failproofai 1.0.4-beta.2 → 1.0.4-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js +2 -2
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +5 -5
- package/.next/standalone/.next/server/app/audit/page.js +3 -3
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +2 -2
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +4 -4
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +3 -3
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +4 -4
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +3 -3
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1lh7m5d._.js → [externals]__0v1hz15._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1rqkg_y._.js → [externals]__1nb206a._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rv7m0k._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1legmza._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1p-qi2t._.js +1 -1
- package/.next/standalone/.next/server/chunks/{_08w6xzm._.js → _0otft92._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +4 -4
- package/.next/standalone/.next/server/chunks/_1vslkoe._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0p-5p8u._.js → [root-of-the-server]__0-4ja6q._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1p2otjt._.js → [root-of-the-server]__00cr3xu._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__013jr2b._.js → [root-of-the-server]__04px77e._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__190won8._.js → [root-of-the-server]__0dxf928._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0s740oi._.js → [root-of-the-server]__0egr5s1._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__01wy8d-._.js → [root-of-the-server]__0i0l1di._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0n_lxhg._.js → [root-of-the-server]__0kokc8z._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1ctpynv._.js → [root-of-the-server]__0n2txhk._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02npjtd._.js → [root-of-the-server]__0r3c1_0._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ftmoxc._.js → [root-of-the-server]__17xnxlx._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0da85px._.js → [root-of-the-server]__1ckpmkk._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00-s7h8._.js → [root-of-the-server]__1fvfw59._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ui5ur8._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_02b3i98._.js +23 -0
- package/.next/standalone/.next/server/chunks/ssr/{_0oq1dh6._.js → _04ng_6x._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_1u8-lu2._.js → _07t3jol._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0h_douw._.js → _0s-77v5._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1_ozgif._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1es2j7i._.js +4 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +22 -22
- package/.next/standalone/.next/static/chunks/{1pb1oztsbwcss.js → 07c6l1lq5_69b.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0o-hh5_turzlz.css → 0jpd8dv2vk930.css} +1 -1
- package/.next/standalone/.next/static/chunks/{32spub4wqjem-.js → 12bsgz8czvcnn.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3m4upvybtrexd.js → 1gn08w2pgqh09.js} +1 -1
- package/.next/standalone/.next/static/chunks/{010bv1w6j171t.js → 1xgq22tri86an.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2aquitk72k2op.js → 20xkiqzvfkuvm.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2bi_1y0a_smt7.js → 2a84ug32tzik2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2ej3b8gk5ittu.js → 32m2ryfankf_2.js} +1 -1
- package/.next/standalone/.next/static/chunks/3ioub_lpen-sq.js +1 -0
- package/.next/standalone/.next/static/chunks/{0wz8yftk18ts2.js → 3jxd133cw2vm3.js} +1 -1
- package/.next/standalone/.next/static/chunks/44ncu88eq6z71.js +1 -0
- package/.next/standalone/app/actions/get-leaks.ts +5 -1
- package/.next/standalone/app/actions/update-scheduled-audit.ts +4 -56
- package/.next/standalone/app/api/auth/status/route.ts +3 -2
- package/.next/standalone/app/audit/_components/audit-dashboard.tsx +29 -2
- package/.next/standalone/app/audit/_components/leak-section.tsx +15 -2
- package/.next/standalone/app/audit/audit-styles.css +18 -0
- package/.next/standalone/app/settings/page.tsx +1 -1
- package/.next/standalone/app/settings/settings-client.tsx +13 -39
- package/.next/standalone/lib/auth/api-server-client.ts +6 -6
- package/.next/standalone/lib/codex-sessions.ts +20 -4
- package/.next/standalone/lib/copilot-sessions.ts +32 -1
- package/.next/standalone/lib/cursor-sessions.ts +62 -5
- package/.next/standalone/lib/sqlite-reader.ts +78 -1
- package/.next/standalone/package.json +10 -10
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +1 -1
- package/dist/cli.mjs +1191 -1130
- package/dist/worker.mjs +198 -359
- package/lib/auth/api-server-client.ts +6 -6
- package/lib/codex-sessions.ts +20 -4
- package/lib/copilot-sessions.ts +32 -1
- package/lib/cursor-sessions.ts +62 -5
- package/lib/sqlite-reader.ts +78 -1
- package/package.json +10 -10
- package/pi-extension/index.ts +11 -4
- package/src/audit/cache.ts +6 -0
- package/src/audit/cli-adapters/claude.ts +13 -0
- package/src/audit/cli-login.ts +4 -1
- package/src/audit/cli.ts +67 -51
- package/src/audit/harm-report.ts +12 -6
- package/src/audit/index.ts +151 -8
- package/src/audit/leak-fingerprint.ts +2 -4
- package/src/audit/leak-record.ts +13 -9
- package/src/audit/leak-scan.ts +20 -44
- package/src/audit/leak-store.ts +5 -2
- package/src/audit/machine-store.ts +8 -9
- package/src/audit/macos-notifier.ts +2 -2
- package/src/audit/redact-example.ts +62 -5
- package/src/audit/report-harm.ts +31 -46
- package/src/audit/schedule-cli.ts +17 -33
- package/src/audit/types.ts +11 -0
- package/src/hooks/configure-wizard.ts +28 -0
- package/src/hooks/fp-config.ts +29 -54
- package/src/hooks/handler.ts +1 -59
- package/src/hooks/integrations.ts +4 -1
- package/src/hooks/notice.ts +23 -154
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rgu2r3._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0-oij9d._.js +0 -23
- package/.next/standalone/.next/static/chunks/04r6ch8uf_n8m.js +0 -1
- package/.next/standalone/.next/static/chunks/0zebh1n9jkfbt.js +0 -1
- package/src/audit/leak-notice.ts +0 -161
- /package/.next/standalone/.next/static/{aKNv4Kmv98Xpwns0Xa-C- → aeM365dNTtUZOZvNkX8ba}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{aKNv4Kmv98Xpwns0Xa-C- → aeM365dNTtUZOZvNkX8ba}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{aKNv4Kmv98Xpwns0Xa-C- → aeM365dNTtUZOZvNkX8ba}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[35770,a=>{"use strict";a.s(["CopyButton",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call CopyButton() from the server but CopyButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/components/copy-button.tsx","CopyButton")},893,a=>{"use strict";var b=a.i(35770);a.n(b)},19597,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/app/components/lazy-log-viewer.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/components/lazy-log-viewer.tsx","default")},71130,a=>{"use strict";var b=a.i(19597);a.n(b)},41190,a=>{"use strict";var b=a.i(7997),c=a.i(95936),d=a.i(717);let e=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var f=a.i(53808);let g=(a,b)=>{let c=(0,d.forwardRef)(({className:c,...g},h)=>(0,d.createElement)(f.default,{ref:h,iconNode:b,className:((...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim())(`lucide-${e(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...g}));return c.displayName=e(a),c},h=g("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),i=g("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);a.i(70396);var j=a.i(73727),k=a.i(83397),l=a.i(2157),m=a.i(12714),n=a.i(50227),o=a.i(60526),p=a.i(34900),q=a.i(92246);let r=(0,a.i(75818).codexSessionPathsFile)();function s(){try{if(!(0,l.existsSync)(r))return{};return JSON.parse((0,l.readFileSync)(r,"utf-8"))}catch{return{}}}function t(a,b){try{(0,l.mkdirSync)((0,n.dirname)(r),{recursive:!0});let c=s();c[a]=b,(0,l.writeFileSync)(r,JSON.stringify(c),"utf-8")}catch{}}function u(a,b){try{for(let c of(0,l.readdirSync)(a,{withFileTypes:!0}))if(c.isFile()&&c.name.includes(b)&&c.name.endsWith(".jsonl"))return(0,n.join)(a,c.name)}catch{}return null}function v(a,b){return Array.isArray(a)?a.filter(a=>a?.type===b&&"string"==typeof a.text).map(a=>a.text).join("\n"):""}async function w(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=new Map,h=new Map,i=!1;for(let a=0;a<d.length;a++){let j;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let l=d[a];try{j=JSON.parse(l)}catch{continue}let m={...j,_source:b};f.push(m);let n=j.timestamp;if(!n)continue;let o=new Date(n);if(Number.isNaN(o.getTime()))continue;let p=j.type,r=j.payload??{};if("session_meta"===p){let a=r.cwd;"string"!=typeof a||c||(c=a),e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m});continue}if("response_item"===p){let a=r.type;if("message"===a){let a=r.role,c=r.content;if("user"===a||"developer"===a){let d=v(c,"input_text");if(!d)continue;let f="developer"===a?`[developer] ${d}`:d;e.push({type:"user",...(0,k.baseEntry)(m,n,o,b),message:{role:"user",content:f}});continue}if("assistant"===a){let a=v(c,"output_text");if(!a)continue;let d=[{type:"text",text:a}];e.push({type:"assistant",...(0,k.baseEntry)(m,n,o,b),message:{role:"assistant",content:d}});continue}e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m});continue}if("function_call"===a){let a=r.call_id,c=r.name??"function_call",d={type:"tool_use",id:a??`${n}-${c}`,name:c,input:function(a){if(!a)return{};try{return JSON.parse(a)}catch{return{}}}(r.arguments)},f={type:"assistant",...(0,k.baseEntry)(m,n,o,b),message:{role:"assistant",content:[d]}};e.push(f),a&&(g.set(a,d),h.set(a,o.getTime()));continue}if("function_call_output"===a){let a=r.call_id,c=a?g.get(a):void 0;if(c){let b=h.get(a)??o.getTime(),d=Math.max(0,o.getTime()-b);c.result={timestamp:n,timestampFormatted:(0,k.formatTimestamp)(o),content:"string"==typeof r.output?r.output:JSON.stringify(r.output),durationMs:d,durationFormatted:(0,q.formatDuration)(d)};continue}e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m});continue}e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m});continue}if("event_msg"===p){let a=r.type;if("task_started"===a){let a=i?"Session Resumed":"Session Started";i=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(m,n,o,b),label:a});continue}if("exec_command_end"===a){let a=r.call_id,c=a?g.get(a):void 0;if(c){let b=r.duration,d=b?(b.secs??0)*1e3+Math.round((b.nanos??0)/1e6):Math.max(0,o.getTime()-(h.get(a)??o.getTime())),e=r.aggregated_output;c.result={timestamp:n,timestampFormatted:(0,k.formatTimestamp)(o),content:"string"==typeof e?e:JSON.stringify(e),durationMs:d,durationFormatted:(0,q.formatDuration)(d)};continue}e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m});continue}if("user_message"===a||"agent_message"===a)continue;e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m});continue}e.push({type:"system",...(0,k.baseEntry)(m,n,o,b),raw:m})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function x(a){let b=function(a){let b=s()[a];if(b&&(0,l.existsSync)(b))return b;let c=(0,n.join)((0,o.homedir)(),".codex","sessions"),d=new Date,e=new Date(d.getTime()-864e5);for(let b of[d,e].map(a=>{let b=String(a.getUTCFullYear()),d=String(a.getUTCMonth()+1).padStart(2,"0"),e=String(a.getUTCDate()).padStart(2,"0");return(0,n.join)(c,b,d,e)})){let c=u(b,a);if(c)return t(a,c),c}try{for(let b of(0,l.readdirSync)(c,{withFileTypes:!0}))if(b.isDirectory()){for(let d of(0,l.readdirSync)((0,n.join)(c,b.name),{withFileTypes:!0}))if(d.isDirectory())for(let e of(0,l.readdirSync)((0,n.join)(c,b.name,d.name),{withFileTypes:!0})){if(!e.isDirectory())continue;let f=u((0,n.join)(c,b.name,d.name,e.name),a);if(f)return t(a,f),f}}}catch{}return null}(a);if(!b)return null;let c=await (0,m.readFile)(b,"utf-8"),{entries:d,rawLines:e,cwd:f}=await w(c,"session");return{entries:d,rawLines:e,cwd:f,filePath:b}}let y=(0,p.runtimeCache)(a=>x(a),60,{maxSize:50});function z(a,b){let c=function(a){if(!a)return null;let b=(0,n.resolve)((0,n.join)(process.env.COPILOT_HOME||(0,n.join)((0,o.homedir)(),".copilot"),"session-state")),c=(0,n.resolve)(b,a);return c!==b&&c.startsWith(`${b}${n.sep}`)?c:null}(a);return c?(0,n.join)(c,b):null}async function A(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=new Map,h=new Map,i=!1;for(let a=0;a<d.length;a++){let j;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let l=d[a];try{j=JSON.parse(l)}catch{continue}let m={...j,_source:b};f.push(m);let n=j.timestamp;if(!n)continue;let o=new Date(n);if(Number.isNaN(o.getTime()))continue;let p=o.toISOString(),r=j.type,s=j.data??{};if("session.start"===r){let a=s.context,d=a?.cwd;"string"!=typeof d||c||(c=d);let f=i?"Session Resumed":"Session Started";i=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(m,p,o,b),label:f});continue}if("user.message"===r){let a=s.content??"";if(!a)continue;e.push({type:"user",...(0,k.baseEntry)(m,p,o,b),message:{role:"user",content:a}});continue}if("system.message"===r){e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}if("assistant.message"===r){let a=s.content??"";if(!a){e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}let c=[{type:"text",text:a}];e.push({type:"assistant",...(0,k.baseEntry)(m,p,o,b),message:{role:"assistant",content:c}});continue}if("tool.execution_start"===r){let a=s.toolCallId,c=s.toolName??"tool",d=s.arguments??{},f={type:"tool_use",id:a??`${o.getTime()}-${c}`,name:c,input:d},i={type:"assistant",...(0,k.baseEntry)(m,p,o,b),message:{role:"assistant",content:[f]}};e.push(i),a&&(g.set(a,f),h.set(a,o.getTime()));continue}if("tool.execution_complete"===r){let a=s.toolCallId,c=a?g.get(a):void 0;if(c){let b=h.get(a)??o.getTime(),d=s.result??{},e=s.toolTelemetry??{},f=e.metrics?.commandTimeMs??e.metrics?.durationMs??null,g="number"==typeof f&&f>=0?f:Math.max(0,o.getTime()-b),i=d.detailedContent??d.content??"";c.result={timestamp:p,timestampFormatted:(0,k.formatTimestamp)(o),content:"string"==typeof i?i:JSON.stringify(i),durationMs:g,durationFormatted:(0,q.formatDuration)(g)};continue}e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function B(a){let b,c,d=(c=z(a,"events.jsonl"))&&(0,l.existsSync)(c)?c:null;if(!d)return null;try{b=await (0,m.readFile)(d,"utf-8")}catch{return null}let{entries:e,rawLines:f,cwd:g}=await A(b,"session");return{entries:e,rawLines:f,cwd:g??function(a){let b,c=(b=z(a,"workspace.yaml"))&&(0,l.existsSync)(b)?b:null;if(c)try{let a=(0,l.readFileSync)(c,"utf-8"),b=RegExp("^cwd\\s*:\\s*(.+?)\\s*$","m"),d=a.match(b);if(!d)return;return d[1].replace(/^['"]|['"]$/g,"")}catch{return}}(a),filePath:d}}let C=(0,p.runtimeCache)(a=>B(a),60,{maxSize:50}),D=["agent-sessions","conversations","sessions"],E=["events.jsonl","transcript.jsonl","messages.jsonl"],F="agent-transcripts";async function G(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=new Map,h=new Map,i=!1,j=Date.now();for(let a=0;a<d.length;a++){let l;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let m=d[a];try{l=JSON.parse(m)}catch{continue}let n={...l,_source:b};if(f.push(n),!l.type&&l.role&&l.message?.content){let c=new Date(j+a),d=c.toISOString(),f=l.message.content.filter(a=>a?.type==="text"&&"string"==typeof a.text).map(a=>a.text).join("");if("user"===l.role){let a=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(f),g=a?a[1]:f;g&&e.push({type:"user",...(0,k.baseEntry)(n,d,c,b),message:{role:"user",content:g}});continue}if("assistant"===l.role){let a=f?[{type:"text",text:f}]:[];0===a.length?e.push({type:"system",...(0,k.baseEntry)(n,d,c,b),raw:n}):e.push({type:"assistant",...(0,k.baseEntry)(n,d,c,b),message:{role:"assistant",content:a}});continue}e.push({type:"system",...(0,k.baseEntry)(n,d,c,b),raw:n});continue}let o=l.timestamp;if(!o)continue;let p=new Date(o);if(Number.isNaN(p.getTime()))continue;let r=p.toISOString(),s=l.type,t=l.data??{};if("session.start"===s||"sessionStart"===s||"session_start"===s){let a=t.context??t,d=a.cwd;"string"!=typeof d||c||(c=d),!c&&Array.isArray(a.workspace_roots)&&"string"==typeof a.workspace_roots[0]&&(c=a.workspace_roots[0]);let f=i?"Session Resumed":"Session Started";i=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(n,r,p,b),label:f});continue}if("user.message"===s||"userMessage"===s){let a="string"==typeof t.content?t.content:"string"==typeof t.text?t.text:"";if(!a)continue;e.push({type:"user",...(0,k.baseEntry)(n,r,p,b),message:{role:"user",content:a}});continue}if("system.message"===s||"systemMessage"===s){e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n});continue}if("assistant.message"===s||"assistantMessage"===s){let a="string"==typeof t.content?t.content:"string"==typeof t.text?t.text:"";if(!a){e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n});continue}let c=[{type:"text",text:a}];e.push({type:"assistant",...(0,k.baseEntry)(n,r,p,b),message:{role:"assistant",content:c}});continue}if("tool.execution_start"===s||"tool.executionStart"===s||"preToolUse"===s){let a=t.toolCallId??t.tool_use_id,c=t.toolName??t.tool_name??"tool",d=t.arguments??t.tool_input??{},f={type:"tool_use",id:a??`${p.getTime()}-${c}`,name:c,input:d},i={type:"assistant",...(0,k.baseEntry)(n,r,p,b),message:{role:"assistant",content:[f]}};e.push(i),a&&(g.set(a,f),h.set(a,p.getTime()));continue}if("tool.execution_complete"===s||"tool.executionComplete"===s||"postToolUse"===s){let a=t.toolCallId??t.tool_use_id,c=a?g.get(a):void 0;if(c){let b=h.get(a)??p.getTime(),d=t.result??{},e=t.duration,f="number"==typeof e&&e>=0?e:Math.max(0,p.getTime()-b),g=d.detailedContent??d.content??t.tool_output??"";c.result={timestamp:r,timestampFormatted:(0,k.formatTimestamp)(p),content:"string"==typeof g?g:JSON.stringify(g),durationMs:f,durationFormatted:(0,q.formatDuration)(f)};continue}e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n});continue}e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function H(a){let b,c=function(a){let b=function(a){if(!a)return null;let b=(0,n.resolve)(process.env.CURSOR_HOME||(0,n.join)((0,o.homedir)(),".cursor")),c=(0,n.resolve)(b,"projects"),d=[];try{d=(0,l.readdirSync)(c,{withFileTypes:!0})}catch{}for(let b of d){if(!b.isDirectory())continue;let d=(0,n.resolve)(c,b.name,F,a),e=(0,n.resolve)(c,b.name,F);if(d!==e&&d.startsWith(`${e}${n.sep}`)&&(0,l.existsSync)(d))return d}for(let c of D){let d=(0,n.resolve)(b,c),e=(0,n.resolve)(d,a);if(e!==d&&e.startsWith(`${d}${n.sep}`)&&(0,l.existsSync)(e))return e}return null}(a);if(!b)return null;let c=(0,n.join)(b,`${(0,n.basename)(b)}.jsonl`);if((0,l.existsSync)(c))return c;for(let a of E){let c=(0,n.join)(b,a);if((0,l.existsSync)(c))return c}return null}(a);if(!c)return null;try{b=await (0,m.readFile)(c,"utf-8")}catch{return null}let{entries:d,rawLines:e,cwd:f}=await G(b,"session");return{entries:d,rawLines:e,cwd:f,filePath:c}}let I=(0,p.runtimeCache)(a=>H(a),60,{maxSize:50});var J=a.i(84794);function K(a){try{return a()}catch{return null}}function L(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}function M(a){if("string"!=typeof a||0===a.length)return null;try{let b=JSON.parse(a);return L(b)?b:null}catch{return null}}async function N(a){if(!a||!/^[A-Za-z0-9_-]+$/.test(a))return null;let b=await (0,J.withOpenCodeDb)(b=>({sessions:K(()=>b.query("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = ?",[a])),messages:K(()=>b.query("SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = ? ORDER BY time_created ASC",[a])),parts:K(()=>b.query("SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = ? ORDER BY time_created ASC",[a]))})),c=b?.sessions??null;if(!c||0===c.length)return null;let d=c[0],e=b?.messages??null,f=b?.parts??null;if(!e)return{entries:[],rawLines:[],cwd:d.directory??void 0,filePath:`opencode://${a}`};let g=new Map;for(let a of f??[]){let b=g.get(a.message_id);b||(b=[],g.set(a.message_id,b)),b.push(a)}let h=[],i=[];for(let a of e){let b=g.get(a.id)??[];h.push(function(a,b,c){let d=M(a.data)??{},e="string"==typeof d.role?d.role:"system",f=new Date(a.time_created),g=f.toISOString(),h={uuid:a.id,parentUuid:null},i=(0,k.baseEntry)(h,g,f,c),j=[],l="";for(let a of b){let b=M(a.data);if(!b)continue;let c="string"==typeof b.type?b.type:"unknown";if("text"===c){let a="string"==typeof b.text?b.text:"string"==typeof b.content?b.content:"";a&&(j.push({type:"text",text:a}),l+=(l?"\n":"")+a);continue}if("tool"===c){let c="string"==typeof b.tool?b.tool:"string"==typeof b.name?b.name:"tool",d=L(b.state)?b.state:null,e=d&&L(d.input)?d.input:L(b.input)?b.input:L(b.args)?b.args:{},f={type:"tool_use",id:a.id,name:c,input:e},g=d&&"string"==typeof d.status?d.status:"";if(d&&("completed"===g||"error"===g)){let b=("error"===g&&"string"==typeof d.error?d.error:null)??d.output,c="string"==typeof b?b:null!=b?JSON.stringify(b):"",e=L(d.time)?d.time:{},h="number"==typeof e.start?e.start:a.time_created,i="number"==typeof e.end?e.end:a.time_updated,j=Math.max(0,i-h),l=new Date(i);f.result={timestamp:l.toISOString(),timestampFormatted:(0,k.formatTimestamp)(l),content:c,durationMs:j,durationFormatted:(0,q.formatDuration)(j)}}j.push(f);continue}j.push({type:"text",text:`[opencode ${c}]`})}if("user"===e)return{...i,type:"user",message:{role:"user",content:l}};if("assistant"===e){let a=L(d.model)?d.model:null,b=a&&"string"==typeof a.modelID?a.modelID:void 0;return{...i,type:"assistant",message:{role:"assistant",content:j,model:b}}}return{...i,type:"system",raw:{id:a.id,role:e,parts:j}}}(a,b,"session"));let c=M(a.data);i.push({id:a.id,session_id:a.session_id,time_created:a.time_created,data:c??a.data})}return{entries:h,rawLines:i,cwd:d.directory??void 0,filePath:`opencode://${a}`}}let O=(0,p.runtimeCache)(a=>N(a),30,{maxSize:50}),P=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Q=/^[\d-]+T[\d-]+Z_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i;function R(a){if(!Array.isArray(a))return"";let b=[];for(let c of a)c?.type==="text"&&"string"==typeof c.text&&b.push(c.text);return b.join("\n\n")}async function S(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=!1,h=new Map,i=new Map;for(let a=0;a<d.length;a++){let j;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let l=d[a];try{j=JSON.parse(l)}catch{continue}let m={...j,_source:b};f.push(m);let n=j.timestamp;if(!n)continue;let o=new Date(n);if(Number.isNaN(o.getTime()))continue;let p=o.toISOString(),r=j.type;if("session"===r){"string"!=typeof j.cwd||c||(c=j.cwd);let a=g?"Session Resumed":"Session Started";g=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(m,p,o,b),label:a});continue}if("message"===r&&j.message&&"object"==typeof j.message){let a=j.message.role,c=j.message.content;if("user"===a){let a=R(c);if(!a)continue;e.push({type:"user",...(0,k.baseEntry)(m,p,o,b),message:{role:"user",content:a}});continue}if("assistant"===a){let a=function(a,b){if(!Array.isArray(a))return[];let c=[];for(let d of a)if(d?.type==="text"&&"string"==typeof d.text&&d.text.length>0&&c.push({type:"text",text:d.text}),d?.type==="thinking"&&"string"==typeof d.thinking&&d.thinking.length>0&&c.push({type:"text",text:`[thinking] ${d.thinking}`}),d?.type==="toolCall"){let a="string"==typeof d.id&&d.id.length>0?d.id:`${"string"==typeof d.name?d.name:"tool"}-${c.length}`,e={type:"tool_use",id:a,name:"string"==typeof d.name?d.name:"tool",input:d.arguments&&"object"==typeof d.arguments&&!Array.isArray(d.arguments)?d.arguments:{}};c.push(e),b?.(e)}return c}(c,a=>{h.set(a.id,a),i.set(a.id,o.getTime())});if(0===a.length){e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}e.push({type:"assistant",...(0,k.baseEntry)(m,p,o,b),message:{role:"assistant",content:a}});continue}if("toolResult"===a){let a=j.message.toolCallId,b="string"==typeof a?h.get(a):void 0;if(b){let d="string"==typeof a&&i.get(a)||o.getTime(),e=Math.max(0,o.getTime()-d);b.result={timestamp:p,timestampFormatted:(0,k.formatTimestamp)(o),content:R(c),durationMs:e,durationFormatted:(0,q.formatDuration)(e)};continue}}e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function T(a){let b,c,d=function(a){let b;if(!P.test(a))return null;let c=(0,n.resolve)(process.env.PI_SESSIONS_DIR||(0,n.join)((0,o.homedir)(),".pi","agent","sessions"));try{b=(0,l.readdirSync)(c)}catch{return null}for(let d of b){let b,e=(0,n.resolve)(c,d);if(e.startsWith(`${c}${n.sep}`)){try{b=(0,l.readdirSync)(e)}catch{continue}for(let c of b){let b=Q.exec(c);if(!b||b[1].toLowerCase()!==a.toLowerCase())continue;let d=(0,n.resolve)(e,c);if(d.startsWith(`${e}${n.sep}`)&&(0,l.existsSync)(d))return d}}}return null}(a);if(!d)return null;try{b=await (0,m.readFile)(d,"utf-8")}catch{return null}try{c=await S(b,"session")}catch{return null}return{entries:c.entries,rawLines:c.rawLines,cwd:c.cwd,filePath:d}}let U=(0,p.runtimeCache)(a=>T(a),60,{maxSize:50});var V=a.i(54563),W=a.i(87488),X=a.i(89901),Y=a.i(33559),Z=a.i(99910),$=a.i(74615),_=a.i(90798),aa=a.i(69191),ab=a.i(71130),ac=a.i(893),ad=a.i(24282);function ae({cli:a}){let c=(0,ad.getCliLabel)(a),d=(0,ad.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-mono font-medium uppercase tracking-wider border ${d}`,title:`Agent CLI: ${c}`,children:c})}async function af({params:a}){let d,e,{name:f,sessionId:g}=await a;try{(0,aa.resolveProjectPath)(f)}catch{(0,j.notFound)()}let l=(0,_.decodeFolderName)(f),m=-1===(e=g.indexOf("/"))?g:g.slice(0,e);aa.UUID_RE.test(m)||/^ses_[A-Za-z0-9]+$/.test(m)||/^[A-Za-z0-9_-]+$/.test(m)||(0,j.notFound)();let n=null,o=null,p=null,q="claude";try{let a=await (0,k.getCachedSessionLog)(f,m);n=a.entries,o=a.rawLines}catch(a){if("ENOENT"===a.code){let a=await y(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="codex";else{let a=await C(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="copilot";else{let a=await I(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="cursor";else{let a=await O(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="opencode";else{let a=await U(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="pi";else{let a=await (0,V.getCachedHermesSessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="hermes";else{let a=await (0,W.getCachedOpenClawSessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="openclaw";else{let a=await (0,X.getCachedFactorySessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="factory";else{let a=await (0,Y.getCachedDevinSessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="devin";else{let a=await (0,Z.getCachedAntigravitySessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="antigravity";else{let a=await (0,$.getCachedGooseSessionLog)(m);a?(n=a.entries,o=a.rawLines,d=a.cwd,q="goose"):p="Session log file not found."}}}}}}}}}}}else p="Failed to read session log."}let r="claude"!==q,s="codex"===q?`OpenAI Codex${d?` \xb7 ${d}`:""}`:"copilot"===q?`GitHub Copilot${d?` \xb7 ${d}`:""}`:"cursor"===q?`Cursor Agent${d?` \xb7 ${d}`:""}`:"opencode"===q?`OpenCode${d?` \xb7 ${d}`:""}`:"pi"===q?`Pi${d?` \xb7 ${d}`:""}`:"hermes"===q?`Hermes${d?` \xb7 ${d}`:""}`:"openclaw"===q?`OpenClaw${d?` \xb7 ${d}`:""}`:"factory"===q?`Factory Droid${d?` \xb7 ${d}`:""}`:"devin"===q?`Devin CLI${d?` \xb7 ${d}`:""}`:"antigravity"===q?`Antigravity CLI${d?` \xb7 ${d}`:""}`:"goose"===q?`Goose${d?` \xb7 ${d}`:""}`:l;return(0,b.jsx)("main",{className:"min-h-screen bg-background",children:(0,b.jsxs)("div",{className:"container mx-auto p-8",children:[(0,b.jsxs)(c.default,{href:r?"/policies?tab=activity":`/project/${encodeURIComponent(f)}`,className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground mb-6 transition-colors",children:[(0,b.jsx)(h,{className:"w-4 h-4"}),(0,b.jsx)("span",{children:r?"Back to Activity":"Back to Sessions"})]}),(0,b.jsxs)("div",{className:"mb-8",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-2",children:[(0,b.jsx)("h1",{className:"text-4xl font-bold text-foreground",children:"Session Log"}),(0,b.jsx)(ae,{cli:q})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"text-muted-foreground",children:[(0,b.jsxs)("span",{className:"font-medium",children:[r?"CLI":"Project",":"]})," ",s]}),(0,b.jsxs)("p",{className:"text-muted-foreground break-words break-all inline-flex items-center gap-1",children:[(0,b.jsx)("span",{className:"font-medium",children:"Session:"})," ",m,(0,b.jsx)(ac.CopyButton,{text:m})]}),n&&o&&(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("p",{className:"text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium",children:o.length})," log lines"]}),(0,b.jsxs)("a",{href:`/api/download/${encodeURIComponent(f)}/${encodeURIComponent(m)}?cli=${q}`,download:!0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground transition-colors",children:[(0,b.jsx)(i,{className:"w-4 h-4"}),"Download Logs"]})]})]})]}),p&&(0,b.jsx)("div",{className:"bg-card text-card-foreground rounded-lg border border-destructive/50 p-6 shadow-sm",children:(0,b.jsx)("p",{className:"text-destructive text-center py-8",children:p})}),!p&&n&&(0,b.jsx)(ab.default,{entries:n,projectName:r?d??("codex"===q?"OpenAI Codex":"copilot"===q?"GitHub Copilot":"cursor"===q?"Cursor Agent":"opencode"===q?"OpenCode":"pi"===q?"Pi":"hermes"===q?"Hermes":"openclaw"===q?"OpenClaw":"factory"===q?"Factory Droid":"devin"===q?"Devin CLI":"Antigravity CLI"):l,sessionId:m})]})})}a.s(["default",0,af,"dynamic",0,"force-dynamic"],41190)},87330,function(a){a.n(a.i(41190))},90697,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/node_modules/lucide-react/dist/esm/Icon.mjs from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/node_modules/lucide-react/dist/esm/Icon.mjs","default")},53808,a=>{"use strict";var b=a.i(90697);a.n(b)}];
|
|
1
|
+
module.exports=[35770,a=>{"use strict";a.s(["CopyButton",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call CopyButton() from the server but CopyButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/components/copy-button.tsx","CopyButton")},893,a=>{"use strict";var b=a.i(35770);a.n(b)},19597,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/app/components/lazy-log-viewer.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/components/lazy-log-viewer.tsx","default")},71130,a=>{"use strict";var b=a.i(19597);a.n(b)},41190,a=>{"use strict";var b=a.i(7997),c=a.i(95936),d=a.i(717);let e=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var f=a.i(53808);let g=(a,b)=>{let c=(0,d.forwardRef)(({className:c,...g},h)=>(0,d.createElement)(f.default,{ref:h,iconNode:b,className:((...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim())(`lucide-${e(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...g}));return c.displayName=e(a),c},h=g("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),i=g("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);a.i(70396);var j=a.i(73727),k=a.i(83397),l=a.i(2157),m=a.i(12714),n=a.i(50227),o=a.i(60526),p=a.i(34900),q=a.i(92246);let r=(0,a.i(75818).codexSessionPathsFile)();function s(){try{if(!(0,l.existsSync)(r))return{};return JSON.parse((0,l.readFileSync)(r,"utf-8"))}catch{return{}}}function t(a,b){try{(0,l.mkdirSync)((0,n.dirname)(r),{recursive:!0});let c=s();c[a]=b,(0,l.writeFileSync)(r,JSON.stringify(c),"utf-8")}catch{}}function u(a,b){try{for(let c of(0,l.readdirSync)(a,{withFileTypes:!0}))if(c.isFile()&&c.name.includes(b)&&c.name.endsWith(".jsonl"))return(0,n.join)(a,c.name)}catch{}return null}function v(a,b){return Array.isArray(a)?a.filter(a=>a?.type===b&&"string"==typeof a.text).map(a=>a.text).join("\n"):""}async function w(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=new Map,h=new Map,i=!1;for(let a=0;a<d.length;a++){let l;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let m=d[a];try{l=JSON.parse(m)}catch{continue}let n={...l,_source:b};f.push(n);let o=l.timestamp;if(!o)continue;let p=new Date(o);if(Number.isNaN(p.getTime()))continue;let r=l.type,s=l.payload??{};if("session_meta"===r){let a=s.cwd;"string"!=typeof a||c||(c=a),e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n});continue}if("response_item"===r){let a=s.type;if("message"===a){let a=s.role,c=s.content;if("user"===a||"developer"===a){let d=v(c,"input_text");if(!d)continue;let f="developer"===a?`[developer] ${d}`:d;e.push({type:"user",...(0,k.baseEntry)(n,o,p,b),message:{role:"user",content:f}});continue}if("assistant"===a){let a=v(c,"output_text");if(!a)continue;let d=[{type:"text",text:a}];e.push({type:"assistant",...(0,k.baseEntry)(n,o,p,b),message:{role:"assistant",content:d}});continue}e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n});continue}if("function_call"===a||"custom_tool_call"===a){let a=s.call_id,c=s.name??"function_call",d={type:"tool_use",id:a??`${o}-${c}`,name:c,input:function(a){if(!a)return{};try{return JSON.parse(a)}catch{return{}}}(s.arguments??s.input)},f={type:"assistant",...(0,k.baseEntry)(n,o,p,b),message:{role:"assistant",content:[d]}};e.push(f),a&&(g.set(a,d),h.set(a,p.getTime()));continue}if("function_call_output"===a||"custom_tool_call_output"===a){let a=s.call_id,c=a?g.get(a):void 0;if(c){var j;let b=h.get(a)??p.getTime(),d=Math.max(0,p.getTime()-b);c.result={timestamp:o,timestampFormatted:(0,k.formatTimestamp)(p),content:"string"==typeof(j=s.output)?j:Array.isArray(j)?j.filter(a=>!!a&&"object"==typeof a).map(a=>"string"==typeof a.text?a.text:"").filter(Boolean).join("\n"):void 0===j?"":JSON.stringify(j),durationMs:d,durationFormatted:(0,q.formatDuration)(d)};continue}e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n});continue}e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n});continue}if("event_msg"===r){let a=s.type;if("task_started"===a){let a=i?"Session Resumed":"Session Started";i=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(n,o,p,b),label:a});continue}if("exec_command_end"===a){let a=s.call_id,c=a?g.get(a):void 0;if(c){let b=s.duration,d=b?(b.secs??0)*1e3+Math.round((b.nanos??0)/1e6):Math.max(0,p.getTime()-(h.get(a)??p.getTime())),e=s.aggregated_output;c.result={timestamp:o,timestampFormatted:(0,k.formatTimestamp)(p),content:"string"==typeof e?e:JSON.stringify(e),durationMs:d,durationFormatted:(0,q.formatDuration)(d)};continue}e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n});continue}if("user_message"===a||"agent_message"===a)continue;e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n});continue}e.push({type:"system",...(0,k.baseEntry)(n,o,p,b),raw:n})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function x(a){let b=function(a){let b=s()[a];if(b&&(0,l.existsSync)(b))return b;let c=(0,n.join)((0,o.homedir)(),".codex","sessions"),d=new Date,e=new Date(d.getTime()-864e5);for(let b of[d,e].map(a=>{let b=String(a.getUTCFullYear()),d=String(a.getUTCMonth()+1).padStart(2,"0"),e=String(a.getUTCDate()).padStart(2,"0");return(0,n.join)(c,b,d,e)})){let c=u(b,a);if(c)return t(a,c),c}try{for(let b of(0,l.readdirSync)(c,{withFileTypes:!0}))if(b.isDirectory()){for(let d of(0,l.readdirSync)((0,n.join)(c,b.name),{withFileTypes:!0}))if(d.isDirectory())for(let e of(0,l.readdirSync)((0,n.join)(c,b.name,d.name),{withFileTypes:!0})){if(!e.isDirectory())continue;let f=u((0,n.join)(c,b.name,d.name,e.name),a);if(f)return t(a,f),f}}}catch{}return null}(a);if(!b)return null;let c=await (0,m.readFile)(b,"utf-8"),{entries:d,rawLines:e,cwd:f}=await w(c,"session");return{entries:d,rawLines:e,cwd:f,filePath:b}}let y=(0,p.runtimeCache)(a=>x(a),60,{maxSize:50});function z(a,b){let c=function(a){if(!a)return null;let b=(0,n.resolve)((0,n.join)(process.env.COPILOT_HOME||(0,n.join)((0,o.homedir)(),".copilot"),"session-state")),c=(0,n.resolve)(b,a);return c!==b&&c.startsWith(`${b}${n.sep}`)?c:null}(a);return c?(0,n.join)(c,b):null}async function A(a,b="session"){let c,d,e=a.split("\n").filter(a=>""!==a.trim()),f=[],g=[],h=new Map,i=new Map,j=0,l=!1;for(let a=0;a<e.length;a++){let m;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let n=e[a];try{m=JSON.parse(n)}catch{continue}let o={...m,_source:b};g.push(o);let p=m.timestamp;if(!p)continue;let r=new Date(p);if(Number.isNaN(r.getTime()))continue;let s=r.toISOString(),t=m.type,u=m.data??{};if("session.start"===t){let a=u.context,c=a?.cwd;"string"!=typeof c||d||(d=c);let e=l?"Session Resumed":"Session Started";l=!0,f.push({type:"queue-operation",...(0,k.baseEntry)(o,s,r,b),label:e});continue}if("user.message"===t){let a=u.content??"";if(!a)continue;f.push({type:"user",...(0,k.baseEntry)(o,s,r,b),message:{role:"user",content:a}});continue}if("system.message"===t){f.push({type:"system",...(0,k.baseEntry)(o,s,r,b),raw:o});continue}if("assistant.message"===t){let a=u.content??"";if(!a){f.push({type:"system",...(0,k.baseEntry)(o,s,r,b),raw:o});continue}let c=[{type:"text",text:a}];f.push({type:"assistant",...(0,k.baseEntry)(o,s,r,b),message:{role:"assistant",content:c}});continue}if("tool.execution_start"===t){let a=u.toolCallId,d=u.toolName??"tool",e=u.arguments??{},g={type:"tool_use",id:a??`${r.getTime()}-${d}`,name:d,input:e},l={type:"assistant",...(0,k.baseEntry)(o,s,r,b),message:{role:"assistant",content:[g]}};f.push(l),a&&(h.set(a,g),i.set(a,r.getTime())),c=g,j=r.getTime();continue}if("hook.start"===t&&"postToolUse"===u.hookType&&c){let a=(u.input??{}).toolResult??{},b=a.textResultForLlm??a.sessionLog;"string"==typeof b&&b.length>0&&(c.result={timestamp:s,timestampFormatted:(0,k.formatTimestamp)(r),content:b,durationMs:Math.max(0,r.getTime()-j),durationFormatted:(0,q.formatDuration)(Math.max(0,r.getTime()-j))})}if("tool.execution_complete"===t){let a=u.toolCallId,c=a?h.get(a):void 0;if(c){let b=i.get(a)??r.getTime(),d=u.result??{},e=u.toolTelemetry??{},f=e.metrics?.commandTimeMs??e.metrics?.durationMs??null,g="number"==typeof f&&f>=0?f:Math.max(0,r.getTime()-b),h=d.detailedContent??d.content??"",j=c.result?.content||h;c.result={timestamp:s,timestampFormatted:(0,k.formatTimestamp)(r),content:"string"==typeof j?j:JSON.stringify(j),durationMs:g,durationFormatted:(0,q.formatDuration)(g)};continue}f.push({type:"system",...(0,k.baseEntry)(o,s,r,b),raw:o});continue}f.push({type:"system",...(0,k.baseEntry)(o,s,r,b),raw:o})}return f.length>500&&await new Promise(a=>setImmediate(a)),f.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:f,rawLines:g,cwd:d}}async function B(a){let b,c,d=(c=z(a,"events.jsonl"))&&(0,l.existsSync)(c)?c:null;if(!d)return null;try{b=await (0,m.readFile)(d,"utf-8")}catch{return null}let{entries:e,rawLines:f,cwd:g}=await A(b,"session");return{entries:e,rawLines:f,cwd:g??function(a){let b,c=(b=z(a,"workspace.yaml"))&&(0,l.existsSync)(b)?b:null;if(c)try{let a=(0,l.readFileSync)(c,"utf-8"),b=RegExp("^cwd\\s*:\\s*(.+?)\\s*$","m"),d=a.match(b);if(!d)return;return d[1].replace(/^['"]|['"]$/g,"")}catch{return}}(a),filePath:d}}let C=(0,p.runtimeCache)(a=>B(a),60,{maxSize:50}),D=["agent-sessions","conversations","sessions"],E=["events.jsonl","transcript.jsonl","messages.jsonl"],F="agent-transcripts";async function G(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=new Map,h=new Map,i=!1,j=Date.now();for(let a=0;a<d.length;a++){let l;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let m=d[a];try{l=JSON.parse(m)}catch{continue}let n={...l,_source:b};if(f.push(n),!l.type&&l.role&&l.message?.content){let c=new Date(j+a),d=c.toISOString(),f=l.message.content,i=f.filter(a=>a?.type==="text"&&"string"==typeof a.text).map(a=>a.text).join("");if("user"===l.role){let a=!1;for(let b of f){if(b?.type!=="tool_result")continue;let e="string"==typeof b.tool_use_id?b.tool_use_id:void 0,f=e?g.get(e):void 0;if(!f)continue;let i=Math.max(0,c.getTime()-(h.get(e)??c.getTime()));f.result={timestamp:d,timestampFormatted:(0,k.formatTimestamp)(c),content:"string"==typeof b.content?b.content:null==b.content?"":JSON.stringify(b.content),durationMs:i,durationFormatted:(0,q.formatDuration)(i)},a=!0}let j=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(i),l=j?j[1]:i;l?e.push({type:"user",...(0,k.baseEntry)(n,d,c,b),message:{role:"user",content:l}}):a||e.push({type:"system",...(0,k.baseEntry)(n,d,c,b),raw:n});continue}if("assistant"===l.role){let j=[];i&&j.push({type:"text",text:i});for(let b=0;b<f.length;b++){let d=f[b];if(d?.type!=="tool_use")continue;let e="string"==typeof d.name?d.name:"tool",i="string"==typeof d.id&&d.id?d.id:`cursor-${a}-${e}-${b}`,k={type:"tool_use",id:i,name:e,input:d.input&&"object"==typeof d.input?d.input:{}};j.push(k),g.set(i,k),h.set(i,c.getTime())}0===j.length?e.push({type:"system",...(0,k.baseEntry)(n,d,c,b),raw:n}):e.push({type:"assistant",...(0,k.baseEntry)(n,d,c,b),message:{role:"assistant",content:j}});continue}e.push({type:"system",...(0,k.baseEntry)(n,d,c,b),raw:n});continue}let o=l.timestamp;if(!o)continue;let p=new Date(o);if(Number.isNaN(p.getTime()))continue;let r=p.toISOString(),s=l.type,t=l.data??{};if("session.start"===s||"sessionStart"===s||"session_start"===s){let a=t.context??t,d=a.cwd;"string"!=typeof d||c||(c=d),!c&&Array.isArray(a.workspace_roots)&&"string"==typeof a.workspace_roots[0]&&(c=a.workspace_roots[0]);let f=i?"Session Resumed":"Session Started";i=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(n,r,p,b),label:f});continue}if("user.message"===s||"userMessage"===s){let a="string"==typeof t.content?t.content:"string"==typeof t.text?t.text:"";if(!a)continue;e.push({type:"user",...(0,k.baseEntry)(n,r,p,b),message:{role:"user",content:a}});continue}if("system.message"===s||"systemMessage"===s){e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n});continue}if("assistant.message"===s||"assistantMessage"===s){let a="string"==typeof t.content?t.content:"string"==typeof t.text?t.text:"";if(!a){e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n});continue}let c=[{type:"text",text:a}];e.push({type:"assistant",...(0,k.baseEntry)(n,r,p,b),message:{role:"assistant",content:c}});continue}if("tool.execution_start"===s||"tool.executionStart"===s||"preToolUse"===s){let a=t.toolCallId??t.tool_use_id,c=t.toolName??t.tool_name??"tool",d=t.arguments??t.tool_input??{},f={type:"tool_use",id:a??`${p.getTime()}-${c}`,name:c,input:d},i={type:"assistant",...(0,k.baseEntry)(n,r,p,b),message:{role:"assistant",content:[f]}};e.push(i),a&&(g.set(a,f),h.set(a,p.getTime()));continue}if("tool.execution_complete"===s||"tool.executionComplete"===s||"postToolUse"===s){let a=t.toolCallId??t.tool_use_id,c=a?g.get(a):void 0;if(c){let b=h.get(a)??p.getTime(),d=t.result??{},e=t.duration,f="number"==typeof e&&e>=0?e:Math.max(0,p.getTime()-b),g=d.detailedContent??d.content??t.tool_output??"";c.result={timestamp:r,timestampFormatted:(0,k.formatTimestamp)(p),content:"string"==typeof g?g:JSON.stringify(g),durationMs:f,durationFormatted:(0,q.formatDuration)(f)};continue}e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n});continue}e.push({type:"system",...(0,k.baseEntry)(n,r,p,b),raw:n})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function H(a){let b,c=function(a){let b=function(a){if(!a)return null;let b=(0,n.resolve)(process.env.CURSOR_HOME||(0,n.join)((0,o.homedir)(),".cursor")),c=(0,n.resolve)(b,"projects"),d=[];try{d=(0,l.readdirSync)(c,{withFileTypes:!0})}catch{}for(let b of d){if(!b.isDirectory())continue;let d=(0,n.resolve)(c,b.name,F,a),e=(0,n.resolve)(c,b.name,F);if(d!==e&&d.startsWith(`${e}${n.sep}`)&&(0,l.existsSync)(d))return d}for(let c of D){let d=(0,n.resolve)(b,c),e=(0,n.resolve)(d,a);if(e!==d&&e.startsWith(`${d}${n.sep}`)&&(0,l.existsSync)(e))return e}return null}(a);if(!b)return null;let c=(0,n.join)(b,`${(0,n.basename)(b)}.jsonl`);if((0,l.existsSync)(c))return c;for(let a of E){let c=(0,n.join)(b,a);if((0,l.existsSync)(c))return c}return null}(a);if(!c)return null;try{b=await (0,m.readFile)(c,"utf-8")}catch{return null}let{entries:d,rawLines:e,cwd:f}=await G(b,"session");return{entries:d,rawLines:e,cwd:f,filePath:c}}let I=(0,p.runtimeCache)(a=>H(a),60,{maxSize:50});var J=a.i(84794);function K(a){try{return a()}catch{return null}}function L(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}function M(a){if("string"!=typeof a||0===a.length)return null;try{let b=JSON.parse(a);return L(b)?b:null}catch{return null}}async function N(a){if(!a||!/^[A-Za-z0-9_-]+$/.test(a))return null;let b=await (0,J.withOpenCodeDb)(b=>({sessions:K(()=>b.query("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = ?",[a])),messages:K(()=>b.query("SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = ? ORDER BY time_created ASC",[a])),parts:K(()=>b.query("SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = ? ORDER BY time_created ASC",[a]))})),c=b?.sessions??null;if(!c||0===c.length)return null;let d=c[0],e=b?.messages??null,f=b?.parts??null;if(!e)return{entries:[],rawLines:[],cwd:d.directory??void 0,filePath:`opencode://${a}`};let g=new Map;for(let a of f??[]){let b=g.get(a.message_id);b||(b=[],g.set(a.message_id,b)),b.push(a)}let h=[],i=[];for(let a of e){let b=g.get(a.id)??[];h.push(function(a,b,c){let d=M(a.data)??{},e="string"==typeof d.role?d.role:"system",f=new Date(a.time_created),g=f.toISOString(),h={uuid:a.id,parentUuid:null},i=(0,k.baseEntry)(h,g,f,c),j=[],l="";for(let a of b){let b=M(a.data);if(!b)continue;let c="string"==typeof b.type?b.type:"unknown";if("text"===c){let a="string"==typeof b.text?b.text:"string"==typeof b.content?b.content:"";a&&(j.push({type:"text",text:a}),l+=(l?"\n":"")+a);continue}if("tool"===c){let c="string"==typeof b.tool?b.tool:"string"==typeof b.name?b.name:"tool",d=L(b.state)?b.state:null,e=d&&L(d.input)?d.input:L(b.input)?b.input:L(b.args)?b.args:{},f={type:"tool_use",id:a.id,name:c,input:e},g=d&&"string"==typeof d.status?d.status:"";if(d&&("completed"===g||"error"===g)){let b=("error"===g&&"string"==typeof d.error?d.error:null)??d.output,c="string"==typeof b?b:null!=b?JSON.stringify(b):"",e=L(d.time)?d.time:{},h="number"==typeof e.start?e.start:a.time_created,i="number"==typeof e.end?e.end:a.time_updated,j=Math.max(0,i-h),l=new Date(i);f.result={timestamp:l.toISOString(),timestampFormatted:(0,k.formatTimestamp)(l),content:c,durationMs:j,durationFormatted:(0,q.formatDuration)(j)}}j.push(f);continue}j.push({type:"text",text:`[opencode ${c}]`})}if("user"===e)return{...i,type:"user",message:{role:"user",content:l}};if("assistant"===e){let a=L(d.model)?d.model:null,b=a&&"string"==typeof a.modelID?a.modelID:void 0;return{...i,type:"assistant",message:{role:"assistant",content:j,model:b}}}return{...i,type:"system",raw:{id:a.id,role:e,parts:j}}}(a,b,"session"));let c=M(a.data);i.push({id:a.id,session_id:a.session_id,time_created:a.time_created,data:c??a.data})}return{entries:h,rawLines:i,cwd:d.directory??void 0,filePath:`opencode://${a}`}}let O=(0,p.runtimeCache)(a=>N(a),30,{maxSize:50}),P=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Q=/^[\d-]+T[\d-]+Z_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i;function R(a){if(!Array.isArray(a))return"";let b=[];for(let c of a)c?.type==="text"&&"string"==typeof c.text&&b.push(c.text);return b.join("\n\n")}async function S(a,b="session"){let c,d=a.split("\n").filter(a=>""!==a.trim()),e=[],f=[],g=!1,h=new Map,i=new Map;for(let a=0;a<d.length;a++){let j;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let l=d[a];try{j=JSON.parse(l)}catch{continue}let m={...j,_source:b};f.push(m);let n=j.timestamp;if(!n)continue;let o=new Date(n);if(Number.isNaN(o.getTime()))continue;let p=o.toISOString(),r=j.type;if("session"===r){"string"!=typeof j.cwd||c||(c=j.cwd);let a=g?"Session Resumed":"Session Started";g=!0,e.push({type:"queue-operation",...(0,k.baseEntry)(m,p,o,b),label:a});continue}if("message"===r&&j.message&&"object"==typeof j.message){let a=j.message.role,c=j.message.content;if("user"===a){let a=R(c);if(!a)continue;e.push({type:"user",...(0,k.baseEntry)(m,p,o,b),message:{role:"user",content:a}});continue}if("assistant"===a){let a=function(a,b){if(!Array.isArray(a))return[];let c=[];for(let d of a)if(d?.type==="text"&&"string"==typeof d.text&&d.text.length>0&&c.push({type:"text",text:d.text}),d?.type==="thinking"&&"string"==typeof d.thinking&&d.thinking.length>0&&c.push({type:"text",text:`[thinking] ${d.thinking}`}),d?.type==="toolCall"){let a="string"==typeof d.id&&d.id.length>0?d.id:`${"string"==typeof d.name?d.name:"tool"}-${c.length}`,e={type:"tool_use",id:a,name:"string"==typeof d.name?d.name:"tool",input:d.arguments&&"object"==typeof d.arguments&&!Array.isArray(d.arguments)?d.arguments:{}};c.push(e),b?.(e)}return c}(c,a=>{h.set(a.id,a),i.set(a.id,o.getTime())});if(0===a.length){e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}e.push({type:"assistant",...(0,k.baseEntry)(m,p,o,b),message:{role:"assistant",content:a}});continue}if("toolResult"===a){let a=j.message.toolCallId,b="string"==typeof a?h.get(a):void 0;if(b){let d="string"==typeof a&&i.get(a)||o.getTime(),e=Math.max(0,o.getTime()-d);b.result={timestamp:p,timestampFormatted:(0,k.formatTimestamp)(o),content:R(c),durationMs:e,durationFormatted:(0,q.formatDuration)(e)};continue}}e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m});continue}e.push({type:"system",...(0,k.baseEntry)(m,p,o,b),raw:m})}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,cwd:c}}async function T(a){let b,c,d=function(a){let b;if(!P.test(a))return null;let c=(0,n.resolve)(process.env.PI_SESSIONS_DIR||(0,n.join)((0,o.homedir)(),".pi","agent","sessions"));try{b=(0,l.readdirSync)(c)}catch{return null}for(let d of b){let b,e=(0,n.resolve)(c,d);if(e.startsWith(`${c}${n.sep}`)){try{b=(0,l.readdirSync)(e)}catch{continue}for(let c of b){let b=Q.exec(c);if(!b||b[1].toLowerCase()!==a.toLowerCase())continue;let d=(0,n.resolve)(e,c);if(d.startsWith(`${e}${n.sep}`)&&(0,l.existsSync)(d))return d}}}return null}(a);if(!d)return null;try{b=await (0,m.readFile)(d,"utf-8")}catch{return null}try{c=await S(b,"session")}catch{return null}return{entries:c.entries,rawLines:c.rawLines,cwd:c.cwd,filePath:d}}let U=(0,p.runtimeCache)(a=>T(a),60,{maxSize:50});var V=a.i(54563),W=a.i(87488),X=a.i(89901),Y=a.i(33559),Z=a.i(99910),$=a.i(74615),_=a.i(90798),aa=a.i(69191),ab=a.i(71130),ac=a.i(893),ad=a.i(24282);function ae({cli:a}){let c=(0,ad.getCliLabel)(a),d=(0,ad.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-mono font-medium uppercase tracking-wider border ${d}`,title:`Agent CLI: ${c}`,children:c})}async function af({params:a}){let d,e,{name:f,sessionId:g}=await a;try{(0,aa.resolveProjectPath)(f)}catch{(0,j.notFound)()}let l=(0,_.decodeFolderName)(f),m=-1===(e=g.indexOf("/"))?g:g.slice(0,e);aa.UUID_RE.test(m)||/^ses_[A-Za-z0-9]+$/.test(m)||/^[A-Za-z0-9_-]+$/.test(m)||(0,j.notFound)();let n=null,o=null,p=null,q="claude";try{let a=await (0,k.getCachedSessionLog)(f,m);n=a.entries,o=a.rawLines}catch(a){if("ENOENT"===a.code){let a=await y(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="codex";else{let a=await C(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="copilot";else{let a=await I(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="cursor";else{let a=await O(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="opencode";else{let a=await U(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="pi";else{let a=await (0,V.getCachedHermesSessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="hermes";else{let a=await (0,W.getCachedOpenClawSessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="openclaw";else{let a=await (0,X.getCachedFactorySessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="factory";else{let a=await (0,Y.getCachedDevinSessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="devin";else{let a=await (0,Z.getCachedAntigravitySessionLog)(m);if(a)n=a.entries,o=a.rawLines,d=a.cwd,q="antigravity";else{let a=await (0,$.getCachedGooseSessionLog)(m);a?(n=a.entries,o=a.rawLines,d=a.cwd,q="goose"):p="Session log file not found."}}}}}}}}}}}else p="Failed to read session log."}let r="claude"!==q,s="codex"===q?`OpenAI Codex${d?` \xb7 ${d}`:""}`:"copilot"===q?`GitHub Copilot${d?` \xb7 ${d}`:""}`:"cursor"===q?`Cursor Agent${d?` \xb7 ${d}`:""}`:"opencode"===q?`OpenCode${d?` \xb7 ${d}`:""}`:"pi"===q?`Pi${d?` \xb7 ${d}`:""}`:"hermes"===q?`Hermes${d?` \xb7 ${d}`:""}`:"openclaw"===q?`OpenClaw${d?` \xb7 ${d}`:""}`:"factory"===q?`Factory Droid${d?` \xb7 ${d}`:""}`:"devin"===q?`Devin CLI${d?` \xb7 ${d}`:""}`:"antigravity"===q?`Antigravity CLI${d?` \xb7 ${d}`:""}`:"goose"===q?`Goose${d?` \xb7 ${d}`:""}`:l;return(0,b.jsx)("main",{className:"min-h-screen bg-background",children:(0,b.jsxs)("div",{className:"container mx-auto p-8",children:[(0,b.jsxs)(c.default,{href:r?"/policies?tab=activity":`/project/${encodeURIComponent(f)}`,className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground mb-6 transition-colors",children:[(0,b.jsx)(h,{className:"w-4 h-4"}),(0,b.jsx)("span",{children:r?"Back to Activity":"Back to Sessions"})]}),(0,b.jsxs)("div",{className:"mb-8",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-2",children:[(0,b.jsx)("h1",{className:"text-4xl font-bold text-foreground",children:"Session Log"}),(0,b.jsx)(ae,{cli:q})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"text-muted-foreground",children:[(0,b.jsxs)("span",{className:"font-medium",children:[r?"CLI":"Project",":"]})," ",s]}),(0,b.jsxs)("p",{className:"text-muted-foreground break-words break-all inline-flex items-center gap-1",children:[(0,b.jsx)("span",{className:"font-medium",children:"Session:"})," ",m,(0,b.jsx)(ac.CopyButton,{text:m})]}),n&&o&&(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("p",{className:"text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium",children:o.length})," log lines"]}),(0,b.jsxs)("a",{href:`/api/download/${encodeURIComponent(f)}/${encodeURIComponent(m)}?cli=${q}`,download:!0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground transition-colors",children:[(0,b.jsx)(i,{className:"w-4 h-4"}),"Download Logs"]})]})]})]}),p&&(0,b.jsx)("div",{className:"bg-card text-card-foreground rounded-lg border border-destructive/50 p-6 shadow-sm",children:(0,b.jsx)("p",{className:"text-destructive text-center py-8",children:p})}),!p&&n&&(0,b.jsx)(ab.default,{entries:n,projectName:r?d??("codex"===q?"OpenAI Codex":"copilot"===q?"GitHub Copilot":"cursor"===q?"Cursor Agent":"opencode"===q?"OpenCode":"pi"===q?"Pi":"hermes"===q?"Hermes":"openclaw"===q?"OpenClaw":"factory"===q?"Factory Droid":"devin"===q?"Devin CLI":"Antigravity CLI"):l,sessionId:m})]})})}a.s(["default",0,af,"dynamic",0,"force-dynamic"],41190)},87330,function(a){a.n(a.i(41190))},90697,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/node_modules/lucide-react/dist/esm/Icon.mjs from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/node_modules/lucide-react/dist/esm/Icon.mjs","default")},53808,a=>{"use strict";var b=a.i(90697);a.n(b)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_1ddpc5g._.js.map
|
|
@@ -209,7 +209,10 @@ export default async function failproofaiPlugin({ client, directory }) {
|
|
|
209
209
|
const claudeEvent = BUS_EVENT_MAP[event.type];
|
|
210
210
|
if (!claudeEvent) return;
|
|
211
211
|
const props = event.properties || {};
|
|
212
|
-
const
|
|
212
|
+
const info = props.info || props.session || {};
|
|
213
|
+
|
|
214
|
+
const sessionID = info.id || info.sessionID || info.sessionId || info.session_id ||
|
|
215
|
+
props.sessionID || props.sessionId || props.session_id || props.id;
|
|
213
216
|
const r = await runFailproofai(claudeEvent, {
|
|
214
217
|
session_id: sessionID, cwd: directory, hook_event_name: claudeEvent,
|
|
215
218
|
}, directory);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[73338,a=>{"use strict";var b=a.i(36359),c=a.i(7292),d=a.i(37936),e=a.i(2157);a.i(66680);var f=a.i(50227);a.i(8674),a.i(1144);var g=a.i(75818),h=a.i(13095);async function i(){return function(a=Date.now()){let b,c,d=(c=process.env.FAILPROOFAI_STATE_DIR)?(0,f.resolve)(c,"sessions"):(0,g.sessionPauseDir)();if(!(0,e.existsSync)(d))return[];let h=[];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,f.join)(d,c),"utf8")));if(!b||b.expiresAt<=a)continue;let{schemaVersion:g,...i}=b;h.push(i)}catch{}return h.sort((a,b)=>b.pausedAt-a.pausedAt)}()}(0,h.ensureServerEntryExports)([i]),(0,d.registerServerReference)(i,"
|
|
1
|
+
module.exports=[73338,a=>{"use strict";var b=a.i(36359),c=a.i(7292),d=a.i(37936),e=a.i(2157);a.i(66680);var f=a.i(50227);a.i(8674),a.i(1144);var g=a.i(75818),h=a.i(13095);async function i(){return function(a=Date.now()){let b,c,d=(c=process.env.FAILPROOFAI_STATE_DIR)?(0,f.resolve)(c,"sessions"):(0,g.sessionPauseDir)();if(!(0,e.existsSync)(d))return[];let h=[];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,f.join)(d,c),"utf8")));if(!b||b.expiresAt<=a)continue;let{schemaVersion:g,...i}=b;h.push(i)}catch{}return h.sort((a,b)=>b.pausedAt-a.pausedAt)}()}(0,h.ensureServerEntryExports)([i]),(0,d.registerServerReference)(i,"0077a2e270ba59e7a233b4d791a5ef1cba7671247b",null);var j=a.i(17280);a.i(10695);var k=a.i(98378),l=a.i(69839),m=a.i(28120),n=a.i(74533),o=a.i(60526),p=a.i(91997),q=a.i(67121),r=a.i(92956),s=a.i(15638);class t extends Error{exitCode;constructor(a,b=1){super(a),this.name="CliError",this.exitCode=b}}a.i(89790);var u=a.i(9909);a.i(1459);let v=new Set(r.BUILTIN_POLICIES.map(a=>a.name));function w(a,b){return q.claudeCode.getSettingsPath(a,b)}function x(a){let b=[],c=[],d=[],e=[];try{e=(0,u.readInstalledPacks)().packs}catch{}let f=(a,b)=>e.filter(b=>null===a||b.id===a).filter(a=>a.policies.some(a=>a.name===b)).map(a=>({packId:a.id,packVersion:a.version,name:b,disabledKey:`pack:${a.id}@${a.version}:${b}`}));for(let e of a){let a=f(null,e);if(1===a.length){c.push(a[0]);continue}if(a.length>1)throw new t(`"${e}" is declared by ${a.length} installed packs.
|
|
2
2
|
Name the one you mean:
|
|
3
3
|
`+a.map(a=>` ${a.packId}:${a.name}`).join("\n"));if(v.has(e)){b.push(e);continue}let g=e.lastIndexOf(":"),h=g>0?{packId:e.slice(0,g),name:e.slice(g+1)}:null,i=h?f(h.packId,h.name):f(null,e);if(1===i.length){c.push(i[0]);continue}if(i.length>1)throw new t(`"${e}" is declared by ${i.length} installed packs.
|
|
4
4
|
Name the one you mean:
|
|
@@ -12,6 +12,6 @@ Run \`failproofai policies add FailproofAI/policies\` once you are online.`)}if(
|
|
|
12
12
|
Enabled ${E.length} policy(ies): ${E.join(", ")}
|
|
13
13
|
`),i)console.log("Custom hooks path cleared.");else if(K.customPoliciesPaths?.length||K.customPoliciesPath){let a=K.customPoliciesPaths??[K.customPoliciesPath];console.log(`Custom hooks paths: ${a.join(", ")}`)}let N=[];for(let a of G){let d=(0,q.getIntegration)(a),e=(0,q.settingsPathsFor)(d,b,c);try{for(let c of e){let e=d.readSettings(c);d.writeHookEntries(e,H,b),d.writeSettings(c,e),N.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,k.trackHookEvent)((0,l.getInstanceId)(),"hook_write_failed",{cli:a,scope:b,error_type:c})}catch{}throw d}}try{let a=new Set(E),c=E.filter(a=>!J.has(a)),e=[...J].filter(b=>!a.has(b)),f=(0,l.getInstanceId)();if(await (0,k.trackHookEvent)(f,"hooks_installed",{scope:b,cli:G,cli_count:G.length,policies:E,policy_count:E.length,policies_added:c,policies_removed:e,...g?{source:g}:{},platform:(0,o.platform)(),arch:(0,o.arch)(),os_release:(0,o.release)(),hostname_hash:(0,l.hashToId)((0,o.hostname)()),has_custom_hooks_path:!!(K.customPoliciesPaths?.length||K.customPoliciesPath),has_policy_params:!!(K.policyParams&&Object.keys(K.policyParams).length>0),param_policy_names:K.policyParams?Object.keys(K.policyParams):[],command_format:"project"===b?"npx":"absolute"}),d){let a=new Set(r.BUILTIN_POLICIES.filter(a=>a.beta).map(a=>a.name)),c=E.filter(b=>a.has(b));c.length>0&&await (0,k.trackHookEvent)(f,"beta_policies_installed",{scope:b,cli:G,beta_count:c.length,beta_policy_names:c,...g?{source:g}:{}})}}catch{}for(let{cli:a,path:c}of N){let d=(0,q.getIntegration)(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(`
|
|
14
14
|
This file can be committed to git — no machine-specific paths.`)):console.log(`Binary: ${H}`);let O=(D=p.HOOK_SCOPES,F=new Set,D.filter(a=>{let b=w(a,c);return!F.has(b)&&(F.add(b),!0)})).filter(a=>a!==b).filter(a=>z(a,c));if(O.length>0){let a=O.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 ${O[0]}\` to remove the other installation,`),console.log("or `failproofai policies` to see all scopes.");try{await (0,k.trackHookEvent)((0,l.getInstanceId)(),"multi_scope_warning_shown",{new_scope:b,existing_scopes:O,cli:G})}catch{}}}async function C(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,m.readScopedHooksConfig)(f,c);delete a.customPoliciesPath,delete a.customPoliciesPaths,(0,m.writeScopedHooksConfig)(a,f,c),console.log("Custom hooks path cleared.")}if(a&&a.length>0&&(1!==a.length||"all"!==a[0])){let b=x(a);y(b.packs,!1,f,c);var h=a=b.builtins;let d=new Set(r.BUILTIN_POLICIES.filter(a=>a.alwaysOn).map(a=>a.name)),e=h.filter(a=>d.has(a));if(e.length>0)throw new t(`Cannot disable: ${e.join(", ")}
|
|
15
|
-
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,m.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:n,...p}=e,q=n?Object.fromEntries(Object.entries(n).filter(([a])=>!h.has(a))):null,r={...p,enabledPolicies:i,...q&&Object.keys(q).length>0?{policyParams:q}:{}};(0,m.writeScopedHooksConfig)(r,f,c);try{let c=(0,l.getInstanceId)(),f=a.filter(a=>e.enabledPolicies.includes(a));await (0,k.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,o.platform)(),arch:(0,o.arch)(),os_release:(0,o.release)(),hostname_hash:(0,l.hashToId)((0,o.hostname)())})}catch{}console.log(`Disabled ${a.length-j.length} policy(ies).`),console.log(`Remaining: ${i.length>0?i.join(", "):"(none)"}`);return}let i=(0,m.readScopedHooksConfig)(f,c),j=0,n=!1;for(let a of g){let d=(0,q.getIntegration)(a);for(let a of"all"===b?[...d.scopes]:d.scopes.includes(b)?[b]:[]){let f=(0,q.settingsPathsFor)(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."),n=!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."),n=!0;continue}j+=h}}if(!n||0!==j){if("all"===b)for(let a of(console.log(`Removed ${j} failproofai hook(s) from all scopes.`),g)){let b=(0,q.getIntegration)(a);for(let a of b.scopes)for(let d of(0,q.settingsPathsFor)(b,a,c))console.log(` ${b.displayName} / ${a}: ${d}`)}try{let a=(0,l.getInstanceId)();await (0,k.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,o.platform)(),arch:(0,o.arch)(),os_release:(0,o.release)(),hostname_hash:(0,l.hashToId)((0,o.hostname)())})}catch{}if("all"===b)for(let a of p.HOOK_SCOPES){let b=(0,m.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,m.writeScopedHooksConfig)({...g,enabledPolicies:[]},a,c)}}else if(!p.HOOK_SCOPES.some(a=>z(a,c))){let{customPoliciesPath:a,customPoliciesPaths:b,policyParams:d,...e}=(0,m.readScopedHooksConfig)(f,c);(0,m.writeScopedHooksConfig)({...e,enabledPolicies:[]},f,c)}}}var D=a.i(24282),E=a.i(12714);async function F(a,b){let c=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),d=(0,f.resolve)((0,m.findProjectConfigDir)(c),".failproofai","policies"),e=(0,g.customPoliciesDir)(),h=[];for(let{scope:c,dir:g}of[{scope:"project",dir:d},...e===d?[]:[{scope:"user",dir:e}]]){let d=[];try{d=(0,s.discoverPolicyFiles)(g)}catch{continue}for(let e of d){if(b.has(e))continue;let d=[];try{d=(await G(e)).map(b=>{let d=(0,s.conventionPolicyId)(c,(0,f.basename)(e),b.name);return{...b,id:d,enabled:!a.has(d)}})}catch{}h.push({scope:c,file:(0,f.basename)(e),path:e,policies:d})}}return h}async function G(a){if(!(0,e.existsSync)(a))return[];let b=await (0,E.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 H(){let a=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),b=(0,m.readMergedHooksConfig)(a),c=new Set(b.disabledCustomPolicies??[]),d=p.HOOK_SCOPES.filter(a=>z(a)),e=w(d[0]??"user"),g=(0,q.listIntegrations)().map(a=>({id:a.id,label:(0,D.getCliLabel)(a.id),installed:a.hooksInstalledInSettings("user"),settingsPath:a.getSettingsPath("user"),detected:a.detectInstalled()})),h=[],i=[];try{let a=(0,u.readInstalledPacks)();h=a.packs,i=a.errors}catch{}let k=[];for(let a of h){let d=a.enabled??a.policies.map(a=>a.name);for(let e of a.policies)k.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:function(a,b,c){if(!a)return;let d=a[`pack/${b}/${c}`];return d||(b.toLowerCase()===j.CORE_SOURCE.toLowerCase()?a[c]:void 0)}(b.policyParams,a.id,e.name)??{}}:{}})}let l=(0,m.configuredCustomPolicyPaths)(b),n=(0,m.findProjectConfigDir)(a),o=l.map(a=>(0,f.resolve)(n,a)),r=(await Promise.all(o.map(async a=>{try{return(await G(a)).map(b=>{let d=(0,s.customPolicyId)(a,b.name);return{...b,id:d,enabled:!c.has(d)}})}catch{return[]}}))).flat(),t=await F(c,new Set(o)),v=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)v.push({id:a.id??"(unnamed pack)",version:"",source:"",effect:"enforce",policies:[],error:a.reason});return{enabledPolicies:b.enabledPolicies,installedScopes:d,settingsPath:e,clis:g,policies:k,customPoliciesPaths:l.length?l:void 0,customPoliciesPath:1===l.length?l[0]:void 0,customPolicies:r.length?r:void 0,conventionPolicies:t,packs:v}}async function I(a,b){let c=(0,m.readHooksConfig)(),d=new Set(c.enabledPolicies);b?d.add(a):d.delete(a),(0,m.writeHooksConfig)({...c,enabledPolicies:[...d]});try{let c=(0,l.getInstanceId)();await (0,k.trackHookEvent)(c,"policy_toggled",{policy_name:a,enabled:b,action:b?"enable":"disable",source:"web"})}catch{}}async function J(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 p.HOOK_SCOPES){let d=(0,m.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,m.writeScopedHooksConfig)(f,b,c)}return}let d=(0,m.readHooksConfig)(),e=new Set(d.disabledCustomPolicies??[]);e.add(a);let f={...d,disabledCustomPolicies:[...e]};e.size||delete f.disabledCustomPolicies,(0,m.writeHooksConfig)(f)}async function K(a,b){let c=a.trim();if(!c)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await (0,j.addPackFromSource)(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 L(){try{let a=await (0,j.addPack)(j.CORE_SOURCE);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 M(a){let b;try{b=(0,j.removePack)(a)}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}return b?{ok:!0,id:b}:{ok:!1,error:`No installed pack with id ${a}`}}async function N(a,b,c){let d=(0,j.setPackPolicyEnabled)(a,b,c);if(!d.ok)return{ok:!1,error:d.reason};if(c){let c=(0,u.readInstalledPacks)().packs.find(b=>b.id===a);if(c){let a=`pack:${c.id}@${c.version}:${b}`,d=(0,m.readHooksConfig)(),e=(d.disabledCustomPolicies??[]).filter(b=>b!==a);if(e.length!==(d.disabledCustomPolicies??[]).length){let{disabledCustomPolicies:a,...b}=d;(0,m.writeHooksConfig)(e.length>0?{...b,disabledCustomPolicies:e}:b)}}}return{ok:!0,id:a}}async function O(a){let b=a.trim();if(!b)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await (0,j.fetchPackPreview)(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 P(a="user",b){let c=(0,m.readHooksConfig)(),d=c.enabledPolicies.length>0?c.enabledPolicies:r.BUILTIN_POLICIES.filter(a=>a.defaultEnabled&&!a.beta).map(a=>a.name),e=b&&b.length>0?b:(0,q.detectInstalledClis)(),f=e.length>0?e:["claude"];await A(d,a,void 0,!1,"web",void 0,!1,f)}async function Q(a="user",b){let c=b&&b.length>0?b:(0,q.detectInstalledClis)(),d=c.length>0?c:["claude"];await C(void 0,a,void 0,{source:"web",cli:d})}async function R(a,b){let c=(0,m.readHooksConfig)(),d={...c.policyParams??{},[a]:b};(0,m.writeHooksConfig)({...c,policyParams:d});try{let c=(0,l.getInstanceId)();await (0,k.trackHookEvent)(c,"policy_params_updated",{policy_name:a,param_keys:Object.keys(b),source:"web"})}catch{}}(0,h.ensureServerEntryExports)([H]),(0,d.registerServerReference)(H,"00b6455f46f538e1e0f7872d2d9c77b0195511e731",null),(0,h.ensureServerEntryExports)([I,J]),(0,d.registerServerReference)(I,"604f1a4f8765fa231e831310dc35ebaeab568bf35d",null),(0,d.registerServerReference)(J,"605b9184ee6c68dfd18071b7cd687b276f30b2a74f",null),(0,h.ensureServerEntryExports)([K,L,M,N,O]),(0,d.registerServerReference)(K,"60aa1ce805f4904d4cdeccaaae4d76d4946ca5a9d2",null),(0,d.registerServerReference)(L,"005b82e13b42131f7051c1e6c50a53397488f2b941",null),(0,d.registerServerReference)(M,"40dc4f9e49f77dfc2297f895811fd835ef1ccbddbf",null),(0,d.registerServerReference)(N,"700600aa6454cbfa68fe29c391688523cd653e14c1",null),(0,d.registerServerReference)(O,"40d026a27c6a92fce5300b06bcf44fa1ce0e01709a",null),(0,h.ensureServerEntryExports)([P,Q]),(0,d.registerServerReference)(P,"60cae434e394962a07674df6f52f22fe7b332ed128",null),(0,d.registerServerReference)(Q,"60f12e9ff49120ca670f1fbff765bfd0768f125900",null),(0,h.ensureServerEntryExports)([R]),(0,d.registerServerReference)(R,"60eaa0aad0a7c8253b6935f0ea15b16a343173f09f",null),a.s([],96801),a.i(96801),a.s(["000ae5b9f039195740b0697383b66ef36475abe12d",()=>b.getTelemetryConfig,"005b82e13b42131f7051c1e6c50a53397488f2b941",0,L,"00b6455f46f538e1e0f7872d2d9c77b0195511e731",0,H,"00f2651d6c61b8af94fb61a3e35baa07db7a565f71",0,i,"40d026a27c6a92fce5300b06bcf44fa1ce0e01709a",0,O,"40dc4f9e49f77dfc2297f895811fd835ef1ccbddbf",0,M,"40fd166f9e08915649b8a51bc4f455a44462deefd1",()=>c.getHookActivityAction,"605b9184ee6c68dfd18071b7cd687b276f30b2a74f",0,J,"60aa1ce805f4904d4cdeccaaae4d76d4946ca5a9d2",0,K,"60cae434e394962a07674df6f52f22fe7b332ed128",0,P,"60d4b56a98077468792db89d8812f1e5e786583628",()=>c.searchHookActivityAction,"60eaa0aad0a7c8253b6935f0ea15b16a343173f09f",0,R,"60f12e9ff49120ca670f1fbff765bfd0768f125900",0,Q,"700600aa6454cbfa68fe29c391688523cd653e14c1",0,N],73338)}];
|
|
15
|
+
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,m.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:n,...p}=e,q=n?Object.fromEntries(Object.entries(n).filter(([a])=>!h.has(a))):null,r={...p,enabledPolicies:i,...q&&Object.keys(q).length>0?{policyParams:q}:{}};(0,m.writeScopedHooksConfig)(r,f,c);try{let c=(0,l.getInstanceId)(),f=a.filter(a=>e.enabledPolicies.includes(a));await (0,k.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,o.platform)(),arch:(0,o.arch)(),os_release:(0,o.release)(),hostname_hash:(0,l.hashToId)((0,o.hostname)())})}catch{}console.log(`Disabled ${a.length-j.length} policy(ies).`),console.log(`Remaining: ${i.length>0?i.join(", "):"(none)"}`);return}let i=(0,m.readScopedHooksConfig)(f,c),j=0,n=!1;for(let a of g){let d=(0,q.getIntegration)(a);for(let a of"all"===b?[...d.scopes]:d.scopes.includes(b)?[b]:[]){let f=(0,q.settingsPathsFor)(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."),n=!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."),n=!0;continue}j+=h}}if(!n||0!==j){if("all"===b)for(let a of(console.log(`Removed ${j} failproofai hook(s) from all scopes.`),g)){let b=(0,q.getIntegration)(a);for(let a of b.scopes)for(let d of(0,q.settingsPathsFor)(b,a,c))console.log(` ${b.displayName} / ${a}: ${d}`)}try{let a=(0,l.getInstanceId)();await (0,k.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,o.platform)(),arch:(0,o.arch)(),os_release:(0,o.release)(),hostname_hash:(0,l.hashToId)((0,o.hostname)())})}catch{}if("all"===b)for(let a of p.HOOK_SCOPES){let b=(0,m.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,m.writeScopedHooksConfig)({...g,enabledPolicies:[]},a,c)}}else if(!p.HOOK_SCOPES.some(a=>z(a,c))){let{customPoliciesPath:a,customPoliciesPaths:b,policyParams:d,...e}=(0,m.readScopedHooksConfig)(f,c);(0,m.writeScopedHooksConfig)({...e,enabledPolicies:[]},f,c)}}}var D=a.i(24282),E=a.i(12714);async function F(a,b){let c=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),d=(0,f.resolve)((0,m.findProjectConfigDir)(c),".failproofai","policies"),e=(0,g.customPoliciesDir)(),h=[];for(let{scope:c,dir:g}of[{scope:"project",dir:d},...e===d?[]:[{scope:"user",dir:e}]]){let d=[];try{d=(0,s.discoverPolicyFiles)(g)}catch{continue}for(let e of d){if(b.has(e))continue;let d=[];try{d=(await G(e)).map(b=>{let d=(0,s.conventionPolicyId)(c,(0,f.basename)(e),b.name);return{...b,id:d,enabled:!a.has(d)}})}catch{}h.push({scope:c,file:(0,f.basename)(e),path:e,policies:d})}}return h}async function G(a){if(!(0,e.existsSync)(a))return[];let b=await (0,E.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 H(){let a=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),b=(0,m.readMergedHooksConfig)(a),c=new Set(b.disabledCustomPolicies??[]),d=p.HOOK_SCOPES.filter(a=>z(a)),e=w(d[0]??"user"),g=(0,q.listIntegrations)().map(a=>({id:a.id,label:(0,D.getCliLabel)(a.id),installed:a.hooksInstalledInSettings("user"),settingsPath:a.getSettingsPath("user"),detected:a.detectInstalled()})),h=[],i=[];try{let a=(0,u.readInstalledPacks)();h=a.packs,i=a.errors}catch{}let k=[];for(let a of h){let d=a.enabled??a.policies.map(a=>a.name);for(let e of a.policies)k.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:function(a,b,c){if(!a)return;let d=a[`pack/${b}/${c}`];return d||(b.toLowerCase()===j.CORE_SOURCE.toLowerCase()?a[c]:void 0)}(b.policyParams,a.id,e.name)??{}}:{}})}let l=(0,m.configuredCustomPolicyPaths)(b),n=(0,m.findProjectConfigDir)(a),o=l.map(a=>(0,f.resolve)(n,a)),r=(await Promise.all(o.map(async a=>{try{return(await G(a)).map(b=>{let d=(0,s.customPolicyId)(a,b.name);return{...b,id:d,enabled:!c.has(d)}})}catch{return[]}}))).flat(),t=await F(c,new Set(o)),v=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)v.push({id:a.id??"(unnamed pack)",version:"",source:"",effect:"enforce",policies:[],error:a.reason});return{enabledPolicies:b.enabledPolicies,installedScopes:d,settingsPath:e,clis:g,policies:k,customPoliciesPaths:l.length?l:void 0,customPoliciesPath:1===l.length?l[0]:void 0,customPolicies:r.length?r:void 0,conventionPolicies:t,packs:v}}async function I(a,b){let c=(0,m.readHooksConfig)(),d=new Set(c.enabledPolicies);b?d.add(a):d.delete(a),(0,m.writeHooksConfig)({...c,enabledPolicies:[...d]});try{let c=(0,l.getInstanceId)();await (0,k.trackHookEvent)(c,"policy_toggled",{policy_name:a,enabled:b,action:b?"enable":"disable",source:"web"})}catch{}}async function J(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 p.HOOK_SCOPES){let d=(0,m.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,m.writeScopedHooksConfig)(f,b,c)}return}let d=(0,m.readHooksConfig)(),e=new Set(d.disabledCustomPolicies??[]);e.add(a);let f={...d,disabledCustomPolicies:[...e]};e.size||delete f.disabledCustomPolicies,(0,m.writeHooksConfig)(f)}async function K(a,b){let c=a.trim();if(!c)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await (0,j.addPackFromSource)(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 L(){try{let a=await (0,j.addPack)(j.CORE_SOURCE);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 M(a){let b;try{b=(0,j.removePack)(a)}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}return b?{ok:!0,id:b}:{ok:!1,error:`No installed pack with id ${a}`}}async function N(a,b,c){let d=(0,j.setPackPolicyEnabled)(a,b,c);if(!d.ok)return{ok:!1,error:d.reason};if(c){let c=(0,u.readInstalledPacks)().packs.find(b=>b.id===a);if(c){let a=`pack:${c.id}@${c.version}:${b}`,d=(0,m.readHooksConfig)(),e=(d.disabledCustomPolicies??[]).filter(b=>b!==a);if(e.length!==(d.disabledCustomPolicies??[]).length){let{disabledCustomPolicies:a,...b}=d;(0,m.writeHooksConfig)(e.length>0?{...b,disabledCustomPolicies:e}:b)}}}return{ok:!0,id:a}}async function O(a){let b=a.trim();if(!b)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await (0,j.fetchPackPreview)(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 P(a="user",b){let c=(0,m.readHooksConfig)(),d=c.enabledPolicies.length>0?c.enabledPolicies:r.BUILTIN_POLICIES.filter(a=>a.defaultEnabled&&!a.beta).map(a=>a.name),e=b&&b.length>0?b:(0,q.detectInstalledClis)(),f=e.length>0?e:["claude"];await A(d,a,void 0,!1,"web",void 0,!1,f)}async function Q(a="user",b){let c=b&&b.length>0?b:(0,q.detectInstalledClis)(),d=c.length>0?c:["claude"];await C(void 0,a,void 0,{source:"web",cli:d})}async function R(a,b){let c=(0,m.readHooksConfig)(),d={...c.policyParams??{},[a]:b};(0,m.writeHooksConfig)({...c,policyParams:d});try{let c=(0,l.getInstanceId)();await (0,k.trackHookEvent)(c,"policy_params_updated",{policy_name:a,param_keys:Object.keys(b),source:"web"})}catch{}}(0,h.ensureServerEntryExports)([H]),(0,d.registerServerReference)(H,"007d58580520408b2040a7ae4e2e90d36a2f0d72da",null),(0,h.ensureServerEntryExports)([I,J]),(0,d.registerServerReference)(I,"60bb507652010e43ca29edb4631a5e05f98f1f4588",null),(0,d.registerServerReference)(J,"60df994c72122478ca7af41a080886c923481d00e9",null),(0,h.ensureServerEntryExports)([K,L,M,N,O]),(0,d.registerServerReference)(K,"60fa4cfdb5bfb185db6006543676bfa5136fcbd8a1",null),(0,d.registerServerReference)(L,"002ab5a555b104880543ad247bc448800dcf570ea4",null),(0,d.registerServerReference)(M,"402331f715383bdca28170eb80112b781cba8cd4cf",null),(0,d.registerServerReference)(N,"706e976016592623f2426adabba14ae4303f8eecb1",null),(0,d.registerServerReference)(O,"400e09fa39c2683dc7e946a7cf3deafa718259b5e9",null),(0,h.ensureServerEntryExports)([P,Q]),(0,d.registerServerReference)(P,"60ed16ed27cd934db35b1ac51144c3d3251638c759",null),(0,d.registerServerReference)(Q,"6027e75b89c9e5d777ef3d1a9767fae3cb0b453afe",null),(0,h.ensureServerEntryExports)([R]),(0,d.registerServerReference)(R,"60507fd2978345f3e9ac2945900576ab9181bc0f96",null),a.s([],96801),a.i(96801),a.s(["002ab5a555b104880543ad247bc448800dcf570ea4",0,L,"0077a2e270ba59e7a233b4d791a5ef1cba7671247b",0,i,"007ccdb1326c7e33bd8fd7a1fe8c1779bdb5425857",()=>b.getTelemetryConfig,"007d58580520408b2040a7ae4e2e90d36a2f0d72da",0,H,"400e09fa39c2683dc7e946a7cf3deafa718259b5e9",0,O,"402331f715383bdca28170eb80112b781cba8cd4cf",0,M,"4093f83a7764d675f24855d2588b3b9996539cf3da",()=>c.getHookActivityAction,"6009779268cbebb950fffbef0f7dab73fe58ddbf3b",()=>c.searchHookActivityAction,"6027e75b89c9e5d777ef3d1a9767fae3cb0b453afe",0,Q,"60507fd2978345f3e9ac2945900576ab9181bc0f96",0,R,"60df994c72122478ca7af41a080886c923481d00e9",0,J,"60ed16ed27cd934db35b1ac51144c3d3251638c759",0,P,"60fa4cfdb5bfb185db6006543676bfa5136fcbd8a1",0,K,"706e976016592623f2426adabba14ae4303f8eecb1",0,N],73338)}];
|
|
16
16
|
|
|
17
17
|
//# sourceMappingURL=_next-internal_server_app_policies_page_actions_1sp2-yo.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[80311,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("00840e34fdc0ab0093541d34b83cc649ce4f5d86f3",d.callServer,void 0,d.findSourceMapURL,"getAuditResultAction");var f=a.i(10765);function g({cachedAt:a,fixed:c=!1}){return(0,b.jsxs)("footer",{className:c?"report-footer report-footer--fixed":"report-footer",children:[(0,b.jsx)("img",{src:"/logo.svg",alt:"failproof_ai",style:{height:18,display:"inline-block",verticalAlign:"middle"}}),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"audit v1.0",(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"generated ",function(a){if(!a)return"—";let b=new Date(a);if(Number.isNaN(b.getTime()))return"—";let c=b.getUTCDate().toString().padStart(2,"0"),d=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][b.getUTCMonth()],e=b.getUTCFullYear(),f=b.getUTCHours().toString().padStart(2,"0"),g=b.getUTCMinutes().toString().padStart(2,"0");return`${c} ${d} ${e}, ${f}:${g} utc`}(a),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),(0,b.jsx)("span",{style:{color:"var(--ink-2)"},children:"auto-healing for your agents."})]})}let h=(0,d.createServerReference)("40d9250b20c84e4d86f5898290e4a7a464c019b309",d.callServer,void 0,d.findSourceMapURL,"dismissLeakAction"),i=(0,d.createServerReference)("00290d6c5d144e8bf121d1b8e95c08990b6bafca27",d.callServer,void 0,d.findSourceMapURL,"getLeaksAction"),j=(0,d.createServerReference)("40f2667668aae1ab9d2a5b00c81eebc40f91a3fc8b",d.callServer,void 0,d.findSourceMapURL,"setLeakNotifyAction");function k(){let[a,d]=(0,c.useState)(null),[e,f]=(0,c.useState)(!0),[g,k]=(0,c.useState)(null),l=(0,c.useCallback)(async()=>{let a=await i();d(a.rows),f(a.notify)},[]);(0,c.useEffect)(()=>{l()},[l]);let m=(0,c.useCallback)(async a=>{k(a);try{await h(a)&&d(b=>b?.filter(b=>b.id!==a)??null)}finally{k(null)}},[]),n=(0,c.useCallback)(async()=>{let a=!e;f(a),await j(a)||f(!a)},[e]);return null===a?null:(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"02 Leaks",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"02"}),"// credentials"]}),(0,b.jsx)("button",{type:"button",className:"cbb-toggle leak-notify","data-on":e,onClick:n,"aria-label":e?"turn desktop notifications off":"turn desktop notifications on",title:"desktop notification when a new credential is found",children:(0,b.jsx)("span",{className:"cbb-toggle-knob"})})]}),0===a.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("h2",{className:"audit-sec-title",children:"no credentials found"}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:["// nothing in this machine's transcripts matched a known key format",(0,b.jsx)("br",{}),"// or a secret-named assignment."]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("h2",{className:"audit-sec-title",children:[a.length," credential",1===a.length?"":"s"," in your transcripts"]}),(0,b.jsx)("div",{className:"audit-sec-sub",children:"// one row per distinct key — an exposure count is not a key count."}),(0,b.jsx)("ul",{className:"leak-list",children:a.map(a=>(0,b.jsxs)("li",{className:"leak-row","data-attributed":a.attributed,children:[(0,b.jsxs)("div",{className:"leak-row-top",children:[(0,b.jsx)("code",{className:"leak-key",children:a.display}),(0,b.jsx)("span",{className:"leak-label",children:a.label}),a.name?(0,b.jsx)("span",{className:"leak-name",children:a.name}):null,(0,b.jsx)("button",{type:"button",className:"leak-dismiss",onClick:()=>void m(a.id),disabled:g===a.id,children:"not a secret"})]}),(0,b.jsxs)("div",{className:"leak-how",children:[(0,b.jsx)("span",{className:"leak-verb",children:a.mechanism})," in ",(0,b.jsx)("span",{className:"leak-where",children:a.project})," via ",(0,b.jsx)("span",{className:"leak-who",children:a.cli})," · ",(0,b.jsx)("span",{className:"leak-when",children:function(a){let b=Date.parse(a);if(!Number.isFinite(b))return"unknown";let c=Math.floor((Date.now()-b)/864e5);return c<=0?"today":1===c?"yesterday":c<30?`${c}d ago`:new Date(b).toLocaleDateString(void 0,{month:"short",day:"numeric"})}(a.lastSeen)})]}),(0,b.jsxs)("div",{className:"leak-foot",children:[(0,b.jsxs)("span",{className:"leak-meta",children:[a.occurrences," exposure",1===a.occurrences?"":"s",a.sessions>1?` \xb7 ${a.sessions} sessions`:""," · ",a.length," chars"]}),(0,b.jsx)("span",{className:"leak-dir",children:"input"===a.direction?"sent by the agent — blockable at PreToolUse":"returned to the agent — already in the transcript"}),(0,b.jsx)("span",{className:"leak-fix",children:a.attributed?`rotate it in the ${a.label.replace(/ (API )?(key|token).*$/i,"")} console`:a.name?`find what reads ${a.name}, then rotate it there`:"trace it to its owner, then rotate it"})]})]},a.id))})]})]})}var l=a.i(89564);function m({mode:a,running:c,onStarted:d,onCompleted:e}){let{capture:g}=(0,f.usePostHog)(),h=async()=>{g("audit_first_run_clicked",{source:"empty_state",mode:a}),d();try{await (0,l.triggerRun)({cli:[],since:"all"})}catch(a){console.error("audit first run failed:",a)}finally{await e()}};return"no-cache"===a?(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{className:"sep",children:"·"})," first run"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"○"})," no cache yet"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"scan and see."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["1","5","8","10","13","17","20","23","25","30","32"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no audit data yet"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"run your first audit."}),(0,b.jsxs)("p",{className:"empty-sub",children:["we'll walk every transcript across your installed CLIs — Claude Code, Codex, Copilot, Cursor, OpenCode, Pi — and count every wasteful","or risky action. you'll get your agent's archetype and a punch-list."]}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("button",{type:"button",className:"btn btn-primary btn-press empty-cta",onClick:h,disabled:c,children:c?"[ scanning… ]":"[ run audit ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"scans all sessions · all installed CLIs · may take a while"})]})]})]}):(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{className:"sep",children:"·"})," zero transcripts"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--amber)"},children:"●"})," hooks not installed"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"nothing to read."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["2","4","9","11","16","18","23","25","27","30","33"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no sessions found"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"install hooks first."}),(0,b.jsx)("p",{className:"empty-sub",children:"failproofai couldn't find any transcripts to scan on this machine. install the hooks for at least one CLI and come back."}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("a",{href:"https://docs.befailproof.ai/getting-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-press empty-cta",onClick:()=>{g("audit_install_guide_clicked",{source:"empty_state",mode:a})},children:"[ install guide → ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"takes about 30 seconds · one command per CLI"})]})]})]})}let n=[{label:"discovering transcripts",detail:"walking ~/.claude, ~/.codex, ~/.cursor, …"},{label:"parsing session logs",detail:"reading JSONL + sqlite session stores"},{label:"running policy checks",detail:"replaying every policy against each tool call"},{label:"aggregating results",detail:"counting hits, ranking by frequency"}];function o(){let[a,d]=(0,c.useState)(0),[e,f]=(0,c.useState)(0);(0,c.useEffect)(()=>{let a=setInterval(()=>{d(a=>Math.min(a+1,n.length-1))},4e3),b=setInterval(()=>f(a=>(a+1)%4),350);return()=>{clearInterval(a),clearInterval(b)}},[]);let g=".".repeat(e+1),h=a===n.length-1,i=Math.round(100*Math.min(.9,(a+1)/n.length*.9));return(0,b.jsxs)("section",{className:"section running-section","data-screen-label":"00 Running",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{className:"sep",children:"·"})," in progress"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--accent-pink)"},children:"●"})," scanning"]})]}),(0,b.jsxs)("h2",{className:"section-h",children:["scanning sessions",g]}),(0,b.jsxs)("div",{className:"panel running-panel",children:[(0,b.jsxs)("div",{className:"running-header",children:[(0,b.jsx)("span",{className:"running-prompt",children:"$"}),(0,b.jsx)("span",{className:"running-cmd",children:"failproofai audit"}),(0,b.jsx)("span",{className:"running-cursor","aria-hidden":"true",children:"▮"})]}),(0,b.jsx)("ul",{className:"running-stages",children:n.map((c,d)=>{let f=d<a,g=d===a;return(0,b.jsxs)("li",{className:"running-stage"+(f?" done":g?" active":" queued"),children:[(0,b.jsx)("span",{className:"running-marker","aria-hidden":"true",children:f?"✓":g?"▮▮":"○"}),(0,b.jsxs)("div",{className:"running-stage-body",children:[(0,b.jsx)("div",{className:"running-stage-label",children:c.label}),g&&(0,b.jsx)("div",{className:"running-stage-detail",children:h?"finishing up…":c.detail})]}),g&&(0,b.jsx)("span",{className:"running-stage-spin","aria-hidden":"true",children:["⠋","⠙","⠹","⠸"][e]})]},d)})}),(0,b.jsxs)("div",{className:"running-bar-label",children:[(0,b.jsx)("span",{children:"progress"}),(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[i,"%"]})]}),(0,b.jsx)("div",{className:"running-bar-track",children:(0,b.jsx)("div",{className:"running-bar-fill",style:{width:`${i}%`}})}),(0,b.jsx)("p",{className:"running-foot",children:"this can take a while depending on how much session history you have."})]})]})}let p={timeout:"audit took too long — try again",network:"network hiccup — check your connection",post_failed:"audit failed — try again"};function q({status:a,onDismiss:d}){let[e,f]=(0,c.useState)(()=>Date.now());if((0,c.useEffect)(()=>{if("running"!==a.kind)return;let b=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(b)},[a.kind]),"idle"===a.kind)return null;if("running"===a.kind){let c=Math.max(0,e-a.startedAt);return(0,b.jsxs)("div",{className:"audit-progress-strip",role:"status","aria-live":"polite",children:[(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__spinner","aria-hidden":"true"}),"re-auditing your sessions"]}),(0,b.jsx)("span",{className:"audit-progress-strip__elapsed",children:function(a){if(a<0)return"00:00";let b=Math.floor(a/1e3),c=Math.floor(b/60).toString().padStart(2,"0"),d=(b%60).toString().padStart(2,"0");return`${c}:${d}`}(c)})]}),(0,b.jsx)("div",{className:"audit-progress-strip__pulse","aria-hidden":"true"})]})}return(0,b.jsx)("div",{className:"audit-progress-strip audit-progress-strip--failed",role:"alert",children:(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__x","aria-hidden":"true",children:"×"}),p[a.reason]]}),(0,b.jsx)("button",{type:"button",className:"audit-progress-strip__dismiss",onClick:d,"aria-label":"dismiss",children:"[ dismiss ]"})]})})}function r({result:a,cachedAt:d,projectFromUrl:e,isRunning:h,rerunStatus:i,onRerun:j,onDismissRerun:l}){let{capture:m}=(0,f.usePostHog)(),{detectorsTriggered:n,missing:o}=(0,c.useMemo)(()=>{let b=0,c=0;for(let d of a.results)d.hits>0&&b++,"builtin"===d.source&&!d.enabledInConfig&&d.hits>0&&c++;return{detectorsTriggered:b,missing:c}},[a]),p=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{p.current||(p.current=!0,m("audit_dashboard_viewed",{missing:o,transcripts_scanned:a.transcripts.scanned,results_count:a.results.length,detectors_triggered:n}))},[m,o,a.transcripts.scanned,a.results.length,n]),(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(q,{status:i,onDismiss:l}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsxs)("div",{className:"report",children:[(0,b.jsx)(s,{transcripts:a.transcripts.scanned,events:a.eventsScanned??0,projects:a.projectsScanned.length}),(0,b.jsx)(k,{})]}),(0,b.jsx)(g,{cachedAt:d})]})]})}function s({transcripts:a,events:c,projects:d}){return(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"01 Scan",children:[(0,b.jsx)("div",{className:"audit-sec-head",children:(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"01"}),"// scan"]})}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"scan complete"}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:[c.toLocaleString()," tool call",1===c?"":"s"," across ",a.toLocaleString()," ","transcript",1===a?"":"s",d>0?` \xb7 ${d.toLocaleString()} project${1===d?"":"s"}`:""]}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:["// the report is being rebuilt around leak detection. the scan, the",(0,b.jsx)("br",{}),"// 12-CLI transcript reader and the emailed digest are unaffected."]})]})}function t({running:a,mode:c="no-cache",rerunStatus:d,onDismissRerun:e,onStarted:f,onCompleted:h}){return(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(q,{status:d,onDismiss:e}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsx)("div",{className:"report",children:a?(0,b.jsx)(o,{}):(0,b.jsx)(m,{mode:c,running:a,onStarted:f,onCompleted:h})}),(0,b.jsx)(g,{cachedAt:null,fixed:!0})]})]})}a.s(["AuditDashboard",0,function({initial:a,projectFromUrl:d,totalCatalogSize:g}){let[h,i]=(0,c.useState)(a),[j,k]=(0,c.useState)(!1),[m,n]=(0,c.useState)({kind:"idle"}),{capture:o}=(0,f.usePostHog)(),p=(0,c.useRef)(null),q=(0,c.useRef)(!1),s="cached"===h.status?h.result.transcripts.scanned:0,u="cached"===h.status?h.result.results.length:0,v=(0,c.useCallback)(async()=>{i(await e())},[]),w=(0,c.useCallback)(async a=>{if(j)return;o("audit_rerun_clicked",{source:a,since:"all"}),k(!0);let b=Date.now();n({kind:"running",startedAt:b});try{await (0,l.triggerRun)({cli:[],since:"all",noCache:!0}),await v(),o("audit_rerun_succeeded",{source:a,since:"all",duration_ms:Date.now()-b}),n({kind:"idle"})}catch(d){let c=d instanceof l.RerunError?d.kind:"network";o("audit_rerun_failed",{kind:c,source:a,since:"all",cli_filter:"all",duration_ms:Date.now()-b}),n({kind:"failed",reason:c,failedAt:Date.now()})}finally{k(!1)}},[o,v,j]),x=(0,c.useCallback)(()=>{n({kind:"idle"})},[]);if((0,c.useEffect)(()=>(document.body.classList.add("audit-body"),()=>document.body.classList.remove("audit-body")),[]),(0,c.useEffect)(()=>{let a=j?"running":"empty"===h.status?"empty":0===s?"zero_sessions":"report";p.current!==a&&(p.current=a,o("audit_page_viewed",{state:a,has_cache:"cached"===h.status}))},[h.status,o,j,s]),(0,c.useEffect)(()=>{q.current=!1},[h.status,j,s]),(0,c.useEffect)(()=>{if(j||"cached"!==h.status||0===s)return;let a=0,b=()=>{if(a=0,q.current)return;let b=document.documentElement.scrollHeight-window.innerHeight;b<=0||window.scrollY>=b-24&&(q.current=!0,o("audit_page_scrolled_to_end",{results_count:u,transcripts_scanned:s}))},c=()=>{0===a&&(a=requestAnimationFrame(b))};return b(),window.addEventListener("scroll",c,{passive:!0}),()=>{window.removeEventListener("scroll",c),0!==a&&cancelAnimationFrame(a)}},[h.status,o,u,j,s]),"empty"===h.status&&!j)return(0,b.jsx)(t,{running:!1,rerunStatus:m,onDismissRerun:x,onStarted:()=>k(!0),onCompleted:async()=>{k(!1),await v()}});if("empty"===h.status&&j)return(0,b.jsx)(t,{running:!0,rerunStatus:m,onDismissRerun:x,onStarted:()=>{},onCompleted:async()=>{k(!1),await v()}});let y="cached"===h.status?h.result:null;if(!y)return null;let z="cached"===h.status?h.cachedAt:null;return 0===y.transcripts.scanned?(0,b.jsx)(t,{running:j,mode:"zero-sessions",rerunStatus:m,onDismissRerun:x,onStarted:()=>k(!0),onCompleted:async()=>{k(!1),await v()}}):(0,b.jsx)(r,{result:y,cachedAt:z,projectFromUrl:d,isRunning:j,rerunStatus:m,onRerun:a=>w(a),onDismissRerun:x})}],80311)}];
|
|
1
|
+
module.exports=[80311,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("009ad545620d7158fc4c18ddc9854cfa5473399e64",d.callServer,void 0,d.findSourceMapURL,"getAuditResultAction");var f=a.i(10765);function g({cachedAt:a,fixed:c=!1}){return(0,b.jsxs)("footer",{className:c?"report-footer report-footer--fixed":"report-footer",children:[(0,b.jsx)("img",{src:"/logo.svg",alt:"failproof_ai",style:{height:18,display:"inline-block",verticalAlign:"middle"}}),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"audit v1.0",(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"generated ",function(a){if(!a)return"—";let b=new Date(a);if(Number.isNaN(b.getTime()))return"—";let c=b.getUTCDate().toString().padStart(2,"0"),d=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][b.getUTCMonth()],e=b.getUTCFullYear(),f=b.getUTCHours().toString().padStart(2,"0"),g=b.getUTCMinutes().toString().padStart(2,"0");return`${c} ${d} ${e}, ${f}:${g} utc`}(a),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),(0,b.jsx)("span",{style:{color:"var(--ink-2)"},children:"auto-healing for your agents."})]})}let h=(0,d.createServerReference)("40627fe0bb35d1aea2f59f4ed5f39912b524a8cc1c",d.callServer,void 0,d.findSourceMapURL,"dismissLeakAction"),i=(0,d.createServerReference)("004c0a92f30b3875d89d14068f7fbdb7ecce772dc3",d.callServer,void 0,d.findSourceMapURL,"getLeaksAction"),j=(0,d.createServerReference)("40dbb536ad33353d440386d51c0242e56cd808cfbc",d.callServer,void 0,d.findSourceMapURL,"setLeakNotifyAction");function k(a){let b=Date.parse(a);if(!Number.isFinite(b))return"unknown";let c=Math.floor((Date.now()-b)/864e5);return c<=0?"today":1===c?"yesterday":c<30?`${c}d ago`:new Date(b).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function l(){let[a,d]=(0,c.useState)(null),[e,f]=(0,c.useState)(!0),[g,l]=(0,c.useState)(null),m=(0,c.useCallback)(async()=>{let a=await i();d(a.rows),f(a.notify)},[]);(0,c.useEffect)(()=>{m()},[m]);let n=(0,c.useCallback)(async a=>{l(a);try{await h(a)&&d(b=>b?.filter(b=>b.id!==a)??null)}finally{l(null)}},[]),o=(0,c.useCallback)(async()=>{let a=!e;f(a),await j(a)||f(!a)},[e]);return null===a?null:(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"02 Leaks",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"02"}),"// credentials"]}),(0,b.jsx)("button",{type:"button",className:"cbb-toggle leak-notify","data-on":e,onClick:o,"aria-label":e?"turn desktop notifications off":"turn desktop notifications on",title:"desktop notification when a new credential is found",children:(0,b.jsx)("span",{className:"cbb-toggle-knob"})})]}),0===a.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("h2",{className:"audit-sec-title",children:"no credentials found"}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:["// nothing in this machine's transcripts matched a known key format",(0,b.jsx)("br",{}),"// or a secret-named assignment."]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("h2",{className:"audit-sec-title",children:[a.length," credential",1===a.length?"":"s"," in your transcripts"]}),(0,b.jsx)("div",{className:"audit-sec-sub",children:"// one row per distinct key — an exposure count is not a key count."}),(0,b.jsx)("ul",{className:"leak-list",children:a.map(a=>(0,b.jsxs)("li",{className:"leak-row","data-attributed":a.attributed,children:[(0,b.jsxs)("div",{className:"leak-row-top",children:[(0,b.jsx)("code",{className:"leak-key",children:a.display}),(0,b.jsx)("span",{className:"leak-label",children:a.label}),a.name?(0,b.jsx)("span",{className:"leak-name",children:a.name}):null,(0,b.jsx)("button",{type:"button",className:"leak-dismiss",onClick:()=>void n(a.id),disabled:g===a.id,children:"not a secret"})]}),(0,b.jsxs)("div",{className:"leak-how",children:[(0,b.jsx)("span",{className:"leak-verb",children:a.mechanism})," in ",(0,b.jsx)("span",{className:"leak-where",children:a.project})," via ",(0,b.jsx)("span",{className:"leak-who",children:a.cli})," · leaked ",(0,b.jsx)("span",{className:"leak-when",children:k(a.firstSeen)}),k(a.firstSeen)!==k(a.lastSeen)?(0,b.jsxs)(b.Fragment,{children:[" · last seen ",(0,b.jsx)("span",{className:"leak-when",children:k(a.lastSeen)})]}):null]}),(0,b.jsxs)("div",{className:"leak-foot",children:[(0,b.jsxs)("span",{className:"leak-meta",children:[a.occurrences," exposure",1===a.occurrences?"":"s",a.sessions>1?` \xb7 ${a.sessions} sessions`:""," · ",a.length," chars"]}),(0,b.jsx)("span",{className:"leak-dir",children:"input"===a.direction?"sent by the agent — blockable at PreToolUse":"returned to the agent — already in the transcript"}),(0,b.jsx)("span",{className:"leak-fix",children:a.attributed?`rotate it in the ${a.label.replace(/ (API )?(key|token).*$/i,"")} console`:a.name?`find what reads ${a.name}, then rotate it there`:"trace it to its owner, then rotate it"})]})]},a.id))})]})]})}var m=a.i(89564);function n({mode:a,running:c,onStarted:d,onCompleted:e}){let{capture:g}=(0,f.usePostHog)(),h=async()=>{g("audit_first_run_clicked",{source:"empty_state",mode:a}),d();try{await (0,m.triggerRun)({cli:[],since:"all"})}catch(a){console.error("audit first run failed:",a)}finally{await e()}};return"no-cache"===a?(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{className:"sep",children:"·"})," first run"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"○"})," no cache yet"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"scan and see."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["1","5","8","10","13","17","20","23","25","30","32"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no audit data yet"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"run your first audit."}),(0,b.jsxs)("p",{className:"empty-sub",children:["we'll walk every transcript across your installed CLIs — Claude Code, Codex, Copilot, Cursor, OpenCode, Pi — and count every wasteful","or risky action. you'll get your agent's archetype and a punch-list."]}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("button",{type:"button",className:"btn btn-primary btn-press empty-cta",onClick:h,disabled:c,children:c?"[ scanning… ]":"[ run audit ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"scans all sessions · all installed CLIs · may take a while"})]})]})]}):(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{className:"sep",children:"·"})," zero transcripts"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--amber)"},children:"●"})," hooks not installed"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"nothing to read."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["2","4","9","11","16","18","23","25","27","30","33"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no sessions found"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"install hooks first."}),(0,b.jsx)("p",{className:"empty-sub",children:"failproofai couldn't find any transcripts to scan on this machine. install the hooks for at least one CLI and come back."}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("a",{href:"https://docs.befailproof.ai/getting-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-press empty-cta",onClick:()=>{g("audit_install_guide_clicked",{source:"empty_state",mode:a})},children:"[ install guide → ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"takes about 30 seconds · one command per CLI"})]})]})]})}let o=[{label:"discovering transcripts",detail:"walking ~/.claude, ~/.codex, ~/.cursor, …"},{label:"parsing session logs",detail:"reading JSONL + sqlite session stores"},{label:"running policy checks",detail:"replaying every policy against each tool call"},{label:"aggregating results",detail:"counting hits, ranking by frequency"}];function p(){let[a,d]=(0,c.useState)(0),[e,f]=(0,c.useState)(0);(0,c.useEffect)(()=>{let a=setInterval(()=>{d(a=>Math.min(a+1,o.length-1))},4e3),b=setInterval(()=>f(a=>(a+1)%4),350);return()=>{clearInterval(a),clearInterval(b)}},[]);let g=".".repeat(e+1),h=a===o.length-1,i=Math.round(100*Math.min(.9,(a+1)/o.length*.9));return(0,b.jsxs)("section",{className:"section running-section","data-screen-label":"00 Running",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{className:"sep",children:"·"})," in progress"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--accent-pink)"},children:"●"})," scanning"]})]}),(0,b.jsxs)("h2",{className:"section-h",children:["scanning sessions",g]}),(0,b.jsxs)("div",{className:"panel running-panel",children:[(0,b.jsxs)("div",{className:"running-header",children:[(0,b.jsx)("span",{className:"running-prompt",children:"$"}),(0,b.jsx)("span",{className:"running-cmd",children:"failproofai audit"}),(0,b.jsx)("span",{className:"running-cursor","aria-hidden":"true",children:"▮"})]}),(0,b.jsx)("ul",{className:"running-stages",children:o.map((c,d)=>{let f=d<a,g=d===a;return(0,b.jsxs)("li",{className:"running-stage"+(f?" done":g?" active":" queued"),children:[(0,b.jsx)("span",{className:"running-marker","aria-hidden":"true",children:f?"✓":g?"▮▮":"○"}),(0,b.jsxs)("div",{className:"running-stage-body",children:[(0,b.jsx)("div",{className:"running-stage-label",children:c.label}),g&&(0,b.jsx)("div",{className:"running-stage-detail",children:h?"finishing up…":c.detail})]}),g&&(0,b.jsx)("span",{className:"running-stage-spin","aria-hidden":"true",children:["⠋","⠙","⠹","⠸"][e]})]},d)})}),(0,b.jsxs)("div",{className:"running-bar-label",children:[(0,b.jsx)("span",{children:"progress"}),(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[i,"%"]})]}),(0,b.jsx)("div",{className:"running-bar-track",children:(0,b.jsx)("div",{className:"running-bar-fill",style:{width:`${i}%`}})}),(0,b.jsx)("p",{className:"running-foot",children:"this can take a while depending on how much session history you have."})]})]})}let q={timeout:"audit took too long — try again",network:"network hiccup — check your connection",post_failed:"audit failed — try again"};function r({status:a,onDismiss:d}){let[e,f]=(0,c.useState)(()=>Date.now());if((0,c.useEffect)(()=>{if("running"!==a.kind)return;let b=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(b)},[a.kind]),"idle"===a.kind)return null;if("running"===a.kind){let c=Math.max(0,e-a.startedAt);return(0,b.jsxs)("div",{className:"audit-progress-strip",role:"status","aria-live":"polite",children:[(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__spinner","aria-hidden":"true"}),"re-auditing your sessions"]}),(0,b.jsx)("span",{className:"audit-progress-strip__elapsed",children:function(a){if(a<0)return"00:00";let b=Math.floor(a/1e3),c=Math.floor(b/60).toString().padStart(2,"0"),d=(b%60).toString().padStart(2,"0");return`${c}:${d}`}(c)})]}),(0,b.jsx)("div",{className:"audit-progress-strip__pulse","aria-hidden":"true"})]})}return(0,b.jsx)("div",{className:"audit-progress-strip audit-progress-strip--failed",role:"alert",children:(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__x","aria-hidden":"true",children:"×"}),q[a.reason]]}),(0,b.jsx)("button",{type:"button",className:"audit-progress-strip__dismiss",onClick:d,"aria-label":"dismiss",children:"[ dismiss ]"})]})})}function s({result:a,cachedAt:d,projectFromUrl:e,isRunning:h,rerunStatus:i,onRerun:j,onDismissRerun:k}){let{capture:m}=(0,f.usePostHog)(),{detectorsTriggered:n,missing:o}=(0,c.useMemo)(()=>{let b=0,c=0;for(let d of a.results)d.hits>0&&b++,"builtin"===d.source&&!d.enabledInConfig&&d.hits>0&&c++;return{detectorsTriggered:b,missing:c}},[a]),p=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{p.current||(p.current=!0,m("audit_dashboard_viewed",{missing:o,transcripts_scanned:a.transcripts.scanned,results_count:a.results.length,detectors_triggered:n}))},[m,o,a.transcripts.scanned,a.results.length,n]),(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(r,{status:i,onDismiss:k}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsxs)("div",{className:"report",children:[(0,b.jsx)(t,{transcripts:a.transcripts.scanned,events:a.eventsScanned??0,projects:a.projectsScanned.length,isRunning:h||"running"===i.kind,onRerun:()=>j("scan_header")}),(0,b.jsx)(l,{})]}),(0,b.jsx)(g,{cachedAt:d})]})]})}function t({transcripts:a,events:c,projects:d,isRunning:e,onRerun:f}){return(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"01 Scan",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"01"}),"// scan"]}),(0,b.jsx)("button",{type:"button",className:"scan-rerun",onClick:f,disabled:e,children:e?"scanning…":"run again"})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"scan complete"}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:[c.toLocaleString()," tool call",1===c?"":"s"," across ",a.toLocaleString()," ","transcript",1===a?"":"s",d>0?` \xb7 ${d.toLocaleString()} project${1===d?"":"s"}`:""]}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:["// the report is being rebuilt around leak detection. the scan, the",(0,b.jsx)("br",{}),"// 12-CLI transcript reader and the emailed digest are unaffected."]})]})}function u({running:a,mode:c="no-cache",rerunStatus:d,onDismissRerun:e,onStarted:f,onCompleted:h}){return(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(r,{status:d,onDismiss:e}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsx)("div",{className:"report",children:a?(0,b.jsx)(p,{}):(0,b.jsx)(n,{mode:c,running:a,onStarted:f,onCompleted:h})}),(0,b.jsx)(g,{cachedAt:null,fixed:!0})]})]})}a.s(["AuditDashboard",0,function({initial:a,projectFromUrl:d,totalCatalogSize:g}){let[h,i]=(0,c.useState)(a),[j,k]=(0,c.useState)(!1),[l,n]=(0,c.useState)({kind:"idle"}),{capture:o}=(0,f.usePostHog)(),p=(0,c.useRef)(null),q=(0,c.useRef)(!1),r="cached"===h.status?h.result.transcripts.scanned:0,t="cached"===h.status?h.result.results.length:0,v=(0,c.useCallback)(async()=>{i(await e())},[]),w=(0,c.useCallback)(async a=>{if(j)return;o("audit_rerun_clicked",{source:a,since:"all"}),k(!0);let b=Date.now();n({kind:"running",startedAt:b});try{await (0,m.triggerRun)({cli:[],since:"all",noCache:!0}),await v(),o("audit_rerun_succeeded",{source:a,since:"all",duration_ms:Date.now()-b}),n({kind:"idle"})}catch(d){let c=d instanceof m.RerunError?d.kind:"network";o("audit_rerun_failed",{kind:c,source:a,since:"all",cli_filter:"all",duration_ms:Date.now()-b}),n({kind:"failed",reason:c,failedAt:Date.now()})}finally{k(!1)}},[o,v,j]),x=(0,c.useCallback)(()=>{n({kind:"idle"})},[]);if((0,c.useEffect)(()=>(document.body.classList.add("audit-body"),()=>document.body.classList.remove("audit-body")),[]),(0,c.useEffect)(()=>{let a=j?"running":"empty"===h.status?"empty":0===r?"zero_sessions":"report";p.current!==a&&(p.current=a,o("audit_page_viewed",{state:a,has_cache:"cached"===h.status}))},[h.status,o,j,r]),(0,c.useEffect)(()=>{q.current=!1},[h.status,j,r]),(0,c.useEffect)(()=>{if(j||"cached"!==h.status||0===r)return;let a=0,b=()=>{if(a=0,q.current)return;let b=document.documentElement.scrollHeight-window.innerHeight;b<=0||window.scrollY>=b-24&&(q.current=!0,o("audit_page_scrolled_to_end",{results_count:t,transcripts_scanned:r}))},c=()=>{0===a&&(a=requestAnimationFrame(b))};return b(),window.addEventListener("scroll",c,{passive:!0}),()=>{window.removeEventListener("scroll",c),0!==a&&cancelAnimationFrame(a)}},[h.status,o,t,j,r]),"empty"===h.status&&!j)return(0,b.jsx)(u,{running:!1,rerunStatus:l,onDismissRerun:x,onStarted:()=>k(!0),onCompleted:async()=>{k(!1),await v()}});if("empty"===h.status&&j)return(0,b.jsx)(u,{running:!0,rerunStatus:l,onDismissRerun:x,onStarted:()=>{},onCompleted:async()=>{k(!1),await v()}});let y="cached"===h.status?h.result:null;if(!y)return null;let z="cached"===h.status?h.cachedAt:null;return 0===y.transcripts.scanned?(0,b.jsx)(u,{running:j,mode:"zero-sessions",rerunStatus:l,onDismissRerun:x,onStarted:()=>k(!0),onCompleted:async()=>{k(!1),await v()}}):(0,b.jsx)(s,{result:y,cachedAt:z,projectFromUrl:d,isRunning:j,rerunStatus:l,onRerun:a=>w(a),onDismissRerun:x})}],80311)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_audit__components_audit-dashboard_tsx_0p9ud47._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[3171,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(
|
|
1
|
+
module.exports=[3171,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(18987),e=a.i(66036);a.s(["default",0,function({error:a,reset:f}){return(0,c.useEffect)(()=>{(0,d.getTelemetryConfig)().then(b=>{(0,e.setClientTelemetryConfig)(b),(0,e.captureClientEvent)("client_error",{error_message:a.message,error_name:a.name,error_digest:a.digest,boundary:"global"})}).catch(()=>{})},[a]),(0,b.jsx)("html",{children:(0,b.jsx)("body",{children:(0,b.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,b.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,b.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,b.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:a.message||"An unexpected error occurred."}),(0,b.jsx)("button",{onClick:f,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_global-error_tsx_1kp6l3x._.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[22712,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35112),e=a.i(38246),f=a.i(52562),g=a.i(89027),h=a.i(64831);let i=(0,h.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var j=a.i(85650);let k=(0,h.default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),l=(0,h.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var m=a.i(41476);let n=(0,h.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),o=(0,h.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),p=(0,h.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),q=(0,h.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),r=(0,h.default)("trash",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),s=(0,h.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var t=a.i(74215),u=a.i(65967),v=a.i(5050);let w=(0,v.createServerReference)("40fd166f9e08915649b8a51bc4f455a44462deefd1",v.callServer,void 0,v.findSourceMapURL,"getHookActivityAction"),x=(0,v.createServerReference)("60d4b56a98077468792db89d8812f1e5e786583628",v.callServer,void 0,v.findSourceMapURL,"searchHookActivityAction"),y=(0,v.createServerReference)("00f2651d6c61b8af94fb61a3e35baa07db7a565f71",v.callServer,void 0,v.findSourceMapURL,"getActivePausesAction");function z({pauses:a,now:d}){let[e,f]=(0,c.useState)(()=>Date.now());(0,c.useEffect)(()=>{let a=setInterval(()=>f(Date.now()),3e4);return()=>clearInterval(a)},[]);let g=d??e,h=a.filter(a=>a.expiresAt>g);if(0===h.length)return null;let i=h.reduce((a,b)=>a.expiresAt<b.expiresAt?a:b);return(0,b.jsxs)("div",{role:"status",className:"mb-4 flex items-start gap-2.5 rounded border border-amber-500/40 bg-amber-500/[0.07] px-3 py-2.5",children:[(0,b.jsx)(o,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"text-xs leading-relaxed",children:[(0,b.jsxs)("p",{className:"font-medium text-foreground",children:["Enforcement is paused for ",h.length," session",1===h.length?"":"s"," —"," ",function(a){if(a<=0)return"expiring now";if(a<6e4)return"under a minute";let b=Math.round(a/6e4);if(b<60)return`${b}m`;let c=Math.floor(b/60),d=b%60;return 0===d?`${c}h`:`${c}h${d}m`}(i.expiresAt-g)," left",h.length>1?" on the next to expire":"","."]}),(0,b.jsxs)("p",{className:"text-muted-foreground mt-0.5",children:["Builtin, custom and convention policies are suspended for"," ",1===h.length?"that session":"those sessions","; cloud-managed policies keep enforcing. It lifts on its own — or run"," ",(0,b.jsx)("span",{className:"font-mono text-foreground",children:"failproofai config --resume"}),"."]})]})]})}function A(){return(0,b.jsx)("span",{title:"Enforcement was paused for this session — local policies did not run",className:"ml-1.5 inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium uppercase tracking-wide border border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-500",children:"paused"})}function B({item:a}){if(!a.pausedBy)return null;let c="number"==typeof a.pauseExpiresAt?new Date(a.pauseExpiresAt).toLocaleTimeString():null;return(0,b.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,b.jsx)(s,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:"Not enforced — paused."})," Enforcement was suspended for this session","cli"===a.pausedBy?" from the CLI":` by ${a.pausedBy}`,c?`, lifting at ${c}`:"",". Builtin, custom and convention policies did not run for this event; cloud-managed policies did."]})]})}let C=(0,v.createServerReference)("00b6455f46f538e1e0f7872d2d9c77b0195511e731",v.callServer,void 0,v.findSourceMapURL,"getHooksConfigAction"),D=(0,v.createServerReference)("605b9184ee6c68dfd18071b7cd687b276f30b2a74f",v.callServer,void 0,v.findSourceMapURL,"toggleCustomPolicyAction"),E=(0,v.createServerReference)("005b82e13b42131f7051c1e6c50a53397488f2b941",v.callServer,void 0,v.findSourceMapURL,"addBundledPackWebAction"),F=(0,v.createServerReference)("60aa1ce805f4904d4cdeccaaae4d76d4946ca5a9d2",v.callServer,void 0,v.findSourceMapURL,"addPackWebAction"),G=(0,v.createServerReference)("40d026a27c6a92fce5300b06bcf44fa1ce0e01709a",v.callServer,void 0,v.findSourceMapURL,"previewPackWebAction"),H=(0,v.createServerReference)("40dc4f9e49f77dfc2297f895811fd835ef1ccbddbf",v.callServer,void 0,v.findSourceMapURL,"removePackWebAction"),I=(0,v.createServerReference)("700600aa6454cbfa68fe29c391688523cd653e14c1",v.callServer,void 0,v.findSourceMapURL,"togglePackPolicyAction"),J=(0,v.createServerReference)("60cae434e394962a07674df6f52f22fe7b332ed128",v.callServer,void 0,v.findSourceMapURL,"installHooksWebAction"),K=(0,v.createServerReference)("60f12e9ff49120ca670f1fbff765bfd0768f125900",v.callServer,void 0,v.findSourceMapURL,"removeHooksWebAction"),L=(0,v.createServerReference)("60eaa0aad0a7c8253b6935f0ea15b16a343173f09f",v.callServer,void 0,v.findSourceMapURL,"updatePolicyParamsAction");var M=a.i(6236),N=a.i(10765),O=a.i(90619),P=a.i(95947),Q=a.i(87256);let R={claude:{PreToolUse:"block",UserPromptSubmit:"block",PermissionRequest:"block",Stop:"block",SubagentStop:"block",PreCompact:"block",PostToolBatch:"block",ConfigChange:"block",UserPromptExpansion:"block",TaskCreated:"block",TaskCompleted:"block",TeammateIdle:"block",Elicitation:"block",ElicitationResult:"block",PostToolUse:"observe",PostToolUseFailure:"observe",SessionStart:"observe",Setup:"observe",SubagentStart:"observe",SessionEnd:"observe",StopFailure:"observe",PermissionDenied:"observe",Notification:"observe",InstructionsLoaded:"observe",CwdChanged:"observe",FileChanged:"observe",PostCompact:"observe",WorktreeRemove:"observe"},codex:{PreToolUse:"block",PermissionRequest:"block",UserPromptSubmit:"block",Stop:"block",SubagentStop:"block",PostToolUse:"block",SessionStart:"observe",SubagentStart:"observe",PreCompact:"observe",PostCompact:"observe"},copilot:{PreToolUse:"block",Stop:"block",SubagentStop:"block",UserPromptSubmit:"block",PermissionRequest:"block",PostToolUse:"block",SessionStart:"observe",SessionEnd:"observe",PostToolUseFailure:"observe",PreCompact:"observe",Notification:"observe"},cursor:{PreToolUse:"block",Stop:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},opencode:{PreToolUse:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",UserPromptSubmit:"observe",PermissionRequest:"observe"},pi:{PreToolUse:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",Stop:"observe"},hermes:{PreToolUse:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe"},openclaw:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",SubagentStop:"observe",PreCompact:"observe"},factory:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PreCompact:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe",Notification:"observe"},devin:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PermissionRequest:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},antigravity:{PreToolUse:"block",Stop:"block",PostToolUse:"observe",UserPromptSubmit:"observe"},goose:{PreToolUse:"block",UserPromptSubmit:"observe",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"}};var S=a.i(80977),T=a.i(40695);function U({sessionId:a,transcriptPath:c,integration:d,cwd:f}){if(!a)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let g=a?a.slice(0,8):"—",h="codex"===d||(c?.includes("/.codex/")??!1),i="copilot"===d||(c?.includes("/.copilot/session-state/")??!1),j="cursor"===d||(c?.includes("/.cursor/")??!1),k="opencode"===d||(c?.includes("/.local/share/opencode/")??!1)||(c?.includes("/.opencode/")??!1),l="pi"===d||(c?.includes("/.pi/")??!1);if(h||i||j||k||l){let c,d=f?(c=/^([A-Za-z]):[\\/](.*)$/.exec(f))?c[1]+"--"+c[2].replace(/[\\/]/g,"-"):f.replace(/[\\/]/g,"-"):h?"codex":i?"copilot":j?"cursor":k?"opencode":"pi";return(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(d)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g})}let m=c?function(a){let b=a.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length<2)return null;let c=b[b.length-2];return!c||c.startsWith(".")?null:c}(c):null;return m?(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(m)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g}):(0,b.jsx)("span",{className:"text-muted-foreground font-mono",children:g})}function V({decision:a}){return"deny"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,b.jsx)(q,{className:"h-3 w-3"}),"Deny"]}):"instruct"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,b.jsx)(o,{className:"h-3 w-3"}),"Instruct"]}):(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,b.jsx)(p,{className:"h-3 w-3"}),"Allow"]})}function W({eventType:a}){return(0,b.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:a})}function X({integration:a}){if(!a)return null;let c=(0,Q.getCliLabel)(a),d=(0,Q.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${d}`,title:`Agent CLI: ${c}`,children:c})}function Y({mode:a}){let c="default"===a;return(0,b.jsx)("span",{title:a,className:`inline-block max-w-full truncate rounded px-1.5 py-0.5 align-middle text-[0.6rem] font-medium border ${c?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:a})}function Z({ms:a}){return(0,b.jsx)("span",{className:`font-mono text-[0.7rem] ${a>500?"text-red-400":a>100?"text-amber-400":"text-muted-foreground"}`,children:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`})}function $({text:a,field:d}){let[e,g]=(0,c.useState)(!1),{capture:h}=(0,N.usePostHog)(),i=async b=>{b.stopPropagation(),h("activity_copy_clicked",{field:d??"unknown"});try{await navigator.clipboard.writeText(a),g(!0),setTimeout(()=>g(!1),1500)}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),g(!0),setTimeout(()=>g(!1),1500)}};return(0,b.jsx)("button",{onClick:i,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:e?(0,b.jsx)(f.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(j.Copy,{className:"h-3 w-3"})})}function _({value:a,onChange:c}){return(0,b.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(d=>(0,b.jsx)("button",{onClick:()=>c(d.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${a===d.value?"deny"===d.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===d.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===d.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.value))})}function aa({stats:a}){let c=a.totalEvents>0?a.denyCount/a.totalEvents*100:0,d=c.toFixed(c>=10?0:1),e=0===a.denyCount?"":c>=5?" is-deny":c>=2?" is-warn":"";return(0,b.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"total events"}),(0,b.jsx)("span",{className:"value",children:a.totalEvents.toLocaleString()}),(0,b.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,b.jsxs)("span",{className:`value${e}`,children:[d,"%"]}),(0,b.jsxs)("span",{className:"meta",children:[a.denyCount.toLocaleString()," of ",a.totalEvents.toLocaleString()," denied"]})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,b.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:a.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.topPolicy??void 0,children:a.topPolicy??"—"}),(0,b.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function ab({item:a}){if("observe"!==function(a,b){if(!a||!b)return;let c=R[a];if(c)return c[b]}(a.integration,a.eventType))return null;let c=a.matchedPolicies??[];if(0===c.length)return null;let d=a.integration?(0,Q.getCliLabel)(a.integration):"This CLI",e=c.map(a=>a.replace(/^(custom|\.failproofai-(project|user))\//,"")),f=1===e.length?e[0]:`${e.length} policies`,g="deny"===a.decision;return(0,b.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,b.jsx)(s,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:g?"Not enforced.":"Ran, but cannot enforce here."})," ",(0,b.jsx)("span",{className:"font-mono",children:f})," ran on"," ",(0,b.jsx)("span",{className:"font-mono",children:a.eventType}),", but ",d," discards hook verdicts for this event",g?" — the action went ahead anyway.":", so a policy cannot block here."," ","Move the check to an event ",d," enforces on, such as"," ",(0,b.jsx)("span",{className:"font-mono",children:"PreToolUse"}),"."]})]})}function ac({item:a}){return(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,b.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,b.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,b.jsx)("span",{"aria-hidden":"true",children:"▾"}),"event detail"]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,b.jsx)(B,{item:a}),(0,b.jsx)(ab,{item:a}),a.policySource&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Decided by: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:"cloud"===a.policySource&&a.cloudPolicyId?`cloud \xb7 ${a.cloudPolicyId} version ${a.cloudVersion}`:a.policySource})]}),void 0!==a.cloudDeployment&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Cloud deployment: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cloudDeployment})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.sessionId??"—"}),a.sessionId&&(0,b.jsx)($,{text:a.sessionId,field:"session_id"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cwd??"—"}),a.cwd&&(0,b.jsx)($,{text:a.cwd,field:"cwd"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,b.jsx)("span",{className:"font-mono text-foreground break-all",children:a.transcriptPath??"—"}),a.transcriptPath?.startsWith("opencode-db://")&&(0,b.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),a.policyNames&&a.policyNames.length>1&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.policyNames.join(", ")})]}),a.reason&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,b.jsx)("span",{className:"text-foreground",children:a.reason})]})]})})})}function ad({hooksInstalled:a,onSwitchTab:d}){let{intervalSec:e}=(0,M.useAutoRefresh)(),{capture:f}=(0,N.usePostHog)(),h=(0,O.useUrlParams)(),i=(0,c.useRef)(!1),[j,k]=(0,c.useState)(()=>(0,P.paramToPage)(h.get("page"))),[l,m]=(0,c.useState)(null),[o,p]=(0,c.useState)([]),[q,r]=(0,c.useState)(null),[s,t]=(0,c.useState)(()=>{let a=h.get("decision");return"allow"===a||"deny"===a||"instruct"===a?a:""}),[v,B]=(0,c.useState)(()=>h.get("event")??""),[C,D]=(0,c.useState)(()=>h.get("policy")??""),[E,F]=(0,c.useState)(()=>h.get("session")??""),[G,H]=(0,c.useState)(()=>{let a=h.get("cli");return(0,Q.isKnownCli)(a)?a:""}),[I,J]=(0,c.useState)(()=>{let a=h.get("source");return"custom"===a||"convention"===a||"cloud"===a||"pack"===a?a:""}),K=(0,c.useRef)(null),L=(0,c.useRef)(!0),R=(0,c.useRef)({filterDecision:s,filterEventType:v,filterPolicy:C,filterSessionId:E,filterCli:G,filterSource:I});R.current={filterDecision:s,filterEventType:v,filterPolicy:C,filterSessionId:E,filterCli:G,filterSource:I},(0,c.useEffect)(()=>{if(!i.current){i.current=!0;return}h.setAll({decision:s||void 0,event:v||void 0,policy:C||void 0,session:E||void 0,cli:G||void 0,source:I||void 0,page:(0,P.pageToParam)(j)})},[s,v,C,E,G,I,j]);let T=""!==s||""!==v||""!==C||""!==E||""!==G||""!==I,$=(0,c.useCallback)(async a=>{try{let b,{filterDecision:c,filterEventType:d,filterPolicy:e,filterSessionId:f,filterCli:g,filterSource:h}=R.current;b=""!==c||""!==d||""!==e||""!==f||""!==g||""!==h?await x({decision:c||void 0,eventType:d||void 0,policyName:e||void 0,sessionId:f||void 0,integration:g||void 0,source:h||void 0},a):await w(a),m(b)}catch{}},[]);(0,c.useEffect)(()=>{$(j);let a=setInterval(()=>$(j),e>0?1e3*e:5e3);return()=>clearInterval(a)},[j,$,e]),(0,c.useEffect)(()=>{let a=!1,b=()=>{y().then(b=>{a||p(b)}).catch(()=>{})};b();let c=setInterval(b,e>0?1e3*e:5e3);return()=>{a=!0,clearInterval(c)}},[e]),(0,c.useEffect)(()=>(K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{if(k(1),r(null),$(1),L.current){L.current=!1;return}f("activity_filter_changed",{active_filter_count:+(""!==s)+ +(""!==v)+ +(""!==C)+ +(""!==E)+ +(""!==G),has_decision:""!==s,has_event_type:""!==v,has_policy:""!==C,has_session:""!==E,has_cli:""!==G,decision:s||null,event_type:v||null,cli:G||null})},300),()=>{K.current&&clearTimeout(K.current)}),[s,v,C,E,G]);let ab=l?.entries??[],ae=l?.totalPages??1;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(z,{pauses:o}),l?.stats&&l.stats.totalEvents>0&&(0,b.jsx)("div",{style:{marginBottom:18},children:(0,b.jsx)(aa,{stats:l.stats})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"filter-bar",children:[(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"decision"}),(0,b.jsx)(_,{value:s,onChange:t})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"event"}),(0,b.jsxs)("select",{value:v,onChange:a=>B(a.target.value),className:"filter-input",children:[(0,b.jsx)("option",{value:"",children:"all events"}),(0,b.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,b.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,b.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,b.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,b.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,b.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"source"}),(0,b.jsxs)("select",{value:I,onChange:a=>{let b=a.target.value;J("custom"===b||"convention"===b||"cloud"===b||"pack"===b?b:"")},className:"filter-input","aria-label":"Filter by policy source",children:[(0,b.jsx)("option",{value:"",children:"all sources"}),(0,b.jsx)("option",{value:"custom",children:"custom"}),(0,b.jsx)("option",{value:"convention",children:"convention"}),(0,b.jsx)("option",{value:"cloud",children:"cloud"}),(0,b.jsx)("option",{value:"pack",children:"pack"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"cli"}),(0,b.jsxs)("select",{value:G,onChange:a=>{let b=a.target.value;H(""===b||(0,Q.isKnownCli)(b)?b:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,b.jsx)("option",{value:"",children:"all clis"}),Q.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,Q.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"policy"}),(0,b.jsx)("input",{type:"text",value:C,onChange:a=>D(a.target.value),placeholder:"filter by policy…",className:"filter-input"})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"session"}),(0,b.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"filter by session…",className:"filter-input"})]}),T&&(0,b.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{t(""),B(""),H(""),D(""),F(""),J("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),0===ab.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,b.jsx)(n,{className:"h-12 w-12 text-muted-foreground/30"}),!1===a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,b.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>d?.("policies"),children:"Policies tab"})," ","and click ",(0,b.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:T?"No matching activity.":"Waiting for hook events…"})]}):(0,b.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,b.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{style:{width:32}}),(0,b.jsx)("col",{style:{width:"7%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"13%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}})]}),(0,b.jsx)("thead",{className:"activity-thead",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Time"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-border/30",children:ab.map((a,d)=>{let e="deny"===a.decision,h=q===d,i="instruct"===a.decision;return(0,b.jsxs)(c.Fragment,{children:[(0,b.jsxs)("tr",{onClick:()=>{r(a=>{let b=a===d?null:d,c=ab[d];return f("activity_row_toggled",{expanded:null!==b,decision:c?.decision??null,policy_name:c?.policyName??null,event_type:c?.eventType??null}),b})},className:`activity-data-row cursor-pointer transition-colors ${e?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":i?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":d%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${h?"bg-muted/20":""}`,children:[(0,b.jsx)("td",{className:"px-4 py-2",children:(0,b.jsx)(g.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${h?"rotate-0":"-rotate-90"}`})}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",title:new Date(a.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,S.formatRelativeTime)(a.timestamp)}),(0,b.jsxs)("td",{className:"px-3 py-2",children:[(0,b.jsx)(V,{decision:a.decision}),a.pausedBy&&(0,b.jsx)(A,{})]}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(W,{eventType:a.eventType})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(X,{integration:a.integration})}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.toolName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.policyNames&&a.policyNames.length>1?(0,b.jsxs)("span",{title:a.policyNames.join(", "),children:[a.policyNames[0],(0,b.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",a.policyNames.length-1]})]}):a.policyName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate",title:a.reason??"",children:a.reason??"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:a.permissionMode?(0,b.jsx)(Y,{mode:a.permissionMode}):"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(Z,{ms:a.durationMs})}),(0,b.jsx)("td",{className:"px-3 py-2",title:a.sessionId??"",children:(0,b.jsx)(U,{sessionId:a.sessionId,transcriptPath:a.transcriptPath,integration:a.integration,cwd:a.cwd})})]}),h&&(0,b.jsx)(ac,{item:a})]},`${a.timestamp}-${d}`)})})]})}),(0,b.jsx)(u.default,{currentPage:j,totalPages:ae,onPageChange:a=>{f("activity_pagination_changed",{from_page:j,to_page:a,total_pages:ae}),k(a),r(null)}})]})]})}function ae({enabled:a,onChange:c,disabled:d}){return(0,b.jsx)("button",{onClick:c,disabled:d,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${a?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":a?"Disable policy":"Enable policy",children:(0,b.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${a?"translate-x-3.5":"translate-x-0.5"}`})})}function af({policy:a,onClose:d,onSave:e}){let f=a.params??{},g=a.currentParams??{},[h,i]=(0,c.useState)(()=>{let a={};for(let[b,c]of Object.entries(f)){let d=b in g?g[b]:c.default;a[b]=d}return a});(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&d()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[d]);let j=(a,b)=>{i(c=>({...c,[a]:b}))};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:a=>{a.target===a.currentTarget&&d()},children:(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),(0,b.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(t.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(f).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:a}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:c.description}),((a,c)=>{let d=h[a];if("boolean"===c.type)return(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!!d,onChange:b=>j(a,b.target.checked),className:"rounded border-border"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:c.description})]});if("number"===c.type)return(0,b.jsx)("input",{type:"number",value:"number"==typeof d?d:"",onChange:b=>j(a,Number(b.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===c.type){let c=Array.isArray(d)?d.join("\n"):"";return(0,b.jsx)("textarea",{value:c,onChange:b=>j(a,b.target.value.split("\n").filter(a=>""!==a.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===c.type){let c=Array.isArray(d)?d:[];return(0,b.jsxs)("div",{className:"space-y-1.5",children:[c.map((d,e)=>(0,b.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,b.jsx)("input",{type:"text",value:d.regex,onChange:b=>{let d=[...c];d[e]={...d[e],regex:b.target.value},j(a,d)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("input",{type:"text",value:d.label,onChange:b=>{let d=[...c];d[e]={...d[e],label:b.target.value},j(a,d)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("button",{onClick:()=>j(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,b.jsx)(t.X,{className:"h-3.5 w-3.5"})})]},e)),(0,b.jsx)("button",{onClick:()=>j(a,[...c,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,b.jsx)("input",{type:"text",value:"string"==typeof d?d:"",onChange:b=>j(a,b.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(a,c)]},a))}),(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,b.jsx)(T.Button,{variant:"outline",size:"sm",onClick:d,className:"h-7 text-xs",children:"Cancel"}),(0,b.jsx)(T.Button,{size:"sm",onClick:()=>e(h),className:"h-7 text-xs",children:"Save"})]})]})})}function ag({message:a,onDismiss:c,onInstall:e,isPending:f}){let{capture:g}=(0,N.usePostHog)();return(0,d.createPortal)((0,b.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,b.jsx)("style",{children:`
|
|
1
|
+
module.exports=[22712,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35112),e=a.i(38246),f=a.i(52562),g=a.i(89027),h=a.i(64831);let i=(0,h.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var j=a.i(85650);let k=(0,h.default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),l=(0,h.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var m=a.i(41476);let n=(0,h.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),o=(0,h.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),p=(0,h.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),q=(0,h.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),r=(0,h.default)("trash",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),s=(0,h.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var t=a.i(74215),u=a.i(65967),v=a.i(5050);let w=(0,v.createServerReference)("4093f83a7764d675f24855d2588b3b9996539cf3da",v.callServer,void 0,v.findSourceMapURL,"getHookActivityAction"),x=(0,v.createServerReference)("6009779268cbebb950fffbef0f7dab73fe58ddbf3b",v.callServer,void 0,v.findSourceMapURL,"searchHookActivityAction"),y=(0,v.createServerReference)("0077a2e270ba59e7a233b4d791a5ef1cba7671247b",v.callServer,void 0,v.findSourceMapURL,"getActivePausesAction");function z({pauses:a,now:d}){let[e,f]=(0,c.useState)(()=>Date.now());(0,c.useEffect)(()=>{let a=setInterval(()=>f(Date.now()),3e4);return()=>clearInterval(a)},[]);let g=d??e,h=a.filter(a=>a.expiresAt>g);if(0===h.length)return null;let i=h.reduce((a,b)=>a.expiresAt<b.expiresAt?a:b);return(0,b.jsxs)("div",{role:"status",className:"mb-4 flex items-start gap-2.5 rounded border border-amber-500/40 bg-amber-500/[0.07] px-3 py-2.5",children:[(0,b.jsx)(o,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"text-xs leading-relaxed",children:[(0,b.jsxs)("p",{className:"font-medium text-foreground",children:["Enforcement is paused for ",h.length," session",1===h.length?"":"s"," —"," ",function(a){if(a<=0)return"expiring now";if(a<6e4)return"under a minute";let b=Math.round(a/6e4);if(b<60)return`${b}m`;let c=Math.floor(b/60),d=b%60;return 0===d?`${c}h`:`${c}h${d}m`}(i.expiresAt-g)," left",h.length>1?" on the next to expire":"","."]}),(0,b.jsxs)("p",{className:"text-muted-foreground mt-0.5",children:["Builtin, custom and convention policies are suspended for"," ",1===h.length?"that session":"those sessions","; cloud-managed policies keep enforcing. It lifts on its own — or run"," ",(0,b.jsx)("span",{className:"font-mono text-foreground",children:"failproofai config --resume"}),"."]})]})]})}function A(){return(0,b.jsx)("span",{title:"Enforcement was paused for this session — local policies did not run",className:"ml-1.5 inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium uppercase tracking-wide border border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-500",children:"paused"})}function B({item:a}){if(!a.pausedBy)return null;let c="number"==typeof a.pauseExpiresAt?new Date(a.pauseExpiresAt).toLocaleTimeString():null;return(0,b.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,b.jsx)(s,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:"Not enforced — paused."})," Enforcement was suspended for this session","cli"===a.pausedBy?" from the CLI":` by ${a.pausedBy}`,c?`, lifting at ${c}`:"",". Builtin, custom and convention policies did not run for this event; cloud-managed policies did."]})]})}let C=(0,v.createServerReference)("007d58580520408b2040a7ae4e2e90d36a2f0d72da",v.callServer,void 0,v.findSourceMapURL,"getHooksConfigAction"),D=(0,v.createServerReference)("60df994c72122478ca7af41a080886c923481d00e9",v.callServer,void 0,v.findSourceMapURL,"toggleCustomPolicyAction"),E=(0,v.createServerReference)("002ab5a555b104880543ad247bc448800dcf570ea4",v.callServer,void 0,v.findSourceMapURL,"addBundledPackWebAction"),F=(0,v.createServerReference)("60fa4cfdb5bfb185db6006543676bfa5136fcbd8a1",v.callServer,void 0,v.findSourceMapURL,"addPackWebAction"),G=(0,v.createServerReference)("400e09fa39c2683dc7e946a7cf3deafa718259b5e9",v.callServer,void 0,v.findSourceMapURL,"previewPackWebAction"),H=(0,v.createServerReference)("402331f715383bdca28170eb80112b781cba8cd4cf",v.callServer,void 0,v.findSourceMapURL,"removePackWebAction"),I=(0,v.createServerReference)("706e976016592623f2426adabba14ae4303f8eecb1",v.callServer,void 0,v.findSourceMapURL,"togglePackPolicyAction"),J=(0,v.createServerReference)("60ed16ed27cd934db35b1ac51144c3d3251638c759",v.callServer,void 0,v.findSourceMapURL,"installHooksWebAction"),K=(0,v.createServerReference)("6027e75b89c9e5d777ef3d1a9767fae3cb0b453afe",v.callServer,void 0,v.findSourceMapURL,"removeHooksWebAction"),L=(0,v.createServerReference)("60507fd2978345f3e9ac2945900576ab9181bc0f96",v.callServer,void 0,v.findSourceMapURL,"updatePolicyParamsAction");var M=a.i(6236),N=a.i(10765),O=a.i(90619),P=a.i(95947),Q=a.i(87256);let R={claude:{PreToolUse:"block",UserPromptSubmit:"block",PermissionRequest:"block",Stop:"block",SubagentStop:"block",PreCompact:"block",PostToolBatch:"block",ConfigChange:"block",UserPromptExpansion:"block",TaskCreated:"block",TaskCompleted:"block",TeammateIdle:"block",Elicitation:"block",ElicitationResult:"block",PostToolUse:"observe",PostToolUseFailure:"observe",SessionStart:"observe",Setup:"observe",SubagentStart:"observe",SessionEnd:"observe",StopFailure:"observe",PermissionDenied:"observe",Notification:"observe",InstructionsLoaded:"observe",CwdChanged:"observe",FileChanged:"observe",PostCompact:"observe",WorktreeRemove:"observe"},codex:{PreToolUse:"block",PermissionRequest:"block",UserPromptSubmit:"block",Stop:"block",SubagentStop:"block",PostToolUse:"block",SessionStart:"observe",SubagentStart:"observe",PreCompact:"observe",PostCompact:"observe"},copilot:{PreToolUse:"block",Stop:"block",SubagentStop:"block",UserPromptSubmit:"block",PermissionRequest:"block",PostToolUse:"block",SessionStart:"observe",SessionEnd:"observe",PostToolUseFailure:"observe",PreCompact:"observe",Notification:"observe"},cursor:{PreToolUse:"block",Stop:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},opencode:{PreToolUse:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",UserPromptSubmit:"observe",PermissionRequest:"observe"},pi:{PreToolUse:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",Stop:"observe"},hermes:{PreToolUse:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe"},openclaw:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",SubagentStop:"observe",PreCompact:"observe"},factory:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PreCompact:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe",Notification:"observe"},devin:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PermissionRequest:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},antigravity:{PreToolUse:"block",Stop:"block",PostToolUse:"observe",UserPromptSubmit:"observe"},goose:{PreToolUse:"block",UserPromptSubmit:"observe",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"}};var S=a.i(80977),T=a.i(40695);function U({sessionId:a,transcriptPath:c,integration:d,cwd:f}){if(!a)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let g=a?a.slice(0,8):"—",h="codex"===d||(c?.includes("/.codex/")??!1),i="copilot"===d||(c?.includes("/.copilot/session-state/")??!1),j="cursor"===d||(c?.includes("/.cursor/")??!1),k="opencode"===d||(c?.includes("/.local/share/opencode/")??!1)||(c?.includes("/.opencode/")??!1),l="pi"===d||(c?.includes("/.pi/")??!1);if(h||i||j||k||l){let c,d=f?(c=/^([A-Za-z]):[\\/](.*)$/.exec(f))?c[1]+"--"+c[2].replace(/[\\/]/g,"-"):f.replace(/[\\/]/g,"-"):h?"codex":i?"copilot":j?"cursor":k?"opencode":"pi";return(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(d)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g})}let m=c?function(a){let b=a.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length<2)return null;let c=b[b.length-2];return!c||c.startsWith(".")?null:c}(c):null;return m?(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(m)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g}):(0,b.jsx)("span",{className:"text-muted-foreground font-mono",children:g})}function V({decision:a}){return"deny"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,b.jsx)(q,{className:"h-3 w-3"}),"Deny"]}):"instruct"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,b.jsx)(o,{className:"h-3 w-3"}),"Instruct"]}):(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,b.jsx)(p,{className:"h-3 w-3"}),"Allow"]})}function W({eventType:a}){return(0,b.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:a})}function X({integration:a}){if(!a)return null;let c=(0,Q.getCliLabel)(a),d=(0,Q.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${d}`,title:`Agent CLI: ${c}`,children:c})}function Y({mode:a}){let c="default"===a;return(0,b.jsx)("span",{title:a,className:`inline-block max-w-full truncate rounded px-1.5 py-0.5 align-middle text-[0.6rem] font-medium border ${c?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:a})}function Z({ms:a}){return(0,b.jsx)("span",{className:`font-mono text-[0.7rem] ${a>500?"text-red-400":a>100?"text-amber-400":"text-muted-foreground"}`,children:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`})}function $({text:a,field:d}){let[e,g]=(0,c.useState)(!1),{capture:h}=(0,N.usePostHog)(),i=async b=>{b.stopPropagation(),h("activity_copy_clicked",{field:d??"unknown"});try{await navigator.clipboard.writeText(a),g(!0),setTimeout(()=>g(!1),1500)}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),g(!0),setTimeout(()=>g(!1),1500)}};return(0,b.jsx)("button",{onClick:i,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:e?(0,b.jsx)(f.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(j.Copy,{className:"h-3 w-3"})})}function _({value:a,onChange:c}){return(0,b.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(d=>(0,b.jsx)("button",{onClick:()=>c(d.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${a===d.value?"deny"===d.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===d.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===d.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.value))})}function aa({stats:a}){let c=a.totalEvents>0?a.denyCount/a.totalEvents*100:0,d=c.toFixed(c>=10?0:1),e=0===a.denyCount?"":c>=5?" is-deny":c>=2?" is-warn":"";return(0,b.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"total events"}),(0,b.jsx)("span",{className:"value",children:a.totalEvents.toLocaleString()}),(0,b.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,b.jsxs)("span",{className:`value${e}`,children:[d,"%"]}),(0,b.jsxs)("span",{className:"meta",children:[a.denyCount.toLocaleString()," of ",a.totalEvents.toLocaleString()," denied"]})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,b.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:a.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.topPolicy??void 0,children:a.topPolicy??"—"}),(0,b.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function ab({item:a}){if("observe"!==function(a,b){if(!a||!b)return;let c=R[a];if(c)return c[b]}(a.integration,a.eventType))return null;let c=a.matchedPolicies??[];if(0===c.length)return null;let d=a.integration?(0,Q.getCliLabel)(a.integration):"This CLI",e=c.map(a=>a.replace(/^(custom|\.failproofai-(project|user))\//,"")),f=1===e.length?e[0]:`${e.length} policies`,g="deny"===a.decision;return(0,b.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,b.jsx)(s,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:g?"Not enforced.":"Ran, but cannot enforce here."})," ",(0,b.jsx)("span",{className:"font-mono",children:f})," ran on"," ",(0,b.jsx)("span",{className:"font-mono",children:a.eventType}),", but ",d," discards hook verdicts for this event",g?" — the action went ahead anyway.":", so a policy cannot block here."," ","Move the check to an event ",d," enforces on, such as"," ",(0,b.jsx)("span",{className:"font-mono",children:"PreToolUse"}),"."]})]})}function ac({item:a}){return(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,b.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,b.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,b.jsx)("span",{"aria-hidden":"true",children:"▾"}),"event detail"]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,b.jsx)(B,{item:a}),(0,b.jsx)(ab,{item:a}),a.policySource&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Decided by: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:"cloud"===a.policySource&&a.cloudPolicyId?`cloud \xb7 ${a.cloudPolicyId} version ${a.cloudVersion}`:a.policySource})]}),void 0!==a.cloudDeployment&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Cloud deployment: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cloudDeployment})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.sessionId??"—"}),a.sessionId&&(0,b.jsx)($,{text:a.sessionId,field:"session_id"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cwd??"—"}),a.cwd&&(0,b.jsx)($,{text:a.cwd,field:"cwd"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,b.jsx)("span",{className:"font-mono text-foreground break-all",children:a.transcriptPath??"—"}),a.transcriptPath?.startsWith("opencode-db://")&&(0,b.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),a.policyNames&&a.policyNames.length>1&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.policyNames.join(", ")})]}),a.reason&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,b.jsx)("span",{className:"text-foreground",children:a.reason})]})]})})})}function ad({hooksInstalled:a,onSwitchTab:d}){let{intervalSec:e}=(0,M.useAutoRefresh)(),{capture:f}=(0,N.usePostHog)(),h=(0,O.useUrlParams)(),i=(0,c.useRef)(!1),[j,k]=(0,c.useState)(()=>(0,P.paramToPage)(h.get("page"))),[l,m]=(0,c.useState)(null),[o,p]=(0,c.useState)([]),[q,r]=(0,c.useState)(null),[s,t]=(0,c.useState)(()=>{let a=h.get("decision");return"allow"===a||"deny"===a||"instruct"===a?a:""}),[v,B]=(0,c.useState)(()=>h.get("event")??""),[C,D]=(0,c.useState)(()=>h.get("policy")??""),[E,F]=(0,c.useState)(()=>h.get("session")??""),[G,H]=(0,c.useState)(()=>{let a=h.get("cli");return(0,Q.isKnownCli)(a)?a:""}),[I,J]=(0,c.useState)(()=>{let a=h.get("source");return"custom"===a||"convention"===a||"cloud"===a||"pack"===a?a:""}),K=(0,c.useRef)(null),L=(0,c.useRef)(!0),R=(0,c.useRef)({filterDecision:s,filterEventType:v,filterPolicy:C,filterSessionId:E,filterCli:G,filterSource:I});R.current={filterDecision:s,filterEventType:v,filterPolicy:C,filterSessionId:E,filterCli:G,filterSource:I},(0,c.useEffect)(()=>{if(!i.current){i.current=!0;return}h.setAll({decision:s||void 0,event:v||void 0,policy:C||void 0,session:E||void 0,cli:G||void 0,source:I||void 0,page:(0,P.pageToParam)(j)})},[s,v,C,E,G,I,j]);let T=""!==s||""!==v||""!==C||""!==E||""!==G||""!==I,$=(0,c.useCallback)(async a=>{try{let b,{filterDecision:c,filterEventType:d,filterPolicy:e,filterSessionId:f,filterCli:g,filterSource:h}=R.current;b=""!==c||""!==d||""!==e||""!==f||""!==g||""!==h?await x({decision:c||void 0,eventType:d||void 0,policyName:e||void 0,sessionId:f||void 0,integration:g||void 0,source:h||void 0},a):await w(a),m(b)}catch{}},[]);(0,c.useEffect)(()=>{$(j);let a=setInterval(()=>$(j),e>0?1e3*e:5e3);return()=>clearInterval(a)},[j,$,e]),(0,c.useEffect)(()=>{let a=!1,b=()=>{y().then(b=>{a||p(b)}).catch(()=>{})};b();let c=setInterval(b,e>0?1e3*e:5e3);return()=>{a=!0,clearInterval(c)}},[e]),(0,c.useEffect)(()=>(K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{if(k(1),r(null),$(1),L.current){L.current=!1;return}f("activity_filter_changed",{active_filter_count:+(""!==s)+ +(""!==v)+ +(""!==C)+ +(""!==E)+ +(""!==G),has_decision:""!==s,has_event_type:""!==v,has_policy:""!==C,has_session:""!==E,has_cli:""!==G,decision:s||null,event_type:v||null,cli:G||null})},300),()=>{K.current&&clearTimeout(K.current)}),[s,v,C,E,G]);let ab=l?.entries??[],ae=l?.totalPages??1;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(z,{pauses:o}),l?.stats&&l.stats.totalEvents>0&&(0,b.jsx)("div",{style:{marginBottom:18},children:(0,b.jsx)(aa,{stats:l.stats})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"filter-bar",children:[(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"decision"}),(0,b.jsx)(_,{value:s,onChange:t})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"event"}),(0,b.jsxs)("select",{value:v,onChange:a=>B(a.target.value),className:"filter-input",children:[(0,b.jsx)("option",{value:"",children:"all events"}),(0,b.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,b.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,b.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,b.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,b.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,b.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"source"}),(0,b.jsxs)("select",{value:I,onChange:a=>{let b=a.target.value;J("custom"===b||"convention"===b||"cloud"===b||"pack"===b?b:"")},className:"filter-input","aria-label":"Filter by policy source",children:[(0,b.jsx)("option",{value:"",children:"all sources"}),(0,b.jsx)("option",{value:"custom",children:"custom"}),(0,b.jsx)("option",{value:"convention",children:"convention"}),(0,b.jsx)("option",{value:"cloud",children:"cloud"}),(0,b.jsx)("option",{value:"pack",children:"pack"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"cli"}),(0,b.jsxs)("select",{value:G,onChange:a=>{let b=a.target.value;H(""===b||(0,Q.isKnownCli)(b)?b:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,b.jsx)("option",{value:"",children:"all clis"}),Q.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,Q.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"policy"}),(0,b.jsx)("input",{type:"text",value:C,onChange:a=>D(a.target.value),placeholder:"filter by policy…",className:"filter-input"})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"session"}),(0,b.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"filter by session…",className:"filter-input"})]}),T&&(0,b.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{t(""),B(""),H(""),D(""),F(""),J("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),0===ab.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,b.jsx)(n,{className:"h-12 w-12 text-muted-foreground/30"}),!1===a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,b.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>d?.("policies"),children:"Policies tab"})," ","and click ",(0,b.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:T?"No matching activity.":"Waiting for hook events…"})]}):(0,b.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,b.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{style:{width:32}}),(0,b.jsx)("col",{style:{width:"7%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"13%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}})]}),(0,b.jsx)("thead",{className:"activity-thead",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Time"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-border/30",children:ab.map((a,d)=>{let e="deny"===a.decision,h=q===d,i="instruct"===a.decision;return(0,b.jsxs)(c.Fragment,{children:[(0,b.jsxs)("tr",{onClick:()=>{r(a=>{let b=a===d?null:d,c=ab[d];return f("activity_row_toggled",{expanded:null!==b,decision:c?.decision??null,policy_name:c?.policyName??null,event_type:c?.eventType??null}),b})},className:`activity-data-row cursor-pointer transition-colors ${e?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":i?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":d%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${h?"bg-muted/20":""}`,children:[(0,b.jsx)("td",{className:"px-4 py-2",children:(0,b.jsx)(g.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${h?"rotate-0":"-rotate-90"}`})}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",title:new Date(a.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,S.formatRelativeTime)(a.timestamp)}),(0,b.jsxs)("td",{className:"px-3 py-2",children:[(0,b.jsx)(V,{decision:a.decision}),a.pausedBy&&(0,b.jsx)(A,{})]}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(W,{eventType:a.eventType})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(X,{integration:a.integration})}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.toolName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.policyNames&&a.policyNames.length>1?(0,b.jsxs)("span",{title:a.policyNames.join(", "),children:[a.policyNames[0],(0,b.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",a.policyNames.length-1]})]}):a.policyName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate",title:a.reason??"",children:a.reason??"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:a.permissionMode?(0,b.jsx)(Y,{mode:a.permissionMode}):"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(Z,{ms:a.durationMs})}),(0,b.jsx)("td",{className:"px-3 py-2",title:a.sessionId??"",children:(0,b.jsx)(U,{sessionId:a.sessionId,transcriptPath:a.transcriptPath,integration:a.integration,cwd:a.cwd})})]}),h&&(0,b.jsx)(ac,{item:a})]},`${a.timestamp}-${d}`)})})]})}),(0,b.jsx)(u.default,{currentPage:j,totalPages:ae,onPageChange:a=>{f("activity_pagination_changed",{from_page:j,to_page:a,total_pages:ae}),k(a),r(null)}})]})]})}function ae({enabled:a,onChange:c,disabled:d}){return(0,b.jsx)("button",{onClick:c,disabled:d,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${a?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":a?"Disable policy":"Enable policy",children:(0,b.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${a?"translate-x-3.5":"translate-x-0.5"}`})})}function af({policy:a,onClose:d,onSave:e}){let f=a.params??{},g=a.currentParams??{},[h,i]=(0,c.useState)(()=>{let a={};for(let[b,c]of Object.entries(f)){let d=b in g?g[b]:c.default;a[b]=d}return a});(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&d()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[d]);let j=(a,b)=>{i(c=>({...c,[a]:b}))};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:a=>{a.target===a.currentTarget&&d()},children:(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),(0,b.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(t.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(f).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:a}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:c.description}),((a,c)=>{let d=h[a];if("boolean"===c.type)return(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!!d,onChange:b=>j(a,b.target.checked),className:"rounded border-border"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:c.description})]});if("number"===c.type)return(0,b.jsx)("input",{type:"number",value:"number"==typeof d?d:"",onChange:b=>j(a,Number(b.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===c.type){let c=Array.isArray(d)?d.join("\n"):"";return(0,b.jsx)("textarea",{value:c,onChange:b=>j(a,b.target.value.split("\n").filter(a=>""!==a.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===c.type){let c=Array.isArray(d)?d:[];return(0,b.jsxs)("div",{className:"space-y-1.5",children:[c.map((d,e)=>(0,b.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,b.jsx)("input",{type:"text",value:d.regex,onChange:b=>{let d=[...c];d[e]={...d[e],regex:b.target.value},j(a,d)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("input",{type:"text",value:d.label,onChange:b=>{let d=[...c];d[e]={...d[e],label:b.target.value},j(a,d)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("button",{onClick:()=>j(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,b.jsx)(t.X,{className:"h-3.5 w-3.5"})})]},e)),(0,b.jsx)("button",{onClick:()=>j(a,[...c,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,b.jsx)("input",{type:"text",value:"string"==typeof d?d:"",onChange:b=>j(a,b.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(a,c)]},a))}),(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,b.jsx)(T.Button,{variant:"outline",size:"sm",onClick:d,className:"h-7 text-xs",children:"Cancel"}),(0,b.jsx)(T.Button,{size:"sm",onClick:()=>e(h),className:"h-7 text-xs",children:"Save"})]})]})})}function ag({message:a,onDismiss:c,onInstall:e,isPending:f}){let{capture:g}=(0,N.usePostHog)();return(0,d.createPortal)((0,b.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,b.jsx)("style",{children:`
|
|
2
2
|
@keyframes slideInFromRight {
|
|
3
3
|
from { transform: translateX(calc(100% + 1rem)); opacity: 0; }
|
|
4
4
|
to { transform: translateX(0); opacity: 1; }
|