wecool-chat 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.ja.md +9 -3
  3. package/README.md +14 -3
  4. package/dist/CopyIndicator-DcJtCBYP.js +63 -0
  5. package/dist/{MarkdownBody-EIz0jnQy.js → MarkdownBody-DX0DoV4C.js} +901 -893
  6. package/dist/VoiceControls-B_kX2Uj3.js +160 -0
  7. package/dist/{VoiceRuntime-DrYjNkZK.js → VoiceRuntime-D1nURNly.js} +13 -13
  8. package/dist/blank-line-D-aLg3m0.js +213 -0
  9. package/dist/{browser-M7mS-hAN.js → browser-a2qIWP48.js} +1 -1
  10. package/dist/core/client.d.ts +5 -0
  11. package/dist/core/client.d.ts.map +1 -1
  12. package/dist/core/consume-stream.d.ts +18 -1
  13. package/dist/core/consume-stream.d.ts.map +1 -1
  14. package/dist/core/i18n/messages.d.ts +2 -0
  15. package/dist/core/i18n/messages.d.ts.map +1 -1
  16. package/dist/core/narration-round.d.ts +27 -0
  17. package/dist/core/narration-round.d.ts.map +1 -0
  18. package/dist/core/placeholder-manager.d.ts +30 -0
  19. package/dist/core/placeholder-manager.d.ts.map +1 -0
  20. package/dist/core/run-conversation.d.ts.map +1 -1
  21. package/dist/core/stream-state.d.ts +9 -1
  22. package/dist/core/stream-state.d.ts.map +1 -1
  23. package/dist/core/types.d.ts +21 -0
  24. package/dist/core/types.d.ts.map +1 -1
  25. package/dist/createLucideIcon-Dc6H577p.js +120 -0
  26. package/dist/index.css +2 -2
  27. package/dist/index.js +6514 -5325
  28. package/dist/{jsx-runtime-Cyy0mp0f.js → jsx-runtime-2MlY8uwR.js} +132 -122
  29. package/dist/{messages-FvtWi3lI.js → messages-ZLdeJx9N.js} +11 -31
  30. package/dist/observe/__tests__/widget-self-http.test.d.ts +2 -0
  31. package/dist/observe/__tests__/widget-self-http.test.d.ts.map +1 -0
  32. package/dist/observe/__tests__/widget-self.test.d.ts +2 -0
  33. package/dist/observe/__tests__/widget-self.test.d.ts.map +1 -0
  34. package/dist/observe/observers/http.d.ts.map +1 -1
  35. package/dist/observe/observers/js-error.d.ts +7 -2
  36. package/dist/observe/observers/js-error.d.ts.map +1 -1
  37. package/dist/observe/widget-self.d.ts +46 -0
  38. package/dist/observe/widget-self.d.ts.map +1 -0
  39. package/dist/plugin/logger.d.ts.map +1 -1
  40. package/dist/plugins/qrcode.js +7 -6
  41. package/dist/remark-gfm-DDNju7JY.js +2247 -0
  42. package/dist/{remark-parse-BnwSmQr-.js → remark-parse-B3YPcONN.js} +377 -445
  43. package/dist/rolldown-runtime-Csywlj8R.js +25 -0
  44. package/dist/ui/components/ChatFooter.d.ts +4 -3
  45. package/dist/ui/components/ChatFooter.d.ts.map +1 -1
  46. package/dist/ui/components/ChatHeader.d.ts +1 -1
  47. package/dist/ui/components/ChatHeaderMenu.d.ts +1 -1
  48. package/dist/ui/components/ChatPanel.d.ts +1 -1
  49. package/dist/ui/components/ChatWidget.d.ts.map +1 -1
  50. package/dist/ui/components/CommandConfirmationCard.d.ts +1 -1
  51. package/dist/ui/components/CommandOverlays.d.ts +1 -1
  52. package/dist/ui/components/CommandPalette.d.ts +1 -1
  53. package/dist/ui/components/ConversationSelect.d.ts +1 -1
  54. package/dist/ui/components/CopyIndicator.d.ts +1 -1
  55. package/dist/ui/components/FloatButton.d.ts +1 -1
  56. package/dist/ui/components/FooterActions.d.ts +1 -1
  57. package/dist/ui/components/HelpDialogContent.d.ts +1 -1
  58. package/dist/ui/components/MessageActionsPopover.d.ts +1 -1
  59. package/dist/ui/components/MessageAttachments.d.ts +1 -1
  60. package/dist/ui/components/MessageBubble.d.ts +1 -1
  61. package/dist/ui/components/MessageCopyButton.d.ts +1 -1
  62. package/dist/ui/components/MessageEditor.d.ts +1 -1
  63. package/dist/ui/components/MessageList.d.ts +1 -1
  64. package/dist/ui/components/MessagePopoverButton.d.ts +1 -1
  65. package/dist/ui/components/MessageRow.d.ts +1 -1
  66. package/dist/ui/components/MessageRowActions.d.ts +1 -1
  67. package/dist/ui/components/MicButton.d.ts +1 -1
  68. package/dist/ui/components/ResizeHandles.d.ts +1 -1
  69. package/dist/ui/components/ToolConfirmationCard.d.ts +1 -1
  70. package/dist/ui/components/ToolConfirmationRecord.d.ts +1 -1
  71. package/dist/ui/components/ToolsDialogContent.d.ts +1 -1
  72. package/dist/ui/components/VoiceControls.d.ts +1 -1
  73. package/dist/ui/components/VoiceControls.d.ts.map +1 -1
  74. package/dist/ui/components/VoiceLoopStatusBar.d.ts +1 -1
  75. package/dist/ui/components/VoiceLoopToggle.d.ts +1 -1
  76. package/dist/ui/components/VoiceRuntime.d.ts +1 -1
  77. package/dist/ui/components/WidgetDialog.d.ts +1 -1
  78. package/dist/ui/components/markdown/CodeBlock.d.ts +1 -1
  79. package/dist/ui/components/markdown/MarkdownBody.d.ts +1 -1
  80. package/dist/ui/components/markdown/MarkdownMessage.d.ts +1 -1
  81. package/dist/ui/hooks/use-mic-button.d.ts +2 -0
  82. package/dist/ui/hooks/use-mic-button.d.ts.map +1 -1
  83. package/dist/ui/hooks/use-send-message.d.ts.map +1 -1
  84. package/dist/{unified-DctkAd9P.js → unified-DvM6W8YC.js} +3 -3
  85. package/dist/{use-voice-input-LtJJz-zQ.js → use-voice-input-DJtyHnsT.js} +3 -3
  86. package/dist/{voice-support-BeOiOzcn.js → voice-support-DYXg7xML.js} +2 -2
  87. package/package.json +33 -33
  88. package/dist/CopyIndicator-RR3hSsBA.js +0 -51
  89. package/dist/VoiceControls-A7N4uPTo.js +0 -146
  90. package/dist/blank-line-CUDmZ-mX.js +0 -143
  91. package/dist/createLucideIcon-C7wGkK-Q.js +0 -43
  92. package/dist/remark-gfm-Bzy1u34W.js +0 -1962
@@ -1,51 +0,0 @@
1
- import { a as s } from "./messages-FvtWi3lI.js";
2
- import { i as n, r as u, t as l } from "./jsx-runtime-Cyy0mp0f.js";
3
- import { t as o } from "./createLucideIcon-C7wGkK-Q.js";
4
- var p = [["path", {
5
- d: "M20 6 9 17l-5-5",
6
- key: "1gmf2c"
7
- }]], d = o("check", p), _ = [["rect", {
8
- width: "14",
9
- height: "14",
10
- x: "8",
11
- y: "8",
12
- rx: "2",
13
- ry: "2",
14
- key: "17jyea"
15
- }], ["path", {
16
- d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
17
- key: "zix9uf"
18
- }]], f = o("copy", _), m = /!\[[^\]]*\]\(\s*data:[^)]*\)/gi, x = /!\[[^\]]*\]\(\s*data:[A-Za-z0-9+/=,;_\-.%\s]*/gi, w = (r) => {
19
- let e = r.replace(m, "");
20
- return e = e.replace(x, ""), e;
21
- }, t = /* @__PURE__ */ s(n(), 1), v = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, y = /[\u200b\u200c\u200d\u2060\ufeff]/g, g = (r) => r.replace(/\r\n?/g, `
22
- `).replace(v, "").replace(y, ""), C = 2e3, A = () => {
23
- const [r, e] = (0, t.useState)(!1), a = (0, t.useRef)(null);
24
- return (0, t.useEffect)(() => () => {
25
- a.current !== null && window.clearTimeout(a.current);
26
- }, []), {
27
- copied: r,
28
- copy: (0, t.useCallback)(async (i) => {
29
- if (navigator.clipboard)
30
- try {
31
- await navigator.clipboard.writeText(g(i)), e(!0), a.current !== null && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
32
- e(!1), a.current = null;
33
- }, C);
34
- } catch {
35
- }
36
- }, [])
37
- };
38
- }, c = l();
39
- function E({ copied: r }) {
40
- const e = u(), a = r ? d : f, i = r ? e.copiedLabel : e.copyLabel;
41
- return /* @__PURE__ */ (0, c.jsxs)(c.Fragment, { children: [/* @__PURE__ */ (0, c.jsx)(a, {
42
- className: "wecool-icon--xs",
43
- "aria-hidden": "true"
44
- }), /* @__PURE__ */ (0, c.jsx)("span", { children: i })] });
45
- }
46
- export {
47
- d as i,
48
- A as n,
49
- w as r,
50
- E as t
51
- };
@@ -1,146 +0,0 @@
1
- import { a as f } from "./messages-FvtWi3lI.js";
2
- import { i as g, r as b, t as x } from "./jsx-runtime-Cyy0mp0f.js";
3
- import { t as d } from "./clsx-Cf23UI1w.js";
4
- import { n as M, t as k } from "./voice-support-BeOiOzcn.js";
5
- import { t as m } from "./createLucideIcon-C7wGkK-Q.js";
6
- import { t as L } from "./use-voice-input-LtJJz-zQ.js";
7
- var w = [
8
- ["path", {
9
- d: "M2 10v3",
10
- key: "1fnikh"
11
- }],
12
- ["path", {
13
- d: "M6 6v11",
14
- key: "11sgs0"
15
- }],
16
- ["path", {
17
- d: "M10 3v18",
18
- key: "yhl04a"
19
- }],
20
- ["path", {
21
- d: "M14 8v7",
22
- key: "3a1oy3"
23
- }],
24
- ["path", {
25
- d: "M18 5v13",
26
- key: "123xd1"
27
- }],
28
- ["path", {
29
- d: "M22 10v3",
30
- key: "154ddg"
31
- }]
32
- ], y = m("audio-lines", w), E = [
33
- ["path", {
34
- d: "M12 19v3",
35
- key: "npa21l"
36
- }],
37
- ["path", {
38
- d: "M19 10v2a7 7 0 0 1-14 0v-2",
39
- key: "1vc78b"
40
- }],
41
- ["rect", {
42
- x: "9",
43
- y: "2",
44
- width: "6",
45
- height: "13",
46
- rx: "3",
47
- key: "s6n7sd"
48
- }]
49
- ], I = m("mic", E), l = /* @__PURE__ */ f(g(), 1), j = 4e3, S = ({ voice: n, onBeforeListen: c, onTranscript: o, messages: e, announce: a }) => {
50
- const t = L(), [s, i] = (0, l.useState)(null), u = (0, l.useRef)(null), _ = n && k();
51
- (0, l.useEffect)(() => {
52
- if (!t.error) return;
53
- const p = {
54
- unsupported: e.errorGeneric,
55
- permission_denied: e.voiceInputErrorPermissionDenied,
56
- timeout: e.voiceInputErrorTimeout,
57
- no_match: e.voiceInputErrorNoMatch,
58
- network_error: e.voiceInputErrorNetwork,
59
- device_unavailable: e.voiceInputErrorDeviceUnavailable,
60
- language_unsupported: e.voiceInputErrorLanguageUnsupported
61
- }[t.error];
62
- i(p), a(p), u.current && clearTimeout(u.current), u.current = setTimeout(() => i(null), j);
63
- }, [
64
- t.error,
65
- e,
66
- a
67
- ]), (0, l.useEffect)(() => () => {
68
- u.current && clearTimeout(u.current);
69
- }, []);
70
- const v = (0, l.useCallback)(() => {
71
- if (t.isListening) {
72
- t.stop();
73
- return;
74
- }
75
- c?.(), i(null), a(e.voiceInputListeningAnnouncement), t.start(o);
76
- }, [
77
- t,
78
- c,
79
- e.voiceInputListeningAnnouncement,
80
- a,
81
- o
82
- ]), h = t.isListening ? e.voiceInputListeningAria : e.voiceInputButtonAria;
83
- return {
84
- showsMic: _,
85
- isListening: t.isListening,
86
- micErrorText: s,
87
- ariaLabel: h,
88
- handleMicClick: v
89
- };
90
- }, r = x();
91
- function R({ isListening: n, disabled: c, errorText: o, ariaLabel: e, onClick: a }) {
92
- return /* @__PURE__ */ (0, r.jsxs)(r.Fragment, { children: [/* @__PURE__ */ (0, r.jsx)("button", {
93
- type: "button",
94
- onClick: a,
95
- disabled: c,
96
- className: d("wecool-footer__button", "wecool-footer__button--mic", n && "wecool-footer__button--mic-listening"),
97
- "aria-label": e,
98
- children: /* @__PURE__ */ (0, r.jsx)(I, {
99
- className: "wecool-icon--md",
100
- "aria-hidden": "true"
101
- })
102
- }), o && /* @__PURE__ */ (0, r.jsx)("span", {
103
- className: "wecool-footer__mic-error",
104
- children: o
105
- })] });
106
- }
107
- function T({ isRunning: n, disabled: c, ariaLabel: o, onClick: e }) {
108
- return /* @__PURE__ */ (0, r.jsx)("button", {
109
- type: "button",
110
- onClick: e,
111
- disabled: c,
112
- "aria-pressed": n,
113
- "aria-label": o,
114
- className: d("wecool-footer__button", "wecool-footer__button--voice-loop", n && "wecool-footer__button--voice-loop-on"),
115
- children: /* @__PURE__ */ (0, r.jsx)(y, {
116
- className: "wecool-icon--md",
117
- "aria-hidden": "true"
118
- })
119
- });
120
- }
121
- function B({ voice: n, isLoading: c, onBeforeListen: o, onTranscript: e, announce: a, voiceLoop: t }) {
122
- const s = b(), i = S({
123
- voice: n,
124
- onBeforeListen: o,
125
- onTranscript: e,
126
- messages: s,
127
- announce: a
128
- });
129
- if (!i.showsMic) return null;
130
- const u = t !== void 0 && M();
131
- return /* @__PURE__ */ (0, r.jsxs)(r.Fragment, { children: [/* @__PURE__ */ (0, r.jsx)(R, {
132
- isListening: i.isListening,
133
- disabled: c || (t?.isRunning ?? !1),
134
- errorText: i.micErrorText,
135
- ariaLabel: i.ariaLabel,
136
- onClick: i.handleMicClick
137
- }), u && /* @__PURE__ */ (0, r.jsx)(T, {
138
- isRunning: t.isRunning,
139
- disabled: i.isListening && !t.isRunning,
140
- ariaLabel: t.isRunning ? s.voiceLoopToggleStopAria : s.voiceLoopToggleStartAria,
141
- onClick: t.toggle
142
- })] });
143
- }
144
- export {
145
- B as VoiceControls
146
- };
@@ -1,143 +0,0 @@
1
- var z = l(/[A-Za-z]/), I = l(/[\dA-Za-z]/), m = l(/[#-'*+\--9=?A-Z^-~]/);
2
- function E(n) {
3
- return n !== null && (n < 32 || n === 127);
4
- }
5
- var L = l(/\d/), O = l(/[\dA-Fa-f]/), N = l(/[!-/:-@[-`{-~]/);
6
- function y(n) {
7
- return n !== null && n < -2;
8
- }
9
- function A(n) {
10
- return n !== null && (n < 0 || n === 32);
11
- }
12
- function f(n) {
13
- return n === -2 || n === -1 || n === 32;
14
- }
15
- var w = l(new RegExp("\\p{P}|\\p{S}", "u")), x = l(/\s/);
16
- function l(n) {
17
- return r;
18
- function r(t) {
19
- return t !== null && t > -1 && n.test(String.fromCharCode(t));
20
- }
21
- }
22
- function Z(n) {
23
- return n.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
24
- }
25
- function j(n) {
26
- if (n === null || A(n) || x(n)) return 1;
27
- if (w(n)) return 2;
28
- }
29
- var k = {};
30
- function B(n, r) {
31
- const t = r || k;
32
- return p(n, typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, typeof t.includeHtml == "boolean" ? t.includeHtml : !0);
33
- }
34
- function p(n, r, t) {
35
- if (b(n)) {
36
- if ("value" in n) return n.type === "html" && !t ? "" : n.value;
37
- if (r && "alt" in n && n.alt) return n.alt;
38
- if ("children" in n) return s(n.children, r, t);
39
- }
40
- return Array.isArray(n) ? s(n, r, t) : "";
41
- }
42
- function s(n, r, t) {
43
- const e = [];
44
- let a = -1;
45
- for (; ++a < n.length; ) e[a] = p(n[a], r, t);
46
- return e.join("");
47
- }
48
- function b(n) {
49
- return !!(n && typeof n == "object");
50
- }
51
- function g(n, r, t, e) {
52
- const a = n.length;
53
- let i = 0, u;
54
- if (r < 0 ? r = -r > a ? 0 : a + r : r = r > a ? a : r, t = t > 0 ? t : 0, e.length < 1e4)
55
- u = Array.from(e), u.unshift(r, t), n.splice(...u);
56
- else
57
- for (t && n.splice(r, t); i < e.length; )
58
- u = e.slice(i, i + 1e4), u.unshift(r, 0), n.splice(...u), i += 1e4, r += 1e4;
59
- }
60
- function D(n, r) {
61
- return n.length > 0 ? (g(n, n.length, 0, r), n) : r;
62
- }
63
- var h = {}.hasOwnProperty;
64
- function F(n) {
65
- const r = {};
66
- let t = -1;
67
- for (; ++t < n.length; ) S(r, n[t]);
68
- return r;
69
- }
70
- function S(n, r) {
71
- let t;
72
- for (t in r) {
73
- const e = (h.call(n, t) ? n[t] : void 0) || (n[t] = {}), a = r[t];
74
- let i;
75
- if (a) for (i in a) {
76
- h.call(e, i) || (e[i] = []);
77
- const u = a[i];
78
- C(e[i], Array.isArray(u) ? u : u ? [u] : []);
79
- }
80
- }
81
- }
82
- function C(n, r) {
83
- let t = -1;
84
- const e = [];
85
- for (; ++t < r.length; ) (r[t].add === "after" ? n : e).push(r[t]);
86
- g(n, 0, 0, e);
87
- }
88
- function T(n, r, t) {
89
- const e = [];
90
- let a = -1;
91
- for (; ++a < n.length; ) {
92
- const i = n[a].resolveAll;
93
- i && !e.includes(i) && (r = i(r, t), e.push(i));
94
- }
95
- return r;
96
- }
97
- function P(n, r, t, e) {
98
- const a = e ? e - 1 : Number.POSITIVE_INFINITY;
99
- let i = 0;
100
- return u;
101
- function u(o) {
102
- return f(o) ? (n.enter(t), c(o)) : r(o);
103
- }
104
- function c(o) {
105
- return f(o) && i++ < a ? (n.consume(o), c) : (n.exit(t), r(o));
106
- }
107
- }
108
- var _ = {
109
- partial: !0,
110
- tokenize: d
111
- };
112
- function d(n, r, t) {
113
- return e;
114
- function e(i) {
115
- return f(i) ? P(n, a, "linePrefix")(i) : a(i);
116
- }
117
- function a(i) {
118
- return i === null || y(i) ? r(i) : t(i);
119
- }
120
- }
121
- export {
122
- y as _,
123
- D as a,
124
- w as b,
125
- j as c,
126
- I as d,
127
- m as f,
128
- N as g,
129
- O as h,
130
- F as i,
131
- Z as l,
132
- L as m,
133
- P as n,
134
- g as o,
135
- E as p,
136
- T as r,
137
- B as s,
138
- _ as t,
139
- z as u,
140
- A as v,
141
- x,
142
- f as y
143
- };
@@ -1,43 +0,0 @@
1
- import { a as g } from "./messages-FvtWi3lI.js";
2
- import { i as A } from "./jsx-runtime-Cyy0mp0f.js";
3
- var a = /* @__PURE__ */ g(A(), 1), m = (...t) => t.filter((e, r, o) => !!e && e.trim() !== "" && o.indexOf(e) === r).join(" ").trim(), b = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (t) => t.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, r, o) => o ? o.toUpperCase() : r.toLowerCase()), d = (t) => {
4
- const e = L(t);
5
- return e.charAt(0).toUpperCase() + e.slice(1);
6
- }, c = {
7
- xmlns: "http://www.w3.org/2000/svg",
8
- width: 24,
9
- height: 24,
10
- viewBox: "0 0 24 24",
11
- fill: "none",
12
- stroke: "currentColor",
13
- strokeWidth: 2,
14
- strokeLinecap: "round",
15
- strokeLinejoin: "round"
16
- }, W = (t) => {
17
- for (const e in t) if (e.startsWith("aria-") || e === "role" || e === "title") return !0;
18
- return !1;
19
- }, S = (0, a.createContext)({}), _ = () => (0, a.useContext)(S), y = (0, a.forwardRef)(({ color: t, size: e, strokeWidth: r, absoluteStrokeWidth: o, className: i = "", children: s, iconNode: C, ...l }, h) => {
20
- const { size: n = 24, strokeWidth: u = 2, absoluteStrokeWidth: p = !1, color: f = "currentColor", className: v = "" } = _() ?? {}, w = o ?? p ? Number(r ?? u) * 24 / Number(e ?? n) : r ?? u;
21
- return (0, a.createElement)("svg", {
22
- ref: h,
23
- ...c,
24
- width: e ?? n ?? c.width,
25
- height: e ?? n ?? c.height,
26
- stroke: t ?? f,
27
- strokeWidth: w,
28
- className: m("lucide", v, i),
29
- ...!s && !W(l) && { "aria-hidden": "true" },
30
- ...l
31
- }, [...C.map(([x, k]) => (0, a.createElement)(x, k)), ...Array.isArray(s) ? s : [s]]);
32
- }), j = (t, e) => {
33
- const r = (0, a.forwardRef)(({ className: o, ...i }, s) => (0, a.createElement)(y, {
34
- ref: s,
35
- iconNode: e,
36
- className: m(`lucide-${b(d(t))}`, `lucide-${t}`, o),
37
- ...i
38
- }));
39
- return r.displayName = d(t), r;
40
- };
41
- export {
42
- j as t
43
- };