@swarmify/agents-cli 1.12.0 → 1.13.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.
- package/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +209 -233
- package/dist/commands/__tests__/sessions.test.js +90 -20
- package/dist/commands/__tests__/sessions.test.js.map +1 -1
- package/dist/commands/cloud.d.ts +11 -0
- package/dist/commands/cloud.d.ts.map +1 -0
- package/dist/commands/cloud.js +363 -0
- package/dist/commands/cloud.js.map +1 -0
- package/dist/commands/commands.d.ts +9 -0
- package/dist/commands/commands.d.ts.map +1 -1
- package/dist/commands/commands.js +330 -139
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/daemon.d.ts +8 -0
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +38 -222
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/drive.d.ts +8 -0
- package/dist/commands/drive.d.ts.map +1 -1
- package/dist/commands/drive.js +70 -7
- package/dist/commands/drive.js.map +1 -1
- package/dist/commands/exec.d.ts +9 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +198 -24
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/factory.d.ts +11 -0
- package/dist/commands/factory.d.ts.map +1 -0
- package/dist/commands/factory.js +445 -0
- package/dist/commands/factory.js.map +1 -0
- package/dist/commands/fork.d.ts +8 -0
- package/dist/commands/fork.d.ts.map +1 -1
- package/dist/commands/fork.js +38 -4
- package/dist/commands/fork.js.map +1 -1
- package/dist/commands/hooks.d.ts +9 -0
- package/dist/commands/hooks.d.ts.map +1 -1
- package/dist/commands/hooks.js +252 -18
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.d.ts +15 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +137 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +250 -169
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/models.d.ts +11 -0
- package/dist/commands/models.d.ts.map +1 -0
- package/dist/commands/models.js +170 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/packages.d.ts +8 -0
- package/dist/commands/packages.d.ts.map +1 -1
- package/dist/commands/packages.js +155 -14
- package/dist/commands/packages.js.map +1 -1
- package/dist/commands/permissions.d.ts +9 -0
- package/dist/commands/permissions.d.ts.map +1 -1
- package/dist/commands/permissions.js +72 -13
- package/dist/commands/permissions.js.map +1 -1
- package/dist/commands/plugins.d.ts +8 -0
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +265 -44
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/profiles.d.ts +12 -0
- package/dist/commands/profiles.d.ts.map +1 -0
- package/dist/commands/profiles.js +255 -0
- package/dist/commands/profiles.js.map +1 -0
- package/dist/commands/pty.d.ts +1 -0
- package/dist/commands/pty.d.ts.map +1 -1
- package/dist/commands/pty.js +133 -22
- package/dist/commands/pty.js.map +1 -1
- package/dist/commands/pull.d.ts +8 -0
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +103 -14
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.d.ts +8 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +37 -3
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/refresh-memory.d.ts +16 -0
- package/dist/commands/refresh-memory.d.ts.map +1 -0
- package/dist/commands/refresh-memory.js +52 -0
- package/dist/commands/refresh-memory.js.map +1 -0
- package/dist/commands/resource-view.d.ts +39 -0
- package/dist/commands/resource-view.d.ts.map +1 -0
- package/dist/commands/resource-view.js +197 -0
- package/dist/commands/resource-view.js.map +1 -0
- package/dist/commands/routines.d.ts +8 -0
- package/dist/commands/routines.d.ts.map +1 -1
- package/dist/commands/routines.js +163 -34
- package/dist/commands/routines.js.map +1 -1
- package/dist/commands/rules.d.ts +9 -0
- package/dist/commands/rules.d.ts.map +1 -1
- package/dist/commands/rules.js +83 -12
- package/dist/commands/rules.js.map +1 -1
- package/dist/commands/secrets.d.ts +11 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +352 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/sessions-picker.d.ts +18 -0
- package/dist/commands/sessions-picker.d.ts.map +1 -0
- package/dist/commands/sessions-picker.js +265 -0
- package/dist/commands/sessions-picker.js.map +1 -0
- package/dist/commands/sessions.d.ts +15 -0
- package/dist/commands/sessions.d.ts.map +1 -1
- package/dist/commands/sessions.js +700 -263
- package/dist/commands/sessions.js.map +1 -1
- package/dist/commands/skills.d.ts +9 -0
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +355 -233
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +7 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/subagents.d.ts +8 -0
- package/dist/commands/subagents.d.ts.map +1 -1
- package/dist/commands/subagents.js +214 -74
- package/dist/commands/subagents.js.map +1 -1
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +15 -7
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/teams-picker.d.ts +18 -0
- package/dist/commands/teams-picker.d.ts.map +1 -0
- package/dist/commands/teams-picker.js +290 -0
- package/dist/commands/teams-picker.js.map +1 -0
- package/dist/commands/teams.d.ts +18 -0
- package/dist/commands/teams.d.ts.map +1 -0
- package/dist/commands/teams.js +1098 -0
- package/dist/commands/teams.js.map +1 -0
- package/dist/commands/utils.d.ts +20 -0
- package/dist/commands/utils.d.ts.map +1 -1
- package/dist/commands/utils.js +34 -0
- package/dist/commands/utils.js.map +1 -1
- package/dist/commands/versions.d.ts +8 -0
- package/dist/commands/versions.d.ts.map +1 -1
- package/dist/commands/versions.js +71 -8
- package/dist/commands/versions.js.map +1 -1
- package/dist/commands/view.d.ts +34 -1
- package/dist/commands/view.d.ts.map +1 -1
- package/dist/commands/view.js +207 -13
- package/dist/commands/view.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +136 -51
- package/dist/index.js.map +1 -1
- package/dist/lib/__tests__/bugfixes.test.js +3 -3
- package/dist/lib/__tests__/bugfixes.test.js.map +1 -1
- package/dist/lib/__tests__/exec.test.js +125 -19
- package/dist/lib/__tests__/exec.test.js.map +1 -1
- package/dist/lib/__tests__/hooks.test.d.ts +2 -0
- package/dist/lib/__tests__/hooks.test.d.ts.map +1 -0
- package/dist/lib/__tests__/hooks.test.js +203 -0
- package/dist/lib/__tests__/hooks.test.js.map +1 -0
- package/dist/lib/__tests__/memory-compile.test.d.ts +2 -0
- package/dist/lib/__tests__/memory-compile.test.d.ts.map +1 -0
- package/dist/lib/__tests__/memory-compile.test.js +95 -0
- package/dist/lib/__tests__/memory-compile.test.js.map +1 -0
- package/dist/lib/__tests__/models.test.d.ts +2 -0
- package/dist/lib/__tests__/models.test.d.ts.map +1 -0
- package/dist/lib/__tests__/models.test.js +239 -0
- package/dist/lib/__tests__/models.test.js.map +1 -0
- package/dist/lib/__tests__/rotate.test.d.ts +2 -0
- package/dist/lib/__tests__/rotate.test.d.ts.map +1 -0
- package/dist/lib/__tests__/rotate.test.js +80 -0
- package/dist/lib/__tests__/rotate.test.js.map +1 -0
- package/dist/lib/__tests__/secrets-bundles.test.d.ts +2 -0
- package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +1 -0
- package/dist/lib/__tests__/secrets-bundles.test.js +104 -0
- package/dist/lib/__tests__/secrets-bundles.test.js.map +1 -0
- package/dist/lib/__tests__/secrets.test.d.ts +2 -0
- package/dist/lib/__tests__/secrets.test.d.ts.map +1 -0
- package/dist/lib/__tests__/secrets.test.js +90 -0
- package/dist/lib/__tests__/secrets.test.js.map +1 -0
- package/dist/lib/__tests__/shims.test.d.ts +2 -0
- package/dist/lib/__tests__/shims.test.d.ts.map +1 -0
- package/dist/lib/__tests__/shims.test.js +39 -0
- package/dist/lib/__tests__/shims.test.js.map +1 -0
- package/dist/lib/__tests__/usage.test.js +4 -2
- package/dist/lib/__tests__/usage.test.js.map +1 -1
- package/dist/lib/__tests__/versions.test.d.ts +2 -0
- package/dist/lib/__tests__/versions.test.d.ts.map +1 -0
- package/dist/lib/__tests__/versions.test.js +63 -0
- package/dist/lib/__tests__/versions.test.js.map +1 -0
- package/dist/lib/agents.d.ts +53 -1
- package/dist/lib/agents.d.ts.map +1 -1
- package/dist/lib/agents.js +178 -37
- package/dist/lib/agents.js.map +1 -1
- package/dist/lib/artifact-actions.d.ts +8 -3
- package/dist/lib/artifact-actions.d.ts.map +1 -1
- package/dist/lib/artifact-actions.js +8 -5
- package/dist/lib/artifact-actions.js.map +1 -1
- package/dist/lib/cloud/codex.d.ts +26 -0
- package/dist/lib/cloud/codex.d.ts.map +1 -0
- package/dist/lib/cloud/codex.js +237 -0
- package/dist/lib/cloud/codex.js.map +1 -0
- package/dist/lib/cloud/factory.d.ts +32 -0
- package/dist/lib/cloud/factory.d.ts.map +1 -0
- package/dist/lib/cloud/factory.js +43 -0
- package/dist/lib/cloud/factory.js.map +1 -0
- package/dist/lib/cloud/registry.d.ts +16 -0
- package/dist/lib/cloud/registry.d.ts.map +1 -0
- package/dist/lib/cloud/registry.js +68 -0
- package/dist/lib/cloud/registry.js.map +1 -0
- package/dist/lib/cloud/rush.d.ts +37 -0
- package/dist/lib/cloud/rush.d.ts.map +1 -0
- package/dist/lib/cloud/rush.js +230 -0
- package/dist/lib/cloud/rush.js.map +1 -0
- package/dist/lib/cloud/rush.test.d.ts +2 -0
- package/dist/lib/cloud/rush.test.d.ts.map +1 -0
- package/dist/lib/cloud/rush.test.js +63 -0
- package/dist/lib/cloud/rush.test.js.map +1 -0
- package/dist/lib/cloud/store.d.ts +23 -0
- package/dist/lib/cloud/store.d.ts.map +1 -0
- package/dist/lib/cloud/store.js +116 -0
- package/dist/lib/cloud/store.js.map +1 -0
- package/dist/lib/cloud/stream.d.ts +24 -0
- package/dist/lib/cloud/stream.d.ts.map +1 -0
- package/dist/lib/cloud/stream.js +145 -0
- package/dist/lib/cloud/stream.js.map +1 -0
- package/dist/lib/cloud/types.d.ts +109 -0
- package/dist/lib/cloud/types.d.ts.map +1 -0
- package/dist/lib/cloud/types.js +33 -0
- package/dist/lib/cloud/types.js.map +1 -0
- package/dist/lib/cloud/types.test.d.ts +2 -0
- package/dist/lib/cloud/types.test.d.ts.map +1 -0
- package/dist/lib/cloud/types.test.js +41 -0
- package/dist/lib/cloud/types.test.js.map +1 -0
- package/dist/lib/commands.d.ts +67 -0
- package/dist/lib/commands.d.ts.map +1 -1
- package/dist/lib/commands.js +161 -2
- package/dist/lib/commands.js.map +1 -1
- package/dist/lib/convert.d.ts +10 -0
- package/dist/lib/convert.d.ts.map +1 -1
- package/dist/lib/convert.js +9 -0
- package/dist/lib/convert.js.map +1 -1
- package/dist/lib/daemon.d.ts +21 -0
- package/dist/lib/daemon.d.ts.map +1 -1
- package/dist/lib/daemon.js +21 -0
- package/dist/lib/daemon.js.map +1 -1
- package/dist/lib/drive-sync.d.ts +18 -0
- package/dist/lib/drive-sync.d.ts.map +1 -1
- package/dist/lib/drive-sync.js +16 -0
- package/dist/lib/drive-sync.js.map +1 -1
- package/dist/lib/exec.d.ts +64 -3
- package/dist/lib/exec.d.ts.map +1 -1
- package/dist/lib/exec.js +218 -80
- package/dist/lib/exec.js.map +1 -1
- package/dist/lib/factory/__tests__/config.test.d.ts +2 -0
- package/dist/lib/factory/__tests__/config.test.d.ts.map +1 -0
- package/dist/lib/factory/__tests__/config.test.js +128 -0
- package/dist/lib/factory/__tests__/config.test.js.map +1 -0
- package/dist/lib/factory/config.d.ts +49 -0
- package/dist/lib/factory/config.d.ts.map +1 -0
- package/dist/lib/factory/config.js +127 -0
- package/dist/lib/factory/config.js.map +1 -0
- package/dist/lib/factory.js +1 -1
- package/dist/lib/factory.js.map +1 -1
- package/dist/lib/git.d.ts +16 -1
- package/dist/lib/git.d.ts.map +1 -1
- package/dist/lib/git.js +33 -4
- package/dist/lib/git.js.map +1 -1
- package/dist/lib/help.d.ts +7 -0
- package/dist/lib/help.d.ts.map +1 -1
- package/dist/lib/help.js +3 -0
- package/dist/lib/help.js.map +1 -1
- package/dist/lib/hooks.d.ts +59 -3
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +413 -33
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/ledger/__tests__/local.test.d.ts +2 -0
- package/dist/lib/ledger/__tests__/local.test.d.ts.map +1 -0
- package/dist/lib/ledger/__tests__/local.test.js +177 -0
- package/dist/lib/ledger/__tests__/local.test.js.map +1 -0
- package/dist/lib/ledger/__tests__/sync.test.d.ts +2 -0
- package/dist/lib/ledger/__tests__/sync.test.d.ts.map +1 -0
- package/dist/lib/ledger/__tests__/sync.test.js +117 -0
- package/dist/lib/ledger/__tests__/sync.test.js.map +1 -0
- package/dist/lib/ledger/index.d.ts +18 -0
- package/dist/lib/ledger/index.d.ts.map +1 -0
- package/dist/lib/ledger/index.js +32 -0
- package/dist/lib/ledger/index.js.map +1 -0
- package/dist/lib/ledger/local.d.ts +22 -0
- package/dist/lib/ledger/local.d.ts.map +1 -0
- package/dist/lib/ledger/local.js +333 -0
- package/dist/lib/ledger/local.js.map +1 -0
- package/dist/lib/ledger/r2.d.ts +41 -0
- package/dist/lib/ledger/r2.d.ts.map +1 -0
- package/dist/lib/ledger/r2.js +335 -0
- package/dist/lib/ledger/r2.js.map +1 -0
- package/dist/lib/ledger/sync.d.ts +33 -0
- package/dist/lib/ledger/sync.d.ts.map +1 -0
- package/dist/lib/ledger/sync.js +106 -0
- package/dist/lib/ledger/sync.js.map +1 -0
- package/dist/lib/ledger/types.d.ts +100 -0
- package/dist/lib/ledger/types.d.ts.map +1 -0
- package/dist/lib/ledger/types.js +21 -0
- package/dist/lib/ledger/types.js.map +1 -0
- package/dist/lib/manifest.d.ts +6 -0
- package/dist/lib/manifest.d.ts.map +1 -1
- package/dist/lib/manifest.js +12 -0
- package/dist/lib/manifest.js.map +1 -1
- package/dist/lib/markdown.d.ts.map +1 -1
- package/dist/lib/markdown.js +6 -0
- package/dist/lib/markdown.js.map +1 -1
- package/dist/lib/mcp.d.ts +0 -9
- package/dist/lib/mcp.d.ts.map +1 -1
- package/dist/lib/mcp.js +0 -20
- package/dist/lib/mcp.js.map +1 -1
- package/dist/lib/memory-compile.d.ts +65 -0
- package/dist/lib/memory-compile.d.ts.map +1 -0
- package/dist/lib/memory-compile.js +174 -0
- package/dist/lib/memory-compile.js.map +1 -0
- package/dist/lib/memory.d.ts +8 -0
- package/dist/lib/memory.d.ts.map +1 -1
- package/dist/lib/memory.js +8 -0
- package/dist/lib/memory.js.map +1 -1
- package/dist/lib/models.d.ts +98 -0
- package/dist/lib/models.d.ts.map +1 -0
- package/dist/lib/models.js +722 -0
- package/dist/lib/models.js.map +1 -0
- package/dist/lib/permissions.d.ts +3 -1
- package/dist/lib/permissions.d.ts.map +1 -1
- package/dist/lib/permissions.js +13 -3
- package/dist/lib/permissions.js.map +1 -1
- package/dist/lib/picker.d.ts +27 -0
- package/dist/lib/picker.d.ts.map +1 -0
- package/dist/lib/picker.js +110 -0
- package/dist/lib/picker.js.map +1 -0
- package/dist/lib/plugins.d.ts +22 -0
- package/dist/lib/plugins.d.ts.map +1 -1
- package/dist/lib/plugins.js +114 -0
- package/dist/lib/plugins.js.map +1 -1
- package/dist/lib/profiles-keychain.d.ts +11 -0
- package/dist/lib/profiles-keychain.d.ts.map +1 -0
- package/dist/lib/profiles-keychain.js +14 -0
- package/dist/lib/profiles-keychain.js.map +1 -0
- package/dist/lib/profiles-presets.d.ts +25 -0
- package/dist/lib/profiles-presets.d.ts.map +1 -0
- package/dist/lib/profiles-presets.js +104 -0
- package/dist/lib/profiles-presets.js.map +1 -0
- package/dist/lib/profiles.d.ts +70 -0
- package/dist/lib/profiles.d.ts.map +1 -0
- package/dist/lib/profiles.js +145 -0
- package/dist/lib/profiles.js.map +1 -0
- package/dist/lib/pty-client.d.ts +1 -0
- package/dist/lib/pty-client.d.ts.map +1 -1
- package/dist/lib/pty-client.js.map +1 -1
- package/dist/lib/pty-server.d.ts +5 -0
- package/dist/lib/pty-server.d.ts.map +1 -1
- package/dist/lib/pty-server.js +5 -0
- package/dist/lib/pty-server.js.map +1 -1
- package/dist/lib/registry.d.ts +17 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +17 -0
- package/dist/lib/registry.js.map +1 -1
- package/dist/lib/resources.d.ts +5 -0
- package/dist/lib/resources.d.ts.map +1 -1
- package/dist/lib/resources.js.map +1 -1
- package/dist/lib/rotate.d.ts +58 -0
- package/dist/lib/rotate.d.ts.map +1 -0
- package/dist/lib/rotate.js +93 -0
- package/dist/lib/rotate.js.map +1 -0
- package/dist/lib/routines.d.ts +30 -1
- package/dist/lib/routines.d.ts.map +1 -1
- package/dist/lib/routines.js +31 -4
- package/dist/lib/routines.js.map +1 -1
- package/dist/lib/runner.d.ts +14 -0
- package/dist/lib/runner.d.ts.map +1 -1
- package/dist/lib/runner.js +45 -11
- package/dist/lib/runner.js.map +1 -1
- package/dist/lib/sandbox.d.ts +16 -0
- package/dist/lib/sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox.js +19 -2
- package/dist/lib/sandbox.js.map +1 -1
- package/dist/lib/scheduler.d.ts +8 -0
- package/dist/lib/scheduler.d.ts.map +1 -1
- package/dist/lib/scheduler.js +8 -0
- package/dist/lib/scheduler.js.map +1 -1
- package/dist/lib/secrets-bundles.d.ts +38 -0
- package/dist/lib/secrets-bundles.d.ts.map +1 -0
- package/dist/lib/secrets-bundles.js +176 -0
- package/dist/lib/secrets-bundles.js.map +1 -0
- package/dist/lib/secrets.d.ts +53 -0
- package/dist/lib/secrets.d.ts.map +1 -0
- package/dist/lib/secrets.js +140 -0
- package/dist/lib/secrets.js.map +1 -0
- package/dist/lib/session/__tests__/db.test.d.ts +2 -0
- package/dist/lib/session/__tests__/db.test.d.ts.map +1 -0
- package/dist/lib/session/__tests__/db.test.js +54 -0
- package/dist/lib/session/__tests__/db.test.js.map +1 -0
- package/dist/lib/session/__tests__/discover.test.js +54 -91
- package/dist/lib/session/__tests__/discover.test.js.map +1 -1
- package/dist/lib/session/__tests__/prompt.test.d.ts +2 -0
- package/dist/lib/session/__tests__/prompt.test.d.ts.map +1 -0
- package/dist/lib/session/__tests__/prompt.test.js +44 -0
- package/dist/lib/session/__tests__/prompt.test.js.map +1 -0
- package/dist/lib/session/__tests__/render.test.d.ts +2 -0
- package/dist/lib/session/__tests__/render.test.d.ts.map +1 -0
- package/dist/lib/session/__tests__/render.test.js +602 -0
- package/dist/lib/session/__tests__/render.test.js.map +1 -0
- package/dist/lib/session/artifacts.d.ts +15 -0
- package/dist/lib/session/artifacts.d.ts.map +1 -0
- package/dist/lib/session/artifacts.js +86 -0
- package/dist/lib/session/artifacts.js.map +1 -0
- package/dist/lib/session/db.d.ts +140 -0
- package/dist/lib/session/db.d.ts.map +1 -0
- package/dist/lib/session/db.js +599 -0
- package/dist/lib/session/db.js.map +1 -0
- package/dist/lib/session/discover.d.ts +44 -32
- package/dist/lib/session/discover.d.ts.map +1 -1
- package/dist/lib/session/discover.js +418 -464
- package/dist/lib/session/discover.js.map +1 -1
- package/dist/lib/session/parse.d.ts +11 -0
- package/dist/lib/session/parse.d.ts.map +1 -1
- package/dist/lib/session/parse.js +50 -0
- package/dist/lib/session/parse.js.map +1 -1
- package/dist/lib/session/prompt.d.ts +10 -0
- package/dist/lib/session/prompt.d.ts.map +1 -1
- package/dist/lib/session/prompt.js +38 -2
- package/dist/lib/session/prompt.js.map +1 -1
- package/dist/lib/session/prompt.test.d.ts +2 -0
- package/dist/lib/session/prompt.test.d.ts.map +1 -0
- package/dist/lib/session/prompt.test.js +57 -0
- package/dist/lib/session/prompt.test.js.map +1 -0
- package/dist/lib/session/render.d.ts +91 -10
- package/dist/lib/session/render.d.ts.map +1 -1
- package/dist/lib/session/render.js +708 -180
- package/dist/lib/session/render.js.map +1 -1
- package/dist/lib/session/team-filter.d.ts +35 -0
- package/dist/lib/session/team-filter.d.ts.map +1 -0
- package/dist/lib/session/team-filter.js +75 -0
- package/dist/lib/session/team-filter.js.map +1 -0
- package/dist/lib/session/team-filter.test.d.ts +2 -0
- package/dist/lib/session/team-filter.test.d.ts.map +1 -0
- package/dist/lib/session/team-filter.test.js +157 -0
- package/dist/lib/session/team-filter.test.js.map +1 -0
- package/dist/lib/session/types.d.ts +48 -6
- package/dist/lib/session/types.d.ts.map +1 -1
- package/dist/lib/session/types.js +9 -0
- package/dist/lib/session/types.js.map +1 -1
- package/dist/lib/shims.d.ts +73 -2
- package/dist/lib/shims.d.ts.map +1 -1
- package/dist/lib/shims.js +171 -25
- package/dist/lib/shims.js.map +1 -1
- package/dist/lib/skills.d.ts +68 -0
- package/dist/lib/skills.d.ts.map +1 -1
- package/dist/lib/skills.js +267 -1
- package/dist/lib/skills.js.map +1 -1
- package/dist/lib/state.d.ts +41 -2
- package/dist/lib/state.d.ts.map +1 -1
- package/dist/lib/state.js +63 -4
- package/dist/lib/state.js.map +1 -1
- package/dist/lib/subagents.d.ts +9 -0
- package/dist/lib/subagents.d.ts.map +1 -1
- package/dist/lib/subagents.js +9 -1
- package/dist/lib/subagents.js.map +1 -1
- package/dist/lib/teams/__tests__/oracle.test.d.ts +2 -0
- package/dist/lib/teams/__tests__/oracle.test.d.ts.map +1 -0
- package/dist/lib/teams/__tests__/oracle.test.js +89 -0
- package/dist/lib/teams/__tests__/oracle.test.js.map +1 -0
- package/dist/lib/teams/__tests__/supervisor.test.d.ts +2 -0
- package/dist/lib/teams/__tests__/supervisor.test.d.ts.map +1 -0
- package/dist/lib/teams/__tests__/supervisor.test.js +179 -0
- package/dist/lib/teams/__tests__/supervisor.test.js.map +1 -0
- package/dist/lib/teams/agents.d.ts +247 -0
- package/dist/lib/teams/agents.d.ts.map +1 -0
- package/dist/lib/teams/agents.js +1244 -0
- package/dist/lib/teams/agents.js.map +1 -0
- package/dist/lib/teams/api.d.ts +91 -0
- package/dist/lib/teams/api.d.ts.map +1 -0
- package/dist/lib/teams/api.js +239 -0
- package/dist/lib/teams/api.js.map +1 -0
- package/dist/lib/teams/cloud.d.ts +11 -0
- package/dist/lib/teams/cloud.d.ts.map +1 -0
- package/dist/lib/teams/cloud.js +169 -0
- package/dist/lib/teams/cloud.js.map +1 -0
- package/dist/lib/teams/debug.d.ts +8 -0
- package/dist/lib/teams/debug.d.ts.map +1 -0
- package/dist/lib/teams/debug.js +12 -0
- package/dist/lib/teams/debug.js.map +1 -0
- package/dist/lib/teams/file_ops.d.ts +13 -0
- package/dist/lib/teams/file_ops.d.ts.map +1 -0
- package/dist/lib/teams/file_ops.js +66 -0
- package/dist/lib/teams/file_ops.js.map +1 -0
- package/dist/lib/teams/index.d.ts +16 -0
- package/dist/lib/teams/index.d.ts.map +1 -0
- package/dist/lib/teams/index.js +15 -0
- package/dist/lib/teams/index.js.map +1 -0
- package/dist/lib/teams/oracle.d.ts +20 -0
- package/dist/lib/teams/oracle.d.ts.map +1 -0
- package/dist/lib/teams/oracle.js +59 -0
- package/dist/lib/teams/oracle.js.map +1 -0
- package/dist/lib/teams/parsers.d.ts +9 -0
- package/dist/lib/teams/parsers.d.ts.map +1 -0
- package/dist/lib/teams/parsers.js +837 -0
- package/dist/lib/teams/parsers.js.map +1 -0
- package/dist/lib/teams/persistence.d.ts +43 -0
- package/dist/lib/teams/persistence.d.ts.map +1 -0
- package/dist/lib/teams/persistence.js +299 -0
- package/dist/lib/teams/persistence.js.map +1 -0
- package/dist/lib/teams/ralph.d.ts +8 -0
- package/dist/lib/teams/ralph.d.ts.map +1 -0
- package/dist/lib/teams/ralph.js +59 -0
- package/dist/lib/teams/ralph.js.map +1 -0
- package/dist/lib/teams/registry.d.ts +18 -0
- package/dist/lib/teams/registry.d.ts.map +1 -0
- package/dist/lib/teams/registry.js +68 -0
- package/dist/lib/teams/registry.js.map +1 -0
- package/dist/lib/teams/summarizer.d.ts +73 -0
- package/dist/lib/teams/summarizer.d.ts.map +1 -0
- package/dist/lib/teams/summarizer.js +780 -0
- package/dist/lib/teams/summarizer.js.map +1 -0
- package/dist/lib/teams/supervisor.d.ts +49 -0
- package/dist/lib/teams/supervisor.d.ts.map +1 -0
- package/dist/lib/teams/supervisor.js +74 -0
- package/dist/lib/teams/supervisor.js.map +1 -0
- package/dist/lib/template.d.ts +8 -5
- package/dist/lib/template.d.ts.map +1 -1
- package/dist/lib/template.js +8 -5
- package/dist/lib/template.js.map +1 -1
- package/dist/lib/types.d.ts +58 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +16 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/usage.d.ts +48 -0
- package/dist/lib/usage.d.ts.map +1 -1
- package/dist/lib/usage.js +103 -11
- package/dist/lib/usage.js.map +1 -1
- package/dist/lib/versions.d.ts +12 -1
- package/dist/lib/versions.d.ts.map +1 -1
- package/dist/lib/versions.js +91 -35
- package/dist/lib/versions.js.map +1 -1
- package/package.json +20 -6
- package/scripts/postinstall.js +1 -1
- package/scripts/rebuild-sqlite.sh +46 -0
- package/dist/commands/sessions.test.d.ts +0 -2
- package/dist/commands/sessions.test.d.ts.map +0 -1
- package/dist/commands/sessions.test.js +0 -53
- package/dist/commands/sessions.test.js.map +0 -1
|
@@ -0,0 +1,837 @@
|
|
|
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
|