Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Merge remote-tracking branch 'origin/main' into feat/lowercase-agent-name

Abel Dantas0f01ddcb3047
diff --cc console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/configure-agent-panel.tsx
index 83880e0fe,c66ff32ed..44bccba38
--- a/console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/configure-agent-panel.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/locations/components/add-agent-modal/configure-agent-panel.tsx
@@@ -255,18 -258,41 +258,43 @@@ export function AgentIdentityFields({ f
<FieldLabel htmlFor={nameId}>Name</FieldLabel>
<Input
id={nameId}
+ ref={nameRef}
placeholder="Name this agent"
value={form.agentName}
- onChange={(e) => form.setAgentName(e.target.value)}
+ onChange={(e) =>
+ form.setAgentName(e.target.value.replace(/[A-Z]/g, (c) => c.toLowerCase()))
+ }
- aria-invalid={form.agentName.length > 0 && !form.nameIsValid}
+ aria-invalid={form.nameIsRejected}
/>
- {form.agentName.length > 0 && !form.nameIsValid ? (
- <span className="text-destructive text-xs">
- Use lowercase letters, digits, <span className="font-mono">. - _</span>, starting with a
- letter or digit. No spaces or uppercase.
- </span>
+ {form.nameIsRejected ? (
+ <Alert
+ variant="destructive"
+ className="border-border-destructive bg-background-destructive"
+ >
+ <TriangleAlert />
+ <AlertDescription className="text-foreground-destructive">
+ Use lowercase letters, digits, <span className="font-mono">. - _</span>, starting with
+ a letter or digit. No spaces or uppercase.
+ </AlertDescription>
+ {form.suggestedName && (
+ <AlertAction>
+ <Button
+ variant="outline"
+ size="xs"
+ className="max-w-full"
+ // Accepting the offer makes the name valid, which unmounts this
+ // button; without moving focus first it falls to the body and
+ // the tab order restarts.
+ onClick={() => {
+ form.setAgentName(form.suggestedName);
+ nameRef.current?.focus();
+ }}
+ >
+ Use <span className="truncate font-mono">{form.suggestedName}</span>
+ </Button>
+ </AlertAction>
+ )}
+ </Alert>
) : form.agentName.length > 0 ? (
// Once there is a name, show the handle it produces rather than
// repeating the advice: the advice is about choosing a name, and it