@aintela/chat 0.8.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/Memory-BUnmYGNv.js.map +1 -1
- package/dist/PersonaAvatar-tKaWpDeQ.js +199 -0
- package/dist/PersonaAvatar-tKaWpDeQ.js.map +1 -0
- package/dist/agent-team.d.ts +2 -0
- package/dist/agent-team.js +27 -0
- package/dist/agent-team.js.map +1 -0
- package/dist/components.js +8543 -8995
- package/dist/components.js.map +1 -1
- package/dist/{detachedRunActivity-RNg1JDDW.js → detachedRunActivity-DWOR3cAC.js} +227 -224
- package/dist/detachedRunActivity-DWOR3cAC.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/{httpSessionService-DLdoBZRW.js → httpSessionService-BIkDesYB.js} +32 -31
- package/dist/{httpSessionService-DLdoBZRW.js.map → httpSessionService-BIkDesYB.js.map} +1 -1
- package/dist/index.js +289 -278
- package/dist/index.js.map +1 -1
- package/dist/serializer-DvR3nOcf.js.map +1 -1
- package/dist/services.js +2 -2
- package/dist/src/agentTeam.d.ts +3 -0
- package/dist/src/components/AgentTeam/PersonaAvatar.d.ts +7 -1
- package/dist/src/components/AgentTeam/__tests__/personaFixtures.d.ts +3 -0
- package/dist/src/components/AgentTeam/agentRoles.d.ts +2 -2
- package/dist/src/components/AgentTeam/chatAgent.d.ts +1 -1
- package/dist/src/components/AgentTeam/personas.d.ts +65 -4
- package/dist/src/components/AiChat/AiChatContext.d.ts +9 -0
- package/dist/src/components/AiChat/AiChatTypes.d.ts +6 -0
- package/dist/src/components/AiChat/ChatPane/ChatTurn.d.ts +33 -0
- package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +6 -4
- package/dist/src/components/AiChat/ChatPane/parts/ReadOnlyGuard.d.ts +9 -0
- package/dist/src/components/AiChat/ChatPane/parts/uiPartStage.d.ts +15 -10
- package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +6 -0
- package/dist/src/components/AiChat/ChatPane/turnCommitKeepsUiTools.test.d.ts +1 -0
- package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +7 -0
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/v2/SharedSessionTranscript.d.ts +76 -0
- package/dist/src/components/v2/index.d.ts +2 -0
- package/dist/src/models/ChatSession.d.ts +6 -0
- package/dist/src/models/Interaction.d.ts +1 -1
- package/dist/src/models/contexts.d.ts +6 -0
- package/dist/src/services/detachedRun/DetachedRunFramesTransport.d.ts +11 -0
- package/dist/src/services/detachedRun/streamDetachedRunFrames.d.ts +7 -0
- package/dist/{useChatSessions-DwqgYo79.js → useChatSessions-CyFKVtkk.js} +2 -2
- package/dist/{useChatSessions-DwqgYo79.js.map → useChatSessions-CyFKVtkk.js.map} +1 -1
- package/package.json +8 -1
- package/dist/detachedRunActivity-RNg1JDDW.js.map +0 -1
package/dist/services.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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
|
-
import { H as _, d as l, r as f } from "./httpSessionService-
|
|
3
|
+
import { H as _, d as l, r as f } from "./httpSessionService-BIkDesYB.js";
|
|
4
4
|
export {
|
|
5
5
|
r as AgentGatewayService,
|
|
6
6
|
s as AgentGatewayWSAsync,
|
|
@@ -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
|
-
|
|
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. */
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
53
|
-
export
|
|
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). */
|
|
@@ -33,6 +33,8 @@ export interface AiChatContextState {
|
|
|
33
33
|
showSessionInfo: boolean;
|
|
34
34
|
showConnectionState: boolean;
|
|
35
35
|
hidePromptInput: boolean;
|
|
36
|
+
/** The chat sends nothing — see `AiChatBaseProps.readOnly`. */
|
|
37
|
+
readOnly?: boolean;
|
|
36
38
|
/** DEVELOPMENT ONLY — a key that paints the phantom ghost at the caret (see PromptAssistOptions.debugGhostKey). */
|
|
37
39
|
promptGhostDebugKey?: string;
|
|
38
40
|
/**
|
|
@@ -116,4 +118,11 @@ export interface AiChatContextState {
|
|
|
116
118
|
}
|
|
117
119
|
export declare const AiChatServiceContext: import('react').Context<AiChatContextState | undefined>;
|
|
118
120
|
export declare const useAiChatServices: () => AiChatContextState;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the chat around this component is READ-ONLY (`<AiChat readOnly>`, AIA Issue 1587) — a transcript the
|
|
123
|
+
* signed-in person may watch but not act in. A UI tool component reads it to hide the buttons that would send (a
|
|
124
|
+
* flight's "selecionar", a seat map's "confirmar") while keeping what only browses (fares, photos, the map).
|
|
125
|
+
* False outside any chat.
|
|
126
|
+
*/
|
|
127
|
+
export declare function useChatReadOnly(): boolean;
|
|
119
128
|
export declare function useAiChatSessionStore<T>(selector: (state: AiChatState) => T): T;
|
|
@@ -182,6 +182,12 @@ export interface AiChatBaseProps extends AiChatStyleProps {
|
|
|
182
182
|
* a pure transcript. Defaults to `false`.
|
|
183
183
|
*/
|
|
184
184
|
hidePromptInput?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* A transcript someone else owns (a shared conversation, AIA Issue 1587): the chat sends NOTHING. UI tools get
|
|
187
|
+
* `ctx.readOnly` (and `useChatReadOnly()`) so they can hide their commit buttons, ask-user cards are drawn
|
|
188
|
+
* inert, and `sendMessage` / answers are refused. Defaults to `false`.
|
|
189
|
+
*/
|
|
190
|
+
readOnly?: boolean;
|
|
185
191
|
/**
|
|
186
192
|
* DEVELOPMENT ONLY. A single character (the demo pages use `|`) that the composer swallows and answers with
|
|
187
193
|
* the phantom "@ …" ghost at the caret — location on the first press, person on the next — so the ghost can
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { Interaction } from '../../../models/Interaction';
|
|
4
|
+
export interface ChatTurnProps {
|
|
5
|
+
message: Interaction;
|
|
6
|
+
/** The turn is still streaming. Flipping this is a prop change on the SAME element — never a remount. */
|
|
7
|
+
live: boolean;
|
|
8
|
+
onLinkClicked?: (link: string, content: string | null) => void;
|
|
9
|
+
/** The box once the turn has settled. */
|
|
10
|
+
settledSx?: SxProps<Theme>;
|
|
11
|
+
/** A rule under a settled turn. */
|
|
12
|
+
divider?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One turn of the conversation, live or settled, as ONE element (AIA Issue 1599).
|
|
16
|
+
*
|
|
17
|
+
* The live turn and the history used to be drawn by two different components — `CurrentMessage`
|
|
18
|
+
* after the list and `Message` inside it, the history additionally under an `InertEnvironmentProvider`.
|
|
19
|
+
* Committing a turn therefore unmounted the live element and mounted a new one for the same
|
|
20
|
+
* interaction, and every component inside remounted with it: a UI tool that fetches on mount (the
|
|
21
|
+
* attach_document card's preview) went back through its spinner as the turn ended — the "blink".
|
|
22
|
+
* UiPartStage keeps a tool's identity WITHIN a MessageAgent; this keeps the MessageAgent itself.
|
|
23
|
+
*
|
|
24
|
+
* So every wrapper here renders in both states and only its props change: the box's sx, the inert
|
|
25
|
+
* switch, the scope's `live`. Keep it that way — a wrapper that appears or disappears with `live`
|
|
26
|
+
* (or a different element type per state) brings the remount back. Callers must render the live turn
|
|
27
|
+
* in the SAME keyed array as the history, keyed by interactionId, or React will not match the two.
|
|
28
|
+
*
|
|
29
|
+
* Settled turns are inert: their live-TSX side-effect hooks (`useDashboardPad`, …) dead-end, so a
|
|
30
|
+
* session reload replays the history visually only. The live turn keeps the real environment.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ChatTurn: React.FC<ChatTurnProps>;
|
|
33
|
+
export default ChatTurn;
|
|
@@ -3,10 +3,12 @@ export interface CurrentMessageProps {
|
|
|
3
3
|
onLinkClicked?: (link: string, content: string | null) => void;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* The turn being streamed
|
|
7
|
-
* turn is open, the host's friendly mode — it reads
|
|
8
|
-
* services context; the only input is where links go.
|
|
9
|
-
*
|
|
6
|
+
* The turn being streamed, standalone — for a host that draws a live turn outside a ChatPane.
|
|
7
|
+
* Everything it needs — the message, whether the turn is open, the host's friendly mode — it reads
|
|
8
|
+
* from the store and the services context; the only input is where links go.
|
|
9
|
+
*
|
|
10
|
+
* ChatPane does NOT use this: it renders the live turn as a `ChatTurn` in the same keyed list as the
|
|
11
|
+
* history, so the turn keeps its components when it settles (AIA Issue 1599).
|
|
10
12
|
*/
|
|
11
13
|
export declare const CurrentMessage: React.FC<CurrentMessageProps>;
|
|
12
14
|
export default CurrentMessage;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Draws its children non-interactive: `inert` (no click, no focus, no keyboard), dimmed a little so it reads as
|
|
4
|
+
* something to look at. For what a read-only chat (AIA Issue 1587) must show but never let anyone act on — a
|
|
5
|
+
* question the conversation's owner is being asked. Set through a ref: React 18 does not know the attribute.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ReadOnlyGuard({ children }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { InteractionPart } from '../../../../models/InteractionPart';
|
|
3
3
|
/**
|
|
4
|
-
* Single-owner rendering for
|
|
4
|
+
* Single-owner rendering for UI tool parts (issue #325; every finished UI part since AIA Issue 1599).
|
|
5
5
|
*
|
|
6
6
|
* A UI render tool's component used to render in TWO possible React subtrees: at its
|
|
7
7
|
* stream position (MessageAgent's part list) the moment its result folded in, and later
|
|
@@ -31,10 +31,10 @@ export declare class UiPartStage {
|
|
|
31
31
|
private claims;
|
|
32
32
|
private seq;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* render pass. LlmResponseRender
|
|
36
|
-
* (the part is staged — adopt its container) and the legacy
|
|
37
|
-
* was filtered out of the positional list, or there is no stage
|
|
34
|
+
* Stage keys this stage's MessageAgent is rendering through a portal on the CURRENT
|
|
35
|
+
* render pass (see `stageKeyOf`). LlmResponseRender looks a slot id up here to decide
|
|
36
|
+
* between rendering an anchor (the part is staged — adopt its container) and the legacy
|
|
37
|
+
* direct render (the part was filtered out of the positional list, or there is no stage).
|
|
38
38
|
*/
|
|
39
39
|
stagedKeys: ReadonlySet<string>;
|
|
40
40
|
setStagedKeys(keys: Iterable<string>): void;
|
|
@@ -47,12 +47,17 @@ export declare class UiPartStage {
|
|
|
47
47
|
}
|
|
48
48
|
export declare const UiPartStageContext: React.Context<UiPartStage | null>;
|
|
49
49
|
/**
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
50
|
+
* The key a part is staged under, or undefined when the stage does not manage it: every
|
|
51
|
+
* UI-flagged function part (or ask-user part) whose RESULT has landed (status Done).
|
|
52
|
+
*
|
|
53
|
+
* A part with a SlotId is keyed by it, so a `{{Component:<slotId>}}` slot in the text can
|
|
54
|
+
* adopt it. A part WITHOUT one is staged too, under its call id (AIA Issue 1599): its
|
|
55
|
+
* positional spot sits inside the message's part groups, and the grouping changes shape
|
|
56
|
+
* when the turn closes (`groupParts(onGoing)`), which moved an unslotted tool into a new
|
|
57
|
+
* wrapper — a remount, and a refetch for a tool that loads on mount. Rendered through the
|
|
58
|
+
* stage, only its anchor moves. The `call:` prefix keeps the two key spaces apart.
|
|
54
59
|
*/
|
|
55
|
-
export declare function
|
|
60
|
+
export declare function stageKeyOf(part: InteractionPart): string | undefined;
|
|
56
61
|
/** Renders a staged part into its stable container. Call from the OWNING MessageAgent only. */
|
|
57
62
|
export declare function renderStagedPart(stage: UiPartStage, key: string, child: React.ReactNode): React.ReactNode;
|
|
58
63
|
/**
|
|
@@ -59,6 +59,12 @@ export interface UiToolContext<In = unknown, Ans = unknown> {
|
|
|
59
59
|
onGoing: boolean;
|
|
60
60
|
/** True during historical replay / preview — actions must NOT re-fire side effects. */
|
|
61
61
|
preview: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The chat is READ-ONLY (`<AiChat readOnly>`, AIA Issue 1587): someone is watching a conversation they do not
|
|
64
|
+
* own. Draw everything that informs, hide everything that would send (a select button, a submit); `answer`
|
|
65
|
+
* does nothing. Optional so a host-built context (a test, a preview) need not set it.
|
|
66
|
+
*/
|
|
67
|
+
readOnly?: boolean;
|
|
62
68
|
/**
|
|
63
69
|
* Submit the user's answer for this parked ask-user call, then let the library deliver it to the agent
|
|
64
70
|
* (via `answerHumanTool`, keyed by {@link callId}). A string is sent verbatim; anything else is
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,7 +27,14 @@ export declare function useEnvironmentOptional<T = Record<string, unknown>>(): T
|
|
|
27
27
|
* No-throw when there's no parent env: returns an empty record so
|
|
28
28
|
* `useEnvironment` consumers inside don't blow up either. That
|
|
29
29
|
* matches the "inert by default" semantics of historical replay.
|
|
30
|
+
*
|
|
31
|
+
* `enabled={false}` passes the parent environment straight through, while
|
|
32
|
+
* still rendering the provider. That lets ONE element switch from live to
|
|
33
|
+
* inert as its turn closes without changing the tree shape around its
|
|
34
|
+
* children — wrapping and unwrapping instead would remount every component in
|
|
35
|
+
* the turn (AIA Issue 1599).
|
|
30
36
|
*/
|
|
31
37
|
export declare const InertEnvironmentProvider: React.FC<{
|
|
32
38
|
children: React.ReactNode;
|
|
39
|
+
enabled?: boolean;
|
|
33
40
|
}>;
|
|
@@ -3,7 +3,7 @@ export { default as ChatPane } from './AiChat/ChatPane/ChatPane';
|
|
|
3
3
|
export { default as CurrentMessage } from './AiChat/ChatPane/CurrentMessage';
|
|
4
4
|
export { AiChatProvider } from './AiChat/AiChatProvider';
|
|
5
5
|
export { AiChatDrawer } from './AiChat/AiChatDrawer';
|
|
6
|
-
export { AiChatServiceContext, useAiChatServices, useAiChatSessionStore, } from './AiChat/AiChatContext';
|
|
6
|
+
export { AiChatServiceContext, useAiChatServices, useAiChatSessionStore, useChatReadOnly, } from './AiChat/AiChatContext';
|
|
7
7
|
export { useTurnOpen } from './AiChat/useTurnOpen';
|
|
8
8
|
export type { AiChatContextState as AiChatServices } from './AiChat/AiChatContext';
|
|
9
9
|
export type { AiChatProps, AiChatBaseProps, AiChatEngineProps, AiChatHandle, AiChatStyleProps, AiChatDrawerProps, AiChatFloatingProps, ConnectionInformation, AuthPromptContext, } from './AiChat/AiChatTypes';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AiChatEngine } from '../AiChat/aiChatEngine';
|
|
3
|
+
import { User } from '../../models/contexts';
|
|
4
|
+
import { INotificationPort } from '../../interfaces/INotificationPort';
|
|
5
|
+
import { DetachedRunFramesTransport } from '../../services/detachedRun/DetachedRunFramesTransport';
|
|
6
|
+
import { DetachedRunFetch, DetachedRunFollowError, DetachedRunFramesRetry } from '../../services/detachedRun/streamDetachedRunFrames';
|
|
7
|
+
import { DetachedRunTranscriptPresentationProps } from './DetachedRunTranscript';
|
|
8
|
+
/** Which session to watch, and with whose credentials. */
|
|
9
|
+
export interface SharedSessionTranscriptSource {
|
|
10
|
+
/** A session someone shared with the signed-in user (or one of their own). */
|
|
11
|
+
sessionId: string;
|
|
12
|
+
/** The agents server (the chat's `serverBaseUrl`). */
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
/** The HTTP layer for the frames stream — a host's authenticated `fetch` wrapper. Default: the global `fetch`. */
|
|
15
|
+
fetchImpl?: DetachedRunFetch;
|
|
16
|
+
/** The bearer, read on every (re)connect. Default: the user's `access_token`. */
|
|
17
|
+
getToken?: () => string | undefined | null | Promise<string | undefined | null>;
|
|
18
|
+
/** Called on a 401 from the frames stream: refresh and resolve true to retry once with a fresh token. */
|
|
19
|
+
onUnauthorized?: () => Promise<boolean>;
|
|
20
|
+
/** The signed-in user — whose token reads the history and the artifacts. Prefer `getUser` (read live). */
|
|
21
|
+
user?: User;
|
|
22
|
+
getUser?: () => User | undefined;
|
|
23
|
+
notificationPort?: INotificationPort;
|
|
24
|
+
retry?: DetachedRunFramesRetry;
|
|
25
|
+
}
|
|
26
|
+
export interface SharedSessionTranscriptEngine {
|
|
27
|
+
/** An ordinary chat engine over the session's history and frames — adopt it with `<AiChat engine={…}>`. */
|
|
28
|
+
engine: AiChatEngine;
|
|
29
|
+
transport: DetachedRunFramesTransport;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A chat engine that shows a SHARED conversation read-only and live (AIA Issue 1587): the ordinary engine, gateway and
|
|
33
|
+
* store, whose session record is loaded from `GET /sessions/{id}` like any reload, and whose "socket" is a
|
|
34
|
+
* {@link DetachedRunFramesTransport} over `GET /sessions/{id}/frames` — started from the history's `lastSequence`, so
|
|
35
|
+
* the turns the owner runs from now on stream in as they would on the owner's screen. Any number of viewers follow one
|
|
36
|
+
* session; none of them touches the owner's socket. Creating it touches no network; call
|
|
37
|
+
* {@link openSharedSessionTranscript} to start, `engine.dispose()` to stop.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createSharedSessionTranscriptEngine(source: SharedSessionTranscriptSource): SharedSessionTranscriptEngine;
|
|
40
|
+
/**
|
|
41
|
+
* Load the session's history, then follow its frames from where the history ends. The history load is the open's
|
|
42
|
+
* `prepare` step — it completes before the transport connects, which is what lets the transport start from the
|
|
43
|
+
* loaded `lastSequence`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function openSharedSessionTranscript({ engine }: SharedSessionTranscriptEngine, sessionId: string): Promise<void>;
|
|
46
|
+
export interface UseSharedSessionTranscriptOptions extends SharedSessionTranscriptSource {
|
|
47
|
+
/**
|
|
48
|
+
* Following stopped for good, and why — `notFound` (the session is gone, or no longer shared with the caller),
|
|
49
|
+
* `forbidden`, `unauthorized`, `gaveUp`.
|
|
50
|
+
*/
|
|
51
|
+
onError?: (error: DetachedRunFollowError) => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The engine of {@link createSharedSessionTranscriptEngine}, owned by the calling component: one per session,
|
|
55
|
+
* following from mount, stopped on unmount. For a host that mounts its own `<AiChat engine={…}>` wrapper;
|
|
56
|
+
* {@link SharedSessionTranscript} is that wrapper, ready-made.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useSharedSessionTranscript(options: UseSharedSessionTranscriptOptions): SharedSessionTranscriptEngine;
|
|
59
|
+
export interface SharedSessionTranscriptProps extends UseSharedSessionTranscriptOptions, DetachedRunTranscriptPresentationProps {
|
|
60
|
+
/** Drawn above the transcript, inside the chat's providers — where a host says whose conversation this is. */
|
|
61
|
+
header?: React.ReactNode;
|
|
62
|
+
/** Drawn under the transcript, in place of the prompt a viewer does not have. */
|
|
63
|
+
footer?: React.ReactNode;
|
|
64
|
+
/** Not accepted: the transcript builds its own engine. */
|
|
65
|
+
engine?: never;
|
|
66
|
+
/** Not accepted: a viewer speaks as nobody. */
|
|
67
|
+
agentContext?: never;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A conversation someone shared with the signed-in user, read-only and live (AIA Issue 1587): the history as the chat
|
|
71
|
+
* draws it on reload, then the owner's new turns streaming in — the user's bubbles, the agent's tool calls, cards and
|
|
72
|
+
* answer — with no prompt. Presentation props (`uiTools`, `partRenderers`, `showPersona`, …) pass through to
|
|
73
|
+
* `<AiChat>`. Give it a definite height, like `ChatPane`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function SharedSessionTranscript(props: SharedSessionTranscriptProps): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
export default SharedSessionTranscript;
|
|
@@ -45,6 +45,8 @@ export { useDetachedRunLiveActivity, canStreamDetachedRun } from './useDetachedR
|
|
|
45
45
|
export type { DetachedRunStreamAuth, DetachedRunLiveActivity } from './useDetachedRunLiveActivity';
|
|
46
46
|
export { DetachedRunTranscript, useDetachedRunTranscript, createDetachedRunTranscriptEngine, openDetachedRunTranscript, } from './DetachedRunTranscript';
|
|
47
47
|
export type { DetachedRunTranscriptProps, DetachedRunTranscriptSource, DetachedRunTranscriptEngine, DetachedRunTranscriptPresentationProps, UseDetachedRunTranscriptOptions, } from './DetachedRunTranscript';
|
|
48
|
+
export { SharedSessionTranscript, useSharedSessionTranscript, createSharedSessionTranscriptEngine, openSharedSessionTranscript, } from './SharedSessionTranscript';
|
|
49
|
+
export type { SharedSessionTranscriptProps, SharedSessionTranscriptSource, SharedSessionTranscriptEngine, UseSharedSessionTranscriptOptions, } from './SharedSessionTranscript';
|
|
48
50
|
export { useDetachedRunResumeKey } from './useDetachedRunResumeKey';
|
|
49
51
|
export type { DetachedRunBoxV2Props as DetachedRunBoxProps, DetachedRunBoxV2Props, DetachedRunBoxV2Level as DetachedRunBoxLevel, DetachedRunBoxV2Level } from './DetachedRunBoxV2';
|
|
50
52
|
export { AgentActivityV2 as AgentActivity, AgentActivityV2 } from './AgentActivityV2';
|
|
@@ -22,4 +22,10 @@ export interface ChatSession extends IDBStorable {
|
|
|
22
22
|
lastGeneratedOverview?: Date | null;
|
|
23
23
|
skillLevel?: SkillLevel;
|
|
24
24
|
sessionRunMode: RunMode;
|
|
25
|
+
/**
|
|
26
|
+
* The session's highest frame number when it was read (`GET /sessions/{id}`'s `lastSequence`): every frame at or
|
|
27
|
+
* below it is in {@link interactions}. Where a viewer of a shared session starts following its frames (AIA Issue
|
|
28
|
+
* 1587). Absent from servers that predate it.
|
|
29
|
+
*/
|
|
30
|
+
lastSequence?: number;
|
|
25
31
|
}
|
|
@@ -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
|
-
* (`
|
|
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
|
}
|
|
@@ -10,6 +10,17 @@ export interface DetachedRunFramesTransportOptions {
|
|
|
10
10
|
/** Refresh after a 401; true retries once (see `streamDetachedRunFrames`). */
|
|
11
11
|
onUnauthorized?: () => Promise<boolean>;
|
|
12
12
|
retry?: DetachedRunFramesRetry;
|
|
13
|
+
/**
|
|
14
|
+
* Whose frames `connect(id)` follows: a detached run's (default) or a shared session's (AIA Issue 1587) — see
|
|
15
|
+
* `streamDetachedRunFrames`. A session's stream never ends, so {@link DetachedRunFramesTransport.onEnd} never fires.
|
|
16
|
+
*/
|
|
17
|
+
resource?: 'detachedRun' | 'session';
|
|
18
|
+
/**
|
|
19
|
+
* Where a fresh `connect` starts following — read at that moment. A shared session's viewer draws the history
|
|
20
|
+
* first (`GET /sessions/{id}`) and follows from its `lastSequence`, so it neither repeats nor misses a frame.
|
|
21
|
+
* Default 0: the run's whole history.
|
|
22
|
+
*/
|
|
23
|
+
initialAfterSeq?: () => number | undefined;
|
|
13
24
|
}
|
|
14
25
|
/**
|
|
15
26
|
* A read-only {@link IWebSocketConnection} over a detached run's frames stream (AIA Issue 1548, phase 5) — what lets
|
|
@@ -38,7 +38,14 @@ export interface DetachedRunFramesRetry {
|
|
|
38
38
|
export interface StreamDetachedRunFramesOptions {
|
|
39
39
|
/** The agents server the run lives on (the same base URL the chat socket dials). */
|
|
40
40
|
baseUrl: string;
|
|
41
|
+
/** The run — or, with `resource: 'session'`, the session — whose frames to follow. */
|
|
41
42
|
runId: string;
|
|
43
|
+
/**
|
|
44
|
+
* Whose frames: a detached run's (`GET /detached-runs/{id}/frames`, the default) or a shared session's
|
|
45
|
+
* (`GET /sessions/{id}/frames`, AIA Issue 1587). A session's stream has no last turn — the server never ends it —
|
|
46
|
+
* so every close is a drop and is reconnected, and `onEnd` never fires.
|
|
47
|
+
*/
|
|
48
|
+
resource?: 'detachedRun' | 'session';
|
|
42
49
|
/** The HTTP layer. Default: the global `fetch`. */
|
|
43
50
|
fetchImpl?: DetachedRunFetch;
|
|
44
51
|
/** The bearer token, read before EVERY request so a refreshed token is picked up on a reconnect. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
2
|
var d = (e, t) => L(e, "name", { value: t, configurable: !0 });
|
|
3
3
|
import { useMemo as h, useState as v, useCallback as g, useEffect as C } from "react";
|
|
4
|
-
import { H } from "./httpSessionService-
|
|
4
|
+
import { H } from "./httpSessionService-BIkDesYB.js";
|
|
5
5
|
const w = 6e4, y = 60 * w, l = 24 * y;
|
|
6
6
|
function k(e) {
|
|
7
7
|
if (!e) return;
|
|
@@ -104,4 +104,4 @@ d(Y, "useChatSessions");
|
|
|
104
104
|
export {
|
|
105
105
|
Y as u
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=useChatSessions-
|
|
107
|
+
//# sourceMappingURL=useChatSessions-CyFKVtkk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatSessions-DwqgYo79.js","sources":["../src/hooks/useChatSessions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { ChatSession } from '@lib/models/ChatSession';\nimport type { ISessionService } from '@lib/services/servers/sessionService/ISessionService';\nimport { HttpSessionService } from '../services';\n\n/**\n * One row in a session-picker UI. `raw` is the original ChatSession the\n * server returned; everything else is a derived label the hook computed\n * (and the host's `decorate` callback may have overridden).\n */\nexport interface ChatSessionListItem {\n id: string;\n title: string;\n snippet?: string;\n /** Compact relative-time label (\"now\", \"5m\", \"2h\", \"Mar 14\"). */\n timeLabel?: string;\n /** Optional per-row tag — host-supplied via the `decorate` callback. */\n kind?: string;\n updatedAt?: Date;\n raw: ChatSession;\n}\n\n/**\n * Sessions bucketed by recency. The order of `label` reflects display\n * order top-down (\"Today\" first, \"Older\" last).\n */\nexport interface ChatSessionGroup {\n label: string;\n items: ChatSessionListItem[];\n}\n\nexport interface UseChatSessionsOptions {\n sessionService?: ISessionService;\n /**\n * If provided, the live (current) session is merged into the list —\n * replacing an existing entry by id, or prepended if not yet on the\n * server. Lets a \"New chat\" row appear instantly without waiting for\n * the server roundtrip.\n */\n liveSession?: ChatSession | null;\n\n accessToken: string,\n serverBaseUrl: string,\n /**\n * Per-row override hook. Whatever fields you return are merged on top\n * of the hook's computed item — typical use is adding a `kind` tag for\n * application-specific session types (`'chat' | 'composer' | ...`) the\n * library doesn't know about.\n */\n decorate?: (session: ChatSession) => Partial<ChatSessionListItem>;\n}\n\nexport interface UseChatSessionsResult {\n /** Flat list (live session merged in, server order preserved). */\n sessions: ChatSession[];\n /** Same data bucketed by recency. */\n groups: ChatSessionGroup[];\n isLoading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n /** Optimistic rename — patches local state immediately, rolls back on failure. */\n rename: (id: string, title: string) => Promise<void>;\n /** Optimistic remove — drops from local state immediately, rolls back on failure. */\n remove: (id: string) => Promise<void>;\n}\n\nconst MINUTE_MS = 60_000;\nconst HOUR_MS = 60 * MINUTE_MS;\nconst DAY_MS = 24 * HOUR_MS;\n\nfunction toDate(value: Date | string | undefined | null): Date | undefined {\n if (!value) return undefined;\n if (value instanceof Date) return value;\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? undefined : d;\n}\n\nfunction formatTimeLabel(date: Date | undefined): string {\n if (!date) return '';\n const diff = Date.now() - date.getTime();\n if (diff < MINUTE_MS) return 'now';\n if (diff < HOUR_MS) return `${Math.floor(diff / MINUTE_MS)}m`;\n if (diff < DAY_MS) return `${Math.floor(diff / HOUR_MS)}h`;\n if (diff < 7 * DAY_MS) return `${Math.floor(diff / DAY_MS)}d`;\n return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n}\n\nfunction startOfToday(): Date {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nfunction groupByTime(items: ChatSessionListItem[]): ChatSessionGroup[] {\n const today = startOfToday();\n const yesterday = new Date(today.getTime() - DAY_MS);\n const weekAgo = new Date(today.getTime() - 7 * DAY_MS);\n const monthAgo = new Date(today.getTime() - 30 * DAY_MS);\n\n // Insertion-ordered map preserves the bucket display order.\n const buckets: Array<[string, ChatSessionListItem[]]> = [\n ['Today', []],\n ['Yesterday', []],\n ['This Week', []],\n ['This Month', []],\n ['Older', []],\n ];\n\n for (const item of items) {\n const u = item.updatedAt;\n if (!u) { buckets[4][1].push(item); continue; }\n if (u >= today) buckets[0][1].push(item);\n else if (u >= yesterday) buckets[1][1].push(item);\n else if (u >= weekAgo) buckets[2][1].push(item);\n else if (u >= monthAgo) buckets[3][1].push(item);\n else buckets[4][1].push(item);\n }\n\n return buckets\n .filter(([, list]) => list.length > 0)\n .map(([label, list]) => ({ label, items: list }));\n}\n\nfunction buildItem(\n session: ChatSession,\n decorate?: (s: ChatSession) => Partial<ChatSessionListItem>,\n): ChatSessionListItem {\n const updatedAt = toDate(session.updatedAt) ?? toDate(session.created);\n const base: ChatSessionListItem = {\n id: session.id ?? session.browserScopeId ?? '',\n title: session.overview || session.userDescription || '(untitled chat)',\n snippet: session.lastQuestion ?? undefined,\n timeLabel: formatTimeLabel(updatedAt),\n kind: session.agentType as string | undefined,\n updatedAt,\n raw: session,\n };\n return { ...base, ...(decorate?.(session) ?? {}) };\n}\n\n/**\n * Fetch + organise the user's chat sessions for a picker UI. Backend-agnostic\n * — the host injects an `ISessionService` so the same hook drives an HTTP\n * client, an in-memory fake, or whatever else.\n *\n * Replaces the duplicated `useEffect(async () => sessionService.getAllSessions())`\n * + grouping logic that lived in DataExplorerViewV2 and MobileSessionsList,\n * and consolidates the optimistic rename/delete pattern.\n */\nexport function useChatSessions(opts: UseChatSessionsOptions): UseChatSessionsResult {\n\n const defaultSessionService = useMemo(() => {\n return new HttpSessionService(opts.serverBaseUrl, opts.accessToken);\n }, [opts.accessToken, opts.serverBaseUrl]);\n\n const { sessionService, liveSession, decorate } = {\n sessionService: defaultSessionService,\n liveSession: opts.liveSession,\n decorate: opts.decorate\n };\n const [sessions, setSessions] = useState<ChatSession[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n\n const refresh = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n try {\n const list = await sessionService.getAllSessions();\n setSessions(list);\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [sessionService]);\n\n useEffect(() => { void refresh(); }, [refresh]);\n\n const merged = useMemo(() => {\n if (!liveSession?.id) return sessions;\n const idx = sessions.findIndex(s => s.id === liveSession.id);\n if (idx === -1) return [liveSession, ...sessions];\n const copy = sessions.slice();\n copy[idx] = liveSession;\n return copy;\n }, [sessions, liveSession]);\n\n const items = useMemo(\n () => merged.map(s => buildItem(s, decorate)),\n [merged, decorate],\n );\n\n const groups = useMemo(() => groupByTime(items), [items]);\n\n const rename = useCallback(async (id: string, title: string) => {\n setSessions(current =>\n current.map(s => (s.id === id ? { ...s, overview: title } : s)),\n );\n try {\n await sessionService.patchSession(id, { overview: title });\n } catch (err) {\n console.error('[useChatSessions] rename failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n const remove = useCallback(async (id: string) => {\n setSessions(current => current.filter(s => s.id !== id));\n try {\n await sessionService.removeSession(id);\n } catch (err) {\n console.error('[useChatSessions] remove failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n return { sessions: merged, groups, isLoading, error, refresh, rename, remove };\n}\n"],"names":["MINUTE_MS","HOUR_MS","DAY_MS","toDate","value","d","__name","formatTimeLabel","date","diff","startOfToday","groupByTime","items","today","yesterday","weekAgo","monthAgo","buckets","item","u","list","label","buildItem","session","decorate","updatedAt","useChatSessions","opts","defaultSessionService","useMemo","HttpSessionService","sessionService","liveSession","sessions","setSessions","useState","isLoading","setIsLoading","error","setError","refresh","useCallback","err","useEffect","merged","idx","s","copy","groups","rename","id","title","current","remove"],"mappings":";;;;AAkEA,MAAMA,IAAY,KACZC,IAAU,KAAKD,GACfE,IAAS,KAAKD;AAEpB,SAASE,EAAOC,GAA2D;AACvE,MAAI,CAACA,EAAO;AACZ,MAAIA,aAAiB,KAAM,QAAOA;AAClC,QAAMC,IAAI,IAAI,KAAKD,CAAK;AACxB,SAAO,OAAO,MAAMC,EAAE,QAAA,CAAS,IAAI,SAAYA;AACnD;AALSC,EAAAH,GAAA;AAOT,SAASI,EAAgBC,GAAgC;AACrD,MAAI,CAACA,EAAM,QAAO;AAClB,QAAMC,IAAO,KAAK,IAAA,IAAQD,EAAK,QAAA;AAC/B,SAAIC,IAAOT,IAAkB,QACzBS,IAAOR,IAAgB,GAAG,KAAK,MAAMQ,IAAOT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AAe;AAC7C,IAAAhB,EAAY,OAAWkB,EAAQ,OAAO,OAAKN,EAAE,OAAOI,CAAE,CAAC;AACvD,QAAI;AACA,YAAMnB,EAAe,cAAcmB,CAAE;AAAA,IACzC,SAASR,GAAK;AACV,cAAQ,MAAM,6DAA6DA,CAAG,GACzEF,EAAA;AAAA,IACT;AAAA,EACJ,GAAG,CAACT,GAAgBS,CAAO,CAAC;AAE5B,SAAO,EAAE,UAAUI,GAAQ,QAAAI,GAAQ,WAAAZ,GAAW,OAAAE,GAAO,SAAAE,GAAS,QAAAS,GAAQ,QAAAI,EAAA;AAC1E;AAtEgB/C,EAAAoB,GAAA;"}
|
|
1
|
+
{"version":3,"file":"useChatSessions-CyFKVtkk.js","sources":["../src/hooks/useChatSessions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { ChatSession } from '@lib/models/ChatSession';\nimport type { ISessionService } from '@lib/services/servers/sessionService/ISessionService';\nimport { HttpSessionService } from '../services';\n\n/**\n * One row in a session-picker UI. `raw` is the original ChatSession the\n * server returned; everything else is a derived label the hook computed\n * (and the host's `decorate` callback may have overridden).\n */\nexport interface ChatSessionListItem {\n id: string;\n title: string;\n snippet?: string;\n /** Compact relative-time label (\"now\", \"5m\", \"2h\", \"Mar 14\"). */\n timeLabel?: string;\n /** Optional per-row tag — host-supplied via the `decorate` callback. */\n kind?: string;\n updatedAt?: Date;\n raw: ChatSession;\n}\n\n/**\n * Sessions bucketed by recency. The order of `label` reflects display\n * order top-down (\"Today\" first, \"Older\" last).\n */\nexport interface ChatSessionGroup {\n label: string;\n items: ChatSessionListItem[];\n}\n\nexport interface UseChatSessionsOptions {\n sessionService?: ISessionService;\n /**\n * If provided, the live (current) session is merged into the list —\n * replacing an existing entry by id, or prepended if not yet on the\n * server. Lets a \"New chat\" row appear instantly without waiting for\n * the server roundtrip.\n */\n liveSession?: ChatSession | null;\n\n accessToken: string,\n serverBaseUrl: string,\n /**\n * Per-row override hook. Whatever fields you return are merged on top\n * of the hook's computed item — typical use is adding a `kind` tag for\n * application-specific session types (`'chat' | 'composer' | ...`) the\n * library doesn't know about.\n */\n decorate?: (session: ChatSession) => Partial<ChatSessionListItem>;\n}\n\nexport interface UseChatSessionsResult {\n /** Flat list (live session merged in, server order preserved). */\n sessions: ChatSession[];\n /** Same data bucketed by recency. */\n groups: ChatSessionGroup[];\n isLoading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n /** Optimistic rename — patches local state immediately, rolls back on failure. */\n rename: (id: string, title: string) => Promise<void>;\n /** Optimistic remove — drops from local state immediately, rolls back on failure. */\n remove: (id: string) => Promise<void>;\n}\n\nconst MINUTE_MS = 60_000;\nconst HOUR_MS = 60 * MINUTE_MS;\nconst DAY_MS = 24 * HOUR_MS;\n\nfunction toDate(value: Date | string | undefined | null): Date | undefined {\n if (!value) return undefined;\n if (value instanceof Date) return value;\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? undefined : d;\n}\n\nfunction formatTimeLabel(date: Date | undefined): string {\n if (!date) return '';\n const diff = Date.now() - date.getTime();\n if (diff < MINUTE_MS) return 'now';\n if (diff < HOUR_MS) return `${Math.floor(diff / MINUTE_MS)}m`;\n if (diff < DAY_MS) return `${Math.floor(diff / HOUR_MS)}h`;\n if (diff < 7 * DAY_MS) return `${Math.floor(diff / DAY_MS)}d`;\n return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n}\n\nfunction startOfToday(): Date {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nfunction groupByTime(items: ChatSessionListItem[]): ChatSessionGroup[] {\n const today = startOfToday();\n const yesterday = new Date(today.getTime() - DAY_MS);\n const weekAgo = new Date(today.getTime() - 7 * DAY_MS);\n const monthAgo = new Date(today.getTime() - 30 * DAY_MS);\n\n // Insertion-ordered map preserves the bucket display order.\n const buckets: Array<[string, ChatSessionListItem[]]> = [\n ['Today', []],\n ['Yesterday', []],\n ['This Week', []],\n ['This Month', []],\n ['Older', []],\n ];\n\n for (const item of items) {\n const u = item.updatedAt;\n if (!u) { buckets[4][1].push(item); continue; }\n if (u >= today) buckets[0][1].push(item);\n else if (u >= yesterday) buckets[1][1].push(item);\n else if (u >= weekAgo) buckets[2][1].push(item);\n else if (u >= monthAgo) buckets[3][1].push(item);\n else buckets[4][1].push(item);\n }\n\n return buckets\n .filter(([, list]) => list.length > 0)\n .map(([label, list]) => ({ label, items: list }));\n}\n\nfunction buildItem(\n session: ChatSession,\n decorate?: (s: ChatSession) => Partial<ChatSessionListItem>,\n): ChatSessionListItem {\n const updatedAt = toDate(session.updatedAt) ?? toDate(session.created);\n const base: ChatSessionListItem = {\n id: session.id ?? session.browserScopeId ?? '',\n title: session.overview || session.userDescription || '(untitled chat)',\n snippet: session.lastQuestion ?? undefined,\n timeLabel: formatTimeLabel(updatedAt),\n kind: session.agentType as string | undefined,\n updatedAt,\n raw: session,\n };\n return { ...base, ...(decorate?.(session) ?? {}) };\n}\n\n/**\n * Fetch + organise the user's chat sessions for a picker UI. Backend-agnostic\n * — the host injects an `ISessionService` so the same hook drives an HTTP\n * client, an in-memory fake, or whatever else.\n *\n * Replaces the duplicated `useEffect(async () => sessionService.getAllSessions())`\n * + grouping logic that lived in DataExplorerViewV2 and MobileSessionsList,\n * and consolidates the optimistic rename/delete pattern.\n */\nexport function useChatSessions(opts: UseChatSessionsOptions): UseChatSessionsResult {\n\n const defaultSessionService = useMemo(() => {\n return new HttpSessionService(opts.serverBaseUrl, opts.accessToken);\n }, [opts.accessToken, opts.serverBaseUrl]);\n\n const { sessionService, liveSession, decorate } = {\n sessionService: defaultSessionService,\n liveSession: opts.liveSession,\n decorate: opts.decorate\n };\n const [sessions, setSessions] = useState<ChatSession[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n\n const refresh = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n try {\n const list = await sessionService.getAllSessions();\n setSessions(list);\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [sessionService]);\n\n useEffect(() => { void refresh(); }, [refresh]);\n\n const merged = useMemo(() => {\n if (!liveSession?.id) return sessions;\n const idx = sessions.findIndex(s => s.id === liveSession.id);\n if (idx === -1) return [liveSession, ...sessions];\n const copy = sessions.slice();\n copy[idx] = liveSession;\n return copy;\n }, [sessions, liveSession]);\n\n const items = useMemo(\n () => merged.map(s => buildItem(s, decorate)),\n [merged, decorate],\n );\n\n const groups = useMemo(() => groupByTime(items), [items]);\n\n const rename = useCallback(async (id: string, title: string) => {\n setSessions(current =>\n current.map(s => (s.id === id ? { ...s, overview: title } : s)),\n );\n try {\n await sessionService.patchSession(id, { overview: title });\n } catch (err) {\n console.error('[useChatSessions] rename failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n const remove = useCallback(async (id: string) => {\n setSessions(current => current.filter(s => s.id !== id));\n try {\n await sessionService.removeSession(id);\n } catch (err) {\n console.error('[useChatSessions] remove failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n return { sessions: merged, groups, isLoading, error, refresh, rename, remove };\n}\n"],"names":["MINUTE_MS","HOUR_MS","DAY_MS","toDate","value","d","__name","formatTimeLabel","date","diff","startOfToday","groupByTime","items","today","yesterday","weekAgo","monthAgo","buckets","item","u","list","label","buildItem","session","decorate","updatedAt","useChatSessions","opts","defaultSessionService","useMemo","HttpSessionService","sessionService","liveSession","sessions","setSessions","useState","isLoading","setIsLoading","error","setError","refresh","useCallback","err","useEffect","merged","idx","s","copy","groups","rename","id","title","current","remove"],"mappings":";;;;AAkEA,MAAMA,IAAY,KACZC,IAAU,KAAKD,GACfE,IAAS,KAAKD;AAEpB,SAASE,EAAOC,GAA2D;AACvE,MAAI,CAACA,EAAO;AACZ,MAAIA,aAAiB,KAAM,QAAOA;AAClC,QAAMC,IAAI,IAAI,KAAKD,CAAK;AACxB,SAAO,OAAO,MAAMC,EAAE,QAAA,CAAS,IAAI,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ElE,QAAI;AACA,YAAMf,EAAe,aAAamB,GAAI,EAAE,UAAUC,GAAO;AAAA,IAC7D,SAAST,GAAK;AACV,cAAQ,MAAM,6DAA6DA,CAAG,GACzEF,EAAA;AAAA,IACT;AAAA,EACJ,GAAG,CAACT,GAAgBS,CAAO,CAAC,GAEtBa,IAASZ,EAAY,OAAOS,MAAe;AAC7C,IAAAhB,EAAY,OAAWkB,EAAQ,OAAO,OAAKN,EAAE,OAAOI,CAAE,CAAC;AACvD,QAAI;AACA,YAAMnB,EAAe,cAAcmB,CAAE;AAAA,IACzC,SAASR,GAAK;AACV,cAAQ,MAAM,6DAA6DA,CAAG,GACzEF,EAAA;AAAA,IACT;AAAA,EACJ,GAAG,CAACT,GAAgBS,CAAO,CAAC;AAE5B,SAAO,EAAE,UAAUI,GAAQ,QAAAI,GAAQ,WAAAZ,GAAW,OAAAE,GAAO,SAAAE,GAAS,QAAAS,GAAQ,QAAAI,EAAA;AAC1E;AAtEgB/C,EAAAoB,GAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aintela/chat",
|
|
3
|
-
"version": "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
|
},
|