@sveda-ai/vue 0.3.0 → 0.3.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.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/dist/appearance.d.ts +4 -53
  3. package/dist/appearance.d.ts.map +1 -1
  4. package/dist/composables/useSvedaChat.d.ts +7 -149
  5. package/dist/composables/useSvedaChat.d.ts.map +1 -1
  6. package/dist/composables/useSvedaChatLayout.d.ts +1 -1
  7. package/dist/composables/useSvedaChatLayout.d.ts.map +1 -1
  8. package/dist/composables/useSvedaChatPage.d.ts +6 -91
  9. package/dist/composables/useSvedaChatPage.d.ts.map +1 -1
  10. package/dist/composables/useSvedaPrompts.d.ts +1 -1
  11. package/dist/composables/useSvedaPrompts.d.ts.map +1 -1
  12. package/dist/composables/useSvedaStreaming.d.ts +3 -6
  13. package/dist/composables/useSvedaStreaming.d.ts.map +1 -1
  14. package/dist/index.d.ts +4 -11
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3047 -4428
  17. package/dist/plugin.d.ts +1 -0
  18. package/dist/plugin.d.ts.map +1 -1
  19. package/dist/styles.css +2 -1
  20. package/dist/ui/sheet/index.d.ts +1 -1
  21. package/dist/ui/toast/Toast.vue.d.ts +2 -2
  22. package/dist/vue.css +1 -1
  23. package/package.json +20 -28
  24. package/src/appearance.ts +44 -652
  25. package/src/components/chat/AnimatedStreamBlock.vue +12 -10
  26. package/src/components/chat/ChatMessageActivityBlock.vue +20 -16
  27. package/src/components/chat/ChatMessageItem.vue +3 -3
  28. package/src/components/chat/ChatMessageList.vue +1 -1
  29. package/src/components/shell/SvedaTabs.vue +1 -1
  30. package/src/composables/useSvedaChat.ts +54 -553
  31. package/src/composables/useSvedaChatLayout.ts +1 -1
  32. package/src/composables/useSvedaChatPage.ts +1 -1
  33. package/src/composables/useSvedaPrompts.ts +1 -1
  34. package/src/composables/useSvedaStreaming.ts +41 -368
  35. package/src/index.ts +15 -11
  36. package/src/plugin.ts +3 -3
  37. package/src/theme.test.mjs +5 -4
  38. package/dist/i18n/locales/en.d.ts +0 -4
  39. package/dist/i18n/locales/en.d.ts.map +0 -1
  40. package/dist/i18n/locales/ru.d.ts +0 -4
  41. package/dist/i18n/locales/ru.d.ts.map +0 -1
  42. package/dist/lib/assistantMessage.d.ts +0 -90
  43. package/dist/lib/assistantMessage.d.ts.map +0 -1
  44. package/dist/lib/chatHistoryMerge.d.ts +0 -20
  45. package/dist/lib/chatHistoryMerge.d.ts.map +0 -1
  46. package/dist/lib/chatI18nKeys.d.ts +0 -2
  47. package/dist/lib/chatI18nKeys.d.ts.map +0 -1
  48. package/dist/lib/chatMessageVisibility.d.ts +0 -6
  49. package/dist/lib/chatMessageVisibility.d.ts.map +0 -1
  50. package/dist/lib/chatResize.d.ts +0 -42
  51. package/dist/lib/chatResize.d.ts.map +0 -1
  52. package/dist/lib/chatTabs.d.ts +0 -9
  53. package/dist/lib/chatTabs.d.ts.map +0 -1
  54. package/dist/lib/chatTitle.d.ts +0 -3
  55. package/dist/lib/chatTitle.d.ts.map +0 -1
  56. package/dist/lib/chatUiStorage.d.ts +0 -6
  57. package/dist/lib/chatUiStorage.d.ts.map +0 -1
  58. package/dist/lib/finalizeMessages.d.ts +0 -21
  59. package/dist/lib/finalizeMessages.d.ts.map +0 -1
  60. package/dist/lib/markdown.d.ts +0 -8
  61. package/dist/lib/markdown.d.ts.map +0 -1
  62. package/dist/lib/modelLabels.d.ts +0 -3
  63. package/dist/lib/modelLabels.d.ts.map +0 -1
  64. package/dist/lib/toolConfirmation.d.ts +0 -11
  65. package/dist/lib/toolConfirmation.d.ts.map +0 -1
  66. package/dist/lib/userMessage.d.ts +0 -17
  67. package/dist/lib/userMessage.d.ts.map +0 -1
  68. package/src/i18n/locales/en.ts +0 -64
  69. package/src/i18n/locales/ru.ts +0 -65
  70. package/src/lib/assistantMessage.ts +0 -439
  71. package/src/lib/chatHistoryMerge.ts +0 -93
  72. package/src/lib/chatI18nKeys.ts +0 -64
  73. package/src/lib/chatMessageVisibility.ts +0 -92
  74. package/src/lib/chatResize.ts +0 -123
  75. package/src/lib/chatTabs.ts +0 -54
  76. package/src/lib/chatTitle.ts +0 -30
  77. package/src/lib/chatUiStorage.ts +0 -69
  78. package/src/lib/finalizeMessages.ts +0 -81
  79. package/src/lib/markdown.ts +0 -90
  80. package/src/lib/modelLabels.ts +0 -24
  81. package/src/lib/toolConfirmation.ts +0 -31
  82. package/src/lib/userMessage.ts +0 -55
@@ -27,18 +27,20 @@
27
27
 
28
28
  const contentRef = ref(null);
29
29
  const translateY = ref(0);
30
+ const overflowing = ref(false);
30
31
  const displayedText = useAnimatedText(() => props.text, {
31
32
  enabled: () => props.animated,
32
33
  });
33
34
 
34
35
  function updateTranslate() {
35
- if (!contentRef.value) return;
36
- const container = contentRef.value.parentElement;
37
- if (!container) return;
38
- const contentHeight = contentRef.value.offsetHeight;
39
- const containerHeight = container.offsetHeight;
40
- const overflow = Math.max(0, contentHeight - containerHeight);
41
- translateY.value = -overflow;
36
+ const content = contentRef.value;
37
+ const container = content?.parentElement;
38
+ if (!content || !container) return;
39
+ const maxPx = Number.parseFloat(getComputedStyle(container).maxHeight);
40
+ const contentHeight = content.offsetHeight;
41
+ const overflows = Number.isFinite(maxPx) && contentHeight > maxPx + 1;
42
+ overflowing.value = overflows;
43
+ translateY.value = overflows ? -(contentHeight - maxPx) : 0;
42
44
  }
43
45
 
44
46
  watch(
@@ -46,15 +48,15 @@
46
48
  () => {
47
49
  nextTick(updateTranslate);
48
50
  },
49
- { flush: 'post' }
51
+ { flush: 'post', immediate: true }
50
52
  );
51
53
  </script>
52
54
 
53
55
  <template>
54
56
  <div
55
57
  class="animated-stream-block"
56
- :class="{ 'animated-stream-block--masked': showMask }"
57
- :style="{ height: maxHeight }"
58
+ :class="{ 'animated-stream-block--masked': showMask && overflowing }"
59
+ :style="overflowing ? { maxHeight, height: maxHeight } : { maxHeight }"
58
60
  >
59
61
  <div
60
62
  ref="contentRef"
@@ -4,7 +4,7 @@
4
4
  getActivityGroupLabel,
5
5
  getToolNameFromPart,
6
6
  parseToolResultOutput,
7
- } from '../../lib/assistantMessage.js';
7
+ } from '@sveda-ai/chat';
8
8
  import { useSvedaT } from '../../i18n/index.js';
9
9
  import { CheckCircle, ChevronDown, ChevronRight, CircleStop, ExternalLink, Search, Terminal, XCircle } from 'lucide-vue-next';
10
10
  import { computed, ref, watch } from 'vue';
@@ -143,11 +143,12 @@
143
143
  const prevMap = new Map(prevSteps.map(step => [step.id, step]));
144
144
  steps.forEach(step => {
145
145
  if (step.kind === 'tool') {
146
- if (step.status === 'running' || step.status === 'confirmation' || step.needsConfirmation) {
146
+ if (step.status === 'running') {
147
147
  expandedSteps.value[step.id] = true;
148
148
  } else if (step.status === 'success' || step.status === 'error' || step.status === 'stopped') {
149
- const wasRunning = prevMap.get(step.id)?.status === 'running';
150
- if (wasRunning) {
149
+ const previous = prevMap.get(step.id);
150
+ const wasOpen = previous?.status === 'running' || previous?.status === 'confirmation' || previous?.needsConfirmation;
151
+ if (wasOpen) {
151
152
  expandedSteps.value[step.id] = false;
152
153
  }
153
154
  }
@@ -243,6 +244,9 @@
243
244
  const hasDisplayLink = step => step.display && step.display.link && step.status === 'success';
244
245
 
245
246
  const handleStepClick = step => {
247
+ if (step.needsConfirmation) {
248
+ return;
249
+ }
246
250
  if (hasDisplayLink(step)) {
247
251
  emit('activity-link-click', step.display.link);
248
252
  return;
@@ -355,13 +359,13 @@
355
359
  class="h-3 w-3 flex-shrink-0 text-muted-foreground"
356
360
  />
357
361
  <component
358
- v-else-if="step.detail || step.kind === 'tool' || step.kind === 'subagent'"
362
+ v-else-if="!step.needsConfirmation && (step.detail || step.kind === 'tool' || step.kind === 'subagent')"
359
363
  :is="isStepExpanded(step) ? ChevronDown : ChevronRight"
360
364
  class="ml-auto h-3 w-3 text-muted-foreground"
361
365
  />
362
366
  </button>
363
367
  <div
364
- v-if="isStepExpanded(step) && !hasDisplayLink(step) && (step.detail || step.kind === 'tool' || step.kind === 'subagent')"
368
+ v-if="isStepExpanded(step) && !step.needsConfirmation && !hasDisplayLink(step) && (step.detail || step.kind === 'tool' || step.kind === 'subagent')"
365
369
  class="pb-1 pl-4 text-muted-foreground/80"
366
370
  >
367
371
  <AnimatedStreamBlock
@@ -381,11 +385,11 @@
381
385
  </div>
382
386
  <div
383
387
  v-if="step.needsConfirmation"
384
- class="mt-1 border border-border bg-card p-2"
388
+ class="mt-1 border border-border bg-card px-2.5 py-2"
385
389
  >
386
- <p class="text-xs text-foreground">{{ t('toolConfirmationPrompt') }}</p>
387
- <pre class="mt-1 max-h-32 overflow-auto whitespace-pre-wrap font-mono text-xs text-muted-foreground">{{ step.detail }}</pre>
388
- <div class="mt-2 flex gap-2">
390
+ <p class="text-xs leading-snug text-foreground">{{ t('toolConfirmationPrompt') }}</p>
391
+ <pre v-if="step.detail" class="mt-1.5 max-h-24 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-snug text-muted-foreground">{{ step.detail }}</pre>
392
+ <div class="mt-2 flex items-center gap-2">
389
393
  <button
390
394
  type="button"
391
395
  class="bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground"
@@ -447,13 +451,13 @@
447
451
  class="h-3 w-3 flex-shrink-0 text-muted-foreground"
448
452
  />
449
453
  <component
450
- v-else-if="item.step.detail || item.step.kind === 'tool' || item.step.kind === 'subagent'"
454
+ v-else-if="!item.step.needsConfirmation && (item.step.detail || item.step.kind === 'tool' || item.step.kind === 'subagent')"
451
455
  :is="isStepExpanded(item.step) ? ChevronDown : ChevronRight"
452
456
  class="ml-auto h-3 w-3 text-muted-foreground"
453
457
  />
454
458
  </button>
455
459
  <div
456
- v-if="isStepExpanded(item.step) && !hasDisplayLink(item.step) && (item.step.detail || item.step.kind === 'tool' || item.step.kind === 'subagent')"
460
+ v-if="isStepExpanded(item.step) && !item.step.needsConfirmation && !hasDisplayLink(item.step) && (item.step.detail || item.step.kind === 'tool' || item.step.kind === 'subagent')"
457
461
  class="pb-1 pl-4 text-muted-foreground/80"
458
462
  >
459
463
  <AnimatedStreamBlock
@@ -473,11 +477,11 @@
473
477
  </div>
474
478
  <div
475
479
  v-if="item.step.needsConfirmation"
476
- class="mt-1 border border-border bg-card p-2"
480
+ class="mt-1 border border-border bg-card px-2.5 py-2"
477
481
  >
478
- <p class="text-xs text-foreground">{{ t('toolConfirmationPrompt') }}</p>
479
- <pre class="mt-1 max-h-32 overflow-auto whitespace-pre-wrap font-mono text-xs text-muted-foreground">{{ item.step.detail }}</pre>
480
- <div class="mt-2 flex gap-2">
482
+ <p class="text-xs leading-snug text-foreground">{{ t('toolConfirmationPrompt') }}</p>
483
+ <pre v-if="item.step.detail" class="mt-1.5 max-h-24 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-snug text-muted-foreground">{{ item.step.detail }}</pre>
484
+ <div class="mt-2 flex items-center gap-2">
481
485
  <button
482
486
  type="button"
483
487
  class="bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground"
@@ -1,8 +1,8 @@
1
1
  <script setup>
2
- import { buildAssistantMessageSegments, collectResourceLinks } from '../../lib/assistantMessage.js';
3
- import { renderMarkdown } from '../../lib/markdown.js';
2
+ import { buildAssistantMessageSegments, collectResourceLinks } from '@sveda-ai/chat';
3
+ import { renderMarkdown } from '@sveda-ai/chat';
4
4
  import { useAnimatedText } from '../../lib/useAnimatedText.js';
5
- import { getUserMessageAttachmentNames, getUserMessageText } from '../../lib/userMessage.js';
5
+ import { getUserMessageAttachmentNames, getUserMessageText } from '@sveda-ai/chat';
6
6
  import { useSvedaT } from '../../i18n/index.js';
7
7
  import { Paperclip } from 'lucide-vue-next';
8
8
  import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  assistantHasActiveTools,
5
5
  shouldShowChatPendingIndicator,
6
- } from '../../lib/chatMessageVisibility.js';
6
+ } from '@sveda-ai/chat';
7
7
  import { useSvedaT } from '../../i18n/index.js';
8
8
  import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';
9
9
  import ChatMessageItem from './ChatMessageItem.vue';
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { Button } from '../../ui/button';
3
3
  import { ScrollArea, ScrollBar } from '../../ui/scroll-area';
4
- import { buildChatTabTitleMap } from '../../lib/chatTabs';
4
+ import { buildChatTabTitleMap } from '@sveda-ai/chat';
5
5
  import { Loader2, Plus, X } from 'lucide-vue-next';
6
6
  import { computed, unref } from 'vue';
7
7
  import { useSvedaT } from '../../i18n/index';