This commit is contained in:
ZacharyZhang-NY committed 2026-04-05 20:14:48 -04:00
1 parent 09971cabc2
commit 9145572422
163 files changed
+3348 -2874

No files matched your search

@@ -1,4 +1,5 @@
import { useState } from "react";
import { NEW_ENTITY_ID } from "../../lib/constants";
import type {
AgentRecord,
ApprovalRecord,
@@ -123,6 +124,8 @@ export function ExecutionSections({
const [costsTab, setCostsTab] = useState<"costs" | "policies" | "incidents">("costs");
const selectedGoal = companyGoals.find((g) => g.id === selectedGoalId) ?? null;
if (!currentCompany) return null;
return (
<>
{section === "runs" ? (
@@ -179,11 +182,11 @@ export function ExecutionSections({
{section === "tasks" ? (
<>
<Panel title="Goals" action={<ActionButton label="New goal" icon={Target} tone="accent" onClick={() => setSelectedGoalId("__new__")} />}>
<Panel title="Goals" action={<ActionButton label="New goal" icon={Target} tone="accent" onClick={() => setSelectedGoalId(NEW_ENTITY_ID)} />}>
<GoalList goals={companyGoals} agents={companyAgents} selectedGoalId={selectedGoalId} onSelect={setSelectedGoalId} />
</Panel>
<Modal open={selectedGoalId === "__new__" && section === "tasks"} title="New goal" onClose={() => setSelectedGoalId(null)}>
<GoalCreator companyId={currentCompany!.id} agents={companyAgents} goals={companyGoals} onSaved={async () => { setSelectedGoalId(null); await refresh(); }} />
<Modal open={selectedGoalId === NEW_ENTITY_ID && section === "tasks"} title="New goal" onClose={() => setSelectedGoalId(null)}>
<GoalCreator companyId={currentCompany.id} agents={companyAgents} goals={companyGoals} onSaved={async () => { setSelectedGoalId(null); await refresh(); }} />
</Modal>
<Modal open={!!selectedGoal && section === "tasks"} title={selectedGoal ? `Edit: ${selectedGoal.title}` : ""} onClose={() => setSelectedGoalId(null)}>
{selectedGoal ? (
@@ -192,7 +195,7 @@ export function ExecutionSections({
goal={selectedGoal}
goals={companyGoals}
agents={companyAgents}
companyId={currentCompany!.id}
companyId={currentCompany.id}
onSaved={async () => { setSelectedGoalId(null); await refresh(); }}
onDeleted={async () => { setSelectedGoalId(null); await refresh(); }}
/>
@@ -219,7 +222,7 @@ export function ExecutionSections({
<Kanban size={14} />
</button>
</div>
<ActionButton label="New task" icon={ListChecks} tone="accent" onClick={() => setSelectedTaskId("__new__")} />
<ActionButton label="New task" icon={ListChecks} tone="accent" onClick={() => setSelectedTaskId(NEW_ENTITY_ID)} />
</div>
}
>
@@ -229,8 +232,8 @@ export function ExecutionSections({
<TaskQueue tasks={tasks} runs={runs} onSelect={setSelectedTaskId} selectedTaskId={selectedTask?.id ?? null} />
)}
</Panel>
<Modal open={selectedTaskId === "__new__"} title="New task" onClose={() => setSelectedTaskId(null)}>
<TaskCreator companyId={currentCompany!.id} goals={companyGoals} projects={companyProjects} agents={companyAgents} workspaces={companyWorkspaces} onSaved={async () => { setSelectedTaskId(null); await refresh(); }} />
<Modal open={selectedTaskId === NEW_ENTITY_ID} title="New task" onClose={() => setSelectedTaskId(null)}>
<TaskCreator companyId={currentCompany.id} goals={companyGoals} projects={companyProjects} agents={companyAgents} workspaces={companyWorkspaces} onSaved={async () => { setSelectedTaskId(null); await refresh(); }} />
</Modal>
<Modal open={!!selectedTask} title={selectedTask?.title ?? ""} onClose={() => setSelectedTaskId(null)} width="720px">
{selectedTask ? (
@@ -242,7 +245,7 @@ export function ExecutionSections({
goals={companyGoals}
projects={companyProjects}
workspaces={companyWorkspaces}
companyId={currentCompany!.id}
companyId={currentCompany.id}
comments={(snapshot.comments ?? []).filter((comment) => comment.taskId === selectedTask.id)}
onRefresh={refresh}
onRun={startRun}
@@ -250,7 +253,7 @@ export function ExecutionSections({
onCreateApproval={async () => {
const isBlocked = selectedTask.status === "blocked";
const approvalId = unwrap(await window.agentCompany.requestApproval({
companyId: currentCompany!.id,
companyId: currentCompany.id,
relatedTaskId: selectedTask.id,
requestedByAgentId: selectedTask.assigneeAgentId,
type: isBlocked ? "secret_access" : "approve_ceo_strategy",
@@ -291,9 +294,9 @@ export function ExecutionSections({
agents={companyAgents}
tasks={tasks}
documents={companyDocuments}
companyId={currentCompany!.id}
companyId={currentCompany.id}
onDecide={async (state, note) => {
unwrap(await window.agentCompany.decideApproval({ companyId: currentCompany!.id, approvalId: selectedApproval.id, state, decisionNote: note ?? `${state} from desktop control surface.` }));
unwrap(await window.agentCompany.decideApproval({ companyId: currentCompany.id, approvalId: selectedApproval.id, state, decisionNote: note ?? `${state} from desktop control surface.` }));
await refresh();
}}
onDeleted={async () => { setSelectedApprovalId(null); await refresh(); }}
@@ -338,13 +341,13 @@ export function ExecutionSections({
/>
) : costsTab === "policies" ? (
<PolicyList
companyId={currentCompany!.id}
companyId={currentCompany.id}
agents={companyAgents.map((a) => ({ id: a.id, name: a.name }))}
projects={companyProjects.map((p) => ({ id: p.id, name: p.name }))}
/>
) : (
<IncidentList
companyId={currentCompany!.id}
companyId={currentCompany.id}
agents={companyAgents.map((a) => ({ id: a.id, name: a.name }))}
projects={companyProjects.map((p) => ({ id: p.id, name: p.name }))}
/>
@@ -284,7 +284,7 @@ export function OperationsSections({
<WorkspaceList
workspaces={companyWorkspaces}
projects={companyProjects}
companyId={currentCompany!.id}
companyId={currentCompany.id}
selectedWorkspaceId={selectedWorkspace?.id ?? null}
onSelect={setSelectedWorkspaceId}
onOpen={openPathWithFeedback}
@@ -306,7 +306,7 @@ export function OperationsSections({
/>
</Panel>
<Panel title="Add workspace">
<WorkspaceCreator companyId={currentCompany!.id} projects={companyProjects} onSaved={refresh} />
<WorkspaceCreator companyId={currentCompany.id} projects={companyProjects} onSaved={refresh} />
</Panel>
</div>
}
@@ -316,7 +316,7 @@ export function OperationsSections({
{section === "settings" && currentCompany ? (
<div className="space-y-10">
<Panel title={locale === "zh" ? "配置" : "Profile and release"}>
<SettingsPane snapshot={snapshot} secrets={companySecrets} companyId={currentCompany!.id} onSaved={refresh} />
<SettingsPane snapshot={snapshot} secrets={companySecrets} companyId={currentCompany.id} onSaved={refresh} />
</Panel>
<Panel title={locale === "zh" ? "模型管理" : "Model Management"}>
<ModelManagement connectors={snapshot.connectors} locale={locale} onSaved={refresh} />
@@ -7,6 +7,7 @@ import type {
ProfileSnapshot,
SectionId,
} from "@shared/types";
import { NEW_ENTITY_ID } from "../../lib/constants";
import {
Target,
UserPlus,
@@ -26,6 +27,7 @@ import {
} from "../../components/organization";
import { HiringPipeline } from "../../components/hiring";
import { ActionButton, Modal, Panel } from "../../components/ui";
import { useT } from "../../i18n";
interface OrganizationSectionsProps {
section: SectionId;
@@ -62,16 +64,19 @@ export function OrganizationSections({
setSection,
refresh,
}: OrganizationSectionsProps) {
const t = useT();
const selectedAgent = companyAgents.find((a) => a.id === selectedAgentId) ?? null;
const selectedGoal = companyGoals.find((g) => g.id === selectedGoalId) ?? null;
const selectedProject = companyProjects.find((p) => p.id === selectedProjectId) ?? null;
if (!currentCompany) return null;
return (
<>
{section === "agents" ? (
<>
<OrgChart agents={companyAgents} connectors={snapshot.connectors} onSelectAgent={(id) => setSelectedAgentId(id)} />
<Panel title="Agent roster" action={<ActionButton label="New hire request" icon={UserPlus} tone="accent" onClick={() => setSelectedAgentId("__new__")} />}>
<Panel title={t("org.agentRoster")} action={<ActionButton label={t("org.newHireRequest")} icon={UserPlus} tone="accent" onClick={() => setSelectedAgentId(NEW_ENTITY_ID)} />}>
<AgentRoster
agents={companyAgents}
connectors={snapshot.connectors}
@@ -80,9 +85,9 @@ export function OrganizationSections({
onSelect={setSelectedAgentId}
/>
</Panel>
<Modal open={selectedAgentId === "__new__"} title="Request new hire" onClose={() => setSelectedAgentId(null)}>
<Modal open={selectedAgentId === NEW_ENTITY_ID} title={t("org.requestNewHire")} onClose={() => setSelectedAgentId(null)}>
<AgentCreator
companyId={currentCompany!.id}
companyId={currentCompany.id}
connectors={snapshot.connectors}
workspaces={companyWorkspaces}
agents={companyAgents}
@@ -101,7 +106,7 @@ export function OrganizationSections({
connectors={snapshot.connectors}
workspaces={companyWorkspaces}
agents={companyAgents}
companyId={currentCompany!.id}
companyId={currentCompany.id}
onSaved={refresh}
onDeleted={async () => { setSelectedAgentId(null); await refresh(); }}
/>
@@ -117,7 +122,7 @@ export function OrganizationSections({
{section === "hiring" && currentCompany ? (
<HiringPipeline
agents={companyAgents}
approvals={(snapshot?.approvals ?? []).filter(a => a.companyId === currentCompany!.id)}
approvals={(snapshot?.approvals ?? []).filter(a => a.companyId === currentCompany.id)}
onRefresh={refresh}
onNavigateToAgent={(id) => { setSelectedAgentId(id); setSection("agents"); }}
/>
@@ -125,11 +130,11 @@ export function OrganizationSections({
{section === "goals" ? (
<>
<Panel title="Goal stack" action={<ActionButton label="New goal" icon={Target} tone="accent" onClick={() => setSelectedGoalId("__new__")} />}>
<Panel title={t("org.goalStack")} action={<ActionButton label={t("org.newGoal")} icon={Target} tone="accent" onClick={() => setSelectedGoalId(NEW_ENTITY_ID)} />}>
<GoalList goals={companyGoals} agents={companyAgents} selectedGoalId={selectedGoalId} onSelect={setSelectedGoalId} />
</Panel>
<Modal open={selectedGoalId === "__new__"} title="New goal" onClose={() => setSelectedGoalId(null)}>
<GoalCreator companyId={currentCompany!.id} agents={companyAgents} goals={companyGoals} onSaved={async () => { setSelectedGoalId(null); await refresh(); }} />
<Modal open={selectedGoalId === NEW_ENTITY_ID} title={t("org.newGoal")} onClose={() => setSelectedGoalId(null)}>
<GoalCreator companyId={currentCompany.id} agents={companyAgents} goals={companyGoals} onSaved={async () => { setSelectedGoalId(null); await refresh(); }} />
</Modal>
<Modal open={!!selectedGoal} title={selectedGoal ? `Edit: ${selectedGoal.title}` : ""} onClose={() => setSelectedGoalId(null)}>
{selectedGoal ? (
@@ -138,7 +143,7 @@ export function OrganizationSections({
goal={selectedGoal}
goals={companyGoals}
agents={companyAgents}
companyId={currentCompany!.id}
companyId={currentCompany.id}
onSaved={async () => { setSelectedGoalId(null); await refresh(); }}
onDeleted={async () => { setSelectedGoalId(null); await refresh(); }}
/>
@@ -149,11 +154,11 @@ export function OrganizationSections({
{section === "projects" ? (
<>
<Panel title="Projects" action={<ActionButton label="New project" icon={Kanban} tone="accent" onClick={() => setSelectedProjectId("__new__")} />}>
<Panel title={t("nav.projects")} action={<ActionButton label={t("org.newProject")} icon={Kanban} tone="accent" onClick={() => setSelectedProjectId(NEW_ENTITY_ID)} />}>
<ProjectList projects={companyProjects} goals={companyGoals} agents={companyAgents} workspaces={companyWorkspaces} selectedProjectId={selectedProjectId} onSelect={setSelectedProjectId} />
</Panel>
<Modal open={selectedProjectId === "__new__"} title="New project" onClose={() => setSelectedProjectId(null)}>
<ProjectCreator companyId={currentCompany!.id} goals={companyGoals} agents={companyAgents} onSaved={async () => { setSelectedProjectId(null); await refresh(); }} />
<Modal open={selectedProjectId === NEW_ENTITY_ID} title={t("org.newProject")} onClose={() => setSelectedProjectId(null)}>
<ProjectCreator companyId={currentCompany.id} goals={companyGoals} agents={companyAgents} onSaved={async () => { setSelectedProjectId(null); await refresh(); }} />
</Modal>
<Modal open={!!selectedProject} title={selectedProject ? `Edit: ${selectedProject.name}` : ""} onClose={() => setSelectedProjectId(null)}>
{selectedProject ? (
@@ -162,7 +167,7 @@ export function OrganizationSections({
project={selectedProject}
goals={companyGoals}
agents={companyAgents}
companyId={currentCompany!.id}
companyId={currentCompany.id}
onSaved={async () => { setSelectedProjectId(null); await refresh(); }}
onDeleted={async () => { setSelectedProjectId(null); await refresh(); }}
/>