refactor(agent-form): split EditFormBody into 5 semantic sections + add Cancel/dirty-state + always-visible Thinking Effort + binary OrgChart hierarchy

Previously the agent Edit modal was a 351-LOC wall of 17 stacked form
fields with no visual grouping, mixed header styles between the
skills heading and the field labels, a Save button that was always
enabled, no Cancel affordance, and a Thinking Effort field that
silently disappeared when the selected connector did not support it.

This commit restructures the edit surface into five named sections
— Identity, Runtime, Budget & scope, Behavior, Skills — each with a
consistent SectionHeader (11px uppercase muted, border-top divider).
Every section lives in its own ≤150-LOC file under
agent-form-fields/edit-sections/ so nothing stays god-sized:

  EditFormBody.tsx          199 LOC (orchestrator: isDirty, handlers)
  IdentitySection.tsx        74 LOC
  RuntimeSection.tsx        114 LOC
  ConstraintsSection.tsx     58 LOC
  SkillsSection.tsx          36 LOC
  EditActionBar.tsx          87 LOC
  SectionHeader.tsx          18 LOC

Behavioral changes:

- Save is disabled until the form is dirty (trimmed-string + numeric
  budget comparison against the persisted agent record). The board
  sees whether changes are captured without clicking Save to find out.
- Cancel button added, wired through AgentForm → AgentEditor →
  OrganizationSections, which clears selectedAgentId (same as the
  modal's close X — a proper bottom action avoids users reaching for
  the corner).
- Thinking Effort is always shown. When the connector provider does
  not accept the hint the Select is disabled with an inline note,
  so the option is discoverable instead of silently hidden.
- Budget shows a live BudgetBar + "Spent $X of $Y" line when the
  budget or spend is non-zero. The raw number input on its own left
  burn state invisible.
- Capabilities placeholder replaced with a concrete example
  ("writes React components, reviews PRs, ...") — the previous
  "What this agent does" was a circular prompt.
- OrgChart role bar went from three tiers (CEO 4px primary /
  manager 3px warning / IC 2px muted 30%) to binary (root 4px
  primary / everyone else 2px border). Orange-warning for managers
  read as an alert, not a rank; managerial position is already
  encoded in the tree's topology.

Also added i18n keys (zh + en):
  agent.form.sectionIdentity / sectionRuntime / sectionConstraints /
  sectionBehavior / effortNotSupported / budgetBurn; updated
  capabilitiesPlaceholder copy.

Covers J2 / J7 / J8 / S5 / S6 / S7 / S8.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-17 19:50:53 -04:00
1 parent 62d0964af3
commit 9981ee342b
13 files changed
+510 -261

No files matched your search

+7 -1
View File
@@ -1369,12 +1369,18 @@ export const en: Record<string, string> = {
"agent.form.titleHint": "Job title shown under the name",
"agent.form.budgetPlaceholder": "120",
"agent.form.budgetHint": "Spending cap per month; agent pauses when exceeded",
"agent.form.capabilitiesPlaceholder": "What this agent does",
"agent.form.capabilitiesPlaceholder": "e.g. writes React components, reviews PRs, triages bugs, drafts support replies",
"agent.form.capabilitiesHint": "Skills and domain knowledge injected into the agent's system prompt",
"agent.form.effortDefault": "Default",
"agent.form.effortLow": "Low",
"agent.form.effortMedium": "Medium",
"agent.form.effortHigh": "High",
"agent.form.effortNotSupported": "The selected connector's models do not accept a thinking-effort hint.",
"agent.form.budgetBurn": "Spent {spent} of {budget}",
"agent.form.sectionIdentity": "Identity",
"agent.form.sectionRuntime": "Runtime",
"agent.form.sectionConstraints": "Budget & scope",
"agent.form.sectionBehavior": "Behavior",
"agent.form.statusIdle": "Idle",
"agent.form.statusActive": "Active",
"agent.form.statusRunning": "Running",
+7 -1
View File
@@ -1369,12 +1369,18 @@ export const zh: Record<string, string> = {
"agent.form.titleHint": "显示在名称下方的职位",
"agent.form.budgetPlaceholder": "120",
"agent.form.budgetHint": "每月支出上限,超支后智能体自动暂停",
"agent.form.capabilitiesPlaceholder": "这位智能体擅长什么",
"agent.form.capabilitiesPlaceholder": "例如:撰写 React 组件、评审 PR、分类 bug、写客服工单回复",
"agent.form.capabilitiesHint": "注入智能体系统提示词的技能和领域知识",
"agent.form.effortDefault": "默认",
"agent.form.effortLow": "低",
"agent.form.effortMedium": "中",
"agent.form.effortHigh": "高",
"agent.form.effortNotSupported": "当前连接器的模型不接受思考力度设置。",
"agent.form.budgetBurn": "已用 {spent} / 共 {budget}",
"agent.form.sectionIdentity": "身份",
"agent.form.sectionRuntime": "运行时",
"agent.form.sectionConstraints": "预算与范围",
"agent.form.sectionBehavior": "行为",
"agent.form.statusIdle": "空闲",
"agent.form.statusActive": "活跃",
"agent.form.statusRunning": "运行中",