@tdesign-react/chat 1.0.2-alpha.1 → 1.0.2-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/es/_util/reactify.d.ts +1 -2
  2. package/es/_util/reactify.js +83 -234
  3. package/es/_util/reactify.js.map +1 -1
  4. package/es/_util/useDynamicStyle.js +2 -2
  5. package/es/_util/useDynamicStyle.js.map +1 -1
  6. package/es/attachments/index.d.ts +5 -0
  7. package/es/attachments/index.js +24 -0
  8. package/es/attachments/index.js.map +1 -0
  9. package/es/chat-actionbar/index.js +5 -7
  10. package/es/chat-actionbar/index.js.map +1 -1
  11. package/es/chat-engine/components/activity/index.d.ts +4 -0
  12. package/es/chat-engine/components/activity/index.js +18 -0
  13. package/es/chat-engine/components/activity/index.js.map +1 -0
  14. package/es/chat-engine/components/activity/registry.d.ts +44 -0
  15. package/es/chat-engine/components/activity/registry.js +85 -0
  16. package/es/chat-engine/components/activity/registry.js.map +1 -0
  17. package/es/chat-engine/components/activity/render.d.ts +11 -0
  18. package/es/chat-engine/components/activity/render.js +107 -0
  19. package/es/chat-engine/components/activity/render.js.map +1 -0
  20. package/es/chat-engine/components/activity/types.d.ts +32 -0
  21. package/es/chat-engine/components/activity/types.js +7 -0
  22. package/es/chat-engine/components/activity/types.js.map +1 -0
  23. package/es/chat-engine/components/index.d.ts +3 -0
  24. package/es/chat-engine/components/index.js +55 -0
  25. package/es/chat-engine/components/index.js.map +1 -0
  26. package/es/chat-engine/components/provider/agent-state.js +2 -2
  27. package/es/chat-engine/components/toolcall/index.js +32 -2
  28. package/es/chat-engine/components/toolcall/index.js.map +1 -1
  29. package/es/chat-engine/components/toolcall/registry.js +2 -2
  30. package/es/chat-engine/components/toolcall/render.d.ts +1 -1
  31. package/es/chat-engine/components/toolcall/render.js +88 -15
  32. package/es/chat-engine/components/toolcall/render.js.map +1 -1
  33. package/es/chat-engine/components/toolcall/types.js +2 -2
  34. package/es/chat-engine/core/adapters/agui/event-mapper.d.ts +5 -0
  35. package/es/chat-engine/core/adapters/agui/event-mapper.js +60 -33
  36. package/es/chat-engine/core/adapters/agui/event-mapper.js.map +1 -1
  37. package/es/chat-engine/core/adapters/agui/events.d.ts +377 -221
  38. package/es/chat-engine/core/adapters/agui/events.js +52 -34
  39. package/es/chat-engine/core/adapters/agui/events.js.map +1 -1
  40. package/es/chat-engine/core/adapters/agui/index.d.ts +16 -0
  41. package/es/chat-engine/core/adapters/agui/index.js +52 -28
  42. package/es/chat-engine/core/adapters/agui/index.js.map +1 -1
  43. package/es/chat-engine/core/adapters/agui/state-manager.js +2 -2
  44. package/es/chat-engine/core/adapters/agui/types.d.ts +155 -97
  45. package/es/chat-engine/core/adapters/agui/types.js +13 -7
  46. package/es/chat-engine/core/adapters/agui/types.js.map +1 -1
  47. package/es/chat-engine/core/adapters/agui/utils.d.ts +20 -2
  48. package/es/chat-engine/core/adapters/agui/utils.js +23 -7
  49. package/es/chat-engine/core/adapters/agui/utils.js.map +1 -1
  50. package/es/chat-engine/core/index.js +7 -7
  51. package/es/chat-engine/core/processor/index.js +2 -2
  52. package/es/chat-engine/core/server/batch-client.js +2 -2
  53. package/es/chat-engine/core/server/connection-manager.js +2 -2
  54. package/es/chat-engine/core/server/errors.js +2 -2
  55. package/es/chat-engine/core/server/index.js +2 -2
  56. package/es/chat-engine/core/server/llm-service.js +2 -2
  57. package/es/chat-engine/core/server/sse-client.js +2 -2
  58. package/es/chat-engine/core/server/sse-parser.js +2 -2
  59. package/es/chat-engine/core/server/types.js +2 -2
  60. package/es/chat-engine/core/store/message.js +2 -2
  61. package/es/chat-engine/core/store/model.js +2 -2
  62. package/es/chat-engine/core/store/reactiveState.js +2 -2
  63. package/es/chat-engine/core/type.d.ts +8 -1
  64. package/es/chat-engine/core/type.js +2 -2
  65. package/es/chat-engine/core/utils/eventEmitter.js +2 -2
  66. package/es/chat-engine/core/utils/index.d.ts +2 -1
  67. package/es/chat-engine/core/utils/index.js +6 -3
  68. package/es/chat-engine/core/utils/index.js.map +1 -1
  69. package/es/chat-engine/core/utils/logger.js +2 -2
  70. package/es/chat-engine/hooks/index.d.ts +4 -0
  71. package/es/chat-engine/hooks/index.js +20 -0
  72. package/es/chat-engine/hooks/index.js.map +1 -0
  73. package/es/chat-engine/hooks/useAgentActivity.d.ts +16 -0
  74. package/es/chat-engine/hooks/useAgentActivity.js +73 -0
  75. package/es/chat-engine/hooks/useAgentActivity.js.map +1 -0
  76. package/es/chat-engine/hooks/useAgentState.js +2 -2
  77. package/es/chat-engine/hooks/useAgentState.js.map +1 -1
  78. package/es/chat-engine/hooks/useAgentToolcall.js +2 -2
  79. package/es/chat-engine/hooks/useAgentToolcall.js.map +1 -1
  80. package/es/chat-engine/hooks/useChat.js +4 -4
  81. package/es/chat-engine/hooks/useChat.js.map +1 -1
  82. package/es/chat-engine/index.d.ts +3 -3
  83. package/es/chat-engine/index.js +41 -6
  84. package/es/chat-engine/index.js.map +1 -1
  85. package/es/chat-filecard/index.js +5 -7
  86. package/es/chat-filecard/index.js.map +1 -1
  87. package/es/chat-loading/index.js +5 -7
  88. package/es/chat-loading/index.js.map +1 -1
  89. package/es/chat-markdown/index.js +5 -7
  90. package/es/chat-markdown/index.js.map +1 -1
  91. package/es/chat-message/index.js +5 -7
  92. package/es/chat-message/index.js.map +1 -1
  93. package/es/chat-sender/index.js +5 -7
  94. package/es/chat-sender/index.js.map +1 -1
  95. package/es/chat-thinking/index.js +5 -7
  96. package/es/chat-thinking/index.js.map +1 -1
  97. package/es/chatbot/index.js +5 -7
  98. package/es/chatbot/index.js.map +1 -1
  99. package/es/index.d.ts +1 -1
  100. package/es/index.js +40 -11
  101. package/es/index.js.map +1 -1
  102. package/es/style/index.js +2 -2
  103. package/package.json +5 -4
@@ -0,0 +1,24 @@
1
+ /**
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
+ * @license MIT
5
+ */
6
+
7
+ import 'tdesign-web-components/lib/attachments';
8
+ import reactify from '../_util/reactify.js';
9
+ import '@babel/runtime/helpers/defineProperty';
10
+ import '@babel/runtime/helpers/objectWithoutProperties';
11
+ import '@babel/runtime/helpers/typeof';
12
+ import '@babel/runtime/helpers/slicedToArray';
13
+ import '@babel/runtime/helpers/classCallCheck';
14
+ import '@babel/runtime/helpers/createClass';
15
+ import '@babel/runtime/helpers/possibleConstructorReturn';
16
+ import '@babel/runtime/helpers/getPrototypeOf';
17
+ import '@babel/runtime/helpers/inherits';
18
+ import 'react';
19
+ import 'react-dom/client';
20
+
21
+ var Attachments = reactify("t-attachments");
22
+
23
+ export { Attachments, Attachments as default };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../pro-components/chat/attachments/index.ts"],"sourcesContent":["import { TdAttachmentsProps } from 'tdesign-web-components';\nimport 'tdesign-web-components/lib/attachments';\nimport reactify from '../_util/reactify';\n\nexport const Attachments: React.ForwardRefExoticComponent<\n Omit<TdAttachmentsProps, 'ref'> & React.RefAttributes<HTMLElement | undefined>\n> = reactify<TdAttachmentsProps>('t-attachments');\n\nexport default Attachments;\n\nexport type { TdAttachmentsProps, TdAttachmentItem } from 'tdesign-web-components';\n"],"names":["Attachments","reactify"],"mappings":";;;;;;;;;;;;;;;;;;;;IAIaA,WAAA,GAETC,SAA6B,eAAe;;;;"}
@@ -1,23 +1,21 @@
1
1
  /**
2
- * tdesign v1.0.1
3
- * (c) 2025 tdesign
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
4
  * @license MIT
5
5
  */
6
6
 
7
7
  import 'tdesign-web-components/lib/chat-action';
8
8
  import reactify from '../_util/reactify.js';
9
+ import '@babel/runtime/helpers/defineProperty';
9
10
  import '@babel/runtime/helpers/objectWithoutProperties';
10
- import '@babel/runtime/helpers/toConsumableArray';
11
+ import '@babel/runtime/helpers/typeof';
12
+ import '@babel/runtime/helpers/slicedToArray';
11
13
  import '@babel/runtime/helpers/classCallCheck';
12
14
  import '@babel/runtime/helpers/createClass';
13
15
  import '@babel/runtime/helpers/possibleConstructorReturn';
14
16
  import '@babel/runtime/helpers/getPrototypeOf';
15
17
  import '@babel/runtime/helpers/inherits';
16
- import '@babel/runtime/helpers/defineProperty';
17
- import '@babel/runtime/helpers/slicedToArray';
18
- import '@babel/runtime/helpers/typeof';
19
18
  import 'react';
20
- import 'react-dom';
21
19
  import 'react-dom/client';
22
20
 
23
21
  var ChatActionBar = reactify("t-chat-action");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../pro-components/chat/chat-actionbar/index.tsx"],"sourcesContent":["import { TdChatActionProps } from 'tdesign-web-components';\nimport 'tdesign-web-components/lib/chat-action';\nimport reactify from '../_util/reactify';\n\nexport const ChatActionBar: React.ForwardRefExoticComponent<\n Omit<TdChatActionProps, 'ref'> &\n React.RefAttributes<HTMLElement | undefined> & {\n [key: string]: any;\n }\n> = reactify<TdChatActionProps>('t-chat-action');\n\nexport default ChatActionBar;\nexport type { TdChatActionProps, TdChatActionsName } from 'tdesign-web-components';\n\n// 方案1\n// import { reactifyLazy } from './_util/reactifyLazy';\n// const ChatActionBar = reactifyLazy<{\n// size: 'small' | 'medium' | 'large',\n// variant: 'primary' | 'secondary' | 'outline'\n// }>(\n// 't-chat-action',\n// 'tdesign-web-components/esm/chat-action'\n// );\n\n// import ChatAction from 'tdesign-web-components/esm/chat-action';\n// import React, { forwardRef, useEffect } from 'react';\n\n// // 注册Web Components组件\n// const registerChatAction = () => {\n// if (!customElements.get('t-chat-action')) {\n// customElements.define('t-chat-action', ChatAction);\n// }\n// };\n\n// // 在组件挂载时注册\n// const useRegisterWebComponent = () => {\n// useEffect(() => {\n// registerChatAction();\n// }, []);\n// };\n\n// // 使用reactify创建React组件\n// const BaseChatActionBar = reactify<TdChatActionProps>('t-chat-action');\n\n// // 包装组件,确保Web Components已注册\n// export const ChatActionBar2 = forwardRef<\n// HTMLElement | undefined,\n// Omit<TdChatActionProps, 'ref'> & { [key: string]: any }\n// >((props, ref) => {\n// useRegisterWebComponent();\n// return <BaseChatActionBar {...props} ref={ref} />;\n// });\n"],"names":["ChatActionBar","reactify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAIaA,aAAA,GAKTC,SAA4B,eAAe;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../pro-components/chat/chat-actionbar/index.tsx"],"sourcesContent":["import { TdChatActionProps } from 'tdesign-web-components';\nimport 'tdesign-web-components/lib/chat-action';\nimport reactify from '../_util/reactify';\n\nexport const ChatActionBar: React.ForwardRefExoticComponent<\n Omit<TdChatActionProps, 'ref'> &\n React.RefAttributes<HTMLElement | undefined> & {\n [key: string]: any;\n }\n> = reactify<TdChatActionProps>('t-chat-action');\n\nexport default ChatActionBar;\nexport type { TdChatActionProps, TdChatActionsName } from 'tdesign-web-components';\n\n// 方案1\n// import { reactifyLazy } from './_util/reactifyLazy';\n// const ChatActionBar = reactifyLazy<{\n// size: 'small' | 'medium' | 'large',\n// variant: 'primary' | 'secondary' | 'outline'\n// }>(\n// 't-chat-action',\n// 'tdesign-web-components/esm/chat-action'\n// );\n\n// import ChatAction from 'tdesign-web-components/esm/chat-action';\n// import React, { forwardRef, useEffect } from 'react';\n\n// // 注册Web Components组件\n// const registerChatAction = () => {\n// if (!customElements.get('t-chat-action')) {\n// customElements.define('t-chat-action', ChatAction);\n// }\n// };\n\n// // 在组件挂载时注册\n// const useRegisterWebComponent = () => {\n// useEffect(() => {\n// registerChatAction();\n// }, []);\n// };\n\n// // 使用reactify创建React组件\n// const BaseChatActionBar = reactify<TdChatActionProps>('t-chat-action');\n\n// // 包装组件,确保Web Components已注册\n// export const ChatActionBar2 = forwardRef<\n// HTMLElement | undefined,\n// Omit<TdChatActionProps, 'ref'> & { [key: string]: any }\n// >((props, ref) => {\n// useRegisterWebComponent();\n// return <BaseChatActionBar {...props} ref={ref} />;\n// });\n"],"names":["ChatActionBar","reactify"],"mappings":";;;;;;;;;;;;;;;;;;;;IAIaA,aAAA,GAKTC,SAA4B,eAAe;;;;"}
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './registry';
3
+ export * from './render';
4
+ export { activityRegistry } from './registry';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
+ * @license MIT
5
+ */
6
+
7
+ import './types.js';
8
+ export { activityRegistry } from './registry.js';
9
+ export { ActivityRenderer } from './render.js';
10
+ import '@babel/runtime/helpers/classCallCheck';
11
+ import '@babel/runtime/helpers/createClass';
12
+ import '@babel/runtime/helpers/defineProperty';
13
+ import 'react';
14
+ import '@babel/runtime/helpers/slicedToArray';
15
+ import '@babel/runtime/helpers/possibleConstructorReturn';
16
+ import '@babel/runtime/helpers/getPrototypeOf';
17
+ import '@babel/runtime/helpers/inherits';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import type { ActivityConfig, ActivityRegistry, ActivityComponentProps } from './types';
3
+ /**
4
+ * Activity 注册表管理器
5
+ * 参考 AgentToolcallRegistryManager 的设计,但简化了复杂的状态管理
6
+ */
7
+ declare class ActivityRegistryManager {
8
+ private registry;
9
+ private renderFunctionCache;
10
+ /**
11
+ * 注册一个 Activity 配置
12
+ */
13
+ register<TContent = any>(config: ActivityConfig<TContent>): void;
14
+ /**
15
+ * 获取指定类型的 Activity 配置
16
+ */
17
+ get(activityType: string): ActivityConfig | undefined;
18
+ /**
19
+ * 获取或创建缓存的组件渲染函数
20
+ */
21
+ getRenderFunction(activityType: string): React.MemoExoticComponent<React.ComponentType<ActivityComponentProps>> | null;
22
+ /**
23
+ * 获取所有已注册的 Activity 配置
24
+ */
25
+ getAll(): ActivityRegistry;
26
+ /**
27
+ * 取消注册指定的 Activity
28
+ */
29
+ unregister(activityType: string): void;
30
+ /**
31
+ * 清空所有注册的 Activity
32
+ */
33
+ clear(): void;
34
+ /**
35
+ * 检查指定类型是否已注册
36
+ */
37
+ has(activityType: string): boolean;
38
+ /**
39
+ * 获取所有已注册的 Activity 类型
40
+ */
41
+ getRegisteredTypes(): string[];
42
+ }
43
+ export declare const activityRegistry: ActivityRegistryManager;
44
+ export {};
@@ -0,0 +1,85 @@
1
+ /**
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
+ * @license MIT
5
+ */
6
+
7
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
8
+ import _createClass from '@babel/runtime/helpers/createClass';
9
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
10
+ import React from 'react';
11
+
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ var ActivityRegistryManager = /*#__PURE__*/function () {
15
+ function ActivityRegistryManager() {
16
+ _classCallCheck(this, ActivityRegistryManager);
17
+ _defineProperty(this, "registry", {});
18
+ _defineProperty(this, "renderFunctionCache", /* @__PURE__ */new Map());
19
+ }
20
+ return _createClass(ActivityRegistryManager, [{
21
+ key: "register",
22
+ value: function register(config) {
23
+ var existingConfig = this.registry[config.activityType];
24
+ if (existingConfig && existingConfig.component !== config.component) {
25
+ this.renderFunctionCache["delete"](config.activityType);
26
+ }
27
+ this.registry[config.activityType] = config;
28
+ window.dispatchEvent(new CustomEvent("activity-registered", {
29
+ detail: {
30
+ activityType: config.activityType
31
+ }
32
+ }));
33
+ }
34
+ }, {
35
+ key: "get",
36
+ value: function get(activityType) {
37
+ return this.registry[activityType];
38
+ }
39
+ }, {
40
+ key: "getRenderFunction",
41
+ value: function getRenderFunction(activityType) {
42
+ var config = this.registry[activityType];
43
+ if (!config) return null;
44
+ var memoizedComponent = this.renderFunctionCache.get(activityType);
45
+ if (!memoizedComponent) {
46
+ memoizedComponent = /*#__PURE__*/React.memo(function (props) {
47
+ return /*#__PURE__*/React.createElement(config.component, props);
48
+ });
49
+ this.renderFunctionCache.set(activityType, memoizedComponent);
50
+ }
51
+ return memoizedComponent;
52
+ }
53
+ }, {
54
+ key: "getAll",
55
+ value: function getAll() {
56
+ return _objectSpread({}, this.registry);
57
+ }
58
+ }, {
59
+ key: "unregister",
60
+ value: function unregister(activityType) {
61
+ delete this.registry[activityType];
62
+ this.renderFunctionCache["delete"](activityType);
63
+ }
64
+ }, {
65
+ key: "clear",
66
+ value: function clear() {
67
+ this.registry = {};
68
+ this.renderFunctionCache.clear();
69
+ }
70
+ }, {
71
+ key: "has",
72
+ value: function has(activityType) {
73
+ return activityType in this.registry;
74
+ }
75
+ }, {
76
+ key: "getRegisteredTypes",
77
+ value: function getRegisteredTypes() {
78
+ return Object.keys(this.registry);
79
+ }
80
+ }]);
81
+ }();
82
+ var activityRegistry = new ActivityRegistryManager();
83
+
84
+ export { activityRegistry };
85
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sources":["../../../../../pro-components/chat/chat-engine/components/activity/registry.ts"],"sourcesContent":["import React from 'react';\nimport type { ActivityConfig, ActivityRegistry, ActivityComponentProps } from './types';\n\n/**\n * Activity 注册表管理器\n * 参考 AgentToolcallRegistryManager 的设计,但简化了复杂的状态管理\n */\nclass ActivityRegistryManager {\n private registry: ActivityRegistry = {};\n\n // 组件渲染函数缓存,避免重复创建 React 组件\n private renderFunctionCache = new Map<\n string,\n React.MemoExoticComponent<React.ComponentType<ActivityComponentProps>>\n >();\n\n /**\n * 注册一个 Activity 配置\n */\n register<TContent = any>(config: ActivityConfig<TContent>): void {\n const existingConfig = this.registry[config.activityType];\n\n // 如果组件发生变化,清除旧的缓存\n if (existingConfig && existingConfig.component !== config.component) {\n this.renderFunctionCache.delete(config.activityType);\n }\n\n this.registry[config.activityType] = config;\n\n // 触发注册事件,支持动态注册\n window.dispatchEvent(\n new CustomEvent('activity-registered', {\n detail: { activityType: config.activityType },\n }),\n );\n }\n\n /**\n * 获取指定类型的 Activity 配置\n */\n get(activityType: string): ActivityConfig | undefined {\n return this.registry[activityType];\n }\n\n /**\n * 获取或创建缓存的组件渲染函数\n */\n getRenderFunction(activityType: string): React.MemoExoticComponent<React.ComponentType<ActivityComponentProps>> | null {\n const config = this.registry[activityType];\n if (!config) return null;\n\n // 检查缓存\n let memoizedComponent = this.renderFunctionCache.get(activityType);\n\n if (!memoizedComponent) {\n // 创建 memo 化的组件\n memoizedComponent = React.memo((props: ActivityComponentProps) => \n React.createElement(config.component, props)\n );\n\n // 缓存组件\n this.renderFunctionCache.set(activityType, memoizedComponent);\n }\n\n return memoizedComponent;\n }\n\n /**\n * 获取所有已注册的 Activity 配置\n */\n getAll(): ActivityRegistry {\n return { ...this.registry };\n }\n\n /**\n * 取消注册指定的 Activity\n */\n unregister(activityType: string): void {\n delete this.registry[activityType];\n this.renderFunctionCache.delete(activityType);\n }\n\n /**\n * 清空所有注册的 Activity\n */\n clear(): void {\n this.registry = {};\n this.renderFunctionCache.clear();\n }\n\n /**\n * 检查指定类型是否已注册\n */\n has(activityType: string): boolean {\n return activityType in this.registry;\n }\n\n /**\n * 获取所有已注册的 Activity 类型\n */\n getRegisteredTypes(): string[] {\n return Object.keys(this.registry);\n }\n}\n\n// 导出单例实例\nexport const activityRegistry = new ActivityRegistryManager();"],"names":["ActivityRegistryManager","_classCallCheck","_defineProperty","Map","_createClass","key","value","register","config","existingConfig","registry","activityType","component","renderFunctionCache","window","dispatchEvent","CustomEvent","detail","get","getRenderFunction","memoizedComponent","React","memo","props","createElement","set","getAll","_objectSpread","unregister","clear","has","getRegisteredTypes","Object","keys","activityRegistry"],"mappings":";;;;;;;;;;;;;AAAkB,IAOZA,uBAAwB,gBAAA,YAAA;AAAA,EAAA,SAAAA,uBAAA,GAAA;AAAAC,IAAAA,eAAA,OAAAD,uBAAA,CAAA,CAAA;IAAAE,eAAA,CAAA,IAAA,EAAA,UAAA,EACS,EAAC,CAAA,CAAA;AAAAA,IAAAA,eAAA,CAGR,IAAA,EAAA,qBAAA,qBAAIC,GAGhC,EAAA,CAAA,CAAA;AAAA,GAAA;EAAA,OAAAC,YAAA,CAAAJ,uBAAA,EAAA,CAAA;IAAAK,GAAA,EAAA,UAAA;AAAAC,IAAAA,KAAA,EAKF,SAAAC,SAAyBC,MAAwC,EAAA;MACzD,IAAAC,cAAA,GAAiB,IAAK,CAAAC,QAAA,CAASF,MAAO,CAAAG,YAAA,CAAA,CAAA;MAG5C,IAAIF,cAAkB,IAAAA,cAAA,CAAeG,SAAc,KAAAJ,MAAA,CAAOI,SAAW,EAAA;AAC9D,QAAA,IAAA,CAAAC,mBAAA,CAAA,QAAA,CAA2B,CAAAL,MAAA,CAAOG,YAAY,CAAA,CAAA;AACrD,OAAA;MAEK,IAAA,CAAAD,QAAA,CAASF,OAAOG,YAAgB,CAAA,GAAAH,MAAA,CAAA;AAG9BM,MAAAA,MAAA,CAAAC,aAAA,CACL,IAAIC,YAAY,qBAAuB,EAAA;AACrCC,QAAAA,MAAQ,EAAA;UAAEN,YAAc,EAAAH,MAAA,CAAOG,YAAAA;AAAa,SAAA;AAC9C,OAAC,CACH,CAAA,CAAA;AACF,KAAA;AAAA,GAAA,EAAA;IAAAN,GAAA,EAAA,KAAA;AAAAC,IAAAA,KAAA,EAKA,SAAAY,IAAIP,YAAkD,EAAA;AACpD,MAAA,OAAO,KAAKD,QAAS,CAAAC,YAAA,CAAA,CAAA;AACvB,KAAA;AAAA,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AKG,oBAAoBgB,KAAM,EAAA,CAAA;AACjC,KAAA;AAAA,GAAA,EAAA;IAAAxB,GAAA,EAAA,KAAA;AAAAC,IAAAA,KAAA,EAKA,SAAAwB,IAAInB,YAA+B,EAAA;AACjC,MAAA,OAAOA,gBAAgB,IAAK,CAAAD,QAAA,CAAA;AAC9B,KAAA;AAAA,GAAA,EAAA;IAAAL,GAAA,EAAA,oBAAA;AAAAC,IAAAA,KAAA,EAKA,SAAAyB,kBAA+BA,GAAA;AACtB,MAAA,OAAAC,MAAA,CAAOC,IAAK,CAAA,IAAA,CAAKvB,QAAQ,CAAA,CAAA;AAClC,KAAA;AAAA,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,EAAA,CAAA;IAIWwB,gBAAA,GAAmB,IAAIlC,uBAAwB;;;;"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type ActivityData } from 'tdesign-web-components/lib/chat-engine';
3
+ interface ActivityRendererProps {
4
+ activity: ActivityData;
5
+ }
6
+ /**
7
+ * Activity 渲染器组件
8
+ * 根据 activityType 查找注册的组件进行渲染
9
+ */
10
+ export declare const ActivityRenderer: React.NamedExoticComponent<ActivityRendererProps>;
11
+ export {};
@@ -0,0 +1,107 @@
1
+ /**
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
+ * @license MIT
5
+ */
6
+
7
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
8
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
9
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
10
+ import _createClass from '@babel/runtime/helpers/createClass';
11
+ import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
12
+ import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
13
+ import _inherits from '@babel/runtime/helpers/inherits';
14
+ import React, { Component, useState, useMemo, useEffect } from 'react';
15
+ import { activityRegistry } from './registry.js';
16
+
17
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
20
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
+ var ActivityErrorBoundary = /*#__PURE__*/function (_Component) {
22
+ function ActivityErrorBoundary(props) {
23
+ var _this;
24
+ _classCallCheck(this, ActivityErrorBoundary);
25
+ _this = _callSuper(this, ActivityErrorBoundary, [props]);
26
+ _this.state = {
27
+ hasError: false,
28
+ error: null
29
+ };
30
+ return _this;
31
+ }
32
+ _inherits(ActivityErrorBoundary, _Component);
33
+ return _createClass(ActivityErrorBoundary, [{
34
+ key: "componentDidCatch",
35
+ value: function componentDidCatch(error, errorInfo) {
36
+ console.error("[ActivityRenderer] Error in activity \"".concat(this.props.activityType, "\":"), error, errorInfo);
37
+ }
38
+ }, {
39
+ key: "render",
40
+ value: function render() {
41
+ if (this.state.hasError) {
42
+ return null;
43
+ }
44
+ return this.props.children;
45
+ }
46
+ }], [{
47
+ key: "getDerivedStateFromError",
48
+ value: function getDerivedStateFromError(error) {
49
+ return {
50
+ hasError: true,
51
+ error: error
52
+ };
53
+ }
54
+ }]);
55
+ }(Component);
56
+ var DefaultActivityRenderer = function DefaultActivityRenderer(_ref) {
57
+ var activity = _ref.activity;
58
+ console.warn("[ActivityRenderer] Unknown activity type: ".concat(activity.activityType), activity.content);
59
+ return null;
60
+ };
61
+ var ActivityRenderer = /*#__PURE__*/React.memo(function (_ref2) {
62
+ var activity = _ref2.activity;
63
+ var _useState = useState(function () {
64
+ return !!activityRegistry.getRenderFunction(activity.activityType);
65
+ }),
66
+ _useState2 = _slicedToArray(_useState, 2),
67
+ isRegistered = _useState2[0],
68
+ setIsRegistered = _useState2[1];
69
+ var componentProps = useMemo(function () {
70
+ return {
71
+ activityType: activity.activityType,
72
+ content: activity.content,
73
+ messageId: activity.messageId || ""
74
+ };
75
+ }, [activity.activityType, activity.content, activity.messageId]);
76
+ useEffect(function () {
77
+ if (!isRegistered) {
78
+ var handleRegistered = function handleRegistered(event) {
79
+ var _event$detail;
80
+ if (((_event$detail = event.detail) === null || _event$detail === void 0 ? void 0 : _event$detail.activityType) === activity.activityType) {
81
+ setIsRegistered(true);
82
+ }
83
+ };
84
+ window.addEventListener("activity-registered", handleRegistered);
85
+ return function () {
86
+ window.removeEventListener("activity-registered", handleRegistered);
87
+ };
88
+ }
89
+ }, [activity.activityType, isRegistered]);
90
+ var MemoizedComponent = useMemo(function () {
91
+ return activityRegistry.getRenderFunction(activity.activityType);
92
+ }, [activity.activityType, isRegistered]);
93
+ if (!MemoizedComponent) {
94
+ return /* @__PURE__ */React.createElement(DefaultActivityRenderer, {
95
+ activity: activity
96
+ });
97
+ }
98
+ return /* @__PURE__ */React.createElement(ActivityErrorBoundary, {
99
+ activityType: activity.activityType
100
+ }, /* @__PURE__ */React.createElement(MemoizedComponent, _objectSpread({}, componentProps)));
101
+ }, function (prevProps, nextProps) {
102
+ return prevProps.activity.activityType === nextProps.activity.activityType && prevProps.activity.messageId === nextProps.activity.messageId && JSON.stringify(prevProps.activity.content) === JSON.stringify(nextProps.activity.content);
103
+ });
104
+ ActivityRenderer.displayName = "ActivityRenderer";
105
+
106
+ export { ActivityRenderer };
107
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sources":["../../../../../pro-components/chat/chat-engine/components/activity/render.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo, Component, ErrorInfo } from 'react';\nimport type { ActivityComponentProps } from './types';\nimport { activityRegistry } from './registry';\nimport { type ActivityData } from 'tdesign-web-components/lib/chat-engine';\n\ninterface ActivityRendererProps {\n activity: ActivityData;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\n/**\n * Activity 错误边界组件\n * 捕获子组件渲染错误,防止整个对话列表崩溃\n * TODO: 后续支持配置化的错误 UI\n */\nclass ActivityErrorBoundary extends Component<\n { children: React.ReactNode; activityType: string },\n ErrorBoundaryState\n> {\n constructor(props: { children: React.ReactNode; activityType: string }) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n console.error(`[ActivityRenderer] Error in activity \"${this.props.activityType}\":`, error, errorInfo);\n }\n\n render() {\n if (this.state.hasError) {\n return null;\n }\n\n return this.props.children;\n }\n}\n\n/**\n * 默认的 Activity 渲染器\n * 当没有注册对应类型的组件时使用\n * TODO: 后续支持配置化的默认 UI\n */\nconst DefaultActivityRenderer: React.FC<ActivityRendererProps> = ({ activity }) => {\n // 空白兜底,仅在控制台输出警告\n console.warn(`[ActivityRenderer] Unknown activity type: ${activity.activityType}`, activity.content);\n return null;\n};\n\n/**\n * Activity 渲染器组件\n * 根据 activityType 查找注册的组件进行渲染\n */\nexport const ActivityRenderer = React.memo<ActivityRendererProps>(\n ({ activity }) => {\n // 添加注册状态监听\n const [isRegistered, setIsRegistered] = useState(\n () => !!activityRegistry.getRenderFunction(activity.activityType),\n );\n\n // 缓存组件 props\n const componentProps = useMemo<ActivityComponentProps>(\n () => ({\n activityType: activity.activityType,\n content: activity.content,\n messageId: activity.messageId || '',\n }),\n [activity.activityType, activity.content, activity.messageId],\n );\n\n // 监听组件注册事件,支持动态注册\n useEffect(() => {\n if (!isRegistered) {\n const handleRegistered = (event: CustomEvent) => {\n if (event.detail?.activityType === activity.activityType) {\n setIsRegistered(true);\n }\n };\n\n // 添加事件监听\n window.addEventListener('activity-registered', handleRegistered as EventListener);\n\n return () => {\n window.removeEventListener('activity-registered', handleRegistered as EventListener);\n };\n }\n }, [activity.activityType, isRegistered]);\n\n // 使用 registry 的缓存渲染函数\n const MemoizedComponent = useMemo(\n () => activityRegistry.getRenderFunction(activity.activityType),\n [activity.activityType, isRegistered],\n );\n\n // 如果没有注册对应的组件,使用默认渲染器\n if (!MemoizedComponent) {\n return <DefaultActivityRenderer activity={activity} />;\n }\n\n return (\n <ActivityErrorBoundary activityType={activity.activityType}>\n <MemoizedComponent {...componentProps} />\n </ActivityErrorBoundary>\n );\n },\n (prevProps, nextProps) =>\n prevProps.activity.activityType === nextProps.activity.activityType &&\n prevProps.activity.messageId === nextProps.activity.messageId &&\n JSON.stringify(prevProps.activity.content) === JSON.stringify(nextProps.activity.content),\n);\n\nActivityRenderer.displayName = 'ActivityRenderer';"],"names":["ActivityErrorBoundary","props","_this","_classCallCheck","_callSuper","state","hasError","error","_inherits","_Component","_createClass","key","value","componentDidCatch","errorInfo","console","activityType","render","children","getDerivedStateFromError","Component","DefaultActivityRenderer","_ref","activity","warn","concat","content","ActivityRenderer","React","memo","_ref2","_useState","useState","activityRegistry","getRenderFunction","_useState2","_slicedToArray","isRegistered","setIsRegistered","componentProps","useMemo","messageId","useEffect","handleRegistered","event","_event$detail","detail","window","addEventListener","removeEventListener","MemoizedComponent","createElement","_objectSpread","prevProps","nextProps","JSON","stringify","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEiC,IAiB3BA;EAIJ,SAAAA,qBAAAA,CAAYC,KAA4D,EAAA;AAAA,IAAA,IAAAC,KAAA,CAA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AA,CAAUH,SAAU,CAAA9B,QAAA,CAASG,OAAO,CAAA,KAAM6B,IAAK,CAAAC,SAAA,CAAUF,SAAU,CAAA/B,QAAA,CAASG,OAAO,CAAA,CAAA;AAAA,CAC5F,EAAA;AAEAC,gBAAA,CAAiB8B,WAAc,GAAA,kBAAA;;;;"}
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ /**
3
+ * Activity 组件的标准 Props 接口
4
+ */
5
+ export interface ActivityComponentProps<TContent = any> {
6
+ /** Activity 类型 */
7
+ activityType: string;
8
+ /** Activity 内容数据 */
9
+ content: TContent;
10
+ /** 关联的消息 ID */
11
+ messageId: string;
12
+ }
13
+ /**
14
+ * Activity 配置接口
15
+ */
16
+ export interface ActivityConfig<TContent = any> {
17
+ /** Activity 类型标识符 */
18
+ activityType: string;
19
+ /** 渲染组件 */
20
+ component: React.FC<ActivityComponentProps<TContent>>;
21
+ /** 描述信息(可选) */
22
+ description?: string;
23
+ }
24
+ /**
25
+ * Activity 注册表接口
26
+ */
27
+ export interface ActivityRegistry {
28
+ [activityType: string]: ActivityConfig;
29
+ }
30
+ /**
31
+ * Activity 数据结构(从 ActivityContent 中提取)
32
+ */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
+ * @license MIT
5
+ */
6
+
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,3 @@
1
+ export * from './toolcall';
2
+ export * from './activity';
3
+ export * from './provider/agent-state';
@@ -0,0 +1,55 @@
1
+ /**
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
+ * @license MIT
5
+ */
6
+
7
+ import './toolcall/index.js';
8
+ import './activity/index.js';
9
+ export { AgentStateProvider } from './provider/agent-state.js';
10
+ export { isNonInteractive, isNonInteractiveConfig } from './toolcall/types.js';
11
+ export { agentToolcallRegistry } from './toolcall/registry.js';
12
+ export { ToolCallRenderer, withAgentStateToolcall, withAgentStateToolcall1 } from './toolcall/render.js';
13
+ export { activityRegistry } from './activity/registry.js';
14
+ export { ActivityRenderer } from './activity/render.js';
15
+ import './activity/types.js';
16
+ import 'react';
17
+ import '../hooks/useAgentState.js';
18
+ import '@babel/runtime/helpers/defineProperty';
19
+ import '@babel/runtime/helpers/slicedToArray';
20
+ import 'tdesign-web-components/lib/chat-engine';
21
+ import '@babel/runtime/helpers/classCallCheck';
22
+ import '@babel/runtime/helpers/createClass';
23
+ import '@babel/runtime/helpers/asyncToGenerator';
24
+ import '@babel/runtime/helpers/possibleConstructorReturn';
25
+ import '@babel/runtime/helpers/getPrototypeOf';
26
+ import '@babel/runtime/helpers/inherits';
27
+ import '@babel/runtime/regenerator';
28
+ import '../core/index.js';
29
+ import '@babel/runtime/helpers/objectWithoutProperties';
30
+ import '../core/adapters/agui/index.js';
31
+ import '@babel/runtime/helpers/toConsumableArray';
32
+ import '../core/adapters/agui/event-mapper.js';
33
+ import '../core/adapters/agui/events.js';
34
+ import 'zod';
35
+ import '../core/adapters/agui/types.js';
36
+ import '@babel/runtime/helpers/wrapNativeSuper';
37
+ import '../core/adapters/agui/state-manager.js';
38
+ import '@babel/runtime/helpers/typeof';
39
+ import '../core/utils/index.js';
40
+ import '../core/adapters/agui/utils.js';
41
+ import '../core/store/message.js';
42
+ import '@babel/runtime/helpers/get';
43
+ import '../core/store/reactiveState.js';
44
+ import '../core/processor/index.js';
45
+ import '../core/server/index.js';
46
+ import '../core/server/llm-service.js';
47
+ import '../core/utils/logger.js';
48
+ import '../core/server/batch-client.js';
49
+ import '../core/utils/eventEmitter.js';
50
+ import '../core/server/errors.js';
51
+ import '../core/server/sse-client.js';
52
+ import '../core/server/connection-manager.js';
53
+ import '../core/server/sse-parser.js';
54
+ import '../core/server/types.js';
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * tdesign v1.0.1
3
- * (c) 2025 tdesign
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
4
  * @license MIT
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
- * tdesign v1.0.1
3
- * (c) 2025 tdesign
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
4
  * @license MIT
5
5
  */
6
6
 
@@ -13,7 +13,37 @@ import '@babel/runtime/helpers/defineProperty';
13
13
  import 'react';
14
14
  import '@babel/runtime/helpers/asyncToGenerator';
15
15
  import '@babel/runtime/helpers/slicedToArray';
16
+ import '@babel/runtime/helpers/possibleConstructorReturn';
17
+ import '@babel/runtime/helpers/getPrototypeOf';
18
+ import '@babel/runtime/helpers/inherits';
16
19
  import '@babel/runtime/regenerator';
17
20
  import '../../hooks/useAgentState.js';
18
21
  import 'tdesign-web-components/lib/chat-engine';
22
+ import '../../core/index.js';
23
+ import '@babel/runtime/helpers/objectWithoutProperties';
24
+ import '../../core/adapters/agui/index.js';
25
+ import '@babel/runtime/helpers/toConsumableArray';
26
+ import '../../core/adapters/agui/event-mapper.js';
27
+ import '../../core/adapters/agui/events.js';
28
+ import 'zod';
29
+ import '../../core/adapters/agui/types.js';
30
+ import '@babel/runtime/helpers/wrapNativeSuper';
31
+ import '../../core/adapters/agui/state-manager.js';
32
+ import '@babel/runtime/helpers/typeof';
33
+ import '../../core/utils/index.js';
34
+ import '../../core/adapters/agui/utils.js';
35
+ import '../../core/store/message.js';
36
+ import '@babel/runtime/helpers/get';
37
+ import '../../core/store/reactiveState.js';
38
+ import '../../core/processor/index.js';
39
+ import '../../core/server/index.js';
40
+ import '../../core/server/llm-service.js';
41
+ import '../../core/utils/logger.js';
42
+ import '../../core/server/batch-client.js';
43
+ import '../../core/utils/eventEmitter.js';
44
+ import '../../core/server/errors.js';
45
+ import '../../core/server/sse-client.js';
46
+ import '../../core/server/connection-manager.js';
47
+ import '../../core/server/sse-parser.js';
48
+ import '../../core/server/types.js';
19
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * tdesign v1.0.1
3
- * (c) 2025 tdesign
2
+ * tdesign v1.0.2-alpha.9
3
+ * (c) 2026 tdesign
4
4
  * @license MIT
5
5
  */
6
6
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ToolCall } from 'tdesign-web-components/lib/chat-engine';
2
+ import { ToolCall } from '../../core';
3
3
  interface ToolCallRendererProps {
4
4
  toolCall: ToolCall;
5
5
  onRespond?: (toolCall: ToolCall, response: any) => void;