orbital-ds 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/AGENTS.md +1 -1
  2. package/components.manifest.json +221 -1
  3. package/dist/hooks/use-ds-messages.d.ts +82 -0
  4. package/dist/lib/a2ui-catalog.d.ts +42 -0
  5. package/dist/lib/a2ui-catalog.js +558 -0
  6. package/dist/lib/a2ui.d.ts +289 -0
  7. package/dist/lib/a2ui.js +215 -0
  8. package/dist/lib/ai-events.d.ts +15 -0
  9. package/dist/lib/ai-events.js +202 -0
  10. package/dist/lib/auth-flow.d.ts +3 -1
  11. package/dist/lib/auth-flow.js +24 -3
  12. package/dist/lib/i18n.d.ts +82 -0
  13. package/dist/lib/i18n.js +246 -0
  14. package/dist/styles.css +23 -1
  15. package/dist/ui/a2ui-renderer.d.ts +33 -0
  16. package/dist/ui/a2ui-renderer.js +793 -0
  17. package/dist/ui/agent-events.d.ts +32 -0
  18. package/dist/ui/agent-events.js +108 -0
  19. package/dist/ui/alert.d.ts +1 -1
  20. package/dist/ui/attachment.d.ts +2 -2
  21. package/dist/ui/auth-form.d.ts +3 -1
  22. package/dist/ui/auth-form.js +34 -6
  23. package/dist/ui/badge.d.ts +1 -1
  24. package/dist/ui/banner.d.ts +1 -1
  25. package/dist/ui/bubble.d.ts +1 -1
  26. package/dist/ui/button-group.d.ts +1 -1
  27. package/dist/ui/button.d.ts +2 -2
  28. package/dist/ui/chain-of-thought.d.ts +19 -0
  29. package/dist/ui/chain-of-thought.js +90 -0
  30. package/dist/ui/chat-composer.d.ts +39 -0
  31. package/dist/ui/chat-composer.js +192 -0
  32. package/dist/ui/conversation-list.d.ts +24 -0
  33. package/dist/ui/conversation-list.js +141 -0
  34. package/dist/ui/empty.d.ts +1 -1
  35. package/dist/ui/field.d.ts +1 -1
  36. package/dist/ui/generated-image.d.ts +14 -0
  37. package/dist/ui/generated-image.js +65 -0
  38. package/dist/ui/generated-table.d.ts +11 -0
  39. package/dist/ui/generated-table.js +59 -0
  40. package/dist/ui/icon-tile.d.ts +2 -2
  41. package/dist/ui/item.d.ts +2 -2
  42. package/dist/ui/markdown.d.ts +14 -0
  43. package/dist/ui/markdown.js +123 -0
  44. package/dist/ui/marker.d.ts +1 -1
  45. package/dist/ui/message-actions.d.ts +12 -0
  46. package/dist/ui/message-actions.js +79 -0
  47. package/dist/ui/panel.d.ts +1 -1
  48. package/dist/ui/reasoning.d.ts +10 -0
  49. package/dist/ui/reasoning.js +62 -0
  50. package/dist/ui/sidebar.d.ts +1 -1
  51. package/dist/ui/sparkline.d.ts +1 -1
  52. package/dist/ui/stat.d.ts +1 -1
  53. package/dist/ui/status-badge.d.ts +3 -3
  54. package/dist/ui/suggestions.d.ts +8 -0
  55. package/dist/ui/suggestions.js +39 -0
  56. package/dist/ui/tabs.d.ts +1 -1
  57. package/dist/ui/toggle.d.ts +1 -1
  58. package/dist/ui/tool-call.d.ts +15 -0
  59. package/dist/ui/tool-call.js +74 -0
  60. package/dist/ui/workflow-run.d.ts +23 -0
  61. package/dist/ui/workflow-run.js +185 -0
  62. package/docs/designer/criterio.md +87 -87
  63. package/docs/designer/patrones.md +3 -1
  64. package/package.json +238 -228
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+
3
+ type AgentEventType = "thinking" | "tool" | "message" | "handoff" | "error" | "done";
4
+ type AgentEventStatus = "running" | "done" | "error";
5
+ /** Dato breve del evento (modelo, tokens, coste, herramienta…) que se muestra como badge. */
6
+ interface AgentEventChip {
7
+ kind: "model" | "tokens" | "cost" | "tools" | "reasoning" | "branch" | "tool" | "content";
8
+ label: string;
9
+ }
10
+ interface AgentEvent {
11
+ id: string;
12
+ type: AgentEventType;
13
+ /** Qué hizo (nombre de la herramienta, a quién traspasa…); si falta, se usa la etiqueta del tipo. */
14
+ title?: React.ReactNode;
15
+ /** Texto breve visible siempre. */
16
+ summary?: React.ReactNode;
17
+ /** Contenido plegado (razonamiento completo, entrada y salida…). */
18
+ detail?: React.ReactNode;
19
+ time?: Date | string | number;
20
+ /** Metadatos del evento (véase `chipsFromMeta` en `orbital-ds/lib/ai-events`). */
21
+ chips?: AgentEventChip[];
22
+ /** `running` pulsa el indicador; por defecto `done` (`error` en el tipo error). */
23
+ status?: AgentEventStatus;
24
+ }
25
+ declare function AgentEvents({ events, density, now, className, ...props }: Omit<React.ComponentProps<"ol">, "children"> & {
26
+ events: AgentEvent[];
27
+ density?: "default" | "compact";
28
+ /** Referencia para el tiempo relativo (fíjala en SSR). */
29
+ now?: Date;
30
+ }): React.JSX.Element;
31
+
32
+ export { type AgentEvent, type AgentEventChip, type AgentEventStatus, type AgentEventType, AgentEvents };
@@ -0,0 +1,108 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ AlertCircleIcon,
5
+ BrainIcon,
6
+ CheckCircle2Icon,
7
+ ChevronDownIcon,
8
+ MessageSquareIcon,
9
+ RepeatIcon,
10
+ WrenchIcon
11
+ } from "lucide-react";
12
+ import { useDsMessages } from "../hooks/use-ds-messages.js";
13
+ import { cn } from "../lib/utils.js";
14
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
15
+ import {
16
+ Timeline,
17
+ TimelineContent,
18
+ TimelineDescription,
19
+ TimelineIndicator,
20
+ TimelineItem,
21
+ TimelineTime
22
+ } from "./timeline.js";
23
+ const ICON = {
24
+ thinking: /* @__PURE__ */ jsx(BrainIcon, {}),
25
+ tool: /* @__PURE__ */ jsx(WrenchIcon, {}),
26
+ message: /* @__PURE__ */ jsx(MessageSquareIcon, {}),
27
+ handoff: /* @__PURE__ */ jsx(RepeatIcon, {}),
28
+ error: /* @__PURE__ */ jsx(AlertCircleIcon, {}),
29
+ done: /* @__PURE__ */ jsx(CheckCircle2Icon, {})
30
+ };
31
+ const TONE = {
32
+ thinking: "neutral",
33
+ tool: "info",
34
+ message: "primary",
35
+ handoff: "warning",
36
+ error: "danger",
37
+ done: "success"
38
+ };
39
+ function AgentEvents({
40
+ events,
41
+ density = "default",
42
+ now,
43
+ className,
44
+ ...props
45
+ }) {
46
+ const t = useDsMessages();
47
+ const label = {
48
+ thinking: t.eventThinking,
49
+ tool: t.eventTool,
50
+ message: t.eventMessage,
51
+ handoff: t.eventHandoff,
52
+ error: t.eventError,
53
+ done: t.eventDone
54
+ };
55
+ return /* @__PURE__ */ jsx(Timeline, { "data-slot": "agent-events", "data-density": density, className: cn("w-full", className), ...props, children: events.map((e) => {
56
+ const status = e.status ?? (e.type === "error" ? "error" : "done");
57
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [
59
+ /* @__PURE__ */ jsx(
60
+ "span",
61
+ {
62
+ "data-slot": "agent-event-title",
63
+ className: cn(
64
+ "text-sm font-(--ds-strong-weight)",
65
+ e.type === "tool" && e.title && "font-mono",
66
+ status === "running" && "text-shimmer"
67
+ ),
68
+ children: e.title ?? label[e.type]
69
+ }
70
+ ),
71
+ e.title ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: label[e.type] }) : null,
72
+ status === "running" ? /* @__PURE__ */ jsx("span", { className: "text-xs text-info", children: t.toolRunning }) : null,
73
+ e.time !== void 0 ? /* @__PURE__ */ jsx(TimelineTime, { dateTime: e.time, now, relative: true, className: "ms-auto" }) : null
74
+ ] }),
75
+ e.summary && density !== "compact" ? /* @__PURE__ */ jsx(TimelineDescription, { children: e.summary }) : null
76
+ ] });
77
+ return /* @__PURE__ */ jsxs(
78
+ TimelineItem,
79
+ {
80
+ "data-slot": "agent-event",
81
+ "data-type": e.type,
82
+ "data-status": status,
83
+ tone: status === "error" ? "danger" : TONE[e.type],
84
+ className: density === "compact" ? "[&_[data-slot=timeline-content]]:pb-3" : void 0,
85
+ children: [
86
+ /* @__PURE__ */ jsx(
87
+ TimelineIndicator,
88
+ {
89
+ className: cn(status === "running" && "[&_[data-slot=timeline-icon]]:animate-ds-ring-inner motion-reduce:[&_[data-slot=timeline-icon]]:animate-none"),
90
+ children: ICON[e.type]
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx(TimelineContent, { children: e.detail ? /* @__PURE__ */ jsxs(Collapsible, { children: [
94
+ /* @__PURE__ */ jsx(CollapsibleTrigger, { className: "group flex w-full flex-col gap-0.5 rounded-control text-start outline-none focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color)", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-start gap-2", children: [
95
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: body }),
96
+ /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": true, className: "mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform group-data-[panel-open]:rotate-180" })
97
+ ] }) }),
98
+ /* @__PURE__ */ jsx(CollapsibleContent, { className: "mt-2 whitespace-pre-wrap rounded-lg border border-border bg-muted/40 p-3 text-xs text-muted-foreground", children: e.detail })
99
+ ] }) : body })
100
+ ]
101
+ },
102
+ e.id
103
+ );
104
+ }) });
105
+ }
106
+ export {
107
+ AgentEvents
108
+ };
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const alertVariants: (props?: ({
6
- variant?: "default" | "destructive" | "info" | "success" | "warning" | "danger" | null | undefined;
6
+ variant?: "info" | "warning" | "success" | "danger" | "default" | "destructive" | null | undefined;
7
7
  } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): React.JSX.Element;
9
9
  declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
@@ -6,13 +6,13 @@ import { Button } from './button.js';
6
6
 
7
7
  declare const attachmentVariants: (props?: ({
8
8
  size?: "default" | "xs" | "sm" | null | undefined;
9
- orientation?: "horizontal" | "vertical" | null | undefined;
9
+ orientation?: "vertical" | "horizontal" | null | undefined;
10
10
  } & class_variance_authority_types.ClassProp) | undefined) => string;
11
11
  declare function Attachment({ className, state, size, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
12
12
  state?: "idle" | "uploading" | "processing" | "error" | "done";
13
13
  }): React.JSX.Element;
14
14
  declare const attachmentMediaVariants: (props?: ({
15
- variant?: "image" | "icon" | null | undefined;
15
+ variant?: "icon" | "image" | null | undefined;
16
16
  } & class_variance_authority_types.ClassProp) | undefined) => string;
17
17
  declare function AttachmentMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>): React.JSX.Element;
18
18
  declare function AttachmentContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
@@ -36,7 +36,7 @@ type AuthRoute = void | undefined | {
36
36
  organizations?: AuthOrganization[];
37
37
  error?: AuthMessage;
38
38
  };
39
- declare function AuthForm({ preset, title, description, icon, identifier, defaultIdentifier, identifierFirst, onIdentify, audience, fields, extraFields, passwordRules, showStrength, remember, providers, onProvider, providersPlacement, providersLayout, onPasskey, onSso, ssoBy, lastUsed, onSubmit, onVerifyCode, onResend, resendAfter, codeLength, error: errorProp, fieldErrors: fieldErrorsProp, links, submitLabel, footer, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "onSubmit"> & {
39
+ declare function AuthForm({ preset, title, description, icon, identifier, defaultIdentifier, identifierFirst, onIdentify, audience, entry, fields, extraFields, passwordRules, showStrength, remember, providers, onProvider, providersPlacement, providersLayout, onPasskey, onSso, ssoBy, lastUsed, onSubmit, onVerifyCode, onResend, resendAfter, codeLength, error: errorProp, fieldErrors: fieldErrorsProp, links, submitLabel, footer, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "onSubmit"> & {
40
40
  preset?: AuthFormPreset;
41
41
  title?: React.ReactNode;
42
42
  description?: React.ReactNode;
@@ -51,6 +51,8 @@ declare function AuthForm({ preset, title, description, icon, identifier, defaul
51
51
  onIdentify?: (identifier: string) => AuthRoute | Promise<AuthRoute>;
52
52
  /** Quién puede entrar: explica en pantalla, antes de escribir el correo, qué puerta le toca a cada persona. */
53
53
  audience?: "internal" | "external" | "mixed";
54
+ /** Inicio del acceso mixto: `identifier` pide el correo y el dominio decide; `doors` ofrece dos puertas sin escribir: «Continuar con SSO» para el personal y «Acceso para personas externas», que abre el formulario de cuenta propia (correo y contraseña, passkey). Necesita `onSso`. */
55
+ entry?: "identifier" | "doors";
54
56
  /** Campos y orden (sign-up y reset-password). */
55
57
  fields?: AuthField[];
56
58
  /** Campos propios de la app, antes del botón (llegan en `formData`). */
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { ArrowLeftIcon, Building2Icon, CheckIcon, CircleIcon, MailCheckIcon } from "lucide-react";
3
+ import { ArrowLeftIcon, Building2Icon, CheckIcon, CircleIcon, MailCheckIcon, UsersRoundIcon } from "lucide-react";
4
4
  import * as React from "react";
5
5
  import { useDsMessages } from "../hooks/use-ds-messages.js";
6
6
  import {
@@ -45,6 +45,7 @@ function AuthForm({
45
45
  identifierFirst,
46
46
  onIdentify,
47
47
  audience,
48
+ entry = "identifier",
48
49
  fields,
49
50
  extraFields,
50
51
  passwordRules,
@@ -75,11 +76,12 @@ function AuthForm({
75
76
  const d = PRESETS[preset];
76
77
  const list = fields ?? d.fields;
77
78
  const [accessKind, setAccessKind] = React.useState(null);
78
- const stepFirst = preset === "sign-in" && (identifierFirst ?? d.identifierFirst);
79
+ const doors = entry === "doors" && preset === "sign-in" && !!onSso;
80
+ const stepFirst = preset === "sign-in" && !doors && (identifierFirst ?? d.identifierFirst);
79
81
  const strength = showStrength ?? d.strength;
80
82
  const uid = React.useId();
81
83
  const ids = (f) => `${uid}-${f}`;
82
- const [view, setView] = React.useState(preset === "sso" ? "sso" : "form");
84
+ const [view, setView] = React.useState(preset === "sso" ? "sso" : doors ? "doors" : "form");
83
85
  const [values, setValues] = React.useState({ identifier: defaultIdentifier, password: "", name: "", confirmPassword: "", remember: false, terms: false });
84
86
  const [code, setCode] = React.useState("");
85
87
  const [errors, setErrors] = React.useState({});
@@ -459,6 +461,28 @@ function AuthForm({
459
461
  ) }, o.id)) }) }),
460
462
  backToForm
461
463
  ] });
464
+ } else if (view === "doors") {
465
+ content = /* @__PURE__ */ jsxs(Fragment, { children: [
466
+ /* @__PURE__ */ jsx(AuthHeader, { icon, title: title ?? head[preset][0], description: description ?? head[preset][1] }),
467
+ /* @__PURE__ */ jsx(AuthError, { error: shownError }),
468
+ /* @__PURE__ */ jsxs(AuthStagger, { index: 2, "data-slot": "auth-form-doors", className: "flex flex-col gap-6", children: [
469
+ /* @__PURE__ */ jsxs("section", { "data-door": "staff", className: "flex flex-col gap-3", children: [
470
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-pretty text-muted-foreground", children: t.authDoorStaffHint }),
471
+ /* @__PURE__ */ jsxs(Button, { type: "button", size: "lg", className: "w-full", "data-last-used": lastUsed === "sso" || void 0, disabled: pending != null, "aria-busy": pending === "sso" || void 0, onClick: () => void startSso(), children: [
472
+ pending === "sso" ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(Building2Icon, {}),
473
+ t.authContinueSso
474
+ ] })
475
+ ] }),
476
+ /* @__PURE__ */ jsx(AuthDivider, {}),
477
+ /* @__PURE__ */ jsxs("section", { "data-door": "external", className: "flex flex-col gap-3", children: [
478
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-pretty text-muted-foreground", children: t.authDoorExternalHint }),
479
+ /* @__PURE__ */ jsxs(Button, { type: "button", size: "lg", variant: "outline", className: "w-full", disabled: pending != null, onClick: () => go("form"), children: [
480
+ /* @__PURE__ */ jsx(UsersRoundIcon, {}),
481
+ t.authDoorExternal
482
+ ] })
483
+ ] })
484
+ ] })
485
+ ] });
462
486
  } else if (view === "redirecting") {
463
487
  content = /* @__PURE__ */ jsxs("div", { "data-slot": "auth-form-redirecting", role: "status", className: "flex flex-col items-center gap-4 py-6 text-center", children: [
464
488
  /* @__PURE__ */ jsx(Spinner, { className: "size-6" }),
@@ -481,7 +505,7 @@ function AuthForm({
481
505
  /* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", onClick: () => go("form"), children: t.authChange }),
482
506
  /* @__PURE__ */ jsx("input", { type: "hidden", name: "username", autoComplete: "username", value: email })
483
507
  ] }) : null,
484
- audience && audience !== "external" && stepFirst && view === "form" ? /* @__PURE__ */ jsx("p", { "data-slot": "auth-form-audience", "data-audience": audience, className: "rounded-(--ds-auth-radius) bg-muted px-3 py-2 text-xs text-pretty text-muted-foreground", children: audience === "mixed" ? t.authAudienceMixed : t.authAudienceInternal }) : null,
508
+ audience && audience !== "external" && stepFirst && view === "form" && !doors ? /* @__PURE__ */ jsx("p", { "data-slot": "auth-form-audience", "data-audience": audience, className: "rounded-(--ds-auth-radius) bg-muted px-3 py-2 text-xs text-pretty text-muted-foreground", children: audience === "mixed" ? t.authAudienceMixed : t.authAudienceInternal }) : null,
485
509
  visibleFields.map(renderField),
486
510
  !ssoView && extraFields && !(stepFirst && view === "form") ? extraFields : null,
487
511
  remember && preset === "sign-in" && !(stepFirst && view === "form") ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
@@ -502,13 +526,17 @@ function AuthForm({
502
526
  /* @__PURE__ */ jsx(Building2Icon, {}),
503
527
  t.authUseSso
504
528
  ] }) }) : null,
505
- ssoView && (preset === "sign-in" || preset === "social") ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "self-center", onClick: () => go("form"), children: [
529
+ doors && view === "form" ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "self-center", onClick: () => go("doors"), children: [
530
+ /* @__PURE__ */ jsx(ArrowLeftIcon, {}),
531
+ t.authBackToSignIn
532
+ ] }) : null,
533
+ ssoView && (preset === "sign-in" || preset === "social") ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "self-center", onClick: () => go(doors ? "doors" : "form"), children: [
506
534
  /* @__PURE__ */ jsx(ArrowLeftIcon, {}),
507
535
  t.authBackToSignIn
508
536
  ] }) : null
509
537
  ] });
510
538
  }
511
- const footerLinks = footer ?? (view === "form" || view === "sso" ? (preset === "sign-in" || preset === "social") && links.signUp ? /* @__PURE__ */ jsxs(Fragment, { children: [
539
+ const footerLinks = footer ?? (view === "doors" || view === "form" || view === "sso" ? (preset === "sign-in" || preset === "social") && links.signUp ? /* @__PURE__ */ jsxs(Fragment, { children: [
512
540
  t.authNoAccount,
513
541
  " ",
514
542
  /* @__PURE__ */ jsx(AuthAnchor, { to: links.signUp, children: t.authSignUpLink })
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const badgeVariants: (props?: ({
7
7
  size?: "default" | "sm" | null | undefined;
8
- variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "info" | "success" | "warning" | "danger" | "neutral" | null | undefined;
8
+ variant?: "neutral" | "info" | "success" | "warning" | "danger" | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare function Badge({ className, variant, size, dot, render, children, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
11
11
  /** Punto de estado a la izquierda, con el color del texto de la variante. */
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const bannerVariants: (props?: ({
6
- variant?: "default" | "info" | "success" | "warning" | "danger" | "brand" | null | undefined;
6
+ variant?: "info" | "warning" | "success" | "danger" | "default" | "brand" | null | undefined;
7
7
  } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  declare function Banner({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bannerVariants>): React.JSX.Element;
9
9
  declare function BannerContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare function BubbleGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
7
7
  declare const bubbleVariants: (props?: ({
8
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "muted" | "tinted" | null | undefined;
8
+ variant?: "outline" | "default" | "ghost" | "secondary" | "destructive" | "muted" | "tinted" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare function Bubble({ variant, align, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
11
11
  align?: "start" | "end";
@@ -6,7 +6,7 @@ import { Separator } from './separator.js';
6
6
  import '@base-ui/react/separator';
7
7
 
8
8
  declare const buttonGroupVariants: (props?: ({
9
- orientation?: "horizontal" | "vertical" | null | undefined;
9
+ orientation?: "vertical" | "horizontal" | null | undefined;
10
10
  } & class_variance_authority_types.ClassProp) | undefined) => string;
11
11
  declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): React$1.JSX.Element;
12
12
  declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
@@ -4,8 +4,8 @@ import { useRender } from '@base-ui/react/use-render';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const buttonVariants: (props?: ({
7
- variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "cta" | null | undefined;
8
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
7
+ variant?: "outline" | "default" | "ghost" | "secondary" | "link" | "destructive" | "cta" | null | undefined;
8
+ size?: "icon" | "default" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare function Button({ className, variant, size, render, nativeButton: _nativeButton, ...props }: useRender.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
11
11
  nativeButton?: boolean;
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+
3
+ type ChainStepStatus = "running" | "done" | "error" | "pending";
4
+ interface ChainStep {
5
+ id: string;
6
+ title: React.ReactNode;
7
+ description?: React.ReactNode;
8
+ /** Resultados breves (dominios, ficheros, etiquetas) como badges. */
9
+ results?: string[];
10
+ icon?: React.ReactNode;
11
+ status?: ChainStepStatus;
12
+ }
13
+ declare function ChainOfThought({ steps, summary, defaultOpen, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
14
+ steps: ChainStep[];
15
+ summary?: React.ReactNode;
16
+ defaultOpen?: boolean;
17
+ }): React.JSX.Element;
18
+
19
+ export { ChainOfThought, type ChainStep, type ChainStepStatus };
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { AlertCircleIcon, CheckCircle2Icon, ChevronDownIcon, CircleDashedIcon } from "lucide-react";
5
+ import { useDsMessages } from "../hooks/use-ds-messages.js";
6
+ import { dsFormat } from "../lib/i18n.js";
7
+ import { cn } from "../lib/utils.js";
8
+ import { Badge } from "./badge.js";
9
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
10
+ import { Spinner } from "./spinner.js";
11
+ function ChainOfThought({
12
+ steps,
13
+ summary,
14
+ defaultOpen,
15
+ className,
16
+ ...props
17
+ }) {
18
+ const t = useDsMessages();
19
+ const running = steps.some((s) => s.status === "running");
20
+ const failed = steps.some((s) => s.status === "error");
21
+ const [open, setOpen] = React.useState(defaultOpen ?? running);
22
+ const touched = React.useRef(false);
23
+ React.useEffect(() => {
24
+ if (!touched.current) setOpen(running);
25
+ }, [running]);
26
+ const label = summary ?? (running ? t.chainWorking : dsFormat(t.chainDone, { count: steps.length }));
27
+ return /* @__PURE__ */ jsx(
28
+ "div",
29
+ {
30
+ "data-slot": "chain-of-thought",
31
+ "data-status": running ? "running" : failed ? "error" : "done",
32
+ className: cn("text-sm", className),
33
+ ...props,
34
+ children: /* @__PURE__ */ jsxs(
35
+ Collapsible,
36
+ {
37
+ open,
38
+ onOpenChange: (v) => {
39
+ touched.current = true;
40
+ setOpen(v);
41
+ },
42
+ children: [
43
+ /* @__PURE__ */ jsxs(CollapsibleTrigger, { className: "group flex items-center gap-2 rounded-control text-muted-foreground outline-none hover:text-foreground focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color)", children: [
44
+ running ? /* @__PURE__ */ jsx(Spinner, { "aria-hidden": true, role: "presentation", className: "size-3.5" }) : failed ? /* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": true, className: "size-4 text-danger" }) : /* @__PURE__ */ jsx(CheckCircle2Icon, { "aria-hidden": true, className: "size-4" }),
45
+ /* @__PURE__ */ jsx("span", { className: cn("font-(--ds-medium-weight)", running && "text-shimmer"), children: label }),
46
+ /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-4 transition-transform group-data-[panel-open]:rotate-180" })
47
+ ] }),
48
+ /* @__PURE__ */ jsx(CollapsibleContent, { keepMounted: true, children: /* @__PURE__ */ jsx("ol", { className: "mt-3 flex flex-col", children: steps.map((s, i) => {
49
+ const status = s.status ?? "done";
50
+ return /* @__PURE__ */ jsxs(
51
+ "li",
52
+ {
53
+ "data-slot": "chain-step",
54
+ "data-status": status,
55
+ "aria-current": status === "running" ? "step" : void 0,
56
+ className: "relative flex gap-3 pb-4 last:pb-0",
57
+ children: [
58
+ i < steps.length - 1 ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute start-2.5 top-6 bottom-0 w-px -translate-x-1/2 bg-(--ds-track-bg)" }) : null,
59
+ /* @__PURE__ */ jsx(
60
+ "span",
61
+ {
62
+ "aria-hidden": true,
63
+ className: cn(
64
+ "relative mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-background text-muted-foreground [&_svg]:size-4",
65
+ status === "done" && "text-success",
66
+ status === "error" && "text-danger",
67
+ status === "running" && "text-info"
68
+ ),
69
+ children: s.icon ?? (status === "running" ? /* @__PURE__ */ jsx(Spinner, { "aria-hidden": true, role: "presentation", className: "size-3.5" }) : status === "error" ? /* @__PURE__ */ jsx(AlertCircleIcon, {}) : status === "pending" ? /* @__PURE__ */ jsx(CircleDashedIcon, {}) : /* @__PURE__ */ jsx(CheckCircle2Icon, {}))
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col gap-1", status === "pending" && "text-muted-foreground"), children: [
73
+ /* @__PURE__ */ jsx("span", { className: cn("text-foreground", status === "running" && "text-shimmer"), children: s.title }),
74
+ s.description ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: s.description }) : null,
75
+ s.results?.length ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: s.results.map((r) => /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: r }, r)) }) : null
76
+ ] })
77
+ ]
78
+ },
79
+ s.id
80
+ );
81
+ }) }) })
82
+ ]
83
+ }
84
+ )
85
+ }
86
+ );
87
+ }
88
+ export {
89
+ ChainOfThought
90
+ };
@@ -0,0 +1,39 @@
1
+ import * as React from 'react';
2
+
3
+ type ChatAttachmentStatus = "ready" | "uploading" | "error";
4
+ interface ChatAttachment {
5
+ id: string;
6
+ name: string;
7
+ /** Tipo MIME; `image/*` usa el icono de imagen. */
8
+ type?: string;
9
+ status?: ChatAttachmentStatus;
10
+ }
11
+ type ChatVoiceState = "idle" | "recording" | "transcribing" | "error";
12
+ interface ChatVoice {
13
+ state: ChatVoiceState;
14
+ /** Segundos grabados (los formatea el componente). */
15
+ seconds?: number;
16
+ onStart: () => void;
17
+ /** Termina y usa la grabación. */
18
+ onConfirm: () => void;
19
+ /** Descarta la grabación. */
20
+ onCancel: () => void;
21
+ }
22
+ declare function ChatComposer({ value, defaultValue, onValueChange, onSend, onStop, onAttach, onFilesDrop, attachments, onRemoveAttachment, voice, maxLength, streaming, disabled, placeholder, className, ...props }: Omit<React.ComponentProps<"div">, "onChange" | "defaultValue"> & {
23
+ value?: string;
24
+ defaultValue?: string;
25
+ onValueChange?: (value: string) => void;
26
+ onSend?: (value: string) => void;
27
+ onStop?: () => void;
28
+ onAttach?: () => void;
29
+ onFilesDrop?: (files: File[]) => void;
30
+ attachments?: ChatAttachment[];
31
+ onRemoveAttachment?: (id: string) => void;
32
+ voice?: ChatVoice;
33
+ maxLength?: number;
34
+ streaming?: boolean;
35
+ disabled?: boolean;
36
+ placeholder?: string;
37
+ }): React.JSX.Element;
38
+
39
+ export { type ChatAttachment, type ChatAttachmentStatus, ChatComposer, type ChatVoice, type ChatVoiceState };