@pactor-app/chat 1.16.0 → 1.17.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.
package/dist/index.d.cts CHANGED
@@ -36,6 +36,25 @@ declare const ARTIFACT_IMAGE_EXTENSIONS: readonly string[];
36
36
  declare function resolveArtifactFileType(artifact: ChatArtifact): string | null;
37
37
  /** 是否图片类产物(扩展名命中内建图片集合) */
38
38
  declare function isImageArtifact(artifact: ChatArtifact): boolean;
39
+ /** 产物图标的着色档位(卡片图标底色 / 前景色按 tone 取色) */
40
+ type ArtifactIconTone = 'green' | 'blue' | 'amber' | 'violet' | 'slate';
41
+ /** 产物图标规格:ui Icon 白名单名 + 着色档位 */
42
+ interface ArtifactIconSpec {
43
+ name: string;
44
+ tone: ArtifactIconTone;
45
+ }
46
+ /**
47
+ * 产物图标(图标名 + 着色档位):文件扩展名优先(图片类 → image/violet,
48
+ * 表格 / 数据 / 脚本 / 代码 / 文档按扩展名分桶),无扩展名或未知扩展名
49
+ * 时按 kind 兜底(code → code/blue、dsl → layout-grid/slate、其余
50
+ * file-text 或 file,均 slate)。卡片 / 面板下拉 / 目录树共用,
51
+ * 保证同一产物在各处图标一致。
52
+ */
53
+ declare function resolveArtifactIcon(artifact: ChatArtifact): ArtifactIconSpec;
54
+ /** 产物图标名(resolveArtifactIcon 的 name 部分,面板下拉 / 目录树用) */
55
+ declare function resolveArtifactIconName(artifact: ChatArtifact): string;
56
+ /** 产物尺寸展示(meta.size 字节数 → "512 B / 3.5 KB / 12.0 MB";非法输入返回 null) */
57
+ declare function formatArtifactSize(size: unknown): string | null;
39
58
  /** update 的补丁:id 不可改 */
40
59
  type ArtifactPatch = Partial<Omit<ChatArtifact, 'id'>>;
41
60
  /** 消息形态的最小契约(与 model.ts ChatMessage 结构化兼容,保持本文件零依赖) */
@@ -728,13 +747,21 @@ interface ArtifactPanelProps {
728
747
  artifact?: ChatArtifact | null;
729
748
  /**
730
749
  * 会话内全部产出物(多产物场景):提供后 header 左端展示目录列表
731
- * 切换钮;多于 1 个时 header 下沿展示 tab 条(kind 图标 + 名称)
750
+ * 切换钮,文件名处展示产物切换下拉
732
751
  */
733
752
  artifacts?: ChatArtifact[];
734
- /** 当前激活产出物 id(tabs 高亮;缺省取 artifact.id) */
753
+ /** 当前激活产出物 id(下拉高亮;缺省取 artifact.id) */
735
754
  activeArtifactId?: string;
736
- /** tab / 目录列表点击切换回调(受控切换,面板不自改外部状态) */
755
+ /** 下拉 / 目录列表点击切换回调(受控切换,面板不自改外部状态) */
737
756
  onSelectArtifact?: (artifact: ChatArtifact) => void;
757
+ /**
758
+ * 定位产物目录视图的请求信号(卡片区"查看所有产物"):数值变化即
759
+ * 切换列表视图并经 onViewRequestConsumed 消费复位(消费后普通
760
+ * 打开回内容视图)
761
+ */
762
+ viewRequest?: number | null;
763
+ /** viewRequest 消费回调(组合层复位信号) */
764
+ onViewRequestConsumed?: () => void;
738
765
  /** 面板内容槽:提供时整体替代内建渲染器(标题栏保留) */
739
766
  inspector?: ReactNode;
740
767
  /** 关闭按钮 / 遮罩点击回调 */
@@ -772,7 +799,7 @@ declare function buildArtifactTree(artifacts: ChatArtifact[]): ArtifactTreeNode[
772
799
  */
773
800
  type ArtifactViewer = (artifact: ChatArtifact) => ReactNode;
774
801
  type ArtifactViewers = Record<string, ArtifactViewer>;
775
- declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, inspector, onClose, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
802
+ declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, viewRequest, onViewRequestConsumed, inspector, onClose, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
776
803
 
777
804
  /**
778
805
  * EmptyState(spec: chat-empty-state,设计决策 D0/D1):空会话欢迎页。
@@ -932,6 +959,8 @@ interface ChatWorkspaceProps {
932
959
  onArtifact?: (artifact: ChatArtifact) => void;
933
960
  /** 产出物卡片"在面板中打开"回调(runtime 绑定 events.onOpenArtifact 时传入) */
934
961
  onOpenArtifact?: (artifact: ChatArtifact) => void;
962
+ /** 卡片区"查看所有产物"回调(runtime 绑定 events.onOpenArtifactList 时传入) */
963
+ onOpenArtifactList?: () => void;
935
964
  /**
936
965
  * 面板 tab / 目录列表点击切换回调(runtime 绑定 events.onSelectArtifact
937
966
  * 时传入;受控典型接法:setState artifact=${event.artifact})。
@@ -1114,6 +1143,8 @@ interface ChatProps {
1114
1143
  onArtifact?: (artifact: ChatArtifact) => void;
1115
1144
  /** 产出物卡片"在面板中打开"按钮点击回调(event 作用域含 artifact;受控场景的开面板入口) */
1116
1145
  onOpenArtifact?: (artifact: ChatArtifact) => void;
1146
+ /** 卡片区"查看所有产物"点击回调(event 为空对象 {};受控典型接法:setState panelOpen=true,面板自动定位产物目录视图) */
1147
+ onOpenArtifactList?: () => void;
1117
1148
  /** 面板 tab / 目录列表点击切换回调(event 作用域含 artifact;受控典型接法:setState artifact=${event.artifact}) */
1118
1149
  onSelectArtifact?: (artifact: ChatArtifact) => void;
1119
1150
  className?: string;
@@ -1145,7 +1176,7 @@ declare function ChatSidebarMenu({ menu, activeMenuKey, onMenuSelect, }: {
1145
1176
  * 「未配置聊天服务」提示并 console.warn,不抛错。组合逻辑与
1146
1177
  * createChatWorkspace 共用内部 ChatComposition(决策 D5)。
1147
1178
  */
1148
- declare function Chat({ title, greeting, subtitle, suggestions, conversationId, params, showHeader, menu, activeMenuKey, sidebar, toolbarStart, toolbarEnd, composerFooter, composerBottom, hideToolbar, headerExtra, header, headerActions, editableTitle, onExport, onThemeChange, onClear, onTitleChange, models, model, onModelChange, modelPlacement, contexts, onContextsChange, messageActions, onMessageAction, artifact, panelOpen, onPanelClose, inspector, onArtifact, onOpenArtifact, onSelectArtifact, className, onSend, onMenuSelect, }: ChatProps): ReactNode;
1179
+ declare function Chat({ title, greeting, subtitle, suggestions, conversationId, params, showHeader, menu, activeMenuKey, sidebar, toolbarStart, toolbarEnd, composerFooter, composerBottom, hideToolbar, headerExtra, header, headerActions, editableTitle, onExport, onThemeChange, onClear, onTitleChange, models, model, onModelChange, modelPlacement, contexts, onContextsChange, messageActions, onMessageAction, artifact, panelOpen, onPanelClose, inspector, onArtifact, onOpenArtifact, onOpenArtifactList, onSelectArtifact, className, onSend, onMenuSelect, }: ChatProps): ReactNode;
1149
1180
  /** Chat 的 DSL 组件类型名 */
1150
1181
  declare const CHAT_COMPONENT_TYPE = "Chat";
1151
1182
  /**
@@ -1208,6 +1239,24 @@ declare const CHAT_SHELL_COMPONENT_TYPE = "ChatShell";
1208
1239
  */
1209
1240
  declare function registerChatShellComponent(registry: Registry<unknown>): void;
1210
1241
 
1242
+ /**
1243
+ * artifact 卡片(spec: chat-chrome-dsl / chat-artifact-panel):
1244
+ * 整卡可点击的产物卡片——文件类型图标(着色图标盒,扩展名优先
1245
+ * kind 兜底)+ 标题 + 元信息行(尺寸 · 类型标签)+ 右上箭头,
1246
+ * 点击经 invokeChatOpenArtifact 走 chat.openArtifact 同一 handlers
1247
+ * 注册表(DSL 片段与 fallback 共用本组件,行为零分叉)。
1248
+ *
1249
+ * 图标盒按文件类型着色(tone:表格 green / 数据 amber / 代码 blue /
1250
+ * 图片 violet / 文档与兜底 slate),修饰类
1251
+ * pactor-chat-artifact-card--{tone} 挂在卡片根上。
1252
+ */
1253
+ /** 卡片元信息行:尺寸(meta.size 字节数)· 类型标签(扩展名大写,缺省 kind 大写) */
1254
+ declare function artifactCardMeta(artifact: ChatArtifact): string;
1255
+ /** 产物卡片本体(chat 内部组件,DSL 片段与 fallback 共用) */
1256
+ declare function ChatArtifactCard({ artifact, }: {
1257
+ artifact: ChatArtifact;
1258
+ }): ReactNode;
1259
+
1211
1260
  /**
1212
1261
  * 侧栏抽屉 context(spec: chat-app-shell):侧栏内容(如导航项)在导航后
1213
1262
  * 调用 `close()` 关闭移动端抽屉;不在 AppShell 内时返回 null,
@@ -1395,8 +1444,10 @@ interface ChatViewProps extends Pick<ComposerProps, 'attachments' | 'onAttachmen
1395
1444
  * 产出物事件);同一 part 只触发一次,框架不擅自打开面板
1396
1445
  */
1397
1446
  onArtifact?: (artifact: ChatArtifact) => void;
1398
- /** artifact 卡片"在面板中打开"回调(透传 PartRenderer) */
1447
+ /** artifact 卡片"在面板中打开"回调(整卡点击,经包级 handlers 桥接) */
1399
1448
  onOpenArtifact?: (artifact: ChatArtifact) => void;
1449
+ /** 卡片区"查看所有产物"回调(打开面板并定位产物目录视图) */
1450
+ onOpenArtifactList?: () => void;
1400
1451
  /**
1401
1452
  * 内建模型选择(spec: chat-model-selector,决策 D5):
1402
1453
  * `model` + `onModelChange` 同时提供即受控(以 props 为准);
@@ -1438,7 +1489,7 @@ interface ChatViewProps extends Pick<ComposerProps, 'attachments' | 'onAttachmen
1438
1489
  composerBottom?: ReactNode;
1439
1490
  className?: string;
1440
1491
  }
1441
- declare function ChatView({ store, transport, onSend, safeRegistry, capabilities, permission, confirm, conversationId, user, params, greeting, subtitle, suggestions, className, onArtifact, onOpenArtifact, attachments, onAttachmentsChange, onAttachFiles, onAttachmentClick, toolbarStart, toolbarEnd, composerFooter, hideToolbar, onMentionTrigger, onPlusMenu, models, model, onModelChange, modelPlacement, contexts, onContextsChange, callService, messageActions, onMessageAction, composerBottom, }: ChatViewProps): react.JSX.Element;
1492
+ declare function ChatView({ store, transport, onSend, safeRegistry, capabilities, permission, confirm, conversationId, user, params, greeting, subtitle, suggestions, className, onArtifact, onOpenArtifact, onOpenArtifactList, attachments, onAttachmentsChange, onAttachFiles, onAttachmentClick, toolbarStart, toolbarEnd, composerFooter, hideToolbar, onMentionTrigger, onPlusMenu, models, model, onModelChange, modelPlacement, contexts, onContextsChange, callService, messageActions, onMessageAction, composerBottom, }: ChatViewProps): react.JSX.Element;
1442
1493
 
1443
1494
  /**
1444
1495
  * ActivityTrace(spec: chat-activity-trace,设计决策 D1/D4):
@@ -1498,10 +1549,13 @@ interface MessageBubbleProps {
1498
1549
  callService?: CallChatService;
1499
1550
  /** 全部动作(含内建)点击的并行通知 */
1500
1551
  onMessageAction?: (actionId: string, message: ChatMessage) => void;
1501
- /** artifact 卡片"在面板中打开"回调(透传 PartRenderer) */
1502
- onOpenArtifact?: (artifact: ChatArtifact) => void;
1503
1552
  }
1504
- declare function MessageBubble({ message, runtime, scope, showRegenerate, onRegenerate, onRetry, onEditResend, messageActions, callService, onMessageAction, onOpenArtifact, }: MessageBubbleProps): react.JSX.Element;
1553
+ /**
1554
+ * 消息时间格式化(assistant 消息底部时间戳):
1555
+ * 当天 HH:mm;非当天 M月d日 HH:mm
1556
+ */
1557
+ declare function formatMessageTime(ts: number, now?: number): string;
1558
+ declare function MessageBubble({ message, runtime, scope, showRegenerate, onRegenerate, onRetry, onEditResend, messageActions, callService, onMessageAction, }: MessageBubbleProps): react.JSX.Element;
1505
1559
 
1506
1560
  /**
1507
1561
  * MessageActions(spec: chat-message-actions / 消息操作条):
@@ -1555,8 +1609,8 @@ declare function MessageActions({ message, actions, showRegenerate, onRegenerate
1555
1609
  * - tool-call / tool-result / thinking → 不在此渲染(由 assistant 消息
1556
1610
  * 顶部的 ActivityTrace 配对 / 折叠呈现,见 chat-activity-trace)
1557
1611
  * - error → 自绘警示条;status → 弱提示文本
1558
- * - artifact → 产出物卡片(标题 + kind 角标 + "在面板中打开"按钮,
1559
- * spec: chat-artifact-panel)
1612
+ * - artifact → 产出物卡片(ChatArtifactCard 内部组件:着色图标盒 +
1613
+ * 标题 + 元信息 + 右上箭头,整卡点击打开面板,spec: chat-artifact-panel)
1560
1614
  *
1561
1615
  * 视图零 antd 依赖,颜色经 `@pactor-app/chat/styles.css` 的
1562
1616
  * `--pactor-chat-*` 变量表达。
@@ -1569,14 +1623,12 @@ interface PartRendererProps {
1569
1623
  scope?: ChatScope;
1570
1624
  /** 所属消息是否流式中(text/markdown 启用平滑揭示) */
1571
1625
  streaming?: boolean;
1572
- /** artifact 卡片"在面板中打开"回调(spec: chat-artifact-panel) */
1573
- onOpenArtifact?: (artifact: ChatArtifact) => void;
1574
1626
  }
1575
1627
  /** 白名单外组件的受控占位(注册名 ChatDenied,见 dsl-guard) */
1576
1628
  declare function ChatDenied({ deniedType }: {
1577
1629
  deniedType?: string;
1578
1630
  }): react.JSX.Element;
1579
- declare function PartRenderer({ part, runtime, scope, streaming, onOpenArtifact }: PartRendererProps): react.JSX.Element | null;
1631
+ declare function PartRenderer({ part, runtime, scope, streaming }: PartRendererProps): react.JSX.Element | null;
1580
1632
 
1581
1633
  /**
1582
1634
  * ChatLayout(设计决策 D6):chat 布局 = header(title)+ ChatView 区。
@@ -1603,4 +1655,4 @@ interface ChatLayoutRegistry {
1603
1655
  /** 注册 chat 布局(已注册时不覆盖,与 createLayoutRegistry 约定一致) */
1604
1656
  declare function registerChatLayout(layoutRegistry: ChatLayoutRegistry): void;
1605
1657
 
1606
- export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore, type ArtifactTreeNode, type ArtifactViewer, type ArtifactViewers, type BuiltinMessageAction, CHAT_COMPONENT_TYPE, CHAT_DENIED_TYPE, CHAT_LAYOUT_TYPE, CHAT_SHELL_COMPONENT_TYPE, type CapabilityActionDeps, type CapabilityHandler, Chat, type ChatArtifact, type ChatAttachment, type ChatCapabilityRegistry, type ChatConfirm, type ChatConfirmRequest, type ChatContextItem, type ChatContextSource, ChatDenied, type ChatEvent, type ChatHeaderAction, type ChatInput, ChatLayout, type ChatLayoutProps, type ChatLayoutRegistry, type ChatMenuItem, type ChatMessage, type ChatMessageAction, type ChatModelOption, type ChatPart, type ChatPermissionChecker, type ChatProps, type ChatRole, type ChatRuntime, type ChatScope, type ChatServices, ChatServicesProvider, ChatShell, type ChatShellProps, ChatSidebarMenu, type ChatSuggestion, type ChatTransport, type ChatTurnResult, ChatView, type ChatViewProps, type ChatWorkspaceProps, type ChatWorkspaceServices, Composer, type ComposerProps, ConversationStore, type CreateChatRuntimeOptions, DEFAULT_CHAT_GREETING, EmptyState, type EmptyStateProps, type ManualChatDriver, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, type MessagePatch, type MessageStatus, type PartPatch, type PartRef, PartRenderer, type PartRendererProps, type PartStatus, type RunChatTurnOptions, type StreamingMode, type ToolCallStatus, type ToolTraceEntry, type UseChatAutoScrollOptions, type UseChatAutoScrollResult, type UseSmoothStreamTextOptions, applyChatEvent, buildArtifactBlob, buildArtifactTree, buildChatScope, collectArtifacts, collectMessageText, createChatComponentRegistry, createChatId, createChatRuntime, createChatWorkspace, createManualDriver, createSafeRegistry, detectStreamingMode, downloadArtifact, guardChatDsl, isImageArtifact, mergeArtifacts, pairToolTraces, registerCapabilityAction, registerChatComponent, registerChatLayout, registerChatShellComponent, resolveArtifactFileType, resolveArtifactFilename, runChatTurn, runRegenerateTurn, saveBlob, useChatAutoScroll, useChatServices, useSidebarDrawer, useSmoothStreamText };
1658
+ export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, type ArtifactIconSpec, type ArtifactIconTone, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore, type ArtifactTreeNode, type ArtifactViewer, type ArtifactViewers, type BuiltinMessageAction, CHAT_COMPONENT_TYPE, CHAT_DENIED_TYPE, CHAT_LAYOUT_TYPE, CHAT_SHELL_COMPONENT_TYPE, type CapabilityActionDeps, type CapabilityHandler, Chat, type ChatArtifact, ChatArtifactCard, type ChatAttachment, type ChatCapabilityRegistry, type ChatConfirm, type ChatConfirmRequest, type ChatContextItem, type ChatContextSource, ChatDenied, type ChatEvent, type ChatHeaderAction, type ChatInput, ChatLayout, type ChatLayoutProps, type ChatLayoutRegistry, type ChatMenuItem, type ChatMessage, type ChatMessageAction, type ChatModelOption, type ChatPart, type ChatPermissionChecker, type ChatProps, type ChatRole, type ChatRuntime, type ChatScope, type ChatServices, ChatServicesProvider, ChatShell, type ChatShellProps, ChatSidebarMenu, type ChatSuggestion, type ChatTransport, type ChatTurnResult, ChatView, type ChatViewProps, type ChatWorkspaceProps, type ChatWorkspaceServices, Composer, type ComposerProps, ConversationStore, type CreateChatRuntimeOptions, DEFAULT_CHAT_GREETING, EmptyState, type EmptyStateProps, type ManualChatDriver, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, type MessagePatch, type MessageStatus, type PartPatch, type PartRef, PartRenderer, type PartRendererProps, type PartStatus, type RunChatTurnOptions, type StreamingMode, type ToolCallStatus, type ToolTraceEntry, type UseChatAutoScrollOptions, type UseChatAutoScrollResult, type UseSmoothStreamTextOptions, applyChatEvent, artifactCardMeta, buildArtifactBlob, buildArtifactTree, buildChatScope, collectArtifacts, collectMessageText, createChatComponentRegistry, createChatId, createChatRuntime, createChatWorkspace, createManualDriver, createSafeRegistry, detectStreamingMode, downloadArtifact, formatArtifactSize, formatMessageTime, guardChatDsl, isImageArtifact, mergeArtifacts, pairToolTraces, registerCapabilityAction, registerChatComponent, registerChatLayout, registerChatShellComponent, resolveArtifactFileType, resolveArtifactFilename, resolveArtifactIcon, resolveArtifactIconName, runChatTurn, runRegenerateTurn, saveBlob, useChatAutoScroll, useChatServices, useSidebarDrawer, useSmoothStreamText };
package/dist/index.d.ts CHANGED
@@ -36,6 +36,25 @@ declare const ARTIFACT_IMAGE_EXTENSIONS: readonly string[];
36
36
  declare function resolveArtifactFileType(artifact: ChatArtifact): string | null;
37
37
  /** 是否图片类产物(扩展名命中内建图片集合) */
38
38
  declare function isImageArtifact(artifact: ChatArtifact): boolean;
39
+ /** 产物图标的着色档位(卡片图标底色 / 前景色按 tone 取色) */
40
+ type ArtifactIconTone = 'green' | 'blue' | 'amber' | 'violet' | 'slate';
41
+ /** 产物图标规格:ui Icon 白名单名 + 着色档位 */
42
+ interface ArtifactIconSpec {
43
+ name: string;
44
+ tone: ArtifactIconTone;
45
+ }
46
+ /**
47
+ * 产物图标(图标名 + 着色档位):文件扩展名优先(图片类 → image/violet,
48
+ * 表格 / 数据 / 脚本 / 代码 / 文档按扩展名分桶),无扩展名或未知扩展名
49
+ * 时按 kind 兜底(code → code/blue、dsl → layout-grid/slate、其余
50
+ * file-text 或 file,均 slate)。卡片 / 面板下拉 / 目录树共用,
51
+ * 保证同一产物在各处图标一致。
52
+ */
53
+ declare function resolveArtifactIcon(artifact: ChatArtifact): ArtifactIconSpec;
54
+ /** 产物图标名(resolveArtifactIcon 的 name 部分,面板下拉 / 目录树用) */
55
+ declare function resolveArtifactIconName(artifact: ChatArtifact): string;
56
+ /** 产物尺寸展示(meta.size 字节数 → "512 B / 3.5 KB / 12.0 MB";非法输入返回 null) */
57
+ declare function formatArtifactSize(size: unknown): string | null;
39
58
  /** update 的补丁:id 不可改 */
40
59
  type ArtifactPatch = Partial<Omit<ChatArtifact, 'id'>>;
41
60
  /** 消息形态的最小契约(与 model.ts ChatMessage 结构化兼容,保持本文件零依赖) */
@@ -728,13 +747,21 @@ interface ArtifactPanelProps {
728
747
  artifact?: ChatArtifact | null;
729
748
  /**
730
749
  * 会话内全部产出物(多产物场景):提供后 header 左端展示目录列表
731
- * 切换钮;多于 1 个时 header 下沿展示 tab 条(kind 图标 + 名称)
750
+ * 切换钮,文件名处展示产物切换下拉
732
751
  */
733
752
  artifacts?: ChatArtifact[];
734
- /** 当前激活产出物 id(tabs 高亮;缺省取 artifact.id) */
753
+ /** 当前激活产出物 id(下拉高亮;缺省取 artifact.id) */
735
754
  activeArtifactId?: string;
736
- /** tab / 目录列表点击切换回调(受控切换,面板不自改外部状态) */
755
+ /** 下拉 / 目录列表点击切换回调(受控切换,面板不自改外部状态) */
737
756
  onSelectArtifact?: (artifact: ChatArtifact) => void;
757
+ /**
758
+ * 定位产物目录视图的请求信号(卡片区"查看所有产物"):数值变化即
759
+ * 切换列表视图并经 onViewRequestConsumed 消费复位(消费后普通
760
+ * 打开回内容视图)
761
+ */
762
+ viewRequest?: number | null;
763
+ /** viewRequest 消费回调(组合层复位信号) */
764
+ onViewRequestConsumed?: () => void;
738
765
  /** 面板内容槽:提供时整体替代内建渲染器(标题栏保留) */
739
766
  inspector?: ReactNode;
740
767
  /** 关闭按钮 / 遮罩点击回调 */
@@ -772,7 +799,7 @@ declare function buildArtifactTree(artifacts: ChatArtifact[]): ArtifactTreeNode[
772
799
  */
773
800
  type ArtifactViewer = (artifact: ChatArtifact) => ReactNode;
774
801
  type ArtifactViewers = Record<string, ArtifactViewer>;
775
- declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, inspector, onClose, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
802
+ declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, viewRequest, onViewRequestConsumed, inspector, onClose, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
776
803
 
777
804
  /**
778
805
  * EmptyState(spec: chat-empty-state,设计决策 D0/D1):空会话欢迎页。
@@ -932,6 +959,8 @@ interface ChatWorkspaceProps {
932
959
  onArtifact?: (artifact: ChatArtifact) => void;
933
960
  /** 产出物卡片"在面板中打开"回调(runtime 绑定 events.onOpenArtifact 时传入) */
934
961
  onOpenArtifact?: (artifact: ChatArtifact) => void;
962
+ /** 卡片区"查看所有产物"回调(runtime 绑定 events.onOpenArtifactList 时传入) */
963
+ onOpenArtifactList?: () => void;
935
964
  /**
936
965
  * 面板 tab / 目录列表点击切换回调(runtime 绑定 events.onSelectArtifact
937
966
  * 时传入;受控典型接法:setState artifact=${event.artifact})。
@@ -1114,6 +1143,8 @@ interface ChatProps {
1114
1143
  onArtifact?: (artifact: ChatArtifact) => void;
1115
1144
  /** 产出物卡片"在面板中打开"按钮点击回调(event 作用域含 artifact;受控场景的开面板入口) */
1116
1145
  onOpenArtifact?: (artifact: ChatArtifact) => void;
1146
+ /** 卡片区"查看所有产物"点击回调(event 为空对象 {};受控典型接法:setState panelOpen=true,面板自动定位产物目录视图) */
1147
+ onOpenArtifactList?: () => void;
1117
1148
  /** 面板 tab / 目录列表点击切换回调(event 作用域含 artifact;受控典型接法:setState artifact=${event.artifact}) */
1118
1149
  onSelectArtifact?: (artifact: ChatArtifact) => void;
1119
1150
  className?: string;
@@ -1145,7 +1176,7 @@ declare function ChatSidebarMenu({ menu, activeMenuKey, onMenuSelect, }: {
1145
1176
  * 「未配置聊天服务」提示并 console.warn,不抛错。组合逻辑与
1146
1177
  * createChatWorkspace 共用内部 ChatComposition(决策 D5)。
1147
1178
  */
1148
- declare function Chat({ title, greeting, subtitle, suggestions, conversationId, params, showHeader, menu, activeMenuKey, sidebar, toolbarStart, toolbarEnd, composerFooter, composerBottom, hideToolbar, headerExtra, header, headerActions, editableTitle, onExport, onThemeChange, onClear, onTitleChange, models, model, onModelChange, modelPlacement, contexts, onContextsChange, messageActions, onMessageAction, artifact, panelOpen, onPanelClose, inspector, onArtifact, onOpenArtifact, onSelectArtifact, className, onSend, onMenuSelect, }: ChatProps): ReactNode;
1179
+ declare function Chat({ title, greeting, subtitle, suggestions, conversationId, params, showHeader, menu, activeMenuKey, sidebar, toolbarStart, toolbarEnd, composerFooter, composerBottom, hideToolbar, headerExtra, header, headerActions, editableTitle, onExport, onThemeChange, onClear, onTitleChange, models, model, onModelChange, modelPlacement, contexts, onContextsChange, messageActions, onMessageAction, artifact, panelOpen, onPanelClose, inspector, onArtifact, onOpenArtifact, onOpenArtifactList, onSelectArtifact, className, onSend, onMenuSelect, }: ChatProps): ReactNode;
1149
1180
  /** Chat 的 DSL 组件类型名 */
1150
1181
  declare const CHAT_COMPONENT_TYPE = "Chat";
1151
1182
  /**
@@ -1208,6 +1239,24 @@ declare const CHAT_SHELL_COMPONENT_TYPE = "ChatShell";
1208
1239
  */
1209
1240
  declare function registerChatShellComponent(registry: Registry<unknown>): void;
1210
1241
 
1242
+ /**
1243
+ * artifact 卡片(spec: chat-chrome-dsl / chat-artifact-panel):
1244
+ * 整卡可点击的产物卡片——文件类型图标(着色图标盒,扩展名优先
1245
+ * kind 兜底)+ 标题 + 元信息行(尺寸 · 类型标签)+ 右上箭头,
1246
+ * 点击经 invokeChatOpenArtifact 走 chat.openArtifact 同一 handlers
1247
+ * 注册表(DSL 片段与 fallback 共用本组件,行为零分叉)。
1248
+ *
1249
+ * 图标盒按文件类型着色(tone:表格 green / 数据 amber / 代码 blue /
1250
+ * 图片 violet / 文档与兜底 slate),修饰类
1251
+ * pactor-chat-artifact-card--{tone} 挂在卡片根上。
1252
+ */
1253
+ /** 卡片元信息行:尺寸(meta.size 字节数)· 类型标签(扩展名大写,缺省 kind 大写) */
1254
+ declare function artifactCardMeta(artifact: ChatArtifact): string;
1255
+ /** 产物卡片本体(chat 内部组件,DSL 片段与 fallback 共用) */
1256
+ declare function ChatArtifactCard({ artifact, }: {
1257
+ artifact: ChatArtifact;
1258
+ }): ReactNode;
1259
+
1211
1260
  /**
1212
1261
  * 侧栏抽屉 context(spec: chat-app-shell):侧栏内容(如导航项)在导航后
1213
1262
  * 调用 `close()` 关闭移动端抽屉;不在 AppShell 内时返回 null,
@@ -1395,8 +1444,10 @@ interface ChatViewProps extends Pick<ComposerProps, 'attachments' | 'onAttachmen
1395
1444
  * 产出物事件);同一 part 只触发一次,框架不擅自打开面板
1396
1445
  */
1397
1446
  onArtifact?: (artifact: ChatArtifact) => void;
1398
- /** artifact 卡片"在面板中打开"回调(透传 PartRenderer) */
1447
+ /** artifact 卡片"在面板中打开"回调(整卡点击,经包级 handlers 桥接) */
1399
1448
  onOpenArtifact?: (artifact: ChatArtifact) => void;
1449
+ /** 卡片区"查看所有产物"回调(打开面板并定位产物目录视图) */
1450
+ onOpenArtifactList?: () => void;
1400
1451
  /**
1401
1452
  * 内建模型选择(spec: chat-model-selector,决策 D5):
1402
1453
  * `model` + `onModelChange` 同时提供即受控(以 props 为准);
@@ -1438,7 +1489,7 @@ interface ChatViewProps extends Pick<ComposerProps, 'attachments' | 'onAttachmen
1438
1489
  composerBottom?: ReactNode;
1439
1490
  className?: string;
1440
1491
  }
1441
- declare function ChatView({ store, transport, onSend, safeRegistry, capabilities, permission, confirm, conversationId, user, params, greeting, subtitle, suggestions, className, onArtifact, onOpenArtifact, attachments, onAttachmentsChange, onAttachFiles, onAttachmentClick, toolbarStart, toolbarEnd, composerFooter, hideToolbar, onMentionTrigger, onPlusMenu, models, model, onModelChange, modelPlacement, contexts, onContextsChange, callService, messageActions, onMessageAction, composerBottom, }: ChatViewProps): react.JSX.Element;
1492
+ declare function ChatView({ store, transport, onSend, safeRegistry, capabilities, permission, confirm, conversationId, user, params, greeting, subtitle, suggestions, className, onArtifact, onOpenArtifact, onOpenArtifactList, attachments, onAttachmentsChange, onAttachFiles, onAttachmentClick, toolbarStart, toolbarEnd, composerFooter, hideToolbar, onMentionTrigger, onPlusMenu, models, model, onModelChange, modelPlacement, contexts, onContextsChange, callService, messageActions, onMessageAction, composerBottom, }: ChatViewProps): react.JSX.Element;
1442
1493
 
1443
1494
  /**
1444
1495
  * ActivityTrace(spec: chat-activity-trace,设计决策 D1/D4):
@@ -1498,10 +1549,13 @@ interface MessageBubbleProps {
1498
1549
  callService?: CallChatService;
1499
1550
  /** 全部动作(含内建)点击的并行通知 */
1500
1551
  onMessageAction?: (actionId: string, message: ChatMessage) => void;
1501
- /** artifact 卡片"在面板中打开"回调(透传 PartRenderer) */
1502
- onOpenArtifact?: (artifact: ChatArtifact) => void;
1503
1552
  }
1504
- declare function MessageBubble({ message, runtime, scope, showRegenerate, onRegenerate, onRetry, onEditResend, messageActions, callService, onMessageAction, onOpenArtifact, }: MessageBubbleProps): react.JSX.Element;
1553
+ /**
1554
+ * 消息时间格式化(assistant 消息底部时间戳):
1555
+ * 当天 HH:mm;非当天 M月d日 HH:mm
1556
+ */
1557
+ declare function formatMessageTime(ts: number, now?: number): string;
1558
+ declare function MessageBubble({ message, runtime, scope, showRegenerate, onRegenerate, onRetry, onEditResend, messageActions, callService, onMessageAction, }: MessageBubbleProps): react.JSX.Element;
1505
1559
 
1506
1560
  /**
1507
1561
  * MessageActions(spec: chat-message-actions / 消息操作条):
@@ -1555,8 +1609,8 @@ declare function MessageActions({ message, actions, showRegenerate, onRegenerate
1555
1609
  * - tool-call / tool-result / thinking → 不在此渲染(由 assistant 消息
1556
1610
  * 顶部的 ActivityTrace 配对 / 折叠呈现,见 chat-activity-trace)
1557
1611
  * - error → 自绘警示条;status → 弱提示文本
1558
- * - artifact → 产出物卡片(标题 + kind 角标 + "在面板中打开"按钮,
1559
- * spec: chat-artifact-panel)
1612
+ * - artifact → 产出物卡片(ChatArtifactCard 内部组件:着色图标盒 +
1613
+ * 标题 + 元信息 + 右上箭头,整卡点击打开面板,spec: chat-artifact-panel)
1560
1614
  *
1561
1615
  * 视图零 antd 依赖,颜色经 `@pactor-app/chat/styles.css` 的
1562
1616
  * `--pactor-chat-*` 变量表达。
@@ -1569,14 +1623,12 @@ interface PartRendererProps {
1569
1623
  scope?: ChatScope;
1570
1624
  /** 所属消息是否流式中(text/markdown 启用平滑揭示) */
1571
1625
  streaming?: boolean;
1572
- /** artifact 卡片"在面板中打开"回调(spec: chat-artifact-panel) */
1573
- onOpenArtifact?: (artifact: ChatArtifact) => void;
1574
1626
  }
1575
1627
  /** 白名单外组件的受控占位(注册名 ChatDenied,见 dsl-guard) */
1576
1628
  declare function ChatDenied({ deniedType }: {
1577
1629
  deniedType?: string;
1578
1630
  }): react.JSX.Element;
1579
- declare function PartRenderer({ part, runtime, scope, streaming, onOpenArtifact }: PartRendererProps): react.JSX.Element | null;
1631
+ declare function PartRenderer({ part, runtime, scope, streaming }: PartRendererProps): react.JSX.Element | null;
1580
1632
 
1581
1633
  /**
1582
1634
  * ChatLayout(设计决策 D6):chat 布局 = header(title)+ ChatView 区。
@@ -1603,4 +1655,4 @@ interface ChatLayoutRegistry {
1603
1655
  /** 注册 chat 布局(已注册时不覆盖,与 createLayoutRegistry 约定一致) */
1604
1656
  declare function registerChatLayout(layoutRegistry: ChatLayoutRegistry): void;
1605
1657
 
1606
- export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore, type ArtifactTreeNode, type ArtifactViewer, type ArtifactViewers, type BuiltinMessageAction, CHAT_COMPONENT_TYPE, CHAT_DENIED_TYPE, CHAT_LAYOUT_TYPE, CHAT_SHELL_COMPONENT_TYPE, type CapabilityActionDeps, type CapabilityHandler, Chat, type ChatArtifact, type ChatAttachment, type ChatCapabilityRegistry, type ChatConfirm, type ChatConfirmRequest, type ChatContextItem, type ChatContextSource, ChatDenied, type ChatEvent, type ChatHeaderAction, type ChatInput, ChatLayout, type ChatLayoutProps, type ChatLayoutRegistry, type ChatMenuItem, type ChatMessage, type ChatMessageAction, type ChatModelOption, type ChatPart, type ChatPermissionChecker, type ChatProps, type ChatRole, type ChatRuntime, type ChatScope, type ChatServices, ChatServicesProvider, ChatShell, type ChatShellProps, ChatSidebarMenu, type ChatSuggestion, type ChatTransport, type ChatTurnResult, ChatView, type ChatViewProps, type ChatWorkspaceProps, type ChatWorkspaceServices, Composer, type ComposerProps, ConversationStore, type CreateChatRuntimeOptions, DEFAULT_CHAT_GREETING, EmptyState, type EmptyStateProps, type ManualChatDriver, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, type MessagePatch, type MessageStatus, type PartPatch, type PartRef, PartRenderer, type PartRendererProps, type PartStatus, type RunChatTurnOptions, type StreamingMode, type ToolCallStatus, type ToolTraceEntry, type UseChatAutoScrollOptions, type UseChatAutoScrollResult, type UseSmoothStreamTextOptions, applyChatEvent, buildArtifactBlob, buildArtifactTree, buildChatScope, collectArtifacts, collectMessageText, createChatComponentRegistry, createChatId, createChatRuntime, createChatWorkspace, createManualDriver, createSafeRegistry, detectStreamingMode, downloadArtifact, guardChatDsl, isImageArtifact, mergeArtifacts, pairToolTraces, registerCapabilityAction, registerChatComponent, registerChatLayout, registerChatShellComponent, resolveArtifactFileType, resolveArtifactFilename, runChatTurn, runRegenerateTurn, saveBlob, useChatAutoScroll, useChatServices, useSidebarDrawer, useSmoothStreamText };
1658
+ export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, type ArtifactIconSpec, type ArtifactIconTone, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore, type ArtifactTreeNode, type ArtifactViewer, type ArtifactViewers, type BuiltinMessageAction, CHAT_COMPONENT_TYPE, CHAT_DENIED_TYPE, CHAT_LAYOUT_TYPE, CHAT_SHELL_COMPONENT_TYPE, type CapabilityActionDeps, type CapabilityHandler, Chat, type ChatArtifact, ChatArtifactCard, type ChatAttachment, type ChatCapabilityRegistry, type ChatConfirm, type ChatConfirmRequest, type ChatContextItem, type ChatContextSource, ChatDenied, type ChatEvent, type ChatHeaderAction, type ChatInput, ChatLayout, type ChatLayoutProps, type ChatLayoutRegistry, type ChatMenuItem, type ChatMessage, type ChatMessageAction, type ChatModelOption, type ChatPart, type ChatPermissionChecker, type ChatProps, type ChatRole, type ChatRuntime, type ChatScope, type ChatServices, ChatServicesProvider, ChatShell, type ChatShellProps, ChatSidebarMenu, type ChatSuggestion, type ChatTransport, type ChatTurnResult, ChatView, type ChatViewProps, type ChatWorkspaceProps, type ChatWorkspaceServices, Composer, type ComposerProps, ConversationStore, type CreateChatRuntimeOptions, DEFAULT_CHAT_GREETING, EmptyState, type EmptyStateProps, type ManualChatDriver, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, type MessagePatch, type MessageStatus, type PartPatch, type PartRef, PartRenderer, type PartRendererProps, type PartStatus, type RunChatTurnOptions, type StreamingMode, type ToolCallStatus, type ToolTraceEntry, type UseChatAutoScrollOptions, type UseChatAutoScrollResult, type UseSmoothStreamTextOptions, applyChatEvent, artifactCardMeta, buildArtifactBlob, buildArtifactTree, buildChatScope, collectArtifacts, collectMessageText, createChatComponentRegistry, createChatId, createChatRuntime, createChatWorkspace, createManualDriver, createSafeRegistry, detectStreamingMode, downloadArtifact, formatArtifactSize, formatMessageTime, guardChatDsl, isImageArtifact, mergeArtifacts, pairToolTraces, registerCapabilityAction, registerChatComponent, registerChatLayout, registerChatShellComponent, resolveArtifactFileType, resolveArtifactFilename, resolveArtifactIcon, resolveArtifactIconName, runChatTurn, runRegenerateTurn, saveBlob, useChatAutoScroll, useChatServices, useSidebarDrawer, useSmoothStreamText };