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