failproofai 0.0.14-beta.1 → 0.0.14-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  12. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  13. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  21. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  22. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
  23. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  24. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  25. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  26. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  35. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/app/index.html +1 -1
  38. package/.next/standalone/.next/server/app/index.rsc +14 -14
  39. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  40. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  41. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  42. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +9 -9
  43. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  44. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  45. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  48. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  51. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  54. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  55. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  58. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0--lkk6._.js +1 -1
  61. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-219ec._.js +1 -1
  62. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04_h-a5._.js +1 -1
  63. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06cuf1y._.js +1 -1
  64. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08w4wmd._.js +1 -1
  65. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g6bbuw._.js +1 -1
  66. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jnjf2t._.js +1 -1
  67. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q-v9z2._.js +1 -1
  68. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q0qzx1._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q2nbsl._.js +1 -1
  70. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rv7m0k._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__16le-kd._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ffkmds._.js +1 -1
  74. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1fwl2mz._.js +1 -1
  75. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1legmza._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1mrihkj._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1myjm-d._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qb590j._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qxztj-._.js +1 -1
  80. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1shcqgr._.js +1 -1
  81. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1xuedea._.js +1 -1
  82. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +4 -4
  83. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  84. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__015_i4t._.js +2 -2
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__030k0c6._.js +1 -1
  86. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03lv-pe._.js +2 -2
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05r_17v._.js +1 -1
  88. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0wp9w6i._.js → [root-of-the-server]__09v9cwb._.js} +2 -2
  89. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e2l3c1._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hci7t3._.js +1 -1
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hdsupo._.js +2 -2
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p84xee._.js +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qeuy9c._.js +2 -2
  94. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s89hoe._.js +2 -2
  95. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0brjczq._.js → [root-of-the-server]__0twi4fj._.js} +2 -2
  96. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ynf7tx._.js +2 -2
  97. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__170799-._.js +1 -1
  98. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17ai7sy._.js +2 -2
  99. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1nq7ivq._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1tkjqka._.js +2 -2
  101. package/.next/standalone/.next/server/chunks/ssr/_05whahf._.js +1 -1
  102. package/.next/standalone/.next/server/chunks/ssr/_1kje4fm._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +2 -2
  104. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/lib_0xkhw_v._.js +1 -1
  107. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_12rjfea.js → node_modules_html-to-image_es_index_06xsmte.js} +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1ezd2jf._.js +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1tnuifj._.js +1 -1
  110. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  111. package/.next/standalone/.next/server/pages/404.html +1 -1
  112. package/.next/standalone/.next/server/pages/500.html +1 -1
  113. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  114. package/.next/standalone/.next/server/server-reference-manifest.json +10 -10
  115. package/.next/standalone/.next/static/chunks/{0o9wpnze1ey8y.js → 0h-6ymo9v86b0.js} +2 -2
  116. package/.next/standalone/.next/static/chunks/0pndjhcxfu-0t.js +1 -0
  117. package/.next/standalone/.next/static/chunks/1-33f82_l32or.js +1 -0
  118. package/.next/standalone/.next/static/chunks/{2vav_x0_336ds.js → 1bg_g3g359c_d.js} +1 -1
  119. package/.next/standalone/.next/static/chunks/{1359o5785rmve.js → 1gg-8e9q_m__9.js} +2 -2
  120. package/.next/standalone/.next/static/chunks/{0emg30_6svycu.js → 29zkom4s9de2d.js} +1 -1
  121. package/.next/standalone/.next/static/chunks/{0d5lypu1zs21r.js → 2llkdafnaejw_.js} +1 -1
  122. package/.next/standalone/.next/static/chunks/{20tuctw38jbgw.js → 388hgfqye67xa.js} +1 -1
  123. package/.next/standalone/.next/static/chunks/396764jgd7-9j.js +1 -0
  124. package/.next/standalone/.next/static/chunks/3w7g0n0iwwnbs.js +1 -0
  125. package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +11 -2
  126. package/.next/standalone/app/components/copy-button.tsx +22 -6
  127. package/.next/standalone/{ci/cli-integration → integration-suite}/README.md +25 -7
  128. package/.next/standalone/integration-suite/ci-entrypoint.sh +164 -0
  129. package/.next/standalone/{ci/cli-integration → integration-suite}/run.sh +4 -4
  130. package/.next/standalone/lib/format-duration.ts +23 -9
  131. package/.next/standalone/package.json +1 -1
  132. package/.next/standalone/server.js +1 -1
  133. package/dist/cli.mjs +342 -106
  134. package/lib/format-duration.ts +23 -9
  135. package/package.json +1 -1
  136. package/scripts/translate-docs/cli.ts +6 -0
  137. package/scripts/translate-docs/mdx-translator.ts +30 -19
  138. package/scripts/translate-docs/readme-translator.ts +31 -21
  139. package/scripts/translate-docs/translator.ts +142 -7
  140. package/scripts/translate-docs/types.ts +6 -0
  141. package/scripts/translate-docs/validate-translation.ts +132 -0
  142. package/scripts/validate-mdx.ts +80 -11
  143. package/src/audit/cli.ts +12 -6
  144. package/src/auth/cli.ts +14 -5
  145. package/src/hooks/builtin-policies.ts +168 -50
  146. package/src/hooks/configure-wizard.ts +238 -22
  147. package/src/hooks/custom-hooks-loader.ts +70 -4
  148. package/src/hooks/handler.ts +4 -1
  149. package/src/hooks/policy-types.ts +8 -0
  150. package/src/hooks/tui.ts +95 -28
  151. package/.next/standalone/.next/static/chunks/2ldhnaweu9ew3.js +0 -1
  152. package/.next/standalone/.next/static/chunks/3cg7x0joi2b98.js +0 -1
  153. package/.next/standalone/.next/static/chunks/3k87p-tijud-4.js +0 -1
  154. package/.next/standalone/.next/static/chunks/3kmaqcp7rldad.js +0 -1
  155. /package/.next/standalone/.next/static/{LkN-JjmhKGmL-WklH7WVi → YKxI22hC-F_nHp7MEKfb1}/_buildManifest.js +0 -0
  156. /package/.next/standalone/.next/static/{LkN-JjmhKGmL-WklH7WVi → YKxI22hC-F_nHp7MEKfb1}/_clientMiddlewareManifest.js +0 -0
  157. /package/.next/standalone/.next/static/{LkN-JjmhKGmL-WklH7WVi → YKxI22hC-F_nHp7MEKfb1}/_ssgManifest.js +0 -0
  158. /package/.next/standalone/{ci/cli-integration → integration-suite}/Dockerfile +0 -0
  159. /package/.next/standalone/{ci/cli-integration → integration-suite}/canary-policies.mjs +0 -0
  160. /package/.next/standalone/{ci/cli-integration → integration-suite}/capture-tokens.sh +0 -0
  161. /package/.next/standalone/{ci/cli-integration → integration-suite}/inject-tokens.sh +0 -0
  162. /package/.next/standalone/{ci/cli-integration → integration-suite}/install-clis.sh +0 -0
  163. /package/.next/standalone/{ci/cli-integration → integration-suite}/probe-cli.sh +0 -0
  164. /package/.next/standalone/{ci/cli-integration → integration-suite}/report.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[50227,(e,t,n)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,n)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,n)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,n)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},74533,(e,t,n)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},18622,(e,t,n)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,n)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,n)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},94930,e=>{"use strict";var t=e.i(2157),n=e.i(50227),i=e.i(66680);e.s(["writeJsonAtomically",0,function(e,s,r={}){let o=r.mode??384,a=r.dirMode??448,l=(0,n.dirname)(e);(0,t.existsSync)(l)||(0,t.mkdirSync)(l,{recursive:!0,mode:a});let u=`${e}.${process.pid}.${(0,i.randomBytes)(6).toString("hex")}.tmp`;try{(0,t.writeFileSync)(u,JSON.stringify(s,null,2),{mode:o});try{(63&(0,t.statSync)(u).mode)!=0&&(0,t.chmodSync)(u,o)}catch{}(0,t.renameSync)(u,e);try{(63&(0,t.statSync)(e).mode)!=0&&(0,t.chmodSync)(e,o)}catch{}}catch(e){try{(0,t.rmSync)(u,{force:!0})}catch{}throw e}}])},24214,(e,t,n)=>{t.exports={name:"failproofai",version:"0.0.14-beta.1",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.111.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.3","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.1","@types/react":"19.2.17","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^29.1.1","lucide-react":"^1.18.0",next:"^16.2.9",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.37.1","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{postcss:"8.5.14","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.28.0"}}},28067,e=>{"use strict";e.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])},10659,e=>{"use strict";let t;var n=e.i(2157),i=e.i(50227),s=e.i(60526),r=e.i(66680);e.i(74533);let o=i.default.join(s.default.homedir(),".failproofai"),a=i.default.join(o,"instance-id");function l(e){return r.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(s.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=n.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return t=l(e);let i=[s.default.hostname(),s.default.homedir(),s.default.platform(),s.default.arch(),s.default.cpus()[0]?.model??""].join(":");return t=i?l(i):function(){try{let e=n.default.readFileSync(a,"utf-8").trim();if(e)return e}catch{}let e=r.default.randomUUID();try{n.default.mkdirSync(o,{recursive:!0}),n.default.writeFileSync(a,e,"utf-8")}catch{}return e}()}])},72561,e=>{"use strict";var t=e.i(10659),n=e.i(24214),i=e.i(28067);let s=i.POSTHOG_API_KEY;async function r(e,t){for(let n=1;n<=5;n++){try{let{signal:n,...i}=t,s=await fetch(e,{...i,signal:AbortSignal.timeout(5e3)});if(s.ok)return s}catch{}if(n<5){let e=Math.min(1e3*2**(n-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}function o(){return"1"!==process.env.FAILPROOFAI_TELEMETRY_DISABLED}async function a(){try{if(!o()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),n=process.env.FAILPROOFAI_POSTHOG_KEY??s,i=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(n,{host:i,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:r});let a=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",a),process.on("SIGTERM",a),process.on("SIGINT",a)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,a,"trackEvent",0,function(e,s){if(!o())return;let r=globalThis.__FAILPROOFAI_POSTHOG__;r&&r.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...s,$lib:"failproofai",failproofai_version:n.version,product:i.POSTHOG_PRODUCT}})}])},64199,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=/^[0-9a-fA-F-]{36}$/;function u(){return process.env.OPENCLAW_HOME||(0,s.join)((0,i.homedir)(),".openclaw")}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(){let e,t=(0,s.join)(u(),"agents"),i=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return i}for(let r of e){let e,o=(0,s.join)(t,r,"sessions");try{e=(0,n.readdirSync)(o)}catch{continue}for(let t of e){if(!t.endsWith(".jsonl")||t.endsWith(".trajectory.jsonl"))continue;let e=t.slice(0,-6);if(!l.test(e))continue;let a=(0,s.join)(o,t);try{let t=(0,n.statSync)(a);i.push({agentId:r,sessionId:e,transcriptPath:a,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}}return i}function m(e){if(!l.test(e))return null;for(let t of f())if(t.sessionId===e)return t.transcriptPath;return null}async function p(e){let n,i,s=m(e);if(!s)return null;try{n=await (0,t.readFile)(s,"utf-8")}catch{return null}let r=(0,o.parseRawLines)(n,"session"),l=function(e,t="session"){let n=[],i=new Map,s=new Map,r=Date.now();for(let l=0;l<e.length;l++){let u=e[l];if(!c(u)||"message"!==u.type)continue;let f=c(u.message)?u.message:void 0;if(!f)continue;let m="string"==typeof f.role?f.role:"system",p=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(u.timestamp??f.timestamp,r+l),y=p.toISOString(),g={uuid:null!=u.id?String(u.id):`openclaw-${l}`,parentUuid:null!=u.parentId?String(u.parentId):null},h=(0,o.baseEntry)(g,y,p,t);if("user"===m){n.push({type:"user",...h,message:{role:"user",content:d(f.content)}});continue}if("assistant"===m){let e=[],t=f.content;if(Array.isArray(t)){for(let n of t)if(c(n)){if("text"===n.type&&"string"==typeof n.text)e.push({type:"text",text:n.text});else if("toolCall"===n.type){let t="string"==typeof n.id?n.id:`${String(n.name??"tool")}-${e.length}`,r={type:"tool_use",id:t,name:"string"==typeof n.name?n.name:"tool",input:c(n.arguments)?n.arguments:{}};e.push(r),i.set(t,r),s.set(t,p.getTime())}}}else{let n=d(t);n&&e.push({type:"text",text:n})}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e,model:"string"==typeof f.model?f.model:void 0}});continue}if("toolResult"===m){let e="string"==typeof f.toolCallId?f.toolCallId:void 0,t=e?i.get(e):void 0;if(t){let n=c(f.details)?f.details:void 0,i=e&&s.get(e)||p.getTime(),r=n&&"number"==typeof n.durationMs?n.durationMs:Math.max(0,p.getTime()-i);t.result={timestamp:y,timestampFormatted:(0,o.formatTimestamp)(p),content:d(f.content),durationMs:r,durationFormatted:(0,a.formatDuration)(r)};continue}}n.push({type:"system",...h,raw:g})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(r,"session");for(let e of r)if(c(e)&&"session"===e.type&&"string"==typeof e.cwd&&e.cwd.length>0){i=e.cwd;break}return{entries:l,rawLines:r,cwd:i,filePath:s}}(0,r.runtimeCache)(e=>p(e),2,{maxSize:50}),e.s(["findOpenClawTranscript",0,m,"getOpenClawSessionLog",0,p,"listOpenClawTranscripts",0,f,"openclawHome",0,u])},28246,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),r=e.i(81580),o=e.i(83534),a=e.i(54214),l=e.i(67405);let u=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(e,t="session"){let n=[],i=new Map,s=new Map,r=Date.now();for(let o=0;o<e.length;o++){let u=e[o];if(!c(u)||"message"!==u.type)continue;let f=c(u.message)?u.message:void 0;if(!f)continue;let m="string"==typeof f.role?f.role:"system",p=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(u.timestamp??f.timestamp,r+o),y=p.toISOString(),g={uuid:null!=u.id?String(u.id):`factory-${o}`,parentUuid:null!=u.parentId?String(u.parentId):null},h=(0,a.baseEntry)(g,y,p,t),w=f.content;if("assistant"===m){let e=[];if(Array.isArray(w)){for(let t of w)if(c(t)){if("text"===t.type&&"string"==typeof t.text)e.push({type:"text",text:t.text});else if("tool_use"===t.type){let n="string"==typeof t.id?t.id:`${String(t.name??"tool")}-${e.length}`,r={type:"tool_use",id:n,name:"string"==typeof t.name?t.name:"tool",input:c(t.input)?t.input:{}};e.push(r),i.set(n,r),s.set(n,p.getTime())}}}else{let t=d(w);t&&e.push({type:"text",text:t})}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e,model:"string"==typeof f.model?f.model:void 0}});continue}if(Array.isArray(w)){let e=!1,t=[];for(let n of w)if(c(n)){if("tool_result"===n.type){let t="string"==typeof n.tool_use_id?n.tool_use_id:"string"==typeof n.toolUseId?n.toolUseId:void 0,r=t?i.get(t):void 0;if(r){let i=t&&s.get(t)||p.getTime(),o=Math.max(0,p.getTime()-i);r.result={timestamp:y,timestampFormatted:(0,a.formatTimestamp)(p),content:d(n.content),durationMs:o,durationFormatted:(0,l.formatDuration)(o)},e=!0;continue}}"text"===n.type&&"string"==typeof n.text&&t.push(n.text)}t.length>0?n.push({type:"user",...h,message:{role:"user",content:t.join("\n")}}):e||n.push({type:"system",...h,raw:g});continue}if("user"===m){n.push({type:"user",...h,message:{role:"user",content:d(w)}});continue}n.push({type:"system",...h,raw:g})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}function m(){let e,t=(0,s.join)(process.env.FACTORY_HOME||(0,s.join)((0,i.homedir)(),".factory"),"sessions"),o=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory())}catch{return o}for(let i of e){let e,a=i.name,l=(0,r.decodeFolderName)(a),c=(0,s.join)(t,a);try{e=(0,n.readdirSync)(c)}catch{continue}for(let t of e){if(!t.endsWith(".jsonl"))continue;let e=t.slice(0,-6);if(!u.test(e))continue;let i=(0,s.join)(c,t);try{let t=(0,n.statSync)(i);o.push({projectName:a,cwd:l,sessionId:e,transcriptPath:i,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}}return o}function p(e){if(!u.test(e))return null;for(let t of m())if(t.sessionId===e)return t.transcriptPath;return null}async function y(e){let n,i,s=p(e);if(!s)return null;try{n=await (0,t.readFile)(s,"utf-8")}catch{return null}let r=(0,a.parseRawLines)(n,"session"),o=f(r,"session");for(let e of r)if(c(e)&&"session_start"===e.type&&"string"==typeof e.cwd&&e.cwd.length>0){i=e.cwd;break}return{entries:o,rawLines:r,cwd:i,filePath:s}}(0,o.runtimeCache)(e=>y(e),60,{maxSize:50}),e.s(["factoryLinesToLogEntries",0,f,"findFactoryTranscript",0,p,"getFactorySessionLog",0,y,"listFactoryTranscripts",0,m])},47756,48480,e=>{"use strict";var t=e.i(2157),n=e.i(50227),i=e.i(60526),s=e.i(94930);function r(){return(0,n.join)((0,i.homedir)(),".failproofai","audit-dashboard.json")}e.s(["readDashboardCache",0,function(){let e=r();if(!(0,t.existsSync)(e))return null;try{let n=(0,t.readFileSync)(e,"utf-8"),i=JSON.parse(n);if(!i||"object"!=typeof i||"string"!=typeof i.cachedAt||!i.params||"object"!=typeof i.params||!i.result||"object"!=typeof i.result||2!==i.schemaVersion||function(e,t=30){let n=new Date(e).getTime();return!!Number.isNaN(n)||Date.now()-n>6e4*t}(i.cachedAt,10080))return null;return i}catch{return null}},"writeDashboardCache",0,function(e,t){try{let n={schemaVersion:2,cachedAt:new Date().toISOString(),params:e,result:t};return(0,s.writeJsonAtomically)(r(),n),!0}catch{return!1}}],47756);let o={running:!1,error:null};e.s(["finishRun",0,function(e){o.running=!1,o.startedAt=void 0,o.error=e},"getRunState",0,function(){return{...o}},"tryAcquireRun",0,function(){return!o.running&&(o.running=!0,o.startedAt=Date.now(),o.error=null,!0)}],48480)},55851,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);async function u(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function c(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function d(){let e=(0,i.join)(process.env.COPILOT_HOME||(0,i.join)((0,n.homedir)(),".copilot"),"session-state"),s=await u(e);if(!s)return[];let r=s.filter(e=>e.isDirectory()).map(t=>({sessionId:t.name,workspacePath:(0,i.join)(e,t.name,"workspace.yaml"),eventsPath:(0,i.join)(e,t.name,"events.jsonl")}));return(await (0,o.batchAll)(r.map(e=>async()=>{let n;try{n=await (0,t.readFile)(e.workspacePath,"utf-8")}catch{return null}let i=function(e){let t=e.match(/^cwd\s*:\s*(.+?)\s*$/m);if(t)return t[1].replace(/^['"]|['"]$/g,"")}(n);if(!i)return null;let s=await c(e.eventsPath),r=await c(e.workspacePath),o=null!==s,a=s&&r?new Date(Math.max(s.getTime(),r.getTime())):s??r??new Date(0);return{workspacePath:e.workspacePath,eventsPath:e.eventsPath,sessionId:e.sessionId,cwd:i,fileMtime:a,hasTranscript:o}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let f=(0,r.runtimeCache)(d,30);async function m(){let e;try{e=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),[]}let t=new Map;for(let n of e){if(!n.hasTranscript)continue;let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["copilot"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function p(e){let t=e.filter(e=>e.hasTranscript).map(e=>({name:e.sessionId,path:e.eventsPath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"copilot"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function y(e){let t;try{t=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),[]}return p(t.filter(t=>t.cwd===e))}async function g(e){let t;try{t=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>t.hasTranscript&&(0,s.encodeFolderName)(t.cwd)===e);return{cwd:n[0]?.cwd??null,sessions:p(n)}}let h=(0,r.runtimeCache)(m,30),w=(0,r.runtimeCache)(e=>y(e),30,{maxSize:50}),_=(0,r.runtimeCache)(e=>g(e),30,{maxSize:50});e.s(["getCachedCopilotProjects",0,h,"getCachedCopilotSessionsByEncodedName",0,_,"getCachedCopilotSessionsForCwd",0,w,"getCopilotProjects",0,m,"getCopilotSessionsByEncodedName",0,g,"getCopilotSessionsForCwd",0,y])},19791,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);let u=/^[\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;async function c(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function d(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function f(e){let n;try{n=await (0,t.readFile)(e,"utf-8")}catch{return null}let i=n.indexOf("\n")>=0?n.slice(0,n.indexOf("\n")):n;if(!i)return null;try{let e=JSON.parse(i);if("session"!==e.type||"string"!=typeof e.cwd||0===e.cwd.length)return null;return e.cwd}catch{return null}}async function m(){let e=process.env.PI_SESSIONS_DIR||(0,i.join)((0,n.homedir)(),".pi","agent","sessions"),t=await c(e);if(!t)return[];let s=[];for(let n of t){if(!n.isDirectory())continue;let t=(0,i.join)(e,n.name),r=await c(t);if(r)for(let e of r){if(!e.isFile())continue;let n=u.exec(e.name);n&&s.push({sessionId:n[1],filePath:(0,i.join)(t,e.name)})}}return 0===s.length?[]:(await (0,o.batchAll)(s.map(e=>async()=>{let t=await f(e.filePath);if(!t)return null;let n=await d(e.filePath);return n?{filePath:e.filePath,sessionId:e.sessionId,cwd:t,fileMtime:n}:null}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let p=(0,r.runtimeCache)(m,30);async function y(){let e;try{e=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),[]}let t=new Map;for(let n of e){let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["pi"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function g(e){let t=e.map(e=>({name:e.sessionId,path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"pi"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function h(e){let t;try{t=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),[]}return g(t.filter(t=>t.cwd===e))}async function w(e){let t;try{t=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>(0,s.encodeFolderName)(t.cwd)===e),i=Array.from(new Set(n.map(e=>e.cwd)));return 1!==i.length?{cwd:null,sessions:[]}:{cwd:i[0],sessions:g(n)}}let _=(0,r.runtimeCache)(y,30),S=(0,r.runtimeCache)(e=>h(e),30,{maxSize:50}),v=(0,r.runtimeCache)(e=>w(e),30,{maxSize:50});e.s(["getCachedPiProjects",0,_,"getCachedPiSessionsByEncodedName",0,v,"getCachedPiSessionsForCwd",0,S,"getPiProjects",0,y,"getPiSessionsByEncodedName",0,w,"getPiSessionsForCwd",0,h])},36203,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);let u=(0,i.join)((0,n.homedir)(),".codex","sessions"),c=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;async function d(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function f(e){let n=null;try{n=await (0,t.open)(e,"r");let i=Buffer.alloc(262144),{bytesRead:s}=await n.read(i,0,262144,0);if(0===s)return null;let r=i.subarray(0,s),o=r.indexOf(10),a=-1===o?s:o;return r.subarray(0,a).toString("utf-8")}catch{return null}finally{n&&await n.close().catch(()=>{})}}async function m(e){let t=await d(e);return t?t.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")).map(t=>(0,i.join)(e,t.name)):[]}async function p(){let e=await d(u);if(!e)return[];let n=[];for(let t of e){if(!t.isDirectory())continue;let e=await d((0,i.join)(u,t.name));if(e)for(let s of e){if(!s.isDirectory())continue;let e=await d((0,i.join)(u,t.name,s.name));if(e)for(let r of e){if(!r.isDirectory())continue;let e=(0,i.join)(u,t.name,s.name,r.name);n.push(...await m(e))}}}return 0===n.length?[]:(await (0,o.batchAll)(n.map(e=>async()=>{let n,i,s=(i=(e.split("/").pop()??"").match(c))?i[0]:null;if(!s)return null;let r=await f(e);if(!r)return null;let{cwd:o}=function(e){try{let t=JSON.parse(e);if("session_meta"!==t.type)return{};let n=t.payload?.cwd;if("string"!=typeof n||0===n.length)return{};return{cwd:n}}catch{return{}}}(r);if(!o)return null;try{let i=await (0,t.open)(e,"r");try{n=(await i.stat()).mtime}finally{await i.close().catch(()=>{})}}catch{n=new Date(0)}return{filePath:e,fileName:e.split("/").pop()??"",cwd:o,sessionId:s,fileMtime:n}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let y=(0,r.runtimeCache)(p,30);async function g(){let e;try{e=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),[]}let t=new Map;for(let n of e){let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["codex"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function h(e){let t=e.map(e=>({name:e.fileName.replace(/\.jsonl$/,""),path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"codex"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function w(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),[]}return h(t.filter(t=>t.cwd===e))}async function _(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>(0,s.encodeFolderName)(t.cwd)===e);return{cwd:n[0]?.cwd??null,sessions:h(n)}}let S=(0,r.runtimeCache)(g,30),v=(0,r.runtimeCache)(e=>w(e),30,{maxSize:50}),M=(0,r.runtimeCache)(e=>_(e),30,{maxSize:50});e.s(["getCachedCodexProjects",0,S,"getCachedCodexSessionsByEncodedName",0,M,"getCachedCodexSessionsForCwd",0,v,"getCodexProjects",0,g,"getCodexSessionsByEncodedName",0,_,"getCodexSessionsForCwd",0,w])},35435,e=>{"use strict";var t=e.i(74533),n=e.i(81580),i=e.i(83534),s=e.i(28557),r=e.i(40911);function o(e){try{let n=(0,t.execFileSync)("opencode",["db","--format","json",e],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]});if(!n.trim())return[];let i=JSON.parse(n);if(!Array.isArray(i))return null;return i}catch{return null}}function a(){return o("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT 1000")}function l(){return o("SELECT id, worktree, vcs, name, time_created, time_updated FROM project")}async function u(){let e=a(),t=l();if(null===e&&null===t)return[];let i=new Map;for(let e of t??[])i.set(e.id,e);let r=new Map;for(let t of e??[]){if(!t.project_id)continue;let e=r.get(t.project_id);e||(e={rows:[],latest:0},r.set(t.project_id,e)),e.rows.push(t),t.time_updated>e.latest&&(e.latest=t.time_updated)}let o=new Set,u=[];for(let[e,t]of r){o.add(e);let r=i.get(e),a=r?.worktree??t.rows[0]?.directory??null,l=a?(0,n.encodeFolderName)(a):e,c=a??"",d=new Date(Math.max(t.latest,r?.time_updated??0));u.push({name:l,path:c,isDirectory:!0,lastModified:d,lastModifiedFormatted:(0,s.formatDate)(d),cli:["opencode"]})}for(let e of t??[]){if(o.has(e.id))continue;let t=e.worktree??"",i=t?(0,n.encodeFolderName)(t):e.id,r=new Date(e.time_updated);u.push({name:i,path:t,isDirectory:!0,lastModified:r,lastModifiedFormatted:(0,s.formatDate)(r),cli:["opencode"]})}return u.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),u}async function c(e){let t=a();return t?t.filter(t=>t.directory===e).map(e=>{let t=new Date(e.time_updated);return{name:e.title??e.slug??e.id,path:`opencode://${e.id}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.id,cli:"opencode"}}):[]}async function d(e){let t,i;try{t=l(),i=a()}catch(e){return(0,r.logWarn)("Failed to read OpenCode DB:",e),{cwd:null,sessions:[]}}if(!t||!i)return{cwd:null,sessions:[]};let o=t.find(t=>t.worktree&&(0,n.encodeFolderName)(t.worktree)===e);if(!o||!o.worktree)return{cwd:null,sessions:[]};let u=i.filter(e=>e.project_id===o.id);return{cwd:o.worktree,sessions:u.map(e=>{let t=new Date(e.time_updated);return{name:e.title??e.slug??e.id,path:`opencode://${e.id}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.id,cli:"opencode"}})}}let f=(0,i.runtimeCache)(u,30),m=(0,i.runtimeCache)(e=>c(e),30,{maxSize:50}),p=(0,i.runtimeCache)(e=>d(e),30,{maxSize:50});e.s(["getCachedOpenCodeProjects",0,f,"getCachedOpenCodeSessionsByEncodedName",0,p,"getCachedOpenCodeSessionsForCwd",0,m,"getOpenCodeProjects",0,u,"getOpenCodeSessionsByEncodedName",0,d,"getOpenCodeSessionsForCwd",0,c])},78166,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214),a=e.i(67405);function l(e,t){let n=function(e){if(!e)return null;let t=(0,i.resolve)((0,i.join)(process.env.COPILOT_HOME||(0,i.join)((0,s.homedir)(),".copilot"),"session-state")),n=(0,i.resolve)(t,e);return n!==t&&n.startsWith(`${t}${i.sep}`)?n:null}(e);return n?(0,i.join)(n,t):null}function u(e){let n=l(e,"events.jsonl");return n&&(0,t.existsSync)(n)?n:null}async function c(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,u=new Map,d=!1;for(let e=0;e<i.length;e++){let c;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let f=i[e];try{c=JSON.parse(f)}catch{continue}let m={...c,_source:t};r.push(m);let p=c.timestamp;if(!p)continue;let y=new Date(p);if(Number.isNaN(y.getTime()))continue;let g=y.toISOString(),h=c.type,w=c.data??{};if("session.start"===h){let e=w.context,i=e?.cwd;"string"!=typeof i||n||(n=i);let r=d?"Session Resumed":"Session Started";d=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(m,g,y,t),label:r});continue}if("user.message"===h){let e=w.content??"";if(!e)continue;s.push({type:"user",...(0,o.baseEntry)(m,g,y,t),message:{role:"user",content:e}});continue}if("system.message"===h){s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m});continue}if("assistant.message"===h){let e=w.content??"";if(!e){s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m});continue}let n=[{type:"text",text:e}];s.push({type:"assistant",...(0,o.baseEntry)(m,g,y,t),message:{role:"assistant",content:n}});continue}if("tool.execution_start"===h){let e=w.toolCallId,n=w.toolName??"tool",i=w.arguments??{},r={type:"tool_use",id:e??`${y.getTime()}-${n}`,name:n,input:i},a={type:"assistant",...(0,o.baseEntry)(m,g,y,t),message:{role:"assistant",content:[r]}};s.push(a),e&&(l.set(e,r),u.set(e,y.getTime()));continue}if("tool.execution_complete"===h){let e=w.toolCallId,n=e?l.get(e):void 0;if(n){let t=u.get(e)??y.getTime(),i=w.result??{},s=w.toolTelemetry??{},r=s.metrics?.commandTimeMs??s.metrics?.durationMs??null,l="number"==typeof r&&r>=0?r:Math.max(0,y.getTime()-t),c=i.detailedContent??i.content??"";n.result={timestamp:g,timestampFormatted:(0,o.formatTimestamp)(y),content:"string"==typeof c?c:JSON.stringify(c),durationMs:l,durationFormatted:(0,a.formatDuration)(l)};continue}s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m});continue}s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function d(e){let i,s=u(e);if(!s)return null;try{i=await (0,n.readFile)(s,"utf-8")}catch{return null}let{entries:r,rawLines:o,cwd:a}=await c(i,"session");return{entries:r,rawLines:o,cwd:a??function(e){let n,i=(n=l(e,"workspace.yaml"))&&(0,t.existsSync)(n)?n:null;if(i)try{let e=(0,t.readFileSync)(i,"utf-8"),n=RegExp("^cwd\\s*:\\s*(.+?)\\s*$","m"),s=e.match(n);if(!s)return;return s[1].replace(/^['"]|['"]$/g,"")}catch{return}}(e),filePath:s}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),e.s(["findCopilotTranscript",0,u,"getCopilotSessionLog",0,d])},99440,e=>{"use strict";var t=e.i(74533),n=e.i(83534),i=e.i(54214),s=e.i(67405);function r(e){try{let n=(0,t.execFileSync)("opencode",["db","--format","json",e],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]});if(!n.trim())return[];let i=JSON.parse(n);if(!Array.isArray(i))return null;return i}catch{return null}}function o(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function a(e){if("string"!=typeof e||0===e.length)return null;try{let t=JSON.parse(e);return o(t)?t:null}catch{return null}}async function l(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=r(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = '${e}'`);if(!t||0===t.length)return null;let n=t[0],l=r(`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = '${e}' ORDER BY time_created ASC`),u=r(`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = '${e}' ORDER BY time_created ASC`);if(!l)return{entries:[],rawLines:[],cwd:n.directory??void 0,filePath:`opencode://${e}`};let c=new Map;for(let e of u??[]){let t=c.get(e.message_id);t||(t=[],c.set(e.message_id,t)),t.push(e)}let d=[],f=[];for(let e of l){let t=c.get(e.id)??[];d.push(function(e,t,n){let r=a(e.data)??{},l="string"==typeof r.role?r.role:"system",u=new Date(e.time_created),c=u.toISOString(),d={uuid:e.id,parentUuid:null},f=(0,i.baseEntry)(d,c,u,n),m=[],p="";for(let e of t){let t=a(e.data);if(!t)continue;let n="string"==typeof t.type?t.type:"unknown";if("text"===n){let e="string"==typeof t.text?t.text:"string"==typeof t.content?t.content:"";e&&(m.push({type:"text",text:e}),p+=(p?"\n":"")+e);continue}if("tool"===n){let n="string"==typeof t.tool?t.tool:"string"==typeof t.name?t.name:"tool",r=o(t.state)?t.state:null,a=r&&o(r.input)?r.input:o(t.input)?t.input:o(t.args)?t.args:{},l={type:"tool_use",id:e.id,name:n,input:a},u=r&&"string"==typeof r.status?r.status:"";if(r&&("completed"===u||"error"===u)){let t=("error"===u&&"string"==typeof r.error?r.error:null)??r.output,n="string"==typeof t?t:null!=t?JSON.stringify(t):"",a=o(r.time)?r.time:{},c="number"==typeof a.start?a.start:e.time_created,d="number"==typeof a.end?a.end:e.time_updated,f=Math.max(0,d-c),m=new Date(d);l.result={timestamp:m.toISOString(),timestampFormatted:(0,i.formatTimestamp)(m),content:n,durationMs:f,durationFormatted:(0,s.formatDuration)(f)}}m.push(l);continue}m.push({type:"text",text:`[opencode ${n}]`})}if("user"===l)return{...f,type:"user",message:{role:"user",content:p}};if("assistant"===l){let e=o(r.model)?r.model:null,t=e&&"string"==typeof e.modelID?e.modelID:void 0;return{...f,type:"assistant",message:{role:"assistant",content:m,model:t}}}return{...f,type:"system",raw:{id:e.id,role:l,parts:m}}}(e,t,"session"));let n=a(e.data);f.push({id:e.id,session_id:e.session_id,time_created:e.time_created,data:n??e.data})}return{entries:d,rawLines:f,cwd:n.directory??void 0,filePath:`opencode://${e}`}}async function u(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=r(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = '${e}'`);if(!t||0===t.length)return null;let n=r(`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = '${e}' ORDER BY time_created ASC`),i=r(`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = '${e}' ORDER BY time_created ASC`);return null===n||null===i?null:{session:t[0],messages:n.map(e=>({...e,data:a(e.data)??e.data})),parts:i.map(e=>({...e,data:a(e.data)??e.data}))}}(0,n.runtimeCache)(e=>l(e),30,{maxSize:50}),e.s(["getOpenCodeSessionExport",0,u,"getOpenCodeSessionLog",0,l])},57232,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=(0,i.join)((0,s.homedir)(),".failproofai","cache","codex-session-paths.json");function u(){try{if(!(0,t.existsSync)(l))return{};return JSON.parse((0,t.readFileSync)(l,"utf-8"))}catch{return{}}}function c(e,n){try{(0,t.mkdirSync)((0,i.dirname)(l),{recursive:!0});let s=u();s[e]=n,(0,t.writeFileSync)(l,JSON.stringify(s),"utf-8")}catch{}}function d(e,n){try{for(let s of(0,t.readdirSync)(e,{withFileTypes:!0}))if(s.isFile()&&s.name.includes(n)&&s.name.endsWith(".jsonl"))return(0,i.join)(e,s.name)}catch{}return null}function f(e){let n=u()[e];if(n&&(0,t.existsSync)(n))return n;let r=(0,i.join)((0,s.homedir)(),".codex","sessions"),o=new Date,a=new Date(o.getTime()-864e5);for(let t of[o,a].map(e=>{let t=String(e.getUTCFullYear()),n=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return(0,i.join)(r,t,n,s)})){let n=d(t,e);if(n)return c(e,n),n}try{for(let n of(0,t.readdirSync)(r,{withFileTypes:!0}))if(n.isDirectory()){for(let s of(0,t.readdirSync)((0,i.join)(r,n.name),{withFileTypes:!0}))if(s.isDirectory())for(let o of(0,t.readdirSync)((0,i.join)(r,n.name,s.name),{withFileTypes:!0})){if(!o.isDirectory())continue;let t=d((0,i.join)(r,n.name,s.name,o.name),e);if(t)return c(e,t),t}}}catch{}return null}function m(e,t){return Array.isArray(e)?e.filter(e=>e?.type===t&&"string"==typeof e.text).map(e=>e.text).join("\n"):""}async function p(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,u=new Map,c=!1;for(let e=0;e<i.length;e++){let d;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let f=i[e];try{d=JSON.parse(f)}catch{continue}let p={...d,_source:t};r.push(p);let y=d.timestamp;if(!y)continue;let g=new Date(y);if(Number.isNaN(g.getTime()))continue;let h=d.type,w=d.payload??{};if("session_meta"===h){let e=w.cwd;"string"!=typeof e||n||(n=e),s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("response_item"===h){let e=w.type;if("message"===e){let e=w.role,n=w.content;if("user"===e||"developer"===e){let i=m(n,"input_text");if(!i)continue;let r="developer"===e?`[developer] ${i}`:i;s.push({type:"user",...(0,o.baseEntry)(p,y,g,t),message:{role:"user",content:r}});continue}if("assistant"===e){let e=m(n,"output_text");if(!e)continue;let i=[{type:"text",text:e}];s.push({type:"assistant",...(0,o.baseEntry)(p,y,g,t),message:{role:"assistant",content:i}});continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("function_call"===e){let e=w.call_id,n=w.name??"function_call",i={type:"tool_use",id:e??`${y}-${n}`,name:n,input:function(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}(w.arguments)},r={type:"assistant",...(0,o.baseEntry)(p,y,g,t),message:{role:"assistant",content:[i]}};s.push(r),e&&(l.set(e,i),u.set(e,g.getTime()));continue}if("function_call_output"===e){let e=w.call_id,n=e?l.get(e):void 0;if(n){let t=u.get(e)??g.getTime(),i=Math.max(0,g.getTime()-t);n.result={timestamp:y,timestampFormatted:(0,o.formatTimestamp)(g),content:"string"==typeof w.output?w.output:JSON.stringify(w.output),durationMs:i,durationFormatted:(0,a.formatDuration)(i)};continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("event_msg"===h){let e=w.type;if("task_started"===e){let e=c?"Session Resumed":"Session Started";c=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(p,y,g,t),label:e});continue}if("exec_command_end"===e){let e=w.call_id,n=e?l.get(e):void 0;if(n){let t=w.duration,i=t?(t.secs??0)*1e3+Math.round((t.nanos??0)/1e6):Math.max(0,g.getTime()-(u.get(e)??g.getTime())),s=w.aggregated_output;n.result={timestamp:y,timestampFormatted:(0,o.formatTimestamp)(g),content:"string"==typeof s?s:JSON.stringify(s),durationMs:i,durationFormatted:(0,a.formatDuration)(i)};continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("user_message"===e||"agent_message"===e)continue;s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function y(e){let t=f(e);if(!t)return null;let i=await (0,n.readFile)(t,"utf-8"),{entries:s,rawLines:r,cwd:o}=await p(i,"session");return{entries:s,rawLines:r,cwd:o,filePath:t}}(0,r.runtimeCache)(e=>y(e),60,{maxSize:50}),e.s(["findCodexTranscript",0,f,"getCodexSessionLog",0,y])},85116,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214);let a=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,l=/^[\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 u(e){let n;if(!a.test(e))return null;let r=(0,i.resolve)(process.env.PI_SESSIONS_DIR||(0,i.join)((0,s.homedir)(),".pi","agent","sessions"));try{n=(0,t.readdirSync)(r)}catch{return null}for(let s of n){let n,o=(0,i.resolve)(r,s);if(o.startsWith(`${r}${i.sep}`)){try{n=(0,t.readdirSync)(o)}catch{continue}for(let s of n){let n=l.exec(s);if(!n||n[1].toLowerCase()!==e.toLowerCase())continue;let r=(0,i.resolve)(o,s);if(r.startsWith(`${o}${i.sep}`)&&(0,t.existsSync)(r))return r}}}return null}async function c(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],a=!1;for(let e=0;e<i.length;e++){let l;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let u=i[e];try{l=JSON.parse(u)}catch{continue}let c={...l,_source:t};r.push(c);let d=l.timestamp;if(!d)continue;let f=new Date(d);if(Number.isNaN(f.getTime()))continue;let m=f.toISOString(),p=l.type;if("session"===p){"string"!=typeof l.cwd||n||(n=l.cwd);let e=a?"Session Resumed":"Session Started";a=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(c,m,f,t),label:e});continue}if("message"===p&&l.message&&"object"==typeof l.message){let e=l.message.role,n=l.message.content;if("user"===e){let e=function(e){if(!Array.isArray(e))return"";let t=[];for(let n of e)n?.type==="text"&&"string"==typeof n.text&&t.push(n.text);return t.join("\n\n")}(n);if(!e)continue;s.push({type:"user",...(0,o.baseEntry)(c,m,f,t),message:{role:"user",content:e}});continue}if("assistant"===e){let e=function(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)n?.type==="text"&&"string"==typeof n.text&&n.text.length>0&&t.push({type:"text",text:n.text}),n?.type==="thinking"&&"string"==typeof n.thinking&&n.thinking.length>0&&t.push({type:"text",text:`[thinking] ${n.thinking}`});return t}(n);if(0===e.length){s.push({type:"system",...(0,o.baseEntry)(c,m,f,t),raw:c});continue}s.push({type:"assistant",...(0,o.baseEntry)(c,m,f,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,o.baseEntry)(c,m,f,t),raw:c});continue}s.push({type:"system",...(0,o.baseEntry)(c,m,f,t),raw:c})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function d(e){let t,i,s=u(e);if(!s)return null;try{t=await (0,n.readFile)(s,"utf-8")}catch{return null}try{i=await c(t,"session")}catch{return null}return{entries:i.entries,rawLines:i.rawLines,cwd:i.cwd,filePath:s}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),o.formatTimestamp,e.s(["findPiTranscript",0,u,"getPiSessionLog",0,d])},46413,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);let u=["agent-sessions","conversations","sessions"],c=["meta.json","session.json","workspace.json","workspace.yaml"],d=["events.jsonl","transcript.jsonl","messages.jsonl"];async function f(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function m(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function p(e,n){for(let s of n){let n,r=(0,i.join)(e,s);if(await m(r)===null)continue;try{n=await (0,t.readFile)(r,"utf-8")}catch{continue}let o=function(e){try{let t=JSON.parse(e);if("string"==typeof t.cwd&&t.cwd.length>0)return t.cwd}catch{}let t=e.match(/^\s*cwd\s*:\s*(.+?)\s*$/m);if(t){let e=t[1].replace(/^['"]|['"]$/g,"");if(e.length>0)return e}}(n);if(o)return{path:r,cwd:o}}return null}async function y(e,t){for(let n of t){let t=(0,i.join)(e,n);if(await m(t)!==null)return t}return null}async function g(){let e=process.env.CURSOR_HOME||(0,i.join)((0,n.homedir)(),".cursor"),t=[],r=[],a=(0,i.join)(e,"projects"),l=await f(a);if(l)for(let e of l){if(!e.isDirectory())continue;let n=(0,s.decodeFolderName)(e.name),r=n.startsWith("/")||/^[A-Za-z]:\//.test(n)?n:`/${n}`,o=(0,i.join)(a,e.name,"agent-transcripts"),l=await f(o);if(l)for(let e of l)e.isDirectory()&&t.push({sessionId:e.name,dir:(0,i.join)(o,e.name),cwd:r})}for(let t of u){let n=(0,i.join)(e,t),s=await f(n);if(s)for(let e of s)e.isDirectory()&&r.push({sessionId:e.name,dir:(0,i.join)(n,e.name)})}return 0===t.length&&0===r.length?[]:(await (0,o.batchAll)([...t.map(e=>async()=>{let t=(0,i.join)(e.dir,`${e.sessionId}.jsonl`),n=await m(t);return n?{metaPath:e.dir,transcriptPath:t,sessionId:e.sessionId,cwd:e.cwd,fileMtime:n,hasTranscript:!0}:null}),...r.map(e=>async()=>{let t=await p(e.dir,c);if(!t)return null;let n=await y(e.dir,d),i=n?await m(n):null,s=await m(t.path),r=i&&s?new Date(Math.max(i.getTime(),s.getTime())):i??s??new Date(0);return{metaPath:t.path,transcriptPath:n,sessionId:e.sessionId,cwd:t.cwd,fileMtime:r,hasTranscript:null!==n}})],16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let h=(0,r.runtimeCache)(g,30);async function w(){let e;try{e=await h()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),[]}let t=new Map;for(let n of e){if(!n.hasTranscript)continue;let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["cursor"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function _(e){let t=e.filter(e=>e.hasTranscript&&e.transcriptPath).map(e=>({name:e.sessionId,path:e.transcriptPath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"cursor"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function S(e){let t;try{t=await h()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),[]}return _(t.filter(t=>t.cwd===e))}async function v(e){let t;try{t=await h()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>t.hasTranscript&&(0,s.encodeFolderName)(t.cwd)===e);return{cwd:n[0]?.cwd??null,sessions:_(n)}}let M=(0,r.runtimeCache)(w,30),x=(0,r.runtimeCache)(e=>S(e),30,{maxSize:50}),E=(0,r.runtimeCache)(e=>v(e),30,{maxSize:50});e.s(["getCachedCursorProjects",0,M,"getCachedCursorSessionsByEncodedName",0,E,"getCachedCursorSessionsForCwd",0,x,"getCursorProjects",0,w,"getCursorSessionsByEncodedName",0,v,"getCursorSessionsForCwd",0,S])},3605,e=>{"use strict";var t=e.i(60526),n=e.i(50227),i=e.i(79708),s=e.i(83534),r=e.i(54214),o=e.i(67405);function a(){return process.env.HERMES_DB_PATH||(0,n.join)((0,t.homedir)(),".hermes","state.db")}function l(e){if("string"==typeof e&&0!==e.length)try{return JSON.parse(e)}catch{return}}function u(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function c(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>u(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}async function d(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=await (0,i.openSqliteReadonly)(a());if(!t)return null;try{let n=t.query("SELECT source, cwd FROM sessions WHERE id = ?",[e]);if(0===n.length)return null;let{source:i,cwd:s}=n[0],a=t.query("SELECT id, role, content, tool_call_id, tool_calls, tool_name, timestamp FROM messages WHERE session_id = ? ORDER BY timestamp ASC",[e]),d=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let d=0;d<e.length;d++){let f=e[d];if(!u(f))continue;let m="string"==typeof f.role?f.role:"system",p=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(f.timestamp??f.time_created,a+d),y=p.toISOString(),g={uuid:null!=f.id?String(f.id):`hermes-${d}`,parentUuid:null},h=(0,r.baseEntry)(g,y,p,t);if("user"===m){n.push({type:"user",...h,message:{role:"user",content:c(f.content)}});continue}if("assistant"===m){let e=[],t=c(f.content);for(let n of(t&&e.push({type:"text",text:t}),function(e){let t=Array.isArray(e)?e:l(e);if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!u(e))continue;let t=u(e.function)?e.function:{},i="string"==typeof t.name?t.name:"string"==typeof e.name?e.name:"tool",s="string"==typeof e.id&&e.id||"string"==typeof e.call_id&&e.call_id||`${i}-${n.length}`,r=u(t.arguments)?t.arguments:l(t.arguments);n.push({id:s,name:i,input:u(r)?r:{}})}return n}(f.tool_calls))){let t={type:"tool_use",id:n.id,name:n.name,input:n.input};e.push(t),i.set(n.id,t),s.set(n.id,p.getTime())}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e}});continue}if("tool"===m){let e="string"==typeof f.tool_call_id?f.tool_call_id:void 0,t=e?i.get(e):void 0;if(t){let n=e&&s.get(e)||p.getTime(),i=Math.max(0,p.getTime()-n);t.result={timestamp:y,timestampFormatted:(0,r.formatTimestamp)(p),content:c(f.content),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}}n.push({type:"system",...h,raw:g})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(a,"session"),f=s&&s.length>0?s:i?`hermes:${i}`:void 0;return{entries:d,rawLines:a,cwd:f,filePath:`hermes://${e}`}}catch{return null}finally{t.close()}}(0,s.runtimeCache)(e=>d(e),2,{maxSize:50}),e.s(["epochToMs",0,function(e){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return e;if(e>1e9)return 1e3*e}return Date.now()},"getHermesSessionLog",0,d,"hermesDbPath",0,a])},64828,e=>{"use strict";var t=e.i(79708),n=e.i(3605),i=e.i(83534),s=e.i(28557);async function r(){let e=await (0,t.openSqliteReadonly)((0,n.hermesDbPath)());if(!e)return[];try{return e.query("SELECT s.id, s.source, s.cwd, s.title, s.user_id, s.chat_id, s.chat_type, s.started_at, s.ended_at, s.message_count, lm.last_activity FROM sessions s LEFT JOIN (SELECT session_id, MAX(timestamp) AS last_activity FROM messages GROUP BY session_id) lm ON lm.session_id = s.id ORDER BY lm.last_activity DESC").map(e=>({sessionId:e.id,source:e.source??void 0,cwd:e.cwd??void 0,title:e.title??void 0,userId:e.user_id??void 0,chatId:e.chat_id??void 0,chatType:e.chat_type??void 0,mtimeMs:(0,n.epochToMs)(e.last_activity??e.ended_at??e.started_at),messageCount:"number"==typeof e.message_count?e.message_count:0,hasMessages:null!=e.last_activity}))}catch{return[]}finally{e.close()}}let o=(0,i.runtimeCache)(r,2);async function a(){let e=await r(),t=new Map;for(let n of e){if(n.messageCount<=0&&!n.hasMessages)continue;let e=n.source??"unknown";t.set(e,Math.max(t.get(e)??0,n.mtimeMs))}let n=[];for(let[e,i]of t){let t=new Date(i);n.push({name:`hermes-${e}`,path:`hermes:${e}`,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),cli:["hermes"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function l(e){if(!e.startsWith("hermes-"))return{cwd:null,sessions:[]};let t=e.slice(7),n=(await r()).filter(e=>(e.messageCount>0||e.hasMessages)&&(e.source??"unknown")===t);return{cwd:`hermes:${t}`,sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.sessionId,path:`hermes://${e.sessionId}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.sessionId,cli:"hermes",userId:e.userId,channelId:e.chatId,channelType:e.chatType}})}}let u=(0,i.runtimeCache)(a,2),c=(0,i.runtimeCache)(e=>l(e),2,{maxSize:50});e.s(["getCachedHermesProjects",0,u,"getCachedHermesSessions",0,o,"getCachedHermesSessionsByEncodedName",0,c,"getHermesProjects",0,a,"getHermesSessions",0,r,"getHermesSessionsByEncodedName",0,l])},40375,e=>{"use strict";var t=e.i(60526),n=e.i(50227),i=e.i(79708),s=e.i(83534),r=e.i(54214),o=e.i(67405);let a=/^[A-Za-z0-9_-]+$/;function l(){return process.env.DEVIN_DB_PATH||(0,n.join)(process.env.DEVIN_HOME||(0,n.join)((0,t.homedir)(),".local","share","devin"),"cli","sessions.db")}function u(e){if("string"==typeof e&&0!==e.length)try{return JSON.parse(e)}catch{return}}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}async function m(e){if(!e||!a.test(e))return null;let t=await (0,i.openSqliteReadonly)(l());if(!t)return null;try{let n=t.query("SELECT working_directory FROM sessions WHERE id = ?",[e]);if(0===n.length)return null;let i=n[0].working_directory,s=t.query("SELECT node_id, parent_node_id, chat_message, created_at FROM message_nodes WHERE session_id = ? ORDER BY node_id ASC",[e]),a=function(e){let t=[];for(let n of e){let e=u(n.chat_message);c(e)&&(null!=n.created_at&&null==e._created_at&&(e._created_at=n.created_at),t.push(e))}return t}(function(e){if(0===e.length)return e;let t=new Map;for(let n of e)"number"==typeof n.node_id&&t.set(n.node_id,n);let n=e.reduce((e,t)=>(e.node_id??-1)>(t.node_id??-1)?e:t),i=[],s=new Set;for(;n&&"number"==typeof n.node_id&&!s.has(n.node_id);)s.add(n.node_id),i.push(n),n=null!=n.parent_node_id?t.get(n.parent_node_id):void 0;return i.reverse()}(s)),l=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let l=0;l<e.length;l++){let m=e[l];if(!c(m))continue;let p="string"==typeof m.role?m.role:"system",y=function(e,t){let n=c(e.metadata)?e.metadata:void 0;return n&&null!=n.created_at?f(n.created_at,t):null!=e._created_at?f(e._created_at,t):new Date(t)}(m,a+l),g=y.toISOString(),h={uuid:null!=m.message_id?String(m.message_id):`devin-${l}`,parentUuid:null},w=(0,r.baseEntry)(h,g,y,t);if("user"===p){n.push({type:"user",...w,message:{role:"user",content:d(m.content)}});continue}if("assistant"===p){let e=[],t=d(m.content);for(let n of(t&&e.push({type:"text",text:t}),function(e){let t=Array.isArray(e)?e:u(e);if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!c(e))continue;let t=c(e.function)?e.function:{},i="string"==typeof e.name?e.name:"string"==typeof t.name?t.name:"tool",s="string"==typeof e.id&&e.id||"string"==typeof e.call_id&&e.call_id||`${i}-${n.length}`,r=e.arguments??t.arguments,o=c(r)?r:u(r);n.push({id:s,name:i,input:c(o)?o:{}})}return n}(m.tool_calls))){let t={type:"tool_use",id:n.id,name:n.name,input:n.input};e.push(t),i.set(n.id,t),s.set(n.id,y.getTime())}if(0===e.length)continue;n.push({type:"assistant",...w,message:{role:"assistant",content:e,model:"string"==typeof m.model?m.model:void 0}});continue}if("tool"===p){let e="string"==typeof m.tool_call_id?m.tool_call_id:void 0,t=e?i.get(e):void 0;if(t){let n=e&&s.get(e)||y.getTime(),i=Math.max(0,y.getTime()-n);t.result={timestamp:g,timestampFormatted:(0,r.formatTimestamp)(y),content:d(m.content),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}}n.push({type:"system",...w,raw:h})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(a,"session"),m=i&&i.length>0?i:void 0;return{entries:l,rawLines:a,cwd:m,filePath:`devin-db://${e}`}}catch{return null}finally{t.close()}}(0,s.runtimeCache)(e=>m(e),2,{maxSize:50}),e.s(["devinDbPath",0,l,"devinEpochToMs",0,function(e){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return e;if(e>1e9)return 1e3*e}return Date.now()},"getDevinSessionLog",0,m])},79364,e=>{"use strict";var t=e.i(79708),n=e.i(40375),i=e.i(81580),s=e.i(83534),r=e.i(28557);async function o(){let e=await (0,t.openSqliteReadonly)((0,n.devinDbPath)());if(!e)return[];try{return e.query("SELECT id, working_directory, title, created_at, last_activity_at, hidden FROM sessions ORDER BY last_activity_at DESC").filter(e=>!e.hidden).map(e=>{let t=e.working_directory??void 0;return{sessionId:e.id,cwd:t,title:e.title??void 0,projectName:t?(0,i.encodeFolderName)(t):"devin",mtimeMs:(0,n.devinEpochToMs)(e.last_activity_at??e.created_at)}})}catch{return[]}finally{e.close()}}let a=(0,s.runtimeCache)(o,2);async function l(){let e=await o(),t=new Map;for(let n of e){if(!n.cwd)continue;let e=t.get(n.projectName);(!e||n.mtimeMs>e.latest)&&t.set(n.projectName,{latest:n.mtimeMs,cwd:n.cwd,name:n.projectName})}let n=[];for(let{name:e,cwd:i,latest:s}of t.values()){let t=new Date(s);n.push({name:e,path:i,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),cli:["devin"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function u(e){let t=(await o()).filter(t=>t.cwd&&t.projectName===e);if(0===t.length)return{cwd:null,sessions:[]};let n=[...t].sort((e,t)=>t.mtimeMs-e.mtimeMs);return{cwd:n[0].cwd??null,sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.sessionId,path:`devin-db://${e.sessionId}`,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),sessionId:e.sessionId,cli:"devin"}})}}let c=(0,s.runtimeCache)(l,2),d=(0,s.runtimeCache)(e=>u(e),2,{maxSize:50});e.s(["getCachedDevinProjects",0,c,"getCachedDevinSessions",0,a,"getCachedDevinSessionsByEncodedName",0,d,"getDevinProjects",0,l,"getDevinSessions",0,o,"getDevinSessionsByEncodedName",0,u])},36618,e=>{"use strict";var t=e.i(60526),n=e.i(50227),i=e.i(79708),s=e.i(83534),r=e.i(54214),o=e.i(67405);let a=/^\d{8}_\d+$/;function l(){return process.env.GOOSE_DB_PATH||(0,n.join)(function(){if(process.env.GOOSE_HOME)return process.env.GOOSE_HOME;let e=process.env.XDG_DATA_HOME;return(0,n.join)(e&&e.length>0?e:(0,n.join)((0,t.homedir)(),".local","share"),"goose")}(),"sessions","sessions.db")}function u(e){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return e;if(e>1e9)return 1e3*e}if("string"==typeof e&&e.length>0){let t=Date.parse(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(e)?e.replace(" ","T")+"Z":e);if(!Number.isNaN(t))return t}return Date.now()}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}async function f(e){if(!e||!a.test(e))return null;let t=await (0,i.openSqliteReadonly)(l());if(!t)return null;try{let n=t.query("SELECT working_dir FROM sessions WHERE id = ?",[e]);if(0===n.length)return null;let i=n[0].working_dir,s=t.query("SELECT role, content_json, created_timestamp FROM messages WHERE session_id = ? ORDER BY id ASC",[e]),a=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let l=0;l<e.length;l++){let f=e[l],m=function(e){if("string"==typeof e&&0!==e.length)try{return JSON.parse(e)}catch{return}}(f.content_json);if(!Array.isArray(m))continue;let p="string"==typeof f.role?f.role:"system",y=function(e,t){let n="number"==typeof e||"string"==typeof e?u(e):NaN;return new Date(Number.isNaN(n)?t:n)}(f.created_timestamp,a+l),g=y.toISOString(),h={uuid:`goose-${l}`,parentUuid:null},w=(0,r.baseEntry)(h,g,y,t),_=[],S=[],v=[];for(let e of m)c(e)&&("text"===e.type&&"string"==typeof e.text?_.push(e.text):"toolRequest"===e.type?S.push(e):"toolResponse"===e.type&&v.push(e));for(let e of v){let t="string"==typeof e.id?e.id:void 0,n=t?i.get(t):void 0;if(!n)continue;let a=t&&s.get(t)||y.getTime(),l=Math.max(0,y.getTime()-a);n.result={timestamp:g,timestampFormatted:(0,r.formatTimestamp)(y),content:function(e){let t=(c(e.toolResult)?e.toolResult:{}).value;return c(t)&&Array.isArray(t.content)?d(t.content):"string"==typeof t?t:Array.isArray(t)?d(t):""}(e),durationMs:l,durationFormatted:(0,o.formatDuration)(l)}}let M=_.join("\n").trim();if(S.length>0||"assistant"===p&&M){let e=[];for(let t of(M&&e.push({type:"text",text:M}),S)){let{id:n,name:r,input:o}=function(e,t){let n="string"==typeof e.id&&e.id?e.id:`goose-tool-${t}`,i=c(e.toolCall)?e.toolCall:{},s=c(i.value)?i.value:{},r="string"==typeof s.name?s.name:"tool";return{id:n,name:r,input:c(s.arguments)?s.arguments:{}}}(t,e.length),a={type:"tool_use",id:n,name:r,input:o};e.push(a),i.set(n,a),s.set(n,y.getTime())}if(0===e.length)continue;n.push({type:"assistant",...w,message:{role:"assistant",content:e}});continue}if("user"===p&&M){n.push({type:"user",...w,message:{role:"user",content:M}});continue}M&&n.push({type:"system",...w,raw:h})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(s,"session"),l=i&&i.length>0?i:void 0;return{entries:a,rawLines:s,cwd:l,filePath:`goose-db://${e}`}}catch{return null}finally{t.close()}}(0,s.runtimeCache)(e=>f(e),2,{maxSize:50}),e.s(["getGooseSessionLog",0,f,"gooseDbPath",0,l,"gooseTimestampToMs",0,u])},69164,e=>{"use strict";var t=e.i(79708),n=e.i(36618),i=e.i(81580),s=e.i(83534),r=e.i(28557);async function o(){let e=await (0,t.openSqliteReadonly)((0,n.gooseDbPath)());if(!e)return[];try{return e.query("SELECT id, working_dir, description, name, session_type, created_at, updated_at FROM sessions ORDER BY updated_at DESC").filter(e=>"hidden"!==e.session_type).map(e=>{let t=e.working_dir??void 0,s=(e.description&&e.description.length>0?e.description:e.name)??void 0;return{sessionId:e.id,cwd:t,title:s&&s.length>0?s:void 0,projectName:t?(0,i.encodeFolderName)(t):"goose",mtimeMs:(0,n.gooseTimestampToMs)(e.updated_at??e.created_at)}})}catch{return[]}finally{e.close()}}let a=(0,s.runtimeCache)(o,2);async function l(){let e=await o(),t=new Map;for(let n of e){if(!n.cwd)continue;let e=t.get(n.projectName);(!e||n.mtimeMs>e.latest)&&t.set(n.projectName,{latest:n.mtimeMs,cwd:n.cwd,name:n.projectName})}let n=[];for(let{name:e,cwd:i,latest:s}of t.values()){let t=new Date(s);n.push({name:e,path:i,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),cli:["goose"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function u(e){let t=(await o()).filter(t=>t.cwd&&t.projectName===e);if(0===t.length)return{cwd:null,sessions:[]};let n=[...t].sort((e,t)=>t.mtimeMs-e.mtimeMs);return{cwd:n[0].cwd??null,sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.sessionId,path:`goose-db://${e.sessionId}`,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),sessionId:e.sessionId,cli:"goose"}})}}let c=(0,s.runtimeCache)(l,2),d=(0,s.runtimeCache)(e=>u(e),2,{maxSize:50});e.s(["getCachedGooseProjects",0,c,"getCachedGooseSessions",0,a,"getCachedGooseSessionsByEncodedName",0,d,"getGooseProjects",0,l,"getGooseSessions",0,o,"getGooseSessionsByEncodedName",0,u])},72094,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=["agent-sessions","conversations","sessions"],u=["events.jsonl","transcript.jsonl","messages.jsonl"],c="agent-transcripts";function d(e){let n=function(e){if(!e)return null;let n=(0,i.resolve)(process.env.CURSOR_HOME||(0,i.join)((0,s.homedir)(),".cursor")),r=(0,i.resolve)(n,"projects"),o=[];try{o=(0,t.readdirSync)(r,{withFileTypes:!0})}catch{}for(let n of o){if(!n.isDirectory())continue;let s=(0,i.resolve)(r,n.name,c,e),o=(0,i.resolve)(r,n.name,c);if(s!==o&&s.startsWith(`${o}${i.sep}`)&&(0,t.existsSync)(s))return s}for(let s of l){let r=(0,i.resolve)(n,s),o=(0,i.resolve)(r,e);if(o!==r&&o.startsWith(`${r}${i.sep}`)&&(0,t.existsSync)(o))return o}return null}(e);if(!n)return null;let r=(0,i.join)(n,`${(0,i.basename)(n)}.jsonl`);if((0,t.existsSync)(r))return r;for(let e of u){let s=(0,i.join)(n,e);if((0,t.existsSync)(s))return s}return null}async function f(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,u=new Map,c=!1,d=Date.now();for(let e=0;e<i.length;e++){let f;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let m=i[e];try{f=JSON.parse(m)}catch{continue}let p={...f,_source:t};if(r.push(p),!f.type&&f.role&&f.message?.content){let n=new Date(d+e),i=n.toISOString(),r=f.message.content.filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("");if("user"===f.role){let e=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(r),a=e?e[1]:r;a&&s.push({type:"user",...(0,o.baseEntry)(p,i,n,t),message:{role:"user",content:a}});continue}if("assistant"===f.role){let e=r?[{type:"text",text:r}]:[];0===e.length?s.push({type:"system",...(0,o.baseEntry)(p,i,n,t),raw:p}):s.push({type:"assistant",...(0,o.baseEntry)(p,i,n,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,o.baseEntry)(p,i,n,t),raw:p});continue}let y=f.timestamp;if(!y)continue;let g=new Date(y);if(Number.isNaN(g.getTime()))continue;let h=g.toISOString(),w=f.type,_=f.data??{};if("session.start"===w||"sessionStart"===w||"session_start"===w){let e=_.context??_,i=e.cwd;"string"!=typeof i||n||(n=i),!n&&Array.isArray(e.workspace_roots)&&"string"==typeof e.workspace_roots[0]&&(n=e.workspace_roots[0]);let r=c?"Session Resumed":"Session Started";c=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(p,h,g,t),label:r});continue}if("user.message"===w||"userMessage"===w){let e="string"==typeof _.content?_.content:"string"==typeof _.text?_.text:"";if(!e)continue;s.push({type:"user",...(0,o.baseEntry)(p,h,g,t),message:{role:"user",content:e}});continue}if("system.message"===w||"systemMessage"===w){s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p});continue}if("assistant.message"===w||"assistantMessage"===w){let e="string"==typeof _.content?_.content:"string"==typeof _.text?_.text:"";if(!e){s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p});continue}let n=[{type:"text",text:e}];s.push({type:"assistant",...(0,o.baseEntry)(p,h,g,t),message:{role:"assistant",content:n}});continue}if("tool.execution_start"===w||"tool.executionStart"===w||"preToolUse"===w){let e=_.toolCallId??_.tool_use_id,n=_.toolName??_.tool_name??"tool",i=_.arguments??_.tool_input??{},r={type:"tool_use",id:e??`${g.getTime()}-${n}`,name:n,input:i},a={type:"assistant",...(0,o.baseEntry)(p,h,g,t),message:{role:"assistant",content:[r]}};s.push(a),e&&(l.set(e,r),u.set(e,g.getTime()));continue}if("tool.execution_complete"===w||"tool.executionComplete"===w||"postToolUse"===w){let e=_.toolCallId??_.tool_use_id,n=e?l.get(e):void 0;if(n){let t=u.get(e)??g.getTime(),i=_.result??{},s=_.duration,r="number"==typeof s&&s>=0?s:Math.max(0,g.getTime()-t),l=i.detailedContent??i.content??_.tool_output??"";n.result={timestamp:h,timestampFormatted:(0,o.formatTimestamp)(g),content:"string"==typeof l?l:JSON.stringify(l),durationMs:r,durationFormatted:(0,a.formatDuration)(r)};continue}s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p});continue}s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function m(e){let t,i=d(e);if(!i)return null;try{t=await (0,n.readFile)(i,"utf-8")}catch{return null}let{entries:s,rawLines:r,cwd:o}=await f(t,"session");return{entries:s,rawLines:r,cwd:o,filePath:i}}(0,r.runtimeCache)(e=>m(e),60,{maxSize:50}),e.s(["findCursorTranscript",0,d,"getCursorSessionLog",0,m])},93114,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,u=new Set(["CONVERSATION_HISTORY","CHECKPOINT"]);function c(){return process.env.ANTIGRAVITY_HOME||(0,s.join)((0,i.homedir)(),".gemini","antigravity-cli")}function d(){return(0,s.join)(c(),"brain")}function f(){return(0,s.join)(".system_generated","logs","transcript_full.jsonl")}function m(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function p(e,t="session"){let n=[],i=new Map,s=Date.now();for(let r=0;r<e.length;r++){let l=e[r];if(!m(l))continue;let c="string"==typeof l.type?l.type:"";if(!c||u.has(c))continue;let d=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(l.created_at,s+r),f=d.toISOString(),p="number"==typeof l.step_index?l.step_index:r,y={uuid:`antigravity-${p}`,parentUuid:null},g=(0,o.baseEntry)(y,f,d,t);if("USER_INPUT"===c){let e="string"==typeof l.content?l.content:"";n.push({type:"user",...g,message:{role:"user",content:e}});continue}if("PLANNER_RESPONSE"===c){let e=[];if("string"==typeof l.content&&l.content.length>0&&e.push({type:"text",text:l.content}),Array.isArray(l.tool_calls))for(let t=0;t<l.tool_calls.length;t++){let n=l.tool_calls[t];if(!m(n))continue;let s="string"==typeof n.name?n.name:"tool",r={type:"tool_use",id:`${s}-${p}-${t}`,name:s,input:m(n.args)?n.args:{}};e.push(r);let o=s.toUpperCase(),a=i.get(o)??[];a.push({block:r,startMs:d.getTime()}),i.set(o,a)}if(0===e.length)continue;n.push({type:"assistant",...g,message:{role:"assistant",content:e}});continue}let h=i.get(c);if(h&&h.length>0){let{block:e,startMs:t}=h.shift(),n=Math.max(0,d.getTime()-t);e.result={timestamp:f,timestampFormatted:(0,o.formatTimestamp)(d),content:"string"==typeof l.content?l.content:"",durationMs:n,durationFormatted:(0,a.formatDuration)(n)};continue}n.push({type:"system",...g,raw:y})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}function y(e){if(!l.test(e))return null;let t=(0,s.join)(d(),e,f());try{if((0,n.statSync)(t).isFile())return t}catch{}return null}async function g(e){let n,i=y(e);if(!i)return null;try{n=await (0,t.readFile)(i,"utf-8")}catch{return null}let s=(0,o.parseRawLines)(n,"session"),r=p(s,"session"),a=function(e){for(let t of e)if(m(t)&&Array.isArray(t.tool_calls))for(let e of t.tool_calls){if(!m(e)||!m(e.args))continue;let t=e.args.Cwd??e.args.cwd;if("string"==typeof t&&t.length>0)return t}}(s);return{entries:r,rawLines:s,cwd:a,filePath:i}}(0,r.runtimeCache)(e=>g(e),60,{maxSize:50}),e.s(["antigravityHome",0,c,"antigravityLinesToLogEntries",0,p,"findAntigravityTranscript",0,y,"getAntigravitySessionLog",0,g,"listAntigravityTranscripts",0,function(){let e,t=d(),i=f(),r=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory())}catch{return r}for(let o of e){let e=o.name;if(!l.test(e))continue;let a=(0,s.join)(t,e,i);try{let t=(0,n.statSync)(a);if(!t.isFile())continue;r.push({conversationId:e,transcriptPath:a,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}return r}])},30441,e=>{"use strict";var t=e.i(50227),n=e.i(79708),i=e.i(93114),s=e.i(83534),r=e.i(81580),o=e.i(28557),a=e.i(40911);function l(){return(0,t.join)((0,i.antigravityHome)(),"conversation_summaries.db")}async function u(){let e=new Map,t=await (0,n.openSqliteReadonly)(l());if(!t)return e;try{for(let n of t.query("SELECT conversation_id, title, step_count, workspace_uris, last_modified_time FROM conversation_summaries"))n.conversation_id&&e.set(n.conversation_id,{title:n.title??void 0,cwd:function(e){let t;if(!e)return;try{let n=JSON.parse(e);Array.isArray(n)&&"string"==typeof n[0]?t=n[0]:"string"==typeof n&&(t=n)}catch{t=e}if(!t)return;let n=t.replace(/^file:\/\//,"");return n.length>0?n:void 0}(n.workspace_uris),stepCount:"number"==typeof n.step_count?n.step_count:void 0,lastMs:function(e){if("number"==typeof e&&Number.isFinite(e))return e>1e12?e:e>1e9?1e3*e:void 0;if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return t}}(n.last_modified_time)})}catch{}finally{t.close()}return e}async function c(){let e;try{e=(0,i.listAntigravityTranscripts)()}catch(e){return(0,a.logWarn)("Failed to scan Antigravity brain dir:",e),[]}let t=await u(),n=[];for(let s of e){let e=t.get(s.conversationId),r=e?.cwd??null;if(!r)try{let e=await (0,i.getAntigravitySessionLog)(s.conversationId);r=e?.cwd??null}catch{r=null}n.push({conversationId:s.conversationId,cwd:r,title:e?.title,mtimeMs:e?.lastMs??s.mtimeMs})}return n}let d="antigravity";async function f(){let e=await c(),t=new Map;for(let n of e){let e=n.cwd?(0,r.encodeFolderName)(n.cwd):d,i=n.cwd??"antigravity",s=t.get(e);(!s||n.mtimeMs>s.latest)&&t.set(e,{latest:n.mtimeMs,path:i})}let n=[];for(let[e,{latest:i,path:s}]of t){let t=new Date(i);n.push({name:e,path:s,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,o.formatDate)(t),cli:["antigravity"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function m(e){let t=(await c()).filter(t=>(t.cwd?(0,r.encodeFolderName)(t.cwd):d)===e);if(0===t.length)return{cwd:null,sessions:[]};let n=[...t].sort((e,t)=>t.mtimeMs-e.mtimeMs);return{cwd:n.find(e=>e.cwd)?.cwd??(e===d?null:(0,r.decodeFolderName)(e)),sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.conversationId,path:`antigravity://${e.conversationId}`,lastModified:t,lastModifiedFormatted:(0,o.formatDate)(t),sessionId:e.conversationId,cli:"antigravity"}})}}let p=(0,s.runtimeCache)(f,30),y=(0,s.runtimeCache)(e=>m(e),30,{maxSize:50});e.s(["antigravitySummariesDbPath",0,l,"getAntigravityIndex",0,u,"getAntigravityProjects",0,f,"getAntigravitySessionsByEncodedName",0,m,"getCachedAntigravityProjects",0,p,"getCachedAntigravitySessionsByEncodedName",0,y])},37352,e=>{e.v(e=>Promise.resolve().then(()=>e(36203)))},5807,e=>{e.v(e=>Promise.resolve().then(()=>e(55851)))},97452,e=>{e.v(e=>Promise.resolve().then(()=>e(46413)))},82978,e=>{e.v(e=>Promise.resolve().then(()=>e(35435)))},45093,e=>{e.v(e=>Promise.resolve().then(()=>e(19791)))},67347,e=>{e.v(e=>Promise.resolve().then(()=>e(64828)))},38978,e=>{e.v(t=>Promise.all(["server/chunks/lib_openclaw-projects_ts_0gc-p24._.js"].map(t=>e.l(t))).then(()=>t(90624)))},62998,e=>{e.v(t=>Promise.all(["server/chunks/lib_factory-projects_ts_1eo_bk-._.js"].map(t=>e.l(t))).then(()=>t(69391)))},52400,e=>{e.v(e=>Promise.resolve().then(()=>e(79364)))},91301,e=>{e.v(e=>Promise.resolve().then(()=>e(30441)))},31854,e=>{e.v(e=>Promise.resolve().then(()=>e(69164)))},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__1_g_b3t._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
1
+ module.exports=[50227,(e,t,n)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,n)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,n)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,n)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},74533,(e,t,n)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},18622,(e,t,n)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,n)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,n)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},94930,e=>{"use strict";var t=e.i(2157),n=e.i(50227),i=e.i(66680);e.s(["writeJsonAtomically",0,function(e,s,r={}){let o=r.mode??384,a=r.dirMode??448,l=(0,n.dirname)(e);(0,t.existsSync)(l)||(0,t.mkdirSync)(l,{recursive:!0,mode:a});let u=`${e}.${process.pid}.${(0,i.randomBytes)(6).toString("hex")}.tmp`;try{(0,t.writeFileSync)(u,JSON.stringify(s,null,2),{mode:o});try{(63&(0,t.statSync)(u).mode)!=0&&(0,t.chmodSync)(u,o)}catch{}(0,t.renameSync)(u,e);try{(63&(0,t.statSync)(e).mode)!=0&&(0,t.chmodSync)(e,o)}catch{}}catch(e){try{(0,t.rmSync)(u,{force:!0})}catch{}throw e}}])},24214,(e,t,n)=>{t.exports={name:"failproofai",version:"0.0.14-beta.2",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.111.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.3","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.1","@types/react":"19.2.17","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^29.1.1","lucide-react":"^1.18.0",next:"^16.2.9",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.37.1","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{postcss:"8.5.14","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.28.0"}}},28067,e=>{"use strict";e.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])},10659,e=>{"use strict";let t;var n=e.i(2157),i=e.i(50227),s=e.i(60526),r=e.i(66680);e.i(74533);let o=i.default.join(s.default.homedir(),".failproofai"),a=i.default.join(o,"instance-id");function l(e){return r.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(s.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=n.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return t=l(e);let i=[s.default.hostname(),s.default.homedir(),s.default.platform(),s.default.arch(),s.default.cpus()[0]?.model??""].join(":");return t=i?l(i):function(){try{let e=n.default.readFileSync(a,"utf-8").trim();if(e)return e}catch{}let e=r.default.randomUUID();try{n.default.mkdirSync(o,{recursive:!0}),n.default.writeFileSync(a,e,"utf-8")}catch{}return e}()}])},72561,e=>{"use strict";var t=e.i(10659),n=e.i(24214),i=e.i(28067);let s=i.POSTHOG_API_KEY;async function r(e,t){for(let n=1;n<=5;n++){try{let{signal:n,...i}=t,s=await fetch(e,{...i,signal:AbortSignal.timeout(5e3)});if(s.ok)return s}catch{}if(n<5){let e=Math.min(1e3*2**(n-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}function o(){return"1"!==process.env.FAILPROOFAI_TELEMETRY_DISABLED}async function a(){try{if(!o()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),n=process.env.FAILPROOFAI_POSTHOG_KEY??s,i=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(n,{host:i,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:r});let a=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",a),process.on("SIGTERM",a),process.on("SIGINT",a)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,a,"trackEvent",0,function(e,s){if(!o())return;let r=globalThis.__FAILPROOFAI_POSTHOG__;r&&r.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...s,$lib:"failproofai",failproofai_version:n.version,product:i.POSTHOG_PRODUCT}})}])},64199,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=/^[0-9a-fA-F-]{36}$/;function u(){return process.env.OPENCLAW_HOME||(0,s.join)((0,i.homedir)(),".openclaw")}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(){let e,t=(0,s.join)(u(),"agents"),i=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return i}for(let r of e){let e,o=(0,s.join)(t,r,"sessions");try{e=(0,n.readdirSync)(o)}catch{continue}for(let t of e){if(!t.endsWith(".jsonl")||t.endsWith(".trajectory.jsonl"))continue;let e=t.slice(0,-6);if(!l.test(e))continue;let a=(0,s.join)(o,t);try{let t=(0,n.statSync)(a);i.push({agentId:r,sessionId:e,transcriptPath:a,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}}return i}function m(e){if(!l.test(e))return null;for(let t of f())if(t.sessionId===e)return t.transcriptPath;return null}async function p(e){let n,i,s=m(e);if(!s)return null;try{n=await (0,t.readFile)(s,"utf-8")}catch{return null}let r=(0,o.parseRawLines)(n,"session"),l=function(e,t="session"){let n=[],i=new Map,s=new Map,r=Date.now();for(let l=0;l<e.length;l++){let u=e[l];if(!c(u)||"message"!==u.type)continue;let f=c(u.message)?u.message:void 0;if(!f)continue;let m="string"==typeof f.role?f.role:"system",p=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(u.timestamp??f.timestamp,r+l),y=p.toISOString(),g={uuid:null!=u.id?String(u.id):`openclaw-${l}`,parentUuid:null!=u.parentId?String(u.parentId):null},h=(0,o.baseEntry)(g,y,p,t);if("user"===m){n.push({type:"user",...h,message:{role:"user",content:d(f.content)}});continue}if("assistant"===m){let e=[],t=f.content;if(Array.isArray(t)){for(let n of t)if(c(n)){if("text"===n.type&&"string"==typeof n.text)e.push({type:"text",text:n.text});else if("toolCall"===n.type){let t="string"==typeof n.id?n.id:`${String(n.name??"tool")}-${e.length}`,r={type:"tool_use",id:t,name:"string"==typeof n.name?n.name:"tool",input:c(n.arguments)?n.arguments:{}};e.push(r),i.set(t,r),s.set(t,p.getTime())}}}else{let n=d(t);n&&e.push({type:"text",text:n})}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e,model:"string"==typeof f.model?f.model:void 0}});continue}if("toolResult"===m){let e="string"==typeof f.toolCallId?f.toolCallId:void 0,t=e?i.get(e):void 0;if(t){let n=c(f.details)?f.details:void 0,i=e&&s.get(e)||p.getTime(),r=n&&"number"==typeof n.durationMs?n.durationMs:Math.max(0,p.getTime()-i);t.result={timestamp:y,timestampFormatted:(0,o.formatTimestamp)(p),content:d(f.content),durationMs:r,durationFormatted:(0,a.formatDuration)(r)};continue}}n.push({type:"system",...h,raw:g})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(r,"session");for(let e of r)if(c(e)&&"session"===e.type&&"string"==typeof e.cwd&&e.cwd.length>0){i=e.cwd;break}return{entries:l,rawLines:r,cwd:i,filePath:s}}(0,r.runtimeCache)(e=>p(e),2,{maxSize:50}),e.s(["findOpenClawTranscript",0,m,"getOpenClawSessionLog",0,p,"listOpenClawTranscripts",0,f,"openclawHome",0,u])},28246,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),r=e.i(81580),o=e.i(83534),a=e.i(54214),l=e.i(67405);let u=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(e,t="session"){let n=[],i=new Map,s=new Map,r=Date.now();for(let o=0;o<e.length;o++){let u=e[o];if(!c(u)||"message"!==u.type)continue;let f=c(u.message)?u.message:void 0;if(!f)continue;let m="string"==typeof f.role?f.role:"system",p=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(u.timestamp??f.timestamp,r+o),y=p.toISOString(),g={uuid:null!=u.id?String(u.id):`factory-${o}`,parentUuid:null!=u.parentId?String(u.parentId):null},h=(0,a.baseEntry)(g,y,p,t),w=f.content;if("assistant"===m){let e=[];if(Array.isArray(w)){for(let t of w)if(c(t)){if("text"===t.type&&"string"==typeof t.text)e.push({type:"text",text:t.text});else if("tool_use"===t.type){let n="string"==typeof t.id?t.id:`${String(t.name??"tool")}-${e.length}`,r={type:"tool_use",id:n,name:"string"==typeof t.name?t.name:"tool",input:c(t.input)?t.input:{}};e.push(r),i.set(n,r),s.set(n,p.getTime())}}}else{let t=d(w);t&&e.push({type:"text",text:t})}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e,model:"string"==typeof f.model?f.model:void 0}});continue}if(Array.isArray(w)){let e=!1,t=[];for(let n of w)if(c(n)){if("tool_result"===n.type){let t="string"==typeof n.tool_use_id?n.tool_use_id:"string"==typeof n.toolUseId?n.toolUseId:void 0,r=t?i.get(t):void 0;if(r){let i=t&&s.get(t)||p.getTime(),o=Math.max(0,p.getTime()-i);r.result={timestamp:y,timestampFormatted:(0,a.formatTimestamp)(p),content:d(n.content),durationMs:o,durationFormatted:(0,l.formatDuration)(o)},e=!0;continue}}"text"===n.type&&"string"==typeof n.text&&t.push(n.text)}t.length>0?n.push({type:"user",...h,message:{role:"user",content:t.join("\n")}}):e||n.push({type:"system",...h,raw:g});continue}if("user"===m){n.push({type:"user",...h,message:{role:"user",content:d(w)}});continue}n.push({type:"system",...h,raw:g})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}function m(){let e,t=(0,s.join)(process.env.FACTORY_HOME||(0,s.join)((0,i.homedir)(),".factory"),"sessions"),o=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory())}catch{return o}for(let i of e){let e,a=i.name,l=(0,r.decodeFolderName)(a),c=(0,s.join)(t,a);try{e=(0,n.readdirSync)(c)}catch{continue}for(let t of e){if(!t.endsWith(".jsonl"))continue;let e=t.slice(0,-6);if(!u.test(e))continue;let i=(0,s.join)(c,t);try{let t=(0,n.statSync)(i);o.push({projectName:a,cwd:l,sessionId:e,transcriptPath:i,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}}return o}function p(e){if(!u.test(e))return null;for(let t of m())if(t.sessionId===e)return t.transcriptPath;return null}async function y(e){let n,i,s=p(e);if(!s)return null;try{n=await (0,t.readFile)(s,"utf-8")}catch{return null}let r=(0,a.parseRawLines)(n,"session"),o=f(r,"session");for(let e of r)if(c(e)&&"session_start"===e.type&&"string"==typeof e.cwd&&e.cwd.length>0){i=e.cwd;break}return{entries:o,rawLines:r,cwd:i,filePath:s}}(0,o.runtimeCache)(e=>y(e),60,{maxSize:50}),e.s(["factoryLinesToLogEntries",0,f,"findFactoryTranscript",0,p,"getFactorySessionLog",0,y,"listFactoryTranscripts",0,m])},47756,48480,e=>{"use strict";var t=e.i(2157),n=e.i(50227),i=e.i(60526),s=e.i(94930);function r(){return(0,n.join)((0,i.homedir)(),".failproofai","audit-dashboard.json")}e.s(["readDashboardCache",0,function(){let e=r();if(!(0,t.existsSync)(e))return null;try{let n=(0,t.readFileSync)(e,"utf-8"),i=JSON.parse(n);if(!i||"object"!=typeof i||"string"!=typeof i.cachedAt||!i.params||"object"!=typeof i.params||!i.result||"object"!=typeof i.result||2!==i.schemaVersion||function(e,t=30){let n=new Date(e).getTime();return!!Number.isNaN(n)||Date.now()-n>6e4*t}(i.cachedAt,10080))return null;return i}catch{return null}},"writeDashboardCache",0,function(e,t){try{let n={schemaVersion:2,cachedAt:new Date().toISOString(),params:e,result:t};return(0,s.writeJsonAtomically)(r(),n),!0}catch{return!1}}],47756);let o={running:!1,error:null};e.s(["finishRun",0,function(e){o.running=!1,o.startedAt=void 0,o.error=e},"getRunState",0,function(){return{...o}},"tryAcquireRun",0,function(){return!o.running&&(o.running=!0,o.startedAt=Date.now(),o.error=null,!0)}],48480)},55851,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);async function u(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function c(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function d(){let e=(0,i.join)(process.env.COPILOT_HOME||(0,i.join)((0,n.homedir)(),".copilot"),"session-state"),s=await u(e);if(!s)return[];let r=s.filter(e=>e.isDirectory()).map(t=>({sessionId:t.name,workspacePath:(0,i.join)(e,t.name,"workspace.yaml"),eventsPath:(0,i.join)(e,t.name,"events.jsonl")}));return(await (0,o.batchAll)(r.map(e=>async()=>{let n;try{n=await (0,t.readFile)(e.workspacePath,"utf-8")}catch{return null}let i=function(e){let t=e.match(/^cwd\s*:\s*(.+?)\s*$/m);if(t)return t[1].replace(/^['"]|['"]$/g,"")}(n);if(!i)return null;let s=await c(e.eventsPath),r=await c(e.workspacePath),o=null!==s,a=s&&r?new Date(Math.max(s.getTime(),r.getTime())):s??r??new Date(0);return{workspacePath:e.workspacePath,eventsPath:e.eventsPath,sessionId:e.sessionId,cwd:i,fileMtime:a,hasTranscript:o}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let f=(0,r.runtimeCache)(d,30);async function m(){let e;try{e=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),[]}let t=new Map;for(let n of e){if(!n.hasTranscript)continue;let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["copilot"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function p(e){let t=e.filter(e=>e.hasTranscript).map(e=>({name:e.sessionId,path:e.eventsPath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"copilot"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function y(e){let t;try{t=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),[]}return p(t.filter(t=>t.cwd===e))}async function g(e){let t;try{t=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>t.hasTranscript&&(0,s.encodeFolderName)(t.cwd)===e);return{cwd:n[0]?.cwd??null,sessions:p(n)}}let h=(0,r.runtimeCache)(m,30),w=(0,r.runtimeCache)(e=>y(e),30,{maxSize:50}),_=(0,r.runtimeCache)(e=>g(e),30,{maxSize:50});e.s(["getCachedCopilotProjects",0,h,"getCachedCopilotSessionsByEncodedName",0,_,"getCachedCopilotSessionsForCwd",0,w,"getCopilotProjects",0,m,"getCopilotSessionsByEncodedName",0,g,"getCopilotSessionsForCwd",0,y])},19791,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);let u=/^[\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;async function c(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function d(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function f(e){let n;try{n=await (0,t.readFile)(e,"utf-8")}catch{return null}let i=n.indexOf("\n")>=0?n.slice(0,n.indexOf("\n")):n;if(!i)return null;try{let e=JSON.parse(i);if("session"!==e.type||"string"!=typeof e.cwd||0===e.cwd.length)return null;return e.cwd}catch{return null}}async function m(){let e=process.env.PI_SESSIONS_DIR||(0,i.join)((0,n.homedir)(),".pi","agent","sessions"),t=await c(e);if(!t)return[];let s=[];for(let n of t){if(!n.isDirectory())continue;let t=(0,i.join)(e,n.name),r=await c(t);if(r)for(let e of r){if(!e.isFile())continue;let n=u.exec(e.name);n&&s.push({sessionId:n[1],filePath:(0,i.join)(t,e.name)})}}return 0===s.length?[]:(await (0,o.batchAll)(s.map(e=>async()=>{let t=await f(e.filePath);if(!t)return null;let n=await d(e.filePath);return n?{filePath:e.filePath,sessionId:e.sessionId,cwd:t,fileMtime:n}:null}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let p=(0,r.runtimeCache)(m,30);async function y(){let e;try{e=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),[]}let t=new Map;for(let n of e){let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["pi"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function g(e){let t=e.map(e=>({name:e.sessionId,path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"pi"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function h(e){let t;try{t=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),[]}return g(t.filter(t=>t.cwd===e))}async function w(e){let t;try{t=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>(0,s.encodeFolderName)(t.cwd)===e),i=Array.from(new Set(n.map(e=>e.cwd)));return 1!==i.length?{cwd:null,sessions:[]}:{cwd:i[0],sessions:g(n)}}let _=(0,r.runtimeCache)(y,30),S=(0,r.runtimeCache)(e=>h(e),30,{maxSize:50}),v=(0,r.runtimeCache)(e=>w(e),30,{maxSize:50});e.s(["getCachedPiProjects",0,_,"getCachedPiSessionsByEncodedName",0,v,"getCachedPiSessionsForCwd",0,S,"getPiProjects",0,y,"getPiSessionsByEncodedName",0,w,"getPiSessionsForCwd",0,h])},36203,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);let u=(0,i.join)((0,n.homedir)(),".codex","sessions"),c=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;async function d(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function f(e){let n=null;try{n=await (0,t.open)(e,"r");let i=Buffer.alloc(262144),{bytesRead:s}=await n.read(i,0,262144,0);if(0===s)return null;let r=i.subarray(0,s),o=r.indexOf(10),a=-1===o?s:o;return r.subarray(0,a).toString("utf-8")}catch{return null}finally{n&&await n.close().catch(()=>{})}}async function m(e){let t=await d(e);return t?t.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")).map(t=>(0,i.join)(e,t.name)):[]}async function p(){let e=await d(u);if(!e)return[];let n=[];for(let t of e){if(!t.isDirectory())continue;let e=await d((0,i.join)(u,t.name));if(e)for(let s of e){if(!s.isDirectory())continue;let e=await d((0,i.join)(u,t.name,s.name));if(e)for(let r of e){if(!r.isDirectory())continue;let e=(0,i.join)(u,t.name,s.name,r.name);n.push(...await m(e))}}}return 0===n.length?[]:(await (0,o.batchAll)(n.map(e=>async()=>{let n,i,s=(i=(e.split("/").pop()??"").match(c))?i[0]:null;if(!s)return null;let r=await f(e);if(!r)return null;let{cwd:o}=function(e){try{let t=JSON.parse(e);if("session_meta"!==t.type)return{};let n=t.payload?.cwd;if("string"!=typeof n||0===n.length)return{};return{cwd:n}}catch{return{}}}(r);if(!o)return null;try{let i=await (0,t.open)(e,"r");try{n=(await i.stat()).mtime}finally{await i.close().catch(()=>{})}}catch{n=new Date(0)}return{filePath:e,fileName:e.split("/").pop()??"",cwd:o,sessionId:s,fileMtime:n}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let y=(0,r.runtimeCache)(p,30);async function g(){let e;try{e=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),[]}let t=new Map;for(let n of e){let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["codex"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function h(e){let t=e.map(e=>({name:e.fileName.replace(/\.jsonl$/,""),path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"codex"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function w(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),[]}return h(t.filter(t=>t.cwd===e))}async function _(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>(0,s.encodeFolderName)(t.cwd)===e);return{cwd:n[0]?.cwd??null,sessions:h(n)}}let S=(0,r.runtimeCache)(g,30),v=(0,r.runtimeCache)(e=>w(e),30,{maxSize:50}),M=(0,r.runtimeCache)(e=>_(e),30,{maxSize:50});e.s(["getCachedCodexProjects",0,S,"getCachedCodexSessionsByEncodedName",0,M,"getCachedCodexSessionsForCwd",0,v,"getCodexProjects",0,g,"getCodexSessionsByEncodedName",0,_,"getCodexSessionsForCwd",0,w])},35435,e=>{"use strict";var t=e.i(74533),n=e.i(81580),i=e.i(83534),s=e.i(28557),r=e.i(40911);function o(e){try{let n=(0,t.execFileSync)("opencode",["db","--format","json",e],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]});if(!n.trim())return[];let i=JSON.parse(n);if(!Array.isArray(i))return null;return i}catch{return null}}function a(){return o("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT 1000")}function l(){return o("SELECT id, worktree, vcs, name, time_created, time_updated FROM project")}async function u(){let e=a(),t=l();if(null===e&&null===t)return[];let i=new Map;for(let e of t??[])i.set(e.id,e);let r=new Map;for(let t of e??[]){if(!t.project_id)continue;let e=r.get(t.project_id);e||(e={rows:[],latest:0},r.set(t.project_id,e)),e.rows.push(t),t.time_updated>e.latest&&(e.latest=t.time_updated)}let o=new Set,u=[];for(let[e,t]of r){o.add(e);let r=i.get(e),a=r?.worktree??t.rows[0]?.directory??null,l=a?(0,n.encodeFolderName)(a):e,c=a??"",d=new Date(Math.max(t.latest,r?.time_updated??0));u.push({name:l,path:c,isDirectory:!0,lastModified:d,lastModifiedFormatted:(0,s.formatDate)(d),cli:["opencode"]})}for(let e of t??[]){if(o.has(e.id))continue;let t=e.worktree??"",i=t?(0,n.encodeFolderName)(t):e.id,r=new Date(e.time_updated);u.push({name:i,path:t,isDirectory:!0,lastModified:r,lastModifiedFormatted:(0,s.formatDate)(r),cli:["opencode"]})}return u.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),u}async function c(e){let t=a();return t?t.filter(t=>t.directory===e).map(e=>{let t=new Date(e.time_updated);return{name:e.title??e.slug??e.id,path:`opencode://${e.id}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.id,cli:"opencode"}}):[]}async function d(e){let t,i;try{t=l(),i=a()}catch(e){return(0,r.logWarn)("Failed to read OpenCode DB:",e),{cwd:null,sessions:[]}}if(!t||!i)return{cwd:null,sessions:[]};let o=t.find(t=>t.worktree&&(0,n.encodeFolderName)(t.worktree)===e);if(!o||!o.worktree)return{cwd:null,sessions:[]};let u=i.filter(e=>e.project_id===o.id);return{cwd:o.worktree,sessions:u.map(e=>{let t=new Date(e.time_updated);return{name:e.title??e.slug??e.id,path:`opencode://${e.id}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.id,cli:"opencode"}})}}let f=(0,i.runtimeCache)(u,30),m=(0,i.runtimeCache)(e=>c(e),30,{maxSize:50}),p=(0,i.runtimeCache)(e=>d(e),30,{maxSize:50});e.s(["getCachedOpenCodeProjects",0,f,"getCachedOpenCodeSessionsByEncodedName",0,p,"getCachedOpenCodeSessionsForCwd",0,m,"getOpenCodeProjects",0,u,"getOpenCodeSessionsByEncodedName",0,d,"getOpenCodeSessionsForCwd",0,c])},78166,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214),a=e.i(67405);function l(e,t){let n=function(e){if(!e)return null;let t=(0,i.resolve)((0,i.join)(process.env.COPILOT_HOME||(0,i.join)((0,s.homedir)(),".copilot"),"session-state")),n=(0,i.resolve)(t,e);return n!==t&&n.startsWith(`${t}${i.sep}`)?n:null}(e);return n?(0,i.join)(n,t):null}function u(e){let n=l(e,"events.jsonl");return n&&(0,t.existsSync)(n)?n:null}async function c(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,u=new Map,d=!1;for(let e=0;e<i.length;e++){let c;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let f=i[e];try{c=JSON.parse(f)}catch{continue}let m={...c,_source:t};r.push(m);let p=c.timestamp;if(!p)continue;let y=new Date(p);if(Number.isNaN(y.getTime()))continue;let g=y.toISOString(),h=c.type,w=c.data??{};if("session.start"===h){let e=w.context,i=e?.cwd;"string"!=typeof i||n||(n=i);let r=d?"Session Resumed":"Session Started";d=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(m,g,y,t),label:r});continue}if("user.message"===h){let e=w.content??"";if(!e)continue;s.push({type:"user",...(0,o.baseEntry)(m,g,y,t),message:{role:"user",content:e}});continue}if("system.message"===h){s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m});continue}if("assistant.message"===h){let e=w.content??"";if(!e){s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m});continue}let n=[{type:"text",text:e}];s.push({type:"assistant",...(0,o.baseEntry)(m,g,y,t),message:{role:"assistant",content:n}});continue}if("tool.execution_start"===h){let e=w.toolCallId,n=w.toolName??"tool",i=w.arguments??{},r={type:"tool_use",id:e??`${y.getTime()}-${n}`,name:n,input:i},a={type:"assistant",...(0,o.baseEntry)(m,g,y,t),message:{role:"assistant",content:[r]}};s.push(a),e&&(l.set(e,r),u.set(e,y.getTime()));continue}if("tool.execution_complete"===h){let e=w.toolCallId,n=e?l.get(e):void 0;if(n){let t=u.get(e)??y.getTime(),i=w.result??{},s=w.toolTelemetry??{},r=s.metrics?.commandTimeMs??s.metrics?.durationMs??null,l="number"==typeof r&&r>=0?r:Math.max(0,y.getTime()-t),c=i.detailedContent??i.content??"";n.result={timestamp:g,timestampFormatted:(0,o.formatTimestamp)(y),content:"string"==typeof c?c:JSON.stringify(c),durationMs:l,durationFormatted:(0,a.formatDuration)(l)};continue}s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m});continue}s.push({type:"system",...(0,o.baseEntry)(m,g,y,t),raw:m})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function d(e){let i,s=u(e);if(!s)return null;try{i=await (0,n.readFile)(s,"utf-8")}catch{return null}let{entries:r,rawLines:o,cwd:a}=await c(i,"session");return{entries:r,rawLines:o,cwd:a??function(e){let n,i=(n=l(e,"workspace.yaml"))&&(0,t.existsSync)(n)?n:null;if(i)try{let e=(0,t.readFileSync)(i,"utf-8"),n=RegExp("^cwd\\s*:\\s*(.+?)\\s*$","m"),s=e.match(n);if(!s)return;return s[1].replace(/^['"]|['"]$/g,"")}catch{return}}(e),filePath:s}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),e.s(["findCopilotTranscript",0,u,"getCopilotSessionLog",0,d])},99440,e=>{"use strict";var t=e.i(74533),n=e.i(83534),i=e.i(54214),s=e.i(67405);function r(e){try{let n=(0,t.execFileSync)("opencode",["db","--format","json",e],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]});if(!n.trim())return[];let i=JSON.parse(n);if(!Array.isArray(i))return null;return i}catch{return null}}function o(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function a(e){if("string"!=typeof e||0===e.length)return null;try{let t=JSON.parse(e);return o(t)?t:null}catch{return null}}async function l(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=r(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = '${e}'`);if(!t||0===t.length)return null;let n=t[0],l=r(`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = '${e}' ORDER BY time_created ASC`),u=r(`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = '${e}' ORDER BY time_created ASC`);if(!l)return{entries:[],rawLines:[],cwd:n.directory??void 0,filePath:`opencode://${e}`};let c=new Map;for(let e of u??[]){let t=c.get(e.message_id);t||(t=[],c.set(e.message_id,t)),t.push(e)}let d=[],f=[];for(let e of l){let t=c.get(e.id)??[];d.push(function(e,t,n){let r=a(e.data)??{},l="string"==typeof r.role?r.role:"system",u=new Date(e.time_created),c=u.toISOString(),d={uuid:e.id,parentUuid:null},f=(0,i.baseEntry)(d,c,u,n),m=[],p="";for(let e of t){let t=a(e.data);if(!t)continue;let n="string"==typeof t.type?t.type:"unknown";if("text"===n){let e="string"==typeof t.text?t.text:"string"==typeof t.content?t.content:"";e&&(m.push({type:"text",text:e}),p+=(p?"\n":"")+e);continue}if("tool"===n){let n="string"==typeof t.tool?t.tool:"string"==typeof t.name?t.name:"tool",r=o(t.state)?t.state:null,a=r&&o(r.input)?r.input:o(t.input)?t.input:o(t.args)?t.args:{},l={type:"tool_use",id:e.id,name:n,input:a},u=r&&"string"==typeof r.status?r.status:"";if(r&&("completed"===u||"error"===u)){let t=("error"===u&&"string"==typeof r.error?r.error:null)??r.output,n="string"==typeof t?t:null!=t?JSON.stringify(t):"",a=o(r.time)?r.time:{},c="number"==typeof a.start?a.start:e.time_created,d="number"==typeof a.end?a.end:e.time_updated,f=Math.max(0,d-c),m=new Date(d);l.result={timestamp:m.toISOString(),timestampFormatted:(0,i.formatTimestamp)(m),content:n,durationMs:f,durationFormatted:(0,s.formatDuration)(f)}}m.push(l);continue}m.push({type:"text",text:`[opencode ${n}]`})}if("user"===l)return{...f,type:"user",message:{role:"user",content:p}};if("assistant"===l){let e=o(r.model)?r.model:null,t=e&&"string"==typeof e.modelID?e.modelID:void 0;return{...f,type:"assistant",message:{role:"assistant",content:m,model:t}}}return{...f,type:"system",raw:{id:e.id,role:l,parts:m}}}(e,t,"session"));let n=a(e.data);f.push({id:e.id,session_id:e.session_id,time_created:e.time_created,data:n??e.data})}return{entries:d,rawLines:f,cwd:n.directory??void 0,filePath:`opencode://${e}`}}async function u(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=r(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = '${e}'`);if(!t||0===t.length)return null;let n=r(`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = '${e}' ORDER BY time_created ASC`),i=r(`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = '${e}' ORDER BY time_created ASC`);return null===n||null===i?null:{session:t[0],messages:n.map(e=>({...e,data:a(e.data)??e.data})),parts:i.map(e=>({...e,data:a(e.data)??e.data}))}}(0,n.runtimeCache)(e=>l(e),30,{maxSize:50}),e.s(["getOpenCodeSessionExport",0,u,"getOpenCodeSessionLog",0,l])},57232,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=(0,i.join)((0,s.homedir)(),".failproofai","cache","codex-session-paths.json");function u(){try{if(!(0,t.existsSync)(l))return{};return JSON.parse((0,t.readFileSync)(l,"utf-8"))}catch{return{}}}function c(e,n){try{(0,t.mkdirSync)((0,i.dirname)(l),{recursive:!0});let s=u();s[e]=n,(0,t.writeFileSync)(l,JSON.stringify(s),"utf-8")}catch{}}function d(e,n){try{for(let s of(0,t.readdirSync)(e,{withFileTypes:!0}))if(s.isFile()&&s.name.includes(n)&&s.name.endsWith(".jsonl"))return(0,i.join)(e,s.name)}catch{}return null}function f(e){let n=u()[e];if(n&&(0,t.existsSync)(n))return n;let r=(0,i.join)((0,s.homedir)(),".codex","sessions"),o=new Date,a=new Date(o.getTime()-864e5);for(let t of[o,a].map(e=>{let t=String(e.getUTCFullYear()),n=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return(0,i.join)(r,t,n,s)})){let n=d(t,e);if(n)return c(e,n),n}try{for(let n of(0,t.readdirSync)(r,{withFileTypes:!0}))if(n.isDirectory()){for(let s of(0,t.readdirSync)((0,i.join)(r,n.name),{withFileTypes:!0}))if(s.isDirectory())for(let o of(0,t.readdirSync)((0,i.join)(r,n.name,s.name),{withFileTypes:!0})){if(!o.isDirectory())continue;let t=d((0,i.join)(r,n.name,s.name,o.name),e);if(t)return c(e,t),t}}}catch{}return null}function m(e,t){return Array.isArray(e)?e.filter(e=>e?.type===t&&"string"==typeof e.text).map(e=>e.text).join("\n"):""}async function p(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,u=new Map,c=!1;for(let e=0;e<i.length;e++){let d;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let f=i[e];try{d=JSON.parse(f)}catch{continue}let p={...d,_source:t};r.push(p);let y=d.timestamp;if(!y)continue;let g=new Date(y);if(Number.isNaN(g.getTime()))continue;let h=d.type,w=d.payload??{};if("session_meta"===h){let e=w.cwd;"string"!=typeof e||n||(n=e),s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("response_item"===h){let e=w.type;if("message"===e){let e=w.role,n=w.content;if("user"===e||"developer"===e){let i=m(n,"input_text");if(!i)continue;let r="developer"===e?`[developer] ${i}`:i;s.push({type:"user",...(0,o.baseEntry)(p,y,g,t),message:{role:"user",content:r}});continue}if("assistant"===e){let e=m(n,"output_text");if(!e)continue;let i=[{type:"text",text:e}];s.push({type:"assistant",...(0,o.baseEntry)(p,y,g,t),message:{role:"assistant",content:i}});continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("function_call"===e){let e=w.call_id,n=w.name??"function_call",i={type:"tool_use",id:e??`${y}-${n}`,name:n,input:function(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}(w.arguments)},r={type:"assistant",...(0,o.baseEntry)(p,y,g,t),message:{role:"assistant",content:[i]}};s.push(r),e&&(l.set(e,i),u.set(e,g.getTime()));continue}if("function_call_output"===e){let e=w.call_id,n=e?l.get(e):void 0;if(n){let t=u.get(e)??g.getTime(),i=Math.max(0,g.getTime()-t);n.result={timestamp:y,timestampFormatted:(0,o.formatTimestamp)(g),content:"string"==typeof w.output?w.output:JSON.stringify(w.output),durationMs:i,durationFormatted:(0,a.formatDuration)(i)};continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("event_msg"===h){let e=w.type;if("task_started"===e){let e=c?"Session Resumed":"Session Started";c=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(p,y,g,t),label:e});continue}if("exec_command_end"===e){let e=w.call_id,n=e?l.get(e):void 0;if(n){let t=w.duration,i=t?(t.secs??0)*1e3+Math.round((t.nanos??0)/1e6):Math.max(0,g.getTime()-(u.get(e)??g.getTime())),s=w.aggregated_output;n.result={timestamp:y,timestampFormatted:(0,o.formatTimestamp)(g),content:"string"==typeof s?s:JSON.stringify(s),durationMs:i,durationFormatted:(0,a.formatDuration)(i)};continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}if("user_message"===e||"agent_message"===e)continue;s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p});continue}s.push({type:"system",...(0,o.baseEntry)(p,y,g,t),raw:p})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function y(e){let t=f(e);if(!t)return null;let i=await (0,n.readFile)(t,"utf-8"),{entries:s,rawLines:r,cwd:o}=await p(i,"session");return{entries:s,rawLines:r,cwd:o,filePath:t}}(0,r.runtimeCache)(e=>y(e),60,{maxSize:50}),e.s(["findCodexTranscript",0,f,"getCodexSessionLog",0,y])},85116,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214);let a=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,l=/^[\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 u(e){let n;if(!a.test(e))return null;let r=(0,i.resolve)(process.env.PI_SESSIONS_DIR||(0,i.join)((0,s.homedir)(),".pi","agent","sessions"));try{n=(0,t.readdirSync)(r)}catch{return null}for(let s of n){let n,o=(0,i.resolve)(r,s);if(o.startsWith(`${r}${i.sep}`)){try{n=(0,t.readdirSync)(o)}catch{continue}for(let s of n){let n=l.exec(s);if(!n||n[1].toLowerCase()!==e.toLowerCase())continue;let r=(0,i.resolve)(o,s);if(r.startsWith(`${o}${i.sep}`)&&(0,t.existsSync)(r))return r}}}return null}async function c(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],a=!1;for(let e=0;e<i.length;e++){let l;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let u=i[e];try{l=JSON.parse(u)}catch{continue}let c={...l,_source:t};r.push(c);let d=l.timestamp;if(!d)continue;let f=new Date(d);if(Number.isNaN(f.getTime()))continue;let m=f.toISOString(),p=l.type;if("session"===p){"string"!=typeof l.cwd||n||(n=l.cwd);let e=a?"Session Resumed":"Session Started";a=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(c,m,f,t),label:e});continue}if("message"===p&&l.message&&"object"==typeof l.message){let e=l.message.role,n=l.message.content;if("user"===e){let e=function(e){if(!Array.isArray(e))return"";let t=[];for(let n of e)n?.type==="text"&&"string"==typeof n.text&&t.push(n.text);return t.join("\n\n")}(n);if(!e)continue;s.push({type:"user",...(0,o.baseEntry)(c,m,f,t),message:{role:"user",content:e}});continue}if("assistant"===e){let e=function(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)n?.type==="text"&&"string"==typeof n.text&&n.text.length>0&&t.push({type:"text",text:n.text}),n?.type==="thinking"&&"string"==typeof n.thinking&&n.thinking.length>0&&t.push({type:"text",text:`[thinking] ${n.thinking}`});return t}(n);if(0===e.length){s.push({type:"system",...(0,o.baseEntry)(c,m,f,t),raw:c});continue}s.push({type:"assistant",...(0,o.baseEntry)(c,m,f,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,o.baseEntry)(c,m,f,t),raw:c});continue}s.push({type:"system",...(0,o.baseEntry)(c,m,f,t),raw:c})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function d(e){let t,i,s=u(e);if(!s)return null;try{t=await (0,n.readFile)(s,"utf-8")}catch{return null}try{i=await c(t,"session")}catch{return null}return{entries:i.entries,rawLines:i.rawLines,cwd:i.cwd,filePath:s}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),o.formatTimestamp,e.s(["findPiTranscript",0,u,"getPiSessionLog",0,d])},46413,e=>{"use strict";var t=e.i(12714),n=e.i(60526),i=e.i(50227),s=e.i(81580),r=e.i(83534),o=e.i(71809),a=e.i(28557),l=e.i(40911);let u=["agent-sessions","conversations","sessions"],c=["meta.json","session.json","workspace.json","workspace.yaml"],d=["events.jsonl","transcript.jsonl","messages.jsonl"];async function f(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function m(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function p(e,n){for(let s of n){let n,r=(0,i.join)(e,s);if(await m(r)===null)continue;try{n=await (0,t.readFile)(r,"utf-8")}catch{continue}let o=function(e){try{let t=JSON.parse(e);if("string"==typeof t.cwd&&t.cwd.length>0)return t.cwd}catch{}let t=e.match(/^\s*cwd\s*:\s*(.+?)\s*$/m);if(t){let e=t[1].replace(/^['"]|['"]$/g,"");if(e.length>0)return e}}(n);if(o)return{path:r,cwd:o}}return null}async function y(e,t){for(let n of t){let t=(0,i.join)(e,n);if(await m(t)!==null)return t}return null}async function g(){let e=process.env.CURSOR_HOME||(0,i.join)((0,n.homedir)(),".cursor"),t=[],r=[],a=(0,i.join)(e,"projects"),l=await f(a);if(l)for(let e of l){if(!e.isDirectory())continue;let n=(0,s.decodeFolderName)(e.name),r=n.startsWith("/")||/^[A-Za-z]:\//.test(n)?n:`/${n}`,o=(0,i.join)(a,e.name,"agent-transcripts"),l=await f(o);if(l)for(let e of l)e.isDirectory()&&t.push({sessionId:e.name,dir:(0,i.join)(o,e.name),cwd:r})}for(let t of u){let n=(0,i.join)(e,t),s=await f(n);if(s)for(let e of s)e.isDirectory()&&r.push({sessionId:e.name,dir:(0,i.join)(n,e.name)})}return 0===t.length&&0===r.length?[]:(await (0,o.batchAll)([...t.map(e=>async()=>{let t=(0,i.join)(e.dir,`${e.sessionId}.jsonl`),n=await m(t);return n?{metaPath:e.dir,transcriptPath:t,sessionId:e.sessionId,cwd:e.cwd,fileMtime:n,hasTranscript:!0}:null}),...r.map(e=>async()=>{let t=await p(e.dir,c);if(!t)return null;let n=await y(e.dir,d),i=n?await m(n):null,s=await m(t.path),r=i&&s?new Date(Math.max(i.getTime(),s.getTime())):i??s??new Date(0);return{metaPath:t.path,transcriptPath:n,sessionId:e.sessionId,cwd:t.cwd,fileMtime:r,hasTranscript:null!==n}})],16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let h=(0,r.runtimeCache)(g,30);async function w(){let e;try{e=await h()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),[]}let t=new Map;for(let n of e){if(!n.hasTranscript)continue;let e=t.get(n.cwd);(!e||n.fileMtime.getTime()>e.latest.getTime())&&t.set(n.cwd,{latest:n.fileMtime,cwd:n.cwd})}let n=[];for(let{cwd:e,latest:i}of t.values())n.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:i,lastModifiedFormatted:(0,a.formatDate)(i),cli:["cursor"]});return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}function _(e){let t=e.filter(e=>e.hasTranscript&&e.transcriptPath).map(e=>({name:e.sessionId,path:e.transcriptPath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"cursor"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function S(e){let t;try{t=await h()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),[]}return _(t.filter(t=>t.cwd===e))}async function v(e){let t;try{t=await h()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),{cwd:null,sessions:[]}}let n=t.filter(t=>t.hasTranscript&&(0,s.encodeFolderName)(t.cwd)===e);return{cwd:n[0]?.cwd??null,sessions:_(n)}}let M=(0,r.runtimeCache)(w,30),x=(0,r.runtimeCache)(e=>S(e),30,{maxSize:50}),E=(0,r.runtimeCache)(e=>v(e),30,{maxSize:50});e.s(["getCachedCursorProjects",0,M,"getCachedCursorSessionsByEncodedName",0,E,"getCachedCursorSessionsForCwd",0,x,"getCursorProjects",0,w,"getCursorSessionsByEncodedName",0,v,"getCursorSessionsForCwd",0,S])},3605,e=>{"use strict";var t=e.i(60526),n=e.i(50227),i=e.i(79708),s=e.i(83534),r=e.i(54214),o=e.i(67405);function a(){return process.env.HERMES_DB_PATH||(0,n.join)((0,t.homedir)(),".hermes","state.db")}function l(e){if("string"==typeof e&&0!==e.length)try{return JSON.parse(e)}catch{return}}function u(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function c(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>u(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}async function d(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=await (0,i.openSqliteReadonly)(a());if(!t)return null;try{let n=t.query("SELECT source, cwd FROM sessions WHERE id = ?",[e]);if(0===n.length)return null;let{source:i,cwd:s}=n[0],a=t.query("SELECT id, role, content, tool_call_id, tool_calls, tool_name, timestamp FROM messages WHERE session_id = ? ORDER BY timestamp ASC",[e]),d=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let d=0;d<e.length;d++){let f=e[d];if(!u(f))continue;let m="string"==typeof f.role?f.role:"system",p=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(f.timestamp??f.time_created,a+d),y=p.toISOString(),g={uuid:null!=f.id?String(f.id):`hermes-${d}`,parentUuid:null},h=(0,r.baseEntry)(g,y,p,t);if("user"===m){n.push({type:"user",...h,message:{role:"user",content:c(f.content)}});continue}if("assistant"===m){let e=[],t=c(f.content);for(let n of(t&&e.push({type:"text",text:t}),function(e){let t=Array.isArray(e)?e:l(e);if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!u(e))continue;let t=u(e.function)?e.function:{},i="string"==typeof t.name?t.name:"string"==typeof e.name?e.name:"tool",s="string"==typeof e.id&&e.id||"string"==typeof e.call_id&&e.call_id||`${i}-${n.length}`,r=u(t.arguments)?t.arguments:l(t.arguments);n.push({id:s,name:i,input:u(r)?r:{}})}return n}(f.tool_calls))){let t={type:"tool_use",id:n.id,name:n.name,input:n.input};e.push(t),i.set(n.id,t),s.set(n.id,p.getTime())}if(0===e.length)continue;n.push({type:"assistant",...h,message:{role:"assistant",content:e}});continue}if("tool"===m){let e="string"==typeof f.tool_call_id?f.tool_call_id:void 0,t=e?i.get(e):void 0;if(t){let n=e&&s.get(e)||p.getTime(),i=Math.max(0,p.getTime()-n);t.result={timestamp:y,timestampFormatted:(0,r.formatTimestamp)(p),content:c(f.content),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}}n.push({type:"system",...h,raw:g})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(a,"session"),f=s&&s.length>0?s:i?`hermes:${i}`:void 0;return{entries:d,rawLines:a,cwd:f,filePath:`hermes://${e}`}}catch{return null}finally{t.close()}}(0,s.runtimeCache)(e=>d(e),2,{maxSize:50}),e.s(["epochToMs",0,function(e){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return e;if(e>1e9)return 1e3*e}return Date.now()},"getHermesSessionLog",0,d,"hermesDbPath",0,a])},64828,e=>{"use strict";var t=e.i(79708),n=e.i(3605),i=e.i(83534),s=e.i(28557);async function r(){let e=await (0,t.openSqliteReadonly)((0,n.hermesDbPath)());if(!e)return[];try{return e.query("SELECT s.id, s.source, s.cwd, s.title, s.user_id, s.chat_id, s.chat_type, s.started_at, s.ended_at, s.message_count, lm.last_activity FROM sessions s LEFT JOIN (SELECT session_id, MAX(timestamp) AS last_activity FROM messages GROUP BY session_id) lm ON lm.session_id = s.id ORDER BY lm.last_activity DESC").map(e=>({sessionId:e.id,source:e.source??void 0,cwd:e.cwd??void 0,title:e.title??void 0,userId:e.user_id??void 0,chatId:e.chat_id??void 0,chatType:e.chat_type??void 0,mtimeMs:(0,n.epochToMs)(e.last_activity??e.ended_at??e.started_at),messageCount:"number"==typeof e.message_count?e.message_count:0,hasMessages:null!=e.last_activity}))}catch{return[]}finally{e.close()}}let o=(0,i.runtimeCache)(r,2);async function a(){let e=await r(),t=new Map;for(let n of e){if(n.messageCount<=0&&!n.hasMessages)continue;let e=n.source??"unknown";t.set(e,Math.max(t.get(e)??0,n.mtimeMs))}let n=[];for(let[e,i]of t){let t=new Date(i);n.push({name:`hermes-${e}`,path:`hermes:${e}`,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),cli:["hermes"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function l(e){if(!e.startsWith("hermes-"))return{cwd:null,sessions:[]};let t=e.slice(7),n=(await r()).filter(e=>(e.messageCount>0||e.hasMessages)&&(e.source??"unknown")===t);return{cwd:`hermes:${t}`,sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.sessionId,path:`hermes://${e.sessionId}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.sessionId,cli:"hermes",userId:e.userId,channelId:e.chatId,channelType:e.chatType}})}}let u=(0,i.runtimeCache)(a,2),c=(0,i.runtimeCache)(e=>l(e),2,{maxSize:50});e.s(["getCachedHermesProjects",0,u,"getCachedHermesSessions",0,o,"getCachedHermesSessionsByEncodedName",0,c,"getHermesProjects",0,a,"getHermesSessions",0,r,"getHermesSessionsByEncodedName",0,l])},40375,e=>{"use strict";var t=e.i(60526),n=e.i(50227),i=e.i(79708),s=e.i(83534),r=e.i(54214),o=e.i(67405);let a=/^[A-Za-z0-9_-]+$/;function l(){return process.env.DEVIN_DB_PATH||(0,n.join)(process.env.DEVIN_HOME||(0,n.join)((0,t.homedir)(),".local","share","devin"),"cli","sessions.db")}function u(e){if("string"==typeof e&&0!==e.length)try{return JSON.parse(e)}catch{return}}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}function f(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}async function m(e){if(!e||!a.test(e))return null;let t=await (0,i.openSqliteReadonly)(l());if(!t)return null;try{let n=t.query("SELECT working_directory FROM sessions WHERE id = ?",[e]);if(0===n.length)return null;let i=n[0].working_directory,s=t.query("SELECT node_id, parent_node_id, chat_message, created_at FROM message_nodes WHERE session_id = ? ORDER BY node_id ASC",[e]),a=function(e){let t=[];for(let n of e){let e=u(n.chat_message);c(e)&&(null!=n.created_at&&null==e._created_at&&(e._created_at=n.created_at),t.push(e))}return t}(function(e){if(0===e.length)return e;let t=new Map;for(let n of e)"number"==typeof n.node_id&&t.set(n.node_id,n);let n=e.reduce((e,t)=>(e.node_id??-1)>(t.node_id??-1)?e:t),i=[],s=new Set;for(;n&&"number"==typeof n.node_id&&!s.has(n.node_id);)s.add(n.node_id),i.push(n),n=null!=n.parent_node_id?t.get(n.parent_node_id):void 0;return i.reverse()}(s)),l=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let l=0;l<e.length;l++){let m=e[l];if(!c(m))continue;let p="string"==typeof m.role?m.role:"system",y=function(e,t){let n=c(e.metadata)?e.metadata:void 0;return n&&null!=n.created_at?f(n.created_at,t):null!=e._created_at?f(e._created_at,t):new Date(t)}(m,a+l),g=y.toISOString(),h={uuid:null!=m.message_id?String(m.message_id):`devin-${l}`,parentUuid:null},w=(0,r.baseEntry)(h,g,y,t);if("user"===p){n.push({type:"user",...w,message:{role:"user",content:d(m.content)}});continue}if("assistant"===p){let e=[],t=d(m.content);for(let n of(t&&e.push({type:"text",text:t}),function(e){let t=Array.isArray(e)?e:u(e);if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!c(e))continue;let t=c(e.function)?e.function:{},i="string"==typeof e.name?e.name:"string"==typeof t.name?t.name:"tool",s="string"==typeof e.id&&e.id||"string"==typeof e.call_id&&e.call_id||`${i}-${n.length}`,r=e.arguments??t.arguments,o=c(r)?r:u(r);n.push({id:s,name:i,input:c(o)?o:{}})}return n}(m.tool_calls))){let t={type:"tool_use",id:n.id,name:n.name,input:n.input};e.push(t),i.set(n.id,t),s.set(n.id,y.getTime())}if(0===e.length)continue;n.push({type:"assistant",...w,message:{role:"assistant",content:e,model:"string"==typeof m.model?m.model:void 0}});continue}if("tool"===p){let e="string"==typeof m.tool_call_id?m.tool_call_id:void 0,t=e?i.get(e):void 0;if(t){let n=e&&s.get(e)||y.getTime(),i=Math.max(0,y.getTime()-n);t.result={timestamp:g,timestampFormatted:(0,r.formatTimestamp)(y),content:d(m.content),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}}n.push({type:"system",...w,raw:h})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(a,"session"),m=i&&i.length>0?i:void 0;return{entries:l,rawLines:a,cwd:m,filePath:`devin-db://${e}`}}catch{return null}finally{t.close()}}(0,s.runtimeCache)(e=>m(e),2,{maxSize:50}),e.s(["devinDbPath",0,l,"devinEpochToMs",0,function(e){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return e;if(e>1e9)return 1e3*e}return Date.now()},"getDevinSessionLog",0,m])},79364,e=>{"use strict";var t=e.i(79708),n=e.i(40375),i=e.i(81580),s=e.i(83534),r=e.i(28557);async function o(){let e=await (0,t.openSqliteReadonly)((0,n.devinDbPath)());if(!e)return[];try{return e.query("SELECT id, working_directory, title, created_at, last_activity_at, hidden FROM sessions ORDER BY last_activity_at DESC").filter(e=>!e.hidden).map(e=>{let t=e.working_directory??void 0;return{sessionId:e.id,cwd:t,title:e.title??void 0,projectName:t?(0,i.encodeFolderName)(t):"devin",mtimeMs:(0,n.devinEpochToMs)(e.last_activity_at??e.created_at)}})}catch{return[]}finally{e.close()}}let a=(0,s.runtimeCache)(o,2);async function l(){let e=await o(),t=new Map;for(let n of e){if(!n.cwd)continue;let e=t.get(n.projectName);(!e||n.mtimeMs>e.latest)&&t.set(n.projectName,{latest:n.mtimeMs,cwd:n.cwd,name:n.projectName})}let n=[];for(let{name:e,cwd:i,latest:s}of t.values()){let t=new Date(s);n.push({name:e,path:i,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),cli:["devin"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function u(e){let t=(await o()).filter(t=>t.cwd&&t.projectName===e);if(0===t.length)return{cwd:null,sessions:[]};let n=[...t].sort((e,t)=>t.mtimeMs-e.mtimeMs);return{cwd:n[0].cwd??null,sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.sessionId,path:`devin-db://${e.sessionId}`,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),sessionId:e.sessionId,cli:"devin"}})}}let c=(0,s.runtimeCache)(l,2),d=(0,s.runtimeCache)(e=>u(e),2,{maxSize:50});e.s(["getCachedDevinProjects",0,c,"getCachedDevinSessions",0,a,"getCachedDevinSessionsByEncodedName",0,d,"getDevinProjects",0,l,"getDevinSessions",0,o,"getDevinSessionsByEncodedName",0,u])},36618,e=>{"use strict";var t=e.i(60526),n=e.i(50227),i=e.i(79708),s=e.i(83534),r=e.i(54214),o=e.i(67405);let a=/^\d{8}_\d+$/;function l(){return process.env.GOOSE_DB_PATH||(0,n.join)(function(){if(process.env.GOOSE_HOME)return process.env.GOOSE_HOME;let e=process.env.XDG_DATA_HOME;return(0,n.join)(e&&e.length>0?e:(0,n.join)((0,t.homedir)(),".local","share"),"goose")}(),"sessions","sessions.db")}function u(e){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return e;if(e>1e9)return 1e3*e}if("string"==typeof e&&e.length>0){let t=Date.parse(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(e)?e.replace(" ","T")+"Z":e);if(!Number.isNaN(t))return t}return Date.now()}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>c(e)&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):""}async function f(e){if(!e||!a.test(e))return null;let t=await (0,i.openSqliteReadonly)(l());if(!t)return null;try{let n=t.query("SELECT working_dir FROM sessions WHERE id = ?",[e]);if(0===n.length)return null;let i=n[0].working_dir,s=t.query("SELECT role, content_json, created_timestamp FROM messages WHERE session_id = ? ORDER BY id ASC",[e]),a=function(e,t="session"){let n=[],i=new Map,s=new Map,a=Date.now();for(let l=0;l<e.length;l++){let f=e[l],m=function(e){if("string"==typeof e&&0!==e.length)try{return JSON.parse(e)}catch{return}}(f.content_json);if(!Array.isArray(m))continue;let p="string"==typeof f.role?f.role:"system",y=function(e,t){let n="number"==typeof e||"string"==typeof e?u(e):NaN;return new Date(Number.isNaN(n)?t:n)}(f.created_timestamp,a+l),g=y.toISOString(),h={uuid:`goose-${l}`,parentUuid:null},w=(0,r.baseEntry)(h,g,y,t),_=[],S=[],v=[];for(let e of m)c(e)&&("text"===e.type&&"string"==typeof e.text?_.push(e.text):"toolRequest"===e.type?S.push(e):"toolResponse"===e.type&&v.push(e));for(let e of v){let t="string"==typeof e.id?e.id:void 0,n=t?i.get(t):void 0;if(!n)continue;let a=t&&s.get(t)||y.getTime(),l=Math.max(0,y.getTime()-a);n.result={timestamp:g,timestampFormatted:(0,r.formatTimestamp)(y),content:function(e){let t=(c(e.toolResult)?e.toolResult:{}).value;return c(t)&&Array.isArray(t.content)?d(t.content):"string"==typeof t?t:Array.isArray(t)?d(t):""}(e),durationMs:l,durationFormatted:(0,o.formatDuration)(l)}}let M=_.join("\n").trim();if(S.length>0||"assistant"===p&&M){let e=[];for(let t of(M&&e.push({type:"text",text:M}),S)){let{id:n,name:r,input:o}=function(e,t){let n="string"==typeof e.id&&e.id?e.id:`goose-tool-${t}`,i=c(e.toolCall)?e.toolCall:{},s=c(i.value)?i.value:{},r="string"==typeof s.name?s.name:"tool";return{id:n,name:r,input:c(s.arguments)?s.arguments:{}}}(t,e.length),a={type:"tool_use",id:n,name:r,input:o};e.push(a),i.set(n,a),s.set(n,y.getTime())}if(0===e.length)continue;n.push({type:"assistant",...w,message:{role:"assistant",content:e}});continue}if("user"===p&&M){n.push({type:"user",...w,message:{role:"user",content:M}});continue}M&&n.push({type:"system",...w,raw:h})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}(s,"session"),l=i&&i.length>0?i:void 0;return{entries:a,rawLines:s,cwd:l,filePath:`goose-db://${e}`}}catch{return null}finally{t.close()}}(0,s.runtimeCache)(e=>f(e),2,{maxSize:50}),e.s(["getGooseSessionLog",0,f,"gooseDbPath",0,l,"gooseTimestampToMs",0,u])},69164,e=>{"use strict";var t=e.i(79708),n=e.i(36618),i=e.i(81580),s=e.i(83534),r=e.i(28557);async function o(){let e=await (0,t.openSqliteReadonly)((0,n.gooseDbPath)());if(!e)return[];try{return e.query("SELECT id, working_dir, description, name, session_type, created_at, updated_at FROM sessions ORDER BY updated_at DESC").filter(e=>"hidden"!==e.session_type).map(e=>{let t=e.working_dir??void 0,s=(e.description&&e.description.length>0?e.description:e.name)??void 0;return{sessionId:e.id,cwd:t,title:s&&s.length>0?s:void 0,projectName:t?(0,i.encodeFolderName)(t):"goose",mtimeMs:(0,n.gooseTimestampToMs)(e.updated_at??e.created_at)}})}catch{return[]}finally{e.close()}}let a=(0,s.runtimeCache)(o,2);async function l(){let e=await o(),t=new Map;for(let n of e){if(!n.cwd)continue;let e=t.get(n.projectName);(!e||n.mtimeMs>e.latest)&&t.set(n.projectName,{latest:n.mtimeMs,cwd:n.cwd,name:n.projectName})}let n=[];for(let{name:e,cwd:i,latest:s}of t.values()){let t=new Date(s);n.push({name:e,path:i,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),cli:["goose"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function u(e){let t=(await o()).filter(t=>t.cwd&&t.projectName===e);if(0===t.length)return{cwd:null,sessions:[]};let n=[...t].sort((e,t)=>t.mtimeMs-e.mtimeMs);return{cwd:n[0].cwd??null,sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.sessionId,path:`goose-db://${e.sessionId}`,lastModified:t,lastModifiedFormatted:(0,r.formatDate)(t),sessionId:e.sessionId,cli:"goose"}})}}let c=(0,s.runtimeCache)(l,2),d=(0,s.runtimeCache)(e=>u(e),2,{maxSize:50});e.s(["getCachedGooseProjects",0,c,"getCachedGooseSessions",0,a,"getCachedGooseSessionsByEncodedName",0,d,"getGooseProjects",0,l,"getGooseSessions",0,o,"getGooseSessionsByEncodedName",0,u])},72094,e=>{"use strict";var t=e.i(2157),n=e.i(12714),i=e.i(50227),s=e.i(60526),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=["agent-sessions","conversations","sessions"],u=["events.jsonl","transcript.jsonl","messages.jsonl"],c="agent-transcripts";function d(e){let n=function(e){if(!e)return null;let n=(0,i.resolve)(process.env.CURSOR_HOME||(0,i.join)((0,s.homedir)(),".cursor")),r=(0,i.resolve)(n,"projects"),o=[];try{o=(0,t.readdirSync)(r,{withFileTypes:!0})}catch{}for(let n of o){if(!n.isDirectory())continue;let s=(0,i.resolve)(r,n.name,c,e),o=(0,i.resolve)(r,n.name,c);if(s!==o&&s.startsWith(`${o}${i.sep}`)&&(0,t.existsSync)(s))return s}for(let s of l){let r=(0,i.resolve)(n,s),o=(0,i.resolve)(r,e);if(o!==r&&o.startsWith(`${r}${i.sep}`)&&(0,t.existsSync)(o))return o}return null}(e);if(!n)return null;let r=(0,i.join)(n,`${(0,i.basename)(n)}.jsonl`);if((0,t.existsSync)(r))return r;for(let e of u){let s=(0,i.join)(n,e);if((0,t.existsSync)(s))return s}return null}async function f(e,t="session"){let n,i=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,u=new Map,c=!1,d=Date.now();for(let e=0;e<i.length;e++){let f;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let m=i[e];try{f=JSON.parse(m)}catch{continue}let p={...f,_source:t};if(r.push(p),!f.type&&f.role&&f.message?.content){let n=new Date(d+e),i=n.toISOString(),r=f.message.content.filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("");if("user"===f.role){let e=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(r),a=e?e[1]:r;a&&s.push({type:"user",...(0,o.baseEntry)(p,i,n,t),message:{role:"user",content:a}});continue}if("assistant"===f.role){let e=r?[{type:"text",text:r}]:[];0===e.length?s.push({type:"system",...(0,o.baseEntry)(p,i,n,t),raw:p}):s.push({type:"assistant",...(0,o.baseEntry)(p,i,n,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,o.baseEntry)(p,i,n,t),raw:p});continue}let y=f.timestamp;if(!y)continue;let g=new Date(y);if(Number.isNaN(g.getTime()))continue;let h=g.toISOString(),w=f.type,_=f.data??{};if("session.start"===w||"sessionStart"===w||"session_start"===w){let e=_.context??_,i=e.cwd;"string"!=typeof i||n||(n=i),!n&&Array.isArray(e.workspace_roots)&&"string"==typeof e.workspace_roots[0]&&(n=e.workspace_roots[0]);let r=c?"Session Resumed":"Session Started";c=!0,s.push({type:"queue-operation",...(0,o.baseEntry)(p,h,g,t),label:r});continue}if("user.message"===w||"userMessage"===w){let e="string"==typeof _.content?_.content:"string"==typeof _.text?_.text:"";if(!e)continue;s.push({type:"user",...(0,o.baseEntry)(p,h,g,t),message:{role:"user",content:e}});continue}if("system.message"===w||"systemMessage"===w){s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p});continue}if("assistant.message"===w||"assistantMessage"===w){let e="string"==typeof _.content?_.content:"string"==typeof _.text?_.text:"";if(!e){s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p});continue}let n=[{type:"text",text:e}];s.push({type:"assistant",...(0,o.baseEntry)(p,h,g,t),message:{role:"assistant",content:n}});continue}if("tool.execution_start"===w||"tool.executionStart"===w||"preToolUse"===w){let e=_.toolCallId??_.tool_use_id,n=_.toolName??_.tool_name??"tool",i=_.arguments??_.tool_input??{},r={type:"tool_use",id:e??`${g.getTime()}-${n}`,name:n,input:i},a={type:"assistant",...(0,o.baseEntry)(p,h,g,t),message:{role:"assistant",content:[r]}};s.push(a),e&&(l.set(e,r),u.set(e,g.getTime()));continue}if("tool.execution_complete"===w||"tool.executionComplete"===w||"postToolUse"===w){let e=_.toolCallId??_.tool_use_id,n=e?l.get(e):void 0;if(n){let t=u.get(e)??g.getTime(),i=_.result??{},s=_.duration,r="number"==typeof s&&s>=0?s:Math.max(0,g.getTime()-t),l=i.detailedContent??i.content??_.tool_output??"";n.result={timestamp:h,timestampFormatted:(0,o.formatTimestamp)(g),content:"string"==typeof l?l:JSON.stringify(l),durationMs:r,durationFormatted:(0,a.formatDuration)(r)};continue}s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p});continue}s.push({type:"system",...(0,o.baseEntry)(p,h,g,t),raw:p})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:n}}async function m(e){let t,i=d(e);if(!i)return null;try{t=await (0,n.readFile)(i,"utf-8")}catch{return null}let{entries:s,rawLines:r,cwd:o}=await f(t,"session");return{entries:s,rawLines:r,cwd:o,filePath:i}}(0,r.runtimeCache)(e=>m(e),60,{maxSize:50}),e.s(["findCursorTranscript",0,d,"getCursorSessionLog",0,m])},93114,e=>{"use strict";var t=e.i(12714),n=e.i(2157),i=e.i(60526),s=e.i(50227),r=e.i(83534),o=e.i(54214),a=e.i(67405);let l=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,u=new Set(["CONVERSATION_HISTORY","CHECKPOINT"]);function c(){return process.env.ANTIGRAVITY_HOME||(0,s.join)((0,i.homedir)(),".gemini","antigravity-cli")}function d(){return(0,s.join)(c(),"brain")}function f(){return(0,s.join)(".system_generated","logs","transcript_full.jsonl")}function m(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function p(e,t="session"){let n=[],i=new Map,s=Date.now();for(let r=0;r<e.length;r++){let l=e[r];if(!m(l))continue;let c="string"==typeof l.type?l.type:"";if(!c||u.has(c))continue;let d=function(e,t){if("number"==typeof e&&Number.isFinite(e)){if(e>1e12)return new Date(e);if(e>1e9)return new Date(1e3*e)}if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}return new Date(t)}(l.created_at,s+r),f=d.toISOString(),p="number"==typeof l.step_index?l.step_index:r,y={uuid:`antigravity-${p}`,parentUuid:null},g=(0,o.baseEntry)(y,f,d,t);if("USER_INPUT"===c){let e="string"==typeof l.content?l.content:"";n.push({type:"user",...g,message:{role:"user",content:e}});continue}if("PLANNER_RESPONSE"===c){let e=[];if("string"==typeof l.content&&l.content.length>0&&e.push({type:"text",text:l.content}),Array.isArray(l.tool_calls))for(let t=0;t<l.tool_calls.length;t++){let n=l.tool_calls[t];if(!m(n))continue;let s="string"==typeof n.name?n.name:"tool",r={type:"tool_use",id:`${s}-${p}-${t}`,name:s,input:m(n.args)?n.args:{}};e.push(r);let o=s.toUpperCase(),a=i.get(o)??[];a.push({block:r,startMs:d.getTime()}),i.set(o,a)}if(0===e.length)continue;n.push({type:"assistant",...g,message:{role:"assistant",content:e}});continue}let h=i.get(c);if(h&&h.length>0){let{block:e,startMs:t}=h.shift(),n=Math.max(0,d.getTime()-t);e.result={timestamp:f,timestampFormatted:(0,o.formatTimestamp)(d),content:"string"==typeof l.content?l.content:"",durationMs:n,durationFormatted:(0,a.formatDuration)(n)};continue}n.push({type:"system",...g,raw:y})}return n.sort((e,t)=>e.timestampMs-t.timestampMs),n}function y(e){if(!l.test(e))return null;let t=(0,s.join)(d(),e,f());try{if((0,n.statSync)(t).isFile())return t}catch{}return null}async function g(e){let n,i=y(e);if(!i)return null;try{n=await (0,t.readFile)(i,"utf-8")}catch{return null}let s=(0,o.parseRawLines)(n,"session"),r=p(s,"session"),a=function(e){for(let t of e)if(m(t)&&Array.isArray(t.tool_calls))for(let e of t.tool_calls){if(!m(e)||!m(e.args))continue;let t=e.args.Cwd??e.args.cwd;if("string"==typeof t&&t.length>0)return t}}(s);return{entries:r,rawLines:s,cwd:a,filePath:i}}(0,r.runtimeCache)(e=>g(e),60,{maxSize:50}),e.s(["antigravityHome",0,c,"antigravityLinesToLogEntries",0,p,"findAntigravityTranscript",0,y,"getAntigravitySessionLog",0,g,"listAntigravityTranscripts",0,function(){let e,t=d(),i=f(),r=[];try{e=(0,n.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory())}catch{return r}for(let o of e){let e=o.name;if(!l.test(e))continue;let a=(0,s.join)(t,e,i);try{let t=(0,n.statSync)(a);if(!t.isFile())continue;r.push({conversationId:e,transcriptPath:a,mtimeMs:t.mtimeMs,sizeBytes:t.size})}catch{}}return r}])},30441,e=>{"use strict";var t=e.i(50227),n=e.i(79708),i=e.i(93114),s=e.i(83534),r=e.i(81580),o=e.i(28557),a=e.i(40911);function l(){return(0,t.join)((0,i.antigravityHome)(),"conversation_summaries.db")}async function u(){let e=new Map,t=await (0,n.openSqliteReadonly)(l());if(!t)return e;try{for(let n of t.query("SELECT conversation_id, title, step_count, workspace_uris, last_modified_time FROM conversation_summaries"))n.conversation_id&&e.set(n.conversation_id,{title:n.title??void 0,cwd:function(e){let t;if(!e)return;try{let n=JSON.parse(e);Array.isArray(n)&&"string"==typeof n[0]?t=n[0]:"string"==typeof n&&(t=n)}catch{t=e}if(!t)return;let n=t.replace(/^file:\/\//,"");return n.length>0?n:void 0}(n.workspace_uris),stepCount:"number"==typeof n.step_count?n.step_count:void 0,lastMs:function(e){if("number"==typeof e&&Number.isFinite(e))return e>1e12?e:e>1e9?1e3*e:void 0;if("string"==typeof e){let t=Date.parse(e);if(!Number.isNaN(t))return t}}(n.last_modified_time)})}catch{}finally{t.close()}return e}async function c(){let e;try{e=(0,i.listAntigravityTranscripts)()}catch(e){return(0,a.logWarn)("Failed to scan Antigravity brain dir:",e),[]}let t=await u(),n=[];for(let s of e){let e=t.get(s.conversationId),r=e?.cwd??null;if(!r)try{let e=await (0,i.getAntigravitySessionLog)(s.conversationId);r=e?.cwd??null}catch{r=null}n.push({conversationId:s.conversationId,cwd:r,title:e?.title,mtimeMs:e?.lastMs??s.mtimeMs})}return n}let d="antigravity";async function f(){let e=await c(),t=new Map;for(let n of e){let e=n.cwd?(0,r.encodeFolderName)(n.cwd):d,i=n.cwd??"antigravity",s=t.get(e);(!s||n.mtimeMs>s.latest)&&t.set(e,{latest:n.mtimeMs,path:i})}let n=[];for(let[e,{latest:i,path:s}]of t){let t=new Date(i);n.push({name:e,path:s,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,o.formatDate)(t),cli:["antigravity"]})}return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}async function m(e){let t=(await c()).filter(t=>(t.cwd?(0,r.encodeFolderName)(t.cwd):d)===e);if(0===t.length)return{cwd:null,sessions:[]};let n=[...t].sort((e,t)=>t.mtimeMs-e.mtimeMs);return{cwd:n.find(e=>e.cwd)?.cwd??(e===d?null:(0,r.decodeFolderName)(e)),sessions:n.map(e=>{let t=new Date(e.mtimeMs);return{name:e.title??e.conversationId,path:`antigravity://${e.conversationId}`,lastModified:t,lastModifiedFormatted:(0,o.formatDate)(t),sessionId:e.conversationId,cli:"antigravity"}})}}let p=(0,s.runtimeCache)(f,30),y=(0,s.runtimeCache)(e=>m(e),30,{maxSize:50});e.s(["antigravitySummariesDbPath",0,l,"getAntigravityIndex",0,u,"getAntigravityProjects",0,f,"getAntigravitySessionsByEncodedName",0,m,"getCachedAntigravityProjects",0,p,"getCachedAntigravitySessionsByEncodedName",0,y])},37352,e=>{e.v(e=>Promise.resolve().then(()=>e(36203)))},5807,e=>{e.v(e=>Promise.resolve().then(()=>e(55851)))},97452,e=>{e.v(e=>Promise.resolve().then(()=>e(46413)))},82978,e=>{e.v(e=>Promise.resolve().then(()=>e(35435)))},45093,e=>{e.v(e=>Promise.resolve().then(()=>e(19791)))},67347,e=>{e.v(e=>Promise.resolve().then(()=>e(64828)))},38978,e=>{e.v(t=>Promise.all(["server/chunks/lib_openclaw-projects_ts_0gc-p24._.js"].map(t=>e.l(t))).then(()=>t(90624)))},62998,e=>{e.v(t=>Promise.all(["server/chunks/lib_factory-projects_ts_1eo_bk-._.js"].map(t=>e.l(t))).then(()=>t(69391)))},52400,e=>{e.v(e=>Promise.resolve().then(()=>e(79364)))},91301,e=>{e.v(e=>Promise.resolve().then(()=>e(30441)))},31854,e=>{e.v(e=>Promise.resolve().then(()=>e(69164)))},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__1_g_b3t._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0q2nbsl._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[60526,(t,e,s)=>{e.exports=t.x("node:os",()=>require("node:os"))},2157,(t,e,s)=>{e.exports=t.x("node:fs",()=>require("node:fs"))},54214,67405,t=>{"use strict";var e=t.i(24868),s=t.i(14747),n=t.i(81580),i=t.i(56936);async function r(t,n,i,r){let o=`agent-${r}.jsonl`;for(let r of[(0,s.join)(t,n,o),(0,s.join)(t,n,i,o),(0,s.join)(t,n,i,"subagents",o)])if(!(0,s.relative)(t,r).startsWith(".."))try{return await (0,e.access)(r),r}catch(t){if("ENOENT"===t.code)continue;break}return null}var o=t.i(83534),a=t.i(71809),u=t.i(28557);function l(t){if(t<1e3)return`${t}ms`;let e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;let s=Math.floor(e/60);if(s>=60){let t=Math.floor(s/60);return`${t}h ${s%60}m`}let n=(e%60).toFixed(0);return`${s}m ${n}s`}function m(t){let e=(0,u.formatDate)(t),s=t.getMilliseconds().toString().padStart(3,"0");return`${e}.${s}`}function p(t,e,s,n){return{_source:n,uuid:t.uuid||"",parentUuid:t.parentUuid??null,timestamp:e,timestampMs:s.getTime(),timestampFormatted:m(s)}}async function c(t,e){let s=t.split("\n").filter(t=>""!==t.trim()),n=new Map,i=[],r=[],o=new Set,a=!1;for(let t=0;t<s.length;t++){let u;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let l=s[t];try{u=JSON.parse(l)}catch{continue}let m={...u,_source:e};r.push(m);let c=u.type,f=u.timestamp;if(!f)continue;let y=new Date(f),g=y.getTime();if("user"===c){let t=u.message;if(Array.isArray(t?.content)){let e=t.content;if(e.some(t=>"tool_result"===t.type)){let t=u.toolUseResult,s="string"==typeof t?.agentId?t.agentId:void 0;for(let t of(s&&/^[a-f0-9]+$/.test(s)&&o.add(s),e)){if("tool_result"!==t.type)continue;let e=t.tool_use_id;if(!e)continue;let{text:i,images:r}=function(t){let e=t.content;if("string"==typeof e)return{text:e};if(Array.isArray(e)){let t=e.filter(t=>"text"===t.type).map(t=>t.text),s=e.filter(t=>"image"===t.type).map(t=>{let e=t.source;return{base64:e.data,mediaType:e.media_type}}).filter(t=>t.base64&&t.mediaType);return{text:t.length>0?t.join("\n"):void 0,images:s.length>0?s:void 0}}return{}}(t);n.set(e,{timestamp:f,timestampMs:g,content:i,images:r,agentId:s})}continue}}let s="string"==typeof t?.content?t.content:"";i.push({type:"user",...p(u,f,y,e),message:{role:"user",content:s}});continue}if("assistant"===c){let t=u.message,s=[];if(Array.isArray(t?.content)&&(s=t.content.filter(t=>["text","tool_use","thinking"].includes(t.type)).map(t=>{if("text"===t.type)return{type:"text",text:t.text};if("tool_use"===t.type){let e=t.input;return{type:"tool_use",id:t.id,name:t.name,input:t.input??{},..."Task"===t.name&&e?{subagentType:e.subagent_type,subagentDescription:e.description}:{}}}return{type:"thinking",thinking:t.thinking,signature:t.signature}})),0===s.length)continue;i.push({type:"assistant",...p(u,f,y,e),message:{role:"assistant",content:s,model:t?.model}});continue}if("file-history-snapshot"===c||"progress"===c||"system"===c){i.push({type:c,...p(u,f,y,e),raw:{...u}});continue}if("queue-operation"===c){let t=a?"Session Resumed":"Session Started";a=!0,i.push({type:"queue-operation",...p(u,f,y,e),label:t});continue}}let u=0;for(let t of i)if("assistant"===t.type)for(let e of(++u%200==0&&await new Promise(t=>setImmediate(t)),t.message.content)){if("tool_use"!==e.type)continue;let s=n.get(e.id);if(!s)continue;let i=new Date(s.timestamp),r=Math.max(0,s.timestampMs-t.timestampMs);e.result={timestamp:s.timestamp,timestampFormatted:m(i),content:s.content,images:s.images,durationMs:r,durationFormatted:l(r)},s.agentId&&(e.subagentId=s.agentId)}return i.length>500&&await new Promise(t=>setImmediate(t)),i.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:i,rawLines:r,subagentIds:Array.from(o)}}async function f(t,e="session"){return(await c(t,e)).entries}async function y(t,o){let u=(0,i.resolveProjectPath)(t),l=(0,n.getClaudeProjectsPath)(),m=(0,s.join)(u,`${o}.jsonl`),p=await (0,e.readFile)(m,"utf-8"),{entries:f,rawLines:y,subagentIds:g}=await c(p,"session");if(0===g.length)return{entries:f,rawLines:y,subagentIds:[]};let d=await (0,a.batchAll)(g.map(s=>async()=>{let n=`agent-${s}`,i=await r(l,t,o,s);if(!i)return null;let a=await (0,e.readFile)(i,"utf-8"),{entries:u,rawLines:m}=await c(a,n);return{entries:u,rawLines:m}}),4),h=[...f],w=[...y];for(let t of d)"fulfilled"===t.status&&t.value&&(h.push(...t.value.entries),w.push(...t.value.rawLines));return h.length>500&&await new Promise(t=>setImmediate(t)),h.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:h,rawLines:w,subagentIds:g}}t.s(["formatDuration",0,l],67405),(0,o.runtimeCache)((t,e)=>y(t,e),60,{maxSize:50}),t.s(["baseEntry",0,p,"formatTimestamp",0,m,"parseLogContent",0,f,"parseRawLines",0,function(t,e){return t.split("\n").filter(t=>""!==t.trim()).flatMap(t=>{try{let s=JSON.parse(t);return void 0!==e&&(s._source=e),[s]}catch{return[]}})}],54214)},72094,t=>{"use strict";var e=t.i(2157),s=t.i(12714),n=t.i(50227),i=t.i(60526),r=t.i(83534),o=t.i(54214),a=t.i(67405);let u=["agent-sessions","conversations","sessions"],l=["events.jsonl","transcript.jsonl","messages.jsonl"],m="agent-transcripts";function p(t){let s=function(t){if(!t)return null;let s=(0,n.resolve)(process.env.CURSOR_HOME||(0,n.join)((0,i.homedir)(),".cursor")),r=(0,n.resolve)(s,"projects"),o=[];try{o=(0,e.readdirSync)(r,{withFileTypes:!0})}catch{}for(let s of o){if(!s.isDirectory())continue;let i=(0,n.resolve)(r,s.name,m,t),o=(0,n.resolve)(r,s.name,m);if(i!==o&&i.startsWith(`${o}${n.sep}`)&&(0,e.existsSync)(i))return i}for(let i of u){let r=(0,n.resolve)(s,i),o=(0,n.resolve)(r,t);if(o!==r&&o.startsWith(`${r}${n.sep}`)&&(0,e.existsSync)(o))return o}return null}(t);if(!s)return null;let r=(0,n.join)(s,`${(0,n.basename)(s)}.jsonl`);if((0,e.existsSync)(r))return r;for(let t of l){let i=(0,n.join)(s,t);if((0,e.existsSync)(i))return i}return null}async function c(t,e="session"){let s,n=t.split("\n").filter(t=>""!==t.trim()),i=[],r=[],u=new Map,l=new Map,m=!1,p=Date.now();for(let t=0;t<n.length;t++){let c;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let f=n[t];try{c=JSON.parse(f)}catch{continue}let y={...c,_source:e};if(r.push(y),!c.type&&c.role&&c.message?.content){let s=new Date(p+t),n=s.toISOString(),r=c.message.content.filter(t=>t?.type==="text"&&"string"==typeof t.text).map(t=>t.text).join("");if("user"===c.role){let t=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(r),a=t?t[1]:r;a&&i.push({type:"user",...(0,o.baseEntry)(y,n,s,e),message:{role:"user",content:a}});continue}if("assistant"===c.role){let t=r?[{type:"text",text:r}]:[];0===t.length?i.push({type:"system",...(0,o.baseEntry)(y,n,s,e),raw:y}):i.push({type:"assistant",...(0,o.baseEntry)(y,n,s,e),message:{role:"assistant",content:t}});continue}i.push({type:"system",...(0,o.baseEntry)(y,n,s,e),raw:y});continue}let g=c.timestamp;if(!g)continue;let d=new Date(g);if(Number.isNaN(d.getTime()))continue;let h=d.toISOString(),w=c.type,x=c.data??{};if("session.start"===w||"sessionStart"===w||"session_start"===w){let t=x.context??x,n=t.cwd;"string"!=typeof n||s||(s=n),!s&&Array.isArray(t.workspace_roots)&&"string"==typeof t.workspace_roots[0]&&(s=t.workspace_roots[0]);let r=m?"Session Resumed":"Session Started";m=!0,i.push({type:"queue-operation",...(0,o.baseEntry)(y,h,d,e),label:r});continue}if("user.message"===w||"userMessage"===w){let t="string"==typeof x.content?x.content:"string"==typeof x.text?x.text:"";if(!t)continue;i.push({type:"user",...(0,o.baseEntry)(y,h,d,e),message:{role:"user",content:t}});continue}if("system.message"===w||"systemMessage"===w){i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y});continue}if("assistant.message"===w||"assistantMessage"===w){let t="string"==typeof x.content?x.content:"string"==typeof x.text?x.text:"";if(!t){i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y});continue}let s=[{type:"text",text:t}];i.push({type:"assistant",...(0,o.baseEntry)(y,h,d,e),message:{role:"assistant",content:s}});continue}if("tool.execution_start"===w||"tool.executionStart"===w||"preToolUse"===w){let t=x.toolCallId??x.tool_use_id,s=x.toolName??x.tool_name??"tool",n=x.arguments??x.tool_input??{},r={type:"tool_use",id:t??`${d.getTime()}-${s}`,name:s,input:n},a={type:"assistant",...(0,o.baseEntry)(y,h,d,e),message:{role:"assistant",content:[r]}};i.push(a),t&&(u.set(t,r),l.set(t,d.getTime()));continue}if("tool.execution_complete"===w||"tool.executionComplete"===w||"postToolUse"===w){let t=x.toolCallId??x.tool_use_id,s=t?u.get(t):void 0;if(s){let e=l.get(t)??d.getTime(),n=x.result??{},i=x.duration,r="number"==typeof i&&i>=0?i:Math.max(0,d.getTime()-e),u=n.detailedContent??n.content??x.tool_output??"";s.result={timestamp:h,timestampFormatted:(0,o.formatTimestamp)(d),content:"string"==typeof u?u:JSON.stringify(u),durationMs:r,durationFormatted:(0,a.formatDuration)(r)};continue}i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y});continue}i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y})}return i.length>500&&await new Promise(t=>setImmediate(t)),i.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:i,rawLines:r,cwd:s}}async function f(t){let e,n=p(t);if(!n)return null;try{e=await (0,s.readFile)(n,"utf-8")}catch{return null}let{entries:i,rawLines:r,cwd:o}=await c(e,"session");return{entries:i,rawLines:r,cwd:o,filePath:n}}(0,r.runtimeCache)(t=>f(t),60,{maxSize:50}),t.s(["findCursorTranscript",0,p,"getCursorSessionLog",0,f])}];
1
+ module.exports=[60526,(t,e,s)=>{e.exports=t.x("node:os",()=>require("node:os"))},2157,(t,e,s)=>{e.exports=t.x("node:fs",()=>require("node:fs"))},54214,67405,t=>{"use strict";var e=t.i(24868),s=t.i(14747),n=t.i(81580),i=t.i(56936);async function r(t,n,i,r){let o=`agent-${r}.jsonl`;for(let r of[(0,s.join)(t,n,o),(0,s.join)(t,n,i,o),(0,s.join)(t,n,i,"subagents",o)])if(!(0,s.relative)(t,r).startsWith(".."))try{return await (0,e.access)(r),r}catch(t){if("ENOENT"===t.code)continue;break}return null}var o=t.i(83534),a=t.i(71809),u=t.i(28557);function l(t){if(t<1e3)return`${t}ms`;let e=Math.round(t/100);if(e<600)return`${(e/10).toFixed(1)}s`;let s=Math.round(t/1e3);if(s<3600){let t=Math.floor(s/60);return`${t}m ${s%60}s`}let n=Math.round(t/6e4),i=Math.floor(n/60);return`${i}h ${n%60}m`}function m(t){let e=(0,u.formatDate)(t),s=t.getMilliseconds().toString().padStart(3,"0");return`${e}.${s}`}function p(t,e,s,n){return{_source:n,uuid:t.uuid||"",parentUuid:t.parentUuid??null,timestamp:e,timestampMs:s.getTime(),timestampFormatted:m(s)}}async function c(t,e){let s=t.split("\n").filter(t=>""!==t.trim()),n=new Map,i=[],r=[],o=new Set,a=!1;for(let t=0;t<s.length;t++){let u;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let l=s[t];try{u=JSON.parse(l)}catch{continue}let m={...u,_source:e};r.push(m);let c=u.type,f=u.timestamp;if(!f)continue;let y=new Date(f),g=y.getTime();if("user"===c){let t=u.message;if(Array.isArray(t?.content)){let e=t.content;if(e.some(t=>"tool_result"===t.type)){let t=u.toolUseResult,s="string"==typeof t?.agentId?t.agentId:void 0;for(let t of(s&&/^[a-f0-9]+$/.test(s)&&o.add(s),e)){if("tool_result"!==t.type)continue;let e=t.tool_use_id;if(!e)continue;let{text:i,images:r}=function(t){let e=t.content;if("string"==typeof e)return{text:e};if(Array.isArray(e)){let t=e.filter(t=>"text"===t.type).map(t=>t.text),s=e.filter(t=>"image"===t.type).map(t=>{let e=t.source;return{base64:e.data,mediaType:e.media_type}}).filter(t=>t.base64&&t.mediaType);return{text:t.length>0?t.join("\n"):void 0,images:s.length>0?s:void 0}}return{}}(t);n.set(e,{timestamp:f,timestampMs:g,content:i,images:r,agentId:s})}continue}}let s="string"==typeof t?.content?t.content:"";i.push({type:"user",...p(u,f,y,e),message:{role:"user",content:s}});continue}if("assistant"===c){let t=u.message,s=[];if(Array.isArray(t?.content)&&(s=t.content.filter(t=>["text","tool_use","thinking"].includes(t.type)).map(t=>{if("text"===t.type)return{type:"text",text:t.text};if("tool_use"===t.type){let e=t.input;return{type:"tool_use",id:t.id,name:t.name,input:t.input??{},..."Task"===t.name&&e?{subagentType:e.subagent_type,subagentDescription:e.description}:{}}}return{type:"thinking",thinking:t.thinking,signature:t.signature}})),0===s.length)continue;i.push({type:"assistant",...p(u,f,y,e),message:{role:"assistant",content:s,model:t?.model}});continue}if("file-history-snapshot"===c||"progress"===c||"system"===c){i.push({type:c,...p(u,f,y,e),raw:{...u}});continue}if("queue-operation"===c){let t=a?"Session Resumed":"Session Started";a=!0,i.push({type:"queue-operation",...p(u,f,y,e),label:t});continue}}let u=0;for(let t of i)if("assistant"===t.type)for(let e of(++u%200==0&&await new Promise(t=>setImmediate(t)),t.message.content)){if("tool_use"!==e.type)continue;let s=n.get(e.id);if(!s)continue;let i=new Date(s.timestamp),r=Math.max(0,s.timestampMs-t.timestampMs);e.result={timestamp:s.timestamp,timestampFormatted:m(i),content:s.content,images:s.images,durationMs:r,durationFormatted:l(r)},s.agentId&&(e.subagentId=s.agentId)}return i.length>500&&await new Promise(t=>setImmediate(t)),i.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:i,rawLines:r,subagentIds:Array.from(o)}}async function f(t,e="session"){return(await c(t,e)).entries}async function y(t,o){let u=(0,i.resolveProjectPath)(t),l=(0,n.getClaudeProjectsPath)(),m=(0,s.join)(u,`${o}.jsonl`),p=await (0,e.readFile)(m,"utf-8"),{entries:f,rawLines:y,subagentIds:g}=await c(p,"session");if(0===g.length)return{entries:f,rawLines:y,subagentIds:[]};let d=await (0,a.batchAll)(g.map(s=>async()=>{let n=`agent-${s}`,i=await r(l,t,o,s);if(!i)return null;let a=await (0,e.readFile)(i,"utf-8"),{entries:u,rawLines:m}=await c(a,n);return{entries:u,rawLines:m}}),4),h=[...f],w=[...y];for(let t of d)"fulfilled"===t.status&&t.value&&(h.push(...t.value.entries),w.push(...t.value.rawLines));return h.length>500&&await new Promise(t=>setImmediate(t)),h.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:h,rawLines:w,subagentIds:g}}t.s(["formatDuration",0,l],67405),(0,o.runtimeCache)((t,e)=>y(t,e),60,{maxSize:50}),t.s(["baseEntry",0,p,"formatTimestamp",0,m,"parseLogContent",0,f,"parseRawLines",0,function(t,e){return t.split("\n").filter(t=>""!==t.trim()).flatMap(t=>{try{let s=JSON.parse(t);return void 0!==e&&(s._source=e),[s]}catch{return[]}})}],54214)},72094,t=>{"use strict";var e=t.i(2157),s=t.i(12714),n=t.i(50227),i=t.i(60526),r=t.i(83534),o=t.i(54214),a=t.i(67405);let u=["agent-sessions","conversations","sessions"],l=["events.jsonl","transcript.jsonl","messages.jsonl"],m="agent-transcripts";function p(t){let s=function(t){if(!t)return null;let s=(0,n.resolve)(process.env.CURSOR_HOME||(0,n.join)((0,i.homedir)(),".cursor")),r=(0,n.resolve)(s,"projects"),o=[];try{o=(0,e.readdirSync)(r,{withFileTypes:!0})}catch{}for(let s of o){if(!s.isDirectory())continue;let i=(0,n.resolve)(r,s.name,m,t),o=(0,n.resolve)(r,s.name,m);if(i!==o&&i.startsWith(`${o}${n.sep}`)&&(0,e.existsSync)(i))return i}for(let i of u){let r=(0,n.resolve)(s,i),o=(0,n.resolve)(r,t);if(o!==r&&o.startsWith(`${r}${n.sep}`)&&(0,e.existsSync)(o))return o}return null}(t);if(!s)return null;let r=(0,n.join)(s,`${(0,n.basename)(s)}.jsonl`);if((0,e.existsSync)(r))return r;for(let t of l){let i=(0,n.join)(s,t);if((0,e.existsSync)(i))return i}return null}async function c(t,e="session"){let s,n=t.split("\n").filter(t=>""!==t.trim()),i=[],r=[],u=new Map,l=new Map,m=!1,p=Date.now();for(let t=0;t<n.length;t++){let c;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let f=n[t];try{c=JSON.parse(f)}catch{continue}let y={...c,_source:e};if(r.push(y),!c.type&&c.role&&c.message?.content){let s=new Date(p+t),n=s.toISOString(),r=c.message.content.filter(t=>t?.type==="text"&&"string"==typeof t.text).map(t=>t.text).join("");if("user"===c.role){let t=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(r),a=t?t[1]:r;a&&i.push({type:"user",...(0,o.baseEntry)(y,n,s,e),message:{role:"user",content:a}});continue}if("assistant"===c.role){let t=r?[{type:"text",text:r}]:[];0===t.length?i.push({type:"system",...(0,o.baseEntry)(y,n,s,e),raw:y}):i.push({type:"assistant",...(0,o.baseEntry)(y,n,s,e),message:{role:"assistant",content:t}});continue}i.push({type:"system",...(0,o.baseEntry)(y,n,s,e),raw:y});continue}let g=c.timestamp;if(!g)continue;let d=new Date(g);if(Number.isNaN(d.getTime()))continue;let h=d.toISOString(),w=c.type,x=c.data??{};if("session.start"===w||"sessionStart"===w||"session_start"===w){let t=x.context??x,n=t.cwd;"string"!=typeof n||s||(s=n),!s&&Array.isArray(t.workspace_roots)&&"string"==typeof t.workspace_roots[0]&&(s=t.workspace_roots[0]);let r=m?"Session Resumed":"Session Started";m=!0,i.push({type:"queue-operation",...(0,o.baseEntry)(y,h,d,e),label:r});continue}if("user.message"===w||"userMessage"===w){let t="string"==typeof x.content?x.content:"string"==typeof x.text?x.text:"";if(!t)continue;i.push({type:"user",...(0,o.baseEntry)(y,h,d,e),message:{role:"user",content:t}});continue}if("system.message"===w||"systemMessage"===w){i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y});continue}if("assistant.message"===w||"assistantMessage"===w){let t="string"==typeof x.content?x.content:"string"==typeof x.text?x.text:"";if(!t){i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y});continue}let s=[{type:"text",text:t}];i.push({type:"assistant",...(0,o.baseEntry)(y,h,d,e),message:{role:"assistant",content:s}});continue}if("tool.execution_start"===w||"tool.executionStart"===w||"preToolUse"===w){let t=x.toolCallId??x.tool_use_id,s=x.toolName??x.tool_name??"tool",n=x.arguments??x.tool_input??{},r={type:"tool_use",id:t??`${d.getTime()}-${s}`,name:s,input:n},a={type:"assistant",...(0,o.baseEntry)(y,h,d,e),message:{role:"assistant",content:[r]}};i.push(a),t&&(u.set(t,r),l.set(t,d.getTime()));continue}if("tool.execution_complete"===w||"tool.executionComplete"===w||"postToolUse"===w){let t=x.toolCallId??x.tool_use_id,s=t?u.get(t):void 0;if(s){let e=l.get(t)??d.getTime(),n=x.result??{},i=x.duration,r="number"==typeof i&&i>=0?i:Math.max(0,d.getTime()-e),u=n.detailedContent??n.content??x.tool_output??"";s.result={timestamp:h,timestampFormatted:(0,o.formatTimestamp)(d),content:"string"==typeof u?u:JSON.stringify(u),durationMs:r,durationFormatted:(0,a.formatDuration)(r)};continue}i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y});continue}i.push({type:"system",...(0,o.baseEntry)(y,h,d,e),raw:y})}return i.length>500&&await new Promise(t=>setImmediate(t)),i.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:i,rawLines:r,cwd:s}}async function f(t){let e,n=p(t);if(!n)return null;try{e=await (0,s.readFile)(n,"utf-8")}catch{return null}let{entries:i,rawLines:r,cwd:o}=await c(e,"session");return{entries:i,rawLines:r,cwd:o,filePath:n}}(0,r.runtimeCache)(t=>f(t),60,{maxSize:50}),t.s(["findCursorTranscript",0,p,"getCursorSessionLog",0,f])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0rv7m0k._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},81580,e=>{"use strict";var t=e.i(46786),r=e.i(14747);e.s(["decodeFolderName",0,function(e){return/^[A-Za-z]--/.test(e)?e[0]+":/"+e.slice(3).replace(/-/g,"/"):e.replace(/-/g,"/")},"encodeFolderName",0,function(e){let t=/^([A-Za-z]):[\\/](.*)$/.exec(e);return t?t[1]+"--"+t[2].replace(/[\\/]/g,"-"):e.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let e=process.env.CLAUDE_PROJECTS_PATH;return e||(0,r.join)((0,t.homedir)(),".claude","projects")}])},83534,e=>{"use strict";e.s(["runtimeCache",0,function(e,t,r){let i=new Map,n=new Map,a=r?.maxSize;return async(...r)=>{let o=JSON.stringify(r),s=i.get(o);if(s&&Date.now()<s.expiry)return s.data;let l=n.get(o);if(l)return l;let u=e(...r).then(e=>{if(n.delete(o),a&&i.size>=a){let e=i.keys().next().value;i.delete(e)}return i.set(o,{data:e,expiry:Date.now()+1e3*t}),e},e=>{throw n.delete(o),e});return n.set(o,u),u}}])},40911,e=>{"use strict";let t={info:0,warn:1,error:2};function r(e){return t[e]>=t.warn}function i(e){return`[failproofai${new Date().toISOString()}] ${e}`}e.s(["logActivity",0,function(e,t,n){if(!r("info"))return;let a=[`user=${e}`,`action=${t}`];n&&a.push(n),console.log(i("ACTIVITY"),a.join(" "))},"logError",0,function(e,t){void 0!==t?console.error(i("ERROR"),e,t):console.error(i("ERROR"),e)},"logWarn",0,function(e,t){r("warn")&&(void 0!==t?console.warn(i("WARN"),e,t):console.warn(i("WARN"),e))}])},28557,e=>{"use strict";e.s(["formatDate",0,function(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}])},71809,e=>{"use strict";async function t(e,t){let r=Array(e.length),i=0;async function n(){for(;i<e.length;){let t=i++;try{r[t]={status:"fulfilled",value:await e[t]()}}catch(e){r[t]={status:"rejected",reason:e}}}}let a=Array.from({length:Math.min(t,e.length)},()=>n());return await Promise.all(a),r}e.s(["batchAll",0,t])},56936,e=>{"use strict";var t=e.i(12714),r=e.i(50227),i=e.i(81580),n=e.i(83534),a=e.i(71809),o=e.i(40911),s=e.i(28557);let l=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;async function u(e,r){try{return(await (0,t.stat)(e)).mtime}catch(e){return(0,o.logWarn)(`Failed to stat ${r}:`,e),new Date(0)}}async function c(e){try{if(!(await (0,t.stat)(e)).isDirectory())return null;return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function f(){try{let e=(0,i.getClaudeProjectsPath)(),t=await c(e);if(!t)return[];let n=(await (0,a.batchAll)(t.filter(e=>e.isDirectory()).map(t=>async()=>{let i=(0,r.join)(e,t.name),n=await u(i,t.name);return{name:t.name,path:i,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,s.formatDate)(n),cli:["claude"]}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}catch(e){return(0,o.logError)("Error reading Claude project folders:",e),[]}}async function m(){let[{getCodexProjects:t},{getCopilotProjects:r},{getCursorProjects:i},{getOpenCodeProjects:n},{getPiProjects:a},{getHermesProjects:s},{getOpenClawProjects:l},{getFactoryProjects:u},{getDevinProjects:c},{getAntigravityProjects:m},{getGooseProjects:d}]=await Promise.all([e.A(37352),e.A(5807),e.A(97452),e.A(82978),e.A(45093),e.A(67347),e.A(38978),e.A(62998),e.A(52400),e.A(91301),e.A(31854)]),[p,g,h,y,w,E,j,A,M,v,x,P]=await Promise.all([f(),t().catch(e=>((0,o.logError)("Error reading Codex projects:",e),[])),r().catch(e=>((0,o.logError)("Error reading Copilot projects:",e),[])),i().catch(e=>((0,o.logError)("Error reading Cursor projects:",e),[])),n().catch(e=>((0,o.logError)("Error reading OpenCode projects:",e),[])),a().catch(e=>((0,o.logError)("Error reading Pi projects:",e),[])),s().catch(e=>((0,o.logError)("Error reading Hermes projects:",e),[])),l().catch(e=>((0,o.logError)("Error reading OpenClaw projects:",e),[])),u().catch(e=>((0,o.logError)("Error reading Factory projects:",e),[])),c().catch(e=>((0,o.logError)("Error reading Devin projects:",e),[])),m().catch(e=>((0,o.logError)("Error reading Antigravity projects:",e),[])),d().catch(e=>((0,o.logError)("Error reading Goose projects:",e),[]))]);return function(...e){let t=new Map;for(let r of e)for(let e of r){let r=t.get(e.name);if(!r){t.set(e.name,{...e,cli:[...e.cli]});continue}let i=[...r.cli];for(let t of e.cli)i.includes(t)||i.push(t);let n=e.lastModified.getTime()>r.lastModified.getTime()?e:r;t.set(e.name,{...r,cli:i,lastModified:n.lastModified,lastModifiedFormatted:n.lastModifiedFormatted})}let r=Array.from(t.values());return r.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),r}(p,g,h,y,w,E,j,A,M,v,x,P)}function d(e){if(!e)throw RangeError("Empty project name");if(/^[/\\]/.test(e))throw RangeError("Absolute project name");let t=(0,r.resolve)((0,i.getClaudeProjectsPath)()),n=(0,r.resolve)((0,r.join)(t,e));if(!n.startsWith(t+r.sep))throw RangeError("Project path escapes root");return n}function p(e){let t=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return t?t[0]:void 0}async function g(e){try{let t=await c(e);if(!t)return[];let i=t.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")&&p(e.name)),n=(await (0,a.batchAll)(i.map(t=>async()=>{let i=(0,r.join)(e,t.name),n=await u(i,t.name);return{name:t.name,path:i,lastModified:n,lastModifiedFormatted:(0,s.formatDate)(n),sessionId:p(t.name),cli:"claude"}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}catch(e){return(0,o.logError)("Error reading session files:",e),[]}}(0,n.runtimeCache)(m,30),(0,n.runtimeCache)(e=>g(e),30),e.s(["UUID_RE",0,l,"resolveProjectPath",0,d,"resolveSessionFilePath",0,function(e,t){if(!l.test(t))throw RangeError("Invalid session ID");let i=d(e);return(0,r.join)(i,`${t}.jsonl`)}])},54214,67405,e=>{"use strict";var t=e.i(24868),r=e.i(14747),i=e.i(81580),n=e.i(56936);async function a(e,i,n,a){let o=`agent-${a}.jsonl`;for(let a of[(0,r.join)(e,i,o),(0,r.join)(e,i,n,o),(0,r.join)(e,i,n,"subagents",o)])if(!(0,r.relative)(e,a).startsWith(".."))try{return await (0,t.access)(a),a}catch(e){if("ENOENT"===e.code)continue;break}return null}var o=e.i(83534),s=e.i(71809),l=e.i(28557);function u(e){if(e<1e3)return`${e}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let r=Math.floor(t/60);if(r>=60){let e=Math.floor(r/60);return`${e}h ${r%60}m`}let i=(t%60).toFixed(0);return`${r}m ${i}s`}function c(e){let t=(0,l.formatDate)(e),r=e.getMilliseconds().toString().padStart(3,"0");return`${t}.${r}`}function f(e,t,r,i){return{_source:i,uuid:e.uuid||"",parentUuid:e.parentUuid??null,timestamp:t,timestampMs:r.getTime(),timestampFormatted:c(r)}}async function m(e,t){let r=e.split("\n").filter(e=>""!==e.trim()),i=new Map,n=[],a=[],o=new Set,s=!1;for(let e=0;e<r.length;e++){let l;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let u=r[e];try{l=JSON.parse(u)}catch{continue}let c={...l,_source:t};a.push(c);let m=l.type,d=l.timestamp;if(!d)continue;let p=new Date(d),g=p.getTime();if("user"===m){let e=l.message;if(Array.isArray(e?.content)){let t=e.content;if(t.some(e=>"tool_result"===e.type)){let e=l.toolUseResult,r="string"==typeof e?.agentId?e.agentId:void 0;for(let e of(r&&/^[a-f0-9]+$/.test(r)&&o.add(r),t)){if("tool_result"!==e.type)continue;let t=e.tool_use_id;if(!t)continue;let{text:n,images:a}=function(e){let t=e.content;if("string"==typeof t)return{text:t};if(Array.isArray(t)){let e=t.filter(e=>"text"===e.type).map(e=>e.text),r=t.filter(e=>"image"===e.type).map(e=>{let t=e.source;return{base64:t.data,mediaType:t.media_type}}).filter(e=>e.base64&&e.mediaType);return{text:e.length>0?e.join("\n"):void 0,images:r.length>0?r:void 0}}return{}}(e);i.set(t,{timestamp:d,timestampMs:g,content:n,images:a,agentId:r})}continue}}let r="string"==typeof e?.content?e.content:"";n.push({type:"user",...f(l,d,p,t),message:{role:"user",content:r}});continue}if("assistant"===m){let e=l.message,r=[];if(Array.isArray(e?.content)&&(r=e.content.filter(e=>["text","tool_use","thinking"].includes(e.type)).map(e=>{if("text"===e.type)return{type:"text",text:e.text};if("tool_use"===e.type){let t=e.input;return{type:"tool_use",id:e.id,name:e.name,input:e.input??{},..."Task"===e.name&&t?{subagentType:t.subagent_type,subagentDescription:t.description}:{}}}return{type:"thinking",thinking:e.thinking,signature:e.signature}})),0===r.length)continue;n.push({type:"assistant",...f(l,d,p,t),message:{role:"assistant",content:r,model:e?.model}});continue}if("file-history-snapshot"===m||"progress"===m||"system"===m){n.push({type:m,...f(l,d,p,t),raw:{...l}});continue}if("queue-operation"===m){let e=s?"Session Resumed":"Session Started";s=!0,n.push({type:"queue-operation",...f(l,d,p,t),label:e});continue}}let l=0;for(let e of n)if("assistant"===e.type)for(let t of(++l%200==0&&await new Promise(e=>setImmediate(e)),e.message.content)){if("tool_use"!==t.type)continue;let r=i.get(t.id);if(!r)continue;let n=new Date(r.timestamp),a=Math.max(0,r.timestampMs-e.timestampMs);t.result={timestamp:r.timestamp,timestampFormatted:c(n),content:r.content,images:r.images,durationMs:a,durationFormatted:u(a)},r.agentId&&(t.subagentId=r.agentId)}return n.length>500&&await new Promise(e=>setImmediate(e)),n.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:n,rawLines:a,subagentIds:Array.from(o)}}async function d(e,t="session"){return(await m(e,t)).entries}async function p(e,o){let l=(0,n.resolveProjectPath)(e),u=(0,i.getClaudeProjectsPath)(),c=(0,r.join)(l,`${o}.jsonl`),f=await (0,t.readFile)(c,"utf-8"),{entries:d,rawLines:p,subagentIds:g}=await m(f,"session");if(0===g.length)return{entries:d,rawLines:p,subagentIds:[]};let h=await (0,s.batchAll)(g.map(r=>async()=>{let i=`agent-${r}`,n=await a(u,e,o,r);if(!n)return null;let s=await (0,t.readFile)(n,"utf-8"),{entries:l,rawLines:c}=await m(s,i);return{entries:l,rawLines:c}}),4),y=[...d],w=[...p];for(let e of h)"fulfilled"===e.status&&e.value&&(y.push(...e.value.entries),w.push(...e.value.rawLines));return y.length>500&&await new Promise(e=>setImmediate(e)),y.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:y,rawLines:w,subagentIds:g}}e.s(["formatDuration",0,u],67405),(0,o.runtimeCache)((e,t)=>p(e,t),60,{maxSize:50}),e.s(["baseEntry",0,f,"formatTimestamp",0,c,"parseLogContent",0,d,"parseRawLines",0,function(e,t){return e.split("\n").filter(e=>""!==e.trim()).flatMap(e=>{try{let r=JSON.parse(e);return void 0!==t&&(r._source=t),[r]}catch{return[]}})}],54214)}];
1
+ module.exports=[14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},81580,e=>{"use strict";var t=e.i(46786),r=e.i(14747);e.s(["decodeFolderName",0,function(e){return/^[A-Za-z]--/.test(e)?e[0]+":/"+e.slice(3).replace(/-/g,"/"):e.replace(/-/g,"/")},"encodeFolderName",0,function(e){let t=/^([A-Za-z]):[\\/](.*)$/.exec(e);return t?t[1]+"--"+t[2].replace(/[\\/]/g,"-"):e.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let e=process.env.CLAUDE_PROJECTS_PATH;return e||(0,r.join)((0,t.homedir)(),".claude","projects")}])},83534,e=>{"use strict";e.s(["runtimeCache",0,function(e,t,r){let i=new Map,n=new Map,a=r?.maxSize;return async(...r)=>{let o=JSON.stringify(r),s=i.get(o);if(s&&Date.now()<s.expiry)return s.data;let l=n.get(o);if(l)return l;let u=e(...r).then(e=>{if(n.delete(o),a&&i.size>=a){let e=i.keys().next().value;i.delete(e)}return i.set(o,{data:e,expiry:Date.now()+1e3*t}),e},e=>{throw n.delete(o),e});return n.set(o,u),u}}])},40911,e=>{"use strict";let t={info:0,warn:1,error:2};function r(e){return t[e]>=t.warn}function i(e){return`[failproofai${new Date().toISOString()}] ${e}`}e.s(["logActivity",0,function(e,t,n){if(!r("info"))return;let a=[`user=${e}`,`action=${t}`];n&&a.push(n),console.log(i("ACTIVITY"),a.join(" "))},"logError",0,function(e,t){void 0!==t?console.error(i("ERROR"),e,t):console.error(i("ERROR"),e)},"logWarn",0,function(e,t){r("warn")&&(void 0!==t?console.warn(i("WARN"),e,t):console.warn(i("WARN"),e))}])},28557,e=>{"use strict";e.s(["formatDate",0,function(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}])},71809,e=>{"use strict";async function t(e,t){let r=Array(e.length),i=0;async function n(){for(;i<e.length;){let t=i++;try{r[t]={status:"fulfilled",value:await e[t]()}}catch(e){r[t]={status:"rejected",reason:e}}}}let a=Array.from({length:Math.min(t,e.length)},()=>n());return await Promise.all(a),r}e.s(["batchAll",0,t])},56936,e=>{"use strict";var t=e.i(12714),r=e.i(50227),i=e.i(81580),n=e.i(83534),a=e.i(71809),o=e.i(40911),s=e.i(28557);let l=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;async function u(e,r){try{return(await (0,t.stat)(e)).mtime}catch(e){return(0,o.logWarn)(`Failed to stat ${r}:`,e),new Date(0)}}async function c(e){try{if(!(await (0,t.stat)(e)).isDirectory())return null;return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function f(){try{let e=(0,i.getClaudeProjectsPath)(),t=await c(e);if(!t)return[];let n=(await (0,a.batchAll)(t.filter(e=>e.isDirectory()).map(t=>async()=>{let i=(0,r.join)(e,t.name),n=await u(i,t.name);return{name:t.name,path:i,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,s.formatDate)(n),cli:["claude"]}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}catch(e){return(0,o.logError)("Error reading Claude project folders:",e),[]}}async function m(){let[{getCodexProjects:t},{getCopilotProjects:r},{getCursorProjects:i},{getOpenCodeProjects:n},{getPiProjects:a},{getHermesProjects:s},{getOpenClawProjects:l},{getFactoryProjects:u},{getDevinProjects:c},{getAntigravityProjects:m},{getGooseProjects:d}]=await Promise.all([e.A(37352),e.A(5807),e.A(97452),e.A(82978),e.A(45093),e.A(67347),e.A(38978),e.A(62998),e.A(52400),e.A(91301),e.A(31854)]),[p,g,h,y,w,E,j,M,A,v,x,P]=await Promise.all([f(),t().catch(e=>((0,o.logError)("Error reading Codex projects:",e),[])),r().catch(e=>((0,o.logError)("Error reading Copilot projects:",e),[])),i().catch(e=>((0,o.logError)("Error reading Cursor projects:",e),[])),n().catch(e=>((0,o.logError)("Error reading OpenCode projects:",e),[])),a().catch(e=>((0,o.logError)("Error reading Pi projects:",e),[])),s().catch(e=>((0,o.logError)("Error reading Hermes projects:",e),[])),l().catch(e=>((0,o.logError)("Error reading OpenClaw projects:",e),[])),u().catch(e=>((0,o.logError)("Error reading Factory projects:",e),[])),c().catch(e=>((0,o.logError)("Error reading Devin projects:",e),[])),m().catch(e=>((0,o.logError)("Error reading Antigravity projects:",e),[])),d().catch(e=>((0,o.logError)("Error reading Goose projects:",e),[]))]);return function(...e){let t=new Map;for(let r of e)for(let e of r){let r=t.get(e.name);if(!r){t.set(e.name,{...e,cli:[...e.cli]});continue}let i=[...r.cli];for(let t of e.cli)i.includes(t)||i.push(t);let n=e.lastModified.getTime()>r.lastModified.getTime()?e:r;t.set(e.name,{...r,cli:i,lastModified:n.lastModified,lastModifiedFormatted:n.lastModifiedFormatted})}let r=Array.from(t.values());return r.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),r}(p,g,h,y,w,E,j,M,A,v,x,P)}function d(e){if(!e)throw RangeError("Empty project name");if(/^[/\\]/.test(e))throw RangeError("Absolute project name");let t=(0,r.resolve)((0,i.getClaudeProjectsPath)()),n=(0,r.resolve)((0,r.join)(t,e));if(!n.startsWith(t+r.sep))throw RangeError("Project path escapes root");return n}function p(e){let t=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return t?t[0]:void 0}async function g(e){try{let t=await c(e);if(!t)return[];let i=t.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")&&p(e.name)),n=(await (0,a.batchAll)(i.map(t=>async()=>{let i=(0,r.join)(e,t.name),n=await u(i,t.name);return{name:t.name,path:i,lastModified:n,lastModifiedFormatted:(0,s.formatDate)(n),sessionId:p(t.name),cli:"claude"}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}catch(e){return(0,o.logError)("Error reading session files:",e),[]}}(0,n.runtimeCache)(m,30),(0,n.runtimeCache)(e=>g(e),30),e.s(["UUID_RE",0,l,"resolveProjectPath",0,d,"resolveSessionFilePath",0,function(e,t){if(!l.test(t))throw RangeError("Invalid session ID");let i=d(e);return(0,r.join)(i,`${t}.jsonl`)}])},54214,67405,e=>{"use strict";var t=e.i(24868),r=e.i(14747),i=e.i(81580),n=e.i(56936);async function a(e,i,n,a){let o=`agent-${a}.jsonl`;for(let a of[(0,r.join)(e,i,o),(0,r.join)(e,i,n,o),(0,r.join)(e,i,n,"subagents",o)])if(!(0,r.relative)(e,a).startsWith(".."))try{return await (0,t.access)(a),a}catch(e){if("ENOENT"===e.code)continue;break}return null}var o=e.i(83534),s=e.i(71809),l=e.i(28557);function u(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let r=Math.round(e/1e3);if(r<3600){let e=Math.floor(r/60);return`${e}m ${r%60}s`}let i=Math.round(e/6e4),n=Math.floor(i/60);return`${n}h ${i%60}m`}function c(e){let t=(0,l.formatDate)(e),r=e.getMilliseconds().toString().padStart(3,"0");return`${t}.${r}`}function f(e,t,r,i){return{_source:i,uuid:e.uuid||"",parentUuid:e.parentUuid??null,timestamp:t,timestampMs:r.getTime(),timestampFormatted:c(r)}}async function m(e,t){let r=e.split("\n").filter(e=>""!==e.trim()),i=new Map,n=[],a=[],o=new Set,s=!1;for(let e=0;e<r.length;e++){let l;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let u=r[e];try{l=JSON.parse(u)}catch{continue}let c={...l,_source:t};a.push(c);let m=l.type,d=l.timestamp;if(!d)continue;let p=new Date(d),g=p.getTime();if("user"===m){let e=l.message;if(Array.isArray(e?.content)){let t=e.content;if(t.some(e=>"tool_result"===e.type)){let e=l.toolUseResult,r="string"==typeof e?.agentId?e.agentId:void 0;for(let e of(r&&/^[a-f0-9]+$/.test(r)&&o.add(r),t)){if("tool_result"!==e.type)continue;let t=e.tool_use_id;if(!t)continue;let{text:n,images:a}=function(e){let t=e.content;if("string"==typeof t)return{text:t};if(Array.isArray(t)){let e=t.filter(e=>"text"===e.type).map(e=>e.text),r=t.filter(e=>"image"===e.type).map(e=>{let t=e.source;return{base64:t.data,mediaType:t.media_type}}).filter(e=>e.base64&&e.mediaType);return{text:e.length>0?e.join("\n"):void 0,images:r.length>0?r:void 0}}return{}}(e);i.set(t,{timestamp:d,timestampMs:g,content:n,images:a,agentId:r})}continue}}let r="string"==typeof e?.content?e.content:"";n.push({type:"user",...f(l,d,p,t),message:{role:"user",content:r}});continue}if("assistant"===m){let e=l.message,r=[];if(Array.isArray(e?.content)&&(r=e.content.filter(e=>["text","tool_use","thinking"].includes(e.type)).map(e=>{if("text"===e.type)return{type:"text",text:e.text};if("tool_use"===e.type){let t=e.input;return{type:"tool_use",id:e.id,name:e.name,input:e.input??{},..."Task"===e.name&&t?{subagentType:t.subagent_type,subagentDescription:t.description}:{}}}return{type:"thinking",thinking:e.thinking,signature:e.signature}})),0===r.length)continue;n.push({type:"assistant",...f(l,d,p,t),message:{role:"assistant",content:r,model:e?.model}});continue}if("file-history-snapshot"===m||"progress"===m||"system"===m){n.push({type:m,...f(l,d,p,t),raw:{...l}});continue}if("queue-operation"===m){let e=s?"Session Resumed":"Session Started";s=!0,n.push({type:"queue-operation",...f(l,d,p,t),label:e});continue}}let l=0;for(let e of n)if("assistant"===e.type)for(let t of(++l%200==0&&await new Promise(e=>setImmediate(e)),e.message.content)){if("tool_use"!==t.type)continue;let r=i.get(t.id);if(!r)continue;let n=new Date(r.timestamp),a=Math.max(0,r.timestampMs-e.timestampMs);t.result={timestamp:r.timestamp,timestampFormatted:c(n),content:r.content,images:r.images,durationMs:a,durationFormatted:u(a)},r.agentId&&(t.subagentId=r.agentId)}return n.length>500&&await new Promise(e=>setImmediate(e)),n.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:n,rawLines:a,subagentIds:Array.from(o)}}async function d(e,t="session"){return(await m(e,t)).entries}async function p(e,o){let l=(0,n.resolveProjectPath)(e),u=(0,i.getClaudeProjectsPath)(),c=(0,r.join)(l,`${o}.jsonl`),f=await (0,t.readFile)(c,"utf-8"),{entries:d,rawLines:p,subagentIds:g}=await m(f,"session");if(0===g.length)return{entries:d,rawLines:p,subagentIds:[]};let h=await (0,s.batchAll)(g.map(r=>async()=>{let i=`agent-${r}`,n=await a(u,e,o,r);if(!n)return null;let s=await (0,t.readFile)(n,"utf-8"),{entries:l,rawLines:c}=await m(s,i);return{entries:l,rawLines:c}}),4),y=[...d],w=[...p];for(let e of h)"fulfilled"===e.status&&e.value&&(y.push(...e.value.entries),w.push(...e.value.rawLines));return y.length>500&&await new Promise(e=>setImmediate(e)),y.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:y,rawLines:w,subagentIds:g}}e.s(["formatDuration",0,u],67405),(0,o.runtimeCache)((e,t)=>p(e,t),60,{maxSize:50}),e.s(["baseEntry",0,f,"formatTimestamp",0,c,"parseLogContent",0,d,"parseRawLines",0,function(e,t){return e.split("\n").filter(e=>""!==e.trim()).flatMap(e=>{try{let r=JSON.parse(e);return void 0!==t&&(r._source=t),[r]}catch{return[]}})}],54214)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__16le-kd._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[60526,(t,e,n)=>{e.exports=t.x("node:os",()=>require("node:os"))},2157,(t,e,n)=>{e.exports=t.x("node:fs",()=>require("node:fs"))},54214,67405,t=>{"use strict";var e=t.i(24868),n=t.i(14747),i=t.i(81580),s=t.i(56936);async function r(t,i,s,r){let a=`agent-${r}.jsonl`;for(let r of[(0,n.join)(t,i,a),(0,n.join)(t,i,s,a),(0,n.join)(t,i,s,"subagents",a)])if(!(0,n.relative)(t,r).startsWith(".."))try{return await (0,e.access)(r),r}catch(t){if("ENOENT"===t.code)continue;break}return null}var a=t.i(83534),o=t.i(71809),u=t.i(28557);function l(t){if(t<1e3)return`${t}ms`;let e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;let n=Math.floor(e/60);if(n>=60){let t=Math.floor(n/60);return`${t}h ${n%60}m`}let i=(e%60).toFixed(0);return`${n}m ${i}s`}function m(t){let e=(0,u.formatDate)(t),n=t.getMilliseconds().toString().padStart(3,"0");return`${e}.${n}`}function p(t,e,n,i){return{_source:i,uuid:t.uuid||"",parentUuid:t.parentUuid??null,timestamp:e,timestampMs:n.getTime(),timestampFormatted:m(n)}}async function c(t,e){let n=t.split("\n").filter(t=>""!==t.trim()),i=new Map,s=[],r=[],a=new Set,o=!1;for(let t=0;t<n.length;t++){let u;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let l=n[t];try{u=JSON.parse(l)}catch{continue}let m={...u,_source:e};r.push(m);let c=u.type,f=u.timestamp;if(!f)continue;let y=new Date(f),d=y.getTime();if("user"===c){let t=u.message;if(Array.isArray(t?.content)){let e=t.content;if(e.some(t=>"tool_result"===t.type)){let t=u.toolUseResult,n="string"==typeof t?.agentId?t.agentId:void 0;for(let t of(n&&/^[a-f0-9]+$/.test(n)&&a.add(n),e)){if("tool_result"!==t.type)continue;let e=t.tool_use_id;if(!e)continue;let{text:s,images:r}=function(t){let e=t.content;if("string"==typeof e)return{text:e};if(Array.isArray(e)){let t=e.filter(t=>"text"===t.type).map(t=>t.text),n=e.filter(t=>"image"===t.type).map(t=>{let e=t.source;return{base64:e.data,mediaType:e.media_type}}).filter(t=>t.base64&&t.mediaType);return{text:t.length>0?t.join("\n"):void 0,images:n.length>0?n:void 0}}return{}}(t);i.set(e,{timestamp:f,timestampMs:d,content:s,images:r,agentId:n})}continue}}let n="string"==typeof t?.content?t.content:"";s.push({type:"user",...p(u,f,y,e),message:{role:"user",content:n}});continue}if("assistant"===c){let t=u.message,n=[];if(Array.isArray(t?.content)&&(n=t.content.filter(t=>["text","tool_use","thinking"].includes(t.type)).map(t=>{if("text"===t.type)return{type:"text",text:t.text};if("tool_use"===t.type){let e=t.input;return{type:"tool_use",id:t.id,name:t.name,input:t.input??{},..."Task"===t.name&&e?{subagentType:e.subagent_type,subagentDescription:e.description}:{}}}return{type:"thinking",thinking:t.thinking,signature:t.signature}})),0===n.length)continue;s.push({type:"assistant",...p(u,f,y,e),message:{role:"assistant",content:n,model:t?.model}});continue}if("file-history-snapshot"===c||"progress"===c||"system"===c){s.push({type:c,...p(u,f,y,e),raw:{...u}});continue}if("queue-operation"===c){let t=o?"Session Resumed":"Session Started";o=!0,s.push({type:"queue-operation",...p(u,f,y,e),label:t});continue}}let u=0;for(let t of s)if("assistant"===t.type)for(let e of(++u%200==0&&await new Promise(t=>setImmediate(t)),t.message.content)){if("tool_use"!==e.type)continue;let n=i.get(e.id);if(!n)continue;let s=new Date(n.timestamp),r=Math.max(0,n.timestampMs-t.timestampMs);e.result={timestamp:n.timestamp,timestampFormatted:m(s),content:n.content,images:n.images,durationMs:r,durationFormatted:l(r)},n.agentId&&(e.subagentId=n.agentId)}return s.length>500&&await new Promise(t=>setImmediate(t)),s.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:s,rawLines:r,subagentIds:Array.from(a)}}async function f(t,e="session"){return(await c(t,e)).entries}async function y(t,a){let u=(0,s.resolveProjectPath)(t),l=(0,i.getClaudeProjectsPath)(),m=(0,n.join)(u,`${a}.jsonl`),p=await (0,e.readFile)(m,"utf-8"),{entries:f,rawLines:y,subagentIds:d}=await c(p,"session");if(0===d.length)return{entries:f,rawLines:y,subagentIds:[]};let g=await (0,o.batchAll)(d.map(n=>async()=>{let i=`agent-${n}`,s=await r(l,t,a,n);if(!s)return null;let o=await (0,e.readFile)(s,"utf-8"),{entries:u,rawLines:m}=await c(o,i);return{entries:u,rawLines:m}}),4),h=[...f],w=[...y];for(let t of g)"fulfilled"===t.status&&t.value&&(h.push(...t.value.entries),w.push(...t.value.rawLines));return h.length>500&&await new Promise(t=>setImmediate(t)),h.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:h,rawLines:w,subagentIds:d}}t.s(["formatDuration",0,l],67405),(0,a.runtimeCache)((t,e)=>y(t,e),60,{maxSize:50}),t.s(["baseEntry",0,p,"formatTimestamp",0,m,"parseLogContent",0,f,"parseRawLines",0,function(t,e){return t.split("\n").filter(t=>""!==t.trim()).flatMap(t=>{try{let n=JSON.parse(t);return void 0!==e&&(n._source=e),[n]}catch{return[]}})}],54214)},57232,t=>{"use strict";var e=t.i(2157),n=t.i(12714),i=t.i(50227),s=t.i(60526),r=t.i(83534),a=t.i(54214),o=t.i(67405);let u=(0,i.join)((0,s.homedir)(),".failproofai","cache","codex-session-paths.json");function l(){try{if(!(0,e.existsSync)(u))return{};return JSON.parse((0,e.readFileSync)(u,"utf-8"))}catch{return{}}}function m(t,n){try{(0,e.mkdirSync)((0,i.dirname)(u),{recursive:!0});let s=l();s[t]=n,(0,e.writeFileSync)(u,JSON.stringify(s),"utf-8")}catch{}}function p(t,n){try{for(let s of(0,e.readdirSync)(t,{withFileTypes:!0}))if(s.isFile()&&s.name.includes(n)&&s.name.endsWith(".jsonl"))return(0,i.join)(t,s.name)}catch{}return null}function c(t){let n=l()[t];if(n&&(0,e.existsSync)(n))return n;let r=(0,i.join)((0,s.homedir)(),".codex","sessions"),a=new Date,o=new Date(a.getTime()-864e5);for(let e of[a,o].map(t=>{let e=String(t.getUTCFullYear()),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return(0,i.join)(r,e,n,s)})){let n=p(e,t);if(n)return m(t,n),n}try{for(let n of(0,e.readdirSync)(r,{withFileTypes:!0}))if(n.isDirectory()){for(let s of(0,e.readdirSync)((0,i.join)(r,n.name),{withFileTypes:!0}))if(s.isDirectory())for(let a of(0,e.readdirSync)((0,i.join)(r,n.name,s.name),{withFileTypes:!0})){if(!a.isDirectory())continue;let e=p((0,i.join)(r,n.name,s.name,a.name),t);if(e)return m(t,e),e}}}catch{}return null}function f(t,e){return Array.isArray(t)?t.filter(t=>t?.type===e&&"string"==typeof t.text).map(t=>t.text).join("\n"):""}async function y(t,e="session"){let n,i=t.split("\n").filter(t=>""!==t.trim()),s=[],r=[],u=new Map,l=new Map,m=!1;for(let t=0;t<i.length;t++){let p;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let c=i[t];try{p=JSON.parse(c)}catch{continue}let y={...p,_source:e};r.push(y);let d=p.timestamp;if(!d)continue;let g=new Date(d);if(Number.isNaN(g.getTime()))continue;let h=p.type,w=p.payload??{};if("session_meta"===h){let t=w.cwd;"string"!=typeof t||n||(n=t),s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("response_item"===h){let t=w.type;if("message"===t){let t=w.role,n=w.content;if("user"===t||"developer"===t){let i=f(n,"input_text");if(!i)continue;let r="developer"===t?`[developer] ${i}`:i;s.push({type:"user",...(0,a.baseEntry)(y,d,g,e),message:{role:"user",content:r}});continue}if("assistant"===t){let t=f(n,"output_text");if(!t)continue;let i=[{type:"text",text:t}];s.push({type:"assistant",...(0,a.baseEntry)(y,d,g,e),message:{role:"assistant",content:i}});continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("function_call"===t){let t=w.call_id,n=w.name??"function_call",i={type:"tool_use",id:t??`${d}-${n}`,name:n,input:function(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}(w.arguments)},r={type:"assistant",...(0,a.baseEntry)(y,d,g,e),message:{role:"assistant",content:[i]}};s.push(r),t&&(u.set(t,i),l.set(t,g.getTime()));continue}if("function_call_output"===t){let t=w.call_id,n=t?u.get(t):void 0;if(n){let e=l.get(t)??g.getTime(),i=Math.max(0,g.getTime()-e);n.result={timestamp:d,timestampFormatted:(0,a.formatTimestamp)(g),content:"string"==typeof w.output?w.output:JSON.stringify(w.output),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("event_msg"===h){let t=w.type;if("task_started"===t){let t=m?"Session Resumed":"Session Started";m=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(y,d,g,e),label:t});continue}if("exec_command_end"===t){let t=w.call_id,n=t?u.get(t):void 0;if(n){let e=w.duration,i=e?(e.secs??0)*1e3+Math.round((e.nanos??0)/1e6):Math.max(0,g.getTime()-(l.get(t)??g.getTime())),s=w.aggregated_output;n.result={timestamp:d,timestampFormatted:(0,a.formatTimestamp)(g),content:"string"==typeof s?s:JSON.stringify(s),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("user_message"===t||"agent_message"===t)continue;s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y})}return s.length>500&&await new Promise(t=>setImmediate(t)),s.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:s,rawLines:r,cwd:n}}async function d(t){let e=c(t);if(!e)return null;let i=await (0,n.readFile)(e,"utf-8"),{entries:s,rawLines:r,cwd:a}=await y(i,"session");return{entries:s,rawLines:r,cwd:a,filePath:e}}(0,r.runtimeCache)(t=>d(t),60,{maxSize:50}),t.s(["findCodexTranscript",0,c,"getCodexSessionLog",0,d])}];
1
+ module.exports=[60526,(t,e,n)=>{e.exports=t.x("node:os",()=>require("node:os"))},2157,(t,e,n)=>{e.exports=t.x("node:fs",()=>require("node:fs"))},54214,67405,t=>{"use strict";var e=t.i(24868),n=t.i(14747),i=t.i(81580),s=t.i(56936);async function r(t,i,s,r){let a=`agent-${r}.jsonl`;for(let r of[(0,n.join)(t,i,a),(0,n.join)(t,i,s,a),(0,n.join)(t,i,s,"subagents",a)])if(!(0,n.relative)(t,r).startsWith(".."))try{return await (0,e.access)(r),r}catch(t){if("ENOENT"===t.code)continue;break}return null}var a=t.i(83534),o=t.i(71809),u=t.i(28557);function l(t){if(t<1e3)return`${t}ms`;let e=Math.round(t/100);if(e<600)return`${(e/10).toFixed(1)}s`;let n=Math.round(t/1e3);if(n<3600){let t=Math.floor(n/60);return`${t}m ${n%60}s`}let i=Math.round(t/6e4),s=Math.floor(i/60);return`${s}h ${i%60}m`}function m(t){let e=(0,u.formatDate)(t),n=t.getMilliseconds().toString().padStart(3,"0");return`${e}.${n}`}function p(t,e,n,i){return{_source:i,uuid:t.uuid||"",parentUuid:t.parentUuid??null,timestamp:e,timestampMs:n.getTime(),timestampFormatted:m(n)}}async function c(t,e){let n=t.split("\n").filter(t=>""!==t.trim()),i=new Map,s=[],r=[],a=new Set,o=!1;for(let t=0;t<n.length;t++){let u;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let l=n[t];try{u=JSON.parse(l)}catch{continue}let m={...u,_source:e};r.push(m);let c=u.type,f=u.timestamp;if(!f)continue;let y=new Date(f),d=y.getTime();if("user"===c){let t=u.message;if(Array.isArray(t?.content)){let e=t.content;if(e.some(t=>"tool_result"===t.type)){let t=u.toolUseResult,n="string"==typeof t?.agentId?t.agentId:void 0;for(let t of(n&&/^[a-f0-9]+$/.test(n)&&a.add(n),e)){if("tool_result"!==t.type)continue;let e=t.tool_use_id;if(!e)continue;let{text:s,images:r}=function(t){let e=t.content;if("string"==typeof e)return{text:e};if(Array.isArray(e)){let t=e.filter(t=>"text"===t.type).map(t=>t.text),n=e.filter(t=>"image"===t.type).map(t=>{let e=t.source;return{base64:e.data,mediaType:e.media_type}}).filter(t=>t.base64&&t.mediaType);return{text:t.length>0?t.join("\n"):void 0,images:n.length>0?n:void 0}}return{}}(t);i.set(e,{timestamp:f,timestampMs:d,content:s,images:r,agentId:n})}continue}}let n="string"==typeof t?.content?t.content:"";s.push({type:"user",...p(u,f,y,e),message:{role:"user",content:n}});continue}if("assistant"===c){let t=u.message,n=[];if(Array.isArray(t?.content)&&(n=t.content.filter(t=>["text","tool_use","thinking"].includes(t.type)).map(t=>{if("text"===t.type)return{type:"text",text:t.text};if("tool_use"===t.type){let e=t.input;return{type:"tool_use",id:t.id,name:t.name,input:t.input??{},..."Task"===t.name&&e?{subagentType:e.subagent_type,subagentDescription:e.description}:{}}}return{type:"thinking",thinking:t.thinking,signature:t.signature}})),0===n.length)continue;s.push({type:"assistant",...p(u,f,y,e),message:{role:"assistant",content:n,model:t?.model}});continue}if("file-history-snapshot"===c||"progress"===c||"system"===c){s.push({type:c,...p(u,f,y,e),raw:{...u}});continue}if("queue-operation"===c){let t=o?"Session Resumed":"Session Started";o=!0,s.push({type:"queue-operation",...p(u,f,y,e),label:t});continue}}let u=0;for(let t of s)if("assistant"===t.type)for(let e of(++u%200==0&&await new Promise(t=>setImmediate(t)),t.message.content)){if("tool_use"!==e.type)continue;let n=i.get(e.id);if(!n)continue;let s=new Date(n.timestamp),r=Math.max(0,n.timestampMs-t.timestampMs);e.result={timestamp:n.timestamp,timestampFormatted:m(s),content:n.content,images:n.images,durationMs:r,durationFormatted:l(r)},n.agentId&&(e.subagentId=n.agentId)}return s.length>500&&await new Promise(t=>setImmediate(t)),s.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:s,rawLines:r,subagentIds:Array.from(a)}}async function f(t,e="session"){return(await c(t,e)).entries}async function y(t,a){let u=(0,s.resolveProjectPath)(t),l=(0,i.getClaudeProjectsPath)(),m=(0,n.join)(u,`${a}.jsonl`),p=await (0,e.readFile)(m,"utf-8"),{entries:f,rawLines:y,subagentIds:d}=await c(p,"session");if(0===d.length)return{entries:f,rawLines:y,subagentIds:[]};let g=await (0,o.batchAll)(d.map(n=>async()=>{let i=`agent-${n}`,s=await r(l,t,a,n);if(!s)return null;let o=await (0,e.readFile)(s,"utf-8"),{entries:u,rawLines:m}=await c(o,i);return{entries:u,rawLines:m}}),4),h=[...f],w=[...y];for(let t of g)"fulfilled"===t.status&&t.value&&(h.push(...t.value.entries),w.push(...t.value.rawLines));return h.length>500&&await new Promise(t=>setImmediate(t)),h.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:h,rawLines:w,subagentIds:d}}t.s(["formatDuration",0,l],67405),(0,a.runtimeCache)((t,e)=>y(t,e),60,{maxSize:50}),t.s(["baseEntry",0,p,"formatTimestamp",0,m,"parseLogContent",0,f,"parseRawLines",0,function(t,e){return t.split("\n").filter(t=>""!==t.trim()).flatMap(t=>{try{let n=JSON.parse(t);return void 0!==e&&(n._source=e),[n]}catch{return[]}})}],54214)},57232,t=>{"use strict";var e=t.i(2157),n=t.i(12714),i=t.i(50227),s=t.i(60526),r=t.i(83534),a=t.i(54214),o=t.i(67405);let u=(0,i.join)((0,s.homedir)(),".failproofai","cache","codex-session-paths.json");function l(){try{if(!(0,e.existsSync)(u))return{};return JSON.parse((0,e.readFileSync)(u,"utf-8"))}catch{return{}}}function m(t,n){try{(0,e.mkdirSync)((0,i.dirname)(u),{recursive:!0});let s=l();s[t]=n,(0,e.writeFileSync)(u,JSON.stringify(s),"utf-8")}catch{}}function p(t,n){try{for(let s of(0,e.readdirSync)(t,{withFileTypes:!0}))if(s.isFile()&&s.name.includes(n)&&s.name.endsWith(".jsonl"))return(0,i.join)(t,s.name)}catch{}return null}function c(t){let n=l()[t];if(n&&(0,e.existsSync)(n))return n;let r=(0,i.join)((0,s.homedir)(),".codex","sessions"),a=new Date,o=new Date(a.getTime()-864e5);for(let e of[a,o].map(t=>{let e=String(t.getUTCFullYear()),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return(0,i.join)(r,e,n,s)})){let n=p(e,t);if(n)return m(t,n),n}try{for(let n of(0,e.readdirSync)(r,{withFileTypes:!0}))if(n.isDirectory()){for(let s of(0,e.readdirSync)((0,i.join)(r,n.name),{withFileTypes:!0}))if(s.isDirectory())for(let a of(0,e.readdirSync)((0,i.join)(r,n.name,s.name),{withFileTypes:!0})){if(!a.isDirectory())continue;let e=p((0,i.join)(r,n.name,s.name,a.name),t);if(e)return m(t,e),e}}}catch{}return null}function f(t,e){return Array.isArray(t)?t.filter(t=>t?.type===e&&"string"==typeof t.text).map(t=>t.text).join("\n"):""}async function y(t,e="session"){let n,i=t.split("\n").filter(t=>""!==t.trim()),s=[],r=[],u=new Map,l=new Map,m=!1;for(let t=0;t<i.length;t++){let p;t>0&&t%200==0&&await new Promise(t=>setImmediate(t));let c=i[t];try{p=JSON.parse(c)}catch{continue}let y={...p,_source:e};r.push(y);let d=p.timestamp;if(!d)continue;let g=new Date(d);if(Number.isNaN(g.getTime()))continue;let h=p.type,w=p.payload??{};if("session_meta"===h){let t=w.cwd;"string"!=typeof t||n||(n=t),s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("response_item"===h){let t=w.type;if("message"===t){let t=w.role,n=w.content;if("user"===t||"developer"===t){let i=f(n,"input_text");if(!i)continue;let r="developer"===t?`[developer] ${i}`:i;s.push({type:"user",...(0,a.baseEntry)(y,d,g,e),message:{role:"user",content:r}});continue}if("assistant"===t){let t=f(n,"output_text");if(!t)continue;let i=[{type:"text",text:t}];s.push({type:"assistant",...(0,a.baseEntry)(y,d,g,e),message:{role:"assistant",content:i}});continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("function_call"===t){let t=w.call_id,n=w.name??"function_call",i={type:"tool_use",id:t??`${d}-${n}`,name:n,input:function(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}(w.arguments)},r={type:"assistant",...(0,a.baseEntry)(y,d,g,e),message:{role:"assistant",content:[i]}};s.push(r),t&&(u.set(t,i),l.set(t,g.getTime()));continue}if("function_call_output"===t){let t=w.call_id,n=t?u.get(t):void 0;if(n){let e=l.get(t)??g.getTime(),i=Math.max(0,g.getTime()-e);n.result={timestamp:d,timestampFormatted:(0,a.formatTimestamp)(g),content:"string"==typeof w.output?w.output:JSON.stringify(w.output),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("event_msg"===h){let t=w.type;if("task_started"===t){let t=m?"Session Resumed":"Session Started";m=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(y,d,g,e),label:t});continue}if("exec_command_end"===t){let t=w.call_id,n=t?u.get(t):void 0;if(n){let e=w.duration,i=e?(e.secs??0)*1e3+Math.round((e.nanos??0)/1e6):Math.max(0,g.getTime()-(l.get(t)??g.getTime())),s=w.aggregated_output;n.result={timestamp:d,timestampFormatted:(0,a.formatTimestamp)(g),content:"string"==typeof s?s:JSON.stringify(s),durationMs:i,durationFormatted:(0,o.formatDuration)(i)};continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}if("user_message"===t||"agent_message"===t)continue;s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y});continue}s.push({type:"system",...(0,a.baseEntry)(y,d,g,e),raw:y})}return s.length>500&&await new Promise(t=>setImmediate(t)),s.sort((t,e)=>t.timestampMs-e.timestampMs),{entries:s,rawLines:r,cwd:n}}async function d(t){let e=c(t);if(!e)return null;let i=await (0,n.readFile)(e,"utf-8"),{entries:s,rawLines:r,cwd:a}=await y(i,"session");return{entries:s,rawLines:r,cwd:a,filePath:e}}(0,r.runtimeCache)(t=>d(t),60,{maxSize:50}),t.s(["findCodexTranscript",0,c,"getCodexSessionLog",0,d])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__17g9wh7._.js.map