@adminforth/agent 1.32.2 → 1.33.1

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 209,157 bytes received 585 bytes 419,484.00 bytes/sec
44
- total size is 206,747 speedup is 0.99
43
+ sent 211,007 bytes received 585 bytes 423,184.00 bytes/sec
44
+ total size is 208,637 speedup is 0.99
@@ -20,21 +20,25 @@
20
20
  <div
21
21
  ref="chatSurface"
22
22
  id="adminforth-agent-chat-surface"
23
- class="fixed bg-lightNavbar dark:bg-darkNavbar h-screen top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
23
+ class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
24
24
  flex flex z-40"
25
25
  :class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
26
- :style="{ width: agentStore.chatWidth + 'rem' }"
26
+ :style="{
27
+ width: agentStore.chatWidth + 'rem',
28
+ top: viewportOffsetTop + 'px',
29
+ height: dvh + 'px',
30
+ }"
27
31
  >
28
32
  <div
29
33
  v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
30
34
  class="w-2 cursor-ew-resize absolute left-0 top-0 h-full z-30"
31
35
  @mousedown="startResize"
32
36
  ></div>
33
-
34
37
  <div
35
- class="w-full min-h-0 max-h-full flex flex-col"
38
+ class="w-full h-full min-h-0 max-h-full flex flex-col"
36
39
  >
37
40
  <div
41
+ ref="headerRef"
38
42
  class="flex items-center justify-between h-14 border-b border-gray-200 dark:border-gray-700"
39
43
  >
40
44
  <div
@@ -94,7 +98,7 @@
94
98
  class="m-2 w-8 h-8 p-1 cursor-pointer hover:scale-110 rounded transition-colors duration-200
95
99
  text-lightNavbarIcons hover:text-lightNavbarIcons/80 hover:bg-lightNavbarIcons/20
96
100
  dark:text-darkNavbarIcons hover:text-darkNavbarIcons/80 hover:bg-darkNavbarIcons/20 "
97
- @click="agentStore.setIsChatOpen(false)"
101
+ @click="agentStore.setFullScreen(false); agentStore.setIsChatOpen(false)"
98
102
  />
99
103
  </div>
100
104
 
@@ -108,7 +112,8 @@
108
112
  :messages="agentStore.chatMessages"
109
113
  />
110
114
 
111
- <div
115
+ <div
116
+ ref="promptInput"
112
117
  class="w-full mb-2 flex items-center justify-center px-2 bg-transparent relative translate-x-[-50%] left-1/2"
113
118
  :style="{
114
119
  maxWidth: agentStore.isFullScreen ? remToPx(agentStore.MAX_WIDTH)+'px' : '100%',
@@ -122,6 +127,7 @@
122
127
  @input="autoResize"
123
128
  :class="[
124
129
  'min-h-12 px-4 pt-4 rounded-xl w-full resize-none overflow-hidden text-lightInputText dark:text-darkInputText rounded-md bg-transparent text-sm bg-gray-50 dark:bg-gray-700 dark:border-gray-600 focus:outline-none',
130
+ { '!text-base': coreStore.isIos }
125
131
  ]"
126
132
  :placeholder="agentStore.userMessagePlaceholder"
127
133
  @keydown.enter.exact.prevent="sendMessage"
@@ -187,7 +193,7 @@
187
193
  <script setup lang="ts">
188
194
  import { IconChatBubbleLeft20Solid, IconSparklesSolid, IconArrowsPointingOut, IconArrowsPointingIn } from '@iconify-prerendered/vue-heroicons';
189
195
  import { IconCloseOutline, IconBarsOutline, IconArrowUpOutline, IconCloseSidebarSolid, IconOpenSidebarSolid, IconAngleDownOutline, IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
190
- import { useTemplateRef, onMounted, ref } from 'vue';
196
+ import { useTemplateRef, onMounted, ref, onUnmounted } from 'vue';
191
197
  import { onClickOutside } from '@vueuse/core'
192
198
  import ConversationArea from './conversation_area/ConversationArea.vue';
193
199
  import { useAgentStore } from './composables/useAgentStore';
@@ -216,6 +222,10 @@ const agentStore = useAgentStore();
216
222
  const agentTransitions = useAgentTransitions();
217
223
  const coreStore = useCoreStore();
218
224
  const isModeMenuOpen = ref(false);
225
+
226
+ const dvh = ref(Math.round(window.visualViewport?.height || window.innerHeight));
227
+ const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
228
+
219
229
  let startX = 0
220
230
  let startWidth = 0
221
231
 
@@ -225,8 +235,17 @@ onClickOutside(modeMenu, () => { isModeMenuOpen.value = false; });
225
235
  onMounted(async () => {
226
236
  agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
227
237
  agentStore.regisrerTextInput(textInput.value);
238
+ window.addEventListener('resize', updateHeight)
239
+ window.visualViewport?.addEventListener('resize', updateHeight);
240
+ window.visualViewport?.addEventListener('scroll', updateHeight);
241
+ updateHeight();
228
242
  textInput.value?.focus();
229
- const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
243
+ const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
244
+ const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
245
+ let isTeleportedToBodyFromLocalStorage = true;
246
+ if (savedIsTeleportedToBody !== null || savedIsTeleportedToBodyBeforeFullScreen !== null) {
247
+ isTeleportedToBodyFromLocalStorage = savedIsTeleportedToBody === 'true' || savedIsTeleportedToBodyBeforeFullScreen === 'true';
248
+ }
230
249
  if( coreStore.isMobile ) {
231
250
  agentStore.setIsTeleportedToBody(false);
232
251
  } else {
@@ -235,6 +254,11 @@ onMounted(async () => {
235
254
  await agentStore.fetchSessionsList();
236
255
  });
237
256
 
257
+ onUnmounted(() => {
258
+ window.removeEventListener('resize', updateHeight)
259
+ window.visualViewport?.removeEventListener('resize', updateHeight);
260
+ window.visualViewport?.removeEventListener('scroll', updateHeight);
261
+ })
238
262
 
239
263
  const startResize = (e: MouseEvent) => {
240
264
  startX = e.clientX
@@ -300,4 +324,9 @@ async function sendMessage() {
300
324
  conversationArea.value?.handleSendMessage();
301
325
  }
302
326
 
327
+ function updateHeight() {
328
+ dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
329
+ viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
330
+ }
331
+
303
332
  </script>
@@ -116,13 +116,16 @@ export const useAgentStore = defineStore('agent', () => {
116
116
  }
117
117
  }
118
118
  }
119
- setIsTeleportedToBody(getLocalStorageItem('isTeleportedToBody') === 'true' || getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true');
119
+ const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
120
+ const savedIsChatOpen = getLocalStorageItem('isChatOpen');
121
+ const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
122
+ setIsTeleportedToBody(shouldTeleportToBody);
120
123
  lastSessionId.value = getLocalStorageItem('lastSessionId');
121
124
  if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
122
125
  setActiveSession(lastSessionId.value);
123
126
  }
124
127
  if (isTeleportedToBody.value) {
125
- isChatOpen.value = getLocalStorageItem('isChatOpen') === 'true';
128
+ isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
126
129
  }
127
130
  if (coreStore.isMobile) {
128
131
  setChatWidth(window.innerWidth);
@@ -143,14 +146,20 @@ export const useAgentStore = defineStore('agent', () => {
143
146
  const isFullScreen = ref(false);
144
147
  function setFullScreen(fullScreen: boolean) {
145
148
  isFullScreen.value = fullScreen;
149
+ const appElement = document.getElementById('app');
150
+
146
151
  if (fullScreen) {
147
152
  document.body.style.overflow = 'hidden';
153
+ setTimeout(() => {
154
+ appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
155
+ }, agentTransitions.TRANSITION_DURATION);
148
156
  setLocalStorageItem('chatWidthBeforeFullScreen', chatWidth.value.toString());
149
157
  setLocalStorageItem('isTeleportedToBodyBeforeFullScreen', isTeleportedToBody.value ? 'true' : 'false');
150
158
  setIsTeleportedToBody(false);
151
159
  useAgentTransitions().setChatSurfaceTransition(false);
152
160
  setChatWidth(window.innerWidth, false);
153
161
  } else {
162
+ appElement?.setAttribute('style', `opacity: 100; pointer-events: all;`);
154
163
  document.body.style.overflow = '';
155
164
  const lastChatWidth = parseInt(getLocalStorageItem('chatWidthBeforeFullScreen') || DEFAULT_CHAT_WIDTH.toString(), 10);
156
165
  const isTeleportedBeforeFullScreen = getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
@@ -55,7 +55,9 @@
55
55
  </CustomAutoScrollContainer>
56
56
  <button @click="scrollContainer.scrollToBottom();">
57
57
  <IconArrowDownOutline
58
- class="absolute z-10 bottom-8 left-1/2 bg-lightPrimary dark:bg-darkPrimary text-white p-2 w-10 h-10 rounded-full transition-opacity duration-100 ease-in"
58
+ class="absolute z-10 bottom-8 left-1/2 -translate-x-1/2 bg-lightPrimary/20 dark:bg-darkPrimary/10
59
+ border border-lightPrimary dark:border-darkPrimary text-lightPrimary dark:text-darkPrimary p-2 w-10 h-10
60
+ rounded-full transition-opacity duration-100 ease-in backdrop-blur-sm"
59
61
  :class="showScrollToBottomButton ? 'opacity-100' : 'opacity-0 pointer-events-none'"
60
62
  :disabled="!showScrollToBottomButton"
61
63
  />
@@ -20,21 +20,25 @@
20
20
  <div
21
21
  ref="chatSurface"
22
22
  id="adminforth-agent-chat-surface"
23
- class="fixed bg-lightNavbar dark:bg-darkNavbar h-screen top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
23
+ class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
24
24
  flex flex z-40"
25
25
  :class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
26
- :style="{ width: agentStore.chatWidth + 'rem' }"
26
+ :style="{
27
+ width: agentStore.chatWidth + 'rem',
28
+ top: viewportOffsetTop + 'px',
29
+ height: dvh + 'px',
30
+ }"
27
31
  >
28
32
  <div
29
33
  v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
30
34
  class="w-2 cursor-ew-resize absolute left-0 top-0 h-full z-30"
31
35
  @mousedown="startResize"
32
36
  ></div>
33
-
34
37
  <div
35
- class="w-full min-h-0 max-h-full flex flex-col"
38
+ class="w-full h-full min-h-0 max-h-full flex flex-col"
36
39
  >
37
40
  <div
41
+ ref="headerRef"
38
42
  class="flex items-center justify-between h-14 border-b border-gray-200 dark:border-gray-700"
39
43
  >
40
44
  <div
@@ -94,7 +98,7 @@
94
98
  class="m-2 w-8 h-8 p-1 cursor-pointer hover:scale-110 rounded transition-colors duration-200
95
99
  text-lightNavbarIcons hover:text-lightNavbarIcons/80 hover:bg-lightNavbarIcons/20
96
100
  dark:text-darkNavbarIcons hover:text-darkNavbarIcons/80 hover:bg-darkNavbarIcons/20 "
97
- @click="agentStore.setIsChatOpen(false)"
101
+ @click="agentStore.setFullScreen(false); agentStore.setIsChatOpen(false)"
98
102
  />
99
103
  </div>
100
104
 
@@ -108,7 +112,8 @@
108
112
  :messages="agentStore.chatMessages"
109
113
  />
110
114
 
111
- <div
115
+ <div
116
+ ref="promptInput"
112
117
  class="w-full mb-2 flex items-center justify-center px-2 bg-transparent relative translate-x-[-50%] left-1/2"
113
118
  :style="{
114
119
  maxWidth: agentStore.isFullScreen ? remToPx(agentStore.MAX_WIDTH)+'px' : '100%',
@@ -122,6 +127,7 @@
122
127
  @input="autoResize"
123
128
  :class="[
124
129
  'min-h-12 px-4 pt-4 rounded-xl w-full resize-none overflow-hidden text-lightInputText dark:text-darkInputText rounded-md bg-transparent text-sm bg-gray-50 dark:bg-gray-700 dark:border-gray-600 focus:outline-none',
130
+ { '!text-base': coreStore.isIos }
125
131
  ]"
126
132
  :placeholder="agentStore.userMessagePlaceholder"
127
133
  @keydown.enter.exact.prevent="sendMessage"
@@ -187,7 +193,7 @@
187
193
  <script setup lang="ts">
188
194
  import { IconChatBubbleLeft20Solid, IconSparklesSolid, IconArrowsPointingOut, IconArrowsPointingIn } from '@iconify-prerendered/vue-heroicons';
189
195
  import { IconCloseOutline, IconBarsOutline, IconArrowUpOutline, IconCloseSidebarSolid, IconOpenSidebarSolid, IconAngleDownOutline, IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
190
- import { useTemplateRef, onMounted, ref } from 'vue';
196
+ import { useTemplateRef, onMounted, ref, onUnmounted } from 'vue';
191
197
  import { onClickOutside } from '@vueuse/core'
192
198
  import ConversationArea from './conversation_area/ConversationArea.vue';
193
199
  import { useAgentStore } from './composables/useAgentStore';
@@ -216,6 +222,10 @@ const agentStore = useAgentStore();
216
222
  const agentTransitions = useAgentTransitions();
217
223
  const coreStore = useCoreStore();
218
224
  const isModeMenuOpen = ref(false);
225
+
226
+ const dvh = ref(Math.round(window.visualViewport?.height || window.innerHeight));
227
+ const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
228
+
219
229
  let startX = 0
220
230
  let startWidth = 0
221
231
 
@@ -225,8 +235,17 @@ onClickOutside(modeMenu, () => { isModeMenuOpen.value = false; });
225
235
  onMounted(async () => {
226
236
  agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
227
237
  agentStore.regisrerTextInput(textInput.value);
238
+ window.addEventListener('resize', updateHeight)
239
+ window.visualViewport?.addEventListener('resize', updateHeight);
240
+ window.visualViewport?.addEventListener('scroll', updateHeight);
241
+ updateHeight();
228
242
  textInput.value?.focus();
229
- const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
243
+ const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
244
+ const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
245
+ let isTeleportedToBodyFromLocalStorage = true;
246
+ if (savedIsTeleportedToBody !== null || savedIsTeleportedToBodyBeforeFullScreen !== null) {
247
+ isTeleportedToBodyFromLocalStorage = savedIsTeleportedToBody === 'true' || savedIsTeleportedToBodyBeforeFullScreen === 'true';
248
+ }
230
249
  if( coreStore.isMobile ) {
231
250
  agentStore.setIsTeleportedToBody(false);
232
251
  } else {
@@ -235,6 +254,11 @@ onMounted(async () => {
235
254
  await agentStore.fetchSessionsList();
236
255
  });
237
256
 
257
+ onUnmounted(() => {
258
+ window.removeEventListener('resize', updateHeight)
259
+ window.visualViewport?.removeEventListener('resize', updateHeight);
260
+ window.visualViewport?.removeEventListener('scroll', updateHeight);
261
+ })
238
262
 
239
263
  const startResize = (e: MouseEvent) => {
240
264
  startX = e.clientX
@@ -300,4 +324,9 @@ async function sendMessage() {
300
324
  conversationArea.value?.handleSendMessage();
301
325
  }
302
326
 
327
+ function updateHeight() {
328
+ dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
329
+ viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
330
+ }
331
+
303
332
  </script>
@@ -116,13 +116,16 @@ export const useAgentStore = defineStore('agent', () => {
116
116
  }
117
117
  }
118
118
  }
119
- setIsTeleportedToBody(getLocalStorageItem('isTeleportedToBody') === 'true' || getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true');
119
+ const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
120
+ const savedIsChatOpen = getLocalStorageItem('isChatOpen');
121
+ const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
122
+ setIsTeleportedToBody(shouldTeleportToBody);
120
123
  lastSessionId.value = getLocalStorageItem('lastSessionId');
121
124
  if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
122
125
  setActiveSession(lastSessionId.value);
123
126
  }
124
127
  if (isTeleportedToBody.value) {
125
- isChatOpen.value = getLocalStorageItem('isChatOpen') === 'true';
128
+ isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
126
129
  }
127
130
  if (coreStore.isMobile) {
128
131
  setChatWidth(window.innerWidth);
@@ -143,14 +146,20 @@ export const useAgentStore = defineStore('agent', () => {
143
146
  const isFullScreen = ref(false);
144
147
  function setFullScreen(fullScreen: boolean) {
145
148
  isFullScreen.value = fullScreen;
149
+ const appElement = document.getElementById('app');
150
+
146
151
  if (fullScreen) {
147
152
  document.body.style.overflow = 'hidden';
153
+ setTimeout(() => {
154
+ appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
155
+ }, agentTransitions.TRANSITION_DURATION);
148
156
  setLocalStorageItem('chatWidthBeforeFullScreen', chatWidth.value.toString());
149
157
  setLocalStorageItem('isTeleportedToBodyBeforeFullScreen', isTeleportedToBody.value ? 'true' : 'false');
150
158
  setIsTeleportedToBody(false);
151
159
  useAgentTransitions().setChatSurfaceTransition(false);
152
160
  setChatWidth(window.innerWidth, false);
153
161
  } else {
162
+ appElement?.setAttribute('style', `opacity: 100; pointer-events: all;`);
154
163
  document.body.style.overflow = '';
155
164
  const lastChatWidth = parseInt(getLocalStorageItem('chatWidthBeforeFullScreen') || DEFAULT_CHAT_WIDTH.toString(), 10);
156
165
  const isTeleportedBeforeFullScreen = getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
@@ -55,7 +55,9 @@
55
55
  </CustomAutoScrollContainer>
56
56
  <button @click="scrollContainer.scrollToBottom();">
57
57
  <IconArrowDownOutline
58
- class="absolute z-10 bottom-8 left-1/2 bg-lightPrimary dark:bg-darkPrimary text-white p-2 w-10 h-10 rounded-full transition-opacity duration-100 ease-in"
58
+ class="absolute z-10 bottom-8 left-1/2 -translate-x-1/2 bg-lightPrimary/20 dark:bg-darkPrimary/10
59
+ border border-lightPrimary dark:border-darkPrimary text-lightPrimary dark:text-darkPrimary p-2 w-10 h-10
60
+ rounded-full transition-opacity duration-100 ease-in backdrop-blur-sm"
59
61
  :class="showScrollToBottomButton ? 'opacity-100' : 'opacity-0 pointer-events-none'"
60
62
  :disabled="!showScrollToBottomButton"
61
63
  />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.32.2",
3
+ "version": "1.33.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",