@pactor-app/chat 1.44.0 → 1.46.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/chunk-TBPUSGKL.js +2633 -0
- package/dist/components/index.cjs +2651 -0
- package/dist/components/index.d.cts +793 -0
- package/dist/components/index.d.ts +793 -0
- package/dist/components/index.js +52 -0
- package/dist/download-DnP2uArc.d.cts +134 -0
- package/dist/download-DnP2uArc.d.ts +134 -0
- package/dist/index.cjs +3876 -1685
- package/dist/index.d.cts +41 -69
- package/dist/index.d.ts +41 -69
- package/dist/index.js +624 -1002
- package/package.json +28 -10
- package/styles.css +1154 -844
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DslNode, Registry, PermissionConfig } from '@pactor-app/core';
|
|
2
|
+
import { A as ArtifactViewers } from './download-DnP2uArc.cjs';
|
|
3
|
+
export { c as ArtifactTreeNode, d as ArtifactViewer, e as buildArtifactBlob, f as buildArtifactTree, g as downloadArtifact, r as resolveArtifactFilename, s as saveBlob } from './download-DnP2uArc.cjs';
|
|
2
4
|
import { ActionContext, ActionRegistry, RuntimeContext, ActionEngine } from '@pactor-app/runtime';
|
|
3
5
|
import { PermissionStore } from '@pactor-app/permission';
|
|
4
6
|
import * as react from 'react';
|
|
@@ -338,21 +340,6 @@ declare class ConversationStore {
|
|
|
338
340
|
private commit;
|
|
339
341
|
}
|
|
340
342
|
|
|
341
|
-
/** 下载文件名:title 已带扩展名原样使用;否则补 fileType / kind 缺省扩展名 */
|
|
342
|
-
declare function resolveArtifactFilename(artifact: ChatArtifact): string;
|
|
343
|
-
/**
|
|
344
|
-
* 构建下载 Blob;图片内容为 http(s) URL 时返回 null(由 downloadArtifact
|
|
345
|
-
* 走 fetch 取回,失败降级新标签打开)
|
|
346
|
-
*/
|
|
347
|
-
declare function buildArtifactBlob(artifact: ChatArtifact): Blob | null;
|
|
348
|
-
/** 触发浏览器下载(Object URL + 临时锚点) */
|
|
349
|
-
declare function saveBlob(blob: Blob, filename: string): void;
|
|
350
|
-
/**
|
|
351
|
-
* 下载产物:文本类 / dsl JSON / 图片 data URL 与 svg 标记直接存 Blob;
|
|
352
|
-
* 图片 http(s) URL fetch 取回(跨域失败降级新标签打开)
|
|
353
|
-
*/
|
|
354
|
-
declare function downloadArtifact(artifact: ChatArtifact): Promise<void>;
|
|
355
|
-
|
|
356
343
|
/**
|
|
357
344
|
* Streaming 事件模型与 reducer(设计决策 D2,设计文档第 69 节)。
|
|
358
345
|
*
|
|
@@ -746,16 +733,17 @@ interface UseChatAutoScrollResult {
|
|
|
746
733
|
declare function useChatAutoScroll({ messageCount, lastContentLength, isStreaming, }: UseChatAutoScrollOptions): UseChatAutoScrollResult;
|
|
747
734
|
|
|
748
735
|
/**
|
|
749
|
-
* ArtifactPanel(spec: chat-artifact-panel
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
736
|
+
* ArtifactPanel(spec: chat-artifact-panel):chat 组合层——展示由包内
|
|
737
|
+
* 展示组件(src/components/ArtifactPanel,单一实现,自 @pactor-app/ui
|
|
738
|
+
* 迁入)承载,本层保留 chat 运行时
|
|
739
|
+
* 接线:整对象 onSelectArtifact(ui 为 id 形式,经 artifacts 回查)、
|
|
740
|
+
* 面板皮肤类(pactor-chat-inspector)、拖拽调宽(resizable 常开)与
|
|
741
|
+
* chrome DSL 标题栏(ChatPanel* 内部组件 + chat.panelClose /
|
|
742
|
+
* panelToggleList / panelDownload 包级动作桥接,无 renderer 或类型
|
|
743
|
+
* 缺失时回退同一组内部组件的手写组合)。
|
|
757
744
|
*
|
|
758
|
-
*
|
|
745
|
+
* 目录列表视图状态由本层受控持有(ui view / onViewChange),chrome
|
|
746
|
+
* 标题栏的目录钮 / 切换下拉经 ChatPanelContext 共享同一状态。
|
|
759
747
|
*/
|
|
760
748
|
interface ArtifactPanelProps {
|
|
761
749
|
/** 当前产出物;null 时内容区为空态(inspector 槽场景常见) */
|
|
@@ -781,6 +769,8 @@ interface ArtifactPanelProps {
|
|
|
781
769
|
inspector?: ReactNode;
|
|
782
770
|
/** 关闭按钮 / 遮罩点击回调 */
|
|
783
771
|
onClose?: () => void;
|
|
772
|
+
/** 下载回调;缺省内部走浏览器下载(downloadArtifact) */
|
|
773
|
+
onDownload?: (artifact: ChatArtifact) => void;
|
|
784
774
|
/** dsl 产出物活预览的 Safe Registry;缺省时 dsl 内容渲染降级块 */
|
|
785
775
|
safeRegistry?: Registry<unknown>;
|
|
786
776
|
/** 注入 dsl 预览作用域 user */
|
|
@@ -792,29 +782,7 @@ interface ArtifactPanelProps {
|
|
|
792
782
|
artifactViewers?: ArtifactViewers;
|
|
793
783
|
className?: string;
|
|
794
784
|
}
|
|
795
|
-
|
|
796
|
-
* 产物目录树(纯函数):按 id 的 '/' 分段建目录层级——
|
|
797
|
-
* id 形如 `reports/q3/月报` 时产出 reports → q3 两级目录;
|
|
798
|
-
* 无 '/' 分段的产物平铺在根层。目录先于文件、各自按名称排序。
|
|
799
|
-
*/
|
|
800
|
-
interface ArtifactTreeNode {
|
|
801
|
-
/** 段名(目录名或产物标题) */
|
|
802
|
-
name: string;
|
|
803
|
-
/** 完整路径(目录为 id 前缀,文件为产物 id) */
|
|
804
|
-
path: string;
|
|
805
|
-
artifact?: ChatArtifact;
|
|
806
|
-
children: ArtifactTreeNode[];
|
|
807
|
-
}
|
|
808
|
-
declare function buildArtifactTree(artifacts: ChatArtifact[]): ArtifactTreeNode[];
|
|
809
|
-
/**
|
|
810
|
-
* 自定义产物查看器(spec: chat-artifact-panel / 自定义预览):
|
|
811
|
-
* 键为扩展名(小写不带点,如 'png' / 'md')或 kind
|
|
812
|
-
* ('markdown' / 'code' / 'text' / 'dsl');扩展名键优先于 kind 键,
|
|
813
|
-
* 均优先于内建渲染器。查看器抛错不经守卫——宿主代码自负。
|
|
814
|
-
*/
|
|
815
|
-
type ArtifactViewer = (artifact: ChatArtifact) => ReactNode;
|
|
816
|
-
type ArtifactViewers = Record<string, ArtifactViewer>;
|
|
817
|
-
declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, viewRequest, onViewRequestConsumed, inspector, onClose, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
|
|
785
|
+
declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, viewRequest, onViewRequestConsumed, inspector, onClose, onDownload, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
|
|
818
786
|
|
|
819
787
|
/**
|
|
820
788
|
* EmptyState(spec: chat-empty-state,设计决策 D0/D1):空会话欢迎页。
|
|
@@ -823,10 +791,12 @@ declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelect
|
|
|
823
791
|
* 点击建议经 `onSuggestionClick` 回调交还调用方(ChatView 接入时
|
|
824
792
|
* 复用 Composer 的同一条发送路径)。
|
|
825
793
|
*
|
|
794
|
+
* 展示由 @pactor-app/ui 的 Welcome + Suggestion 组合承载(回退路径;
|
|
795
|
+
* greeting 经 titleClassName 复用 chat 皮肤的 display 衬线字体栈)。
|
|
826
796
|
* chrome DSL 渲染层(spec: chat-chrome-dsl):元素层在页面运行时内
|
|
827
|
-
* 优先经 ChromeSlot 以宿主组件(Typography / Text /
|
|
828
|
-
*
|
|
829
|
-
* 无 renderer
|
|
797
|
+
* 优先经 ChromeSlot 以宿主组件(Typography / Text / Suggestion)DSL
|
|
798
|
+
* 组合渲染,建议点击经 chat.sendSuggestion 内建动作接回同一发送路径;
|
|
799
|
+
* 无 renderer 环境或类型缺失时回退 ui 组合实现(EmptyStateFallback)。
|
|
830
800
|
*/
|
|
831
801
|
type ChatSuggestion = string | {
|
|
832
802
|
label: string;
|
|
@@ -1208,7 +1178,8 @@ declare const CHAT_COMPONENT_TYPE = "Chat";
|
|
|
1208
1178
|
*/
|
|
1209
1179
|
declare function registerChatComponent(registry: Registry<unknown>): void;
|
|
1210
1180
|
/**
|
|
1211
|
-
*
|
|
1181
|
+
* 便捷工厂:创建含全部内置组件(ui 内置 + chat 展示组件)+
|
|
1182
|
+
* Chat / ChatShell 的组件注册表,
|
|
1212
1183
|
* 直接作为 createPactorApplication 的 componentRegistry 选项:
|
|
1213
1184
|
*
|
|
1214
1185
|
* ```ts
|
|
@@ -1344,25 +1315,26 @@ type CallChatService = (name: string, params?: Record<string, unknown>) => Promi
|
|
|
1344
1315
|
|
|
1345
1316
|
/**
|
|
1346
1317
|
* Composer(spec: chat-view / Composer + chat-composer-extensions):
|
|
1347
|
-
*
|
|
1348
|
-
*
|
|
1318
|
+
* chat 组合层——展示由包内展示组件(src/components/Composer,自
|
|
1319
|
+
* @pactor-app/ui 迁入)承载(fallback 路径),本层只保留运行时接线:
|
|
1320
|
+
* 发送状态机回调映射、附件模型适配、词边界 '@'
|
|
1321
|
+
* 提及检测(内建弹层 / 调用方回调)、'+' 入口与 chrome DSL 桥接。
|
|
1349
1322
|
*
|
|
1350
|
-
* - IME
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
* 不上传);卡片点击经 `onAttachmentClick` 通知
|
|
1323
|
+
* - IME 守卫由 ui ChatInput 承担(合成中 Enter 不发送),本层不再实现
|
|
1324
|
+
* - 附件(D3):受控 `attachments` + `onAttachmentsChange`;粘贴 / 拖拽 /
|
|
1325
|
+
* 文件选择产出 `File[]` 经 `onAttachFiles` 交给调用方(包内不上传);
|
|
1326
|
+
* 卡片点击经 `onAttachmentClick` 通知
|
|
1355
1327
|
* - 扩展槽:`toolbarStart` / `toolbarEnd` 渲染槽;词边界 `@` 触发
|
|
1356
1328
|
* `onMentionTrigger(query, anchorRect)`;"+" 按钮触发
|
|
1357
1329
|
* `onPlusMenu(anchorRect)`(无回调不渲染入口)
|
|
1358
1330
|
* - 内建特性(chat-builtin-features):models 非空时工具栏右端渲染
|
|
1359
|
-
* 模型 chip(
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1331
|
+
* 模型 chip(toolbarEnd 之前);contexts 配置且未注入调用方回调时
|
|
1332
|
+
* 启用内建 @ 提及 / + 菜单弹层,选中项追加为输入区上方的上下文
|
|
1333
|
+
* chips(受控:contextChips + onContextChipsChange)
|
|
1362
1334
|
* - chrome DSL 渲染层(spec: chat-composer-on-chatinput):呈现层在
|
|
1363
1335
|
* DSL 环境经宿主 ChatInput 组合渲染(非受控 + chat.composerSubmit
|
|
1364
|
-
* 桥接 + 冒泡同步 / 附件承接),无 renderer
|
|
1365
|
-
*
|
|
1336
|
+
* 桥接 + 冒泡同步 / 附件承接),无 renderer 或类型缺失时回退
|
|
1337
|
+
* ui Composer 组合路径,两条路径交互语义一致
|
|
1366
1338
|
*/
|
|
1367
1339
|
interface ComposerProps {
|
|
1368
1340
|
/** 发送回调;输入框在回调后清空 */
|
|
@@ -1542,11 +1514,11 @@ declare function ActivityTrace({ message }: ActivityTraceProps): react.JSX.Eleme
|
|
|
1542
1514
|
|
|
1543
1515
|
/**
|
|
1544
1516
|
* MessageBubble:按 role 区分呈现(参考 DeepTutor web 消息区设计)——
|
|
1545
|
-
* user
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1548
|
-
* system 居中弱提示。
|
|
1549
|
-
* 颜色经 `--pactor-chat-*`
|
|
1517
|
+
* user 右侧气泡(ui Bubble,tinted 变体);assistant 左侧通栏排版:
|
|
1518
|
+
* 顶部 Agent 身份行(ui Sender)+ 活动轨迹区(ActivityTrace:状态头 +
|
|
1519
|
+
* thinking + 配对工具轨迹),正文 parts 按序渲染;hover 操作条
|
|
1520
|
+
* (MessageActions:复制 / 重新生成 / 编辑 / 重试);system 居中弱提示。
|
|
1521
|
+
* 颜色经 `--pactor-chat-*` 变量与 ui 语义令牌表达。
|
|
1550
1522
|
*/
|
|
1551
1523
|
interface MessageBubbleProps {
|
|
1552
1524
|
message: ChatMessage;
|
|
@@ -1686,4 +1658,4 @@ interface ChatLayoutRegistry {
|
|
|
1686
1658
|
/** 注册 chat 布局(已注册时不覆盖,与 createLayoutRegistry 约定一致) */
|
|
1687
1659
|
declare function registerChatLayout(layoutRegistry: ChatLayoutRegistry): void;
|
|
1688
1660
|
|
|
1689
|
-
export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, type ArtifactIconSpec, type ArtifactIconTone, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore,
|
|
1661
|
+
export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, type ArtifactIconSpec, type ArtifactIconTone, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore, ArtifactViewers, type BuiltinMessageAction, CHAT_COMPONENT_TYPE, CHAT_DENIED_TYPE, CHAT_LAYOUT_TYPE, CHAT_SHELL_COMPONENT_TYPE, type CapabilityActionDeps, type CapabilityHandler, Chat, type ChatAgentIdentity, 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, buildChatScope, collectArtifacts, collectMessageText, createChatComponentRegistry, createChatId, createChatRuntime, createChatWorkspace, createManualDriver, createSafeRegistry, detectStreamingMode, formatArtifactSize, formatMessageTime, guardChatDsl, isImageArtifact, mergeArtifacts, pairToolTraces, registerCapabilityAction, registerChatComponent, registerChatLayout, registerChatShellComponent, resolveArtifactFileType, resolveArtifactIcon, resolveArtifactIconName, runChatTurn, runRegenerateTurn, useChatAutoScroll, useChatServices, useSidebarDrawer, useSmoothStreamText };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DslNode, Registry, PermissionConfig } from '@pactor-app/core';
|
|
2
|
+
import { A as ArtifactViewers } from './download-DnP2uArc.js';
|
|
3
|
+
export { c as ArtifactTreeNode, d as ArtifactViewer, e as buildArtifactBlob, f as buildArtifactTree, g as downloadArtifact, r as resolveArtifactFilename, s as saveBlob } from './download-DnP2uArc.js';
|
|
2
4
|
import { ActionContext, ActionRegistry, RuntimeContext, ActionEngine } from '@pactor-app/runtime';
|
|
3
5
|
import { PermissionStore } from '@pactor-app/permission';
|
|
4
6
|
import * as react from 'react';
|
|
@@ -338,21 +340,6 @@ declare class ConversationStore {
|
|
|
338
340
|
private commit;
|
|
339
341
|
}
|
|
340
342
|
|
|
341
|
-
/** 下载文件名:title 已带扩展名原样使用;否则补 fileType / kind 缺省扩展名 */
|
|
342
|
-
declare function resolveArtifactFilename(artifact: ChatArtifact): string;
|
|
343
|
-
/**
|
|
344
|
-
* 构建下载 Blob;图片内容为 http(s) URL 时返回 null(由 downloadArtifact
|
|
345
|
-
* 走 fetch 取回,失败降级新标签打开)
|
|
346
|
-
*/
|
|
347
|
-
declare function buildArtifactBlob(artifact: ChatArtifact): Blob | null;
|
|
348
|
-
/** 触发浏览器下载(Object URL + 临时锚点) */
|
|
349
|
-
declare function saveBlob(blob: Blob, filename: string): void;
|
|
350
|
-
/**
|
|
351
|
-
* 下载产物:文本类 / dsl JSON / 图片 data URL 与 svg 标记直接存 Blob;
|
|
352
|
-
* 图片 http(s) URL fetch 取回(跨域失败降级新标签打开)
|
|
353
|
-
*/
|
|
354
|
-
declare function downloadArtifact(artifact: ChatArtifact): Promise<void>;
|
|
355
|
-
|
|
356
343
|
/**
|
|
357
344
|
* Streaming 事件模型与 reducer(设计决策 D2,设计文档第 69 节)。
|
|
358
345
|
*
|
|
@@ -746,16 +733,17 @@ interface UseChatAutoScrollResult {
|
|
|
746
733
|
declare function useChatAutoScroll({ messageCount, lastContentLength, isStreaming, }: UseChatAutoScrollOptions): UseChatAutoScrollResult;
|
|
747
734
|
|
|
748
735
|
/**
|
|
749
|
-
* ArtifactPanel(spec: chat-artifact-panel
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
736
|
+
* ArtifactPanel(spec: chat-artifact-panel):chat 组合层——展示由包内
|
|
737
|
+
* 展示组件(src/components/ArtifactPanel,单一实现,自 @pactor-app/ui
|
|
738
|
+
* 迁入)承载,本层保留 chat 运行时
|
|
739
|
+
* 接线:整对象 onSelectArtifact(ui 为 id 形式,经 artifacts 回查)、
|
|
740
|
+
* 面板皮肤类(pactor-chat-inspector)、拖拽调宽(resizable 常开)与
|
|
741
|
+
* chrome DSL 标题栏(ChatPanel* 内部组件 + chat.panelClose /
|
|
742
|
+
* panelToggleList / panelDownload 包级动作桥接,无 renderer 或类型
|
|
743
|
+
* 缺失时回退同一组内部组件的手写组合)。
|
|
757
744
|
*
|
|
758
|
-
*
|
|
745
|
+
* 目录列表视图状态由本层受控持有(ui view / onViewChange),chrome
|
|
746
|
+
* 标题栏的目录钮 / 切换下拉经 ChatPanelContext 共享同一状态。
|
|
759
747
|
*/
|
|
760
748
|
interface ArtifactPanelProps {
|
|
761
749
|
/** 当前产出物;null 时内容区为空态(inspector 槽场景常见) */
|
|
@@ -781,6 +769,8 @@ interface ArtifactPanelProps {
|
|
|
781
769
|
inspector?: ReactNode;
|
|
782
770
|
/** 关闭按钮 / 遮罩点击回调 */
|
|
783
771
|
onClose?: () => void;
|
|
772
|
+
/** 下载回调;缺省内部走浏览器下载(downloadArtifact) */
|
|
773
|
+
onDownload?: (artifact: ChatArtifact) => void;
|
|
784
774
|
/** dsl 产出物活预览的 Safe Registry;缺省时 dsl 内容渲染降级块 */
|
|
785
775
|
safeRegistry?: Registry<unknown>;
|
|
786
776
|
/** 注入 dsl 预览作用域 user */
|
|
@@ -792,29 +782,7 @@ interface ArtifactPanelProps {
|
|
|
792
782
|
artifactViewers?: ArtifactViewers;
|
|
793
783
|
className?: string;
|
|
794
784
|
}
|
|
795
|
-
|
|
796
|
-
* 产物目录树(纯函数):按 id 的 '/' 分段建目录层级——
|
|
797
|
-
* id 形如 `reports/q3/月报` 时产出 reports → q3 两级目录;
|
|
798
|
-
* 无 '/' 分段的产物平铺在根层。目录先于文件、各自按名称排序。
|
|
799
|
-
*/
|
|
800
|
-
interface ArtifactTreeNode {
|
|
801
|
-
/** 段名(目录名或产物标题) */
|
|
802
|
-
name: string;
|
|
803
|
-
/** 完整路径(目录为 id 前缀,文件为产物 id) */
|
|
804
|
-
path: string;
|
|
805
|
-
artifact?: ChatArtifact;
|
|
806
|
-
children: ArtifactTreeNode[];
|
|
807
|
-
}
|
|
808
|
-
declare function buildArtifactTree(artifacts: ChatArtifact[]): ArtifactTreeNode[];
|
|
809
|
-
/**
|
|
810
|
-
* 自定义产物查看器(spec: chat-artifact-panel / 自定义预览):
|
|
811
|
-
* 键为扩展名(小写不带点,如 'png' / 'md')或 kind
|
|
812
|
-
* ('markdown' / 'code' / 'text' / 'dsl');扩展名键优先于 kind 键,
|
|
813
|
-
* 均优先于内建渲染器。查看器抛错不经守卫——宿主代码自负。
|
|
814
|
-
*/
|
|
815
|
-
type ArtifactViewer = (artifact: ChatArtifact) => ReactNode;
|
|
816
|
-
type ArtifactViewers = Record<string, ArtifactViewer>;
|
|
817
|
-
declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, viewRequest, onViewRequestConsumed, inspector, onClose, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
|
|
785
|
+
declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelectArtifact, viewRequest, onViewRequestConsumed, inspector, onClose, onDownload, safeRegistry, user, artifactViewers, className, }: ArtifactPanelProps): ReactNode;
|
|
818
786
|
|
|
819
787
|
/**
|
|
820
788
|
* EmptyState(spec: chat-empty-state,设计决策 D0/D1):空会话欢迎页。
|
|
@@ -823,10 +791,12 @@ declare function ArtifactPanel({ artifact, artifacts, activeArtifactId, onSelect
|
|
|
823
791
|
* 点击建议经 `onSuggestionClick` 回调交还调用方(ChatView 接入时
|
|
824
792
|
* 复用 Composer 的同一条发送路径)。
|
|
825
793
|
*
|
|
794
|
+
* 展示由 @pactor-app/ui 的 Welcome + Suggestion 组合承载(回退路径;
|
|
795
|
+
* greeting 经 titleClassName 复用 chat 皮肤的 display 衬线字体栈)。
|
|
826
796
|
* chrome DSL 渲染层(spec: chat-chrome-dsl):元素层在页面运行时内
|
|
827
|
-
* 优先经 ChromeSlot 以宿主组件(Typography / Text /
|
|
828
|
-
*
|
|
829
|
-
* 无 renderer
|
|
797
|
+
* 优先经 ChromeSlot 以宿主组件(Typography / Text / Suggestion)DSL
|
|
798
|
+
* 组合渲染,建议点击经 chat.sendSuggestion 内建动作接回同一发送路径;
|
|
799
|
+
* 无 renderer 环境或类型缺失时回退 ui 组合实现(EmptyStateFallback)。
|
|
830
800
|
*/
|
|
831
801
|
type ChatSuggestion = string | {
|
|
832
802
|
label: string;
|
|
@@ -1208,7 +1178,8 @@ declare const CHAT_COMPONENT_TYPE = "Chat";
|
|
|
1208
1178
|
*/
|
|
1209
1179
|
declare function registerChatComponent(registry: Registry<unknown>): void;
|
|
1210
1180
|
/**
|
|
1211
|
-
*
|
|
1181
|
+
* 便捷工厂:创建含全部内置组件(ui 内置 + chat 展示组件)+
|
|
1182
|
+
* Chat / ChatShell 的组件注册表,
|
|
1212
1183
|
* 直接作为 createPactorApplication 的 componentRegistry 选项:
|
|
1213
1184
|
*
|
|
1214
1185
|
* ```ts
|
|
@@ -1344,25 +1315,26 @@ type CallChatService = (name: string, params?: Record<string, unknown>) => Promi
|
|
|
1344
1315
|
|
|
1345
1316
|
/**
|
|
1346
1317
|
* Composer(spec: chat-view / Composer + chat-composer-extensions):
|
|
1347
|
-
*
|
|
1348
|
-
*
|
|
1318
|
+
* chat 组合层——展示由包内展示组件(src/components/Composer,自
|
|
1319
|
+
* @pactor-app/ui 迁入)承载(fallback 路径),本层只保留运行时接线:
|
|
1320
|
+
* 发送状态机回调映射、附件模型适配、词边界 '@'
|
|
1321
|
+
* 提及检测(内建弹层 / 调用方回调)、'+' 入口与 chrome DSL 桥接。
|
|
1349
1322
|
*
|
|
1350
|
-
* - IME
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
* 不上传);卡片点击经 `onAttachmentClick` 通知
|
|
1323
|
+
* - IME 守卫由 ui ChatInput 承担(合成中 Enter 不发送),本层不再实现
|
|
1324
|
+
* - 附件(D3):受控 `attachments` + `onAttachmentsChange`;粘贴 / 拖拽 /
|
|
1325
|
+
* 文件选择产出 `File[]` 经 `onAttachFiles` 交给调用方(包内不上传);
|
|
1326
|
+
* 卡片点击经 `onAttachmentClick` 通知
|
|
1355
1327
|
* - 扩展槽:`toolbarStart` / `toolbarEnd` 渲染槽;词边界 `@` 触发
|
|
1356
1328
|
* `onMentionTrigger(query, anchorRect)`;"+" 按钮触发
|
|
1357
1329
|
* `onPlusMenu(anchorRect)`(无回调不渲染入口)
|
|
1358
1330
|
* - 内建特性(chat-builtin-features):models 非空时工具栏右端渲染
|
|
1359
|
-
* 模型 chip(
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1331
|
+
* 模型 chip(toolbarEnd 之前);contexts 配置且未注入调用方回调时
|
|
1332
|
+
* 启用内建 @ 提及 / + 菜单弹层,选中项追加为输入区上方的上下文
|
|
1333
|
+
* chips(受控:contextChips + onContextChipsChange)
|
|
1362
1334
|
* - chrome DSL 渲染层(spec: chat-composer-on-chatinput):呈现层在
|
|
1363
1335
|
* DSL 环境经宿主 ChatInput 组合渲染(非受控 + chat.composerSubmit
|
|
1364
|
-
* 桥接 + 冒泡同步 / 附件承接),无 renderer
|
|
1365
|
-
*
|
|
1336
|
+
* 桥接 + 冒泡同步 / 附件承接),无 renderer 或类型缺失时回退
|
|
1337
|
+
* ui Composer 组合路径,两条路径交互语义一致
|
|
1366
1338
|
*/
|
|
1367
1339
|
interface ComposerProps {
|
|
1368
1340
|
/** 发送回调;输入框在回调后清空 */
|
|
@@ -1542,11 +1514,11 @@ declare function ActivityTrace({ message }: ActivityTraceProps): react.JSX.Eleme
|
|
|
1542
1514
|
|
|
1543
1515
|
/**
|
|
1544
1516
|
* MessageBubble:按 role 区分呈现(参考 DeepTutor web 消息区设计)——
|
|
1545
|
-
* user
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1548
|
-
* system 居中弱提示。
|
|
1549
|
-
* 颜色经 `--pactor-chat-*`
|
|
1517
|
+
* user 右侧气泡(ui Bubble,tinted 变体);assistant 左侧通栏排版:
|
|
1518
|
+
* 顶部 Agent 身份行(ui Sender)+ 活动轨迹区(ActivityTrace:状态头 +
|
|
1519
|
+
* thinking + 配对工具轨迹),正文 parts 按序渲染;hover 操作条
|
|
1520
|
+
* (MessageActions:复制 / 重新生成 / 编辑 / 重试);system 居中弱提示。
|
|
1521
|
+
* 颜色经 `--pactor-chat-*` 变量与 ui 语义令牌表达。
|
|
1550
1522
|
*/
|
|
1551
1523
|
interface MessageBubbleProps {
|
|
1552
1524
|
message: ChatMessage;
|
|
@@ -1686,4 +1658,4 @@ interface ChatLayoutRegistry {
|
|
|
1686
1658
|
/** 注册 chat 布局(已注册时不覆盖,与 createLayoutRegistry 约定一致) */
|
|
1687
1659
|
declare function registerChatLayout(layoutRegistry: ChatLayoutRegistry): void;
|
|
1688
1660
|
|
|
1689
|
-
export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, type ArtifactIconSpec, type ArtifactIconTone, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore,
|
|
1661
|
+
export { ARTIFACT_IMAGE_EXTENSIONS, ActivityTrace, type ActivityTraceProps, AppShell, type AppShellProps, type ArtifactIconSpec, type ArtifactIconTone, ArtifactPanel, type ArtifactPanelProps, type ArtifactPatch, ArtifactStore, ArtifactViewers, type BuiltinMessageAction, CHAT_COMPONENT_TYPE, CHAT_DENIED_TYPE, CHAT_LAYOUT_TYPE, CHAT_SHELL_COMPONENT_TYPE, type CapabilityActionDeps, type CapabilityHandler, Chat, type ChatAgentIdentity, 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, buildChatScope, collectArtifacts, collectMessageText, createChatComponentRegistry, createChatId, createChatRuntime, createChatWorkspace, createManualDriver, createSafeRegistry, detectStreamingMode, formatArtifactSize, formatMessageTime, guardChatDsl, isImageArtifact, mergeArtifacts, pairToolTraces, registerCapabilityAction, registerChatComponent, registerChatLayout, registerChatShellComponent, resolveArtifactFileType, resolveArtifactIcon, resolveArtifactIconName, runChatTurn, runRegenerateTurn, useChatAutoScroll, useChatServices, useSidebarDrawer, useSmoothStreamText };
|