@aintela/chat 0.9.0 → 0.10.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.
package/dist/services.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as r, A as s, D as t, a as c, E as o, H as n, b as i, L as A, M as S, T as d, c as v, d as E, r as T, e as D, s as m, t as H } from "./detachedRunActivity-jHa9SDv1.js";
1
+ import { A as r, A as s, D as t, a as c, E as o, H as n, b as i, L as A, M as S, T as d, c as v, d as E, r as T, e as D, s as m, t as H } from "./detachedRunActivity-DWOR3cAC.js";
2
2
  import { A as p } from "./artifactHtmlHandler-CMQJf1cX.js";
3
3
  import { H as _, d as l, r as f } from "./httpSessionService-BIkDesYB.js";
4
4
  export {
@@ -0,0 +1,3 @@
1
+ export * from './components/AgentTeam/personas';
2
+ export * from './components/AgentTeam/agentRoles';
3
+ export * from './components/AgentTeam/PersonaAvatar';
@@ -1,7 +1,13 @@
1
1
  import { Persona, PersonaId } from './personas';
2
2
  import { AgentRole } from './agentRoles';
3
+ /** What the avatar needs: a catalog persona, or a draft one (the admin console's preview). */
4
+ export type AvatarSubject = Pick<Persona, 'name' | 'gender' | 'look'> & {
5
+ avatarUrl?: string;
6
+ };
3
7
  export interface PersonaAvatarProps {
4
- persona: PersonaId | Persona;
8
+ /** An id (looked up in the loaded catalog — the neutral avatar until it arrives or when it does not have it) or the
9
+ * persona itself. */
10
+ persona: PersonaId | AvatarSubject;
5
11
  /** px. Tamanhos usados: 20 (passagem), 24 (chat mobile), 28 (chat desktop), 36/44/48/56/72/88. */
6
12
  size?: number;
7
13
  /** Mostra o pino de especialidade no canto. Por padrão só a partir de 48 px — no chat o texto do papel faz esse trabalho. */
@@ -0,0 +1,3 @@
1
+ import { NamedAgentDto } from '../personas';
2
+ export declare const FIXTURE_DTOS: NamedAgentDto[];
3
+ export declare const loadFixtureCatalog: () => void;
@@ -27,7 +27,7 @@ export declare const avatarAlt: (p: Pick<Persona, "name" | "gender">) => string;
27
27
  * própria da persona. Trocar o papel troca só o trecho da especialidade.
28
28
  */
29
29
  export declare function greeting(name: string, gender: Gender, role: AgentRole, tail?: string): string;
30
- /** A frase própria da persona: o que vem depois de "… especialista em {especialidade}." no `hello` do catálogo. */
31
- export declare function personaTail(p: Pick<Persona, 'hello'>): string;
30
+ /** A frase própria da persona: o `tail` do catálogo, ou o que vem depois de "… especialista em {especialidade}." no `hello`. */
31
+ export declare function personaTail(p: Pick<Persona, 'hello'> & Partial<Pick<Persona, 'tail'>>): string;
32
32
  /** A saudação da persona ocupando um papel: a especialidade vem do papel, a frase final da persona. */
33
33
  export declare const personaGreeting: (p: Pick<Persona, "name" | "gender" | "hello">, role: AgentRole) => string;
@@ -5,7 +5,7 @@ export interface ResolvedChatAgent {
5
5
  persona: Persona;
6
6
  role: AgentRole;
7
7
  }
8
- /** The persona and role behind a wire identity, or undefined when this build does not know the persona. */
8
+ /** The persona and role behind a wire identity, or undefined when the loaded catalog does not have the persona. */
9
9
  export declare function resolveChatAgent(identity: ChatAgentIdentity | undefined | null): ResolvedChatAgent | undefined;
10
10
  /**
11
11
  * The handoff, if any, that happens AT `current`: the last earlier agent turn was answered by a different persona.
@@ -1,4 +1,5 @@
1
- export type PersonaId = "ana" | "bruno" | "carla" | "marla" | "rafael" | "fernanda" | "raimundo" | "luana" | "diego" | "tereza" | "paulo" | "beatriz" | "thiago" | "claudia" | "marcio" | "jessica" | "antonio" | "aline" | "vinicius" | "sonia" | "wesley" | "priscila" | "edson" | "yasmin";
1
+ /** O id de uma persona — o que times, cobranças e conversas referenciam (`diego`). */
2
+ export type PersonaId = string;
2
3
  export type Gender = 'f' | 'm';
3
4
  export type HairStyle = 'long' | 'short' | 'curly' | 'bun' | 'side' | 'wavy' | 'bald' | 'afro' | 'buzz' | 'none';
4
5
  export type HairColor = 'black' | 'dbrown' | 'brown' | 'auburn' | 'blond' | 'gray' | 'white';
@@ -44,13 +45,73 @@ export interface Persona {
44
45
  gender: Gender;
45
46
  /** dois adjetivos */
46
47
  voice: string;
47
- /** saudação — formato fixo: "Olá, sou {o|a} {Nome}, agente {autônomo|autônoma} especialista em {especialidade}." + frase própria */
48
+ /** saudação de reservas — formato fixo: "Olá, sou {o|a} {Nome}, agente {autônomo|autônoma} especialista em {especialidade}." + frase própria */
48
49
  hello: string;
50
+ /** a frase própria depois da saudação fixa */
51
+ tail: string;
49
52
  look: AvatarLook;
50
53
  comm: PersonaVoice;
54
+ /** ilustração que substitui o avatar gerado, quando houver */
55
+ avatarUrl?: string;
56
+ /** false: não é mais oferecida para contratação nem sugerida; times e conversas que a têm continuam a vê-la */
57
+ active: boolean;
58
+ /** posição em "Sugerir outro" (1 primeiro); ausente depois de todas as ranqueadas */
59
+ suggestRank?: number;
51
60
  }
52
- export declare const PERSONAS: Persona[];
53
- export declare const PERSONA_BY_ID: Record<PersonaId, Persona>;
61
+ /** Uma persona como a ProfileApi a serve (`GET /api/agent-team/personas`, `NamedAgentDto`). */
62
+ export interface NamedAgentDto {
63
+ id: string;
64
+ name: string;
65
+ gender: string;
66
+ voice: string;
67
+ tail: string;
68
+ sheet: {
69
+ address: string;
70
+ formality: number;
71
+ exclamation: string;
72
+ emoji: string;
73
+ region: string;
74
+ regionalMarks: string;
75
+ badNews: string;
76
+ issued: string;
77
+ approval: string;
78
+ closing: string;
79
+ };
80
+ look: {
81
+ skin: number;
82
+ hair: string;
83
+ hairColor: string;
84
+ shirt: number;
85
+ background: number;
86
+ top: string;
87
+ glasses?: boolean;
88
+ beard?: boolean;
89
+ hearingAid?: boolean;
90
+ part?: boolean;
91
+ cover?: string | null;
92
+ };
93
+ avatarUrl?: string | null;
94
+ active: boolean;
95
+ suggestRank?: number | null;
96
+ updatedAt?: string | null;
97
+ updatedBy?: string | null;
98
+ }
99
+ /** A persona a partir do que a ProfileApi serve. */
100
+ export declare function personaFromDto(d: NamedAgentDto): Persona;
101
+ /** Entrega (ou troca) o catálogo. Ordem: por nome. */
102
+ export declare function setPersonaCatalog(personas: readonly Persona[]): void;
103
+ /** Todas as personas carregadas, ativas ou não. */
104
+ export declare const getPersonaCatalog: () => readonly Persona[];
105
+ /** A persona deste id, ativa ou não; undefined quando o catálogo não a tem (ou ainda não chegou). */
106
+ export declare const findPersona: (id: PersonaId | null | undefined) => Persona | undefined;
107
+ /** O catálogo, redesenhando quando ele chega ou muda. */
108
+ export declare const usePersonaCatalog: () => readonly Persona[];
109
+ /** Uma persona por id, redesenhando quando o catálogo chega ou muda. */
110
+ export declare const usePersona: (id: PersonaId | null | undefined) => Persona | undefined;
111
+ /**
112
+ * As personas que "Sugerir outro" percorre, na ordem: as ranqueadas primeiro, depois as demais por nome — só ativas.
113
+ */
114
+ export declare function suggestionOrder(personas?: readonly Persona[]): Persona[];
54
115
  /** "a" / "o" — artigo para frases como "A Ana passa a sênior", "Liberar o Rafael". */
55
116
  export declare const article: (p: Persona) => "a" | "o";
56
117
  /** Regras de comunicação comuns a todas as personas (vão no system prompt do agente, acima da voz da persona). */
@@ -15,7 +15,7 @@ export interface TurnOpenCloseDetails {
15
15
  }
16
16
  /**
17
17
  * The named agent (persona) that answered a turn — Equipe de agentes. `personaId` keys the persona catalog
18
- * (`PERSONA_BY_ID`), `role` the specialty (`res` | `pos` | `pol` | `evt`). Kept as plain strings: the wire may
18
+ * (`findPersona`, loaded by the app with `setPersonaCatalog`), `role` the specialty (`res` | `pos` | `pol` | `evt`). Kept as plain strings: the wire may
19
19
  * name a persona this client build does not know yet, and the renderer falls back to the generic agent.
20
20
  */
21
21
  export interface ChatAgentIdentity {
@@ -30,4 +30,10 @@ export interface AgentContext {
30
30
  agentConfig: Partial<Agent>;
31
31
  customer?: Customer;
32
32
  model?: string;
33
+ /**
34
+ * Extra `Message.Parameters` the host adds to every message, read at SEND time (so it can change between
35
+ * conversations without rebuilding the engine). AIA sends the named agent it showed before the first message
36
+ * (`NamedAgentId`, AIA Issue 1625). Keys the library sets itself win over these.
37
+ */
38
+ parameters?: () => Record<string, string> | undefined;
33
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aintela/chat",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,6 +42,10 @@
42
42
  "types": "./dist/interfaces.d.ts",
43
43
  "import": "./dist/interfaces.js"
44
44
  },
45
+ "./agent-team": {
46
+ "types": "./dist/agent-team.d.ts",
47
+ "import": "./dist/agent-team.js"
48
+ },
45
49
  "./style": "./dist/style.css",
46
50
  "./style.css": "./dist/style.css"
47
51
  },
@@ -64,6 +68,9 @@
64
68
  ],
65
69
  "interfaces": [
66
70
  "./dist/interfaces.d.ts"
71
+ ],
72
+ "agent-team": [
73
+ "./dist/agent-team.d.ts"
67
74
  ]
68
75
  }
69
76
  },