@aintela/chat 0.2.15
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/README.md +161 -0
- package/dist/ClientMessage-EKgfuTp8.js +40 -0
- package/dist/ClientMessage-EKgfuTp8.js.map +1 -0
- package/dist/Memory-DjLZqgbF.js +84 -0
- package/dist/Memory-DjLZqgbF.js.map +1 -0
- package/dist/Prompt-DZb7OaPp.js +37 -0
- package/dist/Prompt-DZb7OaPp.js.map +1 -0
- package/dist/artifactHtmlHandler-CMQJf1cX.js +41 -0
- package/dist/artifactHtmlHandler-CMQJf1cX.js.map +1 -0
- package/dist/auth-CcTgInbY.js +524 -0
- package/dist/auth-CcTgInbY.js.map +1 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.js +14159 -0
- package/dist/components.js.map +1 -0
- package/dist/environmentUtils-BaKw5_VD.js +462 -0
- package/dist/environmentUtils-BaKw5_VD.js.map +1 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +9 -0
- package/dist/hooks.js.map +1 -0
- package/dist/httpArtifactService-BAR60Gu1.js +1802 -0
- package/dist/httpArtifactService-BAR60Gu1.js.map +1 -0
- package/dist/httpSessionService-5Kr__oQL.js +279 -0
- package/dist/httpSessionService-5Kr__oQL.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +226 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces.d.ts +2 -0
- package/dist/interfaces.js +11 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/models.d.ts +2 -0
- package/dist/models.js +54 -0
- package/dist/models.js.map +1 -0
- package/dist/serializer-DyHZxlAG.js +1276 -0
- package/dist/serializer-DyHZxlAG.js.map +1 -0
- package/dist/services.d.ts +2 -0
- package/dist/services.js +16 -0
- package/dist/services.js.map +1 -0
- package/dist/sortable-table-DgQHxWIh.js +819 -0
- package/dist/sortable-table-DgQHxWIh.js.map +1 -0
- package/dist/src/ErrorBondary.d.ts +10 -0
- package/dist/src/components/AiChat/AiChat.d.ts +3 -0
- package/dist/src/components/AiChat/AiChatContext.d.ts +76 -0
- package/dist/src/components/AiChat/AiChatDrawer.d.ts +3 -0
- package/dist/src/components/AiChat/AiChatFloating.d.ts +3 -0
- package/dist/src/components/AiChat/AiChatProvider.d.ts +7 -0
- package/dist/src/components/AiChat/AiChatSessionStore.d.ts +1 -0
- package/dist/src/components/AiChat/AiChatTypes.d.ts +227 -0
- package/dist/src/components/AiChat/ChatPane/AlertDialog.d.ts +12 -0
- package/dist/src/components/AiChat/ChatPane/AskUserSheet.d.ts +25 -0
- package/dist/src/components/AiChat/ChatPane/ChatPane.d.ts +7 -0
- package/dist/src/components/AiChat/ChatPane/ConnectionState.d.ts +2 -0
- package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +12 -0
- package/dist/src/components/AiChat/ChatPane/Event.d.ts +6 -0
- package/dist/src/components/AiChat/ChatPane/FloatingConnectionStatus.d.ts +8 -0
- package/dist/src/components/AiChat/ChatPane/FriendlyPartDisplay.d.ts +13 -0
- package/dist/src/components/AiChat/ChatPane/LastPrompts.d.ts +9 -0
- package/dist/src/components/AiChat/ChatPane/Message.d.ts +11 -0
- package/dist/src/components/AiChat/ChatPane/MessageAgent.d.ts +16 -0
- package/dist/src/components/AiChat/ChatPane/MessageNonTextDisplay.d.ts +16 -0
- package/dist/src/components/AiChat/ChatPane/MessagePart.d.ts +15 -0
- package/dist/src/components/AiChat/ChatPane/MessagePersona.d.ts +13 -0
- package/dist/src/components/AiChat/ChatPane/MessageUser.d.ts +8 -0
- package/dist/src/components/AiChat/ChatPane/ModelSelector.d.ts +11 -0
- package/dist/src/components/AiChat/ChatPane/Prompt.d.ts +9 -0
- package/dist/src/components/AiChat/ChatPane/SessionDataDialog.d.ts +7 -0
- package/dist/src/components/AiChat/ChatPane/StickyQuestionHeader.d.ts +7 -0
- package/dist/src/components/AiChat/ChatPane/StreamStatistics.d.ts +32 -0
- package/dist/src/components/AiChat/ChatPane/SubAgentBox.d.ts +9 -0
- package/dist/src/components/AiChat/ChatPane/TaskList.d.ts +6 -0
- package/dist/src/components/AiChat/ChatPane/friendlyToolConfig.d.ts +11 -0
- package/dist/src/components/AiChat/ChatPane/parts/AskUserPart.d.ts +8 -0
- package/dist/src/components/AiChat/ChatPane/parts/BoxedPart.d.ts +4 -0
- package/dist/src/components/AiChat/ChatPane/parts/FunctionPart.d.ts +4 -0
- package/dist/src/components/AiChat/ChatPane/parts/SuspendedPart.d.ts +4 -0
- package/dist/src/components/AiChat/ChatPane/parts/TextPart.d.ts +4 -0
- package/dist/src/components/AiChat/ChatPane/parts/ThoughtPart.d.ts +4 -0
- package/dist/src/components/AiChat/ChatPane/parts/UiToolDispatcher.d.ts +16 -0
- package/dist/src/components/AiChat/ChatPane/parts/WaitingPart.d.ts +4 -0
- package/dist/src/components/AiChat/ChatPane/parts/index.d.ts +20 -0
- package/dist/src/components/AiChat/ChatPane/parts/index.test.d.ts +1 -0
- package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +22 -0
- package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +121 -0
- package/dist/src/components/AiChat/index.d.ts +13 -0
- package/dist/src/components/AiChat/sessionStateManagerService.d.ts +47 -0
- package/dist/src/components/AiChat/stateConfiguration.d.ts +80 -0
- package/dist/src/components/Library/ArtifactRender.d.ts +18 -0
- package/dist/src/components/Library/DelayTextComponent.d.ts +9 -0
- package/dist/src/components/Library/LinearBackgroundProgress.d.ts +8 -0
- package/dist/src/components/Library/LinearProgressBarWithMarkers.d.ts +14 -0
- package/dist/src/components/Library/LoadingDots.d.ts +8 -0
- package/dist/src/components/Library/MarkdowmExtended.d.ts +32 -0
- package/dist/src/components/Library/VizLibrary/Skeletons/ChartSkeleton.d.ts +3 -0
- package/dist/src/components/Library/VizLibrary/Skeletons/IFrameSkeleton.d.ts +3 -0
- package/dist/src/components/Library/VizLibrary/Skeletons/MetricGroupSkeleton.d.ts +8 -0
- package/dist/src/components/Library/VizLibrary/Skeletons/MetricSkeleton.d.ts +7 -0
- package/dist/src/components/Library/VizLibrary/Skeletons/TableSkeleton.d.ts +7 -0
- package/dist/src/components/Library/VizLibrary/index.d.ts +5 -0
- package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +33 -0
- package/dist/src/components/LlmResponseRender/GeneratingVisualization.d.ts +13 -0
- package/dist/src/components/LlmResponseRender/LiveJsxBlock.d.ts +55 -0
- package/dist/src/components/LlmResponseRender/LlmResponseRender.d.ts +29 -0
- package/dist/src/components/LlmResponseRender/index.d.ts +6 -0
- package/dist/src/components/LlmResponseRender/jsxScope.d.ts +41 -0
- package/dist/src/components/LlmResponseRender/liveTsxConfig.d.ts +18 -0
- package/dist/src/components/LlmResponseRender/parseBlocks.d.ts +39 -0
- package/dist/src/components/Stopwatch.d.ts +12 -0
- package/dist/src/components/index.d.ts +30 -0
- package/dist/src/components/v2/AgentActivityV2.d.ts +32 -0
- package/dist/src/components/v2/AiChatFloatingV2.d.ts +3 -0
- package/dist/src/components/v2/AiChatV2Pane.d.ts +20 -0
- package/dist/src/components/v2/AppBarV2.d.ts +38 -0
- package/dist/src/components/v2/AppRailV2.d.ts +21 -0
- package/dist/src/components/v2/AppShellV2.d.ts +13 -0
- package/dist/src/components/v2/ChatsHistoryV2.d.ts +47 -0
- package/dist/src/components/v2/LastPromptsV2.d.ts +6 -0
- package/dist/src/components/v2/MobileDrawerV2.d.ts +43 -0
- package/dist/src/components/v2/PromptV2.d.ts +164 -0
- package/dist/src/components/v2/RunProgressPanelV2.d.ts +28 -0
- package/dist/src/components/v2/RunProgressStripV2.d.ts +2 -0
- package/dist/src/components/v2/Sparkline.d.ts +10 -0
- package/dist/src/components/v2/SubAgentBoxV2.d.ts +15 -0
- package/dist/src/components/v2/TaskListV2.d.ts +8 -0
- package/dist/src/components/v2/icons.d.ts +42 -0
- package/dist/src/components/v2/index.d.ts +34 -0
- package/dist/src/components/v2/styles.d.ts +6 -0
- package/dist/src/components/v2/toolCategories.d.ts +18 -0
- package/dist/src/components/v2/useResponsiveLayout.d.ts +9 -0
- package/dist/src/hooks/index.d.ts +4 -0
- package/dist/src/hooks/useChatSessions.d.ts +68 -0
- package/dist/src/hooks/useContainerWidth.d.ts +2 -0
- package/dist/src/hooks/useIntervalHook.d.ts +2 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/interfaces/IHeartbeatPort.d.ts +4 -0
- package/dist/src/interfaces/INotificationPort.d.ts +4 -0
- package/dist/src/interfaces/index.d.ts +4 -0
- package/dist/src/interfaces/memoryService.d.ts +37 -0
- package/dist/src/interfaces/schedulingService.d.ts +64 -0
- package/dist/src/models/Agent.d.ts +32 -0
- package/dist/src/models/Artifact.d.ts +21 -0
- package/dist/src/models/ArtifactData.d.ts +30 -0
- package/dist/src/models/ChatSession.d.ts +57 -0
- package/dist/src/models/ClientMessage.d.ts +38 -0
- package/dist/src/models/Customer.d.ts +7 -0
- package/dist/src/models/EndMessageData.d.ts +6 -0
- package/dist/src/models/IAbiContext.d.ts +8 -0
- package/dist/src/models/IDBStorable.d.ts +14 -0
- package/dist/src/models/Interaction.d.ts +36 -0
- package/dist/src/models/InteractionPart.d.ts +69 -0
- package/dist/src/models/LlmSession.d.ts +10 -0
- package/dist/src/models/Memory.d.ts +48 -0
- package/dist/src/models/Notification.d.ts +11 -0
- package/dist/src/models/Prompt.d.ts +20 -0
- package/dist/src/models/SendMessageResponse.d.ts +21 -0
- package/dist/src/models/ServerEvent.d.ts +130 -0
- package/dist/src/models/connectionState.d.ts +9 -0
- package/dist/src/models/contexts.d.ts +33 -0
- package/dist/src/models/enums.d.ts +333 -0
- package/dist/src/models/index.d.ts +36 -0
- package/dist/src/models/semanticKernelModel/index.d.ts +2 -0
- package/dist/src/models/semanticKernelModel/init.d.ts +1 -0
- package/dist/src/models/semanticKernelModel/models.d.ts +208 -0
- package/dist/src/models/semanticKernelModel/serializer.d.ts +40 -0
- package/dist/src/models/serverReponse.d.ts +5 -0
- package/dist/src/models/subAgentModel.d.ts +48 -0
- package/dist/src/models/todoListModel.d.ts +18 -0
- package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +163 -0
- package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +75 -0
- package/dist/src/services/artifactHtmlHandler.d.ts +6 -0
- package/dist/src/services/eventBusService.d.ts +119 -0
- package/dist/src/services/httpArtifactService.d.ts +25 -0
- package/dist/src/services/httpSessionService.d.ts +31 -0
- package/dist/src/services/index.d.ts +16 -0
- package/dist/src/services/interactionService.d.ts +28 -0
- package/dist/src/services/interactionService.test.d.ts +1 -0
- package/dist/src/services/interfaces/artifactService.d.ts +13 -0
- package/dist/src/services/servers/AgentGatewayService.d.ts +167 -0
- package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +44 -0
- package/dist/src/services/servers/agentGatewayWSAsync.test.d.ts +1 -0
- package/dist/src/services/servers/sessionService/ISessionService.d.ts +20 -0
- package/dist/src/services/sessionEventDecoder.d.ts +22 -0
- package/dist/src/services/sessionEventDecoder.test.d.ts +1 -0
- package/dist/src/services/storageService.d.ts +73 -0
- package/dist/src/themes/index.d.ts +3 -0
- package/dist/src/themes/v2-chart-palette.d.ts +1 -0
- package/dist/src/themes/v2.d.ts +71 -0
- package/dist/src/utils/auth.d.ts +9 -0
- package/dist/src/utils/envOverrides.d.ts +23 -0
- package/dist/src/utils/envUtils.d.ts +13 -0
- package/dist/src/utils/environmentUtils.d.ts +43 -0
- package/dist/src/utils/fileUtils.d.ts +6 -0
- package/dist/src/utils/getAgentArtifactsBaseUrl.d.ts +1 -0
- package/dist/src/utils/getAgentBaseUrl.d.ts +1 -0
- package/dist/src/utils/getDotNetBaseUrl.d.ts +5 -0
- package/dist/src/utils/index.d.ts +17 -0
- package/dist/src/utils/interactionIdChecker.d.ts +27 -0
- package/dist/src/utils/jsonDetector.d.ts +50 -0
- package/dist/src/utils/jsonUtils.d.ts +1 -0
- package/dist/src/utils/materialIconsList.d.ts +42 -0
- package/dist/src/utils/materialIconsSvg.d.ts +51 -0
- package/dist/src/utils/objectUtils.d.ts +31 -0
- package/dist/src/utils/parseArtifact.d.ts +3 -0
- package/dist/src/utils/sessionWindowParameters.d.ts +3 -0
- package/dist/src/utils/sortable-table.d.ts +31 -0
- package/dist/src/utils/stringUtils.d.ts +8 -0
- package/dist/src/utils/uriUtils.d.ts +39 -0
- package/dist/src/utils/urlParser.d.ts +8 -0
- package/dist/style.css +94 -0
- package/dist/tests/fakes/fakeWebSocket.d.ts +32 -0
- package/dist/tests/fakes/makeGateway.d.ts +24 -0
- package/dist/tests/fixtures.d.ts +73 -0
- package/dist/useChatSessions-DttlifVk.js +107 -0
- package/dist/useChatSessions-DttlifVk.js.map +1 -0
- package/dist/useContainerWidth-Df2PmSoC.js +52 -0
- package/dist/useContainerWidth-Df2PmSoC.js.map +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +49 -0
- package/dist/utils.js.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { ServerEvent, ToolEventDetails } from '../../models/ServerEvent';
|
|
2
|
+
import { User, AgentContext } from '../../models/contexts';
|
|
3
|
+
import { ClientMessage } from '../../models/ClientMessage';
|
|
4
|
+
import { Interaction, MergeResult } from '../../models/Interaction';
|
|
5
|
+
import { EventBusService, FirstTokenEventDetails } from '../eventBusService';
|
|
6
|
+
import { InteractionService } from '../interactionService';
|
|
7
|
+
import { RunMode } from '../../models/enums';
|
|
8
|
+
import { InteractionPart } from '../../models/InteractionPart';
|
|
9
|
+
import { StartStreamResponse, SendMessageResponse } from '../../models/SendMessageResponse';
|
|
10
|
+
import { IArtifactService } from '../interfaces/artifactService';
|
|
11
|
+
import { Artifact } from '../../models/Artifact';
|
|
12
|
+
import { AiChatState, AiChatStore } from '../../components/AiChat/stateConfiguration';
|
|
13
|
+
import { INotificationPort } from '../../interfaces/INotificationPort';
|
|
14
|
+
import { EndMessageData } from '../../models/EndMessageData';
|
|
15
|
+
import { IStorageService } from '../storageService';
|
|
16
|
+
export interface GatewaySendMessageOptions {
|
|
17
|
+
callId?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare abstract class AgentGatewayService {
|
|
20
|
+
base_production_url: string;
|
|
21
|
+
base_url_local: string;
|
|
22
|
+
base_url: string;
|
|
23
|
+
isLocal: boolean;
|
|
24
|
+
msg_order: number;
|
|
25
|
+
static SUSPENSION_MSG: string;
|
|
26
|
+
protected lastPing: Date;
|
|
27
|
+
protected interactionsMap: Map<string, Interaction>;
|
|
28
|
+
protected interactionsServiceMap: Map<string, InteractionService>;
|
|
29
|
+
protected user: User;
|
|
30
|
+
protected config: AgentContext;
|
|
31
|
+
protected currentIS: InteractionService | null;
|
|
32
|
+
protected server_session_id?: string | null;
|
|
33
|
+
protected model_session_id?: string | null;
|
|
34
|
+
protected runMode: RunMode;
|
|
35
|
+
protected sessionState: AiChatState;
|
|
36
|
+
protected storageService: IStorageService;
|
|
37
|
+
protected notificationPort: INotificationPort;
|
|
38
|
+
protected interactionCallIds: Map<string, string>;
|
|
39
|
+
protected rawJwt: string;
|
|
40
|
+
protected sessionId?: string;
|
|
41
|
+
isInited: boolean;
|
|
42
|
+
eventBusService: EventBusService;
|
|
43
|
+
artifactService: IArtifactService;
|
|
44
|
+
onTurnOpen: (listener: (...args: any[]) => Promise<void>) => void;
|
|
45
|
+
offTurnOpen: (listener: (...args: any[]) => Promise<void>) => void;
|
|
46
|
+
onTurnComplete: (listener: (...args: any[]) => Promise<void>) => void;
|
|
47
|
+
offTurnComplete: (listener: (...args: any[]) => Promise<void>) => void;
|
|
48
|
+
onStreamError: (listener: (...args: any[]) => Promise<void>) => void;
|
|
49
|
+
offStreamError: (listener: (...args: any[]) => Promise<void>) => void;
|
|
50
|
+
onStreamEnded: (listener: (...args: any[]) => Promise<void>) => void;
|
|
51
|
+
offStreamEnded: (listener: (...args: any[]) => Promise<void>) => void;
|
|
52
|
+
onMessage: (listener: (...args: any[]) => Promise<void>) => void;
|
|
53
|
+
offMessage: (listener: (...args: any[]) => Promise<void>) => void;
|
|
54
|
+
onFirstToken: (listener: (details: FirstTokenEventDetails) => Promise<void>) => void;
|
|
55
|
+
offFirstToken: (listener: (details: FirstTokenEventDetails) => Promise<void>) => void;
|
|
56
|
+
onEndMessageData(listener: (data: EndMessageData) => Promise<void>): void;
|
|
57
|
+
offEndMessageData(listener: (data: EndMessageData) => Promise<void>): void;
|
|
58
|
+
onFunctionResponse: (listener: (...args: any[]) => Promise<void>) => void;
|
|
59
|
+
offFunctionResponse: (listener: (...args: any[]) => Promise<void>) => void;
|
|
60
|
+
toolSessionId: string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Send the user's answer to a parked `ask_user` tool call back to the agent.
|
|
63
|
+
* Default no-op; the WebSocket gateway (AgentGatewayWSAsync) overrides it to emit
|
|
64
|
+
* a ChatAction.AnswerHumanTool frame.
|
|
65
|
+
*/
|
|
66
|
+
answerHumanTool(toolCallId: string, answer: string): void;
|
|
67
|
+
constructor(user: User, eventBusService: EventBusService, artifactService: IArtifactService, baseUrl: string, config: AgentContext, sessionStore: AiChatStore, notificationPort: INotificationPort, storageService: IStorageService, sessionId?: string, runMode?: RunMode);
|
|
68
|
+
getAgentContext(): AgentContext;
|
|
69
|
+
getModel(): string | undefined;
|
|
70
|
+
setModel(modelId: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Live update for the agent / customer slice of the gateway's
|
|
73
|
+
* config. Mirrors {@link setModel}'s in-place pattern so the
|
|
74
|
+
* next outgoing message — `sendMessageInternal` reads
|
|
75
|
+
* `this.config.agentConfig?.id` directly at send time, see
|
|
76
|
+
* `AgentGatewayWSAsync.sendMessageInternal` — picks up the new
|
|
77
|
+
* id without rebuilding the gateway or tearing down the
|
|
78
|
+
* WebSocket. This is what the host calls from the agent picker
|
|
79
|
+
* so switching agents preserves the current session's
|
|
80
|
+
* connection, chat history, and any in-flight stream state
|
|
81
|
+
* instead of remounting `AiChatProvider` and losing them.
|
|
82
|
+
*
|
|
83
|
+
* Callers should pass the FULL replacement context (the same
|
|
84
|
+
* shape they originally constructed the gateway with). The
|
|
85
|
+
* gateway preserves the `model` slice from its current config
|
|
86
|
+
* if the incoming context omits it — the model is owned
|
|
87
|
+
* separately by `setModel` and shouldn't get clobbered by an
|
|
88
|
+
* agent-only change.
|
|
89
|
+
*/
|
|
90
|
+
setAgentContext(config: AgentContext): void;
|
|
91
|
+
getSessionId(): string | undefined;
|
|
92
|
+
getErrorEvent(errorMessage: string): {
|
|
93
|
+
interaction_id: string | null;
|
|
94
|
+
model_session_id: string;
|
|
95
|
+
mime_type: string;
|
|
96
|
+
partial: boolean;
|
|
97
|
+
serverError: string;
|
|
98
|
+
};
|
|
99
|
+
setSession(sessionId: string, toolSessionId: string): void;
|
|
100
|
+
startInteraction(interactionQuestion: string, wasSuspended?: boolean | undefined, idOverrideForTests?: string): Interaction;
|
|
101
|
+
getInteractions(): Interaction[];
|
|
102
|
+
getRecentInteractions(filterMs?: number): Interaction[];
|
|
103
|
+
protected updateMap(serverEvent: ServerEvent): MergeResult | undefined;
|
|
104
|
+
getCurrentInteractionId(): string | null;
|
|
105
|
+
getCurrentInteraction(): Interaction | null;
|
|
106
|
+
getInteraction(interactionId: string): Interaction | undefined;
|
|
107
|
+
hasState(): boolean;
|
|
108
|
+
protected buildAgentParams(): string;
|
|
109
|
+
abstract finalResponse(interactionId: string, agentInteraction: Interaction, author: string, subAgentId?: string): void;
|
|
110
|
+
openConnection(sessionId?: string): Promise<string>;
|
|
111
|
+
abstract closeConnection(closeTurn: boolean): Promise<SendMessageResponse | null>;
|
|
112
|
+
protected Error(errorMessage?: string | undefined): Promise<void>;
|
|
113
|
+
private pendingCurrentMessage;
|
|
114
|
+
private lastCurrentMessageUpdate;
|
|
115
|
+
private static readonly CURRENT_MSG_THROTTLE_MS;
|
|
116
|
+
hasServerSessionId(): boolean;
|
|
117
|
+
runningRequests: Map<string, Promise<Artifact | null>>;
|
|
118
|
+
asyncLoadArtifact(artifactId: string): Promise<Artifact | null>;
|
|
119
|
+
protected processComands(serverEvent: ServerEvent): boolean;
|
|
120
|
+
lastToolInteraction: string;
|
|
121
|
+
protected subAgentInteractions: Map<string, Interaction>;
|
|
122
|
+
protected subAgentInteractionServices: Map<string, InteractionService>;
|
|
123
|
+
protected getOrCreateSubAgentInteraction(subAgentId: string, interactionId: string, subAgentName?: string): {
|
|
124
|
+
interaction: Interaction;
|
|
125
|
+
service: InteractionService;
|
|
126
|
+
};
|
|
127
|
+
protected handleSubAgentEvent(serverEvent: ServerEvent): void;
|
|
128
|
+
Message(event: MessageEvent | ServerEvent): Promise<void>;
|
|
129
|
+
hasOneCompleteInteraction(): boolean;
|
|
130
|
+
protected localEmitToolEvent(toolDetails: ToolEventDetails): void;
|
|
131
|
+
protected registerInteractionCallId(interactionId: string, options?: GatewaySendMessageOptions): void;
|
|
132
|
+
protected localEmitFirstToken(interactionId: string): void;
|
|
133
|
+
private lastThorttledTimeout;
|
|
134
|
+
private doEmitMessage;
|
|
135
|
+
protected localEmitMessage(message: Interaction, mergeResult?: MergeResult): void;
|
|
136
|
+
protected localOpen(interactionId: string, _author: string): void;
|
|
137
|
+
/**
|
|
138
|
+
* Drop any throttled `currentMessage` emit still queued by
|
|
139
|
+
* `localEmitMessage`. The throttle's trailing edge is a `setTimeout` that
|
|
140
|
+
* calls `setCurrentMessage(...)`; if it fires *after* the turn has been
|
|
141
|
+
* committed (`setNewMessage` moved the interaction into `messages` and
|
|
142
|
+
* nulled `currentMessage`), it re-publishes the now-committed interaction
|
|
143
|
+
* as the live message — so the chat renders the turn twice: once in
|
|
144
|
+
* history (`MessageAgent` with `onGoing=false`, which drops Thought parts)
|
|
145
|
+
* and once as the live `currentMessage` (`onGoing=true`, which keeps them).
|
|
146
|
+
* That is the duplicated-bubble bug (the two copies even look different —
|
|
147
|
+
* only the live one shows the "thought" strip). Call this on turn commit.
|
|
148
|
+
*/
|
|
149
|
+
private cancelPendingCurrentMessage;
|
|
150
|
+
protected turnComplete(interactionId: string, agentInteraction: Interaction, _author: string, subAgentId?: string): Promise<void>;
|
|
151
|
+
protected lastPingStatus: boolean;
|
|
152
|
+
protected handlePing(): Promise<boolean>;
|
|
153
|
+
sendMessage(message: ClientMessage, options?: GatewaySendMessageOptions): Promise<SendMessageResponse>;
|
|
154
|
+
abstract startStream(sendStartMessage?: boolean): Promise<StartStreamResponse>;
|
|
155
|
+
abstract stopStream(): void;
|
|
156
|
+
abstract sendMessageInternal(message: ClientMessage, options?: GatewaySendMessageOptions): Promise<SendMessageResponse>;
|
|
157
|
+
abstract isSuspended(): boolean;
|
|
158
|
+
abstract suspend(): Promise<boolean>;
|
|
159
|
+
abstract reset(user: User, config?: AgentContext): void;
|
|
160
|
+
check(): Promise<boolean>;
|
|
161
|
+
startAndForget(): void;
|
|
162
|
+
forceReceiveMessage(serverEvent: ServerEvent): void;
|
|
163
|
+
sendStatusMessage(question: string, parts: InteractionPart[], interactionId: string): void;
|
|
164
|
+
clearStatus(): void;
|
|
165
|
+
ping(): Promise<boolean>;
|
|
166
|
+
protected getNewInteractionId(): string;
|
|
167
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { User, AgentContext } from '../../models/contexts';
|
|
2
|
+
import { ClientMessage } from '../../models/ClientMessage';
|
|
3
|
+
import { AgentGatewayService, GatewaySendMessageOptions } from './AgentGatewayService';
|
|
4
|
+
import { Interaction } from '../../models/Interaction';
|
|
5
|
+
import { EventBusService } from '../eventBusService';
|
|
6
|
+
import { SendMessageResponse, StartStreamResponse } from '../../models/SendMessageResponse';
|
|
7
|
+
import { IArtifactService } from '../interfaces/artifactService';
|
|
8
|
+
import { AxiosResponse } from 'axios';
|
|
9
|
+
import { IHeartbeatPort } from '../../interfaces/IHeartbeatPort';
|
|
10
|
+
import { INotificationPort } from '../../interfaces/INotificationPort';
|
|
11
|
+
import { ConnectionState } from '../../models/connectionState';
|
|
12
|
+
import { AiChatStore } from '../../components/AiChat/stateConfiguration';
|
|
13
|
+
import { IWebSocketConnection } from '../WebSocketConnection/webSocketConnection';
|
|
14
|
+
import { IStorageService } from '../storageService';
|
|
15
|
+
export type Reader = (response: AxiosResponse, wasSuspended: boolean, onFirstRead?: () => void) => void;
|
|
16
|
+
export declare class AgentGatewayWSAsync extends AgentGatewayService {
|
|
17
|
+
suspendState: boolean;
|
|
18
|
+
reset(_user: User, _config?: AgentContext): void;
|
|
19
|
+
startStream(_sendStartMessage?: boolean): Promise<StartStreamResponse>;
|
|
20
|
+
isSuspended(): boolean;
|
|
21
|
+
protected wsService: IWebSocketConnection;
|
|
22
|
+
protected root_url: string;
|
|
23
|
+
protected hearBeatPort?: IHeartbeatPort;
|
|
24
|
+
connectionAttempts: number;
|
|
25
|
+
constructor(user: User, eventBusService: EventBusService, artifactService: IArtifactService, baseUrl: string, config: AgentContext, sessionStore: AiChatStore, notificationPort: INotificationPort, ws: IWebSocketConnection, storageService: IStorageService, heartbeatPort?: IHeartbeatPort, sessionId?: string);
|
|
26
|
+
getStoredSessionId(): string | undefined;
|
|
27
|
+
isInteractionComplete(interactionId: string): boolean | undefined;
|
|
28
|
+
isTurnCompleted(interactionId: string): boolean | undefined;
|
|
29
|
+
statuses: string[];
|
|
30
|
+
finalResponse(interactionId: string, agentInteraction: Interaction, author: string): Promise<void>;
|
|
31
|
+
stopStream(closeTurn?: boolean): void;
|
|
32
|
+
suspend(): Promise<boolean>;
|
|
33
|
+
answerHumanTool(toolCallId: string, answer: string): void;
|
|
34
|
+
cancelSuspend(): Promise<void>;
|
|
35
|
+
check(): Promise<boolean>;
|
|
36
|
+
lastConnectionPromise: Promise<string> | null;
|
|
37
|
+
socketState: ConnectionState;
|
|
38
|
+
openConnection(sessionId?: string): Promise<string>;
|
|
39
|
+
closeConnection(closeTurn?: boolean): Promise<SendMessageResponse | null>;
|
|
40
|
+
simulateDisconnect(code?: number, reason?: string): void;
|
|
41
|
+
sleep(ms: number): Promise<unknown>;
|
|
42
|
+
streamOpened: boolean;
|
|
43
|
+
sendMessageInternal(message: ClientMessage, options?: GatewaySendMessageOptions, _openTurn?: boolean): Promise<SendMessageResponse>;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChatSession } from '../../../models/ChatSession';
|
|
2
|
+
import { Customer } from '../../../models/Customer';
|
|
3
|
+
import { ServerResponse } from '../../../models/serverReponse';
|
|
4
|
+
import { LlmCreateSessionResponse, LlmSession } from '../../../models/LlmSession';
|
|
5
|
+
export interface ISessionService {
|
|
6
|
+
getAllSessions(): Promise<ChatSession[]>;
|
|
7
|
+
removeSession(sessionId: string): Promise<void>;
|
|
8
|
+
getLlmSessionInformation(): Promise<LlmSession>;
|
|
9
|
+
retrieveSession(sessionId: string): Promise<ChatSession | null>;
|
|
10
|
+
createSession(sessionId: string, agentName: string, customer?: Customer): Promise<ChatSession | null>;
|
|
11
|
+
createAgentSession(): Promise<LlmCreateSessionResponse>;
|
|
12
|
+
closeSession(sessionId: string): Promise<void>;
|
|
13
|
+
generateOverviewForCurrentSession(systemInstruction: string, model: string): Promise<string | null>;
|
|
14
|
+
storeSession(session: ChatSession): Promise<ServerResponse<ChatSession>>;
|
|
15
|
+
patchSession(sessionId: string, partialChatSession: Partial<ChatSession>): Promise<void>;
|
|
16
|
+
delayedPatchActiveSession(partialChatSession: Partial<ChatSession>): void;
|
|
17
|
+
patchActiveSession(partialChatSession: Partial<ChatSession>): Promise<ChatSession | null>;
|
|
18
|
+
getLastUsedSession(): Promise<ChatSession | null>;
|
|
19
|
+
transformIntoInstances(session: ChatSession): ChatSession;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Interaction } from '../models/Interaction';
|
|
2
|
+
/**
|
|
3
|
+
* Rebuilds the `Interaction[]` the chat UI renders from the historical event
|
|
4
|
+
* log returned by <c>GET /sessions/{id}</c>.
|
|
5
|
+
*
|
|
6
|
+
* Unlike the live turn loop, this does NOT route events through
|
|
7
|
+
* `InteractionService.merge`. The merge pipeline (and its `FlatParts` step) is
|
|
8
|
+
* built for the *live* stream, where each event carries a single content item
|
|
9
|
+
* arriving incrementally; it flattens every event down to one part. The
|
|
10
|
+
* *persisted* log is different: the server stores consolidated blocks where a
|
|
11
|
+
* single event's `content.items` holds many parts at once — e.g. a text
|
|
12
|
+
* preamble plus several FunctionCalls. Running those through `merge` collapsed
|
|
13
|
+
* each event to one part and silently dropped the rest (every function call in
|
|
14
|
+
* a multi-item event disappeared on replay).
|
|
15
|
+
*
|
|
16
|
+
* This restore path instead reads *every* item as its own `InteractionPart`
|
|
17
|
+
* (via `ServerEvent.parseFromTypedEvent`, which already maps one part per
|
|
18
|
+
* item) and only applies the one piece of merge logic replay genuinely needs:
|
|
19
|
+
* folding each FunctionResponse onto the call it answers, keyed by `callId`.
|
|
20
|
+
* No copy-on-write cloning, no event-bus side effects, no streaming-append.
|
|
21
|
+
*/
|
|
22
|
+
export declare function decodeSessionEvents(rawEvents: unknown[]): Interaction[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ArtifactData, Section } from '../models/ArtifactData';
|
|
2
|
+
import { Prompt } from '../models/Prompt';
|
|
3
|
+
export interface IStorageService {
|
|
4
|
+
initializeStorage(): void;
|
|
5
|
+
getSections(): Section[];
|
|
6
|
+
getArtifacts(): ArtifactData[];
|
|
7
|
+
createSection(name: string, iconType?: 'dashboard' | 'chart' | 'folder'): Section;
|
|
8
|
+
updateSection(sectionId: string, updates: Partial<Section>): void;
|
|
9
|
+
deleteSection(sectionId: string): void;
|
|
10
|
+
storeArtifact(artifact: ArtifactData): void;
|
|
11
|
+
moveArtifact(artifactId: string, newSectionId: string): void;
|
|
12
|
+
deleteArtifact(artifactId: string): void;
|
|
13
|
+
updateArtifact(artifactId: string, updates: Partial<ArtifactData>): void;
|
|
14
|
+
getArtifactsBySection(sectionId: string): ArtifactData[];
|
|
15
|
+
getPrompts(): Prompt[];
|
|
16
|
+
storePrompt(prompt: Prompt): void;
|
|
17
|
+
deletePrompt(promptId: string): void;
|
|
18
|
+
clearAllPrompts(): void;
|
|
19
|
+
getItem(key: string): any;
|
|
20
|
+
setItem(key: string, value: any): void;
|
|
21
|
+
removeItem(key: string): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class LocalStorageService implements IStorageService {
|
|
24
|
+
getItem(key: string): string | null;
|
|
25
|
+
setItem(key: string, value: any): void;
|
|
26
|
+
removeItem(key: string): void;
|
|
27
|
+
onPromptCreated: (prompt: Prompt) => void;
|
|
28
|
+
initializeStorage(): void;
|
|
29
|
+
getSections(): Section[];
|
|
30
|
+
getArtifacts(): ArtifactData[];
|
|
31
|
+
createSection(name: string, iconType?: 'dashboard' | 'chart' | 'folder'): Section;
|
|
32
|
+
updateSection(sectionId: string, updates: Partial<Section>): void;
|
|
33
|
+
deleteSection(sectionId: string): void;
|
|
34
|
+
storeArtifact(artifact: ArtifactData): void;
|
|
35
|
+
moveArtifact(artifactId: string, newSectionId: string): void;
|
|
36
|
+
deleteArtifact(artifactId: string): void;
|
|
37
|
+
updateArtifact(artifactId: string, updates: Partial<ArtifactData>): void;
|
|
38
|
+
getArtifactsBySection(sectionId: string): ArtifactData[];
|
|
39
|
+
getPrompts(): Prompt[];
|
|
40
|
+
storePrompt(prompt: Prompt): void;
|
|
41
|
+
deletePrompt(promptId: string): void;
|
|
42
|
+
clearAllPrompts(): void;
|
|
43
|
+
}
|
|
44
|
+
export declare class MockStorageService implements IStorageService {
|
|
45
|
+
getItem(_key: string): string;
|
|
46
|
+
setItem(_key: string, _value: any): void;
|
|
47
|
+
removeItem(_key: string): void;
|
|
48
|
+
private artifacts;
|
|
49
|
+
private sections;
|
|
50
|
+
private prompts;
|
|
51
|
+
onPromptCreated: (prompt: Prompt) => void;
|
|
52
|
+
setMockArtifacts(artifacts: ArtifactData[]): void;
|
|
53
|
+
setMockSections(sections: Section[]): void;
|
|
54
|
+
setMockPrompts(prompts: Prompt[]): void;
|
|
55
|
+
initializeStorage(): void;
|
|
56
|
+
getSections(): Section[];
|
|
57
|
+
getArtifacts(): ArtifactData[];
|
|
58
|
+
createSection(name: string, iconType?: 'dashboard' | 'chart' | 'folder'): Section;
|
|
59
|
+
updateSection(sectionId: string, updates: Partial<Section>): void;
|
|
60
|
+
deleteSection(sectionId: string): void;
|
|
61
|
+
storeArtifact(artifact: ArtifactData): void;
|
|
62
|
+
moveArtifact(artifactId: string, newSectionId: string): void;
|
|
63
|
+
deleteArtifact(artifactId: string): void;
|
|
64
|
+
updateArtifact(artifactId: string, updates: Partial<ArtifactData>): void;
|
|
65
|
+
getArtifactsBySection(sectionId: string): ArtifactData[];
|
|
66
|
+
getPrompts(): Prompt[];
|
|
67
|
+
storePrompt(prompt: Prompt): void;
|
|
68
|
+
deletePrompt(promptId: string): void;
|
|
69
|
+
clearAllPrompts(): void;
|
|
70
|
+
}
|
|
71
|
+
export declare const usePromptState: (storageService: IStorageService) => {
|
|
72
|
+
promptState: string;
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const V2_CHART_PALETTE: readonly string[];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const themeTokens: {
|
|
2
|
+
readonly bgCanvas: "#0a0a0b";
|
|
3
|
+
readonly bgCanvasTransparency: "#0a0a0bDD";
|
|
4
|
+
readonly bgPanel: "#111114";
|
|
5
|
+
readonly bgRaised: "#17171b";
|
|
6
|
+
readonly bgHover: "#1d1d22";
|
|
7
|
+
readonly border: "#26262d";
|
|
8
|
+
readonly borderSoft: "#1f1f25";
|
|
9
|
+
readonly divider: "#161616";
|
|
10
|
+
readonly text: "#ececef";
|
|
11
|
+
readonly textDim: "#8e8e96";
|
|
12
|
+
readonly textFaint: "#5a5a62";
|
|
13
|
+
readonly accent: "#e0a458";
|
|
14
|
+
readonly accentDim: "#7a5a30";
|
|
15
|
+
readonly accentSoft: "rgba(224,164,88,0.14)";
|
|
16
|
+
readonly good: "#5eb88a";
|
|
17
|
+
readonly bad: "#d97a7a";
|
|
18
|
+
readonly font: "\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif";
|
|
19
|
+
readonly mono: "\"JetBrains Mono\", ui-monospace, SFMono-Regular, Menlo, monospace";
|
|
20
|
+
readonly radius: 10;
|
|
21
|
+
readonly radiusSm: 6;
|
|
22
|
+
readonly radiusLg: 12;
|
|
23
|
+
};
|
|
24
|
+
declare module '@mui/material/styles' {
|
|
25
|
+
interface Palette {
|
|
26
|
+
surface: {
|
|
27
|
+
panel: string;
|
|
28
|
+
raised: string;
|
|
29
|
+
hover: string;
|
|
30
|
+
chrome?: string;
|
|
31
|
+
chromePanel?: string;
|
|
32
|
+
};
|
|
33
|
+
border: {
|
|
34
|
+
default: string;
|
|
35
|
+
soft: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface PaletteOptions {
|
|
39
|
+
surface?: {
|
|
40
|
+
panel: string;
|
|
41
|
+
raised: string;
|
|
42
|
+
hover: string;
|
|
43
|
+
chrome?: string;
|
|
44
|
+
chromePanel?: string;
|
|
45
|
+
};
|
|
46
|
+
border?: {
|
|
47
|
+
default: string;
|
|
48
|
+
soft: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface PaletteColor {
|
|
52
|
+
softBg?: string;
|
|
53
|
+
}
|
|
54
|
+
interface SimplePaletteColorOptions {
|
|
55
|
+
softBg?: string;
|
|
56
|
+
}
|
|
57
|
+
interface TypographyVariants {
|
|
58
|
+
fontFamilyMono: string;
|
|
59
|
+
}
|
|
60
|
+
interface TypographyVariantsOptions {
|
|
61
|
+
fontFamilyMono?: string;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
declare module '@mui/system' {
|
|
65
|
+
interface Shape {
|
|
66
|
+
radiusSm: number;
|
|
67
|
+
radiusLg: number;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export declare const v2Theme: import('@mui/material').Theme;
|
|
71
|
+
export type V2Theme = typeof v2Theme;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const GOOGLE_CLIENT_ID: string | undefined;
|
|
2
|
+
export declare const ALLOWED_DOMAINS: string[];
|
|
3
|
+
export declare const ALLOWED_EMAILS: string[];
|
|
4
|
+
export declare const AUTH_CONFIG: {
|
|
5
|
+
requireAuthentication: boolean;
|
|
6
|
+
allowAnonymousAccess: boolean;
|
|
7
|
+
sessionTimeout: number;
|
|
8
|
+
GOOGLE_API_KEY: string | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment-URL overrides (e.g. a staging environment), resolved per environment:
|
|
3
|
+
*
|
|
4
|
+
* - Node (SSR / tests): real environment variables, read at call time.
|
|
5
|
+
* - Browser: `process` doesn't exist. The HOST app's Vite build statically
|
|
6
|
+
* replaces these exact `process.env.X` member expressions via `define`
|
|
7
|
+
* (see envision-abi dashboard-app vite.config.ts — the same channel it
|
|
8
|
+
* already uses for `process.env.MODE`). Without such a define the read
|
|
9
|
+
* throws on the bare `process` global → caught → no override.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: `import.meta.env.VITE_*` is NOT usable here — this package builds in
|
|
12
|
+
* Vite lib mode, which inlines `import.meta.env` at PACKAGE build time, so a
|
|
13
|
+
* consumer's VITE_* values can never reach the published dist. `process.env.X`
|
|
14
|
+
* member expressions survive the lib build, which is what makes the consumer
|
|
15
|
+
* `define` channel work.
|
|
16
|
+
*
|
|
17
|
+
* The reads must stay literal static member accesses (no dynamic key lookup),
|
|
18
|
+
* or the consumer's define replacement won't match them.
|
|
19
|
+
*/
|
|
20
|
+
/** Base URL of the .NET agent server (overrides `https://agent.tripapi.com.br`). */
|
|
21
|
+
export declare function agentBaseUrlOverride(): string | undefined;
|
|
22
|
+
/** Public base URL of the dashboard client app (overrides `https://client-agent.tripapi.com.br`). */
|
|
23
|
+
export declare function clientBaseUrlOverride(): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment utilities for cross-platform (browser/Node.js) environment variable access
|
|
3
|
+
*/
|
|
4
|
+
export declare function getEnvVar(key: string): string | undefined;
|
|
5
|
+
export declare function isViteEnvironment(): boolean;
|
|
6
|
+
export declare function isNodeEnvironment(): boolean;
|
|
7
|
+
export declare function getRandomUUID(): string;
|
|
8
|
+
declare const _default: {
|
|
9
|
+
getEnvVar: typeof getEnvVar;
|
|
10
|
+
isViteEnvironment: typeof isViteEnvironment;
|
|
11
|
+
isNodeEnvironment: typeof isNodeEnvironment;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment detection and URL resolution utilities
|
|
3
|
+
* Provides different base URLs for client vs server-side execution
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEV_SERVER_CONFIG: {
|
|
6
|
+
readonly SERVER_BASE_URL: "http://localhost:3000";
|
|
7
|
+
readonly CLIENT_BASE_URL: "http://localhost:5800";
|
|
8
|
+
readonly CUSTOM_HEADERS: {};
|
|
9
|
+
};
|
|
10
|
+
export declare const ANALYTICS_AGENT_NAME = "analytics_agent";
|
|
11
|
+
/**
|
|
12
|
+
* Detects if code is running in browser vs server environment
|
|
13
|
+
*/
|
|
14
|
+
export declare function isBrowser(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Detects if code is running in Node.js server environment
|
|
17
|
+
*/
|
|
18
|
+
export declare function isServer(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the appropriate base URL for API calls
|
|
21
|
+
* - Browser: Returns empty string (uses relative URLs)
|
|
22
|
+
* - Server: Returns full localhost URL
|
|
23
|
+
*/
|
|
24
|
+
export declare function getServerBaseAbUrl(): string;
|
|
25
|
+
export declare function getServerBaseUrl(): string;
|
|
26
|
+
export declare function getServerClientBaseUrl(): string;
|
|
27
|
+
export declare function getAgentServerBaseUrl(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Resolves a relative API path to full URL when needed
|
|
30
|
+
* @param relativePath - API path like "/api/sessions"
|
|
31
|
+
* @returns Full URL for server, relative path for browser
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveApiUrl(relativePath: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Gets environment info for debugging
|
|
36
|
+
*/
|
|
37
|
+
export declare function getEnvironmentInfo(): {
|
|
38
|
+
isBrowser: boolean;
|
|
39
|
+
isServer: boolean;
|
|
40
|
+
baseUrl: string;
|
|
41
|
+
userAgent: string;
|
|
42
|
+
nodeVersion: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getArtifactsBaseUrl: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAgentBaseUrl: (window: any) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { getServerBaseUrl, isServer, ANALYTICS_AGENT_NAME, getAgentServerBaseUrl, DEV_SERVER_CONFIG, getServerClientBaseUrl, getEnvironmentInfo, resolveApiUrl, } from './environmentUtils';
|
|
2
|
+
export { getAgentBaseUrl } from './getAgentBaseUrl';
|
|
3
|
+
export { getArtifactsBaseUrl } from './getAgentArtifactsBaseUrl';
|
|
4
|
+
export { getDotNetBaseUrl } from './getDotNetBaseUrl';
|
|
5
|
+
export { getRandomUUID, getEnvVar } from './envUtils';
|
|
6
|
+
export { dateReviver } from './objectUtils';
|
|
7
|
+
export { extractLinkAction, parseAndValidateArtifactUrl } from './urlParser';
|
|
8
|
+
export { parseKnownNumbers, chunkArray, splitBigLinesWithSpaces } from './stringUtils';
|
|
9
|
+
export { parseArtifactFromJson } from './parseArtifact';
|
|
10
|
+
export { decodeBase64, encodeBase64, decodeUriFromPython, isBase64Encoded } from './jsonDetector';
|
|
11
|
+
export { isUriEncoded, decodeUri, encodeUri, isValidUri, parseUriParams } from './uriUtils';
|
|
12
|
+
export { startsWithInteractionId, extractInteractionId, isValidInteractionId, } from './interactionIdChecker';
|
|
13
|
+
export { setEbiContextSessionId, setEbiContextData } from './sessionWindowParameters';
|
|
14
|
+
export { default as materialIcons, getIconByName, searchIcons, iconCategories, } from './materialIconsList';
|
|
15
|
+
export type { MaterialIcon } from './materialIconsList';
|
|
16
|
+
export { GOOGLE_CLIENT_ID, ALLOWED_DOMAINS, ALLOWED_EMAILS, AUTH_CONFIG } from './auth';
|
|
17
|
+
export { default as SortableTable } from './sortable-table';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to check if a string starts with an interaction ID (UUID)
|
|
3
|
+
* Supports both formats:
|
|
4
|
+
* - With dashes: ebd067ef-0dbd-49b3-8eff-c54b2a9ff314
|
|
5
|
+
* - Without dashes: 62ec037ae42c439192c64dd112136583
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if a string starts with an interaction ID (UUID)
|
|
9
|
+
* @param str - The string to check
|
|
10
|
+
* @returns true if the string starts with a valid UUID, false otherwise
|
|
11
|
+
*/
|
|
12
|
+
export declare function startsWithInteractionId(str: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Extract the interaction ID from the beginning of a string
|
|
15
|
+
* @param str - The string to extract from
|
|
16
|
+
* @returns The interaction ID if found, null otherwise
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractInteractionId(str: string): string | null;
|
|
19
|
+
export declare function prettiffyFileName(fileName: string): string;
|
|
20
|
+
export declare function prettiffyPythonFunctionName(functionName: string): string;
|
|
21
|
+
export declare function extractNameFromStringWithInteractionId(str: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a string is a valid interaction ID (UUID) on its own
|
|
24
|
+
* @param str - The string to check
|
|
25
|
+
* @returns true if the string is a valid UUID, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
export declare function isValidInteractionId(str: string): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ArtifactType } from '../models/enums';
|
|
2
|
+
export interface ArtifactJson {
|
|
3
|
+
description?: string;
|
|
4
|
+
reasoning?: string;
|
|
5
|
+
type?: ArtifactType;
|
|
6
|
+
file_name?: string;
|
|
7
|
+
mime_type?: string;
|
|
8
|
+
data?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function decodeBase64(base64: string): string;
|
|
11
|
+
export declare function encodeBase64(base64: string): string;
|
|
12
|
+
export declare function decodeUriFromPython(uriEncoded: string): string;
|
|
13
|
+
export declare function isBase64Encoded(base64: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a string contains a valid JSON document with the specified signature
|
|
16
|
+
* @param text - The text to check for JSON content
|
|
17
|
+
* @param signature - The expected JSON structure (optional, defaults to ArtifactSignature)
|
|
18
|
+
* @returns Object with success status and parsed data if found
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectAndParseJson<T = ArtifactJson>(text: string): {
|
|
21
|
+
success: boolean;
|
|
22
|
+
data?: T;
|
|
23
|
+
error?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Validates if an object matches the expected signature
|
|
27
|
+
* @param obj - The parsed JSON object
|
|
28
|
+
* @param signature - The expected structure
|
|
29
|
+
* @returns True if the object matches the signature
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Enhanced version that also looks for partial JSON (useful for streaming)
|
|
33
|
+
* @param text - The text to check
|
|
34
|
+
* @returns Object with success status, parsed data, and whether it's complete
|
|
35
|
+
*/
|
|
36
|
+
export declare function detectPartialJson<T = ArtifactJson>(text: string): {
|
|
37
|
+
success: boolean;
|
|
38
|
+
data?: T;
|
|
39
|
+
isComplete: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Strips all JSON documents from a string, leaving only non-JSON content
|
|
44
|
+
* @param text - The text to process
|
|
45
|
+
* @returns The text with all JSON documents removed
|
|
46
|
+
*/
|
|
47
|
+
export declare function stripJsonDocuments(text: string): {
|
|
48
|
+
beforeText: string;
|
|
49
|
+
afterText: string;
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function safeStringify(obj: any): string;
|