@phnx-labs/agents-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (486) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/LICENSE +21 -0
  3. package/README.md +537 -0
  4. package/dist/commands/__tests__/sessions.test.d.ts +2 -0
  5. package/dist/commands/__tests__/sessions.test.d.ts.map +1 -0
  6. package/dist/commands/__tests__/sessions.test.js +636 -0
  7. package/dist/commands/__tests__/sessions.test.js.map +1 -0
  8. package/dist/commands/cloud.d.ts +3 -0
  9. package/dist/commands/cloud.d.ts.map +1 -0
  10. package/dist/commands/cloud.js +322 -0
  11. package/dist/commands/cloud.js.map +1 -0
  12. package/dist/commands/commands.d.ts +3 -0
  13. package/dist/commands/commands.d.ts.map +1 -0
  14. package/dist/commands/commands.js +628 -0
  15. package/dist/commands/commands.js.map +1 -0
  16. package/dist/commands/daemon.d.ts +3 -0
  17. package/dist/commands/daemon.d.ts.map +1 -0
  18. package/dist/commands/daemon.js +110 -0
  19. package/dist/commands/daemon.js.map +1 -0
  20. package/dist/commands/drive.d.ts +3 -0
  21. package/dist/commands/drive.d.ts.map +1 -0
  22. package/dist/commands/drive.js +166 -0
  23. package/dist/commands/drive.js.map +1 -0
  24. package/dist/commands/exec.d.ts +3 -0
  25. package/dist/commands/exec.d.ts.map +1 -0
  26. package/dist/commands/exec.js +241 -0
  27. package/dist/commands/exec.js.map +1 -0
  28. package/dist/commands/fork.d.ts +3 -0
  29. package/dist/commands/fork.d.ts.map +1 -0
  30. package/dist/commands/fork.js +139 -0
  31. package/dist/commands/fork.js.map +1 -0
  32. package/dist/commands/hooks.d.ts +3 -0
  33. package/dist/commands/hooks.d.ts.map +1 -0
  34. package/dist/commands/hooks.js +689 -0
  35. package/dist/commands/hooks.js.map +1 -0
  36. package/dist/commands/init.d.ts +6 -0
  37. package/dist/commands/init.d.ts.map +1 -0
  38. package/dist/commands/init.js +127 -0
  39. package/dist/commands/init.js.map +1 -0
  40. package/dist/commands/mcp.d.ts +3 -0
  41. package/dist/commands/mcp.d.ts.map +1 -0
  42. package/dist/commands/mcp.js +581 -0
  43. package/dist/commands/mcp.js.map +1 -0
  44. package/dist/commands/models.d.ts +3 -0
  45. package/dist/commands/models.d.ts.map +1 -0
  46. package/dist/commands/models.js +158 -0
  47. package/dist/commands/models.js.map +1 -0
  48. package/dist/commands/packages.d.ts +3 -0
  49. package/dist/commands/packages.d.ts.map +1 -0
  50. package/dist/commands/packages.js +541 -0
  51. package/dist/commands/packages.js.map +1 -0
  52. package/dist/commands/permissions.d.ts +3 -0
  53. package/dist/commands/permissions.d.ts.map +1 -0
  54. package/dist/commands/permissions.js +723 -0
  55. package/dist/commands/permissions.js.map +1 -0
  56. package/dist/commands/plugins.d.ts +3 -0
  57. package/dist/commands/plugins.d.ts.map +1 -0
  58. package/dist/commands/plugins.js +382 -0
  59. package/dist/commands/plugins.js.map +1 -0
  60. package/dist/commands/profiles.d.ts +3 -0
  61. package/dist/commands/profiles.d.ts.map +1 -0
  62. package/dist/commands/profiles.js +242 -0
  63. package/dist/commands/profiles.js.map +1 -0
  64. package/dist/commands/pty.d.ts +20 -0
  65. package/dist/commands/pty.d.ts.map +1 -0
  66. package/dist/commands/pty.js +389 -0
  67. package/dist/commands/pty.js.map +1 -0
  68. package/dist/commands/pull.d.ts +3 -0
  69. package/dist/commands/pull.d.ts.map +1 -0
  70. package/dist/commands/pull.js +448 -0
  71. package/dist/commands/pull.js.map +1 -0
  72. package/dist/commands/push.d.ts +3 -0
  73. package/dist/commands/push.d.ts.map +1 -0
  74. package/dist/commands/push.js +180 -0
  75. package/dist/commands/push.js.map +1 -0
  76. package/dist/commands/refresh-memory.d.ts +9 -0
  77. package/dist/commands/refresh-memory.d.ts.map +1 -0
  78. package/dist/commands/refresh-memory.js +45 -0
  79. package/dist/commands/refresh-memory.js.map +1 -0
  80. package/dist/commands/resource-view.d.ts +31 -0
  81. package/dist/commands/resource-view.d.ts.map +1 -0
  82. package/dist/commands/resource-view.js +183 -0
  83. package/dist/commands/resource-view.js.map +1 -0
  84. package/dist/commands/routines.d.ts +3 -0
  85. package/dist/commands/routines.d.ts.map +1 -0
  86. package/dist/commands/routines.js +579 -0
  87. package/dist/commands/routines.js.map +1 -0
  88. package/dist/commands/rules.d.ts +3 -0
  89. package/dist/commands/rules.d.ts.map +1 -0
  90. package/dist/commands/rules.js +488 -0
  91. package/dist/commands/rules.js.map +1 -0
  92. package/dist/commands/secrets.d.ts +3 -0
  93. package/dist/commands/secrets.d.ts.map +1 -0
  94. package/dist/commands/secrets.js +339 -0
  95. package/dist/commands/secrets.js.map +1 -0
  96. package/dist/commands/sessions-picker.d.ts +16 -0
  97. package/dist/commands/sessions-picker.d.ts.map +1 -0
  98. package/dist/commands/sessions-picker.js +256 -0
  99. package/dist/commands/sessions-picker.js.map +1 -0
  100. package/dist/commands/sessions.d.ts +16 -0
  101. package/dist/commands/sessions.d.ts.map +1 -0
  102. package/dist/commands/sessions.js +1077 -0
  103. package/dist/commands/sessions.js.map +1 -0
  104. package/dist/commands/skills.d.ts +3 -0
  105. package/dist/commands/skills.d.ts.map +1 -0
  106. package/dist/commands/skills.js +716 -0
  107. package/dist/commands/skills.js.map +1 -0
  108. package/dist/commands/status.d.ts +3 -0
  109. package/dist/commands/status.d.ts.map +1 -0
  110. package/dist/commands/status.js +19 -0
  111. package/dist/commands/status.js.map +1 -0
  112. package/dist/commands/subagents.d.ts +3 -0
  113. package/dist/commands/subagents.d.ts.map +1 -0
  114. package/dist/commands/subagents.js +350 -0
  115. package/dist/commands/subagents.js.map +1 -0
  116. package/dist/commands/sync.d.ts +3 -0
  117. package/dist/commands/sync.d.ts.map +1 -0
  118. package/dist/commands/sync.js +62 -0
  119. package/dist/commands/sync.js.map +1 -0
  120. package/dist/commands/teams-picker.d.ts +14 -0
  121. package/dist/commands/teams-picker.d.ts.map +1 -0
  122. package/dist/commands/teams-picker.js +278 -0
  123. package/dist/commands/teams-picker.js.map +1 -0
  124. package/dist/commands/teams.d.ts +3 -0
  125. package/dist/commands/teams.d.ts.map +1 -0
  126. package/dist/commands/teams.js +917 -0
  127. package/dist/commands/teams.js.map +1 -0
  128. package/dist/commands/utils.d.ts +39 -0
  129. package/dist/commands/utils.d.ts.map +1 -0
  130. package/dist/commands/utils.js +100 -0
  131. package/dist/commands/utils.js.map +1 -0
  132. package/dist/commands/versions.d.ts +3 -0
  133. package/dist/commands/versions.d.ts.map +1 -0
  134. package/dist/commands/versions.js +700 -0
  135. package/dist/commands/versions.js.map +1 -0
  136. package/dist/commands/view.d.ts +8 -0
  137. package/dist/commands/view.d.ts.map +1 -0
  138. package/dist/commands/view.js +626 -0
  139. package/dist/commands/view.js.map +1 -0
  140. package/dist/index.d.ts +3 -0
  141. package/dist/index.d.ts.map +1 -0
  142. package/dist/index.js +484 -0
  143. package/dist/index.js.map +1 -0
  144. package/dist/lib/__tests__/bugfixes.test.d.ts +2 -0
  145. package/dist/lib/__tests__/bugfixes.test.d.ts.map +1 -0
  146. package/dist/lib/__tests__/bugfixes.test.js +192 -0
  147. package/dist/lib/__tests__/bugfixes.test.js.map +1 -0
  148. package/dist/lib/__tests__/exec.test.d.ts +2 -0
  149. package/dist/lib/__tests__/exec.test.d.ts.map +1 -0
  150. package/dist/lib/__tests__/exec.test.js +446 -0
  151. package/dist/lib/__tests__/exec.test.js.map +1 -0
  152. package/dist/lib/__tests__/git-sync.test.d.ts +2 -0
  153. package/dist/lib/__tests__/git-sync.test.d.ts.map +1 -0
  154. package/dist/lib/__tests__/git-sync.test.js +138 -0
  155. package/dist/lib/__tests__/git-sync.test.js.map +1 -0
  156. package/dist/lib/__tests__/hooks.test.d.ts +2 -0
  157. package/dist/lib/__tests__/hooks.test.d.ts.map +1 -0
  158. package/dist/lib/__tests__/hooks.test.js +203 -0
  159. package/dist/lib/__tests__/hooks.test.js.map +1 -0
  160. package/dist/lib/__tests__/memory-compile.test.d.ts +2 -0
  161. package/dist/lib/__tests__/memory-compile.test.d.ts.map +1 -0
  162. package/dist/lib/__tests__/memory-compile.test.js +95 -0
  163. package/dist/lib/__tests__/memory-compile.test.js.map +1 -0
  164. package/dist/lib/__tests__/models.test.d.ts +2 -0
  165. package/dist/lib/__tests__/models.test.d.ts.map +1 -0
  166. package/dist/lib/__tests__/models.test.js +239 -0
  167. package/dist/lib/__tests__/models.test.js.map +1 -0
  168. package/dist/lib/__tests__/rotate.test.d.ts +2 -0
  169. package/dist/lib/__tests__/rotate.test.d.ts.map +1 -0
  170. package/dist/lib/__tests__/rotate.test.js +80 -0
  171. package/dist/lib/__tests__/rotate.test.js.map +1 -0
  172. package/dist/lib/__tests__/secrets-bundles.test.d.ts +2 -0
  173. package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +1 -0
  174. package/dist/lib/__tests__/secrets-bundles.test.js +104 -0
  175. package/dist/lib/__tests__/secrets-bundles.test.js.map +1 -0
  176. package/dist/lib/__tests__/secrets.test.d.ts +2 -0
  177. package/dist/lib/__tests__/secrets.test.d.ts.map +1 -0
  178. package/dist/lib/__tests__/secrets.test.js +90 -0
  179. package/dist/lib/__tests__/secrets.test.js.map +1 -0
  180. package/dist/lib/__tests__/shims.test.d.ts +2 -0
  181. package/dist/lib/__tests__/shims.test.d.ts.map +1 -0
  182. package/dist/lib/__tests__/shims.test.js +39 -0
  183. package/dist/lib/__tests__/shims.test.js.map +1 -0
  184. package/dist/lib/__tests__/usage.test.d.ts +2 -0
  185. package/dist/lib/__tests__/usage.test.d.ts.map +1 -0
  186. package/dist/lib/__tests__/usage.test.js +220 -0
  187. package/dist/lib/__tests__/usage.test.js.map +1 -0
  188. package/dist/lib/__tests__/versions.test.d.ts +2 -0
  189. package/dist/lib/__tests__/versions.test.d.ts.map +1 -0
  190. package/dist/lib/__tests__/versions.test.js +63 -0
  191. package/dist/lib/__tests__/versions.test.js.map +1 -0
  192. package/dist/lib/agents.d.ts +107 -0
  193. package/dist/lib/agents.d.ts.map +1 -0
  194. package/dist/lib/agents.js +1096 -0
  195. package/dist/lib/agents.js.map +1 -0
  196. package/dist/lib/artifact-actions.d.ts +22 -0
  197. package/dist/lib/artifact-actions.d.ts.map +1 -0
  198. package/dist/lib/artifact-actions.js +55 -0
  199. package/dist/lib/artifact-actions.js.map +1 -0
  200. package/dist/lib/cloud/codex.d.ts +19 -0
  201. package/dist/lib/cloud/codex.d.ts.map +1 -0
  202. package/dist/lib/cloud/codex.js +210 -0
  203. package/dist/lib/cloud/codex.js.map +1 -0
  204. package/dist/lib/cloud/factory.d.ts +26 -0
  205. package/dist/lib/cloud/factory.d.ts.map +1 -0
  206. package/dist/lib/cloud/factory.js +37 -0
  207. package/dist/lib/cloud/factory.js.map +1 -0
  208. package/dist/lib/cloud/registry.d.ts +6 -0
  209. package/dist/lib/cloud/registry.d.ts.map +1 -0
  210. package/dist/lib/cloud/registry.js +56 -0
  211. package/dist/lib/cloud/registry.js.map +1 -0
  212. package/dist/lib/cloud/rush.d.ts +15 -0
  213. package/dist/lib/cloud/rush.d.ts.map +1 -0
  214. package/dist/lib/cloud/rush.js +185 -0
  215. package/dist/lib/cloud/rush.js.map +1 -0
  216. package/dist/lib/cloud/store.d.ts +10 -0
  217. package/dist/lib/cloud/store.d.ts.map +1 -0
  218. package/dist/lib/cloud/store.js +96 -0
  219. package/dist/lib/cloud/store.js.map +1 -0
  220. package/dist/lib/cloud/stream.d.ts +18 -0
  221. package/dist/lib/cloud/stream.d.ts.map +1 -0
  222. package/dist/lib/cloud/stream.js +138 -0
  223. package/dist/lib/cloud/stream.js.map +1 -0
  224. package/dist/lib/cloud/types.d.ts +60 -0
  225. package/dist/lib/cloud/types.d.ts.map +1 -0
  226. package/dist/lib/cloud/types.js +2 -0
  227. package/dist/lib/cloud/types.js.map +1 -0
  228. package/dist/lib/commands.d.ts +121 -0
  229. package/dist/lib/commands.d.ts.map +1 -0
  230. package/dist/lib/commands.js +499 -0
  231. package/dist/lib/commands.js.map +1 -0
  232. package/dist/lib/convert.d.ts +11 -0
  233. package/dist/lib/convert.d.ts.map +1 -0
  234. package/dist/lib/convert.js +45 -0
  235. package/dist/lib/convert.js.map +1 -0
  236. package/dist/lib/daemon.d.ts +22 -0
  237. package/dist/lib/daemon.d.ts.map +1 -0
  238. package/dist/lib/daemon.js +311 -0
  239. package/dist/lib/daemon.js.map +1 -0
  240. package/dist/lib/drive-sync.d.ts +28 -0
  241. package/dist/lib/drive-sync.d.ts.map +1 -0
  242. package/dist/lib/drive-sync.js +193 -0
  243. package/dist/lib/drive-sync.js.map +1 -0
  244. package/dist/lib/exec.d.ts +85 -0
  245. package/dist/lib/exec.d.ts.map +1 -0
  246. package/dist/lib/exec.js +423 -0
  247. package/dist/lib/exec.js.map +1 -0
  248. package/dist/lib/factory.d.ts +57 -0
  249. package/dist/lib/factory.d.ts.map +1 -0
  250. package/dist/lib/factory.js +110 -0
  251. package/dist/lib/factory.js.map +1 -0
  252. package/dist/lib/git.d.ts +146 -0
  253. package/dist/lib/git.d.ts.map +1 -0
  254. package/dist/lib/git.js +635 -0
  255. package/dist/lib/git.js.map +1 -0
  256. package/dist/lib/help.d.ts +3 -0
  257. package/dist/lib/help.d.ts.map +1 -0
  258. package/dist/lib/help.js +63 -0
  259. package/dist/lib/help.js.map +1 -0
  260. package/dist/lib/hooks.d.ts +116 -0
  261. package/dist/lib/hooks.d.ts.map +1 -0
  262. package/dist/lib/hooks.js +837 -0
  263. package/dist/lib/hooks.js.map +1 -0
  264. package/dist/lib/manifest.d.ts +8 -0
  265. package/dist/lib/manifest.d.ts.map +1 -0
  266. package/dist/lib/manifest.js +36 -0
  267. package/dist/lib/manifest.js.map +1 -0
  268. package/dist/lib/markdown.d.ts +5 -0
  269. package/dist/lib/markdown.d.ts.map +1 -0
  270. package/dist/lib/markdown.js +11 -0
  271. package/dist/lib/markdown.js.map +1 -0
  272. package/dist/lib/mcp.d.ts +64 -0
  273. package/dist/lib/mcp.d.ts.map +1 -0
  274. package/dist/lib/mcp.js +327 -0
  275. package/dist/lib/mcp.js.map +1 -0
  276. package/dist/lib/memory-compile.d.ts +56 -0
  277. package/dist/lib/memory-compile.d.ts.map +1 -0
  278. package/dist/lib/memory-compile.js +167 -0
  279. package/dist/lib/memory-compile.js.map +1 -0
  280. package/dist/lib/memory.d.ts +56 -0
  281. package/dist/lib/memory.d.ts.map +1 -0
  282. package/dist/lib/memory.js +267 -0
  283. package/dist/lib/memory.js.map +1 -0
  284. package/dist/lib/models.d.ts +91 -0
  285. package/dist/lib/models.d.ts.map +1 -0
  286. package/dist/lib/models.js +706 -0
  287. package/dist/lib/models.js.map +1 -0
  288. package/dist/lib/permissions.d.ts +204 -0
  289. package/dist/lib/permissions.d.ts.map +1 -0
  290. package/dist/lib/permissions.js +1022 -0
  291. package/dist/lib/permissions.js.map +1 -0
  292. package/dist/lib/picker.d.ts +17 -0
  293. package/dist/lib/picker.d.ts.map +1 -0
  294. package/dist/lib/picker.js +95 -0
  295. package/dist/lib/picker.js.map +1 -0
  296. package/dist/lib/plugins.d.ts +73 -0
  297. package/dist/lib/plugins.d.ts.map +1 -0
  298. package/dist/lib/plugins.js +549 -0
  299. package/dist/lib/plugins.js.map +1 -0
  300. package/dist/lib/profiles-keychain.d.ts +3 -0
  301. package/dist/lib/profiles-keychain.d.ts.map +1 -0
  302. package/dist/lib/profiles-keychain.js +10 -0
  303. package/dist/lib/profiles-keychain.js.map +1 -0
  304. package/dist/lib/profiles-presets.d.ts +15 -0
  305. package/dist/lib/profiles-presets.d.ts.map +1 -0
  306. package/dist/lib/profiles-presets.js +95 -0
  307. package/dist/lib/profiles-presets.js.map +1 -0
  308. package/dist/lib/profiles.d.ts +35 -0
  309. package/dist/lib/profiles.d.ts.map +1 -0
  310. package/dist/lib/profiles.js +123 -0
  311. package/dist/lib/profiles.js.map +1 -0
  312. package/dist/lib/pty-client.d.ts +22 -0
  313. package/dist/lib/pty-client.d.ts.map +1 -0
  314. package/dist/lib/pty-client.js +181 -0
  315. package/dist/lib/pty-client.js.map +1 -0
  316. package/dist/lib/pty-server.d.ts +16 -0
  317. package/dist/lib/pty-server.d.ts.map +1 -0
  318. package/dist/lib/pty-server.js +422 -0
  319. package/dist/lib/pty-server.js.map +1 -0
  320. package/dist/lib/registry.d.ts +28 -0
  321. package/dist/lib/registry.d.ts.map +1 -0
  322. package/dist/lib/registry.js +203 -0
  323. package/dist/lib/registry.js.map +1 -0
  324. package/dist/lib/resources.d.ts +50 -0
  325. package/dist/lib/resources.d.ts.map +1 -0
  326. package/dist/lib/resources.js +103 -0
  327. package/dist/lib/resources.js.map +1 -0
  328. package/dist/lib/rotate.d.ts +52 -0
  329. package/dist/lib/rotate.d.ts.map +1 -0
  330. package/dist/lib/rotate.js +87 -0
  331. package/dist/lib/rotate.js.map +1 -0
  332. package/dist/lib/routines.d.ts +70 -0
  333. package/dist/lib/routines.d.ts.map +1 -0
  334. package/dist/lib/routines.js +325 -0
  335. package/dist/lib/routines.js.map +1 -0
  336. package/dist/lib/runner.d.ts +12 -0
  337. package/dist/lib/runner.d.ts.map +1 -0
  338. package/dist/lib/runner.js +311 -0
  339. package/dist/lib/runner.js.map +1 -0
  340. package/dist/lib/sandbox.d.ts +10 -0
  341. package/dist/lib/sandbox.d.ts.map +1 -0
  342. package/dist/lib/sandbox.js +201 -0
  343. package/dist/lib/sandbox.js.map +1 -0
  344. package/dist/lib/scheduler.d.ts +18 -0
  345. package/dist/lib/scheduler.d.ts.map +1 -0
  346. package/dist/lib/scheduler.js +69 -0
  347. package/dist/lib/scheduler.js.map +1 -0
  348. package/dist/lib/secrets-bundles.d.ts +29 -0
  349. package/dist/lib/secrets-bundles.d.ts.map +1 -0
  350. package/dist/lib/secrets-bundles.js +168 -0
  351. package/dist/lib/secrets-bundles.js.map +1 -0
  352. package/dist/lib/secrets.d.ts +27 -0
  353. package/dist/lib/secrets.d.ts.map +1 -0
  354. package/dist/lib/secrets.js +127 -0
  355. package/dist/lib/secrets.js.map +1 -0
  356. package/dist/lib/session/__tests__/db.test.d.ts +2 -0
  357. package/dist/lib/session/__tests__/db.test.d.ts.map +1 -0
  358. package/dist/lib/session/__tests__/db.test.js +54 -0
  359. package/dist/lib/session/__tests__/db.test.js.map +1 -0
  360. package/dist/lib/session/__tests__/discover.test.d.ts +2 -0
  361. package/dist/lib/session/__tests__/discover.test.d.ts.map +1 -0
  362. package/dist/lib/session/__tests__/discover.test.js +63 -0
  363. package/dist/lib/session/__tests__/discover.test.js.map +1 -0
  364. package/dist/lib/session/__tests__/prompt.test.d.ts +2 -0
  365. package/dist/lib/session/__tests__/prompt.test.d.ts.map +1 -0
  366. package/dist/lib/session/__tests__/prompt.test.js +44 -0
  367. package/dist/lib/session/__tests__/prompt.test.js.map +1 -0
  368. package/dist/lib/session/__tests__/render.test.d.ts +2 -0
  369. package/dist/lib/session/__tests__/render.test.d.ts.map +1 -0
  370. package/dist/lib/session/__tests__/render.test.js +602 -0
  371. package/dist/lib/session/__tests__/render.test.js.map +1 -0
  372. package/dist/lib/session/artifacts.d.ts +5 -0
  373. package/dist/lib/session/artifacts.d.ts.map +1 -0
  374. package/dist/lib/session/artifacts.js +75 -0
  375. package/dist/lib/session/artifacts.js.map +1 -0
  376. package/dist/lib/session/db.d.ts +118 -0
  377. package/dist/lib/session/db.d.ts.map +1 -0
  378. package/dist/lib/session/db.js +576 -0
  379. package/dist/lib/session/db.js.map +1 -0
  380. package/dist/lib/session/discover.d.ts +60 -0
  381. package/dist/lib/session/discover.d.ts.map +1 -0
  382. package/dist/lib/session/discover.js +1272 -0
  383. package/dist/lib/session/discover.js.map +1 -0
  384. package/dist/lib/session/parse.d.ts +23 -0
  385. package/dist/lib/session/parse.d.ts.map +1 -0
  386. package/dist/lib/session/parse.js +650 -0
  387. package/dist/lib/session/parse.js.map +1 -0
  388. package/dist/lib/session/prompt.d.ts +4 -0
  389. package/dist/lib/session/prompt.d.ts.map +1 -0
  390. package/dist/lib/session/prompt.js +64 -0
  391. package/dist/lib/session/prompt.js.map +1 -0
  392. package/dist/lib/session/prompt.test.d.ts +2 -0
  393. package/dist/lib/session/prompt.test.d.ts.map +1 -0
  394. package/dist/lib/session/prompt.test.js +57 -0
  395. package/dist/lib/session/prompt.test.js.map +1 -0
  396. package/dist/lib/session/render.d.ts +90 -0
  397. package/dist/lib/session/render.d.ts.map +1 -0
  398. package/dist/lib/session/render.js +778 -0
  399. package/dist/lib/session/render.js.map +1 -0
  400. package/dist/lib/session/team-filter.d.ts +26 -0
  401. package/dist/lib/session/team-filter.d.ts.map +1 -0
  402. package/dist/lib/session/team-filter.js +66 -0
  403. package/dist/lib/session/team-filter.js.map +1 -0
  404. package/dist/lib/session/team-filter.test.d.ts +2 -0
  405. package/dist/lib/session/team-filter.test.d.ts.map +1 -0
  406. package/dist/lib/session/team-filter.test.js +157 -0
  407. package/dist/lib/session/team-filter.test.js.map +1 -0
  408. package/dist/lib/session/types.d.ts +69 -0
  409. package/dist/lib/session/types.d.ts.map +1 -0
  410. package/dist/lib/session/types.js +2 -0
  411. package/dist/lib/session/types.js.map +1 -0
  412. package/dist/lib/shims.d.ts +228 -0
  413. package/dist/lib/shims.d.ts.map +1 -0
  414. package/dist/lib/shims.js +1170 -0
  415. package/dist/lib/shims.js.map +1 -0
  416. package/dist/lib/skills.d.ts +134 -0
  417. package/dist/lib/skills.d.ts.map +1 -0
  418. package/dist/lib/skills.js +783 -0
  419. package/dist/lib/skills.js.map +1 -0
  420. package/dist/lib/state.d.ts +53 -0
  421. package/dist/lib/state.d.ts.map +1 -0
  422. package/dist/lib/state.js +299 -0
  423. package/dist/lib/state.js.map +1 -0
  424. package/dist/lib/subagents.d.ts +75 -0
  425. package/dist/lib/subagents.d.ts.map +1 -0
  426. package/dist/lib/subagents.js +402 -0
  427. package/dist/lib/subagents.js.map +1 -0
  428. package/dist/lib/teams/agents.d.ts +146 -0
  429. package/dist/lib/teams/agents.d.ts.map +1 -0
  430. package/dist/lib/teams/agents.js +1072 -0
  431. package/dist/lib/teams/agents.js.map +1 -0
  432. package/dist/lib/teams/api.d.ts +77 -0
  433. package/dist/lib/teams/api.d.ts.map +1 -0
  434. package/dist/lib/teams/api.js +229 -0
  435. package/dist/lib/teams/api.js.map +1 -0
  436. package/dist/lib/teams/cloud.d.ts +11 -0
  437. package/dist/lib/teams/cloud.d.ts.map +1 -0
  438. package/dist/lib/teams/cloud.js +169 -0
  439. package/dist/lib/teams/cloud.js.map +1 -0
  440. package/dist/lib/teams/debug.d.ts +2 -0
  441. package/dist/lib/teams/debug.d.ts.map +1 -0
  442. package/dist/lib/teams/debug.js +6 -0
  443. package/dist/lib/teams/debug.js.map +1 -0
  444. package/dist/lib/teams/file_ops.d.ts +6 -0
  445. package/dist/lib/teams/file_ops.d.ts.map +1 -0
  446. package/dist/lib/teams/file_ops.js +59 -0
  447. package/dist/lib/teams/file_ops.js.map +1 -0
  448. package/dist/lib/teams/parsers.d.ts +5 -0
  449. package/dist/lib/teams/parsers.d.ts.map +1 -0
  450. package/dist/lib/teams/parsers.js +826 -0
  451. package/dist/lib/teams/parsers.js.map +1 -0
  452. package/dist/lib/teams/persistence.d.ts +28 -0
  453. package/dist/lib/teams/persistence.d.ts.map +1 -0
  454. package/dist/lib/teams/persistence.js +289 -0
  455. package/dist/lib/teams/persistence.js.map +1 -0
  456. package/dist/lib/teams/ralph.d.ts +8 -0
  457. package/dist/lib/teams/ralph.d.ts.map +1 -0
  458. package/dist/lib/teams/ralph.js +59 -0
  459. package/dist/lib/teams/ralph.js.map +1 -0
  460. package/dist/lib/teams/registry.d.ts +11 -0
  461. package/dist/lib/teams/registry.d.ts.map +1 -0
  462. package/dist/lib/teams/registry.js +56 -0
  463. package/dist/lib/teams/registry.js.map +1 -0
  464. package/dist/lib/teams/summarizer.d.ts +58 -0
  465. package/dist/lib/teams/summarizer.d.ts.map +1 -0
  466. package/dist/lib/teams/summarizer.js +766 -0
  467. package/dist/lib/teams/summarizer.js.map +1 -0
  468. package/dist/lib/template.d.ts +24 -0
  469. package/dist/lib/template.d.ts.map +1 -0
  470. package/dist/lib/template.js +57 -0
  471. package/dist/lib/template.js.map +1 -0
  472. package/dist/lib/types.d.ts +282 -0
  473. package/dist/lib/types.d.ts.map +1 -0
  474. package/dist/lib/types.js +18 -0
  475. package/dist/lib/types.js.map +1 -0
  476. package/dist/lib/usage.d.ts +73 -0
  477. package/dist/lib/usage.d.ts.map +1 -0
  478. package/dist/lib/usage.js +623 -0
  479. package/dist/lib/usage.js.map +1 -0
  480. package/dist/lib/versions.d.ts +248 -0
  481. package/dist/lib/versions.d.ts.map +1 -0
  482. package/dist/lib/versions.js +1737 -0
  483. package/dist/lib/versions.js.map +1 -0
  484. package/package.json +82 -0
  485. package/scripts/postinstall.js +72 -0
  486. package/scripts/rebuild-sqlite.sh +46 -0
@@ -0,0 +1,826 @@
1
+ import { extractFileOpsFromBash } from './file_ops.js';
2
+ const claudeToolUseMap = new Map();
3
+ export function normalizeEvents(agentType, raw) {
4
+ if (agentType === 'codex') {
5
+ return normalizeCodex(raw);
6
+ }
7
+ else if (agentType === 'cursor') {
8
+ return normalizeCursor(raw);
9
+ }
10
+ else if (agentType === 'gemini') {
11
+ return normalizeGemini(raw);
12
+ }
13
+ else if (agentType === 'claude') {
14
+ return normalizeClaude(raw);
15
+ }
16
+ else if (agentType === 'opencode') {
17
+ return normalizeOpencode(raw);
18
+ }
19
+ const timestamp = new Date().toISOString();
20
+ return [{
21
+ type: raw.type || 'unknown',
22
+ agent: agentType,
23
+ raw: raw,
24
+ timestamp: timestamp,
25
+ }];
26
+ }
27
+ export function normalizeEvent(agentType, raw) {
28
+ const events = normalizeEvents(agentType, raw);
29
+ if (events.length > 0) {
30
+ return events[0];
31
+ }
32
+ return {
33
+ type: raw.type || 'unknown',
34
+ agent: agentType,
35
+ raw: raw,
36
+ timestamp: new Date().toISOString(),
37
+ };
38
+ }
39
+ function normalizeCodex(raw) {
40
+ if (!raw || typeof raw !== 'object') {
41
+ return [{
42
+ type: 'unknown',
43
+ agent: 'codex',
44
+ raw: raw,
45
+ timestamp: new Date().toISOString(),
46
+ }];
47
+ }
48
+ const eventType = raw.type || 'unknown';
49
+ const timestamp = new Date().toISOString();
50
+ if (eventType === 'thread.started') {
51
+ return [{
52
+ type: 'init',
53
+ agent: 'codex',
54
+ session_id: raw.thread_id || null,
55
+ timestamp: timestamp,
56
+ }];
57
+ }
58
+ else if (eventType === 'turn.started') {
59
+ return [{
60
+ type: 'turn_start',
61
+ agent: 'codex',
62
+ timestamp: timestamp,
63
+ }];
64
+ }
65
+ else if (eventType === 'item.completed') {
66
+ const item = raw.item || {};
67
+ const itemType = item?.type;
68
+ if (itemType === 'agent_message') {
69
+ return [{
70
+ type: 'message',
71
+ agent: 'codex',
72
+ content: item?.text || '',
73
+ complete: true,
74
+ timestamp: timestamp,
75
+ }];
76
+ }
77
+ else if (itemType === 'command_execution') {
78
+ const command = item?.command || '';
79
+ if (!command.trim()) {
80
+ return [];
81
+ }
82
+ const events = [{
83
+ type: 'bash',
84
+ agent: 'codex',
85
+ tool: 'command_execution',
86
+ command: command,
87
+ timestamp: timestamp,
88
+ }];
89
+ const [filesRead, filesWritten, filesDeleted] = extractFileOpsFromBash(command);
90
+ for (const path of filesRead) {
91
+ events.push({
92
+ type: 'file_read',
93
+ agent: 'codex',
94
+ tool: 'bash',
95
+ path,
96
+ command,
97
+ timestamp,
98
+ });
99
+ }
100
+ for (const path of filesWritten) {
101
+ events.push({
102
+ type: 'file_write',
103
+ agent: 'codex',
104
+ tool: 'bash',
105
+ path,
106
+ command,
107
+ timestamp,
108
+ });
109
+ }
110
+ for (const path of filesDeleted) {
111
+ events.push({
112
+ type: 'file_delete',
113
+ agent: 'codex',
114
+ tool: 'bash',
115
+ path,
116
+ command,
117
+ timestamp,
118
+ });
119
+ }
120
+ return events;
121
+ }
122
+ else if (itemType === 'file_change') {
123
+ const changes = Array.isArray(item?.changes) ? item.changes : [];
124
+ const changeEvents = [];
125
+ for (const change of changes) {
126
+ const path = change?.path || change?.file_path || '';
127
+ if (!path) {
128
+ continue;
129
+ }
130
+ const kind = String(change?.kind || change?.status || '').toLowerCase();
131
+ const baseEvent = {
132
+ agent: 'codex',
133
+ tool: 'file_change',
134
+ path,
135
+ timestamp,
136
+ };
137
+ if (['add', 'create', 'new'].includes(kind)) {
138
+ changeEvents.push({ ...baseEvent, type: 'file_create' });
139
+ }
140
+ else if (['delete', 'remove'].includes(kind)) {
141
+ changeEvents.push({ ...baseEvent, type: 'file_delete' });
142
+ }
143
+ else {
144
+ changeEvents.push({ ...baseEvent, type: 'file_write' });
145
+ }
146
+ }
147
+ if (changeEvents.length > 0) {
148
+ return changeEvents;
149
+ }
150
+ }
151
+ else if (itemType === 'tool_call') {
152
+ const toolName = item?.name || 'unknown';
153
+ const toolArgs = item?.arguments || {};
154
+ if (toolName === 'create_file') {
155
+ const path = toolArgs?.path || toolArgs?.file_path || '';
156
+ if (!path) {
157
+ return [];
158
+ }
159
+ return [{
160
+ type: 'file_create',
161
+ agent: 'codex',
162
+ tool: toolName,
163
+ path: path,
164
+ timestamp: timestamp,
165
+ }];
166
+ }
167
+ else if (toolName === 'write_file' || toolName === 'edit_file') {
168
+ const path = toolArgs?.path || toolArgs?.file_path || '';
169
+ if (!path) {
170
+ return [];
171
+ }
172
+ return [{
173
+ type: 'file_write',
174
+ agent: 'codex',
175
+ tool: toolName,
176
+ path: path,
177
+ timestamp: timestamp,
178
+ }];
179
+ }
180
+ else if (toolName === 'read_file') {
181
+ const path = toolArgs?.path || toolArgs?.file_path || '';
182
+ if (!path) {
183
+ return [];
184
+ }
185
+ return [{
186
+ type: 'file_read',
187
+ agent: 'codex',
188
+ tool: toolName,
189
+ path: path,
190
+ timestamp: timestamp,
191
+ }];
192
+ }
193
+ else if (toolName === 'delete_file' || toolName === 'remove_file') {
194
+ const path = toolArgs?.path || toolArgs?.file_path || '';
195
+ if (!path) {
196
+ return [];
197
+ }
198
+ return [{
199
+ type: 'file_delete',
200
+ agent: 'codex',
201
+ tool: toolName,
202
+ path: path,
203
+ timestamp: timestamp,
204
+ }];
205
+ }
206
+ else if (toolName === 'shell' || toolName === 'bash' || toolName === 'execute') {
207
+ const command = toolArgs?.command || '';
208
+ if (!command.trim()) {
209
+ return [];
210
+ }
211
+ return [{
212
+ type: 'bash',
213
+ agent: 'codex',
214
+ tool: toolName,
215
+ command: command,
216
+ timestamp: timestamp,
217
+ }];
218
+ }
219
+ else {
220
+ return [{
221
+ type: 'tool_use',
222
+ agent: 'codex',
223
+ tool: toolName,
224
+ args: toolArgs,
225
+ timestamp: timestamp,
226
+ }];
227
+ }
228
+ }
229
+ }
230
+ else if (eventType === 'turn.completed') {
231
+ const usage = raw.usage || {};
232
+ return [{
233
+ type: 'result',
234
+ agent: 'codex',
235
+ status: 'success',
236
+ usage: {
237
+ input_tokens: usage?.input_tokens || 0,
238
+ output_tokens: usage?.output_tokens || 0,
239
+ },
240
+ timestamp: timestamp,
241
+ }];
242
+ }
243
+ return [{
244
+ type: eventType,
245
+ agent: 'codex',
246
+ raw: raw,
247
+ timestamp: timestamp,
248
+ }];
249
+ }
250
+ function normalizeCursor(raw) {
251
+ const eventType = raw.type || 'unknown';
252
+ const subtype = raw.subtype;
253
+ const timestamp = new Date().toISOString();
254
+ if (eventType === 'system' && subtype === 'init') {
255
+ return [{
256
+ type: 'init',
257
+ agent: 'cursor',
258
+ model: raw.model,
259
+ session_id: raw.session_id,
260
+ timestamp: timestamp,
261
+ }];
262
+ }
263
+ else if (eventType === 'thinking') {
264
+ if (subtype === 'delta') {
265
+ const text = raw.text || '';
266
+ if (!text.trim()) {
267
+ return [];
268
+ }
269
+ }
270
+ return [{
271
+ type: 'thinking',
272
+ agent: 'cursor',
273
+ content: raw.text || '',
274
+ complete: subtype === 'completed',
275
+ timestamp: timestamp,
276
+ }];
277
+ }
278
+ else if (eventType === 'assistant') {
279
+ const message = raw.message || {};
280
+ const contentBlocks = message.content || [];
281
+ const events = [];
282
+ let textContent = '';
283
+ for (const block of contentBlocks) {
284
+ if (block.type === 'text') {
285
+ textContent += block.text || '';
286
+ }
287
+ else if (block.type === 'tool_use') {
288
+ events.push({
289
+ type: 'tool_use',
290
+ agent: 'cursor',
291
+ tool: block.name || 'unknown',
292
+ args: block.input || {},
293
+ timestamp: timestamp,
294
+ });
295
+ }
296
+ }
297
+ if (textContent) {
298
+ events.push({
299
+ type: 'message',
300
+ agent: 'cursor',
301
+ content: textContent,
302
+ complete: true,
303
+ timestamp: timestamp,
304
+ });
305
+ }
306
+ if (events.length === 0) {
307
+ events.push({
308
+ type: 'message',
309
+ agent: 'cursor',
310
+ content: '',
311
+ complete: true,
312
+ timestamp: timestamp,
313
+ });
314
+ }
315
+ return events;
316
+ }
317
+ else if (eventType === 'result') {
318
+ return [{
319
+ type: 'result',
320
+ agent: 'cursor',
321
+ status: subtype || 'success',
322
+ duration_ms: raw.duration_ms,
323
+ timestamp: timestamp,
324
+ }];
325
+ }
326
+ else if (eventType === 'tool_result') {
327
+ return [{
328
+ type: 'tool_result',
329
+ agent: 'cursor',
330
+ tool: raw.tool_name || 'unknown',
331
+ success: raw.success !== false,
332
+ timestamp: timestamp,
333
+ }];
334
+ }
335
+ else if (eventType === 'tool_call' && subtype === 'completed') {
336
+ const toolCall = raw.tool_call;
337
+ if (toolCall?.shellToolCall) {
338
+ const command = toolCall.shellToolCall.args?.command || '';
339
+ return [{
340
+ type: 'bash',
341
+ agent: 'cursor',
342
+ tool: 'shell',
343
+ command: command,
344
+ timestamp: timestamp,
345
+ }];
346
+ }
347
+ else if (toolCall?.editToolCall) {
348
+ const filePath = toolCall.editToolCall.args?.path || '';
349
+ return [{
350
+ type: 'file_write',
351
+ agent: 'cursor',
352
+ tool: 'edit',
353
+ path: filePath,
354
+ timestamp: timestamp,
355
+ }];
356
+ }
357
+ else if (toolCall?.readToolCall) {
358
+ const filePath = toolCall.readToolCall.args?.path || '';
359
+ return [{
360
+ type: 'file_read',
361
+ agent: 'cursor',
362
+ tool: 'read',
363
+ path: filePath,
364
+ timestamp: timestamp,
365
+ }];
366
+ }
367
+ else if (toolCall?.deleteToolCall) {
368
+ const filePath = toolCall.deleteToolCall.args?.path || '';
369
+ return [{
370
+ type: 'file_delete',
371
+ agent: 'cursor',
372
+ tool: 'delete',
373
+ path: filePath,
374
+ timestamp: timestamp,
375
+ }];
376
+ }
377
+ else if (toolCall?.listToolCall) {
378
+ const dirPath = toolCall.listToolCall.args?.path || '';
379
+ return [{
380
+ type: 'directory_list',
381
+ agent: 'cursor',
382
+ tool: 'list',
383
+ path: dirPath,
384
+ timestamp: timestamp,
385
+ }];
386
+ }
387
+ return [{
388
+ type: 'tool_use',
389
+ agent: 'cursor',
390
+ tool: Object.keys(toolCall || {})[0] || 'unknown',
391
+ timestamp: timestamp,
392
+ }];
393
+ }
394
+ return [{
395
+ type: eventType,
396
+ agent: 'cursor',
397
+ raw: raw,
398
+ timestamp: timestamp,
399
+ }];
400
+ }
401
+ function normalizeGemini(raw) {
402
+ if (!raw || typeof raw !== 'object') {
403
+ return [{
404
+ type: 'unknown',
405
+ agent: 'gemini',
406
+ raw: raw,
407
+ timestamp: new Date().toISOString(),
408
+ }];
409
+ }
410
+ const eventType = raw?.type || 'unknown';
411
+ const timestamp = raw?.timestamp || new Date().toISOString();
412
+ if (eventType === 'init') {
413
+ return [{
414
+ type: 'init',
415
+ agent: 'gemini',
416
+ model: raw?.model,
417
+ session_id: raw?.session_id,
418
+ timestamp: timestamp,
419
+ }];
420
+ }
421
+ else if (eventType === 'message') {
422
+ const role = raw?.role || 'assistant';
423
+ if (role === 'assistant') {
424
+ return [{
425
+ type: 'message',
426
+ agent: 'gemini',
427
+ content: raw?.content || '',
428
+ complete: !raw?.delta,
429
+ timestamp: timestamp,
430
+ }];
431
+ }
432
+ else {
433
+ return [{
434
+ type: 'user_message',
435
+ agent: 'gemini',
436
+ content: raw?.content || '',
437
+ timestamp: timestamp,
438
+ }];
439
+ }
440
+ }
441
+ else if (eventType === 'tool_call' || eventType === 'tool_use') {
442
+ const toolNameRaw = raw?.tool_name || raw?.name || 'unknown';
443
+ const toolName = String(toolNameRaw);
444
+ let toolArgsRaw = raw?.parameters;
445
+ if (toolArgsRaw === null || toolArgsRaw === undefined) {
446
+ toolArgsRaw = raw?.args;
447
+ }
448
+ const toolArgs = (typeof toolArgsRaw === 'object' && toolArgsRaw !== null) ? toolArgsRaw : {};
449
+ const toolNameLower = toolName.toLowerCase();
450
+ const filePath = toolArgs?.file_path || toolArgs?.path || '';
451
+ const command = toolArgs?.command || '';
452
+ // File write/edit tools - Gemini uses 'replace', 'edit', 'patch', 'write_file', etc.
453
+ const writeTools = ['replace', 'edit', 'patch', 'write_file', 'edit_file', 'update_file', 'modify_file'];
454
+ if (writeTools.includes(toolNameLower) || (toolNameLower.includes('write') && toolNameLower.includes('file'))) {
455
+ if (!filePath.trim()) {
456
+ return [];
457
+ }
458
+ return [{
459
+ type: 'file_write',
460
+ agent: 'gemini',
461
+ tool: toolName,
462
+ path: filePath,
463
+ timestamp: timestamp,
464
+ }];
465
+ }
466
+ // File read tools
467
+ const readTools = ['read_file', 'view_file', 'cat_file', 'get_file'];
468
+ if (readTools.includes(toolNameLower) || (toolNameLower.includes('read') && toolNameLower.includes('file'))) {
469
+ if (!filePath.trim()) {
470
+ return [];
471
+ }
472
+ return [{
473
+ type: 'file_read',
474
+ agent: 'gemini',
475
+ tool: toolName,
476
+ path: filePath,
477
+ timestamp: timestamp,
478
+ }];
479
+ }
480
+ // File delete tools
481
+ const deleteTools = ['delete_file', 'remove_file', 'rm_file'];
482
+ if (deleteTools.includes(toolNameLower) || (toolNameLower.includes('delete') && toolNameLower.includes('file'))) {
483
+ if (!filePath.trim()) {
484
+ return [];
485
+ }
486
+ return [{
487
+ type: 'file_delete',
488
+ agent: 'gemini',
489
+ tool: toolName,
490
+ path: filePath,
491
+ timestamp: timestamp,
492
+ }];
493
+ }
494
+ // Shell/bash tools
495
+ if (['shell', 'bash', 'execute', 'run_command', 'run_shell_command'].includes(toolNameLower)) {
496
+ if (!command.trim()) {
497
+ return [];
498
+ }
499
+ return [{
500
+ type: 'bash',
501
+ agent: 'gemini',
502
+ tool: toolName,
503
+ command: command,
504
+ timestamp: timestamp,
505
+ }];
506
+ }
507
+ return [{
508
+ type: 'tool_use',
509
+ agent: 'gemini',
510
+ tool: toolName,
511
+ args: toolArgs,
512
+ timestamp: timestamp,
513
+ }];
514
+ }
515
+ else if (eventType === 'result') {
516
+ const stats = raw?.stats || {};
517
+ return [{
518
+ type: 'result',
519
+ agent: 'gemini',
520
+ status: raw?.status || 'success',
521
+ duration_ms: stats?.duration_ms,
522
+ usage: {
523
+ total_tokens: stats?.total_tokens || 0,
524
+ },
525
+ timestamp: timestamp,
526
+ }];
527
+ }
528
+ return [{
529
+ type: eventType,
530
+ agent: 'gemini',
531
+ raw: raw,
532
+ timestamp: timestamp,
533
+ }];
534
+ }
535
+ function normalizeClaude(raw) {
536
+ const eventType = raw.type || 'unknown';
537
+ const subtype = raw.subtype;
538
+ const timestamp = new Date().toISOString();
539
+ if (eventType === 'system' && subtype === 'init') {
540
+ return [{
541
+ type: 'init',
542
+ agent: 'claude',
543
+ model: raw.model,
544
+ session_id: raw.session_id,
545
+ timestamp: timestamp,
546
+ }];
547
+ }
548
+ else if (eventType === 'assistant') {
549
+ const message = raw.message || {};
550
+ const contentBlocks = message.content || [];
551
+ const events = [];
552
+ let textContent = '';
553
+ for (const block of contentBlocks) {
554
+ if (block.type === 'text') {
555
+ textContent += block.text || '';
556
+ }
557
+ else if (block.type === 'tool_use') {
558
+ const toolName = block.name || 'unknown';
559
+ const toolId = block.id;
560
+ const toolInput = block.input || {};
561
+ if (toolId) {
562
+ if (toolName === 'Bash' && toolInput.command) {
563
+ claudeToolUseMap.set(toolId, { tool: toolName, command: toolInput.command });
564
+ }
565
+ else if ((toolName === 'Edit' || toolName === 'Write') && toolInput.file_path) {
566
+ claudeToolUseMap.set(toolId, { tool: toolName, path: toolInput.file_path });
567
+ }
568
+ else if (toolName === 'Read' && toolInput.file_path) {
569
+ claudeToolUseMap.set(toolId, { tool: toolName, path: toolInput.file_path });
570
+ }
571
+ }
572
+ events.push({
573
+ type: 'tool_use',
574
+ agent: 'claude',
575
+ tool: toolName,
576
+ args: toolInput,
577
+ timestamp: timestamp,
578
+ });
579
+ }
580
+ }
581
+ if (textContent) {
582
+ events.push({
583
+ type: 'message',
584
+ agent: 'claude',
585
+ content: textContent,
586
+ complete: true,
587
+ timestamp: timestamp,
588
+ });
589
+ }
590
+ if (events.length === 0) {
591
+ events.push({
592
+ type: 'message',
593
+ agent: 'claude',
594
+ content: '',
595
+ complete: true,
596
+ timestamp: timestamp,
597
+ });
598
+ }
599
+ return events;
600
+ }
601
+ else if (eventType === 'user') {
602
+ const message = raw.message || {};
603
+ const contentBlocks = message.content || [];
604
+ const toolUseResult = raw.tool_use_result;
605
+ const events = [];
606
+ for (const block of contentBlocks) {
607
+ if (block.type === 'tool_result') {
608
+ const toolUseId = block.tool_use_id;
609
+ if (toolUseResult?.file) {
610
+ events.push({
611
+ type: 'file_read',
612
+ agent: 'claude',
613
+ path: toolUseResult.file.filePath,
614
+ timestamp: timestamp,
615
+ });
616
+ }
617
+ else if (toolUseResult?.stdout !== undefined) {
618
+ const toolUseInfo = claudeToolUseMap.get(toolUseId);
619
+ const command = toolUseInfo?.command || '';
620
+ events.push({
621
+ type: 'bash',
622
+ agent: 'claude',
623
+ command: command,
624
+ timestamp: timestamp,
625
+ });
626
+ claudeToolUseMap.delete(toolUseId);
627
+ }
628
+ else if (!block.is_error && typeof toolUseResult !== 'string') {
629
+ const toolUseInfo = claudeToolUseMap.get(toolUseId);
630
+ if (toolUseInfo && (toolUseInfo.tool === 'Edit' || toolUseInfo.tool === 'Write') && toolUseInfo.path) {
631
+ events.push({
632
+ type: 'file_write',
633
+ agent: 'claude',
634
+ path: toolUseInfo.path,
635
+ timestamp: timestamp,
636
+ });
637
+ claudeToolUseMap.delete(toolUseId);
638
+ }
639
+ else {
640
+ events.push({
641
+ type: 'tool_result',
642
+ agent: 'claude',
643
+ tool_use_id: toolUseId,
644
+ success: true,
645
+ timestamp: timestamp,
646
+ });
647
+ if (toolUseInfo) {
648
+ claudeToolUseMap.delete(toolUseId);
649
+ }
650
+ }
651
+ }
652
+ else if (block.is_error || (typeof toolUseResult === 'string' && toolUseResult.startsWith('Error:'))) {
653
+ events.push({
654
+ type: 'error',
655
+ agent: 'claude',
656
+ message: block.content || (typeof toolUseResult === 'string' ? toolUseResult : ''),
657
+ timestamp: timestamp,
658
+ });
659
+ }
660
+ else {
661
+ const toolUseInfo = claudeToolUseMap.get(toolUseId);
662
+ events.push({
663
+ type: 'tool_result',
664
+ agent: 'claude',
665
+ tool_use_id: toolUseId,
666
+ success: !block.is_error,
667
+ timestamp: timestamp,
668
+ });
669
+ if (toolUseInfo) {
670
+ claudeToolUseMap.delete(toolUseId);
671
+ }
672
+ }
673
+ }
674
+ }
675
+ return events.length > 0 ? events : [{
676
+ type: eventType,
677
+ agent: 'claude',
678
+ raw: raw,
679
+ timestamp: timestamp,
680
+ }];
681
+ }
682
+ else if (eventType === 'result') {
683
+ return [{
684
+ type: 'result',
685
+ agent: 'claude',
686
+ status: subtype || 'success',
687
+ duration_ms: raw.duration_ms,
688
+ timestamp: timestamp,
689
+ }];
690
+ }
691
+ return [{
692
+ type: eventType,
693
+ agent: 'claude',
694
+ raw: raw,
695
+ timestamp: timestamp,
696
+ }];
697
+ }
698
+ // --- OpenCode parsing ---
699
+ // OpenCode outputs JSON events with step_start, tool_use, text, step_finish types
700
+ function normalizeOpencode(raw) {
701
+ if (!raw || typeof raw !== 'object') {
702
+ return [{
703
+ type: 'unknown',
704
+ agent: 'opencode',
705
+ raw: raw,
706
+ timestamp: new Date().toISOString(),
707
+ }];
708
+ }
709
+ const eventType = raw?.type || 'unknown';
710
+ const timestamp = raw?.timestamp ? new Date(raw.timestamp).toISOString() : new Date().toISOString();
711
+ const part = raw?.part || {};
712
+ if (eventType === 'step_start' || eventType === 'step-start') {
713
+ return [{
714
+ type: 'init',
715
+ agent: 'opencode',
716
+ session_id: part?.sessionID || null,
717
+ timestamp: timestamp,
718
+ }];
719
+ }
720
+ if (eventType === 'tool_use') {
721
+ const toolName = part?.tool || 'unknown';
722
+ const state = part?.state || {};
723
+ const input = state?.input || {};
724
+ const status = state?.status || 'unknown';
725
+ const events = [];
726
+ if (toolName === 'bash' && input?.command) {
727
+ events.push({
728
+ type: 'bash',
729
+ agent: 'opencode',
730
+ tool: toolName,
731
+ command: input.command,
732
+ timestamp: timestamp,
733
+ });
734
+ const [filesRead, filesWritten, filesDeleted] = extractFileOpsFromBash(input.command);
735
+ for (const path of filesRead) {
736
+ events.push({ type: 'file_read', agent: 'opencode', tool: 'bash', path, command: input.command, timestamp });
737
+ }
738
+ for (const path of filesWritten) {
739
+ events.push({ type: 'file_write', agent: 'opencode', tool: 'bash', path, command: input.command, timestamp });
740
+ }
741
+ for (const path of filesDeleted) {
742
+ events.push({ type: 'file_delete', agent: 'opencode', tool: 'bash', path, command: input.command, timestamp });
743
+ }
744
+ return events;
745
+ }
746
+ const filePath = input?.path || input?.file_path || '';
747
+ if (toolName === 'edit_file' || toolName === 'write_file' || toolName === 'create_file') {
748
+ if (filePath.trim()) {
749
+ return [{
750
+ type: 'file_write',
751
+ agent: 'opencode',
752
+ tool: toolName,
753
+ path: filePath,
754
+ timestamp: timestamp,
755
+ }];
756
+ }
757
+ }
758
+ if (toolName === 'read_file' || toolName === 'view_file') {
759
+ if (filePath.trim()) {
760
+ return [{
761
+ type: 'file_read',
762
+ agent: 'opencode',
763
+ tool: toolName,
764
+ path: filePath,
765
+ timestamp: timestamp,
766
+ }];
767
+ }
768
+ }
769
+ if (toolName === 'delete_file' || toolName === 'remove_file') {
770
+ if (filePath.trim()) {
771
+ return [{
772
+ type: 'file_delete',
773
+ agent: 'opencode',
774
+ tool: toolName,
775
+ path: filePath,
776
+ timestamp: timestamp,
777
+ }];
778
+ }
779
+ }
780
+ return [{
781
+ type: 'tool_use',
782
+ agent: 'opencode',
783
+ tool: toolName,
784
+ args: input,
785
+ timestamp: timestamp,
786
+ }];
787
+ }
788
+ if (eventType === 'text') {
789
+ const text = part?.text || '';
790
+ return [{
791
+ type: 'message',
792
+ agent: 'opencode',
793
+ content: text,
794
+ complete: true,
795
+ timestamp: timestamp,
796
+ }];
797
+ }
798
+ if (eventType === 'step_finish' || eventType === 'step-finish') {
799
+ const reason = part?.reason || 'unknown';
800
+ const status = reason === 'stop' ? 'success' : (reason === 'error' ? 'error' : 'success');
801
+ return [{
802
+ type: 'result',
803
+ agent: 'opencode',
804
+ status: status,
805
+ cost: part?.cost || 0,
806
+ tokens: part?.tokens || {},
807
+ timestamp: timestamp,
808
+ }];
809
+ }
810
+ return [{
811
+ type: eventType,
812
+ agent: 'opencode',
813
+ raw: raw,
814
+ timestamp: timestamp,
815
+ }];
816
+ }
817
+ export function parseEvent(agentType, line) {
818
+ try {
819
+ const raw = JSON.parse(line);
820
+ return normalizeEvents(agentType, raw);
821
+ }
822
+ catch {
823
+ return null;
824
+ }
825
+ }
826
+ //# sourceMappingURL=parsers.js.map