@memori.ai/memori-react 8.42.0 → 8.44.0

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 (164) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +1 -1
  3. package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js +1 -1
  4. package/dist/components/Chat/Chat.js +1 -1
  5. package/dist/components/Chat/Chat.js.map +1 -1
  6. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  7. package/dist/components/ChatInputs/ChatInputs.d.ts +1 -0
  8. package/dist/components/ChatInputs/ChatInputs.js +2 -2
  9. package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
  10. package/dist/components/IconButton/IconButton.css +144 -0
  11. package/dist/components/IconButton/IconButton.d.ts +9 -0
  12. package/dist/components/IconButton/IconButton.js +36 -0
  13. package/dist/components/IconButton/IconButton.js.map +1 -0
  14. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +1 -0
  15. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  16. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +204 -59
  17. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
  18. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +1 -1
  19. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  20. package/dist/components/MemoriArtifactSystem/context/ArtifactContext.d.ts +3 -1
  21. package/dist/components/MemoriArtifactSystem/context/ArtifactContext.js +76 -16
  22. package/dist/components/MemoriArtifactSystem/context/ArtifactContext.js.map +1 -1
  23. package/dist/components/MemoriArtifactSystem/types/artifact.types.d.ts +11 -0
  24. package/dist/components/MemoriArtifactSystem/utils/ArtifactAPI.js +18 -13
  25. package/dist/components/MemoriArtifactSystem/utils/ArtifactAPI.js.map +1 -1
  26. package/dist/components/MemoriArtifactSystem/utils/applyEdits.d.ts +8 -0
  27. package/dist/components/MemoriArtifactSystem/utils/applyEdits.js +117 -0
  28. package/dist/components/MemoriArtifactSystem/utils/applyEdits.js.map +1 -0
  29. package/dist/components/MobileSessionPanel/MobileSessionPanel.css +29 -7
  30. package/dist/components/MobileSessionPanel/MobileSessionPanel.d.ts +3 -0
  31. package/dist/components/MobileSessionPanel/MobileSessionPanel.js +8 -6
  32. package/dist/components/MobileSessionPanel/MobileSessionPanel.js.map +1 -1
  33. package/dist/components/PositionPopover/PositionPopover.d.ts +2 -0
  34. package/dist/components/PositionPopover/PositionPopover.js +19 -11
  35. package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
  36. package/dist/components/UploadButton/UploadButton.d.ts +1 -0
  37. package/dist/components/UploadButton/UploadButton.js +12 -18
  38. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  39. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +1 -6
  40. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +7 -139
  41. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  42. package/dist/components/icons/Print.js +1 -1
  43. package/dist/components/icons/Print.js.map +1 -1
  44. package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +24 -3
  45. package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -1
  46. package/dist/components/layouts/WebsiteAssistant/website-assistant.css +137 -55
  47. package/dist/components/layouts/fullpage.css +165 -68
  48. package/dist/helpers/constants.d.ts +1 -0
  49. package/dist/helpers/constants.js +24 -1
  50. package/dist/helpers/constants.js.map +1 -1
  51. package/dist/helpers/convertDocument.d.ts +1 -0
  52. package/dist/helpers/convertDocument.js +24 -0
  53. package/dist/helpers/convertDocument.js.map +1 -0
  54. package/dist/helpers/message.js +3 -0
  55. package/dist/helpers/message.js.map +1 -1
  56. package/dist/helpers/positionPopover.d.ts +1 -1
  57. package/dist/helpers/positionPopover.js +2 -2
  58. package/dist/helpers/positionPopover.js.map +1 -1
  59. package/dist/helpers/tts/muteSpeaker.d.ts +13 -0
  60. package/dist/helpers/tts/muteSpeaker.js +26 -0
  61. package/dist/helpers/tts/muteSpeaker.js.map +1 -0
  62. package/dist/locales/de.json +3 -0
  63. package/dist/locales/en.json +3 -0
  64. package/dist/locales/es.json +3 -0
  65. package/dist/locales/fr.json +3 -0
  66. package/dist/locales/it.json +3 -0
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/esm/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +1 -1
  70. package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js +1 -1
  71. package/esm/components/Chat/Chat.js +1 -1
  72. package/esm/components/Chat/Chat.js.map +1 -1
  73. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  74. package/esm/components/ChatInputs/ChatInputs.d.ts +1 -0
  75. package/esm/components/ChatInputs/ChatInputs.js +2 -2
  76. package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
  77. package/esm/components/IconButton/IconButton.css +144 -0
  78. package/esm/components/IconButton/IconButton.d.ts +9 -0
  79. package/esm/components/IconButton/IconButton.js +33 -0
  80. package/esm/components/IconButton/IconButton.js.map +1 -0
  81. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +1 -0
  82. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  83. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +205 -60
  84. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
  85. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +2 -2
  86. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  87. package/esm/components/MemoriArtifactSystem/context/ArtifactContext.d.ts +3 -1
  88. package/esm/components/MemoriArtifactSystem/context/ArtifactContext.js +77 -17
  89. package/esm/components/MemoriArtifactSystem/context/ArtifactContext.js.map +1 -1
  90. package/esm/components/MemoriArtifactSystem/types/artifact.types.d.ts +11 -0
  91. package/esm/components/MemoriArtifactSystem/utils/ArtifactAPI.js +18 -13
  92. package/esm/components/MemoriArtifactSystem/utils/ArtifactAPI.js.map +1 -1
  93. package/esm/components/MemoriArtifactSystem/utils/applyEdits.d.ts +8 -0
  94. package/esm/components/MemoriArtifactSystem/utils/applyEdits.js +112 -0
  95. package/esm/components/MemoriArtifactSystem/utils/applyEdits.js.map +1 -0
  96. package/esm/components/MobileSessionPanel/MobileSessionPanel.css +29 -7
  97. package/esm/components/MobileSessionPanel/MobileSessionPanel.d.ts +3 -0
  98. package/esm/components/MobileSessionPanel/MobileSessionPanel.js +8 -6
  99. package/esm/components/MobileSessionPanel/MobileSessionPanel.js.map +1 -1
  100. package/esm/components/PositionPopover/PositionPopover.d.ts +2 -0
  101. package/esm/components/PositionPopover/PositionPopover.js +20 -12
  102. package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
  103. package/esm/components/UploadButton/UploadButton.d.ts +1 -0
  104. package/esm/components/UploadButton/UploadButton.js +13 -19
  105. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  106. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +1 -6
  107. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +8 -140
  108. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  109. package/esm/components/icons/Print.js +1 -1
  110. package/esm/components/icons/Print.js.map +1 -1
  111. package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js +24 -3
  112. package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -1
  113. package/esm/components/layouts/WebsiteAssistant/website-assistant.css +137 -55
  114. package/esm/components/layouts/fullpage.css +165 -68
  115. package/esm/helpers/constants.d.ts +1 -0
  116. package/esm/helpers/constants.js +23 -0
  117. package/esm/helpers/constants.js.map +1 -1
  118. package/esm/helpers/convertDocument.d.ts +1 -0
  119. package/esm/helpers/convertDocument.js +20 -0
  120. package/esm/helpers/convertDocument.js.map +1 -0
  121. package/esm/helpers/message.js +3 -0
  122. package/esm/helpers/message.js.map +1 -1
  123. package/esm/helpers/positionPopover.d.ts +1 -1
  124. package/esm/helpers/positionPopover.js +2 -2
  125. package/esm/helpers/positionPopover.js.map +1 -1
  126. package/esm/helpers/tts/muteSpeaker.d.ts +13 -0
  127. package/esm/helpers/tts/muteSpeaker.js +21 -0
  128. package/esm/helpers/tts/muteSpeaker.js.map +1 -0
  129. package/esm/locales/de.json +3 -0
  130. package/esm/locales/en.json +3 -0
  131. package/esm/locales/es.json +3 -0
  132. package/esm/locales/fr.json +3 -0
  133. package/esm/locales/it.json +3 -0
  134. package/esm/version.d.ts +1 -1
  135. package/esm/version.js +1 -1
  136. package/package.json +2 -2
  137. package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +1 -1
  138. package/src/components/Chat/Chat.tsx +1 -0
  139. package/src/components/ChatInputs/ChatInputs.tsx +3 -0
  140. package/src/components/FilePreview/FilePreview.stories.tsx +0 -3
  141. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +1 -0
  142. package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +324 -133
  143. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +2 -2
  144. package/src/components/MemoriArtifactSystem/context/ArtifactContext.tsx +122 -24
  145. package/src/components/MemoriArtifactSystem/types/artifact.types.ts +20 -1
  146. package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +1 -0
  147. package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.tsx +19 -13
  148. package/src/components/MemoriArtifactSystem/utils/applyEdits.test.ts +85 -0
  149. package/src/components/MemoriArtifactSystem/utils/applyEdits.ts +173 -0
  150. package/src/components/UploadButton/UploadButton.stories.tsx +2 -2
  151. package/src/components/UploadButton/UploadButton.tsx +19 -19
  152. package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +13 -187
  153. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +2 -2
  154. package/src/components/icons/Print.tsx +6 -2
  155. package/src/helpers/constants.ts +24 -0
  156. package/src/helpers/convertDocument.test.ts +67 -0
  157. package/src/helpers/convertDocument.ts +35 -0
  158. package/src/helpers/message.ts +15 -0
  159. package/src/locales/de.json +3 -0
  160. package/src/locales/en.json +3 -0
  161. package/src/locales/es.json +3 -0
  162. package/src/locales/fr.json +3 -0
  163. package/src/locales/it.json +3 -0
  164. package/src/version.ts +1 -1
@@ -0,0 +1,144 @@
1
+ /* Shared secondary icon-button chrome (header + chat input bar).
2
+ CTA primary (Accedi / send) must NOT use this class. */
3
+
4
+ .memori-widget {
5
+ --memori-icon-active-bg: color-mix(in oklch, var(--memori-primary) 12%, transparent);
6
+ --memori-icon-recording-bg: color-mix(in oklch, var(--memori-error, #dc2626) 12%, transparent);
7
+ --memori-icon-button-size: 40px;
8
+ --memori-icon-button-icon-size: 20px;
9
+ --memori-icon-button-icon: color-mix(in oklch, var(--memori-text-color, #111827) 72%, transparent);
10
+ }
11
+
12
+ .memori-widget .memori-icon-button.memori-button {
13
+ display: inline-flex;
14
+ width: var(--memori-icon-button-size);
15
+ min-width: var(--memori-icon-button-size);
16
+ height: var(--memori-icon-button-size);
17
+ min-height: var(--memori-icon-button-size);
18
+ box-sizing: border-box;
19
+ align-items: center;
20
+ justify-content: center;
21
+ padding: 0;
22
+ border: 1px solid var(--memori-border-color, #ddd);
23
+ border-radius: var(--memori-radius-box);
24
+ background: transparent;
25
+ box-shadow: none;
26
+ color: var(--memori-icon-button-icon);
27
+ transform: none;
28
+ }
29
+
30
+ /* Icon + text (Cronologia, Esci, Share con label, …) — grow past the square */
31
+ .memori-widget .memori-icon-button.memori-icon-button--labeled.memori-button,
32
+ .memori-widget .memori-icon-button.memori-button:has(.memori-header--action-label),
33
+ .memori-widget .memori-icon-button.memori-button:has(.memori-button__content) {
34
+ overflow: visible;
35
+ width: auto;
36
+ min-width: var(--memori-icon-button-size);
37
+ max-width: none;
38
+ height: var(--memori-icon-button-size);
39
+ min-height: var(--memori-icon-button-size);
40
+ flex-wrap: nowrap;
41
+ justify-content: center;
42
+ padding: 0 12px;
43
+ gap: 0.4rem;
44
+ white-space: nowrap;
45
+ }
46
+
47
+ .memori-widget .memori-icon-button.memori-icon-button--labeled.memori-button .memori-button__content,
48
+ .memori-widget .memori-icon-button.memori-button:has(.memori-button__content) .memori-button__content,
49
+ .memori-widget .memori-icon-button.memori-button .memori-header--action-label {
50
+ display: inline-flex;
51
+ overflow: visible;
52
+ align-items: center;
53
+ font-size: var(--memori-text-size-sm, 0.8125rem);
54
+ font-weight: var(--memori-text-weight-medium, 500);
55
+ line-height: 1.2;
56
+ white-space: nowrap;
57
+ }
58
+
59
+ .memori-widget .memori-icon-button.memori-button svg,
60
+ .memori-widget .memori-icon-button.memori-button .icon {
61
+ width: var(--memori-icon-button-icon-size, 20px);
62
+ height: var(--memori-icon-button-icon-size, 20px);
63
+ flex-shrink: 0;
64
+ /* Keep lucide / custom icons as authored — only size them */
65
+ color: inherit;
66
+ }
67
+
68
+ /* Mute (VolumeX): slightly larger glyph + heavier stroke so the X reads clearly */
69
+ .memori-widget .memori-icon-button.memori-button svg.lucide-volume-x {
70
+ width: calc(var(--memori-icon-button-icon-size, 20px) + 1px);
71
+ height: calc(var(--memori-icon-button-icon-size, 20px) + 1px);
72
+ stroke-width: 2.35;
73
+ }
74
+
75
+ .memori-widget .memori-icon-button.memori-button:disabled,
76
+ .memori-widget .memori-icon-button.memori-button.memori-button--disabled {
77
+ cursor: not-allowed;
78
+ opacity: 0.35;
79
+ }
80
+
81
+ .memori-widget .memori-icon-button.memori-button:focus {
82
+ outline: none;
83
+ }
84
+
85
+ .memori-widget .memori-icon-button.memori-button:focus-visible {
86
+ border-color: var(--memori-primary);
87
+ box-shadow: var(--memori-focus-ring, 0 0 0 3px color-mix(in oklch, var(--memori-primary) 18%, transparent));
88
+ outline: 2px solid var(--memori-primary);
89
+ outline-offset: var(--memori-focus-ring-offset, 2px);
90
+ }
91
+
92
+ .memori-widget .memori-icon-button.memori-button:hover:not(:disabled, .memori-button--disabled) {
93
+ border-color: color-mix(in oklch, var(--memori-text-color, #111827) 28%, transparent);
94
+ background: color-mix(in oklch, var(--memori-text-color, #111827) 6%, transparent);
95
+ box-shadow: none;
96
+ color: var(--memori-text-color, #111827);
97
+ transform: none;
98
+ }
99
+
100
+ /* Active / popover open — soft primary, never solid CTA fill */
101
+ .memori-widget .memori-icon-button.memori-button.memori-icon-button--active,
102
+ .memori-widget .memori-icon-button.memori-button.memori-button--active,
103
+ .memori-widget
104
+ .memori-icon-button.memori-button--outline.memori-button--active:not(:disabled, .memori-button--disabled),
105
+ .memori-widget
106
+ .memori-icon-button.memori-button--toolbar.memori-button--active:not(:disabled, .memori-button--disabled),
107
+ .memori-widget .memori-icon-button.memori-button--ghost.memori-button--active:not(:disabled, .memori-button--disabled) {
108
+ border-color: var(--memori-primary);
109
+ background: var(--memori-icon-active-bg);
110
+ box-shadow: none;
111
+ color: var(--memori-primary);
112
+ }
113
+
114
+ .memori-widget
115
+ .memori-icon-button.memori-button.memori-icon-button--active:hover:not(:disabled, .memori-button--disabled),
116
+ .memori-widget .memori-icon-button.memori-button.memori-button--active:hover:not(:disabled, .memori-button--disabled) {
117
+ border-color: var(--memori-primary);
118
+ background: color-mix(in oklch, var(--memori-primary) 18%, transparent);
119
+ color: var(--memori-primary);
120
+ }
121
+
122
+ /* Mic recording — soft error, not primary */
123
+ .memori-widget .memori-icon-button.memori-button.memori-icon-button--recording {
124
+ border-color: var(--memori-error, #dc2626);
125
+ background: var(--memori-icon-recording-bg);
126
+ box-shadow: none;
127
+ color: var(--memori-error, #dc2626);
128
+ transform: none;
129
+ }
130
+
131
+ .memori-widget .memori-icon-button.memori-button.memori-icon-button--recording:focus-visible {
132
+ border-color: var(--memori-error, #dc2626);
133
+ box-shadow: 0 0 0 3px color-mix(in oklch, var(--memori-error, #dc2626) 22%, transparent);
134
+ outline-color: var(--memori-error, #dc2626);
135
+ }
136
+
137
+ .memori-widget
138
+ .memori-icon-button.memori-button.memori-icon-button--recording:hover:not(:disabled, .memori-button--disabled) {
139
+ border-color: var(--memori-error, #dc2626);
140
+ background: var(--memori-icon-recording-bg);
141
+ box-shadow: none;
142
+ color: var(--memori-error, #dc2626);
143
+ transform: none;
144
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Button } from '@memori.ai/ui';
3
+ export type IconButtonProps = Omit<React.ComponentProps<typeof Button>, 'variant' | 'active'> & {
4
+ active?: boolean;
5
+ recording?: boolean;
6
+ variant?: React.ComponentProps<typeof Button>['variant'];
7
+ };
8
+ declare const IconButton: React.ForwardRefExoticComponent<Pick<IconButtonProps, "children" | "form" | "slot" | "style" | "title" | "shape" | "value" | "className" | "key" | "name" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "render" | "type" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "focusableWhenDisabled" | "nativeButton" | "danger" | "variant" | "loading" | "icon" | "size" | "active" | "fullWidth" | "iconPosition" | "shadow" | "ariaLabel" | "recording"> & React.RefAttributes<HTMLButtonElement>>;
9
+ export default IconButton;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import cx from 'classnames';
4
+ import { Button } from '@memori.ai/ui';
5
+ function hasVisibleLabel(children) {
6
+ return React.Children.toArray(children).some(child => {
7
+ if (child === null || child === undefined)
8
+ return false;
9
+ if (typeof child === 'boolean')
10
+ return false;
11
+ if (typeof child === 'string')
12
+ return child.trim().length > 0;
13
+ if (typeof child === 'number')
14
+ return true;
15
+ return true;
16
+ });
17
+ }
18
+ const IconButton = React.forwardRef(({ active = false, recording = false, className, variant = 'toolbar', shape = 'default', size = 'sm', children, ...rest }, ref) => {
19
+ const isRecording = !!recording;
20
+ const isActive = !!active && !isRecording;
21
+ const isLabeled = hasVisibleLabel(children);
22
+ const resolvedVariant = variant === 'primary' ||
23
+ variant === 'secondary' ||
24
+ variant === 'danger' ||
25
+ variant === 'outline' ||
26
+ variant === 'ghost'
27
+ ? 'toolbar'
28
+ : variant;
29
+ return (_jsx(Button, { ref: ref, variant: resolvedVariant, shape: shape, size: size, active: isActive, className: cx('memori-icon-button', isLabeled && 'memori-icon-button--labeled', isActive && 'memori-icon-button--active', isRecording && 'memori-icon-button--recording', className), ...rest, children: children }));
30
+ });
31
+ IconButton.displayName = 'IconButton';
32
+ export default IconButton;
33
+ //# sourceMappingURL=IconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/components/IconButton/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAqBvC,SAAS,eAAe,CAAC,QAAyB;IAChD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACnD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACxD,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F,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,eAAe,UAAU,CAAC"}
@@ -157,6 +157,7 @@ const ArtifactDrawer = ({ isChatLogPanel = false, }) => {
157
157
  timestamp: new Date(),
158
158
  size: 0,
159
159
  id: '',
160
+ artifactId: '',
160
161
  });
161
162
  }, disabled: false, className: "memori-artifact-action-btn", ghost: true, icon: _jsx(Link, { className: "memori-artifact-action-icon" }), title: t('artifact.external') || 'External', children: _jsx("span", { className: "memori-artifact-action-text", children: t('artifact.external') || 'External' }) })] }) }) })] })] })), isMobile && (_jsx(Button, { onClick: closeArtifact, className: cx('memori-artifact-drawer--close', 'memori-button--icon-only'), ghost: true, title: t('artifact.close') || 'Close', children: _jsx(Close, { className: "memori-artifact-panel--close-icon" }) }))] }), _jsx("div", { className: "memori-artifact-panel--header" }), _jsx("div", { className: "memori-artifact-panel--content", children: _jsx("div", { className: "memori-artifact-panel--main", children: _jsx(ArtifactPreview, { artifact: state.currentArtifact, activeTab: activeTab }) }) })] }));
162
163
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ArtifactDrawer.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAW,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAU,UAAU,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,MAAM,M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AAC,CAAA;yDAAA,EACF,QAAQ,EAAE,KAAK,EACf,SAAS,EAAC,4BAA4B,EACtC,KAAK,QACL,IAAI,EAAE,KAAC,IAAI,IAAC,SAAS,EAAC,6BAA6B,GAAG,EACtD,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,IAAI,UAAU,YAE3C,eAAM,SAAS,EAAC,6BAA6B,YAC1C,CAAC,CAAC,mBAAmB,CAAC,IAAI,UAAU,GAChC,GACA,IACL,GACK,GACF,IACR,IACN,CACJ,EAGA,QAAQ,IAAI,CACX,KAAC,MAAM,IACL,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,EAAE,CACX,+BAA+B,EAC/B,0BAA0B,CAC3B,EACD,KAAK,QACL,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,IAAI,OAAO,YAErC,KAAC,KAAK,IAAC,SAAS,EAAC,mCAAmC,GAAG,GAChD,CACV,IACG,EAEN,cAAK,SAAS,EAAC,+BAA+B,GAAO,EAGrD,cAAK,SAAS,EAAC,gCAAgC,YAC7C,cAAK,SAAS,EAAC,6BAA6B,YAC1C,KAAC,eAAe,IACd,QAAQ,EAAE,KAAK,CAAC,eAAe,EAC/B,SAAS,EAAE,SAAS,GACpB,GACE,GACF,IACW,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ArtifactDrawer.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAW,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAU,UAAU,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,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AAe,mCAAI;gEACzD,OAAO,EAAE,EAAE;gEACX,QAAQ,EAAE,EAAE;gEACZ,KAAK,EAAE,EAAE;gEACT,SAAS,EAAE,IAAI,IAAI,EAAE;gEACrB,IAAI,EAAE,CAAC;gEACP,EAAE,EAAE,EAAE;gEACN,UAAU,EAAE,EAAE;6DACf,CAAC,CAAA;yDAAA,EACF,QAAQ,EAAE,KAAK,EACf,SAAS,EAAC,4BAA4B,EACtC,KAAK,QACL,IAAI,EAAE,KAAC,IAAI,IAAC,SAAS,EAAC,6BAA6B,GAAG,EACtD,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,IAAI,UAAU,YAE3C,eAAM,SAAS,EAAC,6BAA6B,YAC1C,CAAC,CAAC,mBAAmB,CAAC,IAAI,UAAU,GAChC,GACA,IACL,GACK,GACF,IACR,IACN,CACJ,EAGA,QAAQ,IAAI,CACX,KAAC,MAAM,IACL,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,EAAE,CACX,+BAA+B,EAC/B,0BAA0B,CAC3B,EACD,KAAK,QACL,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,IAAI,OAAO,YAErC,KAAC,KAAK,IAAC,SAAS,EAAC,mCAAmC,GAAG,GAChD,CACV,IACG,EAEN,cAAK,SAAS,EAAC,+BAA+B,GAAO,EAGrD,cAAK,SAAS,EAAC,gCAAgC,YAC7C,cAAK,SAAS,EAAC,6BAA6B,YAC1C,KAAC,eAAe,IACd,QAAQ,EAAE,KAAK,CAAC,eAAe,EAC/B,SAAS,EAAE,SAAS,GACpB,GACE,GACF,IACW,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useEffect, useMemo, useCallback, memo } from 'react';
2
+ import React, { useEffect, useState, useMemo, useCallback, memo, useRef, } from 'react';
3
3
  import { useArtifact } from '../../context/ArtifactContext';
4
4
  import ChevronRight from '../../../icons/ChevronRight';
5
5
  import ArtifactDrawer from '../ArtifactDrawer/ArtifactDrawer';
@@ -7,6 +7,8 @@ import ChevronDown from '../../../icons/ChevronDown';
7
7
  import ChevronLeft from '../../../icons/ChevronLeft';
8
8
  import ChevronUp from '../../../icons/ChevronUp';
9
9
  import { stripReasoningTags } from '../../../../helpers/utils';
10
+ import { parseEdits } from '../../utils/applyEdits';
11
+ import { useTranslation } from 'react-i18next';
10
12
  const formatBytes = (bytes) => {
11
13
  if (bytes === 0)
12
14
  return '0 Bytes';
@@ -15,24 +17,64 @@ const formatBytes = (bytes) => {
15
17
  const i = Math.floor(Math.log(bytes) / Math.log(k));
16
18
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
17
19
  };
18
- const hashContent = (str) => {
19
- let hash = 0;
20
- const len = Math.min(str.length, 200);
21
- for (let i = 0; i < len; i++) {
22
- hash = (hash << 5) - hash + str.charCodeAt(i);
23
- hash |= 0;
24
- }
25
- return Math.abs(hash).toString(36);
26
- };
27
20
  const CLASS_ATTR_RE = /class\s*=\s*["']([^"']*)["']/i;
28
- const hasMemoriArtifactClass = (openingTag) => {
21
+ const DATA_ACTION_RE = /data-action\s*=\s*["']([^"']+)["']/i;
22
+ const getClassList = (openingTag) => {
29
23
  const m = openingTag.match(CLASS_ATTR_RE);
30
24
  if (!m)
25
+ return [];
26
+ return m[1].split(/\s+/).filter(Boolean);
27
+ };
28
+ const getDataAction = (openingTag) => {
29
+ var _a;
30
+ const m = openingTag.match(DATA_ACTION_RE);
31
+ return ((_a = m === null || m === void 0 ? void 0 : m[1]) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) || null;
32
+ };
33
+ const isCreateArtifactTag = (openingTag) => {
34
+ const classes = getClassList(openingTag);
35
+ if (classes.includes('memori-artifact-update'))
31
36
  return false;
32
- return /\bmemori-artifact\b/.test(m[1]);
37
+ if (!classes.includes('memori-artifact'))
38
+ return false;
39
+ const action = getDataAction(openingTag);
40
+ return action === null || action === 'create';
41
+ };
42
+ const isUpdateArtifactTag = (openingTag) => {
43
+ const classes = getClassList(openingTag);
44
+ if (classes.includes('memori-artifact-update'))
45
+ return true;
46
+ if (!classes.includes('memori-artifact'))
47
+ return false;
48
+ return getDataAction(openingTag) === 'update';
49
+ };
50
+ const findMatchingOutputClose = (cleaned, openEnd) => {
51
+ let depth = 1;
52
+ let pos = openEnd;
53
+ let closeStart = -1;
54
+ while (pos < cleaned.length && depth > 0) {
55
+ const nextOpen = cleaned.indexOf('<output', pos);
56
+ const nextClose = cleaned.indexOf('</output>', pos);
57
+ if (nextClose === -1) {
58
+ return cleaned.length;
59
+ }
60
+ if (nextOpen !== -1 && nextOpen < nextClose) {
61
+ depth++;
62
+ pos = nextOpen + '<output'.length;
63
+ }
64
+ else {
65
+ depth--;
66
+ if (depth === 0) {
67
+ closeStart = nextClose;
68
+ }
69
+ else {
70
+ pos = nextClose + '</output>'.length;
71
+ }
72
+ }
73
+ }
74
+ return closeStart;
33
75
  };
34
76
  const detectArtifacts = (text, isFromUser, messageKey) => {
35
- var _a;
77
+ var _a, _b;
36
78
  if (!text || isFromUser)
37
79
  return [];
38
80
  const cleaned = stripReasoningTags(text);
@@ -46,37 +88,12 @@ const detectArtifacts = (text, isFromUser, messageKey) => {
46
88
  if (!openMatch)
47
89
  break;
48
90
  const fullOpenTag = openMatch[0];
49
- const openStart = openMatch.index;
50
- const openEnd = openStart + fullOpenTag.length;
51
- if (!hasMemoriArtifactClass(fullOpenTag)) {
91
+ const openEnd = openMatch.index + fullOpenTag.length;
92
+ if (!isCreateArtifactTag(fullOpenTag)) {
52
93
  searchFrom = openEnd;
53
94
  continue;
54
95
  }
55
- let depth = 1;
56
- let pos = openEnd;
57
- let closeStart = -1;
58
- while (pos < cleaned.length && depth > 0) {
59
- const nextOpen = cleaned.indexOf('<output', pos);
60
- const nextClose = cleaned.indexOf('</output>', pos);
61
- if (nextClose === -1) {
62
- closeStart = cleaned.length;
63
- depth = 0;
64
- break;
65
- }
66
- if (nextOpen !== -1 && nextOpen < nextClose) {
67
- depth++;
68
- pos = nextOpen + '<output'.length;
69
- }
70
- else {
71
- depth--;
72
- if (depth === 0) {
73
- closeStart = nextClose;
74
- }
75
- else {
76
- pos = nextClose + '</output>'.length;
77
- }
78
- }
79
- }
96
+ const closeStart = findMatchingOutputClose(cleaned, openEnd);
80
97
  if (closeStart === -1) {
81
98
  searchFrom = openEnd;
82
99
  continue;
@@ -90,9 +107,12 @@ const detectArtifacts = (text, isFromUser, messageKey) => {
90
107
  (htmlTitleMatch === null || htmlTitleMatch === void 0 ? void 0 : htmlTitleMatch[1]) ||
91
108
  `${mimeType.toUpperCase()} Artifact`;
92
109
  artifactNum++;
93
- const stableId = `artifact-${messageKey}-${artifactNum}-${hashContent(content)}`;
110
+ const dataArtifactIdMatch = fullOpenTag.match(/data-artifact-id\s*=\s*["']([^"']+)["']/i);
111
+ const artifactId = ((_b = dataArtifactIdMatch === null || dataArtifactIdMatch === void 0 ? void 0 : dataArtifactIdMatch[1]) === null || _b === void 0 ? void 0 : _b.trim()) ||
112
+ `artifact-${messageKey}-${artifactNum}`;
94
113
  artifacts.push({
95
- id: stableId,
114
+ id: `artifact-ui-${artifactId}`,
115
+ artifactId,
96
116
  content,
97
117
  mimeType,
98
118
  title,
@@ -106,9 +126,46 @@ const detectArtifacts = (text, isFromUser, messageKey) => {
106
126
  }
107
127
  return artifacts;
108
128
  };
129
+ const detectUpdates = (text, isFromUser) => {
130
+ var _a;
131
+ if (!text || isFromUser)
132
+ return [];
133
+ const cleaned = stripReasoningTags(text);
134
+ const updates = [];
135
+ let searchFrom = 0;
136
+ const OPEN_TAG_RE = /<output\b([^>]*)>/gi;
137
+ while (searchFrom < cleaned.length) {
138
+ OPEN_TAG_RE.lastIndex = searchFrom;
139
+ const openMatch = OPEN_TAG_RE.exec(cleaned);
140
+ if (!openMatch)
141
+ break;
142
+ const fullOpenTag = openMatch[0];
143
+ const openEnd = openMatch.index + fullOpenTag.length;
144
+ if (!isUpdateArtifactTag(fullOpenTag)) {
145
+ searchFrom = openEnd;
146
+ continue;
147
+ }
148
+ const closeStart = cleaned.indexOf('</output>', openEnd);
149
+ const bodyEnd = closeStart === -1 ? cleaned.length : closeStart;
150
+ const body = cleaned.slice(openEnd, bodyEnd).trim();
151
+ const idMatch = fullOpenTag.match(/data-artifact-id\s*=\s*["']([^"']+)["']/i);
152
+ const artifactId = (_a = idMatch === null || idMatch === void 0 ? void 0 : idMatch[1]) === null || _a === void 0 ? void 0 : _a.trim();
153
+ const edits = parseEdits(body);
154
+ if (artifactId && edits) {
155
+ updates.push({ artifactId, edits });
156
+ }
157
+ else if (artifactId) {
158
+ updates.push({ artifactId, edits: [] });
159
+ }
160
+ searchFrom =
161
+ closeStart === -1 ? cleaned.length : closeStart + '</output>'.length;
162
+ }
163
+ return updates;
164
+ };
109
165
  const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
110
166
  var _a;
111
- const { openArtifact, state, closeArtifact } = useArtifact();
167
+ const { openArtifact, state, closeArtifact, registerArtifact, applyArtifactUpdate, } = useArtifact();
168
+ const { t } = useTranslation();
112
169
  const messageText = useMemo(() => message.text || '', [message.text]);
113
170
  const translatedMessageText = useMemo(() => message.translatedText || '', [message.translatedText]);
114
171
  const messageKey = useMemo(() => `${message.timestamp}-${message.fromUser ? '1' : '0'}`, [message.timestamp, message.fromUser]);
@@ -125,18 +182,79 @@ const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
125
182
  return primary;
126
183
  return detectArtifacts(translatedMessageText, fromUser, messageKey);
127
184
  }, [messageText, translatedMessageText, message.fromUser, messageKey]);
185
+ const detectedUpdates = useMemo(() => {
186
+ const fromUser = message.fromUser || false;
187
+ const primary = detectUpdates(messageText, fromUser);
188
+ if (primary.length > 0)
189
+ return primary;
190
+ return detectUpdates(translatedMessageText, fromUser);
191
+ }, [messageText, translatedMessageText, message.fromUser]);
192
+ const [updateResultMap, setUpdateResultMap] = useState({});
193
+ const [failedUpdates, setFailedUpdates] = useState([]);
194
+ const processedUpdatesRef = useRef('');
195
+ const hasAutoOpenedRef = useRef('');
128
196
  useEffect(() => {
129
- if (!messageText || artifacts.length === 0)
197
+ if (!messageText && !translatedMessageText)
130
198
  return;
131
- artifacts.forEach(artifact => dispatchArtifactCreatedEvent(artifact));
132
- if (!isChatlogPanel) {
133
- const timer = setTimeout(() => openArtifact(artifacts[0]), 100);
134
- return () => clearTimeout(timer);
199
+ artifacts.forEach(artifact => {
200
+ registerArtifact(artifact);
201
+ dispatchArtifactCreatedEvent(artifact);
202
+ });
203
+ const updatesSignature = `${messageKey}:${detectedUpdates
204
+ .map(u => `${u.artifactId}:${JSON.stringify(u.edits)}`)
205
+ .join('|')}`;
206
+ let lastUpdated = null;
207
+ if (detectedUpdates.length > 0 &&
208
+ processedUpdatesRef.current !== updatesSignature) {
209
+ processedUpdatesRef.current = updatesSignature;
210
+ const nextMap = {};
211
+ const nextFailed = [];
212
+ detectedUpdates.forEach((update, idx) => {
213
+ var _a;
214
+ if (!update.edits.length) {
215
+ nextFailed.push({
216
+ artifactId: update.artifactId,
217
+ reason: 'invalid',
218
+ });
219
+ return;
220
+ }
221
+ const result = applyArtifactUpdate(update.artifactId, update.edits);
222
+ if (result.updatedArtifact) {
223
+ nextMap[idx] = result.updatedArtifact;
224
+ lastUpdated = result.updatedArtifact;
225
+ dispatchArtifactCreatedEvent(result.updatedArtifact);
226
+ }
227
+ else {
228
+ nextFailed.push({
229
+ artifactId: update.artifactId,
230
+ reason: (_a = result.failureReason) !== null && _a !== void 0 ? _a : 'no-match',
231
+ });
232
+ }
233
+ });
234
+ setUpdateResultMap(nextMap);
235
+ setFailedUpdates(nextFailed);
135
236
  }
237
+ if (isChatlogPanel)
238
+ return;
239
+ const openTarget = lastUpdated !== null && lastUpdated !== void 0 ? lastUpdated : (Object.keys(updateResultMap).length === 0 && artifacts.length > 0
240
+ ? artifacts[0]
241
+ : null);
242
+ if (!openTarget)
243
+ return;
244
+ if (hasAutoOpenedRef.current === messageKey)
245
+ return;
246
+ hasAutoOpenedRef.current = messageKey;
247
+ const timer = setTimeout(() => openArtifact(openTarget), 100);
248
+ return () => clearTimeout(timer);
136
249
  }, [
137
250
  messageKey,
138
251
  messageText,
252
+ translatedMessageText,
139
253
  artifacts,
254
+ detectedUpdates,
255
+ updateResultMap,
256
+ registerArtifact,
257
+ applyArtifactUpdate,
140
258
  dispatchArtifactCreatedEvent,
141
259
  isChatlogPanel,
142
260
  openArtifact,
@@ -169,18 +287,45 @@ const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
169
287
  return '🖼️';
170
288
  return '📄';
171
289
  }, []);
172
- if (artifacts.length === 0)
290
+ const updatedLabel = t('artifact.updated') || 'updated';
291
+ const updateFailedLabel = t('artifact.updateFailed') || 'Update could not be applied';
292
+ const updateFailedHint = t('artifact.updateFailedHint') ||
293
+ 'The patch did not match the current content. Ask to rewrite the artifact.';
294
+ const updateEntries = Object.entries(updateResultMap);
295
+ const hasCreates = artifacts.length > 0;
296
+ const hasUpdates = updateEntries.length > 0;
297
+ const hasFailed = failedUpdates.length > 0;
298
+ if (!hasCreates && !hasUpdates && !hasFailed)
173
299
  return null;
174
- return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: artifacts.map(artifact => {
175
- var _a;
176
- const isSelected = state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === artifact.id;
177
- return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: `memori-artifact-handler${isSelected ? ' memori-artifact-handler--selected' : ''}`, onClick: () => handleArtifactClick(artifact), style: isSelected
178
- ? {
179
- border: '2px solid var(--memori-primary, #3b82f6)',
180
- boxShadow: '0 0 0 3px rgba(59, 130, 246, 0.1)',
181
- }
182
- : undefined, children: [_jsx("div", { className: "memori-artifact-handler-icon", children: getIconForMimeType(artifact.mimeType) }), _jsxs("div", { className: "memori-artifact-handler-info", children: [_jsx("div", { className: "memori-artifact-handler-title", children: artifact.title }), _jsxs("div", { className: "memori-artifact-handler-meta", children: [artifact.mimeType, " \u2022 ", formatBytes(artifact.size || 0)] })] }), _jsx("div", { className: "memori-artifact-handler-action", children: isChatlogPanel ? (isSelected ? (_jsx(ChevronUp, { className: "memori-artifact-handler-action-icon" })) : (_jsx(ChevronDown, { className: "memori-artifact-handler-action-icon" }))) : isSelected ? (_jsx(ChevronLeft, { className: "memori-artifact-handler-action-icon" })) : (_jsx(ChevronRight, { className: "memori-artifact-handler-action-icon" })) })] }), isSelected && _jsx(ArtifactDrawer, { isChatLogPanel: isChatlogPanel })] }, artifact.id));
183
- }) }));
300
+ const renderChevron = (isSelected) => {
301
+ if (isChatlogPanel) {
302
+ return isSelected ? (_jsx(ChevronUp, { className: "memori-artifact-handler-action-icon" })) : (_jsx(ChevronDown, { className: "memori-artifact-handler-action-icon" }));
303
+ }
304
+ return isSelected ? (_jsx(ChevronLeft, { className: "memori-artifact-handler-action-icon" })) : (_jsx(ChevronRight, { className: "memori-artifact-handler-action-icon" }));
305
+ };
306
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [artifacts.map(artifact => {
307
+ var _a;
308
+ const isSelected = state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === artifact.id;
309
+ return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: `memori-artifact-handler${isSelected ? ' memori-artifact-handler--selected' : ''}`, onClick: () => handleArtifactClick(artifact), style: isSelected
310
+ ? {
311
+ border: '2px solid var(--memori-primary, #3b82f6)',
312
+ boxShadow: '0 0 0 3px rgba(59, 130, 246, 0.1)',
313
+ }
314
+ : undefined, children: [_jsx("div", { className: "memori-artifact-handler-icon", children: getIconForMimeType(artifact.mimeType) }), _jsxs("div", { className: "memori-artifact-handler-info", children: [_jsx("div", { className: "memori-artifact-handler-title", children: artifact.title }), _jsxs("div", { className: "memori-artifact-handler-meta", children: [artifact.mimeType, " \u2022 ", formatBytes(artifact.size || 0)] })] }), _jsx("div", { className: "memori-artifact-handler-action", children: renderChevron(isSelected) })] }), isSelected && _jsx(ArtifactDrawer, { isChatLogPanel: isChatlogPanel })] }, artifact.id));
315
+ }), updateEntries.map(([, artifact]) => {
316
+ var _a;
317
+ const isSelected = state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === artifact.id;
318
+ return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: `memori-artifact-handler${isSelected ? ' memori-artifact-handler--selected' : ''}`, onClick: () => handleArtifactClick(artifact), style: isSelected
319
+ ? {
320
+ border: '2px solid var(--memori-primary, #3b82f6)',
321
+ boxShadow: '0 0 0 3px rgba(59, 130, 246, 0.1)',
322
+ }
323
+ : undefined, children: [_jsx("div", { className: "memori-artifact-handler-icon", children: "\u270F\uFE0F" }), _jsxs("div", { className: "memori-artifact-handler-info", children: [_jsxs("div", { className: "memori-artifact-handler-title", children: [artifact.title, " \u2014 ", updatedLabel] }), _jsxs("div", { className: "memori-artifact-handler-meta", children: [artifact.mimeType, " \u2022 ", formatBytes(artifact.size || 0)] })] }), _jsx("div", { className: "memori-artifact-handler-action", children: renderChevron(isSelected) })] }), isSelected && _jsx(ArtifactDrawer, { isChatLogPanel: isChatlogPanel })] }, artifact.id));
324
+ }), failedUpdates.map((failed, idx) => (_jsxs("div", { className: "memori-artifact-handler memori-artifact-handler--failed", style: {
325
+ opacity: 0.85,
326
+ border: '1px dashed var(--memori-danger, #ef4444)',
327
+ cursor: 'default',
328
+ }, role: "status", children: [_jsx("div", { className: "memori-artifact-handler-icon", children: "\u26A0\uFE0F" }), _jsxs("div", { className: "memori-artifact-handler-info", children: [_jsx("div", { className: "memori-artifact-handler-title", children: updateFailedLabel }), _jsxs("div", { className: "memori-artifact-handler-meta", children: [failed.artifactId, " \u2022 ", updateFailedHint] })] })] }, `failed-${failed.artifactId}-${idx}`)))] }));
184
329
  };
185
330
  const MemoizedArtifactHandler = memo(ArtifactHandler, (prev, next) => {
186
331
  const prevText = prev.message.text || prev.message.translatedText || '';