hermium 0.3.6 → 0.3.7

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 (34) hide show
  1. package/dist/api.mjs +37 -17
  2. package/dist/public/assets/js/{ChatInputBlock-BYpIR_ls.js → ChatInputBlock-BsakEj7f.js} +1 -1
  3. package/dist/{server/public/assets/js/MarkdownMessage-DL1aUod4.js → public/assets/js/MarkdownMessage-CFmUlx03.js} +1 -1
  4. package/dist/public/assets/js/{chat._sessionId-YaowVhVf.js → chat._sessionId-Du4LuT3Z.js} +1 -1
  5. package/dist/{server/public/assets/js/chat.index-B64jjuMw.js → public/assets/js/chat.index-DfETrKqO.js} +1 -1
  6. package/dist/public/assets/js/{index-DnOJbmz0.js → index-c1JE7Mqf.js} +1 -1
  7. package/dist/public/assets/js/{index-DsMUdp1X.js → index-om9XIKI1.js} +22 -22
  8. package/dist/public/assets/js/{memory-B_Uy_WUi.js → memory-TUhvnVO-.js} +1 -1
  9. package/dist/public/assets/js/{settings-ZdgGJLcS.js → settings-C6SLxMLw.js} +1 -1
  10. package/dist/public/assets/js/{skills-Bg3vZgl2.js → skills-CiWhpzh2.js} +1 -1
  11. package/dist/public/assets/js/{usage-DXPIAwzR.js → usage-BrhP5T90.js} +1 -1
  12. package/dist/server/_ssr/{ChatInputBlock-BONgzml9.mjs → ChatInputBlock-D3Bw-ILw.mjs} +1 -1
  13. package/dist/server/_ssr/{MarkdownMessage-y8GThg94.mjs → MarkdownMessage-hXIkdfYz.mjs} +1 -1
  14. package/dist/server/_ssr/{chat._sessionId-BSlHY8-3.mjs → chat._sessionId-CyrHExqJ.mjs} +4 -4
  15. package/dist/server/_ssr/{chat.index-DaPRZ2yS.mjs → chat.index-ngXZoPUQ.mjs} +1 -1
  16. package/dist/server/_ssr/{index-D-zP2Zbh.mjs → index-BC1mevNA.mjs} +2 -2
  17. package/dist/server/_ssr/{index-B6Q_iKG1.mjs → index-CLZ8vwCm.mjs} +2 -2
  18. package/dist/server/_ssr/{memory-CeEgICRt.mjs → memory-D9rLeKcu.mjs} +3 -3
  19. package/dist/server/_ssr/{router-BwJ9sLwD.mjs → router-CuDg0t0a.mjs} +33 -31
  20. package/dist/server/_ssr/{skills-BgBDh_7P.mjs → skills-DzKE4Akb.mjs} +3 -3
  21. package/dist/server/_ssr/{usage-BRFRmZxm.mjs → usage-CHB9EQE9.mjs} +1 -1
  22. package/dist/server/{_tanstack-start-manifest_v-C1EEhhb2.mjs → _tanstack-start-manifest_v-Cw2_0nXX.mjs} +1 -1
  23. package/dist/server/index.mjs +93 -93
  24. package/dist/server/public/assets/js/{ChatInputBlock-BYpIR_ls.js → ChatInputBlock-BsakEj7f.js} +1 -1
  25. package/dist/{public/assets/js/MarkdownMessage-DL1aUod4.js → server/public/assets/js/MarkdownMessage-CFmUlx03.js} +1 -1
  26. package/dist/server/public/assets/js/{chat._sessionId-YaowVhVf.js → chat._sessionId-Du4LuT3Z.js} +1 -1
  27. package/dist/{public/assets/js/chat.index-B64jjuMw.js → server/public/assets/js/chat.index-DfETrKqO.js} +1 -1
  28. package/dist/server/public/assets/js/{index-DnOJbmz0.js → index-c1JE7Mqf.js} +1 -1
  29. package/dist/server/public/assets/js/{index-DsMUdp1X.js → index-om9XIKI1.js} +22 -22
  30. package/dist/server/public/assets/js/{memory-B_Uy_WUi.js → memory-TUhvnVO-.js} +1 -1
  31. package/dist/server/public/assets/js/{settings-ZdgGJLcS.js → settings-C6SLxMLw.js} +1 -1
  32. package/dist/server/public/assets/js/{skills-Bg3vZgl2.js → skills-CiWhpzh2.js} +1 -1
  33. package/dist/server/public/assets/js/{usage-DXPIAwzR.js → usage-BrhP5T90.js} +1 -1
  34. package/package.json +2 -2
@@ -26,7 +26,7 @@ function lazyService(loader) {
26
26
  };
27
27
  }
28
28
  const services = {
29
- ["ssr"]: lazyService(() => import("./_ssr/index-D-zP2Zbh.mjs"))
29
+ ["ssr"]: lazyService(() => import("./_ssr/index-BC1mevNA.mjs"))
30
30
  };
31
31
  globalThis.__nitro_vite_envs__ = services;
32
32
  const errorHandler$1 = (error, event) => {
@@ -120,154 +120,154 @@ const assets = {
120
120
  "/favicon.ico": {
121
121
  "type": "image/vnd.microsoft.icon",
122
122
  "etag": '"f1e-ESBTjHetHyiokkO0tT/irBbMO8Y"',
123
- "mtime": "2026-05-17T08:23:51.216Z",
123
+ "mtime": "2026-05-17T14:30:08.446Z",
124
124
  "size": 3870,
125
125
  "path": "../public/favicon.ico"
126
126
  },
127
+ "/manifest.json": {
128
+ "type": "application/json",
129
+ "etag": '"1f2-Oqn/x1R1hBTtEjA8nFhpBeFJJNg"',
130
+ "mtime": "2026-05-17T14:30:08.446Z",
131
+ "size": 498,
132
+ "path": "../public/manifest.json"
133
+ },
127
134
  "/robots.txt": {
128
135
  "type": "text/plain; charset=utf-8",
129
136
  "etag": '"43-BEzmj4PuhUNHX+oW9uOnPSihxtU"',
130
- "mtime": "2026-05-17T08:23:51.216Z",
137
+ "mtime": "2026-05-17T14:30:08.446Z",
131
138
  "size": 67,
132
139
  "path": "../public/robots.txt"
133
140
  },
134
141
  "/assets/css/index-Dfs9RUU9.css": {
135
142
  "type": "text/css; charset=utf-8",
136
143
  "etag": '"429-auB1gSdvHWOpUkgakyObE/IliVA"',
137
- "mtime": "2026-05-17T08:23:50.052Z",
144
+ "mtime": "2026-05-17T14:30:07.459Z",
138
145
  "size": 1065,
139
146
  "path": "../public/assets/css/index-Dfs9RUU9.css"
140
147
  },
141
- "/assets/js/ChatInputBlock-BYpIR_ls.js": {
142
- "type": "text/javascript; charset=utf-8",
143
- "etag": '"135c-/d4FNNN4KpdRrE8qeiTBxqDL5vM"',
144
- "mtime": "2026-05-17T08:23:50.052Z",
145
- "size": 4956,
146
- "path": "../public/assets/js/ChatInputBlock-BYpIR_ls.js"
147
- },
148
- "/assets/js/MarkdownMessage-DL1aUod4.js": {
149
- "type": "text/javascript; charset=utf-8",
150
- "etag": '"a1e-X8yyfM56sqVXjNBolVSGYtFzHTQ"',
151
- "mtime": "2026-05-17T08:23:50.052Z",
152
- "size": 2590,
153
- "path": "../public/assets/js/MarkdownMessage-DL1aUod4.js"
154
- },
155
- "/manifest.json": {
156
- "type": "application/json",
157
- "etag": '"1f2-Oqn/x1R1hBTtEjA8nFhpBeFJJNg"',
158
- "mtime": "2026-05-17T08:23:51.216Z",
159
- "size": 498,
160
- "path": "../public/manifest.json"
161
- },
162
148
  "/assets/css/styles-YqYDZ89Q.css": {
163
149
  "type": "text/css; charset=utf-8",
164
150
  "etag": '"1a553-PeitUnrwQBPxGUsGIFG1nQmHggw"',
165
- "mtime": "2026-05-17T08:23:50.051Z",
151
+ "mtime": "2026-05-17T14:30:07.458Z",
166
152
  "size": 107859,
167
153
  "path": "../public/assets/css/styles-YqYDZ89Q.css"
168
154
  },
169
- "/assets/js/chat._sessionId-YaowVhVf.js": {
170
- "type": "text/javascript; charset=utf-8",
171
- "etag": '"272b-T27l9FmASYCN7GiXu26qMuiYRwc"',
172
- "mtime": "2026-05-17T08:23:50.052Z",
173
- "size": 10027,
174
- "path": "../public/assets/js/chat._sessionId-YaowVhVf.js"
175
- },
176
- "/assets/js/chat.index-B64jjuMw.js": {
177
- "type": "text/javascript; charset=utf-8",
178
- "etag": '"279-wlHD7WKxZKCj0iZGBxmHZ/X41YM"',
179
- "mtime": "2026-05-17T08:23:50.052Z",
180
- "size": 633,
181
- "path": "../public/assets/js/chat.index-B64jjuMw.js"
182
- },
183
- "/assets/js/index-DnOJbmz0.js": {
184
- "type": "text/javascript; charset=utf-8",
185
- "etag": '"25b-GLjiq0e6Eac1ry9f1HgKab2J0ww"',
186
- "mtime": "2026-05-17T08:23:50.052Z",
187
- "size": 603,
188
- "path": "../public/assets/js/index-DnOJbmz0.js"
189
- },
190
- "/assets/js/memory-B_Uy_WUi.js": {
191
- "type": "text/javascript; charset=utf-8",
192
- "etag": '"1260-aojfBDWxFncFnGl6o9qk6Eeckb0"',
193
- "mtime": "2026-05-17T08:23:50.052Z",
194
- "size": 4704,
195
- "path": "../public/assets/js/memory-B_Uy_WUi.js"
196
- },
197
- "/assets/js/settings-ZdgGJLcS.js": {
198
- "type": "text/javascript; charset=utf-8",
199
- "etag": '"130-/qsPY4du8jPH+7tT1Wh+qKrV+QA"',
200
- "mtime": "2026-05-17T08:23:50.052Z",
201
- "size": 304,
202
- "path": "../public/assets/js/settings-ZdgGJLcS.js"
203
- },
204
- "/assets/js/skills-Bg3vZgl2.js": {
205
- "type": "text/javascript; charset=utf-8",
206
- "etag": '"29cb-VMMqJmvt5FQIMfnDzjRnWkPjnos"',
207
- "mtime": "2026-05-17T08:23:50.052Z",
208
- "size": 10699,
209
- "path": "../public/assets/js/skills-Bg3vZgl2.js"
210
- },
211
- "/assets/js/theme-CPkdkpaj.js": {
212
- "type": "text/javascript; charset=utf-8",
213
- "etag": '"245-JWXBP1zFNJpiVT0wBqxD0nTaUio"',
214
- "mtime": "2026-05-17T08:23:50.052Z",
215
- "size": 581,
216
- "path": "../public/assets/js/theme-CPkdkpaj.js"
217
- },
218
- "/assets/js/usage-DXPIAwzR.js": {
219
- "type": "text/javascript; charset=utf-8",
220
- "etag": '"2503-pwaGtTRliNQtzQyRfC/cUvpwQTM"',
221
- "mtime": "2026-05-17T08:23:50.052Z",
222
- "size": 9475,
223
- "path": "../public/assets/js/usage-DXPIAwzR.js"
224
- },
225
155
  "/assets/woff2/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2": {
226
156
  "type": "font/woff2",
227
157
  "etag": '"1cfc-yYSDXNlt/tTRaj6rJo8ZMqvY7pQ"',
228
- "mtime": "2026-05-17T08:23:50.052Z",
158
+ "mtime": "2026-05-17T14:30:07.458Z",
229
159
  "size": 7420,
230
160
  "path": "../public/assets/woff2/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2"
231
161
  },
232
162
  "/assets/woff2/geist-cyrillic-wght-normal-BEAKL7Jp.woff2": {
233
163
  "type": "font/woff2",
234
164
  "etag": '"3aec-5kpQSZEtAzzU5kdiuro3Zr2YR54"',
235
- "mtime": "2026-05-17T08:23:50.051Z",
165
+ "mtime": "2026-05-17T14:30:07.458Z",
236
166
  "size": 15084,
237
167
  "path": "../public/assets/woff2/geist-cyrillic-wght-normal-BEAKL7Jp.woff2"
238
168
  },
239
169
  "/assets/woff2/geist-latin-ext-wght-normal-DC-KSUi6.woff2": {
240
170
  "type": "font/woff2",
241
171
  "etag": '"4080-mZu3Z7sOWqglha+kefNbUA9Pp+Q"',
242
- "mtime": "2026-05-17T08:23:50.052Z",
172
+ "mtime": "2026-05-17T14:30:07.458Z",
243
173
  "size": 16512,
244
174
  "path": "../public/assets/woff2/geist-latin-ext-wght-normal-DC-KSUi6.woff2"
245
175
  },
246
176
  "/assets/woff2/geist-latin-wght-normal-BgDaEnEv.woff2": {
247
177
  "type": "font/woff2",
248
178
  "etag": '"72d8-9J+D7/6th5UzRxIgoFX9awJv47A"',
249
- "mtime": "2026-05-17T08:23:50.052Z",
179
+ "mtime": "2026-05-17T14:30:07.458Z",
250
180
  "size": 29400,
251
181
  "path": "../public/assets/woff2/geist-latin-wght-normal-BgDaEnEv.woff2"
252
182
  },
253
183
  "/assets/woff2/geist-vietnamese-wght-normal-6IgcOCM7.woff2": {
254
184
  "type": "font/woff2",
255
185
  "etag": '"1f44-6MZ7/PEEOeDVF0eHI650KpwKQV8"',
256
- "mtime": "2026-05-17T08:23:50.052Z",
186
+ "mtime": "2026-05-17T14:30:07.458Z",
257
187
  "size": 8004,
258
188
  "path": "../public/assets/woff2/geist-vietnamese-wght-normal-6IgcOCM7.woff2"
259
189
  },
260
- "/assets/js/index-DsMUdp1X.js": {
190
+ "/assets/js/ChatInputBlock-BsakEj7f.js": {
191
+ "type": "text/javascript; charset=utf-8",
192
+ "etag": '"135c-AgNpHVOFPXmAJDSF3D8OrjBtF+A"',
193
+ "mtime": "2026-05-17T14:30:07.459Z",
194
+ "size": 4956,
195
+ "path": "../public/assets/js/ChatInputBlock-BsakEj7f.js"
196
+ },
197
+ "/assets/js/MarkdownMessage-CFmUlx03.js": {
198
+ "type": "text/javascript; charset=utf-8",
199
+ "etag": '"a1e-sdy/AgmYds5WJzkeaVHqfYShgbM"',
200
+ "mtime": "2026-05-17T14:30:07.459Z",
201
+ "size": 2590,
202
+ "path": "../public/assets/js/MarkdownMessage-CFmUlx03.js"
203
+ },
204
+ "/assets/js/chat._sessionId-Du4LuT3Z.js": {
205
+ "type": "text/javascript; charset=utf-8",
206
+ "etag": '"272b-gg+doLcz4/Y9A6EQ+t9LhIVG4R0"',
207
+ "mtime": "2026-05-17T14:30:07.459Z",
208
+ "size": 10027,
209
+ "path": "../public/assets/js/chat._sessionId-Du4LuT3Z.js"
210
+ },
211
+ "/assets/js/chat.index-DfETrKqO.js": {
212
+ "type": "text/javascript; charset=utf-8",
213
+ "etag": '"279-qBQmpI0y6yKAmzkD/t9Oq+bZ+Qc"',
214
+ "mtime": "2026-05-17T14:30:07.459Z",
215
+ "size": 633,
216
+ "path": "../public/assets/js/chat.index-DfETrKqO.js"
217
+ },
218
+ "/assets/js/index-c1JE7Mqf.js": {
219
+ "type": "text/javascript; charset=utf-8",
220
+ "etag": '"25b-FOlLkdq9acnBF22Y41BcsVOwanw"',
221
+ "mtime": "2026-05-17T14:30:07.459Z",
222
+ "size": 603,
223
+ "path": "../public/assets/js/index-c1JE7Mqf.js"
224
+ },
225
+ "/assets/js/memory-TUhvnVO-.js": {
226
+ "type": "text/javascript; charset=utf-8",
227
+ "etag": '"1260-DjSM/ExdF4vBexB947UBBZLtv7I"',
228
+ "mtime": "2026-05-17T14:30:07.459Z",
229
+ "size": 4704,
230
+ "path": "../public/assets/js/memory-TUhvnVO-.js"
231
+ },
232
+ "/assets/js/settings-C6SLxMLw.js": {
233
+ "type": "text/javascript; charset=utf-8",
234
+ "etag": '"130-6b7ayIffWfwHxevijhSBm7kZSDs"',
235
+ "mtime": "2026-05-17T14:30:07.459Z",
236
+ "size": 304,
237
+ "path": "../public/assets/js/settings-C6SLxMLw.js"
238
+ },
239
+ "/assets/js/skills-CiWhpzh2.js": {
240
+ "type": "text/javascript; charset=utf-8",
241
+ "etag": '"29cb-BMhNMnB4t6fP2jfn4YXN7YzNgMk"',
242
+ "mtime": "2026-05-17T14:30:07.459Z",
243
+ "size": 10699,
244
+ "path": "../public/assets/js/skills-CiWhpzh2.js"
245
+ },
246
+ "/assets/js/theme-CPkdkpaj.js": {
247
+ "type": "text/javascript; charset=utf-8",
248
+ "etag": '"245-JWXBP1zFNJpiVT0wBqxD0nTaUio"',
249
+ "mtime": "2026-05-17T14:30:07.459Z",
250
+ "size": 581,
251
+ "path": "../public/assets/js/theme-CPkdkpaj.js"
252
+ },
253
+ "/assets/js/usage-BrhP5T90.js": {
254
+ "type": "text/javascript; charset=utf-8",
255
+ "etag": '"2503-j46T9BRNIwy22Dmix6A6xqAqY8U"',
256
+ "mtime": "2026-05-17T14:30:07.459Z",
257
+ "size": 9475,
258
+ "path": "../public/assets/js/usage-BrhP5T90.js"
259
+ },
260
+ "/assets/js/index-om9XIKI1.js": {
261
261
  "type": "text/javascript; charset=utf-8",
262
- "etag": '"dcdcd-5tva2IYMtxJUZ1pisMt/sCsjzjo"',
263
- "mtime": "2026-05-17T08:23:50.052Z",
264
- "size": 904653,
265
- "path": "../public/assets/js/index-DsMUdp1X.js"
262
+ "etag": '"dce18-hypIVWSRtoi4izd9FRZt1FyN78k"',
263
+ "mtime": "2026-05-17T14:30:07.461Z",
264
+ "size": 904728,
265
+ "path": "../public/assets/js/index-om9XIKI1.js"
266
266
  },
267
267
  "/logo.png": {
268
268
  "type": "image/png",
269
269
  "etag": '"142435-x+cWIod8BP5RPjbiISayulI5r7I"',
270
- "mtime": "2026-05-17T08:23:51.217Z",
270
+ "mtime": "2026-05-17T14:30:08.446Z",
271
271
  "size": 1319989,
272
272
  "path": "../public/logo.png"
273
273
  }
@@ -1 +1 @@
1
- import{C as t,x,D as n,J as o,g as R,s as B,B as g,i as L,k as U,m as F,a as K}from"./index-DsMUdp1X.js";function M({className:d,...i}){return t.jsx("textarea",{"data-slot":"textarea",className:x("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",d),...i})}function E({onCreateSession:d}){const[i,m]=n.useState(""),[a,u]=n.useState([]),[j,p]=n.useState(!1),l=n.useRef(null),f=n.useRef(null),h=o(e=>e.sendMessage),w=o(e=>e.abortStream),N=o(e=>e.isStreaming),y=o(e=>e.activeSessionId),v=n.useCallback(e=>{if(!e)return;const s=[];for(const r of Array.from(e))s.push({id:Math.random().toString(36).slice(2),name:r.name,type:r.type||"application/octet-stream",size:r.size,url:URL.createObjectURL(r),file:r});u(r=>[...r,...s])},[]),k=n.useCallback(e=>{u(s=>{const r=s.find(c=>c.id===e);return r&&URL.revokeObjectURL(r.url),s.filter(c=>c.id!==e)})},[]),b=async()=>{const e=i.trim();if(!e&&a.length===0)return;if(d){const r=await o.getState().createNewSession();if(r){d(r),m(""),l.current&&(l.current.value="");const c=a.length>0?a:void 0;u([]),await h(e,void 0,c)}return}if(!y&&!await o.getState().createNewSession())return;m(""),l.current&&(l.current.value="");const s=a.length>0?a:void 0;u([]),await h(e,void 0,s)},S=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),b())},D=e=>{e.preventDefault(),p(!0)},I=e=>{e.preventDefault(),p(!1)},z=e=>{e.preventDefault(),p(!1),v(e.dataTransfer.files)},C=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,A=e=>e.startsWith("image/");return t.jsx("div",{className:"flex flex-col gap-2 w-full",children:t.jsxs("div",{className:x("flex min-h-[120px] flex-col rounded-2xl cursor-text bg-card border border-border shadow-lg transition-colors",j&&"border-primary ring-2 ring-primary/20"),onDragOver:D,onDragLeave:I,onDrop:z,children:[a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 p-3 pb-0",children:a.map(e=>t.jsxs("div",{className:"group relative flex items-center gap-2 rounded-lg border bg-muted/50 px-2 py-1.5 pr-7 text-xs",children:[A(e.type)?t.jsx("img",{src:e.url,alt:e.name,className:"h-6 w-6 rounded object-cover"}):t.jsx(R,{className:"size-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.name}),t.jsx("span",{className:"text-muted-foreground/60",children:C(e.size)}),t.jsx("button",{onClick:()=>k(e.id),className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center rounded p-0.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(B,{className:"size-3"})})]},e.id))}),t.jsx("div",{className:"flex-1 relative overflow-y-auto max-h-[258px]",children:t.jsx(M,{ref:l,value:i,onChange:e=>m(e.target.value),onKeyDown:S,placeholder:"Ask anything",className:"w-full border-0 p-3 transition-[padding] duration-200 ease-in-out min-h-[48.4px] outline-none text-[16px] text-foreground resize-none shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent! whitespace-pre-wrap break-words"})}),t.jsxs("div",{className:"flex min-h-[40px] items-center gap-2 p-2 pb-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:e=>v(e.target.files)}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach files","aria-label":"Attach files",onClick:()=>f.current?.click(),children:t.jsx(L,{className:"h-5 w-5"})}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach images","aria-label":"Attach images",onClick:()=>f.current?.click(),children:t.jsx(U,{className:"h-5 w-5"})})]}),t.jsx("div",{className:"ml-auto flex items-center gap-3",children:N?t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:w,className:"rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground transition-colors cursor-pointer",title:"Stop generating","aria-label":"Stop generating",children:t.jsx(F,{className:"h-4 w-4"})}):t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:b,className:x("rounded-full transition-colors duration-100 ease-out cursor-pointer bg-primary",(i||a.length>0)&&"bg-primary hover:bg-primary/90!"),disabled:!i&&a.length===0,"aria-label":"Send message",children:t.jsx(K,{className:"h-4 w-4 text-primary-foreground"})})})]})]})})}export{E as C};
1
+ import{C as t,x,D as n,J as o,g as R,s as B,B as g,i as L,k as U,m as F,a as K}from"./index-om9XIKI1.js";function M({className:d,...i}){return t.jsx("textarea",{"data-slot":"textarea",className:x("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",d),...i})}function E({onCreateSession:d}){const[i,m]=n.useState(""),[a,u]=n.useState([]),[j,p]=n.useState(!1),l=n.useRef(null),f=n.useRef(null),h=o(e=>e.sendMessage),w=o(e=>e.abortStream),N=o(e=>e.isStreaming),y=o(e=>e.activeSessionId),v=n.useCallback(e=>{if(!e)return;const s=[];for(const r of Array.from(e))s.push({id:Math.random().toString(36).slice(2),name:r.name,type:r.type||"application/octet-stream",size:r.size,url:URL.createObjectURL(r),file:r});u(r=>[...r,...s])},[]),k=n.useCallback(e=>{u(s=>{const r=s.find(c=>c.id===e);return r&&URL.revokeObjectURL(r.url),s.filter(c=>c.id!==e)})},[]),b=async()=>{const e=i.trim();if(!e&&a.length===0)return;if(d){const r=await o.getState().createNewSession();if(r){d(r),m(""),l.current&&(l.current.value="");const c=a.length>0?a:void 0;u([]),await h(e,void 0,c)}return}if(!y&&!await o.getState().createNewSession())return;m(""),l.current&&(l.current.value="");const s=a.length>0?a:void 0;u([]),await h(e,void 0,s)},S=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),b())},D=e=>{e.preventDefault(),p(!0)},I=e=>{e.preventDefault(),p(!1)},z=e=>{e.preventDefault(),p(!1),v(e.dataTransfer.files)},C=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,A=e=>e.startsWith("image/");return t.jsx("div",{className:"flex flex-col gap-2 w-full",children:t.jsxs("div",{className:x("flex min-h-[120px] flex-col rounded-2xl cursor-text bg-card border border-border shadow-lg transition-colors",j&&"border-primary ring-2 ring-primary/20"),onDragOver:D,onDragLeave:I,onDrop:z,children:[a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 p-3 pb-0",children:a.map(e=>t.jsxs("div",{className:"group relative flex items-center gap-2 rounded-lg border bg-muted/50 px-2 py-1.5 pr-7 text-xs",children:[A(e.type)?t.jsx("img",{src:e.url,alt:e.name,className:"h-6 w-6 rounded object-cover"}):t.jsx(R,{className:"size-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.name}),t.jsx("span",{className:"text-muted-foreground/60",children:C(e.size)}),t.jsx("button",{onClick:()=>k(e.id),className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center rounded p-0.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(B,{className:"size-3"})})]},e.id))}),t.jsx("div",{className:"flex-1 relative overflow-y-auto max-h-[258px]",children:t.jsx(M,{ref:l,value:i,onChange:e=>m(e.target.value),onKeyDown:S,placeholder:"Ask anything",className:"w-full border-0 p-3 transition-[padding] duration-200 ease-in-out min-h-[48.4px] outline-none text-[16px] text-foreground resize-none shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent! whitespace-pre-wrap break-words"})}),t.jsxs("div",{className:"flex min-h-[40px] items-center gap-2 p-2 pb-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:e=>v(e.target.files)}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach files","aria-label":"Attach files",onClick:()=>f.current?.click(),children:t.jsx(L,{className:"h-5 w-5"})}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach images","aria-label":"Attach images",onClick:()=>f.current?.click(),children:t.jsx(U,{className:"h-5 w-5"})})]}),t.jsx("div",{className:"ml-auto flex items-center gap-3",children:N?t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:w,className:"rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground transition-colors cursor-pointer",title:"Stop generating","aria-label":"Stop generating",children:t.jsx(F,{className:"h-4 w-4"})}):t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:b,className:x("rounded-full transition-colors duration-100 ease-out cursor-pointer bg-primary",(i||a.length>0)&&"bg-primary hover:bg-primary/90!"),disabled:!i&&a.length===0,"aria-label":"Send message",children:t.jsx(K,{className:"h-4 w-4 text-primary-foreground"})})})]})]})})}export{E as C};
@@ -1 +1 @@
1
- import{C as s,M as m,E as d,F as n}from"./index-DsMUdp1X.js";function c({content:a,isStreaming:l}){return s.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none leading-relaxed",children:[s.jsx(m,{remarkPlugins:[n],rehypePlugins:[d],components:{p:({children:e})=>s.jsx("p",{className:"mb-3 last:mb-0",children:e}),h1:({children:e})=>s.jsx("h1",{className:"text-xl font-semibold mt-4 mb-2",children:e}),h2:({children:e})=>s.jsx("h2",{className:"text-lg font-semibold mt-3 mb-2",children:e}),h3:({children:e})=>s.jsx("h3",{className:"text-base font-semibold mt-2 mb-1",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:e}),ol:({children:e})=>s.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:e}),li:({children:e})=>s.jsx("li",{className:"marker:text-muted-foreground",children:e}),code:({className:e,children:r,...t})=>{if(!(e?.includes("hljs")||e?.includes("language-")))return s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-sm font-mono text-foreground",...t,children:r});const o=e?.match(/language-(\w+)/)?.[1];return s.jsxs("div",{className:"relative my-3 rounded-lg border bg-muted/50 overflow-hidden",children:[o&&s.jsx("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted border-b text-[10px] text-muted-foreground font-mono uppercase",children:s.jsx("span",{children:o})}),s.jsx("pre",{className:"p-3 overflow-x-auto text-sm leading-relaxed m-0",children:s.jsx("code",{className:e,...t,children:r})})]})},blockquote:({children:e})=>s.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-4 italic text-muted-foreground my-3",children:e}),a:({href:e,children:r})=>s.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80 transition-colors",children:r}),table:({children:e})=>s.jsx("div",{className:"overflow-x-auto my-3 rounded-lg border",children:s.jsx("table",{className:"w-full text-sm border-collapse",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"bg-muted border-b",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left font-medium text-foreground",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 border-b border-muted",children:e}),hr:()=>s.jsx("hr",{className:"my-4 border-border"}),strong:({children:e})=>s.jsx("strong",{className:"font-semibold text-foreground",children:e})},children:a}),l&&s.jsx("span",{className:"inline-block w-0.5 h-4 bg-foreground/70 ml-0.5 align-text-bottom animate-pulse"})]})}export{c as M};
1
+ import{C as s,M as m,E as d,F as n}from"./index-om9XIKI1.js";function c({content:a,isStreaming:l}){return s.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none leading-relaxed",children:[s.jsx(m,{remarkPlugins:[n],rehypePlugins:[d],components:{p:({children:e})=>s.jsx("p",{className:"mb-3 last:mb-0",children:e}),h1:({children:e})=>s.jsx("h1",{className:"text-xl font-semibold mt-4 mb-2",children:e}),h2:({children:e})=>s.jsx("h2",{className:"text-lg font-semibold mt-3 mb-2",children:e}),h3:({children:e})=>s.jsx("h3",{className:"text-base font-semibold mt-2 mb-1",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:e}),ol:({children:e})=>s.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:e}),li:({children:e})=>s.jsx("li",{className:"marker:text-muted-foreground",children:e}),code:({className:e,children:r,...t})=>{if(!(e?.includes("hljs")||e?.includes("language-")))return s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-sm font-mono text-foreground",...t,children:r});const o=e?.match(/language-(\w+)/)?.[1];return s.jsxs("div",{className:"relative my-3 rounded-lg border bg-muted/50 overflow-hidden",children:[o&&s.jsx("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted border-b text-[10px] text-muted-foreground font-mono uppercase",children:s.jsx("span",{children:o})}),s.jsx("pre",{className:"p-3 overflow-x-auto text-sm leading-relaxed m-0",children:s.jsx("code",{className:e,...t,children:r})})]})},blockquote:({children:e})=>s.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-4 italic text-muted-foreground my-3",children:e}),a:({href:e,children:r})=>s.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80 transition-colors",children:r}),table:({children:e})=>s.jsx("div",{className:"overflow-x-auto my-3 rounded-lg border",children:s.jsx("table",{className:"w-full text-sm border-collapse",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"bg-muted border-b",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left font-medium text-foreground",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 border-b border-muted",children:e}),hr:()=>s.jsx("hr",{className:"my-4 border-border"}),strong:({children:e})=>s.jsx("strong",{className:"font-semibold text-foreground",children:e})},children:a}),l&&s.jsx("span",{className:"inline-block w-0.5 h-4 bg-foreground/70 ml-0.5 align-text-bottom animate-pulse"})]})}export{c as M};
@@ -1 +1 @@
1
- import{J as m,C as e,g as w,D as d,e as v,x as p,h as f,c as y,f as C,L as k,S,u as I}from"./index-DsMUdp1X.js";import{M as g}from"./MarkdownMessage-DL1aUod4.js";import{C as T}from"./ChatInputBlock-BYpIR_ls.js";function M({text:t}){const[s,r]=d.useState(!1),a=async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return e.jsxs("button",{onClick:a,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/50 hover:text-foreground hover:bg-muted transition-colors","aria-label":"Copy message",children:[s?e.jsx(y,{className:"size-3"}):e.jsx(C,{className:"size-3"}),s?"Copied":"Copy"]})}function E(t){const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const r=Math.floor(s/60),a=s%60;return a===0?`${r}m`:`${r}m ${a}s`}function j({reasoning:t,isStreaming:s,startedAt:r,endedAt:a}){const[o,l]=d.useState(s??!1),[n,u]=d.useState(Date.now()),i=d.useRef(null);if(d.useEffect(()=>{l(s??!1)},[s]),d.useEffect(()=>{if(s&&r&&!a)return i.current=setInterval(()=>u(Date.now()),1e3),()=>{i.current&&clearInterval(i.current)};i.current&&(clearInterval(i.current),i.current=null)},[s,r,a]),!t.trim())return null;const x=r?Math.max(0,(a??(s?n:r))-r):null,h=[...t].length,c=s&&r&&!a;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>l(!o),className:p("inline-flex items-center gap-1.5 text-[11px] transition-colors",c?"text-amber-500 dark:text-amber-400 font-medium":"text-muted-foreground/70 hover:text-foreground"),children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",o&&"rotate-90")}),c?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"thinking…"]}):e.jsx("span",{children:"thought"}),x!==null&&x>0&&e.jsxs("span",{className:"text-muted-foreground/60 tabular-nums",children:["· ",E(x)]}),e.jsxs("span",{className:"text-muted-foreground/60",children:["· ",h.toLocaleString()," chars"]})]}),o&&e.jsx("div",{className:"mt-1 rounded-md bg-amber-50 dark:bg-amber-950/20 px-2.5 py-1.5 text-[11px] text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-amber-200 dark:border-amber-800/30",children:t})]})}function N(t){if(!t)return null;try{const s=JSON.parse(t);return{text:JSON.stringify(s,null,2),isJson:!0}}catch{return{text:t,isJson:!1}}}function b({tools:t}){const[s,r]=d.useState(!1);if(!t?.length)return null;const a=t.filter(n=>n.status==="running").length,o=t.filter(n=>n.status==="done").length,l=t.filter(n=>n.status==="error").length;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>r(!s),className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground/70 hover:text-foreground transition-colors",children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",s&&"rotate-90")}),e.jsxs("span",{children:["used ",t.length," tool",t.length>1?"s":""]}),a>0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),a]}),o>0&&e.jsxs("span",{className:"text-emerald-500",children:[o," done"]}),l>0&&e.jsxs("span",{className:"text-red-500",children:[l," error"]}),t.length>0&&a===0&&e.jsxs("span",{className:"text-muted-foreground/50 truncate max-w-[200px]",children:["— ",t.map(n=>n.name).join(", ")]})]}),s&&e.jsx("div",{className:"mt-1 flex flex-col gap-1.5",children:t.map((n,u)=>{const i=N(n.preview),x=N(n.output);return e.jsxs("div",{className:"rounded-md bg-muted/40 border border-border/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-foreground/80 font-mono",children:n.name}),n.status==="running"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"running"]}),n.status==="done"&&e.jsx("span",{className:"text-[10px] text-emerald-500",children:"✓ done"}),n.status==="error"&&e.jsx("span",{className:"text-[10px] text-red-500",children:"✗ error"})]}),i&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Arguments"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",i.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:i.text})})]}),x&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Result"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",x.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:x.text})})]})]},n.callId||`${n.name}-${u}`)})})]})}function z({content:t,isStreaming:s,isAssistant:r}){return r&&!s&&t?e.jsx(g,{content:t}):s&&t?e.jsx("div",{className:"text-base leading-relaxed",children:e.jsx(g,{content:t,isStreaming:!0})}):s&&!t?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}),"Thinking…"]}):e.jsx("div",{className:"text-base leading-relaxed whitespace-pre-wrap",children:t})}function L(t){if(!t||isNaN(t))return null;try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return null}}function D(){const t=m(s=>s.messages);return t.length===0?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Start a conversation"}):e.jsx("div",{className:"flex flex-col",children:t.map(s=>{const r=s.role==="user",a=s.role==="system",o=s.role==="tool",l=!!s.content?.trim(),n=!!s.reasoning?.trim(),u=!!s.toolCalls?.length,i=L(s.timestamp),x=o||!r&&!l&&(n||u);if(a)return e.jsx("div",{className:"px-4 py-2",children:e.jsx("div",{className:"mx-auto max-w-3xl rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-2.5 text-sm text-destructive",children:s.content})},s.id);if(x)return e.jsxs("div",{className:"px-4 py-1",children:[e.jsxs("div",{className:"mx-auto max-w-3xl flex flex-col gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),!o&&u&&e.jsx(b,{tools:s.toolCalls}),o&&e.jsx("div",{className:"rounded-md bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-border/50",children:s.content})]}),i&&e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/40",children:i})})]},s.id);if(r){const h=!!s.attachments?.length;return e.jsx("div",{className:"flex px-4 py-2 justify-end",children:e.jsxs("div",{className:"flex min-w-0 flex-col max-w-[80%] items-end gap-1.5",children:[h&&e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:s.attachments.map(c=>c.type.startsWith("image/")?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-xl overflow-hidden border border-border/50 hover:border-border transition-colors",children:e.jsx("img",{src:c.url,alt:c.name,className:"max-h-[200px] max-w-[260px] object-cover"})},c.id):e.jsxs("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border bg-card px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(w,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:c.name})]},c.id))}),e.jsx("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed bg-primary text-primary-foreground",children:e.jsx("div",{className:"whitespace-pre-wrap",children:s.content})}),i&&e.jsx("span",{className:"text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)}return e.jsx("div",{className:"flex px-4 py-4 justify-start",children:e.jsxs("div",{className:"flex min-w-0 flex-col w-full max-w-3xl gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),u&&e.jsx(b,{tools:s.toolCalls}),e.jsx(z,{content:s.content,isStreaming:s.isStreaming,isAssistant:!0}),l&&e.jsx("div",{className:"mt-1 flex items-center gap-2 px-1",children:e.jsx(M,{text:s.content})}),i&&e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)})})}function J(){const{activeSessionId:t,isStreaming:s}=m(),r=m(l=>l.syncFromDb),{state:a}=k(),o=a==="collapsed";return d.useEffect(()=>{if(!t||!s)return;const l=setInterval(()=>{r(t)},2e3);return()=>clearInterval(l)},[t,s,r]),e.jsxs("div",{className:"flex h-full flex-col ",children:[e.jsx("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o&&e.jsx(S,{className:p("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx("h2",{className:"truncate font-medium",children:t?`Chat ${t.slice(0,8)}`:"New Chat"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"Streaming…"})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(D,{})})}),e.jsx("div",{className:"shrink-0 bg-background px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(T,{})})})]})}function B(){const{sessionId:t}=I.useParams(),s=m(o=>o.switchSession),r=m(o=>o.loadSessions),a=m(o=>o.sessionsLoaded);return d.useEffect(()=>{a||r()},[a,r]),d.useEffect(()=>{t&&s(t)},[t,s]),e.jsx(J,{})}export{B as component};
1
+ import{J as m,C as e,g as w,D as d,e as v,x as p,h as f,c as y,f as C,L as k,S,u as I}from"./index-om9XIKI1.js";import{M as g}from"./MarkdownMessage-CFmUlx03.js";import{C as T}from"./ChatInputBlock-BsakEj7f.js";function M({text:t}){const[s,r]=d.useState(!1),a=async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return e.jsxs("button",{onClick:a,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/50 hover:text-foreground hover:bg-muted transition-colors","aria-label":"Copy message",children:[s?e.jsx(y,{className:"size-3"}):e.jsx(C,{className:"size-3"}),s?"Copied":"Copy"]})}function E(t){const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const r=Math.floor(s/60),a=s%60;return a===0?`${r}m`:`${r}m ${a}s`}function j({reasoning:t,isStreaming:s,startedAt:r,endedAt:a}){const[o,l]=d.useState(s??!1),[n,u]=d.useState(Date.now()),i=d.useRef(null);if(d.useEffect(()=>{l(s??!1)},[s]),d.useEffect(()=>{if(s&&r&&!a)return i.current=setInterval(()=>u(Date.now()),1e3),()=>{i.current&&clearInterval(i.current)};i.current&&(clearInterval(i.current),i.current=null)},[s,r,a]),!t.trim())return null;const x=r?Math.max(0,(a??(s?n:r))-r):null,h=[...t].length,c=s&&r&&!a;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>l(!o),className:p("inline-flex items-center gap-1.5 text-[11px] transition-colors",c?"text-amber-500 dark:text-amber-400 font-medium":"text-muted-foreground/70 hover:text-foreground"),children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",o&&"rotate-90")}),c?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"thinking…"]}):e.jsx("span",{children:"thought"}),x!==null&&x>0&&e.jsxs("span",{className:"text-muted-foreground/60 tabular-nums",children:["· ",E(x)]}),e.jsxs("span",{className:"text-muted-foreground/60",children:["· ",h.toLocaleString()," chars"]})]}),o&&e.jsx("div",{className:"mt-1 rounded-md bg-amber-50 dark:bg-amber-950/20 px-2.5 py-1.5 text-[11px] text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-amber-200 dark:border-amber-800/30",children:t})]})}function N(t){if(!t)return null;try{const s=JSON.parse(t);return{text:JSON.stringify(s,null,2),isJson:!0}}catch{return{text:t,isJson:!1}}}function b({tools:t}){const[s,r]=d.useState(!1);if(!t?.length)return null;const a=t.filter(n=>n.status==="running").length,o=t.filter(n=>n.status==="done").length,l=t.filter(n=>n.status==="error").length;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>r(!s),className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground/70 hover:text-foreground transition-colors",children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",s&&"rotate-90")}),e.jsxs("span",{children:["used ",t.length," tool",t.length>1?"s":""]}),a>0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),a]}),o>0&&e.jsxs("span",{className:"text-emerald-500",children:[o," done"]}),l>0&&e.jsxs("span",{className:"text-red-500",children:[l," error"]}),t.length>0&&a===0&&e.jsxs("span",{className:"text-muted-foreground/50 truncate max-w-[200px]",children:["— ",t.map(n=>n.name).join(", ")]})]}),s&&e.jsx("div",{className:"mt-1 flex flex-col gap-1.5",children:t.map((n,u)=>{const i=N(n.preview),x=N(n.output);return e.jsxs("div",{className:"rounded-md bg-muted/40 border border-border/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-foreground/80 font-mono",children:n.name}),n.status==="running"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"running"]}),n.status==="done"&&e.jsx("span",{className:"text-[10px] text-emerald-500",children:"✓ done"}),n.status==="error"&&e.jsx("span",{className:"text-[10px] text-red-500",children:"✗ error"})]}),i&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Arguments"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",i.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:i.text})})]}),x&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Result"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",x.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:x.text})})]})]},n.callId||`${n.name}-${u}`)})})]})}function z({content:t,isStreaming:s,isAssistant:r}){return r&&!s&&t?e.jsx(g,{content:t}):s&&t?e.jsx("div",{className:"text-base leading-relaxed",children:e.jsx(g,{content:t,isStreaming:!0})}):s&&!t?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}),"Thinking…"]}):e.jsx("div",{className:"text-base leading-relaxed whitespace-pre-wrap",children:t})}function L(t){if(!t||isNaN(t))return null;try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return null}}function D(){const t=m(s=>s.messages);return t.length===0?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Start a conversation"}):e.jsx("div",{className:"flex flex-col",children:t.map(s=>{const r=s.role==="user",a=s.role==="system",o=s.role==="tool",l=!!s.content?.trim(),n=!!s.reasoning?.trim(),u=!!s.toolCalls?.length,i=L(s.timestamp),x=o||!r&&!l&&(n||u);if(a)return e.jsx("div",{className:"px-4 py-2",children:e.jsx("div",{className:"mx-auto max-w-3xl rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-2.5 text-sm text-destructive",children:s.content})},s.id);if(x)return e.jsxs("div",{className:"px-4 py-1",children:[e.jsxs("div",{className:"mx-auto max-w-3xl flex flex-col gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),!o&&u&&e.jsx(b,{tools:s.toolCalls}),o&&e.jsx("div",{className:"rounded-md bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-border/50",children:s.content})]}),i&&e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/40",children:i})})]},s.id);if(r){const h=!!s.attachments?.length;return e.jsx("div",{className:"flex px-4 py-2 justify-end",children:e.jsxs("div",{className:"flex min-w-0 flex-col max-w-[80%] items-end gap-1.5",children:[h&&e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:s.attachments.map(c=>c.type.startsWith("image/")?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-xl overflow-hidden border border-border/50 hover:border-border transition-colors",children:e.jsx("img",{src:c.url,alt:c.name,className:"max-h-[200px] max-w-[260px] object-cover"})},c.id):e.jsxs("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border bg-card px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(w,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:c.name})]},c.id))}),e.jsx("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed bg-primary text-primary-foreground",children:e.jsx("div",{className:"whitespace-pre-wrap",children:s.content})}),i&&e.jsx("span",{className:"text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)}return e.jsx("div",{className:"flex px-4 py-4 justify-start",children:e.jsxs("div",{className:"flex min-w-0 flex-col w-full max-w-3xl gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),u&&e.jsx(b,{tools:s.toolCalls}),e.jsx(z,{content:s.content,isStreaming:s.isStreaming,isAssistant:!0}),l&&e.jsx("div",{className:"mt-1 flex items-center gap-2 px-1",children:e.jsx(M,{text:s.content})}),i&&e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)})})}function J(){const{activeSessionId:t,isStreaming:s}=m(),r=m(l=>l.syncFromDb),{state:a}=k(),o=a==="collapsed";return d.useEffect(()=>{if(!t||!s)return;const l=setInterval(()=>{r(t)},2e3);return()=>clearInterval(l)},[t,s,r]),e.jsxs("div",{className:"flex h-full flex-col ",children:[e.jsx("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o&&e.jsx(S,{className:p("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx("h2",{className:"truncate font-medium",children:t?`Chat ${t.slice(0,8)}`:"New Chat"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"Streaming…"})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(D,{})})}),e.jsx("div",{className:"shrink-0 bg-background px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(T,{})})})]})}function B(){const{sessionId:t}=I.useParams(),s=m(o=>o.switchSession),r=m(o=>o.loadSessions),a=m(o=>o.sessionsLoaded);return d.useEffect(()=>{a||r()},[a,r]),d.useEffect(()=>{t&&s(t)},[t,s]),e.jsx(J,{})}export{B as component};
@@ -1 +1 @@
1
- import{K as c,J as a,D as o,y as u,C as i}from"./index-DsMUdp1X.js";function f(){const s=c(),n=a(e=>e.sessionsLoaded),t=a(e=>e.sessions),r=o.useRef(!1);return o.useEffect(()=>{if(n)if(t.length>0)s({to:"/chat/$sessionId",params:{sessionId:t[0].id},replace:!0});else{if(r.current)return;r.current=!0,u({title:"",source:"api_server"}).then(e=>{s({to:"/chat/$sessionId",params:{sessionId:e.id},replace:!0})}).catch(()=>{r.current=!1})}},[n,t,s]),i.jsx("div",{className:"flex flex-1 items-center justify-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading conversations…"})})}export{f as component};
1
+ import{K as c,J as a,D as o,y as u,C as i}from"./index-om9XIKI1.js";function f(){const s=c(),n=a(e=>e.sessionsLoaded),t=a(e=>e.sessions),r=o.useRef(!1);return o.useEffect(()=>{if(n)if(t.length>0)s({to:"/chat/$sessionId",params:{sessionId:t[0].id},replace:!0});else{if(r.current)return;r.current=!0,u({title:"",source:"api_server"}).then(e=>{s({to:"/chat/$sessionId",params:{sessionId:e.id},replace:!0})}).catch(()=>{r.current=!1})}},[n,t,s]),i.jsx("div",{className:"flex flex-1 items-center justify-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading conversations…"})})}export{f as component};
@@ -1 +1 @@
1
- import{K as a,C as e}from"./index-DsMUdp1X.js";import{C as n}from"./ChatInputBlock-BYpIR_ls.js";function o(){const t=a();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-semibold tracking-tight text-foreground text-center",children:"What can I help you with?"}),e.jsx("div",{className:"w-full",children:e.jsx(n,{onCreateSession:s=>{t({to:"/chat/$sessionId",params:{sessionId:s}})}})})]})})}export{o as component};
1
+ import{K as a,C as e}from"./index-om9XIKI1.js";import{C as n}from"./ChatInputBlock-BsakEj7f.js";function o(){const t=a();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-semibold tracking-tight text-foreground text-center",children:"What can I help you with?"}),e.jsx("div",{className:"w-full",children:e.jsx(n,{onCreateSession:s=>{t({to:"/chat/$sessionId",params:{sessionId:s}})}})})]})})}export{o as component};