@swarmify/agents-cli 1.13.4 → 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.
- package/README.md +2 -319
- package/bin/agents.js +2 -0
- package/package.json +13 -79
- package/scripts/postinstall.js +4 -71
- package/CHANGELOG.md +0 -316
- package/LICENSE +0 -21
- package/dist/commands/__tests__/sessions-tail.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions-tail.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions-tail.test.js +0 -108
- package/dist/commands/__tests__/sessions-tail.test.js.map +0 -1
- package/dist/commands/__tests__/sessions.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions.test.js +0 -636
- package/dist/commands/__tests__/sessions.test.js.map +0 -1
- package/dist/commands/cloud.d.ts +0 -11
- package/dist/commands/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.js +0 -363
- package/dist/commands/cloud.js.map +0 -1
- package/dist/commands/commands.d.ts +0 -12
- package/dist/commands/commands.d.ts.map +0 -1
- package/dist/commands/commands.js +0 -629
- package/dist/commands/commands.js.map +0 -1
- package/dist/commands/daemon.d.ts +0 -11
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -119
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drive.d.ts +0 -11
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js +0 -175
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/exec.d.ts +0 -11
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js +0 -251
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/factory.d.ts +0 -11
- package/dist/commands/factory.d.ts.map +0 -1
- package/dist/commands/factory.js +0 -445
- package/dist/commands/factory.js.map +0 -1
- package/dist/commands/fork.d.ts +0 -11
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js +0 -147
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/hooks.d.ts +0 -12
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -690
- package/dist/commands/hooks.js.map +0 -1
- package/dist/commands/init.d.ts +0 -15
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -137
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -12
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -583
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts +0 -11
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -170
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/packages.d.ts +0 -11
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/packages.js +0 -551
- package/dist/commands/packages.js.map +0 -1
- package/dist/commands/permissions.d.ts +0 -12
- package/dist/commands/permissions.d.ts.map +0 -1
- package/dist/commands/permissions.js +0 -724
- package/dist/commands/permissions.js.map +0 -1
- package/dist/commands/plugins.d.ts +0 -11
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js +0 -393
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/profiles.d.ts +0 -12
- package/dist/commands/profiles.d.ts.map +0 -1
- package/dist/commands/profiles.js +0 -255
- package/dist/commands/profiles.js.map +0 -1
- package/dist/commands/pty.d.ts +0 -21
- package/dist/commands/pty.d.ts.map +0 -1
- package/dist/commands/pty.js +0 -391
- package/dist/commands/pty.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -11
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -456
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -11
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -188
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/refresh-memory.d.ts +0 -16
- package/dist/commands/refresh-memory.d.ts.map +0 -1
- package/dist/commands/refresh-memory.js +0 -52
- package/dist/commands/refresh-memory.js.map +0 -1
- package/dist/commands/resource-view.d.ts +0 -39
- package/dist/commands/resource-view.d.ts.map +0 -1
- package/dist/commands/resource-view.js +0 -197
- package/dist/commands/resource-view.js.map +0 -1
- package/dist/commands/routines.d.ts +0 -11
- package/dist/commands/routines.d.ts.map +0 -1
- package/dist/commands/routines.js +0 -590
- package/dist/commands/routines.js.map +0 -1
- package/dist/commands/rules.d.ts +0 -12
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js +0 -489
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/secrets.d.ts +0 -11
- package/dist/commands/secrets.d.ts.map +0 -1
- package/dist/commands/secrets.js +0 -352
- package/dist/commands/secrets.js.map +0 -1
- package/dist/commands/sessions-picker.d.ts +0 -18
- package/dist/commands/sessions-picker.d.ts.map +0 -1
- package/dist/commands/sessions-picker.js +0 -265
- package/dist/commands/sessions-picker.js.map +0 -1
- package/dist/commands/sessions-tail.d.ts +0 -20
- package/dist/commands/sessions-tail.d.ts.map +0 -1
- package/dist/commands/sessions-tail.js +0 -236
- package/dist/commands/sessions-tail.js.map +0 -1
- package/dist/commands/sessions.d.ts +0 -18
- package/dist/commands/sessions.d.ts.map +0 -1
- package/dist/commands/sessions.js +0 -1173
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -12
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js +0 -717
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/status.d.ts +0 -10
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -26
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/subagents.d.ts +0 -11
- package/dist/commands/subagents.d.ts.map +0 -1
- package/dist/commands/subagents.js +0 -361
- package/dist/commands/subagents.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -11
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -70
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/teams-picker.d.ts +0 -18
- package/dist/commands/teams-picker.d.ts.map +0 -1
- package/dist/commands/teams-picker.js +0 -290
- package/dist/commands/teams-picker.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -18
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js +0 -1144
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/utils.d.ts +0 -45
- package/dist/commands/utils.d.ts.map +0 -1
- package/dist/commands/utils.js +0 -106
- package/dist/commands/utils.js.map +0 -1
- package/dist/commands/versions.d.ts +0 -11
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js +0 -701
- package/dist/commands/versions.js.map +0 -1
- package/dist/commands/view.d.ts +0 -43
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js +0 -894
- package/dist/commands/view.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -496
- package/dist/index.js.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
- package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.js +0 -192
- package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
- package/dist/lib/__tests__/exec.test.d.ts +0 -2
- package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
- package/dist/lib/__tests__/exec.test.js +0 -446
- package/dist/lib/__tests__/exec.test.js.map +0 -1
- package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
- package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
- package/dist/lib/__tests__/git-sync.test.js +0 -138
- package/dist/lib/__tests__/git-sync.test.js.map +0 -1
- package/dist/lib/__tests__/hooks.test.d.ts +0 -2
- package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
- package/dist/lib/__tests__/hooks.test.js +0 -203
- package/dist/lib/__tests__/hooks.test.js.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
- package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.js +0 -95
- package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
- package/dist/lib/__tests__/models.test.d.ts +0 -2
- package/dist/lib/__tests__/models.test.d.ts.map +0 -1
- package/dist/lib/__tests__/models.test.js +0 -239
- package/dist/lib/__tests__/models.test.js.map +0 -1
- package/dist/lib/__tests__/rotate.test.d.ts +0 -2
- package/dist/lib/__tests__/rotate.test.d.ts.map +0 -1
- package/dist/lib/__tests__/rotate.test.js +0 -80
- package/dist/lib/__tests__/rotate.test.js.map +0 -1
- package/dist/lib/__tests__/secrets-bundles.test.d.ts +0 -2
- package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +0 -1
- package/dist/lib/__tests__/secrets-bundles.test.js +0 -104
- package/dist/lib/__tests__/secrets-bundles.test.js.map +0 -1
- package/dist/lib/__tests__/secrets.test.d.ts +0 -2
- package/dist/lib/__tests__/secrets.test.d.ts.map +0 -1
- package/dist/lib/__tests__/secrets.test.js +0 -90
- package/dist/lib/__tests__/secrets.test.js.map +0 -1
- package/dist/lib/__tests__/shims.test.d.ts +0 -2
- package/dist/lib/__tests__/shims.test.d.ts.map +0 -1
- package/dist/lib/__tests__/shims.test.js +0 -57
- package/dist/lib/__tests__/shims.test.js.map +0 -1
- package/dist/lib/__tests__/usage.test.d.ts +0 -2
- package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
- package/dist/lib/__tests__/usage.test.js +0 -220
- package/dist/lib/__tests__/usage.test.js.map +0 -1
- package/dist/lib/__tests__/versions.test.d.ts +0 -2
- package/dist/lib/__tests__/versions.test.d.ts.map +0 -1
- package/dist/lib/__tests__/versions.test.js +0 -63
- package/dist/lib/__tests__/versions.test.js.map +0 -1
- package/dist/lib/agents.d.ts +0 -158
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js +0 -1159
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/artifact-actions.d.ts +0 -27
- package/dist/lib/artifact-actions.d.ts.map +0 -1
- package/dist/lib/artifact-actions.js +0 -58
- package/dist/lib/artifact-actions.js.map +0 -1
- package/dist/lib/cloud/codex.d.ts +0 -26
- package/dist/lib/cloud/codex.d.ts.map +0 -1
- package/dist/lib/cloud/codex.js +0 -237
- package/dist/lib/cloud/codex.js.map +0 -1
- package/dist/lib/cloud/factory.d.ts +0 -32
- package/dist/lib/cloud/factory.d.ts.map +0 -1
- package/dist/lib/cloud/factory.js +0 -43
- package/dist/lib/cloud/factory.js.map +0 -1
- package/dist/lib/cloud/registry.d.ts +0 -16
- package/dist/lib/cloud/registry.d.ts.map +0 -1
- package/dist/lib/cloud/registry.js +0 -68
- package/dist/lib/cloud/registry.js.map +0 -1
- package/dist/lib/cloud/rush.d.ts +0 -37
- package/dist/lib/cloud/rush.d.ts.map +0 -1
- package/dist/lib/cloud/rush.js +0 -230
- package/dist/lib/cloud/rush.js.map +0 -1
- package/dist/lib/cloud/rush.test.d.ts +0 -2
- package/dist/lib/cloud/rush.test.d.ts.map +0 -1
- package/dist/lib/cloud/rush.test.js +0 -63
- package/dist/lib/cloud/rush.test.js.map +0 -1
- package/dist/lib/cloud/store.d.ts +0 -23
- package/dist/lib/cloud/store.d.ts.map +0 -1
- package/dist/lib/cloud/store.js +0 -116
- package/dist/lib/cloud/store.js.map +0 -1
- package/dist/lib/cloud/stream.d.ts +0 -24
- package/dist/lib/cloud/stream.d.ts.map +0 -1
- package/dist/lib/cloud/stream.js +0 -145
- package/dist/lib/cloud/stream.js.map +0 -1
- package/dist/lib/cloud/types.d.ts +0 -109
- package/dist/lib/cloud/types.d.ts.map +0 -1
- package/dist/lib/cloud/types.js +0 -33
- package/dist/lib/cloud/types.js.map +0 -1
- package/dist/lib/cloud/types.test.d.ts +0 -2
- package/dist/lib/cloud/types.test.d.ts.map +0 -1
- package/dist/lib/cloud/types.test.js +0 -41
- package/dist/lib/cloud/types.test.js.map +0 -1
- package/dist/lib/commands.d.ts +0 -141
- package/dist/lib/commands.d.ts.map +0 -1
- package/dist/lib/commands.js +0 -514
- package/dist/lib/commands.js.map +0 -1
- package/dist/lib/convert.d.ts +0 -21
- package/dist/lib/convert.d.ts.map +0 -1
- package/dist/lib/convert.js +0 -54
- package/dist/lib/convert.js.map +0 -1
- package/dist/lib/daemon.d.ts +0 -43
- package/dist/lib/daemon.d.ts.map +0 -1
- package/dist/lib/daemon.js +0 -332
- package/dist/lib/daemon.js.map +0 -1
- package/dist/lib/drive-sync.d.ts +0 -46
- package/dist/lib/drive-sync.d.ts.map +0 -1
- package/dist/lib/drive-sync.js +0 -209
- package/dist/lib/drive-sync.js.map +0 -1
- package/dist/lib/exec.d.ts +0 -101
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js +0 -450
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/factory/__tests__/config.test.d.ts +0 -2
- package/dist/lib/factory/__tests__/config.test.d.ts.map +0 -1
- package/dist/lib/factory/__tests__/config.test.js +0 -128
- package/dist/lib/factory/__tests__/config.test.js.map +0 -1
- package/dist/lib/factory/config.d.ts +0 -49
- package/dist/lib/factory/config.d.ts.map +0 -1
- package/dist/lib/factory/config.js +0 -127
- package/dist/lib/factory/config.js.map +0 -1
- package/dist/lib/factory.d.ts +0 -57
- package/dist/lib/factory.d.ts.map +0 -1
- package/dist/lib/factory.js +0 -107
- package/dist/lib/factory.js.map +0 -1
- package/dist/lib/git.d.ts +0 -157
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js +0 -647
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/help.d.ts +0 -10
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js +0 -66
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/hooks.d.ts +0 -125
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js +0 -846
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/ledger/__tests__/local.test.d.ts +0 -2
- package/dist/lib/ledger/__tests__/local.test.d.ts.map +0 -1
- package/dist/lib/ledger/__tests__/local.test.js +0 -177
- package/dist/lib/ledger/__tests__/local.test.js.map +0 -1
- package/dist/lib/ledger/__tests__/sync.test.d.ts +0 -2
- package/dist/lib/ledger/__tests__/sync.test.d.ts.map +0 -1
- package/dist/lib/ledger/__tests__/sync.test.js +0 -117
- package/dist/lib/ledger/__tests__/sync.test.js.map +0 -1
- package/dist/lib/ledger/index.d.ts +0 -18
- package/dist/lib/ledger/index.d.ts.map +0 -1
- package/dist/lib/ledger/index.js +0 -32
- package/dist/lib/ledger/index.js.map +0 -1
- package/dist/lib/ledger/local.d.ts +0 -22
- package/dist/lib/ledger/local.d.ts.map +0 -1
- package/dist/lib/ledger/local.js +0 -333
- package/dist/lib/ledger/local.js.map +0 -1
- package/dist/lib/ledger/r2.d.ts +0 -41
- package/dist/lib/ledger/r2.d.ts.map +0 -1
- package/dist/lib/ledger/r2.js +0 -335
- package/dist/lib/ledger/r2.js.map +0 -1
- package/dist/lib/ledger/sync.d.ts +0 -33
- package/dist/lib/ledger/sync.d.ts.map +0 -1
- package/dist/lib/ledger/sync.js +0 -106
- package/dist/lib/ledger/sync.js.map +0 -1
- package/dist/lib/ledger/types.d.ts +0 -100
- package/dist/lib/ledger/types.d.ts.map +0 -1
- package/dist/lib/ledger/types.js +0 -21
- package/dist/lib/ledger/types.js.map +0 -1
- package/dist/lib/manifest.d.ts +0 -14
- package/dist/lib/manifest.d.ts.map +0 -1
- package/dist/lib/manifest.js +0 -48
- package/dist/lib/manifest.js.map +0 -1
- package/dist/lib/markdown.d.ts +0 -5
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/markdown.js +0 -17
- package/dist/lib/markdown.js.map +0 -1
- package/dist/lib/mcp.d.ts +0 -64
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js +0 -327
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/memory-compile.d.ts +0 -65
- package/dist/lib/memory-compile.d.ts.map +0 -1
- package/dist/lib/memory-compile.js +0 -174
- package/dist/lib/memory-compile.js.map +0 -1
- package/dist/lib/memory.d.ts +0 -64
- package/dist/lib/memory.d.ts.map +0 -1
- package/dist/lib/memory.js +0 -275
- package/dist/lib/memory.js.map +0 -1
- package/dist/lib/models.d.ts +0 -98
- package/dist/lib/models.d.ts.map +0 -1
- package/dist/lib/models.js +0 -728
- package/dist/lib/models.js.map +0 -1
- package/dist/lib/permissions.d.ts +0 -227
- package/dist/lib/permissions.d.ts.map +0 -1
- package/dist/lib/permissions.js +0 -1085
- package/dist/lib/permissions.js.map +0 -1
- package/dist/lib/picker.d.ts +0 -27
- package/dist/lib/picker.d.ts.map +0 -1
- package/dist/lib/picker.js +0 -110
- package/dist/lib/picker.js.map +0 -1
- package/dist/lib/plugins.d.ts +0 -80
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/lib/plugins.js +0 -556
- package/dist/lib/plugins.js.map +0 -1
- package/dist/lib/profiles-keychain.d.ts +0 -11
- package/dist/lib/profiles-keychain.d.ts.map +0 -1
- package/dist/lib/profiles-keychain.js +0 -14
- package/dist/lib/profiles-keychain.js.map +0 -1
- package/dist/lib/profiles-presets.d.ts +0 -25
- package/dist/lib/profiles-presets.d.ts.map +0 -1
- package/dist/lib/profiles-presets.js +0 -104
- package/dist/lib/profiles-presets.js.map +0 -1
- package/dist/lib/profiles.d.ts +0 -70
- package/dist/lib/profiles.d.ts.map +0 -1
- package/dist/lib/profiles.js +0 -145
- package/dist/lib/profiles.js.map +0 -1
- package/dist/lib/pty-client.d.ts +0 -23
- package/dist/lib/pty-client.d.ts.map +0 -1
- package/dist/lib/pty-client.js +0 -181
- package/dist/lib/pty-client.js.map +0 -1
- package/dist/lib/pty-server.d.ts +0 -21
- package/dist/lib/pty-server.d.ts.map +0 -1
- package/dist/lib/pty-server.js +0 -427
- package/dist/lib/pty-server.js.map +0 -1
- package/dist/lib/registry.d.ts +0 -45
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js +0 -220
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resources.d.ts +0 -55
- package/dist/lib/resources.d.ts.map +0 -1
- package/dist/lib/resources.js +0 -103
- package/dist/lib/resources.js.map +0 -1
- package/dist/lib/rotate.d.ts +0 -58
- package/dist/lib/rotate.d.ts.map +0 -1
- package/dist/lib/rotate.js +0 -93
- package/dist/lib/rotate.js.map +0 -1
- package/dist/lib/routines.d.ts +0 -99
- package/dist/lib/routines.d.ts.map +0 -1
- package/dist/lib/routines.js +0 -352
- package/dist/lib/routines.js.map +0 -1
- package/dist/lib/runner.d.ts +0 -26
- package/dist/lib/runner.d.ts.map +0 -1
- package/dist/lib/runner.js +0 -325
- package/dist/lib/runner.js.map +0 -1
- package/dist/lib/sandbox.d.ts +0 -26
- package/dist/lib/sandbox.d.ts.map +0 -1
- package/dist/lib/sandbox.js +0 -218
- package/dist/lib/sandbox.js.map +0 -1
- package/dist/lib/scheduler.d.ts +0 -26
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.js +0 -77
- package/dist/lib/scheduler.js.map +0 -1
- package/dist/lib/secrets-bundles.d.ts +0 -38
- package/dist/lib/secrets-bundles.d.ts.map +0 -1
- package/dist/lib/secrets-bundles.js +0 -176
- package/dist/lib/secrets-bundles.js.map +0 -1
- package/dist/lib/secrets.d.ts +0 -53
- package/dist/lib/secrets.d.ts.map +0 -1
- package/dist/lib/secrets.js +0 -140
- package/dist/lib/secrets.js.map +0 -1
- package/dist/lib/session/__tests__/db.test.d.ts +0 -2
- package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/db.test.js +0 -54
- package/dist/lib/session/__tests__/db.test.js.map +0 -1
- package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
- package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/discover.test.js +0 -63
- package/dist/lib/session/__tests__/discover.test.js.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
- package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.js +0 -44
- package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
- package/dist/lib/session/__tests__/render.test.d.ts +0 -2
- package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/render.test.js +0 -602
- package/dist/lib/session/__tests__/render.test.js.map +0 -1
- package/dist/lib/session/active.d.ts +0 -44
- package/dist/lib/session/active.d.ts.map +0 -1
- package/dist/lib/session/active.js +0 -379
- package/dist/lib/session/active.js.map +0 -1
- package/dist/lib/session/artifacts.d.ts +0 -15
- package/dist/lib/session/artifacts.d.ts.map +0 -1
- package/dist/lib/session/artifacts.js +0 -86
- package/dist/lib/session/artifacts.js.map +0 -1
- package/dist/lib/session/db.d.ts +0 -140
- package/dist/lib/session/db.d.ts.map +0 -1
- package/dist/lib/session/db.js +0 -599
- package/dist/lib/session/db.js.map +0 -1
- package/dist/lib/session/discover.d.ts +0 -72
- package/dist/lib/session/discover.d.ts.map +0 -1
- package/dist/lib/session/discover.js +0 -1315
- package/dist/lib/session/discover.js.map +0 -1
- package/dist/lib/session/parse.d.ts +0 -34
- package/dist/lib/session/parse.d.ts.map +0 -1
- package/dist/lib/session/parse.js +0 -663
- package/dist/lib/session/parse.js.map +0 -1
- package/dist/lib/session/prompt.d.ts +0 -13
- package/dist/lib/session/prompt.d.ts.map +0 -1
- package/dist/lib/session/prompt.js +0 -79
- package/dist/lib/session/prompt.js.map +0 -1
- package/dist/lib/session/prompt.test.d.ts +0 -2
- package/dist/lib/session/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/prompt.test.js +0 -57
- package/dist/lib/session/prompt.test.js.map +0 -1
- package/dist/lib/session/render.d.ts +0 -103
- package/dist/lib/session/render.d.ts.map +0 -1
- package/dist/lib/session/render.js +0 -798
- package/dist/lib/session/render.js.map +0 -1
- package/dist/lib/session/team-filter.d.ts +0 -35
- package/dist/lib/session/team-filter.d.ts.map +0 -1
- package/dist/lib/session/team-filter.js +0 -75
- package/dist/lib/session/team-filter.js.map +0 -1
- package/dist/lib/session/team-filter.test.d.ts +0 -2
- package/dist/lib/session/team-filter.test.d.ts.map +0 -1
- package/dist/lib/session/team-filter.test.js +0 -157
- package/dist/lib/session/team-filter.test.js.map +0 -1
- package/dist/lib/session/types.d.ts +0 -84
- package/dist/lib/session/types.d.ts.map +0 -1
- package/dist/lib/session/types.js +0 -11
- package/dist/lib/session/types.js.map +0 -1
- package/dist/lib/shims.d.ts +0 -272
- package/dist/lib/shims.d.ts.map +0 -1
- package/dist/lib/shims.js +0 -1322
- package/dist/lib/shims.js.map +0 -1
- package/dist/lib/skills.d.ts +0 -142
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js +0 -791
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/state.d.ts +0 -87
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js +0 -333
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/subagents.d.ts +0 -84
- package/dist/lib/subagents.d.ts.map +0 -1
- package/dist/lib/subagents.js +0 -410
- package/dist/lib/subagents.js.map +0 -1
- package/dist/lib/teams/__tests__/oracle.test.d.ts +0 -2
- package/dist/lib/teams/__tests__/oracle.test.d.ts.map +0 -1
- package/dist/lib/teams/__tests__/oracle.test.js +0 -89
- package/dist/lib/teams/__tests__/oracle.test.js.map +0 -1
- package/dist/lib/teams/__tests__/supervisor.test.d.ts +0 -2
- package/dist/lib/teams/__tests__/supervisor.test.d.ts.map +0 -1
- package/dist/lib/teams/__tests__/supervisor.test.js +0 -179
- package/dist/lib/teams/__tests__/supervisor.test.js.map +0 -1
- package/dist/lib/teams/agents.d.ts +0 -247
- package/dist/lib/teams/agents.d.ts.map +0 -1
- package/dist/lib/teams/agents.js +0 -1244
- package/dist/lib/teams/agents.js.map +0 -1
- package/dist/lib/teams/api.d.ts +0 -91
- package/dist/lib/teams/api.d.ts.map +0 -1
- package/dist/lib/teams/api.js +0 -239
- package/dist/lib/teams/api.js.map +0 -1
- package/dist/lib/teams/cloud.d.ts +0 -11
- package/dist/lib/teams/cloud.d.ts.map +0 -1
- package/dist/lib/teams/cloud.js +0 -169
- package/dist/lib/teams/cloud.js.map +0 -1
- package/dist/lib/teams/debug.d.ts +0 -8
- package/dist/lib/teams/debug.d.ts.map +0 -1
- package/dist/lib/teams/debug.js +0 -12
- package/dist/lib/teams/debug.js.map +0 -1
- package/dist/lib/teams/file_ops.d.ts +0 -13
- package/dist/lib/teams/file_ops.d.ts.map +0 -1
- package/dist/lib/teams/file_ops.js +0 -66
- package/dist/lib/teams/file_ops.js.map +0 -1
- package/dist/lib/teams/index.d.ts +0 -16
- package/dist/lib/teams/index.d.ts.map +0 -1
- package/dist/lib/teams/index.js +0 -15
- package/dist/lib/teams/index.js.map +0 -1
- package/dist/lib/teams/oracle.d.ts +0 -20
- package/dist/lib/teams/oracle.d.ts.map +0 -1
- package/dist/lib/teams/oracle.js +0 -59
- package/dist/lib/teams/oracle.js.map +0 -1
- package/dist/lib/teams/parsers.d.ts +0 -9
- package/dist/lib/teams/parsers.d.ts.map +0 -1
- package/dist/lib/teams/parsers.js +0 -837
- package/dist/lib/teams/parsers.js.map +0 -1
- package/dist/lib/teams/persistence.d.ts +0 -43
- package/dist/lib/teams/persistence.d.ts.map +0 -1
- package/dist/lib/teams/persistence.js +0 -299
- package/dist/lib/teams/persistence.js.map +0 -1
- package/dist/lib/teams/ralph.d.ts +0 -8
- package/dist/lib/teams/ralph.d.ts.map +0 -1
- package/dist/lib/teams/ralph.js +0 -59
- package/dist/lib/teams/ralph.js.map +0 -1
- package/dist/lib/teams/registry.d.ts +0 -18
- package/dist/lib/teams/registry.d.ts.map +0 -1
- package/dist/lib/teams/registry.js +0 -68
- package/dist/lib/teams/registry.js.map +0 -1
- package/dist/lib/teams/summarizer.d.ts +0 -73
- package/dist/lib/teams/summarizer.d.ts.map +0 -1
- package/dist/lib/teams/summarizer.js +0 -780
- package/dist/lib/teams/summarizer.js.map +0 -1
- package/dist/lib/teams/supervisor.d.ts +0 -49
- package/dist/lib/teams/supervisor.d.ts.map +0 -1
- package/dist/lib/teams/supervisor.js +0 -74
- package/dist/lib/teams/supervisor.js.map +0 -1
- package/dist/lib/template.d.ts +0 -27
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js +0 -60
- package/dist/lib/template.js.map +0 -1
- package/dist/lib/types.d.ts +0 -331
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js +0 -29
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage.d.ts +0 -105
- package/dist/lib/usage.d.ts.map +0 -1
- package/dist/lib/usage.js +0 -686
- package/dist/lib/usage.js.map +0 -1
- package/dist/lib/versions.d.ts +0 -253
- package/dist/lib/versions.d.ts.map +0 -1
- package/dist/lib/versions.js +0 -1796
- package/dist/lib/versions.js.map +0 -1
- package/scripts/rebuild-sqlite.sh +0 -46
|
@@ -1,663 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session file parsers for Claude, Codex, Gemini, and OpenCode.
|
|
3
|
-
*
|
|
4
|
-
* Each agent stores sessions in a different format (JSONL, JSON, SQLite).
|
|
5
|
-
* This module normalizes all of them into a flat array of SessionEvent
|
|
6
|
-
* objects suitable for rendering, filtering, and summarization.
|
|
7
|
-
*/
|
|
8
|
-
import * as fs from 'fs';
|
|
9
|
-
import { execSync } from 'child_process';
|
|
10
|
-
/**
|
|
11
|
-
* Auto-detect agent type from file path and parse the session.
|
|
12
|
-
*/
|
|
13
|
-
export function parseSession(filePath, agent) {
|
|
14
|
-
const detected = agent || detectAgent(filePath);
|
|
15
|
-
if (!detected) {
|
|
16
|
-
throw new Error(`Cannot detect agent type from path: ${filePath}`);
|
|
17
|
-
}
|
|
18
|
-
switch (detected) {
|
|
19
|
-
case 'claude': return parseClaude(filePath);
|
|
20
|
-
case 'codex': return parseCodex(filePath);
|
|
21
|
-
case 'gemini': return parseGemini(filePath);
|
|
22
|
-
case 'opencode': return parseOpenCode(filePath);
|
|
23
|
-
case 'openclaw': return []; // OpenClaw sessions don't have parseable files yet
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/** Infer the agent type from a session file path using known directory conventions. */
|
|
27
|
-
export function detectAgent(filePath) {
|
|
28
|
-
if (filePath.includes('/.claude/') || filePath.includes('\\.claude\\'))
|
|
29
|
-
return 'claude';
|
|
30
|
-
if (filePath.includes('/.codex/') || filePath.includes('\\.codex\\'))
|
|
31
|
-
return 'codex';
|
|
32
|
-
if (filePath.includes('/.gemini/') || filePath.includes('\\.gemini\\'))
|
|
33
|
-
return 'gemini';
|
|
34
|
-
if (filePath.includes('opencode.db'))
|
|
35
|
-
return 'opencode';
|
|
36
|
-
// Try file extension + content heuristic
|
|
37
|
-
if (filePath.endsWith('.json'))
|
|
38
|
-
return 'gemini';
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Summarize a tool_use into a one-liner string.
|
|
43
|
-
*/
|
|
44
|
-
export function summarizeToolUse(tool, args) {
|
|
45
|
-
if (!args)
|
|
46
|
-
return tool;
|
|
47
|
-
switch (tool) {
|
|
48
|
-
case 'Bash':
|
|
49
|
-
return `Bash: ${truncate(String(args.command || '').replace(/\n/g, ' ').trim(), 120)}`;
|
|
50
|
-
case 'Read':
|
|
51
|
-
return `Read ${shortenPath(args.file_path || '')}`;
|
|
52
|
-
case 'Write':
|
|
53
|
-
return `Write ${shortenPath(args.file_path || '')}`;
|
|
54
|
-
case 'Edit':
|
|
55
|
-
return `Edit ${shortenPath(args.file_path || '')}`;
|
|
56
|
-
case 'Glob':
|
|
57
|
-
return `Glob ${args.pattern || ''}`;
|
|
58
|
-
case 'Grep':
|
|
59
|
-
return `Grep ${args.pattern || ''} ${args.path || ''}`.trim();
|
|
60
|
-
case 'Agent':
|
|
61
|
-
return `Agent: ${truncate(args.description || args.prompt || '', 80)}`;
|
|
62
|
-
case 'WebSearch':
|
|
63
|
-
case 'WebFetch':
|
|
64
|
-
return `${tool}: ${truncate(args.query || args.url || '', 80)}`;
|
|
65
|
-
// Codex tools
|
|
66
|
-
case 'exec_command':
|
|
67
|
-
return `Bash: ${truncate(String(args.command || args.cmd || '').replace(/\n/g, ' ').trim(), 120)}`;
|
|
68
|
-
case 'read_file':
|
|
69
|
-
return `Read ${shortenPath(args.file_path || args.path || '')}`;
|
|
70
|
-
case 'write_file':
|
|
71
|
-
case 'create_file':
|
|
72
|
-
return `Write ${shortenPath(args.file_path || args.path || '')}`;
|
|
73
|
-
case 'edit_file':
|
|
74
|
-
return `Edit ${shortenPath(args.file_path || args.path || '')}`;
|
|
75
|
-
// Gemini tools
|
|
76
|
-
case 'run_shell_command':
|
|
77
|
-
return `Bash: ${truncate(String(args.command || '').replace(/\n/g, ' ').trim(), 120)}`;
|
|
78
|
-
case 'search_file_content':
|
|
79
|
-
return `Search ${args.pattern || ''}`;
|
|
80
|
-
default: {
|
|
81
|
-
// Generic: show first meaningful arg
|
|
82
|
-
for (const key of ['file_path', 'path', 'pattern', 'command', 'prompt', 'query', 'url']) {
|
|
83
|
-
if (args[key])
|
|
84
|
-
return `${tool}: ${truncate(String(args[key]), 80)}`;
|
|
85
|
-
}
|
|
86
|
-
return tool;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/** Truncate a string to n characters, appending '...' if shortened. */
|
|
91
|
-
function truncate(s, n) {
|
|
92
|
-
return s.length <= n ? s : s.slice(0, n - 3) + '...';
|
|
93
|
-
}
|
|
94
|
-
/** Replace the home directory prefix with ~ for display. */
|
|
95
|
-
function shortenPath(p) {
|
|
96
|
-
const home = process.env.HOME || '';
|
|
97
|
-
if (home && p.startsWith(home))
|
|
98
|
-
return '~' + p.slice(home.length);
|
|
99
|
-
return p;
|
|
100
|
-
}
|
|
101
|
-
// ---------------------------------------------------------------------------
|
|
102
|
-
// Claude parser
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
|
-
/** Parse a Claude JSONL session file into normalized events. */
|
|
105
|
-
export function parseClaude(filePath) {
|
|
106
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
107
|
-
const lines = content.split('\n').filter(l => l.trim());
|
|
108
|
-
const events = [];
|
|
109
|
-
// Map tool_use id -> {tool, args} for correlating with tool_result
|
|
110
|
-
const toolUseMap = new Map();
|
|
111
|
-
for (const line of lines) {
|
|
112
|
-
let raw;
|
|
113
|
-
try {
|
|
114
|
-
raw = JSON.parse(line);
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
/* malformed JSONL line, skip */
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const type = raw.type;
|
|
121
|
-
const timestamp = raw.timestamp || new Date().toISOString();
|
|
122
|
-
if (type === 'assistant') {
|
|
123
|
-
const contentBlocks = raw.message?.content || [];
|
|
124
|
-
for (const block of contentBlocks) {
|
|
125
|
-
if (block.type === 'thinking') {
|
|
126
|
-
// Thinking content -- may be encrypted (has .signature field)
|
|
127
|
-
const thinkingText = block.thinking || '';
|
|
128
|
-
if (thinkingText) {
|
|
129
|
-
events.push({
|
|
130
|
-
type: 'thinking',
|
|
131
|
-
agent: 'claude',
|
|
132
|
-
timestamp,
|
|
133
|
-
content: thinkingText,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else if (block.type === 'text') {
|
|
138
|
-
const text = (block.text || '').trim();
|
|
139
|
-
if (text) {
|
|
140
|
-
events.push({
|
|
141
|
-
type: 'message',
|
|
142
|
-
agent: 'claude',
|
|
143
|
-
timestamp,
|
|
144
|
-
role: 'assistant',
|
|
145
|
-
content: text,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else if (block.type === 'tool_use') {
|
|
150
|
-
const toolName = block.name || 'unknown';
|
|
151
|
-
const toolInput = block.input || {};
|
|
152
|
-
const toolId = block.id;
|
|
153
|
-
const isLocal = toolInput.is_local === true;
|
|
154
|
-
if (toolId) {
|
|
155
|
-
toolUseMap.set(toolId, { tool: toolName, args: toolInput });
|
|
156
|
-
}
|
|
157
|
-
const event = {
|
|
158
|
-
type: 'tool_use',
|
|
159
|
-
agent: 'claude',
|
|
160
|
-
timestamp,
|
|
161
|
-
tool: toolName,
|
|
162
|
-
args: toolInput,
|
|
163
|
-
path: toolInput.file_path || undefined,
|
|
164
|
-
command: toolName === 'Bash' ? toolInput.command : undefined,
|
|
165
|
-
};
|
|
166
|
-
if (isLocal)
|
|
167
|
-
event._local = true;
|
|
168
|
-
events.push(event);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
// Capture token usage and model from assistant turn
|
|
172
|
-
if (raw.message?.usage) {
|
|
173
|
-
const u = raw.message.usage;
|
|
174
|
-
events.push({
|
|
175
|
-
type: 'usage',
|
|
176
|
-
agent: 'claude',
|
|
177
|
-
timestamp,
|
|
178
|
-
model: raw.message.model,
|
|
179
|
-
inputTokens: u.input_tokens,
|
|
180
|
-
outputTokens: u.output_tokens,
|
|
181
|
-
cacheReadTokens: u.cache_read_input_tokens,
|
|
182
|
-
cacheCreationTokens: u.cache_creation_input_tokens,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
else if (type === 'user') {
|
|
187
|
-
const contentBlocks = raw.message?.content;
|
|
188
|
-
if (typeof contentBlocks === 'string') {
|
|
189
|
-
// Simple user text
|
|
190
|
-
const text = contentBlocks.trim();
|
|
191
|
-
if (text) {
|
|
192
|
-
events.push({
|
|
193
|
-
type: 'message',
|
|
194
|
-
agent: 'claude',
|
|
195
|
-
timestamp,
|
|
196
|
-
role: 'user',
|
|
197
|
-
content: text,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
else if (Array.isArray(contentBlocks)) {
|
|
202
|
-
for (const block of contentBlocks) {
|
|
203
|
-
if (block.type === 'text') {
|
|
204
|
-
const text = (block.text || '').trim();
|
|
205
|
-
if (text && !text.startsWith('[Request interrupted')) {
|
|
206
|
-
events.push({
|
|
207
|
-
type: 'message',
|
|
208
|
-
agent: 'claude',
|
|
209
|
-
timestamp,
|
|
210
|
-
role: 'user',
|
|
211
|
-
content: text,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else if (block.type === 'image') {
|
|
216
|
-
const source = block.source || {};
|
|
217
|
-
if (source.type === 'base64') {
|
|
218
|
-
const sizeBytes = Math.ceil((source.data?.length || 0) * 0.75);
|
|
219
|
-
events.push({
|
|
220
|
-
type: 'attachment',
|
|
221
|
-
agent: 'claude',
|
|
222
|
-
timestamp,
|
|
223
|
-
mediaType: source.media_type || 'image/png',
|
|
224
|
-
sizeBytes,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
else if (block.type === 'document') {
|
|
229
|
-
const source = block.source || {};
|
|
230
|
-
events.push({
|
|
231
|
-
type: 'attachment',
|
|
232
|
-
agent: 'claude',
|
|
233
|
-
timestamp,
|
|
234
|
-
mediaType: source.media_type || 'application/pdf',
|
|
235
|
-
sizeBytes: 0,
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
else if (block.type === 'tool_result') {
|
|
239
|
-
const toolId = block.tool_use_id;
|
|
240
|
-
const toolInfo = toolId ? toolUseMap.get(toolId) : undefined;
|
|
241
|
-
const isError = block.is_error === true;
|
|
242
|
-
// Extract output text from tool result
|
|
243
|
-
let output = '';
|
|
244
|
-
if (typeof block.content === 'string') {
|
|
245
|
-
output = block.content;
|
|
246
|
-
}
|
|
247
|
-
else if (Array.isArray(block.content)) {
|
|
248
|
-
output = block.content
|
|
249
|
-
.filter((c) => c.type === 'text')
|
|
250
|
-
.map((c) => c.text || '')
|
|
251
|
-
.join('\n');
|
|
252
|
-
}
|
|
253
|
-
if (isError) {
|
|
254
|
-
events.push({
|
|
255
|
-
type: 'error',
|
|
256
|
-
agent: 'claude',
|
|
257
|
-
timestamp,
|
|
258
|
-
tool: toolInfo?.tool,
|
|
259
|
-
content: output || 'Tool execution failed',
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
events.push({
|
|
264
|
-
type: 'tool_result',
|
|
265
|
-
agent: 'claude',
|
|
266
|
-
timestamp,
|
|
267
|
-
tool: toolInfo?.tool,
|
|
268
|
-
success: true,
|
|
269
|
-
output: output.length > 500 ? output.slice(0, 497) + '...' : output,
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
if (toolId)
|
|
273
|
-
toolUseMap.delete(toolId);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
else if (type === 'result') {
|
|
279
|
-
events.push({
|
|
280
|
-
type: 'result',
|
|
281
|
-
agent: 'claude',
|
|
282
|
-
timestamp,
|
|
283
|
-
content: raw.subtype || 'success',
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
// Skip: permission-mode, attachment, and other line types
|
|
287
|
-
}
|
|
288
|
-
return events;
|
|
289
|
-
}
|
|
290
|
-
// ---------------------------------------------------------------------------
|
|
291
|
-
// Codex parser
|
|
292
|
-
// ---------------------------------------------------------------------------
|
|
293
|
-
/** Parse a Codex JSONL session file into normalized events. */
|
|
294
|
-
export function parseCodex(filePath) {
|
|
295
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
296
|
-
const lines = content.split('\n').filter(l => l.trim());
|
|
297
|
-
const events = [];
|
|
298
|
-
// Track function_call id -> name for correlating with function_call_output
|
|
299
|
-
const callMap = new Map();
|
|
300
|
-
for (const line of lines) {
|
|
301
|
-
let raw;
|
|
302
|
-
try {
|
|
303
|
-
raw = JSON.parse(line);
|
|
304
|
-
}
|
|
305
|
-
catch {
|
|
306
|
-
/* malformed JSONL line, skip */
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
const lineType = raw.type;
|
|
310
|
-
const timestamp = raw.timestamp || new Date().toISOString();
|
|
311
|
-
const payload = raw.payload || {};
|
|
312
|
-
if (lineType === 'session_meta') {
|
|
313
|
-
events.push({
|
|
314
|
-
type: 'init',
|
|
315
|
-
agent: 'codex',
|
|
316
|
-
timestamp,
|
|
317
|
-
content: `Codex ${payload.cli_version || ''} session in ${payload.cwd || ''}`.trim(),
|
|
318
|
-
});
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
if (lineType === 'response_item') {
|
|
322
|
-
const ptype = payload.type;
|
|
323
|
-
if (ptype === 'message') {
|
|
324
|
-
const contentBlocks = payload.content || [];
|
|
325
|
-
const role = payload.role === 'user' || payload.role === 'developer' ? 'user' : 'assistant';
|
|
326
|
-
for (const block of contentBlocks) {
|
|
327
|
-
if (block.type === 'output_text') {
|
|
328
|
-
const text = (block.text || '').trim();
|
|
329
|
-
if (text) {
|
|
330
|
-
events.push({
|
|
331
|
-
type: 'message',
|
|
332
|
-
agent: 'codex',
|
|
333
|
-
timestamp,
|
|
334
|
-
role: 'assistant',
|
|
335
|
-
content: text,
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
else if (block.type === 'input_text') {
|
|
340
|
-
// Developer/user input messages -- only include actual prompts, not system instructions
|
|
341
|
-
const text = (block.text || '').trim();
|
|
342
|
-
if (text && text.length < 2000 && !text.includes('<permissions instructions>')) {
|
|
343
|
-
events.push({
|
|
344
|
-
type: 'message',
|
|
345
|
-
agent: 'codex',
|
|
346
|
-
timestamp,
|
|
347
|
-
role: 'user',
|
|
348
|
-
content: text,
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
else if (ptype === 'function_call') {
|
|
355
|
-
const name = payload.name || 'unknown';
|
|
356
|
-
let args = {};
|
|
357
|
-
try {
|
|
358
|
-
args = typeof payload.arguments === 'string'
|
|
359
|
-
? JSON.parse(payload.arguments)
|
|
360
|
-
: (payload.arguments || {});
|
|
361
|
-
}
|
|
362
|
-
catch {
|
|
363
|
-
/* arguments not valid JSON, preserve raw */
|
|
364
|
-
args = { raw: payload.arguments };
|
|
365
|
-
}
|
|
366
|
-
const callId = payload.call_id || payload.id;
|
|
367
|
-
if (callId) {
|
|
368
|
-
callMap.set(callId, { name, args });
|
|
369
|
-
}
|
|
370
|
-
events.push({
|
|
371
|
-
type: 'tool_use',
|
|
372
|
-
agent: 'codex',
|
|
373
|
-
timestamp,
|
|
374
|
-
tool: name,
|
|
375
|
-
args,
|
|
376
|
-
command: name === 'exec_command' ? (args.command || args.cmd) : undefined,
|
|
377
|
-
path: args.file_path || args.path || undefined,
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
else if (ptype === 'function_call_output') {
|
|
381
|
-
const callId = payload.call_id || payload.id;
|
|
382
|
-
const callInfo = callId ? callMap.get(callId) : undefined;
|
|
383
|
-
const output = String(payload.output || '');
|
|
384
|
-
events.push({
|
|
385
|
-
type: 'tool_result',
|
|
386
|
-
agent: 'codex',
|
|
387
|
-
timestamp,
|
|
388
|
-
tool: callInfo?.name,
|
|
389
|
-
success: true,
|
|
390
|
-
output: output.length > 500 ? output.slice(0, 497) + '...' : output,
|
|
391
|
-
});
|
|
392
|
-
if (callId)
|
|
393
|
-
callMap.delete(callId);
|
|
394
|
-
}
|
|
395
|
-
else if (ptype === 'reasoning') {
|
|
396
|
-
// Codex reasoning -- try to get the readable summary
|
|
397
|
-
const summaries = payload.summary || [];
|
|
398
|
-
const text = summaries.length > 0
|
|
399
|
-
? summaries.map((s) => s.text || '').join('\n')
|
|
400
|
-
: (payload.text || '');
|
|
401
|
-
if (text.trim()) {
|
|
402
|
-
events.push({
|
|
403
|
-
type: 'thinking',
|
|
404
|
-
agent: 'codex',
|
|
405
|
-
timestamp,
|
|
406
|
-
content: text.trim(),
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
// Skip: event_msg (token_count, etc.), turn_context
|
|
412
|
-
}
|
|
413
|
-
return events;
|
|
414
|
-
}
|
|
415
|
-
// ---------------------------------------------------------------------------
|
|
416
|
-
// Gemini parser
|
|
417
|
-
// ---------------------------------------------------------------------------
|
|
418
|
-
/** Parse a Gemini JSON session file into normalized events. */
|
|
419
|
-
export function parseGemini(filePath) {
|
|
420
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
421
|
-
let session;
|
|
422
|
-
try {
|
|
423
|
-
session = JSON.parse(content);
|
|
424
|
-
}
|
|
425
|
-
catch {
|
|
426
|
-
/* Gemini session file is not valid JSON */
|
|
427
|
-
throw new Error(`Failed to parse Gemini session: ${filePath}`);
|
|
428
|
-
}
|
|
429
|
-
const messages = session.messages || [];
|
|
430
|
-
const events = [];
|
|
431
|
-
events.push({
|
|
432
|
-
type: 'init',
|
|
433
|
-
agent: 'gemini',
|
|
434
|
-
timestamp: session.startTime || new Date().toISOString(),
|
|
435
|
-
content: `Gemini session ${session.sessionId || ''}`.trim(),
|
|
436
|
-
});
|
|
437
|
-
for (const msg of messages) {
|
|
438
|
-
const timestamp = msg.timestamp || session.startTime || new Date().toISOString();
|
|
439
|
-
if (msg.type === 'user') {
|
|
440
|
-
const text = extractGeminiContent(msg.content);
|
|
441
|
-
if (text) {
|
|
442
|
-
events.push({
|
|
443
|
-
type: 'message',
|
|
444
|
-
agent: 'gemini',
|
|
445
|
-
timestamp,
|
|
446
|
-
role: 'user',
|
|
447
|
-
content: text,
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
else if (msg.type === 'gemini') {
|
|
452
|
-
// Reasoning thoughts
|
|
453
|
-
if (Array.isArray(msg.thoughts)) {
|
|
454
|
-
for (const thought of msg.thoughts) {
|
|
455
|
-
const text = thought.description || thought.subject || '';
|
|
456
|
-
if (text.trim()) {
|
|
457
|
-
const subject = thought.subject ? `**${thought.subject}**: ` : '';
|
|
458
|
-
events.push({
|
|
459
|
-
type: 'thinking',
|
|
460
|
-
agent: 'gemini',
|
|
461
|
-
timestamp: thought.timestamp || timestamp,
|
|
462
|
-
content: `${subject}${thought.description || ''}`.trim(),
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
// Assistant text
|
|
468
|
-
const text = extractGeminiContent(msg.content);
|
|
469
|
-
if (text) {
|
|
470
|
-
events.push({
|
|
471
|
-
type: 'message',
|
|
472
|
-
agent: 'gemini',
|
|
473
|
-
timestamp,
|
|
474
|
-
role: 'assistant',
|
|
475
|
-
content: text,
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
// Tool calls (Gemini inlines call + result on the same message)
|
|
479
|
-
if (Array.isArray(msg.toolCalls)) {
|
|
480
|
-
for (const tc of msg.toolCalls) {
|
|
481
|
-
const toolName = tc.name || 'unknown';
|
|
482
|
-
const args = tc.args || {};
|
|
483
|
-
events.push({
|
|
484
|
-
type: 'tool_use',
|
|
485
|
-
agent: 'gemini',
|
|
486
|
-
timestamp: tc.timestamp || timestamp,
|
|
487
|
-
tool: toolName,
|
|
488
|
-
args,
|
|
489
|
-
command: ['run_shell_command', 'shell', 'bash'].includes(toolName) ? args.command : undefined,
|
|
490
|
-
path: args.file_path || args.path || undefined,
|
|
491
|
-
});
|
|
492
|
-
// Inline result
|
|
493
|
-
if (tc.result || tc.status) {
|
|
494
|
-
let output = '';
|
|
495
|
-
if (Array.isArray(tc.result)) {
|
|
496
|
-
for (const r of tc.result) {
|
|
497
|
-
const resp = r?.functionResponse?.response;
|
|
498
|
-
if (resp?.output) {
|
|
499
|
-
output += String(resp.output);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
else if (typeof tc.result === 'string') {
|
|
504
|
-
output = tc.result;
|
|
505
|
-
}
|
|
506
|
-
events.push({
|
|
507
|
-
type: 'tool_result',
|
|
508
|
-
agent: 'gemini',
|
|
509
|
-
timestamp: tc.timestamp || timestamp,
|
|
510
|
-
tool: toolName,
|
|
511
|
-
success: tc.status === 'success',
|
|
512
|
-
output: output.length > 500 ? output.slice(0, 497) + '...' : output,
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return events;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Extract text content from Gemini's content field,
|
|
523
|
-
* which can be a string or an array of {text: string} parts.
|
|
524
|
-
*/
|
|
525
|
-
function extractGeminiContent(content) {
|
|
526
|
-
if (typeof content === 'string')
|
|
527
|
-
return content.trim();
|
|
528
|
-
if (Array.isArray(content)) {
|
|
529
|
-
return content
|
|
530
|
-
.map((part) => {
|
|
531
|
-
if (typeof part === 'string')
|
|
532
|
-
return part;
|
|
533
|
-
if (typeof part?.text === 'string')
|
|
534
|
-
return part.text;
|
|
535
|
-
return '';
|
|
536
|
-
})
|
|
537
|
-
.join('\n')
|
|
538
|
-
.trim();
|
|
539
|
-
}
|
|
540
|
-
return '';
|
|
541
|
-
}
|
|
542
|
-
// ---------------------------------------------------------------------------
|
|
543
|
-
// OpenCode parser
|
|
544
|
-
// ---------------------------------------------------------------------------
|
|
545
|
-
/**
|
|
546
|
-
* Parse an OpenCode session from its SQLite database.
|
|
547
|
-
* filePath format: "/path/to/opencode.db#session_id"
|
|
548
|
-
*
|
|
549
|
-
* Data model: session -> message -> part
|
|
550
|
-
* Messages have role (user/assistant) and metadata.
|
|
551
|
-
* Parts contain the actual content: text, tool, reasoning, patch, step-start/finish.
|
|
552
|
-
*/
|
|
553
|
-
export function parseOpenCode(filePath) {
|
|
554
|
-
const [dbPath, sessionId] = filePath.split('#');
|
|
555
|
-
if (!dbPath || !sessionId)
|
|
556
|
-
return [];
|
|
557
|
-
const events = [];
|
|
558
|
-
try {
|
|
559
|
-
// Query messages with their parts, ordered chronologically.
|
|
560
|
-
// Each row: msg_role ||| part_type ||| part_data (truncated for tool output) ||| msg_time
|
|
561
|
-
const query = `
|
|
562
|
-
SELECT
|
|
563
|
-
json_extract(m.data, '$.role'),
|
|
564
|
-
json_extract(p.data, '$.type'),
|
|
565
|
-
CASE
|
|
566
|
-
WHEN json_extract(p.data, '$.type') = 'tool'
|
|
567
|
-
THEN substr(p.data, 1, 2000)
|
|
568
|
-
ELSE p.data
|
|
569
|
-
END,
|
|
570
|
-
m.time_created
|
|
571
|
-
FROM message m
|
|
572
|
-
JOIN part p ON p.message_id = m.id AND p.session_id = m.session_id
|
|
573
|
-
WHERE m.session_id = '${sessionId.replace(/'/g, "''")}'
|
|
574
|
-
ORDER BY m.time_created ASC, p.time_created ASC;
|
|
575
|
-
`.replace(/\n/g, ' ');
|
|
576
|
-
const out = execSync(`sqlite3 -separator '|||' "${dbPath}"`, { encoding: 'utf-8', input: query, stdio: ['pipe', 'pipe', 'ignore'], timeout: 10000 });
|
|
577
|
-
for (const line of out.split('\n')) {
|
|
578
|
-
if (!line.trim())
|
|
579
|
-
continue;
|
|
580
|
-
const sepIdx1 = line.indexOf('|||');
|
|
581
|
-
if (sepIdx1 === -1)
|
|
582
|
-
continue;
|
|
583
|
-
const sepIdx2 = line.indexOf('|||', sepIdx1 + 3);
|
|
584
|
-
if (sepIdx2 === -1)
|
|
585
|
-
continue;
|
|
586
|
-
const sepIdx3 = line.lastIndexOf('|||');
|
|
587
|
-
const role = line.slice(0, sepIdx1);
|
|
588
|
-
const partType = line.slice(sepIdx1 + 3, sepIdx2);
|
|
589
|
-
const partDataStr = line.slice(sepIdx2 + 3, sepIdx3);
|
|
590
|
-
const timeStr = line.slice(sepIdx3 + 3);
|
|
591
|
-
const timeMs = parseInt(timeStr, 10);
|
|
592
|
-
const timestamp = isNaN(timeMs) ? new Date().toISOString() : new Date(timeMs).toISOString();
|
|
593
|
-
let partData;
|
|
594
|
-
try {
|
|
595
|
-
partData = JSON.parse(partDataStr);
|
|
596
|
-
}
|
|
597
|
-
catch {
|
|
598
|
-
/* malformed part data, skip */
|
|
599
|
-
continue;
|
|
600
|
-
}
|
|
601
|
-
switch (partType) {
|
|
602
|
-
case 'text': {
|
|
603
|
-
const text = (partData.text || '').trim();
|
|
604
|
-
if (text) {
|
|
605
|
-
events.push({
|
|
606
|
-
type: 'message',
|
|
607
|
-
agent: 'opencode',
|
|
608
|
-
timestamp,
|
|
609
|
-
role: role === 'user' ? 'user' : 'assistant',
|
|
610
|
-
content: text,
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
break;
|
|
614
|
-
}
|
|
615
|
-
case 'reasoning': {
|
|
616
|
-
const text = (partData.text || '').trim();
|
|
617
|
-
if (text) {
|
|
618
|
-
events.push({
|
|
619
|
-
type: 'thinking',
|
|
620
|
-
agent: 'opencode',
|
|
621
|
-
timestamp,
|
|
622
|
-
content: text,
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
|
-
case 'tool': {
|
|
628
|
-
const toolName = partData.tool || 'unknown';
|
|
629
|
-
const state = partData.state || {};
|
|
630
|
-
const input = state.input || {};
|
|
631
|
-
const output = state.output || '';
|
|
632
|
-
events.push({
|
|
633
|
-
type: 'tool_use',
|
|
634
|
-
agent: 'opencode',
|
|
635
|
-
timestamp,
|
|
636
|
-
tool: toolName,
|
|
637
|
-
args: input,
|
|
638
|
-
command: toolName === 'shell' ? input.command : undefined,
|
|
639
|
-
path: input.filePath || input.path || undefined,
|
|
640
|
-
});
|
|
641
|
-
if (state.status === 'completed' || state.status === 'error') {
|
|
642
|
-
const outputStr = typeof output === 'string' ? output : JSON.stringify(output);
|
|
643
|
-
events.push({
|
|
644
|
-
type: state.status === 'error' ? 'error' : 'tool_result',
|
|
645
|
-
agent: 'opencode',
|
|
646
|
-
timestamp,
|
|
647
|
-
tool: toolName,
|
|
648
|
-
success: state.status === 'completed',
|
|
649
|
-
output: outputStr.length > 500 ? outputStr.slice(0, 497) + '...' : outputStr,
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
break;
|
|
653
|
-
}
|
|
654
|
-
// Skip step-start, step-finish, patch, file — not needed for transcript/trace
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
catch {
|
|
659
|
-
/* DB not accessible or query failed */
|
|
660
|
-
}
|
|
661
|
-
return events;
|
|
662
|
-
}
|
|
663
|
-
//# sourceMappingURL=parse.js.map
|