@compilr-dev/cli 0.4.0 → 0.5.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/README.md +254 -68
- package/dist/.tsbuildinfo.app +1 -0
- package/dist/.tsbuildinfo.data +1 -0
- package/dist/.tsbuildinfo.domain +1 -0
- package/dist/.tsbuildinfo.foundation +1 -0
- package/dist/agent.d.ts +134 -4
- package/dist/agent.js +345 -166
- package/dist/anchors/index.d.ts +9 -0
- package/dist/anchors/index.js +9 -0
- package/dist/anchors/project-anchors.d.ts +79 -0
- package/dist/anchors/project-anchors.js +202 -0
- package/dist/auth/api-client.d.ts +124 -0
- package/dist/auth/api-client.js +261 -0
- package/dist/auth/index.d.ts +172 -0
- package/dist/auth/index.js +545 -0
- package/dist/auth/storage.d.ts +52 -0
- package/dist/auth/storage.js +118 -0
- package/dist/changelog/index.d.ts +16 -0
- package/dist/changelog/index.js +24 -0
- package/dist/changelog/releases.d.ts +17 -0
- package/dist/changelog/releases.js +63 -0
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands-v2/handlers/auth.d.ts +10 -0
- package/dist/commands-v2/handlers/auth.js +118 -0
- package/dist/commands-v2/handlers/background.d.ts +14 -0
- package/dist/commands-v2/handlers/background.js +276 -0
- package/dist/commands-v2/handlers/context.d.ts +13 -0
- package/dist/commands-v2/handlers/context.js +533 -0
- package/dist/commands-v2/handlers/core.d.ts +14 -0
- package/dist/commands-v2/handlers/core.js +290 -0
- package/dist/commands-v2/handlers/debug.d.ts +11 -0
- package/dist/commands-v2/handlers/debug.js +177 -0
- package/dist/commands-v2/handlers/delegations.d.ts +8 -0
- package/dist/commands-v2/handlers/delegations.js +29 -0
- package/dist/commands-v2/handlers/files.d.ts +8 -0
- package/dist/commands-v2/handlers/files.js +162 -0
- package/dist/commands-v2/handlers/filter.d.ts +9 -0
- package/dist/commands-v2/handlers/filter.js +130 -0
- package/dist/commands-v2/handlers/games.d.ts +7 -0
- package/dist/commands-v2/handlers/games.js +57 -0
- package/dist/commands-v2/handlers/index.d.ts +25 -0
- package/dist/commands-v2/handlers/index.js +63 -0
- package/dist/commands-v2/handlers/mcp.d.ts +8 -0
- package/dist/commands-v2/handlers/mcp.js +39 -0
- package/dist/commands-v2/handlers/notifications.d.ts +9 -0
- package/dist/commands-v2/handlers/notifications.js +34 -0
- package/dist/commands-v2/handlers/project.d.ts +22 -0
- package/dist/commands-v2/handlers/project.js +1035 -0
- package/dist/commands-v2/handlers/reset.d.ts +11 -0
- package/dist/commands-v2/handlers/reset.js +118 -0
- package/dist/commands-v2/handlers/session.d.ts +161 -0
- package/dist/commands-v2/handlers/session.js +805 -0
- package/dist/commands-v2/handlers/settings.d.ts +17 -0
- package/dist/commands-v2/handlers/settings.js +417 -0
- package/dist/commands-v2/handlers/tasks.d.ts +5 -0
- package/dist/commands-v2/handlers/tasks.js +36 -0
- package/dist/commands-v2/handlers/team.d.ts +9 -0
- package/dist/commands-v2/handlers/team.js +549 -0
- package/dist/commands-v2/handlers/terminals.d.ts +9 -0
- package/dist/commands-v2/handlers/terminals.js +34 -0
- package/dist/commands-v2/index.d.ts +14 -0
- package/dist/commands-v2/index.js +18 -0
- package/dist/commands-v2/registry.d.ts +52 -0
- package/dist/commands-v2/registry.js +114 -0
- package/dist/commands-v2/types.d.ts +153 -0
- package/dist/commands-v2/types.js +7 -0
- package/dist/commands.js +123 -7
- package/dist/compilr-diff-companion.vsix +0 -0
- package/dist/db/index.js +98 -4
- package/dist/db/repositories/document-repository.d.ts +2 -0
- package/dist/db/repositories/document-repository.js +5 -1
- package/dist/db/repositories/index.d.ts +2 -0
- package/dist/db/repositories/index.js +1 -0
- package/dist/db/repositories/plan-repository.d.ts +101 -0
- package/dist/db/repositories/plan-repository.js +275 -0
- package/dist/db/repositories/project-repository.d.ts +6 -0
- package/dist/db/repositories/project-repository.js +41 -0
- package/dist/db/repositories/work-item-repository.d.ts +15 -0
- package/dist/db/repositories/work-item-repository.js +69 -4
- package/dist/db/schema.d.ts +40 -3
- package/dist/db/schema.js +66 -3
- package/dist/episodes/index.d.ts +20 -0
- package/dist/episodes/index.js +27 -0
- package/dist/episodes/recorder.d.ts +51 -0
- package/dist/episodes/recorder.js +195 -0
- package/dist/episodes/significant-work.d.ts +21 -0
- package/dist/episodes/significant-work.js +56 -0
- package/dist/episodes/store.d.ts +38 -0
- package/dist/episodes/store.js +199 -0
- package/dist/episodes/types.d.ts +35 -0
- package/dist/episodes/types.js +6 -0
- package/dist/episodes/work-at-risk.d.ts +12 -0
- package/dist/episodes/work-at-risk.js +38 -0
- package/dist/episodes/work-summary-anchor.d.ts +23 -0
- package/dist/episodes/work-summary-anchor.js +73 -0
- package/dist/games/coins.d.ts +66 -0
- package/dist/games/coins.js +165 -0
- package/dist/games/game-base.d.ts +84 -0
- package/dist/games/game-base.js +204 -0
- package/dist/games/index.d.ts +16 -0
- package/dist/games/index.js +49 -0
- package/dist/games/scores.d.ts +69 -0
- package/dist/games/scores.js +191 -0
- package/dist/games/tetris/board.d.ts +59 -0
- package/dist/games/tetris/board.js +170 -0
- package/dist/games/tetris/index.d.ts +109 -0
- package/dist/games/tetris/index.js +610 -0
- package/dist/games/tetris/pieces.d.ts +44 -0
- package/dist/games/tetris/pieces.js +271 -0
- package/dist/games/tetris/renderer.d.ts +26 -0
- package/dist/games/tetris/renderer.js +77 -0
- package/dist/guide/guide-content.d.ts +23 -0
- package/dist/guide/guide-content.js +196 -0
- package/dist/guide/index.d.ts +8 -0
- package/dist/guide/index.js +7 -0
- package/dist/guide/shared-content.d.ts +37 -0
- package/dist/guide/shared-content.js +1272 -0
- package/dist/guide/tutorial-helpers.d.ts +57 -0
- package/dist/guide/tutorial-helpers.js +147 -0
- package/dist/handlers/ask-user-handlers.d.ts +32 -0
- package/dist/handlers/ask-user-handlers.js +104 -0
- package/dist/handlers/delegation-handlers.d.ts +34 -0
- package/dist/handlers/delegation-handlers.js +291 -0
- package/dist/handlers/permission-handler.d.ts +30 -0
- package/dist/handlers/permission-handler.js +205 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +615 -179
- package/dist/input-handlers/index.d.ts +7 -0
- package/dist/input-handlers/index.js +7 -0
- package/dist/input-handlers/memory-handler.d.ts +26 -0
- package/dist/input-handlers/memory-handler.js +69 -0
- package/dist/models/index.d.ts +10 -0
- package/dist/models/index.js +12 -0
- package/dist/models/model-registry.d.ts +38 -0
- package/dist/models/model-registry.js +69 -0
- package/dist/models/model-tiers.d.ts +28 -0
- package/dist/models/model-tiers.js +71 -0
- package/dist/models/model-validation.d.ts +25 -0
- package/dist/models/model-validation.js +291 -0
- package/dist/models/ollama-models.d.ts +73 -0
- package/dist/models/ollama-models.js +178 -0
- package/dist/models/provider-types.d.ts +6 -0
- package/dist/models/provider-types.js +1 -0
- package/dist/models/providers.d.ts +35 -0
- package/dist/models/providers.js +58 -0
- package/dist/models/types.d.ts +4 -0
- package/dist/models/types.js +4 -0
- package/dist/multi-agent/activity.d.ts +21 -0
- package/dist/multi-agent/activity.js +34 -0
- package/dist/multi-agent/agent-selection.d.ts +55 -0
- package/dist/multi-agent/agent-selection.js +90 -0
- package/dist/multi-agent/artifacts.d.ts +197 -0
- package/dist/multi-agent/artifacts.js +379 -0
- package/dist/multi-agent/checkpointer.d.ts +138 -0
- package/dist/multi-agent/checkpointer.js +471 -0
- package/dist/multi-agent/collision-utils.d.ts +16 -0
- package/dist/multi-agent/collision-utils.js +28 -0
- package/dist/multi-agent/context-resolver.d.ts +97 -0
- package/dist/multi-agent/context-resolver.js +316 -0
- package/dist/multi-agent/custom-agents.d.ts +83 -0
- package/dist/multi-agent/custom-agents.js +227 -0
- package/dist/multi-agent/delegation-tracker.d.ts +157 -0
- package/dist/multi-agent/delegation-tracker.js +243 -0
- package/dist/multi-agent/file-lock-hook.d.ts +29 -0
- package/dist/multi-agent/file-lock-hook.js +97 -0
- package/dist/multi-agent/file-locks.d.ts +58 -0
- package/dist/multi-agent/file-locks.js +194 -0
- package/dist/multi-agent/index.d.ts +24 -0
- package/dist/multi-agent/index.js +30 -0
- package/dist/multi-agent/mention-parser.d.ts +64 -0
- package/dist/multi-agent/mention-parser.js +146 -0
- package/dist/multi-agent/notification-manager.d.ts +84 -0
- package/dist/multi-agent/notification-manager.js +224 -0
- package/dist/multi-agent/pending-requests.d.ts +122 -0
- package/dist/multi-agent/pending-requests.js +155 -0
- package/dist/multi-agent/session-registry.d.ts +139 -0
- package/dist/multi-agent/session-registry.js +514 -0
- package/dist/multi-agent/shared-context.d.ts +293 -0
- package/dist/multi-agent/shared-context.js +671 -0
- package/dist/multi-agent/skill-requirements.d.ts +66 -0
- package/dist/multi-agent/skill-requirements.js +178 -0
- package/dist/multi-agent/task-assignment.d.ts +69 -0
- package/dist/multi-agent/task-assignment.js +123 -0
- package/dist/multi-agent/task-suggestion.d.ts +31 -0
- package/dist/multi-agent/task-suggestion.js +72 -0
- package/dist/multi-agent/team-agent.d.ts +201 -0
- package/dist/multi-agent/team-agent.js +488 -0
- package/dist/multi-agent/team.d.ts +286 -0
- package/dist/multi-agent/team.js +610 -0
- package/dist/multi-agent/tool-config.d.ts +110 -0
- package/dist/multi-agent/tool-config.js +661 -0
- package/dist/multi-agent/types.d.ts +211 -0
- package/dist/multi-agent/types.js +617 -0
- package/dist/prompts/plan-mode-prompt.d.ts +11 -0
- package/dist/prompts/plan-mode-prompt.js +95 -0
- package/dist/repl-helpers.d.ts +63 -0
- package/dist/repl-helpers.js +319 -0
- package/dist/repl-v2.d.ts +554 -0
- package/dist/repl-v2.js +3286 -0
- package/dist/session/index.d.ts +6 -0
- package/dist/session/index.js +6 -0
- package/dist/session/project-session-manager.d.ts +158 -0
- package/dist/session/project-session-manager.js +650 -0
- package/dist/settings/index.d.ts +156 -13
- package/dist/settings/index.js +377 -24
- package/dist/settings/mcp-config.d.ts +76 -0
- package/dist/settings/mcp-config.js +143 -0
- package/dist/settings/paths.d.ts +114 -0
- package/dist/settings/paths.js +270 -0
- package/dist/shared-handlers.d.ts +62 -0
- package/dist/shared-handlers.js +48 -0
- package/dist/system-prompt/builder.d.ts +5 -0
- package/dist/system-prompt/builder.js +4 -0
- package/dist/system-prompt/index.d.ts +18 -0
- package/dist/system-prompt/index.js +18 -0
- package/dist/system-prompt/modules.d.ts +5 -0
- package/dist/system-prompt/modules.js +4 -0
- package/dist/tabbed-menu.js +2 -1
- package/dist/templates/compilr-md-import.d.ts +16 -0
- package/dist/templates/compilr-md-import.js +241 -0
- package/dist/templates/compilr-md.js +10 -58
- package/dist/templates/config-json.d.ts +1 -25
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.js +35 -75
- package/dist/themes/colors.js +3 -1
- package/dist/themes/registry.d.ts +5 -36
- package/dist/themes/registry.js +11 -95
- package/dist/themes/types.d.ts +3 -38
- package/dist/themes/types.js +2 -2
- package/dist/tool-names.d.ts +108 -0
- package/dist/tool-names.js +227 -0
- package/dist/tools/anchor-tools.d.ts +31 -0
- package/dist/tools/anchor-tools.js +255 -0
- package/dist/tools/artifact-tools.d.ts +42 -0
- package/dist/tools/artifact-tools.js +328 -0
- package/dist/tools/ask-user-simple.d.ts +1 -1
- package/dist/tools/ask-user-simple.js +2 -1
- package/dist/tools/ask-user.d.ts +1 -1
- package/dist/tools/ask-user.js +2 -1
- package/dist/tools/backlog-wrappers.d.ts +56 -0
- package/dist/tools/backlog-wrappers.js +353 -0
- package/dist/tools/backlog.d.ts +2 -2
- package/dist/tools/backlog.js +2 -2
- package/dist/tools/db-tools.d.ts +12 -0
- package/dist/tools/db-tools.js +14 -0
- package/dist/tools/delegate-background.d.ts +27 -0
- package/dist/tools/delegate-background.js +115 -0
- package/dist/tools/delegate.d.ts +22 -0
- package/dist/tools/delegate.js +97 -0
- package/dist/tools/delegation-status.d.ts +16 -0
- package/dist/tools/delegation-status.js +128 -0
- package/dist/tools/document-db.d.ts +43 -0
- package/dist/tools/document-db.js +220 -0
- package/dist/tools/guide-tool.d.ts +12 -0
- package/dist/tools/guide-tool.js +59 -0
- package/dist/tools/handoff.d.ts +25 -0
- package/dist/tools/handoff.js +99 -0
- package/dist/tools/meta-tools.d.ts +26 -0
- package/dist/tools/meta-tools.js +47 -0
- package/dist/tools/plan-tools.d.ts +54 -0
- package/dist/tools/plan-tools.js +338 -0
- package/dist/tools/platform-adapter.d.ts +29 -0
- package/dist/tools/platform-adapter.js +394 -0
- package/dist/tools/project-db.d.ts +34 -0
- package/dist/tools/project-db.js +39 -0
- package/dist/tools/recall-work-tool.d.ts +18 -0
- package/dist/tools/recall-work-tool.js +82 -0
- package/dist/tools/workitem-db.d.ts +135 -0
- package/dist/tools/workitem-db.js +730 -0
- package/dist/tools.d.ts +67 -2
- package/dist/tools.js +238 -38
- package/dist/ui/ask-user-overlay.d.ts +2 -2
- package/dist/ui/ask-user-overlay.js +443 -535
- package/dist/ui/ask-user-simple-overlay.d.ts +2 -2
- package/dist/ui/ask-user-simple-overlay.js +182 -209
- package/dist/ui/autocomplete-controller.d.ts +42 -0
- package/dist/ui/autocomplete-controller.js +384 -0
- package/dist/ui/base/index.d.ts +26 -0
- package/dist/ui/base/index.js +33 -0
- package/dist/ui/base/inline-overlay-utils.d.ts +217 -0
- package/dist/ui/base/inline-overlay-utils.js +320 -0
- package/dist/ui/base/inline-overlay.d.ts +159 -0
- package/dist/ui/base/inline-overlay.js +257 -0
- package/dist/ui/base/key-utils.d.ts +15 -0
- package/dist/ui/base/key-utils.js +30 -0
- package/dist/ui/base/overlay-base-v2.d.ts +203 -0
- package/dist/ui/base/overlay-base-v2.js +260 -0
- package/dist/ui/base/overlay-base.d.ts +156 -0
- package/dist/ui/base/overlay-base.js +238 -0
- package/dist/ui/base/overlay-lifecycle.d.ts +65 -0
- package/dist/ui/base/overlay-lifecycle.js +159 -0
- package/dist/ui/base/overlay-types.d.ts +185 -0
- package/dist/ui/base/overlay-types.js +7 -0
- package/dist/ui/base/render-utils.d.ts +27 -0
- package/dist/ui/base/render-utils.js +36 -0
- package/dist/ui/base/screen-stack.d.ts +148 -0
- package/dist/ui/base/screen-stack.js +184 -0
- package/dist/ui/base/tabbed-list-overlay-v2.d.ts +118 -0
- package/dist/ui/base/tabbed-list-overlay-v2.js +335 -0
- package/dist/ui/base/tabbed-list-overlay.d.ts +153 -0
- package/dist/ui/base/tabbed-list-overlay.js +369 -0
- package/dist/ui/constants/labels.d.ts +14 -0
- package/dist/ui/constants/labels.js +51 -0
- package/dist/ui/conversation-store.d.ts +55 -0
- package/dist/ui/conversation-store.js +107 -0
- package/dist/ui/conversation.d.ts +75 -4
- package/dist/ui/conversation.js +376 -165
- package/dist/ui/diff.d.ts +7 -1
- package/dist/ui/diff.js +85 -48
- package/dist/ui/ephemeral.d.ts +1 -1
- package/dist/ui/ephemeral.js +4 -10
- package/dist/ui/features/index.d.ts +34 -0
- package/dist/ui/features/index.js +34 -0
- package/dist/ui/features/input-feature.d.ts +85 -0
- package/dist/ui/features/input-feature.js +238 -0
- package/dist/ui/features/list-feature.d.ts +155 -0
- package/dist/ui/features/list-feature.js +244 -0
- package/dist/ui/features/pagination-feature.d.ts +154 -0
- package/dist/ui/features/pagination-feature.js +238 -0
- package/dist/ui/features/search-feature.d.ts +148 -0
- package/dist/ui/features/search-feature.js +185 -0
- package/dist/ui/features/tab-feature.d.ts +194 -0
- package/dist/ui/features/tab-feature.js +307 -0
- package/dist/ui/file-autocomplete.d.ts +24 -0
- package/dist/ui/file-autocomplete.js +56 -0
- package/dist/ui/footer-renderer.d.ts +69 -0
- package/dist/ui/footer-renderer.js +431 -0
- package/dist/ui/footer.d.ts +181 -7
- package/dist/ui/footer.js +523 -74
- package/dist/ui/guardrail-overlay.d.ts +29 -0
- package/dist/ui/guardrail-overlay.js +145 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -3
- package/dist/ui/input-controller.d.ts +51 -0
- package/dist/ui/input-controller.js +176 -0
- package/dist/ui/input-prompt.d.ts +135 -33
- package/dist/ui/input-prompt.js +728 -337
- package/dist/ui/iteration-limit-overlay.d.ts +2 -2
- package/dist/ui/iteration-limit-overlay.js +92 -128
- package/dist/ui/keyboard-handler.d.ts +57 -0
- package/dist/ui/keyboard-handler.js +557 -0
- package/dist/ui/keys-overlay.d.ts +1 -0
- package/dist/ui/keys-overlay.js +203 -141
- package/dist/ui/line-utils.d.ts +88 -0
- package/dist/ui/line-utils.js +150 -0
- package/dist/ui/live-region-facade.d.ts +42 -0
- package/dist/ui/live-region-facade.js +205 -0
- package/dist/ui/live-region.d.ts +157 -0
- package/dist/ui/live-region.js +379 -0
- package/dist/ui/mascot/expressions.d.ts +32 -0
- package/dist/ui/mascot/expressions.js +213 -0
- package/dist/ui/mascot/index.d.ts +8 -0
- package/dist/ui/mascot/index.js +8 -0
- package/dist/ui/mascot/renderer.d.ts +19 -0
- package/dist/ui/mascot/renderer.js +132 -0
- package/dist/ui/overlay/data/tutorial-content.d.ts +9 -0
- package/dist/ui/overlay/data/tutorial-content.js +9 -0
- package/dist/ui/overlay/data/tutorial-registry.d.ts +12 -0
- package/dist/ui/overlay/data/tutorial-registry.js +116 -0
- package/dist/ui/overlay/data/tutorial-types.d.ts +35 -0
- package/dist/ui/overlay/data/tutorial-types.js +6 -0
- package/dist/ui/overlay/data/tutorials/basics/first-conversation.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/basics/first-conversation.js +220 -0
- package/dist/ui/overlay/data/tutorials/basics/first-project.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/basics/first-project.js +284 -0
- package/dist/ui/overlay/data/tutorials/basics/navigation.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/basics/navigation.js +22 -0
- package/dist/ui/overlay/data/tutorials/basics/welcome.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/basics/welcome.js +174 -0
- package/dist/ui/overlay/data/tutorials/config/context-management.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/context-management.js +158 -0
- package/dist/ui/overlay/data/tutorials/config/mcp-servers.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/config/mcp-servers.js +155 -0
- package/dist/ui/overlay/data/tutorials/config/model-selection.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/model-selection.js +162 -0
- package/dist/ui/overlay/data/tutorials/config/permissions-safety.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/permissions-safety.js +163 -0
- package/dist/ui/overlay/data/tutorials/config/settings-config.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/settings-config.js +166 -0
- package/dist/ui/overlay/data/tutorials/planning/arch.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/arch.js +168 -0
- package/dist/ui/overlay/data/tutorials/planning/backlog.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/backlog.js +103 -0
- package/dist/ui/overlay/data/tutorials/planning/build.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/build.js +173 -0
- package/dist/ui/overlay/data/tutorials/planning/design.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/design.js +205 -0
- package/dist/ui/overlay/data/tutorials/planning/docs.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/docs.js +143 -0
- package/dist/ui/overlay/data/tutorials/planning/prd.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/prd.js +173 -0
- package/dist/ui/overlay/data/tutorials/planning/scaffold.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/scaffold.js +164 -0
- package/dist/ui/overlay/data/tutorials/planning/sketch.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/sketch.js +58 -0
- package/dist/ui/overlay/data/tutorials/projects/anchors.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/anchors.js +248 -0
- package/dist/ui/overlay/data/tutorials/projects/import-project.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/import-project.js +172 -0
- package/dist/ui/overlay/data/tutorials/projects/managing-projects.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/projects/managing-projects.js +212 -0
- package/dist/ui/overlay/data/tutorials/projects/new-project.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/new-project.js +251 -0
- package/dist/ui/overlay/data/tutorials/projects/session-management.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/session-management.js +169 -0
- package/dist/ui/overlay/data/tutorials/teams/background-execution.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/background-execution.js +171 -0
- package/dist/ui/overlay/data/tutorials/teams/multi-terminal.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/teams/multi-terminal.js +147 -0
- package/dist/ui/overlay/data/tutorials/teams/task-assignment.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/task-assignment.js +204 -0
- package/dist/ui/overlay/data/tutorials/teams/team-overview.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/team-overview.js +165 -0
- package/dist/ui/overlay/data/tutorials/teams/working-with-agents.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/working-with-agents.js +172 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.js +814 -0
- package/dist/ui/overlay/impl/anchors-overlay-v2.d.ts +47 -0
- package/dist/ui/overlay/impl/anchors-overlay-v2.js +749 -0
- package/dist/ui/overlay/impl/arch-type-overlay-v2.d.ts +37 -0
- package/dist/ui/overlay/impl/arch-type-overlay-v2.js +240 -0
- package/dist/ui/overlay/impl/artifact-detail-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/artifact-detail-overlay-v2.js +232 -0
- package/dist/ui/overlay/impl/artifact-overlay-v2.d.ts +40 -0
- package/dist/ui/overlay/impl/artifact-overlay-v2.js +115 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.d.ts +72 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.js +581 -0
- package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.d.ts +46 -0
- package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.js +204 -0
- package/dist/ui/overlay/impl/background-overlay-v2.d.ts +40 -0
- package/dist/ui/overlay/impl/background-overlay-v2.js +147 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.d.ts +52 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.js +681 -0
- package/dist/ui/overlay/impl/changelog-overlay-v2.d.ts +44 -0
- package/dist/ui/overlay/impl/changelog-overlay-v2.js +165 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.d.ts +33 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.js +439 -0
- package/dist/ui/overlay/impl/config-overlay-v2.d.ts +111 -0
- package/dist/ui/overlay/impl/config-overlay-v2.js +718 -0
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.d.ts +83 -0
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.js +711 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.d.ts +57 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.js +382 -0
- package/dist/ui/overlay/impl/delegations-overlay-v2.d.ts +28 -0
- package/dist/ui/overlay/impl/delegations-overlay-v2.js +279 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.js +117 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.d.ts +84 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.js +1112 -0
- package/dist/ui/overlay/impl/filter-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/filter-overlay-v2.js +110 -0
- package/dist/ui/overlay/impl/games-overlay-v2.d.ts +31 -0
- package/dist/ui/overlay/impl/games-overlay-v2.js +135 -0
- package/dist/ui/overlay/impl/guardrail-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/guardrail-overlay-v2.js +114 -0
- package/dist/ui/overlay/impl/help-overlay-v2.d.ts +57 -0
- package/dist/ui/overlay/impl/help-overlay-v2.js +287 -0
- package/dist/ui/overlay/impl/init-setup-overlay-v2.d.ts +25 -0
- package/dist/ui/overlay/impl/init-setup-overlay-v2.js +97 -0
- package/dist/ui/overlay/impl/iteration-limit-overlay-v2.d.ts +35 -0
- package/dist/ui/overlay/impl/iteration-limit-overlay-v2.js +105 -0
- package/dist/ui/overlay/impl/keys-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/keys-overlay-v2.js +248 -0
- package/dist/ui/overlay/impl/login-overlay-v2.d.ts +49 -0
- package/dist/ui/overlay/impl/login-overlay-v2.js +277 -0
- package/dist/ui/overlay/impl/mascot-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/mascot-overlay-v2.js +138 -0
- package/dist/ui/overlay/impl/mcp-overlay-v2.d.ts +63 -0
- package/dist/ui/overlay/impl/mcp-overlay-v2.js +907 -0
- package/dist/ui/overlay/impl/model-overlay-v2.d.ts +93 -0
- package/dist/ui/overlay/impl/model-overlay-v2.js +1143 -0
- package/dist/ui/overlay/impl/model-warning-overlay-v2.d.ts +46 -0
- package/dist/ui/overlay/impl/model-warning-overlay-v2.js +132 -0
- package/dist/ui/overlay/impl/new-overlay-v2.d.ts +108 -0
- package/dist/ui/overlay/impl/new-overlay-v2.js +1243 -0
- package/dist/ui/overlay/impl/notifications-overlay-v2.d.ts +20 -0
- package/dist/ui/overlay/impl/notifications-overlay-v2.js +116 -0
- package/dist/ui/overlay/impl/onboarding-wizard-overlay-v2.d.ts +76 -0
- package/dist/ui/overlay/impl/onboarding-wizard-overlay-v2.js +728 -0
- package/dist/ui/overlay/impl/pending-overlay-v2.d.ts +51 -0
- package/dist/ui/overlay/impl/pending-overlay-v2.js +445 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.js +380 -0
- package/dist/ui/overlay/impl/permissions-overlay-v2.d.ts +85 -0
- package/dist/ui/overlay/impl/permissions-overlay-v2.js +820 -0
- package/dist/ui/overlay/impl/plan-approval-overlay-v2.d.ts +35 -0
- package/dist/ui/overlay/impl/plan-approval-overlay-v2.js +181 -0
- package/dist/ui/overlay/impl/project-edit-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/project-edit-overlay-v2.js +195 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.d.ts +37 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.js +733 -0
- package/dist/ui/overlay/impl/reset-overlay-v2.d.ts +39 -0
- package/dist/ui/overlay/impl/reset-overlay-v2.js +107 -0
- package/dist/ui/overlay/impl/resume-overlay-v2.d.ts +60 -0
- package/dist/ui/overlay/impl/resume-overlay-v2.js +414 -0
- package/dist/ui/overlay/impl/session-mode-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/session-mode-overlay-v2.js +124 -0
- package/dist/ui/overlay/impl/tasks-overlay-v2.d.ts +28 -0
- package/dist/ui/overlay/impl/tasks-overlay-v2.js +283 -0
- package/dist/ui/overlay/impl/team-overlay-v2.d.ts +86 -0
- package/dist/ui/overlay/impl/team-overlay-v2.js +692 -0
- package/dist/ui/overlay/impl/terminals-overlay-v2.d.ts +26 -0
- package/dist/ui/overlay/impl/terminals-overlay-v2.js +217 -0
- package/dist/ui/overlay/impl/theme-overlay-v2.d.ts +42 -0
- package/dist/ui/overlay/impl/theme-overlay-v2.js +135 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.d.ts +47 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.js +214 -0
- package/dist/ui/overlay/impl/tutorial-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/tutorial-overlay-v2.js +212 -0
- package/dist/ui/overlay/impl/workflow-overlay-v2.d.ts +80 -0
- package/dist/ui/overlay/impl/workflow-overlay-v2.js +641 -0
- package/dist/ui/overlay/index.d.ts +52 -0
- package/dist/ui/overlay/index.js +54 -0
- package/dist/ui/overlay/key-utils.d.ts +6 -0
- package/dist/ui/overlay/key-utils.js +6 -0
- package/dist/ui/overlay/types.d.ts +140 -0
- package/dist/ui/overlay/types.js +22 -0
- package/dist/ui/overlay-manager.d.ts +43 -0
- package/dist/ui/overlay-manager.js +238 -0
- package/dist/ui/overlays.d.ts +0 -4
- package/dist/ui/overlays.js +4 -460
- package/dist/ui/permission-overlay.d.ts +1 -1
- package/dist/ui/permission-overlay.js +189 -300
- package/dist/ui/providers/types.d.ts +178 -0
- package/dist/ui/providers/types.js +9 -0
- package/dist/ui/render-modes.d.ts +36 -0
- package/dist/ui/render-modes.js +44 -0
- package/dist/ui/startup-menu.d.ts +36 -0
- package/dist/ui/startup-menu.js +236 -0
- package/dist/ui/status-bar-controller.d.ts +33 -0
- package/dist/ui/status-bar-controller.js +99 -0
- package/dist/ui/subagent-renderer.d.ts +117 -0
- package/dist/ui/subagent-renderer.js +318 -0
- package/dist/ui/terminal-autocomplete-utils.d.ts +23 -0
- package/dist/ui/terminal-autocomplete-utils.js +83 -0
- package/dist/ui/terminal-codes.d.ts +94 -0
- package/dist/ui/terminal-codes.js +124 -0
- package/dist/ui/terminal-line-builders.d.ts +17 -0
- package/dist/ui/terminal-line-builders.js +42 -0
- package/dist/ui/terminal-render-item.d.ts +16 -0
- package/dist/ui/terminal-render-item.js +267 -0
- package/dist/ui/terminal-renderer.d.ts +220 -0
- package/dist/ui/terminal-renderer.js +750 -0
- package/dist/ui/terminal-types.d.ts +179 -0
- package/dist/ui/terminal-types.js +34 -0
- package/dist/ui/terminal-ui.d.ts +331 -0
- package/dist/ui/terminal-ui.js +819 -0
- package/dist/ui/terminal.d.ts +20 -0
- package/dist/ui/terminal.js +72 -0
- package/dist/ui/todo-zone.d.ts +19 -1
- package/dist/ui/todo-zone.js +124 -38
- package/dist/ui/tool-formatters.d.ts +16 -0
- package/dist/ui/tool-formatters.js +1027 -0
- package/dist/ui/turn-metrics.d.ts +56 -0
- package/dist/ui/turn-metrics.js +75 -0
- package/dist/ui/types.d.ts +28 -0
- package/dist/ui/types.js +1 -0
- package/dist/ui/vscode-diff-ipc.d.ts +102 -0
- package/dist/ui/vscode-diff-ipc.js +385 -0
- package/dist/utils/credentials.d.ts +24 -5
- package/dist/utils/credentials.js +123 -9
- package/dist/utils/debug-log.d.ts +28 -0
- package/dist/utils/debug-log.js +57 -0
- package/dist/utils/format-tokens.d.ts +13 -0
- package/dist/utils/format-tokens.js +18 -0
- package/dist/utils/git-config.d.ts +26 -0
- package/dist/utils/git-config.js +54 -0
- package/dist/utils/message-utils.d.ts +61 -0
- package/dist/utils/message-utils.js +72 -0
- package/dist/utils/model-tiers.d.ts +8 -1
- package/dist/utils/model-tiers.js +39 -17
- package/dist/utils/open-browser.d.ts +5 -0
- package/dist/utils/open-browser.js +32 -0
- package/dist/utils/path-safety.d.ts +56 -0
- package/dist/utils/path-safety.js +240 -0
- package/dist/utils/project-detection.d.ts +58 -0
- package/dist/utils/project-detection.js +424 -0
- package/dist/utils/project-memory.js +2 -1
- package/dist/utils/project-status.d.ts +2 -2
- package/dist/utils/startup-perf.d.ts +18 -0
- package/dist/utils/startup-perf.js +60 -0
- package/dist/utils/token-tracker.d.ts +62 -0
- package/dist/utils/token-tracker.js +150 -0
- package/dist/utils/token-types.d.ts +23 -0
- package/dist/utils/token-types.js +18 -0
- package/dist/utils/types/config-types.d.ts +32 -0
- package/dist/utils/types/config-types.js +8 -0
- package/dist/utils/update-checker.d.ts +28 -0
- package/dist/utils/update-checker.js +106 -0
- package/dist/utils/version.d.ts +7 -0
- package/dist/utils/version.js +10 -0
- package/dist/utils/vscode-detect.d.ts +39 -0
- package/dist/utils/vscode-detect.js +137 -0
- package/dist/workflow/guided-mode-injector.d.ts +42 -0
- package/dist/workflow/guided-mode-injector.js +191 -0
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.js +8 -0
- package/dist/workflow/step-criteria.d.ts +62 -0
- package/dist/workflow/step-criteria.js +150 -0
- package/dist/workflow/step-tracker.d.ts +92 -0
- package/dist/workflow/step-tracker.js +141 -0
- package/package.json +32 -12
- package/dist/index.old.d.ts +0 -7
- package/dist/index.old.js +0 -1014
- package/dist/repl.d.ts +0 -121
- package/dist/repl.js +0 -1878
- package/dist/templates/claude-md.d.ts +0 -7
- package/dist/templates/claude-md.js +0 -189
- package/dist/test-autocomplete.d.ts +0 -7
- package/dist/test-autocomplete.js +0 -85
- package/dist/test-tabbed-menu.d.ts +0 -7
- package/dist/test-tabbed-menu.js +0 -25
- package/dist/tool-selector.d.ts +0 -71
- package/dist/tool-selector.js +0 -184
- package/dist/ui/agents-overlay.d.ts +0 -12
- package/dist/ui/agents-overlay.js +0 -501
- package/dist/ui/arch-type-overlay.d.ts +0 -20
- package/dist/ui/arch-type-overlay.js +0 -229
- package/dist/ui/backlog-overlay.d.ts +0 -17
- package/dist/ui/backlog-overlay.js +0 -786
- package/dist/ui/commands-overlay.d.ts +0 -11
- package/dist/ui/commands-overlay.js +0 -410
- package/dist/ui/config-overlay.d.ts +0 -34
- package/dist/ui/config-overlay.js +0 -977
- package/dist/ui/init-overlay.d.ts +0 -24
- package/dist/ui/init-overlay.js +0 -525
- package/dist/ui/input-prompt-v2.d.ts +0 -179
- package/dist/ui/input-prompt-v2.js +0 -991
- package/dist/ui/model-warning-overlay.d.ts +0 -30
- package/dist/ui/model-warning-overlay.js +0 -171
- package/dist/ui/tools-overlay.d.ts +0 -26
- package/dist/ui/tools-overlay.js +0 -278
- package/dist/ui/tutorial-overlay.d.ts +0 -10
- package/dist/ui/tutorial-overlay.js +0 -936
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team Overlay V2
|
|
3
|
+
*
|
|
4
|
+
* Modal overlay for managing the multi-agent team.
|
|
5
|
+
* Uses TabbedListOverlayV2 for consistent list/tab behavior.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Members tab: List team agents, switch, add, remove
|
|
9
|
+
* - Roles tab: Available roles to add
|
|
10
|
+
* - Context tab: View per-agent context usage and shared context status
|
|
11
|
+
*/
|
|
12
|
+
import * as terminal from '../../terminal.js';
|
|
13
|
+
import { TabbedListOverlayV2, BaseScreen, stay, popScreen, closeOverlay, isEscape, isCtrlC, isEnter, isClose, extractPrintable, renderBorder, wrapText, renderProgressBar, formatTokens, } from '../../base/index.js';
|
|
14
|
+
import { ROLE_METADATA } from '../../../multi-agent/index.js';
|
|
15
|
+
import { PROFILE_INFO } from '../../../multi-agent/tool-config.js';
|
|
16
|
+
import { TIER_INFO, getModelForTier } from '../../../models/index.js';
|
|
17
|
+
import { getSettings } from '../../../settings/index.js';
|
|
18
|
+
import { getRoleTierDefault, setRoleTierDefault } from '../../../settings/index.js';
|
|
19
|
+
const TABS = [
|
|
20
|
+
{ id: 'members', label: 'Members' },
|
|
21
|
+
{ id: 'roles', label: 'Add Agent' },
|
|
22
|
+
{ id: 'context', label: 'Context' },
|
|
23
|
+
];
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// Detail Screen (View Agent Info)
|
|
26
|
+
// =============================================================================
|
|
27
|
+
const MODEL_TIERS_LIST = ['fast', 'balanced', 'powerful'];
|
|
28
|
+
class AgentDetailScreen extends BaseScreen {
|
|
29
|
+
item;
|
|
30
|
+
styles;
|
|
31
|
+
editingTier = false;
|
|
32
|
+
selectedTierIndex;
|
|
33
|
+
originalTierIndex;
|
|
34
|
+
constructor(item, styles) {
|
|
35
|
+
super();
|
|
36
|
+
this.item = item;
|
|
37
|
+
this.styles = styles;
|
|
38
|
+
// Initialize tier index from current tier or default to balanced
|
|
39
|
+
const currentTier = item.modelTier ?? 'balanced';
|
|
40
|
+
this.selectedTierIndex = MODEL_TIERS_LIST.indexOf(currentTier);
|
|
41
|
+
if (this.selectedTierIndex === -1)
|
|
42
|
+
this.selectedTierIndex = 1;
|
|
43
|
+
this.originalTierIndex = this.selectedTierIndex;
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const s = this.styles;
|
|
47
|
+
const cols = terminal.getTerminalWidth();
|
|
48
|
+
const border = renderBorder(cols, s);
|
|
49
|
+
const lines = [];
|
|
50
|
+
const contentWidth = cols - 6;
|
|
51
|
+
lines.push(border);
|
|
52
|
+
lines.push(` ${s.primaryBold(`${this.item.mascot} ${this.item.displayName}`)}`);
|
|
53
|
+
lines.push('');
|
|
54
|
+
// Info
|
|
55
|
+
lines.push(` ${s.muted('ID:')} ${s.primary(`$${this.item.id}`)}`);
|
|
56
|
+
lines.push(` ${s.muted('Role:')} ${s.secondary(this.item.role)}`);
|
|
57
|
+
// Model tier (editable) and model ID
|
|
58
|
+
const currentTier = MODEL_TIERS_LIST[this.selectedTierIndex];
|
|
59
|
+
const tierInfo = TIER_INFO[currentTier];
|
|
60
|
+
const tierChanged = this.selectedTierIndex !== this.originalTierIndex;
|
|
61
|
+
if (this.editingTier) {
|
|
62
|
+
const tierLabel = s.primaryBold('▶ Tier:');
|
|
63
|
+
const tierValue = s.primaryBold(`[${tierInfo.label}]`);
|
|
64
|
+
const changeHint = tierChanged ? s.warning(' ← will change model') : '';
|
|
65
|
+
lines.push(` ${tierLabel} ${tierValue}${changeHint}`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
lines.push(` ${s.muted('Tier:')} ${s.primary(`[${tierInfo.label}]`)}`);
|
|
69
|
+
}
|
|
70
|
+
// Show actual model ID
|
|
71
|
+
if (this.item.modelId) {
|
|
72
|
+
lines.push(` ${s.muted('Model:')} ${s.secondary(this.item.modelId)}`);
|
|
73
|
+
}
|
|
74
|
+
// Status badges
|
|
75
|
+
const badges = [];
|
|
76
|
+
if (this.item.isActive) {
|
|
77
|
+
badges.push(s.primary('● Active'));
|
|
78
|
+
}
|
|
79
|
+
if (this.item.isCoordinator) {
|
|
80
|
+
badges.push(s.secondary('★ Coordinator'));
|
|
81
|
+
}
|
|
82
|
+
if (this.item.hasToolRestrictions) {
|
|
83
|
+
badges.push(s.warning('◐ Tool Restrictions'));
|
|
84
|
+
}
|
|
85
|
+
if (badges.length > 0) {
|
|
86
|
+
lines.push(` ${badges.join(' ')}`);
|
|
87
|
+
}
|
|
88
|
+
lines.push('');
|
|
89
|
+
// Description
|
|
90
|
+
if (this.item.description) {
|
|
91
|
+
lines.push(` ${s.muted('Description:')}`);
|
|
92
|
+
const wrapped = wrapText(this.item.description, contentWidth);
|
|
93
|
+
for (const line of wrapped) {
|
|
94
|
+
lines.push(` ${s.secondary(line)}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Tool Profile and Skills (for custom agents)
|
|
98
|
+
if (this.item.role === 'custom' && this.item.toolProfile) {
|
|
99
|
+
lines.push('');
|
|
100
|
+
const isValidProfile = this.item.toolProfile in PROFILE_INFO;
|
|
101
|
+
const profileLabel = isValidProfile
|
|
102
|
+
? PROFILE_INFO[this.item.toolProfile].label
|
|
103
|
+
: this.item.toolProfile;
|
|
104
|
+
lines.push(` ${s.muted('Tool Profile:')} ${s.primary(profileLabel)}`);
|
|
105
|
+
if (isValidProfile) {
|
|
106
|
+
lines.push(` ${s.muted(PROFILE_INFO[this.item.toolProfile].description)}`);
|
|
107
|
+
}
|
|
108
|
+
// Show enabled skills
|
|
109
|
+
if (this.item.enabledSkills && this.item.enabledSkills.length > 0) {
|
|
110
|
+
lines.push(` ${s.muted('Skills:')} ${s.secondary(this.item.enabledSkills.join(', '))}`);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
lines.push(` ${s.muted('Skills:')} ${s.secondary('All skills enabled')}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
lines.push('');
|
|
117
|
+
// Hints - different based on editing mode
|
|
118
|
+
if (this.editingTier) {
|
|
119
|
+
lines.push(` ${s.muted('←→: change tier · Enter: confirm · Esc: cancel')}`);
|
|
120
|
+
if (tierChanged) {
|
|
121
|
+
lines.push(` ${s.warning('Note: Changing tier switches to a different model.')}`);
|
|
122
|
+
lines.push(` ${s.warning('Conversation history preserved (thinking blocks stripped).')}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
lines.push(` ${s.muted('Enter: switch to agent · t: edit model tier')}`);
|
|
127
|
+
if (this.item.id !== 'default') {
|
|
128
|
+
lines.push(` ${s.muted('d: remove from team · Esc: go back')}`);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
lines.push(` ${s.muted('Esc: go back')}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
lines.push('');
|
|
135
|
+
lines.push(border);
|
|
136
|
+
return lines;
|
|
137
|
+
}
|
|
138
|
+
getMinHeight() {
|
|
139
|
+
// More height for custom agents with tool profile info, and when editing
|
|
140
|
+
const base = this.item.role === 'custom' ? 22 : 18;
|
|
141
|
+
return this.editingTier ? base + 2 : base;
|
|
142
|
+
}
|
|
143
|
+
handleKey(data) {
|
|
144
|
+
if (this.editingTier) {
|
|
145
|
+
// In tier editing mode
|
|
146
|
+
if (isEscape(data) || isCtrlC(data)) {
|
|
147
|
+
// Cancel editing, restore original tier
|
|
148
|
+
this.selectedTierIndex = this.originalTierIndex;
|
|
149
|
+
this.editingTier = false;
|
|
150
|
+
return stay();
|
|
151
|
+
}
|
|
152
|
+
if (isEnter(data)) {
|
|
153
|
+
// Confirm tier change
|
|
154
|
+
this.editingTier = false;
|
|
155
|
+
const tierChanged = this.selectedTierIndex !== this.originalTierIndex;
|
|
156
|
+
if (tierChanged) {
|
|
157
|
+
const newTier = MODEL_TIERS_LIST[this.selectedTierIndex];
|
|
158
|
+
return closeOverlay({
|
|
159
|
+
action: 'change-tier',
|
|
160
|
+
agentId: this.item.id,
|
|
161
|
+
modelTier: newTier,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return stay();
|
|
165
|
+
}
|
|
166
|
+
// Arrow keys cycle through tiers
|
|
167
|
+
const key = data.toString();
|
|
168
|
+
if (key === '\x1b[D' || key === 'h') { // Left arrow or h
|
|
169
|
+
this.selectedTierIndex = (this.selectedTierIndex - 1 + MODEL_TIERS_LIST.length) % MODEL_TIERS_LIST.length;
|
|
170
|
+
}
|
|
171
|
+
else if (key === '\x1b[C' || key === 'l') { // Right arrow or l
|
|
172
|
+
this.selectedTierIndex = (this.selectedTierIndex + 1) % MODEL_TIERS_LIST.length;
|
|
173
|
+
}
|
|
174
|
+
return stay();
|
|
175
|
+
}
|
|
176
|
+
// Normal mode
|
|
177
|
+
if (isEscape(data) || isCtrlC(data) || isClose(data)) {
|
|
178
|
+
return popScreen();
|
|
179
|
+
}
|
|
180
|
+
if (isEnter(data)) {
|
|
181
|
+
// Switch to this agent
|
|
182
|
+
return closeOverlay({ action: 'switch', agentId: this.item.id });
|
|
183
|
+
}
|
|
184
|
+
const char = extractPrintable(data);
|
|
185
|
+
if (char === 't') {
|
|
186
|
+
// Enter tier editing mode
|
|
187
|
+
this.editingTier = true;
|
|
188
|
+
return stay();
|
|
189
|
+
}
|
|
190
|
+
if (char === 'd' && this.item.id !== 'default') {
|
|
191
|
+
// Return remove action - command handler will do the actual removal
|
|
192
|
+
// (including cleanup of custom-agents.json for custom agents)
|
|
193
|
+
return closeOverlay({ action: 'remove', agentId: this.item.id, role: this.item.role });
|
|
194
|
+
}
|
|
195
|
+
return stay();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// =============================================================================
|
|
199
|
+
// Add Role Screen (Confirm adding role with optional custom name and model tier)
|
|
200
|
+
// =============================================================================
|
|
201
|
+
class AddRoleScreen extends BaseScreen {
|
|
202
|
+
item;
|
|
203
|
+
styles;
|
|
204
|
+
customName = '';
|
|
205
|
+
selectedTierIndex;
|
|
206
|
+
setAsDefault = false;
|
|
207
|
+
focusedField = 'name';
|
|
208
|
+
roleDefaultTier;
|
|
209
|
+
userDefaultTier;
|
|
210
|
+
constructor(item, styles) {
|
|
211
|
+
super();
|
|
212
|
+
this.item = item;
|
|
213
|
+
this.styles = styles;
|
|
214
|
+
// Get role's built-in default and user's saved preference
|
|
215
|
+
this.roleDefaultTier = item.defaultModelTier ?? 'balanced';
|
|
216
|
+
this.userDefaultTier = getRoleTierDefault(item.role);
|
|
217
|
+
// Initialize to user preference if set, otherwise role default
|
|
218
|
+
const initialTier = this.userDefaultTier ?? this.roleDefaultTier;
|
|
219
|
+
this.selectedTierIndex = MODEL_TIERS_LIST.indexOf(initialTier);
|
|
220
|
+
if (this.selectedTierIndex === -1)
|
|
221
|
+
this.selectedTierIndex = 1; // fallback to balanced
|
|
222
|
+
}
|
|
223
|
+
render() {
|
|
224
|
+
const s = this.styles;
|
|
225
|
+
const cols = terminal.getTerminalWidth();
|
|
226
|
+
const border = renderBorder(cols, s);
|
|
227
|
+
const lines = [];
|
|
228
|
+
const contentWidth = cols - 6;
|
|
229
|
+
lines.push(border);
|
|
230
|
+
lines.push(` ${s.primaryBold(`Add ${this.item.mascot} ${this.item.displayName}`)}`);
|
|
231
|
+
lines.push('');
|
|
232
|
+
// Description
|
|
233
|
+
const wrapped = wrapText(this.item.description, contentWidth);
|
|
234
|
+
for (const line of wrapped) {
|
|
235
|
+
lines.push(` ${s.secondary(line)}`);
|
|
236
|
+
}
|
|
237
|
+
lines.push('');
|
|
238
|
+
// Custom name input
|
|
239
|
+
const defaultId = this.item.role;
|
|
240
|
+
const displayId = this.customName || defaultId;
|
|
241
|
+
const nameLabel = this.focusedField === 'name' ? s.primaryBold('▶ Agent ID:') : s.muted(' Agent ID:');
|
|
242
|
+
lines.push(` ${nameLabel} ${s.primary(`$${displayId}`)}${this.customName ? '' : s.muted(' (default)')}`);
|
|
243
|
+
lines.push('');
|
|
244
|
+
// Model tier - single cycling value
|
|
245
|
+
const currentTier = MODEL_TIERS_LIST[this.selectedTierIndex];
|
|
246
|
+
const tierInfo = TIER_INFO[currentTier];
|
|
247
|
+
const isRoleDefault = currentTier === this.roleDefaultTier;
|
|
248
|
+
const isUserDefault = currentTier === this.userDefaultTier;
|
|
249
|
+
let tierSuffix = '';
|
|
250
|
+
if (isUserDefault) {
|
|
251
|
+
tierSuffix = ' (your default)';
|
|
252
|
+
}
|
|
253
|
+
else if (isRoleDefault) {
|
|
254
|
+
tierSuffix = ' (default)';
|
|
255
|
+
}
|
|
256
|
+
const tierLabel = this.focusedField === 'tier' ? s.primaryBold('▶ Model Tier:') : s.muted(' Model Tier:');
|
|
257
|
+
const tierValue = this.focusedField === 'tier'
|
|
258
|
+
? s.primaryBold(`[${tierInfo.label}${tierSuffix}]`)
|
|
259
|
+
: s.primary(`[${tierInfo.label}${tierSuffix}]`);
|
|
260
|
+
lines.push(` ${tierLabel} ${tierValue}`);
|
|
261
|
+
lines.push('');
|
|
262
|
+
// Checkbox for setting as default
|
|
263
|
+
const checkboxLabel = this.focusedField === 'checkbox' ? s.primaryBold('▶') : ' ';
|
|
264
|
+
const checkboxValue = this.setAsDefault ? s.primary('[✓]') : s.muted('[ ]');
|
|
265
|
+
const checkboxText = `Set as default for ${this.item.displayName}`;
|
|
266
|
+
lines.push(` ${checkboxLabel} ${checkboxValue} ${this.focusedField === 'checkbox' ? s.primary(checkboxText) : s.secondary(checkboxText)}`);
|
|
267
|
+
lines.push('');
|
|
268
|
+
// Hints based on focused field
|
|
269
|
+
if (this.focusedField === 'name') {
|
|
270
|
+
lines.push(` ${s.muted('Type: custom name · Tab: next field · Enter: add · Esc: cancel')}`);
|
|
271
|
+
}
|
|
272
|
+
else if (this.focusedField === 'tier') {
|
|
273
|
+
lines.push(` ${s.muted('←→: change tier · Tab: next field · Enter: add · Esc: cancel')}`);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
lines.push(` ${s.muted('Space: toggle · Tab: next field · Enter: add · Esc: cancel')}`);
|
|
277
|
+
}
|
|
278
|
+
lines.push('');
|
|
279
|
+
lines.push(border);
|
|
280
|
+
return lines;
|
|
281
|
+
}
|
|
282
|
+
getMinHeight() {
|
|
283
|
+
return 18;
|
|
284
|
+
}
|
|
285
|
+
handleKey(data) {
|
|
286
|
+
if (isEscape(data) || isCtrlC(data) || isClose(data)) {
|
|
287
|
+
return popScreen();
|
|
288
|
+
}
|
|
289
|
+
if (isEnter(data)) {
|
|
290
|
+
// Save as default if checkbox is checked
|
|
291
|
+
const modelTier = MODEL_TIERS_LIST[this.selectedTierIndex];
|
|
292
|
+
if (this.setAsDefault) {
|
|
293
|
+
setRoleTierDefault(this.item.role, modelTier);
|
|
294
|
+
}
|
|
295
|
+
// Return result - command handler will do the actual add
|
|
296
|
+
const customId = this.customName.trim() || undefined;
|
|
297
|
+
return closeOverlay({ action: 'add', role: this.item.role, customId, modelTier });
|
|
298
|
+
}
|
|
299
|
+
// Tab cycles through fields: name -> tier -> checkbox -> name
|
|
300
|
+
if (data[0] === 9) { // Tab
|
|
301
|
+
if (this.focusedField === 'name') {
|
|
302
|
+
this.focusedField = 'tier';
|
|
303
|
+
}
|
|
304
|
+
else if (this.focusedField === 'tier') {
|
|
305
|
+
this.focusedField = 'checkbox';
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
this.focusedField = 'name';
|
|
309
|
+
}
|
|
310
|
+
return stay();
|
|
311
|
+
}
|
|
312
|
+
// Field-specific handling
|
|
313
|
+
if (this.focusedField === 'name') {
|
|
314
|
+
// Handle backspace
|
|
315
|
+
if (data[0] === 127 || data[0] === 8) {
|
|
316
|
+
if (this.customName.length > 0) {
|
|
317
|
+
this.customName = this.customName.slice(0, -1);
|
|
318
|
+
}
|
|
319
|
+
return stay();
|
|
320
|
+
}
|
|
321
|
+
// Handle printable characters for custom name
|
|
322
|
+
const char = extractPrintable(data);
|
|
323
|
+
if (char && /^[a-zA-Z0-9_-]$/.test(char)) {
|
|
324
|
+
this.customName += char.toLowerCase();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else if (this.focusedField === 'tier') {
|
|
328
|
+
// Tier selection - left/right arrows cycle through values
|
|
329
|
+
const key = data.toString();
|
|
330
|
+
if (key === '\x1b[D' || key === 'h') { // Left arrow or h
|
|
331
|
+
this.selectedTierIndex = (this.selectedTierIndex - 1 + MODEL_TIERS_LIST.length) % MODEL_TIERS_LIST.length;
|
|
332
|
+
}
|
|
333
|
+
else if (key === '\x1b[C' || key === 'l') { // Right arrow or l
|
|
334
|
+
this.selectedTierIndex = (this.selectedTierIndex + 1) % MODEL_TIERS_LIST.length;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
// focusedField === 'checkbox': Space toggles checkbox
|
|
339
|
+
if (data[0] === 32) { // Space
|
|
340
|
+
this.setAsDefault = !this.setAsDefault;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return stay();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// =============================================================================
|
|
347
|
+
// Context Detail Screen (View Agent Context Status)
|
|
348
|
+
// =============================================================================
|
|
349
|
+
class ContextDetailScreen extends BaseScreen {
|
|
350
|
+
item;
|
|
351
|
+
styles;
|
|
352
|
+
constructor(item, styles) {
|
|
353
|
+
super();
|
|
354
|
+
this.item = item;
|
|
355
|
+
this.styles = styles;
|
|
356
|
+
}
|
|
357
|
+
render() {
|
|
358
|
+
const s = this.styles;
|
|
359
|
+
const cols = terminal.getTerminalWidth();
|
|
360
|
+
const border = renderBorder(cols, s);
|
|
361
|
+
const lines = [];
|
|
362
|
+
lines.push(border);
|
|
363
|
+
if (this.item.isSharedContext) {
|
|
364
|
+
// Shared context detail
|
|
365
|
+
lines.push(` ${s.primaryBold('* Shared Team Context')}`);
|
|
366
|
+
lines.push('');
|
|
367
|
+
lines.push(` ${s.muted('Usage:')} ${renderProgressBar(this.item.utilization / 100, 20, s)}`);
|
|
368
|
+
lines.push(` ${s.muted('Tokens:')} ${formatTokens(this.item.currentTokens)} / ${formatTokens(this.item.maxTokens)}`);
|
|
369
|
+
lines.push('');
|
|
370
|
+
lines.push(` ${s.secondary('Shared context is injected into all agent prompts.')}`);
|
|
371
|
+
lines.push(` ${s.secondary('It includes project info, decisions, and artifact summaries.')}`);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
// Agent context detail
|
|
375
|
+
lines.push(` ${s.primaryBold(`${this.item.mascot} ${this.item.displayName} - Context`)}`);
|
|
376
|
+
lines.push('');
|
|
377
|
+
lines.push(` ${s.muted('Usage:')} ${renderProgressBar(this.item.utilization / 100, 20, s)}`);
|
|
378
|
+
lines.push(` ${s.muted('Tokens:')} ${formatTokens(this.item.currentTokens)} / ${formatTokens(this.item.maxTokens)}`);
|
|
379
|
+
lines.push(` ${s.muted('Messages:')} ${String(this.item.messageCount)}`);
|
|
380
|
+
lines.push('');
|
|
381
|
+
if (this.item.utilization > 70) {
|
|
382
|
+
lines.push(` ${s.warning('⚠ Context is getting full. Consider compacting.')}`);
|
|
383
|
+
lines.push('');
|
|
384
|
+
}
|
|
385
|
+
lines.push(` ${s.muted('Press c to compact this agent\'s context')}`);
|
|
386
|
+
}
|
|
387
|
+
lines.push(` ${s.muted('Press Esc to go back')}`);
|
|
388
|
+
lines.push('');
|
|
389
|
+
lines.push(border);
|
|
390
|
+
return lines;
|
|
391
|
+
}
|
|
392
|
+
// renderProgressBar and formatTokens are now imported from '../../base/index.js'
|
|
393
|
+
getMinHeight() {
|
|
394
|
+
return 14;
|
|
395
|
+
}
|
|
396
|
+
handleKey(data) {
|
|
397
|
+
if (isEscape(data) || isCtrlC(data) || isClose(data)) {
|
|
398
|
+
return popScreen();
|
|
399
|
+
}
|
|
400
|
+
const char = extractPrintable(data);
|
|
401
|
+
if (char === 'c' && !this.item.isSharedContext) {
|
|
402
|
+
// Request compaction for this agent
|
|
403
|
+
return closeOverlay({ action: 'compact', agentId: this.item.id });
|
|
404
|
+
}
|
|
405
|
+
return stay();
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// =============================================================================
|
|
409
|
+
// Main Overlay
|
|
410
|
+
// =============================================================================
|
|
411
|
+
export class TeamOverlayV2 extends TabbedListOverlayV2 {
|
|
412
|
+
type = 'inline';
|
|
413
|
+
id = 'team-overlay-v2';
|
|
414
|
+
constructor(team, _options = {}) {
|
|
415
|
+
const memberItems = TeamOverlayV2.buildMemberItems(team);
|
|
416
|
+
const roleItems = TeamOverlayV2.buildRoleItems(team);
|
|
417
|
+
const contextItems = TeamOverlayV2.buildContextItems(team);
|
|
418
|
+
const allItems = [...memberItems, ...roleItems, ...contextItems];
|
|
419
|
+
super({
|
|
420
|
+
title: 'Team Management',
|
|
421
|
+
tabs: TABS,
|
|
422
|
+
items: allItems,
|
|
423
|
+
pageSize: 10,
|
|
424
|
+
filterByTab: (item, tabId) => {
|
|
425
|
+
if (tabId === 'members')
|
|
426
|
+
return item.isMember;
|
|
427
|
+
if (tabId === 'context')
|
|
428
|
+
return item.isContext;
|
|
429
|
+
// roles tab: neither member nor context
|
|
430
|
+
return !item.isMember && !item.isContext;
|
|
431
|
+
},
|
|
432
|
+
getSearchText: (item) => {
|
|
433
|
+
if (item.isMember) {
|
|
434
|
+
return `${item.id} ${item.displayName} ${item.role}`;
|
|
435
|
+
}
|
|
436
|
+
if (item.isContext) {
|
|
437
|
+
return `${item.id} ${item.displayName}`;
|
|
438
|
+
}
|
|
439
|
+
if ('isCustomCreate' in item && item.isCustomCreate) {
|
|
440
|
+
return `custom create ${item.displayName}`;
|
|
441
|
+
}
|
|
442
|
+
// RoleItem (TypeScript has narrowed the type)
|
|
443
|
+
return `${item.role} ${item.displayName} ${item.description}`;
|
|
444
|
+
},
|
|
445
|
+
renderItem: (item, isSelected, styles) => {
|
|
446
|
+
const prefix = isSelected ? styles.primary('❯ ') : ' ';
|
|
447
|
+
const cols = terminal.getTerminalWidth();
|
|
448
|
+
const maxWidth = cols - 10;
|
|
449
|
+
if (item.isMember) {
|
|
450
|
+
// TeamMemberItem
|
|
451
|
+
const activeIndicator = item.isActive ? styles.primary('●') : ' ';
|
|
452
|
+
const coordIndicator = item.isCoordinator ? styles.secondary('★') : '';
|
|
453
|
+
const label = `${item.mascot} $${item.id}`;
|
|
454
|
+
const name = item.displayName;
|
|
455
|
+
// Model tier badge
|
|
456
|
+
let tierBadge = '';
|
|
457
|
+
if (item.modelTier) {
|
|
458
|
+
tierBadge = styles.muted(` [${TIER_INFO[item.modelTier].label}]`);
|
|
459
|
+
}
|
|
460
|
+
const badges = [activeIndicator, coordIndicator].filter(Boolean).join(' ');
|
|
461
|
+
let line = `${prefix}${label} ${styles.muted(`(${name})`)}${tierBadge} ${badges}`;
|
|
462
|
+
if (line.length > maxWidth) {
|
|
463
|
+
line = line.slice(0, maxWidth - 1) + '…';
|
|
464
|
+
}
|
|
465
|
+
return isSelected ? styles.primary(line) : line;
|
|
466
|
+
}
|
|
467
|
+
else if (item.isContext) {
|
|
468
|
+
// ContextItem - show progress bar
|
|
469
|
+
const pct = item.utilization;
|
|
470
|
+
const barWidth = 10;
|
|
471
|
+
const filled = Math.round((pct / 100) * barWidth);
|
|
472
|
+
const empty = barWidth - filled;
|
|
473
|
+
const bar = '█'.repeat(filled) + '░'.repeat(empty);
|
|
474
|
+
const barColor = pct > 80 ? styles.error : pct > 60 ? styles.warning : styles.primary;
|
|
475
|
+
let label;
|
|
476
|
+
if (item.isSharedContext) {
|
|
477
|
+
label = `* Shared Context`;
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
label = `${item.mascot} $${item.id}`;
|
|
481
|
+
}
|
|
482
|
+
// Pad label to fixed width for alignment (18 chars covers most cases)
|
|
483
|
+
const labelWidth = 18;
|
|
484
|
+
const paddedLabel = label.padEnd(labelWidth);
|
|
485
|
+
const tokens = formatTokens(item.currentTokens);
|
|
486
|
+
// Pad percentage to fixed width (3 chars: 0-100)
|
|
487
|
+
const pctStr = String(Math.round(pct)).padStart(3);
|
|
488
|
+
let line = `${prefix}${paddedLabel} ${barColor(bar)} ${pctStr}% (${tokens})`;
|
|
489
|
+
if (line.length > maxWidth) {
|
|
490
|
+
line = line.slice(0, maxWidth - 1) + '…';
|
|
491
|
+
}
|
|
492
|
+
return isSelected ? styles.primary(line) : line;
|
|
493
|
+
}
|
|
494
|
+
else if ('isCustomCreate' in item && item.isCustomCreate) {
|
|
495
|
+
// CustomCreateItem - special styling
|
|
496
|
+
let line = `${prefix}${styles.secondary(item.mascot)} ${styles.primary(item.displayName)}`;
|
|
497
|
+
if (line.length > maxWidth) {
|
|
498
|
+
line = line.slice(0, maxWidth - 1) + '…';
|
|
499
|
+
}
|
|
500
|
+
return line;
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
// RoleItem (TypeScript has narrowed the type)
|
|
504
|
+
const label = `${item.mascot} ${item.displayName}`;
|
|
505
|
+
// Show profile badge
|
|
506
|
+
let profileBadge = '';
|
|
507
|
+
if (item.defaultProfile && item.defaultProfile !== 'full') {
|
|
508
|
+
profileBadge = styles.muted(` [${PROFILE_INFO[item.defaultProfile].label}]`);
|
|
509
|
+
}
|
|
510
|
+
// Show tier badge
|
|
511
|
+
let tierBadge = '';
|
|
512
|
+
if (item.defaultModelTier) {
|
|
513
|
+
tierBadge = styles.muted(` [${TIER_INFO[item.defaultModelTier].label}]`);
|
|
514
|
+
}
|
|
515
|
+
const inTeamBadge = item.alreadyInTeam ? styles.muted(' (in team)') : '';
|
|
516
|
+
let line = `${prefix}${label}${profileBadge}${tierBadge}${inTeamBadge}`;
|
|
517
|
+
if (line.length > maxWidth) {
|
|
518
|
+
line = line.slice(0, maxWidth - 1) + '…';
|
|
519
|
+
}
|
|
520
|
+
if (item.alreadyInTeam) {
|
|
521
|
+
return styles.muted(line);
|
|
522
|
+
}
|
|
523
|
+
return isSelected ? styles.primary(line) : line;
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
showCount: true,
|
|
527
|
+
emptyMessage: 'No agents in team.',
|
|
528
|
+
noResultsMessage: 'No agents match the search.',
|
|
529
|
+
footerHints: (searchMode, tabId) => {
|
|
530
|
+
if (searchMode) {
|
|
531
|
+
return 'Type to search · Enter/Esc Exit search · Backspace Delete';
|
|
532
|
+
}
|
|
533
|
+
if (tabId === 'context') {
|
|
534
|
+
return 'Enter: view details · c: compact (in detail) · Tab: tabs · q/Esc: close';
|
|
535
|
+
}
|
|
536
|
+
return 'Enter: view/add · d: remove (in detail) · Tab: tabs · q/Esc: close';
|
|
537
|
+
},
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
// ---------------------------------------------------------------------------
|
|
541
|
+
// Static Data Builders
|
|
542
|
+
// ---------------------------------------------------------------------------
|
|
543
|
+
static buildMemberItems(team) {
|
|
544
|
+
const agents = team.getAll();
|
|
545
|
+
// Get current provider for model resolution
|
|
546
|
+
const settings = getSettings();
|
|
547
|
+
const settingsProvider = settings.defaultProvider;
|
|
548
|
+
// Resolve 'auto' to 'claude' as default (same as CLI startup)
|
|
549
|
+
const provider = settingsProvider === 'auto' ? 'claude' : settingsProvider;
|
|
550
|
+
return agents.map((agent) => {
|
|
551
|
+
// Resolve model ID from tier
|
|
552
|
+
const tier = agent.modelTier ?? 'balanced';
|
|
553
|
+
const modelId = getModelForTier(provider, tier);
|
|
554
|
+
return {
|
|
555
|
+
id: agent.id,
|
|
556
|
+
displayName: agent.displayName,
|
|
557
|
+
mascot: agent.mascot,
|
|
558
|
+
role: agent.role,
|
|
559
|
+
description: agent.description,
|
|
560
|
+
isActive: agent.id === team.activeAgentId,
|
|
561
|
+
isCoordinator: agent.id === team.coordinatorId,
|
|
562
|
+
hasToolRestrictions: agent.toolFilter !== undefined && agent.toolFilter.length > 0,
|
|
563
|
+
toolProfile: agent.toolProfile,
|
|
564
|
+
enabledSkills: agent.enabledSkills,
|
|
565
|
+
modelTier: agent.modelTier,
|
|
566
|
+
modelId,
|
|
567
|
+
isMember: true,
|
|
568
|
+
isContext: false,
|
|
569
|
+
};
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
static buildRoleItems(team) {
|
|
573
|
+
const existingIds = new Set(team.getAgentIds());
|
|
574
|
+
const items = [];
|
|
575
|
+
for (const [role, metadata] of Object.entries(ROLE_METADATA)) {
|
|
576
|
+
if (role === 'default' || role === 'custom')
|
|
577
|
+
continue;
|
|
578
|
+
items.push({
|
|
579
|
+
role: role,
|
|
580
|
+
displayName: metadata.displayName,
|
|
581
|
+
mascot: metadata.mascot,
|
|
582
|
+
description: metadata.description,
|
|
583
|
+
alreadyInTeam: existingIds.has(role),
|
|
584
|
+
defaultProfile: metadata.defaultToolProfile,
|
|
585
|
+
defaultModelTier: metadata.defaultModelTier,
|
|
586
|
+
isCustomCreate: false,
|
|
587
|
+
isMember: false,
|
|
588
|
+
isContext: false,
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
// Add custom agent creation option at the bottom
|
|
592
|
+
items.push({
|
|
593
|
+
displayName: 'Create Custom Agent...',
|
|
594
|
+
mascot: '[+]',
|
|
595
|
+
description: 'Define your own specialized agent',
|
|
596
|
+
isCustomCreate: true,
|
|
597
|
+
isMember: false,
|
|
598
|
+
isContext: false,
|
|
599
|
+
});
|
|
600
|
+
return items;
|
|
601
|
+
}
|
|
602
|
+
static buildContextItems(team) {
|
|
603
|
+
const items = [];
|
|
604
|
+
const agents = team.getAll();
|
|
605
|
+
// Add per-agent context items
|
|
606
|
+
for (const teamAgent of agents) {
|
|
607
|
+
// Use getContextStats() which works for both initialized and restored agents
|
|
608
|
+
const stats = teamAgent.getContextStats();
|
|
609
|
+
const currentTokens = stats.estimatedTokens;
|
|
610
|
+
const messageCount = stats.messageCount;
|
|
611
|
+
const maxTokens = 200000; // Claude's context window
|
|
612
|
+
const utilization = Math.min(100, Math.round((currentTokens / maxTokens) * 100));
|
|
613
|
+
items.push({
|
|
614
|
+
id: teamAgent.id,
|
|
615
|
+
displayName: teamAgent.displayName,
|
|
616
|
+
mascot: teamAgent.mascot,
|
|
617
|
+
utilization,
|
|
618
|
+
currentTokens,
|
|
619
|
+
maxTokens,
|
|
620
|
+
messageCount,
|
|
621
|
+
lastActive: undefined, // Could track this in future
|
|
622
|
+
isSharedContext: false,
|
|
623
|
+
isMember: false,
|
|
624
|
+
isContext: true,
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
// Add shared context summary row
|
|
628
|
+
const sharedContext = team.sharedContext;
|
|
629
|
+
const tokenBudget = sharedContext.getTokenBudget();
|
|
630
|
+
items.push({
|
|
631
|
+
id: 'shared',
|
|
632
|
+
displayName: 'Shared Context',
|
|
633
|
+
mascot: '*',
|
|
634
|
+
utilization: sharedContext.getUtilization(),
|
|
635
|
+
currentTokens: tokenBudget.current,
|
|
636
|
+
maxTokens: tokenBudget.max,
|
|
637
|
+
messageCount: 0,
|
|
638
|
+
isSharedContext: true,
|
|
639
|
+
isMember: false,
|
|
640
|
+
isContext: true,
|
|
641
|
+
});
|
|
642
|
+
return items;
|
|
643
|
+
}
|
|
644
|
+
// ---------------------------------------------------------------------------
|
|
645
|
+
// Detail Screen Creation
|
|
646
|
+
// ---------------------------------------------------------------------------
|
|
647
|
+
createDetailScreen(item) {
|
|
648
|
+
if (item.isMember) {
|
|
649
|
+
// TeamMemberItem - show detail screen
|
|
650
|
+
return new AgentDetailScreen(item, this.getStyles());
|
|
651
|
+
}
|
|
652
|
+
else if (item.isContext) {
|
|
653
|
+
// ContextItem - show context detail screen
|
|
654
|
+
return new ContextDetailScreen(item, this.getStyles());
|
|
655
|
+
}
|
|
656
|
+
else if ('isCustomCreate' in item && item.isCustomCreate) {
|
|
657
|
+
// CustomCreateItem - handled specially, should not reach here
|
|
658
|
+
// (handleKey intercepts this case)
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
// RoleItem - show add confirmation (TypeScript has narrowed the type)
|
|
663
|
+
if (item.alreadyInTeam) {
|
|
664
|
+
return null; // Already in team, do nothing
|
|
665
|
+
}
|
|
666
|
+
return new AddRoleScreen(item, this.getStyles());
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
// ---------------------------------------------------------------------------
|
|
670
|
+
// Key Handling Override
|
|
671
|
+
// ---------------------------------------------------------------------------
|
|
672
|
+
handleKey(key) {
|
|
673
|
+
const data = key.raw;
|
|
674
|
+
// Check if Enter is pressed on CustomCreateItem
|
|
675
|
+
if (isEnter(data) && this.state.filteredItems.length > 0) {
|
|
676
|
+
const currentItem = this.state.filteredItems[this.state.selectedIndex];
|
|
677
|
+
if ('isCustomCreate' in currentItem && currentItem.isCustomCreate) {
|
|
678
|
+
// Custom agent creation - close overlay and signal to show form
|
|
679
|
+
return this.close({ action: 'create-custom' });
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
// Also handle 'c' shortcut for custom creation in roles tab
|
|
683
|
+
// Only when on main list (not in a detail screen like AddRoleScreen)
|
|
684
|
+
const char = extractPrintable(data);
|
|
685
|
+
const currentTabId = TABS[this.state.currentTab]?.id;
|
|
686
|
+
if (char === 'c' && currentTabId === 'roles' && !this.state.searchMode && this.screenStack.size() === 1) {
|
|
687
|
+
return this.close({ action: 'create-custom' });
|
|
688
|
+
}
|
|
689
|
+
// Delegate to parent for all other keys
|
|
690
|
+
return super.handleKey(key);
|
|
691
|
+
}
|
|
692
|
+
}
|