@aintela/chat 0.7.0 → 0.9.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/components.js +10016 -8911
- package/dist/components.js.map +1 -1
- package/dist/{detachedRunActivity-CjyFTKSw.js → detachedRunActivity-jHa9SDv1.js} +225 -203
- package/dist/detachedRunActivity-jHa9SDv1.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/{httpSessionService-Ckb9Cxia.js → httpSessionService-BIkDesYB.js} +32 -31
- package/dist/{httpSessionService-Ckb9Cxia.js.map → httpSessionService-BIkDesYB.js.map} +1 -1
- package/dist/index.js +297 -264
- package/dist/models.js +1 -1
- package/dist/{serializer-DNUH6kgE.js → serializer-DvR3nOcf.js} +786 -717
- package/dist/serializer-DvR3nOcf.js.map +1 -0
- package/dist/services.js +2 -2
- package/dist/src/components/AgentTeam/BillingLimitBanner.d.ts +7 -0
- package/dist/src/components/AgentTeam/ChatAgentHeader.d.ts +34 -0
- package/dist/src/components/AgentTeam/HandoffDivider.d.ts +13 -0
- package/dist/src/components/AgentTeam/PersonaAvatar.d.ts +20 -0
- package/dist/src/components/AgentTeam/__tests__/agentTeam.test.d.ts +0 -0
- package/dist/src/components/AgentTeam/__tests__/billingLimit.test.d.ts +0 -0
- package/dist/src/components/AgentTeam/__tests__/messagePersona.test.d.ts +0 -0
- package/dist/src/components/AgentTeam/agentRoles.d.ts +33 -0
- package/dist/src/components/AgentTeam/chatAgent.d.ts +24 -0
- package/dist/src/components/AgentTeam/index.d.ts +7 -0
- package/dist/src/components/AgentTeam/personas.d.ts +60 -0
- package/dist/src/components/AiChat/AiChatContext.d.ts +15 -0
- package/dist/src/components/AiChat/AiChatTypes.d.ts +16 -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/AiChat/stateConfiguration.d.ts +7 -0
- package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +7 -0
- package/dist/src/components/index.d.ts +2 -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 +11 -0
- package/dist/src/models/ServerEvent.d.ts +3 -0
- package/dist/src/models/billingLimit.d.ts +23 -0
- package/dist/src/models/index.d.ts +2 -1
- package/dist/src/models/semanticKernelModel/models.d.ts +19 -1
- package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +2 -0
- package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +3 -0
- package/dist/src/services/detachedRun/DetachedRunFramesTransport.d.ts +11 -0
- package/dist/src/services/detachedRun/streamDetachedRunFrames.d.ts +7 -0
- package/dist/{useChatSessions-aTjNcj8q.js → useChatSessions-CyFKVtkk.js} +2 -2
- package/dist/{useChatSessions-aTjNcj8q.js.map → useChatSessions-CyFKVtkk.js.map} +1 -1
- package/package.json +1 -1
- package/dist/detachedRunActivity-CjyFTKSw.js.map +0 -1
- package/dist/serializer-DNUH6kgE.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BillingLimitNotice } from '../../models/billingLimit';
|
|
1
2
|
import { ComponentType, ReactNode } from 'react';
|
|
2
3
|
import { AgentGatewayService } from '../../services/servers/AgentGatewayService';
|
|
3
4
|
import { EventBusService } from '../../services/eventBusService';
|
|
@@ -32,6 +33,8 @@ export interface AiChatContextState {
|
|
|
32
33
|
showSessionInfo: boolean;
|
|
33
34
|
showConnectionState: boolean;
|
|
34
35
|
hidePromptInput: boolean;
|
|
36
|
+
/** The chat sends nothing — see `AiChatBaseProps.readOnly`. */
|
|
37
|
+
readOnly?: boolean;
|
|
35
38
|
/** DEVELOPMENT ONLY — a key that paints the phantom ghost at the caret (see PromptAssistOptions.debugGhostKey). */
|
|
36
39
|
promptGhostDebugKey?: string;
|
|
37
40
|
/**
|
|
@@ -101,7 +104,12 @@ export interface AiChatContextState {
|
|
|
101
104
|
label: string;
|
|
102
105
|
initials?: string;
|
|
103
106
|
picture?: string;
|
|
107
|
+
personaId?: string;
|
|
104
108
|
};
|
|
109
|
+
/** Draw the account's BillingLimit notice above the composer (default true). See AiChatProps.showBillingLimit. */
|
|
110
|
+
showBillingLimit?: boolean;
|
|
111
|
+
/** Host renderer for the BillingLimit notice. See AiChatProps.renderBillingLimit. */
|
|
112
|
+
renderBillingLimit?: (notice: BillingLimitNotice, dismiss: () => void) => ReactNode;
|
|
105
113
|
/** Custom renderer for the user-message body (the persona row is still shown above it). */
|
|
106
114
|
userMessageRenderer?: ComponentType<UserMessageRendererProps>;
|
|
107
115
|
/** Badge words per turn origin (see AiChatProps.interactionOriginLabels). */
|
|
@@ -110,4 +118,11 @@ export interface AiChatContextState {
|
|
|
110
118
|
}
|
|
111
119
|
export declare const AiChatServiceContext: import('react').Context<AiChatContextState | undefined>;
|
|
112
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;
|
|
113
128
|
export declare function useAiChatSessionStore<T>(selector: (state: AiChatState) => T): T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BillingLimitNotice } from '../../models/billingLimit';
|
|
1
2
|
import { default as React } from 'react';
|
|
2
3
|
import { Interaction, InteractionOrigin } from '../../models/Interaction';
|
|
3
4
|
import { ChatSession } from '../../models/ChatSession';
|
|
@@ -181,6 +182,12 @@ export interface AiChatBaseProps extends AiChatStyleProps {
|
|
|
181
182
|
* a pure transcript. Defaults to `false`.
|
|
182
183
|
*/
|
|
183
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;
|
|
184
191
|
/**
|
|
185
192
|
* DEVELOPMENT ONLY. A single character (the demo pages use `|`) that the composer swallows and answers with
|
|
186
193
|
* the phantom "@ …" ghost at the caret — location on the first press, person on the next — so the ghost can
|
|
@@ -288,7 +295,16 @@ export interface AiChatBaseProps extends AiChatStyleProps {
|
|
|
288
295
|
label: string;
|
|
289
296
|
initials?: string;
|
|
290
297
|
picture?: string;
|
|
298
|
+
personaId?: string;
|
|
291
299
|
};
|
|
300
|
+
/**
|
|
301
|
+
* Equipe de agentes: draw the account's plan notice (the server's out-of-band BillingLimit part — free plan,
|
|
302
|
+
* team near or at its limit, renewal declined) above the composer. Default true; a server that sends no such
|
|
303
|
+
* part shows nothing either way.
|
|
304
|
+
*/
|
|
305
|
+
showBillingLimit?: boolean;
|
|
306
|
+
/** Replace the built-in BillingLimit banner. `dismiss` hides it until the notice changes. */
|
|
307
|
+
renderBillingLimit?: (notice: BillingLimitNotice, dismiss: () => void) => React.ReactNode;
|
|
292
308
|
/**
|
|
293
309
|
* Custom renderer for the BODY of a user message. The persona row (when `showPersona`) still
|
|
294
310
|
* shows above it — this only replaces the default question bubble/icon, e.g. to render plain
|
|
@@ -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 {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BillingLimitNotice } from '../../models/billingLimit';
|
|
1
2
|
import { ChatSession } from '../../models/ChatSession';
|
|
2
3
|
import { Interaction } from '../../models/Interaction';
|
|
3
4
|
import { ConnectionState } from '../../models/connectionState';
|
|
@@ -63,6 +64,11 @@ export interface AiChatState {
|
|
|
63
64
|
* the outage interrupts — and a host can draw its own affordance from it anywhere.
|
|
64
65
|
*/
|
|
65
66
|
connectionOutage: ConnectionOutage | null;
|
|
67
|
+
/**
|
|
68
|
+
* Where the account's plan stands (Equipe de agentes), from the server's out-of-band BillingLimit part — the
|
|
69
|
+
* latest one wins. Null until the server says something. Drawn above the composer.
|
|
70
|
+
*/
|
|
71
|
+
billingLimit: BillingLimitNotice | null;
|
|
66
72
|
statistics?: InteractionStatistics;
|
|
67
73
|
connectionStatus: ConnectionState;
|
|
68
74
|
lastToolEvent?: ToolEventDetails;
|
|
@@ -84,6 +90,7 @@ export interface AiChatState {
|
|
|
84
90
|
setTurnOpen: (status: boolean) => void;
|
|
85
91
|
setSuspendState: (status: SuspendState) => void;
|
|
86
92
|
setConnectionOutage: (outage: ConnectionOutage | null) => void;
|
|
93
|
+
setBillingLimit: (notice: BillingLimitNotice | null) => void;
|
|
87
94
|
setConnectionStatus: (status: ConnectionState) => void;
|
|
88
95
|
setDetachedRunMessage: (detachedRunId: string, interaction: Interaction, name?: string) => void;
|
|
89
96
|
completeDetachedRun: (detachedRunId: string) => void;
|
|
@@ -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';
|
|
@@ -51,3 +51,4 @@ export type { ContentBlock } from './LlmResponseRender';
|
|
|
51
51
|
export * from './v2';
|
|
52
52
|
export { MessageScopeProvider, useMessageScope } from './AiChat/ChatPane/MessageScope';
|
|
53
53
|
export type { MessageScope } from './AiChat/ChatPane/MessageScope';
|
|
54
|
+
export * from './AgentTeam';
|
|
@@ -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
|
}
|
|
@@ -13,6 +13,15 @@ export interface TurnOpenCloseDetails {
|
|
|
13
13
|
stack: string[];
|
|
14
14
|
turnClosed: boolean;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
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
|
|
19
|
+
* name a persona this client build does not know yet, and the renderer falls back to the generic agent.
|
|
20
|
+
*/
|
|
21
|
+
export interface ChatAgentIdentity {
|
|
22
|
+
personaId: string;
|
|
23
|
+
role: string;
|
|
24
|
+
}
|
|
16
25
|
export interface Interaction {
|
|
17
26
|
isSuspended?: boolean;
|
|
18
27
|
created: Date;
|
|
@@ -39,4 +48,6 @@ export interface Interaction {
|
|
|
39
48
|
functionMap?: Map<string, InteractionPart>;
|
|
40
49
|
contextStatus?: any;
|
|
41
50
|
taskLists?: Map<string, string>;
|
|
51
|
+
/** Who answered this turn. Sticky: once a turn names its agent, later events without one keep it. */
|
|
52
|
+
agent?: ChatAgentIdentity;
|
|
42
53
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventType } from './enums';
|
|
2
2
|
import { InteractionPart } from './InteractionPart';
|
|
3
3
|
import { EndMessageData } from './EndMessageData';
|
|
4
|
+
import { ChatAgentIdentity } from './Interaction';
|
|
4
5
|
import { KernelContent, LlmArtifact, LlmEvent, PartType, SessionInformation, StreamingKernelContent } from './semanticKernelModel/models';
|
|
5
6
|
export interface FunctionDetails {
|
|
6
7
|
id: string;
|
|
@@ -129,6 +130,8 @@ export declare class ServerEvent {
|
|
|
129
130
|
session_information?: SessionInformation;
|
|
130
131
|
detachedRunId?: string;
|
|
131
132
|
detachedRunName?: string;
|
|
133
|
+
/** The named agent answering this turn, when the server stamps one (Equipe de agentes). */
|
|
134
|
+
agent?: ChatAgentIdentity;
|
|
132
135
|
visible: boolean;
|
|
133
136
|
constructor(interactionId: string);
|
|
134
137
|
static createErrorEvent(errorMessage: string, interactionId: string): ServerEvent;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the account's plan stands (Equipe de agentes) — what the server's BillingLimit part says. Session-level state:
|
|
3
|
+
* the agents server sends it out of band on connect (no turn) and at a turn's start. Held in
|
|
4
|
+
* `AiChatState.billingLimit`; the chat draws it as a banner above the composer (or the host's `renderBillingLimit`).
|
|
5
|
+
*/
|
|
6
|
+
export interface BillingLimitNotice {
|
|
7
|
+
/** `free` (no hired agent) or `team`. */
|
|
8
|
+
plan: string;
|
|
9
|
+
/** `ok`, `a70`, `a90`, `temp`, `full`, `hold` or `pastdue`. */
|
|
10
|
+
state: string;
|
|
11
|
+
used: number;
|
|
12
|
+
included: number;
|
|
13
|
+
/** True when the next trip would not be issued without a hire. */
|
|
14
|
+
limitReached: boolean;
|
|
15
|
+
/** True when this user can act on it (hire, update the card). */
|
|
16
|
+
canManage: boolean;
|
|
17
|
+
title?: string;
|
|
18
|
+
message?: string;
|
|
19
|
+
/** A host route where the user acts on it. */
|
|
20
|
+
actionUrl?: string;
|
|
21
|
+
/** The turn it came with; empty for a notice sent on connect. */
|
|
22
|
+
interactionId?: string;
|
|
23
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export type { Interaction, TurnOpenCloseDetails, InteractionOrigin } from './Interaction';
|
|
1
|
+
export type { Interaction, TurnOpenCloseDetails, InteractionOrigin, ChatAgentIdentity } from './Interaction';
|
|
2
2
|
export { toInteractionOrigin } from './Interaction';
|
|
3
|
+
export type { BillingLimitNotice } from './billingLimit';
|
|
3
4
|
export type { InteractionPart } from './InteractionPart';
|
|
4
5
|
export { InteractionPartUtils } from './InteractionPart';
|
|
5
6
|
export type { ChatSession } from './ChatSession';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Artifact } from '../../models/Artifact';
|
|
2
|
-
export type PartType = 'ToolEventContent' | 'StreamingToolEventContent' | 'TextContent' | 'StreamingFinalFunctionCallContent' | 'StreamingFinalFunctionResultContent' | 'StreamingClientOutputContent' | 'StreamingReasoningContent' | 'StreamingThoughtHighlightContent' | 'ImageContent' | 'FunctionCallContent' | 'FunctionResultContent' | 'FunctionClientOutputContent' | 'UserUiContent' | 'InteractionOriginContent' | 'ChatMessageContent' | 'StreamingTextContent' | 'StreamingFunctionCallUpdateContent' | 'Unknown';
|
|
2
|
+
export type PartType = 'ToolEventContent' | 'StreamingToolEventContent' | 'TextContent' | 'StreamingFinalFunctionCallContent' | 'StreamingFinalFunctionResultContent' | 'StreamingClientOutputContent' | 'StreamingReasoningContent' | 'StreamingThoughtHighlightContent' | 'ImageContent' | 'FunctionCallContent' | 'FunctionResultContent' | 'FunctionClientOutputContent' | 'UserUiContent' | 'InteractionOriginContent' | 'BillingLimitContent' | 'ChatMessageContent' | 'StreamingTextContent' | 'StreamingFunctionCallUpdateContent' | 'Unknown';
|
|
3
3
|
export declare const PartType: {
|
|
4
4
|
readonly TextContent: "TextContent";
|
|
5
5
|
readonly ToolEventContent: "ToolEventContent";
|
|
@@ -12,6 +12,7 @@ export declare const PartType: {
|
|
|
12
12
|
readonly FunctionClientOutputContent: "FunctionClientOutputContent";
|
|
13
13
|
readonly UserUiContent: "UserUiContent";
|
|
14
14
|
readonly InteractionOriginContent: "InteractionOriginContent";
|
|
15
|
+
readonly BillingLimitContent: "BillingLimitContent";
|
|
15
16
|
readonly ChatMessageContent: "ChatMessageContent";
|
|
16
17
|
readonly StreamingTextContent: "StreamingTextContent";
|
|
17
18
|
readonly StreamingFunctionCallUpdateContent: "StreamingFunctionCallUpdateContent";
|
|
@@ -123,6 +124,17 @@ export declare class UserUiContent extends KernelContent {
|
|
|
123
124
|
export declare class InteractionOriginContent extends KernelContent {
|
|
124
125
|
origin?: string;
|
|
125
126
|
}
|
|
127
|
+
export declare class BillingLimitContent extends KernelContent {
|
|
128
|
+
plan?: string;
|
|
129
|
+
state?: string;
|
|
130
|
+
used?: number;
|
|
131
|
+
included?: number;
|
|
132
|
+
limitReached?: boolean;
|
|
133
|
+
canManage?: boolean;
|
|
134
|
+
title?: string;
|
|
135
|
+
message?: string;
|
|
136
|
+
actionUrl?: string;
|
|
137
|
+
}
|
|
126
138
|
export declare class ChatMessageContent extends KernelContent {
|
|
127
139
|
role?: AuthorRole;
|
|
128
140
|
items?: KernelContent[];
|
|
@@ -154,6 +166,10 @@ export declare class InstructionSummary {
|
|
|
154
166
|
description: string;
|
|
155
167
|
interactionId: string;
|
|
156
168
|
}
|
|
169
|
+
export declare class AgentIdentityWire {
|
|
170
|
+
personaId: string;
|
|
171
|
+
role: string;
|
|
172
|
+
}
|
|
157
173
|
export declare class SessionInformation {
|
|
158
174
|
size: number;
|
|
159
175
|
originalSize: number;
|
|
@@ -177,6 +193,8 @@ export declare class LlmEvent {
|
|
|
177
193
|
serverError?: string;
|
|
178
194
|
interactionId: string;
|
|
179
195
|
sessionInformation?: SessionInformation;
|
|
196
|
+
/** The named agent answering this turn (Equipe de agentes). Absent on servers without personas. */
|
|
197
|
+
agent?: AgentIdentityWire;
|
|
180
198
|
eventType?: EventTypeInformation;
|
|
181
199
|
artifactsGenerated: LlmArtifact[];
|
|
182
200
|
author?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BillingLimitNotice } from '../../models/billingLimit';
|
|
1
2
|
import { ServerEvent } from '../../models/ServerEvent';
|
|
2
3
|
import { TypedJSON } from 'typedjson';
|
|
3
4
|
import { InteractionStart, InteractionStatistics, LlmEvent, StreamingResponse } from '../../models/semanticKernelModel/models';
|
|
@@ -22,6 +23,7 @@ export declare class WebSocketConnecionV2 implements IWebSocketConnection {
|
|
|
22
23
|
onOpen?: () => void;
|
|
23
24
|
onFirstToken?: (interactionId: string) => void;
|
|
24
25
|
onSuspended?: () => void;
|
|
26
|
+
onBillingLimit?: (notice: BillingLimitNotice) => void;
|
|
25
27
|
onClose?: (code: number, reason: string) => void;
|
|
26
28
|
/**
|
|
27
29
|
* Fired when the server signals that we lost streaming events on resume — our
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BillingLimitNotice } from '../../models/billingLimit';
|
|
1
2
|
import { ServerEvent } from '../../models/ServerEvent';
|
|
2
3
|
import { ChatAction } from '../../models/enums';
|
|
3
4
|
import { InteractionStart, InteractionStatistics } from '../../models/semanticKernelModel/models';
|
|
@@ -64,6 +65,8 @@ export interface IWebSocketConnection {
|
|
|
64
65
|
onOpen?: () => void;
|
|
65
66
|
onFirstToken?: (interactionId: string) => void;
|
|
66
67
|
onSuspended?: () => void;
|
|
68
|
+
/** Equipe de agentes: the server's out-of-band BillingLimit notice (on connect, or at a turn's start). */
|
|
69
|
+
onBillingLimit?: (notice: BillingLimitNotice) => void;
|
|
67
70
|
onClose?: (code: number, reason: string) => void;
|
|
68
71
|
onNewPacket?: (stats: InteractionStatistics) => void;
|
|
69
72
|
/**
|
|
@@ -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
|