wecool-chat 0.7.1 → 0.9.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 (201) hide show
  1. package/CHANGELOG.md +50 -3
  2. package/README.ja.md +161 -13
  3. package/README.md +301 -33
  4. package/dist/CopyIndicator-D50ixqNB.js +407 -0
  5. package/dist/MarkdownBody-eopKrDot.js +19983 -0
  6. package/dist/abort-BjeyCmGn.js +6 -0
  7. package/dist/browser-D1aZQhQL.js +1358 -0
  8. package/dist/core/client.d.ts +46 -2
  9. package/dist/core/client.d.ts.map +1 -1
  10. package/dist/core/consume-stream.d.ts +5 -0
  11. package/dist/core/consume-stream.d.ts.map +1 -1
  12. package/dist/core/debug-logger.d.ts +26 -0
  13. package/dist/core/debug-logger.d.ts.map +1 -0
  14. package/dist/core/error-reporter.d.ts +59 -0
  15. package/dist/core/error-reporter.d.ts.map +1 -0
  16. package/dist/core/global-error-capture.d.ts +10 -0
  17. package/dist/core/global-error-capture.d.ts.map +1 -0
  18. package/dist/core/i18n/messages.d.ts +83 -0
  19. package/dist/core/i18n/messages.d.ts.map +1 -1
  20. package/dist/core/run-conversation.d.ts +12 -0
  21. package/dist/core/run-conversation.d.ts.map +1 -1
  22. package/dist/core/sanitize-user-message.d.ts +11 -0
  23. package/dist/core/sanitize-user-message.d.ts.map +1 -0
  24. package/dist/core/stream-state.d.ts.map +1 -1
  25. package/dist/core/tool-confirmation.d.ts +35 -0
  26. package/dist/core/tool-confirmation.d.ts.map +1 -0
  27. package/dist/core/tool-runner.d.ts +15 -1
  28. package/dist/core/tool-runner.d.ts.map +1 -1
  29. package/dist/core/types.d.ts +168 -4
  30. package/dist/core/types.d.ts.map +1 -1
  31. package/dist/core/widget-origin.d.ts +33 -0
  32. package/dist/core/widget-origin.d.ts.map +1 -0
  33. package/dist/define-DZ0itsfG.js +4 -0
  34. package/dist/index.css +3 -1
  35. package/dist/index.d.ts +5 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +8421 -32540
  38. package/dist/loader.d.ts +12 -0
  39. package/dist/loader.d.ts.map +1 -0
  40. package/dist/messages-CveZLPSJ.js +175 -0
  41. package/dist/observe/__tests__/format.test.d.ts +2 -0
  42. package/dist/observe/__tests__/format.test.d.ts.map +1 -0
  43. package/dist/observe/__tests__/http.test.d.ts +2 -0
  44. package/dist/observe/__tests__/http.test.d.ts.map +1 -0
  45. package/dist/observe/__tests__/index.test.d.ts +2 -0
  46. package/dist/observe/__tests__/index.test.d.ts.map +1 -0
  47. package/dist/observe/__tests__/js-error.test.d.ts +2 -0
  48. package/dist/observe/__tests__/js-error.test.d.ts.map +1 -0
  49. package/dist/observe/__tests__/redact.test.d.ts +2 -0
  50. package/dist/observe/__tests__/redact.test.d.ts.map +1 -0
  51. package/dist/observe/__tests__/ring-buffer.test.d.ts +2 -0
  52. package/dist/observe/__tests__/ring-buffer.test.d.ts.map +1 -0
  53. package/dist/observe/format.d.ts +10 -0
  54. package/dist/observe/format.d.ts.map +1 -0
  55. package/dist/observe/index.d.ts +33 -0
  56. package/dist/observe/index.d.ts.map +1 -0
  57. package/dist/observe/observers/http.d.ts +24 -0
  58. package/dist/observe/observers/http.d.ts.map +1 -0
  59. package/dist/observe/observers/js-error.d.ts +22 -0
  60. package/dist/observe/observers/js-error.d.ts.map +1 -0
  61. package/dist/observe/redact.d.ts +27 -0
  62. package/dist/observe/redact.d.ts.map +1 -0
  63. package/dist/observe/ring-buffer.d.ts +20 -0
  64. package/dist/observe/ring-buffer.d.ts.map +1 -0
  65. package/dist/observe/types.d.ts +25 -0
  66. package/dist/observe/types.d.ts.map +1 -0
  67. package/dist/plugin/registry.d.ts.map +1 -1
  68. package/dist/plugin/types.d.ts +19 -1
  69. package/dist/plugin/types.d.ts.map +1 -1
  70. package/dist/plugin.d.ts +1 -1
  71. package/dist/plugin.js +2 -2
  72. package/dist/plugins/page-reader/__tests__/get-meta.test.d.ts +2 -0
  73. package/dist/plugins/page-reader/__tests__/get-meta.test.d.ts.map +1 -0
  74. package/dist/plugins/page-reader/__tests__/index.test.d.ts +2 -0
  75. package/dist/plugins/page-reader/__tests__/index.test.d.ts.map +1 -0
  76. package/dist/plugins/page-reader/__tests__/read-content.test.d.ts +2 -0
  77. package/dist/plugins/page-reader/__tests__/read-content.test.d.ts.map +1 -0
  78. package/dist/plugins/page-reader/__tests__/scroll.test.d.ts +2 -0
  79. package/dist/plugins/page-reader/__tests__/scroll.test.d.ts.map +1 -0
  80. package/dist/plugins/page-reader/index.d.ts +18 -0
  81. package/dist/plugins/page-reader/index.d.ts.map +1 -0
  82. package/dist/plugins/page-reader/tools/get-meta.d.ts +29 -0
  83. package/dist/plugins/page-reader/tools/get-meta.d.ts.map +1 -0
  84. package/dist/plugins/page-reader/tools/read-content.d.ts +34 -0
  85. package/dist/plugins/page-reader/tools/read-content.d.ts.map +1 -0
  86. package/dist/plugins/page-reader/tools/scroll.d.ts +29 -0
  87. package/dist/plugins/page-reader/tools/scroll.d.ts.map +1 -0
  88. package/dist/plugins/page-reader.d.ts +2 -0
  89. package/dist/plugins/page-reader.js +230 -0
  90. package/dist/plugins/qrcode/tool.d.ts +9 -6
  91. package/dist/plugins/qrcode/tool.d.ts.map +1 -1
  92. package/dist/plugins/qrcode.d.ts +1 -1
  93. package/dist/plugins/qrcode.js +121 -100
  94. package/dist/plugins/shared/abort.d.ts +7 -0
  95. package/dist/plugins/shared/abort.d.ts.map +1 -0
  96. package/dist/ui/builtin-tools/get-current-page-info.d.ts.map +1 -1
  97. package/dist/ui/builtin-tools/index.d.ts +1 -1
  98. package/dist/ui/builtin-tools/index.d.ts.map +1 -1
  99. package/dist/ui/builtin-tools/merge-builtin-tools.d.ts +9 -0
  100. package/dist/ui/builtin-tools/merge-builtin-tools.d.ts.map +1 -1
  101. package/dist/ui/commands/builtin-commands.d.ts +46 -0
  102. package/dist/ui/commands/builtin-commands.d.ts.map +1 -0
  103. package/dist/ui/components/ChatErrorBoundary.d.ts +30 -0
  104. package/dist/ui/components/ChatErrorBoundary.d.ts.map +1 -0
  105. package/dist/ui/components/ChatFooter.d.ts +18 -2
  106. package/dist/ui/components/ChatFooter.d.ts.map +1 -1
  107. package/dist/ui/components/ChatHeader.d.ts +14 -1
  108. package/dist/ui/components/ChatHeader.d.ts.map +1 -1
  109. package/dist/ui/components/ChatHeaderMenu.d.ts +7 -2
  110. package/dist/ui/components/ChatHeaderMenu.d.ts.map +1 -1
  111. package/dist/ui/components/ChatPanel.d.ts +35 -4
  112. package/dist/ui/components/ChatPanel.d.ts.map +1 -1
  113. package/dist/ui/components/ChatWidget.d.ts +1 -1
  114. package/dist/ui/components/ChatWidget.d.ts.map +1 -1
  115. package/dist/ui/components/CommandConfirmationCard.d.ts +22 -0
  116. package/dist/ui/components/CommandConfirmationCard.d.ts.map +1 -0
  117. package/dist/ui/components/CommandOverlays.d.ts +28 -0
  118. package/dist/ui/components/CommandOverlays.d.ts.map +1 -0
  119. package/dist/ui/components/CommandPalette.d.ts +25 -0
  120. package/dist/ui/components/CommandPalette.d.ts.map +1 -0
  121. package/dist/ui/components/ConversationSelect.d.ts +15 -0
  122. package/dist/ui/components/ConversationSelect.d.ts.map +1 -0
  123. package/dist/ui/components/CopyIndicator.d.ts +1 -1
  124. package/dist/ui/components/CopyIndicator.d.ts.map +1 -1
  125. package/dist/ui/components/FloatButton.d.ts +1 -1
  126. package/dist/ui/components/FloatButton.d.ts.map +1 -1
  127. package/dist/ui/components/HelpDialogContent.d.ts +7 -0
  128. package/dist/ui/components/HelpDialogContent.d.ts.map +1 -0
  129. package/dist/ui/components/MessageActionsPopover.d.ts +1 -1
  130. package/dist/ui/components/MessageActionsPopover.d.ts.map +1 -1
  131. package/dist/ui/components/MessageAttachments.d.ts +1 -1
  132. package/dist/ui/components/MessageAttachments.d.ts.map +1 -1
  133. package/dist/ui/components/MessageBubble.d.ts +1 -1
  134. package/dist/ui/components/MessageBubble.d.ts.map +1 -1
  135. package/dist/ui/components/MessageCopyButton.d.ts +1 -1
  136. package/dist/ui/components/MessageCopyButton.d.ts.map +1 -1
  137. package/dist/ui/components/MessageEditor.d.ts +1 -1
  138. package/dist/ui/components/MessageEditor.d.ts.map +1 -1
  139. package/dist/ui/components/MessageList.d.ts +6 -1
  140. package/dist/ui/components/MessageList.d.ts.map +1 -1
  141. package/dist/ui/components/MessagePopoverButton.d.ts +1 -1
  142. package/dist/ui/components/MessagePopoverButton.d.ts.map +1 -1
  143. package/dist/ui/components/MessageRow.d.ts +1 -1
  144. package/dist/ui/components/MessageRow.d.ts.map +1 -1
  145. package/dist/ui/components/MessageRowActions.d.ts +1 -1
  146. package/dist/ui/components/MessageRowActions.d.ts.map +1 -1
  147. package/dist/ui/components/ResizeHandles.d.ts +15 -0
  148. package/dist/ui/components/ResizeHandles.d.ts.map +1 -0
  149. package/dist/ui/components/ToolConfirmationCard.d.ts +22 -0
  150. package/dist/ui/components/ToolConfirmationCard.d.ts.map +1 -0
  151. package/dist/ui/components/ToolConfirmationRecord.d.ts +16 -0
  152. package/dist/ui/components/ToolConfirmationRecord.d.ts.map +1 -0
  153. package/dist/ui/components/ToolsDialogContent.d.ts +20 -0
  154. package/dist/ui/components/ToolsDialogContent.d.ts.map +1 -0
  155. package/dist/ui/components/WidgetDialog.d.ts +22 -0
  156. package/dist/ui/components/WidgetDialog.d.ts.map +1 -0
  157. package/dist/ui/components/markdown/CodeBlock.d.ts +1 -1
  158. package/dist/ui/components/markdown/CodeBlock.d.ts.map +1 -1
  159. package/dist/ui/components/markdown/MarkdownBody.d.ts +28 -0
  160. package/dist/ui/components/markdown/MarkdownBody.d.ts.map +1 -0
  161. package/dist/ui/components/markdown/MarkdownMessage.d.ts +13 -14
  162. package/dist/ui/components/markdown/MarkdownMessage.d.ts.map +1 -1
  163. package/dist/ui/components/markdown/trim-autolink-cjk.d.ts +21 -0
  164. package/dist/ui/components/markdown/trim-autolink-cjk.d.ts.map +1 -0
  165. package/dist/ui/hooks/conversationPersistence.d.ts +21 -0
  166. package/dist/ui/hooks/conversationPersistence.d.ts.map +1 -0
  167. package/dist/ui/hooks/resize-geometry.d.ts +42 -0
  168. package/dist/ui/hooks/resize-geometry.d.ts.map +1 -0
  169. package/dist/ui/hooks/use-command-execution.d.ts +38 -0
  170. package/dist/ui/hooks/use-command-execution.d.ts.map +1 -0
  171. package/dist/ui/hooks/use-command-palette.d.ts +45 -0
  172. package/dist/ui/hooks/use-command-palette.d.ts.map +1 -0
  173. package/dist/ui/hooks/use-fullscreen.d.ts +21 -0
  174. package/dist/ui/hooks/use-fullscreen.d.ts.map +1 -0
  175. package/dist/ui/hooks/use-global-error-capture.d.ts +16 -0
  176. package/dist/ui/hooks/use-global-error-capture.d.ts.map +1 -0
  177. package/dist/ui/hooks/use-locale-preference.d.ts +14 -0
  178. package/dist/ui/hooks/use-locale-preference.d.ts.map +1 -0
  179. package/dist/ui/hooks/use-menu-keyboard.d.ts +7 -1
  180. package/dist/ui/hooks/use-menu-keyboard.d.ts.map +1 -1
  181. package/dist/ui/hooks/use-send-message.d.ts +20 -0
  182. package/dist/ui/hooks/use-send-message.d.ts.map +1 -1
  183. package/dist/ui/hooks/use-tool-confirmation.d.ts +22 -0
  184. package/dist/ui/hooks/use-tool-confirmation.d.ts.map +1 -0
  185. package/dist/ui/hooks/use-tool-runner.d.ts +17 -2
  186. package/dist/ui/hooks/use-tool-runner.d.ts.map +1 -1
  187. package/dist/ui/hooks/use-visitor-id.d.ts +10 -0
  188. package/dist/ui/hooks/use-visitor-id.d.ts.map +1 -0
  189. package/dist/ui/hooks/useChatStream.d.ts +35 -0
  190. package/dist/ui/hooks/useChatStream.d.ts.map +1 -1
  191. package/dist/ui/hooks/useConversationList.d.ts +33 -0
  192. package/dist/ui/hooks/useConversationList.d.ts.map +1 -0
  193. package/dist/ui/hooks/useDraggablePanel.d.ts +2 -0
  194. package/dist/ui/hooks/useDraggablePanel.d.ts.map +1 -1
  195. package/dist/ui/hooks/useResizablePanel.d.ts +48 -0
  196. package/dist/ui/hooks/useResizablePanel.d.ts.map +1 -0
  197. package/dist/ui/types.d.ts +6 -0
  198. package/dist/ui/types.d.ts.map +1 -1
  199. package/package.json +43 -27
  200. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  201. package/dist/browser-beO7dF90.js +0 -1538
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 配信版ウィジェット (widget.js) の自己起動エントリ。
3
+ *
4
+ * `<script src=".../v1/widget.js" data-api-key="...">` の 1 行だけで動くよう、
5
+ * 自身の `<script>` タグの `data-*` 属性から設定を読み取り `initWecoolChat` を呼ぶ。
6
+ * npm 版 (`import { initWecoolChat }`) の公開 API は一切変えず、この loader は
7
+ * その薄い自己起動ラッパに徹する。
8
+ *
9
+ * ビルドは `vite.config.loader.ts` が IIFE + CSS 内包の単一ファイル dist/widget.js に固める。
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,175 @@
1
+ var d = Object.create, r = Object.defineProperty, u = Object.getOwnPropertyDescriptor, h = Object.getOwnPropertyNames, C = Object.getPrototypeOf, f = Object.prototype.hasOwnProperty, y = (e, o) => () => (o || (e((o = { exports: {} }).exports, o), e = null), o.exports), L = (e, o) => {
2
+ let a = {};
3
+ for (var n in e)
4
+ r(a, n, {
5
+ get: e[n],
6
+ enumerable: !0
7
+ });
8
+ return o || r(a, Symbol.toStringTag, { value: "Module" }), a;
9
+ }, b = (e, o, a, n) => {
10
+ if (o && typeof o == "object" || typeof o == "function")
11
+ for (var s = h(o), i = 0, m = s.length, t; i < m; i++)
12
+ t = s[i], !f.call(e, t) && t !== a && r(e, t, {
13
+ get: ((g) => o[g]).bind(null, t),
14
+ enumerable: !(n = u(o, t)) || n.enumerable
15
+ });
16
+ return e;
17
+ }, v = (e, o, a) => (a = e != null ? d(C(e)) : {}, b(o || !e || !e.__esModule ? r(a, "default", {
18
+ value: e,
19
+ enumerable: !0
20
+ }) : a, e)), p = {
21
+ inputPlaceholder: "メッセージを入力...",
22
+ emptyState: "メッセージを入力してください",
23
+ errorGeneric: "エラーが発生しました。しばらくしてからお試しください。",
24
+ stopButton: "停止",
25
+ sendButton: "送信",
26
+ clearButton: "クリア",
27
+ closeButton: "閉じる",
28
+ closeChat: "チャットを閉じる",
29
+ openChat: "チャットを開く",
30
+ responseStoppedAnnouncement: "応答を停止しました",
31
+ messageActionsToggle: "メッセージアクションを表示",
32
+ regenerateLabel: "再生成",
33
+ regenerateAria: "メッセージを再生成",
34
+ copyLabel: "コピー",
35
+ copiedLabel: "コピーしました",
36
+ copyMessageAria: "メッセージをコピー",
37
+ copyMessageAnnouncement: "メッセージをコピーしました",
38
+ copyCodeAria: "コードをコピー",
39
+ copyCodeAnnouncement: "コードをコピーしました",
40
+ editLabel: "編集",
41
+ editMessageAria: "メッセージを編集",
42
+ cancelEditLabel: "キャンセル",
43
+ cancelEditAria: "編集をキャンセル",
44
+ saveEditAria: "編集を保存して送信",
45
+ chatDialogTitle: "wecool チャット",
46
+ chatDialogDescription: "AI チャットアシスタント",
47
+ messageLogLabel: "チャット履歴",
48
+ loadingAnnouncement: "AI が応答を生成中",
49
+ inputLabel: "メッセージを入力",
50
+ downloadAttachment: "ダウンロード",
51
+ dragHandleLabel: "ドラッグまたは矢印キーでウィンドウを移動",
52
+ resizeHandleLabel: "ドラッグまたは矢印キーでウィンドウのサイズを変更",
53
+ resetPositionButton: "位置とサイズをリセット",
54
+ settingsMenuToggle: "設定メニューを開く",
55
+ fullscreenToggle: "全画面表示",
56
+ fullscreenOn: "全画面表示 オン",
57
+ fullscreenOff: "全画面表示 オフ",
58
+ newConversationOption: "+ 新しい会話",
59
+ conversationSelectLabel: "会話を選択",
60
+ stopFallbackUserMessage: "処理を中断しました。",
61
+ maxTurnsReached: "最大試行回数に達しました。条件を変えてもう一度お試しください。",
62
+ errorMessageTooLong: "メッセージが長すぎます。10,000 文字以内に収めてください。",
63
+ errorInvalidRequest: "リクエストの形式が正しくありません。",
64
+ errorRateLimit: "アクセスが集中しています。1 分ほど待ってからもう一度お試しください。",
65
+ errorDailyLimit: "本日の利用上限に達しました。明日以降にもう一度お試しください。",
66
+ errorMonthlyLimit: "今月の利用上限に達しました。プランの利用状況をご確認ください。",
67
+ qrcodeStopTextTooLong: "テキストが長すぎます。{max} 文字以内に収めてもう一度お試しください。",
68
+ toolConfirmationPrompt: "この操作を実行しますか?",
69
+ toolConfirmationApprove: "実行する",
70
+ toolConfirmationCancel: "キャンセル",
71
+ toolConfirmationRegionLabel: "操作の実行確認",
72
+ toolConfirmationApprovedLabel: "実行を承認しました",
73
+ toolConfirmationDeclinedLabel: "キャンセルしました",
74
+ commandPaletteLabel: "コマンド",
75
+ commandToolsDescription: "このAIができること",
76
+ commandClearDescription: "会話をクリア",
77
+ commandNewDescription: "新しい会話を始める",
78
+ commandLangJaDescription: "表示を日本語に切り替え",
79
+ commandLangEnDescription: "表示を英語に切り替え",
80
+ commandHelpDescription: "コマンドの使い方",
81
+ toolsDialogTitle: "このAIができること",
82
+ toolsDialogDescription: "利用できる操作と、聞き方の例の一覧です。例を選ぶと入力欄に挿入されます。",
83
+ toolsDialogEmpty: "利用できるツールはありません。",
84
+ helpDialogTitle: "コマンドの使い方",
85
+ helpDialogDescription: "入力欄の先頭で / を入力すると、以下のコマンドを実行できます。",
86
+ commandClearConfirmMessage: "会話の表示をクリアして新しい会話を始めます。よろしいですか?",
87
+ commandClearConfirmApprove: "クリアする",
88
+ commandClearConfirmCancel: "キャンセル",
89
+ commandClearConfirmRegionLabel: "会話クリアの確認"
90
+ }, c = {
91
+ ja: p,
92
+ en: {
93
+ inputPlaceholder: "Type a message...",
94
+ emptyState: "Type a message to get started",
95
+ errorGeneric: "An error occurred. Please try again later.",
96
+ stopButton: "Stop",
97
+ sendButton: "Send",
98
+ clearButton: "Clear",
99
+ closeButton: "Close",
100
+ closeChat: "Close chat",
101
+ openChat: "Open chat",
102
+ responseStoppedAnnouncement: "Response stopped",
103
+ messageActionsToggle: "Show message actions",
104
+ regenerateLabel: "Regenerate",
105
+ regenerateAria: "Regenerate message",
106
+ copyLabel: "Copy",
107
+ copiedLabel: "Copied",
108
+ copyMessageAria: "Copy message",
109
+ copyMessageAnnouncement: "Message copied",
110
+ copyCodeAria: "Copy code",
111
+ copyCodeAnnouncement: "Code copied",
112
+ editLabel: "Edit",
113
+ editMessageAria: "Edit message",
114
+ cancelEditLabel: "Cancel",
115
+ cancelEditAria: "Cancel editing",
116
+ saveEditAria: "Save edit",
117
+ chatDialogTitle: "wecool chat",
118
+ chatDialogDescription: "AI chat assistant",
119
+ messageLogLabel: "Chat history",
120
+ loadingAnnouncement: "AI is generating a response",
121
+ inputLabel: "Type a message",
122
+ downloadAttachment: "Download",
123
+ dragHandleLabel: "Drag or use arrow keys to move the window",
124
+ resizeHandleLabel: "Drag or use arrow keys to resize the window",
125
+ resetPositionButton: "Reset position and size",
126
+ settingsMenuToggle: "Open settings menu",
127
+ fullscreenToggle: "Fullscreen",
128
+ fullscreenOn: "Fullscreen on",
129
+ fullscreenOff: "Fullscreen off",
130
+ newConversationOption: "+ New conversation",
131
+ conversationSelectLabel: "Select conversation",
132
+ stopFallbackUserMessage: "The action was stopped.",
133
+ maxTurnsReached: "Reached the maximum tool retry limit. Please try again with different input.",
134
+ errorMessageTooLong: "Message is too long. Please keep it within 10,000 characters.",
135
+ errorInvalidRequest: "The request format is invalid.",
136
+ errorRateLimit: "Too many requests right now. Please wait about a minute and try again.",
137
+ errorDailyLimit: "The daily usage limit has been reached. Please try again tomorrow.",
138
+ errorMonthlyLimit: "The monthly usage limit has been reached. Please check your plan usage.",
139
+ qrcodeStopTextTooLong: "The text is too long. Please shorten it to within {max} characters and try again.",
140
+ toolConfirmationPrompt: "Do you want to run this action?",
141
+ toolConfirmationApprove: "Run",
142
+ toolConfirmationCancel: "Cancel",
143
+ toolConfirmationRegionLabel: "Action confirmation",
144
+ toolConfirmationApprovedLabel: "Approved",
145
+ toolConfirmationDeclinedLabel: "Cancelled",
146
+ commandPaletteLabel: "Commands",
147
+ commandToolsDescription: "What this AI can do",
148
+ commandClearDescription: "Clear the conversation",
149
+ commandNewDescription: "Start a new conversation",
150
+ commandLangJaDescription: "Switch the display to Japanese",
151
+ commandLangEnDescription: "Switch the display to English",
152
+ commandHelpDescription: "How to use commands",
153
+ toolsDialogTitle: "What you can ask",
154
+ toolsDialogDescription: "A list of available actions and example prompts. Select an example to insert it into the input.",
155
+ toolsDialogEmpty: "No tools are available.",
156
+ helpDialogTitle: "How to use commands",
157
+ helpDialogDescription: "Type / at the start of the input field to run one of the commands below.",
158
+ commandClearConfirmMessage: "This will clear the current conversation from view and start a new one. Continue?",
159
+ commandClearConfirmApprove: "Clear",
160
+ commandClearConfirmCancel: "Cancel",
161
+ commandClearConfirmRegionLabel: "Confirm clearing the conversation"
162
+ }
163
+ }, A = (e) => e && c[e] ? c[e] : p, l = (e) => e !== void 0 && e.length > 0 ? e : void 0, D = (e, o) => {
164
+ if (e === void 0) return;
165
+ if (typeof e == "string") return l(e);
166
+ const a = o === "ja" ? "en" : "ja";
167
+ return l(e[o]) ?? l(e[a]);
168
+ };
169
+ export {
170
+ v as a,
171
+ L as i,
172
+ D as n,
173
+ y as r,
174
+ A as t
175
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../../src/observe/__tests__/format.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.test.d.ts","sourceRoot":"","sources":["../../../src/observe/__tests__/http.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/observe/__tests__/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=js-error.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-error.test.d.ts","sourceRoot":"","sources":["../../../src/observe/__tests__/js-error.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=redact.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.test.d.ts","sourceRoot":"","sources":["../../../src/observe/__tests__/redact.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ring-buffer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ring-buffer.test.d.ts","sourceRoot":"","sources":["../../../src/observe/__tests__/ring-buffer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { ObservedEvent } from './types';
2
+ /**
3
+ * 観測イベントを LLM へ渡す英語の構造化ブロックに整形する。
4
+ * redact はこの段で適用する(バッファには生値を保持し、送信時にのみマスク)。
5
+ *
6
+ * @param events - リングバッファのスナップショット
7
+ * @returns 背景情報ブロック。イベントが 0 件なら空文字(呼び出し側は付与しない)
8
+ */
9
+ export declare const formatObserveContext: (events: readonly ObservedEvent[]) => string;
10
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/observe/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA4C7C;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,aAAa,EAAE,KAAG,MAkBvE,CAAC"}
@@ -0,0 +1,33 @@
1
+ export type { ObservedEvent } from './types';
2
+ /**
3
+ * observe の設定。`ChatConfig.observe` に渡る。
4
+ * - 省略 / `true`: 既定 ON(全チャネル観測)
5
+ * - `false`: 完全無効(パッチを一切当てない)
6
+ * - オブジェクト: チャネル単位で無効化できる
7
+ */
8
+ export type ObserveConfig = boolean | {
9
+ /** HTTP エラー(4xx/5xx)観測。既定 true */
10
+ http?: boolean;
11
+ /** JS エラー(未捕捉/reject/console.error)観測。既定 true */
12
+ errors?: boolean;
13
+ };
14
+ /** observe 稼働中のハンドル。ChatWidget が保持し、getContext / 破棄に使う */
15
+ export type ObserveController = {
16
+ /**
17
+ * 直近イベントを redact 済みの英語構造化ブロックにして返す。
18
+ * イベント 0 件なら空文字(呼び出し側は本文へ付与しない)。
19
+ */
20
+ getContext: () => string;
21
+ /** 全 observer を解除し、ホストの fetch / console / listener を原状復帰する */
22
+ dispose: () => void;
23
+ };
24
+ /**
25
+ * observe を起動する。有効なチャネルの observer を購読し、controller を返す。
26
+ * `observe: false`(全チャネル無効)のときは何も購読せず、getContext が常に空を返す
27
+ * no-op controller を返す(パッチを一切当てない)。
28
+ *
29
+ * @param config - `ChatConfig.observe`
30
+ * @returns 観測ハンドル
31
+ */
32
+ export declare const startObserve: (config: ObserveConfig | undefined) => ObserveController;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observe/index.ts"],"names":[],"mappings":"AAMA,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP;IACE,kCAAkC;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAKN,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AASF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,aAAa,GAAG,SAAS,KAAG,iBA2BhE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { ObservedEvent } from '../types';
2
+ /**
3
+ * fetch / XHR の 4xx / 5xx を観測する module-level シングルトン。
4
+ *
5
+ * Why module-level: 同一ページに複数 ChatWidget が居ても window.fetch のラップは 1 組だけ張り、
6
+ * 各 controller の record へ fan-out する(global-error-capture.ts と同じ方針)。ラップを
7
+ * インスタンス毎に重ねると多重ラップになり解除順序が壊れる。
8
+ *
9
+ * 非破壊の担保: レスポンス body は一切読まない(status / url のみ記録)。よって clone も
10
+ * 消費もせず、ホスト側の body 読み取りに影響しない。ラップは元関数を必ず呼び、最後の
11
+ * 購読解除で確実に原状復帰する。
12
+ */
13
+ type HttpRecord = (event: Extract<ObservedEvent, {
14
+ kind: "http";
15
+ }>) => void;
16
+ /**
17
+ * HTTP エラー観測へ record を登録する。最初の購読でラップを張り、最後の解除で外す。
18
+ *
19
+ * @param record - 4xx/5xx を受け取るコールバック
20
+ * @returns 購読解除関数(多重呼び出しは無害)
21
+ */
22
+ export declare const subscribeHttpObserver: (record: HttpRecord) => (() => void);
23
+ export {};
24
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/observe/observers/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;;;;GAUG;AAEH,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,KAAK,IAAI,CAAC;AA2G5E;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,UAAU,KAAG,CAAC,MAAM,IAAI,CAUrE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ObservedEvent } from '../types';
2
+ /**
3
+ * JS エラー(未捕捉例外・Promise reject・console.error)を観測する module-level シングルトン。
4
+ *
5
+ * error-reporter(core/global-error-capture.ts)とは逆に、**widget 起源フィルタをかけない**。
6
+ * observe の目的はホスト側で起きているエラーを AI へ伝えることなので、ページ上の全エラーを拾う。
7
+ *
8
+ * console.error は window の `error` イベントを発火しないため、ここだけは元関数をラップする
9
+ * (元 console.error を必ず呼び、ホストの既存ロガーを壊さない)。最後の購読解除で原状復帰する。
10
+ */
11
+ type ErrorRecord = (event: Extract<ObservedEvent, {
12
+ kind: "js-error";
13
+ }>) => void;
14
+ /**
15
+ * JS エラー観測へ record を登録する。最初の購読で購読/ラップを張り、最後の解除で外す。
16
+ *
17
+ * @param record - JS エラーを受け取るコールバック
18
+ * @returns 購読解除関数(多重呼び出しは無害)
19
+ */
20
+ export declare const subscribeJsErrorObserver: (record: ErrorRecord) => (() => void);
21
+ export {};
22
+ //# sourceMappingURL=js-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-error.d.ts","sourceRoot":"","sources":["../../../src/observe/observers/js-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;;GAQG;AAEH,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,KAAK,IAAI,CAAC;AAsEjF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,WAAW,KAAG,CAAC,MAAM,IAAI,CAOzE,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 観測データから個人情報・秘匿情報を取り除く。observe は既定 ON で同意に頼らないため、
3
+ * ここが「LLM へ個人情報を渡さない」最後の砦(#253 PII redact と方針を揃える)。
4
+ *
5
+ * 判断がつかない値はマスク側に倒す(安全側)。
6
+ */
7
+ /**
8
+ * URL をマスクする。2 段構え:
9
+ * 1. 秘匿キー(token/key/email 等)のクエリ値を [redacted] に置換
10
+ * 2. 置換後の URL 全体に自由文 redact(メール形式・トークン様文字列)を適用し、
11
+ * パスや非秘匿キーの値に紛れた PII / トークンも拾う
12
+ *
13
+ * 秘匿キー名に依存せず「値の見た目」でも拾うので、`/users/john@example.com` や
14
+ * `?ref=<長いトークン>` のような素通りを防ぐ。相対 URL でもダミー origin を基準に解釈する。
15
+ *
16
+ * @param raw - redact 前の URL 文字列
17
+ * @returns マスク済み URL
18
+ */
19
+ export declare const redactUrl: (raw: string) => string;
20
+ /**
21
+ * 自由文(エラーメッセージ等)から個人情報・トークン様文字列をマスクする。
22
+ *
23
+ * @param raw - redact 前の文字列
24
+ * @returns マスク済み文字列
25
+ */
26
+ export declare const redactText: (raw: string) => string;
27
+ //# sourceMappingURL=redact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/observe/redact.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,KAAG,MAqBvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAC+B,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 直近 N 件だけを保持するリングバッファ。上限を超えたら古いものから捨てる。
3
+ * observe が蓄積するイベント量を頭打ちにし、LLM へ渡す背景情報とメモリを一定に保つ。
4
+ */
5
+ export declare class RingBuffer<T> {
6
+ private readonly capacity;
7
+ private items;
8
+ /**
9
+ * @param capacity - 保持する最大件数。1 未満を渡したら 1 に丸める
10
+ */
11
+ constructor(capacity: number);
12
+ /** 1 件追加する。上限超過分は先頭(最古)から捨てる */
13
+ push(item: T): void;
14
+ /** 挿入順(古い→新しい)のコピーを返す */
15
+ toArray(): readonly T[];
16
+ /** 全件破棄する(同意ゲート false 化時など) */
17
+ clear(): void;
18
+ get size(): number;
19
+ }
20
+ //# sourceMappingURL=ring-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ring-buffer.d.ts","sourceRoot":"","sources":["../../src/observe/ring-buffer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC;IAMX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IALrC,OAAO,CAAC,KAAK,CAAW;IAExB;;OAEG;gBAC0B,QAAQ,EAAE,MAAM;IAI7C,gCAAgC;IAChC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAOnB,yBAAyB;IACzB,OAAO,IAAI,SAAS,CAAC,EAAE;IAIvB,+BAA+B;IAC/B,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * observe モジュールが蓄積する 1 イベント。Phase A は HTTP エラーと JS エラーの 2 種のみ。
3
+ *
4
+ * 時刻は持たない: Phase A の観測対象は「失敗が起きた事実」であり、滞在時間などの
5
+ * 時系列指標はスコープ外。整形時は署名でグルーピングして件数を数えるため、順序は
6
+ * リングバッファの挿入順で足りる。
7
+ */
8
+ export type ObservedEvent = {
9
+ readonly kind: "http";
10
+ /** HTTP メソッド(大文字)。取得できなければ "GET" */
11
+ readonly method: string;
12
+ /** redact 前の生 URL。整形直前に redact する */
13
+ readonly url: string;
14
+ /** 4xx / 5xx のステータスコード */
15
+ readonly status: number;
16
+ } | {
17
+ readonly kind: "js-error";
18
+ /** redact 前の生メッセージ。整形直前に redact する */
19
+ readonly message: string;
20
+ /** エラー名(`TypeError` 等)。取得できなければ undefined */
21
+ readonly errorName?: string;
22
+ };
23
+ /** observe が記録する 1 イベントを受け取るコールバック。observer → controller の一方向 */
24
+ export type RecordEvent = (event: ObservedEvent) => void;
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/observe/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GACrB;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEN,iEAAiE;AACjE,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugin/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAsB,MAAM,eAAe,CAAC;AAI9D,OAAO,KAAK,EACV,UAAU,EAMX,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GAAG;IAC5B,mCAAmC;IACnC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,4CAA4C;IAC5C,aAAa,EAAE,WAAW,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,qCAAqC;IACrC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,8BAA8B;IAC9B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AA6KF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,SAAS,UAAU,EAAE,EAC9B,MAAM,eAAe,KACpB,OAAO,CAAC,iBAAiB,CAI3B,CAAC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugin/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAsB,MAAM,eAAe,CAAC;AAI9D,OAAO,KAAK,EACV,UAAU,EAMX,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GAAG;IAC5B,mCAAmC;IACnC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,4CAA4C;IAC5C,aAAa,EAAE,WAAW,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,qCAAqC;IACrC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,8BAA8B;IAC9B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAkLF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,SAAS,UAAU,EAAE,EAC9B,MAAM,eAAe,KACpB,OAAO,CAAC,iBAAiB,CAI3B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ToolParameters } from '../core/types';
1
+ import { LocalizedText, ToolParameters } from '../core/types';
2
2
  /**
3
3
  * Plugin SDK の contract version。
4
4
  *
@@ -45,6 +45,24 @@ export type PluginTool<TArgs extends Record<string, unknown> = Record<string, un
45
45
  description: string;
46
46
  parameters: ToolParameters;
47
47
  handler: (args: TArgs, ctx: PluginToolInvocation) => TResult | Promise<TResult>;
48
+ /**
49
+ * 実行前にユーザー承認 UI を挟む (`Tool.requiresConfirmation` と同義)。
50
+ * 破壊的操作 (削除・上書き・外部送信等) を行う tool は宣言すること。
51
+ * optional 追加のため `pluginApiVersion: 1` 互換。
52
+ */
53
+ requiresConfirmation?: boolean;
54
+ /** 承認 UI に表示する確認文言 (`Tool.confirmationMessage` と同義) */
55
+ confirmationMessage?: string;
56
+ /**
57
+ * `/tools` 一覧に表示する訪問者向けの表示名 (`Tool.displayName` と同義)。
58
+ * UI 表示専用で LLM には送信されない。optional 追加のため `pluginApiVersion: 1` 互換。
59
+ */
60
+ displayName?: LocalizedText;
61
+ /**
62
+ * `/tools` 一覧に出す質問例 (`Tool.exampleQueries` と同義)。
63
+ * クリックで入力欄に挿入される。UI 表示専用で LLM には送信されない。
64
+ */
65
+ exampleQueries?: LocalizedText[];
48
66
  };
49
67
  /**
50
68
  * Plugin setup 時に渡される context。
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,iBAAiB;IACjB,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CACpB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,OAAO,GAAG,OAAO,IACf;IACF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,oBAAoB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjF,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC;IACpC;;;OAGG;IACH,YAAY,EAAE,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAC3D,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAC;IACV,6CAA6C;IAC7C,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IACpD,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,iBAAiB;IACjB,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CACpB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,OAAO,GAAG,OAAO,IACf;IACF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,oBAAoB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChF;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC;IACpC;;;OAGG;IACH,YAAY,EAAE,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAC3D,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAC;IACV,6CAA6C;IAC7C,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IACpD,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC"}
package/dist/plugin.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './plugin/index'
1
+ export * from './plugin/index.js'
2
2
  export {}
package/dist/plugin.js CHANGED
@@ -1,4 +1,4 @@
1
- const n = (e) => e;
1
+ import { t as i } from "./define-DZ0itsfG.js";
2
2
  export {
3
- n as definePlugin
3
+ i as definePlugin
4
4
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=get-meta.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-meta.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/page-reader/__tests__/get-meta.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/page-reader/__tests__/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=read-content.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-content.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/page-reader/__tests__/read-content.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scroll.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/page-reader/__tests__/scroll.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { ChatPlugin } from '../../plugin/types';
2
+ export type { ReadContentArgs, ReadContentResult } from './tools/read-content';
3
+ export type { MetaInfoResult } from './tools/get-meta';
4
+ export type { ScrollArgs, ScrollResult } from './tools/scroll';
5
+ /** `createPageReaderPlugin` の任意設定 */
6
+ export type PageReaderPluginOptions = {
7
+ /** read_page_content のデフォルト最大文字数。default 5000 */
8
+ defaultMaxLength?: number;
9
+ /** up_a_bit / down_a_bit のスクロール量(ビューポート高さに対する比率)。default 0.5 */
10
+ scrollAmount?: number;
11
+ };
12
+ /**
13
+ * ページ読取プラグインを組み立てる。
14
+ *
15
+ * @param opts - 既定値の上書き。省略可
16
+ */
17
+ export declare const createPageReaderPlugin: (opts?: PageReaderPluginOptions) => ChatPlugin;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/page-reader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/D,qCAAqC;AACrC,MAAM,MAAM,uBAAuB,GAAG;IACpC,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAM,uBAA4B,KAAG,UAmBxE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { PluginTool } from '../../../plugin/types';
2
+ type OgMeta = {
3
+ title: string | null;
4
+ description: string | null;
5
+ image: string | null;
6
+ type: string | null;
7
+ siteName: string | null;
8
+ };
9
+ type MetaInfoResultOk = {
10
+ ok: true;
11
+ url: string;
12
+ hostname: string;
13
+ pathname: string;
14
+ title: string;
15
+ language: string;
16
+ description: string | null;
17
+ canonicalUrl: string | null;
18
+ og: OgMeta;
19
+ };
20
+ type MetaInfoResultErr = {
21
+ ok: false;
22
+ error: "browser_only";
23
+ message: string;
24
+ };
25
+ export type MetaInfoResult = MetaInfoResultOk | MetaInfoResultErr;
26
+ /** get_meta_info ツールを組み立てる */
27
+ export declare const buildGetMetaTool: () => PluginTool<Record<string, never>, MetaInfoResult>;
28
+ export {};
29
+ //# sourceMappingURL=get-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-meta.d.ts","sourceRoot":"","sources":["../../../../src/plugins/page-reader/tools/get-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAwB,MAAM,uBAAuB,CAAC;AAI9E,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAyBlE,8BAA8B;AAC9B,eAAO,MAAM,gBAAgB,QAAO,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,cAAc,CAWlF,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { PluginTool } from '../../../plugin/types';
2
+ /** buildReadContentTool に渡すオプション */
3
+ export type ReadContentOpts = {
4
+ defaultMaxLength: number;
5
+ };
6
+ /** read_page_content tool が LLM から受け取る引数 */
7
+ export type ReadContentArgs = {
8
+ maxLength?: number;
9
+ selector?: string;
10
+ };
11
+ type ReadContentResultOk = {
12
+ ok: true;
13
+ content: string;
14
+ truncated: boolean;
15
+ totalLength: number;
16
+ selector: string;
17
+ };
18
+ type ReadContentResultErr = {
19
+ ok: false;
20
+ error: "selector_not_found" | "browser_only";
21
+ message: string;
22
+ };
23
+ export type ReadContentResult = ReadContentResultOk | ReadContentResultErr;
24
+ /** 連続する空白・改行を正規化する */
25
+ export declare const normalizeWhitespace: (text: string) => string;
26
+ /** maxLength で切り詰める。超過時は末尾に "…" を付与 */
27
+ export declare const truncateText: (text: string, maxLength: number) => {
28
+ content: string;
29
+ truncated: boolean;
30
+ };
31
+ /** read_page_content ツールを組み立てる */
32
+ export declare const buildReadContentTool: (opts: ReadContentOpts) => PluginTool<ReadContentArgs, ReadContentResult>;
33
+ export {};
34
+ //# sourceMappingURL=read-content.d.ts.map