@visma-swno/gaia-chat-ui 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/core/auth/auth.interceptor.d.ts +2 -0
  2. package/dist/core/auth/auth.interceptor.d.ts.map +1 -0
  3. package/dist/core/auth/auth.service.d.ts +14 -0
  4. package/dist/core/auth/auth.service.d.ts.map +1 -0
  5. package/dist/core/auth/auth.store.d.ts +22 -0
  6. package/dist/core/auth/auth.store.d.ts.map +1 -0
  7. package/dist/core/auth/auth.types.d.ts +16 -0
  8. package/dist/core/auth/auth.types.d.ts.map +1 -0
  9. package/dist/core/auth/index.d.ts +5 -0
  10. package/dist/core/auth/index.d.ts.map +1 -0
  11. package/dist/core/auth/strategies/strategy.interface.d.ts +7 -0
  12. package/dist/core/auth/strategies/strategy.interface.d.ts.map +1 -0
  13. package/dist/core/auth/strategies/visitor.strategy.d.ts +12 -0
  14. package/dist/core/auth/strategies/visitor.strategy.d.ts.map +1 -0
  15. package/dist/core/auth/strategies/visma-user.strategy.d.ts +10 -0
  16. package/dist/core/auth/strategies/visma-user.strategy.d.ts.map +1 -0
  17. package/dist/core/chat/chat.dto.d.ts +68 -0
  18. package/dist/core/chat/chat.dto.d.ts.map +1 -0
  19. package/dist/core/chat/chat.service.d.ts +10 -0
  20. package/dist/core/chat/chat.service.d.ts.map +1 -0
  21. package/dist/core/chat/chat.store.d.ts +20 -0
  22. package/dist/core/chat/chat.store.d.ts.map +1 -0
  23. package/dist/core/{models/index.d.ts → chat/chat.types.d.ts} +6 -2
  24. package/dist/core/chat/chat.types.d.ts.map +1 -0
  25. package/dist/core/chat/chat.utils.d.ts +23 -0
  26. package/dist/core/chat/chat.utils.d.ts.map +1 -0
  27. package/dist/core/chat/index.d.ts +5 -0
  28. package/dist/core/chat/index.d.ts.map +1 -0
  29. package/dist/core/lib/http-client.d.ts +19 -0
  30. package/dist/core/lib/http-client.d.ts.map +1 -0
  31. package/dist/core/lib/logger.d.ts.map +1 -0
  32. package/dist/core/lib/store.d.ts +13 -0
  33. package/dist/core/lib/store.d.ts.map +1 -0
  34. package/dist/gaia-chat-ui.es.js +1929 -1702
  35. package/dist/gaia-chat-ui.es.js.map +1 -1
  36. package/dist/gaia-chat-ui.umd.js +121 -121
  37. package/dist/gaia-chat-ui.umd.js.map +1 -1
  38. package/dist/ui/chat/chat-menu.d.ts.map +1 -1
  39. package/dist/ui/chat/chat.d.ts +9 -7
  40. package/dist/ui/chat/chat.d.ts.map +1 -1
  41. package/dist/ui/chat/message/abstract-message.d.ts +1 -1
  42. package/dist/ui/chat/message/abstract-message.d.ts.map +1 -1
  43. package/dist/ui/chat/message/assistant-message.d.ts +1 -1
  44. package/dist/ui/chat/message/assistant-message.d.ts.map +1 -1
  45. package/dist/ui/chat/message/notification-message.d.ts +1 -1
  46. package/dist/ui/chat/message/notification-message.d.ts.map +1 -1
  47. package/dist/ui/chat/message/user-message.d.ts +1 -1
  48. package/dist/ui/chat/message/user-message.d.ts.map +1 -1
  49. package/dist/ui/chat/message-list.d.ts +1 -1
  50. package/dist/ui/chat/message-list.d.ts.map +1 -1
  51. package/dist/ui/primitives/citation/citation.d.ts +1 -1
  52. package/dist/ui/primitives/citation/citation.d.ts.map +1 -1
  53. package/dist/ui/primitives/citation-list/citation-list.d.ts +1 -1
  54. package/dist/ui/primitives/citation-list/citation-list.d.ts.map +1 -1
  55. package/package.json +1 -1
  56. package/dist/core/dtos/json-patch.d.ts +0 -7
  57. package/dist/core/dtos/json-patch.d.ts.map +0 -1
  58. package/dist/core/dtos/notification.d.ts +0 -24
  59. package/dist/core/dtos/notification.d.ts.map +0 -1
  60. package/dist/core/dtos/sse.d.ts +0 -13
  61. package/dist/core/dtos/sse.d.ts.map +0 -1
  62. package/dist/core/facades/chat-facade.d.ts +0 -6
  63. package/dist/core/facades/chat-facade.d.ts.map +0 -1
  64. package/dist/core/models/index.d.ts.map +0 -1
  65. package/dist/core/services/chat-service.d.ts +0 -16
  66. package/dist/core/services/chat-service.d.ts.map +0 -1
  67. package/dist/core/store/chat-store.d.ts +0 -16
  68. package/dist/core/store/chat-store.d.ts.map +0 -1
  69. package/dist/core/utils/logger.d.ts.map +0 -1
  70. package/dist/core/utils/type-guards.d.ts +0 -6
  71. package/dist/core/utils/type-guards.d.ts.map +0 -1
  72. /package/dist/core/{utils → lib}/logger.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ export declare const authRequestInterceptor: (_: RequestInfo, config: RequestInit) => Promise<RequestInit>;
2
+ //# sourceMappingURL=auth.interceptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.interceptor.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth.interceptor.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,GACjC,GAAG,WAAW,EACd,QAAQ,WAAW,KAClB,OAAO,CAAC,WAAW,CAarB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { AuthConfig } from './auth.types';
2
+ import { AuthStrategy } from './strategies/strategy.interface';
3
+ export declare class AuthService {
4
+ protected strategy: AuthStrategy | null;
5
+ init(config: AuthConfig): Promise<void>;
6
+ authorize(): Promise<void>;
7
+ refresh(): Promise<void>;
8
+ logout(): Promise<void>;
9
+ isAuthenticated(): boolean;
10
+ protected hasStrategy(): asserts this is this & {
11
+ strategy: AuthStrategy;
12
+ };
13
+ }
14
+ //# sourceMappingURL=auth.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D,qBAAa,WAAW;IACtB,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAQ;IAEzC,IAAI,CAAC,MAAM,EAAE,UAAU;IA0BvB,SAAS;IAMT,OAAO;IAMP,MAAM;IAMZ,eAAe,IAAI,OAAO;IAK1B,SAAS,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,GAAG;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE;CAK3E"}
@@ -0,0 +1,22 @@
1
+ import { Store } from '../lib/store';
2
+ import { AuthState } from './auth.types';
3
+ export declare class AuthStore extends Store<AuthState> {
4
+ private readonly _authStorageKey;
5
+ private readonly _refreshBufferSeconds;
6
+ private expirationTimer?;
7
+ constructor();
8
+ setToken(token: {
9
+ accessToken: string;
10
+ expires: Date;
11
+ isVisitor: boolean;
12
+ }): void;
13
+ clearToken(): void;
14
+ hasValidToken(): boolean;
15
+ isVisitorToken(): boolean;
16
+ private _isTokenExpired;
17
+ private _saveToStorage;
18
+ private _loadFromStorage;
19
+ private _clearStorage;
20
+ private _startExpirationTimer;
21
+ }
22
+ //# sourceMappingURL=auth.store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.store.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAC;AAE1D,qBAAa,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC;IAC7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;IAC9D,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAO;IAC7C,OAAO,CAAC,eAAe,CAAC,CAAiB;;IAclC,QAAQ,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,IAAI,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE;IAc1E,UAAU;IAaV,aAAa,IAAI,OAAO;IAQxB,cAAc,IAAI,OAAO;IAIhC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,qBAAqB;CAU9B"}
@@ -0,0 +1,16 @@
1
+ import { State } from '../lib/store';
2
+ export type AuthConfig = {
3
+ vismaToken: string | null;
4
+ isVisitor: boolean;
5
+ };
6
+ export interface StoredAuthState {
7
+ accessToken: string;
8
+ expires: string;
9
+ isVisitor: true;
10
+ }
11
+ export interface AuthState extends State {
12
+ accessToken: string | null;
13
+ expires: Date | null;
14
+ isVisitor: boolean;
15
+ }
16
+ //# sourceMappingURL=auth.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,SAAU,SAAQ,KAAK;IACtC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,5 @@
1
+ import { AuthService } from './auth.service';
2
+ import { AuthStore } from './auth.store';
3
+ export declare const authStore$: AuthStore;
4
+ export declare const authService: AuthService;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,UAAU,WAAkB,CAAC;AAC1C,eAAO,MAAM,WAAW,aAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface AuthStrategy {
2
+ authorize(): Promise<void>;
3
+ isAuthenticated(): boolean;
4
+ refresh(): Promise<void>;
5
+ logout(): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=strategy.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.interface.d.ts","sourceRoot":"","sources":["../../../../src/core/auth/strategies/strategy.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,eAAe,IAAI,OAAO,CAAC;IAC3B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
@@ -0,0 +1,12 @@
1
+ import { AuthStrategy } from './strategy.interface';
2
+ export type VisitorTokenResponse = {
3
+ accessToken: string;
4
+ expires: string;
5
+ };
6
+ export declare class VisitorStrategy implements AuthStrategy {
7
+ authorize(): Promise<void>;
8
+ isAuthenticated(): boolean;
9
+ refresh(): Promise<void>;
10
+ logout(): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=visitor.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visitor.strategy.d.ts","sourceRoot":"","sources":["../../../../src/core/auth/strategies/visitor.strategy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,eAAgB,YAAW,YAAY;IAC5C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAchC,eAAe,IAAI,OAAO;IAIpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
@@ -0,0 +1,10 @@
1
+ import { AuthStrategy } from './strategy.interface';
2
+ export declare class VismaUserStrategy implements AuthStrategy {
3
+ private readonly vismaToken;
4
+ constructor(vismaToken: string);
5
+ authorize(): Promise<void>;
6
+ isAuthenticated(): boolean;
7
+ refresh(): Promise<void>;
8
+ logout(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=visma-user.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visma-user.strategy.d.ts","sourceRoot":"","sources":["../../../../src/core/auth/strategies/visma-user.strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,qBAAa,iBAAkB,YAAW,YAAY;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM;IAEzC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAYhC,eAAe,IAAI,OAAO;IAIpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
@@ -0,0 +1,68 @@
1
+ import { EventSourceMessage } from 'eventsource-client';
2
+ import { ChatMessage, NotificationType } from './chat.types';
3
+ /**
4
+ * Chat DTOs
5
+ */
6
+ export type SendMessageRequest = {
7
+ profileId: string;
8
+ conversationId: string | null;
9
+ content: string;
10
+ };
11
+ export type ApproveToolCallRequest = {
12
+ profileId: string;
13
+ messageId: string;
14
+ isGranted: boolean;
15
+ };
16
+ export type GetConversationByIdResponse = {
17
+ id: string;
18
+ messages: ChatMessage[];
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ };
22
+ /**
23
+ * Json Patch Event
24
+ */
25
+ export type JsonPatchOp = 'add' | 'remove' | 'replace';
26
+ export type JsonPatch = {
27
+ op: JsonPatchOp;
28
+ path: string;
29
+ value: unknown;
30
+ };
31
+ export type JsonPatchEvent = Omit<EventSourceMessage, 'data'> & {
32
+ event: 'patch';
33
+ data: JsonPatch;
34
+ };
35
+ /**
36
+ * Notification Event
37
+ */
38
+ type BaseNotificationPayload = {
39
+ timestamp: string;
40
+ message: string;
41
+ details: Record<string, unknown>;
42
+ };
43
+ type InfoPayload = BaseNotificationPayload & {
44
+ notificationType: NotificationType.Info;
45
+ };
46
+ type SuccessPayload = BaseNotificationPayload & {
47
+ notificationType: NotificationType.Success;
48
+ };
49
+ type WarningPayload = BaseNotificationPayload & {
50
+ notificationType: NotificationType.Warning;
51
+ };
52
+ type ErrorPayload = BaseNotificationPayload & {
53
+ notificationType: NotificationType.Info;
54
+ errorCode: string;
55
+ exceptionType?: string;
56
+ stackTrace?: string;
57
+ };
58
+ export type NotificationPayload = InfoPayload | SuccessPayload | WarningPayload | ErrorPayload;
59
+ export type NotificationEvent = EventSourceMessage & {
60
+ event: 'notify';
61
+ data: NotificationPayload;
62
+ };
63
+ /**
64
+ * Server Sent Event
65
+ */
66
+ export type ServerSentEvent = JsonPatchEvent | NotificationEvent;
67
+ export {};
68
+ //# sourceMappingURL=chat.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.dto.d.ts","sourceRoot":"","sources":["../../../src/core/chat/chat.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE7D;;GAEG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA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AG,cAAc,GAAG,YAAY,CAAC;AAE/F,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { GetConversationByIdResponse } from './chat.dto';
2
+ export declare class ChatService {
3
+ init(): Promise<void>;
4
+ sendMessage(profileId: string, content: string): Promise<void>;
5
+ approveToolCalls(profileId: string, messageId: string, isGranted: boolean): Promise<void>;
6
+ startNewConversation(): Promise<void>;
7
+ getConversationById(id: string): Promise<GetConversationByIdResponse>;
8
+ private handleStreamRequest;
9
+ }
10
+ //# sourceMappingURL=chat.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.service.d.ts","sourceRoot":"","sources":["../../../src/core/chat/chat.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAE5B,MAAM,YAAY,CAAC;AAUpB,qBAAa,WAAW;IAChB,IAAI;IAcJ,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9D,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBzF,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;YAQ7D,mBAAmB;CAmClC"}
@@ -0,0 +1,20 @@
1
+ import { Store } from '../lib/store';
2
+ import { JsonPatchEvent } from './chat.dto';
3
+ import { ChatMessage, ConversationState } from './chat.types';
4
+ export declare class ChatStore extends Store<ConversationState> {
5
+ private readonly _conversationStorageKey;
6
+ constructor();
7
+ getMessages(): ChatMessage[];
8
+ getLastMessage(): ChatMessage | null;
9
+ setStatus(status: ConversationState['status']): void;
10
+ setError(error: string): void;
11
+ setMessages(messages: Record<string, ChatMessage>): void;
12
+ addMessage(message: ChatMessage): void;
13
+ private setId;
14
+ applyPatchOperation(patch: JsonPatchEvent): void;
15
+ resetState(): void;
16
+ private _saveToStorage;
17
+ private _loadFromStorage;
18
+ clearStorage(): void;
19
+ }
20
+ //# sourceMappingURL=chat.store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.store.d.ts","sourceRoot":"","sources":["../../../src/core/chat/chat.store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE9D,qBAAa,SAAU,SAAQ,KAAK,CAAC,iBAAiB,CAAC;IACrD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAsC;;IAcvE,WAAW,IAAI,WAAW,EAAE;IAI5B,cAAc,IAAI,WAAW,GAAG,IAAI;IAKpC,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC;IAO7C,QAAQ,CAAC,KAAK,EAAE,MAAM;IAQtB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAOjD,UAAU,CAAC,OAAO,EAAE,WAAW;IAUtC,OAAO,CAAC,KAAK;IAQN,mBAAmB,CAAC,KAAK,EAAE,cAAc;IAQzC,UAAU;IASjB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAWjB,YAAY;CAGpB"}
@@ -61,7 +61,11 @@ export type ChatMessage = UserMessage | AssistantMessage | ToolMessage | Notific
61
61
  export interface ConversationState {
62
62
  readonly id: string | null;
63
63
  readonly messages: Record<string, ChatMessage>;
64
- readonly status: 'idle' | 'sending' | 'streaming';
64
+ readonly status: 'idle' | 'sending' | 'streaming' | 'error';
65
65
  readonly error?: string;
66
66
  }
67
- //# sourceMappingURL=index.d.ts.map
67
+ export declare function isUserMessage(message: ChatMessage): message is UserMessage;
68
+ export declare function isAssistantMessage(message: ChatMessage): message is AssistantMessage;
69
+ export declare function isToolMessage(message: ChatMessage): message is ToolMessage;
70
+ export declare function isNotificationMessage(message: ChatMessage): message is NotificationMessage;
71
+ //# sourceMappingURL=chat.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/core/chat/chat.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,cAA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AW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,IAAI,WAAW,CAE1E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,IAAI,gBAAgB,CAEpF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,IAAI,WAAW,CAE1E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,IAAI,mBAAmB,CAE1F"}
@@ -0,0 +1,23 @@
1
+ import { GetConversationByIdResponse, JsonPatchEvent, NotificationEvent } from './chat.dto';
2
+ import { ChatMessage, NotificationMessage } from './chat.types';
3
+ export declare const createUserMessage: (content: string) => ChatMessage;
4
+ export declare const mapNotificationEventToMessage: (event: NotificationEvent) => NotificationMessage;
5
+ export declare const mapConversationToMessages: (conversation: GetConversationByIdResponse) => Record<string, ChatMessage>;
6
+ export interface SseEventHandlers {
7
+ onPatch: (patchEvent: JsonPatchEvent) => void;
8
+ onNotify: (notification: NotificationEvent) => void;
9
+ onError: (error: Error) => void;
10
+ onClose: () => void;
11
+ }
12
+ /**
13
+ * Processes a ReadableStream from a Server-Sent Events endpoint.
14
+ * @param stream The ReadableStream from the response body.
15
+ * @param handlers An object containing callback functions for different event types.
16
+ */
17
+ export declare function sseStreamReader(stream: ReadableStream<Uint8Array<ArrayBuffer>>, handlers: SseEventHandlers): Promise<void>;
18
+ declare global {
19
+ interface ReadableStream<R = any> {
20
+ [Symbol.asyncIterator](): AsyncIterableIterator<R>;
21
+ }
22
+ }
23
+ //# sourceMappingURL=chat.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.utils.d.ts","sourceRoot":"","sources":["../../../src/core/chat/chat.utils.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEhE,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,WAMlD,CAAC;AAEH,eAAO,MAAM,6BAA6B,GAAI,OAAO,iBAAiB,KAAG,mBAWxE,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,cAAc,2BAA2B,KACxC,MAAM,CAAC,MAAM,EAAE,WAAW,CAe5B,CAAC;AAGF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,CAAC,YAAY,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpD,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAC/C,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,cAAc,CAAC,CAAC,GAAG,GAAG;QAC9B,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;KACpD;CACF"}
@@ -0,0 +1,5 @@
1
+ import { ChatService } from './chat.service';
2
+ import { ChatStore } from './chat.store';
3
+ export declare const chatStore$: ChatStore;
4
+ export declare const chatService: ChatService;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,UAAU,WAAkB,CAAC;AAC1C,eAAO,MAAM,WAAW,aAAoB,CAAC"}
@@ -0,0 +1,19 @@
1
+ interface HttpClientResponse<T> extends Response {
2
+ json(): Promise<T>;
3
+ }
4
+ export type RequestInterceptor = (url: RequestInfo, config: RequestInit) => Promise<RequestInit>;
5
+ export type ResponseInterceptor = (response: Response) => Promise<Response>;
6
+ declare class HttpClient {
7
+ private _baseUrl;
8
+ private _requestInterceptors;
9
+ private _responseInterceptors;
10
+ setBaseUrl(baseUrl: string): void;
11
+ addRequestInterceptor(interceptor: RequestInterceptor): void;
12
+ removeRequestInterceptor(interceptor: RequestInterceptor): void;
13
+ addResponseInterceptor(interceptor: ResponseInterceptor): void;
14
+ removeResponseInterceptor(interceptor: ResponseInterceptor): void;
15
+ fetch<T>(input: RequestInfo, init?: RequestInit): Promise<HttpClientResponse<T>>;
16
+ }
17
+ export declare const httpClient: HttpClient;
18
+ export {};
19
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/core/lib/http-client.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB,CAAC,CAAC,CAAE,SAAQ,QAAQ;IAC9C,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;CACpB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AACjG,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,C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GAAG,IAAI;IAI/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;CAG/E;AAED,eAAO,MAAM,MAAM,QAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Signal } from '@lit-labs/preact-signals';
2
+ export interface State {
3
+ error?: string;
4
+ }
5
+ export declare abstract class Store<T extends State> {
6
+ protected readonly _state: Signal<T>;
7
+ constructor(initialState: T);
8
+ subscribe(fn: (value: T) => void): () => void;
9
+ get state(): T;
10
+ protected setState(state: Partial<T>): void;
11
+ setError(error: string): void;
12
+ }
13
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/core/lib/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,8BAAsB,KAAK,CAAC,CAAC,SAAS,KAAK;IACzC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;gBAEzB,YAAY,EAAE,CAAC;IAIpB,SAAS,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI;IAIvC,IAAW,KAAK,IAAI,CAAC,CAEpB;IAED,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAO7B,QAAQ,CAAC,KAAK,EAAE,MAAM;CAM9B"}