@phnx-labs/agents-cli 1.12.0 → 1.14.1
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 +7 -1
- package/README.md +293 -300
- package/dist/commands/alias.d.ts +11 -0
- package/dist/commands/alias.js +117 -0
- package/dist/commands/beta.d.ts +2 -0
- package/dist/commands/beta.js +53 -0
- package/dist/commands/cloud.d.ts +10 -0
- package/dist/commands/cloud.js +408 -0
- package/dist/commands/commands.d.ts +9 -1
- package/dist/commands/commands.js +24 -172
- package/dist/commands/daemon.d.ts +8 -1
- package/dist/commands/daemon.js +13 -5
- package/dist/commands/doctor.d.ts +15 -0
- package/dist/commands/doctor.js +132 -0
- package/dist/commands/drive.d.ts +8 -1
- package/dist/commands/drive.js +20 -3
- package/dist/commands/exec.d.ts +8 -1
- package/dist/commands/exec.js +207 -20
- package/dist/commands/factory.d.ts +19 -0
- package/dist/commands/factory.js +71 -0
- package/dist/commands/fork.d.ts +8 -1
- package/dist/commands/fork.js +11 -4
- package/dist/commands/hooks.d.ts +9 -1
- package/dist/commands/hooks.js +30 -182
- package/dist/commands/init.d.ts +15 -1
- package/dist/commands/init.js +168 -74
- package/dist/commands/mcp.d.ts +9 -1
- package/dist/commands/mcp.js +11 -7
- package/dist/commands/models.d.ts +8 -1
- package/dist/commands/models.js +45 -6
- package/dist/commands/packages.d.ts +8 -1
- package/dist/commands/packages.js +13 -7
- package/dist/commands/permissions.d.ts +9 -1
- package/dist/commands/permissions.js +3 -3
- package/dist/commands/plugins.d.ts +8 -1
- package/dist/commands/plugins.js +13 -2
- package/dist/commands/profiles.d.ts +11 -0
- package/dist/commands/profiles.js +291 -0
- package/dist/commands/prune.d.ts +22 -0
- package/dist/commands/prune.js +191 -0
- package/dist/commands/pty.d.ts +1 -1
- package/dist/commands/pty.js +2 -1
- package/dist/commands/pull.d.ts +8 -1
- package/dist/commands/pull.js +93 -129
- package/dist/commands/refresh-memory.d.ts +7 -1
- package/dist/commands/refresh-memory.js +7 -1
- package/dist/commands/repo.d.ts +15 -0
- package/dist/commands/repo.js +570 -0
- package/dist/commands/resource-view.d.ts +10 -3
- package/dist/commands/resource-view.js +18 -5
- package/dist/commands/routines.d.ts +8 -1
- package/dist/commands/routines.js +17 -4
- package/dist/commands/rules.d.ts +9 -1
- package/dist/commands/rules.js +16 -11
- package/dist/commands/secrets.d.ts +10 -0
- package/dist/commands/secrets.js +511 -0
- package/dist/commands/sessions-picker.d.ts +2 -1
- package/dist/commands/sessions-picker.js +88 -11
- package/dist/commands/sessions-tail.d.ts +19 -0
- package/dist/commands/sessions-tail.js +235 -0
- package/dist/commands/sessions.d.ts +2 -1
- package/dist/commands/sessions.js +288 -7
- package/dist/commands/skills.d.ts +9 -1
- package/dist/commands/skills.js +28 -178
- package/dist/commands/status.d.ts +7 -1
- package/dist/commands/status.js +7 -1
- package/dist/commands/subagents.d.ts +8 -1
- package/dist/commands/subagents.js +11 -1
- package/dist/commands/sync.d.ts +8 -1
- package/dist/commands/sync.js +8 -1
- package/dist/commands/teams-picker.d.ts +4 -1
- package/dist/commands/teams-picker.js +55 -3
- package/dist/commands/teams.d.ts +15 -1
- package/dist/commands/teams.js +323 -69
- package/dist/commands/usage.d.ts +11 -0
- package/dist/commands/usage.js +60 -0
- package/dist/commands/utils.d.ts +6 -1
- package/dist/commands/utils.js +6 -1
- package/dist/commands/versions.d.ts +8 -1
- package/dist/commands/versions.js +4 -3
- package/dist/commands/view.d.ts +47 -2
- package/dist/commands/view.js +353 -20
- package/dist/index.d.ts +7 -2
- package/dist/index.js +205 -38
- package/dist/lib/acp/client.d.ts +31 -0
- package/dist/lib/acp/client.js +117 -0
- package/dist/lib/acp/harnesses.d.ts +26 -0
- package/dist/lib/acp/harnesses.js +65 -0
- package/dist/lib/acp/run.d.ts +18 -0
- package/dist/lib/acp/run.js +39 -0
- package/dist/lib/agents.d.ts +74 -2
- package/dist/lib/agents.js +207 -23
- package/dist/lib/artifact-actions.d.ts +8 -4
- package/dist/lib/artifact-actions.js +8 -6
- package/dist/lib/auto-pull-worker.d.ts +11 -0
- package/dist/lib/auto-pull-worker.js +121 -0
- package/dist/lib/auto-pull.d.ts +31 -0
- package/dist/lib/auto-pull.js +97 -0
- package/dist/lib/beta.d.ts +23 -0
- package/dist/lib/beta.js +90 -0
- package/dist/lib/capabilities.d.ts +29 -0
- package/dist/lib/capabilities.js +74 -0
- package/dist/lib/cloud/codex.d.ts +25 -0
- package/dist/lib/cloud/codex.js +250 -0
- package/dist/lib/cloud/factory.d.ts +31 -0
- package/dist/lib/cloud/factory.js +53 -0
- package/dist/lib/cloud/registry.d.ts +15 -0
- package/dist/lib/cloud/registry.js +67 -0
- package/dist/lib/cloud/rush.d.ts +75 -0
- package/dist/lib/cloud/rush.js +438 -0
- package/dist/lib/cloud/store.d.ts +22 -0
- package/dist/lib/cloud/store.js +115 -0
- package/dist/lib/cloud/stream.d.ts +23 -0
- package/dist/lib/cloud/stream.js +194 -0
- package/dist/lib/cloud/types.d.ts +205 -0
- package/dist/lib/cloud/types.js +34 -0
- package/dist/lib/command-skills.d.ts +20 -0
- package/dist/lib/command-skills.js +142 -0
- package/dist/lib/commands.d.ts +22 -2
- package/dist/lib/commands.js +51 -11
- package/dist/lib/convert.d.ts +10 -1
- package/dist/lib/convert.js +9 -1
- package/dist/lib/daemon.d.ts +21 -1
- package/dist/lib/daemon.js +97 -4
- package/dist/lib/drive-sync.d.ts +18 -1
- package/dist/lib/drive-sync.js +57 -15
- package/dist/lib/exec.d.ts +25 -5
- package/dist/lib/exec.js +72 -27
- package/dist/lib/fs-walk.d.ts +2 -0
- package/dist/lib/fs-walk.js +40 -0
- package/dist/lib/fuzzy.d.ts +53 -0
- package/dist/lib/fuzzy.js +72 -0
- package/dist/lib/gemini-settings.d.ts +4 -0
- package/dist/lib/gemini-settings.js +33 -0
- package/dist/lib/git.d.ts +12 -2
- package/dist/lib/git.js +17 -6
- package/dist/lib/help.d.ts +20 -1
- package/dist/lib/help.js +45 -6
- package/dist/lib/hooks/match.d.ts +32 -0
- package/dist/lib/hooks/match.js +120 -0
- package/dist/lib/hooks.d.ts +17 -4
- package/dist/lib/hooks.js +191 -21
- package/dist/lib/manifest.d.ts +6 -1
- package/dist/lib/manifest.js +15 -4
- package/dist/lib/markdown.d.ts +0 -1
- package/dist/lib/markdown.js +6 -1
- package/dist/lib/mcp.d.ts +0 -1
- package/dist/lib/mcp.js +29 -33
- package/dist/lib/memory-compile.d.ts +13 -3
- package/dist/lib/memory-compile.js +31 -9
- package/dist/lib/memory.d.ts +14 -7
- package/dist/lib/memory.js +67 -38
- package/dist/lib/migrate.d.ts +8 -0
- package/dist/lib/migrate.js +85 -0
- package/dist/lib/models.d.ts +25 -11
- package/dist/lib/models.js +405 -16
- package/dist/lib/onepassword.d.ts +63 -0
- package/dist/lib/onepassword.js +186 -0
- package/dist/lib/paths.d.ts +8 -0
- package/dist/lib/paths.js +20 -0
- package/dist/lib/permissions.d.ts +24 -2
- package/dist/lib/permissions.js +117 -48
- package/dist/lib/picker.d.ts +10 -1
- package/dist/lib/picker.js +15 -1
- package/dist/lib/plugins.d.ts +7 -1
- package/dist/lib/plugins.js +10 -1
- package/dist/lib/profiles-presets.d.ts +24 -0
- package/dist/lib/profiles-presets.js +103 -0
- package/dist/lib/profiles.d.ts +69 -0
- package/dist/lib/profiles.js +144 -0
- package/dist/lib/pty-client.d.ts +1 -1
- package/dist/lib/pty-client.js +0 -1
- package/dist/lib/pty-server.d.ts +16 -2
- package/dist/lib/pty-server.js +92 -3
- package/dist/lib/registry.d.ts +23 -3
- package/dist/lib/registry.js +153 -8
- package/dist/lib/resources.d.ts +28 -1
- package/dist/lib/resources.js +79 -1
- package/dist/lib/rotate.d.ts +79 -0
- package/dist/lib/rotate.js +285 -0
- package/dist/lib/routines.d.ts +29 -1
- package/dist/lib/routines.js +32 -5
- package/dist/lib/runner.d.ts +14 -1
- package/dist/lib/runner.js +22 -3
- package/dist/lib/sandbox.d.ts +16 -1
- package/dist/lib/sandbox.js +39 -16
- package/dist/lib/scheduler.d.ts +8 -1
- package/dist/lib/scheduler.js +8 -1
- package/dist/lib/secrets/AgentsKeychain.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/Info.plist +22 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/MacOS/AgentsKeychain +0 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/_CodeSignature/CodeResources +123 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/embedded.provisionprofile +0 -0
- package/dist/lib/secrets/bundles.d.ts +39 -0
- package/dist/lib/secrets/bundles.js +189 -0
- package/dist/lib/secrets/index.d.ts +55 -0
- package/dist/lib/secrets/index.js +211 -0
- package/dist/lib/secrets/profiles.d.ts +10 -0
- package/dist/lib/secrets/profiles.js +13 -0
- package/dist/lib/session/active.d.ts +43 -0
- package/dist/lib/session/active.js +392 -0
- package/dist/lib/session/artifacts.d.ts +16 -0
- package/dist/lib/session/artifacts.js +95 -0
- package/dist/lib/session/cloud.d.ts +30 -0
- package/dist/lib/session/cloud.js +121 -0
- package/dist/lib/session/db.d.ts +23 -2
- package/dist/lib/session/db.js +76 -12
- package/dist/lib/session/discover.d.ts +19 -4
- package/dist/lib/session/discover.js +344 -48
- package/dist/lib/session/parse.d.ts +28 -1
- package/dist/lib/session/parse.js +267 -9
- package/dist/lib/session/prompt.d.ts +9 -1
- package/dist/lib/session/prompt.js +17 -3
- package/dist/lib/session/render.d.ts +13 -1
- package/dist/lib/session/render.js +20 -1
- package/dist/lib/session/team-filter.d.ts +9 -1
- package/dist/lib/session/team-filter.js +11 -2
- package/dist/lib/session/types.d.ts +24 -2
- package/dist/lib/session/types.js +10 -2
- package/dist/lib/shims.d.ts +93 -5
- package/dist/lib/shims.js +380 -67
- package/dist/lib/skills.d.ts +27 -2
- package/dist/lib/skills.js +127 -65
- package/dist/lib/sqlite.d.ts +43 -0
- package/dist/lib/sqlite.js +94 -0
- package/dist/lib/state.d.ts +114 -22
- package/dist/lib/state.js +323 -138
- package/dist/lib/subagents.d.ts +9 -1
- package/dist/lib/subagents.js +70 -63
- package/dist/lib/sync-manifest.d.ts +81 -0
- package/dist/lib/sync-manifest.js +450 -0
- package/dist/lib/teams/agents.d.ts +103 -5
- package/dist/lib/teams/agents.js +414 -91
- package/dist/lib/teams/api.d.ts +26 -3
- package/dist/lib/teams/api.js +63 -3
- package/dist/lib/teams/debug.d.ts +6 -1
- package/dist/lib/teams/debug.js +6 -1
- package/dist/lib/teams/file_ops.d.ts +7 -1
- package/dist/lib/teams/file_ops.js +7 -1
- package/dist/lib/teams/index.d.ts +15 -0
- package/dist/lib/teams/index.js +14 -0
- package/dist/lib/teams/parsers.d.ts +4 -1
- package/dist/lib/teams/parsers.js +11 -1
- package/dist/lib/teams/persistence.d.ts +15 -1
- package/dist/lib/teams/persistence.js +102 -20
- package/dist/lib/teams/registry.d.ts +12 -1
- package/dist/lib/teams/registry.js +116 -33
- package/dist/lib/teams/summarizer.d.ts +15 -1
- package/dist/lib/teams/summarizer.js +14 -1
- package/dist/lib/teams/supervisor.d.ts +48 -0
- package/dist/lib/teams/supervisor.js +73 -0
- package/dist/lib/template.d.ts +8 -6
- package/dist/lib/template.js +8 -6
- package/dist/lib/types.d.ts +147 -8
- package/dist/lib/types.js +26 -3
- package/dist/lib/usage.d.ts +48 -1
- package/dist/lib/usage.js +97 -16
- package/dist/lib/version-duplicates.d.ts +21 -0
- package/dist/lib/version-duplicates.js +90 -0
- package/dist/lib/versions.d.ts +39 -4
- package/dist/lib/versions.js +401 -111
- package/package.json +33 -18
- package/scripts/postinstall.js +126 -30
- 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/commands.d.ts.map +0 -1
- package/dist/commands/commands.js.map +0 -1
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/packages.js.map +0 -1
- package/dist/commands/permissions.d.ts.map +0 -1
- package/dist/commands/permissions.js.map +0 -1
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/pty.d.ts.map +0 -1
- package/dist/commands/pty.js.map +0 -1
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -3
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -180
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/refresh-memory.d.ts.map +0 -1
- package/dist/commands/refresh-memory.js.map +0 -1
- package/dist/commands/resource-view.d.ts.map +0 -1
- package/dist/commands/resource-view.js.map +0 -1
- package/dist/commands/routines.d.ts.map +0 -1
- package/dist/commands/routines.js.map +0 -1
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/sessions-picker.d.ts.map +0 -1
- package/dist/commands/sessions-picker.js.map +0 -1
- package/dist/commands/sessions.d.ts.map +0 -1
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/subagents.d.ts.map +0 -1
- package/dist/commands/subagents.js.map +0 -1
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/teams-picker.d.ts.map +0 -1
- package/dist/commands/teams-picker.js.map +0 -1
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/utils.d.ts.map +0 -1
- package/dist/commands/utils.js.map +0 -1
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js.map +0 -1
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- 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 -184
- package/dist/lib/__tests__/models.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 -218
- package/dist/lib/__tests__/usage.test.js.map +0 -1
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/artifact-actions.d.ts.map +0 -1
- package/dist/lib/artifact-actions.js.map +0 -1
- package/dist/lib/commands.d.ts.map +0 -1
- package/dist/lib/commands.js.map +0 -1
- package/dist/lib/convert.d.ts.map +0 -1
- package/dist/lib/convert.js.map +0 -1
- package/dist/lib/daemon.d.ts.map +0 -1
- package/dist/lib/daemon.js.map +0 -1
- package/dist/lib/drive-sync.d.ts.map +0 -1
- package/dist/lib/drive-sync.js.map +0 -1
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.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 -110
- package/dist/lib/factory.js.map +0 -1
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/manifest.d.ts.map +0 -1
- package/dist/lib/manifest.js.map +0 -1
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/markdown.js.map +0 -1
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/memory-compile.d.ts.map +0 -1
- package/dist/lib/memory-compile.js.map +0 -1
- package/dist/lib/memory.d.ts.map +0 -1
- package/dist/lib/memory.js.map +0 -1
- package/dist/lib/models.d.ts.map +0 -1
- package/dist/lib/models.js.map +0 -1
- package/dist/lib/permissions.d.ts.map +0 -1
- package/dist/lib/permissions.js.map +0 -1
- package/dist/lib/picker.d.ts.map +0 -1
- package/dist/lib/picker.js.map +0 -1
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/lib/plugins.js.map +0 -1
- package/dist/lib/pty-client.d.ts.map +0 -1
- package/dist/lib/pty-client.js.map +0 -1
- package/dist/lib/pty-server.d.ts.map +0 -1
- package/dist/lib/pty-server.js.map +0 -1
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resources.d.ts.map +0 -1
- package/dist/lib/resources.js.map +0 -1
- package/dist/lib/routines.d.ts.map +0 -1
- package/dist/lib/routines.js.map +0 -1
- package/dist/lib/runner.d.ts.map +0 -1
- package/dist/lib/runner.js.map +0 -1
- package/dist/lib/sandbox.d.ts.map +0 -1
- package/dist/lib/sandbox.js.map +0 -1
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.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/db.d.ts.map +0 -1
- package/dist/lib/session/db.js.map +0 -1
- package/dist/lib/session/discover.d.ts.map +0 -1
- package/dist/lib/session/discover.js.map +0 -1
- package/dist/lib/session/parse.d.ts.map +0 -1
- package/dist/lib/session/parse.js.map +0 -1
- package/dist/lib/session/prompt.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/lib/session/render.js.map +0 -1
- package/dist/lib/session/team-filter.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/lib/session/types.js.map +0 -1
- package/dist/lib/shims.d.ts.map +0 -1
- package/dist/lib/shims.js.map +0 -1
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/subagents.d.ts.map +0 -1
- package/dist/lib/subagents.js.map +0 -1
- package/dist/lib/teams/agents.d.ts.map +0 -1
- package/dist/lib/teams/agents.js.map +0 -1
- package/dist/lib/teams/api.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/lib/teams/debug.js.map +0 -1
- package/dist/lib/teams/file_ops.d.ts.map +0 -1
- package/dist/lib/teams/file_ops.js.map +0 -1
- package/dist/lib/teams/parsers.d.ts.map +0 -1
- package/dist/lib/teams/parsers.js.map +0 -1
- package/dist/lib/teams/persistence.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/lib/teams/registry.js.map +0 -1
- package/dist/lib/teams/summarizer.d.ts.map +0 -1
- package/dist/lib/teams/summarizer.js.map +0 -1
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage.d.ts.map +0 -1
- package/dist/lib/usage.js.map +0 -1
- package/dist/lib/versions.d.ts.map +0 -1
- package/dist/lib/versions.js.map +0 -1
- package/scripts/rebuild-sqlite.sh +0 -46
|
@@ -1,15 +1,39 @@
|
|
|
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
|
+
*/
|
|
1
8
|
import type { SessionAgentId, SessionEvent } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Largest session file we will load into memory. Above this we throw a clean
|
|
11
|
+
* error instead of OOMing or hitting V8's ERR_STRING_TOO_LONG. Aligns with
|
|
12
|
+
* Node's ~512MB string ceiling with a healthy margin.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SESSION_FILE_MAX_BYTES = 200000000;
|
|
15
|
+
export declare function sanitizeForTerminal(s: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Read a session file, refusing files above maxBytes. Bounded read protects
|
|
18
|
+
* against multi-GB session blobs that would OOM the CLI or exceed V8's
|
|
19
|
+
* ERR_STRING_TOO_LONG ceiling.
|
|
20
|
+
*/
|
|
21
|
+
export declare function safeReadSessionFile(filePath: string, maxBytes?: number): string;
|
|
2
22
|
/**
|
|
3
23
|
* Auto-detect agent type from file path and parse the session.
|
|
4
24
|
*/
|
|
5
25
|
export declare function parseSession(filePath: string, agent?: SessionAgentId): SessionEvent[];
|
|
26
|
+
/** Infer the agent type from a session file path using known directory conventions. */
|
|
6
27
|
export declare function detectAgent(filePath: string): SessionAgentId | null;
|
|
7
28
|
/**
|
|
8
29
|
* Summarize a tool_use into a one-liner string.
|
|
9
30
|
*/
|
|
10
31
|
export declare function summarizeToolUse(tool: string, args?: Record<string, any>): string;
|
|
32
|
+
/** Parse a Claude JSONL session file into normalized events. */
|
|
11
33
|
export declare function parseClaude(filePath: string): SessionEvent[];
|
|
34
|
+
/** Parse a Codex JSONL session file into normalized events. */
|
|
12
35
|
export declare function parseCodex(filePath: string): SessionEvent[];
|
|
36
|
+
/** Parse a Gemini JSON session file into normalized events. */
|
|
13
37
|
export declare function parseGemini(filePath: string): SessionEvent[];
|
|
14
38
|
/**
|
|
15
39
|
* Parse an OpenCode session from its SQLite database.
|
|
@@ -20,4 +44,7 @@ export declare function parseGemini(filePath: string): SessionEvent[];
|
|
|
20
44
|
* Parts contain the actual content: text, tool, reasoning, patch, step-start/finish.
|
|
21
45
|
*/
|
|
22
46
|
export declare function parseOpenCode(filePath: string): SessionEvent[];
|
|
23
|
-
|
|
47
|
+
/** Parse a Rush JSONL session file into normalized events. */
|
|
48
|
+
export declare function parseRush(filePath: string): SessionEvent[];
|
|
49
|
+
/** Parse a Hermes session JSON file into normalized events. */
|
|
50
|
+
export declare function parseHermes(filePath: string): SessionEvent[];
|
|
@@ -1,5 +1,76 @@
|
|
|
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
|
+
*/
|
|
1
8
|
import * as fs from 'fs';
|
|
2
9
|
import { execSync } from 'child_process';
|
|
10
|
+
/**
|
|
11
|
+
* Largest session file we will load into memory. Above this we throw a clean
|
|
12
|
+
* error instead of OOMing or hitting V8's ERR_STRING_TOO_LONG. Aligns with
|
|
13
|
+
* Node's ~512MB string ceiling with a healthy margin.
|
|
14
|
+
*/
|
|
15
|
+
export const SESSION_FILE_MAX_BYTES = 200_000_000;
|
|
16
|
+
/**
|
|
17
|
+
* Strip terminal control sequences that a malicious session file could use to
|
|
18
|
+
* hijack the user's terminal (clipboard via OSC 52, scrollback wipe, alt-screen
|
|
19
|
+
* takeover, cursor moves, etc.). Allowed through: tab (0x09), newline (0x0a),
|
|
20
|
+
* carriage return (0x0d). Everything else in the C0/C1 range and every CSI/OSC
|
|
21
|
+
* escape is dropped.
|
|
22
|
+
*/
|
|
23
|
+
const TERMINAL_ESCAPE_REGEX = /\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b\[[0-?]*[ -/]*[@-~]|\x1b[@-_]|[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g;
|
|
24
|
+
export function sanitizeForTerminal(s) {
|
|
25
|
+
if (typeof s !== 'string' || !s)
|
|
26
|
+
return s;
|
|
27
|
+
return s.replace(TERMINAL_ESCAPE_REGEX, '');
|
|
28
|
+
}
|
|
29
|
+
/** Recursively sanitize every string value within a tool-args object. */
|
|
30
|
+
function sanitizeArgsDeep(value) {
|
|
31
|
+
if (typeof value === 'string')
|
|
32
|
+
return sanitizeForTerminal(value);
|
|
33
|
+
if (Array.isArray(value))
|
|
34
|
+
return value.map(sanitizeArgsDeep);
|
|
35
|
+
if (value && typeof value === 'object') {
|
|
36
|
+
const out = {};
|
|
37
|
+
for (const k of Object.keys(value))
|
|
38
|
+
out[k] = sanitizeArgsDeep(value[k]);
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
/** In-place sanitize all user-visible string fields on an event. */
|
|
44
|
+
function sanitizeEvent(e) {
|
|
45
|
+
if (e.content)
|
|
46
|
+
e.content = sanitizeForTerminal(e.content);
|
|
47
|
+
if (e.command)
|
|
48
|
+
e.command = sanitizeForTerminal(e.command);
|
|
49
|
+
if (e.path)
|
|
50
|
+
e.path = sanitizeForTerminal(e.path);
|
|
51
|
+
if (e.output)
|
|
52
|
+
e.output = sanitizeForTerminal(e.output);
|
|
53
|
+
if (e.tool)
|
|
54
|
+
e.tool = sanitizeForTerminal(e.tool);
|
|
55
|
+
if (e.model)
|
|
56
|
+
e.model = sanitizeForTerminal(e.model);
|
|
57
|
+
if (e.mediaType)
|
|
58
|
+
e.mediaType = sanitizeForTerminal(e.mediaType);
|
|
59
|
+
if (e.args)
|
|
60
|
+
e.args = sanitizeArgsDeep(e.args);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Read a session file, refusing files above maxBytes. Bounded read protects
|
|
64
|
+
* against multi-GB session blobs that would OOM the CLI or exceed V8's
|
|
65
|
+
* ERR_STRING_TOO_LONG ceiling.
|
|
66
|
+
*/
|
|
67
|
+
export function safeReadSessionFile(filePath, maxBytes = SESSION_FILE_MAX_BYTES) {
|
|
68
|
+
const stat = fs.statSync(filePath);
|
|
69
|
+
if (stat.size > maxBytes) {
|
|
70
|
+
throw new Error(`Session file too large: ${filePath} is ${stat.size} bytes (limit ${maxBytes}). Refusing to load.`);
|
|
71
|
+
}
|
|
72
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
73
|
+
}
|
|
3
74
|
/**
|
|
4
75
|
* Auto-detect agent type from file path and parse the session.
|
|
5
76
|
*/
|
|
@@ -8,14 +79,38 @@ export function parseSession(filePath, agent) {
|
|
|
8
79
|
if (!detected) {
|
|
9
80
|
throw new Error(`Cannot detect agent type from path: ${filePath}`);
|
|
10
81
|
}
|
|
82
|
+
let events;
|
|
11
83
|
switch (detected) {
|
|
12
|
-
case 'claude':
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
case '
|
|
16
|
-
|
|
84
|
+
case 'claude':
|
|
85
|
+
events = parseClaude(filePath);
|
|
86
|
+
break;
|
|
87
|
+
case 'codex':
|
|
88
|
+
events = parseCodex(filePath);
|
|
89
|
+
break;
|
|
90
|
+
case 'gemini':
|
|
91
|
+
events = parseGemini(filePath);
|
|
92
|
+
break;
|
|
93
|
+
case 'opencode':
|
|
94
|
+
events = parseOpenCode(filePath);
|
|
95
|
+
break;
|
|
96
|
+
case 'rush':
|
|
97
|
+
events = parseRush(filePath);
|
|
98
|
+
break;
|
|
99
|
+
case 'openclaw':
|
|
100
|
+
events = [];
|
|
101
|
+
break; // OpenClaw sessions don't have parseable files yet
|
|
102
|
+
case 'hermes':
|
|
103
|
+
events = parseHermes(filePath);
|
|
104
|
+
break;
|
|
17
105
|
}
|
|
106
|
+
// Chokepoint: every string field that originated in an untrusted session
|
|
107
|
+
// file gets stripped of terminal escapes here, so renderers downstream can
|
|
108
|
+
// safely splat values into chalk/console output.
|
|
109
|
+
for (const e of events)
|
|
110
|
+
sanitizeEvent(e);
|
|
111
|
+
return events;
|
|
18
112
|
}
|
|
113
|
+
/** Infer the agent type from a session file path using known directory conventions. */
|
|
19
114
|
export function detectAgent(filePath) {
|
|
20
115
|
if (filePath.includes('/.claude/') || filePath.includes('\\.claude\\'))
|
|
21
116
|
return 'claude';
|
|
@@ -23,6 +118,14 @@ export function detectAgent(filePath) {
|
|
|
23
118
|
return 'codex';
|
|
24
119
|
if (filePath.includes('/.gemini/') || filePath.includes('\\.gemini\\'))
|
|
25
120
|
return 'gemini';
|
|
121
|
+
if (filePath.includes('/.rush/') || filePath.includes('\\.rush\\'))
|
|
122
|
+
return 'rush';
|
|
123
|
+
if (filePath.includes('/.hermes/') || filePath.includes('\\.hermes\\'))
|
|
124
|
+
return 'hermes';
|
|
125
|
+
// Cloud convention: cloud-sessions/<id>/session.<format>.jsonl
|
|
126
|
+
const cloudMatch = filePath.match(/session\.(claude|codex|rush)\.jsonl(?:$|[?#])/);
|
|
127
|
+
if (cloudMatch)
|
|
128
|
+
return cloudMatch[1];
|
|
26
129
|
if (filePath.includes('opencode.db'))
|
|
27
130
|
return 'opencode';
|
|
28
131
|
// Try file extension + content heuristic
|
|
@@ -79,9 +182,11 @@ export function summarizeToolUse(tool, args) {
|
|
|
79
182
|
}
|
|
80
183
|
}
|
|
81
184
|
}
|
|
185
|
+
/** Truncate a string to n characters, appending '...' if shortened. */
|
|
82
186
|
function truncate(s, n) {
|
|
83
187
|
return s.length <= n ? s : s.slice(0, n - 3) + '...';
|
|
84
188
|
}
|
|
189
|
+
/** Replace the home directory prefix with ~ for display. */
|
|
85
190
|
function shortenPath(p) {
|
|
86
191
|
const home = process.env.HOME || '';
|
|
87
192
|
if (home && p.startsWith(home))
|
|
@@ -91,8 +196,9 @@ function shortenPath(p) {
|
|
|
91
196
|
// ---------------------------------------------------------------------------
|
|
92
197
|
// Claude parser
|
|
93
198
|
// ---------------------------------------------------------------------------
|
|
199
|
+
/** Parse a Claude JSONL session file into normalized events. */
|
|
94
200
|
export function parseClaude(filePath) {
|
|
95
|
-
const content =
|
|
201
|
+
const content = safeReadSessionFile(filePath);
|
|
96
202
|
const lines = content.split('\n').filter(l => l.trim());
|
|
97
203
|
const events = [];
|
|
98
204
|
// Map tool_use id -> {tool, args} for correlating with tool_result
|
|
@@ -279,8 +385,9 @@ export function parseClaude(filePath) {
|
|
|
279
385
|
// ---------------------------------------------------------------------------
|
|
280
386
|
// Codex parser
|
|
281
387
|
// ---------------------------------------------------------------------------
|
|
388
|
+
/** Parse a Codex JSONL session file into normalized events. */
|
|
282
389
|
export function parseCodex(filePath) {
|
|
283
|
-
const content =
|
|
390
|
+
const content = safeReadSessionFile(filePath);
|
|
284
391
|
const lines = content.split('\n').filter(l => l.trim());
|
|
285
392
|
const events = [];
|
|
286
393
|
// Track function_call id -> name for correlating with function_call_output
|
|
@@ -403,8 +510,9 @@ export function parseCodex(filePath) {
|
|
|
403
510
|
// ---------------------------------------------------------------------------
|
|
404
511
|
// Gemini parser
|
|
405
512
|
// ---------------------------------------------------------------------------
|
|
513
|
+
/** Parse a Gemini JSON session file into normalized events. */
|
|
406
514
|
export function parseGemini(filePath) {
|
|
407
|
-
const content =
|
|
515
|
+
const content = safeReadSessionFile(filePath);
|
|
408
516
|
let session;
|
|
409
517
|
try {
|
|
410
518
|
session = JSON.parse(content);
|
|
@@ -647,4 +755,154 @@ export function parseOpenCode(filePath) {
|
|
|
647
755
|
}
|
|
648
756
|
return events;
|
|
649
757
|
}
|
|
650
|
-
|
|
758
|
+
// ---------------------------------------------------------------------------
|
|
759
|
+
// Rush parser
|
|
760
|
+
//
|
|
761
|
+
// Rush messages.jsonl format is flat: one JSON object per line with
|
|
762
|
+
// { id, session_id, role, type, content, created_at, tool_call_id?, name? }
|
|
763
|
+
// type ∈ {message, tool_call, tool_result}
|
|
764
|
+
// content varies by type:
|
|
765
|
+
// message -> { text: string }
|
|
766
|
+
// tool_call -> { input: {...} }
|
|
767
|
+
// tool_result -> { input, output } (output.success === false marks an error)
|
|
768
|
+
// ---------------------------------------------------------------------------
|
|
769
|
+
/** Parse a Rush JSONL session file into normalized events. */
|
|
770
|
+
export function parseRush(filePath) {
|
|
771
|
+
const content = safeReadSessionFile(filePath);
|
|
772
|
+
const lines = content.split('\n').filter(l => l.trim());
|
|
773
|
+
const events = [];
|
|
774
|
+
// Map tool_call id -> {tool, args} for correlating with tool_result.
|
|
775
|
+
const toolCallMap = new Map();
|
|
776
|
+
for (const line of lines) {
|
|
777
|
+
let raw;
|
|
778
|
+
try {
|
|
779
|
+
raw = JSON.parse(line);
|
|
780
|
+
}
|
|
781
|
+
catch {
|
|
782
|
+
/* malformed JSONL line, skip */
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
const type = raw.type;
|
|
786
|
+
const timestamp = raw.created_at || new Date().toISOString();
|
|
787
|
+
const content = raw.content || {};
|
|
788
|
+
if (type === 'message') {
|
|
789
|
+
const text = typeof content.text === 'string' ? content.text.trim() : '';
|
|
790
|
+
if (!text)
|
|
791
|
+
continue;
|
|
792
|
+
const role = raw.role === 'user' ? 'user' : 'assistant';
|
|
793
|
+
// Rush wraps the first user turn in <user_input>...</user_input> — strip.
|
|
794
|
+
const cleaned = text
|
|
795
|
+
.replace(/^<user_input>/, '')
|
|
796
|
+
.replace(/<\/user_input>$/, '')
|
|
797
|
+
.trim();
|
|
798
|
+
// Skip sentinel execution-start marker that isn't human-readable.
|
|
799
|
+
if (raw.role === 'system' && cleaned === 'execution_start')
|
|
800
|
+
continue;
|
|
801
|
+
events.push({
|
|
802
|
+
type: 'message',
|
|
803
|
+
agent: 'rush',
|
|
804
|
+
timestamp,
|
|
805
|
+
role,
|
|
806
|
+
content: cleaned,
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
else if (type === 'tool_call') {
|
|
810
|
+
const toolName = raw.name || 'unknown';
|
|
811
|
+
const args = content.input || {};
|
|
812
|
+
const callId = raw.tool_call_id;
|
|
813
|
+
if (callId)
|
|
814
|
+
toolCallMap.set(callId, { tool: toolName, args });
|
|
815
|
+
events.push({
|
|
816
|
+
type: 'tool_use',
|
|
817
|
+
agent: 'rush',
|
|
818
|
+
timestamp,
|
|
819
|
+
tool: toolName,
|
|
820
|
+
args,
|
|
821
|
+
path: args.file_path || args.path || undefined,
|
|
822
|
+
command: (toolName === 'Bash' || toolName === 'shell') ? args.command : undefined,
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
else if (type === 'tool_result') {
|
|
826
|
+
const callId = raw.tool_call_id;
|
|
827
|
+
const info = callId ? toolCallMap.get(callId) : undefined;
|
|
828
|
+
const output = content.output;
|
|
829
|
+
let outputStr = '';
|
|
830
|
+
if (typeof output === 'string') {
|
|
831
|
+
outputStr = output;
|
|
832
|
+
}
|
|
833
|
+
else if (output !== undefined) {
|
|
834
|
+
try {
|
|
835
|
+
outputStr = JSON.stringify(output);
|
|
836
|
+
}
|
|
837
|
+
catch {
|
|
838
|
+
outputStr = String(output);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
const success = output?.success !== false;
|
|
842
|
+
events.push({
|
|
843
|
+
type: success ? 'tool_result' : 'error',
|
|
844
|
+
agent: 'rush',
|
|
845
|
+
timestamp,
|
|
846
|
+
tool: info?.tool ?? raw.name,
|
|
847
|
+
success,
|
|
848
|
+
output: outputStr.length > 500 ? outputStr.slice(0, 497) + '...' : outputStr,
|
|
849
|
+
});
|
|
850
|
+
if (callId)
|
|
851
|
+
toolCallMap.delete(callId);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return events;
|
|
855
|
+
}
|
|
856
|
+
// ---------------------------------------------------------------------------
|
|
857
|
+
// Hermes parser
|
|
858
|
+
//
|
|
859
|
+
// Hermes stores one JSON file per session at ~/.hermes/sessions/session_<id>.json:
|
|
860
|
+
// { session_id, model, platform, session_start, last_updated,
|
|
861
|
+
// system_prompt, message_count, messages: [{role, content}, ...] }
|
|
862
|
+
// Content may be a string or an array of text parts.
|
|
863
|
+
// ---------------------------------------------------------------------------
|
|
864
|
+
/** Parse a Hermes session JSON file into normalized events. */
|
|
865
|
+
export function parseHermes(filePath) {
|
|
866
|
+
let session;
|
|
867
|
+
try {
|
|
868
|
+
session = JSON.parse(safeReadSessionFile(filePath));
|
|
869
|
+
}
|
|
870
|
+
catch {
|
|
871
|
+
return [];
|
|
872
|
+
}
|
|
873
|
+
const messages = Array.isArray(session.messages) ? session.messages : [];
|
|
874
|
+
const timestamp = typeof session.session_start === 'string'
|
|
875
|
+
? session.session_start
|
|
876
|
+
: new Date().toISOString();
|
|
877
|
+
const events = [];
|
|
878
|
+
for (const msg of messages) {
|
|
879
|
+
const role = msg?.role === 'user' ? 'user' : 'assistant';
|
|
880
|
+
const text = hermesContentToText(msg?.content);
|
|
881
|
+
if (!text)
|
|
882
|
+
continue;
|
|
883
|
+
events.push({
|
|
884
|
+
type: 'message',
|
|
885
|
+
agent: 'hermes',
|
|
886
|
+
timestamp,
|
|
887
|
+
role,
|
|
888
|
+
content: text,
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
return events;
|
|
892
|
+
}
|
|
893
|
+
function hermesContentToText(content) {
|
|
894
|
+
if (typeof content === 'string')
|
|
895
|
+
return content.trim();
|
|
896
|
+
if (!Array.isArray(content))
|
|
897
|
+
return '';
|
|
898
|
+
return content
|
|
899
|
+
.map((part) => {
|
|
900
|
+
if (typeof part === 'string')
|
|
901
|
+
return part;
|
|
902
|
+
if (typeof part?.text === 'string')
|
|
903
|
+
return part.text;
|
|
904
|
+
return '';
|
|
905
|
+
})
|
|
906
|
+
.join('\n')
|
|
907
|
+
.trim();
|
|
908
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt cleaning and topic extraction for session messages.
|
|
3
|
+
*
|
|
4
|
+
* Strips noise injected by the agent framework (system context lines, XML
|
|
5
|
+
* wrapper tags, team-spawn boilerplate) so that only the real user intent
|
|
6
|
+
* remains. Used by the session picker to show a human-readable topic line.
|
|
7
|
+
*/
|
|
1
8
|
export declare const HEADLESS_PLAN_MODE_PREFIX = "You are running in HEADLESS PLAN MODE.";
|
|
9
|
+
/** Strip framework noise from a raw session prompt, returning only meaningful user text. */
|
|
2
10
|
export declare function cleanSessionPrompt(raw: string): string;
|
|
11
|
+
/** Extract a one-line topic from a raw user message, or undefined if the message is pure noise. */
|
|
3
12
|
export declare function extractSessionTopic(raw: string): string | undefined;
|
|
4
|
-
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt cleaning and topic extraction for session messages.
|
|
3
|
+
*
|
|
4
|
+
* Strips noise injected by the agent framework (system context lines, XML
|
|
5
|
+
* wrapper tags, team-spawn boilerplate) so that only the real user intent
|
|
6
|
+
* remains. Used by the session picker to show a human-readable topic line.
|
|
7
|
+
*/
|
|
8
|
+
/** Patterns that cause the entire message to be skipped for topic extraction. */
|
|
1
9
|
const WHOLE_MESSAGE_SKIP_PATTERNS = [
|
|
2
10
|
/<permissions instructions>/i,
|
|
3
11
|
/<collaboration_mode>/i,
|
|
@@ -7,6 +15,7 @@ const WHOLE_MESSAGE_SKIP_PATTERNS = [
|
|
|
7
15
|
// lives in the next user message, not in these wrapper tags.
|
|
8
16
|
/<command-(message|name|args)>/i,
|
|
9
17
|
];
|
|
18
|
+
/** Per-line noise patterns stripped during prompt cleaning (env context, bare paths, etc). */
|
|
10
19
|
const NOISE_LINE_PATTERNS = [
|
|
11
20
|
/^(cwd|shell|current_date|timezone|os|platform|arch|home|user)\b\s*:/i,
|
|
12
21
|
/^\/[\w/.-]+$/,
|
|
@@ -15,25 +24,30 @@ const NOISE_LINE_PATTERNS = [
|
|
|
15
24
|
/^[A-Z][A-Za-z]+\/[A-Z][\w+-]+$/,
|
|
16
25
|
/^Caveat:/i,
|
|
17
26
|
];
|
|
27
|
+
/** XML tag prefix used by local-command messages. */
|
|
18
28
|
const LOCAL_COMMAND_PREFIX = '<local-command-caveat>';
|
|
19
29
|
// Prefix prepended to every Claude-in-plan-mode team spawn prompt.
|
|
20
30
|
// Ends at a blank line before the real user task.
|
|
21
31
|
export const HEADLESS_PLAN_MODE_PREFIX = 'You are running in HEADLESS PLAN MODE.';
|
|
22
32
|
// Wrappers added to team-spawned prompts in src/lib/teams/agents.ts.
|
|
23
33
|
// Stripped before topic extraction so the picker shows what the user actually typed.
|
|
34
|
+
/** Marker string appended to team-spawned prompts; stripped before topic extraction. */
|
|
24
35
|
const TEAM_PROMPT_SUFFIX_MARKER = "When you're done, provide a brief summary of:";
|
|
36
|
+
/** Remove headless-plan-mode prefix and team summary suffix from a raw prompt. */
|
|
25
37
|
function stripTeamWrappers(raw) {
|
|
26
38
|
let text = raw;
|
|
27
39
|
if (text.trimStart().startsWith(HEADLESS_PLAN_MODE_PREFIX)) {
|
|
28
40
|
const blankLine = text.indexOf('\n\n');
|
|
29
|
-
if (blankLine
|
|
30
|
-
|
|
41
|
+
if (blankLine === -1)
|
|
42
|
+
return '';
|
|
43
|
+
text = text.slice(blankLine + 2);
|
|
31
44
|
}
|
|
32
45
|
const suffixIdx = text.indexOf(TEAM_PROMPT_SUFFIX_MARKER);
|
|
33
46
|
if (suffixIdx !== -1)
|
|
34
47
|
text = text.slice(0, suffixIdx);
|
|
35
48
|
return text.trim();
|
|
36
49
|
}
|
|
50
|
+
/** Strip framework noise from a raw session prompt, returning only meaningful user text. */
|
|
37
51
|
export function cleanSessionPrompt(raw) {
|
|
38
52
|
let text = stripTeamWrappers(raw).replace(/\r/g, '').trim();
|
|
39
53
|
if (!text)
|
|
@@ -46,6 +60,7 @@ export function cleanSessionPrompt(raw) {
|
|
|
46
60
|
.filter(line => !NOISE_LINE_PATTERNS.some(pattern => pattern.test(line)));
|
|
47
61
|
return meaningful.join('\n').trim();
|
|
48
62
|
}
|
|
63
|
+
/** Extract a one-line topic from a raw user message, or undefined if the message is pure noise. */
|
|
49
64
|
export function extractSessionTopic(raw) {
|
|
50
65
|
if (!raw.trim())
|
|
51
66
|
return undefined;
|
|
@@ -61,4 +76,3 @@ export function extractSessionTopic(raw) {
|
|
|
61
76
|
const firstLine = cleaned.split('\n').map(line => line.trim()).find(Boolean);
|
|
62
77
|
return firstLine || undefined;
|
|
63
78
|
}
|
|
64
|
-
//# sourceMappingURL=prompt.js.map
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session rendering: summary, markdown conversation, and JSON output.
|
|
3
|
+
*
|
|
4
|
+
* Provides the display layer for `agents sessions <id>`. The summary renderer
|
|
5
|
+
* produces a chalk-formatted activity overview (modified files, commands,
|
|
6
|
+
* errors, final message). The markdown renderer emits a full conversation
|
|
7
|
+
* transcript. Filtering by role and turn slicing is handled here as well.
|
|
8
|
+
*/
|
|
1
9
|
import type { SessionEvent } from './types.js';
|
|
2
10
|
/**
|
|
3
11
|
* Return absPath relative to cwd; fall back to ~/… then absolute.
|
|
@@ -35,6 +43,7 @@ export declare function collapseRetries(commands: Array<{
|
|
|
35
43
|
cmd: string;
|
|
36
44
|
ts: number;
|
|
37
45
|
}>): CmdRun[];
|
|
46
|
+
/** Aggregated statistics computed from a session's parsed events. */
|
|
38
47
|
export interface SessionStats {
|
|
39
48
|
models: string[];
|
|
40
49
|
userTurns: number;
|
|
@@ -46,6 +55,7 @@ export interface SessionStats {
|
|
|
46
55
|
firstTs: number;
|
|
47
56
|
lastTs: number;
|
|
48
57
|
}
|
|
58
|
+
/** Compute aggregate statistics (turns, tools, tokens, duration) from session events. */
|
|
49
59
|
export declare function computeSummaryStats(events: SessionEvent[]): SessionStats;
|
|
50
60
|
/**
|
|
51
61
|
* Return the stats line for a session summary header.
|
|
@@ -57,8 +67,11 @@ export declare function renderSummaryHeader(stats: SessionStats): string;
|
|
|
57
67
|
* Returns a chalk-formatted string (not markdown) for direct terminal output.
|
|
58
68
|
*/
|
|
59
69
|
export declare function renderSummary(events: SessionEvent[], cwd?: string): string;
|
|
70
|
+
/** Allowed values for --include/--exclude role filters. */
|
|
60
71
|
export declare const VALID_ROLE_VALUES: readonly ["user", "assistant", "thinking", "tools"];
|
|
72
|
+
/** A single role filter value derived from VALID_ROLE_VALUES. */
|
|
61
73
|
export type RoleFilter = typeof VALID_ROLE_VALUES[number];
|
|
74
|
+
/** Options for filtering session events by role and turn range. */
|
|
62
75
|
export interface FilterOptions {
|
|
63
76
|
include?: RoleFilter[];
|
|
64
77
|
exclude?: RoleFilter[];
|
|
@@ -87,4 +100,3 @@ export declare function renderConversationMarkdown(events: SessionEvent[]): stri
|
|
|
87
100
|
*/
|
|
88
101
|
export declare function renderJson(events: SessionEvent[]): string;
|
|
89
102
|
export {};
|
|
90
|
-
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session rendering: summary, markdown conversation, and JSON output.
|
|
3
|
+
*
|
|
4
|
+
* Provides the display layer for `agents sessions <id>`. The summary renderer
|
|
5
|
+
* produces a chalk-formatted activity overview (modified files, commands,
|
|
6
|
+
* errors, final message). The markdown renderer emits a full conversation
|
|
7
|
+
* transcript. Filtering by role and turn slicing is handled here as well.
|
|
8
|
+
*/
|
|
1
9
|
import chalk from 'chalk';
|
|
2
10
|
import { summarizeToolUse } from './parse.js';
|
|
3
11
|
import { cleanSessionPrompt, extractSessionTopic } from './prompt.js';
|
|
@@ -70,6 +78,7 @@ export function normalizeForDedup(cmd) {
|
|
|
70
78
|
}
|
|
71
79
|
return s.trim();
|
|
72
80
|
}
|
|
81
|
+
/** Command classification categories with signal levels for summary rendering. */
|
|
73
82
|
const CATEGORIES = [
|
|
74
83
|
{ name: 'Probes', match: t => ['ls', 'cat', 'head', 'tail', 'wc', 'stat', 'file', 'which', 'tree', 'pwd'].includes(t), signal: 'low' },
|
|
75
84
|
{ name: 'Search', match: t => ['grep', 'rg', 'ag', 'fd', 'find'].includes(t), signal: 'low' },
|
|
@@ -81,6 +90,7 @@ const CATEGORIES = [
|
|
|
81
90
|
{ name: 'Shell', match: t => ['rm', 'mv', 'cp', 'mkdir', 'touch', 'echo', 'printf', 'chmod', 'ln', 'awk', 'sed', 'tee', 'xargs', 'for'].includes(t), signal: 'low' },
|
|
82
91
|
{ name: 'Wait', match: t => ['sleep', 'wait'].includes(t), signal: 'low' },
|
|
83
92
|
];
|
|
93
|
+
/** CLI tools whose subcommand (second token) is included in the bucket key. */
|
|
84
94
|
const TWO_LEVEL_TOKENS = new Set([
|
|
85
95
|
'git', 'gh', 'bun', 'npm', 'cargo', 'docker', 'kubectl', 'rush', 'openclaw', 'pnpm', 'yarn',
|
|
86
96
|
]);
|
|
@@ -139,6 +149,7 @@ export function collapseRetries(commands) {
|
|
|
139
149
|
}
|
|
140
150
|
return result;
|
|
141
151
|
}
|
|
152
|
+
/** Compute aggregate statistics (turns, tools, tokens, duration) from session events. */
|
|
142
153
|
export function computeSummaryStats(events) {
|
|
143
154
|
const modelSet = new Set();
|
|
144
155
|
let userTurns = 0;
|
|
@@ -188,9 +199,11 @@ export function computeSummaryStats(events) {
|
|
|
188
199
|
lastTs: lastTs === -Infinity ? 0 : lastTs,
|
|
189
200
|
};
|
|
190
201
|
}
|
|
202
|
+
/** Strip the 'claude-' prefix and date suffix from a model identifier. */
|
|
191
203
|
function shortenModel(model) {
|
|
192
204
|
return model.replace(/^claude-/, '').replace(/-\d{8}$/, '');
|
|
193
205
|
}
|
|
206
|
+
/** Format a token count as a human-readable string (e.g. 67.5K, 1.2M). */
|
|
194
207
|
function formatTokenCount(n) {
|
|
195
208
|
if (n === 0)
|
|
196
209
|
return '0';
|
|
@@ -203,6 +216,7 @@ function formatTokenCount(n) {
|
|
|
203
216
|
const m = n / 1_000_000;
|
|
204
217
|
return (m >= 100 ? Math.round(m) : parseFloat(m.toFixed(1))) + 'M';
|
|
205
218
|
}
|
|
219
|
+
/** Format a duration in milliseconds as a human-readable string (e.g. '12 min', '2h 30min'). */
|
|
206
220
|
function formatDuration(ms) {
|
|
207
221
|
const totalMin = Math.round(ms / 60_000);
|
|
208
222
|
if (totalMin < 1)
|
|
@@ -239,6 +253,7 @@ export function renderSummaryHeader(stats) {
|
|
|
239
253
|
return parts.join(' · ');
|
|
240
254
|
}
|
|
241
255
|
// ── Prompt reference extraction ───────────────────────────────────────────────
|
|
256
|
+
/** Extract @-mentions, slash paths, and ~/... references from a prompt string. */
|
|
242
257
|
function extractReferences(text) {
|
|
243
258
|
const refs = new Set();
|
|
244
259
|
for (const m of text.matchAll(/@[\w/.-]+/g))
|
|
@@ -249,6 +264,7 @@ function extractReferences(text) {
|
|
|
249
264
|
refs.add(m[0]);
|
|
250
265
|
return Array.from(refs);
|
|
251
266
|
}
|
|
267
|
+
/** Render the Commands section of the summary, grouping by category and collapsing retries. */
|
|
252
268
|
function renderCommandsSection(cmds, lines) {
|
|
253
269
|
if (cmds.length === 0)
|
|
254
270
|
return;
|
|
@@ -354,6 +370,7 @@ function truncateCmd(cmd, max) {
|
|
|
354
370
|
return cmd.length <= max ? cmd : cmd.slice(0, max - 1) + '…';
|
|
355
371
|
}
|
|
356
372
|
// ── File grouping ─────────────────────────────────────────────────────────────
|
|
373
|
+
/** Group file paths by their parent directory, relative to cwd. */
|
|
357
374
|
function groupByParentDir(paths, cwd) {
|
|
358
375
|
const groups = new Map();
|
|
359
376
|
for (const p of paths) {
|
|
@@ -367,6 +384,7 @@ function groupByParentDir(paths, cwd) {
|
|
|
367
384
|
}
|
|
368
385
|
return new Map(Array.from(groups.entries()).sort((a, b) => b[1].length - a[1].length));
|
|
369
386
|
}
|
|
387
|
+
/** Render grouped file paths as indented, clickable terminal lines. */
|
|
370
388
|
function renderFileGroup(lines, groups, absPathMap) {
|
|
371
389
|
if (groups.size === 1) {
|
|
372
390
|
const [dir, files] = Array.from(groups.entries())[0];
|
|
@@ -612,6 +630,7 @@ export function renderSummary(events, cwd) {
|
|
|
612
630
|
return lines.join('\n');
|
|
613
631
|
}
|
|
614
632
|
// ── Event filters ─────────────────────────────────────────────────────────────
|
|
633
|
+
/** Allowed values for --include/--exclude role filters. */
|
|
615
634
|
export const VALID_ROLE_VALUES = ['user', 'assistant', 'thinking', 'tools'];
|
|
616
635
|
/**
|
|
617
636
|
* Parse a comma-separated role list (e.g. "user,assistant") into typed values.
|
|
@@ -769,10 +788,10 @@ export function renderConversationMarkdown(events) {
|
|
|
769
788
|
export function renderJson(events) {
|
|
770
789
|
return JSON.stringify(events, null, 2);
|
|
771
790
|
}
|
|
791
|
+
/** Replace the home directory prefix with ~ for trace display. */
|
|
772
792
|
function shortenPathTrace(p) {
|
|
773
793
|
const home = process.env.HOME || '';
|
|
774
794
|
if (home && p.startsWith(home))
|
|
775
795
|
return '~' + p.slice(home.length);
|
|
776
796
|
return p;
|
|
777
797
|
}
|
|
778
|
-
//# sourceMappingURL=render.js.map
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification and filtering of team-spawned sessions.
|
|
3
|
+
*
|
|
4
|
+
* Sessions launched by `agents teams` carry an 'sdk-cli' entrypoint and
|
|
5
|
+
* optionally have a meta.json with handle/mode info. This module determines
|
|
6
|
+
* whether a session is team-origin and splits session lists into visible
|
|
7
|
+
* and hidden groups for the picker UI.
|
|
8
|
+
*/
|
|
1
9
|
import type { SessionMeta, TeamOrigin } from './types.js';
|
|
2
10
|
/**
|
|
3
11
|
* Determine whether `session` was spawned by `agents teams`.
|
|
@@ -12,6 +20,7 @@ import type { SessionMeta, TeamOrigin } from './types.js';
|
|
|
12
20
|
* when it is a normal interactive session.
|
|
13
21
|
*/
|
|
14
22
|
export declare function classifyTeamSession(session: SessionMeta): TeamOrigin | null;
|
|
23
|
+
/** Result of splitting sessions into visible and hidden (team-origin) groups. */
|
|
15
24
|
export interface FilterResult {
|
|
16
25
|
visible: SessionMeta[];
|
|
17
26
|
hiddenCount: number;
|
|
@@ -23,4 +32,3 @@ export interface FilterResult {
|
|
|
23
32
|
* excluded and counted in `hiddenCount`.
|
|
24
33
|
*/
|
|
25
34
|
export declare function filterTeamSessions(sessions: SessionMeta[], showTeams: boolean): FilterResult;
|
|
26
|
-
//# sourceMappingURL=team-filter.d.ts.map
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification and filtering of team-spawned sessions.
|
|
3
|
+
*
|
|
4
|
+
* Sessions launched by `agents teams` carry an 'sdk-cli' entrypoint and
|
|
5
|
+
* optionally have a meta.json with handle/mode info. This module determines
|
|
6
|
+
* whether a session is team-origin and splits session lists into visible
|
|
7
|
+
* and hidden groups for the picker UI.
|
|
8
|
+
*/
|
|
1
9
|
import * as fs from 'fs';
|
|
2
10
|
import * as os from 'os';
|
|
3
11
|
import * as path from 'path';
|
|
12
|
+
import { getAgentsDir } from '../state.js';
|
|
4
13
|
const HOME = os.homedir();
|
|
5
14
|
// Default path; tests can override via AGENTS_TEAMS_DIR env var.
|
|
15
|
+
/** Resolve the directory containing per-session team metadata files. */
|
|
6
16
|
function teamsAgentsDir() {
|
|
7
|
-
return process.env.AGENTS_TEAMS_DIR ?? path.join(
|
|
17
|
+
return process.env.AGENTS_TEAMS_DIR ?? path.join(getAgentsDir(), 'teams', 'agents');
|
|
8
18
|
}
|
|
9
19
|
/**
|
|
10
20
|
* Determine whether `session` was spawned by `agents teams`.
|
|
@@ -63,4 +73,3 @@ export function filterTeamSessions(sessions, showTeams) {
|
|
|
63
73
|
}
|
|
64
74
|
return { visible, hiddenCount };
|
|
65
75
|
}
|
|
66
|
-
//# sourceMappingURL=team-filter.js.map
|