@phnx-labs/agents-cli 1.12.0 → 1.14.2
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 +308 -297
- 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 +518 -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 +89 -0
- package/dist/lib/rotate.js +327 -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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Sent Events parser and terminal renderer for cloud task output.
|
|
3
|
+
*
|
|
4
|
+
* Used by `agents cloud logs -f` to stream live output from a running task
|
|
5
|
+
* and by the post-dispatch follow mode to show progress inline.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
/**
|
|
9
|
+
* Translate a (server-emitted SSE event name, raw data string) pair into a
|
|
10
|
+
* typed CloudEvent. Unknown event names are surfaced as `{ type: 'unknown' }`
|
|
11
|
+
* rather than dropped — that's the whole point of widening the taxonomy.
|
|
12
|
+
*/
|
|
13
|
+
function decodeSSEFrame(name, data, timestamp) {
|
|
14
|
+
let parsed = {};
|
|
15
|
+
try {
|
|
16
|
+
parsed = data ? JSON.parse(data) : {};
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// non-JSON payloads are kept as raw text below
|
|
20
|
+
}
|
|
21
|
+
switch (name) {
|
|
22
|
+
case 'status':
|
|
23
|
+
return { type: 'status', status: parsed.status ?? 'running', timestamp };
|
|
24
|
+
case 'text':
|
|
25
|
+
case 'output':
|
|
26
|
+
case 'message':
|
|
27
|
+
return { type: 'text', content: parsed.content ?? data, timestamp };
|
|
28
|
+
case 'thinking':
|
|
29
|
+
return { type: 'thinking', content: parsed.content ?? data, timestamp };
|
|
30
|
+
case 'tool_use':
|
|
31
|
+
return { type: 'tool_use', tool: parsed.tool ?? '', input: parsed.input, timestamp };
|
|
32
|
+
case 'tool_result':
|
|
33
|
+
return { type: 'tool_result', tool: parsed.tool ?? '', output: parsed.output, timestamp };
|
|
34
|
+
case 'usage':
|
|
35
|
+
return {
|
|
36
|
+
type: 'usage',
|
|
37
|
+
model: parsed.model,
|
|
38
|
+
inputTokens: parsed.inputTokens,
|
|
39
|
+
outputTokens: parsed.outputTokens,
|
|
40
|
+
timestamp,
|
|
41
|
+
};
|
|
42
|
+
case 'done':
|
|
43
|
+
return {
|
|
44
|
+
type: 'done',
|
|
45
|
+
status: parsed.status,
|
|
46
|
+
prUrl: parsed.prUrl,
|
|
47
|
+
summary: typeof parsed.output === 'string' ? parsed.output.slice(0, 2000) : parsed.summary,
|
|
48
|
+
timestamp,
|
|
49
|
+
};
|
|
50
|
+
case 'error':
|
|
51
|
+
return { type: 'error', message: parsed.message ?? data, timestamp };
|
|
52
|
+
default:
|
|
53
|
+
return { type: 'unknown', name, data, timestamp };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse a Server-Sent Events stream into CloudEvents.
|
|
58
|
+
* Handles `event:`, `data:`, keepalive comments, and multi-line data.
|
|
59
|
+
*/
|
|
60
|
+
export async function* parseSSE(response) {
|
|
61
|
+
if (!response.body)
|
|
62
|
+
return;
|
|
63
|
+
const reader = response.body.getReader();
|
|
64
|
+
const decoder = new TextDecoder();
|
|
65
|
+
let buffer = '';
|
|
66
|
+
let currentEvent = '';
|
|
67
|
+
let currentData = '';
|
|
68
|
+
try {
|
|
69
|
+
while (true) {
|
|
70
|
+
const { done, value } = await reader.read();
|
|
71
|
+
if (done)
|
|
72
|
+
break;
|
|
73
|
+
buffer += decoder.decode(value, { stream: true });
|
|
74
|
+
const lines = buffer.split('\n');
|
|
75
|
+
buffer = lines.pop() ?? '';
|
|
76
|
+
for (const line of lines) {
|
|
77
|
+
// Keepalive comment
|
|
78
|
+
if (line.startsWith(':'))
|
|
79
|
+
continue;
|
|
80
|
+
if (line.startsWith('event: ')) {
|
|
81
|
+
currentEvent = line.slice(7).trim();
|
|
82
|
+
}
|
|
83
|
+
else if (line.startsWith('data: ')) {
|
|
84
|
+
currentData += (currentData ? '\n' : '') + line.slice(6);
|
|
85
|
+
}
|
|
86
|
+
else if (line === '') {
|
|
87
|
+
// Empty line = end of event
|
|
88
|
+
if (currentEvent || currentData) {
|
|
89
|
+
yield decodeSSEFrame(currentEvent || 'output', currentData, new Date().toISOString());
|
|
90
|
+
currentEvent = '';
|
|
91
|
+
currentData = '';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Flush remaining
|
|
97
|
+
if (currentEvent || currentData) {
|
|
98
|
+
yield decodeSSEFrame(currentEvent || 'output', currentData, new Date().toISOString());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
reader.releaseLock();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Render a stream of CloudEvents to the terminal.
|
|
107
|
+
* Returns the final status and summary when the stream ends.
|
|
108
|
+
*/
|
|
109
|
+
export async function renderStream(events, options) {
|
|
110
|
+
let lastStatus = 'running';
|
|
111
|
+
let summary;
|
|
112
|
+
let prUrl;
|
|
113
|
+
for await (const event of events) {
|
|
114
|
+
if (options?.json) {
|
|
115
|
+
process.stdout.write(JSON.stringify(event) + '\n');
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
switch (event.type) {
|
|
119
|
+
case 'status': {
|
|
120
|
+
lastStatus = event.status;
|
|
121
|
+
process.stderr.write(`${statusLabel(lastStatus)}\n`);
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 'text': {
|
|
125
|
+
process.stdout.write(event.content);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'thinking': {
|
|
129
|
+
process.stderr.write(chalk.dim(`[thinking] ${event.content}\n`));
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case 'tool_use': {
|
|
133
|
+
process.stderr.write(chalk.cyan(`[tool] ${event.tool}\n`));
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case 'tool_result': {
|
|
137
|
+
// Tool results are usually verbose; just acknowledge inline.
|
|
138
|
+
process.stderr.write(chalk.dim(`[tool_result] ${event.tool}\n`));
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case 'usage': {
|
|
142
|
+
const parts = [];
|
|
143
|
+
if (event.model)
|
|
144
|
+
parts.push(event.model);
|
|
145
|
+
if (event.inputTokens != null)
|
|
146
|
+
parts.push(`in=${event.inputTokens}`);
|
|
147
|
+
if (event.outputTokens != null)
|
|
148
|
+
parts.push(`out=${event.outputTokens}`);
|
|
149
|
+
if (parts.length > 0) {
|
|
150
|
+
process.stderr.write(chalk.dim(`[usage] ${parts.join(' ')}\n`));
|
|
151
|
+
}
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case 'done': {
|
|
155
|
+
lastStatus = event.status ?? 'completed';
|
|
156
|
+
summary = event.summary;
|
|
157
|
+
prUrl = event.prUrl;
|
|
158
|
+
process.stderr.write(`\n${statusLabel(lastStatus)}\n`);
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case 'error': {
|
|
162
|
+
process.stderr.write(chalk.red(`Error: ${event.message}\n`));
|
|
163
|
+
lastStatus = 'failed';
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case 'unknown': {
|
|
167
|
+
process.stderr.write(chalk.dim(`[${event.name}] ${event.data}\n`));
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return { status: lastStatus, summary, prUrl };
|
|
173
|
+
}
|
|
174
|
+
/** Map a task status string to a colored terminal label. */
|
|
175
|
+
function statusLabel(status) {
|
|
176
|
+
switch (status) {
|
|
177
|
+
case 'queued':
|
|
178
|
+
case 'allocating':
|
|
179
|
+
return chalk.blue(`[${status}]`);
|
|
180
|
+
case 'running':
|
|
181
|
+
return chalk.yellow(`[${status}]`);
|
|
182
|
+
case 'completed':
|
|
183
|
+
return chalk.green('[completed]');
|
|
184
|
+
case 'needs_review':
|
|
185
|
+
case 'input_required':
|
|
186
|
+
return chalk.magenta('[needs review]');
|
|
187
|
+
case 'failed':
|
|
188
|
+
return chalk.red('[failed]');
|
|
189
|
+
case 'cancelled':
|
|
190
|
+
return chalk.gray('[cancelled]');
|
|
191
|
+
default:
|
|
192
|
+
return chalk.dim(`[${status}]`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud dispatch type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Defines the provider-agnostic interface that all cloud backends (Rush, Codex,
|
|
5
|
+
* Factory) implement, plus the shared task and event types that flow through
|
|
6
|
+
* the dispatch pipeline.
|
|
7
|
+
*/
|
|
8
|
+
/** Identifier for a supported cloud dispatch backend. */
|
|
9
|
+
export type CloudProviderId = 'rush' | 'codex' | 'factory';
|
|
10
|
+
/**
|
|
11
|
+
* Lifecycle state of a cloud-dispatched task.
|
|
12
|
+
*
|
|
13
|
+
* `idle` represents a long-lived session that has stopped between turns and
|
|
14
|
+
* can be resumed via `message()`. Distinct from the terminal `completed |
|
|
15
|
+
* failed | cancelled` states, which cannot transition back to `running`.
|
|
16
|
+
*/
|
|
17
|
+
export type CloudTaskStatus = 'queued' | 'allocating' | 'running' | 'idle' | 'input_required' | 'completed' | 'failed' | 'cancelled';
|
|
18
|
+
/** Snapshot of a dispatched task, stored locally and refreshed from the provider. */
|
|
19
|
+
export interface CloudTask {
|
|
20
|
+
id: string;
|
|
21
|
+
provider: CloudProviderId;
|
|
22
|
+
status: CloudTaskStatus;
|
|
23
|
+
agent?: string;
|
|
24
|
+
prompt: string;
|
|
25
|
+
/**
|
|
26
|
+
* First (or only) repo the task targets. Kept for back-compat with callers
|
|
27
|
+
* that treat one task as one repo. For multi-repo dispatches, see `repos`.
|
|
28
|
+
*/
|
|
29
|
+
repo?: string;
|
|
30
|
+
/**
|
|
31
|
+
* All repos the task targets, in dispatch order. Populated for multi-repo
|
|
32
|
+
* dispatches (Rush Cloud, and any provider that supports it). `repo`
|
|
33
|
+
* mirrors `repos[0]` when both are set.
|
|
34
|
+
*/
|
|
35
|
+
repos?: string[];
|
|
36
|
+
branch?: string;
|
|
37
|
+
prUrl?: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
summary?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Single event emitted by a running cloud task.
|
|
44
|
+
*
|
|
45
|
+
* Discriminated union mirroring the local `SessionEvent` taxonomy so cloud
|
|
46
|
+
* streams can be rendered with the same UI primitives as local sessions. The
|
|
47
|
+
* `unknown` variant catches event names the provider emits that the client
|
|
48
|
+
* doesn't recognize — surfacing them rather than silently dropping is the
|
|
49
|
+
* point.
|
|
50
|
+
*/
|
|
51
|
+
export type CloudEvent = {
|
|
52
|
+
type: 'text';
|
|
53
|
+
content: string;
|
|
54
|
+
timestamp?: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'thinking';
|
|
57
|
+
content: string;
|
|
58
|
+
timestamp?: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'tool_use';
|
|
61
|
+
tool: string;
|
|
62
|
+
input: unknown;
|
|
63
|
+
timestamp?: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'tool_result';
|
|
66
|
+
tool: string;
|
|
67
|
+
output: unknown;
|
|
68
|
+
timestamp?: string;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'status';
|
|
71
|
+
status: CloudTaskStatus;
|
|
72
|
+
timestamp?: string;
|
|
73
|
+
} | {
|
|
74
|
+
type: 'usage';
|
|
75
|
+
model?: string;
|
|
76
|
+
inputTokens?: number;
|
|
77
|
+
outputTokens?: number;
|
|
78
|
+
timestamp?: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'done';
|
|
81
|
+
status?: CloudTaskStatus;
|
|
82
|
+
prUrl?: string;
|
|
83
|
+
summary?: string;
|
|
84
|
+
timestamp?: string;
|
|
85
|
+
} | {
|
|
86
|
+
type: 'error';
|
|
87
|
+
message: string;
|
|
88
|
+
timestamp?: string;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'unknown';
|
|
91
|
+
name: string;
|
|
92
|
+
data: string;
|
|
93
|
+
timestamp?: string;
|
|
94
|
+
};
|
|
95
|
+
/** Reference to a skill that should ride along with a cloud dispatch. */
|
|
96
|
+
export interface SkillRef {
|
|
97
|
+
id: string;
|
|
98
|
+
version?: string;
|
|
99
|
+
}
|
|
100
|
+
/** A vision attachment carried along with a prompt (base64-encoded image bytes). */
|
|
101
|
+
export interface ImageAttachment {
|
|
102
|
+
data: string;
|
|
103
|
+
mimeType: 'image/png' | 'image/jpeg' | 'image/webp';
|
|
104
|
+
}
|
|
105
|
+
/** Maximum images allowed per dispatch (matches Cursor Background Agents). */
|
|
106
|
+
export declare const MAX_IMAGES_PER_DISPATCH = 5;
|
|
107
|
+
/** Parameters for dispatching a new cloud task. */
|
|
108
|
+
export interface DispatchOptions {
|
|
109
|
+
prompt: string;
|
|
110
|
+
agent?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Legacy single-repo target. Still honored: if `repos` is empty, this
|
|
113
|
+
* becomes the only repo. Providers that support multi-repo treat
|
|
114
|
+
* `repos = [repo]` and `repo` as equivalent.
|
|
115
|
+
*/
|
|
116
|
+
repo?: string;
|
|
117
|
+
/**
|
|
118
|
+
* One or more repos the dispatch targets. Repeatable on the CLI via
|
|
119
|
+
* `--repo`. Providers handle multi-repo differently:
|
|
120
|
+
* - Rush Cloud clones each into /workspace/<owner>/<name>/
|
|
121
|
+
* - Codex Cloud rejects (multi-repo requires an env that bundles them)
|
|
122
|
+
* - Factory (local) clones each into the workspace before dispatch
|
|
123
|
+
*/
|
|
124
|
+
repos?: string[];
|
|
125
|
+
branch?: string;
|
|
126
|
+
timeout?: string;
|
|
127
|
+
model?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Skills to ship with the dispatch. Providers that support skills mount
|
|
130
|
+
* them in the pod's skills directory before the agent runs. Providers
|
|
131
|
+
* without skill support reject via `capabilities().skills === false`.
|
|
132
|
+
*/
|
|
133
|
+
skills?: SkillRef[];
|
|
134
|
+
/**
|
|
135
|
+
* Image attachments for vision-enabled dispatch (e.g., "fix this UI bug,
|
|
136
|
+
* here's the screenshot"). Capped at MAX_IMAGES_PER_DISPATCH.
|
|
137
|
+
*/
|
|
138
|
+
images?: ImageAttachment[];
|
|
139
|
+
/** Provider-specific options (e.g., codex env ID, factory computer name). */
|
|
140
|
+
providerOptions?: Record<string, unknown>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Collapse `repo` + `repos` into a single deduped list. Exported so callers,
|
|
144
|
+
* tests, and every provider share the same resolution — one source of truth
|
|
145
|
+
* for "which repos does this dispatch target?".
|
|
146
|
+
*/
|
|
147
|
+
export declare function resolveDispatchRepos(options: DispatchOptions): string[];
|
|
148
|
+
/**
|
|
149
|
+
* What a provider can actually do. Replaces the single-bool `supports()` so
|
|
150
|
+
* callers can ask "does this provider support cancel?" without trying and
|
|
151
|
+
* catching. The CLI gates feature-specific calls on these flags and surfaces
|
|
152
|
+
* a typed error instead of letting throws bubble.
|
|
153
|
+
*/
|
|
154
|
+
export interface ProviderCapabilities {
|
|
155
|
+
/** Configured + reachable (auth present, binary installed, etc.). */
|
|
156
|
+
available: boolean;
|
|
157
|
+
dispatch: boolean;
|
|
158
|
+
status: boolean;
|
|
159
|
+
list: boolean;
|
|
160
|
+
stream: boolean;
|
|
161
|
+
cancel: boolean;
|
|
162
|
+
message: boolean;
|
|
163
|
+
multiRepo: boolean;
|
|
164
|
+
skills: boolean;
|
|
165
|
+
images: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Contract that every cloud backend must implement.
|
|
169
|
+
*
|
|
170
|
+
* Each provider translates between the unified dispatch interface and its
|
|
171
|
+
* backend-specific API (Rush Factory Floor, Codex Cloud CLI, Droid daemon).
|
|
172
|
+
*
|
|
173
|
+
* `message()` may transition a task from `idle` back to `running`.
|
|
174
|
+
*/
|
|
175
|
+
export interface CloudProvider {
|
|
176
|
+
id: CloudProviderId;
|
|
177
|
+
name: string;
|
|
178
|
+
/** Static capability map for this provider. Read before calling feature methods. */
|
|
179
|
+
capabilities(): ProviderCapabilities;
|
|
180
|
+
dispatch(options: DispatchOptions): Promise<CloudTask>;
|
|
181
|
+
status(taskId: string): Promise<CloudTask>;
|
|
182
|
+
list(filter?: {
|
|
183
|
+
status?: CloudTaskStatus;
|
|
184
|
+
}): Promise<CloudTask[]>;
|
|
185
|
+
/** Stream live output. Yields events until task completes or caller breaks. */
|
|
186
|
+
stream(taskId: string): AsyncIterable<CloudEvent>;
|
|
187
|
+
cancel(taskId: string): Promise<void>;
|
|
188
|
+
/** Send a follow-up message to a finished/idle/needs_review task. */
|
|
189
|
+
message(taskId: string, content: string): Promise<void>;
|
|
190
|
+
}
|
|
191
|
+
/** Per-provider configuration stored in the `cloud.providers` section of agents.yaml. */
|
|
192
|
+
export interface CloudProviderConfig {
|
|
193
|
+
rush?: Record<string, string>;
|
|
194
|
+
codex?: {
|
|
195
|
+
env?: string;
|
|
196
|
+
};
|
|
197
|
+
factory?: {
|
|
198
|
+
computer?: string;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/** Top-level `cloud` section of agents.yaml. */
|
|
202
|
+
export interface CloudConfig {
|
|
203
|
+
default_provider?: CloudProviderId;
|
|
204
|
+
providers?: CloudProviderConfig;
|
|
205
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud dispatch type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Defines the provider-agnostic interface that all cloud backends (Rush, Codex,
|
|
5
|
+
* Factory) implement, plus the shared task and event types that flow through
|
|
6
|
+
* the dispatch pipeline.
|
|
7
|
+
*/
|
|
8
|
+
/** Maximum images allowed per dispatch (matches Cursor Background Agents). */
|
|
9
|
+
export const MAX_IMAGES_PER_DISPATCH = 5;
|
|
10
|
+
/**
|
|
11
|
+
* Collapse `repo` + `repos` into a single deduped list. Exported so callers,
|
|
12
|
+
* tests, and every provider share the same resolution — one source of truth
|
|
13
|
+
* for "which repos does this dispatch target?".
|
|
14
|
+
*/
|
|
15
|
+
export function resolveDispatchRepos(options) {
|
|
16
|
+
const out = [];
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
const candidates = [];
|
|
19
|
+
if (options.repos)
|
|
20
|
+
candidates.push(...options.repos);
|
|
21
|
+
if (options.repo)
|
|
22
|
+
candidates.push(options.repo);
|
|
23
|
+
for (const raw of candidates) {
|
|
24
|
+
const trimmed = typeof raw === 'string' ? raw.trim() : '';
|
|
25
|
+
if (!trimmed)
|
|
26
|
+
continue;
|
|
27
|
+
const key = trimmed.toLowerCase();
|
|
28
|
+
if (seen.has(key))
|
|
29
|
+
continue;
|
|
30
|
+
seen.add(key);
|
|
31
|
+
out.push(trimmed);
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert slash-command markdown files into Codex skills for Codex releases
|
|
3
|
+
* that no longer load the legacy prompts/ directory.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentId } from './types.js';
|
|
6
|
+
export declare function shouldInstallCommandAsSkill(agent: AgentId, version: string): boolean;
|
|
7
|
+
export declare function commandSkillName(commandName: string): string;
|
|
8
|
+
export declare function buildCommandSkillContent(commandName: string, sourcePath: string): string;
|
|
9
|
+
export declare function skillSourceExists(skillName: string, skillSourceDirs: Array<string | null | undefined>): boolean;
|
|
10
|
+
export declare function installCommandSkillToVersion(agentDir: string, commandName: string, sourcePath: string, skillSourceDirs?: Array<string | null | undefined>): {
|
|
11
|
+
success: boolean;
|
|
12
|
+
skipped?: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function listCommandSkillsInVersion(agentDir: string): string[];
|
|
16
|
+
export declare function commandSkillMatches(agentDir: string, commandName: string, sourcePath: string): boolean;
|
|
17
|
+
export declare function removeCommandSkillFromVersion(agentDir: string, commandName: string): {
|
|
18
|
+
success: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert slash-command markdown files into Codex skills for Codex releases
|
|
3
|
+
* that no longer load the legacy prompts/ directory.
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import * as yaml from 'yaml';
|
|
8
|
+
import { supports } from './capabilities.js';
|
|
9
|
+
import { safeJoin } from './paths.js';
|
|
10
|
+
const COMMAND_SKILL_MARKER = 'agents_command';
|
|
11
|
+
function readCommandMetadata(sourcePath) {
|
|
12
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
13
|
+
const lines = content.split('\n');
|
|
14
|
+
if (lines[0] !== '---') {
|
|
15
|
+
return { description: '', body: content };
|
|
16
|
+
}
|
|
17
|
+
const endIndex = lines.slice(1).findIndex((line) => line === '---');
|
|
18
|
+
if (endIndex < 0) {
|
|
19
|
+
return { description: '', body: content };
|
|
20
|
+
}
|
|
21
|
+
const frontmatterEnd = endIndex + 1;
|
|
22
|
+
const frontmatter = lines.slice(1, frontmatterEnd).join('\n');
|
|
23
|
+
const body = lines.slice(frontmatterEnd + 1).join('\n').trimStart();
|
|
24
|
+
try {
|
|
25
|
+
const parsed = yaml.parse(frontmatter);
|
|
26
|
+
const description = typeof parsed?.description === 'string' ? parsed.description.trim() : '';
|
|
27
|
+
return { description, body };
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return { description: '', body };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function readSkillCommandMarker(skillMdPath) {
|
|
34
|
+
if (!fs.existsSync(skillMdPath))
|
|
35
|
+
return null;
|
|
36
|
+
const content = fs.readFileSync(skillMdPath, 'utf-8');
|
|
37
|
+
const lines = content.split('\n');
|
|
38
|
+
if (lines[0] !== '---')
|
|
39
|
+
return null;
|
|
40
|
+
const endIndex = lines.slice(1).findIndex((line) => line === '---');
|
|
41
|
+
if (endIndex < 0)
|
|
42
|
+
return null;
|
|
43
|
+
try {
|
|
44
|
+
const frontmatter = lines.slice(1, endIndex + 1).join('\n');
|
|
45
|
+
const parsed = yaml.parse(frontmatter);
|
|
46
|
+
return typeof parsed?.[COMMAND_SKILL_MARKER] === 'string' ? parsed[COMMAND_SKILL_MARKER] : null;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function shouldInstallCommandAsSkill(agent, version) {
|
|
53
|
+
if (agent !== 'codex')
|
|
54
|
+
return false;
|
|
55
|
+
return !supports(agent, 'commands', version).ok && supports(agent, 'skills', version).ok;
|
|
56
|
+
}
|
|
57
|
+
export function commandSkillName(commandName) {
|
|
58
|
+
return commandName;
|
|
59
|
+
}
|
|
60
|
+
export function buildCommandSkillContent(commandName, sourcePath) {
|
|
61
|
+
const { description, body } = readCommandMetadata(sourcePath);
|
|
62
|
+
const skillDescription = description || `Slash command converted from /${commandName}`;
|
|
63
|
+
return [
|
|
64
|
+
'---',
|
|
65
|
+
`name: ${JSON.stringify(commandSkillName(commandName))}`,
|
|
66
|
+
`description: ${JSON.stringify(skillDescription)}`,
|
|
67
|
+
`${COMMAND_SKILL_MARKER}: ${JSON.stringify(commandName)}`,
|
|
68
|
+
'---',
|
|
69
|
+
'',
|
|
70
|
+
`# /${commandName}`,
|
|
71
|
+
'',
|
|
72
|
+
`This skill contains the behavior from the legacy \`/${commandName}\` slash command.`,
|
|
73
|
+
'When invoked with `$' + commandSkillName(commandName) + '`, treat the text after the skill name as the original command arguments.',
|
|
74
|
+
'',
|
|
75
|
+
body.trimEnd(),
|
|
76
|
+
'',
|
|
77
|
+
].join('\n');
|
|
78
|
+
}
|
|
79
|
+
export function skillSourceExists(skillName, skillSourceDirs) {
|
|
80
|
+
return skillSourceDirs.some((dir) => {
|
|
81
|
+
if (!dir)
|
|
82
|
+
return false;
|
|
83
|
+
const candidate = path.join(dir, skillName);
|
|
84
|
+
return fs.existsSync(candidate) && fs.lstatSync(candidate).isDirectory();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function installCommandSkillToVersion(agentDir, commandName, sourcePath, skillSourceDirs = []) {
|
|
88
|
+
const skillName = commandSkillName(commandName);
|
|
89
|
+
if (skillSourceExists(skillName, skillSourceDirs)) {
|
|
90
|
+
return { success: false, skipped: true, error: `Skill '${skillName}' already exists` };
|
|
91
|
+
}
|
|
92
|
+
const skillsDir = safeJoin(agentDir, 'skills');
|
|
93
|
+
const skillDir = safeJoin(skillsDir, skillName);
|
|
94
|
+
try {
|
|
95
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
96
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
97
|
+
fs.writeFileSync(safeJoin(skillDir, 'SKILL.md'), buildCommandSkillContent(commandName, sourcePath), 'utf-8');
|
|
98
|
+
return { success: true };
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
return { success: false, error: err.message };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export function listCommandSkillsInVersion(agentDir) {
|
|
105
|
+
const skillsDir = path.join(agentDir, 'skills');
|
|
106
|
+
if (!fs.existsSync(skillsDir))
|
|
107
|
+
return [];
|
|
108
|
+
const names = [];
|
|
109
|
+
for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
110
|
+
if (!entry.isDirectory() || entry.name.startsWith('.'))
|
|
111
|
+
continue;
|
|
112
|
+
const marker = readSkillCommandMarker(path.join(skillsDir, entry.name, 'SKILL.md'));
|
|
113
|
+
if (marker)
|
|
114
|
+
names.push(marker);
|
|
115
|
+
}
|
|
116
|
+
return names.sort();
|
|
117
|
+
}
|
|
118
|
+
export function commandSkillMatches(agentDir, commandName, sourcePath) {
|
|
119
|
+
const skillMdPath = path.join(agentDir, 'skills', commandSkillName(commandName), 'SKILL.md');
|
|
120
|
+
if (!fs.existsSync(skillMdPath))
|
|
121
|
+
return false;
|
|
122
|
+
try {
|
|
123
|
+
return fs.readFileSync(skillMdPath, 'utf-8') === buildCommandSkillContent(commandName, sourcePath);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export function removeCommandSkillFromVersion(agentDir, commandName) {
|
|
130
|
+
const skillDir = path.join(agentDir, 'skills', commandSkillName(commandName));
|
|
131
|
+
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
132
|
+
if (readSkillCommandMarker(skillMdPath) !== commandName) {
|
|
133
|
+
return { success: true };
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
137
|
+
return { success: true };
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
return { success: false, error: err.message };
|
|
141
|
+
}
|
|
142
|
+
}
|
package/dist/lib/commands.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash command management -- discovery, installation, and syncing.
|
|
3
|
+
*
|
|
4
|
+
* Commands are markdown files in ~/.agents/commands/ exposed as `/command-name`
|
|
5
|
+
* shortcuts by agents. This module discovers them, converts between formats
|
|
6
|
+
* (markdown for Claude/Codex, TOML for Gemini), and installs them into
|
|
7
|
+
* agent version homes.
|
|
8
|
+
*/
|
|
1
9
|
import type { AgentId, CommandInstallation } from './types.js';
|
|
10
|
+
/** Scope of a command: user-global or project-local. */
|
|
2
11
|
export type CommandScope = 'user' | 'project';
|
|
12
|
+
/** Parsed metadata from a command file's YAML frontmatter. */
|
|
3
13
|
export interface CommandMetadata {
|
|
4
14
|
name: string;
|
|
5
15
|
description: string;
|
|
6
16
|
}
|
|
17
|
+
/** Result of validating command metadata. */
|
|
7
18
|
export interface ValidationResult {
|
|
8
19
|
valid: boolean;
|
|
9
20
|
errors: string[];
|
|
10
21
|
warnings: string[];
|
|
11
22
|
}
|
|
23
|
+
/** A command discovered in a repository's commands/ directory. */
|
|
12
24
|
export interface DiscoveredCommand {
|
|
13
25
|
name: string;
|
|
14
26
|
description: string;
|
|
@@ -16,16 +28,22 @@ export interface DiscoveredCommand {
|
|
|
16
28
|
isShared: boolean;
|
|
17
29
|
validation: ValidationResult;
|
|
18
30
|
}
|
|
31
|
+
/** A command installed in an agent's config directory. */
|
|
19
32
|
export interface InstalledCommand {
|
|
20
33
|
name: string;
|
|
21
34
|
scope: CommandScope;
|
|
22
35
|
path: string;
|
|
23
36
|
description?: string;
|
|
24
37
|
}
|
|
38
|
+
/** Parse command metadata (name, description) from YAML frontmatter or TOML headers. */
|
|
25
39
|
export declare function parseCommandMetadata(filePath: string): CommandMetadata | null;
|
|
40
|
+
/** Validate command metadata, returning errors and warnings. */
|
|
26
41
|
export declare function validateCommandMetadata(metadata: CommandMetadata | null, commandName: string): ValidationResult;
|
|
42
|
+
/** Discover all command markdown files in a repository's commands/ directory. */
|
|
27
43
|
export declare function discoverCommands(repoPath: string): DiscoveredCommand[];
|
|
44
|
+
/** Find the source path for a command in a repository. */
|
|
28
45
|
export declare function resolveCommandSource(repoPath: string, commandName: string): string | null;
|
|
46
|
+
/** Install a command into an agent's config directory, with optional format conversion. */
|
|
29
47
|
export declare function installCommand(sourcePath: string, agentId: AgentId, commandName: string, method?: 'symlink' | 'copy'): CommandInstallation & {
|
|
30
48
|
error?: string;
|
|
31
49
|
warnings?: string[];
|
|
@@ -77,7 +95,9 @@ export declare function iterCommandsCapableVersions(filter?: {
|
|
|
77
95
|
agent: AgentId;
|
|
78
96
|
version: string;
|
|
79
97
|
}>;
|
|
98
|
+
/** Remove a command from an agent's config directory. */
|
|
80
99
|
export declare function uninstallCommand(agentId: AgentId, commandName: string): boolean;
|
|
100
|
+
/** List command names installed for an agent in the active version home. */
|
|
81
101
|
export declare function listInstalledCommands(agentId: AgentId): string[];
|
|
82
102
|
/**
|
|
83
103
|
* Check if a command exists for an agent.
|
|
@@ -106,7 +126,8 @@ export declare function installCommandCentrally(sourcePath: string, commandName:
|
|
|
106
126
|
warnings?: string[];
|
|
107
127
|
};
|
|
108
128
|
/**
|
|
109
|
-
* List commands from
|
|
129
|
+
* List commands from user (~/.agents/commands/) and system (~/.agents-system/commands/) dirs.
|
|
130
|
+
* User dir takes priority; deduplication preserves first occurrence.
|
|
110
131
|
*/
|
|
111
132
|
export declare function listCentralCommands(): string[];
|
|
112
133
|
/**
|
|
@@ -118,4 +139,3 @@ export declare function getCommandInfo(name: string): {
|
|
|
118
139
|
path: string;
|
|
119
140
|
content: string;
|
|
120
141
|
} | null;
|
|
121
|
-
//# sourceMappingURL=commands.d.ts.map
|