wecool-chat 0.6.0 → 0.7.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 (205) hide show
  1. package/CHANGELOG.md +59 -1
  2. package/README.ja.md +286 -29
  3. package/README.md +291 -29
  4. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  5. package/dist/browser-beO7dF90.js +1538 -0
  6. package/dist/core/cancellation-log.d.ts.map +1 -0
  7. package/dist/{client.d.ts → core/client.d.ts} +15 -3
  8. package/dist/core/client.d.ts.map +1 -0
  9. package/dist/{hooks → core}/consume-stream.d.ts +9 -5
  10. package/dist/core/consume-stream.d.ts.map +1 -0
  11. package/dist/{i18n → core/i18n}/messages.d.ts +4 -0
  12. package/dist/core/i18n/messages.d.ts.map +1 -0
  13. package/dist/core/index.d.ts +12 -0
  14. package/dist/core/index.d.ts.map +1 -0
  15. package/dist/core/run-conversation.d.ts +38 -0
  16. package/dist/core/run-conversation.d.ts.map +1 -0
  17. package/dist/core/sse-parser.d.ts.map +1 -0
  18. package/dist/{hooks → core}/stream-state.d.ts +14 -11
  19. package/dist/core/stream-state.d.ts.map +1 -0
  20. package/dist/{hooks → core}/tool-runner.d.ts +4 -5
  21. package/dist/core/tool-runner.d.ts.map +1 -0
  22. package/dist/core/types.d.ts +248 -0
  23. package/dist/core/types.d.ts.map +1 -0
  24. package/dist/index.css +1 -1
  25. package/dist/index.d.ts +32 -14
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +11062 -10369
  28. package/dist/plugin/context.d.ts +15 -0
  29. package/dist/plugin/context.d.ts.map +1 -0
  30. package/dist/plugin/define.d.ts +30 -0
  31. package/dist/plugin/define.d.ts.map +1 -0
  32. package/dist/plugin/id.d.ts +19 -0
  33. package/dist/plugin/id.d.ts.map +1 -0
  34. package/dist/plugin/index.d.ts +21 -0
  35. package/dist/plugin/index.d.ts.map +1 -0
  36. package/dist/plugin/logger.d.ts +11 -0
  37. package/dist/plugin/logger.d.ts.map +1 -0
  38. package/dist/plugin/registry.d.ts +21 -0
  39. package/dist/plugin/registry.d.ts.map +1 -0
  40. package/dist/plugin/types.d.ts +109 -0
  41. package/dist/plugin/types.d.ts.map +1 -0
  42. package/dist/plugin.d.ts +2 -0
  43. package/dist/plugin.js +4 -0
  44. package/dist/plugins/qrcode/__tests__/format-result.test.d.ts +2 -0
  45. package/dist/plugins/qrcode/__tests__/format-result.test.d.ts.map +1 -0
  46. package/dist/plugins/qrcode/__tests__/index.test.d.ts +2 -0
  47. package/dist/plugins/qrcode/__tests__/index.test.d.ts.map +1 -0
  48. package/dist/plugins/qrcode/__tests__/tool.test.d.ts +2 -0
  49. package/dist/plugins/qrcode/__tests__/tool.test.d.ts.map +1 -0
  50. package/dist/plugins/qrcode/format-result.d.ts +59 -0
  51. package/dist/plugins/qrcode/format-result.d.ts.map +1 -0
  52. package/dist/plugins/qrcode/index.d.ts +23 -0
  53. package/dist/plugins/qrcode/index.d.ts.map +1 -0
  54. package/dist/plugins/qrcode/tool.d.ts +50 -0
  55. package/dist/plugins/qrcode/tool.d.ts.map +1 -0
  56. package/dist/plugins/qrcode.d.ts +2 -0
  57. package/dist/plugins/qrcode.js +161 -0
  58. package/dist/{builtin-tools → ui/builtin-tools}/get-current-page-info.d.ts +1 -1
  59. package/dist/ui/builtin-tools/get-current-page-info.d.ts.map +1 -0
  60. package/dist/ui/builtin-tools/index.d.ts.map +1 -0
  61. package/dist/{builtin-tools → ui/builtin-tools}/merge-builtin-tools.d.ts +1 -1
  62. package/dist/ui/builtin-tools/merge-builtin-tools.d.ts.map +1 -0
  63. package/dist/ui/components/ChatFooter.d.ts.map +1 -0
  64. package/dist/ui/components/ChatHeader.d.ts +15 -0
  65. package/dist/ui/components/ChatHeader.d.ts.map +1 -0
  66. package/dist/ui/components/ChatHeaderMenu.d.ts +12 -0
  67. package/dist/ui/components/ChatHeaderMenu.d.ts.map +1 -0
  68. package/dist/{components → ui/components}/ChatPanel.d.ts +9 -2
  69. package/dist/ui/components/ChatPanel.d.ts.map +1 -0
  70. package/dist/ui/components/ChatWidget.d.ts +3 -0
  71. package/dist/ui/components/ChatWidget.d.ts.map +1 -0
  72. package/dist/{components → ui/components}/CopyIndicator.d.ts +1 -1
  73. package/dist/ui/components/CopyIndicator.d.ts.map +1 -0
  74. package/dist/{components → ui/components}/FloatButton.d.ts +2 -1
  75. package/dist/ui/components/FloatButton.d.ts.map +1 -0
  76. package/dist/{components → ui/components}/MessageActionsPopover.d.ts +1 -1
  77. package/dist/ui/components/MessageActionsPopover.d.ts.map +1 -0
  78. package/dist/ui/components/MessageAttachments.d.ts +21 -0
  79. package/dist/ui/components/MessageAttachments.d.ts.map +1 -0
  80. package/dist/{components → ui/components}/MessageBubble.d.ts +14 -7
  81. package/dist/ui/components/MessageBubble.d.ts.map +1 -0
  82. package/dist/{components → ui/components}/MessageCopyButton.d.ts +1 -1
  83. package/dist/ui/components/MessageCopyButton.d.ts.map +1 -0
  84. package/dist/{components → ui/components}/MessageEditor.d.ts +1 -1
  85. package/dist/ui/components/MessageEditor.d.ts.map +1 -0
  86. package/dist/{components → ui/components}/MessageList.d.ts +1 -1
  87. package/dist/ui/components/MessageList.d.ts.map +1 -0
  88. package/dist/{components → ui/components}/MessagePopoverButton.d.ts +1 -1
  89. package/dist/ui/components/MessagePopoverButton.d.ts.map +1 -0
  90. package/dist/ui/components/MessageRow.d.ts +18 -0
  91. package/dist/ui/components/MessageRow.d.ts.map +1 -0
  92. package/dist/{components → ui/components}/MessageRowActions.d.ts +2 -2
  93. package/dist/ui/components/MessageRowActions.d.ts.map +1 -0
  94. package/dist/{components → ui/components}/markdown/CodeBlock.d.ts +1 -1
  95. package/dist/ui/components/markdown/CodeBlock.d.ts.map +1 -0
  96. package/dist/{components → ui/components}/markdown/MarkdownMessage.d.ts +5 -1
  97. package/dist/ui/components/markdown/MarkdownMessage.d.ts.map +1 -0
  98. package/dist/ui/components/markdown/sanitize-clipboard.d.ts.map +1 -0
  99. package/dist/ui/components/markdown/stable-prefix.d.ts.map +1 -0
  100. package/dist/ui/components/markdown/strip-data-images.d.ts +2 -0
  101. package/dist/ui/components/markdown/strip-data-images.d.ts.map +1 -0
  102. package/dist/ui/components/markdown/url-transform.d.ts.map +1 -0
  103. package/dist/ui/components/message-row-handlers.d.ts.map +1 -0
  104. package/dist/ui/hooks/use-editing-message.d.ts.map +1 -0
  105. package/dist/ui/hooks/use-menu-keyboard.d.ts.map +1 -0
  106. package/dist/ui/hooks/use-message-history.d.ts +20 -0
  107. package/dist/ui/hooks/use-message-history.d.ts.map +1 -0
  108. package/dist/{hooks → ui/hooks}/use-send-message.d.ts +8 -14
  109. package/dist/ui/hooks/use-send-message.d.ts.map +1 -0
  110. package/dist/ui/hooks/use-stream-lifecycle.d.ts.map +1 -0
  111. package/dist/{hooks → ui/hooks}/use-tool-runner.d.ts +2 -3
  112. package/dist/ui/hooks/use-tool-runner.d.ts.map +1 -0
  113. package/dist/ui/hooks/useActiveMessage.d.ts.map +1 -0
  114. package/dist/{hooks → ui/hooks}/useChatStream.d.ts +5 -3
  115. package/dist/ui/hooks/useChatStream.d.ts.map +1 -0
  116. package/dist/ui/hooks/useCopyToClipboard.d.ts.map +1 -0
  117. package/dist/ui/hooks/useDismissOnOutside.d.ts.map +1 -0
  118. package/dist/ui/hooks/useDraggablePanel.d.ts +32 -0
  119. package/dist/ui/hooks/useDraggablePanel.d.ts.map +1 -0
  120. package/dist/ui/hooks/useFocusTrap.d.ts.map +1 -0
  121. package/dist/ui/hooks/useMediaQuery.d.ts.map +1 -0
  122. package/dist/ui/hooks/useScrollToBottom.d.ts +22 -0
  123. package/dist/ui/hooks/useScrollToBottom.d.ts.map +1 -0
  124. package/dist/ui/i18n/format-time.d.ts +10 -0
  125. package/dist/ui/i18n/format-time.d.ts.map +1 -0
  126. package/dist/ui/i18n/locale-context.d.ts +10 -0
  127. package/dist/ui/i18n/locale-context.d.ts.map +1 -0
  128. package/dist/{i18n → ui/i18n}/messages-context.d.ts +1 -1
  129. package/dist/ui/i18n/messages-context.d.ts.map +1 -0
  130. package/dist/{mount.d.ts → ui/mount.d.ts} +1 -1
  131. package/dist/ui/mount.d.ts.map +1 -0
  132. package/dist/ui/styles/index.d.ts.map +1 -0
  133. package/dist/ui/types.d.ts +42 -0
  134. package/dist/ui/types.d.ts.map +1 -0
  135. package/package.json +23 -3
  136. package/dist/builtin-tools/get-current-page-info.d.ts.map +0 -1
  137. package/dist/builtin-tools/index.d.ts.map +0 -1
  138. package/dist/builtin-tools/merge-builtin-tools.d.ts.map +0 -1
  139. package/dist/client.d.ts.map +0 -1
  140. package/dist/components/ChatFooter.d.ts.map +0 -1
  141. package/dist/components/ChatHeader.d.ts +0 -7
  142. package/dist/components/ChatHeader.d.ts.map +0 -1
  143. package/dist/components/ChatPanel.d.ts.map +0 -1
  144. package/dist/components/ChatWidget.d.ts +0 -3
  145. package/dist/components/ChatWidget.d.ts.map +0 -1
  146. package/dist/components/CopyIndicator.d.ts.map +0 -1
  147. package/dist/components/FloatButton.d.ts.map +0 -1
  148. package/dist/components/MessageActionsPopover.d.ts.map +0 -1
  149. package/dist/components/MessageBubble.d.ts.map +0 -1
  150. package/dist/components/MessageCopyButton.d.ts.map +0 -1
  151. package/dist/components/MessageEditor.d.ts.map +0 -1
  152. package/dist/components/MessageList.d.ts.map +0 -1
  153. package/dist/components/MessagePopoverButton.d.ts.map +0 -1
  154. package/dist/components/MessageRow.d.ts +0 -17
  155. package/dist/components/MessageRow.d.ts.map +0 -1
  156. package/dist/components/MessageRowActions.d.ts.map +0 -1
  157. package/dist/components/markdown/CodeBlock.d.ts.map +0 -1
  158. package/dist/components/markdown/MarkdownMessage.d.ts.map +0 -1
  159. package/dist/components/markdown/sanitize-clipboard.d.ts.map +0 -1
  160. package/dist/components/markdown/stable-prefix.d.ts.map +0 -1
  161. package/dist/components/markdown/url-transform.d.ts.map +0 -1
  162. package/dist/components/message-row-handlers.d.ts.map +0 -1
  163. package/dist/hooks/cancellation-log.d.ts.map +0 -1
  164. package/dist/hooks/consume-stream.d.ts.map +0 -1
  165. package/dist/hooks/run-conversation.d.ts +0 -23
  166. package/dist/hooks/run-conversation.d.ts.map +0 -1
  167. package/dist/hooks/stream-state.d.ts.map +0 -1
  168. package/dist/hooks/tool-runner.d.ts.map +0 -1
  169. package/dist/hooks/use-editing-message.d.ts.map +0 -1
  170. package/dist/hooks/use-menu-keyboard.d.ts.map +0 -1
  171. package/dist/hooks/use-send-message.d.ts.map +0 -1
  172. package/dist/hooks/use-stream-lifecycle.d.ts.map +0 -1
  173. package/dist/hooks/use-tool-runner.d.ts.map +0 -1
  174. package/dist/hooks/useActiveMessage.d.ts.map +0 -1
  175. package/dist/hooks/useChatStream.d.ts.map +0 -1
  176. package/dist/hooks/useCopyToClipboard.d.ts.map +0 -1
  177. package/dist/hooks/useDismissOnOutside.d.ts.map +0 -1
  178. package/dist/hooks/useFocusTrap.d.ts.map +0 -1
  179. package/dist/hooks/useMediaQuery.d.ts.map +0 -1
  180. package/dist/hooks/useScrollToBottom.d.ts +0 -12
  181. package/dist/hooks/useScrollToBottom.d.ts.map +0 -1
  182. package/dist/i18n/messages-context.d.ts.map +0 -1
  183. package/dist/i18n/messages.d.ts.map +0 -1
  184. package/dist/mount.d.ts.map +0 -1
  185. package/dist/sse-parser.d.ts.map +0 -1
  186. package/dist/styles/index.d.ts.map +0 -1
  187. package/dist/types.d.ts +0 -148
  188. package/dist/types.d.ts.map +0 -1
  189. /package/dist/{hooks → core}/cancellation-log.d.ts +0 -0
  190. /package/dist/{sse-parser.d.ts → core/sse-parser.d.ts} +0 -0
  191. /package/dist/{builtin-tools → ui/builtin-tools}/index.d.ts +0 -0
  192. /package/dist/{components → ui/components}/ChatFooter.d.ts +0 -0
  193. /package/dist/{components → ui/components}/markdown/sanitize-clipboard.d.ts +0 -0
  194. /package/dist/{components → ui/components}/markdown/stable-prefix.d.ts +0 -0
  195. /package/dist/{components → ui/components}/markdown/url-transform.d.ts +0 -0
  196. /package/dist/{components → ui/components}/message-row-handlers.d.ts +0 -0
  197. /package/dist/{hooks → ui/hooks}/use-editing-message.d.ts +0 -0
  198. /package/dist/{hooks → ui/hooks}/use-menu-keyboard.d.ts +0 -0
  199. /package/dist/{hooks → ui/hooks}/use-stream-lifecycle.d.ts +0 -0
  200. /package/dist/{hooks → ui/hooks}/useActiveMessage.d.ts +0 -0
  201. /package/dist/{hooks → ui/hooks}/useCopyToClipboard.d.ts +0 -0
  202. /package/dist/{hooks → ui/hooks}/useDismissOnOutside.d.ts +0 -0
  203. /package/dist/{hooks → ui/hooks}/useFocusTrap.d.ts +0 -0
  204. /package/dist/{hooks → ui/hooks}/useMediaQuery.d.ts +0 -0
  205. /package/dist/{styles → ui/styles}/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancellation-log.d.ts","sourceRoot":"","sources":["../../src/core/cancellation-log.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,eAAe,CAAC;AAE3D,QAAA,MAAM,YAAY,GAAI,KAAK,OAAO,KAAG,OACqB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,OAAO,EAAE,QAAQ,WAAW,KAAG,YAAY,GAAG,IAGhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,YAAY,EAAE,SAAS,OAAO,KAAG,IAExE,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,9 +1,16 @@
1
- import { ToolDefinition, Message, ChatEvent, ToolResult } from './types';
1
+ import { ToolDefinition, Message, ChatEvent } from './types';
2
2
  type ChatParams = {
3
3
  message?: string;
4
4
  tools: ToolDefinition[];
5
5
  history?: Message[];
6
- toolResults?: ToolResult[];
6
+ /**
7
+ * LLM がツールを呼べるか制御する。OpenAI 標準の `tool_choice` をそのまま転送する。
8
+ *
9
+ * - `undefined` / `"auto"`: 既定。LLM がツール呼出か text か自由に決める
10
+ * - `"none"`: ツール呼出を禁止し、text のみを返させる。
11
+ * `narrateToolResults` 機構で「tool 結果を語る追加ラウンド」を実行するときに使う
12
+ */
13
+ toolChoice?: "auto" | "none";
7
14
  };
8
15
  /**
9
16
  * API client for communicating with the chat backend via SSE
@@ -41,7 +48,12 @@ export declare function createAssistantMessage(content: string): Message;
41
48
  export declare function createErrorMessage(content: string): Message;
42
49
  /**
43
50
  * Create a tool result message
51
+ *
52
+ * @param toolCallId - LLM が tool_use を発行したときの一意な call ID。
53
+ * 省略可だが、API へ送る際に `tool_call_id` として再利用するため、
54
+ * 並列で複数 tool を呼ぶシナリオでは必須。
55
+ * @param attachments - UI 添付物 (画像など)。LLM 履歴・バックエンドへは送られない
44
56
  */
45
- export declare function createToolMessage(toolName: string, args: Record<string, unknown>, result: unknown): Message;
57
+ export declare function createToolMessage(toolName: string, args: Record<string, unknown>, result: unknown, toolCallId?: string, attachments?: Message["attachments"]): Message;
46
58
  export {};
47
59
  //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGlE,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B,CAAC;AAYF;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,cAAc,CAAuB;gBAEjC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAM7C,iBAAiB,IAAI,MAAM;IAO3B,iBAAiB,IAAI,IAAI;IAIzB;;OAEG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC;IAqBhF,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,SAAS;CAiBlB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAO/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQ3D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,OAAO,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACnC,OAAO,CAcT"}
@@ -1,13 +1,18 @@
1
- import { ChatEvent, Message } from '../types';
2
- import { ToolUseEvent } from './stream-state';
1
+ import { ChatEvent, Message, ToolUseEvent } from './types';
2
+ import { StreamIdRef } from './stream-state';
3
3
  export type StreamRoundResult = {
4
4
  toolUses: ToolUseEvent[];
5
5
  /** テキスト応答で完結した場合の最終テキスト。tool_use のみのターンでは null */
6
6
  finalText: string | null;
7
7
  /** 中断時に削除すべき空 placeholder の ID(内容ありなら null) */
8
8
  emptyPlaceholderId: string | null;
9
+ /** 本ラウンドで生成した assistant placeholder の ID。後段で削除したい場合に使う */
10
+ placeholderId: string | null;
9
11
  };
10
- type SetMessages = React.Dispatch<React.SetStateAction<Message[]>>;
12
+ /**
13
+ * React 非依存の setState 互換型。`useState<Message[]>` の setter 関数はそのまま代入可能。
14
+ */
15
+ export type SetMessages = (updater: Message[] | ((prev: Message[]) => Message[])) => void;
11
16
  /**
12
17
  * 1ラウンド分の SSE を消費し、text_delta のストリーミング反映と tool_use の蓄積を行う。
13
18
  *
@@ -15,6 +20,5 @@ type SetMessages = React.Dispatch<React.SetStateAction<Message[]>>;
15
20
  * - finalText: テキスト応答で完結した場合の本文(履歴追記は呼び出し側で行う = 一方向データフロー)
16
21
  * - emptyPlaceholderId: 中断時に削除すべき空 placeholder の ID
17
22
  */
18
- export declare const consumeStreamRound: (stream: AsyncGenerator<ChatEvent>, setMessages: SetMessages, streamId: number, currentStreamIdRef: React.RefObject<number>) => Promise<StreamRoundResult>;
19
- export {};
23
+ export declare const consumeStreamRound: (stream: AsyncGenerator<ChatEvent>, setMessages: SetMessages, streamId: number, currentStreamIdRef: StreamIdRef) => Promise<StreamRoundResult>;
20
24
  //# sourceMappingURL=consume-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consume-stream.d.ts","sourceRoot":"","sources":["../../src/core/consume-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,kDAAkD;IAClD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,+CAA+C;IAC/C,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,0DAA0D;IAC1D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;AAgF1F;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,cAAc,CAAC,SAAS,CAAC,EACjC,aAAa,WAAW,EACxB,UAAU,MAAM,EAChB,oBAAoB,WAAW,KAC9B,OAAO,CAAC,iBAAiB,CAoB3B,CAAC"}
@@ -37,6 +37,10 @@ export type Messages = {
37
37
  messageLogLabel: string;
38
38
  loadingAnnouncement: string;
39
39
  inputLabel: string;
40
+ downloadAttachment: string;
41
+ dragHandleLabel: string;
42
+ resetPositionButton: string;
43
+ settingsMenuToggle: string;
40
44
  };
41
45
  /**
42
46
  * 指定 locale のメッセージ集を取得する。未指定 / 未対応 locale は ja を返す。
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/core/i18n/messages.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B,EAAE,MAAM,CAAC;IACpC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AA4EF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,QAG7C,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * chat-core の公開エントリポイント。
3
+ * React / DOM 非依存の API のみをまとめて再エクスポートする。
4
+ *
5
+ * 将来 `packages/chat-core` として物理分離する際は、このファイルがそのまま
6
+ * 新パッケージのエントリ(`packages/chat-core/src/index.ts`)になる。
7
+ */
8
+ export type { Tool, ToolDefinition, ToolParameters, ChatConfig, Message, ToolCall, ChatEvent, } from './types';
9
+ export { ChatClient, createMessageId, createUserMessage, createAssistantMessage, createToolMessage, } from './client';
10
+ export { parseChatSSE } from './sse-parser';
11
+ export { getMessages, type Locale, type Messages } from './i18n/messages';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACV,IAAI,EACJ,cAAc,EACd,cAAc,EACd,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { ChatClient } from './client';
2
+ import { Message, ToolDefinition, ToolUseEvent } from './types';
3
+ import { ToolExecution } from './tool-runner';
4
+ import { SetMessages } from './consume-stream';
5
+ import { StreamIdRef } from './stream-state';
6
+ export type RunConversationParams = {
7
+ client: ChatClient;
8
+ toolDefinitions: ToolDefinition[];
9
+ initialMessage: string;
10
+ initialHistory: Message[];
11
+ setMessages: SetMessages;
12
+ runTool: (event: ToolUseEvent, signal: AbortSignal) => Promise<ToolExecution>;
13
+ signal: AbortSignal;
14
+ streamId: number;
15
+ currentStreamIdRef: StreamIdRef;
16
+ removeMessageById: (id: string) => void;
17
+ /**
18
+ * true の場合、tool 実行直後にもう 1 回 LLM (`tool_choice: "none"`) に
19
+ * 問い合わせて text のみを取得し、画面に表示する。
20
+ * 詳細は ChatConfig.narrateToolResults を参照。
21
+ */
22
+ narrateToolResults?: boolean;
23
+ };
24
+ /**
25
+ * チャットの全ラウンドを回す。`MAX_TOOL_ITERATIONS` を超えたら例外で打ち切る。
26
+ *
27
+ * 継続ターン (= iter2+) で `body.message` が空になるため、初回 user 発話が API に
28
+ * 渡らず LLM コンテキストから消える事象があった。これを防ぐため iter1 完了直後に
29
+ * `createUserMessage(initialMessage)` を history に積み、以降の `body.history` に
30
+ * 必ず最新 user 発話が乗るようにする。
31
+ *
32
+ * 重複は起きない: iter1 では history に user 発話は未追加で、`nextMessage` が
33
+ * `body.message` として送られる。iter1 が done を返した時点で append しても、
34
+ * その回の API 送信は既に完了しているため、`body.history` と `body.message` の
35
+ * 二重計上にはならない。
36
+ */
37
+ export declare const runConversation: (params: RunConversationParams) => Promise<void>;
38
+ //# sourceMappingURL=run-conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-conversation.d.ts","sourceRoot":"","sources":["../../src/core/run-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AASxB,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9E,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,WAAW,CAAC;IAChC,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAwHF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAAU,QAAQ,qBAAqB,KAAG,OAAO,CAAC,IAAI,CA2CjF,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../src/core/sse-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;GAGG;AACH,wBAAuB,YAAY,CACjC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,GACxC,cAAc,CAAC,SAAS,CAAC,CA4B3B"}
@@ -1,23 +1,26 @@
1
- import { ChatEvent, Message, ToolResult } from '../types';
1
+ import { Message } from './types';
2
2
  import { ToolExecution } from './tool-runner';
3
- type ToolUseEvent = Extract<ChatEvent, {
4
- type: "tool_use";
5
- }>;
3
+ /**
4
+ * React 非依存の ref 互換型。`useRef<number>(...)` の戻り値はそのまま代入可能。
5
+ */
6
+ export type StreamIdRef = {
7
+ readonly current: number;
8
+ };
6
9
  /**
7
10
  * 現在の sendMessage 呼び出しが「最新ストリーム」かどうか。
8
11
  * 古いストリームの遅延 yield / throw を抑止するための判定。
9
12
  */
10
- export declare const isCurrentStream: (streamId: number, currentRef: React.RefObject<number>) => boolean;
13
+ export declare const isCurrentStream: (streamId: number, currentRef: StreamIdRef) => boolean;
11
14
  /**
12
15
  * abort または streamId 不一致を検知したとき、空プレースホルダーを履歴から削除する後処理。
13
16
  */
14
17
  export declare const cleanupOnInterruption: (emptyPlaceholderId: string | null, removeMessageById: (id: string) => void) => void;
15
18
  /**
16
- * Promise.all で並列実行したツール結果を、履歴用 Message と次ターン送信用 ToolResult に変換する純粋関数。
19
+ * Promise.all で並列実行したツール結果を、履歴用 Message 配列に変換する純粋関数。
20
+ *
21
+ * 過去の wecool-chat には別途 `ToolResult` を `body.toolResults` として送る経路があったが、
22
+ * history に積んだ `role:"tool"` メッセージと冗長で、API 側の重複防止フィルタが
23
+ * 過去ターンの tool 結果まで消すバグの温床になっていたため廃止した。
17
24
  */
18
- export declare const collectToolOutputs: (executions: ToolExecution[]) => {
19
- toolMessages: Message[];
20
- toolResults: ToolResult[];
21
- };
22
- export type { ToolUseEvent };
25
+ export declare const collectToolOutputs: (executions: ToolExecution[]) => Message[];
23
26
  //# sourceMappingURL=stream-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-state.d.ts","sourceRoot":"","sources":["../../src/core/stream-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,YAAY,WAAW,KAAG,OAC3C,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,oBAAoB,MAAM,GAAG,IAAI,EACjC,mBAAmB,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,KACtC,IAEF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,aAAa,EAAE,KAAG,OAAO,EAMvE,CAAC"}
@@ -1,10 +1,10 @@
1
- import { ChatEvent, Tool } from '../types';
2
- type ToolUseEvent = Extract<ChatEvent, {
3
- type: "tool_use";
4
- }>;
1
+ import { Tool, ToolAttachment, ToolUseEvent } from './types';
5
2
  export type ToolExecution = {
6
3
  event: ToolUseEvent;
4
+ /** LLM 履歴・バックエンドに送る結果 */
7
5
  result: unknown;
6
+ /** UI でだけ描画する添付物。LLM 履歴にもバックエンドにも送らない */
7
+ attachments?: ToolAttachment[];
8
8
  };
9
9
  export type ToolRunnerCallbacks = {
10
10
  onToolExecute?: (toolName: string, args: unknown) => void;
@@ -20,5 +20,4 @@ export declare const executeToolCall: (event: ToolUseEvent, findTool: (name: str
20
20
  timeoutMs?: number;
21
21
  signal?: AbortSignal;
22
22
  }) => Promise<ToolExecution>;
23
- export {};
24
23
  //# sourceMappingURL=tool-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-runner.d.ts","sourceRoot":"","sources":["../../src/core/tool-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,yBAAyB;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,yCAAyC;IACzC,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D,CAAC;AAkDF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,YAAY,EACnB,UAAU,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,EAC5C,SAAS,mBAAmB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAC1E,OAAO,CAAC,aAAa,CA4BvB,CAAC"}
@@ -0,0 +1,248 @@
1
+ import { ChatPlugin } from '../plugin/types';
2
+ /**
3
+ * JSON Schema for tool parameters
4
+ */
5
+ export type ToolParameters = {
6
+ type: "object";
7
+ properties: Record<string, {
8
+ type: "string" | "number" | "boolean" | "array" | "object";
9
+ description?: string;
10
+ enum?: string[];
11
+ items?: {
12
+ type: string;
13
+ };
14
+ }>;
15
+ required?: string[];
16
+ };
17
+ /**
18
+ * Tool 実行時に handler が受け取れる任意 context。
19
+ * 既存 user tools は無視できる optional 引数。
20
+ */
21
+ export type ToolHandlerContext = {
22
+ /** ツール実行ごとの AbortSignal。ストリーム cancel と連動 */
23
+ signal: AbortSignal;
24
+ };
25
+ /**
26
+ * Tool が UI 側でだけ表示したい添付物。
27
+ *
28
+ * Why: 画像 base64 のような大きなデータを LLM context / バックエンドリクエストに乗せると
29
+ * 通信・トークン消費が肥大化する。`attachments` に入れた要素は ChatWidget が直接描画し、
30
+ * LLM の履歴・バックエンドペイロードには載らない。
31
+ *
32
+ * 新しい添付物種別が必要になったら、ここに union メンバーを追加する (`pluginApiVersion: 1` 互換)。
33
+ */
34
+ export type ToolAttachment = {
35
+ type: "image";
36
+ /** PNG / JPEG / GIF / WebP のみ許可。SVG は XSS 経路があるため拒否 */
37
+ mimeType: "image/png" | "image/jpeg" | "image/gif" | "image/webp";
38
+ /** base64 本体 (data URL の `data:...,` プレフィックスは含めない) */
39
+ base64: string;
40
+ /** alt テキスト。スクリーンリーダー向け */
41
+ alt?: string;
42
+ /** 表示の意味的タイトル (省略可) */
43
+ title?: string;
44
+ /**
45
+ * ユーザーが DL ボタンを押したとき保存するファイル名 (省略時は ChatWidget が生成)。
46
+ * 拡張子は省略しても良い (mimeType から推定される)。
47
+ */
48
+ filename?: string;
49
+ };
50
+ /**
51
+ * Tool handler が `{ forLLM, attachments }` の 2 経路に分けて結果を返すための封筒。
52
+ *
53
+ * - `forLLM`: 従来通り LLM 履歴・バックエンドへ送られる
54
+ * - `attachments`: ChatWidget が UI として描画するだけで LLM 履歴にもバックエンドにも送らない
55
+ *
56
+ * handler が plain な値を return した場合は従来動作 (全て LLM 履歴行き) を維持する。
57
+ */
58
+ export type ToolHandlerEnvelope = {
59
+ forLLM: unknown;
60
+ attachments?: ToolAttachment[];
61
+ };
62
+ /**
63
+ * Tool definition that can be executed by the LLM
64
+ */
65
+ export type Tool = {
66
+ /** Unique identifier for the tool */
67
+ name: string;
68
+ /** Human-readable description for the LLM to understand when to use this tool */
69
+ description: string;
70
+ /** JSON Schema defining the expected parameters */
71
+ parameters: ToolParameters;
72
+ /** Function to execute when the LLM calls this tool. ctx は optional で既存実装と互換 */
73
+ handler: (args: Record<string, unknown>, ctx?: ToolHandlerContext) => unknown | Promise<unknown>;
74
+ };
75
+ /**
76
+ * Tool definition sent to the API (without handler)
77
+ */
78
+ export type ToolDefinition = {
79
+ name: string;
80
+ description: string;
81
+ parameters: ToolParameters;
82
+ };
83
+ /**
84
+ * Configuration for initializing the chat widget
85
+ */
86
+ export type ChatConfig = {
87
+ /** API endpoint URL */
88
+ endpoint: string;
89
+ /** API key for authentication */
90
+ apiKey?: string;
91
+ /** List of tools available to the LLM */
92
+ tools: Tool[];
93
+ /** UI language */
94
+ locale?: "ja" | "en";
95
+ /** Callback when a tool is about to be executed */
96
+ onToolExecute?: (toolName: string, args: unknown) => void;
97
+ /** Callback when a tool execution completes */
98
+ onToolResult?: (toolName: string, result: unknown) => void;
99
+ /** Callback when an error occurs */
100
+ onError?: (error: Error) => void;
101
+ /** Timeout in milliseconds for tool handler execution (default: 30000) */
102
+ toolTimeout?: number;
103
+ /** Custom class name for the widget container */
104
+ className?: string;
105
+ /** Placeholder text for the input field */
106
+ placeholder?: string;
107
+ /**
108
+ * Color theme.
109
+ * - `"auto"` (default behavior when explicitly set): follow OS `prefers-color-scheme`.
110
+ * - `"light"` (default): force light theme. Existing behavior, ensures backward compat.
111
+ * - `"dark"`: force dark theme.
112
+ *
113
+ * `"auto"` のときは `data-wecool-theme` 属性を付けず CSS の @media に委ねる
114
+ * (JS マウント遅延に起因するライト→ダーク切替フラッシュを回避)。
115
+ */
116
+ theme?: "auto" | "light" | "dark";
117
+ /**
118
+ * Shadow DOM へのマウントを無効化する逃げ道(既定は false = Shadow 有効)。
119
+ * E2E テスト等で Shadow 越しに DOM を覗くのが面倒な場合の互換オプション。
120
+ */
121
+ disableShadowDom?: boolean;
122
+ /**
123
+ * チャットウィジェットの配置パターン。
124
+ *
125
+ * 未指定時の挙動 (後方互換):
126
+ * - `initWecoolChat` で container を渡さない → `floating-bottom-right` 相当
127
+ * - container を渡す → コンテナ内に埋め込み (旧 inline)
128
+ *
129
+ * パターン一覧:
130
+ * - `floating-bottom-right` / `floating-bottom-left` / `floating-top-right` / `floating-top-left`:
131
+ * 画面四隅にフロートする小窓型 (既存 floating の四方向版)
132
+ * - `sidebar-left` / `sidebar-right`:
133
+ * 画面端に約 360px の固定パネルを置く (Education のような常時相談型)
134
+ * - `header-banner`:
135
+ * 画面上端に横長バナーとして固定 (Travel のような相談カウンター型)。
136
+ * `transparent: true` を併用すると背景を半透明化して本文を透かす
137
+ * - `footer-fixed`:
138
+ * 画面下端に横長で固定 (簡易な常時表示型)
139
+ * - `inline-custom`:
140
+ * Shadow DOM を解除し、ホスト DOM に直接マウント。レイアウトは利用者が完全制御。
141
+ * `disableShadowDom: true` と同等の機能だが、意図 (= カスタムレイアウト想定) を名前で示す
142
+ * - `input-only`:
143
+ * 入力欄 (送信欄 + 送信/クリア/停止ボタン) だけをマウントする最小モード。
144
+ * メッセージ履歴とヘッダーは描画しない。ホスト側で message 一覧を独自描画したい場合に使う
145
+ * (合わせて `onMessagesChange` で message 配列を受け取る)。Shadow DOM は解除される。
146
+ */
147
+ layout?: "floating-bottom-right" | "floating-bottom-left" | "floating-top-right" | "floating-top-left" | "sidebar-left" | "sidebar-right" | "header-banner" | "footer-fixed" | "inline-custom" | "input-only";
148
+ /**
149
+ * `layout: "header-banner"` のとき背景を半透明にし、本文を透かして見せる。
150
+ * 他の layout では無視される。
151
+ */
152
+ transparent?: boolean;
153
+ /**
154
+ * チャット履歴 (Message[]) が変化するたびに呼ばれる callback。
155
+ * ホスト側で会話履歴を独自描画したい場合や、`layout: "input-only"` で
156
+ * ヘッダー / メッセージリスト非表示にして本文側に積む構成のときに使う。
157
+ * 値は wecool 内部 useChatStream の messages のスナップショット (同一参照ではない)。
158
+ */
159
+ onMessagesChange?: (messages: Message[]) => void;
160
+ /**
161
+ * Plugin システムで読み込む plugin の配列。
162
+ * 各 plugin の `setup` は宣言順に実行される。
163
+ * 1 つの plugin の例外は他に影響しない。
164
+ *
165
+ * @since 0.7.0
166
+ */
167
+ plugins?: ChatPlugin[];
168
+ /**
169
+ * tool 実行後、その結果を LLM に自然言語で語らせる追加ラウンドを挟むか。
170
+ *
171
+ * - `true`: tool 実行直後にもう 1 回 LLM に問い合わせ (`tool_choice: "none"`)、
172
+ * text のみを取得して画面に表示する。複数 tool 連鎖シーン (店内 QR 注文等)
173
+ * で「各 tool 後に AI コメントが入る」会話感を出すために使う。
174
+ * - `false` / 未指定 (既定): 追加ラウンドを行わない。従来挙動。
175
+ *
176
+ * 副作用: OpenAI 呼出回数が増える (≈ 2 倍)。料金影響を避けたいシーンでは
177
+ * 有効化しないこと。
178
+ *
179
+ * @since 0.8.0
180
+ */
181
+ narrateToolResults?: boolean;
182
+ };
183
+ /**
184
+ * Chat message
185
+ */
186
+ export type Message = {
187
+ id: string;
188
+ role: "user" | "assistant" | "system" | "tool";
189
+ content: string;
190
+ timestamp: number;
191
+ toolCall?: {
192
+ name: string;
193
+ arguments: Record<string, unknown>;
194
+ };
195
+ /**
196
+ * LLM (OpenAI 等) が tool_use を発行したときに付ける一意な call ID。
197
+ * 同じターンで同一 tool を複数回呼んだ場合でも個別に識別するために必要。
198
+ * `role:"tool"` メッセージにこの ID を保持し、API へ送る際に `tool_call_id` として
199
+ * 元の assistant.tool_calls[].id と紐づける。
200
+ */
201
+ toolCallId?: string;
202
+ toolResult?: unknown;
203
+ /**
204
+ * tool 実行が返した UI 添付物。LLM 履歴・バックエンドには送られず、ChatWidget が描画する。
205
+ * `tool` ロールのメッセージにのみ立つ。
206
+ */
207
+ attachments?: ToolAttachment[];
208
+ /** assistant ロールにのみ立つ。エラー由来の行であることを示す */
209
+ isError?: boolean;
210
+ };
211
+ /**
212
+ * Tool call from the API
213
+ */
214
+ export type ToolCall = {
215
+ name: string;
216
+ arguments: Record<string, unknown>;
217
+ };
218
+ /**
219
+ * SSE event received from the server
220
+ */
221
+ export type ChatEvent = {
222
+ type: "thinking";
223
+ status: string;
224
+ } | {
225
+ type: "tool_use";
226
+ toolCallId: string;
227
+ name: string;
228
+ input: Record<string, unknown>;
229
+ } | {
230
+ type: "text";
231
+ content: string;
232
+ } | {
233
+ type: "text_delta";
234
+ delta: string;
235
+ } | {
236
+ type: "error";
237
+ message: string;
238
+ } | {
239
+ type: "done";
240
+ conversationId: string;
241
+ };
242
+ /**
243
+ * `ChatEvent` のうち tool_use 種別のみを抜き出した派生型。
244
+ */
245
+ export type ToolUseEvent = Extract<ChatEvent, {
246
+ type: "tool_use";
247
+ }>;
248
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"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"}
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:#2563eb;--color-primary-hover:#1d4ed8}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.block{display:block}.hidden{display:none}.inline{display:inline}.table{display:table}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.italic{font-style:italic}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}:host{z-index:2147483647;touch-action:auto;--wecool-color-bg:#fff;--wecool-color-bg-secondary:#fafafa;--wecool-color-bg-muted:#f4f4f5;--wecool-color-bg-strong:#18181b;--wecool-color-text:#18181b;--wecool-color-text-on-strong:#fafafa;--wecool-color-text-muted:#71717a;--wecool-color-border:#e4e4e7;--wecool-color-border-strong:#d4d4d8;--wecool-color-error-bg:#fef2f2;--wecool-color-error-text:#dc2626;--wecool-color-link:var(--color-primary,#2563eb);--wecool-color-link-hover:var(--color-primary-hover,#1d4ed8);font-size:max(16px,1rem);line-height:1.5;position:relative}@media(prefers-color-scheme:dark){:host{--wecool-color-bg:#18181b;--wecool-color-bg-secondary:#27272a;--wecool-color-bg-muted:#3f3f46;--wecool-color-bg-strong:#fafafa;--wecool-color-text:#fafafa;--wecool-color-text-on-strong:#18181b;--wecool-color-text-muted:#a1a1aa;--wecool-color-border:#3f3f46;--wecool-color-border-strong:#52525b;--wecool-color-error-bg:#450a0a;--wecool-color-error-text:#fca5a5}}:host([data-wecool-theme=light]),.wecool-float-container[data-wecool-theme=light],.wecool-embed-root[data-wecool-theme=light]{--wecool-color-bg:#fff;--wecool-color-bg-secondary:#fafafa;--wecool-color-bg-muted:#f4f4f5;--wecool-color-bg-strong:#18181b;--wecool-color-text:#18181b;--wecool-color-text-on-strong:#fafafa;--wecool-color-text-muted:#71717a;--wecool-color-border:#e4e4e7;--wecool-color-border-strong:#d4d4d8;--wecool-color-error-bg:#fef2f2;--wecool-color-error-text:#dc2626}:host([data-wecool-theme=dark]),.wecool-float-container[data-wecool-theme=dark],.wecool-embed-root[data-wecool-theme=dark]{--wecool-color-bg:#18181b;--wecool-color-bg-secondary:#27272a;--wecool-color-bg-muted:#3f3f46;--wecool-color-bg-strong:#fafafa;--wecool-color-text:#fafafa;--wecool-color-text-on-strong:#18181b;--wecool-color-text-muted:#a1a1aa;--wecool-color-border:#3f3f46;--wecool-color-border-strong:#52525b;--wecool-color-error-bg:#450a0a;--wecool-color-error-text:#fca5a5}.wecool-float-container,.wecool-embed-root{color:var(--wecool-color-text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.wecool-float-container :focus-visible,.wecool-embed-root :focus-visible{outline:2px solid var(--color-primary,#2563eb);outline-offset:2px}.wecool-float-container :focus:not(:focus-visible),.wecool-embed-root :focus:not(:focus-visible){outline:none}@keyframes wecool-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.wecool-float-container{display:contents}.wecool-float-container--bottom-right .wecool-float-button{bottom:1.5rem;right:1.5rem}.wecool-float-container--bottom-left .wecool-float-button{bottom:1.5rem;left:1.5rem}.wecool-float-container--top-right .wecool-float-button{top:1.5rem;right:1.5rem}.wecool-float-container--top-left .wecool-float-button{top:1.5rem;left:1.5rem}.wecool-float-panel{border-radius:12px;max-width:23.75rem;max-height:min(32.5rem,100dvh - 1.25rem);position:fixed;overflow:hidden;box-shadow:0 8px 32px #0000001f;container:wecool-chat/inline-size}.wecool-float-panel--bottom-right,.wecool-float-panel--bottom-left,.wecool-float-panel--top-right,.wecool-float-panel--top-left{inset:.625rem}.wecool-float-panel--bottom-right{margin-top:auto;margin-left:auto}.wecool-float-panel--bottom-left{margin-top:auto;margin-right:auto}.wecool-float-panel--top-right{margin-bottom:auto;margin-left:auto}.wecool-float-panel--top-left{margin-bottom:auto;margin-right:auto}.wecool-float-container:has(.wecool-float-panel) .wecool-float-button{display:none}.wecool-embed-root{height:100%;container:wecool-chat/inline-size}.wecool-float-button{background-color:var(--wecool-color-bg-strong);width:3.25rem;height:3.25rem;color:var(--wecool-color-text-on-strong);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;transition:transform .15s,box-shadow .15s;display:flex;position:fixed;box-shadow:0 4px 16px #00000029}.wecool-float-button:hover{transform:scale(1.05);box-shadow:0 6px 20px #0003}.wecool-panel{background-color:var(--wecool-color-bg);border:1px solid var(--wecool-color-border);border-radius:12px;flex-direction:column;height:100%;display:flex;overflow:hidden}.wecool-header{border-bottom:1px solid var(--wecool-color-border);background-color:var(--wecool-color-bg);justify-content:flex-end;align-items:center;height:2.75rem;padding:0 .75rem;display:flex}.wecool-header--spacer{border-bottom:none;height:.5rem}.wecool-header__close{min-width:2.75rem;min-height:2.75rem;color:var(--wecool-color-text-muted);cursor:pointer;background-color:#0000;border:none;border-radius:6px;justify-content:center;align-items:center;padding:.5rem;transition:all .15s;display:flex}.wecool-header__close:hover{background-color:var(--wecool-color-bg-muted);color:var(--wecool-color-text)}.wecool-footer{border-top:1px solid var(--wecool-color-border);background-color:var(--wecool-color-bg);align-items:center;gap:.5rem;padding:.75rem;display:flex}.wecool-footer__input{height:2.5rem;color:var(--wecool-color-text);background-color:var(--wecool-color-bg-secondary);border:1px solid var(--wecool-color-border);border-radius:8px;outline:none;flex:1;padding:0 .875rem;transition:border-color .15s}.wecool-footer__input:focus-visible{border-color:var(--wecool-color-bg-strong)}.wecool-footer__button{cursor:pointer;border:none;border-radius:8px;justify-content:center;align-items:center;width:2.75rem;min-width:2.75rem;height:2.75rem;min-height:2.75rem;transition:all .15s;display:flex}.wecool-footer__button--send{background-color:var(--wecool-color-bg-strong);color:var(--wecool-color-text-on-strong)}.wecool-footer__button--send:disabled{opacity:.3;cursor:not-allowed}.wecool-footer__button--stop{background-color:var(--wecool-color-error-text);color:#fff}.wecool-footer__button--clear{color:var(--wecool-color-text-muted);background-color:#0000}.wecool-footer__button--clear:hover{background-color:var(--wecool-color-bg-muted);color:var(--wecool-color-text)}.wecool-message-list{background-color:var(--wecool-color-bg);flex-direction:column;flex:1;gap:.75rem;padding:1rem;display:flex;overflow-y:auto}.wecool-message-list__empty{color:var(--wecool-color-text-muted);flex:1;justify-content:center;align-items:center;font-size:.875rem;display:flex}.wecool-message-list__items{flex-direction:column;gap:.75rem;margin:0;padding:0;list-style:none;display:flex}.wecool-message-row{flex-direction:column;max-width:85%;display:flex;position:relative}.wecool-message-row[data-message-role=user]{align-self:flex-end}.wecool-message-row[data-message-role=assistant]{align-self:flex-start}.wecool-message-bubble{word-break:break-word;cursor:text;padding:.625rem .875rem;font-size:.875rem;line-height:1.5;position:relative}.wecool-message-bubble--user{white-space:pre-wrap;background-color:var(--wecool-color-bg-strong);color:var(--wecool-color-text-on-strong);border-radius:16px 16px 4px}.wecool-message-bubble--assistant{background-color:var(--wecool-color-bg-muted);color:var(--wecool-color-text);border-radius:16px 16px 16px 4px}.wecool-message-bubble--error{background-color:var(--wecool-color-error-bg);color:var(--wecool-color-error-text);border-radius:16px 16px 16px 4px}.wecool-message-bubble--editing.wecool-message-bubble--user{background-color:var(--wecool-color-bg);color:var(--wecool-color-text);border:1px solid var(--wecool-color-border);padding:.375rem}.wecool-message-editor{align-items:center;gap:.375rem;display:flex}.wecool-message-editor__input{height:2rem;color:var(--wecool-color-text);background-color:var(--wecool-color-bg-secondary);border:1px solid var(--wecool-color-border);border-radius:6px;outline:none;flex:1;padding:0 .625rem;transition:border-color .15s}.wecool-message-editor__input:focus-visible{border-color:var(--wecool-color-bg-strong)}.wecool-message-editor__button{cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;width:2rem;min-width:1.5rem;height:2rem;min-height:1.5rem;transition:all .15s;display:flex}.wecool-message-editor__button--send{background-color:var(--wecool-color-bg-strong);color:var(--wecool-color-text-on-strong)}.wecool-message-editor__button--send:disabled{opacity:.3;cursor:not-allowed}.wecool-message-bubble__menu{background-color:var(--wecool-color-bg-muted);border:1px solid var(--wecool-color-border);width:1.5rem;min-width:1.5rem;height:1.5rem;min-height:1.5rem;color:var(--wecool-color-text-muted);cursor:pointer;border-radius:50%;justify-content:center;align-items:center;transition:color .12s,background-color .12s;display:inline-flex;position:absolute;bottom:-.4375rem;right:-.4375rem}.wecool-message-bubble__menu:hover{background-color:var(--wecool-color-border);color:var(--wecool-color-text)}.wecool-message-popover{z-index:10;background:var(--wecool-color-bg);border:1px solid var(--wecool-color-border);border-radius:8px;flex-direction:column;gap:.125rem;min-width:8.75rem;padding:.25rem;animation:.12s ease-out wecool-popover-appear;display:flex;position:absolute;right:0;box-shadow:0 8px 24px #0000001f}.wecool-message-popover button{cursor:pointer;min-height:1.5rem;color:var(--wecool-color-text);text-align:left;background:0 0;border:none;border-radius:4px;align-items:center;gap:.5rem;width:100%;padding:.5rem .75rem;font-size:.875rem;display:flex}.wecool-message-popover button:hover{background-color:var(--wecool-color-bg-muted)}@keyframes wecool-popover-appear{0%{opacity:0;transform:translateY(.25rem)}to{opacity:1;transform:translateY(0)}}.wecool-loading{background-color:var(--wecool-color-bg-muted);border-radius:16px 16px 16px 4px;align-self:flex-start;align-items:center;gap:.375rem;max-width:85%;padding:.625rem .875rem;display:flex}.wecool-loading-dot{background-color:var(--wecool-color-text-muted);border-radius:50%;width:.375rem;height:.375rem;animation:1.4s ease-in-out infinite both wecool-bounce}.wecool-loading-dot:first-child{animation-delay:-.32s}.wecool-loading-dot:nth-child(2){animation-delay:-.16s}.wecool-sr-only{clip:rect(0,0,0,0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.wecool-icon--xs{width:.875em;height:.875em}.wecool-icon--sm{width:1em;height:1em}.wecool-icon--md{width:1.125em;height:1.125em}.wecool-icon--lg{width:1.375em;height:1.375em}@container wecool-chat (max-width:30em){.wecool-message-list{padding:.5rem}.wecool-message-row{max-width:92%}}@container wecool-chat (max-width:20em){.wecool-message-bubble{padding:.5em .625em}.wecool-header__label{display:none}}@media(prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}.wecool-loading-dot{transform:scale(1);animation:none!important}.wecool-float-button:hover{transform:none!important}}@media(forced-colors:active){.wecool-float-button,.wecool-footer__button,.wecool-header__close,.wecool-message-editor__button,.wecool-message-popover button,.wecool-message-bubble__menu{color:buttontext;background-color:buttonface;border:1px solid buttontext}.wecool-message-bubble--user,.wecool-message-bubble--assistant,.wecool-message-bubble--error,.wecool-loading{border:1px solid canvastext}.wecool-float-container :focus-visible,.wecool-embed-root :focus-visible{outline-offset:2px;outline:2px solid highlight}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}.wecool-markdown{font-size:.875rem;line-height:1.6;color:var(--wecool-color-text, #18181b)}.wecool-markdown>*:first-child{margin-top:0}.wecool-markdown>*:last-child{margin-bottom:0}.wecool-markdown p{margin:.5em 0;word-break:break-word}.wecool-markdown h1,.wecool-markdown h2,.wecool-markdown h3{margin:.8em 0 .4em;font-weight:600;line-height:1.3}.wecool-markdown h1{font-size:1.4em}.wecool-markdown h2{font-size:1.2em}.wecool-markdown h3{font-size:1.05em}.wecool-markdown h4,.wecool-markdown h5,.wecool-markdown h6{margin:.6em 0 .3em;font-size:1em;font-weight:600}.wecool-markdown ul,.wecool-markdown ol{margin:.5em 0;padding-left:1.5em}.wecool-markdown li{margin:.2em 0}.wecool-markdown li>ul,.wecool-markdown li>ol{margin:.2em 0}.wecool-markdown blockquote{margin:.5em 0;padding:.2em .8em;border-left:3px solid var(--wecool-color-border-strong, #d4d4d8);color:var(--wecool-color-text-muted, #71717a)}.wecool-markdown a{color:var(--wecool-color-link, #2563eb);text-decoration:underline}.wecool-markdown a:hover{color:var(--wecool-color-link-hover, #1d4ed8)}.wecool-markdown code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.9em}.wecool-markdown :not(pre)>code{background-color:var(--wecool-color-border, #e4e4e7);padding:.0625rem .25rem;border-radius:4px}.wecool-markdown table{display:block;width:100%;overflow-x:auto;border-collapse:collapse;margin:.5em 0}.wecool-markdown th,.wecool-markdown td{border:1px solid var(--wecool-color-border-strong, #d4d4d8);padding:.375rem .625rem;text-align:left}.wecool-markdown th{background-color:var(--wecool-color-border, #e4e4e7);font-weight:600}.wecool-markdown hr{border:none;border-top:1px solid var(--wecool-color-border-strong, #d4d4d8);margin:1em 0}.wecool-code-block{margin:.5em 0;border-radius:8px;overflow:hidden;background-color:var(--wecool-color-bg-secondary, #fafafa);border:1px solid var(--wecool-color-border, #e4e4e7)}.wecool-code-block__header{display:flex;align-items:center;justify-content:space-between;padding:.25rem .625rem;background-color:var(--wecool-color-border, #e4e4e7);font-size:.75rem;color:var(--wecool-color-text-muted, #71717a)}.wecool-code-block__language{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;text-transform:lowercase}.wecool-code-block__copy{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .375rem;min-width:1.5rem;min-height:1.5rem;background:transparent;border:none;cursor:pointer;color:var(--wecool-color-text-muted, #71717a);font-size:.75rem;border-radius:4px}.wecool-code-block__copy:hover{background-color:var(--wecool-color-border-strong, #d4d4d8);color:var(--wecool-color-text, #18181b)}.wecool-code-block pre{margin:0;padding:.625rem .75rem;overflow-x:auto;background-color:transparent}.wecool-code-block pre code{font-size:.85em;line-height:1.5;background:transparent;padding:0}.wecool-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:#2563eb;--color-primary-hover:#1d4ed8}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.block{display:block}.hidden{display:none}.inline{display:inline}.table{display:table}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.\[wecool-chat\:\<plugin-id\>\]{wecool-chat:<plugin-id>}.\[wecool-chat\:acme\/plugin\]{wecool-chat:acme/plugin}.\[wecool-chat\:scope\]{wecool-chat:scope}}:host{z-index:2147483647;touch-action:auto;--wecool-color-bg:#fff;--wecool-color-bg-secondary:#fafafa;--wecool-color-bg-muted:#f4f4f5;--wecool-color-bg-strong:#18181b;--wecool-color-text:#18181b;--wecool-color-text-on-strong:#fafafa;--wecool-color-text-muted:#71717a;--wecool-color-border:#e4e4e7;--wecool-color-border-strong:#d4d4d8;--wecool-color-error-bg:#fef2f2;--wecool-color-error-text:#dc2626;--wecool-color-link:var(--color-primary,#2563eb);--wecool-color-link-hover:var(--color-primary-hover,#1d4ed8);font-size:max(16px,1rem);line-height:1.5;position:relative}@media(prefers-color-scheme:dark){:host{--wecool-color-bg:#18181b;--wecool-color-bg-secondary:#27272a;--wecool-color-bg-muted:#3f3f46;--wecool-color-bg-strong:#fafafa;--wecool-color-text:#fafafa;--wecool-color-text-on-strong:#18181b;--wecool-color-text-muted:#a1a1aa;--wecool-color-border:#3f3f46;--wecool-color-border-strong:#52525b;--wecool-color-error-bg:#450a0a;--wecool-color-error-text:#fca5a5}}:host([data-wecool-theme=light]),.wecool-float-container[data-wecool-theme=light],.wecool-embed-root[data-wecool-theme=light]{--wecool-color-bg:#fff;--wecool-color-bg-secondary:#fafafa;--wecool-color-bg-muted:#f4f4f5;--wecool-color-bg-strong:#18181b;--wecool-color-text:#18181b;--wecool-color-text-on-strong:#fafafa;--wecool-color-text-muted:#71717a;--wecool-color-border:#e4e4e7;--wecool-color-border-strong:#d4d4d8;--wecool-color-error-bg:#fef2f2;--wecool-color-error-text:#dc2626}:host([data-wecool-theme=dark]),.wecool-float-container[data-wecool-theme=dark],.wecool-embed-root[data-wecool-theme=dark]{--wecool-color-bg:#18181b;--wecool-color-bg-secondary:#27272a;--wecool-color-bg-muted:#3f3f46;--wecool-color-bg-strong:#fafafa;--wecool-color-text:#fafafa;--wecool-color-text-on-strong:#18181b;--wecool-color-text-muted:#a1a1aa;--wecool-color-border:#3f3f46;--wecool-color-border-strong:#52525b;--wecool-color-error-bg:#450a0a;--wecool-color-error-text:#fca5a5}.wecool-float-container,.wecool-embed-root{color:var(--wecool-color-text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.wecool-float-container :focus-visible,.wecool-embed-root :focus-visible{outline:2px solid var(--color-primary,#2563eb);outline-offset:2px}.wecool-float-container :focus:not(:focus-visible),.wecool-embed-root :focus:not(:focus-visible){outline:none}@keyframes wecool-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.wecool-float-container{display:contents}.wecool-float-container--bottom-right .wecool-float-button{bottom:1.5rem;right:1.5rem}.wecool-float-container--bottom-left .wecool-float-button{bottom:1.5rem;left:1.5rem}.wecool-float-container--top-right .wecool-float-button{top:1.5rem;right:1.5rem}.wecool-float-container--top-left .wecool-float-button{top:1.5rem;left:1.5rem}.wecool-float-panel{border-radius:12px;max-width:23.75rem;max-height:min(32.5rem,100dvh - 1.25rem);position:fixed;overflow:hidden;box-shadow:0 8px 32px #0000001f;container:wecool-chat/inline-size}.wecool-float-panel--bottom-right,.wecool-float-panel--bottom-left,.wecool-float-panel--top-right,.wecool-float-panel--top-left{inset:.625rem}.wecool-float-panel--bottom-right{margin-top:auto;margin-left:auto}.wecool-float-panel--bottom-left{margin-top:auto;margin-right:auto}.wecool-float-panel--top-right{margin-bottom:auto;margin-left:auto}.wecool-float-panel--top-left{margin-bottom:auto;margin-right:auto}.wecool-float-container:has(.wecool-float-panel) .wecool-float-button{display:none}.wecool-float-panel--dragged{width:min(23.75rem,100vw - 1.25rem);height:min(32.5rem,100dvh - 1.25rem);margin:0;inset:auto}.wecool-float-panel[data-dragging=true]{-webkit-user-select:none;user-select:none}.wecool-embed-root{height:100%;container:wecool-chat/inline-size}.wecool-float-button{background-color:var(--wecool-color-bg-strong);width:3.25rem;height:3.25rem;color:var(--wecool-color-text-on-strong);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;transition:transform .15s,box-shadow .15s;display:flex;position:fixed;box-shadow:0 4px 16px #00000029}.wecool-float-button:hover{transform:scale(1.05);box-shadow:0 6px 20px #0003}.wecool-panel{background-color:var(--wecool-color-bg);border:1px solid var(--wecool-color-border);border-radius:12px;flex-direction:column;height:100%;display:flex;overflow:hidden}.wecool-embed-root--sidebar-left .wecool-panel,.wecool-embed-root--sidebar-right .wecool-panel,.wecool-embed-root--header-banner .wecool-panel,.wecool-embed-root--footer-fixed .wecool-panel{border:none;border-radius:0;width:100%;height:100%}.wecool-embed-root--input-only{box-sizing:border-box;width:100%;height:100%}.wecool-header{border-bottom:1px solid var(--wecool-color-border);background-color:var(--wecool-color-bg);justify-content:space-between;align-items:center;height:2.75rem;padding:0 .75rem;display:flex}.wecool-header--draggable{cursor:move;touch-action:none;-webkit-user-select:none;user-select:none}.wecool-header--spacer{border-bottom:none;height:.5rem}.wecool-header__close,.wecool-header__menu-toggle{min-width:2.75rem;min-height:2.75rem;color:var(--wecool-color-text-muted);cursor:pointer;background-color:#0000;border:none;border-radius:6px;justify-content:center;align-items:center;padding:.5rem;transition:all .15s;display:flex}.wecool-header__close:hover,.wecool-header__menu-toggle:hover{background-color:var(--wecool-color-bg-muted);color:var(--wecool-color-text)}.wecool-header__menu{position:relative}.wecool-header__menu-popover{border:1px solid var(--wecool-color-border);background-color:var(--wecool-color-bg);z-index:1;border-radius:8px;min-width:12rem;margin-top:.25rem;padding:.25rem;position:absolute;top:100%;right:0;box-shadow:0 8px 24px #0000001f}.wecool-header__menu-item{width:100%;min-height:2.25rem;color:var(--wecool-color-text);cursor:pointer;text-align:start;font-size:inherit;background-color:#0000;border:none;border-radius:6px;align-items:center;gap:.5rem;padding:.375rem .75rem;display:flex}.wecool-header__menu-item:hover:not(:disabled){background-color:var(--wecool-color-bg-muted)}.wecool-header__menu-item:disabled{color:var(--wecool-color-text-muted);cursor:not-allowed}.wecool-footer{border-top:1px solid var(--wecool-color-border);background-color:var(--wecool-color-bg);align-items:center;gap:.5rem;padding:.75rem;display:flex}.wecool-footer__input{min-height:2.625rem;max-height:4.125rem;color:var(--wecool-color-text);background-color:var(--wecool-color-bg-secondary);border:1px solid var(--wecool-color-border);resize:none;border-radius:8px;outline:none;flex:1;padding:.5rem .875rem;font-family:inherit;line-height:1.5rem;transition:border-color .15s;overflow-y:auto}.wecool-footer__input:focus-visible{border-color:var(--wecool-color-bg-strong)}.wecool-footer__button{cursor:pointer;border:none;border-radius:8px;justify-content:center;align-items:center;width:2.75rem;min-width:2.75rem;height:2.75rem;min-height:2.75rem;transition:all .15s;display:flex}.wecool-footer__button--send{background-color:var(--wecool-color-bg-strong);color:var(--wecool-color-text-on-strong)}.wecool-footer__button--send:disabled{opacity:.3;cursor:not-allowed}.wecool-footer__button--stop{background-color:var(--wecool-color-error-text);color:#fff}.wecool-footer__button--clear{color:var(--wecool-color-text-muted);background-color:#0000}.wecool-footer__button--clear:hover{background-color:var(--wecool-color-bg-muted);color:var(--wecool-color-text)}.wecool-message-list{background-color:var(--wecool-color-bg);flex-direction:column;flex:1;gap:.75rem;padding:1rem;display:flex;overflow-y:auto}.wecool-message-list__empty{color:var(--wecool-color-text-muted);flex:1;justify-content:center;align-items:center;font-size:.875rem;display:flex}.wecool-message-list__items{flex-direction:column;gap:.75rem;margin:0;padding:0;list-style:none;display:flex}.wecool-message-row{flex-direction:column;max-width:85%;display:flex;position:relative}.wecool-message-row[data-message-role=user]{align-self:flex-end}.wecool-message-row[data-message-role=assistant]{align-self:flex-start}.wecool-message-row__time{font-variant-numeric:tabular-nums;color:var(--wecool-color-text-muted);margin-top:.25rem;font-size:.75rem}.wecool-message-row[data-message-role=user] .wecool-message-row__time{align-self:flex-end}.wecool-message-row[data-message-role=assistant] .wecool-message-row__time{align-self:flex-start}.wecool-message-bubble{word-break:break-word;cursor:text;padding:.625rem .875rem;font-size:.875rem;line-height:1.5;position:relative}.wecool-message-bubble--user{white-space:pre-wrap;background-color:var(--wecool-color-bg-strong);color:var(--wecool-color-text-on-strong);border-radius:12px}.wecool-message-bubble--assistant{background-color:var(--wecool-color-bg-muted);color:var(--wecool-color-text);border-radius:12px}.wecool-message-bubble--error{background-color:var(--wecool-color-error-bg);color:var(--wecool-color-error-text);border-radius:12px}.wecool-message-bubble--editing.wecool-message-bubble--user{background-color:var(--wecool-color-bg);color:var(--wecool-color-text);border:1px solid var(--wecool-color-border);padding:.375rem}.wecool-message-editor{align-items:center;gap:.375rem;display:flex}.wecool-message-editor__input{height:2rem;color:var(--wecool-color-text);background-color:var(--wecool-color-bg-secondary);border:1px solid var(--wecool-color-border);border-radius:6px;outline:none;flex:1;padding:0 .625rem;transition:border-color .15s}.wecool-message-editor__input:focus-visible{border-color:var(--wecool-color-bg-strong)}.wecool-message-editor__button{cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;width:2rem;min-width:1.5rem;height:2rem;min-height:1.5rem;transition:all .15s;display:flex}.wecool-message-editor__button--send{background-color:var(--wecool-color-bg-strong);color:var(--wecool-color-text-on-strong)}.wecool-message-editor__button--send:disabled{opacity:.3;cursor:not-allowed}.wecool-message-bubble__menu{background-color:var(--wecool-color-bg-muted);border:1px solid var(--wecool-color-border);width:1.5rem;min-width:1.5rem;height:1.5rem;min-height:1.5rem;color:var(--wecool-color-text-muted);cursor:pointer;border-radius:50%;justify-content:center;align-items:center;transition:color .12s,background-color .12s;display:inline-flex;position:absolute;bottom:-.4375rem;right:-.4375rem}.wecool-message-bubble__menu:hover{background-color:var(--wecool-color-border);color:var(--wecool-color-text)}.wecool-message-popover{z-index:10;background:var(--wecool-color-bg);border:1px solid var(--wecool-color-border);border-radius:8px;flex-direction:column;gap:.125rem;min-width:8.75rem;padding:.25rem;animation:.12s ease-out wecool-popover-appear;display:flex;position:absolute;right:0;box-shadow:0 8px 24px #0000001f}.wecool-message-popover button{cursor:pointer;min-height:1.5rem;color:var(--wecool-color-text);text-align:left;background:0 0;border:none;border-radius:4px;align-items:center;gap:.5rem;width:100%;padding:.5rem .75rem;font-size:.875rem;display:flex}.wecool-message-popover button:hover{background-color:var(--wecool-color-bg-muted)}@keyframes wecool-popover-appear{0%{opacity:0;transform:translateY(.25rem)}to{opacity:1;transform:translateY(0)}}.wecool-loading{background-color:var(--wecool-color-bg-muted);border-radius:12px;align-self:flex-start;align-items:center;gap:.375rem;max-width:85%;padding:.625rem .875rem;display:flex}.wecool-loading-dot{background-color:var(--wecool-color-text-muted);border-radius:50%;width:.375rem;height:.375rem;animation:1.4s ease-in-out infinite both wecool-bounce}.wecool-loading-dot:first-child{animation-delay:-.32s}.wecool-loading-dot:nth-child(2){animation-delay:-.16s}.wecool-sr-only{clip:rect(0,0,0,0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.wecool-icon--xs{width:.875em;height:.875em}.wecool-icon--sm{width:1em;height:1em}.wecool-icon--md{width:1.125em;height:1.125em}.wecool-icon--lg{width:1.375em;height:1.375em}@container wecool-chat (max-width:30em){.wecool-message-list{padding:.5rem}.wecool-message-row{max-width:92%}}@container wecool-chat (max-width:20em){.wecool-message-bubble{padding:.5em .625em}.wecool-header__label{display:none}}@media(prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}.wecool-loading-dot{transform:scale(1);animation:none!important}.wecool-float-button:hover{transform:none!important}}@media(forced-colors:active){.wecool-float-button,.wecool-footer__button,.wecool-header__close,.wecool-message-editor__button,.wecool-message-popover button,.wecool-message-bubble__menu{color:buttontext;background-color:buttonface;border:1px solid buttontext}.wecool-message-bubble--user,.wecool-message-bubble--assistant,.wecool-message-bubble--error,.wecool-loading{border:1px solid canvastext}.wecool-float-container :focus-visible,.wecool-embed-root :focus-visible{outline-offset:2px;outline:2px solid highlight}}.wecool-layout{display:block}.wecool-layout--sidebar-left{z-index:2147483640;background:var(--wecool-color-bg,#fff);border-right:1px solid var(--wecool-color-border,#e5e5e5);width:min(22.5rem,100vw - 1.25rem);position:fixed;top:0;bottom:0;left:0;overflow:hidden;box-shadow:.25rem 0 .75rem #00000014}.wecool-layout--sidebar-right{z-index:2147483640;background:var(--wecool-color-bg,#fff);border-left:1px solid var(--wecool-color-border,#e5e5e5);width:min(22.5rem,100vw - 1.25rem);position:fixed;top:0;bottom:0;right:0;overflow:hidden;box-shadow:-.25rem 0 .75rem #00000014}.wecool-layout--header-banner{z-index:2147483640;background:var(--wecool-color-bg,#fff);border-bottom:1px solid var(--wecool-color-border,#e5e5e5);height:5rem;position:fixed;top:0;left:0;right:0;overflow:hidden;box-shadow:0 .25rem .75rem #00000014}.wecool-layout--header-banner.wecool-layout--transparent{-webkit-backdrop-filter:blur(.5rem);background:#ffffffd9}.wecool-layout--footer-fixed{z-index:2147483640;background:var(--wecool-color-bg,#fff);border-top:1px solid var(--wecool-color-border,#e5e5e5);max-height:50dvh;position:fixed;bottom:0;left:0;right:0;overflow:hidden;box-shadow:0 -.25rem .75rem #00000014}@media(prefers-color-scheme:dark){.wecool-layout--header-banner.wecool-layout--transparent{background:#18181bd9}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}.wecool-markdown{font-size:.875rem;line-height:1.6;color:var(--wecool-color-text, #18181b)}.wecool-markdown>*:first-child{margin-top:0}.wecool-markdown>*:last-child{margin-bottom:0}.wecool-markdown p{margin:.5em 0;word-break:break-word}.wecool-markdown h1,.wecool-markdown h2,.wecool-markdown h3{margin:.8em 0 .4em;font-weight:600;line-height:1.3}.wecool-markdown h1{font-size:1.4em}.wecool-markdown h2{font-size:1.2em}.wecool-markdown h3{font-size:1.05em}.wecool-markdown h4,.wecool-markdown h5,.wecool-markdown h6{margin:.6em 0 .3em;font-size:1em;font-weight:600}.wecool-markdown ul,.wecool-markdown ol{margin:.5em 0;padding-left:1.5em}.wecool-markdown li{margin:.2em 0}.wecool-markdown li>ul,.wecool-markdown li>ol{margin:.2em 0}.wecool-markdown blockquote{margin:.5em 0;padding:.2em .8em;border-left:3px solid var(--wecool-color-border-strong, #d4d4d8);color:var(--wecool-color-text-muted, #71717a)}.wecool-markdown a{color:var(--wecool-color-link, #2563eb);text-decoration:underline}.wecool-markdown a:hover{color:var(--wecool-color-link-hover, #1d4ed8)}.wecool-markdown code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.9em}.wecool-markdown :not(pre)>code{background-color:var(--wecool-color-border, #e4e4e7);padding:.0625rem .25rem;border-radius:4px}.wecool-markdown table{display:block;width:100%;overflow-x:auto;border-collapse:collapse;margin:.5em 0}.wecool-markdown th,.wecool-markdown td{border:1px solid var(--wecool-color-border-strong, #d4d4d8);padding:.375rem .625rem;text-align:left}.wecool-markdown th{background-color:var(--wecool-color-border, #e4e4e7);font-weight:600}.wecool-markdown hr{border:none;border-top:1px solid var(--wecool-color-border-strong, #d4d4d8);margin:1em 0}.wecool-code-block{margin:.5em 0;border-radius:8px;overflow:hidden;background-color:var(--wecool-color-bg-secondary, #fafafa);border:1px solid var(--wecool-color-border, #e4e4e7)}.wecool-code-block__header{display:flex;align-items:center;justify-content:space-between;padding:.25rem .625rem;background-color:var(--wecool-color-border, #e4e4e7);font-size:.75rem;color:var(--wecool-color-text-muted, #71717a)}.wecool-code-block__language{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;text-transform:lowercase}.wecool-code-block__copy{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .375rem;min-width:1.5rem;min-height:1.5rem;background:transparent;border:none;cursor:pointer;color:var(--wecool-color-text-muted, #71717a);font-size:.75rem;border-radius:4px}.wecool-code-block__copy:hover{background-color:var(--wecool-color-border-strong, #d4d4d8);color:var(--wecool-color-text, #18181b)}.wecool-code-block pre{margin:0;padding:.625rem .75rem;overflow-x:auto;background-color:transparent}.wecool-code-block pre code{font-size:.85em;line-height:1.5;background:transparent;padding:0}.wecool-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.wecool-message-attachments{display:flex;flex-direction:column;gap:.5rem;margin-top:.5rem}.wecool-message-attachment{margin:0;display:flex;flex-direction:column;gap:.375rem}.wecool-message-attachment__image{display:block;max-width:100%;height:auto;border-radius:.5rem;background-color:var(--wecool-color-bg, #ffffff)}.wecool-message-attachment__download{display:inline-flex;align-items:center;gap:.25rem;align-self:flex-start;padding:.375rem .625rem;min-width:1.5rem;min-height:1.5rem;background-color:var(--wecool-color-bg-secondary, #fafafa);border:1px solid var(--wecool-color-border, #e4e4e7);border-radius:.25rem;color:var(--wecool-color-text, #18181b);font-size:.8125rem;cursor:pointer}.wecool-message-attachment__download:hover{background-color:var(--wecool-color-bg-muted, #f4f4f5)}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}