@adminforth/agent 1.34.0 → 1.34.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
@@ -40,5 +40,5 @@ custom/skills/fetch_data/SKILL.md
40
40
  custom/skills/mutate_data/
41
41
  custom/skills/mutate_data/SKILL.md
42
42
 
43
- sent 210,673 bytes received 585 bytes 422,516.00 bytes/sec
44
- total size is 208,263 speedup is 0.99
43
+ sent 210,653 bytes received 585 bytes 422,476.00 bytes/sec
44
+ total size is 208,279 speedup is 0.99
@@ -15,27 +15,26 @@
15
15
  />
16
16
  </div>
17
17
  </div>
18
-
18
+
19
19
  <Teleport to="body">
20
20
  <div
21
21
  ref="chatSurface"
22
22
  id="adminforth-agent-chat-surface"
23
23
  class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
24
- flex flex z-40"
24
+ flex flex z-40 h-screen"
25
25
  :class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
26
- :style="{
27
- width: agentStore.chatWidth + 'rem',
28
- top: viewportOffsetTop + 'px',
29
- height: dvh + 'px',
30
- }"
26
+ :style="{ width: agentStore.chatWidth + 'rem' }"
31
27
  >
32
28
  <div
33
29
  v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
34
- class="w-2 cursor-ew-resize absolute left-0 top-0 h-full z-30"
30
+ class="w-2 cursor-ew-resize absolute left-0 h-full top-0 z-30"
35
31
  @mousedown="startResize"
36
32
  ></div>
37
33
  <div
38
- class="w-full h-full min-h-0 max-h-full flex flex-col"
34
+ class="w-full min-h-0 max-h-full flex flex-col h-dvh"
35
+ :style="{
36
+ height: !agentStore.isIos ? dvh + 'px' : '100dvh',
37
+ }"
39
38
  >
40
39
  <div
41
40
  ref="headerRef"
@@ -222,8 +221,7 @@ const agentTransitions = useAgentTransitions();
222
221
  const coreStore = useCoreStore();
223
222
  const isModeMenuOpen = ref(false);
224
223
 
225
- const dvh = ref(Math.round(window.visualViewport?.height || window.innerHeight));
226
- const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
224
+ const dvh = ref(window.innerHeight)
227
225
 
228
226
  let startX = 0
229
227
  let startWidth = 0
@@ -235,9 +233,6 @@ onMounted(async () => {
235
233
  agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
236
234
  agentStore.regisrerTextInput(textInput.value);
237
235
  window.addEventListener('resize', updateHeight)
238
- window.visualViewport?.addEventListener('resize', updateHeight);
239
- window.visualViewport?.addEventListener('scroll', updateHeight);
240
- updateHeight();
241
236
  textInput.value?.focus();
242
237
  const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
243
238
  const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
@@ -255,8 +250,6 @@ onMounted(async () => {
255
250
 
256
251
  onUnmounted(() => {
257
252
  window.removeEventListener('resize', updateHeight)
258
- window.visualViewport?.removeEventListener('resize', updateHeight);
259
- window.visualViewport?.removeEventListener('scroll', updateHeight);
260
253
  })
261
254
 
262
255
  const startResize = (e: MouseEvent) => {
@@ -325,7 +318,6 @@ async function sendMessage() {
325
318
 
326
319
  function updateHeight() {
327
320
  dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
328
- viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
329
321
  }
330
322
 
331
323
  </script>
@@ -120,17 +120,20 @@ export const useAgentStore = defineStore('agent', () => {
120
120
  }
121
121
  }
122
122
  }
123
- const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
124
- const savedIsChatOpen = getLocalStorageItem('isChatOpen');
125
- const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
126
- setIsTeleportedToBody(shouldTeleportToBody);
123
+ if (!coreStore.isMobile) {
124
+ const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
125
+ const savedIsChatOpen = getLocalStorageItem('isChatOpen');
126
+ const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
127
+
128
+ setIsTeleportedToBody(shouldTeleportToBody);
129
+ if (isTeleportedToBody.value) {
130
+ isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
131
+ }
132
+ }
127
133
  lastSessionId.value = getLocalStorageItem('lastSessionId');
128
134
  if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
129
135
  setActiveSession(lastSessionId.value);
130
136
  }
131
- if (isTeleportedToBody.value) {
132
- isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
133
- }
134
137
  if (coreStore.isMobile) {
135
138
  setChatWidth(window.innerWidth);
136
139
  }
@@ -154,6 +157,7 @@ export const useAgentStore = defineStore('agent', () => {
154
157
 
155
158
  if (fullScreen) {
156
159
  document.body.style.overflow = 'hidden';
160
+ document.body.classList.add('bg-lightHtml', 'dark:bg-darkHtml');
157
161
  setTimeout(() => {
158
162
  appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
159
163
  }, agentTransitions.TRANSITION_DURATION);
@@ -351,6 +355,7 @@ export const useAgentStore = defineStore('agent', () => {
351
355
  return;
352
356
  }
353
357
  isChatOpen.value = false;
358
+ setFullScreen(false);
354
359
  isSessionHistoryOpen.value = false;
355
360
  }
356
361
 
@@ -582,6 +587,18 @@ export const useAgentStore = defineStore('agent', () => {
582
587
  }
583
588
  }
584
589
 
590
+ function addDebugMessage(message: string) {
591
+ const debugMessage = {
592
+ role: 'assistant',
593
+ parts: [{
594
+ type: 'text',
595
+ text: message,
596
+ state: 'done',
597
+ }]
598
+ };
599
+ currentChat.value?.messages.push(debugMessage);
600
+ }
601
+
585
602
  return {
586
603
  //_________-Sessions management-_____________
587
604
  activeSessionId,
@@ -620,6 +637,7 @@ export const useAgentStore = defineStore('agent', () => {
620
637
  DEFAULT_CHAT_WIDTH,
621
638
  MAX_WIDTH,
622
639
  MIN_WIDTH,
623
- getLocalStorageItem
640
+ getLocalStorageItem,
641
+ addDebugMessage
624
642
  }
625
643
  })
@@ -12,7 +12,7 @@
12
12
  class="transition-transform duration-200"
13
13
  />
14
14
  </div>
15
- <transition name="expand" class="max-h-96 overflow-y-auto mb-4 pt-1">
15
+ <transition name="expand" class="sm:max-h-96 max-h-48 overflow-y-auto mb-4 pt-1">
16
16
  <CustomAutoScrollContainer
17
17
  ref="scrollContainerRef"
18
18
  :enabled="isResponseInProgress"
@@ -202,6 +202,10 @@
202
202
  .expand-leave-from {
203
203
  opacity: 1;
204
204
  max-height: 384px;
205
+
206
+ @media (max-width: 640px) {
207
+ max-height: 192px;
208
+ }
205
209
  }
206
210
 
207
211
  </style>
@@ -15,27 +15,26 @@
15
15
  />
16
16
  </div>
17
17
  </div>
18
-
18
+
19
19
  <Teleport to="body">
20
20
  <div
21
21
  ref="chatSurface"
22
22
  id="adminforth-agent-chat-surface"
23
23
  class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
24
- flex flex z-40"
24
+ flex flex z-40 h-screen"
25
25
  :class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
26
- :style="{
27
- width: agentStore.chatWidth + 'rem',
28
- top: viewportOffsetTop + 'px',
29
- height: dvh + 'px',
30
- }"
26
+ :style="{ width: agentStore.chatWidth + 'rem' }"
31
27
  >
32
28
  <div
33
29
  v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
34
- class="w-2 cursor-ew-resize absolute left-0 top-0 h-full z-30"
30
+ class="w-2 cursor-ew-resize absolute left-0 h-full top-0 z-30"
35
31
  @mousedown="startResize"
36
32
  ></div>
37
33
  <div
38
- class="w-full h-full min-h-0 max-h-full flex flex-col"
34
+ class="w-full min-h-0 max-h-full flex flex-col h-dvh"
35
+ :style="{
36
+ height: !agentStore.isIos ? dvh + 'px' : '100dvh',
37
+ }"
39
38
  >
40
39
  <div
41
40
  ref="headerRef"
@@ -222,8 +221,7 @@ const agentTransitions = useAgentTransitions();
222
221
  const coreStore = useCoreStore();
223
222
  const isModeMenuOpen = ref(false);
224
223
 
225
- const dvh = ref(Math.round(window.visualViewport?.height || window.innerHeight));
226
- const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
224
+ const dvh = ref(window.innerHeight)
227
225
 
228
226
  let startX = 0
229
227
  let startWidth = 0
@@ -235,9 +233,6 @@ onMounted(async () => {
235
233
  agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
236
234
  agentStore.regisrerTextInput(textInput.value);
237
235
  window.addEventListener('resize', updateHeight)
238
- window.visualViewport?.addEventListener('resize', updateHeight);
239
- window.visualViewport?.addEventListener('scroll', updateHeight);
240
- updateHeight();
241
236
  textInput.value?.focus();
242
237
  const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
243
238
  const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
@@ -255,8 +250,6 @@ onMounted(async () => {
255
250
 
256
251
  onUnmounted(() => {
257
252
  window.removeEventListener('resize', updateHeight)
258
- window.visualViewport?.removeEventListener('resize', updateHeight);
259
- window.visualViewport?.removeEventListener('scroll', updateHeight);
260
253
  })
261
254
 
262
255
  const startResize = (e: MouseEvent) => {
@@ -325,7 +318,6 @@ async function sendMessage() {
325
318
 
326
319
  function updateHeight() {
327
320
  dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
328
- viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
329
321
  }
330
322
 
331
323
  </script>
@@ -120,17 +120,20 @@ export const useAgentStore = defineStore('agent', () => {
120
120
  }
121
121
  }
122
122
  }
123
- const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
124
- const savedIsChatOpen = getLocalStorageItem('isChatOpen');
125
- const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
126
- setIsTeleportedToBody(shouldTeleportToBody);
123
+ if (!coreStore.isMobile) {
124
+ const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
125
+ const savedIsChatOpen = getLocalStorageItem('isChatOpen');
126
+ const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
127
+
128
+ setIsTeleportedToBody(shouldTeleportToBody);
129
+ if (isTeleportedToBody.value) {
130
+ isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
131
+ }
132
+ }
127
133
  lastSessionId.value = getLocalStorageItem('lastSessionId');
128
134
  if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
129
135
  setActiveSession(lastSessionId.value);
130
136
  }
131
- if (isTeleportedToBody.value) {
132
- isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
133
- }
134
137
  if (coreStore.isMobile) {
135
138
  setChatWidth(window.innerWidth);
136
139
  }
@@ -154,6 +157,7 @@ export const useAgentStore = defineStore('agent', () => {
154
157
 
155
158
  if (fullScreen) {
156
159
  document.body.style.overflow = 'hidden';
160
+ document.body.classList.add('bg-lightHtml', 'dark:bg-darkHtml');
157
161
  setTimeout(() => {
158
162
  appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
159
163
  }, agentTransitions.TRANSITION_DURATION);
@@ -351,6 +355,7 @@ export const useAgentStore = defineStore('agent', () => {
351
355
  return;
352
356
  }
353
357
  isChatOpen.value = false;
358
+ setFullScreen(false);
354
359
  isSessionHistoryOpen.value = false;
355
360
  }
356
361
 
@@ -582,6 +587,18 @@ export const useAgentStore = defineStore('agent', () => {
582
587
  }
583
588
  }
584
589
 
590
+ function addDebugMessage(message: string) {
591
+ const debugMessage = {
592
+ role: 'assistant',
593
+ parts: [{
594
+ type: 'text',
595
+ text: message,
596
+ state: 'done',
597
+ }]
598
+ };
599
+ currentChat.value?.messages.push(debugMessage);
600
+ }
601
+
585
602
  return {
586
603
  //_________-Sessions management-_____________
587
604
  activeSessionId,
@@ -620,6 +637,7 @@ export const useAgentStore = defineStore('agent', () => {
620
637
  DEFAULT_CHAT_WIDTH,
621
638
  MAX_WIDTH,
622
639
  MIN_WIDTH,
623
- getLocalStorageItem
640
+ getLocalStorageItem,
641
+ addDebugMessage
624
642
  }
625
643
  })
@@ -12,7 +12,7 @@
12
12
  class="transition-transform duration-200"
13
13
  />
14
14
  </div>
15
- <transition name="expand" class="max-h-96 overflow-y-auto mb-4 pt-1">
15
+ <transition name="expand" class="sm:max-h-96 max-h-48 overflow-y-auto mb-4 pt-1">
16
16
  <CustomAutoScrollContainer
17
17
  ref="scrollContainerRef"
18
18
  :enabled="isResponseInProgress"
@@ -202,6 +202,10 @@
202
202
  .expand-leave-from {
203
203
  opacity: 1;
204
204
  max-height: 384px;
205
+
206
+ @media (max-width: 640px) {
207
+ max-height: 192px;
208
+ }
205
209
  }
206
210
 
207
211
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.34.0",
3
+ "version": "1.34.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",