mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-10 01:50:20 -07:00
feat(core,cli): implement external agent polyfills and finalize teams
- Implement External Agent kind with personality overlays (Claude Code, Codex) - Enhance AgentLoader and Registry for external agent discovery and registration - Fix critical startup race condition in Config registry initialization - Add TeamSelectionDialog and ActiveTeamIndicator to CLI UI - Include comprehensive integration and unit tests for agent teams - Refactor SubagentToolWrapper for type-safe external agent invocation
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# TASK-06: External Agent Definitions and "Polyfill" Support
|
||||
|
||||
## Objective
|
||||
|
||||
Introduce a new `external` agent kind to support integrating and "polyfilling"
|
||||
competitor agents like Claude Code and Codex into Gemini CLI teams.
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### 1. Type Definitions (`packages/core/src/agents/types.ts`)
|
||||
|
||||
- [ ] Add `ExternalAgentDefinition` to the `AgentDefinition` union.
|
||||
- [ ] Include fields for `provider` (e.g., `'claude-code'`, `'codex'`) and
|
||||
`providerOptions`.
|
||||
```typescript
|
||||
export interface ExternalAgentDefinition extends BaseAgentDefinition {
|
||||
kind: 'external';
|
||||
provider: string;
|
||||
// Allow for provider-specific configuration
|
||||
providerConfig?: Record<string, unknown>;
|
||||
}
|
||||
```
|
||||
|
||||
### 2. External Agent Invocation (`packages/core/src/agents/external-invocation.ts`)
|
||||
|
||||
- [ ] Implement `ExternalAgentInvocation` class.
|
||||
- [ ] **The Polyfill Logic:**
|
||||
- Use the system's configured default model to "polyfill" the external agent.
|
||||
- Apply a "personality overlay" to the system prompt based on the `provider`.
|
||||
- Example (Claude Code): Prepend instructions to adopt the specific style,
|
||||
tool usage patterns, and "persona" of a high-performance, concise coding
|
||||
assistant.
|
||||
- Example (Codex): Prepend instructions to act as a specialized code
|
||||
generation model.
|
||||
- Ensure the overlay is model-agnostic and relies on the `providerConfig` for
|
||||
behavior tuning.
|
||||
|
||||
### 3. Tool Wrapping (`packages/core/src/agents/subagent-tool-wrapper.ts`)
|
||||
|
||||
- [ ] Update `createInvocation` to recognize `kind === 'external'` and return an
|
||||
`ExternalAgentInvocation`.
|
||||
|
||||
## Verification
|
||||
|
||||
- Unit tests for `ExternalAgentInvocation` ensuring provider-specific prompts
|
||||
are applied.
|
||||
- Manual verification by creating an agent with `kind: external` and
|
||||
`provider: claude-code`.
|
||||
@@ -0,0 +1,49 @@
|
||||
# TASK-07: External Agent Registry and Team Marketplace placeholders
|
||||
|
||||
## Objective
|
||||
|
||||
Enable teams to include external agents and provide the "marketplace" UI
|
||||
placeholders that suggest where one might find or browse external agents.
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### 1. Team Discovery (`packages/core/src/agents/teamLoader.ts`)
|
||||
|
||||
- [ ] Ensure that `TEAM.md` can specify agents with `kind: external` and
|
||||
`provider`.
|
||||
- [ ] If a team specifies an external agent that isn't found locally, provide a
|
||||
clear error message or auto-generate a polyfill definition.
|
||||
|
||||
### 2. Team Marketplace UI (`packages/cli/src/ui/components/TeamSelectionDialog.tsx`)
|
||||
|
||||
- [ ] Populate the "Browse Team Marketplace" and "Create New Team" placeholders
|
||||
from TASK-04.
|
||||
- [ ] For the marketplace, show a list of "Curated Teams" (hardcoded for the
|
||||
MVP) that include external agents.
|
||||
- Example: "The Polyglot Team" (Gemini + Claude Code + Codex).
|
||||
- [ ] **Visual Language:**
|
||||
- Add color-coded tags next to agents in the team list:
|
||||
- **Anthropic Purple** for Claude Code (`provider: 'claude-code'`).
|
||||
- **OpenAI Green** for Codex (`provider: 'codex'`).
|
||||
- **Google Blue** for Gemini agents.
|
||||
- Use a "Multi-Model" badge if a team contains agents from multiple providers.
|
||||
|
||||
### 3. Team Builder/Creator (MVP)
|
||||
|
||||
- [ ] In the "Create New Team" placeholder, provide a simple prompt to create a
|
||||
`TEAM.md` in a new subdirectory.
|
||||
- [ ] Allow users to specify `providers` for their agents in this builder.
|
||||
|
||||
### 4. Status Indicator Enhancement (`packages/cli/src/ui/components/StatusRow.tsx`)
|
||||
|
||||
- [ ] If a team is active, the `ActiveTeamIndicator` should show the "Provider"
|
||||
icons or tags for the agents in the team.
|
||||
- Example: `[ Team: Polyglot (G, C, X) ]` where G/C/X are color-coded letters
|
||||
for Gemini/Claude/Codex.
|
||||
|
||||
## Verification
|
||||
|
||||
- Manual verification of the "Marketplace" and "Create Team" placeholders in the
|
||||
selection dialog.
|
||||
- Verify that a team with an external Claude Code agent displays correctly and
|
||||
its instructions are correctly surfaced.
|
||||
@@ -0,0 +1,47 @@
|
||||
# TASK-08: Interactive Team Creation Wizard
|
||||
|
||||
## Objective
|
||||
|
||||
Implement a guided, step-by-step CLI wizard to allow users to create new Agent
|
||||
Teams without manually editing files and directories.
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### 1. The Wizard Flow (`packages/cli/src/ui/components/TeamCreatorWizard.tsx`)
|
||||
|
||||
- [ ] Create a multi-step Ink component:
|
||||
- **Step 1: Identity**: Prompt for Team Name and Display Name (Text Input).
|
||||
- **Step 2: Objective**: Prompt for the orchestration instructions (Multiline
|
||||
Text Input). This guides the top-level agent on how to use the team.
|
||||
- **Step 3: Roster**: A multi-select list of available agents:
|
||||
- Include local agents from `.gemini/agents/`.
|
||||
- Include "External" templates: `Claude Code (External)`,
|
||||
`Codex (External)`.
|
||||
- **Step 4: Confirmation**: Display a summary and ask for final confirmation.
|
||||
|
||||
### 2. Scaffolding Service (`packages/core/src/agents/teamScaffolder.ts`)
|
||||
|
||||
- [ ] Create a service to handle the filesystem operations:
|
||||
- [ ] Create the directory `.gemini/teams/<slug>/`.
|
||||
- [ ] Generate the `TEAM.md` with the collected frontmatter and instructions.
|
||||
- [ ] Create the `agents/` sub-folder.
|
||||
- [ ] For each selected agent:
|
||||
- If it's an existing local agent, copy/link its definition.
|
||||
- If it's an "External" agent, generate a placeholder `.md` file with the
|
||||
correct `kind: external` and `provider`.
|
||||
|
||||
### 3. UI Integration (`packages/cli/src/ui/AppContainer.tsx`)
|
||||
|
||||
- [ ] In the `TeamSelectionDialog` (from TASK-04/07), when "Create New Team" is
|
||||
selected:
|
||||
- [ ] Set `isTeamCreatorActive(true)`.
|
||||
- [ ] Render the `TeamCreatorWizard` overlay.
|
||||
- [ ] On completion, refresh the `TeamRegistry` and return to the selection list
|
||||
with the new team highlighted.
|
||||
|
||||
## Verification
|
||||
|
||||
- Manual verification of the creation flow.
|
||||
- Verify that the resulting directory structure and `TEAM.md` are valid and
|
||||
loadable.
|
||||
- Unit tests for `teamScaffolder.ts`.
|
||||
Reference in New Issue
Block a user