From a7fff3a122c80632dbeeda446288e2275efd8fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 7 Jun 2026 17:39:47 -0400 Subject: [PATCH] Extend agent editor with department and budget fields UpdateAgentInput now includes department and budgetCents. The edit dialog on the Team page shows department and monthly budget alongside the existing role, title, seniority, provider, and model fields. --- AgentCompany-New/src/main/services/organization-service.ts | 6 ++++-- AgentCompany-New/src/renderer/src/pages/TeamPage.tsx | 4 ++++ .../src/renderer/src/pages/settings/WorkspacePanel.tsx | 7 +++++-- AgentCompany-New/src/shared/commands.ts | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/AgentCompany-New/src/main/services/organization-service.ts b/AgentCompany-New/src/main/services/organization-service.ts index 0833e7a7..912c1748 100644 --- a/AgentCompany-New/src/main/services/organization-service.ts +++ b/AgentCompany-New/src/main/services/organization-service.ts @@ -226,11 +226,13 @@ export class OrganizationService { .get(input.modelProviderId, input.orgId) as { id: string } | undefined; if (!provider) throw new Error("Agent provider was not found."); } + const department = input.department.trim(); + const budgetCents = Math.max(0, Math.round(input.budgetCents)); const result = this.db.prepare(` update agents - set role = ?, title = ?, role_level = ?, model_provider_id = ?, model_id = ? + set role = ?, title = ?, role_level = ?, department = ?, budget_cents = ?, model_provider_id = ?, model_id = ? where id = ? and org_id = ? - `).run(role, input.title.trim() || role, input.roleLevel.trim() || "staff", input.modelProviderId, input.modelId, input.agentId, input.orgId); + `).run(role, input.title.trim() || role, input.roleLevel.trim() || "staff", department || "General", budgetCents, input.modelProviderId, input.modelId, input.agentId, input.orgId); if (result.changes === 0) throw new Error("Agent update failed."); this.audit.record({ orgId: input.orgId, diff --git a/AgentCompany-New/src/renderer/src/pages/TeamPage.tsx b/AgentCompany-New/src/renderer/src/pages/TeamPage.tsx index 749e847a..583d8eb6 100644 --- a/AgentCompany-New/src/renderer/src/pages/TeamPage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/TeamPage.tsx @@ -83,6 +83,8 @@ export function TeamPage({ snapshot, actions }: PageProps) { role: text(form, "role"), title: text(form, "title") || text(form, "role"), roleLevel: text(form, "roleLevel") || "staff", + department: text(form, "department") || editingAgent.department, + budgetCents: Math.max(0, Math.round(Number(text(form, "budget")) * 100)), modelProviderId: optional(form, "modelProviderId"), modelId: optional(form, "modelId"), })).then((result) => { if (result) setEditAgentId(null); }); @@ -163,6 +165,8 @@ export function TeamPage({ snapshot, actions }: PageProps) { setEditAgentId(null)} onSubmit={submitEdit}> + + - diff --git a/AgentCompany-New/src/shared/commands.ts b/AgentCompany-New/src/shared/commands.ts index aca3b673..3c1ba8d2 100644 --- a/AgentCompany-New/src/shared/commands.ts +++ b/AgentCompany-New/src/shared/commands.ts @@ -42,6 +42,8 @@ export interface UpdateAgentInput { role: string; title: string; roleLevel: string; + department: string; + budgetCents: number; modelProviderId: string | null; modelId: string | null; }