mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
## What An Agents feature: hand a task to a coding agent and follow it from the IDE. Agents speak the [Agent Client Protocol](https://agentclientprotocol.com). Built in: Claude Code, Codex, Gemini CLI, GitHub Copilot, Cursor, OpenCode, Qwen Code, Kimi CLI, Goose, Auggie, Kiro, Mistral Vibe. You can add your own in `<config>/agents/<id>.toml` (`name`, `command`, `args`, `[env]`). An agent whose command isn't on `PATH` is listed under "Not installed". - **New Task page.** An editor page with a prompt box. You pick the agent, model, mode and thinking effort, and whether it runs in a new worktree (from a chosen branch) or in the checkout. - **Agents tool window.** Tasks are grouped by what they need: Needs Input, Failed, Running, Ready to Review, Archived. It also shows a stripe badge, a status bar item and notifications. - **Session tab.** - The conversation: Markdown, thinking, tool calls with diff stats, the plan. - Permission requests appear as an editor banner. - The changed files are compared against the task's base commit and open in the diff viewer. - A context-usage meter. - **Composer.** - `@` references files from the project index. A referenced file's text is sent when the agent accepts embedded context, otherwise a `resource_link`. - `/` lists the agent's commands; ↑/↓ recall earlier messages. - Images can be pasted, dropped or picked; Shift+Tab cycles the mode. - While the agent works, Enter queues the message and ⌘↵ interrupts the turn and sends it now. Queued messages can be sent now, edited or removed. - **Send to Agent.** In the editor and Project view context menus. It adds `@file:10-20` references to the message you typed last. - Landing the work is left to the existing Git features: the worktree is a normal branch. ## How - **`crates/ide-agent`**: one ACP agent process per task, running in the task's directory. - It folds `session/update` into a timeline and answers `session/request_permission`. - It tracks the session's settings: `configOptions`, falling back to the older `modes` / `models` fields. The user's choices are applied again on every new or reloaded session. - Tasks are saved as JSON per task. Sessions resume with `session/load` without duplicating history, and old task files are upgraded when read. - **`ide-jsonrpc`**: adds newline-delimited framing (ACP) next to Content-Length (LSP). - **`ide-vcs`**: adds `numstat_with_worktree` for the changes list. - **Editor**: - The Switcher (⌃⇥) lists every open editor, as IDEA does, not just files. - `EditorKindContribution.restorable` lets a kind's tabs be saved with the editor session, so agent tabs survive reloads. - **UI**: `Select` popups now size to fit short option details (they used to cut them off). ## Testing - `cargo test -p ide-agent` (14 tests). They use an in-memory ACP agent and cover permissions, restart with `session/load`, settings, the queue with send-now and stop, and prompt blocks. - There is also an ignored end-to-end test against the real Claude Code adapter: `OPENIDEA_AGENT_E2E=1 cargo test -p ide-agent real_claude -- --ignored`. - `pnpm vitest run`: 2052 tests. - `cargo clippy -p ide-agent -p openidea --all-targets -- -D warnings` and typecheck are clean. - Driven in the running app with Claude Code: - A task in a worktree, with permission answers, changes listed and the diff opened. - A follow-up after restarting the IDE. - `@` reference with embedded content, `/` commands, Shift+Tab mode changes. - A queued message and send-now, an image prompt, Send to Agent from a selection. - The Switcher and restored tabs after a reload. Not covered yet: only Claude Code was driven end to end. The other agents go through the same ACP path but weren't run here. Merged on the maintainer's go-ahead. Merge with main: kept both sides in Cargo.toml (ide-agent + ide-clipboard), the feature registry (agents + vim) and zh.json (no duplicate keys). After the merge: typecheck clean, full vitest 268 files / 2247 tests passed, ide-agent/ide-jsonrpc/ide-vcs 144 passed, bindings unchanged after regeneration.
146 lines
2.7 KiB
CSS
146 lines
2.7 KiB
CSS
/* A framed text area (IDEA text field frame), with the pickers in its bottom row. */
|
|
.composer {
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
border-radius: var(--radius-popup);
|
|
background: var(--bg-field, var(--bg-button));
|
|
box-shadow: inset 0 0 0 1px var(--border-button);
|
|
cursor: text;
|
|
transition: box-shadow var(--dur-fast) var(--ease);
|
|
}
|
|
.composer:focus-within {
|
|
box-shadow:
|
|
inset 0 0 0 1px var(--focus-ring),
|
|
0 0 0 1px var(--focus-ring);
|
|
}
|
|
.textarea {
|
|
display: block;
|
|
width: 100%;
|
|
min-height: 44px;
|
|
resize: none;
|
|
border: 0;
|
|
outline: none;
|
|
background: transparent;
|
|
color: var(--fg-strong);
|
|
font: inherit;
|
|
font-size: var(--fs-ui);
|
|
line-height: 1.5;
|
|
padding: 10px 12px 2px;
|
|
-webkit-user-select: text;
|
|
user-select: text;
|
|
}
|
|
.textarea:focus-visible {
|
|
outline: none;
|
|
}
|
|
.textarea::placeholder {
|
|
color: var(--fg-faint);
|
|
}
|
|
.bar {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
gap: 2px;
|
|
padding: 4px 6px 6px;
|
|
cursor: default;
|
|
}
|
|
.spacer {
|
|
flex: 1;
|
|
}
|
|
.pickerValue {
|
|
display: inline-flex;
|
|
align-items: baseline;
|
|
gap: 5px;
|
|
white-space: nowrap;
|
|
}
|
|
.pickerName {
|
|
color: var(--fg-subtle);
|
|
}
|
|
|
|
.images {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
padding: 8px 10px 0;
|
|
cursor: default;
|
|
}
|
|
.image {
|
|
position: relative;
|
|
width: 44px;
|
|
height: 44px;
|
|
border-radius: var(--radius-small);
|
|
box-shadow: inset 0 0 0 1px var(--border);
|
|
overflow: hidden;
|
|
}
|
|
.image img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
.removeImage {
|
|
position: absolute;
|
|
top: 2px;
|
|
right: 2px;
|
|
display: grid;
|
|
place-items: center;
|
|
width: 16px;
|
|
height: 16px;
|
|
padding: 0;
|
|
border: 0;
|
|
border-radius: 50%;
|
|
background: var(--bg-popup);
|
|
color: var(--fg);
|
|
cursor: pointer;
|
|
opacity: 0;
|
|
}
|
|
.image:hover .removeImage,
|
|
.removeImage:focus-visible {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* `@` / `/` completion, above the box like a code-completion popup. */
|
|
.popup {
|
|
position: absolute;
|
|
left: 0;
|
|
bottom: calc(100% + 4px);
|
|
z-index: 10;
|
|
width: min(560px, 100%);
|
|
max-height: 300px;
|
|
overflow: auto;
|
|
padding: 4px 0;
|
|
border: 1px solid var(--border-popup);
|
|
border-radius: var(--radius-popup);
|
|
background: var(--bg-popup);
|
|
box-shadow: var(--shadow-popup);
|
|
cursor: default;
|
|
}
|
|
.item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
height: var(--h-row);
|
|
margin: 0 4px;
|
|
padding: 0 8px;
|
|
border-radius: var(--radius-row);
|
|
white-space: nowrap;
|
|
}
|
|
.active {
|
|
background: var(--bg-list-selected);
|
|
}
|
|
.itemName {
|
|
flex: none;
|
|
color: var(--fg-strong);
|
|
}
|
|
.itemHint {
|
|
flex: none;
|
|
color: var(--fg-muted);
|
|
font-style: italic;
|
|
}
|
|
.itemDetail {
|
|
flex: 1 1 0;
|
|
min-width: 0;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
color: var(--fg-subtle);
|
|
}
|