Skip to content

Commit 733d4b0

Browse files
committed
Update agent configuration management and enhance Dockerfile
- Added `toml_edit` dependency for improved TOML file handling. - Introduced new agent configuration types and API endpoints for fetching and updating agent settings. - Enhanced the Dockerfile to include necessary build dependencies for the Rust backend. - Updated the `AgentConfig` component to manage new configuration sections, improving user interaction with agent settings. - Implemented loading and updating of agent configurations in the API, ensuring seamless integration with the frontend.
1 parent 1b42e12 commit 733d4b0

File tree

8 files changed

+1250
-71
lines changed

8 files changed

+1250
-71
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ tracing-appender = "0.2"
4242
dirs = "6.0"
4343
config = "0.15"
4444
toml = "0.8"
45+
toml_edit = "0.22"
4546
arc-swap = "1"
4647
notify = "7"
4748

Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22
# Compiles the React frontend and the Rust binary with the frontend embedded.
33
FROM rust:bookworm AS builder
44

5-
# Install bun for frontend build
5+
# Install build dependencies:
6+
# protobuf-compiler — LanceDB protobuf codegen
7+
# cmake — onig_sys (regex), lz4-sys
8+
# libssl-dev — openssl-sys (reqwest TLS)
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
protobuf-compiler \
11+
libprotobuf-dev \
12+
cmake \
13+
libssl-dev \
14+
pkg-config \
15+
&& rm -rf /var/lib/apt/lists/*
616
RUN curl -fsSL https://bun.sh/install | bash
717
ENV PATH="/root/.bun/bin:${PATH}"
818

919
WORKDIR /build
1020

1121
# 1. Fetch and cache Rust dependencies.
12-
# The actual compilation requires full source, but fetching crates is the slow part.
22+
# cargo fetch needs a valid target, so we create stubs that get replaced later.
1323
COPY Cargo.toml Cargo.lock ./
14-
RUN cargo fetch
24+
RUN mkdir src && echo "fn main() {}" > src/main.rs && touch src/lib.rs && cargo fetch && rm -rf src
1525

1626
# 2. Build the frontend.
1727
COPY interface/ interface/

interface/src/api/client.ts

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,134 @@ export interface IdentityUpdateRequest {
335335
user?: string | null;
336336
}
337337

338+
// -- Agent Config Types --
339+
340+
export interface RoutingSection {
341+
channel: string;
342+
branch: string;
343+
worker: string;
344+
compactor: string;
345+
cortex: string;
346+
rate_limit_cooldown_secs: number;
347+
}
348+
349+
export interface TuningSection {
350+
max_concurrent_branches: number;
351+
max_turns: number;
352+
branch_max_turns: number;
353+
context_window: number;
354+
history_backfill_count: number;
355+
}
356+
357+
export interface CompactionSection {
358+
background_threshold: number;
359+
aggressive_threshold: number;
360+
emergency_threshold: number;
361+
}
362+
363+
export interface CortexSection {
364+
tick_interval_secs: number;
365+
worker_timeout_secs: number;
366+
branch_timeout_secs: number;
367+
circuit_breaker_threshold: number;
368+
bulletin_interval_secs: number;
369+
bulletin_max_words: number;
370+
bulletin_max_turns: number;
371+
}
372+
373+
export interface CoalesceSection {
374+
enabled: boolean;
375+
debounce_ms: number;
376+
max_wait_ms: number;
377+
min_messages: number;
378+
multi_user_only: boolean;
379+
}
380+
381+
export interface MemoryPersistenceSection {
382+
enabled: boolean;
383+
message_interval: number;
384+
}
385+
386+
export interface BrowserSection {
387+
enabled: boolean;
388+
headless: boolean;
389+
evaluate_enabled: boolean;
390+
}
391+
392+
export interface AgentConfigResponse {
393+
routing: RoutingSection;
394+
tuning: TuningSection;
395+
compaction: CompactionSection;
396+
cortex: CortexSection;
397+
coalesce: CoalesceSection;
398+
memory_persistence: MemoryPersistenceSection;
399+
browser: BrowserSection;
400+
}
401+
402+
// Partial update types - all fields are optional
403+
export interface RoutingUpdate {
404+
channel?: string;
405+
branch?: string;
406+
worker?: string;
407+
compactor?: string;
408+
cortex?: string;
409+
rate_limit_cooldown_secs?: number;
410+
}
411+
412+
export interface TuningUpdate {
413+
max_concurrent_branches?: number;
414+
max_turns?: number;
415+
branch_max_turns?: number;
416+
context_window?: number;
417+
history_backfill_count?: number;
418+
}
419+
420+
export interface CompactionUpdate {
421+
background_threshold?: number;
422+
aggressive_threshold?: number;
423+
emergency_threshold?: number;
424+
}
425+
426+
export interface CortexUpdate {
427+
tick_interval_secs?: number;
428+
worker_timeout_secs?: number;
429+
branch_timeout_secs?: number;
430+
circuit_breaker_threshold?: number;
431+
bulletin_interval_secs?: number;
432+
bulletin_max_words?: number;
433+
bulletin_max_turns?: number;
434+
}
435+
436+
export interface CoalesceUpdate {
437+
enabled?: boolean;
438+
debounce_ms?: number;
439+
max_wait_ms?: number;
440+
min_messages?: number;
441+
multi_user_only?: boolean;
442+
}
443+
444+
export interface MemoryPersistenceUpdate {
445+
enabled?: boolean;
446+
message_interval?: number;
447+
}
448+
449+
export interface BrowserUpdate {
450+
enabled?: boolean;
451+
headless?: boolean;
452+
evaluate_enabled?: boolean;
453+
}
454+
455+
export interface AgentConfigUpdateRequest {
456+
agent_id: string;
457+
routing?: RoutingUpdate;
458+
tuning?: TuningUpdate;
459+
compaction?: CompactionUpdate;
460+
cortex?: CortexUpdate;
461+
coalesce?: CoalesceUpdate;
462+
memory_persistence?: MemoryPersistenceUpdate;
463+
browser?: BrowserUpdate;
464+
}
465+
338466
export const api = {
339467
status: () => fetchJson<StatusResponse>("/status"),
340468
agents: () => fetchJson<AgentsResponse>("/agents"),
@@ -394,5 +522,18 @@ export const api = {
394522
}
395523
return response.json() as Promise<IdentityFiles>;
396524
},
525+
agentConfig: (agentId: string) =>
526+
fetchJson<AgentConfigResponse>(`/agents/config?agent_id=${encodeURIComponent(agentId)}`),
527+
updateAgentConfig: async (request: AgentConfigUpdateRequest) => {
528+
const response = await fetch(`${API_BASE}/agents/config`, {
529+
method: "PUT",
530+
headers: { "Content-Type": "application/json" },
531+
body: JSON.stringify(request),
532+
});
533+
if (!response.ok) {
534+
throw new Error(`API error: ${response.status}`);
535+
}
536+
return response.json() as Promise<AgentConfigResponse>;
537+
},
397538
eventsUrl: `${API_BASE}/events`,
398539
};

0 commit comments

Comments
 (0)