@pactor-app/chat 1.46.0 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -607,7 +607,7 @@ function ArtifactPanel({
607
607
  onPointerDown: handleResizeStart
608
608
  }
609
609
  ) : null,
610
- header !== void 0 && header !== null ? header : /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1 border-b border-border px-2 py-2.5", children: [
610
+ header !== void 0 && header !== null ? header : /* @__PURE__ */ jsxs3("div", { className: "flex h-10 shrink-0 items-center gap-1 border-b border-border px-2", children: [
611
611
  hasArtifacts ? /* @__PURE__ */ jsx3(
612
612
  Button,
613
613
  {
@@ -1121,12 +1121,12 @@ function ChatMessage({
1121
1121
 
1122
1122
  // src/components/ChatPage/index.tsx
1123
1123
  import { useRenderer as useRenderer2 } from "@pactor-app/runtime";
1124
- import { isValidElement as isValidElement2, useEffect as useEffect5, useState as useState8 } from "react";
1125
1124
  import {
1126
- Panel,
1127
- PanelGroup,
1128
- ResizableHandle
1129
- } from "@pactor-app/ui/ui";
1125
+ isValidElement as isValidElement2,
1126
+ useEffect as useEffect5,
1127
+ useState as useState8
1128
+ } from "react";
1129
+ import { Panel, PanelGroup, ResizableHandle } from "@pactor-app/ui/ui";
1130
1130
  import { Button as Button2 } from "@pactor-app/ui/components";
1131
1131
  import { Icon as Icon13 } from "@pactor-app/ui/components";
1132
1132
  import { Menu } from "@pactor-app/ui/components";
@@ -2022,6 +2022,7 @@ function ChatPage({
2022
2022
  activeMenuKey,
2023
2023
  railItems = [],
2024
2024
  railFooterItems = [],
2025
+ hideMenu = false,
2025
2026
  menuAction,
2026
2027
  onMenuSelect,
2027
2028
  onMenuAction,
@@ -2095,7 +2096,9 @@ function ChatPage({
2095
2096
  if (!railControlled) setActiveRailInner(next);
2096
2097
  onConversationRailChange?.(next);
2097
2098
  };
2098
- const visibleRailItems = conversationRailItems.filter((item) => item.hidden !== true);
2099
+ const visibleRailItems = conversationRailItems.filter(
2100
+ (item) => item.hidden !== true
2101
+ );
2099
2102
  const activeRailItem = visibleRailItems.find(
2100
2103
  (item) => item.key === activeRailKey
2101
2104
  );
@@ -2170,7 +2173,10 @@ function ChatPage({
2170
2173
  {
2171
2174
  icon: item.icon,
2172
2175
  variant: "text",
2173
- className: cn(active ? "bg-accent text-accent-foreground" : void 0, "px-2"),
2176
+ className: cn(
2177
+ active ? "bg-accent text-accent-foreground" : void 0,
2178
+ "px-2"
2179
+ ),
2174
2180
  onClick
2175
2181
  }
2176
2182
  );
@@ -2193,7 +2199,11 @@ function ChatPage({
2193
2199
  toggleArtifact
2194
2200
  ) : null,
2195
2201
  visibleRailItems.map(
2196
- (item) => convRailButton(item, activeRailKey === item.key, () => toggleRailItem(item))
2202
+ (item) => convRailButton(
2203
+ item,
2204
+ activeRailKey === item.key,
2205
+ () => toggleRailItem(item)
2206
+ )
2197
2207
  ),
2198
2208
  activePopoverItem ? /* @__PURE__ */ jsx17(
2199
2209
  "div",
@@ -2211,79 +2221,104 @@ function ChatPage({
2211
2221
  ]
2212
2222
  }
2213
2223
  ) : null;
2214
- const chatArea = /* @__PURE__ */ jsxs15("div", { "data-slot": "chat-page-conversation", className: "flex h-full min-w-0 flex-1 flex-col", children: [
2215
- /* @__PURE__ */ jsxs15(
2216
- "div",
2217
- {
2218
- "data-slot": "chat-page-conversation-header",
2219
- className: "flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",
2220
- children: [
2221
- /* @__PURE__ */ jsx17(Text, { text: conversationTitle, strong: true }),
2222
- conversationHeaderAction ? /* @__PURE__ */ jsx17(Tooltip2, { content: conversationHeaderAction.tooltip ?? conversationHeaderAction.label, side: "bottom", children: /* @__PURE__ */ jsx17(
2223
- Button2,
2224
+ const chatArea = /* @__PURE__ */ jsxs15(
2225
+ "div",
2226
+ {
2227
+ "data-slot": "chat-page-conversation",
2228
+ className: "flex h-full min-w-0 flex-1 flex-col",
2229
+ children: [
2230
+ /* @__PURE__ */ jsxs15(
2231
+ "div",
2232
+ {
2233
+ "data-slot": "chat-page-conversation-header",
2234
+ className: "flex h-10 shrink-0 items-center justify-between border-b border-border px-4",
2235
+ children: [
2236
+ /* @__PURE__ */ jsx17(Text, { text: conversationTitle, strong: true }),
2237
+ conversationHeaderAction ? /* @__PURE__ */ jsx17(
2238
+ Tooltip2,
2239
+ {
2240
+ content: conversationHeaderAction.tooltip ?? conversationHeaderAction.label,
2241
+ side: "bottom",
2242
+ children: /* @__PURE__ */ jsx17(
2243
+ Button2,
2244
+ {
2245
+ text: conversationHeaderAction.label,
2246
+ icon: conversationHeaderAction.icon,
2247
+ variant: "text",
2248
+ onClick: () => onConversationHeaderAction?.()
2249
+ }
2250
+ )
2251
+ }
2252
+ ) : null
2253
+ ]
2254
+ }
2255
+ ),
2256
+ /* @__PURE__ */ jsxs15("div", { className: "flex min-h-0 flex-1", children: [
2257
+ /* @__PURE__ */ jsxs15(
2258
+ "div",
2224
2259
  {
2225
- text: conversationHeaderAction.label,
2226
- icon: conversationHeaderAction.icon,
2227
- variant: "text",
2228
- onClick: () => onConversationHeaderAction?.()
2260
+ "data-slot": "chat-page-conversation-body",
2261
+ className: "mx-auto flex min-h-0 w-[61.8cqw] max-w-full flex-col",
2262
+ children: [
2263
+ messages.length === 0 ? /* @__PURE__ */ jsx17(
2264
+ Welcome,
2265
+ {
2266
+ title: welcome?.title,
2267
+ description: welcome?.description,
2268
+ prompts: welcome?.prompts,
2269
+ style: { flex: 1 },
2270
+ onSelect: (value) => onSend?.(value)
2271
+ }
2272
+ ) : /* @__PURE__ */ jsx17(
2273
+ MessageList,
2274
+ {
2275
+ messages,
2276
+ className: "scrollbar-subtle",
2277
+ style: { flex: 1, minHeight: 0, padding: 16 },
2278
+ onAction: onMessageAction,
2279
+ onOpenArtifacts: () => setOpen(true)
2280
+ }
2281
+ ),
2282
+ /* @__PURE__ */ jsx17(
2283
+ Composer,
2284
+ {
2285
+ placeholder: composerPlaceholder,
2286
+ loading: sending,
2287
+ models,
2288
+ model,
2289
+ contexts,
2290
+ contextItems,
2291
+ attachments,
2292
+ footer: composerFooter,
2293
+ style: {
2294
+ padding: 16,
2295
+ paddingBottom: composerBottom ? 8 : 16,
2296
+ flexShrink: 0
2297
+ },
2298
+ onModelChange,
2299
+ onContextItemsChange,
2300
+ onAttachFiles,
2301
+ onRemoveAttachment,
2302
+ onRetryAttachment,
2303
+ onSubmit: (text) => onSend?.(text)
2304
+ }
2305
+ ),
2306
+ composerBottom ? /* @__PURE__ */ jsx17(
2307
+ "div",
2308
+ {
2309
+ "data-slot": "chat-page-composer-bottom",
2310
+ className: "shrink-0 px-4 pb-2 text-center",
2311
+ children: renderSlot(composerBottom)
2312
+ }
2313
+ ) : null
2314
+ ]
2229
2315
  }
2230
- ) }) : null
2231
- ]
2232
- }
2233
- ),
2234
- /* @__PURE__ */ jsxs15("div", { className: "flex min-h-0 flex-1", children: [
2235
- /* @__PURE__ */ jsxs15(
2236
- "div",
2237
- {
2238
- "data-slot": "chat-page-conversation-body",
2239
- className: "mx-auto flex min-h-0 w-[61.8cqw] max-w-full flex-col",
2240
- children: [
2241
- messages.length === 0 ? /* @__PURE__ */ jsx17(
2242
- Welcome,
2243
- {
2244
- title: welcome?.title,
2245
- description: welcome?.description,
2246
- prompts: welcome?.prompts,
2247
- style: { flex: 1 },
2248
- onSelect: (value) => onSend?.(value)
2249
- }
2250
- ) : /* @__PURE__ */ jsx17(
2251
- MessageList,
2252
- {
2253
- messages,
2254
- className: "scrollbar-subtle",
2255
- style: { flex: 1, minHeight: 0, padding: 16 },
2256
- onAction: onMessageAction,
2257
- onOpenArtifacts: () => setOpen(true)
2258
- }
2259
- ),
2260
- /* @__PURE__ */ jsx17(
2261
- Composer,
2262
- {
2263
- placeholder: composerPlaceholder,
2264
- loading: sending,
2265
- models,
2266
- model,
2267
- contexts,
2268
- contextItems,
2269
- attachments,
2270
- footer: composerFooter,
2271
- style: { padding: 16, paddingBottom: composerBottom ? 8 : 16, flexShrink: 0 },
2272
- onModelChange,
2273
- onContextItemsChange,
2274
- onAttachFiles,
2275
- onRemoveAttachment,
2276
- onRetryAttachment,
2277
- onSubmit: (text) => onSend?.(text)
2278
- }
2279
- ),
2280
- composerBottom ? /* @__PURE__ */ jsx17("div", { "data-slot": "chat-page-composer-bottom", className: "shrink-0 px-4 pb-2 text-center", children: renderSlot(composerBottom) }) : null
2281
- ]
2282
- }
2283
- ),
2284
- convRail
2285
- ] })
2286
- ] });
2316
+ ),
2317
+ convRail
2318
+ ] })
2319
+ ]
2320
+ }
2321
+ );
2287
2322
  const activeArtifact = artifacts.find((item) => item.id === activeArtifactId) ?? (activeArtifactId === void 0 || activeArtifactId === "" ? artifacts[artifacts.length - 1] : void 0);
2288
2323
  const artifactPanel = /* @__PURE__ */ jsx17(
2289
2324
  "div",
@@ -2327,7 +2362,7 @@ function ChatPage({
2327
2362
  ]
2328
2363
  }
2329
2364
  ) : null,
2330
- /* @__PURE__ */ jsxs15(
2365
+ hideMenu ? null : /* @__PURE__ */ jsxs15(
2331
2366
  "div",
2332
2367
  {
2333
2368
  "data-slot": "chat-page-menu",
@@ -2374,22 +2409,43 @@ function ChatPage({
2374
2409
  strong: true
2375
2410
  }
2376
2411
  ),
2377
- /* @__PURE__ */ jsx17(Icon13, { name: convCollapsed ? "chevron-right" : "chevron-down", size: 14 })
2412
+ /* @__PURE__ */ jsx17(
2413
+ Icon13,
2414
+ {
2415
+ name: convCollapsed ? "chevron-right" : "chevron-down",
2416
+ size: 14
2417
+ }
2418
+ )
2419
+ ]
2420
+ }
2421
+ ) : null,
2422
+ !convCollapsed ? /* @__PURE__ */ jsxs15(
2423
+ "div",
2424
+ {
2425
+ "data-slot": "chat-page-section-body",
2426
+ className: "scrollbar-subtle flex min-h-0 flex-1 flex-col overflow-y-auto",
2427
+ children: [
2428
+ /* @__PURE__ */ jsx17(
2429
+ ConversationList,
2430
+ {
2431
+ items: conversations,
2432
+ activeId: activeConversationId,
2433
+ onSelect: (id) => onSelectConversation?.(id),
2434
+ onDelete: (id) => onDeleteConversation?.(id)
2435
+ }
2436
+ ),
2437
+ moreLabel !== void 0 ? /* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx17(
2438
+ Button2,
2439
+ {
2440
+ text: `${moreLabel} >>`,
2441
+ variant: "link",
2442
+ size: "small",
2443
+ onClick: () => onMore?.()
2444
+ }
2445
+ ) }) : null
2378
2446
  ]
2379
2447
  }
2380
2448
  ) : null,
2381
- !convCollapsed ? /* @__PURE__ */ jsxs15("div", { "data-slot": "chat-page-section-body", className: "scrollbar-subtle flex min-h-0 flex-1 flex-col overflow-y-auto", children: [
2382
- /* @__PURE__ */ jsx17(
2383
- ConversationList,
2384
- {
2385
- items: conversations,
2386
- activeId: activeConversationId,
2387
- onSelect: (id) => onSelectConversation?.(id),
2388
- onDelete: (id) => onDeleteConversation?.(id)
2389
- }
2390
- ),
2391
- moreLabel !== void 0 ? /* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx17(Button2, { text: `${moreLabel} >>`, variant: "link", size: "small", onClick: () => onMore?.() }) }) : null
2392
- ] }) : null,
2393
2449
  footerSectionTitle !== void 0 ? /* @__PURE__ */ jsxs15(
2394
2450
  "button",
2395
2451
  {
@@ -2399,33 +2455,61 @@ function ChatPage({
2399
2455
  className: "flex w-full shrink-0 cursor-pointer items-center justify-between px-2 pt-2",
2400
2456
  onClick: toggleFooterSection,
2401
2457
  children: [
2402
- /* @__PURE__ */ jsx17(Text, { text: footerSectionTitle, type: "secondary", className: "text-sm", strong: true }),
2403
- /* @__PURE__ */ jsx17(Icon13, { name: footerCollapsed ? "chevron-right" : "chevron-down", size: 14 })
2458
+ /* @__PURE__ */ jsx17(
2459
+ Text,
2460
+ {
2461
+ text: footerSectionTitle,
2462
+ type: "secondary",
2463
+ className: "text-sm",
2464
+ strong: true
2465
+ }
2466
+ ),
2467
+ /* @__PURE__ */ jsx17(
2468
+ Icon13,
2469
+ {
2470
+ name: footerCollapsed ? "chevron-right" : "chevron-down",
2471
+ size: 14
2472
+ }
2473
+ )
2404
2474
  ]
2405
2475
  }
2406
2476
  ) : null,
2407
- !footerCollapsed && footerItems.length > 0 ? /* @__PURE__ */ jsx17("div", { "data-slot": "chat-page-section-body", className: "scrollbar-subtle min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx17(
2408
- Menu,
2477
+ !footerCollapsed && footerItems.length > 0 ? /* @__PURE__ */ jsx17(
2478
+ "div",
2409
2479
  {
2410
- items: footerItems,
2411
- onSelect: (key) => onMenuSelect?.(key)
2480
+ "data-slot": "chat-page-section-body",
2481
+ className: "scrollbar-subtle min-h-0 flex-1 overflow-y-auto",
2482
+ children: /* @__PURE__ */ jsx17(
2483
+ Menu,
2484
+ {
2485
+ items: footerItems,
2486
+ onSelect: (key) => onMenuSelect?.(key)
2487
+ }
2488
+ )
2412
2489
  }
2413
- ) }) : null
2490
+ ) : null
2414
2491
  ]
2415
2492
  }
2416
2493
  ),
2417
- /* @__PURE__ */ jsx17("div", { className: "@container h-full min-w-0 flex-1", children: content !== void 0 ? renderSlot(content) : open || activePanelItem ? /* @__PURE__ */ jsxs15(PanelGroup, { orientation: "horizontal", style: { width: "100%", height: "100%" }, children: [
2418
- /* @__PURE__ */ jsx17(Panel, { defaultSize: "62%", children: chatArea }),
2419
- /* @__PURE__ */ jsx17(ResizableHandle, { withHandle: true }),
2420
- /* @__PURE__ */ jsx17(Panel, { defaultSize: "38%", minSize: "380px", maxSize: "760px", children: activePanelItem ? /* @__PURE__ */ jsx17(
2421
- "div",
2422
- {
2423
- "data-slot": "chat-page-rail-panel",
2424
- className: "flex h-full min-w-0 flex-col border-l border-border bg-muted",
2425
- children: renderSlot(activePanelItem.content)
2426
- }
2427
- ) : artifactPanel })
2428
- ] }) : chatArea })
2494
+ /* @__PURE__ */ jsx17("div", { className: "@container h-full min-w-0 flex-1", children: content !== void 0 ? renderSlot(content) : open || activePanelItem ? /* @__PURE__ */ jsxs15(
2495
+ PanelGroup,
2496
+ {
2497
+ orientation: "horizontal",
2498
+ style: { width: "100%", height: "100%" },
2499
+ children: [
2500
+ /* @__PURE__ */ jsx17(Panel, { defaultSize: "70%", children: chatArea }),
2501
+ /* @__PURE__ */ jsx17(ResizableHandle, { withHandle: true }),
2502
+ /* @__PURE__ */ jsx17(Panel, { defaultSize: "30%", minSize: "380px", maxSize: "760px", children: activePanelItem ? /* @__PURE__ */ jsx17(
2503
+ "div",
2504
+ {
2505
+ "data-slot": "chat-page-rail-panel",
2506
+ className: "flex h-full min-w-0 flex-col border-l border-border bg-muted",
2507
+ children: renderSlot(activePanelItem.content)
2508
+ }
2509
+ ) : artifactPanel })
2510
+ ]
2511
+ }
2512
+ ) : chatArea })
2429
2513
  ]
2430
2514
  }
2431
2515
  );
@@ -643,7 +643,7 @@ function ArtifactPanel({
643
643
  onPointerDown: handleResizeStart
644
644
  }
645
645
  ) : null,
646
- header !== void 0 && header !== null ? header : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex shrink-0 items-center gap-1 border-b border-border px-2 py-2.5", children: [
646
+ header !== void 0 && header !== null ? header : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex h-10 shrink-0 items-center gap-1 border-b border-border px-2", children: [
647
647
  hasArtifacts ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
648
648
  import_components2.Button,
649
649
  {
@@ -2044,6 +2044,7 @@ function ChatPage({
2044
2044
  activeMenuKey,
2045
2045
  railItems = [],
2046
2046
  railFooterItems = [],
2047
+ hideMenu = false,
2047
2048
  menuAction,
2048
2049
  onMenuSelect,
2049
2050
  onMenuAction,
@@ -2117,7 +2118,9 @@ function ChatPage({
2117
2118
  if (!railControlled) setActiveRailInner(next);
2118
2119
  onConversationRailChange?.(next);
2119
2120
  };
2120
- const visibleRailItems = conversationRailItems.filter((item) => item.hidden !== true);
2121
+ const visibleRailItems = conversationRailItems.filter(
2122
+ (item) => item.hidden !== true
2123
+ );
2121
2124
  const activeRailItem = visibleRailItems.find(
2122
2125
  (item) => item.key === activeRailKey
2123
2126
  );
@@ -2192,7 +2195,10 @@ function ChatPage({
2192
2195
  {
2193
2196
  icon: item.icon,
2194
2197
  variant: "text",
2195
- className: cn(active ? "bg-accent text-accent-foreground" : void 0, "px-2"),
2198
+ className: cn(
2199
+ active ? "bg-accent text-accent-foreground" : void 0,
2200
+ "px-2"
2201
+ ),
2196
2202
  onClick
2197
2203
  }
2198
2204
  );
@@ -2215,7 +2221,11 @@ function ChatPage({
2215
2221
  toggleArtifact
2216
2222
  ) : null,
2217
2223
  visibleRailItems.map(
2218
- (item) => convRailButton(item, activeRailKey === item.key, () => toggleRailItem(item))
2224
+ (item) => convRailButton(
2225
+ item,
2226
+ activeRailKey === item.key,
2227
+ () => toggleRailItem(item)
2228
+ )
2219
2229
  ),
2220
2230
  activePopoverItem ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2221
2231
  "div",
@@ -2233,79 +2243,104 @@ function ChatPage({
2233
2243
  ]
2234
2244
  }
2235
2245
  ) : null;
2236
- const chatArea = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-slot": "chat-page-conversation", className: "flex h-full min-w-0 flex-1 flex-col", children: [
2237
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2238
- "div",
2239
- {
2240
- "data-slot": "chat-page-conversation-header",
2241
- className: "flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",
2242
- children: [
2243
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components25.Text, { text: conversationTitle, strong: true }),
2244
- conversationHeaderAction ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components26.Tooltip, { content: conversationHeaderAction.tooltip ?? conversationHeaderAction.label, side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2245
- import_components22.Button,
2246
+ const chatArea = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2247
+ "div",
2248
+ {
2249
+ "data-slot": "chat-page-conversation",
2250
+ className: "flex h-full min-w-0 flex-1 flex-col",
2251
+ children: [
2252
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2253
+ "div",
2254
+ {
2255
+ "data-slot": "chat-page-conversation-header",
2256
+ className: "flex h-10 shrink-0 items-center justify-between border-b border-border px-4",
2257
+ children: [
2258
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components25.Text, { text: conversationTitle, strong: true }),
2259
+ conversationHeaderAction ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2260
+ import_components26.Tooltip,
2261
+ {
2262
+ content: conversationHeaderAction.tooltip ?? conversationHeaderAction.label,
2263
+ side: "bottom",
2264
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2265
+ import_components22.Button,
2266
+ {
2267
+ text: conversationHeaderAction.label,
2268
+ icon: conversationHeaderAction.icon,
2269
+ variant: "text",
2270
+ onClick: () => onConversationHeaderAction?.()
2271
+ }
2272
+ )
2273
+ }
2274
+ ) : null
2275
+ ]
2276
+ }
2277
+ ),
2278
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-h-0 flex-1", children: [
2279
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2280
+ "div",
2246
2281
  {
2247
- text: conversationHeaderAction.label,
2248
- icon: conversationHeaderAction.icon,
2249
- variant: "text",
2250
- onClick: () => onConversationHeaderAction?.()
2282
+ "data-slot": "chat-page-conversation-body",
2283
+ className: "mx-auto flex min-h-0 w-[61.8cqw] max-w-full flex-col",
2284
+ children: [
2285
+ messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2286
+ Welcome,
2287
+ {
2288
+ title: welcome?.title,
2289
+ description: welcome?.description,
2290
+ prompts: welcome?.prompts,
2291
+ style: { flex: 1 },
2292
+ onSelect: (value) => onSend?.(value)
2293
+ }
2294
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2295
+ MessageList,
2296
+ {
2297
+ messages,
2298
+ className: "scrollbar-subtle",
2299
+ style: { flex: 1, minHeight: 0, padding: 16 },
2300
+ onAction: onMessageAction,
2301
+ onOpenArtifacts: () => setOpen(true)
2302
+ }
2303
+ ),
2304
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2305
+ Composer,
2306
+ {
2307
+ placeholder: composerPlaceholder,
2308
+ loading: sending,
2309
+ models,
2310
+ model,
2311
+ contexts,
2312
+ contextItems,
2313
+ attachments,
2314
+ footer: composerFooter,
2315
+ style: {
2316
+ padding: 16,
2317
+ paddingBottom: composerBottom ? 8 : 16,
2318
+ flexShrink: 0
2319
+ },
2320
+ onModelChange,
2321
+ onContextItemsChange,
2322
+ onAttachFiles,
2323
+ onRemoveAttachment,
2324
+ onRetryAttachment,
2325
+ onSubmit: (text) => onSend?.(text)
2326
+ }
2327
+ ),
2328
+ composerBottom ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2329
+ "div",
2330
+ {
2331
+ "data-slot": "chat-page-composer-bottom",
2332
+ className: "shrink-0 px-4 pb-2 text-center",
2333
+ children: renderSlot(composerBottom)
2334
+ }
2335
+ ) : null
2336
+ ]
2251
2337
  }
2252
- ) }) : null
2253
- ]
2254
- }
2255
- ),
2256
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-h-0 flex-1", children: [
2257
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2258
- "div",
2259
- {
2260
- "data-slot": "chat-page-conversation-body",
2261
- className: "mx-auto flex min-h-0 w-[61.8cqw] max-w-full flex-col",
2262
- children: [
2263
- messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2264
- Welcome,
2265
- {
2266
- title: welcome?.title,
2267
- description: welcome?.description,
2268
- prompts: welcome?.prompts,
2269
- style: { flex: 1 },
2270
- onSelect: (value) => onSend?.(value)
2271
- }
2272
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2273
- MessageList,
2274
- {
2275
- messages,
2276
- className: "scrollbar-subtle",
2277
- style: { flex: 1, minHeight: 0, padding: 16 },
2278
- onAction: onMessageAction,
2279
- onOpenArtifacts: () => setOpen(true)
2280
- }
2281
- ),
2282
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2283
- Composer,
2284
- {
2285
- placeholder: composerPlaceholder,
2286
- loading: sending,
2287
- models,
2288
- model,
2289
- contexts,
2290
- contextItems,
2291
- attachments,
2292
- footer: composerFooter,
2293
- style: { padding: 16, paddingBottom: composerBottom ? 8 : 16, flexShrink: 0 },
2294
- onModelChange,
2295
- onContextItemsChange,
2296
- onAttachFiles,
2297
- onRemoveAttachment,
2298
- onRetryAttachment,
2299
- onSubmit: (text) => onSend?.(text)
2300
- }
2301
- ),
2302
- composerBottom ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { "data-slot": "chat-page-composer-bottom", className: "shrink-0 px-4 pb-2 text-center", children: renderSlot(composerBottom) }) : null
2303
- ]
2304
- }
2305
- ),
2306
- convRail
2307
- ] })
2308
- ] });
2338
+ ),
2339
+ convRail
2340
+ ] })
2341
+ ]
2342
+ }
2343
+ );
2309
2344
  const activeArtifact = artifacts.find((item) => item.id === activeArtifactId) ?? (activeArtifactId === void 0 || activeArtifactId === "" ? artifacts[artifacts.length - 1] : void 0);
2310
2345
  const artifactPanel = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2311
2346
  "div",
@@ -2349,7 +2384,7 @@ function ChatPage({
2349
2384
  ]
2350
2385
  }
2351
2386
  ) : null,
2352
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2387
+ hideMenu ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2353
2388
  "div",
2354
2389
  {
2355
2390
  "data-slot": "chat-page-menu",
@@ -2396,22 +2431,43 @@ function ChatPage({
2396
2431
  strong: true
2397
2432
  }
2398
2433
  ),
2399
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components23.Icon, { name: convCollapsed ? "chevron-right" : "chevron-down", size: 14 })
2434
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2435
+ import_components23.Icon,
2436
+ {
2437
+ name: convCollapsed ? "chevron-right" : "chevron-down",
2438
+ size: 14
2439
+ }
2440
+ )
2441
+ ]
2442
+ }
2443
+ ) : null,
2444
+ !convCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2445
+ "div",
2446
+ {
2447
+ "data-slot": "chat-page-section-body",
2448
+ className: "scrollbar-subtle flex min-h-0 flex-1 flex-col overflow-y-auto",
2449
+ children: [
2450
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2451
+ ConversationList,
2452
+ {
2453
+ items: conversations,
2454
+ activeId: activeConversationId,
2455
+ onSelect: (id) => onSelectConversation?.(id),
2456
+ onDelete: (id) => onDeleteConversation?.(id)
2457
+ }
2458
+ ),
2459
+ moreLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2460
+ import_components22.Button,
2461
+ {
2462
+ text: `${moreLabel} >>`,
2463
+ variant: "link",
2464
+ size: "small",
2465
+ onClick: () => onMore?.()
2466
+ }
2467
+ ) }) : null
2400
2468
  ]
2401
2469
  }
2402
2470
  ) : null,
2403
- !convCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-slot": "chat-page-section-body", className: "scrollbar-subtle flex min-h-0 flex-1 flex-col overflow-y-auto", children: [
2404
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2405
- ConversationList,
2406
- {
2407
- items: conversations,
2408
- activeId: activeConversationId,
2409
- onSelect: (id) => onSelectConversation?.(id),
2410
- onDelete: (id) => onDeleteConversation?.(id)
2411
- }
2412
- ),
2413
- moreLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components22.Button, { text: `${moreLabel} >>`, variant: "link", size: "small", onClick: () => onMore?.() }) }) : null
2414
- ] }) : null,
2415
2471
  footerSectionTitle !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2416
2472
  "button",
2417
2473
  {
@@ -2421,33 +2477,61 @@ function ChatPage({
2421
2477
  className: "flex w-full shrink-0 cursor-pointer items-center justify-between px-2 pt-2",
2422
2478
  onClick: toggleFooterSection,
2423
2479
  children: [
2424
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components25.Text, { text: footerSectionTitle, type: "secondary", className: "text-sm", strong: true }),
2425
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components23.Icon, { name: footerCollapsed ? "chevron-right" : "chevron-down", size: 14 })
2480
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2481
+ import_components25.Text,
2482
+ {
2483
+ text: footerSectionTitle,
2484
+ type: "secondary",
2485
+ className: "text-sm",
2486
+ strong: true
2487
+ }
2488
+ ),
2489
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2490
+ import_components23.Icon,
2491
+ {
2492
+ name: footerCollapsed ? "chevron-right" : "chevron-down",
2493
+ size: 14
2494
+ }
2495
+ )
2426
2496
  ]
2427
2497
  }
2428
2498
  ) : null,
2429
- !footerCollapsed && footerItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { "data-slot": "chat-page-section-body", className: "scrollbar-subtle min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2430
- import_components24.Menu,
2499
+ !footerCollapsed && footerItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2500
+ "div",
2431
2501
  {
2432
- items: footerItems,
2433
- onSelect: (key) => onMenuSelect?.(key)
2502
+ "data-slot": "chat-page-section-body",
2503
+ className: "scrollbar-subtle min-h-0 flex-1 overflow-y-auto",
2504
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2505
+ import_components24.Menu,
2506
+ {
2507
+ items: footerItems,
2508
+ onSelect: (key) => onMenuSelect?.(key)
2509
+ }
2510
+ )
2434
2511
  }
2435
- ) }) : null
2512
+ ) : null
2436
2513
  ]
2437
2514
  }
2438
2515
  ),
2439
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "@container h-full min-w-0 flex-1", children: content !== void 0 ? renderSlot(content) : open || activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_ui2.PanelGroup, { orientation: "horizontal", style: { width: "100%", height: "100%" }, children: [
2440
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui2.Panel, { defaultSize: "62%", children: chatArea }),
2441
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui2.ResizableHandle, { withHandle: true }),
2442
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui2.Panel, { defaultSize: "38%", minSize: "380px", maxSize: "760px", children: activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2443
- "div",
2444
- {
2445
- "data-slot": "chat-page-rail-panel",
2446
- className: "flex h-full min-w-0 flex-col border-l border-border bg-muted",
2447
- children: renderSlot(activePanelItem.content)
2448
- }
2449
- ) : artifactPanel })
2450
- ] }) : chatArea })
2516
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "@container h-full min-w-0 flex-1", children: content !== void 0 ? renderSlot(content) : open || activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2517
+ import_ui2.PanelGroup,
2518
+ {
2519
+ orientation: "horizontal",
2520
+ style: { width: "100%", height: "100%" },
2521
+ children: [
2522
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui2.Panel, { defaultSize: "70%", children: chatArea }),
2523
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui2.ResizableHandle, { withHandle: true }),
2524
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui2.Panel, { defaultSize: "30%", minSize: "380px", maxSize: "760px", children: activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2525
+ "div",
2526
+ {
2527
+ "data-slot": "chat-page-rail-panel",
2528
+ className: "flex h-full min-w-0 flex-col border-l border-border bg-muted",
2529
+ children: renderSlot(activePanelItem.content)
2530
+ }
2531
+ ) : artifactPanel })
2532
+ ]
2533
+ }
2534
+ ) : chatArea })
2451
2535
  ]
2452
2536
  }
2453
2537
  );
@@ -402,7 +402,7 @@ interface ConversationRailItem {
402
402
  /** 图标名(Icon 白名单) */
403
403
  icon?: string;
404
404
  /** 呈现形态:popover(图标栏旁悬浮弹框,缺省)/ panel(产物栏式右侧固定宽栏) */
405
- display?: 'panel' | 'popover';
405
+ display?: "panel" | "popover";
406
406
  /** 附加内容(React 元素或 DslNode;缺省时点击仅触发状态事件,不渲染内容层) */
407
407
  content?: DslNode | ReactNode;
408
408
  /** 隐藏该项(如按当前会话有无对应内容动态显隐);隐藏时激活态一并失效 */
@@ -426,6 +426,8 @@ interface ChatPageProps {
426
426
  railItems?: ChatPageMenuItem[];
427
427
  /** 图标栏底部附加项(如设置 / 个人中心) */
428
428
  railFooterItems?: ChatPageMenuItem[];
429
+ /** 隐藏左侧展开菜单区(品牌 / 导航 / 会话列表 / 底部分组整体不渲染) */
430
+ hideMenu?: boolean;
429
431
  /** 展开菜单区右上角操作(如「发现应用」);提供才渲染 */
430
432
  menuAction?: {
431
433
  label: string;
@@ -576,12 +578,13 @@ interface ChatPageProps {
576
578
  * 最右产物区(ArtifactPanel:内建产物预览、
577
579
  * 目录树与下载,可显隐;展示时经 Resizable 拖拽调节与对话区的宽度)。
578
580
  * content 槽(React 元素或 DslNode)提供时整体替换右侧主区域(含对话
579
- * header),由调用方自带完整主体内容;左侧图标栏与展开菜单区保留。
581
+ * header),由调用方自带完整主体内容;左侧图标栏与展开菜单区保留
582
+ *(hideMenu: true 时展开菜单区整体不渲染)。
580
583
  * 数据与行为全部经 props / events 进出,
581
584
  * 本组件不持有业务状态(产物区开关、图标栏激活项与分区折叠缺省非受控,
582
585
  * 均可经受控 prop + change 事件闭环)。
583
586
  */
584
- declare function ChatPage({ brand, menuItems, activeMenuKey, railItems, railFooterItems, menuAction, onMenuSelect, onMenuAction, conversationSectionTitle, conversationSectionCollapsed, defaultConversationSectionCollapsed, onConversationSectionToggle, conversations, activeConversationId, onSelectConversation, onDeleteConversation, moreLabel, onMore, footerSectionTitle, footerItems, footerSectionCollapsed, defaultFooterSectionCollapsed, onFooterSectionToggle, conversationTitle, conversationHeaderAction, onConversationHeaderAction, conversationRailItems, hideArtifactRailItem, activeConversationRailKey, onConversationRailChange, messages, sending, composerPlaceholder, welcome, onSend, onMessageAction, models, model, onModelChange, contexts, contextItems, onContextItemsChange, attachments, onAttachFiles, onRemoveAttachment, onRetryAttachment, composerFooter, composerBottom, artifactTitle, artifacts, activeArtifactId, onSelectArtifact, artifactEmptyText, safeRegistry, user, artifactViewers, onDownloadArtifact, artifactOpen, defaultArtifactOpen, onArtifactOpenChange, content, className, style, }: ChatPageProps): react.JSX.Element;
587
+ declare function ChatPage({ brand, menuItems, activeMenuKey, railItems, railFooterItems, hideMenu, menuAction, onMenuSelect, onMenuAction, conversationSectionTitle, conversationSectionCollapsed, defaultConversationSectionCollapsed, onConversationSectionToggle, conversations, activeConversationId, onSelectConversation, onDeleteConversation, moreLabel, onMore, footerSectionTitle, footerItems, footerSectionCollapsed, defaultFooterSectionCollapsed, onFooterSectionToggle, conversationTitle, conversationHeaderAction, onConversationHeaderAction, conversationRailItems, hideArtifactRailItem, activeConversationRailKey, onConversationRailChange, messages, sending, composerPlaceholder, welcome, onSend, onMessageAction, models, model, onModelChange, contexts, contextItems, onContextItemsChange, attachments, onAttachFiles, onRemoveAttachment, onRetryAttachment, composerFooter, composerBottom, artifactTitle, artifacts, activeArtifactId, onSelectArtifact, artifactEmptyText, safeRegistry, user, artifactViewers, onDownloadArtifact, artifactOpen, defaultArtifactOpen, onArtifactOpenChange, content, className, style, }: ChatPageProps): react.JSX.Element;
585
588
 
586
589
  /** 引用来源项 */
587
590
  interface CitationItem {
@@ -402,7 +402,7 @@ interface ConversationRailItem {
402
402
  /** 图标名(Icon 白名单) */
403
403
  icon?: string;
404
404
  /** 呈现形态:popover(图标栏旁悬浮弹框,缺省)/ panel(产物栏式右侧固定宽栏) */
405
- display?: 'panel' | 'popover';
405
+ display?: "panel" | "popover";
406
406
  /** 附加内容(React 元素或 DslNode;缺省时点击仅触发状态事件,不渲染内容层) */
407
407
  content?: DslNode | ReactNode;
408
408
  /** 隐藏该项(如按当前会话有无对应内容动态显隐);隐藏时激活态一并失效 */
@@ -426,6 +426,8 @@ interface ChatPageProps {
426
426
  railItems?: ChatPageMenuItem[];
427
427
  /** 图标栏底部附加项(如设置 / 个人中心) */
428
428
  railFooterItems?: ChatPageMenuItem[];
429
+ /** 隐藏左侧展开菜单区(品牌 / 导航 / 会话列表 / 底部分组整体不渲染) */
430
+ hideMenu?: boolean;
429
431
  /** 展开菜单区右上角操作(如「发现应用」);提供才渲染 */
430
432
  menuAction?: {
431
433
  label: string;
@@ -576,12 +578,13 @@ interface ChatPageProps {
576
578
  * 最右产物区(ArtifactPanel:内建产物预览、
577
579
  * 目录树与下载,可显隐;展示时经 Resizable 拖拽调节与对话区的宽度)。
578
580
  * content 槽(React 元素或 DslNode)提供时整体替换右侧主区域(含对话
579
- * header),由调用方自带完整主体内容;左侧图标栏与展开菜单区保留。
581
+ * header),由调用方自带完整主体内容;左侧图标栏与展开菜单区保留
582
+ *(hideMenu: true 时展开菜单区整体不渲染)。
580
583
  * 数据与行为全部经 props / events 进出,
581
584
  * 本组件不持有业务状态(产物区开关、图标栏激活项与分区折叠缺省非受控,
582
585
  * 均可经受控 prop + change 事件闭环)。
583
586
  */
584
- declare function ChatPage({ brand, menuItems, activeMenuKey, railItems, railFooterItems, menuAction, onMenuSelect, onMenuAction, conversationSectionTitle, conversationSectionCollapsed, defaultConversationSectionCollapsed, onConversationSectionToggle, conversations, activeConversationId, onSelectConversation, onDeleteConversation, moreLabel, onMore, footerSectionTitle, footerItems, footerSectionCollapsed, defaultFooterSectionCollapsed, onFooterSectionToggle, conversationTitle, conversationHeaderAction, onConversationHeaderAction, conversationRailItems, hideArtifactRailItem, activeConversationRailKey, onConversationRailChange, messages, sending, composerPlaceholder, welcome, onSend, onMessageAction, models, model, onModelChange, contexts, contextItems, onContextItemsChange, attachments, onAttachFiles, onRemoveAttachment, onRetryAttachment, composerFooter, composerBottom, artifactTitle, artifacts, activeArtifactId, onSelectArtifact, artifactEmptyText, safeRegistry, user, artifactViewers, onDownloadArtifact, artifactOpen, defaultArtifactOpen, onArtifactOpenChange, content, className, style, }: ChatPageProps): react.JSX.Element;
587
+ declare function ChatPage({ brand, menuItems, activeMenuKey, railItems, railFooterItems, hideMenu, menuAction, onMenuSelect, onMenuAction, conversationSectionTitle, conversationSectionCollapsed, defaultConversationSectionCollapsed, onConversationSectionToggle, conversations, activeConversationId, onSelectConversation, onDeleteConversation, moreLabel, onMore, footerSectionTitle, footerItems, footerSectionCollapsed, defaultFooterSectionCollapsed, onFooterSectionToggle, conversationTitle, conversationHeaderAction, onConversationHeaderAction, conversationRailItems, hideArtifactRailItem, activeConversationRailKey, onConversationRailChange, messages, sending, composerPlaceholder, welcome, onSend, onMessageAction, models, model, onModelChange, contexts, contextItems, onContextItemsChange, attachments, onAttachFiles, onRemoveAttachment, onRetryAttachment, composerFooter, composerBottom, artifactTitle, artifacts, activeArtifactId, onSelectArtifact, artifactEmptyText, safeRegistry, user, artifactViewers, onDownloadArtifact, artifactOpen, defaultArtifactOpen, onArtifactOpenChange, content, className, style, }: ChatPageProps): react.JSX.Element;
585
588
 
586
589
  /** 引用来源项 */
587
590
  interface CitationItem {
@@ -23,7 +23,7 @@ import {
23
23
  registerChatComponents,
24
24
  resolveArtifactFilename,
25
25
  saveBlob
26
- } from "../chunk-TBPUSGKL.js";
26
+ } from "../chunk-276DZFLS.js";
27
27
  export {
28
28
  AgentStatus,
29
29
  ArtifactPanel,
package/dist/index.cjs CHANGED
@@ -1673,7 +1673,7 @@ function ArtifactPanel({
1673
1673
  onPointerDown: handleResizeStart
1674
1674
  }
1675
1675
  ) : null,
1676
- header !== void 0 && header !== null ? header : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex shrink-0 items-center gap-1 border-b border-border px-2 py-2.5", children: [
1676
+ header !== void 0 && header !== null ? header : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex h-10 shrink-0 items-center gap-1 border-b border-border px-2", children: [
1677
1677
  hasArtifacts ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1678
1678
  import_components2.Button,
1679
1679
  {
@@ -6314,6 +6314,7 @@ function ChatPage({
6314
6314
  activeMenuKey,
6315
6315
  railItems = [],
6316
6316
  railFooterItems = [],
6317
+ hideMenu = false,
6317
6318
  menuAction,
6318
6319
  onMenuSelect,
6319
6320
  onMenuAction,
@@ -6387,7 +6388,9 @@ function ChatPage({
6387
6388
  if (!railControlled) setActiveRailInner(next);
6388
6389
  onConversationRailChange?.(next);
6389
6390
  };
6390
- const visibleRailItems = conversationRailItems.filter((item) => item.hidden !== true);
6391
+ const visibleRailItems = conversationRailItems.filter(
6392
+ (item) => item.hidden !== true
6393
+ );
6391
6394
  const activeRailItem = visibleRailItems.find(
6392
6395
  (item) => item.key === activeRailKey
6393
6396
  );
@@ -6462,7 +6465,10 @@ function ChatPage({
6462
6465
  {
6463
6466
  icon: item.icon,
6464
6467
  variant: "text",
6465
- className: cn(active ? "bg-accent text-accent-foreground" : void 0, "px-2"),
6468
+ className: cn(
6469
+ active ? "bg-accent text-accent-foreground" : void 0,
6470
+ "px-2"
6471
+ ),
6466
6472
  onClick
6467
6473
  }
6468
6474
  );
@@ -6485,7 +6491,11 @@ function ChatPage({
6485
6491
  toggleArtifact
6486
6492
  ) : null,
6487
6493
  visibleRailItems.map(
6488
- (item) => convRailButton(item, activeRailKey === item.key, () => toggleRailItem(item))
6494
+ (item) => convRailButton(
6495
+ item,
6496
+ activeRailKey === item.key,
6497
+ () => toggleRailItem(item)
6498
+ )
6489
6499
  ),
6490
6500
  activePopoverItem ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6491
6501
  "div",
@@ -6503,79 +6513,104 @@ function ChatPage({
6503
6513
  ]
6504
6514
  }
6505
6515
  ) : null;
6506
- const chatArea = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { "data-slot": "chat-page-conversation", className: "flex h-full min-w-0 flex-1 flex-col", children: [
6507
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6508
- "div",
6509
- {
6510
- "data-slot": "chat-page-conversation-header",
6511
- className: "flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",
6512
- children: [
6513
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components36.Text, { text: conversationTitle, strong: true }),
6514
- conversationHeaderAction ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components37.Tooltip, { content: conversationHeaderAction.tooltip ?? conversationHeaderAction.label, side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6515
- import_components33.Button,
6516
+ const chatArea = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6517
+ "div",
6518
+ {
6519
+ "data-slot": "chat-page-conversation",
6520
+ className: "flex h-full min-w-0 flex-1 flex-col",
6521
+ children: [
6522
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6523
+ "div",
6524
+ {
6525
+ "data-slot": "chat-page-conversation-header",
6526
+ className: "flex h-10 shrink-0 items-center justify-between border-b border-border px-4",
6527
+ children: [
6528
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components36.Text, { text: conversationTitle, strong: true }),
6529
+ conversationHeaderAction ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6530
+ import_components37.Tooltip,
6531
+ {
6532
+ content: conversationHeaderAction.tooltip ?? conversationHeaderAction.label,
6533
+ side: "bottom",
6534
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6535
+ import_components33.Button,
6536
+ {
6537
+ text: conversationHeaderAction.label,
6538
+ icon: conversationHeaderAction.icon,
6539
+ variant: "text",
6540
+ onClick: () => onConversationHeaderAction?.()
6541
+ }
6542
+ )
6543
+ }
6544
+ ) : null
6545
+ ]
6546
+ }
6547
+ ),
6548
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex min-h-0 flex-1", children: [
6549
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6550
+ "div",
6516
6551
  {
6517
- text: conversationHeaderAction.label,
6518
- icon: conversationHeaderAction.icon,
6519
- variant: "text",
6520
- onClick: () => onConversationHeaderAction?.()
6552
+ "data-slot": "chat-page-conversation-body",
6553
+ className: "mx-auto flex min-h-0 w-[61.8cqw] max-w-full flex-col",
6554
+ children: [
6555
+ messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6556
+ Welcome,
6557
+ {
6558
+ title: welcome?.title,
6559
+ description: welcome?.description,
6560
+ prompts: welcome?.prompts,
6561
+ style: { flex: 1 },
6562
+ onSelect: (value) => onSend?.(value)
6563
+ }
6564
+ ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6565
+ MessageList,
6566
+ {
6567
+ messages,
6568
+ className: "scrollbar-subtle",
6569
+ style: { flex: 1, minHeight: 0, padding: 16 },
6570
+ onAction: onMessageAction,
6571
+ onOpenArtifacts: () => setOpen(true)
6572
+ }
6573
+ ),
6574
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6575
+ Composer,
6576
+ {
6577
+ placeholder: composerPlaceholder,
6578
+ loading: sending,
6579
+ models,
6580
+ model,
6581
+ contexts,
6582
+ contextItems,
6583
+ attachments,
6584
+ footer: composerFooter,
6585
+ style: {
6586
+ padding: 16,
6587
+ paddingBottom: composerBottom ? 8 : 16,
6588
+ flexShrink: 0
6589
+ },
6590
+ onModelChange,
6591
+ onContextItemsChange,
6592
+ onAttachFiles,
6593
+ onRemoveAttachment,
6594
+ onRetryAttachment,
6595
+ onSubmit: (text) => onSend?.(text)
6596
+ }
6597
+ ),
6598
+ composerBottom ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6599
+ "div",
6600
+ {
6601
+ "data-slot": "chat-page-composer-bottom",
6602
+ className: "shrink-0 px-4 pb-2 text-center",
6603
+ children: renderSlot(composerBottom)
6604
+ }
6605
+ ) : null
6606
+ ]
6521
6607
  }
6522
- ) }) : null
6523
- ]
6524
- }
6525
- ),
6526
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex min-h-0 flex-1", children: [
6527
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6528
- "div",
6529
- {
6530
- "data-slot": "chat-page-conversation-body",
6531
- className: "mx-auto flex min-h-0 w-[61.8cqw] max-w-full flex-col",
6532
- children: [
6533
- messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6534
- Welcome,
6535
- {
6536
- title: welcome?.title,
6537
- description: welcome?.description,
6538
- prompts: welcome?.prompts,
6539
- style: { flex: 1 },
6540
- onSelect: (value) => onSend?.(value)
6541
- }
6542
- ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6543
- MessageList,
6544
- {
6545
- messages,
6546
- className: "scrollbar-subtle",
6547
- style: { flex: 1, minHeight: 0, padding: 16 },
6548
- onAction: onMessageAction,
6549
- onOpenArtifacts: () => setOpen(true)
6550
- }
6551
- ),
6552
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6553
- Composer,
6554
- {
6555
- placeholder: composerPlaceholder,
6556
- loading: sending,
6557
- models,
6558
- model,
6559
- contexts,
6560
- contextItems,
6561
- attachments,
6562
- footer: composerFooter,
6563
- style: { padding: 16, paddingBottom: composerBottom ? 8 : 16, flexShrink: 0 },
6564
- onModelChange,
6565
- onContextItemsChange,
6566
- onAttachFiles,
6567
- onRemoveAttachment,
6568
- onRetryAttachment,
6569
- onSubmit: (text) => onSend?.(text)
6570
- }
6571
- ),
6572
- composerBottom ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-slot": "chat-page-composer-bottom", className: "shrink-0 px-4 pb-2 text-center", children: renderSlot(composerBottom) }) : null
6573
- ]
6574
- }
6575
- ),
6576
- convRail
6577
- ] })
6578
- ] });
6608
+ ),
6609
+ convRail
6610
+ ] })
6611
+ ]
6612
+ }
6613
+ );
6579
6614
  const activeArtifact = artifacts.find((item) => item.id === activeArtifactId) ?? (activeArtifactId === void 0 || activeArtifactId === "" ? artifacts[artifacts.length - 1] : void 0);
6580
6615
  const artifactPanel = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6581
6616
  "div",
@@ -6619,7 +6654,7 @@ function ChatPage({
6619
6654
  ]
6620
6655
  }
6621
6656
  ) : null,
6622
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6657
+ hideMenu ? null : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6623
6658
  "div",
6624
6659
  {
6625
6660
  "data-slot": "chat-page-menu",
@@ -6666,22 +6701,43 @@ function ChatPage({
6666
6701
  strong: true
6667
6702
  }
6668
6703
  ),
6669
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components34.Icon, { name: convCollapsed ? "chevron-right" : "chevron-down", size: 14 })
6704
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6705
+ import_components34.Icon,
6706
+ {
6707
+ name: convCollapsed ? "chevron-right" : "chevron-down",
6708
+ size: 14
6709
+ }
6710
+ )
6711
+ ]
6712
+ }
6713
+ ) : null,
6714
+ !convCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6715
+ "div",
6716
+ {
6717
+ "data-slot": "chat-page-section-body",
6718
+ className: "scrollbar-subtle flex min-h-0 flex-1 flex-col overflow-y-auto",
6719
+ children: [
6720
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6721
+ ConversationList,
6722
+ {
6723
+ items: conversations,
6724
+ activeId: activeConversationId,
6725
+ onSelect: (id) => onSelectConversation?.(id),
6726
+ onDelete: (id) => onDeleteConversation?.(id)
6727
+ }
6728
+ ),
6729
+ moreLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6730
+ import_components33.Button,
6731
+ {
6732
+ text: `${moreLabel} >>`,
6733
+ variant: "link",
6734
+ size: "small",
6735
+ onClick: () => onMore?.()
6736
+ }
6737
+ ) }) : null
6670
6738
  ]
6671
6739
  }
6672
6740
  ) : null,
6673
- !convCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { "data-slot": "chat-page-section-body", className: "scrollbar-subtle flex min-h-0 flex-1 flex-col overflow-y-auto", children: [
6674
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6675
- ConversationList,
6676
- {
6677
- items: conversations,
6678
- activeId: activeConversationId,
6679
- onSelect: (id) => onSelectConversation?.(id),
6680
- onDelete: (id) => onDeleteConversation?.(id)
6681
- }
6682
- ),
6683
- moreLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components33.Button, { text: `${moreLabel} >>`, variant: "link", size: "small", onClick: () => onMore?.() }) }) : null
6684
- ] }) : null,
6685
6741
  footerSectionTitle !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6686
6742
  "button",
6687
6743
  {
@@ -6691,33 +6747,61 @@ function ChatPage({
6691
6747
  className: "flex w-full shrink-0 cursor-pointer items-center justify-between px-2 pt-2",
6692
6748
  onClick: toggleFooterSection,
6693
6749
  children: [
6694
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components36.Text, { text: footerSectionTitle, type: "secondary", className: "text-sm", strong: true }),
6695
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components34.Icon, { name: footerCollapsed ? "chevron-right" : "chevron-down", size: 14 })
6750
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6751
+ import_components36.Text,
6752
+ {
6753
+ text: footerSectionTitle,
6754
+ type: "secondary",
6755
+ className: "text-sm",
6756
+ strong: true
6757
+ }
6758
+ ),
6759
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6760
+ import_components34.Icon,
6761
+ {
6762
+ name: footerCollapsed ? "chevron-right" : "chevron-down",
6763
+ size: 14
6764
+ }
6765
+ )
6696
6766
  ]
6697
6767
  }
6698
6768
  ) : null,
6699
- !footerCollapsed && footerItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-slot": "chat-page-section-body", className: "scrollbar-subtle min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6700
- import_components35.Menu,
6769
+ !footerCollapsed && footerItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6770
+ "div",
6701
6771
  {
6702
- items: footerItems,
6703
- onSelect: (key) => onMenuSelect?.(key)
6772
+ "data-slot": "chat-page-section-body",
6773
+ className: "scrollbar-subtle min-h-0 flex-1 overflow-y-auto",
6774
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6775
+ import_components35.Menu,
6776
+ {
6777
+ items: footerItems,
6778
+ onSelect: (key) => onMenuSelect?.(key)
6779
+ }
6780
+ )
6704
6781
  }
6705
- ) }) : null
6782
+ ) : null
6706
6783
  ]
6707
6784
  }
6708
6785
  ),
6709
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "@container h-full min-w-0 flex-1", children: content !== void 0 ? renderSlot(content) : open || activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_ui2.PanelGroup, { orientation: "horizontal", style: { width: "100%", height: "100%" }, children: [
6710
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_ui2.Panel, { defaultSize: "62%", children: chatArea }),
6711
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_ui2.ResizableHandle, { withHandle: true }),
6712
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_ui2.Panel, { defaultSize: "38%", minSize: "380px", maxSize: "760px", children: activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6713
- "div",
6714
- {
6715
- "data-slot": "chat-page-rail-panel",
6716
- className: "flex h-full min-w-0 flex-col border-l border-border bg-muted",
6717
- children: renderSlot(activePanelItem.content)
6718
- }
6719
- ) : artifactPanel })
6720
- ] }) : chatArea })
6786
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "@container h-full min-w-0 flex-1", children: content !== void 0 ? renderSlot(content) : open || activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6787
+ import_ui2.PanelGroup,
6788
+ {
6789
+ orientation: "horizontal",
6790
+ style: { width: "100%", height: "100%" },
6791
+ children: [
6792
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_ui2.Panel, { defaultSize: "70%", children: chatArea }),
6793
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_ui2.ResizableHandle, { withHandle: true }),
6794
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_ui2.Panel, { defaultSize: "30%", minSize: "380px", maxSize: "760px", children: activePanelItem ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6795
+ "div",
6796
+ {
6797
+ "data-slot": "chat-page-rail-panel",
6798
+ className: "flex h-full min-w-0 flex-col border-l border-border bg-muted",
6799
+ children: renderSlot(activePanelItem.content)
6800
+ }
6801
+ ) : artifactPanel })
6802
+ ]
6803
+ }
6804
+ ) : chatArea })
6721
6805
  ]
6722
6806
  }
6723
6807
  );
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  registerChatComponents,
12
12
  resolveArtifactFilename,
13
13
  saveBlob
14
- } from "./chunk-TBPUSGKL.js";
14
+ } from "./chunk-276DZFLS.js";
15
15
 
16
16
  // src/model.ts
17
17
  var idCounter = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/chat",
3
- "version": "1.46.0",
3
+ "version": "1.48.0",
4
4
  "description": "Pactor chat: AI message rendering protocol (message model, streaming reducer, safe registry, capability action) and chat runtime view (ChatView / MessageBubble / PartRenderer / Composer / chat layout)",
5
5
  "keywords": [
6
6
  "pactor",
@@ -63,11 +63,11 @@
63
63
  "dependencies": {
64
64
  "clsx": "^2.1.1",
65
65
  "tailwind-merge": "^3.6.0",
66
- "@pactor-app/core": "1.46.0",
67
- "@pactor-app/permission": "1.46.0",
68
- "@pactor-app/runtime": "1.46.0",
69
- "@pactor-app/markdown": "1.46.0",
70
- "@pactor-app/ui": "1.46.0"
66
+ "@pactor-app/core": "1.48.0",
67
+ "@pactor-app/markdown": "1.48.0",
68
+ "@pactor-app/runtime": "1.48.0",
69
+ "@pactor-app/permission": "1.48.0",
70
+ "@pactor-app/ui": "1.48.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": ">=18",
package/styles.css CHANGED
@@ -207,6 +207,9 @@
207
207
  .h-8 {
208
208
  height: calc(var(--spacing) * 8);
209
209
  }
210
+ .h-10 {
211
+ height: calc(var(--spacing) * 10);
212
+ }
210
213
  .h-full {
211
214
  height: 100%;
212
215
  }