@njuptlzf/agent-chat-web 0.2.0 → 0.3.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.
Files changed (61) hide show
  1. package/dist/AgentChat.d.ts +7 -1
  2. package/dist/AgentChat.js +23 -5
  3. package/dist/AgentChatApp.d.ts +4 -1
  4. package/dist/AgentChatApp.js +2 -2
  5. package/dist/PersonasPage.js +8 -0
  6. package/dist/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
  7. package/dist/assets/exceljs.min-jlEt4kSc.js +29 -0
  8. package/dist/assets/index-B7uSE8SM.css +1 -0
  9. package/dist/assets/index-D57mU5H5.js +50 -0
  10. package/dist/assets/index-Dviy7gnB.js +44 -0
  11. package/dist/assets/pdf-CfhDiWmk.js +55 -0
  12. package/dist/assets/pdf.worker.min-CdXBBzB4.js +1 -0
  13. package/dist/assets/pdf.worker.min-CjEcRF4W.mjs +28 -0
  14. package/dist/index.html +13 -0
  15. package/dist/mount.d.ts +7 -1
  16. package/dist/mount.js +2 -2
  17. package/dist/styles.css +1492 -1478
  18. package/dist/suggestions.d.ts +41 -0
  19. package/dist/suggestions.js +98 -0
  20. package/dist/ui/FollowUpSuggestions.d.ts +9 -0
  21. package/dist/ui/FollowUpSuggestions.js +13 -0
  22. package/dist/ui/Icon.d.ts +8 -0
  23. package/dist/ui/Icon.js +26 -0
  24. package/dist/ui/icons.d.ts +19 -0
  25. package/dist/ui/icons.js +25 -0
  26. package/dist/ui/slots.d.ts +23 -0
  27. package/dist/ui/slots.js +13 -0
  28. package/package.json +71 -72
  29. package/src/App.tsx +13 -13
  30. package/src/agent-chat/AgentChat.tsx +729 -692
  31. package/src/agent-chat/AgentChatApp.tsx +211 -206
  32. package/src/agent-chat/PersonasPage.tsx +705 -678
  33. package/src/agent-chat/adapter.ts +272 -272
  34. package/src/agent-chat/app-def-check.ts +215 -215
  35. package/src/agent-chat/app.tsx +327 -327
  36. package/src/agent-chat/auth.ts +83 -83
  37. package/src/agent-chat/dock.ts +161 -161
  38. package/src/agent-chat/docs.ts +179 -179
  39. package/src/agent-chat/index.ts +17 -17
  40. package/src/agent-chat/mount.tsx +8 -1
  41. package/src/agent-chat/qual.ts +55 -55
  42. package/src/agent-chat/sse.ts +104 -104
  43. package/src/agent-chat/suggestions.ts +127 -0
  44. package/src/agent-chat/theme.ts +23 -23
  45. package/src/agent-chat/ui/CodeCopyHeader.tsx +29 -29
  46. package/src/agent-chat/ui/ConfirmCard.tsx +32 -32
  47. package/src/agent-chat/ui/FollowUpSuggestions.tsx +28 -0
  48. package/src/agent-chat/ui/Icon.tsx +53 -0
  49. package/src/agent-chat/ui/Lightbox.tsx +32 -32
  50. package/src/agent-chat/ui/QueueBar.tsx +70 -70
  51. package/src/agent-chat/ui/Splitter.tsx +81 -81
  52. package/src/agent-chat/ui/ThemeToggle.tsx +25 -25
  53. package/src/agent-chat/ui/TierPicker.tsx +112 -112
  54. package/src/agent-chat/ui/UIPromptCard.tsx +68 -68
  55. package/src/agent-chat/ui/icons.ts +31 -0
  56. package/src/agent-chat/ui/slots.tsx +35 -0
  57. package/src/agent-chat/ui/timefmt.ts +110 -110
  58. package/src/agent-chat/ui/useNarrow.ts +20 -20
  59. package/src/fake-product/entry.tsx +63 -54
  60. package/src/main.tsx +8 -8
  61. package/src/styles.css +1492 -1478
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>agentChat</title>
7
+ <script type="module" crossorigin src="/assets/index-D57mU5H5.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-B7uSE8SM.css">
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ </body>
13
+ </html>
package/dist/mount.d.ts CHANGED
@@ -15,6 +15,7 @@
15
15
  import type { ReactNode } from "react";
16
16
  import type { BrandingResponse } from "@njuptlzf/agent-chat-protocol";
17
17
  import { useAppHost, type AppDef } from "./app.tsx";
18
+ import type { Slots } from "./ui/slots.tsx";
18
19
  /** 宿主状态(`useAppHost` 的返回值):插槽从这里取品牌、身份、路由、人格。 */
19
20
  export type AppHost = ReturnType<typeof useAppHost>;
20
21
  /** 产品给的界面文案:全由 branding(manifest 声明)与当前人格决定。 */
@@ -33,6 +34,11 @@ export interface AgentAppProps {
33
34
  def: AppDef;
34
35
  /** 文案兜底:core 不认得任何人格名,也不写死任何一句话。 */
35
36
  texts(branding: BrandingResponse, persona: string): AppTexts;
37
+ /**
38
+ * 视觉件槽位覆盖(可插拔):整体替换 Icon / FollowUpSuggestions 等。
39
+ * 组件写结构兼容的形状即可(类型不导出,避免新增公开符号);不传 = 全默认。
40
+ */
41
+ slots?: Partial<Slots>;
36
42
  /** 侧栏底部的产品入口(声明人格、反馈问题…)。闭包,不能调 hook。 */
37
43
  footer?(host: AppHost): ReactNode;
38
44
  /** 宿主级组件(每日总结、反馈抽屉…)。闭包,不能调 hook。 */
@@ -47,4 +53,4 @@ export interface AgentAppProps {
47
53
  * 差别只有一处:人格不再由 core 判断"谁是声明人格"——`host.persona` 原样传给
48
54
  * `AgentChatApp`("" 收敛成 undefined = 产品默认助手),文案由 `texts` 决定。
49
55
  */
50
- export declare function AgentApp({ def, texts, footer, extras, loadErrorHint }: AgentAppProps): import("react").JSX.Element;
56
+ export declare function AgentApp({ def, texts, slots, footer, extras, loadErrorHint }: AgentAppProps): import("react").JSX.Element;
package/dist/mount.js CHANGED
@@ -9,7 +9,7 @@ import { AppShell, themeVarsOf, useAppHost } from "./app.js";
9
9
  * 差别只有一处:人格不再由 core 判断"谁是声明人格"——`host.persona` 原样传给
10
10
  * `AgentChatApp`("" 收敛成 undefined = 产品默认助手),文案由 `texts` 决定。
11
11
  */
12
- export function AgentApp({ def, texts, footer, extras, loadErrorHint }) {
12
+ export function AgentApp({ def, texts, slots, footer, extras, loadErrorHint }) {
13
13
  const host = useAppHost(def);
14
14
  if (host.loadError) {
15
15
  return (_jsxs("div", { className: "center", children: [_jsxs("p", { children: ["\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\uFF1A", host.loadError] }), loadErrorHint] }));
@@ -32,7 +32,7 @@ export function AgentApp({ def, texts, footer, extras, loadErrorHint }) {
32
32
  go(r);
33
33
  }, onQuals: () => go("quals"), switchTitle: def.labels?.switchTitle, footer: footer?.(host), children: [_jsx(DockPanel, { title: t.title, full: dockFull, onClose: host.closeChat, chat: _jsx(AgentChatApp
34
34
  // key 让切人格时重挂:会话绑死人格,同一个实例换 persona 只会撞 persona_mismatch。
35
- , { branding: branding, scope: qual?.id, renderCard: def.cardRenderer,
35
+ , { branding: branding, scope: qual?.id, renderCard: def.cardRenderer, slots: slots,
36
36
  // core 只做形状收敛("" → undefined = 产品默认助手),不认识具体名字。
37
37
  persona: persona || undefined, title: t.title, assistantLabel: t.assistantLabel, policyNote: t.policyNote, welcome: t.welcome, suggestions: t.suggestions, compact: !dockFull }, persona), children: def.page(ctx) }), extras?.(host)] }) }));
38
38
  }