@aintela/chat 0.2.15

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 (218) hide show
  1. package/README.md +161 -0
  2. package/dist/ClientMessage-EKgfuTp8.js +40 -0
  3. package/dist/ClientMessage-EKgfuTp8.js.map +1 -0
  4. package/dist/Memory-DjLZqgbF.js +84 -0
  5. package/dist/Memory-DjLZqgbF.js.map +1 -0
  6. package/dist/Prompt-DZb7OaPp.js +37 -0
  7. package/dist/Prompt-DZb7OaPp.js.map +1 -0
  8. package/dist/artifactHtmlHandler-CMQJf1cX.js +41 -0
  9. package/dist/artifactHtmlHandler-CMQJf1cX.js.map +1 -0
  10. package/dist/auth-CcTgInbY.js +524 -0
  11. package/dist/auth-CcTgInbY.js.map +1 -0
  12. package/dist/components.d.ts +2 -0
  13. package/dist/components.js +14159 -0
  14. package/dist/components.js.map +1 -0
  15. package/dist/environmentUtils-BaKw5_VD.js +462 -0
  16. package/dist/environmentUtils-BaKw5_VD.js.map +1 -0
  17. package/dist/hooks.d.ts +2 -0
  18. package/dist/hooks.js +9 -0
  19. package/dist/hooks.js.map +1 -0
  20. package/dist/httpArtifactService-BAR60Gu1.js +1802 -0
  21. package/dist/httpArtifactService-BAR60Gu1.js.map +1 -0
  22. package/dist/httpSessionService-5Kr__oQL.js +279 -0
  23. package/dist/httpSessionService-5Kr__oQL.js.map +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.js +226 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/interfaces.d.ts +2 -0
  28. package/dist/interfaces.js +11 -0
  29. package/dist/interfaces.js.map +1 -0
  30. package/dist/models.d.ts +2 -0
  31. package/dist/models.js +54 -0
  32. package/dist/models.js.map +1 -0
  33. package/dist/serializer-DyHZxlAG.js +1276 -0
  34. package/dist/serializer-DyHZxlAG.js.map +1 -0
  35. package/dist/services.d.ts +2 -0
  36. package/dist/services.js +16 -0
  37. package/dist/services.js.map +1 -0
  38. package/dist/sortable-table-DgQHxWIh.js +819 -0
  39. package/dist/sortable-table-DgQHxWIh.js.map +1 -0
  40. package/dist/src/ErrorBondary.d.ts +10 -0
  41. package/dist/src/components/AiChat/AiChat.d.ts +3 -0
  42. package/dist/src/components/AiChat/AiChatContext.d.ts +76 -0
  43. package/dist/src/components/AiChat/AiChatDrawer.d.ts +3 -0
  44. package/dist/src/components/AiChat/AiChatFloating.d.ts +3 -0
  45. package/dist/src/components/AiChat/AiChatProvider.d.ts +7 -0
  46. package/dist/src/components/AiChat/AiChatSessionStore.d.ts +1 -0
  47. package/dist/src/components/AiChat/AiChatTypes.d.ts +227 -0
  48. package/dist/src/components/AiChat/ChatPane/AlertDialog.d.ts +12 -0
  49. package/dist/src/components/AiChat/ChatPane/AskUserSheet.d.ts +25 -0
  50. package/dist/src/components/AiChat/ChatPane/ChatPane.d.ts +7 -0
  51. package/dist/src/components/AiChat/ChatPane/ConnectionState.d.ts +2 -0
  52. package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +12 -0
  53. package/dist/src/components/AiChat/ChatPane/Event.d.ts +6 -0
  54. package/dist/src/components/AiChat/ChatPane/FloatingConnectionStatus.d.ts +8 -0
  55. package/dist/src/components/AiChat/ChatPane/FriendlyPartDisplay.d.ts +13 -0
  56. package/dist/src/components/AiChat/ChatPane/LastPrompts.d.ts +9 -0
  57. package/dist/src/components/AiChat/ChatPane/Message.d.ts +11 -0
  58. package/dist/src/components/AiChat/ChatPane/MessageAgent.d.ts +16 -0
  59. package/dist/src/components/AiChat/ChatPane/MessageNonTextDisplay.d.ts +16 -0
  60. package/dist/src/components/AiChat/ChatPane/MessagePart.d.ts +15 -0
  61. package/dist/src/components/AiChat/ChatPane/MessagePersona.d.ts +13 -0
  62. package/dist/src/components/AiChat/ChatPane/MessageUser.d.ts +8 -0
  63. package/dist/src/components/AiChat/ChatPane/ModelSelector.d.ts +11 -0
  64. package/dist/src/components/AiChat/ChatPane/Prompt.d.ts +9 -0
  65. package/dist/src/components/AiChat/ChatPane/SessionDataDialog.d.ts +7 -0
  66. package/dist/src/components/AiChat/ChatPane/StickyQuestionHeader.d.ts +7 -0
  67. package/dist/src/components/AiChat/ChatPane/StreamStatistics.d.ts +32 -0
  68. package/dist/src/components/AiChat/ChatPane/SubAgentBox.d.ts +9 -0
  69. package/dist/src/components/AiChat/ChatPane/TaskList.d.ts +6 -0
  70. package/dist/src/components/AiChat/ChatPane/friendlyToolConfig.d.ts +11 -0
  71. package/dist/src/components/AiChat/ChatPane/parts/AskUserPart.d.ts +8 -0
  72. package/dist/src/components/AiChat/ChatPane/parts/BoxedPart.d.ts +4 -0
  73. package/dist/src/components/AiChat/ChatPane/parts/FunctionPart.d.ts +4 -0
  74. package/dist/src/components/AiChat/ChatPane/parts/SuspendedPart.d.ts +4 -0
  75. package/dist/src/components/AiChat/ChatPane/parts/TextPart.d.ts +4 -0
  76. package/dist/src/components/AiChat/ChatPane/parts/ThoughtPart.d.ts +4 -0
  77. package/dist/src/components/AiChat/ChatPane/parts/UiToolDispatcher.d.ts +16 -0
  78. package/dist/src/components/AiChat/ChatPane/parts/WaitingPart.d.ts +4 -0
  79. package/dist/src/components/AiChat/ChatPane/parts/index.d.ts +20 -0
  80. package/dist/src/components/AiChat/ChatPane/parts/index.test.d.ts +1 -0
  81. package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +22 -0
  82. package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +121 -0
  83. package/dist/src/components/AiChat/index.d.ts +13 -0
  84. package/dist/src/components/AiChat/sessionStateManagerService.d.ts +47 -0
  85. package/dist/src/components/AiChat/stateConfiguration.d.ts +80 -0
  86. package/dist/src/components/Library/ArtifactRender.d.ts +18 -0
  87. package/dist/src/components/Library/DelayTextComponent.d.ts +9 -0
  88. package/dist/src/components/Library/LinearBackgroundProgress.d.ts +8 -0
  89. package/dist/src/components/Library/LinearProgressBarWithMarkers.d.ts +14 -0
  90. package/dist/src/components/Library/LoadingDots.d.ts +8 -0
  91. package/dist/src/components/Library/MarkdowmExtended.d.ts +32 -0
  92. package/dist/src/components/Library/VizLibrary/Skeletons/ChartSkeleton.d.ts +3 -0
  93. package/dist/src/components/Library/VizLibrary/Skeletons/IFrameSkeleton.d.ts +3 -0
  94. package/dist/src/components/Library/VizLibrary/Skeletons/MetricGroupSkeleton.d.ts +8 -0
  95. package/dist/src/components/Library/VizLibrary/Skeletons/MetricSkeleton.d.ts +7 -0
  96. package/dist/src/components/Library/VizLibrary/Skeletons/TableSkeleton.d.ts +7 -0
  97. package/dist/src/components/Library/VizLibrary/index.d.ts +5 -0
  98. package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +33 -0
  99. package/dist/src/components/LlmResponseRender/GeneratingVisualization.d.ts +13 -0
  100. package/dist/src/components/LlmResponseRender/LiveJsxBlock.d.ts +55 -0
  101. package/dist/src/components/LlmResponseRender/LlmResponseRender.d.ts +29 -0
  102. package/dist/src/components/LlmResponseRender/index.d.ts +6 -0
  103. package/dist/src/components/LlmResponseRender/jsxScope.d.ts +41 -0
  104. package/dist/src/components/LlmResponseRender/liveTsxConfig.d.ts +18 -0
  105. package/dist/src/components/LlmResponseRender/parseBlocks.d.ts +39 -0
  106. package/dist/src/components/Stopwatch.d.ts +12 -0
  107. package/dist/src/components/index.d.ts +30 -0
  108. package/dist/src/components/v2/AgentActivityV2.d.ts +32 -0
  109. package/dist/src/components/v2/AiChatFloatingV2.d.ts +3 -0
  110. package/dist/src/components/v2/AiChatV2Pane.d.ts +20 -0
  111. package/dist/src/components/v2/AppBarV2.d.ts +38 -0
  112. package/dist/src/components/v2/AppRailV2.d.ts +21 -0
  113. package/dist/src/components/v2/AppShellV2.d.ts +13 -0
  114. package/dist/src/components/v2/ChatsHistoryV2.d.ts +47 -0
  115. package/dist/src/components/v2/LastPromptsV2.d.ts +6 -0
  116. package/dist/src/components/v2/MobileDrawerV2.d.ts +43 -0
  117. package/dist/src/components/v2/PromptV2.d.ts +164 -0
  118. package/dist/src/components/v2/RunProgressPanelV2.d.ts +28 -0
  119. package/dist/src/components/v2/RunProgressStripV2.d.ts +2 -0
  120. package/dist/src/components/v2/Sparkline.d.ts +10 -0
  121. package/dist/src/components/v2/SubAgentBoxV2.d.ts +15 -0
  122. package/dist/src/components/v2/TaskListV2.d.ts +8 -0
  123. package/dist/src/components/v2/icons.d.ts +42 -0
  124. package/dist/src/components/v2/index.d.ts +34 -0
  125. package/dist/src/components/v2/styles.d.ts +6 -0
  126. package/dist/src/components/v2/toolCategories.d.ts +18 -0
  127. package/dist/src/components/v2/useResponsiveLayout.d.ts +9 -0
  128. package/dist/src/hooks/index.d.ts +4 -0
  129. package/dist/src/hooks/useChatSessions.d.ts +68 -0
  130. package/dist/src/hooks/useContainerWidth.d.ts +2 -0
  131. package/dist/src/hooks/useIntervalHook.d.ts +2 -0
  132. package/dist/src/index.d.ts +7 -0
  133. package/dist/src/interfaces/IHeartbeatPort.d.ts +4 -0
  134. package/dist/src/interfaces/INotificationPort.d.ts +4 -0
  135. package/dist/src/interfaces/index.d.ts +4 -0
  136. package/dist/src/interfaces/memoryService.d.ts +37 -0
  137. package/dist/src/interfaces/schedulingService.d.ts +64 -0
  138. package/dist/src/models/Agent.d.ts +32 -0
  139. package/dist/src/models/Artifact.d.ts +21 -0
  140. package/dist/src/models/ArtifactData.d.ts +30 -0
  141. package/dist/src/models/ChatSession.d.ts +57 -0
  142. package/dist/src/models/ClientMessage.d.ts +38 -0
  143. package/dist/src/models/Customer.d.ts +7 -0
  144. package/dist/src/models/EndMessageData.d.ts +6 -0
  145. package/dist/src/models/IAbiContext.d.ts +8 -0
  146. package/dist/src/models/IDBStorable.d.ts +14 -0
  147. package/dist/src/models/Interaction.d.ts +36 -0
  148. package/dist/src/models/InteractionPart.d.ts +69 -0
  149. package/dist/src/models/LlmSession.d.ts +10 -0
  150. package/dist/src/models/Memory.d.ts +48 -0
  151. package/dist/src/models/Notification.d.ts +11 -0
  152. package/dist/src/models/Prompt.d.ts +20 -0
  153. package/dist/src/models/SendMessageResponse.d.ts +21 -0
  154. package/dist/src/models/ServerEvent.d.ts +130 -0
  155. package/dist/src/models/connectionState.d.ts +9 -0
  156. package/dist/src/models/contexts.d.ts +33 -0
  157. package/dist/src/models/enums.d.ts +333 -0
  158. package/dist/src/models/index.d.ts +36 -0
  159. package/dist/src/models/semanticKernelModel/index.d.ts +2 -0
  160. package/dist/src/models/semanticKernelModel/init.d.ts +1 -0
  161. package/dist/src/models/semanticKernelModel/models.d.ts +208 -0
  162. package/dist/src/models/semanticKernelModel/serializer.d.ts +40 -0
  163. package/dist/src/models/serverReponse.d.ts +5 -0
  164. package/dist/src/models/subAgentModel.d.ts +48 -0
  165. package/dist/src/models/todoListModel.d.ts +18 -0
  166. package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +163 -0
  167. package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +75 -0
  168. package/dist/src/services/artifactHtmlHandler.d.ts +6 -0
  169. package/dist/src/services/eventBusService.d.ts +119 -0
  170. package/dist/src/services/httpArtifactService.d.ts +25 -0
  171. package/dist/src/services/httpSessionService.d.ts +31 -0
  172. package/dist/src/services/index.d.ts +16 -0
  173. package/dist/src/services/interactionService.d.ts +28 -0
  174. package/dist/src/services/interactionService.test.d.ts +1 -0
  175. package/dist/src/services/interfaces/artifactService.d.ts +13 -0
  176. package/dist/src/services/servers/AgentGatewayService.d.ts +167 -0
  177. package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +44 -0
  178. package/dist/src/services/servers/agentGatewayWSAsync.test.d.ts +1 -0
  179. package/dist/src/services/servers/sessionService/ISessionService.d.ts +20 -0
  180. package/dist/src/services/sessionEventDecoder.d.ts +22 -0
  181. package/dist/src/services/sessionEventDecoder.test.d.ts +1 -0
  182. package/dist/src/services/storageService.d.ts +73 -0
  183. package/dist/src/themes/index.d.ts +3 -0
  184. package/dist/src/themes/v2-chart-palette.d.ts +1 -0
  185. package/dist/src/themes/v2.d.ts +71 -0
  186. package/dist/src/utils/auth.d.ts +9 -0
  187. package/dist/src/utils/envOverrides.d.ts +23 -0
  188. package/dist/src/utils/envUtils.d.ts +13 -0
  189. package/dist/src/utils/environmentUtils.d.ts +43 -0
  190. package/dist/src/utils/fileUtils.d.ts +6 -0
  191. package/dist/src/utils/getAgentArtifactsBaseUrl.d.ts +1 -0
  192. package/dist/src/utils/getAgentBaseUrl.d.ts +1 -0
  193. package/dist/src/utils/getDotNetBaseUrl.d.ts +5 -0
  194. package/dist/src/utils/index.d.ts +17 -0
  195. package/dist/src/utils/interactionIdChecker.d.ts +27 -0
  196. package/dist/src/utils/jsonDetector.d.ts +50 -0
  197. package/dist/src/utils/jsonUtils.d.ts +1 -0
  198. package/dist/src/utils/materialIconsList.d.ts +42 -0
  199. package/dist/src/utils/materialIconsSvg.d.ts +51 -0
  200. package/dist/src/utils/objectUtils.d.ts +31 -0
  201. package/dist/src/utils/parseArtifact.d.ts +3 -0
  202. package/dist/src/utils/sessionWindowParameters.d.ts +3 -0
  203. package/dist/src/utils/sortable-table.d.ts +31 -0
  204. package/dist/src/utils/stringUtils.d.ts +8 -0
  205. package/dist/src/utils/uriUtils.d.ts +39 -0
  206. package/dist/src/utils/urlParser.d.ts +8 -0
  207. package/dist/style.css +94 -0
  208. package/dist/tests/fakes/fakeWebSocket.d.ts +32 -0
  209. package/dist/tests/fakes/makeGateway.d.ts +24 -0
  210. package/dist/tests/fixtures.d.ts +73 -0
  211. package/dist/useChatSessions-DttlifVk.js +107 -0
  212. package/dist/useChatSessions-DttlifVk.js.map +1 -0
  213. package/dist/useContainerWidth-Df2PmSoC.js +52 -0
  214. package/dist/useContainerWidth-Df2PmSoC.js.map +1 -0
  215. package/dist/utils.d.ts +2 -0
  216. package/dist/utils.js +49 -0
  217. package/dist/utils.js.map +1 -0
  218. package/package.json +127 -0
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # @envision/aichat
2
+
3
+ Embeddable AI chat component built on a WebSocket agent gateway. This repo
4
+ is the new home for what was previously `packages/library/src/components/AiChat/`
5
+ in `envision-abi` — extracted into a standalone package so it can be
6
+ consumed as a real library (built, versioned, peer-dep'd) instead of via
7
+ in-tree source aliasing.
8
+
9
+ ## Layout
10
+
11
+ This repo is the published package (`@envision/aichat`) at its root:
12
+
13
+ - `src/`, `package.json`, `vite.config.ts`, `tsconfig.json` — library source + config
14
+ - `dist/` — built output, gitignored (rebuilt on every install via `prepare`)
15
+ - `examples/demo/` — Vite + React SPA that exercises the library against a fake
16
+ agent gateway, with an option to point at a real WSServer
17
+
18
+ ## Develop
19
+
20
+ ```bash
21
+ npm install
22
+ cd examples/demo && npm install && npm run dev # http://localhost:5174
23
+ ```
24
+
25
+ The demo aliases `@envision/aichat` to the root `src/` during development so
26
+ HMR works across the package boundary. To validate the built bundle the way
27
+ a real consumer would:
28
+
29
+ ```bash
30
+ npm run build
31
+ # then remove the alias in examples/demo/vite.config.ts (or use npm link)
32
+ ```
33
+
34
+ ## Consuming
35
+
36
+ Consumers install via a git URL — no public registry. Pin to a tag for
37
+ reproducibility; npm's `prepare` script runs `vite build` so the consumer's
38
+ `node_modules/@envision/aichat/dist/` is populated automatically.
39
+
40
+ ```json
41
+ {
42
+ "dependencies": {
43
+ "@envision/aichat": "github:envision-tecnologia/aichat#v0.1.1"
44
+ }
45
+ }
46
+ ```
47
+
48
+ (`github:owner/repo#ref` is npm's shorthand for `git+ssh://git@github.com/owner/repo.git#ref` — both forms work; npm normalizes to the shorthand on install.)
49
+
50
+ Every peer in `peerDependencies` must be installed by the consumer at a
51
+ compatible version — that's how shared singletons (React, MUI ThemeContext,
52
+ Zustand stores, `reflect-metadata`'s patched Reflect, notistack's
53
+ SnackbarProvider) end up as exactly one instance per app instead of two.
54
+
55
+ ## Testing
56
+
57
+ Vitest runs the unit + integration suite. Co-located `*.test.ts` files
58
+ live next to the source they cover; shared fixtures + fakes live under
59
+ `tests/` and are imported via the `@tests/*` path alias.
60
+
61
+ ```bash
62
+ npm test # one-shot run
63
+ npm run test:watch # watch mode
64
+ npm run test:coverage # generates coverage/ (html + lcov + json-summary)
65
+ ```
66
+
67
+ VS Code wiring (auto-installed via `.vscode/extensions.json`):
68
+
69
+ - **Vitest** extension surfaces pass/fail gutters next to each `it(...)`
70
+ and a tree view in the Test panel.
71
+ - **Coverage Gutters** paints green/red strips on the side of source
72
+ files once `npm run test:coverage` has produced `coverage/lcov.info`.
73
+ Trigger with "Coverage Gutters: Display Coverage" from the command
74
+ palette.
75
+
76
+ Open `coverage/index.html` in a browser for the drill-down report.
77
+
78
+ ## Releasing
79
+
80
+ Cut a release whenever you ship a behavior change (bugfix, new prop,
81
+ breaking API change). Tags are the source of truth — consumers pin to
82
+ them, so the tag-on-`main` workflow is intentional discipline, not
83
+ overhead.
84
+
85
+ ### 1. Bump + commit + tag + push
86
+
87
+ From the repo root, after the change is committed on `main`:
88
+
89
+ ```bash
90
+ # 1. bump version in package.json (semver: patch / minor / major)
91
+ npm version patch --no-git-tag-version # 0.1.1 → 0.1.2 (bugfix)
92
+ # npm version minor --no-git-tag-version # 0.1.x → 0.2.0 (new prop / feature)
93
+ # npm version major --no-git-tag-version # 0.x.y → 1.0.0 (breaking)
94
+
95
+ # 2. commit the bump
96
+ git add package.json
97
+ git commit -m "vX.Y.Z: <one-line summary of what changed>"
98
+
99
+ # 3. tag the commit + push branch and tag together
100
+ git tag -a vX.Y.Z -m "vX.Y.Z — <short release note>"
101
+ git push origin main vX.Y.Z
102
+ ```
103
+
104
+ `--no-git-tag-version` on `npm version` is deliberate: it bumps
105
+ `package.json` without creating its own commit/tag, so you control the
106
+ commit message and tag annotation explicitly (npm's defaults are
107
+ ambiguous when the bump rides alongside the substantive change).
108
+
109
+ ### 2. Update consumers
110
+
111
+ Each consumer pins the dep to a specific tag in its `package.json`:
112
+
113
+ ```diff
114
+ - "@envision/aichat": "github:envision-tecnologia/aichat#v0.1.1",
115
+ + "@envision/aichat": "github:envision-tecnologia/aichat#v0.1.2",
116
+ ```
117
+
118
+ Then in the consumer's repo:
119
+
120
+ ```bash
121
+ npm install @envision/aichat
122
+ # dashboard-app currently needs --legacy-peer-deps because of an
123
+ # unrelated transitive peer conflict (MUI + pigment-css). Drop the flag
124
+ # once that's resolved.
125
+ ```
126
+
127
+ npm re-clones the package at the new tag, runs the package's `prepare`
128
+ script (which runs `vite build`), and updates the consumer's lockfile
129
+ with the new commit SHA — so subsequent installs on other machines pull
130
+ the exact same code, even if the tag is later moved (don't move tags).
131
+
132
+ ### Quick smoke-test before tagging
133
+
134
+ `v0.1.1` shipped with a part-eventType bug that the demo surfaced
135
+ within seconds. Before pushing a tag, give it a minute:
136
+
137
+ ```bash
138
+ npm run build && npm run typecheck # at repo root
139
+ cd examples/demo && npm install && npm run dev
140
+ ```
141
+
142
+ Open the Flat tab in the demo, send a prompt, watch the streamed reply
143
+ render and *stay* rendered. Switch tabs and back. If anything renders
144
+ and disappears, the fix isn't ready to tag.
145
+
146
+ ## Scope
147
+
148
+ v0.1 carves the chat-essential subset out of the old library:
149
+
150
+ - AiChat component + ChatPane + variants (Drawer, Floating)
151
+ - AgentGatewayWS + WebSocket connection + event bus
152
+ - Session lifecycle (SessionStateManagerService) — with `autoCreateSession`
153
+ defaulting to `false`, opposite of the old default
154
+ - LlmResponseRender + EnvironmentProvider + LiveTsxConfigProvider
155
+ - Models: Interaction, InteractionPart, ChatSession, ClientMessage, etc.
156
+ - Interfaces: ISessionService, IArtifactService, IStorageService — the
157
+ library ships interfaces, hosts plug in implementations
158
+
159
+ Out of scope: admin Settings UI, dashboard rendering primitives, viz library,
160
+ v2 app chrome, the Node/Mongo/Express server bundle. Those live in (or move
161
+ back to) `envision-abi/packages/dashboard-app`.
@@ -0,0 +1,40 @@
1
+ var m = Object.defineProperty;
2
+ var p = (e, t, a) => t in e ? m(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var h = (e, t) => m(e, "name", { value: t, configurable: !0 });
4
+ var s = (e, t, a) => p(e, typeof t != "symbol" ? t + "" : t, a);
5
+ const i = class i {
6
+ constructor(t, a, y, d, o) {
7
+ s(this, "mimeType");
8
+ s(this, "data");
9
+ s(this, "friendlyMessage");
10
+ s(this, "fake");
11
+ /**
12
+ * Optional image attachments that travel as a structured payload
13
+ * on the WS frame (see `IMessage.Images`). Kept separate from
14
+ * `data` so we don't have to encode them into the text body — the
15
+ * server adds them as `ImageContent` entries on the user turn.
16
+ */
17
+ s(this, "images");
18
+ /**
19
+ * Optional client-only UI representation for this user turn. Carried to the
20
+ * server as a `UserUiContent` sibling (persisted + replayed) but stripped from
21
+ * every model request — `data` stays the only model-facing text. `args` is a
22
+ * serialized JSON string. The gateway also injects a matching `UserAnswer` part
23
+ * on the live interaction so the component renders immediately.
24
+ */
25
+ s(this, "userUi");
26
+ this.data = t, this.mimeType = a, this.friendlyMessage = d, this.fake = y, this.images = o;
27
+ }
28
+ toPythonJson() {
29
+ return {
30
+ mime_type: this.mimeType,
31
+ data: this.data
32
+ };
33
+ }
34
+ };
35
+ h(i, "ClientMessage");
36
+ let r = i;
37
+ export {
38
+ r as C
39
+ };
40
+ //# sourceMappingURL=ClientMessage-EKgfuTp8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientMessage-EKgfuTp8.js","sources":["../src/models/ClientMessage.ts"],"sourcesContent":["/**\n * A single image attachment carried alongside a ClientMessage. `data`\n * is the raw base64 payload (no `data:<mime>;base64,` prefix) so the\n * server can `Convert.FromBase64String` directly into bytes.\n */\nexport interface ClientMessageImage {\n mimeType: string;\n data: string;\n}\n\nexport class ClientMessage {\n mimeType: string;\n data: string;\n friendlyMessage?: string;\n fake?: boolean;\n /**\n * Optional image attachments that travel as a structured payload\n * on the WS frame (see `IMessage.Images`). Kept separate from\n * `data` so we don't have to encode them into the text body — the\n * server adds them as `ImageContent` entries on the user turn.\n */\n images?: ClientMessageImage[];\n\n /**\n * Optional client-only UI representation for this user turn. Carried to the\n * server as a `UserUiContent` sibling (persisted + replayed) but stripped from\n * every model request — `data` stays the only model-facing text. `args` is a\n * serialized JSON string. The gateway also injects a matching `UserAnswer` part\n * on the live interaction so the component renders immediately.\n */\n userUi?: { name: string; args?: string };\n\n public toPythonJson() {\n return {\n \"mime_type\": this.mimeType,\n \"data\": this.data\n }\n }\n\n constructor(data: string, mimeType: string, fake?: boolean, friendlyMessage?: string, images?: ClientMessageImage[]) {\n this.data = data;\n this.mimeType = mimeType;\n this.friendlyMessage = friendlyMessage;\n this.fake = fake;\n this.images = images;\n }\n}"],"names":["_ClientMessage","data","mimeType","fake","friendlyMessage","images","__publicField","__name","ClientMessage"],"mappings":";;;;AAUO,MAAMA,IAAN,MAAMA,EAAc;AAAA,EA6BzB,YAAYC,GAAcC,GAAkBC,GAAgBC,GAA0BC,GAA+B;AA5BrH,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,EAAA;AASA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,EAAA;AAUE,SAAK,OAAOL,GACZ,KAAK,WAAWC,GAChB,KAAK,kBAAkBE,GACvB,KAAK,OAAOD,GACZ,KAAK,SAASE;AAAA,EAChB;AAAA,EAbO,eAAe;AACpB,WAAO;AAAA,MACL,WAAa,KAAK;AAAA,MAClB,MAAQ,KAAK;AAAA,IAAA;AAAA,EAEjB;AASF;AApC2BE,EAAAP,GAAA;AAApB,IAAMQ,IAANR;"}
@@ -0,0 +1,84 @@
1
+ var l = Object.defineProperty;
2
+ var b = (n, e, r) => e in n ? l(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
3
+ var t = (n, e) => l(n, "name", { value: e, configurable: !0 });
4
+ var o = (n, e, r) => b(n, typeof e != "symbol" ? e + "" : e, r);
5
+ function p(n) {
6
+ const e = /* @__PURE__ */ new WeakSet();
7
+ return JSON.stringify(n, /* @__PURE__ */ t((s, i) => {
8
+ if (typeof i == "object" && i !== null) {
9
+ if (e.has(i))
10
+ return console.warn(`Got circular reference here, key: ${s}, value ${i.toString()}`, s, i), null;
11
+ e.add(i);
12
+ }
13
+ return i;
14
+ }, "replacerFunction"));
15
+ }
16
+ t(p, "safeStringify");
17
+ const a = class a {
18
+ // Helper function to truncate text for Firebase size constraints
19
+ static truncateText(e, r) {
20
+ return !e || e.length <= r ? e : e.substring(0, r) + " [... truncated due to size constraints]";
21
+ }
22
+ static truncateSessionForStorage(e) {
23
+ const r = { ...e };
24
+ return r.interactions = a.truncateInteractionsForStorage(e.interactions), r;
25
+ }
26
+ static truncateInteractionsForStorage(e) {
27
+ const r = JSON.parse(JSON.stringify(e));
28
+ return r.map((s) => {
29
+ s.functionMap = void 0, s.parts && s.parts.map((i) => {
30
+ if (i || console.error(e, r), i.functionDetails && i.functionDetails.args) {
31
+ for (const [f, u] of Object.entries(i.functionDetails.args))
32
+ typeof u == "string" ? i.functionDetails.args[f] = this.truncateText(u, 500) : i.functionDetails.args[f] = null;
33
+ i.functionDetails.response = this.truncateText(p(i.functionDetails.response), 500);
34
+ }
35
+ });
36
+ }), r;
37
+ }
38
+ };
39
+ t(a, "ChatSessionUtils");
40
+ let g = a;
41
+ const c = class c {
42
+ constructor(e, r) {
43
+ o(this, "id");
44
+ o(this, "biName");
45
+ this.id = e, this.biName = r;
46
+ }
47
+ getBiName() {
48
+ return `BI_${this.biName}`;
49
+ }
50
+ };
51
+ t(c, "Account");
52
+ let S = c;
53
+ const d = {
54
+ ExplorerAgent: "ExplorerAgent",
55
+ DashboardAgent: "DashboardAgent",
56
+ Unknown: "Unknown"
57
+ }, h = [
58
+ "Completed",
59
+ "Failed",
60
+ "Cancelled"
61
+ ];
62
+ function N(n) {
63
+ return n ? h.includes(n) : !1;
64
+ }
65
+ t(N, "isSubAgentTerminalStatus");
66
+ var D = /* @__PURE__ */ ((n) => (n[n.Table = 0] = "Table", n[n.Metric = 1] = "Metric", n[n.Chart = 2] = "Chart", n[n.Dashboards = 3] = "Dashboards", n[n.Suggestions = 4] = "Suggestions", n[n.Memory = 5] = "Memory", n))(D || {});
67
+ const A = {
68
+ 0: "Table",
69
+ 1: "Metric",
70
+ 2: "Chart",
71
+ 3: "Dashboards",
72
+ 4: "Suggestions",
73
+ 5: "Memory"
74
+ };
75
+ export {
76
+ S as A,
77
+ g as C,
78
+ A as M,
79
+ h as S,
80
+ d as a,
81
+ D as b,
82
+ N as i
83
+ };
84
+ //# sourceMappingURL=Memory-DjLZqgbF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Memory-DjLZqgbF.js","sources":["../src/utils/jsonUtils.ts","../src/models/ChatSession.ts","../src/models/contexts.ts","../src/models/Agent.ts","../src/models/subAgentModel.ts","../src/models/Memory.ts"],"sourcesContent":["//const jsonString = JSON.stringify(obj: any, \n\nexport function safeStringify(obj: any) {\n const seen = new WeakSet();\n\n const replacerFunction = (key: string, value: any) => {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n console.warn(`Got circular reference here, key: ${key}, value ${value.toString()}`, key, value)\n return null; // Omit circular reference\n }\n seen.add(value);\n }\n return value;\n };\n\n return JSON.stringify(obj, replacerFunction);\n}","import type { Interaction } from \"./Interaction\";\nimport type { AgentType, RunMode, SkillLevel } from \"./enums\";\nimport type { Customer } from \"./Customer\";\nimport type { User } from \"../models/contexts\";\nimport { type InteractionPart } from \"./InteractionPart\";\nimport { safeStringify } from '../utils/jsonUtils';\nimport _ from \"lodash\";\nimport { type IDBStorable } from \"./IDBStorable\";\n\nexport interface SharedUser {\n email: string;\n permission: 'view' | 'interact';\n}\n\nexport interface ChatSession extends IDBStorable {\n toolSessionId?: string,\n fullyLoaded: boolean; //Starts as false either when it is new, or when it is retrieved without the binding flag\n loadError?: string;\n artifacts: string[],\n browserScopeId: string; //To help with rendering. As for new session we don't have an ID, this is locally a Unique ID for an object.\n interactions: Interaction[];\n userDescription?: string;\n overview: string;\n lastQuestion?: string | null;\n agentType: AgentType;\n customer?: Customer | null;\n activityCount: number;\n interactionsCount?: number;\n allPartsCount?: number;\n user: User;\n lastGeneratedOverview?: Date | null;\n skillLevel?: SkillLevel;\n sessionRunMode: RunMode\n}\n\n// Note: ChatSession interface now extends IDBStorable\n// No need for a separate model class - just use the interface directly\n\nexport class ChatSessionUtils {\n\n // Helper function to truncate text for Firebase size constraints\n static truncateText(text: string, maxLength: number): string {\n if (!text)\n return text;\n\n if (text.length <= maxLength) {\n return text;\n }\n return text.substring(0, maxLength) + ' [... truncated due to size constraints]';\n }\n\n static truncateSessionForStorage(chatSession: ChatSession) {\n const newSession = { ...chatSession }\n newSession.interactions = ChatSessionUtils.truncateInteractionsForStorage(chatSession.interactions);\n\n return newSession;\n }\n\n static truncateInteractionsForStorage(originalInteractions: Interaction[]): Interaction[] {\n const interactions: Interaction[] = JSON.parse(JSON.stringify(originalInteractions));\n // Truncate interaction parts\n interactions.map((interaction: Interaction) => {\n interaction.functionMap = undefined;\n if (interaction.parts) {\n interaction.parts.map((truncatedPart: InteractionPart) => {\n // Truncate FunctionDetails properties\n if (!truncatedPart)\n console.error(originalInteractions, interactions);\n\n if (truncatedPart.functionDetails) {\n // Truncate args values to max 500 characters\n if (truncatedPart.functionDetails.args) {\n for (const [key, value] of Object.entries(truncatedPart.functionDetails.args)) {\n if (typeof value === 'string') {\n truncatedPart.functionDetails.args[key] = this.truncateText(value, 500);\n }\n else {\n truncatedPart.functionDetails.args[key] = null;\n }\n }\n\n truncatedPart.functionDetails.response = this.truncateText(safeStringify(truncatedPart.functionDetails.response), 500)\n }\n }\n });\n }\n });\n\n return interactions;\n\n }\n\n}","import type { Customer } from \"./Customer\";\nimport type { Agent } from \"./Agent\";\nimport { type IDBStorable } from \"./IDBStorable\";\n\nexport class Account {\n id: string;\n biName: string;\n\n constructor(id: string, biName: string) {\n this.id = id;\n this.biName = biName;\n }\n\n getBiName() {\n return `BI_${this.biName}`;\n }\n}\n\nexport interface User extends IDBStorable {\n email: string;\n family_name: string;\n given_name: string;\n name: string;\n hd: string;\n picture: string;\n access_token: string;\n previous_access_token?: string;\n refresh_token?: string;\n account?: Account;\n}\n\nexport interface AuthState {\n isAuthenticated: boolean;\n isLoading: boolean;\n login: (userData: User) => void;\n logout: () => void;\n errorMessage: string | null;\n}\n\nexport interface AgentContext {\n agentConfig: Partial<Agent>;\n customer?: Customer;\n model?: string;\n}\n","export type AgentKind = 'ExplorerAgent' | 'DashboardAgent' | 'Unknown';\nexport const AgentKind = {\n ExplorerAgent: 'ExplorerAgent' as AgentKind,\n DashboardAgent: 'DashboardAgent' as AgentKind,\n Unknown: 'Unknown' as AgentKind,\n} as const;\n\n/**\n * Agent model - represents an AI agent configuration\n * Mirrors the .NET Agent entity in Envision.SemanticKernel.Models.Agent\n */\nexport interface Agent {\n id: string;\n name: string;\n type?: AgentKind;\n defaultModelId?: string;\n defaultQuickModelId?: string;\n description?: string;\n muiIconName?: string;\n embeddingConfigurationId: string;\n agentImplementation?: string;\n agentBootStrapImplementation?: string;\n parameters?: Record<string, string>;\n plugins: string[];\n /** List of additional main instruction IDs (Category: Main or Generic) for this agent */\n mainInstructionIds?: string[];\n lastUpdated?: Date;\n created?: Date;\n}\n\n/**\n * Partial agent for listing purposes (only essential fields)\n */\nexport type AgentSummary = Pick<Agent, 'id' | 'name' | 'description' | 'muiIconName' | 'type'>;\n","import type { TodoList } from './todoListModel';\n\n/**\n * Mirrors `Envision.SemanticKernel.Core.SubAgent.SubAgentStatus` enum on the\n * server. Values come back as plain strings (the controller uses `Status.ToString()`).\n */\nexport type SubAgentStatus =\n | 'Pending'\n | 'Running'\n | 'Completed'\n | 'Failed'\n | 'Cancelled'\n | 'Unknown';\n\n/**\n * Lightweight representation of a chat message embedded in the SubAgentDto.\n * The server-side `Message` type carries more fields, but only the basics are\n * needed for status polling on the client.\n */\nexport interface SubAgentMessage {\n id?: string;\n role?: string;\n content?: string;\n [key: string]: unknown;\n}\n\n/**\n * TypeScript counterpart of `Envision.SemanticKernel.Core.SubAgent.SubAgentDto`.\n *\n * This is the payload returned by `GET /SubAgent/{sessionId}/{id}`.\n *\n * `TodoList.percentComplete` is serialized by the server as a fraction in the\n * range `[0, 1]` (i.e. `completedItems / totalItems`). It can be `NaN` when the\n * todo list is empty, so consumers should guard against non-finite values.\n */\nexport interface SubAgentDto {\n id?: string;\n subAgentId: string;\n name: string;\n sessionId?: string;\n dashboardId?: string | null;\n todoList?: TodoList | null;\n generalInstructions?: string | null;\n dashboardInstructions?: string | null;\n detailedStatus?: string | null;\n status: SubAgentStatus | string;\n error?: string | null;\n hasResult?: boolean | null;\n finalSummary?: string | null;\n parameters?: Record<string, string> | null;\n updatedAt?: string | Date | null;\n created?: string | Date | null;\n message?: SubAgentMessage | null;\n}\n\n/** Status values that indicate the sub-agent is no longer making progress. */\nexport const SUB_AGENT_TERMINAL_STATUSES: ReadonlyArray<SubAgentStatus> = [\n 'Completed',\n 'Failed',\n 'Cancelled',\n];\n\nexport function isSubAgentTerminalStatus(status: string | undefined | null): boolean {\n if (!status) return false;\n return (SUB_AGENT_TERMINAL_STATUSES as readonly string[]).includes(status);\n}\n","/**\n * Memory model - represents a semantic memory stored in MongoDB and Qdrant\n * Mirrors the .NET Memory entity in Envision.SemanticKernel.Core/Memory/Memory.cs\n */\n\n/**\n * Context types for memories - determines how they're filtered in semantic search\n */\nexport enum MemoryContexts {\n Table = 0, // Table schema information\n Metric = 1, // Business metrics and KPIs\n Chart = 2, // Chart/visualization descriptions\n Dashboards = 3, // Dashboard information\n Suggestions = 4, // Business recommendations\n Memory = 5 // General memories (no filter applied in search)\n}\n\n/**\n * Human-readable labels for each context type\n */\nexport const MemoryContextLabels: Record<MemoryContexts, string> = {\n [MemoryContexts.Table]: 'Table',\n [MemoryContexts.Metric]: 'Metric',\n [MemoryContexts.Chart]: 'Chart',\n [MemoryContexts.Dashboards]: 'Dashboards',\n [MemoryContexts.Suggestions]: 'Suggestions',\n [MemoryContexts.Memory]: 'Memory',\n};\n\n/**\n * Full Memory entity as stored in the database\n */\nexport interface SemanticMemory {\n id: string;\n memoryText: string;\n relatedTags?: string;\n created?: string;\n updatedAt?: string;\n // Runtime properties (populated by search results only)\n runtimeScore?: number;\n runtimeRank?: number;\n}\n\n/**\n * Input model for creating/updating memories\n * Does not include id, created, or runtime properties\n */\nexport interface SemanticMemoryInput {\n memoryText: string;\n relatedTags?: string;\n}\n\n/**\n * Options for semantic search\n */\nexport interface SemanticMemorySearchOptions {\n relatedTable?: string;\n relatedContext?: MemoryContexts;\n relatedTags?: string;\n limit?: number;\n}\n"],"names":["safeStringify","obj","seen","__name","key","value","_ChatSessionUtils","text","maxLength","chatSession","newSession","originalInteractions","interactions","interaction","truncatedPart","ChatSessionUtils","_Account","id","biName","__publicField","Account","AgentKind","SUB_AGENT_TERMINAL_STATUSES","isSubAgentTerminalStatus","status","MemoryContexts","MemoryContextLabels"],"mappings":"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"}
@@ -0,0 +1,37 @@
1
+ var u = Object.defineProperty;
2
+ var c = (f, t) => u(f, "name", { value: t, configurable: !0 });
3
+ const D = {
4
+ Disconnected: "Disconnected",
5
+ Connected: "Connected",
6
+ Paused: "Paused",
7
+ Idle: "Idle",
8
+ Connecting: "Connecting",
9
+ Unknown: "Unknown"
10
+ }, a = class a {
11
+ static createPrompt(t, e) {
12
+ return {
13
+ id: crypto.randomUUID(),
14
+ promptJson: e,
15
+ promptText: t.trim(),
16
+ created: /* @__PURE__ */ new Date()
17
+ };
18
+ }
19
+ static formatTimeAgo(t) {
20
+ const e = /* @__PURE__ */ new Date(), r = new Date(t), n = e.getTime() - r.getTime(), o = Math.floor(n / (1e3 * 60)), i = Math.floor(n / (1e3 * 60 * 60)), s = Math.floor(n / (1e3 * 60 * 60 * 24));
21
+ return o < 1 ? "agora" : o < 60 ? `${o}m atrás` : i < 24 ? `${i}h atrás` : s < 7 ? `${s}d atrás` : r.toLocaleDateString("pt-BR", {
22
+ day: "2-digit",
23
+ month: "2-digit"
24
+ });
25
+ }
26
+ static truncateText(t, e = 60, r = 2) {
27
+ const n = r > 1 ? `Last ${r} prompts: ` : "Last prompt: ";
28
+ return t.length <= e ? n + t : n + t.substring(0, e).trim() + "...";
29
+ }
30
+ };
31
+ c(a, "PromptUtils");
32
+ let d = a;
33
+ export {
34
+ D as C,
35
+ d as P
36
+ };
37
+ //# sourceMappingURL=Prompt-DZb7OaPp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Prompt-DZb7OaPp.js","sources":["../src/models/connectionState.ts","../src/models/Prompt.ts"],"sourcesContent":["export type ConnectionState = 'Disconnected' | 'Connected' | 'Idle' | 'Paused' | 'Connecting' | 'Unknown';\nexport const ConnectionState = {\n Disconnected: 'Disconnected',\n Connected: 'Connected',\n Paused: 'Paused',\n Idle: 'Idle',\n Connecting: 'Connecting',\n Unknown: 'Unknown'\n} as const;","import { type IDBStorable } from \"./IDBStorable\";\n\nexport interface Prompt extends IDBStorable {\n id: string;\n promptText: string;\n promptJson?: string;\n created: Date; // ISO date string\n updatedAt?: Date;\n lastUpdated?: Date,\n instructions?: ScoredInstruction[]\n}\n\nexport interface ScoredInstruction {\n instruction: string,\n score: number,\n group: number\n}\n\nexport class PromptUtils {\n static createPrompt(promptText: string, promptJson?: string): Prompt {\n return {\n id: crypto.randomUUID(),\n promptJson: promptJson,\n promptText: promptText.trim(),\n created: new Date()\n };\n }\n\n static formatTimeAgo(created: string): string {\n const now = new Date();\n const createdDate = new Date(created);\n const diffMs = now.getTime() - createdDate.getTime();\n\n const diffMinutes = Math.floor(diffMs / (1000 * 60));\n const diffHours = Math.floor(diffMs / (1000 * 60 * 60));\n const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));\n\n if (diffMinutes < 1) return 'agora';\n if (diffMinutes < 60) return `${diffMinutes}m atrás`;\n if (diffHours < 24) return `${diffHours}h atrás`;\n if (diffDays < 7) return `${diffDays}d atrás`;\n\n return createdDate.toLocaleDateString('pt-BR', {\n day: '2-digit',\n month: '2-digit'\n });\n }\n\n static truncateText(text: string, maxLength: number = 60, promptNumber: number = 2): string {\n const prefix = promptNumber > 1 ? `Last ${promptNumber} prompts: ` : 'Last prompt: ';\n if (text.length <= maxLength) return prefix + text;\n return prefix + text.substring(0, maxLength).trim() + '...';\n }\n}"],"names":["ConnectionState","_PromptUtils","promptText","promptJson","created","now","createdDate","diffMs","diffMinutes","diffHours","diffDays","text","maxLength","promptNumber","prefix","__name","PromptUtils"],"mappings":";;AACO,MAAMA,IAAkB;AAAA,EAC3B,cAAc;AAAA,EACd,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,SAAS;AACb,GCUaC,IAAN,MAAMA,EAAY;AAAA,EACvB,OAAO,aAAaC,GAAoBC,GAA6B;AACnE,WAAO;AAAA,MACL,IAAI,OAAO,WAAA;AAAA,MACX,YAAAA;AAAA,MACA,YAAYD,EAAW,KAAA;AAAA,MACvB,6BAAa,KAAA;AAAA,IAAK;AAAA,EAEtB;AAAA,EAEA,OAAO,cAAcE,GAAyB;AAC5C,UAAMC,wBAAU,KAAA,GACVC,IAAc,IAAI,KAAKF,CAAO,GAC9BG,IAASF,EAAI,QAAA,IAAYC,EAAY,QAAA,GAErCE,IAAc,KAAK,MAAMD,KAAU,MAAO,GAAG,GAC7CE,IAAY,KAAK,MAAMF,KAAU,MAAO,KAAK,GAAG,GAChDG,IAAW,KAAK,MAAMH,KAAU,MAAO,KAAK,KAAK,GAAG;AAE1D,WAAIC,IAAc,IAAU,UACxBA,IAAc,KAAW,GAAGA,CAAW,YACvCC,IAAY,KAAW,GAAGA,CAAS,YACnCC,IAAW,IAAU,GAAGA,CAAQ,YAE7BJ,EAAY,mBAAmB,SAAS;AAAA,MAC7C,KAAK;AAAA,MACL,OAAO;AAAA,IAAA,CACR;AAAA,EACH;AAAA,EAEA,OAAO,aAAaK,GAAcC,IAAoB,IAAIC,IAAuB,GAAW;AAC1F,UAAMC,IAASD,IAAe,IAAI,QAAQA,CAAY,eAAe;AACrE,WAAIF,EAAK,UAAUC,IAAkBE,IAASH,IACvCG,IAASH,EAAK,UAAU,GAAGC,CAAS,EAAE,SAAS;AAAA,EACxD;AACF;AAnCyBG,EAAAd,GAAA;AAAlB,IAAMe,IAANf;"}
@@ -0,0 +1,41 @@
1
+ var n = Object.defineProperty;
2
+ var o = (i, e, a) => e in i ? n(i, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[e] = a;
3
+ var l = (i, e) => n(i, "name", { value: e, configurable: !0 });
4
+ var r = (i, e, a) => o(i, typeof e != "symbol" ? e + "" : e, a);
5
+ const s = class s {
6
+ static handleArtifactHtml(e, a, h, d) {
7
+ if (!e) return "";
8
+ e = this.replaceVarText(e, d), e = e.replace(/<\/?html[^>]*>/gi, "").replace(/<\/?head[^>]*>/gi, "").replace(/<\/?body[^>]*>/gi, "").replace(/<link[^>]*>/gi, "").replace(/<meta[^>]*>/gi, "");
9
+ const t = "";
10
+ let c = `
11
+ <script>
12
+
13
+ // // Create instance
14
+ // const sortableTable = new SortableTable();
15
+
16
+
17
+ // // Initialize all tables in document
18
+ // sortableTable.init();
19
+ <\/script>
20
+ `;
21
+ return e.includes("<head>") ? e.replace("<head>", `<head>
22
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
23
+ ${this.defaultIframeScript}
24
+ ${t}
25
+ `).replace("</body>", `${c}</body>`) : `
26
+ ${this.defaultIframeScript}
27
+ ${t}
28
+ ${e}
29
+ ${c}
30
+ `;
31
+ }
32
+ };
33
+ l(s, "ArtifactHtmlHandler"), r(s, "defaultIframeScript", ""), // TODO(phase-4): theme-token substitution lived in utils/themeColorReplacer
34
+ // (deleted with the dashboard carve). Re-introduce as an injectable hook
35
+ // if/when hosts need it. For now the artifact HTML passes through unchanged.
36
+ r(s, "replaceVarText", /* @__PURE__ */ l((e, a) => e, "replaceVarText"));
37
+ let p = s;
38
+ export {
39
+ p as A
40
+ };
41
+ //# sourceMappingURL=artifactHtmlHandler-CMQJf1cX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifactHtmlHandler-CMQJf1cX.js","sources":["../src/services/artifactHtmlHandler.ts"],"sourcesContent":["import type { Theme } from \"@mui/material/styles\";\n\nexport class ArtifactHtmlHandler {\n\n static defaultIframeScript = '';\n\n // TODO(phase-4): theme-token substitution lived in utils/themeColorReplacer\n // (deleted with the dashboard carve). Re-introduce as an injectable hook\n // if/when hosts need it. For now the artifact HTML passes through unchanged.\n static replaceVarText = (artifactHtml: string, _theme: Theme): string => {\n return artifactHtml;\n }\n\n static handleArtifactHtml(artifactHtml: string, _mode: 'full' | 'compact', _isMobile: boolean, theme: Theme): string {\n // Inject CSS and JS into the artifact HTML\n if (!artifactHtml) return \"\";\n\n artifactHtml = this.replaceVarText(artifactHtml, theme);\n\n // Clean HTML: remove HTML/HEAD/BODY tags, link tags, and meta tags\n artifactHtml = artifactHtml\n // Remove <html> and </html> tags (case insensitive)\n .replace(/<\\/?html[^>]*>/gi, '')\n // Remove <head> and </head> tags (case insensitive)\n .replace(/<\\/?head[^>]*>/gi, '')\n // Remove <body> and </body> tags (case insensitive)\n .replace(/<\\/?body[^>]*>/gi, '')\n // Remove <link ... /> tags (case insensitive)\n .replace(/<link[^>]*>/gi, '')\n // Remove <meta ... /> tags (case insensitive)\n .replace(/<meta[^>]*>/gi, '');\n\n // Mobile-specific styles and configuration\n const defaultStyles = ``\n\n let injectedScript = `\n <script>\n\n // // Create instance\n // const sortableTable = new SortableTable();\n\n\n // // Initialize all tables in document\n // sortableTable.init();\n </script>\n `;\n\n // Check if the HTML already has a head section\n if (artifactHtml.includes('<head>')) {\n // Insert CSS and JS into existing head\n return artifactHtml\n .replace('<head>', `<head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n ${this.defaultIframeScript}\n ${defaultStyles}\n `)\n .replace('</body>', `${injectedScript}</body>`);\n } else {\n // Create a complete HTML structure with head\n return `\n ${this.defaultIframeScript}\n ${defaultStyles}\n ${artifactHtml}\n ${injectedScript} \n `;\n }\n }\n}\n"],"names":["_ArtifactHtmlHandler","artifactHtml","_mode","_isMobile","theme","defaultStyles","injectedScript","__name","__publicField","_theme","ArtifactHtmlHandler"],"mappings":";;;;AAEO,MAAMA,IAAN,MAAMA,EAAoB;AAAA,EAW7B,OAAO,mBAAmBC,GAAsBC,GAA2BC,GAAoBC,GAAsB;AAEjH,QAAI,CAACH,EAAc,QAAO;AAE1B,IAAAA,IAAe,KAAK,eAAeA,GAAcG,CAAK,GAGtDH,IAAeA,EAEV,QAAQ,oBAAoB,EAAE,EAE9B,QAAQ,oBAAoB,EAAE,EAE9B,QAAQ,oBAAoB,EAAE,EAE9B,QAAQ,iBAAiB,EAAE,EAE3B,QAAQ,iBAAiB,EAAE;AAGhC,UAAMI,IAAgB;AAEtB,QAAIC,IAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAarB,WAAIL,EAAa,SAAS,QAAQ,IAEvBA,EACF,QAAQ,UAAU;AAAA;AAAA,sBAEb,KAAK,mBAAmB;AAAA,sBACxBI,CAAa;AAAA,iBAClB,EACA,QAAQ,WAAW,GAAGC,CAAc,SAAS,IAG3C;AAAA,kBACD,KAAK,mBAAmB;AAAA,kBACxBD,CAAa;AAAA,kBACbJ,CAAY;AAAA,kBACZK,CAAc;AAAA;AAAA,EAG5B;AACJ;AAjEiCC,EAAAP,GAAA,wBAE7BQ,EAFSR,GAEF,uBAAsB;AAAA;AAAA;AAK7BQ,EAPSR,GAOF,kBAAiB,gBAAAO,EAAA,CAACN,GAAsBQ,MACpCR,GADa;AAPrB,IAAMS,IAANV;"}