mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
feat(desktop): per-persona and per-agent env var overrides (#594)
This commit is contained in:
@@ -214,6 +214,7 @@ export type RawManagedAgent = {
|
||||
system_prompt: string | null;
|
||||
model: string | null;
|
||||
mcp_toolsets: string | null;
|
||||
env_vars?: Record<string, string>;
|
||||
status: ManagedAgent["status"];
|
||||
pid: number | null;
|
||||
created_at: string;
|
||||
@@ -825,6 +826,7 @@ export function fromRawManagedAgent(agent: RawManagedAgent): ManagedAgent {
|
||||
systemPrompt: agent.system_prompt,
|
||||
model: agent.model,
|
||||
mcpToolsets: agent.mcp_toolsets,
|
||||
envVars: agent.env_vars ?? {},
|
||||
status: agent.status,
|
||||
pid: agent.pid,
|
||||
createdAt: agent.created_at,
|
||||
@@ -950,6 +952,7 @@ export async function createManagedAgent(input: CreateManagedAgentInput) {
|
||||
systemPrompt: input.systemPrompt,
|
||||
avatarUrl: input.avatarUrl,
|
||||
model: input.model,
|
||||
envVars: input.envVars ?? {},
|
||||
spawnAfterCreate: input.spawnAfterCreate,
|
||||
startOnAppLaunch: input.startOnAppLaunch,
|
||||
backend: input.backend,
|
||||
|
||||
@@ -57,6 +57,7 @@ type RawPersona = {
|
||||
name_pool?: string[];
|
||||
is_builtin: boolean;
|
||||
is_active?: boolean;
|
||||
env_vars?: Record<string, string>;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
};
|
||||
@@ -72,6 +73,7 @@ function fromRawPersona(persona: RawPersona): AgentPersona {
|
||||
namePool: persona.name_pool ?? [],
|
||||
isBuiltIn: persona.is_builtin,
|
||||
isActive: persona.is_active ?? true,
|
||||
envVars: persona.env_vars ?? {},
|
||||
createdAt: persona.created_at,
|
||||
updatedAt: persona.updated_at,
|
||||
};
|
||||
@@ -93,6 +95,7 @@ export async function createPersona(
|
||||
provider: input.provider,
|
||||
model: input.model,
|
||||
namePool: input.namePool ?? [],
|
||||
envVars: input.envVars ?? {},
|
||||
},
|
||||
}),
|
||||
);
|
||||
@@ -111,6 +114,10 @@ export async function updatePersona(
|
||||
provider: input.provider,
|
||||
model: input.model,
|
||||
namePool: input.namePool ?? [],
|
||||
// Send envVars only when caller explicitly provided it; omitting
|
||||
// tells the backend "don't touch the stored env vars" so editing
|
||||
// unrelated fields can't silently wipe saved credentials.
|
||||
envVars: input.envVars,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -278,6 +278,8 @@ export type ManagedAgent = {
|
||||
systemPrompt: string | null;
|
||||
model: string | null;
|
||||
mcpToolsets: string | null;
|
||||
/** Per-agent env vars. Layered on top of persona envVars. */
|
||||
envVars: Record<string, string>;
|
||||
status: "running" | "stopped" | "deployed" | "not_deployed";
|
||||
pid: number | null;
|
||||
createdAt: string;
|
||||
@@ -335,6 +337,7 @@ export type CreateManagedAgentInput = {
|
||||
avatarUrl?: string;
|
||||
model?: string;
|
||||
mcpToolsets?: string;
|
||||
envVars?: Record<string, string>;
|
||||
spawnAfterCreate?: boolean;
|
||||
startOnAppLaunch?: boolean;
|
||||
backend?: ManagedAgentBackend;
|
||||
@@ -403,6 +406,8 @@ export type UpdateManagedAgentInput = {
|
||||
model?: string | null;
|
||||
systemPrompt?: string | null;
|
||||
mcpToolsets?: string | null;
|
||||
/** Absent = don't touch. Present = replace the env_vars map entirely. */
|
||||
envVars?: Record<string, string>;
|
||||
parallelism?: number;
|
||||
turnTimeoutSeconds?: number;
|
||||
relayUrl?: string;
|
||||
@@ -432,6 +437,9 @@ export type AgentPersona = {
|
||||
isActive: boolean;
|
||||
/** Pack ID if this persona was imported from a persona pack. Pack personas are non-editable. */
|
||||
sourcePack?: string | null;
|
||||
/** Environment variables injected for agents created from this persona.
|
||||
* Layered as: desktop parent env < persona envVars < agent envVars. */
|
||||
envVars: Record<string, string>;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
@@ -443,6 +451,7 @@ export type CreatePersonaInput = {
|
||||
provider?: string;
|
||||
model?: string;
|
||||
namePool?: string[];
|
||||
envVars?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type UpdatePersonaInput = {
|
||||
@@ -453,6 +462,7 @@ export type UpdatePersonaInput = {
|
||||
provider?: string;
|
||||
model?: string;
|
||||
namePool?: string[];
|
||||
envVars?: Record<string, string>;
|
||||
};
|
||||
|
||||
// ── Team types ────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user