дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
feat(agents): one Settings › Agents page for every agent
Agents get their own settings group. Its page lists every agent this machine runs, built in or installed from the ACP Registry, with what each needs (update, not found, custom) beside the selected one's status, sign-in, the settings its new tasks start with, and how it launches. Add Agent… opens the ACP Registry in a dialog; Remove and Update act on registry agents in place. Chat and MCP Server move under it, and Chat gains the sending and conversation options.
Цей коміт міститься в:
1 джерело
338dc71d20
коміт
ca339c4934
27 files changed
+1120
-656
No files matched your search
@@ -61,7 +61,7 @@ pub struct Settings {
|
||||
pub cmake: CMakeSettings,
|
||||
/// Settings › Agents.
|
||||
pub agents: AgentSettings,
|
||||
/// Tools › MCP Server (global only).
|
||||
/// Agents › MCP Server (global only).
|
||||
pub mcp_server: McpServerSettings,
|
||||
/// Plugin settings (`[contributes.settings]`): plugin id → its values by key.
|
||||
#[specta(type = BTreeMap<String, BTreeMap<String, specta_typescript::Unknown>>)]
|
||||
@@ -154,7 +154,7 @@ pub enum WhileRunning {
|
||||
Steer,
|
||||
}
|
||||
|
||||
/// Tools › MCP Server: agents use the IDE's built-in tools.
|
||||
/// Agents › MCP Server: agents use the IDE's built-in tools.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
pub struct McpServerSettings {
|
||||
|
||||
@@ -105,7 +105,7 @@ fn requests(message: &Value) -> Vec<Value> {
|
||||
async fn post(discovery: &Path, project: &Path, message: &Value, scope: &str) -> Result<(StatusCode, Bytes), String> {
|
||||
let not_running = || {
|
||||
format!(
|
||||
"OpenIDEA's MCP server is not running. Start OpenIDEA, open {} in it, and turn on Settings › Tools › MCP Server",
|
||||
"OpenIDEA's MCP server is not running. Start OpenIDEA, open {} in it, and turn on Settings › Agents › MCP Server",
|
||||
project.display()
|
||||
)
|
||||
};
|
||||
|
||||
@@ -5,14 +5,14 @@ for (const [id, selector] of [
|
||||
["editor.inspections", "[class*='split'] > [class*='details']"],
|
||||
["languages.servers", "[class*='body'] > [class*='details']"],
|
||||
["plugins", "[class*='body'] > [class*='details']"],
|
||||
["tools.agents", "section[aria-label='Codex executable']"],
|
||||
["agents", "section[aria-label='Codex']"],
|
||||
]) {
|
||||
test(`${id} keeps its details usable beside the list`, async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await expect(dialog).toBeVisible();
|
||||
await page.evaluate(async (id) => {
|
||||
if (id === "tools.agents") {
|
||||
if (id === "agents") {
|
||||
const path = "/src/features/agents/registry.ts";
|
||||
const { tauriCommands } = await import(/* @vite-ignore */ path);
|
||||
tauriCommands.providers = async () => [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Tools › MCP Server: runs `ide_mcp::McpServer` over built-in host tools
|
||||
//! Agents › MCP Server: runs `ide_mcp::McpServer` over built-in host tools
|
||||
//! while `mcpServer.enabled` is on, and reports where it listens.
|
||||
|
||||
use crate::state::AppState;
|
||||
@@ -63,7 +63,7 @@ pub fn stop(state: &AppState) {
|
||||
}
|
||||
}
|
||||
|
||||
/// What Settings › Tools › MCP Server shows.
|
||||
/// What Settings › Agents › MCP Server shows.
|
||||
#[derive(Serialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct McpServerStatus {
|
||||
|
||||
@@ -21,7 +21,7 @@ pub struct AppState {
|
||||
pub plugins: Arc<ide_host::plugins::PluginHost>,
|
||||
/// The built-in web server (Open In › Browser, the editor's browser bar).
|
||||
pub web: ide_web::WebServer,
|
||||
/// Tools › MCP Server: built-in IDE tools for agents.
|
||||
/// Agents › MCP Server: built-in IDE tools for agents.
|
||||
pub mcp: crate::commands::mcp::McpService,
|
||||
/// Credential prompts of `ssh` / `git` child processes (`None` if it failed to start).
|
||||
pub askpass: Option<ide_ssh::askpass::AskpassServer>,
|
||||
|
||||
@@ -6015,13 +6015,13 @@ export type MavenSettings = {
|
||||
activeProfiles?: string,
|
||||
};
|
||||
|
||||
/** Tools › MCP Server: agents use the IDE's built-in tools. */
|
||||
/** Agents › MCP Server: agents use the IDE's built-in tools. */
|
||||
export type McpServerSettings = {
|
||||
/** Serve the tools on 127.0.0.1 while the IDE runs. */
|
||||
enabled?: boolean,
|
||||
};
|
||||
|
||||
/** What Settings › Tools › MCP Server shows. */
|
||||
/** What Settings › Agents › MCP Server shows. */
|
||||
export type McpServerStatus = {
|
||||
running: boolean,
|
||||
/** Why it isn't running though turned on. */
|
||||
@@ -8061,7 +8061,7 @@ export type Settings_Deserialize = {
|
||||
cmake?: CMakeSettings_Deserialize,
|
||||
/** Settings › Agents. */
|
||||
agents?: AgentSettings,
|
||||
/** Tools › MCP Server (global only). */
|
||||
/** Agents › MCP Server (global only). */
|
||||
mcpServer?: McpServerSettings,
|
||||
/** Plugin settings (`[contributes.settings]`): plugin id → its values by key. */
|
||||
plugins?: { [key in string]: { [key in string]: unknown } },
|
||||
@@ -8123,7 +8123,7 @@ export type Settings_Serialize = {
|
||||
cmake: CMakeSettings_Serialize,
|
||||
/** Settings › Agents. */
|
||||
agents: AgentSettings,
|
||||
/** Tools › MCP Server (global only). */
|
||||
/** Agents › MCP Server (global only). */
|
||||
mcpServer: McpServerSettings,
|
||||
/** Plugin settings (`[contributes.settings]`): plugin id → its values by key. */
|
||||
plugins: { [key in string]: { [key in string]: unknown } },
|
||||
|
||||
+38
-2
@@ -8,10 +8,25 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
.master {
|
||||
flex: 0 0 300px;
|
||||
padding: 6px;
|
||||
display: flex;
|
||||
flex: 0 0 260px;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
border-right: 1px solid var(--border);
|
||||
}
|
||||
/* IntelliJ's list toolbar: add / remove above the list. */
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
padding: 2px 4px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 6px;
|
||||
}
|
||||
.agentRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -121,3 +136,24 @@
|
||||
color: var(--danger);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.update {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
margin: 0 0 12px 28px;
|
||||
color: var(--fg-secondary);
|
||||
}
|
||||
.defaults {
|
||||
display: grid;
|
||||
grid-template-columns: max-content minmax(180px, 280px);
|
||||
align-items: center;
|
||||
gap: 6px 12px;
|
||||
}
|
||||
.defaults > .hint {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.defaultLabel {
|
||||
color: var(--fg);
|
||||
}
|
||||
@@ -0,0 +1,458 @@
|
||||
/**
|
||||
* Settings › Agents: every agent this machine can run (built in, installed from the ACP
|
||||
* Registry, or defined in an agent file) beside the selected one's status, the settings
|
||||
* its new tasks start with, and how it is launched. Launch edits are staged until Apply.
|
||||
*/
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import type { AgentConfigOption, AgentProvider, RequestId } from "@/bindings";
|
||||
import { isCancelled, nextRequestId } from "@/platform/ipc";
|
||||
import { tx, useTxTemplate } from "@/platform/i18n";
|
||||
import clsx from "clsx";
|
||||
import { Button, Dialog, Icon, IconButton, Input, List, ProgressBar, Select, Spinner, T } from "@/ui";
|
||||
import { useSettingsForm } from "@/workbench/contributions";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { providerIcon } from "./model";
|
||||
import type { CommandsBackend, RegistryBackend } from "./registry";
|
||||
import { RegistryList } from "./RegistryList";
|
||||
import styles from "./AgentList.module.css";
|
||||
|
||||
const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));
|
||||
|
||||
/** What the agent needs, if anything, as a trailing tag in the list. */
|
||||
export function agentStatus(agent: AgentProvider): { label: string; tone: "muted" | "accent" | "warning" } | null {
|
||||
if (agent.source.kind === "registry" && agent.source.update) return { label: "Update", tone: "accent" };
|
||||
if (agent.commandOverridden || agent.source.kind === "custom") return { label: "Custom", tone: "accent" };
|
||||
if (!agent.installed) return { label: "Not found", tone: "muted" };
|
||||
return null;
|
||||
}
|
||||
|
||||
function Status({ agent }: { agent: AgentProvider }) {
|
||||
const status = agentStatus(agent);
|
||||
if (!status) return null;
|
||||
return (
|
||||
<span className={clsx(styles.tag, status.tone === "accent" && styles.tagCustom)}>
|
||||
<T>{status.label}</T>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function AgentList({
|
||||
backend,
|
||||
registry,
|
||||
onChanged,
|
||||
}: {
|
||||
backend: CommandsBackend;
|
||||
registry: RegistryBackend;
|
||||
onChanged?: () => void;
|
||||
}) {
|
||||
const [agents, setAgents] = useState<AgentProvider[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [selected, setSelected] = useState<string | null>(null);
|
||||
const [adding, setAdding] = useState(false);
|
||||
const [removing, setRemoving] = useState(false);
|
||||
useEffect(() => {
|
||||
let live = true;
|
||||
backend.providers().then(
|
||||
(list) => live && setAgents(list),
|
||||
(e: unknown) => live && setError(errorText(e)),
|
||||
);
|
||||
return () => {
|
||||
live = false;
|
||||
};
|
||||
}, [backend]);
|
||||
const refresh = useCallback(async () => {
|
||||
setAgents(await backend.providers());
|
||||
}, [backend]);
|
||||
const changed = useCallback(() => {
|
||||
void refresh().catch((e: unknown) => setError(errorText(e)));
|
||||
onChanged?.();
|
||||
}, [refresh, onChanged]);
|
||||
if (error)
|
||||
return (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
);
|
||||
if (!agents) return <Spinner size={14} />;
|
||||
const index = Math.max(
|
||||
0,
|
||||
agents.findIndex((a) => a.id === selected),
|
||||
);
|
||||
const agent = agents[index];
|
||||
const remove = async () => {
|
||||
if (!agent || agent.source.kind !== "registry") return;
|
||||
if (
|
||||
!(await confirm({
|
||||
title: tx`Remove ${agent.name}`,
|
||||
message: tx`Remove ${agent.name} from this computer? Its tasks stay, but can't continue until it is installed again.`,
|
||||
ok: tx("Remove"),
|
||||
}))
|
||||
)
|
||||
return;
|
||||
setRemoving(true);
|
||||
try {
|
||||
await registry.remove(agent.id);
|
||||
setSelected(null);
|
||||
changed();
|
||||
} catch (e) {
|
||||
setError(errorText(e));
|
||||
} finally {
|
||||
setRemoving(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className={styles.split}>
|
||||
<div className={styles.master}>
|
||||
<div className={styles.toolbar} role="toolbar" aria-label={tx("Agents")}>
|
||||
<IconButton icon="plus" title="Add Agent…" onClick={() => setAdding(true)} />
|
||||
<IconButton
|
||||
icon="minus"
|
||||
title="Remove"
|
||||
disabled={agent?.source.kind !== "registry" || removing}
|
||||
onClick={() => void remove()}
|
||||
/>
|
||||
</div>
|
||||
<List
|
||||
className={styles.list}
|
||||
items={agents}
|
||||
getKey={(p) => p.id}
|
||||
activeIndex={index}
|
||||
onActiveChange={(i) => setSelected(agents[i]?.id ?? null)}
|
||||
rowHeight={32}
|
||||
aria-label={tx("Agents")}
|
||||
renderItem={(p) => (
|
||||
<div className={clsx(styles.agentRow, !p.installed && !p.commandOverridden && styles.agentMissing)}>
|
||||
<Icon name={providerIcon(p.id)} size={16} />
|
||||
<span className={styles.agentName}>{p.name}</span> <Status agent={p} />
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{agent && (
|
||||
<Details
|
||||
key={agent.id}
|
||||
agent={agent}
|
||||
backend={backend}
|
||||
registry={registry}
|
||||
refresh={refresh}
|
||||
onChanged={onChanged}
|
||||
/>
|
||||
)}
|
||||
<Dialog
|
||||
open={adding}
|
||||
onClose={() => setAdding(false)}
|
||||
title="Add Agent"
|
||||
width={640}
|
||||
resizable="both"
|
||||
buttons={[{ label: "Done", role: "cancel" }]}
|
||||
>
|
||||
<RegistryList backend={registry} onChanged={changed} />
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Details({
|
||||
agent,
|
||||
backend,
|
||||
registry,
|
||||
refresh,
|
||||
onChanged,
|
||||
}: {
|
||||
agent: AgentProvider;
|
||||
backend: CommandsBackend;
|
||||
registry: RegistryBackend;
|
||||
refresh: () => Promise<void>;
|
||||
onChanged?: () => void;
|
||||
}) {
|
||||
const form = useSettingsForm();
|
||||
const base = agent.commandOverridden ? agent.program : "";
|
||||
const { value, current, set, saving } = form.useExternal(`agents.${agent.id}.command`, base, async (draft) => {
|
||||
const command = draft.trim() || null;
|
||||
await backend.set(agent.id, command);
|
||||
await refresh();
|
||||
onChanged?.();
|
||||
return command === agent.defaultProgram ? "" : (command ?? "");
|
||||
});
|
||||
const envBase = formatEnv(agent.env);
|
||||
const env = form.useExternal(`agents.${agent.id}.env`, envBase, async (draft) => {
|
||||
const parsed = parseEnv(draft);
|
||||
await backend.setEnv(agent.id, parsed);
|
||||
await refresh();
|
||||
onChanged?.();
|
||||
return formatEnv(parsed);
|
||||
});
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
// An edit can have been staged by a previous page instance. Its Apply callback
|
||||
// refreshes that instance; the mounted one follows the newly applied value too.
|
||||
useEffect(() => {
|
||||
if (!saving && current !== base) {
|
||||
void refresh().catch((e: unknown) => setError(e instanceof Error ? e.message : String(e)));
|
||||
}
|
||||
}, [base, current, saving, refresh]);
|
||||
const launch = [agent.defaultProgram, ...agent.defaultArgs].join(" ");
|
||||
const status =
|
||||
agent.source.kind === "registry"
|
||||
? tx`ACP Registry · ${agent.source.version}`
|
||||
: agent.source.kind === "custom"
|
||||
? tx("Agent file")
|
||||
: agent.commandOverridden
|
||||
? tx("Custom executable")
|
||||
: agent.installed
|
||||
? tx("Found on PATH")
|
||||
: tx("Not found on PATH");
|
||||
return (
|
||||
<section className={styles.details} aria-label={agent.name}>
|
||||
<div className={styles.title}>
|
||||
<Icon name={providerIcon(agent.id)} size={20} />
|
||||
<h3>{agent.name}</h3>
|
||||
</div>
|
||||
<div className={styles.subtitle}>
|
||||
<span
|
||||
aria-hidden
|
||||
className={clsx(styles.dot, agent.commandOverridden ? styles.dotCustom : agent.installed && styles.dotFound)}
|
||||
/>
|
||||
<span>{status}</span>
|
||||
<span aria-hidden>·</span>
|
||||
<code className={styles.launch} title={tx("Launch command")}>
|
||||
{launch}
|
||||
</code>
|
||||
</div>
|
||||
{agent.source.kind === "registry" && agent.source.update && (
|
||||
<RegistryUpdate agent={agent} version={agent.source.update} registry={registry} refresh={refresh} />
|
||||
)}
|
||||
{agent.loginHint && (
|
||||
<>
|
||||
<h4 className={styles.section}>
|
||||
<T>Sign in</T>
|
||||
</h4>
|
||||
<p className={styles.hint}>
|
||||
<LoginHint text={agent.loginHint} />
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
<h4 className={styles.section}>
|
||||
<T>New tasks start with</T>
|
||||
</h4>
|
||||
<AgentDefaults agent={agent} />
|
||||
<h4 className={styles.section}>
|
||||
<T>Launch</T>
|
||||
</h4>
|
||||
{agent.commandEditable ? (
|
||||
<>
|
||||
<label className={styles.label} htmlFor={`agent-executable-${agent.id}`}>
|
||||
<T>Executable</T>
|
||||
</label>
|
||||
<div className={styles.controls}>
|
||||
<Input
|
||||
id={`agent-executable-${agent.id}`}
|
||||
mono
|
||||
value={value}
|
||||
disabled={saving}
|
||||
placeholder={tx`Auto-detect (${agent.defaultProgram})`}
|
||||
onChange={(e) => set(e.target.value)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="folder-open"
|
||||
title="Browse…"
|
||||
disabled={saving}
|
||||
onClick={async () => {
|
||||
try {
|
||||
const path = await backend.chooseExecutable(tx`Select ${agent.name}`, value);
|
||||
if (path) set(path);
|
||||
setError(null);
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{value && <IconButton icon="undo" title="Reset" disabled={saving} onClick={() => set("")} />}
|
||||
</div>
|
||||
<p className={styles.hint}>
|
||||
<T>Leave empty to find the executable on PATH. Changes apply to new sessions.</T>
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p className={styles.hint}>
|
||||
{agent.commandReadOnlyReason === "packageRunner" ? (
|
||||
<T>This agent runs through a package runner (npm or uv) and has no executable to choose.</T>
|
||||
) : agent.commandReadOnlyReason === "registry" ? (
|
||||
<T>This agent is installed from the ACP Registry, which launches it.</T>
|
||||
) : (
|
||||
<T>This agent is configured in its agent file.</T>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{agent.commandReadOnlyReason !== "registry" && agent.commandReadOnlyReason !== "customAgent" && (
|
||||
<>
|
||||
<label className={styles.label} htmlFor={`agent-env-${agent.id}`}>
|
||||
<T>Environment variables</T>
|
||||
</label>
|
||||
<div className={styles.controls}>
|
||||
<Input
|
||||
id={`agent-env-${agent.id}`}
|
||||
mono
|
||||
value={env.value}
|
||||
disabled={env.saving}
|
||||
placeholder="NAME=value; OTHER=value"
|
||||
onChange={(e) => env.set(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<p className={styles.hint}>
|
||||
<T>Passed to the agent process, replacing variables of the same name. Changes apply to new sessions.</T>
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{error && (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** `NAME=value` pairs separated by `;` or new lines. */
|
||||
function parseEnv(text: string): Record<string, string> {
|
||||
const env: Record<string, string> = {};
|
||||
for (const raw of text.split(/[;\n]/)) {
|
||||
const pair = raw.trim();
|
||||
if (!pair) continue;
|
||||
const eq = pair.indexOf("=");
|
||||
const key = eq < 0 ? "" : pair.slice(0, eq).trim();
|
||||
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) throw new Error(tx`Expected NAME=value: ${pair}`);
|
||||
env[key] = pair.slice(eq + 1).trim();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
const formatEnv = (env: Record<string, string>) =>
|
||||
Object.entries(env)
|
||||
.map(([k, v]) => `${k}=${v}`)
|
||||
.join("; ");
|
||||
|
||||
/** Login hints are plain text with optional backtick-delimited command spans. */
|
||||
function LoginHint({ text }: { text: string }) {
|
||||
const translate = useTxTemplate();
|
||||
return translate(text)
|
||||
.split(/(`[^`]+`)/g)
|
||||
.map((part, i) => (i % 2 === 1 ? <code key={i}>{part.slice(1, -1)}</code> : part));
|
||||
}
|
||||
|
||||
/** Updates an agent installed from the ACP Registry, with its progress. */
|
||||
function RegistryUpdate({
|
||||
agent,
|
||||
version,
|
||||
registry,
|
||||
refresh,
|
||||
}: {
|
||||
agent: AgentProvider;
|
||||
version: string;
|
||||
registry: RegistryBackend;
|
||||
refresh: () => Promise<void>;
|
||||
}) {
|
||||
const [job, setJob] = useState<{ request: RequestId; fraction: number | null; message: string } | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const update = () => {
|
||||
const request = nextRequestId();
|
||||
setError(null);
|
||||
setJob({ request, fraction: null, message: tx`Installing ${agent.name} ${version}…` });
|
||||
registry
|
||||
.install(agent.id, request, (e) =>
|
||||
setJob((j) =>
|
||||
j && j.request === request
|
||||
? e.type === "progress"
|
||||
? { ...j, fraction: e.fraction, message: e.message }
|
||||
: { ...j, message: e.text }
|
||||
: j,
|
||||
),
|
||||
)
|
||||
.then(refresh)
|
||||
.catch((e: unknown) => !isCancelled(e) && setError(errorText(e)))
|
||||
.finally(() => setJob(null));
|
||||
};
|
||||
return (
|
||||
<div className={styles.update}>
|
||||
{job ? (
|
||||
<>
|
||||
<ProgressBar value={job.fraction} aria-label={tx`Installing ${agent.name}`} />
|
||||
<span className={styles.hint}>{job.message}</span>
|
||||
<Button size="small" onClick={() => registry.cancel(job.request)}>
|
||||
Cancel
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span>{tx`${version} is available`}</span>
|
||||
<Button size="small" variant="primary" onClick={update}>
|
||||
Update
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{error && (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** The options a new task of `agent` starts with: each the agent's own default unless chosen. */
|
||||
export function defaultOptions(agent: AgentProvider, chosen: Record<string, string>): AgentConfigOption[] {
|
||||
const base = agent.config.filter((o) => o.category !== "thought_level" && o.values.length > 1);
|
||||
const modelOption = base.find((o) => o.category === "model");
|
||||
const model = (modelOption && chosen[modelOption.id]) || modelOption?.current;
|
||||
const levels = (model && agent.thoughtLevels?.[model]) || [];
|
||||
return [...base, ...levels.filter((o) => o.values.length > 1)];
|
||||
}
|
||||
|
||||
function AgentDefaults({ agent }: { agent: AgentProvider }) {
|
||||
const form = useSettingsForm();
|
||||
const all = (form.useValue("agents.defaults") ?? {}) as Record<string, Record<string, string>>;
|
||||
const chosen = all[agent.id] ?? {};
|
||||
const options = defaultOptions(agent, chosen);
|
||||
if (!options.length)
|
||||
return (
|
||||
<p className={styles.hint}>
|
||||
<T>The agent's models and modes can be chosen here after its first session.</T>
|
||||
</p>
|
||||
);
|
||||
const choose = (id: string, value: string) => {
|
||||
const { [id]: _, ...rest } = chosen;
|
||||
const next = value ? { ...rest, [id]: value } : rest;
|
||||
const { [agent.id]: __, ...others } = all;
|
||||
form.set("agents.defaults", Object.keys(next).length ? { ...others, [agent.id]: next } : others);
|
||||
};
|
||||
return (
|
||||
<div className={styles.defaults}>
|
||||
{options.map((o) => {
|
||||
const fallback = o.values.find((v) => v.value === o.current)?.name;
|
||||
return (
|
||||
<div key={o.id} className={styles.defaultRow}>
|
||||
<label className={styles.defaultLabel} htmlFor={`agent-default-${agent.id}-${o.id}`}>
|
||||
{o.name}
|
||||
</label>
|
||||
<Select
|
||||
id={`agent-default-${agent.id}-${o.id}`}
|
||||
value={chosen[o.id] ?? ""}
|
||||
options={[
|
||||
{ value: "", label: fallback ? tx`Agent's default (${fallback})` : tx("Agent's default") },
|
||||
...o.values.map((v) => ({
|
||||
value: v.value,
|
||||
label: v.name,
|
||||
verbatim: true,
|
||||
detail: v.description ?? undefined,
|
||||
})),
|
||||
]}
|
||||
onChange={(value) => choose(o.id, value)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<p className={styles.hint}>
|
||||
<T>What you pick on the New Task page wins; these apply until then and after switching agents.</T>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,54 +1,8 @@
|
||||
/**
|
||||
* Settings › Tools › Agents: the launch command of built-in agents (Claude Code…), and
|
||||
* agents of the ACP Registry this machine can run, with Install / Update / Remove.
|
||||
* Installs run in the background with progress, and keep running after the page closes
|
||||
* (as a background task of the project windows); the page then shows them as installing.
|
||||
*/
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { AgentRegistry, RegistryAgent, RequestId } from "@/bindings";
|
||||
import { isCancelled, nextRequestId } from "@/platform/ipc";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { openExternalUrl } from "@/platform/openUrl";
|
||||
import { Badge, Button, Icon, ProgressBar, SearchField, Spinner, T, Tabs } from "@/ui";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { providerIcon } from "./model";
|
||||
import {
|
||||
DISTRIBUTION_LABEL,
|
||||
afterInstall,
|
||||
afterRemove,
|
||||
matchesQuery,
|
||||
rowActions,
|
||||
sortAgents,
|
||||
tauriCommands,
|
||||
tauriRegistry,
|
||||
type CommandsBackend,
|
||||
type RegistryBackend,
|
||||
} from "./registry";
|
||||
import { BuiltinAgents } from "./BuiltinAgents";
|
||||
/** Settings › Agents. */
|
||||
import { AgentList } from "./AgentList";
|
||||
import { tauriCommands, tauriRegistry, type CommandsBackend, type RegistryBackend } from "./registry";
|
||||
import styles from "./AgentRegistry.module.css";
|
||||
|
||||
const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));
|
||||
|
||||
/** How often the page checks on installs it did not start. */
|
||||
const BACKGROUND_POLL_MS = 1500;
|
||||
|
||||
interface Job {
|
||||
id: string;
|
||||
fraction: number | null;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface PageJob extends Job {
|
||||
request: RequestId;
|
||||
}
|
||||
|
||||
/** An install started before the page opened; its progress shows in the background tasks. */
|
||||
const backgroundJob = (agent: RegistryAgent): Job => ({
|
||||
id: agent.id,
|
||||
fraction: null,
|
||||
message: tx`Installing ${agent.name} in the background…`,
|
||||
});
|
||||
|
||||
export function AgentRegistryPage({
|
||||
onChanged,
|
||||
backend = tauriRegistry,
|
||||
@@ -59,284 +13,9 @@ export function AgentRegistryPage({
|
||||
backend?: RegistryBackend;
|
||||
commandBackend?: CommandsBackend;
|
||||
}) {
|
||||
const [tab, setTab] = useState("builtin");
|
||||
return (
|
||||
<div className={styles.body}>
|
||||
<Tabs
|
||||
variant="compact"
|
||||
className={styles.tabs}
|
||||
items={[
|
||||
{ id: "builtin", label: "Built-in" },
|
||||
{ id: "registry", label: "ACP Registry" },
|
||||
]}
|
||||
activeId={tab}
|
||||
onSelect={setTab}
|
||||
aria-label={tx("Agents")}
|
||||
/>
|
||||
{tab === "builtin" ? (
|
||||
<BuiltinAgents backend={commandBackend} onChanged={onChanged} />
|
||||
) : (
|
||||
<RegistryList backend={backend} onChanged={onChanged} />
|
||||
)}
|
||||
<AgentList backend={commandBackend} registry={backend} onChanged={onChanged} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function RegistryList({ backend, onChanged }: { backend: RegistryBackend; onChanged?: () => void }) {
|
||||
const [registry, setRegistry] = useState<AgentRegistry | null>(null);
|
||||
const [loadError, setLoadError] = useState<string | null>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [job, setJob] = useState<PageJob | null>(null);
|
||||
const [removing, setRemoving] = useState<string | null>(null);
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
|
||||
useEffect(() => {
|
||||
const request = nextRequestId();
|
||||
let live = true;
|
||||
backend
|
||||
.list(request)
|
||||
.then((r) => live && setRegistry(r))
|
||||
.catch((e: unknown) => live && !isCancelled(e) && setLoadError(errorText(e)));
|
||||
return () => {
|
||||
live = false;
|
||||
backend.cancel(request);
|
||||
};
|
||||
}, [backend]);
|
||||
|
||||
// Installs started before the page opened: follow them until they end.
|
||||
const background = registry?.agents.some((a) => a.installing) ?? false;
|
||||
useEffect(() => {
|
||||
if (!background) return;
|
||||
let live = true;
|
||||
let request: RequestId | null = null;
|
||||
const timer = setInterval(() => {
|
||||
if (request != null) return;
|
||||
const r = (request = nextRequestId());
|
||||
backend
|
||||
.list(r)
|
||||
.then((next) => {
|
||||
if (!live) return;
|
||||
setRegistry(next);
|
||||
if (!next.agents.some((a) => a.installing)) onChanged?.();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
if (request === r) request = null;
|
||||
});
|
||||
}, BACKGROUND_POLL_MS);
|
||||
return () => {
|
||||
live = false;
|
||||
clearInterval(timer);
|
||||
if (request != null) backend.cancel(request);
|
||||
};
|
||||
}, [backend, background, onChanged]);
|
||||
|
||||
const agents = useMemo(
|
||||
() => sortAgents((registry?.agents ?? []).filter((a) => matchesQuery(a, query))),
|
||||
[registry, query],
|
||||
);
|
||||
const busy = job != null || removing != null || background;
|
||||
|
||||
const setError = (id: string, error: string | null) =>
|
||||
setErrors((all) => {
|
||||
const { [id]: _, ...rest } = all;
|
||||
return error ? { ...rest, [id]: error } : rest;
|
||||
});
|
||||
|
||||
const install = async (agent: RegistryAgent) => {
|
||||
if (
|
||||
agent.noChecksum &&
|
||||
!(await confirm({
|
||||
title: tx`Install ${agent.name}`,
|
||||
message: tx`${agent.name} provides no checksum for its download, so the downloaded file cannot be verified. Install it anyway?`,
|
||||
ok: tx("Install"),
|
||||
icon: "warning",
|
||||
}))
|
||||
)
|
||||
return;
|
||||
const request = nextRequestId();
|
||||
setError(agent.id, null);
|
||||
setJob({ id: agent.id, request, fraction: null, message: tx`Installing ${agent.name} ${agent.version}…` });
|
||||
backend
|
||||
.install(agent.id, request, (e) =>
|
||||
setJob((j) =>
|
||||
j && j.request === request
|
||||
? e.type === "progress"
|
||||
? { ...j, fraction: e.fraction, message: e.message }
|
||||
: { ...j, message: e.text }
|
||||
: j,
|
||||
),
|
||||
)
|
||||
.then(() => {
|
||||
setRegistry((r) => r && { ...r, agents: afterInstall(r.agents, agent.id) });
|
||||
onChanged?.();
|
||||
})
|
||||
.catch((e: unknown) => !isCancelled(e) && setError(agent.id, errorText(e)))
|
||||
.finally(() => setJob(null));
|
||||
};
|
||||
|
||||
const remove = (agent: RegistryAgent) => {
|
||||
setError(agent.id, null);
|
||||
setRemoving(agent.id);
|
||||
backend
|
||||
.remove(agent.id)
|
||||
.then(() => {
|
||||
setRegistry((r) => r && { ...r, agents: afterRemove(r.agents, agent.id) });
|
||||
onChanged?.();
|
||||
})
|
||||
.catch((e: unknown) => setError(agent.id, errorText(e)))
|
||||
.finally(() => setRemoving(null));
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.body}>
|
||||
<SearchField
|
||||
autoFocus
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder={tx("Search the ACP Registry")}
|
||||
aria-label="Search agents"
|
||||
clearable
|
||||
/>
|
||||
<p className={styles.notice}>
|
||||
<T>
|
||||
Agents in the ACP Registry are third-party software. They run on this computer with your permissions and can
|
||||
read and change your files. Install only agents you trust.
|
||||
</T>
|
||||
</p>
|
||||
{registry?.warning && (
|
||||
<p className={styles.warning} role="status">
|
||||
{registry.warning}
|
||||
</p>
|
||||
)}
|
||||
<div className={styles.list} aria-busy={!registry && !loadError}>
|
||||
{loadError ? (
|
||||
<p className={styles.error} role="alert">
|
||||
{tx`Cannot load the ACP Registry: ${loadError}`}
|
||||
</p>
|
||||
) : !registry ? (
|
||||
<div className={styles.loading}>
|
||||
<Spinner size={14} />
|
||||
<T>Loading the ACP Registry…</T>
|
||||
</div>
|
||||
) : agents.length === 0 ? (
|
||||
<p className={styles.empty}>
|
||||
{query ? <T>No agents match</T> : <T>The registry has no agents for this system</T>}
|
||||
</p>
|
||||
) : (
|
||||
<ul className={styles.rows} aria-label="Registry agents">
|
||||
{agents.map((agent) => (
|
||||
<AgentRow
|
||||
key={agent.id}
|
||||
agent={agent}
|
||||
job={job?.id === agent.id ? job : agent.installing ? backgroundJob(agent) : null}
|
||||
removing={removing === agent.id}
|
||||
disabled={busy}
|
||||
error={errors[agent.id] ?? null}
|
||||
onInstall={() => void install(agent)}
|
||||
onRemove={() => remove(agent)}
|
||||
onCancel={job?.id === agent.id ? () => backend.cancel(job.request) : undefined}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AgentRow({
|
||||
agent,
|
||||
job,
|
||||
removing,
|
||||
disabled,
|
||||
error,
|
||||
onInstall,
|
||||
onRemove,
|
||||
onCancel,
|
||||
}: {
|
||||
agent: RegistryAgent;
|
||||
job: Job | null;
|
||||
removing: boolean;
|
||||
disabled: boolean;
|
||||
error: string | null;
|
||||
onInstall: () => void;
|
||||
onRemove: () => void;
|
||||
/** Absent for an install this page did not start (stop it from the background tasks). */
|
||||
onCancel?: () => void;
|
||||
}) {
|
||||
const actions = rowActions(agent);
|
||||
const titleId = `agent-${agent.id}`;
|
||||
return (
|
||||
<li className={styles.row} aria-labelledby={titleId}>
|
||||
<div className={styles.main}>
|
||||
<div className={styles.titleLine}>
|
||||
<Icon name={providerIcon(agent.id)} size={16} />
|
||||
<span id={titleId} className={styles.name}>
|
||||
{agent.name}
|
||||
</span>
|
||||
<span className={styles.version}>{agent.installed ?? agent.version}</span>
|
||||
{agent.distribution && <Badge>{DISTRIBUTION_LABEL[agent.distribution]}</Badge>}
|
||||
{agent.noChecksum && <Badge tone="warning">{tx("No checksum provided")}</Badge>}
|
||||
{actions.update && <Badge tone="accent">{tx`${agent.version} available`}</Badge>}
|
||||
{agent.installed != null && !actions.update && <Badge tone="success">{tx("Installed")}</Badge>}
|
||||
</div>
|
||||
{agent.description && <p className={styles.description}>{agent.description}</p>}
|
||||
<div className={styles.meta}>
|
||||
{agent.authors.length > 0 && <span>{agent.authors.join(", ")}</span>}
|
||||
{agent.license && <span>{agent.license}</span>}
|
||||
{agent.repository && <ExternalLink url={agent.repository} label="Repository" />}
|
||||
{agent.website && agent.website !== agent.repository && <ExternalLink url={agent.website} label="Website" />}
|
||||
</div>
|
||||
{job && (
|
||||
<div className={styles.progress}>
|
||||
<ProgressBar value={job.fraction} aria-label={tx`Installing ${agent.name}`} />
|
||||
<span className={styles.progressText}>{job.message}</span>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.actions}>
|
||||
{job ? (
|
||||
onCancel && (
|
||||
<Button size="small" onClick={onCancel}>
|
||||
Cancel
|
||||
</Button>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
{actions.install && (
|
||||
<Button size="small" variant="primary" disabled={disabled} onClick={onInstall}>
|
||||
Install
|
||||
</Button>
|
||||
)}
|
||||
{actions.update && (
|
||||
<Button size="small" variant="primary" disabled={disabled} onClick={onInstall}>
|
||||
Update
|
||||
</Button>
|
||||
)}
|
||||
{actions.remove && (
|
||||
<Button size="small" disabled={disabled} onClick={onRemove}>
|
||||
{removing ? "Removing…" : "Remove"}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function ExternalLink({ url, label }: { url: string; label: string }) {
|
||||
// Links come from the registry: web pages only.
|
||||
if (!/^https?:\/\//i.test(url)) return null;
|
||||
return (
|
||||
<button type="button" className={styles.link} title={url} onClick={() => void openExternalUrl(url)}>
|
||||
<T>{label}</T>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,244 +0,0 @@
|
||||
/** Built-in launch settings; each executable is staged independently until Apply. */
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import type { AgentProvider } from "@/bindings";
|
||||
import { tx, useTxTemplate } from "@/platform/i18n";
|
||||
import clsx from "clsx";
|
||||
import { Icon, IconButton, Input, List, Spinner, T } from "@/ui";
|
||||
import { useSettingsForm } from "@/workbench/contributions";
|
||||
import { providerIcon } from "./model";
|
||||
import type { CommandsBackend } from "./registry";
|
||||
import styles from "./BuiltinAgents.module.css";
|
||||
|
||||
/** Trailing list tag: a missing agent is a normal state, so it is muted rather than a warning. */
|
||||
function Status({ agent }: { agent: AgentProvider }) {
|
||||
if (agent.commandOverridden)
|
||||
return (
|
||||
<span className={clsx(styles.tag, styles.tagCustom)}>
|
||||
<T>Custom</T>
|
||||
</span>
|
||||
);
|
||||
if (agent.installed) return null;
|
||||
return (
|
||||
<span className={styles.tag}>
|
||||
<T>Not found</T>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function BuiltinAgents({ backend, onChanged }: { backend: CommandsBackend; onChanged?: () => void }) {
|
||||
const [agents, setAgents] = useState<AgentProvider[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [selected, setSelected] = useState(0);
|
||||
useEffect(() => {
|
||||
let live = true;
|
||||
backend.providers().then(
|
||||
(list) => live && setAgents(list.filter((p) => p.defaultProgram != null)),
|
||||
(e: unknown) => live && setError(e instanceof Error ? e.message : String(e)),
|
||||
);
|
||||
return () => {
|
||||
live = false;
|
||||
};
|
||||
}, [backend]);
|
||||
const refresh = useCallback(async () => {
|
||||
const list = await backend.providers();
|
||||
setAgents(list.filter((p) => p.defaultProgram != null));
|
||||
}, [backend]);
|
||||
if (error)
|
||||
return (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
);
|
||||
if (!agents) return <Spinner size={14} />;
|
||||
const agent = agents[selected] ?? agents[0];
|
||||
return (
|
||||
<div className={styles.split}>
|
||||
<List
|
||||
className={styles.master}
|
||||
items={agents}
|
||||
getKey={(p) => p.id}
|
||||
activeIndex={selected}
|
||||
onActiveChange={setSelected}
|
||||
rowHeight={32}
|
||||
aria-label={tx("Built-in agents")}
|
||||
renderItem={(p) => (
|
||||
<div className={clsx(styles.agentRow, !p.installed && !p.commandOverridden && styles.agentMissing)}>
|
||||
<Icon name={providerIcon(p.id)} size={16} />
|
||||
<span className={styles.agentName}>{p.name}</span> <Status agent={p} />
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
{agent && <Details key={agent.id} agent={agent} backend={backend} refresh={refresh} onChanged={onChanged} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Details({
|
||||
agent,
|
||||
backend,
|
||||
refresh,
|
||||
onChanged,
|
||||
}: {
|
||||
agent: AgentProvider;
|
||||
backend: CommandsBackend;
|
||||
refresh: () => Promise<void>;
|
||||
onChanged?: () => void;
|
||||
}) {
|
||||
const form = useSettingsForm();
|
||||
const base = agent.commandOverridden ? agent.program : "";
|
||||
const { value, current, set, saving } = form.useExternal(`agents.${agent.id}.command`, base, async (draft) => {
|
||||
const command = draft.trim() || null;
|
||||
await backend.set(agent.id, command);
|
||||
await refresh();
|
||||
onChanged?.();
|
||||
return command === agent.defaultProgram ? "" : (command ?? "");
|
||||
});
|
||||
const envBase = formatEnv(agent.env);
|
||||
const env = form.useExternal(`agents.${agent.id}.env`, envBase, async (draft) => {
|
||||
const parsed = parseEnv(draft);
|
||||
await backend.setEnv(agent.id, parsed);
|
||||
await refresh();
|
||||
onChanged?.();
|
||||
return formatEnv(parsed);
|
||||
});
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
// An edit can have been staged by a previous page instance. Its Apply callback
|
||||
// refreshes that instance; the mounted one follows the newly applied value too.
|
||||
useEffect(() => {
|
||||
if (!saving && current !== base) {
|
||||
void refresh().catch((e: unknown) => setError(e instanceof Error ? e.message : String(e)));
|
||||
}
|
||||
}, [base, current, saving, refresh]);
|
||||
const launch = [agent.defaultProgram, ...agent.defaultArgs].join(" ");
|
||||
const status = agent.commandOverridden
|
||||
? tx("Custom executable")
|
||||
: agent.installed
|
||||
? tx("Found on PATH")
|
||||
: tx("Not found on PATH");
|
||||
return (
|
||||
<section className={styles.details} aria-label={tx`${agent.name} executable`}>
|
||||
<div className={styles.title}>
|
||||
<Icon name={providerIcon(agent.id)} size={20} />
|
||||
<h3>{agent.name}</h3>
|
||||
</div>
|
||||
<div className={styles.subtitle}>
|
||||
<span
|
||||
aria-hidden
|
||||
className={clsx(styles.dot, agent.commandOverridden ? styles.dotCustom : agent.installed && styles.dotFound)}
|
||||
/>
|
||||
<span>{status}</span>
|
||||
<span aria-hidden>·</span>
|
||||
<code className={styles.launch} title={tx("Launch command")}>
|
||||
{launch}
|
||||
</code>
|
||||
</div>
|
||||
{agent.commandEditable ? (
|
||||
<>
|
||||
<label className={styles.label} htmlFor={`agent-executable-${agent.id}`}>
|
||||
<T>Executable</T>
|
||||
</label>
|
||||
<div className={styles.controls}>
|
||||
<Input
|
||||
id={`agent-executable-${agent.id}`}
|
||||
mono
|
||||
value={value}
|
||||
disabled={saving}
|
||||
placeholder={tx`Auto-detect (${agent.defaultProgram})`}
|
||||
onChange={(e) => set(e.target.value)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="folder-open"
|
||||
title="Browse…"
|
||||
disabled={saving}
|
||||
onClick={async () => {
|
||||
try {
|
||||
const path = await backend.chooseExecutable(tx`Select ${agent.name}`, value);
|
||||
if (path) set(path);
|
||||
setError(null);
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{value && <IconButton icon="undo" title="Reset" disabled={saving} onClick={() => set("")} />}
|
||||
</div>
|
||||
<p className={styles.hint}>
|
||||
<T>Leave empty to find the executable on PATH. Changes apply to new sessions.</T>
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p className={styles.hint}>
|
||||
{agent.commandReadOnlyReason === "packageRunner" ? (
|
||||
<T>This agent runs through a package runner (npm or uv) and has no executable to choose.</T>
|
||||
) : agent.commandReadOnlyReason === "registry" ? (
|
||||
<T>This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.</T>
|
||||
) : (
|
||||
<T>This agent is configured in its agent file.</T>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{agent.commandReadOnlyReason !== "registry" && agent.commandReadOnlyReason !== "customAgent" && (
|
||||
<>
|
||||
<label className={styles.label} htmlFor={`agent-env-${agent.id}`}>
|
||||
<T>Environment variables</T>
|
||||
</label>
|
||||
<div className={styles.controls}>
|
||||
<Input
|
||||
id={`agent-env-${agent.id}`}
|
||||
mono
|
||||
value={env.value}
|
||||
disabled={env.saving}
|
||||
placeholder="NAME=value; OTHER=value"
|
||||
onChange={(e) => env.set(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<p className={styles.hint}>
|
||||
<T>Passed to the agent process, replacing variables of the same name. Changes apply to new sessions.</T>
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{agent.loginHint && (
|
||||
<>
|
||||
<h4 className={styles.section}>
|
||||
<T>Sign in</T>
|
||||
</h4>
|
||||
<p className={styles.hint}>
|
||||
<LoginHint text={agent.loginHint} />
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{error && (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** `NAME=value` pairs separated by `;` or new lines. */
|
||||
function parseEnv(text: string): Record<string, string> {
|
||||
const env: Record<string, string> = {};
|
||||
for (const raw of text.split(/[;\n]/)) {
|
||||
const pair = raw.trim();
|
||||
if (!pair) continue;
|
||||
const eq = pair.indexOf("=");
|
||||
const key = eq < 0 ? "" : pair.slice(0, eq).trim();
|
||||
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) throw new Error(tx`Expected NAME=value: ${pair}`);
|
||||
env[key] = pair.slice(eq + 1).trim();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
const formatEnv = (env: Record<string, string>) =>
|
||||
Object.entries(env)
|
||||
.map(([k, v]) => `${k}=${v}`)
|
||||
.join("; ");
|
||||
|
||||
/** Login hints are plain text with optional backtick-delimited command spans. */
|
||||
function LoginHint({ text }: { text: string }) {
|
||||
const translate = useTxTemplate();
|
||||
return translate(text)
|
||||
.split(/(`[^`]+`)/g)
|
||||
.map((part, i) => (i % 2 === 1 ? <code key={i}>{part.slice(1, -1)}</code> : part));
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
useAgentCommands,
|
||||
useAgents,
|
||||
} from "./store";
|
||||
import { useAgentSettings } from "./agentSettings";
|
||||
import styles from "./Home.module.css";
|
||||
|
||||
export function HomeEditor({ docked = false }: { docked?: boolean; input?: EditorInput }) {
|
||||
@@ -95,7 +96,8 @@ export function HomeEditor({ docked = false }: { docked?: boolean; input?: Edito
|
||||
.catch((e: unknown) => setError(e instanceof Error ? e.message : String(e)))
|
||||
.finally(() => setStarting(false));
|
||||
};
|
||||
const config = draftConfig(provider, draft);
|
||||
const defaults = useAgentSettings().defaults;
|
||||
const config = draftConfig(provider, draft, (provider && defaults[provider.id]) || {});
|
||||
|
||||
return (
|
||||
<div className={clsx(styles.home, docked && styles.docked)}>
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
/**
|
||||
* Agents of the ACP Registry this machine can run, with Install / Update / Remove (in
|
||||
* Settings › Agents › Add Agent).
|
||||
* Installs run in the background with progress, and keep running after the page closes
|
||||
* (as a background task of the project windows); the page then shows them as installing.
|
||||
*/
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { AgentRegistry, RegistryAgent, RequestId } from "@/bindings";
|
||||
import { isCancelled, nextRequestId } from "@/platform/ipc";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { openExternalUrl } from "@/platform/openUrl";
|
||||
import { Badge, Button, Icon, ProgressBar, SearchField, Spinner, T } from "@/ui";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { providerIcon } from "./model";
|
||||
import {
|
||||
DISTRIBUTION_LABEL,
|
||||
afterInstall,
|
||||
afterRemove,
|
||||
matchesQuery,
|
||||
rowActions,
|
||||
sortAgents,
|
||||
type RegistryBackend,
|
||||
} from "./registry";
|
||||
import styles from "./AgentRegistry.module.css";
|
||||
|
||||
const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));
|
||||
|
||||
/** How often the page checks on installs it did not start. */
|
||||
const BACKGROUND_POLL_MS = 1500;
|
||||
|
||||
interface Job {
|
||||
id: string;
|
||||
fraction: number | null;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface PageJob extends Job {
|
||||
request: RequestId;
|
||||
}
|
||||
|
||||
/** An install started before the page opened; its progress shows in the background tasks. */
|
||||
const backgroundJob = (agent: RegistryAgent): Job => ({
|
||||
id: agent.id,
|
||||
fraction: null,
|
||||
message: tx`Installing ${agent.name} in the background…`,
|
||||
});
|
||||
|
||||
export function RegistryList({ backend, onChanged }: { backend: RegistryBackend; onChanged?: () => void }) {
|
||||
const [registry, setRegistry] = useState<AgentRegistry | null>(null);
|
||||
const [loadError, setLoadError] = useState<string | null>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [job, setJob] = useState<PageJob | null>(null);
|
||||
const [removing, setRemoving] = useState<string | null>(null);
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
|
||||
useEffect(() => {
|
||||
const request = nextRequestId();
|
||||
let live = true;
|
||||
backend
|
||||
.list(request)
|
||||
.then((r) => live && setRegistry(r))
|
||||
.catch((e: unknown) => live && !isCancelled(e) && setLoadError(errorText(e)));
|
||||
return () => {
|
||||
live = false;
|
||||
backend.cancel(request);
|
||||
};
|
||||
}, [backend]);
|
||||
|
||||
// Installs started before the page opened: follow them until they end.
|
||||
const background = registry?.agents.some((a) => a.installing) ?? false;
|
||||
useEffect(() => {
|
||||
if (!background) return;
|
||||
let live = true;
|
||||
let request: RequestId | null = null;
|
||||
const timer = setInterval(() => {
|
||||
if (request != null) return;
|
||||
const r = (request = nextRequestId());
|
||||
backend
|
||||
.list(r)
|
||||
.then((next) => {
|
||||
if (!live) return;
|
||||
setRegistry(next);
|
||||
if (!next.agents.some((a) => a.installing)) onChanged?.();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
if (request === r) request = null;
|
||||
});
|
||||
}, BACKGROUND_POLL_MS);
|
||||
return () => {
|
||||
live = false;
|
||||
clearInterval(timer);
|
||||
if (request != null) backend.cancel(request);
|
||||
};
|
||||
}, [backend, background, onChanged]);
|
||||
|
||||
const agents = useMemo(
|
||||
() => sortAgents((registry?.agents ?? []).filter((a) => matchesQuery(a, query))),
|
||||
[registry, query],
|
||||
);
|
||||
const busy = job != null || removing != null || background;
|
||||
|
||||
const setError = (id: string, error: string | null) =>
|
||||
setErrors((all) => {
|
||||
const { [id]: _, ...rest } = all;
|
||||
return error ? { ...rest, [id]: error } : rest;
|
||||
});
|
||||
|
||||
const install = async (agent: RegistryAgent) => {
|
||||
if (
|
||||
agent.noChecksum &&
|
||||
!(await confirm({
|
||||
title: tx`Install ${agent.name}`,
|
||||
message: tx`${agent.name} provides no checksum for its download, so the downloaded file cannot be verified. Install it anyway?`,
|
||||
ok: tx("Install"),
|
||||
icon: "warning",
|
||||
}))
|
||||
)
|
||||
return;
|
||||
const request = nextRequestId();
|
||||
setError(agent.id, null);
|
||||
setJob({ id: agent.id, request, fraction: null, message: tx`Installing ${agent.name} ${agent.version}…` });
|
||||
backend
|
||||
.install(agent.id, request, (e) =>
|
||||
setJob((j) =>
|
||||
j && j.request === request
|
||||
? e.type === "progress"
|
||||
? { ...j, fraction: e.fraction, message: e.message }
|
||||
: { ...j, message: e.text }
|
||||
: j,
|
||||
),
|
||||
)
|
||||
.then(() => {
|
||||
setRegistry((r) => r && { ...r, agents: afterInstall(r.agents, agent.id) });
|
||||
onChanged?.();
|
||||
})
|
||||
.catch((e: unknown) => !isCancelled(e) && setError(agent.id, errorText(e)))
|
||||
.finally(() => setJob(null));
|
||||
};
|
||||
|
||||
const remove = (agent: RegistryAgent) => {
|
||||
setError(agent.id, null);
|
||||
setRemoving(agent.id);
|
||||
backend
|
||||
.remove(agent.id)
|
||||
.then(() => {
|
||||
setRegistry((r) => r && { ...r, agents: afterRemove(r.agents, agent.id) });
|
||||
onChanged?.();
|
||||
})
|
||||
.catch((e: unknown) => setError(agent.id, errorText(e)))
|
||||
.finally(() => setRemoving(null));
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.body}>
|
||||
<SearchField
|
||||
autoFocus
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder={tx("Search the ACP Registry")}
|
||||
aria-label="Search agents"
|
||||
clearable
|
||||
/>
|
||||
<p className={styles.notice}>
|
||||
<T>
|
||||
Agents in the ACP Registry are third-party software. They run on this computer with your permissions and can
|
||||
read and change your files. Install only agents you trust.
|
||||
</T>
|
||||
</p>
|
||||
{registry?.warning && (
|
||||
<p className={styles.warning} role="status">
|
||||
{registry.warning}
|
||||
</p>
|
||||
)}
|
||||
<div className={styles.list} aria-busy={!registry && !loadError}>
|
||||
{loadError ? (
|
||||
<p className={styles.error} role="alert">
|
||||
{tx`Cannot load the ACP Registry: ${loadError}`}
|
||||
</p>
|
||||
) : !registry ? (
|
||||
<div className={styles.loading}>
|
||||
<Spinner size={14} />
|
||||
<T>Loading the ACP Registry…</T>
|
||||
</div>
|
||||
) : agents.length === 0 ? (
|
||||
<p className={styles.empty}>
|
||||
{query ? <T>No agents match</T> : <T>The registry has no agents for this system</T>}
|
||||
</p>
|
||||
) : (
|
||||
<ul className={styles.rows} aria-label="Registry agents">
|
||||
{agents.map((agent) => (
|
||||
<AgentRow
|
||||
key={agent.id}
|
||||
agent={agent}
|
||||
job={job?.id === agent.id ? job : agent.installing ? backgroundJob(agent) : null}
|
||||
removing={removing === agent.id}
|
||||
disabled={busy}
|
||||
error={errors[agent.id] ?? null}
|
||||
onInstall={() => void install(agent)}
|
||||
onRemove={() => remove(agent)}
|
||||
onCancel={job?.id === agent.id ? () => backend.cancel(job.request) : undefined}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AgentRow({
|
||||
agent,
|
||||
job,
|
||||
removing,
|
||||
disabled,
|
||||
error,
|
||||
onInstall,
|
||||
onRemove,
|
||||
onCancel,
|
||||
}: {
|
||||
agent: RegistryAgent;
|
||||
job: Job | null;
|
||||
removing: boolean;
|
||||
disabled: boolean;
|
||||
error: string | null;
|
||||
onInstall: () => void;
|
||||
onRemove: () => void;
|
||||
/** Absent for an install this page did not start (stop it from the background tasks). */
|
||||
onCancel?: () => void;
|
||||
}) {
|
||||
const actions = rowActions(agent);
|
||||
const titleId = `agent-${agent.id}`;
|
||||
return (
|
||||
<li className={styles.row} aria-labelledby={titleId}>
|
||||
<div className={styles.main}>
|
||||
<div className={styles.titleLine}>
|
||||
<Icon name={providerIcon(agent.id)} size={16} />
|
||||
<span id={titleId} className={styles.name}>
|
||||
{agent.name}
|
||||
</span>
|
||||
<span className={styles.version}>{agent.installed ?? agent.version}</span>
|
||||
{agent.distribution && <Badge>{DISTRIBUTION_LABEL[agent.distribution]}</Badge>}
|
||||
{agent.noChecksum && <Badge tone="warning">{tx("No checksum provided")}</Badge>}
|
||||
{actions.update && <Badge tone="accent">{tx`${agent.version} available`}</Badge>}
|
||||
{agent.installed != null && !actions.update && <Badge tone="success">{tx("Installed")}</Badge>}
|
||||
</div>
|
||||
{agent.description && <p className={styles.description}>{agent.description}</p>}
|
||||
<div className={styles.meta}>
|
||||
{agent.authors.length > 0 && <span>{agent.authors.join(", ")}</span>}
|
||||
{agent.license && <span>{agent.license}</span>}
|
||||
{agent.repository && <ExternalLink url={agent.repository} label="Repository" />}
|
||||
{agent.website && agent.website !== agent.repository && <ExternalLink url={agent.website} label="Website" />}
|
||||
</div>
|
||||
{job && (
|
||||
<div className={styles.progress}>
|
||||
<ProgressBar value={job.fraction} aria-label={tx`Installing ${agent.name}`} />
|
||||
<span className={styles.progressText}>{job.message}</span>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<p className={styles.error} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.actions}>
|
||||
{job ? (
|
||||
onCancel && (
|
||||
<Button size="small" onClick={onCancel}>
|
||||
Cancel
|
||||
</Button>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
{actions.install && (
|
||||
<Button size="small" variant="primary" disabled={disabled} onClick={onInstall}>
|
||||
Install
|
||||
</Button>
|
||||
)}
|
||||
{actions.update && (
|
||||
<Button size="small" variant="primary" disabled={disabled} onClick={onInstall}>
|
||||
Update
|
||||
</Button>
|
||||
)}
|
||||
{actions.remove && (
|
||||
<Button size="small" disabled={disabled} onClick={onRemove}>
|
||||
{removing ? "Removing…" : "Remove"}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function ExternalLink({ url, label }: { url: string; label: string }) {
|
||||
// Links come from the registry: web pages only.
|
||||
if (!/^https?:\/\//i.test(url)) return null;
|
||||
return (
|
||||
<button type="button" className={styles.link} title={url} onClick={() => void openExternalUrl(url)}>
|
||||
<T>{label}</T>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ function SessionStatus({
|
||||
|
||||
/**
|
||||
* Context use, usage limits and cost (when the agent reports them) and the time spent on
|
||||
* the task, each as Settings › Tools › Agents › Chat allows.
|
||||
* the task, each as Settings › Agents › Chat allows.
|
||||
*/
|
||||
function Meters({ task, entries }: { task: AgentTask; entries: AgentEntry[] | null }) {
|
||||
const tx = useTx();
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useSettingsFormFor } from "@/features/settings/components/context";
|
||||
import { closeSettings, openSettings, selectPage } from "@/features/settings/model/staging";
|
||||
import { SettingsDialog } from "@/features/settings/dialog/SettingsDialog";
|
||||
import { REGISTRY_PAGE } from "./model";
|
||||
import { RegistryList } from "./RegistryList";
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
function AgentRegistryPage(props: ComponentProps<typeof RegistryPage>) {
|
||||
@@ -176,16 +177,12 @@ describe("agent picker", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Agents settings page", () => {
|
||||
const renderRegistry = (...args: Parameters<typeof render>) => {
|
||||
const result = render(...args);
|
||||
fireEvent.click(screen.getByRole("tab", { name: "ACP Registry" }));
|
||||
return result;
|
||||
};
|
||||
describe("Add Agent: the ACP Registry", () => {
|
||||
const renderRegistry = render;
|
||||
it("shows the built-in Copilot name and icon in its registry row", async () => {
|
||||
const backend = new FakeBackend();
|
||||
backend.registry = { agents: [agent({ id: "copilot", name: "GitHub Copilot" })], warning: null };
|
||||
renderRegistry(<AgentRegistryPage backend={backend} />);
|
||||
renderRegistry(<RegistryList backend={backend} />);
|
||||
const copilot = await screen.findByRole("listitem", { name: "GitHub Copilot" });
|
||||
const expected = document.createElement("div");
|
||||
expected.innerHTML = iconMarkup("agent-copilot")!;
|
||||
@@ -195,7 +192,7 @@ describe("Agents settings page", () => {
|
||||
|
||||
it("lists registry agents, says they are third-party, and searches them", async () => {
|
||||
const backend = new FakeBackend();
|
||||
renderRegistry(<AgentRegistryPage backend={backend} />);
|
||||
renderRegistry(<RegistryList backend={backend} />);
|
||||
await waitFor(() => expect(row("Amp")).toBeInTheDocument());
|
||||
expect(screen.getByText(/third-party software/)).toBeInTheDocument();
|
||||
expect(within(row("Amp")).getByRole("button", { name: "Install" })).toBeEnabled();
|
||||
@@ -214,7 +211,7 @@ describe("Agents settings page", () => {
|
||||
it("installs with progress, then reports the change", async () => {
|
||||
const backend = new FakeBackend();
|
||||
const onChanged = vi.fn();
|
||||
renderRegistry(<AgentRegistryPage onChanged={onChanged} backend={backend} />);
|
||||
renderRegistry(<RegistryList onChanged={onChanged} backend={backend} />);
|
||||
await waitFor(() => expect(row("Amp")).toBeInTheDocument());
|
||||
fireEvent.click(within(row("Amp")).getByRole("button", { name: "Install" }));
|
||||
expect(backend.installs).toEqual(["amp-acp"]);
|
||||
@@ -235,7 +232,7 @@ describe("Agents settings page", () => {
|
||||
backend.registry = { agents: [{ ...AMP, noChecksum: true }], warning: null };
|
||||
renderRegistry(
|
||||
<>
|
||||
<AgentRegistryPage backend={backend} />
|
||||
<RegistryList backend={backend} />
|
||||
<MessagesHost />
|
||||
</>,
|
||||
);
|
||||
@@ -259,7 +256,7 @@ describe("Agents settings page", () => {
|
||||
const backend = new FakeBackend();
|
||||
renderRegistry(
|
||||
<>
|
||||
<AgentRegistryPage backend={backend} />
|
||||
<RegistryList backend={backend} />
|
||||
<MessagesHost />
|
||||
</>,
|
||||
);
|
||||
@@ -272,7 +269,7 @@ describe("Agents settings page", () => {
|
||||
|
||||
it("shows why an install failed, cancels one on Cancel, and leaves it running when the page closes", async () => {
|
||||
const backend = new FakeBackend();
|
||||
const { unmount } = renderRegistry(<AgentRegistryPage backend={backend} />);
|
||||
const { unmount } = renderRegistry(<RegistryList backend={backend} />);
|
||||
await waitFor(() => expect(row("Cline")).toBeInTheDocument());
|
||||
fireEvent.click(within(row("Cline")).getByRole("button", { name: "Update" }));
|
||||
await act(async () => backend.fail(new IpcError({ kind: "unavailable", message: "npm is required" })));
|
||||
@@ -296,7 +293,7 @@ describe("Agents settings page", () => {
|
||||
const backend = new FakeBackend();
|
||||
const onChanged = vi.fn();
|
||||
backend.registry = { agents: [{ ...AMP, installing: true }, CLINE], warning: null };
|
||||
renderRegistry(<AgentRegistryPage onChanged={onChanged} backend={backend} />);
|
||||
renderRegistry(<RegistryList onChanged={onChanged} backend={backend} />);
|
||||
await waitFor(() => expect(row("Amp")).toBeInTheDocument());
|
||||
expect(within(row("Amp")).getByText("Installing Amp in the background…")).toBeInTheDocument();
|
||||
// It is stopped from the background tasks, and nothing else starts meanwhile.
|
||||
@@ -314,7 +311,7 @@ describe("Agents settings page", () => {
|
||||
it("removes an installed agent", async () => {
|
||||
const backend = new FakeBackend();
|
||||
const onChanged = vi.fn();
|
||||
renderRegistry(<AgentRegistryPage onChanged={onChanged} backend={backend} />);
|
||||
renderRegistry(<RegistryList onChanged={onChanged} backend={backend} />);
|
||||
await waitFor(() => expect(row("fast-agent")).toBeInTheDocument());
|
||||
fireEvent.click(within(row("fast-agent")).getByRole("button", { name: "Remove" }));
|
||||
await waitFor(() => expect(within(row("fast-agent")).getByRole("button", { name: "Install" })).toBeEnabled());
|
||||
@@ -325,12 +322,12 @@ describe("Agents settings page", () => {
|
||||
it("falls back to the saved list with a warning, and reports a registry it cannot load", async () => {
|
||||
const backend = new FakeBackend();
|
||||
backend.registry = { agents: AGENTS, warning: "Could not reach the ACP Registry" };
|
||||
const { unmount } = renderRegistry(<AgentRegistryPage backend={backend} />);
|
||||
const { unmount } = renderRegistry(<RegistryList backend={backend} />);
|
||||
await waitFor(() => expect(screen.getByRole("status")).toHaveTextContent("Could not reach the ACP Registry"));
|
||||
unmount();
|
||||
|
||||
backend.list.mockRejectedValueOnce(new IpcError({ kind: "io", message: "offline" }));
|
||||
renderRegistry(<AgentRegistryPage backend={backend} />);
|
||||
renderRegistry(<RegistryList backend={backend} />);
|
||||
await waitFor(() => expect(screen.getByRole("alert")).toHaveTextContent("Cannot load the ACP Registry: offline"));
|
||||
});
|
||||
});
|
||||
@@ -397,12 +394,12 @@ describe("Built-in executable overrides", () => {
|
||||
component: () => <RegistryPage backend={backend} commandBackend={commands} onChanged={onChanged} />,
|
||||
});
|
||||
render(<SettingsDialog />);
|
||||
return screen.findByRole("region", { name: "Claude Code executable" });
|
||||
return screen.findByRole("region", { name: "Claude Code" });
|
||||
};
|
||||
const apply = () => screen.getByRole("button", { name: "Apply" });
|
||||
const field = () => screen.getByRole("textbox", { name: "Executable" });
|
||||
|
||||
it("follows locale changes in tabs and renders login commands as inline code", async () => {
|
||||
it("follows locale changes and renders login commands as inline code", async () => {
|
||||
const commands = new FakeCommands();
|
||||
commands.list = [
|
||||
claudeProvider("claude"),
|
||||
@@ -424,14 +421,12 @@ describe("Built-in executable overrides", () => {
|
||||
await setLocale("zh");
|
||||
});
|
||||
expect(screen.getByRole("option", { name: "Codex 未找到" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("tab", { name: "内置" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("tab", { name: "ACP 注册表" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "添加 Agent…" })).toBeInTheDocument();
|
||||
await act(async () => {
|
||||
await setLocale("en");
|
||||
});
|
||||
expect(screen.getByRole("option", { name: "Codex Not found" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("tab", { name: "Built-in" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("tab", { name: "ACP Registry" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Add Agent…" })).toBeInTheDocument();
|
||||
} finally {
|
||||
await act(async () => {
|
||||
await setLocale("en");
|
||||
@@ -653,3 +648,93 @@ describe("Built-in executable overrides", () => {
|
||||
expect(commands.saved).toEqual([["claude", "/chosen/agent"]]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("the agent list", () => {
|
||||
let dispose = () => {};
|
||||
beforeEach(() => openSettings(REGISTRY_PAGE));
|
||||
afterEach(() => {
|
||||
closeSettings();
|
||||
dispose();
|
||||
});
|
||||
const open = async (commands: FakeCommands, backend = new FakeBackend()) => {
|
||||
dispose = registerSettingsPage({
|
||||
id: REGISTRY_PAGE,
|
||||
title: "Agents",
|
||||
component: () => <RegistryPage backend={backend} commandBackend={commands} />,
|
||||
});
|
||||
render(
|
||||
<>
|
||||
<SettingsDialog />
|
||||
<MessagesHost />
|
||||
</>,
|
||||
);
|
||||
await screen.findByRole("region", { name: "Claude Code" });
|
||||
return backend;
|
||||
};
|
||||
const model = {
|
||||
id: "model",
|
||||
name: "Model",
|
||||
description: null,
|
||||
category: "model",
|
||||
current: "sonnet",
|
||||
values: [
|
||||
{ value: "sonnet", name: "Sonnet", description: null },
|
||||
{ value: "opus", name: "Opus", description: null },
|
||||
],
|
||||
via: "option",
|
||||
} as AgentProvider["config"][number];
|
||||
|
||||
it("lists registry agents beside the built-ins, updates one and removes it", async () => {
|
||||
const commands = new FakeCommands();
|
||||
commands.list = [
|
||||
claudeProvider("claude"),
|
||||
{
|
||||
...claudeProvider("cline"),
|
||||
id: "cline",
|
||||
name: "Cline",
|
||||
commandEditable: false,
|
||||
commandReadOnlyReason: "registry",
|
||||
source: { kind: "registry", version: "3.0.70", update: "3.0.74" },
|
||||
},
|
||||
];
|
||||
const backend = await open(commands);
|
||||
fireEvent.mouseDown(screen.getByRole("option", { name: "Cline Update" }));
|
||||
const details = await screen.findByRole("region", { name: "Cline" });
|
||||
expect(within(details).getByText("ACP Registry · 3.0.70")).toBeInTheDocument();
|
||||
fireEvent.click(within(details).getByRole("button", { name: "Update" }));
|
||||
expect(backend.installs).toEqual(["cline"]);
|
||||
await act(async () => backend.finish());
|
||||
fireEvent.click(screen.getByRole("button", { name: "Remove" }));
|
||||
const dialog = await screen.findByRole("dialog", { name: "Remove Cline" });
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: "Remove" }));
|
||||
await waitFor(() => expect(backend.removed).toEqual(["cline"]));
|
||||
});
|
||||
|
||||
it("adds agents from the ACP Registry in a dialog", async () => {
|
||||
const commands = new FakeCommands();
|
||||
commands.list = [claudeProvider("claude")];
|
||||
await open(commands);
|
||||
expect(screen.getByRole("button", { name: "Remove" })).toBeDisabled();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Add Agent…" }));
|
||||
const dialog = await screen.findByRole("dialog", { name: "Add Agent" });
|
||||
await waitFor(() => expect(within(dialog).getByRole("listitem", { name: "Amp" })).toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("stages the settings new tasks start with", async () => {
|
||||
const commands = new FakeCommands();
|
||||
commands.list = [{ ...claudeProvider("claude"), config: [model] }];
|
||||
await open(commands);
|
||||
const select = screen.getByRole("button", { name: "Model" });
|
||||
expect(select).toHaveTextContent("Agent's default (Sonnet)");
|
||||
fireEvent.click(select);
|
||||
fireEvent.click(await screen.findByRole("option", { name: "Opus" }));
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Opus");
|
||||
});
|
||||
|
||||
it("says when an agent's settings aren't known yet", async () => {
|
||||
const commands = new FakeCommands();
|
||||
commands.list = [claudeProvider("claude")];
|
||||
await open(commands);
|
||||
expect(screen.getByText(/after its first session/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -453,3 +453,30 @@ describe("typed path references", () => {
|
||||
expect(resolveTyped("C:\\r", "../../x")).toBe("C:/x");
|
||||
});
|
||||
});
|
||||
|
||||
describe("new task defaults", () => {
|
||||
it("start a draft with the agent's defaults until the draft picks", async () => {
|
||||
const { draftConfig } = await import("./store");
|
||||
const option = (id: string, current: string, values: string[]) =>
|
||||
({
|
||||
id,
|
||||
name: id,
|
||||
description: null,
|
||||
category: id,
|
||||
current,
|
||||
values: values.map((value) => ({ value, name: value, description: null })),
|
||||
via: "option",
|
||||
}) as AgentConfigOption;
|
||||
const provider = {
|
||||
id: "claude",
|
||||
config: [option("model", "sonnet", ["sonnet", "opus"]), option("mode", "default", ["default", "plan"])],
|
||||
} as unknown as Parameters<typeof draftConfig>[0];
|
||||
const draft = { provider: "claude", config: {}, isolation: "local", base: null } as unknown as Parameters<
|
||||
typeof draftConfig
|
||||
>[1];
|
||||
const current = (d: typeof draft, defaults: Record<string, string>) =>
|
||||
draftConfig(provider, d, defaults).map((o) => o.current);
|
||||
expect(current(draft, { model: "opus", mode: "nope" })).toEqual(["opus", "default"]);
|
||||
expect(current({ ...draft, config: { model: "sonnet" } }, { model: "opus" })).toEqual(["sonnet", "default"]);
|
||||
});
|
||||
});
|
||||
@@ -27,13 +27,13 @@ import { TaskStatusMark } from "./TaskStatusMark";
|
||||
import { taskActions } from "./taskActions";
|
||||
import { replyActions } from "./replyActions";
|
||||
|
||||
/** Settings › Tools › Agents (also used by the Settings window). */
|
||||
/** Settings › Agents (also used by the Settings window). */
|
||||
export function activateSettingsPages(): () => void {
|
||||
return registerSettingsPage({
|
||||
id: REGISTRY_PAGE,
|
||||
title: "Agents",
|
||||
group: "Tools",
|
||||
order: 500,
|
||||
// After Languages & Frameworks, before Tools.
|
||||
order: 450,
|
||||
keywords: ["agent", "acp", "registry", "install", "update", "coding agent"],
|
||||
component: lazyComponent(() => import("./AgentRegistryPage").then((m) => m.AgentRegistryPage)),
|
||||
});
|
||||
|
||||
@@ -7,8 +7,8 @@ export const HOME_KEY = "agent:new";
|
||||
export const TOOL_WINDOW = "agents";
|
||||
/** MIME of a dragged agent task (a tree row or the docked conversation bar): the payload is the task id. */
|
||||
export const TASK_DRAG = "application/x-openidea-agent-task";
|
||||
/** Settings › Tools › Agents: the ACP Registry. */
|
||||
export const REGISTRY_PAGE = "tools.agents";
|
||||
/** Settings › Agents: the agents this machine runs. */
|
||||
export const REGISTRY_PAGE = "agents";
|
||||
|
||||
export const sessionKey = (task: string) => `agent:${task}`;
|
||||
|
||||
|
||||
@@ -157,12 +157,23 @@ export function updateDraft(patch: Partial<Draft>) {
|
||||
save(DRAFT_KEY, draft);
|
||||
}
|
||||
|
||||
/** Config for the selected model, with only supported draft choices applied. */
|
||||
export function draftConfig(provider: AgentProvider | undefined, draft: Draft): AgentConfigOption[] {
|
||||
/** What Settings › Agents says new tasks of `provider` start with, by option id. */
|
||||
export const providerDefaults = (provider: string | undefined): Record<string, string> =>
|
||||
(provider && useProject.getState().settings?.agents?.defaults?.[provider]) || {};
|
||||
|
||||
/**
|
||||
* Config for the selected model, with only supported choices applied: the draft's, else
|
||||
* the agent's defaults from Settings › Agents.
|
||||
*/
|
||||
export function draftConfig(
|
||||
provider: AgentProvider | undefined,
|
||||
draft: Draft,
|
||||
defaults: Record<string, string> = providerDefaults(provider?.id),
|
||||
): AgentConfigOption[] {
|
||||
const config = (provider?.config ?? [])
|
||||
.filter((o) => o.category !== "thought_level")
|
||||
.map((o) => {
|
||||
const choice = draft.config[o.id];
|
||||
const choice = draft.config[o.id] ?? defaults[o.id];
|
||||
return {
|
||||
...o,
|
||||
current: choice !== undefined && o.values.some((v) => v.value === choice) ? choice : o.current,
|
||||
@@ -172,7 +183,7 @@ export function draftConfig(provider: AgentProvider | undefined, draft: Draft):
|
||||
if (model) {
|
||||
config.push(
|
||||
...(provider?.thoughtLevels?.[model] ?? []).map((o) => {
|
||||
const choice = draft.thoughtLevels?.[model]?.[o.id];
|
||||
const choice = draft.thoughtLevels?.[model]?.[o.id] ?? defaults[o.id];
|
||||
return {
|
||||
...o,
|
||||
current: choice !== undefined && o.values.some((v) => v.value === choice) ? choice : o.current,
|
||||
@@ -629,7 +640,7 @@ export async function startTask(
|
||||
providers.find((p) => p.id === draft.provider),
|
||||
draft,
|
||||
);
|
||||
const defaults = bypassDefaults(options);
|
||||
const defaults = { ...bypassDefaults(options), ...providerDefaults(draft.provider) };
|
||||
const config = options.flatMap((o) => {
|
||||
const value =
|
||||
o.category === "model" || o.category === "thought_level"
|
||||
|
||||
@@ -114,10 +114,9 @@ function McpServerEndpoint() {
|
||||
}
|
||||
|
||||
export const MCP_SERVER_PAGE: PageSpec = {
|
||||
id: "tools.mcpServer",
|
||||
id: "agents.mcpServer",
|
||||
title: "MCP Server",
|
||||
group: "Tools",
|
||||
order: 604,
|
||||
order: 10,
|
||||
keywords: ["mcp", "model context protocol", "ai", "agent", "claude", "codex", "tools", "stdio"],
|
||||
sections: [
|
||||
{
|
||||
|
||||
@@ -27,6 +27,24 @@ import { tx } from "@/platform/i18n";
|
||||
|
||||
export const TOOLS_GROUP = "Tools";
|
||||
|
||||
const SEND_KEY_OPTIONS = [
|
||||
{ value: "enter", label: "Enter" },
|
||||
{ value: "modEnter", label: "⌘Enter" },
|
||||
];
|
||||
const WHILE_RUNNING_OPTIONS = [
|
||||
{ value: "queue", label: "Queues the message for after the turn" },
|
||||
{ value: "steer", label: "Sends it into the turn" },
|
||||
];
|
||||
const TOOL_CALL_OPTIONS = [
|
||||
{ value: "grouped", label: "Grouped by what they did" },
|
||||
{ value: "each", label: "One per line" },
|
||||
];
|
||||
const THINKING_OPTIONS = [
|
||||
{ value: "auto", label: "Open while it streams" },
|
||||
{ value: "expanded", label: "Always open" },
|
||||
{ value: "collapsed", label: "Folded" },
|
||||
];
|
||||
|
||||
const L = WORKFLOW_LIMITS;
|
||||
const isMac = typeof navigator !== "undefined" && /Mac/i.test(navigator.platform || navigator.userAgent);
|
||||
|
||||
@@ -630,13 +648,67 @@ export const TOOLS_PAGES: PageSpec[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
// Under Settings › Tools › Agents (the agents feature registers `tools.agents`).
|
||||
id: "tools.agents.chat",
|
||||
// Under Settings › Agents (the agents feature registers `agents`).
|
||||
id: "agents.chat",
|
||||
title: "Chat",
|
||||
group: TOOLS_GROUP,
|
||||
order: 0,
|
||||
keywords: ["agent", "claude", "codex", "usage", "quota", "rate limit", "cost", "tokens", "meter"],
|
||||
keywords: [
|
||||
"agent",
|
||||
"claude",
|
||||
"codex",
|
||||
"usage",
|
||||
"quota",
|
||||
"rate limit",
|
||||
"cost",
|
||||
"tokens",
|
||||
"meter",
|
||||
"send",
|
||||
"reasoning",
|
||||
],
|
||||
sections: [
|
||||
{
|
||||
title: "Sending",
|
||||
options: [
|
||||
{ kind: "select", key: "agents.sendWith", label: "Send messages with", options: SEND_KEY_OPTIONS },
|
||||
{
|
||||
kind: "select",
|
||||
key: "agents.whileRunning",
|
||||
label: "While the agent works, sending",
|
||||
options: WHILE_RUNNING_OPTIONS,
|
||||
hint: "The other way is a modifier away: ⌘↵ with Enter, ⌘⇧↵ with ⌘↵",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Conversation",
|
||||
options: [
|
||||
{
|
||||
kind: "toggle",
|
||||
key: "agents.foldTurns",
|
||||
label: "Fold a finished turn's work",
|
||||
hint: "Reasoning and tool calls before the reply fold into one line under its message",
|
||||
},
|
||||
{
|
||||
kind: "select",
|
||||
key: "agents.toolCalls",
|
||||
label: "Tool calls",
|
||||
options: TOOL_CALL_OPTIONS,
|
||||
},
|
||||
{
|
||||
kind: "select",
|
||||
key: "agents.thinking",
|
||||
label: "Reasoning",
|
||||
options: THINKING_OPTIONS,
|
||||
},
|
||||
{ kind: "toggle", key: "agents.expandToolOutput", label: "Show tool output without opening it" },
|
||||
{
|
||||
kind: "toggle",
|
||||
key: "agents.smoothText",
|
||||
label: "Reveal streaming text smoothly",
|
||||
hint: "Text appears at a steady pace instead of in bursts",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Shown in the Task Header",
|
||||
options: [
|
||||
|
||||
@@ -827,5 +827,37 @@
|
||||
"1 changed file": "1 changed file",
|
||||
"{count} changed files": "{count} changed files",
|
||||
"Send into the agent's turn": "Send into the agent's turn",
|
||||
"Queue a message for when the agent is done (⌘⇧↵ sends it now)": "Queue a message for when the agent is done (⌘⇧↵ sends it now)"
|
||||
"Queue a message for when the agent is done (⌘⇧↵ sends it now)": "Queue a message for when the agent is done (⌘⇧↵ sends it now)",
|
||||
"Remove {name} from this computer? Its tasks stay, but can't continue until it is installed again.": "Remove {name} from this computer? Its tasks stay, but can't continue until it is installed again.",
|
||||
"Add Agent…": "Add Agent…",
|
||||
"Add Agent": "Add Agent",
|
||||
"ACP Registry · {version}": "ACP Registry · {version}",
|
||||
"Agent file": "Agent file",
|
||||
"New tasks start with": "New tasks start with",
|
||||
"Launch": "Launch",
|
||||
"This agent is installed from the ACP Registry, which launches it.": "This agent is installed from the ACP Registry, which launches it.",
|
||||
"{version} is available": "{version} is available",
|
||||
"The agent's models and modes can be chosen here after its first session.": "The agent's models and modes can be chosen here after its first session.",
|
||||
"Agent's default ({fallback})": "Agent's default ({fallback})",
|
||||
"Agent's default": "Agent's default",
|
||||
"What you pick on the New Task page wins; these apply until then and after switching agents.": "What you pick on the New Task page wins; these apply until then and after switching agents.",
|
||||
"⌘Enter": "⌘Enter",
|
||||
"Queues the message for after the turn": "Queues the message for after the turn",
|
||||
"Sends it into the turn": "Sends it into the turn",
|
||||
"Grouped by what they did": "Grouped by what they did",
|
||||
"One per line": "One per line",
|
||||
"Open while it streams": "Open while it streams",
|
||||
"Always open": "Always open",
|
||||
"Folded": "Folded",
|
||||
"Sending": "Sending",
|
||||
"Send messages with": "Send messages with",
|
||||
"While the agent works, sending": "While the agent works, sending",
|
||||
"The other way is a modifier away: ⌘↵ with Enter, ⌘⇧↵ with ⌘↵": "The other way is a modifier away: ⌘↵ with Enter, ⌘⇧↵ with ⌘↵",
|
||||
"Conversation": "Conversation",
|
||||
"Fold a finished turn's work": "Fold a finished turn's work",
|
||||
"Reasoning and tool calls before the reply fold into one line under its message": "Reasoning and tool calls before the reply fold into one line under its message",
|
||||
"Tool calls": "Tool calls",
|
||||
"Show tool output without opening it": "Show tool output without opening it",
|
||||
"Reveal streaming text smoothly": "Reveal streaming text smoothly",
|
||||
"Text appears at a steady pace instead of in bursts": "Text appears at a steady pace instead of in bursts"
|
||||
}
|
||||
@@ -22,11 +22,8 @@
|
||||
"Go to original code at line {line}": "Ir al código original en la línea {line}",
|
||||
"Edited within moved code": "Editado dentro del código movido",
|
||||
"The language server JDK ({path}) must be a full JDK with jdk.compiler, jdk.jdi and jdk.unsupported for Java language support and debugging. jdtls needs JDK {version} or newer. Download JDK {version}, choose a full JDK in {setting}, or set it to Auto.": "El JDK del servidor de lenguaje ({path}) debe ser un JDK completo con jdk.compiler, jdk.jdi y jdk.unsupported para la compatibilidad con el lenguaje Java y la depuración. jdtls requiere JDK {version} o superior. Descarga JDK {version}, elige un JDK completo en {setting} o establécelo en Automático.",
|
||||
"ACP Registry": "Registro ACP",
|
||||
"Apple's clangd does not run clang-tidy, so checks from .clang-tidy are not shown. Install clangd (LLVM) to get them.": "El clangd de Apple no ejecuta clang-tidy, por lo que las comprobaciones de .clang-tidy no se muestran. Instala clangd (LLVM) para obtenerlas.",
|
||||
"Auto-detect ({defaultProgram})": "Detectar automáticamente ({defaultProgram})",
|
||||
"Built-in": "Integrado",
|
||||
"Built-in agents": "Agentes integrados",
|
||||
"Custom executable": "Ejecutable personalizado",
|
||||
"Found on PATH": "Encontrado en PATH",
|
||||
"Launch command": "Comando de inicio",
|
||||
@@ -50,7 +47,6 @@
|
||||
"Run `vibe` in a terminal and sign in.": "Ejecuta `vibe` en una terminal e inicia sesión.",
|
||||
"Sign in with the agent's own command line first.": "Inicia sesión primero con la línea de comandos del propio agente.",
|
||||
"This agent is configured in its agent file.": "Este agente se configura en su archivo de agente.",
|
||||
"This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.": "Este agente se instaló desde el Registro ACP. Administra su instalación en la pestaña Registro ACP.",
|
||||
"This agent runs through a package runner (npm or uv) and has no executable to choose.": "Este agente se ejecuta mediante un ejecutor de paquetes (npm o uv) y no tiene un ejecutable para elegir.",
|
||||
"Update to {latest}": "Actualizar a {latest}",
|
||||
"A newer version is available: {latest}": "Hay una versión más reciente disponible: {latest}",
|
||||
@@ -1686,7 +1682,6 @@
|
||||
"oxfmt formatting timed out": "Se agotó el tiempo de espera al formatear con oxfmt",
|
||||
"{name} does not support selection formatting for this language; formatted the whole file": "{name} no admite el formato de selección para este lenguaje; se formateó todo el archivo",
|
||||
"Formatting timed out": "Se agotó el tiempo de espera de formato",
|
||||
"{name} executable": "Ejecutable de {name}",
|
||||
"{name}: Node.js is required": "{name}: se requiere Node.js",
|
||||
"Formatter": "Formateador",
|
||||
"JSON with Comments": "JSON con comentarios",
|
||||
|
||||
@@ -5486,19 +5486,14 @@
|
||||
"'{expected}' expected": "'{expected}' attendu",
|
||||
"Unexpected token": "Jeton inattendu",
|
||||
"Syntax": "Syntaxe",
|
||||
"Built-in": "Intégrés",
|
||||
"ACP Registry": "Registre ACP",
|
||||
"Not found": "Introuvable",
|
||||
"Built-in agents": "Agents intégrés",
|
||||
"Custom executable": "Exécutable personnalisé",
|
||||
"Found on PATH": "Trouvé dans le PATH",
|
||||
"Not found on PATH": "Introuvable dans le PATH",
|
||||
"{name} executable": "Exécutable {name}",
|
||||
"Launch command": "Commande de lancement",
|
||||
"Auto-detect ({defaultProgram})": "Détection automatique ({defaultProgram})",
|
||||
"Leave empty to find the executable on PATH. Changes apply to new sessions.": "Laissez vide pour rechercher l'exécutable dans le PATH. Les modifications s'appliquent aux nouvelles sessions.",
|
||||
"This agent runs through a package runner (npm or uv) and has no executable to choose.": "Cet agent s'exécute via un lanceur de paquets (npm ou uv) et n'a pas d'exécutable à choisir.",
|
||||
"This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.": "Cet agent est installé depuis le registre ACP. Gérez son installation dans l'onglet Registre ACP.",
|
||||
"This agent is configured in its agent file.": "Cet agent est configuré dans son fichier d'agent.",
|
||||
"Sign in": "Se connecter",
|
||||
"What the session has cost so far, as the agent reports it": "Ce que la session a coûté jusqu'ici, tel que l'agent l'indique",
|
||||
|
||||
@@ -56,11 +56,8 @@
|
||||
"Go to original code at line {line}": "{line}행의 원본 코드로 이동",
|
||||
"Edited within moved code": "이동된 코드 내에서 편집됨",
|
||||
"The language server JDK ({path}) must be a full JDK with jdk.compiler, jdk.jdi and jdk.unsupported for Java language support and debugging. jdtls needs JDK {version} or newer. Download JDK {version}, choose a full JDK in {setting}, or set it to Auto.": "언어 서버 JDK({path})는 Java 언어 지원 및 디버깅을 위해 jdk.compiler, jdk.jdi, jdk.unsupported를 포함한 전체 JDK여야 합니다. jdtls에는 JDK {version} 이상이 필요합니다. JDK {version}을(를) 다운로드하거나, {setting}에서 전체 JDK를 선택하거나, 자동으로 설정하세요.",
|
||||
"ACP Registry": "ACP 레지스트리",
|
||||
"Apple's clangd does not run clang-tidy, so checks from .clang-tidy are not shown. Install clangd (LLVM) to get them.": "Apple의 clangd는 clang-tidy를 실행하지 않으므로 .clang-tidy의 검사가 표시되지 않습니다. 이 검사를 사용하려면 clangd(LLVM)를 설치하세요.",
|
||||
"Auto-detect ({defaultProgram})": "자동 감지({defaultProgram})",
|
||||
"Built-in": "기본 제공",
|
||||
"Built-in agents": "기본 제공 에이전트",
|
||||
"Custom executable": "사용자 지정 실행 파일",
|
||||
"Found on PATH": "PATH에서 찾음",
|
||||
"Launch command": "실행 명령",
|
||||
@@ -86,7 +83,6 @@
|
||||
"Run `vibe` in a terminal and sign in.": "터미널에서 `vibe`를 실행하고 로그인하세요.",
|
||||
"Sign in with the agent's own command line first.": "먼저 에이전트 자체 명령줄에서 로그인하세요.",
|
||||
"This agent is configured in its agent file.": "이 에이전트는 에이전트 파일에서 구성됩니다.",
|
||||
"This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.": "이 에이전트는 ACP 레지스트리에서 설치되었습니다. 설치 관리는 ACP 레지스트리 탭에서 하세요.",
|
||||
"This agent runs through a package runner (npm or uv) and has no executable to choose.": "이 에이전트는 패키지 러너(npm 또는 uv)를 통해 실행되므로 선택할 실행 파일이 없습니다.",
|
||||
"Update to {latest}": "{latest}(으)로 업데이트",
|
||||
"A newer version is available: {latest}": "새 버전을 사용할 수 있습니다: {latest}",
|
||||
@@ -1742,7 +1738,6 @@
|
||||
"Ruff configuration directory has no ruff.toml, .ruff.toml, or pyproject.toml with [tool.ruff]: {path}": "Ruff 구성 디렉터리에 ruff.toml, .ruff.toml 또는 [tool.ruff]가 있는 pyproject.toml이 없습니다: {path}",
|
||||
"{name} does not support selection formatting for this language; formatted the whole file": "{name}은(는) 이 언어의 선택 영역 서식 지정을 지원하지 않아 파일 전체의 서식을 지정했습니다",
|
||||
"Formatting timed out": "서식 지정 시간 초과",
|
||||
"{name} executable": "{name} 실행 파일",
|
||||
"{name}: Node.js is required": "{name}: Node.js가 필요합니다",
|
||||
"Formatter": "서식 지정 도구",
|
||||
"JSON with Comments": "주석이 있는 JSON",
|
||||
|
||||
@@ -14,11 +14,8 @@
|
||||
"Go to original code at line {line}": "Przejdź do oryginalnego kodu w wierszu {line}",
|
||||
"Edited within moved code": "Edytowano w obrębie przeniesionego kodu",
|
||||
"The language server JDK ({path}) must be a full JDK with jdk.compiler, jdk.jdi and jdk.unsupported for Java language support and debugging. jdtls needs JDK {version} or newer. Download JDK {version}, choose a full JDK in {setting}, or set it to Auto.": "JDK serwera językowego ({path}) musi być pełnym pakietem JDK zawierającym jdk.compiler, jdk.jdi oraz jdk.unsupported dla obsługi języka Java i debugowania. jdtls wymaga JDK w wersji {version} lub nowszej. Pobierz JDK {version}, wybierz pełne JDK w {setting} lub ustaw opcję Automatycznie.",
|
||||
"ACP Registry": "Rejestr ACP",
|
||||
"Apple's clangd does not run clang-tidy, so checks from .clang-tidy are not shown. Install clangd (LLVM) to get them.": "Wersja clangd od Apple nie uruchamia clang-tidy, więc kontrole z .clang-tidy nie są wyświetlane. Zainstaluj clangd (LLVM), aby je uzyskać.",
|
||||
"Auto-detect ({defaultProgram})": "Wykryj automatycznie ({defaultProgram})",
|
||||
"Built-in": "Wbudowane",
|
||||
"Built-in agents": "Wbudowani agenci",
|
||||
"Custom executable": "Własny plik wykonywalny",
|
||||
"Found on PATH": "Znaleziono w PATH",
|
||||
"Launch command": "Polecenie uruchomienia",
|
||||
@@ -42,7 +39,6 @@
|
||||
"Run `vibe` in a terminal and sign in.": "Uruchom `vibe` w terminalu i zaloguj się.",
|
||||
"Sign in with the agent's own command line first.": "Najpierw zaloguj się za pomocą własnego wiersza poleceń agenta.",
|
||||
"This agent is configured in its agent file.": "Ten agent jest skonfigurowany w swoim pliku agenta.",
|
||||
"This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.": "Ten agent został zainstalowany z Rejestru ACP. Zarządzaj jego instalacją w karcie Rejestr ACP.",
|
||||
"This agent runs through a package runner (npm or uv) and has no executable to choose.": "Ten agent uruchamia się poprzez narzędzie do uruchamiania pakietów (npm lub uv) i nie posiada pliku wykonywalnego do wyboru.",
|
||||
"Update to {latest}": "Zaktualizuj do {latest}",
|
||||
"A newer version is available: {latest}": "Dostępna jest nowsza wersja: {latest}",
|
||||
@@ -1676,7 +1672,6 @@
|
||||
"oxfmt formatting timed out": "Przekroczono czas oczekiwania na formatowanie oxfmt",
|
||||
"{name} does not support selection formatting for this language; formatted the whole file": "{name} nie obsługuje formatowania zaznaczenia dla tego języka; przeformatowano cały plik",
|
||||
"Formatting timed out": "Przekroczono czas oczekiwania na formatowanie",
|
||||
"{name} executable": "Plik wykonywalny {name}",
|
||||
"{name}: Node.js is required": "{name}: wymagane jest środowisko Node.js",
|
||||
"Formatter": "Formatowanie",
|
||||
"JSON with Comments": "JSON z komentarzami",
|
||||
|
||||
@@ -14,11 +14,8 @@
|
||||
"Go to original code at line {line}": "Ir para o código original na linha {line}",
|
||||
"Edited within moved code": "Editado dentro do código movido",
|
||||
"The language server JDK ({path}) must be a full JDK with jdk.compiler, jdk.jdi and jdk.unsupported for Java language support and debugging. jdtls needs JDK {version} or newer. Download JDK {version}, choose a full JDK in {setting}, or set it to Auto.": "O JDK do servidor de linguagem ({path}) deve ser um JDK completo com jdk.compiler, jdk.jdi e jdk.unsupported para suporte à linguagem Java e depuração. O jdtls requer JDK {version} ou mais recente. Baixe o JDK {version}, escolha um JDK completo em {setting} ou defina como Automático.",
|
||||
"ACP Registry": "Registro ACP",
|
||||
"Apple's clangd does not run clang-tidy, so checks from .clang-tidy are not shown. Install clangd (LLVM) to get them.": "O clangd da Apple não executa o clang-tidy, portanto as verificações do .clang-tidy não são exibidas. Instale o clangd (LLVM) para obtê-las.",
|
||||
"Auto-detect ({defaultProgram})": "Detectar automaticamente ({defaultProgram})",
|
||||
"Built-in": "Integrado",
|
||||
"Built-in agents": "Agentes integrados",
|
||||
"Custom executable": "Executável personalizado",
|
||||
"Found on PATH": "Encontrado no PATH",
|
||||
"Launch command": "Comando de inicialização",
|
||||
@@ -42,7 +39,6 @@
|
||||
"Run `vibe` in a terminal and sign in.": "Execute `vibe` em um terminal e entre.",
|
||||
"Sign in with the agent's own command line first.": "Primeiro entre usando a linha de comando do próprio agente.",
|
||||
"This agent is configured in its agent file.": "Este agente é configurado em seu arquivo de agente.",
|
||||
"This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.": "Este agente foi instalado a partir do Registro ACP. Gerencie sua instalação na guia Registro ACP.",
|
||||
"This agent runs through a package runner (npm or uv) and has no executable to choose.": "Este agente é executado por meio de um executor de pacotes (npm ou uv) e não possui um executável para selecionar.",
|
||||
"Update to {latest}": "Atualizar para {latest}",
|
||||
"A newer version is available: {latest}": "Uma versão mais recente está disponível: {latest}",
|
||||
@@ -1676,7 +1672,6 @@
|
||||
"oxfmt formatting timed out": "Tempo limite de formatação com oxfmt esgotado",
|
||||
"{name} does not support selection formatting for this language; formatted the whole file": "{name} não oferece suporte à formatação de seleção para esta linguagem; o arquivo inteiro foi formatado",
|
||||
"Formatting timed out": "Tempo limite de formatação esgotado",
|
||||
"{name} executable": "Executável do {name}",
|
||||
"{name}: Node.js is required": "{name}: o Node.js é necessário",
|
||||
"Formatter": "Formatador",
|
||||
"JSON with Comments": "JSON com comentários",
|
||||
|
||||
@@ -179,11 +179,8 @@
|
||||
"Go to original code at line {line}": "跳转到第 {line} 行的原始代码",
|
||||
"Edited within moved code": "移动代码中的修改",
|
||||
"The language server JDK ({path}) must be a full JDK with jdk.compiler, jdk.jdi and jdk.unsupported for Java language support and debugging. jdtls needs JDK {version} or newer. Download JDK {version}, choose a full JDK in {setting}, or set it to Auto.": "语言服务器 JDK({path})必须是包含 jdk.compiler、jdk.jdi 和 jdk.unsupported 的完整 JDK,才能支持 Java 语言功能和调试。jdtls 需要 JDK {version} 或更高版本。请下载 JDK {version},在 {setting} 中选择完整 JDK,或设为自动。",
|
||||
"ACP Registry": "ACP 注册表",
|
||||
"Apple's clangd does not run clang-tidy, so checks from .clang-tidy are not shown. Install clangd (LLVM) to get them.": "Apple 的 clangd 不运行 clang-tidy,因此不会显示 .clang-tidy 中配置的检查。请安装 clangd(LLVM)以启用这些检查。",
|
||||
"Auto-detect ({defaultProgram})": "自动检测({defaultProgram})",
|
||||
"Built-in": "内置",
|
||||
"Built-in agents": "内置智能体",
|
||||
"Custom executable": "自定义可执行文件",
|
||||
"Found on PATH": "已在 PATH 中找到",
|
||||
"Launch command": "启动命令",
|
||||
@@ -209,7 +206,6 @@
|
||||
"Run `vibe` in a terminal and sign in.": "在终端中运行 `vibe` 并登录。",
|
||||
"Sign in with the agent's own command line first.": "请先使用智能体自身的命令行登录。",
|
||||
"This agent is configured in its agent file.": "此智能体在其智能体文件中配置。",
|
||||
"This agent is installed from the ACP Registry. Manage its installation in the ACP Registry tab.": "此智能体从 ACP 注册表安装。请在 ACP 注册表标签页管理其安装。",
|
||||
"This agent runs through a package runner (npm or uv) and has no executable to choose.": "此智能体通过包运行器(npm 或 uv)启动,无需选择可执行文件。",
|
||||
"Update to {latest}": "更新至 {latest}",
|
||||
"A newer version is available: {latest}": "有新版本可用:{latest}",
|
||||
@@ -2003,7 +1999,6 @@
|
||||
"Ruff configuration directory has no ruff.toml, .ruff.toml, or pyproject.toml with [tool.ruff]: {path}": "Ruff 配置目录中没有 ruff.toml、.ruff.toml 或包含 [tool.ruff] 的 pyproject.toml:{path}",
|
||||
"{name} does not support selection formatting for this language; formatted the whole file": "{name} 不支持此语言的选区格式化,已格式化整个文件",
|
||||
"Formatting timed out": "格式化超时",
|
||||
"{name} executable": "{name} 可执行文件",
|
||||
"{name}: Node.js is required": "{name}:需要 Node.js",
|
||||
"Formatter": "格式化工具",
|
||||
"JSON with Comments": "带注释的 JSON",
|
||||
@@ -7160,5 +7155,37 @@
|
||||
"1 changed file": "改动 1 个文件",
|
||||
"{count} changed files": "改动 {count} 个文件",
|
||||
"Send into the agent's turn": "发送到当前回合",
|
||||
"Queue a message for when the agent is done (⌘⇧↵ sends it now)": "排队一条消息,agent 做完后发送(⌘⇧↵ 立即发送)"
|
||||
"Queue a message for when the agent is done (⌘⇧↵ sends it now)": "排队一条消息,agent 做完后发送(⌘⇧↵ 立即发送)",
|
||||
"Remove {name} from this computer? Its tasks stay, but can't continue until it is installed again.": "从这台电脑移除 {name}?它的任务会保留,但在重新安装前无法继续。",
|
||||
"Add Agent…": "添加 Agent…",
|
||||
"Add Agent": "添加 Agent",
|
||||
"ACP Registry · {version}": "ACP 注册表 · {version}",
|
||||
"Agent file": "Agent 文件",
|
||||
"New tasks start with": "新任务默认使用",
|
||||
"Launch": "启动",
|
||||
"This agent is installed from the ACP Registry, which launches it.": "此 agent 从 ACP 注册表安装,由注册表负责启动。",
|
||||
"{version} is available": "{version} 可用",
|
||||
"The agent's models and modes can be chosen here after its first session.": "agent 运行过一次会话后,才能在这里选择它的模型和模式。",
|
||||
"Agent's default ({fallback})": "agent 默认({fallback})",
|
||||
"Agent's default": "agent 默认",
|
||||
"What you pick on the New Task page wins; these apply until then and after switching agents.": "以“新任务”页上的选择为准;在那之前,以及切换 agent 之后,使用这里的设置。",
|
||||
"⌘Enter": "⌘Enter",
|
||||
"Queues the message for after the turn": "排队,等本回合结束后发送",
|
||||
"Sends it into the turn": "立即发送到当前回合",
|
||||
"Grouped by what they did": "按操作类型合并",
|
||||
"One per line": "每次调用一行",
|
||||
"Open while it streams": "生成时展开",
|
||||
"Always open": "始终展开",
|
||||
"Folded": "折叠",
|
||||
"Sending": "发送",
|
||||
"Send messages with": "发送消息",
|
||||
"While the agent works, sending": "agent 工作时发送",
|
||||
"The other way is a modifier away: ⌘↵ with Enter, ⌘⇧↵ with ⌘↵": "另一种方式只差一个修饰键:用 Enter 发送时按 ⌘↵,用 ⌘↵ 发送时按 ⌘⇧↵",
|
||||
"Conversation": "对话",
|
||||
"Fold a finished turn's work": "折叠已完成回合的过程",
|
||||
"Reasoning and tool calls before the reply fold into one line under its message": "回复之前的思考和工具调用折叠成一行,显示在对应消息下方",
|
||||
"Tool calls": "工具调用",
|
||||
"Show tool output without opening it": "默认展开工具输出",
|
||||
"Reveal streaming text smoothly": "平滑显示生成中的文字",
|
||||
"Text appears at a steady pace instead of in bursts": "文字匀速出现,而不是一段一段地跳出"
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача