feat: harden support, localize knowledge and add operator availability [skip ci]

Source-only publication of reviewed commit 64e96a7f423673dc29ad56485be9fc79bce8af1c.

Passed in isolation: focused frontend/backend tests, race checks, TypeScript typecheck, lint, Go compilation, Flowgram build, and deterministic SDK build/tests.

Not accepted as a production release: Next.js export/native assembly remains blocked by environment memory limits; browser interaction and MySQL staging acceptance remain unverified. No production server, database/schema, runtime configuration, deployment, release tag, or workflow execution was performed.

Expected source tree: 0a4a7528e9.
This commit is contained in:
2026-10-16 15:21:42 +00:00
parent 299ea50fb5
commit 2f7a491666
176 changed files with 11869 additions and 2716 deletions

View File

@@ -1,3 +1,4 @@
// Modified in this independent fork for support availability; see docs/hardening/README.md.
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -46,6 +47,7 @@ import {
type CreateAdminAgentTeamPayload,
} from "@/lib/api/admin";
import { useI18n } from "@/i18n/provider";
import { availabilityStatusOptions } from "@/lib/support-availability-i18n";
import { ServiceStatus } from "@/lib/generated/enums";
type TFunction = (key: string, values?: Record<string, string | number>) => string;
@@ -65,7 +67,7 @@ const emptyForm: EditForm = {
agentCode: "",
displayName: "",
avatar: "",
serviceStatus: String(ServiceStatus.Idle) as "0" | "1",
serviceStatus: String(ServiceStatus.Idle) as "0" | "1" | "2" | "3" | "4",
maxConcurrentCount: "0",
priorityLevel: "0",
autoAssignEnabled: true,
@@ -79,7 +81,7 @@ type EditForm = {
agentCode: string;
displayName: string;
avatar: string;
serviceStatus: "0" | "1";
serviceStatus: "0" | "1" | "2" | "3" | "4";
maxConcurrentCount: string;
priorityLevel: string;
autoAssignEnabled: boolean;
@@ -94,7 +96,7 @@ function createEditFormSchema(t: TFunction) {
agentCode: z.string().trim().min(1, t("agentProfile.agentCodeRequired")),
displayName: z.string().trim().min(1, t("agentProfile.displayNameRequired")),
avatar: z.string().trim(),
serviceStatus: z.enum(["0", "1"], {
serviceStatus: z.enum(["0", "1", "2", "3", "4"], {
message: t("agentProfile.statusRequired"),
}),
maxConcurrentCount: z
@@ -112,10 +114,7 @@ function createEditFormSchema(t: TFunction) {
}
function getServiceStatusOptions(t: TFunction) {
return [
{ value: String(ServiceStatus.Idle), label: t("agentProfile.statusIdle") },
{ value: String(ServiceStatus.Busy), label: t("agentProfile.statusBusy") },
];
return availabilityStatusOptions(t, false);
}
function buildForm(item: AdminAgentProfile | null): EditForm {
@@ -529,7 +528,7 @@ function AgentEditDialogBody({
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<Field data-invalid={!!errors.serviceStatus}>
{!itemId ? <Field data-invalid={!!errors.serviceStatus}>
<FieldLabel>{t("agentProfile.serviceStatus")}</FieldLabel>
<FieldContent>
<Controller
@@ -548,7 +547,7 @@ function AgentEditDialogBody({
/>
<FieldError errors={[errors.serviceStatus]} />
</FieldContent>
</Field>
</Field> : <p className="text-sm text-muted-foreground">{t("supportAvailability.statusSeparate")}</p>}
<Field className="min-h-32">
<FieldLabel>{t("agentProfile.avatar")}</FieldLabel>
@@ -625,10 +624,12 @@ function AgentEditDialogBody({
render={({ field }) => (
<Switch
checked={field.value}
disabled
onCheckedChange={field.onChange}
/>
)}
/>
<p className="text-xs text-muted-foreground">{t("supportAvailability.offlineDeprecated")}</p>
</FieldContent>
</Field>
</div>