@haylee-ai/chat-sdk 1.0.3 → 1.0.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.
- package/README.md +245 -75
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,8 @@ await client.messages.stream(
|
|
|
79
79
|
- [AuthenticationError](#classesauthenticationerrormd)
|
|
80
80
|
- [AuthorizationError](#classesauthorizationerrormd)
|
|
81
81
|
- [BaseEvent](#classesbaseeventmd)
|
|
82
|
+
- [ConversationInfoContent](#classesconversationinfocontentmd)
|
|
83
|
+
- [ConversationInfoEvent](#classesconversationinfoeventmd)
|
|
82
84
|
- [CreateMessageDto](#classescreatemessagedtomd)
|
|
83
85
|
- [EndEvent](#classesendeventmd)
|
|
84
86
|
- [HayleeAI](#classeshayleeaimd)
|
|
@@ -112,7 +114,7 @@ await client.messages.stream(
|
|
|
112
114
|
|
|
113
115
|
# Class: AuthenticationError
|
|
114
116
|
|
|
115
|
-
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
117
|
+
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authentication.error.ts#L3)
|
|
116
118
|
|
|
117
119
|
## Extends
|
|
118
120
|
|
|
@@ -124,7 +126,7 @@ Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo
|
|
|
124
126
|
|
|
125
127
|
> **new AuthenticationError**(`message`): `AuthenticationError`
|
|
126
128
|
|
|
127
|
-
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
129
|
+
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authentication.error.ts#L6)
|
|
128
130
|
|
|
129
131
|
#### Parameters
|
|
130
132
|
|
|
@@ -170,7 +172,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
170
172
|
|
|
171
173
|
> `readonly` **name**: `string` = `"AuthenticationError"`
|
|
172
174
|
|
|
173
|
-
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
175
|
+
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authentication.error.ts#L4)
|
|
174
176
|
|
|
175
177
|
#### Overrides
|
|
176
178
|
|
|
@@ -321,7 +323,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
321
323
|
|
|
322
324
|
# Class: AuthorizationError
|
|
323
325
|
|
|
324
|
-
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
326
|
+
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authorization.error.ts#L3)
|
|
325
327
|
|
|
326
328
|
## Extends
|
|
327
329
|
|
|
@@ -333,7 +335,7 @@ Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/
|
|
|
333
335
|
|
|
334
336
|
> **new AuthorizationError**(`message`): `AuthorizationError`
|
|
335
337
|
|
|
336
|
-
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
338
|
+
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authorization.error.ts#L6)
|
|
337
339
|
|
|
338
340
|
#### Parameters
|
|
339
341
|
|
|
@@ -379,7 +381,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
379
381
|
|
|
380
382
|
> `readonly` **name**: `string` = `"AuthorizationError"`
|
|
381
383
|
|
|
382
|
-
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
384
|
+
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authorization.error.ts#L4)
|
|
383
385
|
|
|
384
386
|
#### Overrides
|
|
385
387
|
|
|
@@ -530,7 +532,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
530
532
|
|
|
531
533
|
# Class: BaseEvent
|
|
532
534
|
|
|
533
|
-
Defined in: [src/messages/types.ts:
|
|
535
|
+
Defined in: [src/messages/types.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L13)
|
|
534
536
|
|
|
535
537
|
Base event for Streaming
|
|
536
538
|
BaseEvent
|
|
@@ -538,6 +540,7 @@ Base event for Streaming
|
|
|
538
540
|
## Extended by
|
|
539
541
|
|
|
540
542
|
- [`LlmTokenEvent`](#classesllmtokeneventmd)
|
|
543
|
+
- [`ConversationInfoEvent`](#classesconversationinfoeventmd)
|
|
541
544
|
- [`ToolEvent`](#interfacestooleventmd)
|
|
542
545
|
|
|
543
546
|
## Constructors
|
|
@@ -556,7 +559,7 @@ Base event for Streaming
|
|
|
556
559
|
|
|
557
560
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
558
561
|
|
|
559
|
-
Defined in: [src/messages/types.ts:
|
|
562
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
560
563
|
|
|
561
564
|
Used to separate streams
|
|
562
565
|
|
|
@@ -566,11 +569,118 @@ Used to separate streams
|
|
|
566
569
|
|
|
567
570
|
> **node**: `string`
|
|
568
571
|
|
|
569
|
-
Defined in: [src/messages/types.ts:
|
|
572
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
570
573
|
|
|
571
574
|
Source node in langgraph
|
|
572
575
|
|
|
573
576
|
|
|
577
|
+
<a name="classesconversationinfocontentmd"></a>
|
|
578
|
+
|
|
579
|
+
[**@haylee-ai/chat-sdk v1.0.0**](#readmemd)
|
|
580
|
+
|
|
581
|
+
***
|
|
582
|
+
|
|
583
|
+
[@haylee-ai/chat-sdk](#readmemd) / ConversationInfoContent
|
|
584
|
+
|
|
585
|
+
# Class: ConversationInfoContent
|
|
586
|
+
|
|
587
|
+
Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L55)
|
|
588
|
+
|
|
589
|
+
## Constructors
|
|
590
|
+
|
|
591
|
+
### Constructor
|
|
592
|
+
|
|
593
|
+
> **new ConversationInfoContent**(): `ConversationInfoContent`
|
|
594
|
+
|
|
595
|
+
#### Returns
|
|
596
|
+
|
|
597
|
+
`ConversationInfoContent`
|
|
598
|
+
|
|
599
|
+
## Properties
|
|
600
|
+
|
|
601
|
+
### subject
|
|
602
|
+
|
|
603
|
+
> **subject**: `string`
|
|
604
|
+
|
|
605
|
+
Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L57)
|
|
606
|
+
|
|
607
|
+
***
|
|
608
|
+
|
|
609
|
+
### type
|
|
610
|
+
|
|
611
|
+
> **type**: `"created"` \| `"updated"` \| `"deleted"` \| `"error"`
|
|
612
|
+
|
|
613
|
+
Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L56)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
<a name="classesconversationinfoeventmd"></a>
|
|
617
|
+
|
|
618
|
+
[**@haylee-ai/chat-sdk v1.0.0**](#readmemd)
|
|
619
|
+
|
|
620
|
+
***
|
|
621
|
+
|
|
622
|
+
[@haylee-ai/chat-sdk](#readmemd) / ConversationInfoEvent
|
|
623
|
+
|
|
624
|
+
# Class: ConversationInfoEvent
|
|
625
|
+
|
|
626
|
+
Defined in: [src/messages/types.ts:51](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L51)
|
|
627
|
+
|
|
628
|
+
Base event for Streaming
|
|
629
|
+
BaseEvent
|
|
630
|
+
|
|
631
|
+
## Extends
|
|
632
|
+
|
|
633
|
+
- [`BaseEvent`](#classesbaseeventmd)
|
|
634
|
+
|
|
635
|
+
## Constructors
|
|
636
|
+
|
|
637
|
+
### Constructor
|
|
638
|
+
|
|
639
|
+
> **new ConversationInfoEvent**(): `ConversationInfoEvent`
|
|
640
|
+
|
|
641
|
+
#### Returns
|
|
642
|
+
|
|
643
|
+
`ConversationInfoEvent`
|
|
644
|
+
|
|
645
|
+
#### Inherited from
|
|
646
|
+
|
|
647
|
+
[`BaseEvent`](#classesbaseeventmd).[`constructor`](#constructor)
|
|
648
|
+
|
|
649
|
+
## Properties
|
|
650
|
+
|
|
651
|
+
### content
|
|
652
|
+
|
|
653
|
+
> **content**: [`ConversationInfoContent`](#classesconversationinfocontentmd)
|
|
654
|
+
|
|
655
|
+
Defined in: [src/messages/types.ts:52](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L52)
|
|
656
|
+
|
|
657
|
+
***
|
|
658
|
+
|
|
659
|
+
### kind
|
|
660
|
+
|
|
661
|
+
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
662
|
+
|
|
663
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
664
|
+
|
|
665
|
+
Used to separate streams
|
|
666
|
+
|
|
667
|
+
#### Inherited from
|
|
668
|
+
|
|
669
|
+
[`BaseEvent`](#classesbaseeventmd).[`kind`](#kind)
|
|
670
|
+
|
|
671
|
+
***
|
|
672
|
+
|
|
673
|
+
### node
|
|
674
|
+
|
|
675
|
+
> **node**: `string`
|
|
676
|
+
|
|
677
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
678
|
+
|
|
679
|
+
#### Inherited from
|
|
680
|
+
|
|
681
|
+
[`BaseEvent`](#classesbaseeventmd).[`node`](#node)
|
|
682
|
+
|
|
683
|
+
|
|
574
684
|
<a name="classescreatemessagedtomd"></a>
|
|
575
685
|
|
|
576
686
|
[**@haylee-ai/chat-sdk v1.0.0**](#readmemd)
|
|
@@ -581,7 +691,7 @@ Source node in langgraph
|
|
|
581
691
|
|
|
582
692
|
# Class: CreateMessageDto
|
|
583
693
|
|
|
584
|
-
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
694
|
+
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L8)
|
|
585
695
|
|
|
586
696
|
DTO for creating a message
|
|
587
697
|
|
|
@@ -597,11 +707,19 @@ DTO for creating a message
|
|
|
597
707
|
|
|
598
708
|
## Properties
|
|
599
709
|
|
|
710
|
+
### conversation\_id?
|
|
711
|
+
|
|
712
|
+
> `optional` **conversation\_id**: `string`
|
|
713
|
+
|
|
714
|
+
Defined in: [src/types/chat.interface.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L13)
|
|
715
|
+
|
|
716
|
+
***
|
|
717
|
+
|
|
600
718
|
### message
|
|
601
719
|
|
|
602
720
|
> **message**: `string`
|
|
603
721
|
|
|
604
|
-
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
722
|
+
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L11)
|
|
605
723
|
|
|
606
724
|
User message
|
|
607
725
|
|
|
@@ -616,7 +734,7 @@ User message
|
|
|
616
734
|
|
|
617
735
|
# Class: EndEvent
|
|
618
736
|
|
|
619
|
-
Defined in: [src/messages/types.ts:
|
|
737
|
+
Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L62)
|
|
620
738
|
|
|
621
739
|
## Constructors
|
|
622
740
|
|
|
@@ -634,7 +752,7 @@ Defined in: [src/messages/types.ts:49](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
634
752
|
|
|
635
753
|
> **success**: `boolean`
|
|
636
754
|
|
|
637
|
-
Defined in: [src/messages/types.ts:
|
|
755
|
+
Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L63)
|
|
638
756
|
|
|
639
757
|
|
|
640
758
|
<a name="classeshayleeaimd"></a>
|
|
@@ -647,7 +765,7 @@ Defined in: [src/messages/types.ts:50](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
647
765
|
|
|
648
766
|
# Class: HayleeAI
|
|
649
767
|
|
|
650
|
-
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
768
|
+
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/index.ts#L7)
|
|
651
769
|
|
|
652
770
|
Instantiate a new HayleeAI connection
|
|
653
771
|
|
|
@@ -661,7 +779,7 @@ Instantiate a new HayleeAI connection
|
|
|
661
779
|
|
|
662
780
|
> **new HayleeAI**(`options`): `HayleeAI`
|
|
663
781
|
|
|
664
|
-
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
782
|
+
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/index.ts#L13)
|
|
665
783
|
|
|
666
784
|
#### Parameters
|
|
667
785
|
|
|
@@ -685,7 +803,7 @@ HayleeAIChatClientOptions
|
|
|
685
803
|
|
|
686
804
|
> **messages**: [`MessageService`](#classesmessageservicemd)
|
|
687
805
|
|
|
688
|
-
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
806
|
+
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/index.ts#L8)
|
|
689
807
|
|
|
690
808
|
## Methods
|
|
691
809
|
|
|
@@ -693,7 +811,7 @@ Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/bl
|
|
|
693
811
|
|
|
694
812
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
695
813
|
|
|
696
|
-
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
814
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L35)
|
|
697
815
|
|
|
698
816
|
Internal stream callout
|
|
699
817
|
|
|
@@ -730,7 +848,7 @@ Abort signal
|
|
|
730
848
|
|
|
731
849
|
# Class: HayleeAIClient
|
|
732
850
|
|
|
733
|
-
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
851
|
+
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L18)
|
|
734
852
|
|
|
735
853
|
Internal HayleeAI Client. Do not use unless necessary.
|
|
736
854
|
HayleeAIClient
|
|
@@ -745,7 +863,7 @@ Internal HayleeAI Client. Do not use unless necessary.
|
|
|
745
863
|
|
|
746
864
|
> **new HayleeAIClient**(`options`): `HayleeAIClient`
|
|
747
865
|
|
|
748
|
-
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
866
|
+
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L26)
|
|
749
867
|
|
|
750
868
|
#### Parameters
|
|
751
869
|
|
|
@@ -765,7 +883,7 @@ Auth, and baseURL
|
|
|
765
883
|
|
|
766
884
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
767
885
|
|
|
768
|
-
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
886
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L35)
|
|
769
887
|
|
|
770
888
|
Internal stream callout
|
|
771
889
|
|
|
@@ -798,7 +916,7 @@ Abort signal
|
|
|
798
916
|
|
|
799
917
|
# Class: HayleeAIError
|
|
800
918
|
|
|
801
|
-
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
919
|
+
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/base.ts#L1)
|
|
802
920
|
|
|
803
921
|
## Extends
|
|
804
922
|
|
|
@@ -817,7 +935,7 @@ Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-
|
|
|
817
935
|
|
|
818
936
|
> **new HayleeAIError**(`message`): `HayleeAIError`
|
|
819
937
|
|
|
820
|
-
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
938
|
+
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/base.ts#L4)
|
|
821
939
|
|
|
822
940
|
#### Parameters
|
|
823
941
|
|
|
@@ -863,7 +981,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
863
981
|
|
|
864
982
|
> `readonly` **name**: `string` = `"HayleeAIError"`
|
|
865
983
|
|
|
866
|
-
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
984
|
+
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/base.ts#L2)
|
|
867
985
|
|
|
868
986
|
#### Overrides
|
|
869
987
|
|
|
@@ -1014,7 +1132,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1014
1132
|
|
|
1015
1133
|
# Class: LlmTokenContent
|
|
1016
1134
|
|
|
1017
|
-
Defined in: [src/messages/types.ts:
|
|
1135
|
+
Defined in: [src/messages/types.ts:28](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L28)
|
|
1018
1136
|
|
|
1019
1137
|
LLmTokenContent
|
|
1020
1138
|
|
|
@@ -1034,7 +1152,7 @@ LLmTokenContent
|
|
|
1034
1152
|
|
|
1035
1153
|
> **text**: `string`
|
|
1036
1154
|
|
|
1037
|
-
Defined in: [src/messages/types.ts:
|
|
1155
|
+
Defined in: [src/messages/types.ts:36](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L36)
|
|
1038
1156
|
|
|
1039
1157
|
***
|
|
1040
1158
|
|
|
@@ -1042,7 +1160,7 @@ Defined in: [src/messages/types.ts:35](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1042
1160
|
|
|
1043
1161
|
> **type**: `"text"`
|
|
1044
1162
|
|
|
1045
|
-
Defined in: [src/messages/types.ts:
|
|
1163
|
+
Defined in: [src/messages/types.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L32)
|
|
1046
1164
|
|
|
1047
1165
|
|
|
1048
1166
|
<a name="classesllmtokeneventmd"></a>
|
|
@@ -1055,7 +1173,7 @@ Defined in: [src/messages/types.ts:31](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1055
1173
|
|
|
1056
1174
|
# Class: LlmTokenEvent
|
|
1057
1175
|
|
|
1058
|
-
Defined in: [src/messages/types.ts:
|
|
1176
|
+
Defined in: [src/messages/types.ts:39](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L39)
|
|
1059
1177
|
|
|
1060
1178
|
Base event for Streaming
|
|
1061
1179
|
BaseEvent
|
|
@@ -1084,7 +1202,7 @@ Base event for Streaming
|
|
|
1084
1202
|
|
|
1085
1203
|
> **content**: [`LlmTokenContent`](#classesllmtokencontentmd)[]
|
|
1086
1204
|
|
|
1087
|
-
Defined in: [src/messages/types.ts:
|
|
1205
|
+
Defined in: [src/messages/types.ts:43](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L43)
|
|
1088
1206
|
|
|
1089
1207
|
***
|
|
1090
1208
|
|
|
@@ -1092,7 +1210,7 @@ Defined in: [src/messages/types.ts:42](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1092
1210
|
|
|
1093
1211
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1094
1212
|
|
|
1095
|
-
Defined in: [src/messages/types.ts:
|
|
1213
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
1096
1214
|
|
|
1097
1215
|
Used to separate streams
|
|
1098
1216
|
|
|
@@ -1106,7 +1224,7 @@ Used to separate streams
|
|
|
1106
1224
|
|
|
1107
1225
|
> **model**: `string`
|
|
1108
1226
|
|
|
1109
|
-
Defined in: [src/messages/types.ts:
|
|
1227
|
+
Defined in: [src/messages/types.ts:47](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L47)
|
|
1110
1228
|
|
|
1111
1229
|
***
|
|
1112
1230
|
|
|
@@ -1114,7 +1232,7 @@ Defined in: [src/messages/types.ts:46](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1114
1232
|
|
|
1115
1233
|
> **node**: `string`
|
|
1116
1234
|
|
|
1117
|
-
Defined in: [src/messages/types.ts:
|
|
1235
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
1118
1236
|
|
|
1119
1237
|
#### Inherited from
|
|
1120
1238
|
|
|
@@ -1131,7 +1249,7 @@ Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1131
1249
|
|
|
1132
1250
|
# Class: MessageService
|
|
1133
1251
|
|
|
1134
|
-
Defined in: [src/messages/message.service.ts:
|
|
1252
|
+
Defined in: [src/messages/message.service.ts:59](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L59)
|
|
1135
1253
|
|
|
1136
1254
|
## Constructors
|
|
1137
1255
|
|
|
@@ -1139,7 +1257,7 @@ Defined in: [src/messages/message.service.ts:49](https://github.com/vonuyvicoo/h
|
|
|
1139
1257
|
|
|
1140
1258
|
> **new MessageService**(`client`): `MessageService`
|
|
1141
1259
|
|
|
1142
|
-
Defined in: [src/messages/message.service.ts:
|
|
1260
|
+
Defined in: [src/messages/message.service.ts:61](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L61)
|
|
1143
1261
|
|
|
1144
1262
|
#### Parameters
|
|
1145
1263
|
|
|
@@ -1157,7 +1275,7 @@ Defined in: [src/messages/message.service.ts:51](https://github.com/vonuyvicoo/h
|
|
|
1157
1275
|
|
|
1158
1276
|
> **stream**(`payload`, `options?`): `Promise`\<`void`\>
|
|
1159
1277
|
|
|
1160
|
-
Defined in: [src/messages/message.service.ts:
|
|
1278
|
+
Defined in: [src/messages/message.service.ts:67](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L67)
|
|
1161
1279
|
|
|
1162
1280
|
#### Parameters
|
|
1163
1281
|
|
|
@@ -1188,7 +1306,7 @@ Config for streaming
|
|
|
1188
1306
|
|
|
1189
1307
|
# Class: NotFoundError
|
|
1190
1308
|
|
|
1191
|
-
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1309
|
+
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/not-found.error.ts#L3)
|
|
1192
1310
|
|
|
1193
1311
|
## Extends
|
|
1194
1312
|
|
|
@@ -1200,7 +1318,7 @@ Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/hayl
|
|
|
1200
1318
|
|
|
1201
1319
|
> **new NotFoundError**(`message`): `NotFoundError`
|
|
1202
1320
|
|
|
1203
|
-
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1321
|
+
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/not-found.error.ts#L6)
|
|
1204
1322
|
|
|
1205
1323
|
#### Parameters
|
|
1206
1324
|
|
|
@@ -1246,7 +1364,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1246
1364
|
|
|
1247
1365
|
> `readonly` **name**: `string` = `"NotFoundError"`
|
|
1248
1366
|
|
|
1249
|
-
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1367
|
+
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/not-found.error.ts#L4)
|
|
1250
1368
|
|
|
1251
1369
|
#### Overrides
|
|
1252
1370
|
|
|
@@ -1397,7 +1515,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1397
1515
|
|
|
1398
1516
|
# Class: ValidationError
|
|
1399
1517
|
|
|
1400
|
-
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1518
|
+
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L3)
|
|
1401
1519
|
|
|
1402
1520
|
## Extends
|
|
1403
1521
|
|
|
@@ -1409,7 +1527,7 @@ Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/hay
|
|
|
1409
1527
|
|
|
1410
1528
|
> **new ValidationError**(`message`, `details?`): `ValidationError`
|
|
1411
1529
|
|
|
1412
|
-
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1530
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L5)
|
|
1413
1531
|
|
|
1414
1532
|
#### Parameters
|
|
1415
1533
|
|
|
@@ -1447,7 +1565,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1447
1565
|
|
|
1448
1566
|
> `optional` **details**: `any`
|
|
1449
1567
|
|
|
1450
|
-
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1568
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L5)
|
|
1451
1569
|
|
|
1452
1570
|
***
|
|
1453
1571
|
|
|
@@ -1467,7 +1585,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1467
1585
|
|
|
1468
1586
|
> `readonly` **name**: `string` = `"ValidationError"`
|
|
1469
1587
|
|
|
1470
|
-
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1588
|
+
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L4)
|
|
1471
1589
|
|
|
1472
1590
|
#### Overrides
|
|
1473
1591
|
|
|
@@ -1618,15 +1736,23 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1618
1736
|
|
|
1619
1737
|
# Enumeration: EventKind
|
|
1620
1738
|
|
|
1621
|
-
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1739
|
+
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L1)
|
|
1622
1740
|
|
|
1623
1741
|
## Enumeration Members
|
|
1624
1742
|
|
|
1743
|
+
### CONVERSATION\_INFO
|
|
1744
|
+
|
|
1745
|
+
> **CONVERSATION\_INFO**: `"conversation_info"`
|
|
1746
|
+
|
|
1747
|
+
Defined in: [src/messages/types.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L4)
|
|
1748
|
+
|
|
1749
|
+
***
|
|
1750
|
+
|
|
1625
1751
|
### LLM\_TOKEN
|
|
1626
1752
|
|
|
1627
1753
|
> **LLM\_TOKEN**: `"llm_token"`
|
|
1628
1754
|
|
|
1629
|
-
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1755
|
+
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L2)
|
|
1630
1756
|
|
|
1631
1757
|
***
|
|
1632
1758
|
|
|
@@ -1634,7 +1760,7 @@ Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1634
1760
|
|
|
1635
1761
|
> **TOOLS**: `"tools"`
|
|
1636
1762
|
|
|
1637
|
-
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1763
|
+
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L3)
|
|
1638
1764
|
|
|
1639
1765
|
|
|
1640
1766
|
<a name="enumerationsrolemd"></a>
|
|
@@ -1647,7 +1773,7 @@ Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1647
1773
|
|
|
1648
1774
|
# Enumeration: Role
|
|
1649
1775
|
|
|
1650
|
-
Defined in: [src/types/chat.interface.ts:
|
|
1776
|
+
Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L19)
|
|
1651
1777
|
|
|
1652
1778
|
## Enumeration Members
|
|
1653
1779
|
|
|
@@ -1655,7 +1781,7 @@ Defined in: [src/types/chat.interface.ts:17](https://github.com/vonuyvicoo/hayle
|
|
|
1655
1781
|
|
|
1656
1782
|
> **AI**: `"ai"`
|
|
1657
1783
|
|
|
1658
|
-
Defined in: [src/types/chat.interface.ts:
|
|
1784
|
+
Defined in: [src/types/chat.interface.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L21)
|
|
1659
1785
|
|
|
1660
1786
|
***
|
|
1661
1787
|
|
|
@@ -1663,7 +1789,7 @@ Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/hayle
|
|
|
1663
1789
|
|
|
1664
1790
|
> **HUMAN**: `"human"`
|
|
1665
1791
|
|
|
1666
|
-
Defined in: [src/types/chat.interface.ts:
|
|
1792
|
+
Defined in: [src/types/chat.interface.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L20)
|
|
1667
1793
|
|
|
1668
1794
|
|
|
1669
1795
|
<a name="enumerationstoolstatusmd"></a>
|
|
@@ -1676,7 +1802,7 @@ Defined in: [src/types/chat.interface.ts:18](https://github.com/vonuyvicoo/hayle
|
|
|
1676
1802
|
|
|
1677
1803
|
# Enumeration: ToolStatus
|
|
1678
1804
|
|
|
1679
|
-
Defined in: [src/messages/types.ts:
|
|
1805
|
+
Defined in: [src/messages/types.ts:75](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L75)
|
|
1680
1806
|
|
|
1681
1807
|
## Enumeration Members
|
|
1682
1808
|
|
|
@@ -1684,7 +1810,7 @@ Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1684
1810
|
|
|
1685
1811
|
> **END**: `"END"`
|
|
1686
1812
|
|
|
1687
|
-
Defined in: [src/messages/types.ts:
|
|
1813
|
+
Defined in: [src/messages/types.ts:77](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L77)
|
|
1688
1814
|
|
|
1689
1815
|
***
|
|
1690
1816
|
|
|
@@ -1692,7 +1818,7 @@ Defined in: [src/messages/types.ts:64](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1692
1818
|
|
|
1693
1819
|
> **ERROR**: `"ERROR"`
|
|
1694
1820
|
|
|
1695
|
-
Defined in: [src/messages/types.ts:
|
|
1821
|
+
Defined in: [src/messages/types.ts:78](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L78)
|
|
1696
1822
|
|
|
1697
1823
|
***
|
|
1698
1824
|
|
|
@@ -1700,7 +1826,7 @@ Defined in: [src/messages/types.ts:65](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1700
1826
|
|
|
1701
1827
|
> **START**: `"START"`
|
|
1702
1828
|
|
|
1703
|
-
Defined in: [src/messages/types.ts:
|
|
1829
|
+
Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L76)
|
|
1704
1830
|
|
|
1705
1831
|
|
|
1706
1832
|
<a name="interfacesmessageserviceoptionsmd"></a>
|
|
@@ -1713,7 +1839,7 @@ Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1713
1839
|
|
|
1714
1840
|
# Interface: MessageServiceOptions
|
|
1715
1841
|
|
|
1716
|
-
Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1842
|
+
Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L12)
|
|
1717
1843
|
|
|
1718
1844
|
## Properties
|
|
1719
1845
|
|
|
@@ -1721,17 +1847,61 @@ Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/h
|
|
|
1721
1847
|
|
|
1722
1848
|
> `optional` **signal**: `AbortSignal`
|
|
1723
1849
|
|
|
1724
|
-
Defined in: [src/messages/message.service.ts:
|
|
1850
|
+
Defined in: [src/messages/message.service.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L56)
|
|
1725
1851
|
|
|
1726
1852
|
AbortSignal for terminating the upstream stream
|
|
1727
1853
|
|
|
1728
1854
|
## Methods
|
|
1729
1855
|
|
|
1856
|
+
### onConversationCreated()?
|
|
1857
|
+
|
|
1858
|
+
> `optional` **onConversationCreated**(`ev`): `void`
|
|
1859
|
+
|
|
1860
|
+
Defined in: [src/messages/message.service.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L42)
|
|
1861
|
+
|
|
1862
|
+
Streams on async conversation creation.
|
|
1863
|
+
|
|
1864
|
+
#### Parameters
|
|
1865
|
+
|
|
1866
|
+
##### ev
|
|
1867
|
+
|
|
1868
|
+
[`ConversationInfoEvent`](#classesconversationinfoeventmd)
|
|
1869
|
+
|
|
1870
|
+
ConversationInfoEvent
|
|
1871
|
+
|
|
1872
|
+
#### Returns
|
|
1873
|
+
|
|
1874
|
+
`void`
|
|
1875
|
+
|
|
1876
|
+
***
|
|
1877
|
+
|
|
1878
|
+
### onConversationFailed()?
|
|
1879
|
+
|
|
1880
|
+
> `optional` **onConversationFailed**(`ev`): `void`
|
|
1881
|
+
|
|
1882
|
+
Defined in: [src/messages/message.service.ts:47](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L47)
|
|
1883
|
+
|
|
1884
|
+
Streams on async conversation creation failure.
|
|
1885
|
+
|
|
1886
|
+
#### Parameters
|
|
1887
|
+
|
|
1888
|
+
##### ev
|
|
1889
|
+
|
|
1890
|
+
[`ConversationInfoEvent`](#classesconversationinfoeventmd)
|
|
1891
|
+
|
|
1892
|
+
ConversationInfoEvent
|
|
1893
|
+
|
|
1894
|
+
#### Returns
|
|
1895
|
+
|
|
1896
|
+
`void`
|
|
1897
|
+
|
|
1898
|
+
***
|
|
1899
|
+
|
|
1730
1900
|
### onEnd()?
|
|
1731
1901
|
|
|
1732
1902
|
> `optional` **onEnd**(`ev`): `void`
|
|
1733
1903
|
|
|
1734
|
-
Defined in: [src/messages/message.service.ts:22](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1904
|
+
Defined in: [src/messages/message.service.ts:22](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L22)
|
|
1735
1905
|
|
|
1736
1906
|
triggers upon stream end
|
|
1737
1907
|
|
|
@@ -1753,7 +1923,7 @@ EndEvent
|
|
|
1753
1923
|
|
|
1754
1924
|
> `optional` **onError**(`err`): `void`
|
|
1755
1925
|
|
|
1756
|
-
Defined in: [src/messages/message.service.ts:
|
|
1926
|
+
Defined in: [src/messages/message.service.ts:52](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L52)
|
|
1757
1927
|
|
|
1758
1928
|
Streams errors on runtime
|
|
1759
1929
|
|
|
@@ -1773,7 +1943,7 @@ Streams errors on runtime
|
|
|
1773
1943
|
|
|
1774
1944
|
> `optional` **onLlmToken**(`ev`): `void`
|
|
1775
1945
|
|
|
1776
|
-
Defined in: [src/messages/message.service.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1946
|
+
Defined in: [src/messages/message.service.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L17)
|
|
1777
1947
|
|
|
1778
1948
|
Streams llm tokens for output
|
|
1779
1949
|
|
|
@@ -1793,7 +1963,7 @@ Streams llm tokens for output
|
|
|
1793
1963
|
|
|
1794
1964
|
> `optional` **onToolEnd**(`ev`): `void`
|
|
1795
1965
|
|
|
1796
|
-
Defined in: [src/messages/message.service.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1966
|
+
Defined in: [src/messages/message.service.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L32)
|
|
1797
1967
|
|
|
1798
1968
|
Streams tool end updates
|
|
1799
1969
|
|
|
@@ -1815,7 +1985,7 @@ ToolEvent
|
|
|
1815
1985
|
|
|
1816
1986
|
> `optional` **onToolError**(`ev`): `void`
|
|
1817
1987
|
|
|
1818
|
-
Defined in: [src/messages/message.service.ts:37](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1988
|
+
Defined in: [src/messages/message.service.ts:37](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L37)
|
|
1819
1989
|
|
|
1820
1990
|
Streams tool errors
|
|
1821
1991
|
|
|
@@ -1837,7 +2007,7 @@ ToolEvent
|
|
|
1837
2007
|
|
|
1838
2008
|
> `optional` **onToolStart**(`ev`): `void`
|
|
1839
2009
|
|
|
1840
|
-
Defined in: [src/messages/message.service.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2010
|
+
Defined in: [src/messages/message.service.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L27)
|
|
1841
2011
|
|
|
1842
2012
|
Streams tool start updates
|
|
1843
2013
|
|
|
@@ -1864,7 +2034,7 @@ ToolEvent
|
|
|
1864
2034
|
|
|
1865
2035
|
# Interface: ToolContent
|
|
1866
2036
|
|
|
1867
|
-
Defined in: [src/messages/types.ts:
|
|
2037
|
+
Defined in: [src/messages/types.ts:81](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L81)
|
|
1868
2038
|
|
|
1869
2039
|
## Properties
|
|
1870
2040
|
|
|
@@ -1872,7 +2042,7 @@ Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1872
2042
|
|
|
1873
2043
|
> **params**: `unknown`
|
|
1874
2044
|
|
|
1875
|
-
Defined in: [src/messages/types.ts:
|
|
2045
|
+
Defined in: [src/messages/types.ts:82](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L82)
|
|
1876
2046
|
|
|
1877
2047
|
|
|
1878
2048
|
<a name="interfacestooleventmd"></a>
|
|
@@ -1885,7 +2055,7 @@ Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1885
2055
|
|
|
1886
2056
|
# Interface: ToolEvent
|
|
1887
2057
|
|
|
1888
|
-
Defined in: [src/messages/types.ts:
|
|
2058
|
+
Defined in: [src/messages/types.ts:66](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L66)
|
|
1889
2059
|
|
|
1890
2060
|
Base event for Streaming
|
|
1891
2061
|
BaseEvent
|
|
@@ -1900,7 +2070,7 @@ Base event for Streaming
|
|
|
1900
2070
|
|
|
1901
2071
|
> `optional` **content**: [`ToolContent`](#interfacestoolcontentmd)
|
|
1902
2072
|
|
|
1903
|
-
Defined in: [src/messages/types.ts:
|
|
2073
|
+
Defined in: [src/messages/types.ts:67](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L67)
|
|
1904
2074
|
|
|
1905
2075
|
***
|
|
1906
2076
|
|
|
@@ -1908,7 +2078,7 @@ Defined in: [src/messages/types.ts:54](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1908
2078
|
|
|
1909
2079
|
> `optional` **error**: `unknown`
|
|
1910
2080
|
|
|
1911
|
-
Defined in: [src/messages/types.ts:
|
|
2081
|
+
Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L72)
|
|
1912
2082
|
|
|
1913
2083
|
***
|
|
1914
2084
|
|
|
@@ -1916,7 +2086,7 @@ Defined in: [src/messages/types.ts:59](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1916
2086
|
|
|
1917
2087
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1918
2088
|
|
|
1919
|
-
Defined in: [src/messages/types.ts:
|
|
2089
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
1920
2090
|
|
|
1921
2091
|
Used to separate streams
|
|
1922
2092
|
|
|
@@ -1930,7 +2100,7 @@ Used to separate streams
|
|
|
1930
2100
|
|
|
1931
2101
|
> **name**: `string`
|
|
1932
2102
|
|
|
1933
|
-
Defined in: [src/messages/types.ts:
|
|
2103
|
+
Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L68)
|
|
1934
2104
|
|
|
1935
2105
|
***
|
|
1936
2106
|
|
|
@@ -1938,7 +2108,7 @@ Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1938
2108
|
|
|
1939
2109
|
> **node**: `string`
|
|
1940
2110
|
|
|
1941
|
-
Defined in: [src/messages/types.ts:
|
|
2111
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
1942
2112
|
|
|
1943
2113
|
#### Inherited from
|
|
1944
2114
|
|
|
@@ -1950,7 +2120,7 @@ Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1950
2120
|
|
|
1951
2121
|
> **results**: [`ToolResultContent`](#interfacestoolresultcontentmd)[]
|
|
1952
2122
|
|
|
1953
|
-
Defined in: [src/messages/types.ts:
|
|
2123
|
+
Defined in: [src/messages/types.ts:71](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L71)
|
|
1954
2124
|
|
|
1955
2125
|
***
|
|
1956
2126
|
|
|
@@ -1958,7 +2128,7 @@ Defined in: [src/messages/types.ts:58](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1958
2128
|
|
|
1959
2129
|
> **status**: [`ToolStatus`](#enumerationstoolstatusmd)
|
|
1960
2130
|
|
|
1961
|
-
Defined in: [src/messages/types.ts:
|
|
2131
|
+
Defined in: [src/messages/types.ts:70](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L70)
|
|
1962
2132
|
|
|
1963
2133
|
***
|
|
1964
2134
|
|
|
@@ -1966,7 +2136,7 @@ Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1966
2136
|
|
|
1967
2137
|
> `optional` **tool\_call\_id**: `string`
|
|
1968
2138
|
|
|
1969
|
-
Defined in: [src/messages/types.ts:
|
|
2139
|
+
Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L69)
|
|
1970
2140
|
|
|
1971
2141
|
|
|
1972
2142
|
<a name="interfacestoolresultcontentmd"></a>
|
|
@@ -1979,7 +2149,7 @@ Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1979
2149
|
|
|
1980
2150
|
# Interface: ToolResultContent
|
|
1981
2151
|
|
|
1982
|
-
Defined in: [src/messages/types.ts:
|
|
2152
|
+
Defined in: [src/messages/types.ts:85](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L85)
|
|
1983
2153
|
|
|
1984
2154
|
## Properties
|
|
1985
2155
|
|
|
@@ -1987,7 +2157,7 @@ Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1987
2157
|
|
|
1988
2158
|
> **content**: `any`
|
|
1989
2159
|
|
|
1990
|
-
Defined in: [src/messages/types.ts:
|
|
2160
|
+
Defined in: [src/messages/types.ts:89](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L89)
|
|
1991
2161
|
|
|
1992
2162
|
***
|
|
1993
2163
|
|
|
@@ -1995,7 +2165,7 @@ Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1995
2165
|
|
|
1996
2166
|
> **type**: `string`
|
|
1997
2167
|
|
|
1998
|
-
Defined in: [src/messages/types.ts:
|
|
2168
|
+
Defined in: [src/messages/types.ts:87](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L87)
|
|
1999
2169
|
|
|
2000
2170
|
|
|
2001
2171
|
<a name="type-aliaseshayleeaichatclientoptionsmd"></a>
|
|
@@ -2010,7 +2180,7 @@ Defined in: [src/messages/types.ts:74](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
2010
2180
|
|
|
2011
2181
|
> **HayleeAIChatClientOptions** = `object`
|
|
2012
2182
|
|
|
2013
|
-
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2183
|
+
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L9)
|
|
2014
2184
|
|
|
2015
2185
|
Options for the HayleeAI Client
|
|
2016
2186
|
|
|
@@ -2020,6 +2190,6 @@ Options for the HayleeAI Client
|
|
|
2020
2190
|
|
|
2021
2191
|
> `optional` **baseUrl**: `string`
|
|
2022
2192
|
|
|
2023
|
-
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2193
|
+
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L10)
|
|
2024
2194
|
|
|
2025
2195
|
Optional base URL, defaults to production
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,8 @@ __export(index_exports, {
|
|
|
31
31
|
AuthenticationError: () => AuthenticationError,
|
|
32
32
|
AuthorizationError: () => AuthorizationError,
|
|
33
33
|
BaseEvent: () => BaseEvent,
|
|
34
|
+
ConversationInfoContent: () => ConversationInfoContent,
|
|
35
|
+
ConversationInfoEvent: () => ConversationInfoEvent,
|
|
34
36
|
CreateMessageDto: () => CreateMessageDto,
|
|
35
37
|
EndEvent: () => EndEvent,
|
|
36
38
|
EventKind: () => EventKind,
|
|
@@ -115,6 +117,7 @@ var HayleeAIClient = class {
|
|
|
115
117
|
var EventKind = /* @__PURE__ */ ((EventKind2) => {
|
|
116
118
|
EventKind2["LLM_TOKEN"] = "llm_token";
|
|
117
119
|
EventKind2["TOOLS"] = "tools";
|
|
120
|
+
EventKind2["CONVERSATION_INFO"] = "conversation_info";
|
|
118
121
|
return EventKind2;
|
|
119
122
|
})(EventKind || {});
|
|
120
123
|
var BaseEvent = class {
|
|
@@ -147,6 +150,13 @@ var LlmTokenEvent = class extends BaseEvent {
|
|
|
147
150
|
*/
|
|
148
151
|
model;
|
|
149
152
|
};
|
|
153
|
+
var ConversationInfoEvent = class extends BaseEvent {
|
|
154
|
+
content;
|
|
155
|
+
};
|
|
156
|
+
var ConversationInfoContent = class {
|
|
157
|
+
type;
|
|
158
|
+
subject;
|
|
159
|
+
};
|
|
150
160
|
var EndEvent = class {
|
|
151
161
|
success;
|
|
152
162
|
};
|
|
@@ -215,6 +225,15 @@ var MessageService = class {
|
|
|
215
225
|
}
|
|
216
226
|
break;
|
|
217
227
|
}
|
|
228
|
+
case "conversation_info" /* CONVERSATION_INFO */: {
|
|
229
|
+
const typedEvent = event;
|
|
230
|
+
if (typedEvent.content.type === "created") {
|
|
231
|
+
options?.onConversationCreated?.(typedEvent);
|
|
232
|
+
} else if (typedEvent.content.type === "error") {
|
|
233
|
+
options?.onConversationFailed?.(typedEvent);
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
218
237
|
}
|
|
219
238
|
} catch (err) {
|
|
220
239
|
options?.onEnd?.({ success: false });
|
|
@@ -267,10 +286,14 @@ var AuthenticationError = class _AuthenticationError extends HayleeAIError {
|
|
|
267
286
|
var import_class_validator = require("class-validator");
|
|
268
287
|
var CreateMessageDto = class {
|
|
269
288
|
message;
|
|
289
|
+
conversation_id;
|
|
270
290
|
};
|
|
271
291
|
__decorateClass([
|
|
272
292
|
(0, import_class_validator.IsString)()
|
|
273
293
|
], CreateMessageDto.prototype, "message", 2);
|
|
294
|
+
__decorateClass([
|
|
295
|
+
(0, import_class_validator.IsOptional)()
|
|
296
|
+
], CreateMessageDto.prototype, "conversation_id", 2);
|
|
274
297
|
var Role = /* @__PURE__ */ ((Role2) => {
|
|
275
298
|
Role2["HUMAN"] = "human";
|
|
276
299
|
Role2["AI"] = "ai";
|
|
@@ -293,6 +316,8 @@ var HayleeAI = class extends HayleeAIClient {
|
|
|
293
316
|
AuthenticationError,
|
|
294
317
|
AuthorizationError,
|
|
295
318
|
BaseEvent,
|
|
319
|
+
ConversationInfoContent,
|
|
320
|
+
ConversationInfoEvent,
|
|
296
321
|
CreateMessageDto,
|
|
297
322
|
EndEvent,
|
|
298
323
|
EventKind,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts"],"sourcesContent":["import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n","import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n error?: unknown;\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams tool errors\n * @param ev - ToolEvent\n */\n onToolError?(ev: ToolEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n } else if(typedEvent.status == ToolStatus.ERROR) {\n options?.onToolError?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,gCAAiC;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QA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I;AAAA,EAC3C;AACJ;","names":["EventKind","ToolStatus","Role"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts"],"sourcesContent":["import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n","import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\",\n CONVERSATION_INFO = \"conversation_info\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\n\nexport class ConversationInfoEvent extends BaseEvent {\n content!: ConversationInfoContent;\n}\n\nexport class ConversationInfoContent {\n type!: \"created\" | \"updated\" | \"deleted\" | \"error\";\n subject!: string;\n}\n\n\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n error?: unknown;\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, ConversationInfoEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams tool errors\n * @param ev - ToolEvent\n */\n onToolError?(ev: ToolEvent): void;\n /**\n * Streams on async conversation creation.\n * @param ev - ConversationInfoEvent\n */\n onConversationCreated?(ev: ConversationInfoEvent): void;\n /**\n * Streams on async conversation creation failure.\n * @param ev - ConversationInfoEvent\n */\n onConversationFailed?(ev: ConversationInfoEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n } else if(typedEvent.status == ToolStatus.ERROR) {\n options?.onToolError?.(typedEvent);\n }\n break;\n }\n case EventKind.CONVERSATION_INFO: {\n const typedEvent = event as ConversationInfoEvent;\n if(typedEvent.content.type === 'created') {\n options?.onConversationCreated?.(typedEvent);\n } else if(typedEvent.content.type === 'error') {\n options?.onConversationFailed?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsOptional, IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n @IsOptional()\n conversation_id?: string;\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,gCAAiC;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,oDAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5B,gBAAgB;AAAA,MAChB,UAAU,IAAI;AACV,cAAM,KAAK,GAAG,IAAI;AACl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,IAAM,WAAN,cAAuB,eAAe;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKP,YAAY,SAAmC;AAC3C,UAAM,OAAO;AACb,SAAK,WAAW,IAAI,eAAe,IAAI;AAAA,EAC3C;AACJ;","names":["EventKind","ToolStatus","Role"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
declare class CreateMessageDto {
|
|
7
7
|
message: string;
|
|
8
|
+
conversation_id?: string;
|
|
8
9
|
}
|
|
9
10
|
declare enum Role {
|
|
10
11
|
HUMAN = "human",
|
|
@@ -43,7 +44,8 @@ declare class HayleeAIClient {
|
|
|
43
44
|
|
|
44
45
|
declare enum EventKind {
|
|
45
46
|
LLM_TOKEN = "llm_token",
|
|
46
|
-
TOOLS = "tools"
|
|
47
|
+
TOOLS = "tools",
|
|
48
|
+
CONVERSATION_INFO = "conversation_info"
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Base event for Streaming
|
|
@@ -81,6 +83,13 @@ declare class LlmTokenEvent extends BaseEvent {
|
|
|
81
83
|
*/
|
|
82
84
|
model: string;
|
|
83
85
|
}
|
|
86
|
+
declare class ConversationInfoEvent extends BaseEvent {
|
|
87
|
+
content: ConversationInfoContent;
|
|
88
|
+
}
|
|
89
|
+
declare class ConversationInfoContent {
|
|
90
|
+
type: "created" | "updated" | "deleted" | "error";
|
|
91
|
+
subject: string;
|
|
92
|
+
}
|
|
84
93
|
declare class EndEvent {
|
|
85
94
|
success: boolean;
|
|
86
95
|
}
|
|
@@ -137,6 +146,16 @@ interface MessageServiceOptions {
|
|
|
137
146
|
* @param ev - ToolEvent
|
|
138
147
|
*/
|
|
139
148
|
onToolError?(ev: ToolEvent): void;
|
|
149
|
+
/**
|
|
150
|
+
* Streams on async conversation creation.
|
|
151
|
+
* @param ev - ConversationInfoEvent
|
|
152
|
+
*/
|
|
153
|
+
onConversationCreated?(ev: ConversationInfoEvent): void;
|
|
154
|
+
/**
|
|
155
|
+
* Streams on async conversation creation failure.
|
|
156
|
+
* @param ev - ConversationInfoEvent
|
|
157
|
+
*/
|
|
158
|
+
onConversationFailed?(ev: ConversationInfoEvent): void;
|
|
140
159
|
/**
|
|
141
160
|
* Streams errors on runtime
|
|
142
161
|
* @param err - Error or unknown value
|
|
@@ -194,4 +213,4 @@ declare class HayleeAI extends HayleeAIClient {
|
|
|
194
213
|
constructor(options: HayleeAIChatClientOptions);
|
|
195
214
|
}
|
|
196
215
|
|
|
197
|
-
export { AuthenticationError, AuthorizationError, BaseEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
|
216
|
+
export { AuthenticationError, AuthorizationError, BaseEvent, ConversationInfoContent, ConversationInfoEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
declare class CreateMessageDto {
|
|
7
7
|
message: string;
|
|
8
|
+
conversation_id?: string;
|
|
8
9
|
}
|
|
9
10
|
declare enum Role {
|
|
10
11
|
HUMAN = "human",
|
|
@@ -43,7 +44,8 @@ declare class HayleeAIClient {
|
|
|
43
44
|
|
|
44
45
|
declare enum EventKind {
|
|
45
46
|
LLM_TOKEN = "llm_token",
|
|
46
|
-
TOOLS = "tools"
|
|
47
|
+
TOOLS = "tools",
|
|
48
|
+
CONVERSATION_INFO = "conversation_info"
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Base event for Streaming
|
|
@@ -81,6 +83,13 @@ declare class LlmTokenEvent extends BaseEvent {
|
|
|
81
83
|
*/
|
|
82
84
|
model: string;
|
|
83
85
|
}
|
|
86
|
+
declare class ConversationInfoEvent extends BaseEvent {
|
|
87
|
+
content: ConversationInfoContent;
|
|
88
|
+
}
|
|
89
|
+
declare class ConversationInfoContent {
|
|
90
|
+
type: "created" | "updated" | "deleted" | "error";
|
|
91
|
+
subject: string;
|
|
92
|
+
}
|
|
84
93
|
declare class EndEvent {
|
|
85
94
|
success: boolean;
|
|
86
95
|
}
|
|
@@ -137,6 +146,16 @@ interface MessageServiceOptions {
|
|
|
137
146
|
* @param ev - ToolEvent
|
|
138
147
|
*/
|
|
139
148
|
onToolError?(ev: ToolEvent): void;
|
|
149
|
+
/**
|
|
150
|
+
* Streams on async conversation creation.
|
|
151
|
+
* @param ev - ConversationInfoEvent
|
|
152
|
+
*/
|
|
153
|
+
onConversationCreated?(ev: ConversationInfoEvent): void;
|
|
154
|
+
/**
|
|
155
|
+
* Streams on async conversation creation failure.
|
|
156
|
+
* @param ev - ConversationInfoEvent
|
|
157
|
+
*/
|
|
158
|
+
onConversationFailed?(ev: ConversationInfoEvent): void;
|
|
140
159
|
/**
|
|
141
160
|
* Streams errors on runtime
|
|
142
161
|
* @param err - Error or unknown value
|
|
@@ -194,4 +213,4 @@ declare class HayleeAI extends HayleeAIClient {
|
|
|
194
213
|
constructor(options: HayleeAIChatClientOptions);
|
|
195
214
|
}
|
|
196
215
|
|
|
197
|
-
export { AuthenticationError, AuthorizationError, BaseEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
|
216
|
+
export { AuthenticationError, AuthorizationError, BaseEvent, ConversationInfoContent, ConversationInfoEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ var HayleeAIClient = class {
|
|
|
77
77
|
var EventKind = /* @__PURE__ */ ((EventKind2) => {
|
|
78
78
|
EventKind2["LLM_TOKEN"] = "llm_token";
|
|
79
79
|
EventKind2["TOOLS"] = "tools";
|
|
80
|
+
EventKind2["CONVERSATION_INFO"] = "conversation_info";
|
|
80
81
|
return EventKind2;
|
|
81
82
|
})(EventKind || {});
|
|
82
83
|
var BaseEvent = class {
|
|
@@ -109,6 +110,13 @@ var LlmTokenEvent = class extends BaseEvent {
|
|
|
109
110
|
*/
|
|
110
111
|
model;
|
|
111
112
|
};
|
|
113
|
+
var ConversationInfoEvent = class extends BaseEvent {
|
|
114
|
+
content;
|
|
115
|
+
};
|
|
116
|
+
var ConversationInfoContent = class {
|
|
117
|
+
type;
|
|
118
|
+
subject;
|
|
119
|
+
};
|
|
112
120
|
var EndEvent = class {
|
|
113
121
|
success;
|
|
114
122
|
};
|
|
@@ -177,6 +185,15 @@ var MessageService = class {
|
|
|
177
185
|
}
|
|
178
186
|
break;
|
|
179
187
|
}
|
|
188
|
+
case "conversation_info" /* CONVERSATION_INFO */: {
|
|
189
|
+
const typedEvent = event;
|
|
190
|
+
if (typedEvent.content.type === "created") {
|
|
191
|
+
options?.onConversationCreated?.(typedEvent);
|
|
192
|
+
} else if (typedEvent.content.type === "error") {
|
|
193
|
+
options?.onConversationFailed?.(typedEvent);
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
180
197
|
}
|
|
181
198
|
} catch (err) {
|
|
182
199
|
options?.onEnd?.({ success: false });
|
|
@@ -226,13 +243,17 @@ var AuthenticationError = class _AuthenticationError extends HayleeAIError {
|
|
|
226
243
|
};
|
|
227
244
|
|
|
228
245
|
// src/types/chat.interface.ts
|
|
229
|
-
import { IsString } from "class-validator";
|
|
246
|
+
import { IsOptional, IsString } from "class-validator";
|
|
230
247
|
var CreateMessageDto = class {
|
|
231
248
|
message;
|
|
249
|
+
conversation_id;
|
|
232
250
|
};
|
|
233
251
|
__decorateClass([
|
|
234
252
|
IsString()
|
|
235
253
|
], CreateMessageDto.prototype, "message", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
IsOptional()
|
|
256
|
+
], CreateMessageDto.prototype, "conversation_id", 2);
|
|
236
257
|
var Role = /* @__PURE__ */ ((Role2) => {
|
|
237
258
|
Role2["HUMAN"] = "human";
|
|
238
259
|
Role2["AI"] = "ai";
|
|
@@ -254,6 +275,8 @@ export {
|
|
|
254
275
|
AuthenticationError,
|
|
255
276
|
AuthorizationError,
|
|
256
277
|
BaseEvent,
|
|
278
|
+
ConversationInfoContent,
|
|
279
|
+
ConversationInfoEvent,
|
|
257
280
|
CreateMessageDto,
|
|
258
281
|
EndEvent,
|
|
259
282
|
EventKind,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts","../src/index.ts"],"sourcesContent":["import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n error?: unknown;\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams tool errors\n * @param ev - ToolEvent\n */\n onToolError?(ev: ToolEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n } else if(typedEvent.status == ToolStatus.ERROR) {\n options?.onToolError?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n","import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n"],"mappings":";;;;;;;;;;;;AACA,SAAS,wBAAwB;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,qBAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5B,gBAAgB;AAAA,MAChB,UAAU,IAAI;AACV,cAAM,KAAK,GAAG,IAAI;AAClB,kBAAU;AAAA,MACd;AAAA,MACA,UAAU;AACN,eAAO;AACP,kBAAU;AAAA,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AAe,MAAM,iBAAgB,SAAS;AAAA,EACzD;AAAA,EAJgB,OAAe;AAKnC;;;ACNO,IAAM,gBAAN,MAAM,uBAAsB,cAAc;AAAA,EAC7B,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,eAAc,SAAS;AAAA,EACvD;AACJ;;;ACPO,IAAM,qBAAN,MAAM,4BAA2B,cAAc;AAAA,EAClC,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,oBAAmB,SAAS;AAAA,EAC5D;AACJ;;;ACPO,IAAM,sBAAN,MAAM,6BAA4B,cAAc;AAAA,EACnC,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,qBAAoB,SAAS;AAAA,EAC7D;AACJ;;;ACTA,SAAS,gBAAgB;AAOlB,IAAM,mBAAN,MAAuB;AAAA,EAG1B;AACJ;AADI;AAAA,EADC,SAAS;AAAA,GAFD,iBAGT;AAMG,IAAK,OAAL,kBAAKC,UAAL;AACH,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,QAAK;AAFG,SAAAA;AAAA,GAAA;;;ACVZ,IAAM,WAAN,cAAuB,eAAe;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKP,YAAY,SAAmC;AAC3C,UAAM,OAAO;AACb,SAAK,WAAW,IAAI,eAAe,IAAI;AAAA,EAC3C;AACJ;","names":["EventKind","ToolStatus","Role"]}
|
|
1
|
+
{"version":3,"sources":["../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts","../src/index.ts"],"sourcesContent":["import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\",\n CONVERSATION_INFO = \"conversation_info\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\n\nexport class ConversationInfoEvent extends BaseEvent {\n content!: ConversationInfoContent;\n}\n\nexport class ConversationInfoContent {\n type!: \"created\" | \"updated\" | \"deleted\" | \"error\";\n subject!: string;\n}\n\n\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n error?: unknown;\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, ConversationInfoEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams tool errors\n * @param ev - ToolEvent\n */\n onToolError?(ev: ToolEvent): void;\n /**\n * Streams on async conversation creation.\n * @param ev - ConversationInfoEvent\n */\n onConversationCreated?(ev: ConversationInfoEvent): void;\n /**\n * Streams on async conversation creation failure.\n * @param ev - ConversationInfoEvent\n */\n onConversationFailed?(ev: ConversationInfoEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n } else if(typedEvent.status == ToolStatus.ERROR) {\n options?.onToolError?.(typedEvent);\n }\n break;\n }\n case EventKind.CONVERSATION_INFO: {\n const typedEvent = event as ConversationInfoEvent;\n if(typedEvent.content.type === 'created') {\n options?.onConversationCreated?.(typedEvent);\n } else if(typedEvent.content.type === 'error') {\n options?.onConversationFailed?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsOptional, IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n @IsOptional()\n conversation_id?: string;\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n","import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n"],"mappings":";;;;;;;;;;;;AACA,SAAS,wBAAwB;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,qBAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5B,gBAAgB;AAAA,MAChB,UAAU,IAAI;AACV,cAAM,KAAK,GAAG,IAAI;AAClB,kBAAU;AAAA,MACd;AAAA,MACA,UAAU;AACN,eAAO;AACP,kBAAU;AAAA,MACd;AAAA,MACA,QAAQ,KAAK;AACT,eAAO;AACP,kBAAU;AACV,cAAM;AAAA,MACV;AAAA,MACA;AAAA,IACJ,CAAC;AAED,QAAI,QAAQ;AACR,aAAO,iBAAiB,SAAS,MAAM;AACnC,eAAO;AACP,kBAAU;AAAA,MACd,CAAC;AAAA,IACL;AAEA,WAAO,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,UAAI,MAAM,WAAW,GAAG;AAEpB,cAAM,IAAI,QAAc,OAAK;AAAE,oBAAU;AAAA,QAAG,CAAC;AAAA,MACjD;AACA,aAAO,MAAM,SAAS,GAAG;AACrB,cAAM,MAAM,MAAM;AAA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