agmon 0.2.0 → 0.2.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 (294) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/fallback-build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +8 -8
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +15 -13
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +15 -13
  15. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +8 -6
  16. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  17. package/.next/server/app/api/media/route.js.nft.json +1 -1
  18. package/.next/server/app/api/reports/tokens/route.js.nft.json +1 -1
  19. package/.next/server/app/api/sessions/[id]/transcript/route.js +1 -1
  20. package/.next/server/app/api/sessions/[id]/transcript/route.js.nft.json +1 -1
  21. package/.next/server/app/api/traces/stream/route.js +1 -1
  22. package/.next/server/app/api/traces/stream/route.js.nft.json +1 -1
  23. package/.next/server/app/api/version/route.js.nft.json +1 -1
  24. package/.next/server/app/api/workspace/file-content/route.js.nft.json +1 -1
  25. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  26. package/.next/server/app/chat/page.js.nft.json +1 -1
  27. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/chat.html +1 -1
  29. package/.next/server/app/chat.rsc +20 -19
  30. package/.next/server/app/chat.segments/_full.segment.rsc +20 -19
  31. package/.next/server/app/chat.segments/_tree.segment.rsc +2 -2
  32. package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +22 -20
  33. package/.next/server/app/index.html +1 -1
  34. package/.next/server/app/index.rsc +20 -18
  35. package/.next/server/app/index.segments/__PAGE__.segment.rsc +10 -9
  36. package/.next/server/app/index.segments/_full.segment.rsc +20 -18
  37. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  38. package/.next/server/app/page.js.nft.json +1 -1
  39. package/.next/server/app/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/reports/page.js.nft.json +1 -1
  41. package/.next/server/app/reports/page_client-reference-manifest.js +1 -1
  42. package/.next/server/app/reports.html +1 -1
  43. package/.next/server/app/reports.rsc +4 -4
  44. package/.next/server/app/reports.segments/_full.segment.rsc +4 -4
  45. package/.next/server/app/reports.segments/_tree.segment.rsc +2 -2
  46. package/.next/server/app/reports.segments/reports/__PAGE__.segment.rsc +6 -5
  47. package/.next/server/app/store/page.js.nft.json +1 -1
  48. package/.next/server/app/store/page_client-reference-manifest.js +1 -1
  49. package/.next/server/app/store.html +1 -1
  50. package/.next/server/app/store.rsc +5 -5
  51. package/.next/server/app/store.segments/_full.segment.rsc +5 -5
  52. package/.next/server/app/store.segments/_tree.segment.rsc +2 -2
  53. package/.next/server/app/store.segments/store/__PAGE__.segment.rsc +7 -6
  54. package/.next/server/chunks/[root-of-the-server]__0dw97_pahi8uf._.js +3 -0
  55. package/.next/server/chunks/[root-of-the-server]__0dw97_pahi8uf._.js.map +1 -0
  56. package/.next/server/chunks/_0ao-_t4jkb46h._.js +2 -2
  57. package/.next/server/chunks/_0ao-_t4jkb46h._.js.map +1 -1
  58. package/.next/server/chunks/_1-8ipqazoyrrk._.js +1 -1
  59. package/.next/server/chunks/_1-8ipqazoyrrk._.js.map +1 -1
  60. package/.next/server/chunks/ssr/[root-of-the-server]__0i2rbwbkxbdog._.js +3 -0
  61. package/.next/server/chunks/ssr/[root-of-the-server]__0i2rbwbkxbdog._.js.map +1 -0
  62. package/.next/server/chunks/ssr/[root-of-the-server]__0qzscpxebh28_._.js +3 -0
  63. package/.next/server/chunks/ssr/[root-of-the-server]__0qzscpxebh28_._.js.map +1 -0
  64. package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js +427 -0
  65. package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js.map +1 -0
  66. package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js +1 -1
  67. package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js.map +1 -1
  68. package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js +427 -0
  69. package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js.map +1 -0
  70. package/.next/server/chunks/ssr/_0e3frtjrk-wi9._.js +3 -0
  71. package/.next/server/chunks/ssr/_0e3frtjrk-wi9._.js.map +1 -0
  72. package/.next/server/chunks/ssr/_0h29jdf4relbq._.js +3 -0
  73. package/.next/server/chunks/ssr/_0h29jdf4relbq._.js.map +1 -0
  74. package/.next/server/chunks/ssr/_0zel-n0h--cnl._.js +3 -0
  75. package/.next/server/chunks/ssr/_0zel-n0h--cnl._.js.map +1 -0
  76. package/.next/server/chunks/ssr/_1487-zi23c5eb._.js +1 -1
  77. package/.next/server/chunks/ssr/_1487-zi23c5eb._.js.map +1 -1
  78. package/.next/server/chunks/ssr/_1vgwoe-shb9z7._.js +3 -0
  79. package/.next/server/chunks/ssr/_1vgwoe-shb9z7._.js.map +1 -0
  80. package/.next/server/chunks/ssr/_1zm4m-s8k7oe3._.js +3 -0
  81. package/.next/server/chunks/ssr/_1zm4m-s8k7oe3._.js.map +1 -0
  82. package/.next/server/chunks/ssr/_202tntue-jj6s._.js +3 -0
  83. package/.next/server/chunks/ssr/_202tntue-jj6s._.js.map +1 -0
  84. package/.next/server/chunks/ssr/{node_modules_1wlwrgnt65zus._.js → node_modules_00ebs67b4u61w._.js} +1 -1
  85. package/.next/server/chunks/ssr/{node_modules_0f773uqgzj7y7._.js → node_modules_01avo0bde3tpo._.js} +1 -1
  86. package/.next/server/chunks/ssr/{node_modules_0z3elum1675ve._.js → node_modules_01l0208e5kqic._.js} +1 -1
  87. package/.next/server/chunks/ssr/{node_modules_1c8i3jrmo4393._.js → node_modules_033x29yqle_sj._.js} +1 -1
  88. package/.next/server/chunks/ssr/{node_modules_1kr1c-ncf8q9t._.js → node_modules_03wbg__aslvui._.js} +1 -1
  89. package/.next/server/chunks/ssr/{node_modules_02jwra-d9iqim._.js → node_modules_06mgkab1v5iox._.js} +2 -2
  90. package/.next/server/chunks/ssr/{node_modules_0z7rdbaf13024._.js → node_modules_08-bqkrz7sh0l._.js} +1 -1
  91. package/.next/server/chunks/ssr/{node_modules_13nsmuhey_ti_._.js → node_modules_089w9jm7s2qa3._.js} +2 -2
  92. package/.next/server/chunks/ssr/{node_modules_0m3ihe65818y_._.js → node_modules_08q6a-f2itxyo._.js} +1 -1
  93. package/.next/server/chunks/ssr/{node_modules_0__m9_odts7_e._.js → node_modules_0cy47-s63xjzh._.js} +2 -2
  94. package/.next/server/chunks/ssr/{node_modules_0b8ndnuql44z1._.js → node_modules_0czh0jcnsm5e6._.js} +2 -2
  95. package/.next/server/chunks/ssr/{node_modules_0fs8mckuwk2tj._.js → node_modules_0e6qoh__e4a69._.js} +1 -1
  96. package/.next/server/chunks/ssr/{node_modules_05w7qhtrzvnk6._.js → node_modules_0fv321j1nslkb._.js} +1 -1
  97. package/.next/server/chunks/ssr/{node_modules_061uaylfjwqk7._.js → node_modules_0g-wb7h-hsdwc._.js} +1 -1
  98. package/.next/server/chunks/ssr/{node_modules_1ll-58c1c-qab._.js → node_modules_0hb0q0epwvp--._.js} +1 -1
  99. package/.next/server/chunks/ssr/{node_modules_0dq0dsblt-q0g._.js → node_modules_0l-y0kqtu_r3o._.js} +1 -1
  100. package/.next/server/chunks/ssr/{node_modules_1zs2nou5uogby._.js → node_modules_0l814qpw677vm._.js} +1 -1
  101. package/.next/server/chunks/ssr/{node_modules_1xyxigbqzb8vs._.js → node_modules_0o63z1gd17rhb._.js} +1 -1
  102. package/.next/server/chunks/ssr/{node_modules_1-sz_-qddwilq._.js → node_modules_0oz_zzlh8exwx._.js} +1 -1
  103. package/.next/server/chunks/ssr/{node_modules_0oukyh0iq21ow._.js → node_modules_0so2agzqd9p8l._.js} +2 -2
  104. package/.next/server/chunks/ssr/{node_modules_12qw2ucebdvol._.js → node_modules_0w2w61b8bh769._.js} +1 -1
  105. package/.next/server/chunks/ssr/{node_modules_1dff7b_kvngr-._.js → node_modules_0wd6szix_zku7._.js} +2 -2
  106. package/.next/server/chunks/ssr/{node_modules_0fd1swhk15cx3._.js → node_modules_0wp7omf0xblv8._.js} +1 -1
  107. package/.next/server/chunks/ssr/{node_modules_0nde84kzuwv2n._.js → node_modules_0yayrqhzfk8wy._.js} +1 -1
  108. package/.next/server/chunks/ssr/{node_modules_0f4xh33v3iltc._.js → node_modules_0zb0i39mnjdf3._.js} +1 -1
  109. package/.next/server/chunks/ssr/{node_modules_1iovyom0-y7o_._.js → node_modules_10c51o2qv6mbi._.js} +1 -1
  110. package/.next/server/chunks/ssr/{node_modules_02nv3yff2pqh8._.js → node_modules_10g1mmrf63d8a._.js} +2 -2
  111. package/.next/server/chunks/ssr/{node_modules_0-6sb1gkbjo93._.js → node_modules_152txg4c7ose3._.js} +2 -2
  112. package/.next/server/chunks/ssr/{node_modules_12qn4bepdou5v._.js → node_modules_185fuy4cv7loa._.js} +2 -2
  113. package/.next/server/chunks/ssr/{node_modules_1-iyhsn_1p9nx._.js → node_modules_19vqq7rvf-_ar._.js} +2 -2
  114. package/.next/server/chunks/ssr/{node_modules_0hqa9oxz17hip._.js → node_modules_1hd7j-tdb8drq._.js} +1 -1
  115. package/.next/server/chunks/ssr/{node_modules_1rlnehdn16ay-._.js → node_modules_1hu83gui7_nj2._.js} +1 -1
  116. package/.next/server/chunks/ssr/{node_modules_07maxxr-t28ql._.js → node_modules_1i3x2csuq_-jt._.js} +1 -1
  117. package/.next/server/chunks/ssr/{node_modules_0kovk4b6czb22._.js → node_modules_1j8hpoiygrs5e._.js} +1 -1
  118. package/.next/server/chunks/ssr/{node_modules_0zc49fdcopqu9._.js → node_modules_1l2g7btuh3e4s._.js} +2 -2
  119. package/.next/server/chunks/ssr/{node_modules_0t4h1rucl35hl._.js → node_modules_1n4kig4mj6n4s._.js} +2 -2
  120. package/.next/server/chunks/ssr/{node_modules_0vn0kjn_84lmn._.js → node_modules_1nz3ckv6tu_66._.js} +1 -1
  121. package/.next/server/chunks/ssr/{node_modules_0-nvg0c4pgfb8._.js → node_modules_1qnypguag6s_l._.js} +1 -1
  122. package/.next/server/chunks/ssr/{node_modules_1v4lexrfhnlhs._.js → node_modules_1r6w-jlme6d10._.js} +1 -1
  123. package/.next/server/chunks/ssr/{node_modules_1f4geuvkvlxj1._.js → node_modules_1s8oxeqa5_i3k._.js} +1 -1
  124. package/.next/server/chunks/ssr/{node_modules_1216007ogd5om._.js → node_modules_1tskcaktx6ods._.js} +1 -1
  125. package/.next/server/chunks/ssr/{node_modules_02vtgweceovke._.js → node_modules_1xz1dstlo5ri-._.js} +1 -1
  126. package/.next/server/chunks/ssr/{node_modules_1kv6lsckqs-m0._.js → node_modules_1zii7uk468cay._.js} +2 -2
  127. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0bmuudv_6eypr._.js → node_modules_katex_dist_katex_mjs_067omoj5szuys._.js} +1 -1
  128. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0qyy6pq9uzpk0._.js → node_modules_katex_dist_katex_mjs_1604s1ky8db8u._.js} +1 -1
  129. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_1d8fezw1qsiob._.js → node_modules_lucide-react_dist_esm_0-5bcc79665lq._.js} +2 -2
  130. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0-5bcc79665lq._.js.map +1 -0
  131. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_0pezg1352q13j._.js → node_modules_lucide-react_dist_esm_0axoa1eg51x1-._.js} +2 -2
  132. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0axoa1eg51x1-._.js.map +1 -0
  133. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_131i-tjzse3ye._.js → node_modules_lucide-react_dist_esm_18ei1-na3kusb._.js} +2 -2
  134. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_18ei1-na3kusb._.js.map +1 -0
  135. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_1to-9cv1ysvs6._.js → node_modules_lucide-react_dist_esm_1tx493x2_auzs._.js} +2 -2
  136. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1tx493x2_auzs._.js.map +1 -0
  137. package/.next/server/chunks/ssr/node_modules_mermaid_dist_mermaid_core_mjs_06it7ktosm1dr._.js +3 -0
  138. package/.next/server/chunks/ssr/node_modules_mermaid_dist_mermaid_core_mjs_06it7ktosm1dr._.js.map +1 -0
  139. package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js +1 -1
  140. package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js.map +1 -1
  141. package/.next/server/chunks/ssr/src_components_reports_TokenReportView_jsx_1g3p_enbbsadt._.js +1 -1
  142. package/.next/server/chunks/ssr/src_components_reports_TokenReportView_jsx_1g3p_enbbsadt._.js.map +1 -1
  143. package/.next/server/middleware-build-manifest.js +3 -3
  144. package/.next/server/pages/404.html +1 -1
  145. package/.next/server/pages/500.html +1 -1
  146. package/.next/server/preview-props.json +3 -3
  147. package/.next/server/server-reference-manifest.js +1 -1
  148. package/.next/server/server-reference-manifest.json +1 -1
  149. package/.next/static/chunks/0jo6fy2c_gmqn.js +1 -0
  150. package/.next/static/chunks/0r9apkv3exqv-.js +1 -0
  151. package/.next/static/chunks/1n_lb7wmn81jj.js +1 -0
  152. package/.next/static/chunks/2-w116ewoshm1.js +1 -0
  153. package/.next/static/chunks/23uup1e8841av.js +1 -0
  154. package/.next/static/chunks/2q9cwykv6ox1t.css +1 -0
  155. package/.next/static/chunks/2rx7xvi55ohln.js +1 -0
  156. package/.next/static/chunks/2zf44j8sjo0w0.js +425 -0
  157. package/.next/static/chunks/3rtpnpqd981z9.js +1 -0
  158. package/.next/trace +1 -1
  159. package/.next/trace-build +1 -1
  160. package/bin/cli.js +12 -0
  161. package/package.json +1 -1
  162. package/src/app/api/traces/stream/route.js +41 -5
  163. package/src/app/chat/page.js +14 -14
  164. package/src/app/globals.css +128 -0
  165. package/src/app/layout.js +8 -2
  166. package/src/app/page.js +18 -2
  167. package/src/components/chat/ChatMessageItem.js +12 -12
  168. package/src/components/chat/CodeBlock.js +5 -5
  169. package/src/components/chat/DiffViewer.js +27 -27
  170. package/src/components/chat/MarkdownRenderer.js +19 -19
  171. package/src/components/chat/SessionChatView.js +42 -42
  172. package/src/components/chat/SessionSearch.js +8 -8
  173. package/src/components/chat/ThinkingAccordion.js +3 -3
  174. package/src/components/chat/ToolCallCard.js +6 -6
  175. package/src/components/chat/ToolOutputView.js +19 -19
  176. package/src/components/factory/office-canvas.js +165 -3
  177. package/src/components/factory/scene/characters.js +267 -32
  178. package/src/components/layout/BottomPanel.jsx +6 -6
  179. package/src/components/layout/CommandPalette.jsx +12 -0
  180. package/src/components/layout/EditorTabs.jsx +17 -0
  181. package/src/components/layout/LayoutToggles.jsx +31 -2
  182. package/src/components/layout/LeftSidebar.jsx +88 -6
  183. package/src/components/layout/RightSidebar.jsx +8 -8
  184. package/src/components/layout/StatusBar.jsx +1 -1
  185. package/src/components/layout/TitleBar.jsx +76 -2
  186. package/src/components/layout/VSCodeWorkbench.jsx +99 -14
  187. package/src/components/store/Item3DRenderer.jsx +602 -48
  188. package/src/components/store/LiveFittingRoom.jsx +55 -791
  189. package/src/components/store/LiveReactAgent.jsx +1637 -0
  190. package/src/components/store/SupporterStoreModal.jsx +3 -2
  191. package/src/components/store/SupporterStoreView.jsx +94 -34
  192. package/src/components/theme/ThemeSettingsModal.jsx +40 -40
  193. package/src/components/ui/Button.jsx +4 -4
  194. package/src/components/ui/Input.jsx +1 -1
  195. package/src/components/ui/Modal.jsx +6 -6
  196. package/src/components/ui/Select.jsx +3 -3
  197. package/src/lib/catalog/auras.js +226 -1199
  198. package/src/lib/catalog/index.js +60 -1
  199. package/src/lib/catalog/pets.js +291 -2398
  200. package/src/lib/catalog/props.js +488 -4199
  201. package/src/lib/catalog/skins.js +773 -3249
  202. package/src/lib/catalog/trophies.js +226 -1199
  203. package/src/lib/mockTraces.js +28 -26
  204. package/src/lib/parsers/codexParser.js +373 -0
  205. package/src/lib/parsers/transcriptParser.js +35 -3
  206. package/src/lib/supporterStore.js +1 -1
  207. package/src/lib/traceContract.js +1 -1
  208. package/src/lib/useFactoryTraces.js +70 -5
  209. package/src/lib/watchers/antigravityWatcher.js +15 -1
  210. package/src/lib/watchers/claudeWatcher.js +86 -70
  211. package/src/lib/watchers/codexWatcher.js +482 -0
  212. package/src/lib/watchers/watcherManager.js +46 -30
  213. package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js +0 -3
  214. package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js.map +0 -1
  215. package/.next/server/chunks/ssr/[root-of-the-server]__19s2v5rryc14o._.js +0 -3
  216. package/.next/server/chunks/ssr/[root-of-the-server]__19s2v5rryc14o._.js.map +0 -1
  217. package/.next/server/chunks/ssr/[root-of-the-server]__1_jerxrctq6ev._.js +0 -427
  218. package/.next/server/chunks/ssr/[root-of-the-server]__1_jerxrctq6ev._.js.map +0 -1
  219. package/.next/server/chunks/ssr/[root-of-the-server]__1pvso-uyf--97._.js +0 -427
  220. package/.next/server/chunks/ssr/[root-of-the-server]__1pvso-uyf--97._.js.map +0 -1
  221. package/.next/server/chunks/ssr/[root-of-the-server]__1y78dc7oiz7ks._.js +0 -3
  222. package/.next/server/chunks/ssr/[root-of-the-server]__1y78dc7oiz7ks._.js.map +0 -1
  223. package/.next/server/chunks/ssr/_0ozao7omdwbvd._.js +0 -3
  224. package/.next/server/chunks/ssr/_0ozao7omdwbvd._.js.map +0 -1
  225. package/.next/server/chunks/ssr/_0rcmpdyxc1qwj._.js +0 -3
  226. package/.next/server/chunks/ssr/_0rcmpdyxc1qwj._.js.map +0 -1
  227. package/.next/server/chunks/ssr/_0wv0xnhun3mk7._.js +0 -3
  228. package/.next/server/chunks/ssr/_0wv0xnhun3mk7._.js.map +0 -1
  229. package/.next/server/chunks/ssr/_17rmaft1zusua._.js +0 -3
  230. package/.next/server/chunks/ssr/_17rmaft1zusua._.js.map +0 -1
  231. package/.next/server/chunks/ssr/_1e-d4pcj59a7a._.js +0 -3
  232. package/.next/server/chunks/ssr/_1e-d4pcj59a7a._.js.map +0 -1
  233. package/.next/server/chunks/ssr/_1qr5gnh64z8pg._.js +0 -3
  234. package/.next/server/chunks/ssr/_1qr5gnh64z8pg._.js.map +0 -1
  235. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0pezg1352q13j._.js.map +0 -1
  236. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_131i-tjzse3ye._.js.map +0 -1
  237. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1d8fezw1qsiob._.js.map +0 -1
  238. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1to-9cv1ysvs6._.js.map +0 -1
  239. package/.next/static/chunks/0_3s_e4gd9xl0.js +0 -1
  240. package/.next/static/chunks/0i4kx4yl-dwfg.js +0 -425
  241. package/.next/static/chunks/0z0jbobmmvqoc.js +0 -1
  242. package/.next/static/chunks/1_a_gmob5qzho.js +0 -1
  243. package/.next/static/chunks/1ifqr4qo4697b.js +0 -1
  244. package/.next/static/chunks/2ccq9i8ev4dsx.js +0 -1
  245. package/.next/static/chunks/2mif7onk_9jy-.css +0 -1
  246. package/.next/static/chunks/40wyf-mv0tiu3.js +0 -1
  247. /package/.next/server/chunks/ssr/{node_modules_1c8i3jrmo4393._.js.map → node_modules_00ebs67b4u61w._.js.map} +0 -0
  248. /package/.next/server/chunks/ssr/{node_modules_0f773uqgzj7y7._.js.map → node_modules_01avo0bde3tpo._.js.map} +0 -0
  249. /package/.next/server/chunks/ssr/{node_modules_0z3elum1675ve._.js.map → node_modules_01l0208e5kqic._.js.map} +0 -0
  250. /package/.next/server/chunks/ssr/{node_modules_1wlwrgnt65zus._.js.map → node_modules_033x29yqle_sj._.js.map} +0 -0
  251. /package/.next/server/chunks/ssr/{node_modules_1kr1c-ncf8q9t._.js.map → node_modules_03wbg__aslvui._.js.map} +0 -0
  252. /package/.next/server/chunks/ssr/{node_modules_02jwra-d9iqim._.js.map → node_modules_06mgkab1v5iox._.js.map} +0 -0
  253. /package/.next/server/chunks/ssr/{node_modules_0fs8mckuwk2tj._.js.map → node_modules_08-bqkrz7sh0l._.js.map} +0 -0
  254. /package/.next/server/chunks/ssr/{node_modules_0-6sb1gkbjo93._.js.map → node_modules_089w9jm7s2qa3._.js.map} +0 -0
  255. /package/.next/server/chunks/ssr/{node_modules_02vtgweceovke._.js.map → node_modules_08q6a-f2itxyo._.js.map} +0 -0
  256. /package/.next/server/chunks/ssr/{node_modules_0__m9_odts7_e._.js.map → node_modules_0cy47-s63xjzh._.js.map} +0 -0
  257. /package/.next/server/chunks/ssr/{node_modules_02nv3yff2pqh8._.js.map → node_modules_0czh0jcnsm5e6._.js.map} +0 -0
  258. /package/.next/server/chunks/ssr/{node_modules_0z7rdbaf13024._.js.map → node_modules_0e6qoh__e4a69._.js.map} +0 -0
  259. /package/.next/server/chunks/ssr/{node_modules_0-nvg0c4pgfb8._.js.map → node_modules_0fv321j1nslkb._.js.map} +0 -0
  260. /package/.next/server/chunks/ssr/{node_modules_061uaylfjwqk7._.js.map → node_modules_0g-wb7h-hsdwc._.js.map} +0 -0
  261. /package/.next/server/chunks/ssr/{node_modules_0t4h1rucl35hl._.js.map → node_modules_0hb0q0epwvp--._.js.map} +0 -0
  262. /package/.next/server/chunks/ssr/{node_modules_0dq0dsblt-q0g._.js.map → node_modules_0l-y0kqtu_r3o._.js.map} +0 -0
  263. /package/.next/server/chunks/ssr/{node_modules_0zc49fdcopqu9._.js.map → node_modules_0l814qpw677vm._.js.map} +0 -0
  264. /package/.next/server/chunks/ssr/{node_modules_1xyxigbqzb8vs._.js.map → node_modules_0o63z1gd17rhb._.js.map} +0 -0
  265. /package/.next/server/chunks/ssr/{node_modules_1-iyhsn_1p9nx._.js.map → node_modules_0oz_zzlh8exwx._.js.map} +0 -0
  266. /package/.next/server/chunks/ssr/{node_modules_0oukyh0iq21ow._.js.map → node_modules_0so2agzqd9p8l._.js.map} +0 -0
  267. /package/.next/server/chunks/ssr/{node_modules_07maxxr-t28ql._.js.map → node_modules_0w2w61b8bh769._.js.map} +0 -0
  268. /package/.next/server/chunks/ssr/{node_modules_1dff7b_kvngr-._.js.map → node_modules_0wd6szix_zku7._.js.map} +0 -0
  269. /package/.next/server/chunks/ssr/{node_modules_0fd1swhk15cx3._.js.map → node_modules_0wp7omf0xblv8._.js.map} +0 -0
  270. /package/.next/server/chunks/ssr/{node_modules_0nde84kzuwv2n._.js.map → node_modules_0yayrqhzfk8wy._.js.map} +0 -0
  271. /package/.next/server/chunks/ssr/{node_modules_0f4xh33v3iltc._.js.map → node_modules_0zb0i39mnjdf3._.js.map} +0 -0
  272. /package/.next/server/chunks/ssr/{node_modules_1-sz_-qddwilq._.js.map → node_modules_10c51o2qv6mbi._.js.map} +0 -0
  273. /package/.next/server/chunks/ssr/{node_modules_0b8ndnuql44z1._.js.map → node_modules_10g1mmrf63d8a._.js.map} +0 -0
  274. /package/.next/server/chunks/ssr/{node_modules_13nsmuhey_ti_._.js.map → node_modules_152txg4c7ose3._.js.map} +0 -0
  275. /package/.next/server/chunks/ssr/{node_modules_12qn4bepdou5v._.js.map → node_modules_185fuy4cv7loa._.js.map} +0 -0
  276. /package/.next/server/chunks/ssr/{node_modules_1iovyom0-y7o_._.js.map → node_modules_19vqq7rvf-_ar._.js.map} +0 -0
  277. /package/.next/server/chunks/ssr/{node_modules_0hqa9oxz17hip._.js.map → node_modules_1hd7j-tdb8drq._.js.map} +0 -0
  278. /package/.next/server/chunks/ssr/{node_modules_1rlnehdn16ay-._.js.map → node_modules_1hu83gui7_nj2._.js.map} +0 -0
  279. /package/.next/server/chunks/ssr/{node_modules_12qw2ucebdvol._.js.map → node_modules_1i3x2csuq_-jt._.js.map} +0 -0
  280. /package/.next/server/chunks/ssr/{node_modules_0kovk4b6czb22._.js.map → node_modules_1j8hpoiygrs5e._.js.map} +0 -0
  281. /package/.next/server/chunks/ssr/{node_modules_1ll-58c1c-qab._.js.map → node_modules_1l2g7btuh3e4s._.js.map} +0 -0
  282. /package/.next/server/chunks/ssr/{node_modules_1zs2nou5uogby._.js.map → node_modules_1n4kig4mj6n4s._.js.map} +0 -0
  283. /package/.next/server/chunks/ssr/{node_modules_0vn0kjn_84lmn._.js.map → node_modules_1nz3ckv6tu_66._.js.map} +0 -0
  284. /package/.next/server/chunks/ssr/{node_modules_05w7qhtrzvnk6._.js.map → node_modules_1qnypguag6s_l._.js.map} +0 -0
  285. /package/.next/server/chunks/ssr/{node_modules_1v4lexrfhnlhs._.js.map → node_modules_1r6w-jlme6d10._.js.map} +0 -0
  286. /package/.next/server/chunks/ssr/{node_modules_1f4geuvkvlxj1._.js.map → node_modules_1s8oxeqa5_i3k._.js.map} +0 -0
  287. /package/.next/server/chunks/ssr/{node_modules_1216007ogd5om._.js.map → node_modules_1tskcaktx6ods._.js.map} +0 -0
  288. /package/.next/server/chunks/ssr/{node_modules_0m3ihe65818y_._.js.map → node_modules_1xz1dstlo5ri-._.js.map} +0 -0
  289. /package/.next/server/chunks/ssr/{node_modules_1kv6lsckqs-m0._.js.map → node_modules_1zii7uk468cay._.js.map} +0 -0
  290. /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0bmuudv_6eypr._.js.map → node_modules_katex_dist_katex_mjs_067omoj5szuys._.js.map} +0 -0
  291. /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0qyy6pq9uzpk0._.js.map → node_modules_katex_dist_katex_mjs_1604s1ky8db8u._.js.map} +0 -0
  292. /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → dGN2VKPk5TJgezxS3JvRc}/_buildManifest.js +0 -0
  293. /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → dGN2VKPk5TJgezxS3JvRc}/_clientMiddlewareManifest.js +0 -0
  294. /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → dGN2VKPk5TJgezxS3JvRc}/_ssgManifest.js +0 -0
@@ -0,0 +1,482 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import os from "node:os";
4
+ import { exec } from "node:child_process";
5
+ import { promisify } from "node:util";
6
+ import { normalizeTrace } from "../traceContract.js";
7
+
8
+ const execAsync = promisify(exec);
9
+
10
+ /**
11
+ * Codex (OpenAI) stores one rollout file per session under
12
+ * ~/.codex/sessions/<YYYY>/<MM>/<DD>/rollout-<timestamp>-<uuid>.jsonl
13
+ *
14
+ * Rollout entries are `{ type, timestamp, payload }` where `type` is one of
15
+ * `session_meta`, `turn_context`, `response_item`, `event_msg`, `world_state`.
16
+ */
17
+
18
+ function compactText(value, maxLength = 160) {
19
+ const text = String(value || "").replace(/\s+/g, " ").trim();
20
+ return text ? text.slice(0, maxLength) : null;
21
+ }
22
+
23
+ function textFromContent(content) {
24
+ if (typeof content === "string") return compactText(content);
25
+ if (!Array.isArray(content)) return null;
26
+ const joined = content
27
+ .map((block) => (typeof block?.text === "string" ? block.text : ""))
28
+ .filter(Boolean)
29
+ .join(" ");
30
+ return compactText(joined);
31
+ }
32
+
33
+ /**
34
+ * Normalizes tool name and command/args from OpenAI Codex into a standard tool type.
35
+ */
36
+ export function normalizeCodexTool(name, args = {}) {
37
+ const n = String(name || "").toLowerCase();
38
+ const cmd = String(args.cmd || args.command || "").trim();
39
+ const cmdLower = cmd.toLowerCase();
40
+
41
+ if (n === "exec_command" || n === "local_shell_call" || n === "bash" || n === "shell") {
42
+ if (cmdLower.startsWith("docker") || cmdLower.includes("docker exec")) {
43
+ return { type: "docker", detail: cmd.length > 50 ? `${cmd.slice(0, 47)}...` : cmd };
44
+ }
45
+ if (cmdLower.startsWith("git ") || cmdLower.startsWith("gh ")) {
46
+ return { type: "git", detail: cmd.length > 50 ? `${cmd.slice(0, 47)}...` : cmd };
47
+ }
48
+ if (cmdLower.includes("gitnexus")) {
49
+ return { type: "gitnexus", detail: cmd.length > 50 ? `${cmd.slice(0, 47)}...` : cmd };
50
+ }
51
+ if (cmdLower.startsWith("rg ") || cmdLower.startsWith("grep ")) {
52
+ return { type: "search", detail: cmd.length > 50 ? `${cmd.slice(0, 47)}...` : cmd };
53
+ }
54
+ if (/^(cat|sed|head|tail|ls|find)\b/.test(cmdLower)) {
55
+ return { type: "read", detail: cmd.length > 50 ? `${cmd.slice(0, 47)}...` : cmd };
56
+ }
57
+ return { type: "bash", detail: cmd.length > 50 ? `${cmd.slice(0, 47)}...` : cmd };
58
+ }
59
+
60
+ if (n === "apply_patch" || n === "patch" || n.includes("write") || n.includes("edit") || n.includes("replace")) {
61
+ const file = args.file_path || args.path || args.TargetFile || "";
62
+ return { type: "edit", detail: file ? `Edit: ${path.basename(file)}` : "Edit file" };
63
+ }
64
+
65
+ if (n.includes("read") || n.includes("view") || n.includes("glob")) {
66
+ const file = args.file_path || args.path || args.AbsolutePath || "";
67
+ return { type: "read", detail: file ? `Read: ${path.basename(file)}` : "Read file" };
68
+ }
69
+
70
+ if (n.includes("search") || n.includes("grep") || n.includes("find")) {
71
+ return { type: "search", detail: args.pattern || args.query || "Search" };
72
+ }
73
+
74
+ if (n.includes("spawn_agent") || n.includes("followup_task") || n.includes("agent")) {
75
+ return { type: "agent", detail: "Subagent Task" };
76
+ }
77
+
78
+ if (n.includes("browser") || n.includes("playwright")) {
79
+ return { type: "browser", detail: "Browser automation" };
80
+ }
81
+
82
+ if (n.includes("web") || n.includes("fetch")) {
83
+ return { type: "web", detail: "Web fetch" };
84
+ }
85
+
86
+ return { type: "mcp", detail: n };
87
+ }
88
+
89
+ /**
90
+ * Classifies Codex surface into:
91
+ * - Desktop App: `clientType: "desktop", label: "Codex Desktop"`
92
+ * - CLI: `clientType: "cli", label: "Codex CLI"`
93
+ * - VS Code Extension: `clientType: "extension", label: "Codex Extension"`
94
+ *
95
+ * @returns {{ clientType: string, label: string }}
96
+ */
97
+ export function classifyCodexSession(originator, source) {
98
+ const org = String(originator || "").toLowerCase();
99
+ const src = String(source || "").toLowerCase();
100
+
101
+ if (
102
+ org.includes("desktop") ||
103
+ org === "codex_app" ||
104
+ org === "codex-app" ||
105
+ org === "codex_app_server" ||
106
+ src === "desktop" ||
107
+ src === "app"
108
+ ) {
109
+ return { clientType: "desktop", label: "Codex Desktop" };
110
+ }
111
+
112
+ if (org.includes("vscode") || src === "vscode") {
113
+ return { clientType: "extension", label: "Codex Extension" };
114
+ }
115
+
116
+ return { clientType: "cli", label: "Codex CLI" };
117
+ }
118
+
119
+ function extractWorkspace(cwd) {
120
+ return cwd ? path.basename(cwd) : null;
121
+ }
122
+
123
+ /** Scans ~/.codex/sessions/<YYYY>/<MM>/<DD> directories for .jsonl rollout files within maxAgeMs */
124
+ async function scanCodexRolloutFiles(sessionsRoot, maxAgeMs, now) {
125
+ const files = [];
126
+ let years;
127
+ try {
128
+ years = await fs.readdir(sessionsRoot, { withFileTypes: true });
129
+ } catch {
130
+ return files;
131
+ }
132
+
133
+ const yearDirs = years.filter((d) => d.isDirectory()).map((d) => d.name).sort().reverse();
134
+ for (const year of yearDirs) {
135
+ const yearPath = path.join(sessionsRoot, year);
136
+ let months;
137
+ try {
138
+ months = await fs.readdir(yearPath, { withFileTypes: true });
139
+ } catch {
140
+ continue;
141
+ }
142
+ const monthDirs = months.filter((d) => d.isDirectory()).map((d) => d.name).sort().reverse();
143
+
144
+ for (const month of monthDirs) {
145
+ const monthPath = path.join(yearPath, month);
146
+ let days;
147
+ try {
148
+ days = await fs.readdir(monthPath, { withFileTypes: true });
149
+ } catch {
150
+ continue;
151
+ }
152
+ const dayDirs = days.filter((d) => d.isDirectory()).map((d) => d.name).sort().reverse();
153
+
154
+ for (const day of dayDirs) {
155
+ if (Number.isFinite(maxAgeMs)) {
156
+ const dayDate = new Date(`${year}-${month}-${day}T23:59:59Z`).getTime();
157
+ if (now - dayDate > maxAgeMs) continue;
158
+ }
159
+
160
+ const dayPath = path.join(monthPath, day);
161
+ let entries;
162
+ try {
163
+ entries = await fs.readdir(dayPath);
164
+ } catch {
165
+ continue;
166
+ }
167
+
168
+ for (const name of entries) {
169
+ if (name.endsWith(".jsonl")) files.push(path.join(dayPath, name));
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ return files;
176
+ }
177
+
178
+ async function getRunningCodexProcesses() {
179
+ try {
180
+ const { stdout } = await execAsync("pgrep -l -i codex");
181
+ const lines = stdout.trim().split("\n").filter(Boolean);
182
+ return lines.map((line) => {
183
+ const [pidStr, ...rest] = line.trim().split(/\s+/);
184
+ return { pid: Number(pidStr), name: rest.join(" ").toLowerCase() };
185
+ });
186
+ } catch {
187
+ return [];
188
+ }
189
+ }
190
+
191
+ export async function parseCodexRollout(filePath) {
192
+ const raw = await fs.readFile(filePath, "utf-8");
193
+
194
+ const result = {
195
+ meta: null,
196
+ model: null,
197
+ cwd: null,
198
+ sessionTitle: null,
199
+ lastText: null,
200
+ lastTextRole: null,
201
+ toolSet: new Set(),
202
+ toolInvocations: [],
203
+ recentLogs: [],
204
+ activeTool: null,
205
+ currentCommand: null,
206
+ tokens: null,
207
+ startedAt: null,
208
+ lastTimestamp: null,
209
+ openTurn: false,
210
+ error: null,
211
+ isLooping: false,
212
+ };
213
+
214
+ for (const line of raw.split("\n")) {
215
+ if (!line.trim()) continue;
216
+ let entry;
217
+ try {
218
+ entry = JSON.parse(line);
219
+ } catch {
220
+ continue;
221
+ }
222
+
223
+ const ts = entry.timestamp ? new Date(entry.timestamp).getTime() : null;
224
+ if (ts && (!result.lastTimestamp || ts > result.lastTimestamp)) result.lastTimestamp = ts;
225
+
226
+ const payload = entry.payload || (entry.type === "message" || entry.role ? entry : null);
227
+ if (!payload) continue;
228
+
229
+ const entryType = entry.type || payload.type;
230
+
231
+ if (entryType === "session_meta") {
232
+ result.meta = payload;
233
+ result.cwd = payload.cwd || null;
234
+ result.startedAt = payload.timestamp ? new Date(payload.timestamp).getTime() : null;
235
+ continue;
236
+ }
237
+
238
+ if (entryType === "turn_context") {
239
+ if (payload.model) result.model = payload.model;
240
+ if (payload.cwd && !result.cwd) result.cwd = payload.cwd;
241
+ continue;
242
+ }
243
+
244
+ if (entryType === "response_item" || entryType === "message") {
245
+ const type = payload.type || (payload.role ? "message" : null);
246
+
247
+ if (type === "message") {
248
+ const role = payload.role;
249
+ if (role !== "user" && role !== "assistant") continue;
250
+
251
+ // Filter out synthetic injected instructions
252
+ const kinds = payload.internal_chat_message_metadata_passthrough?.content_item_kinds;
253
+ if (role === "user" && Array.isArray(kinds) && !kinds.includes("user.text")) continue;
254
+
255
+ const text = textFromContent(payload.content);
256
+ if (!text) continue;
257
+
258
+ if (!result.cwd) {
259
+ const mCwd = text.match(/<cwd>(.*?)<\/cwd>/);
260
+ if (mCwd) result.cwd = mCwd[1];
261
+ }
262
+ if (role === "user" && /^(# AGENTS\.md instructions|<INSTRUCTIONS>|<permissions instructions>|<model_switch>)/i.test(text)) continue;
263
+
264
+ if (role === "user") {
265
+ result.sessionTitle ||= compactText(text, 80);
266
+ result.lastText = text;
267
+ result.lastTextRole = "user";
268
+ result.recentLogs.push({
269
+ timestamp: entry.timestamp || new Date().toISOString(),
270
+ type: "prompt",
271
+ summary: "User Prompt",
272
+ detail: compactText(text, 100),
273
+ });
274
+ } else {
275
+ result.lastText = text;
276
+ result.lastTextRole = "assistant";
277
+ }
278
+ continue;
279
+ }
280
+
281
+ if (type === "function_call" || type === "local_shell_call" || type === "custom_tool_call") {
282
+ let args = {};
283
+ if (typeof payload.arguments === "string") {
284
+ try {
285
+ args = JSON.parse(payload.arguments);
286
+ } catch {
287
+ args = {};
288
+ }
289
+ } else if (payload.arguments && typeof payload.arguments === "object") {
290
+ args = payload.arguments;
291
+ }
292
+
293
+ const name = payload.name || payload.tool || "tool";
294
+ const { type: toolType, detail } = normalizeCodexTool(name, args);
295
+
296
+ result.toolSet.add(toolType || name.toLowerCase());
297
+ result.activeTool = toolType;
298
+ result.currentCommand = detail || name;
299
+
300
+ const entryTime = ts || Date.now();
301
+ result.toolInvocations.push({
302
+ name,
303
+ detail: detail || name,
304
+ time: entryTime,
305
+ });
306
+
307
+ result.recentLogs.push({
308
+ timestamp: entry.timestamp || new Date().toISOString(),
309
+ type: toolType || "tool",
310
+ summary: name,
311
+ detail: detail || name,
312
+ });
313
+ continue;
314
+ }
315
+
316
+ if (type === "function_call_output") {
317
+ const outText = typeof payload.output === "string" ? payload.output : JSON.stringify(payload.output || "");
318
+ if (outText.includes("error:") || outText.includes("failed") || outText.includes("Error:")) {
319
+ result.recentLogs.push({
320
+ timestamp: entry.timestamp || new Date().toISOString(),
321
+ type: "error",
322
+ summary: "Tool Error",
323
+ detail: compactText(outText, 100),
324
+ });
325
+ }
326
+ }
327
+ continue;
328
+ }
329
+
330
+ if (entry.type === "event_msg") {
331
+ if (payload.type === "token_count") {
332
+ const usage = payload.info?.total_token_usage;
333
+ if (usage && Number.isFinite(usage.total_tokens)) {
334
+ result.tokens = usage;
335
+ }
336
+ continue;
337
+ }
338
+ if (payload.type === "task_started") {
339
+ result.openTurn = true;
340
+ result.error = null;
341
+ continue;
342
+ }
343
+ if (payload.type === "task_complete") {
344
+ result.openTurn = false;
345
+ if (payload.error?.message) {
346
+ result.error = String(payload.error.message).slice(0, 200);
347
+ result.recentLogs.push({
348
+ timestamp: entry.timestamp || new Date().toISOString(),
349
+ type: "error",
350
+ summary: "Task Complete Error",
351
+ detail: result.error,
352
+ });
353
+ }
354
+ }
355
+ }
356
+ }
357
+
358
+ // Loop detection: 5 consecutive identical tool calls within 60s
359
+ if (result.toolInvocations.length >= 5) {
360
+ const lastN = result.toolInvocations.slice(-10);
361
+ for (let s = 0; s <= lastN.length - 5; s++) {
362
+ const window = lastN.slice(s, s + 5);
363
+ const targetKey = `${window[0].name}:${window[0].detail}`;
364
+ const sameCall = window.every((w) => `${w.name}:${w.detail}` === targetKey);
365
+ const timeSpan = (window[window.length - 1].time || 0) - (window[0].time || 0);
366
+ if (sameCall && (timeSpan <= 60000 || timeSpan === 0)) {
367
+ result.isLooping = true;
368
+ break;
369
+ }
370
+ }
371
+ }
372
+
373
+ // Cap recent logs to max 25 entries for performance
374
+ if (result.recentLogs.length > 25) {
375
+ result.recentLogs = result.recentLogs.slice(-25);
376
+ }
377
+
378
+ return result;
379
+ }
380
+
381
+ export async function getCodexTraces(maxAgeMs = 24 * 60 * 60 * 1000) {
382
+ const now = Date.now();
383
+ const sessionsRoot = path.join(os.homedir(), ".codex", "sessions");
384
+ const traces = [];
385
+
386
+ let yearDirs;
387
+ try {
388
+ yearDirs = await fs.readdir(sessionsRoot, { withFileTypes: true });
389
+ } catch {
390
+ return traces;
391
+ }
392
+
393
+ const candidateFiles = await scanCodexRolloutFiles(sessionsRoot, maxAgeMs, now);
394
+ const runningProcs = await getRunningCodexProcesses();
395
+ const hasRunningCodex = runningProcs.length > 0;
396
+
397
+ // Stat candidate files and sort by mtime descending (most recent first)
398
+ const candidateStats = [];
399
+ for (const filePath of candidateFiles) {
400
+ try {
401
+ const stat = await fs.stat(filePath);
402
+ const ageMs = now - stat.mtimeMs;
403
+ if (ageMs > maxAgeMs) continue;
404
+ candidateStats.push({ filePath, stat, ageMs, mtime: stat.mtimeMs });
405
+ } catch {}
406
+ }
407
+
408
+ candidateStats.sort((a, b) => b.mtime - a.mtime);
409
+ const toProcess = candidateStats.slice(0, 100);
410
+
411
+ for (const { filePath, stat, ageMs } of toProcess) {
412
+ try {
413
+ const parsed = await parseCodexRollout(filePath);
414
+ // Skip files that carry no cwd, model, tokens, or title
415
+ if (!parsed.cwd && !parsed.model && !parsed.tokens && !parsed.sessionTitle) continue;
416
+
417
+ const rawBase = path.basename(filePath, ".jsonl");
418
+ const cleanBase = rawBase.replace(/^rollout-[\d-T]+-/, "");
419
+ const sessionId = parsed.meta?.session_id || parsed.meta?.id || cleanBase;
420
+ const { clientType, label } = classifyCodexSession(parsed.meta?.originator, parsed.meta?.source);
421
+ const workspace = extractWorkspace(parsed.cwd) || label;
422
+
423
+ let state = "done";
424
+ if (parsed.isLooping) {
425
+ state = "streaming";
426
+ } else if (parsed.openTurn) {
427
+ state = "streaming";
428
+ } else if (parsed.error && ageMs > 15 * 60 * 1000) {
429
+ state = "error";
430
+ } else if (hasRunningCodex && ageMs < 15 * 60 * 1000) {
431
+ state = ageMs < 45_000 ? "streaming" : "idle";
432
+ } else if (ageMs < 60_000) {
433
+ state = "idle";
434
+ } else if (parsed.error) {
435
+ state = "error";
436
+ }
437
+
438
+ const usage = parsed.tokens;
439
+ const elapsedMs =
440
+ parsed.startedAt && parsed.lastTimestamp
441
+ ? Math.max(0, parsed.lastTimestamp - parsed.startedAt)
442
+ : null;
443
+
444
+ traces.push(normalizeTrace({
445
+ traceId: `codex-${sessionId.slice(0, 8)}`,
446
+ cli: "codex",
447
+ clientType,
448
+ source: clientType,
449
+ connectionId: `${label} (${sessionId.slice(0, 6)})`,
450
+ account: workspace,
451
+ model: parsed.model || null,
452
+ provider: "openai (codex)",
453
+ state,
454
+ startedAt: parsed.startedAt,
455
+ elapsedMs,
456
+ tokens: usage
457
+ ? {
458
+ input: usage.input_tokens ?? null,
459
+ output: usage.output_tokens ?? null,
460
+ cached: usage.cached_input_tokens ?? null,
461
+ }
462
+ : { input: null, output: null, cached: null },
463
+ cost: null,
464
+ status: parsed.error ? "error" : null,
465
+ tools: Array.from(parsed.toolSet),
466
+ activeTool: parsed.activeTool || (parsed.toolSet.size > 0 ? Array.from(parsed.toolSet)[0] : null),
467
+ currentCommand: parsed.currentCommand || null,
468
+ sessionTitle: parsed.sessionTitle || workspace,
469
+ lastText: parsed.lastText,
470
+ lastTextRole: parsed.lastTextRole,
471
+ error: parsed.error,
472
+ isLooping: parsed.isLooping,
473
+ logs: parsed.recentLogs,
474
+ }));
475
+ } catch {
476
+ // unreadable rollout
477
+ }
478
+ }
479
+
480
+ traces.sort((a, b) => (b.startedAt || 0) - (a.startedAt || 0));
481
+ return traces;
482
+ }
@@ -1,49 +1,65 @@
1
1
  import { getAntigravityTraces } from "./antigravityWatcher.js";
2
2
  import { getClaudeTraces } from "./claudeWatcher.js";
3
+ import { getCodexTraces } from "./codexWatcher.js";
3
4
  import { extractProviders } from "../traceContract.js";
4
5
 
5
6
  /**
6
7
  * WatcherManager aggregates traces across all installed CLI watchers
7
8
  * (Antigravity, Claude Code, etc.) with automatic fallback and caching.
8
9
  */
9
- let cachedSnapshot = { traces: [], errors: [] };
10
+ let cachedCombined = [];
11
+ let cachedErrors = [];
10
12
  let lastFetchTime = 0;
13
+ let lastMaxAgeMs = null;
11
14
  const CACHE_TTL_MS = 1500; // 1.5s cache to avoid reading disks too frequently
12
15
 
13
- export async function getLiveTraceSnapshot(force = false, maxAgeMs = 24 * 60 * 60 * 1000) {
16
+ export async function getLiveTraceSnapshot(force = false, maxAgeMs = 24 * 60 * 60 * 1000, limit = 0) {
14
17
  const now = Date.now();
15
- if (!force && now - lastFetchTime < CACHE_TTL_MS) {
16
- return cachedSnapshot;
18
+ const isCacheValid = !force && (now - lastFetchTime < CACHE_TTL_MS) && (lastMaxAgeMs === maxAgeMs);
19
+
20
+ if (!isCacheValid) {
21
+ const results = await Promise.allSettled([
22
+ getAntigravityTraces(maxAgeMs),
23
+ getClaudeTraces(maxAgeMs),
24
+ getCodexTraces(maxAgeMs),
25
+ ]);
26
+ const errors = [];
27
+ const [agyResult, claudeResult, codexResult] = results;
28
+ const agyList = agyResult.status === "fulfilled" ? agyResult.value : [];
29
+ const claudeList = claudeResult.status === "fulfilled" ? claudeResult.value : [];
30
+ const codexList = codexResult.status === "fulfilled" ? codexResult.value : [];
31
+ if (agyResult.status === "rejected") errors.push({ source: "antigravity", message: agyResult.reason?.message || "Watcher failed" });
32
+ if (claudeResult.status === "rejected") errors.push({ source: "claude", message: claudeResult.reason?.message || "Watcher failed" });
33
+ if (codexResult.status === "rejected") errors.push({ source: "codex", message: codexResult.reason?.message || "Watcher failed" });
34
+
35
+ const combined = [...agyList, ...claudeList, ...codexList];
36
+
37
+ // Sort: active/streaming/pending first, then by most recent startedAt
38
+ combined.sort((a, b) => {
39
+ const activeA = (a.state === "streaming" || a.state === "pending") ? 1 : 0;
40
+ const activeB = (b.state === "streaming" || b.state === "pending") ? 1 : 0;
41
+ if (activeA !== activeB) return activeB - activeA;
42
+ return (b.startedAt || 0) - (a.startedAt || 0);
43
+ });
44
+
45
+ cachedCombined = combined;
46
+ cachedErrors = errors;
47
+ lastMaxAgeMs = maxAgeMs;
48
+ lastFetchTime = now;
17
49
  }
18
50
 
19
- const results = await Promise.allSettled([
20
- getAntigravityTraces(maxAgeMs),
21
- getClaudeTraces(maxAgeMs),
22
- ]);
23
- const errors = [];
24
- const [agyResult, claudeResult] = results;
25
- const agyList = agyResult.status === "fulfilled" ? agyResult.value : [];
26
- const claudeList = claudeResult.status === "fulfilled" ? claudeResult.value : [];
27
- if (agyResult.status === "rejected") errors.push({ source: "antigravity", message: agyResult.reason?.message || "Watcher failed" });
28
- if (claudeResult.status === "rejected") errors.push({ source: "claude", message: claudeResult.reason?.message || "Watcher failed" });
29
-
30
- const combined = [...agyList, ...claudeList];
31
-
32
- // Sort: active/streaming/pending first, then by most recent startedAt
33
- combined.sort((a, b) => {
34
- const activeA = (a.state === "streaming" || a.state === "pending") ? 1 : 0;
35
- const activeB = (b.state === "streaming" || b.state === "pending") ? 1 : 0;
36
- if (activeA !== activeB) return activeB - activeA;
37
- return (b.startedAt || 0) - (a.startedAt || 0);
38
- });
39
-
40
- cachedSnapshot = { traces: combined, errors };
41
- lastFetchTime = now;
42
- return cachedSnapshot;
51
+ const totalCount = cachedCombined.length;
52
+ const sliced = (limit > 0 && limit < totalCount) ? cachedCombined.slice(0, limit) : cachedCombined;
53
+
54
+ return {
55
+ traces: sliced,
56
+ totalCount,
57
+ errors: cachedErrors,
58
+ };
43
59
  }
44
60
 
45
- export async function getAllLiveTraces(force = false, maxAgeMs) {
46
- return (await getLiveTraceSnapshot(force, maxAgeMs)).traces;
61
+ export async function getAllLiveTraces(force = false, maxAgeMs, limit = 0) {
62
+ return (await getLiveTraceSnapshot(force, maxAgeMs, limit)).traces;
47
63
  }
48
64
 
49
65
  export function getProvidersFromTraces(traces) {
@@ -1,3 +0,0 @@
1
- module.exports=[53984,56496,e=>{"use strict";var t=e.i(12714),i=e.i(50227),n=e.i(60526);function l(e){let t=e.tokens||{},i=e=>Number.isFinite(e)?Number(e):null,n=i(t.input),l=i(t.output),a=i(t.cached),r=i(e.totalTokens??t.total),s=String(e.connectionId||"").toLowerCase(),o=e.clientType||("app"===e.source||s.includes("app")?"app":"extension"===e.source||s.includes("extension")||"ide"===e.source||s.includes("ide")?"extension":"cli");return{traceId:String(e.traceId||`trace-${Math.random().toString(36).slice(2,9)}`),cli:e.cli||"agent",clientType:o,source:e.source||o,connectionId:String(e.connectionId||"Agent Desk"),account:String(e.account||"Default Workspace"),model:e.model?String(e.model):null,provider:e.provider?String(e.provider).toLowerCase():null,state:["streaming","pending","idle","done","error"].includes(e.state)?e.state:"idle",startedAt:"number"==typeof e.startedAt?e.startedAt:null,elapsedMs:"number"==typeof e.elapsedMs?e.elapsedMs:null,tokens:{input:n,output:l,cached:a},totalTokens:r??(null!==n&&null!==l&&null!==a?n+l+a:null),cost:i(e.cost),status:e.status?String(e.status):null,tools:Array.isArray(e.tools)?e.tools:[],activeTool:e.activeTool||null,currentCommand:e.currentCommand||null,sessionTitle:e.sessionTitle?String(e.sessionTitle):null,lastText:e.lastText?String(e.lastText):null,lastTextRole:["user","assistant"].includes(e.lastTextRole)?e.lastTextRole:null,error:e.error?String(e.error):null,isLooping:!!e.isLooping,logs:Array.isArray(e.logs)?e.logs:[]}}e.s(["s",0,function(e){let t=new Set,i=[];for(let n of e){let e=(n.provider||"other").toLowerCase();t.has(e)||(t.add(e),i.push({provider:e,name:e.charAt(0).toUpperCase()+e.slice(1)}))}return i},"g",0,l],56496);let a={view_file:"read",read_file:"read",replace_file_content:"edit",write_to_file:"edit",call_mcp_tool:"mcp",list_resources:"mcp",invoke_subagent:"agent",grep_search:"search",list_dir:"read",find_by_name:"read",define_subagent:"agent"};function r(e){if(!e||!e.name)return{type:"mcp",detail:null};let t=e.name,n=e.args||{};if("call_mcp_tool"===t){let e=String(n.ServerName||"").toLowerCase(),t=String(n.ToolName||"").toLowerCase();return e.includes("gitnexus")||t.includes("cypher")||t.includes("pdg_query")||t.includes("impact")?{type:"gitnexus",detail:`GitNexus: ${t}`}:e.includes("playwright")||e.includes("browser")||t.startsWith("browser_")?{type:"browser",detail:`Browser: ${t}`}:{type:"mcp",detail:`MCP: ${e}/${t}`}}if("run_command"===t){let e=String(n.CommandLine||"").trim(),t=e.toLowerCase();return t.startsWith("docker")||t.includes("docker exec")||t.includes("docker-compose")?{type:"docker",detail:e.length>50?`${e.slice(0,47)}...`:e}:t.startsWith("git ")||t.startsWith("gh ")||t.includes("git commit")||t.includes("git push")?{type:"git",detail:e.length>50?`${e.slice(0,47)}...`:e}:t.includes("gitnexus")?{type:"gitnexus",detail:e.length>50?`${e.slice(0,47)}...`:e}:{type:"bash",detail:e.length>50?`${e.slice(0,47)}...`:e}}let l=a[t],r=n.TargetFile||n.AbsolutePath||n.query||"",s=r?`${t}: ${i.default.basename(r)}`:t;return l?{type:l,detail:s}:t.includes("read")||t.includes("find")||t.includes("dir")||t.includes("list")?{type:"read",detail:s}:t.includes("edit")||t.includes("write")||t.includes("patch")?{type:"edit",detail:s}:t.includes("search")||t.includes("grep")?{type:"search",detail:s}:t.includes("agent")||t.includes("message")?{type:"agent",detail:s}:{type:"mcp",detail:s}}function s(e){if(!e)return null;let t=e.match(/Model Selection` from [^ ]+ to (.*?)(?:\.\s+No need|\.\s*\n|<\/USER_SETTINGS_CHANGE>)/i);if(t&&t[1])return t[1].trim();let i=e.match(/Model Selection`? from .*? to ([^\n<.]+)/i);return i&&i[1]?i[1].trim():null}function o(e){if(!e)return null;let t=e.toLowerCase();return t.includes("3.8")&&t.includes("flash")?"gemini-3.8-flash":t.includes("3.5")&&t.includes("flash")?"gemini-3.5-flash":t.includes("3.8")&&t.includes("pro")?"gemini-3.8-pro":t.includes("3.1")&&t.includes("pro")?"gemini-3.1-pro":t.includes("2.5")&&t.includes("pro")?"gemini-2.5-pro":t.includes("2.5")&&t.includes("flash")?"gemini-2.5-flash":t.includes("sonnet")&&t.includes("5.5")?"claude-sonnet-5.5":t.includes("sonnet")&&t.includes("3.7")?"claude-3.7-sonnet":t.includes("sonnet")&&t.includes("3.5")?"claude-3.5-sonnet":e.replace(/[()]/g,"").trim().toLowerCase().replace(/\s+/g,"-")}function c(e,t=160){let i=String(e||"").replace(/\s+/g," ").trim();return i?i.slice(0,t):null}async function u(){let e=n.default.homedir(),l=i.default.join(e,".gemini"),a=[],r=new Set,s=(e,t)=>{r.has(e)||(r.add(e),a.push({dir:e,source:t}))};s(i.default.join(l,"antigravity-cli","brain"),"cli"),s(i.default.join(l,"antigravity","brain"),"app"),s(i.default.join(l,"antigravity-ide","brain"),"ide");try{for(let e of(await t.default.readdir(l,{withFileTypes:!0}))){if(!e.isDirectory())continue;let n=i.default.join(l,e.name,"brain");if(!r.has(n))try{if((await t.default.stat(n)).isDirectory()){let t=e.name.toLowerCase(),i=t.includes("ide")?"ide":t.includes("app")||"antigravity"===t?"app":"cli";s(n,i)}}catch{}}}catch{}let o=[];for(let e of a)try{(await t.default.stat(e.dir)).isDirectory()&&o.push(e)}catch{}return o}async function d(e=864e5){let a=n.default.homedir(),p=await u(),g=null;try{let e=await t.default.readFile(i.default.join(a,".gemini","antigravity-cli","settings.json"),"utf-8"),n=JSON.parse(e);n.model&&(g=n.model)}catch{}try{let n=Date.now(),a=[],u=new Set;for(let{dir:d,source:m}of p){let p;try{p=await t.default.readdir(d,{withFileTypes:!0})}catch{continue}for(let f of p){if(!f.isDirectory())continue;let p=f.name;if(u.has(p))continue;let y=i.default.join(d,p,".system_generated","logs","transcript.jsonl");try{let d=(await t.default.stat(y)).mtimeMs;if(n-d>e)continue;let f=await t.default.readFile(y,"utf-8"),h=f.trim().split("\n");if(0===h.length)continue;let _=0,S=0,T=0,w=!1,A=null,N=null,E=new Set,b=null,C=null,v=null,I=null,R=null,k=null,$=null,x=[],D=[];for(let e of h)if(e)try{let t=JSON.parse(e),i=t.created_at?new Date(t.created_at).getTime():Date.now();if(!b&&t.created_at&&(b=i),t.created_at&&(C=i),(Number.isFinite(t.input_tokens)||Number.isFinite(t.output_tokens)||Number.isFinite(t.cache_read_tokens))&&(w=!0,_+=t.input_tokens||0,S+=t.output_tokens||0,T+=t.cache_read_tokens||0),"USER_INPUT"===t.type&&t.content){let e=function(e){if(!e)return null;let t=String(e),i=[...t.matchAll(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/gi)];return c(t=i.length>0?i[i.length-1][1]:t.replace(/<CONTEXT_SUMMARY>[\s\S]*?<\/CONTEXT_SUMMARY>/gi,"").replace(/<ADDITIONAL_METADATA>[\s\S]*?<\/ADDITIONAL_METADATA>/gi,"").replace(/<USER_SETTINGS_CHANGE>[\s\S]*?<\/USER_SETTINGS_CHANGE>/gi,"").replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi,""))}(t.content);e&&(R||=c(e,80),k=e,$="user",D.push({timestamp:t.created_at||new Date().toISOString(),type:"prompt",summary:"User Prompt",detail:e.slice(0,100)}))}else if("PLANNER_RESPONSE"===t.type&&t.content){let e=c(t.content);e&&(k=e,$="assistant")}if(Array.isArray(t.tool_calls)&&t.tool_calls.length>0)for(let e of(A=t,t.tool_calls)){if(e.args?.Cwd&&!I&&(I=e.args.Cwd),!I&&(e.args?.TargetFile||e.args?.AbsolutePath)){let t=e.args.TargetFile||e.args.AbsolutePath;t.includes("/Projects/")&&(I=t.split("/").slice(0,5).join("/"))}let{type:n,detail:l}=r(e);n&&E.add(n),l&&(v=l),x.push({name:e.name,time:i,detail:l||e.name}),D.push({timestamp:t.created_at||new Date().toISOString(),type:n||"tool",summary:e.name,detail:l||e.name})}("ERROR"===t.status||"GENERIC"===t.type&&t.content&&t.content.includes("error"))&&D.push({timestamp:t.created_at||new Date().toISOString(),type:"error",summary:"Error",detail:String(t.content||"Command failed").slice(0,100)}),N=t}catch{}let L="done";A?.status==="RUNNING"?L="streaming":N?.type==="USER_INPUT"?L="pending":n-d<45e3&&(L="idle");let U=!1;if(x.length>=5){let e=x.slice(-10);for(let t=0;t<=e.length-5;t++){let i=e.slice(t,t+5),n=`${i[0].name}:${i[0].detail}`,l=i.every(e=>`${e.name}:${e.detail}`===n),a=(i[i.length-1].time||0)-(i[0].time||0);if(l&&(a<=6e4||0===a)){U=!0;break}}}let M=null;if(A&&Array.isArray(A.tool_calls)&&A.tool_calls.length>0){let e=A.tool_calls[A.tool_calls.length-1];M=r(e).type}let j=C&&b?Math.max(0,C-b):n-d,F=(I?i.default.basename(I):`agy-${p.slice(0,6)}`).replace(/["'\\]/g,"").trim();u.add(p);let O="app"===m?"app":"ide"===m?"ide":"cli",P="app"===m?"Antigravity App":"ide"===m?"Antigravity IDE":"Antigravity",G=s(f)||("cli"===m?g:null),W=o(G),H=function(e,t){let i=String(e||"").toLowerCase(),n=null;return i.includes("gemini")?n="gemini":i.includes("claude")?n="anthropic":i.includes("gpt")||i.includes("o1")||i.includes("o3")?n="openai":i.includes("minimax")?n="minimax":i.includes("deepseek")&&(n="deepseek"),n?`${n} (${t})`:null}(W,O),q=i.default.basename(process.cwd())||"agent-factory",J=F||q,Q=R||J;a.push(l({traceId:`agy-${p.slice(0,8)}`,cli:"antigravity",clientType:O,source:m,connectionId:`${P} (${p.slice(0,6)})`,account:J,model:W,provider:H,state:L,startedAt:b||n-j,elapsedMs:j,tokens:{input:w?_:null,output:w?S:null,cached:w?T:null},cost:null,status:U?"error":null,tools:Array.from(E),activeTool:M,currentCommand:v,sessionTitle:Q,lastText:k,lastTextRole:$,isLooping:U,logs:D.slice(-25)}))}catch{}}}return a.sort((e,t)=>{let i=+("streaming"===e.state||"pending"===e.state),n=+("streaming"===t.state||"pending"===t.state);return i!==n?n-i:(t.startedAt||0)-(e.startedAt||0)}),a}catch{return[]}}e.s(["f",0,s,"g",0,d,"R",0,o],53984)}];
2
-
3
- //# sourceMappingURL=src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js.map