@nexface/chat 0.1.14 → 0.1.15-alpha.1

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 (128) hide show
  1. package/dist/assistant-attachments.js +17 -60
  2. package/dist/assistant-attachments.js.map +1 -0
  3. package/dist/assistant-components.d.ts +3 -3
  4. package/dist/assistant-components.js +29 -77
  5. package/dist/assistant-components.js.map +1 -0
  6. package/dist/assistant-runtime.d.ts +1 -1
  7. package/dist/assistant-runtime.js +43 -100
  8. package/dist/assistant-runtime.js.map +1 -0
  9. package/dist/attachments.js +15 -36
  10. package/dist/attachments.js.map +1 -0
  11. package/dist/client.js +73 -312
  12. package/dist/client.js.map +1 -0
  13. package/dist/config.js +5 -4
  14. package/dist/config.js.map +1 -0
  15. package/dist/default-chat.d.ts +1 -1
  16. package/dist/default-chat.js +728 -2102
  17. package/dist/default-chat.js.map +7 -0
  18. package/dist/errors.js +18 -55
  19. package/dist/errors.js.map +1 -0
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/messages.js +1 -0
  23. package/dist/messages.js.map +1 -0
  24. package/dist/page-confirmation.js +4 -3
  25. package/dist/page-confirmation.js.map +1 -0
  26. package/dist/protocol-messages.js +66 -290
  27. package/dist/protocol-messages.js.map +1 -0
  28. package/dist/protocol-response.js +18 -38
  29. package/dist/protocol-response.js.map +1 -0
  30. package/dist/react.js +50 -146
  31. package/dist/react.js.map +1 -0
  32. package/dist/shared/errors.d.ts +1 -1
  33. package/dist/shared/errors.js +1 -0
  34. package/dist/shared/errors.js.map +1 -0
  35. package/dist/shared/runtime-controller.d.ts +0 -1
  36. package/dist/shared/runtime-controller.js +1 -0
  37. package/dist/shared/runtime-controller.js.map +1 -0
  38. package/dist/shared/runtime-execution.js +1 -0
  39. package/dist/shared/runtime-execution.js.map +1 -0
  40. package/dist/shared/schema.js +19 -45
  41. package/dist/shared/schema.js.map +1 -0
  42. package/dist/storage.js +53 -130
  43. package/dist/storage.js.map +1 -0
  44. package/dist/styles.css +20 -99
  45. package/dist/tool-result.js +3 -7
  46. package/dist/tool-result.js.map +1 -0
  47. package/dist/types.js +1 -0
  48. package/dist/types.js.map +1 -0
  49. package/dist/ui/attachment.aui.d.ts +1 -1
  50. package/dist/ui/attachment.aui.js +20 -16
  51. package/dist/ui/attachment.aui.js.map +1 -0
  52. package/dist/ui/avatar.js +1 -0
  53. package/dist/ui/avatar.js.map +1 -0
  54. package/dist/ui/button.js +1 -0
  55. package/dist/ui/button.js.map +1 -0
  56. package/dist/ui/code-block.js +3 -2
  57. package/dist/ui/code-block.js.map +1 -0
  58. package/dist/ui/collapsible.js +3 -2
  59. package/dist/ui/collapsible.js.map +1 -0
  60. package/dist/ui/composer-voice.js +2 -3
  61. package/dist/ui/composer-voice.js.map +1 -0
  62. package/dist/ui/dialog.d.ts +1 -1
  63. package/dist/ui/dialog.js +4 -9
  64. package/dist/ui/dialog.js.map +1 -0
  65. package/dist/ui/dropdown-menu.js +3 -2
  66. package/dist/ui/dropdown-menu.js.map +1 -0
  67. package/dist/ui/home-demo/action-bar.js +1 -0
  68. package/dist/ui/home-demo/action-bar.js.map +1 -0
  69. package/dist/ui/home-demo/composer.js +4 -7
  70. package/dist/ui/home-demo/composer.js.map +1 -0
  71. package/dist/ui/home-demo/greeting.d.ts +1 -1
  72. package/dist/ui/home-demo/greeting.js +2 -1
  73. package/dist/ui/home-demo/greeting.js.map +1 -0
  74. package/dist/ui/home-demo/messages.d.ts +1 -1
  75. package/dist/ui/home-demo/messages.js +5 -4
  76. package/dist/ui/home-demo/messages.js.map +1 -0
  77. package/dist/ui/home-demo/styles.js +1 -0
  78. package/dist/ui/home-demo/styles.js.map +1 -0
  79. package/dist/ui/home-demo/suggestions.d.ts +1 -1
  80. package/dist/ui/home-demo/suggestions.js +3 -5
  81. package/dist/ui/home-demo/suggestions.js.map +1 -0
  82. package/dist/ui/home-demo/surfaces.js +2 -3
  83. package/dist/ui/home-demo/surfaces.js.map +1 -0
  84. package/dist/ui/home-demo/thread.d.ts +1 -1
  85. package/dist/ui/home-demo/thread.js +2 -1
  86. package/dist/ui/home-demo/thread.js.map +1 -0
  87. package/dist/ui/home-demo/trace-line.d.ts +1 -1
  88. package/dist/ui/home-demo/trace-line.js +3 -2
  89. package/dist/ui/home-demo/trace-line.js.map +1 -0
  90. package/dist/ui/home-demo/trace.d.ts +1 -1
  91. package/dist/ui/home-demo/trace.js +9 -28
  92. package/dist/ui/home-demo/trace.js.map +1 -0
  93. package/dist/ui/home-demo/type.js +1 -0
  94. package/dist/ui/home-demo/type.js.map +1 -0
  95. package/dist/ui/input.js +1 -0
  96. package/dist/ui/input.js.map +1 -0
  97. package/dist/ui/markdown-text.js +3 -2
  98. package/dist/ui/markdown-text.js.map +1 -0
  99. package/dist/ui/reasoning.aui.js +3 -2
  100. package/dist/ui/reasoning.aui.js.map +1 -0
  101. package/dist/ui/reasoning.d.ts +1 -1
  102. package/dist/ui/reasoning.js +9 -6
  103. package/dist/ui/reasoning.js.map +1 -0
  104. package/dist/ui/surface.js +8 -27
  105. package/dist/ui/surface.js.map +1 -0
  106. package/dist/ui/thread-list.aui.d.ts +2 -2
  107. package/dist/ui/thread-list.aui.js +12 -18
  108. package/dist/ui/thread-list.aui.js.map +1 -0
  109. package/dist/ui/tool-group.aui.js +3 -2
  110. package/dist/ui/tool-group.aui.js.map +1 -0
  111. package/dist/ui/tooltip-icon-button.js +2 -1
  112. package/dist/ui/tooltip-icon-button.js.map +1 -0
  113. package/dist/ui/tooltip.js +1 -0
  114. package/dist/ui/tooltip.js.map +1 -0
  115. package/dist/ui/use-attachment-src.js +2 -1
  116. package/dist/ui/use-attachment-src.js.map +1 -0
  117. package/dist/ui/use-copy-to-clipboard.d.ts +1 -1
  118. package/dist/ui/use-copy-to-clipboard.js +2 -1
  119. package/dist/ui/use-copy-to-clipboard.js.map +1 -0
  120. package/dist/ui/utils.js +3 -9
  121. package/dist/ui/utils.js.map +1 -0
  122. package/dist/use-next-message.js +4 -7
  123. package/dist/use-next-message.js.map +1 -0
  124. package/dist/voice/types.js +1 -0
  125. package/dist/voice/types.js.map +1 -0
  126. package/dist/voice/use-voice.js +13 -35
  127. package/dist/voice/use-voice.js.map +1 -0
  128. package/package.json +4 -8
@@ -1,6 +1,6 @@
1
1
  import { ImageInputContentSchema, TextInputContentSchema } from "@ag-ui/core";
2
- import { attachmentContent, readAttachment, validateAttachment, } from "./attachments.js";
3
- const errorText = (error) => (error instanceof Error ? error.message : String(error));
2
+ import { attachmentContent, readAttachment, validateAttachment } from "./attachments.js";
3
+ const errorText = (error) => error instanceof Error ? error.message : String(error);
4
4
  const durablePreview = (preview) => preview?.startsWith("data:image/") ? preview : undefined;
5
5
  // Stop local waiting even when a service ignores cancellation; consume late rejections.
6
6
  function abortable(signal, task) {
@@ -16,20 +16,9 @@ export function toAssistantAttachment(attachment) {
16
16
  const content = attachmentContent(attachment).map((part) => {
17
17
  if (part.type === "text")
18
18
  return part;
19
- return {
20
- type: "image",
21
- image: part.source.type === "data"
22
- ? `data:${part.source.mimeType};base64,${part.source.value}`
23
- : part.source.value,
24
- };
19
+ return { type: "image", image: part.source.type === "data" ? `data:${part.source.mimeType};base64,${part.source.value}` : part.source.value };
25
20
  });
26
- return {
27
- id: attachment.id,
28
- name: attachment.name,
29
- type: attachment.preview ? "image" : "document",
30
- content,
31
- status: { type: "complete" },
32
- };
21
+ return { id: attachment.id, name: attachment.name, type: attachment.preview ? "image" : "document", content, status: { type: "complete" } };
33
22
  }
34
23
  // Only this bridge knows assistant-ui's attachment state and lifecycle types.
35
24
  export class AssistantAttachments {
@@ -43,12 +32,8 @@ export class AssistantAttachments {
43
32
  this.changed = changed;
44
33
  this.notice = notice;
45
34
  }
46
- get blocked() {
47
- return [...this.entries.values()].some((entry) => entry.adding || Boolean(entry.error));
48
- }
49
- preview(id) {
50
- return this.entries.get(id)?.preview;
51
- }
35
+ get blocked() { return [...this.entries.values()].some((entry) => entry.adding || Boolean(entry.error)); }
36
+ preview(id) { return this.entries.get(id)?.preview; }
52
37
  async *add({ file }) {
53
38
  if (this.disposed || this.options === false)
54
39
  throw new Error("附件已禁用。");
@@ -62,22 +47,10 @@ export class AssistantAttachments {
62
47
  this.notice("附件数量超出限制。");
63
48
  throw new Error("附件数量超出限制。");
64
49
  }
65
- const entry = {
66
- id: crypto.randomUUID(),
67
- file,
68
- controller: new AbortController(),
69
- adapter: options.adapter,
70
- adding: true,
71
- };
50
+ const entry = { id: crypto.randomUUID(), file, controller: new AbortController(), adapter: options.adapter, adding: true };
72
51
  this.entries.set(entry.id, entry);
73
52
  this.changed();
74
- const base = {
75
- id: entry.id,
76
- file,
77
- name: file.name,
78
- contentType: file.type,
79
- type: file.type.startsWith("image/") ? "image" : "document",
80
- };
53
+ const base = { id: entry.id, file, name: file.name, contentType: file.type, type: file.type.startsWith("image/") ? "image" : "document" };
81
54
  yield { ...base, status: { type: "running", reason: "uploading", progress: 0 } };
82
55
  try {
83
56
  if (entry.adapter) {
@@ -116,12 +89,7 @@ export class AssistantAttachments {
116
89
  try {
117
90
  let content;
118
91
  if (entry.adapter) {
119
- const result = await abortable(entry.controller.signal, entry.adapter.send({
120
- id: entry.id,
121
- file: entry.file,
122
- data: entry.data,
123
- signal: entry.controller.signal,
124
- }));
92
+ const result = await abortable(entry.controller.signal, entry.adapter.send({ id: entry.id, file: entry.file, data: entry.data, signal: entry.controller.signal }));
125
93
  this.assertLive(entry);
126
94
  if (!Array.isArray(result.content) || !result.content.length)
127
95
  throw new Error("附件处理必须返回文本或内联图片。");
@@ -138,12 +106,7 @@ export class AssistantAttachments {
138
106
  content = attachmentContent(entry.local);
139
107
  this.assertLive(entry);
140
108
  const preview = durablePreview(entry.preview);
141
- entry.result = {
142
- id: entry.id,
143
- name: entry.file.name,
144
- content,
145
- ...(preview ? { preview } : {}),
146
- };
109
+ entry.result = { id: entry.id, name: entry.file.name, content, ...(preview ? { preview } : {}) };
147
110
  return toAssistantAttachment(entry.result);
148
111
  }
149
112
  catch (error) {
@@ -161,12 +124,9 @@ export class AssistantAttachments {
161
124
  entry.controller.abort();
162
125
  if (!this.disposed)
163
126
  this.changed();
164
- void Promise.resolve()
165
- .then(() => entry.adapter?.remove?.({ id: entry.id, file: entry.file, data: entry.data }))
166
- .catch((error) => {
167
- if (!this.disposed)
168
- this.notice(`附件清理失败:${errorText(error)}`);
169
- });
127
+ void Promise.resolve().then(() => entry.adapter?.remove?.({ id: entry.id, file: entry.file, data: entry.data }))
128
+ .catch((error) => { if (!this.disposed)
129
+ this.notice(`附件清理失败:${errorText(error)}`); });
170
130
  }
171
131
  take(attachments) {
172
132
  return attachments.map((attachment) => {
@@ -186,11 +146,8 @@ export class AssistantAttachments {
186
146
  for (const id of this.entries.keys())
187
147
  void this.remove({ id });
188
148
  }
189
- live(entry) {
190
- return (!this.disposed && !entry.controller.signal.aborted && this.entries.get(entry.id) === entry);
191
- }
192
- assertLive(entry) {
193
- if (!this.live(entry))
194
- throw new DOMException("附件处理已取消。", "AbortError");
195
- }
149
+ live(entry) { return !this.disposed && !entry.controller.signal.aborted && this.entries.get(entry.id) === entry; }
150
+ assertLive(entry) { if (!this.live(entry))
151
+ throw new DOMException("附件处理已取消。", "AbortError"); }
196
152
  }
153
+ //# sourceMappingURL=assistant-attachments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assistant-attachments.js","sourceRoot":"","sources":["../src/assistant-attachments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAmB,MAAM,kBAAkB,CAAC;AAe1G,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7F,MAAM,cAAc,GAAG,CAAC,OAAgB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,UAAU,CAAC,KAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC9G","sourcesContent":["import type { AgentInputContent } from \"@nexface/agent\";\nimport type { AttachmentAdapter, PendingAttachment, CompleteAttachment } from \"@assistant-ui/react\";\nimport { ImageInputContentSchema, TextInputContentSchema } from \"@ag-ui/core\";\nimport { attachmentContent, readAttachment, validateAttachment, type Attachment } from \"./attachments.js\";\nimport type { ChatAttachmentOptions } from \"./types.js\";\n\ntype Entry = {\n id: string;\n file: File;\n controller: AbortController;\n adapter: ChatAttachmentOptions[\"adapter\"];\n data?: unknown;\n preview?: string | undefined;\n local?: Attachment;\n result?: Attachment;\n adding: boolean;\n error?: string;\n};\nconst errorText = (error: unknown) => error instanceof Error ? error.message : String(error);\nconst durablePreview = (preview?: string) => preview?.startsWith(\"data:image/\") ? preview : undefined;\n\n// Stop local waiting even when a service ignores cancellation; consume late rejections.\nfunction abortable<T>(signal: AbortSignal, task: Promise<T>): Promise<T> {\n return new Promise((resolve, reject) => {\n const abort = () => reject(new DOMException(\"附件处理已取消。\", \"AbortError\"));\n signal.addEventListener(\"abort\", abort, { once: true });\n void task.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", abort));\n if (signal.aborted) abort();\n });\n}\n\nexport function toAssistantAttachment(attachment: Attachment): CompleteAttachment {\n const content: CompleteAttachment[\"content\"] = attachmentContent(attachment).map((part) => {\n if (part.type === \"text\") return part;\n return { type: \"image\", image: part.source.type === \"data\" ? `data:${part.source.mimeType};base64,${part.source.value}` : part.source.value };\n });\n return { id: attachment.id, name: attachment.name, type: attachment.preview ? \"image\" : \"document\", content, status: { type: \"complete\" } };\n}\n\n// Only this bridge knows assistant-ui's attachment state and lifecycle types.\nexport class AssistantAttachments implements AttachmentAdapter {\n readonly accept = \"*\";\n private entries = new Map<string, Entry>();\n private disposed = false;\n options: false | ChatAttachmentOptions = {};\n constructor(private changed: () => void, private notice: (message: string) => void) {}\n get blocked() { return [...this.entries.values()].some((entry) => entry.adding || Boolean(entry.error)); }\n preview(id: string) { return this.entries.get(id)?.preview; }\n\n async *add({ file }: { file: File }): AsyncGenerator<PendingAttachment, void> {\n if (this.disposed || this.options === false) throw new Error(\"附件已禁用。\");\n const options = this.options;\n const maxCount = options.maxCount ?? 3;\n if (!Number.isInteger(maxCount) || maxCount <= 0) {\n this.notice(\"附件数量限制必须是正整数。\");\n throw new Error(\"附件数量限制必须是正整数。\");\n }\n if (this.entries.size >= maxCount) {\n this.notice(\"附件数量超出限制。\");\n throw new Error(\"附件数量超出限制。\");\n }\n const entry: Entry = { id: crypto.randomUUID(), file, controller: new AbortController(), adapter: options.adapter, adding: true };\n this.entries.set(entry.id, entry);\n this.changed();\n const base = { id: entry.id, file, name: file.name, contentType: file.type, type: file.type.startsWith(\"image/\") ? \"image\" : \"document\" };\n yield { ...base, status: { type: \"running\", reason: \"uploading\", progress: 0 } };\n try {\n if (entry.adapter) {\n validateAttachment(file, options);\n const result = await abortable(entry.controller.signal, entry.adapter.add({ id: entry.id, file, signal: entry.controller.signal }));\n this.assertLive(entry);\n entry.data = result.data;\n entry.preview = result.preview;\n } else {\n entry.local = await abortable(entry.controller.signal, readAttachment(file, options));\n this.assertLive(entry);\n entry.preview = entry.local.preview;\n }\n yield { ...base, status: { type: \"requires-action\", reason: \"composer-send\" } };\n } catch (error) {\n if (!this.live(entry)) return;\n entry.error = errorText(error);\n yield { ...base, status: { type: \"incomplete\", reason: \"error\", message: entry.error } };\n } finally {\n entry.adding = false;\n if (!this.disposed) this.changed();\n }\n }\n\n async send(attachment: { id: string }): Promise<CompleteAttachment> {\n const entry = this.entries.get(attachment.id);\n if (!entry) throw new Error(\"附件已移除。\");\n this.assertLive(entry);\n if (entry.adding || entry.error) throw new Error(entry.error ?? \"附件尚未准备完成。\");\n try {\n let content: AgentInputContent[];\n if (entry.adapter) {\n const result = await abortable(entry.controller.signal, entry.adapter.send({ id: entry.id, file: entry.file, data: entry.data, signal: entry.controller.signal }));\n this.assertLive(entry);\n if (!Array.isArray(result.content) || !result.content.length) throw new Error(\"附件处理必须返回文本或内联图片。\");\n content = result.content.map((part) => {\n if (part.type === \"text\") return TextInputContentSchema.parse(part);\n const image = ImageInputContentSchema.parse(part);\n if (image.source.type !== \"data\") throw new Error(\"附件仅支持内联图片,不支持图片 URL。\");\n return image;\n });\n } else content = attachmentContent(entry.local!);\n this.assertLive(entry);\n const preview = durablePreview(entry.preview);\n entry.result = { id: entry.id, name: entry.file.name, content, ...(preview ? { preview } : {}) };\n return toAssistantAttachment(entry.result);\n } catch (error) {\n if (this.live(entry)) this.notice(errorText(error));\n throw error;\n }\n }\n\n // Removal is local-first. Cleanup failures must not resurrect the chip.\n async remove(attachment: { id: string }): Promise<void> {\n const entry = this.entries.get(attachment.id);\n if (!entry) return;\n this.entries.delete(entry.id);\n entry.controller.abort();\n if (!this.disposed) this.changed();\n void Promise.resolve().then(() => entry.adapter?.remove?.({ id: entry.id, file: entry.file, data: entry.data }))\n .catch((error) => { if (!this.disposed) this.notice(`附件清理失败:${errorText(error)}`); });\n }\n\n take(attachments: readonly CompleteAttachment[]): Attachment[] {\n return attachments.map((attachment) => {\n const entry = this.entries.get(attachment.id);\n if (!entry?.result) throw new Error(\"附件尚未准备完成。\");\n return entry.result;\n });\n }\n commit(attachments: readonly CompleteAttachment[]) {\n for (const attachment of attachments) this.entries.delete(attachment.id);\n this.changed();\n }\n dispose() {\n this.disposed = true;\n for (const id of this.entries.keys()) void this.remove({ id });\n }\n private live(entry: Entry) { return !this.disposed && !entry.controller.signal.aborted && this.entries.get(entry.id) === entry; }\n private assertLive(entry: Entry) { if (!this.live(entry)) throw new DOMException(\"附件处理已取消。\", \"AbortError\"); }\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  import type { UIMessagePart } from "./messages.js";
2
2
  import type { AssistantBinding } from "./assistant-runtime.js";
3
3
  import type { ChatProps } from "./types.js";
4
- export declare function AttachmentTile({ binding, savedPreview, }: {
4
+ export declare function AttachmentTile({ binding, savedPreview }: {
5
5
  binding?: AssistantBinding;
6
6
  savedPreview?: string | undefined;
7
7
  }): import("react").JSX.Element;
8
- export declare function AssistantComposer({ binding, options, placeholder, suggestion, busy, cancelling, cancel, }: {
8
+ export declare function AssistantComposer({ binding, options, placeholder, suggestion, busy, cancelling, cancel }: {
9
9
  binding: AssistantBinding;
10
10
  options: ChatProps["attachments"];
11
11
  placeholder: string;
@@ -14,7 +14,7 @@ export declare function AssistantComposer({ binding, options, placeholder, sugge
14
14
  cancelling: boolean;
15
15
  cancel(): void;
16
16
  }): import("react").JSX.Element;
17
- export declare function AssistantParts({ showDetails, tools, }: {
17
+ export declare function AssistantParts({ showDetails, tools }: {
18
18
  showDetails: boolean;
19
19
  tools?: readonly UIMessagePart[];
20
20
  }): import("react").JSX.Element;
@@ -5,7 +5,7 @@ import { MarkdownText } from "./ui/markdown-text.js";
5
5
  import { Composer } from "./ui/home-demo/composer.js";
6
6
  import { ComposerVoice } from "./ui/composer-voice.js";
7
7
  import { cn } from "./ui/utils.js";
8
- import { AuiIf, AttachmentPrimitive, ComposerPrimitive, useAuiState, MessagePrimitive, groupPartByType, } from "@assistant-ui/react";
8
+ import { AuiIf, AttachmentPrimitive, ComposerPrimitive, useAuiState, MessagePrimitive, groupPartByType } from "@assistant-ui/react";
9
9
  import { ArrowUpIcon, PlusIcon, SquareIcon, MicIcon, XIcon } from "lucide-react";
10
10
  import { TooltipIconButton } from "./ui/tooltip-icon-button.js";
11
11
  import { Button } from "./ui/button.js";
@@ -15,52 +15,30 @@ import { DisclosureTrigger, ToolCall, disclosureContentClass } from "./ui/home-d
15
15
  import { Reasoning, ReasoningRoot, ReasoningContent, ReasoningText } from "./ui/reasoning.aui.js";
16
16
  import { TraceLine } from "./ui/home-demo/trace-line.js";
17
17
  import { attachmentAccept } from "./attachments.js";
18
- export function AttachmentTile({ binding, savedPreview, }) {
18
+ export function AttachmentTile({ binding, savedPreview }) {
19
19
  const attachment = useAuiState((s) => s.attachment);
20
- const preview = binding?.attachments.preview(attachment.id) ??
21
- savedPreview ??
22
- attachment.content?.find((part) => part.type === "image")?.image;
23
- return (_jsx(AttachmentUI, { preview: preview, children: _jsxs("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [_jsx(AttachmentPrimitive.Name, {}), binding && attachment.status.type === "requires-action" ? (_jsx("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" })) : null, attachment.status.type === "running" ? (_jsx("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" })) : null, attachment.status.type === "incomplete" ? (_jsx("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "附件处理失败" })) : null] }) }));
20
+ const preview = binding?.attachments.preview(attachment.id) ?? savedPreview ?? attachment.content?.find((part) => part.type === "image")?.image;
21
+ return _jsx(AttachmentUI, { preview: preview, children: _jsxs("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [_jsx(AttachmentPrimitive.Name, {}), binding && attachment.status.type === "requires-action" ? _jsx("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" }) : null, attachment.status.type === "running" ? _jsx("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" }) : null, attachment.status.type === "incomplete" ? _jsx("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "附件处理失败" }) : null] }) });
24
22
  }
25
- export function AssistantComposer({ binding, options, placeholder, suggestion, busy, cancelling, cancel, }) {
23
+ export function AssistantComposer({ binding, options, placeholder, suggestion, busy, cancelling, cancel }) {
26
24
  const input = useRef(null);
27
25
  const sending = binding.sending;
28
26
  const voiceBusy = binding.voice.status !== "idle";
29
27
  const inputDisabled = sending || voiceBusy;
30
- const voiceDisabledReason = busy
31
- ? "任务执行中,暂不能录音"
32
- : sending
33
- ? "正在处理附件,暂不能录音"
34
- : undefined;
28
+ const voiceDisabledReason = busy ? "任务执行中,暂不能录音" : sending ? "正在处理附件,暂不能录音" : undefined;
35
29
  const empty = useAuiState((state) => state.composer.text.length === 0);
36
30
  const nextMessage = !busy && !inputDisabled && empty ? suggestion : undefined;
37
31
  const showCancel = useAuiState((state) => busy && (state.thread.isRunning || state.composer.isEmpty));
38
32
  const addFiles = (files) => {
39
33
  for (const file of files)
40
- void binding.runtime.thread.composer
41
- .addAttachment(file)
42
- .catch((error) => binding.setNotice(error instanceof Error ? error.message : String(error)));
34
+ void binding.runtime.thread.composer.addAttachment(file).catch((error) => binding.setNotice(error instanceof Error ? error.message : String(error)));
43
35
  };
44
- return (_jsxs(Composer, { onSubmit: (event) => {
45
- event.preventDefault();
46
- void binding.send();
47
- }, inputProps: {
48
- "aria-label": "输入 Agent 任务",
49
- placeholder: nextMessage ?? placeholder,
50
- disabled: inputDisabled,
51
- cancelOnEscape: false,
36
+ return _jsxs(Composer, { onSubmit: (event) => { event.preventDefault(); void binding.send(); }, inputProps: { "aria-label": "输入 Agent 任务", placeholder: nextMessage ?? placeholder, disabled: inputDisabled, cancelOnEscape: false,
52
37
  addAttachmentOnPaste: !inputDisabled,
53
38
  onKeyDown: (event) => {
54
39
  if (event.keyCode === 229)
55
40
  event.preventDefault();
56
- else if ((event.key === "ArrowRight" || event.key === "Tab") &&
57
- nextMessage &&
58
- !event.nativeEvent.isComposing &&
59
- !event.shiftKey &&
60
- !event.ctrlKey &&
61
- !event.altKey &&
62
- !event.metaKey &&
63
- !event.currentTarget.value) {
41
+ else if ((event.key === "ArrowRight" || event.key === "Tab") && nextMessage && !event.nativeEvent.isComposing && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey && !event.currentTarget.value) {
64
42
  event.preventDefault();
65
43
  binding.runtime.thread.composer.setText(nextMessage);
66
44
  }
@@ -68,23 +46,11 @@ export function AssistantComposer({ binding, options, placeholder, suggestion, b
68
46
  event.preventDefault();
69
47
  void binding.send();
70
48
  }
71
- },
72
- }, actions: _jsxs(_Fragment, { children: [voiceBusy ? (_jsx("span", { role: "status", className: cn("sr-only"), children: binding.voice.status === "starting"
73
- ? "正在准备语音输入,请确认麦克风已授权…"
74
- : binding.voice.status === "transcribing"
75
- ? "正在识别,请稍候…"
76
- : "正在录音" })) : null, voiceBusy ? (_jsx(TooltipIconButton, { tooltip: "\u53D6\u6D88\u5F55\u97F3", "aria-label": "\u53D6\u6D88\u8BED\u97F3\u8F93\u5165", className: cn("size-7 shrink-0"), onClick: binding.voice.cancel, children: _jsx(XIcon, { className: cn("size-4") }) })) : options !== false ? (_jsxs(_Fragment, { children: [_jsx("input", { ref: input, type: "file", multiple: true, disabled: inputDisabled, accept: options?.accept ?? attachmentAccept, hidden: true, onChange: (event) => {
77
- addFiles(Array.from(event.target.files ?? []));
78
- event.target.value = "";
79
- } }), _jsx("button", { type: "button", className: cn("text-muted-foreground hover:text-foreground rounded-control grid size-7 shrink-0 place-items-center transition-colors"), "aria-label": "\u6DFB\u52A0\u9644\u4EF6", disabled: inputDisabled, onClick: () => input.current?.click(), children: _jsx(PlusIcon, { className: cn("size-4") }) })] })) : (_jsx("span", {})), voiceBusy ? _jsx(ComposerVoice, { recording: binding.voice.status === "recording" }) : null, _jsxs("div", { className: cn("flex shrink-0 items-center gap-1"), children: [_jsxs(AuiIf, { condition: (state) => state.thread.capabilities.dictation, children: [_jsx(AuiIf, { condition: (state) => state.composer.dictation == null, children: _jsx(TooltipProvider, { delayDuration: 0, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: cn("inline-flex"), tabIndex: voiceDisabledReason ? 0 : undefined, "aria-label": voiceDisabledReason, children: _jsx(ComposerPrimitive.Dictate, { asChild: true, disabled: busy || sending, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165", "aria-description": voiceDisabledReason, className: cn("size-7 p-1"), children: _jsx(MicIcon, { className: cn("size-4") }) }) }) }) }), _jsx(TooltipContent, { children: voiceDisabledReason ?? "语音输入" })] }) }) }), _jsx(AuiIf, { condition: (state) => state.composer.dictation != null, children: _jsx(ComposerPrimitive.StopDictation, { asChild: true, disabled: binding.voice.status !== "recording", children: _jsx("button", { type: "button", "aria-label": "\u7ED3\u675F\u8BED\u97F3\u8F93\u5165", title: "\u7ED3\u675F\u5F55\u97F3", className: cn("text-destructive rounded-control grid size-7 place-items-center transition-colors disabled:opacity-50"), children: _jsx(SquareIcon, { className: cn("size-3 animate-pulse fill-current") }) }) }) })] }), showCancel ? (_jsx("button", { type: "button", "aria-label": "\u53D6\u6D88\u4EFB\u52A1", className: cn("bg-primary text-primary-foreground rounded-control grid size-7 place-items-center"), disabled: cancelling, onClick: cancel, children: _jsx(SquareIcon, { className: cn("size-3 fill-current") }) })) : (_jsx(ComposerPrimitive.Send, { asChild: true, disabled: inputDisabled, children: _jsx("button", { type: "button", onClick: (event) => {
80
- event.preventDefault();
81
- void binding.send();
82
- }, "aria-label": "\u53D1\u9001\u4EFB\u52A1", className: cn("bg-primary text-primary-foreground rounded-control grid size-7 place-items-center transition-opacity disabled:opacity-40"), children: _jsx(ArrowUpIcon, { className: cn("size-4") }) }) }))] })] }), children: [_jsx("div", { ref: (element) => {
83
- element?.toggleAttribute("inert", inputDisabled);
84
- }, className: cn("aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden"), children: _jsx(ComposerPrimitive.Attachments, { children: () => _jsx(AttachmentTile, { binding: binding }) }) }), sending ? _jsx("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null] }));
49
+ } }, actions: _jsxs(_Fragment, { children: [voiceBusy ? _jsx("span", { role: "status", className: cn("sr-only"), children: binding.voice.status === "starting" ? "正在准备语音输入,请确认麦克风已授权…" : binding.voice.status === "transcribing" ? "正在识别,请稍候…" : "正在录音" }) : null, voiceBusy ? _jsx(TooltipIconButton, { tooltip: "\u53D6\u6D88\u5F55\u97F3", "aria-label": "\u53D6\u6D88\u8BED\u97F3\u8F93\u5165", className: cn("size-7 shrink-0"), onClick: binding.voice.cancel, children: _jsx(XIcon, { className: cn("size-4") }) }) : options !== false ? _jsxs(_Fragment, { children: [_jsx("input", { ref: input, type: "file", multiple: true, disabled: inputDisabled, accept: options?.accept ?? attachmentAccept, hidden: true, onChange: (event) => { addFiles(Array.from(event.target.files ?? [])); event.target.value = ""; } }), _jsx("button", { type: "button", className: cn("text-muted-foreground hover:text-foreground rounded-control grid size-7 shrink-0 place-items-center transition-colors"), "aria-label": "\u6DFB\u52A0\u9644\u4EF6", disabled: inputDisabled, onClick: () => input.current?.click(), children: _jsx(PlusIcon, { className: cn("size-4") }) })] }) : _jsx("span", {}), voiceBusy ? _jsx(ComposerVoice, { recording: binding.voice.status === "recording" }) : null, _jsxs("div", { className: cn("flex shrink-0 items-center gap-1"), children: [_jsxs(AuiIf, { condition: (state) => state.thread.capabilities.dictation, children: [_jsx(AuiIf, { condition: (state) => state.composer.dictation == null, children: _jsx(TooltipProvider, { delayDuration: 0, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: cn("inline-flex"), tabIndex: voiceDisabledReason ? 0 : undefined, "aria-label": voiceDisabledReason, children: _jsx(ComposerPrimitive.Dictate, { asChild: true, disabled: busy || sending, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165", "aria-description": voiceDisabledReason, className: cn("size-7 p-1"), children: _jsx(MicIcon, { className: cn("size-4") }) }) }) }) }), _jsx(TooltipContent, { children: voiceDisabledReason ?? "语音输入" })] }) }) }), _jsx(AuiIf, { condition: (state) => state.composer.dictation != null, children: _jsx(ComposerPrimitive.StopDictation, { asChild: true, disabled: binding.voice.status !== "recording", children: _jsx("button", { type: "button", "aria-label": "\u7ED3\u675F\u8BED\u97F3\u8F93\u5165", title: "\u7ED3\u675F\u5F55\u97F3", className: cn("text-destructive rounded-control grid size-7 place-items-center transition-colors disabled:opacity-50"), children: _jsx(SquareIcon, { className: cn("size-3 animate-pulse fill-current") }) }) }) })] }), showCancel ? _jsx("button", { type: "button", "aria-label": "\u53D6\u6D88\u4EFB\u52A1", className: cn("bg-primary text-primary-foreground rounded-control grid size-7 place-items-center"), disabled: cancelling, onClick: cancel, children: _jsx(SquareIcon, { className: cn("size-3 fill-current") }) }) :
50
+ _jsx(ComposerPrimitive.Send, { asChild: true, disabled: inputDisabled, children: _jsx("button", { type: "button", onClick: (event) => { event.preventDefault(); void binding.send(); }, "aria-label": "\u53D1\u9001\u4EFB\u52A1", className: cn("bg-primary text-primary-foreground rounded-control grid size-7 place-items-center transition-opacity disabled:opacity-40"), children: _jsx(ArrowUpIcon, { className: cn("size-4") }) }) })] })] }), children: [_jsx("div", { ref: (element) => { element?.toggleAttribute("inert", inputDisabled); }, className: cn("aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden"), children: _jsx(ComposerPrimitive.Attachments, { children: () => _jsx(AttachmentTile, { binding: binding }) }) }), sending ? _jsx("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null] });
85
51
  }
86
- function ToolGroup({ tools, running, count, children, }) {
87
- const errors = tools.flatMap((tool) => (tool.type === "tool" && tool.error ? [tool.error] : []));
52
+ function ToolGroup({ tools, running, count, children }) {
53
+ const errors = tools.flatMap((tool) => tool.type === "tool" && tool.error ? [tool.error] : []);
88
54
  const errorIds = JSON.stringify(errors.map((error) => error.id));
89
55
  const hasErrors = errors.length > 0;
90
56
  const [open, setOpen] = useState(hasErrors);
@@ -93,39 +59,25 @@ function ToolGroup({ tools, running, count, children, }) {
93
59
  setOpen(true);
94
60
  }, [errorIds]);
95
61
  const unknown = hasErrors && errors.every((error) => error.scope === "tool" && error.execution === "unknown");
96
- return (_jsxs(ToolGroupRoot, { variant: "ghost", className: cn("my-1"), open: open, onOpenChange: setOpen, children: [_jsx(DisclosureTrigger, { live: running && !hasErrors, label: hasErrors ? (unknown ? "Result unknown" : "Failed") : running ? "running" : "ran", detail: `${count} tools` }), _jsx(ToolGroupContent, { className: cn(disclosureContentClass), children: children })] }));
62
+ return _jsxs(ToolGroupRoot, { variant: "ghost", className: cn("my-1"), open: open, onOpenChange: setOpen, children: [_jsx(DisclosureTrigger, { live: running && !hasErrors, label: hasErrors ? unknown ? "Result unknown" : "Failed" : running ? "running" : "ran", detail: `${count} tools` }), _jsx(ToolGroupContent, { className: cn(disclosureContentClass), children: children })] });
97
63
  }
98
64
  const GroupedParts = MessagePrimitive.GroupedParts;
99
- const groupAssistantParts = groupPartByType({
100
- reasoning: ["group-chainOfThought", "group-reasoning"],
101
- source: ["group-chainOfThought", "group-source"],
102
- "tool-call": ["group-chainOfThought", "group-tool"],
103
- "standalone-tool-call": [],
104
- });
105
- export function AssistantParts({ showDetails, tools = [], }) {
106
- return (_jsx(_Fragment, { children: _jsx(GroupedParts, { groupBy: groupAssistantParts, children: ({ part, children }) => {
65
+ const groupAssistantParts = groupPartByType({ reasoning: ["group-chainOfThought", "group-reasoning"], source: ["group-chainOfThought", "group-source"], "tool-call": ["group-chainOfThought", "group-tool"], "standalone-tool-call": [] });
66
+ export function AssistantParts({ showDetails, tools = [] }) {
67
+ return _jsx(_Fragment, { children: _jsx(GroupedParts, { groupBy: groupAssistantParts, children: ({ part, children }) => {
107
68
  switch (part.type) {
108
- case "group-chainOfThought":
109
- return _jsx("div", { className: cn("mb-3"), children: children });
110
- case "group-tool":
111
- return part.indices.length === 1 ? (_jsx(_Fragment, { children: children })) : (_jsx(ToolGroup, { tools: tools.filter((_, index) => part.indices.includes(index)), running: part.status.type === "running", count: part.indices.length, children: children }));
112
- case "group-reasoning":
113
- return (_jsxs(ReasoningRoot, { variant: "ghost", streaming: part.status.type === "running", className: cn("my-1"), children: [_jsx(DisclosureTrigger, { live: part.status.type === "running", label: part.status.type === "running" ? "thinking" : "reasoning" }), _jsx(ReasoningContent, { "aria-busy": part.status.type === "running", className: cn(disclosureContentClass), children: _jsx(ReasoningText, { className: cn("ps-0"), children: children }) })] }));
114
- case "reasoning":
115
- return _jsx(Reasoning, { ...part });
69
+ case "group-chainOfThought": return _jsx("div", { className: cn("mb-3"), children: children });
70
+ case "group-tool": return part.indices.length === 1 ? _jsx(_Fragment, { children: children }) : _jsx(ToolGroup, { tools: tools.filter((_, index) => part.indices.includes(index)), running: part.status.type === "running", count: part.indices.length, children: children });
71
+ case "group-reasoning": return _jsxs(ReasoningRoot, { variant: "ghost", streaming: part.status.type === "running", className: cn("my-1"), children: [_jsx(DisclosureTrigger, { live: part.status.type === "running", label: part.status.type === "running" ? "thinking" : "reasoning" }), _jsx(ReasoningContent, { "aria-busy": part.status.type === "running", className: cn(disclosureContentClass), children: _jsx(ReasoningText, { className: cn("ps-0"), children: children }) })] });
72
+ case "reasoning": return _jsx(Reasoning, { ...part });
116
73
  case "group-source":
117
- case "source":
118
- return null;
119
- case "data":
120
- return part.dataRendererUI;
121
- case "text":
122
- return part.text === "" && part.status?.type === "running" ? (_jsx(TraceLine, { live: true, label: "thinking" })) : (_jsx(MarkdownText, {}));
123
- case "tool-call":
124
- return (part.toolUI ?? (_jsx(ToolCall, { ...part, showDetails: showDetails, presentation: tools.find((tool) => tool.type === "tool" && tool.toolCallId === part.toolCallId) })));
125
- case "indicator":
126
- return _jsx(TraceLine, { live: true, label: "thinking" });
127
- default:
128
- return null;
74
+ case "source": return null;
75
+ case "data": return part.dataRendererUI;
76
+ case "text": return part.text === "" && part.status?.type === "running" ? _jsx(TraceLine, { live: true, label: "thinking" }) : _jsx(MarkdownText, {});
77
+ case "tool-call": return part.toolUI ?? _jsx(ToolCall, { ...part, showDetails: showDetails, presentation: tools.find((tool) => tool.type === "tool" && tool.toolCallId === part.toolCallId) });
78
+ case "indicator": return _jsx(TraceLine, { live: true, label: "thinking" });
79
+ default: return null;
129
80
  }
130
- } }) }));
81
+ } }) });
131
82
  }
83
+ //# sourceMappingURL=assistant-components.js.map
@@ -0,0 +1 @@
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,CAAC,OAAO,IAAI,CAAC;gBACvB,CAAC;YACH,CAAC,GAAgB,GAAG,CAAC;AACvB,CAAC","sourcesContent":["import type { UIMessagePart } from \"./messages.js\";\nimport { AttachmentUI } from \"./ui/attachment.aui.js\";\nimport { useEffect, useRef, useState, type ReactNode, type ComponentType } from \"react\";\nimport { MarkdownText } from \"./ui/markdown-text.js\";\nimport { Composer } from \"./ui/home-demo/composer.js\";\nimport { ComposerVoice } from \"./ui/composer-voice.js\";\nimport { cn } from \"./ui/utils.js\";\nimport { AuiIf, AttachmentPrimitive, ComposerPrimitive, useAuiState, MessagePrimitive, groupPartByType } from \"@assistant-ui/react\";\nimport { ArrowUpIcon, PlusIcon, SquareIcon, MicIcon, XIcon } from \"lucide-react\";\nimport { TooltipIconButton } from \"./ui/tooltip-icon-button.js\";\nimport { Button } from \"./ui/button.js\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./ui/tooltip.js\";\nimport { ToolGroupRoot, ToolGroupContent } from \"./ui/tool-group.aui.js\";\nimport { DisclosureTrigger, ToolCall, disclosureContentClass } from \"./ui/home-demo/trace.js\";\nimport { Reasoning, ReasoningRoot, ReasoningContent, ReasoningText } from \"./ui/reasoning.aui.js\";\nimport { TraceLine } from \"./ui/home-demo/trace-line.js\";\nimport type { AssistantBinding } from \"./assistant-runtime.js\";\nimport { attachmentAccept } from \"./attachments.js\";\nimport type { ChatProps } from \"./types.js\";\n\nexport function AttachmentTile({ binding, savedPreview }: { binding?: AssistantBinding; savedPreview?: string | undefined }) {\n const attachment = useAuiState((s) => s.attachment);\n const preview = binding?.attachments.preview(attachment.id) ?? savedPreview ?? attachment.content?.find((part) => part.type === \"image\")?.image;\n return <AttachmentUI preview={preview}>\n <div className={cn(\"flex max-w-40 flex-col text-xs wrap-anywhere\")}><AttachmentPrimitive.Name />\n {binding && attachment.status.type === \"requires-action\" ? <small className={cn(\"text-muted-foreground\")}>已就绪</small> : null}\n {attachment.status.type === \"running\" ? <small className={cn(\"text-muted-foreground\")}>正在处理…</small> : null}\n {attachment.status.type === \"incomplete\" ? <small className={cn(\"text-destructive\")} role=\"alert\">{attachment.status.message ?? \"附件处理失败\"}</small> : null}\n </div>\n </AttachmentUI>;\n}\n\nexport function AssistantComposer({ binding, options, placeholder, suggestion, busy, cancelling, cancel }: {\n binding: AssistantBinding; options: ChatProps[\"attachments\"]; placeholder: string;\n suggestion?: string | undefined;\n busy: boolean; cancelling: boolean; cancel(): void;\n}) {\n const input = useRef<HTMLInputElement>(null);\n const sending = binding.sending;\n const voiceBusy = binding.voice.status !== \"idle\";\n const inputDisabled = sending || voiceBusy;\n const voiceDisabledReason = busy ? \"任务执行中,暂不能录音\" : sending ? \"正在处理附件,暂不能录音\" : undefined;\n const empty = useAuiState((state) => state.composer.text.length === 0);\n const nextMessage = !busy && !inputDisabled && empty ? suggestion : undefined;\n const showCancel = useAuiState((state) => busy && (state.thread.isRunning || state.composer.isEmpty));\n const addFiles = (files: File[]) => {\n for (const file of files) void binding.runtime.thread.composer.addAttachment(file).catch((error: unknown) => binding.setNotice(error instanceof Error ? error.message : String(error)));\n };\n return <Composer onSubmit={(event) => { event.preventDefault(); void binding.send(); }}\n inputProps={{ \"aria-label\": \"输入 Agent 任务\", placeholder: nextMessage ?? placeholder, disabled: inputDisabled, cancelOnEscape: false,\n addAttachmentOnPaste: !inputDisabled,\n onKeyDown: (event) => {\n if (event.keyCode === 229) event.preventDefault();\n else if ((event.key === \"ArrowRight\" || event.key === \"Tab\") && nextMessage && !event.nativeEvent.isComposing && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey && !event.currentTarget.value) {\n event.preventDefault();\n binding.runtime.thread.composer.setText(nextMessage);\n } else if (event.key === \"Enter\" && !event.shiftKey && !event.nativeEvent.isComposing) { event.preventDefault(); void binding.send(); }\n } }}\n actions={<>\n {voiceBusy ? <span role=\"status\" className={cn(\"sr-only\")}>{binding.voice.status === \"starting\" ? \"正在准备语音输入,请确认麦克风已授权…\" : binding.voice.status === \"transcribing\" ? \"正在识别,请稍候…\" : \"正在录音\"}</span> : null}\n {voiceBusy ? <TooltipIconButton tooltip=\"取消录音\" aria-label=\"取消语音输入\" className={cn(\"size-7 shrink-0\")} onClick={binding.voice.cancel}><XIcon className={cn(\"size-4\")} /></TooltipIconButton> : options !== false ? <><input ref={input} type=\"file\" multiple disabled={inputDisabled} accept={options?.accept ?? attachmentAccept} hidden\n onChange={(event) => { addFiles(Array.from(event.target.files ?? [])); event.target.value = \"\"; }} />\n <button type=\"button\" className={cn(\"text-muted-foreground hover:text-foreground rounded-control grid size-7 shrink-0 place-items-center transition-colors\")} aria-label=\"添加附件\" disabled={inputDisabled} onClick={() => input.current?.click()}><PlusIcon className={cn(\"size-4\")} /></button></> : <span />}\n {voiceBusy ? <ComposerVoice recording={binding.voice.status === \"recording\"} /> : null}\n <div className={cn(\"flex shrink-0 items-center gap-1\")}>\n <AuiIf condition={(state) => state.thread.capabilities.dictation}>\n <AuiIf condition={(state) => state.composer.dictation == null}>\n <TooltipProvider delayDuration={0}><Tooltip>\n <TooltipTrigger asChild><span className={cn(\"inline-flex\")} tabIndex={voiceDisabledReason ? 0 : undefined} aria-label={voiceDisabledReason}>\n <ComposerPrimitive.Dictate asChild disabled={busy || sending}>\n <Button variant=\"ghost\" size=\"icon\" aria-label=\"开始语音输入\" aria-description={voiceDisabledReason} className={cn(\"size-7 p-1\")}><MicIcon className={cn(\"size-4\")} /></Button>\n </ComposerPrimitive.Dictate>\n </span></TooltipTrigger>\n <TooltipContent>{voiceDisabledReason ?? \"语音输入\"}</TooltipContent>\n </Tooltip></TooltipProvider>\n </AuiIf>\n <AuiIf condition={(state) => state.composer.dictation != null}>\n <ComposerPrimitive.StopDictation asChild disabled={binding.voice.status !== \"recording\"}>\n <button type=\"button\" aria-label=\"结束语音输入\" title=\"结束录音\" className={cn(\"text-destructive rounded-control grid size-7 place-items-center transition-colors disabled:opacity-50\")}><SquareIcon className={cn(\"size-3 animate-pulse fill-current\")} /></button>\n </ComposerPrimitive.StopDictation>\n </AuiIf>\n </AuiIf>\n {showCancel ? <button type=\"button\" aria-label=\"取消任务\" className={cn(\"bg-primary text-primary-foreground rounded-control grid size-7 place-items-center\")} disabled={cancelling} onClick={cancel}><SquareIcon className={cn(\"size-3 fill-current\")} /></button> :\n <ComposerPrimitive.Send asChild disabled={inputDisabled}><button type=\"button\" onClick={(event) => { event.preventDefault(); void binding.send(); }} aria-label=\"发送任务\" className={cn(\"bg-primary text-primary-foreground rounded-control grid size-7 place-items-center transition-opacity disabled:opacity-40\")}><ArrowUpIcon className={cn(\"size-4\")} /></button></ComposerPrimitive.Send>}\n </div>\n </>}>\n <div ref={(element) => { element?.toggleAttribute(\"inert\", inputDisabled); }} className={cn(\"aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden\")}><ComposerPrimitive.Attachments>{() => <AttachmentTile binding={binding} />}</ComposerPrimitive.Attachments></div>\n {sending ? <small role=\"status\">正在处理附件…</small> : null}\n </Composer>;\n}\n\nfunction ToolGroup({ tools, running, count, children }: {\n tools: readonly UIMessagePart[]; running: boolean; count: number; children: ReactNode;\n}) {\n const errors = tools.flatMap((tool) => tool.type === \"tool\" && tool.error ? [tool.error] : []);\n const errorIds = JSON.stringify(errors.map((error) => error.id));\n const hasErrors = errors.length > 0;\n const [open, setOpen] = useState(hasErrors);\n useEffect(() => {\n if (errorIds !== \"[]\") setOpen(true);\n }, [errorIds]);\n const unknown = hasErrors && errors.every((error) => error.scope === \"tool\" && error.execution === \"unknown\");\n return <ToolGroupRoot variant=\"ghost\" className={cn(\"my-1\")} open={open} onOpenChange={setOpen}>\n <DisclosureTrigger live={running && !hasErrors} label={hasErrors ? unknown ? \"Result unknown\" : \"Failed\" : running ? \"running\" : \"ran\"} detail={`${count} tools`} />\n <ToolGroupContent className={cn(disclosureContentClass)}>{children}</ToolGroupContent>\n </ToolGroupRoot>;\n}\n\nconst GroupedParts = MessagePrimitive.GroupedParts as ComponentType<Parameters<typeof MessagePrimitive.GroupedParts>[0]>;\nconst groupAssistantParts = groupPartByType({ reasoning: [\"group-chainOfThought\", \"group-reasoning\"], source: [\"group-chainOfThought\", \"group-source\"], \"tool-call\": [\"group-chainOfThought\", \"group-tool\"], \"standalone-tool-call\": [] });\nexport function AssistantParts({ showDetails, tools = [] }: { showDetails: boolean; tools?: readonly UIMessagePart[] }) {\n return <><GroupedParts groupBy={groupAssistantParts}>{({ part, children }) => {\n switch (part.type) {\n case \"group-chainOfThought\": return <div className={cn(\"mb-3\")}>{children}</div>;\n case \"group-tool\": return part.indices.length === 1 ? <>{children}</> : <ToolGroup\n tools={tools.filter((_, index) => part.indices.includes(index))} running={part.status.type === \"running\"} count={part.indices.length}>\n {children}\n </ToolGroup>;\n case \"group-reasoning\": return <ReasoningRoot variant=\"ghost\" streaming={part.status.type === \"running\"} className={cn(\"my-1\")}>\n <DisclosureTrigger live={part.status.type === \"running\"} label={part.status.type === \"running\" ? \"thinking\" : \"reasoning\"} />\n <ReasoningContent aria-busy={part.status.type === \"running\"} className={cn(disclosureContentClass)}><ReasoningText className={cn(\"ps-0\")}>{children}</ReasoningText></ReasoningContent>\n </ReasoningRoot>;\n case \"reasoning\": return <Reasoning {...part} />;\n case \"group-source\":\n case \"source\": return null;\n case \"data\": return part.dataRendererUI;\n case \"text\": return part.text === \"\" && part.status?.type === \"running\" ? <TraceLine live label=\"thinking\" /> : <MarkdownText />;\n case \"tool-call\": return part.toolUI ?? <ToolCall {...part} showDetails={showDetails} presentation={tools.find((tool) => tool.type === \"tool\" && tool.toolCallId === part.toolCallId)} />;\n case \"indicator\": return <TraceLine live label=\"thinking\" />;\n default: return null;\n }\n }}</GroupedParts></>;\n}\n"]}
@@ -16,7 +16,7 @@ export type AssistantBinding = {
16
16
  };
17
17
  export declare function convertMessage(message: UIMessage): ThreadMessageLike;
18
18
  export declare function projectMessages(messages: readonly UIMessage[]): UIMessage[];
19
- export declare function SessionRuntime({ id, chat, options, dictation, open, blocked, active, onEdit, children, }: {
19
+ export declare function SessionRuntime({ id, chat, options, dictation, open, blocked, active, onEdit, children }: {
20
20
  id: string;
21
21
  chat: ChatState;
22
22
  options: ChatProps["attachments"];