@adminforth/agent 1.2.0 → 1.2.2

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/build.log CHANGED
@@ -10,6 +10,7 @@ custom/Message.vue
10
10
  custom/SessionsHistory.vue
11
11
  custom/ToolRenderer.vue
12
12
  custom/ToolsGroup.vue
13
+ custom/chat.ts
13
14
  custom/package.json
14
15
  custom/pnpm-lock.yaml
15
16
  custom/tsconfig.json
@@ -28,5 +29,5 @@ custom/skills/fetch_data/SKILL.md
28
29
  custom/skills/mutate_data/
29
30
  custom/skills/mutate_data/SKILL.md
30
31
 
31
- sent 166,886 bytes received 394 bytes 334,560.00 bytes/sec
32
- total size is 165,300 speedup is 0.99
32
+ sent 168,508 bytes received 413 bytes 337,842.00 bytes/sec
33
+ total size is 166,859 speedup is 0.99
@@ -80,8 +80,8 @@
80
80
 
81
81
  const props = defineProps<{
82
82
  type: string,
83
- message: string
84
- state: string
83
+ message: string | undefined,
84
+ state: string | undefined,
85
85
  data?: any
86
86
  role: 'user' | 'assistant'
87
87
  }>();
@@ -6,7 +6,7 @@
6
6
  "
7
7
  >
8
8
  <h3 :class="h3Style">{{ $t('Chat history') }}</h3>
9
- <Button @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false)" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
9
+ <Button @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
10
10
  <IconPlusOutline class="w-5 h-5" />
11
11
  {{ $t('New chat') }}
12
12
  </Button>
package/custom/chat.ts ADDED
@@ -0,0 +1,82 @@
1
+ /**
2
+ * This file is used to fix circular module initialization between ai and @ai-sdk/vue
3
+ * These files are depending on each other, but vite put them in different chunks, so they are not initialized at the same time, which causes the circular module initialization issue
4
+ * So I get rid of the @ai-sdk/vue only fixes are:
5
+ * 1) Change vite config to put these files in the same chunk
6
+ * 2) Get rid of the circular module initialization by moving the Chat class to this file
7
+ *
8
+ * Maybe there is a better way to fix this issue
9
+ *
10
+ * If you were updating "ai" package and plugin broke, probably you need to update this file as well
11
+ * Or resolve the circular module initialization issue in a better way
12
+ */
13
+
14
+ import {
15
+ AbstractChat,
16
+ ChatInit as BaseChatInit,
17
+ ChatState,
18
+ ChatStatus,
19
+ UIMessage,
20
+ } from 'ai';
21
+ import { Ref, ref } from 'vue';
22
+
23
+ class VueChatState<
24
+ UI_MESSAGE extends UIMessage,
25
+ > implements ChatState<UI_MESSAGE> {
26
+ private messagesRef: Ref<UI_MESSAGE[]>;
27
+ private statusRef = ref<ChatStatus>('ready');
28
+ private errorRef = ref<Error | undefined>(undefined);
29
+
30
+ constructor(messages?: UI_MESSAGE[]) {
31
+ this.messagesRef = ref(messages ?? []) as Ref<UI_MESSAGE[]>;
32
+ }
33
+
34
+ get messages(): UI_MESSAGE[] {
35
+ return this.messagesRef.value;
36
+ }
37
+
38
+ set messages(messages: UI_MESSAGE[]) {
39
+ this.messagesRef.value = messages;
40
+ }
41
+
42
+ get status(): ChatStatus {
43
+ return this.statusRef.value;
44
+ }
45
+
46
+ set status(status: ChatStatus) {
47
+ this.statusRef.value = status;
48
+ }
49
+
50
+ get error(): Error | undefined {
51
+ return this.errorRef.value;
52
+ }
53
+
54
+ set error(error: Error | undefined) {
55
+ this.errorRef.value = error;
56
+ }
57
+
58
+ pushMessage = (message: UI_MESSAGE) => {
59
+ this.messagesRef.value = [...this.messagesRef.value, message];
60
+ };
61
+
62
+ popMessage = () => {
63
+ this.messagesRef.value = this.messagesRef.value.slice(0, -1);
64
+ };
65
+
66
+ replaceMessage = (index: number, message: UI_MESSAGE) => {
67
+ this.messagesRef.value[index] = { ...message };
68
+ };
69
+
70
+ snapshot = <T>(value: T): T => value;
71
+ }
72
+
73
+ export class Chat<
74
+ UI_MESSAGE extends UIMessage,
75
+ > extends AbstractChat<UI_MESSAGE> {
76
+ constructor({ messages, ...init }: BaseChatInit<UI_MESSAGE>) {
77
+ super({
78
+ ...init,
79
+ state: new VueChatState(messages),
80
+ });
81
+ }
82
+ }
@@ -11,14 +11,13 @@
11
11
  "license": "ISC",
12
12
  "packageManager": "pnpm@10.33.0",
13
13
  "dependencies": {
14
- "@ai-sdk/vue": "^3.0.158",
15
14
  "@incremark/core": "^1.0.2",
16
15
  "@incremark/theme": "^1.0.2",
17
16
  "@incremark/vue": "^1.0.2",
18
17
  "@shikijs/langs": "^4.0.2",
19
18
  "@shikijs/themes": "^4.0.2",
20
19
  "@vueuse/core": "^14.2.1",
21
- "ai": "^6.0.158",
20
+ "ai": "^6.0.168",
22
21
  "dompurify": "^3.3.3",
23
22
  "katex": "^0.16.45",
24
23
  "marked": "^18.0.0",
@@ -8,9 +8,6 @@ importers:
8
8
 
9
9
  .:
10
10
  dependencies:
11
- '@ai-sdk/vue':
12
- specifier: ^3.0.158
13
- version: 3.0.158(vue@3.5.32)(zod@4.3.6)
14
11
  '@incremark/core':
15
12
  specifier: ^1.0.2
16
13
  version: 1.0.2
@@ -30,8 +27,8 @@ importers:
30
27
  specifier: ^14.2.1
31
28
  version: 14.2.1(vue@3.5.32)
32
29
  ai:
33
- specifier: ^6.0.158
34
- version: 6.0.158(zod@4.3.6)
30
+ specifier: ^6.0.168
31
+ version: 6.0.168(zod@4.3.6)
35
32
  dompurify:
36
33
  specifier: ^3.3.3
37
34
  version: 3.3.3
@@ -47,8 +44,8 @@ importers:
47
44
 
48
45
  packages:
49
46
 
50
- '@ai-sdk/gateway@3.0.95':
51
- resolution: {integrity: sha512-ZmUNNbZl3V42xwQzPaNUi+s8eqR2lnrxf0bvB6YbLXpLjHYv0k2Y78t12cNOfY0bxGeuVVTLyk856uLuQIuXEQ==}
47
+ '@ai-sdk/gateway@3.0.104':
48
+ resolution: {integrity: sha512-ZKX5n74io8VIRlhIMSLWVlvT3sXC8Z7cZ9GHuWBWZDVi96+62AIsWuLGvMfcBA1STYuSoDrp6rIziZmvrTq0TA==}
52
49
  engines: {node: '>=18'}
53
50
  peerDependencies:
54
51
  zod: ^3.25.76 || ^4.1.8
@@ -63,12 +60,6 @@ packages:
63
60
  resolution: {integrity: sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ==}
64
61
  engines: {node: '>=18'}
65
62
 
66
- '@ai-sdk/vue@3.0.158':
67
- resolution: {integrity: sha512-1uOXnekM9/V8vOhKfEkFOrZYHJKiDmf20FaQJAJK/9tRBEclVCm6L4yOyVqqWhVVodaHrUSpYbAKWVKeP8iatA==}
68
- engines: {node: '>=18'}
69
- peerDependencies:
70
- vue: ^3.3.4
71
-
72
63
  '@antfu/utils@9.3.0':
73
64
  resolution: {integrity: sha512-9hFT4RauhcUzqOE4f1+frMKLZrgNog5b06I7VmZQV1BkvwvqrbC8EBZf3L1eEL2AKb6rNKjER0sEvJiSP1FXEA==}
74
65
 
@@ -217,8 +208,8 @@ packages:
217
208
  '@ungap/structured-clone@1.3.0':
218
209
  resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
219
210
 
220
- '@vercel/oidc@3.1.0':
221
- resolution: {integrity: sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w==}
211
+ '@vercel/oidc@3.2.0':
212
+ resolution: {integrity: sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug==}
222
213
  engines: {node: '>= 20'}
223
214
 
224
215
  '@vue/compiler-core@3.5.32':
@@ -263,8 +254,8 @@ packages:
263
254
  peerDependencies:
264
255
  vue: ^3.5.0
265
256
 
266
- ai@6.0.158:
267
- resolution: {integrity: sha512-gLTp1UXFtMqKUi3XHs33K7UFglbvojkxF/aq337TxnLGOhHIW9+GyP2jwW4hYX87f1es+wId3VQoPRRu9zEStQ==}
257
+ ai@6.0.168:
258
+ resolution: {integrity: sha512-2HqCJuO+1V2aV7vfYs5LFEUfxbkGX+5oa54q/gCCTL7KLTdbxcCu5D7TdLA5kwsrs3Szgjah9q6D9tpjHM3hUQ==}
268
259
  engines: {node: '>=18'}
269
260
  peerDependencies:
270
261
  zod: ^3.25.76 || ^4.1.8
@@ -665,8 +656,8 @@ packages:
665
656
  picocolors@1.1.1:
666
657
  resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
667
658
 
668
- postcss@8.5.9:
669
- resolution: {integrity: sha512-7a70Nsot+EMX9fFU3064K/kdHWZqGVY+BADLyXc8Dfv+mTLLVl6JzJpPaCZ2kQL9gIJvKXSLMHhqdRRjwQeFtw==}
659
+ postcss@8.5.10:
660
+ resolution: {integrity: sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==}
670
661
  engines: {node: ^10 || ^12 || >=14}
671
662
 
672
663
  property-information@7.1.0:
@@ -730,11 +721,6 @@ packages:
730
721
  resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==}
731
722
  engines: {node: '>=12'}
732
723
 
733
- swrv@1.2.0:
734
- resolution: {integrity: sha512-lH/g4UcNyj+7lzK4eRGT4C68Q4EhQ6JtM9otPRIASfhhzfLWtbZPHcMuhuba7S9YVYuxkMUGImwMyGpfbkH07A==}
735
- peerDependencies:
736
- vue: '>=3.2.26 < 4'
737
-
738
724
  topojson-client@3.1.0:
739
725
  resolution: {integrity: sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==}
740
726
  hasBin: true
@@ -919,11 +905,11 @@ packages:
919
905
 
920
906
  snapshots:
921
907
 
922
- '@ai-sdk/gateway@3.0.95(zod@4.3.6)':
908
+ '@ai-sdk/gateway@3.0.104(zod@4.3.6)':
923
909
  dependencies:
924
910
  '@ai-sdk/provider': 3.0.8
925
911
  '@ai-sdk/provider-utils': 4.0.23(zod@4.3.6)
926
- '@vercel/oidc': 3.1.0
912
+ '@vercel/oidc': 3.2.0
927
913
  zod: 4.3.6
928
914
 
929
915
  '@ai-sdk/provider-utils@4.0.23(zod@4.3.6)':
@@ -937,15 +923,6 @@ snapshots:
937
923
  dependencies:
938
924
  json-schema: 0.4.0
939
925
 
940
- '@ai-sdk/vue@3.0.158(vue@3.5.32)(zod@4.3.6)':
941
- dependencies:
942
- '@ai-sdk/provider-utils': 4.0.23(zod@4.3.6)
943
- ai: 6.0.158(zod@4.3.6)
944
- swrv: 1.2.0(vue@3.5.32)
945
- vue: 3.5.32
946
- transitivePeerDependencies:
947
- - zod
948
-
949
926
  '@antfu/utils@9.3.0': {}
950
927
 
951
928
  '@babel/helper-string-parser@7.27.1': {}
@@ -1124,7 +1101,7 @@ snapshots:
1124
1101
 
1125
1102
  '@ungap/structured-clone@1.3.0': {}
1126
1103
 
1127
- '@vercel/oidc@3.1.0': {}
1104
+ '@vercel/oidc@3.2.0': {}
1128
1105
 
1129
1106
  '@vue/compiler-core@3.5.32':
1130
1107
  dependencies:
@@ -1148,7 +1125,7 @@ snapshots:
1148
1125
  '@vue/shared': 3.5.32
1149
1126
  estree-walker: 2.0.2
1150
1127
  magic-string: 0.30.21
1151
- postcss: 8.5.9
1128
+ postcss: 8.5.10
1152
1129
  source-map-js: 1.2.1
1153
1130
 
1154
1131
  '@vue/compiler-ssr@3.5.32':
@@ -1193,9 +1170,9 @@ snapshots:
1193
1170
  dependencies:
1194
1171
  vue: 3.5.32
1195
1172
 
1196
- ai@6.0.158(zod@4.3.6):
1173
+ ai@6.0.168(zod@4.3.6):
1197
1174
  dependencies:
1198
- '@ai-sdk/gateway': 3.0.95(zod@4.3.6)
1175
+ '@ai-sdk/gateway': 3.0.104(zod@4.3.6)
1199
1176
  '@ai-sdk/provider': 3.0.8
1200
1177
  '@ai-sdk/provider-utils': 4.0.23(zod@4.3.6)
1201
1178
  '@opentelemetry/api': 1.9.0
@@ -1780,7 +1757,7 @@ snapshots:
1780
1757
 
1781
1758
  picocolors@1.1.1: {}
1782
1759
 
1783
- postcss@8.5.9:
1760
+ postcss@8.5.10:
1784
1761
  dependencies:
1785
1762
  nanoid: 3.3.11
1786
1763
  picocolors: 1.1.1
@@ -1842,10 +1819,6 @@ snapshots:
1842
1819
  dependencies:
1843
1820
  ansi-regex: 6.2.2
1844
1821
 
1845
- swrv@1.2.0(vue@3.5.32):
1846
- dependencies:
1847
- vue: 3.5.32
1848
-
1849
1822
  topojson-client@3.1.0:
1850
1823
  dependencies:
1851
1824
  commander: 2.20.3
@@ -3,7 +3,7 @@ import { IAgentSession, ISessionsListItem, IMessage } from './types';
3
3
  import { ref, nextTick, computed, watch, onMounted, shallowRef } from 'vue';
4
4
  import { callAdminForthApi } from '@/utils';
5
5
  import { useAdminforth } from '@/adminforth';
6
- import { Chat } from "@ai-sdk/vue";
6
+ import { Chat } from './chat';
7
7
  import { DefaultChatTransport } from 'ai';
8
8
  import { useCoreStore } from '@/stores/core';
9
9
 
@@ -79,8 +79,8 @@ export const useAgentStore = defineStore('agent', () => {
79
79
  }
80
80
  }
81
81
  })
82
- const chats = new Map<string, Chat>();
83
- const currentChat = shallowRef<Chat>(null);
82
+ const chats = new Map<string, Chat<any>>();
83
+ const currentChat = shallowRef<Chat<any>>();
84
84
  function setCurrentChat(sessionId: string) {
85
85
  if (chats.has(sessionId)) {
86
86
  currentChat.value = chats.get(sessionId) || null;
@@ -132,7 +132,7 @@ export const useAgentStore = defineStore('agent', () => {
132
132
  if (!currentSession.value || currentSession.value.sessionId === 'pre-session') {
133
133
  await createNewSession(message);
134
134
  }
135
- currentSession.value.timestamp = new Date().toISOString();
135
+ currentSession.value!.timestamp = new Date().toISOString();
136
136
  sessionList.value = sortSessionsListByTimestamp(sessionList.value.map((s: ISessionsListItem) => s.sessionId === currentSession.value?.sessionId ? {
137
137
  ...s,
138
138
  timestamp: currentSession.value?.timestamp || s.timestamp,
@@ -155,10 +155,14 @@ export const useAgentStore = defineStore('agent', () => {
155
155
  function openChat() {
156
156
  isChatOpen.value = true;
157
157
  nextTick(() => {
158
- textInput.value?.focus();
158
+ focusTextInput();
159
159
  });
160
160
  }
161
161
 
162
+ function focusTextInput() {
163
+ textInput.value?.focus();
164
+ }
165
+
162
166
  function setIsChatOpen(isOpen: boolean) {
163
167
  isOpen ? openChat() : closeChat();
164
168
  }
@@ -354,5 +358,6 @@ export const useAgentStore = defineStore('agent', () => {
354
358
  setIsTeleportedToBody,
355
359
  chatWidth,
356
360
  setChatWidth,
361
+ focusTextInput
357
362
  }
358
363
  })
@@ -80,8 +80,8 @@
80
80
 
81
81
  const props = defineProps<{
82
82
  type: string,
83
- message: string
84
- state: string
83
+ message: string | undefined,
84
+ state: string | undefined,
85
85
  data?: any
86
86
  role: 'user' | 'assistant'
87
87
  }>();
@@ -6,7 +6,7 @@
6
6
  "
7
7
  >
8
8
  <h3 :class="h3Style">{{ $t('Chat history') }}</h3>
9
- <Button @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false)" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
9
+ <Button @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
10
10
  <IconPlusOutline class="w-5 h-5" />
11
11
  {{ $t('New chat') }}
12
12
  </Button>
@@ -0,0 +1,82 @@
1
+ /**
2
+ * This file is used to fix circular module initialization between ai and @ai-sdk/vue
3
+ * These files are depending on each other, but vite put them in different chunks, so they are not initialized at the same time, which causes the circular module initialization issue
4
+ * So I get rid of the @ai-sdk/vue only fixes are:
5
+ * 1) Change vite config to put these files in the same chunk
6
+ * 2) Get rid of the circular module initialization by moving the Chat class to this file
7
+ *
8
+ * Maybe there is a better way to fix this issue
9
+ *
10
+ * If you were updating "ai" package and plugin broke, probably you need to update this file as well
11
+ * Or resolve the circular module initialization issue in a better way
12
+ */
13
+
14
+ import {
15
+ AbstractChat,
16
+ ChatInit as BaseChatInit,
17
+ ChatState,
18
+ ChatStatus,
19
+ UIMessage,
20
+ } from 'ai';
21
+ import { Ref, ref } from 'vue';
22
+
23
+ class VueChatState<
24
+ UI_MESSAGE extends UIMessage,
25
+ > implements ChatState<UI_MESSAGE> {
26
+ private messagesRef: Ref<UI_MESSAGE[]>;
27
+ private statusRef = ref<ChatStatus>('ready');
28
+ private errorRef = ref<Error | undefined>(undefined);
29
+
30
+ constructor(messages?: UI_MESSAGE[]) {
31
+ this.messagesRef = ref(messages ?? []) as Ref<UI_MESSAGE[]>;
32
+ }
33
+
34
+ get messages(): UI_MESSAGE[] {
35
+ return this.messagesRef.value;
36
+ }
37
+
38
+ set messages(messages: UI_MESSAGE[]) {
39
+ this.messagesRef.value = messages;
40
+ }
41
+
42
+ get status(): ChatStatus {
43
+ return this.statusRef.value;
44
+ }
45
+
46
+ set status(status: ChatStatus) {
47
+ this.statusRef.value = status;
48
+ }
49
+
50
+ get error(): Error | undefined {
51
+ return this.errorRef.value;
52
+ }
53
+
54
+ set error(error: Error | undefined) {
55
+ this.errorRef.value = error;
56
+ }
57
+
58
+ pushMessage = (message: UI_MESSAGE) => {
59
+ this.messagesRef.value = [...this.messagesRef.value, message];
60
+ };
61
+
62
+ popMessage = () => {
63
+ this.messagesRef.value = this.messagesRef.value.slice(0, -1);
64
+ };
65
+
66
+ replaceMessage = (index: number, message: UI_MESSAGE) => {
67
+ this.messagesRef.value[index] = { ...message };
68
+ };
69
+
70
+ snapshot = <T>(value: T): T => value;
71
+ }
72
+
73
+ export class Chat<
74
+ UI_MESSAGE extends UIMessage,
75
+ > extends AbstractChat<UI_MESSAGE> {
76
+ constructor({ messages, ...init }: BaseChatInit<UI_MESSAGE>) {
77
+ super({
78
+ ...init,
79
+ state: new VueChatState(messages),
80
+ });
81
+ }
82
+ }
@@ -11,14 +11,13 @@
11
11
  "license": "ISC",
12
12
  "packageManager": "pnpm@10.33.0",
13
13
  "dependencies": {
14
- "@ai-sdk/vue": "^3.0.158",
15
14
  "@incremark/core": "^1.0.2",
16
15
  "@incremark/theme": "^1.0.2",
17
16
  "@incremark/vue": "^1.0.2",
18
17
  "@shikijs/langs": "^4.0.2",
19
18
  "@shikijs/themes": "^4.0.2",
20
19
  "@vueuse/core": "^14.2.1",
21
- "ai": "^6.0.158",
20
+ "ai": "^6.0.168",
22
21
  "dompurify": "^3.3.3",
23
22
  "katex": "^0.16.45",
24
23
  "marked": "^18.0.0",
@@ -8,9 +8,6 @@ importers:
8
8
 
9
9
  .:
10
10
  dependencies:
11
- '@ai-sdk/vue':
12
- specifier: ^3.0.158
13
- version: 3.0.158(vue@3.5.32)(zod@4.3.6)
14
11
  '@incremark/core':
15
12
  specifier: ^1.0.2
16
13
  version: 1.0.2
@@ -30,8 +27,8 @@ importers:
30
27
  specifier: ^14.2.1
31
28
  version: 14.2.1(vue@3.5.32)
32
29
  ai:
33
- specifier: ^6.0.158
34
- version: 6.0.158(zod@4.3.6)
30
+ specifier: ^6.0.168
31
+ version: 6.0.168(zod@4.3.6)
35
32
  dompurify:
36
33
  specifier: ^3.3.3
37
34
  version: 3.3.3
@@ -47,8 +44,8 @@ importers:
47
44
 
48
45
  packages:
49
46
 
50
- '@ai-sdk/gateway@3.0.95':
51
- resolution: {integrity: sha512-ZmUNNbZl3V42xwQzPaNUi+s8eqR2lnrxf0bvB6YbLXpLjHYv0k2Y78t12cNOfY0bxGeuVVTLyk856uLuQIuXEQ==}
47
+ '@ai-sdk/gateway@3.0.104':
48
+ resolution: {integrity: sha512-ZKX5n74io8VIRlhIMSLWVlvT3sXC8Z7cZ9GHuWBWZDVi96+62AIsWuLGvMfcBA1STYuSoDrp6rIziZmvrTq0TA==}
52
49
  engines: {node: '>=18'}
53
50
  peerDependencies:
54
51
  zod: ^3.25.76 || ^4.1.8
@@ -63,12 +60,6 @@ packages:
63
60
  resolution: {integrity: sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ==}
64
61
  engines: {node: '>=18'}
65
62
 
66
- '@ai-sdk/vue@3.0.158':
67
- resolution: {integrity: sha512-1uOXnekM9/V8vOhKfEkFOrZYHJKiDmf20FaQJAJK/9tRBEclVCm6L4yOyVqqWhVVodaHrUSpYbAKWVKeP8iatA==}
68
- engines: {node: '>=18'}
69
- peerDependencies:
70
- vue: ^3.3.4
71
-
72
63
  '@antfu/utils@9.3.0':
73
64
  resolution: {integrity: sha512-9hFT4RauhcUzqOE4f1+frMKLZrgNog5b06I7VmZQV1BkvwvqrbC8EBZf3L1eEL2AKb6rNKjER0sEvJiSP1FXEA==}
74
65
 
@@ -217,8 +208,8 @@ packages:
217
208
  '@ungap/structured-clone@1.3.0':
218
209
  resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
219
210
 
220
- '@vercel/oidc@3.1.0':
221
- resolution: {integrity: sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w==}
211
+ '@vercel/oidc@3.2.0':
212
+ resolution: {integrity: sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug==}
222
213
  engines: {node: '>= 20'}
223
214
 
224
215
  '@vue/compiler-core@3.5.32':
@@ -263,8 +254,8 @@ packages:
263
254
  peerDependencies:
264
255
  vue: ^3.5.0
265
256
 
266
- ai@6.0.158:
267
- resolution: {integrity: sha512-gLTp1UXFtMqKUi3XHs33K7UFglbvojkxF/aq337TxnLGOhHIW9+GyP2jwW4hYX87f1es+wId3VQoPRRu9zEStQ==}
257
+ ai@6.0.168:
258
+ resolution: {integrity: sha512-2HqCJuO+1V2aV7vfYs5LFEUfxbkGX+5oa54q/gCCTL7KLTdbxcCu5D7TdLA5kwsrs3Szgjah9q6D9tpjHM3hUQ==}
268
259
  engines: {node: '>=18'}
269
260
  peerDependencies:
270
261
  zod: ^3.25.76 || ^4.1.8
@@ -665,8 +656,8 @@ packages:
665
656
  picocolors@1.1.1:
666
657
  resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
667
658
 
668
- postcss@8.5.9:
669
- resolution: {integrity: sha512-7a70Nsot+EMX9fFU3064K/kdHWZqGVY+BADLyXc8Dfv+mTLLVl6JzJpPaCZ2kQL9gIJvKXSLMHhqdRRjwQeFtw==}
659
+ postcss@8.5.10:
660
+ resolution: {integrity: sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==}
670
661
  engines: {node: ^10 || ^12 || >=14}
671
662
 
672
663
  property-information@7.1.0:
@@ -730,11 +721,6 @@ packages:
730
721
  resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==}
731
722
  engines: {node: '>=12'}
732
723
 
733
- swrv@1.2.0:
734
- resolution: {integrity: sha512-lH/g4UcNyj+7lzK4eRGT4C68Q4EhQ6JtM9otPRIASfhhzfLWtbZPHcMuhuba7S9YVYuxkMUGImwMyGpfbkH07A==}
735
- peerDependencies:
736
- vue: '>=3.2.26 < 4'
737
-
738
724
  topojson-client@3.1.0:
739
725
  resolution: {integrity: sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==}
740
726
  hasBin: true
@@ -919,11 +905,11 @@ packages:
919
905
 
920
906
  snapshots:
921
907
 
922
- '@ai-sdk/gateway@3.0.95(zod@4.3.6)':
908
+ '@ai-sdk/gateway@3.0.104(zod@4.3.6)':
923
909
  dependencies:
924
910
  '@ai-sdk/provider': 3.0.8
925
911
  '@ai-sdk/provider-utils': 4.0.23(zod@4.3.6)
926
- '@vercel/oidc': 3.1.0
912
+ '@vercel/oidc': 3.2.0
927
913
  zod: 4.3.6
928
914
 
929
915
  '@ai-sdk/provider-utils@4.0.23(zod@4.3.6)':
@@ -937,15 +923,6 @@ snapshots:
937
923
  dependencies:
938
924
  json-schema: 0.4.0
939
925
 
940
- '@ai-sdk/vue@3.0.158(vue@3.5.32)(zod@4.3.6)':
941
- dependencies:
942
- '@ai-sdk/provider-utils': 4.0.23(zod@4.3.6)
943
- ai: 6.0.158(zod@4.3.6)
944
- swrv: 1.2.0(vue@3.5.32)
945
- vue: 3.5.32
946
- transitivePeerDependencies:
947
- - zod
948
-
949
926
  '@antfu/utils@9.3.0': {}
950
927
 
951
928
  '@babel/helper-string-parser@7.27.1': {}
@@ -1124,7 +1101,7 @@ snapshots:
1124
1101
 
1125
1102
  '@ungap/structured-clone@1.3.0': {}
1126
1103
 
1127
- '@vercel/oidc@3.1.0': {}
1104
+ '@vercel/oidc@3.2.0': {}
1128
1105
 
1129
1106
  '@vue/compiler-core@3.5.32':
1130
1107
  dependencies:
@@ -1148,7 +1125,7 @@ snapshots:
1148
1125
  '@vue/shared': 3.5.32
1149
1126
  estree-walker: 2.0.2
1150
1127
  magic-string: 0.30.21
1151
- postcss: 8.5.9
1128
+ postcss: 8.5.10
1152
1129
  source-map-js: 1.2.1
1153
1130
 
1154
1131
  '@vue/compiler-ssr@3.5.32':
@@ -1193,9 +1170,9 @@ snapshots:
1193
1170
  dependencies:
1194
1171
  vue: 3.5.32
1195
1172
 
1196
- ai@6.0.158(zod@4.3.6):
1173
+ ai@6.0.168(zod@4.3.6):
1197
1174
  dependencies:
1198
- '@ai-sdk/gateway': 3.0.95(zod@4.3.6)
1175
+ '@ai-sdk/gateway': 3.0.104(zod@4.3.6)
1199
1176
  '@ai-sdk/provider': 3.0.8
1200
1177
  '@ai-sdk/provider-utils': 4.0.23(zod@4.3.6)
1201
1178
  '@opentelemetry/api': 1.9.0
@@ -1780,7 +1757,7 @@ snapshots:
1780
1757
 
1781
1758
  picocolors@1.1.1: {}
1782
1759
 
1783
- postcss@8.5.9:
1760
+ postcss@8.5.10:
1784
1761
  dependencies:
1785
1762
  nanoid: 3.3.11
1786
1763
  picocolors: 1.1.1
@@ -1842,10 +1819,6 @@ snapshots:
1842
1819
  dependencies:
1843
1820
  ansi-regex: 6.2.2
1844
1821
 
1845
- swrv@1.2.0(vue@3.5.32):
1846
- dependencies:
1847
- vue: 3.5.32
1848
-
1849
1822
  topojson-client@3.1.0:
1850
1823
  dependencies:
1851
1824
  commander: 2.20.3
@@ -3,7 +3,7 @@ import { IAgentSession, ISessionsListItem, IMessage } from './types';
3
3
  import { ref, nextTick, computed, watch, onMounted, shallowRef } from 'vue';
4
4
  import { callAdminForthApi } from '@/utils';
5
5
  import { useAdminforth } from '@/adminforth';
6
- import { Chat } from "@ai-sdk/vue";
6
+ import { Chat } from './chat';
7
7
  import { DefaultChatTransport } from 'ai';
8
8
  import { useCoreStore } from '@/stores/core';
9
9
 
@@ -79,8 +79,8 @@ export const useAgentStore = defineStore('agent', () => {
79
79
  }
80
80
  }
81
81
  })
82
- const chats = new Map<string, Chat>();
83
- const currentChat = shallowRef<Chat>(null);
82
+ const chats = new Map<string, Chat<any>>();
83
+ const currentChat = shallowRef<Chat<any>>();
84
84
  function setCurrentChat(sessionId: string) {
85
85
  if (chats.has(sessionId)) {
86
86
  currentChat.value = chats.get(sessionId) || null;
@@ -132,7 +132,7 @@ export const useAgentStore = defineStore('agent', () => {
132
132
  if (!currentSession.value || currentSession.value.sessionId === 'pre-session') {
133
133
  await createNewSession(message);
134
134
  }
135
- currentSession.value.timestamp = new Date().toISOString();
135
+ currentSession.value!.timestamp = new Date().toISOString();
136
136
  sessionList.value = sortSessionsListByTimestamp(sessionList.value.map((s: ISessionsListItem) => s.sessionId === currentSession.value?.sessionId ? {
137
137
  ...s,
138
138
  timestamp: currentSession.value?.timestamp || s.timestamp,
@@ -155,10 +155,14 @@ export const useAgentStore = defineStore('agent', () => {
155
155
  function openChat() {
156
156
  isChatOpen.value = true;
157
157
  nextTick(() => {
158
- textInput.value?.focus();
158
+ focusTextInput();
159
159
  });
160
160
  }
161
161
 
162
+ function focusTextInput() {
163
+ textInput.value?.focus();
164
+ }
165
+
162
166
  function setIsChatOpen(isOpen: boolean) {
163
167
  isOpen ? openChat() : closeChat();
164
168
  }
@@ -354,5 +358,6 @@ export const useAgentStore = defineStore('agent', () => {
354
358
  setIsTeleportedToBody,
355
359
  chatWidth,
356
360
  setChatWidth,
361
+ focusTextInput
357
362
  }
358
363
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",