Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Build a development-engineer tool: a keyboard-first terminal coding agent (Rust)
- **Provider cache notes**: DeepSeek/GLM cache automatically on an exact prefix (hits in `prompt_cache_hit_tokens` / `prompt_tokens_details.cached_tokens`); MiniMax's Anthropic API caches only `cache_control` breakpoints (≤4); Go's TOML enables a session `prompt_cache_key` on every route, with protocol defaults enabling markers only for Messages. OpenRouter's Claude/Gemini marker rules also live in TOML. These defaults are configurable; transport builders contain no provider/model cache branches. Gateways may report several dialects at once, so the largest cache count wins
- **Categorized errors**: API errors show actionable messages with `/compact`, `/model`, `/provider` hints
- **Subagents**: `task` / `task_output` / `kill_task` hosted tools routed to `SubagentHost`. There are no predetermined subagents: the parent model creates each one for its task — `role` (shown on the card; defaults to the description), optional `instructions`, `capability_mode` (read-only by default) and a `model` — on the base prompt `crates/agente-core/agents/_role.md`; the user's own `.agente/agents/*.md` still launch by name (`subagent_type`, listed only when they exist). Models come from the user's list (`config::SubagentSettings`: entries with a name, provider/model, thinking and a `use_for` note the parent reads; one `default_model`; `orchestrator_picks`), routed by `subagent::routing::resolve_model` — the parent's pick (list name or `main`; anything else fails the call) → an agent file's `model:` → the default → the parent's model; old per-type `subagent_models` pins fold into the list on read. The list's menu (price, window, note) is appended to the `task` description byte-stably; cards show `name · model` (`ChildStarted.seat`). Edited in the TUI `/subagent-models` and Desktop's Subagents dialog (`SubagentModelsEditor.svelte`), both laid out by the Laws of UX: one radio per row for the default with the conversation's model as the last option, names folded into shape instead of refused, a row without a model kept as a draft. A read-only child waits inline, one that may change things runs in the background; children run unbounded (the wall-clock watchdog is the backstop); writing children get an isolated git worktree (two kept warm), read-only children read the parent root directly — no checkout; up to `max_parallel_subagents` (default 8, `/settings`) run at once, the rest queue FIFO; parent + child approvals route by `request_id` via `ApprovalBroker`. Roadmap (limits/recovery, durable children, swarm): `docs/SUBAGENTS_PLAN.md`
- **Swarm mode** (`crates/agente-core/src/swarm.rs`, `subagent/host/board.rs`): a per-session switch (`BoardStore`, `~/.agente/sessions/boards/<session>.json`, daemon `board.get|enable|clear`) that gives the main model the hosted `board` tool. It adds cards — title, role, `capability_mode` (read-only default), model, prompt, `depends_on`, `owns` — and the host starts every card whose dependencies are done as a created background subagent (the card's prompt plus its files and the results it builds on); readers land in Done, writers in Review, failures in Failed; `move` accepts, sends back with a note (a fresh subagent retries) or gives up. One writer per path: a writer's `owns` may not overlap another open writer's. `AgentEvent::BoardChanged` → `RuntimeEvent::BoardChanged` carries the whole board. TUI: `/swarm` toggles, `/board` shows the columns, the status row says `+ swarm`. Desktop: the switch sits in the composer's mode menu (the trigger reads `Auto + Swarm`), and a Board pane (`BoardPanel.svelte`, `swarm.svelte.ts`) shows Backlog / Working / Review / Done — side by side when wide, stacked in a side pane — with review cards on an amber rail; its chip appears only while swarm is on or cards remain
- **Swarm mode** (`crates/agente-core/src/swarm.rs`, `subagent/host/board.rs`): a per-session switch (`BoardStore`, `~/.agente/sessions/boards/<session>.json`, daemon `board.get|enable|clear`) that gives the main model the hosted `board` tool. It adds cards — title, role, `capability_mode` (read-only default), model, prompt, `depends_on`, `owns` — and the host starts every card whose dependencies are done as a created background subagent (the card's prompt plus its files and the results it builds on); readers land in Done, writers in Review, failures in Failed; `move` accepts, sends back with a note (a fresh subagent retries) or gives up. One writer per path: a writer's `owns` may not overlap another open writer's. Members talk through the board's findings log (`Board.findings`): each card's child gets the `swarm` tool (`post` a finding, optionally `to` some cards; `read` the cards and log) and an inbox, so a post reaches the members still working at their next step (no reply expected) and every card that starts later in its prompt; the lead sees the newest ten in every `board` result and broadcasts with `board` `post`. One view: a turn's swarm members draw as one block — Desktop `SwarmBlock.svelte` (a lane per card: status, id, title, role · model, activity hard right, waits for / feeds, then the newest findings via the shared `SwarmFindingList`) instead of the subagent tally line, the Board pane lists the whole log under its columns; TUI member cards read `c2 Title Role` with `· feeds c3` and `✎ c1 → c2 finding`, and `/board` shows the newest findings under the columns. `AgentEvent::BoardChanged` → `RuntimeEvent::BoardChanged` carries the whole board. TUI: `/swarm` toggles, `/board` shows the columns, the status row says `+ swarm`. Desktop: the switch sits in the composer's mode menu (the trigger reads `Auto + Swarm`), and a Board pane (`BoardPanel.svelte`, `swarm.svelte.ts`) shows Backlog / Working / Review / Done — side by side when wide, stacked in a side pane — cards are borderless rows lit on hover (no rails), review marked only by its amber `◆`; its chip appears only while swarm is on or cards remain
- **Loop guard**: identical tool-call signatures nudge after 3 repeats, hard-stop after 6 with a visible notice
- **Skills** (Agent Skills spec, `extensions/skills.rs`): folders with a `SKILL.md` discovered in `~/.claude|.agents|.config/agente|.agente/skills` then `<project>/.claude|.agents|.agente/skills` (later wins, so project beats user); lenient frontmatter (block scalars, nested `metadata`, colons in values), only a missing description skips a skill. Progressive disclosure: the catalog (name + description) lives in the `skill` tool's description with a `name` enum — the model picks the skill itself, and the tool is not registered when there are none; activation returns `<skill_content name="…">` with the body, skill dir and a resource listing (files are read on demand — `read_file`/`list_dir`/`grep`/`find` may open files inside skill dirs outside the project via `resolve_read_path`). `/skill-name request` injects the same block from the composer (the bubble shows what was typed); `/skills` lists them; `disable-model-invocation` keeps one manual-only. Compaction never truncates a skill block and re-attaches any it dropped (`carry_skills`)
- **Desktop typography** (`apps/desktop/renderer/src/app.css`, `lib/stores/accessibility.svelte.ts`): one type ladder (`--text-prose|base|sm|xs|code`) multiplied by `--reading-scale`, so Settings → Text size moves captions, chrome, prose, code, diffs and the terminal together; interface size is a window zoom on top of it and reaches 200% (WCAG 1.4.4 wants no less). Nothing hardcodes below `--text-xs` (12px at 100%, the smallest legible regular size); the one exception is the scaled-down page preview in `ArtifactThumb`, which is artwork. Monaco and xterm resolve the tokens through `utils/type-tokens.ts` because canvas cannot read `var()`. Fonts are OFL only and bundled: Inter Variable, IBM Plex Mono, and the Atkinson Hyperlegible pair, where the reading font also swaps `--font-mono` so code follows it. The OS preference reaches the app too: `prefers-contrast: more` raises the same tokens as the manual switch, `forced-colors: active` drops decoration. Zoom belongs to the setting, not to Chromium (`setZoomMode('manual')` plus `zoom-changed` feeding the same presets)
Expand Down
4 changes: 0 additions & 4 deletions apps/desktop/main/agente/core-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ type Rpc = Pick<AgenteClient, 'request'>;

type SearchSettings = {
provider?: string;
max_results?: number;
providers?: Record<string, { api_key?: unknown; base_url?: unknown } | undefined>;
};

export type WebSyncPayload = {
provider: string;
max_results?: number;
searxng_url?: string;
keys: Record<string, string>;
};
Expand All @@ -36,8 +34,6 @@ export function webSyncPayload(search: SearchSettings | undefined): WebSyncPaylo
const payload: WebSyncPayload = { provider: text(search?.provider) || 'auto', keys };
const searxng = text(providers.searxng?.base_url);
if (searxng) payload.searxng_url = searxng;
const max = Number(search?.max_results);
if (Number.isFinite(max) && max > 0) payload.max_results = Math.round(max);
return payload;
}

Expand Down
1 change: 0 additions & 1 deletion apps/desktop/main/config.defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export function getDefaultSearchConfig(): SearchConfig {
return {
// Auto: a keyed search API when one is set up, else the free API sources.
provider: 'auto',
max_results: 6,
aggregator_engines: [...DEFAULT_AGGREGATOR_ENGINES],
safe_search: 2,
providers: {},
Expand Down
6 changes: 4 additions & 2 deletions apps/desktop/main/config.migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ export function ensureSearchConfig(cfg: AppConfig): boolean {
}
}

if (!search.max_results) {
search.max_results = 6;
// The result-count setting is gone: each search mode and agent tool
// asks for its own count. Drop a value saved by an older version.
if ('max_results' in search) {
delete search.max_results;
dirty = true;
}

Expand Down
1 change: 0 additions & 1 deletion apps/desktop/main/config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export interface RAGConfig {

export interface SearchConfig {
provider: string;
max_results: number;
context_budget_chars?: number;
aggregator_engines?: string[];
safe_search?: number;
Expand Down
9 changes: 7 additions & 2 deletions apps/desktop/main/search-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ export async function webSearch({ query, context, deep, mode, options }: { query
const requestedProvider = normalizeProviderName(options?.provider || 'auto');
// A saved choice of a removed provider (a scraper or reseller) searches with auto.
const explicitProvider = REMOVED_SEARCH_PROVIDERS.includes(requestedProvider) ? 'auto' : requestedProvider;
const maxResults = Math.max(1, Math.min(Number(options?.max_results) || 6, 20));
// The caller (the model, through its tool) says how many results it wants;
// with no count the depth decides. There is no user setting for this.
const requestedResults = Math.round(Number(options?.max_results));
const maxResults = Number.isFinite(requestedResults) && requestedResults >= 1
? Math.min(requestedResults, 50)
: searchMode === 'max' ? 18 : searchMode === 'deep' ? 12 : 8;
const searchOptions = { ...(options || {}), conversation_context: conversationContext, search_query: effectiveQuery || normalizedQuery };

const emit = (step: string, detail: string) => {
Expand Down Expand Up @@ -403,7 +408,7 @@ export async function webSearch({ query, context, deep, mode, options }: { query
}

const responseLimit = searchMode === 'max'
? Math.min(40, Math.max(maxResults * 2, 18))
? Math.max(maxResults, Math.min(40, Math.max(maxResults * 2, 18)))
: searchMode === 'deep'
? Math.max(maxResults, 12)
: maxResults;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function renderSearch(provider = 'aggregator') {
return render(SearchSettings, {
props: {
searchProvider: provider,
searchMaxResults: '6',
searchApiKey: '',
searchBaseUrl: '',
searchModel: 'sonar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@

let {
searchProvider = $bindable(),
searchMaxResults = $bindable(),
searchApiKey = $bindable(),
searchBaseUrl = $bindable(),
searchModel = $bindable(),
Expand All @@ -78,7 +77,6 @@
savingConfiguration = false,
}: {
searchProvider: string;
searchMaxResults: string;
searchApiKey: string;
searchBaseUrl: string;
searchModel: string;
Expand Down Expand Up @@ -218,21 +216,6 @@
/>
</SettingsRow>

<SettingsRow
label={$t('searchSettings.targetResults')}
description={$t('searchSettings.targetResultsHint')}
htmlFor="search-result-target"
>
<Input
id="search-result-target"
type="number"
min="1"
max="20"
inputmode="numeric"
bind:value={searchMaxResults}
/>
</SettingsRow>

<SettingsRow
label={$t('searchSettings.safeSearch')}
description={$t('searchSettings.safeSearchHint')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

let searchProvider = $state(appStore.config.search?.provider || 'aggregator');
let persistedSearchProvider = $state(appStore.config.search?.provider || 'aggregator');
let searchMaxResults = $state(String(appStore.config.search?.max_results ?? 6));
let searchApiKey = $state('');
// One field edits the base URL of whichever provider takes one; each keeps
// its own saved value and default (the connectors' defaults).
Expand Down Expand Up @@ -65,7 +64,6 @@

type SearchPreferences = {
provider: string;
max_results: number;
aggregator_engines: string[];
safe_search: number;
};
Expand Down Expand Up @@ -100,7 +98,6 @@
})));
let previousSearchSignature = JSON.stringify(untrack(() => ({
searchProvider,
searchMaxResults,
aggregatorEngines,
searchSafeSearch,
})));
Expand Down Expand Up @@ -131,16 +128,10 @@
return searchApiKey.trim().length > 0;
}

function normalizedMaxResults(): number {
const parsed = Number(searchMaxResults);
return Number.isFinite(parsed) ? Math.max(1, Math.min(Math.round(parsed), 20)) : 6;
}

function currentSearchPreferences(): SearchPreferences {
const canActivateProvider = providerHasConfiguration(searchProvider);
return {
provider: canActivateProvider ? searchProvider : persistedSearchProvider,
max_results: normalizedMaxResults(),
aggregator_engines: [...aggregatorEngines],
safe_search: Number(searchSafeSearch),
};
Expand Down Expand Up @@ -174,7 +165,7 @@
});

$effect(() => {
const signature = JSON.stringify({ searchProvider, searchMaxResults, aggregatorEngines, searchSafeSearch });
const signature = JSON.stringify({ searchProvider, aggregatorEngines, searchSafeSearch });
if (!mounted || signature === previousSearchSignature) return;
previousSearchSignature = signature;

Expand Down Expand Up @@ -212,7 +203,6 @@
await searchAutosave.cancel();
await appStore.updateSearchSettings({
provider: searchProvider,
max_results: normalizedMaxResults(),
aggregator_engines: aggregatorEngines,
safe_search: Number(searchSafeSearch),
providers: {
Expand Down Expand Up @@ -265,7 +255,6 @@
{:else}
<SearchSettings
bind:searchProvider
bind:searchMaxResults
bind:searchApiKey
bind:searchBaseUrl
bind:searchModel
Expand Down
23 changes: 17 additions & 6 deletions apps/desktop/renderer/src/lib/features/code/BoardPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
- Jakob: a kanban — Backlog, Working, Review, Done — columns side by side
when the pane is wide, stacked sections when it is a side pane.
- Von Restorff: Review is the one thing that needs the user, so review
cards carry the amber rail and the tally names them; done cards dim.
cards carry the amber `◆` and the tally names them; done cards dim. No
rails or card borders: a card is a row on the canvas, lit on hover.
- Chunking + proximity: a card is its title, then `role · model`, then
what it waits for / owns, then its result — one block per card.
- Findings: under the columns, what the members told each other — the
same list the transcript's swarm block shows the newest of.
- Hick + Occam: the board is read-only; the agent moves cards. The only
controls are the swarm switch and "Clear board".
- Fitts: the whole card opens its subagent.
Expand All @@ -23,13 +26,15 @@
import type { SwarmCard } from '$shared/agente-protocol';
import { subagentFocus } from './subagent-focus.svelte';
import { columnsOf, swarmStore, tallyOf } from './swarm.svelte';
import SwarmFindingList from './SwarmFindingList.svelte';

let { chatId }: { chatId: string } = $props();

const board = $derived(swarmStore.boardFor(chatId));
const enabled = $derived(!!board?.enabled);
const columns = $derived(columnsOf(board));
const tally = $derived(tallyOf(board));
const findings = $derived(board?.findings ?? []);
let switching = $state(false);
/** The switch follows the store; a failed change puts it back. */
let checked = $state(false);
Expand Down Expand Up @@ -122,6 +127,13 @@
{/each}
</div>

{#if findings.length}
<section class="findings" aria-labelledby={`board-${chatId}-findings`}>
<h3 id={`board-${chatId}-findings`}>{$t('code.swarm.lane.findings')}<span class="count">{findings.length}</span></h3>
<SwarmFindingList {findings} />
</section>
{/if}

{#if !tally.working}
<div class="foot"><Button size="sm" variant="ghost" onclick={() => void swarmStore.clear(chatId).catch((error) => toastStore.error(String(error)))}>{$t('code.swarm.clear')}</Button></div>
{/if}
Expand All @@ -142,16 +154,15 @@
/* Side pane: sections stacked. Wide pane: the kanban side by side. */
.columns { display: grid; gap: 1rem; }
@container (min-width: 44rem) { .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; } }
.column { display: grid; gap: 0.5rem; min-width: 0; }
.column h3 { display: flex; align-items: baseline; gap: 0.375rem; font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); }
.column { display: grid; gap: 0.125rem; min-width: 0; }
.findings { display: grid; gap: 0.5rem; min-width: 0; }
.column h3, .findings h3 { display: flex; align-items: baseline; gap: 0.375rem; font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); }
.count { color: var(--text-muted, var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.column-empty { font-size: var(--text-xs); color: var(--muted-foreground); padding-left: 0.25rem; }

:global(.card.ui-local-0875e6c3){ display: grid; gap: 0.25rem; width: 100%; min-width: 0; border: 1px solid var(--border-subtle); border-radius: 0.625rem; background: var(--card, transparent); padding: 0.625rem 0.75rem; text-align: left; transition: background var(--motion-instant) var(--motion-ease); }
:global(.card.ui-local-0875e6c3){ display: grid; gap: 0.25rem; min-width: 0; border: 0; border-radius: 0.5rem; background: transparent; margin-inline: -0.5rem; width: calc(100% + 1rem); padding: 0.5rem; text-align: left; transition: background var(--motion-instant) var(--motion-ease); }
:global(.card.ui-local-0875e6c3:not(:disabled)){ cursor: pointer; }
:global(.card.ui-local-0875e6c3:not(:disabled):hover), :global(.card.ui-local-0875e6c3:focus-visible){ background: var(--surface-hover); }
:global(.card.ui-local-0875e6c3.status-review){ box-shadow: inset 3px 0 0 var(--warning); }
:global(.card.ui-local-0875e6c3.status-failed){ box-shadow: inset 3px 0 0 var(--error); }
:global(.card.ui-local-0875e6c3.status-done){ opacity: 0.72; }
.card-head { display: flex; min-width: 0; align-items: baseline; gap: 0.5rem; }
.mark { width: 1rem; flex-shrink: 0; text-align: center; font-size: var(--text-xs); color: var(--muted-foreground); }
Expand Down
Loading
Loading