@8wave/ai-elements 0.104.0 → 0.105.0-beta.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.
- package/dist/_chunks/{Agent-DG4nPG72.js → Agent-VhugusRf.js} +2 -2
- package/dist/_chunks/Agent-VhugusRf.js.map +1 -0
- package/dist/_chunks/{Document-DXkvvAnt.js → Document-DjNrISX1.js} +2 -2
- package/dist/_chunks/{Document-DXkvvAnt.js.map → Document-DjNrISX1.js.map} +1 -1
- package/dist/_chunks/{Media-3Mo4NRj7.js → Media-hjgDyEMr.js} +2 -2
- package/dist/_chunks/Media-hjgDyEMr.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js → PkStreamingMarkdown-B4eMb97I.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js.map → PkStreamingMarkdown-B4eMb97I.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-sf6LpUN_.js → PkToolRequestGeolocation-Bp-D2nDb.js} +3 -3
- package/{dist-vue/_chunks/PkToolRequestGeolocation-BdX5DzEN.js.map → dist/_chunks/PkToolRequestGeolocation-Bp-D2nDb.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js → PkToolRequestOAuthConnection-CjjyDj9A.js} +3 -3
- package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js.map → PkToolRequestOAuthConnection-CjjyDj9A.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js → PkToolShowArtifact-Dl8f7Q7q.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js.map → PkToolShowArtifact-Dl8f7Q7q.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js → PkToolShowCalendarEvent-B_QmZrlZ.js} +2 -2
- package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js.map → PkToolShowCalendarEvent-B_QmZrlZ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js → PkToolShowContactForm-CXE0485W.js} +14 -14
- package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js.map → PkToolShowContactForm-CXE0485W.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js → PkToolShowDiagram-D-TyCkCB.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js.map → PkToolShowDiagram-D-TyCkCB.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DdBAG0Qs.js → PkToolShowForm-BzaibKAz.js} +101 -115
- package/dist/_chunks/PkToolShowForm-BzaibKAz.js.map +1 -0
- package/dist/_chunks/{PkToolShowSources-0qudS-bu.js → PkToolShowSources-CoTIoupP.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-0qudS-bu.js.map → PkToolShowSources-CoTIoupP.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js → PkToolShowSuggestedReply-DA2Bi7k4.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js.map → PkToolShowSuggestedReply-DA2Bi7k4.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js → PkToolShowWeather-ChDHtOLz.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js.map → PkToolShowWeather-ChDHtOLz.js.map} +1 -1
- package/dist/_chunks/{browser-DuzNfJq0.js → browser-BXy4OnXA.js} +804 -779
- package/dist/_chunks/browser-BXy4OnXA.js.map +1 -0
- package/dist/_chunks/index.es-CnpsLhp_.js +1006 -0
- package/dist/_chunks/index.es-CnpsLhp_.js.map +1 -0
- package/dist/_chunks/utils-DtJdKlnF.js +185 -0
- package/dist/_chunks/utils-DtJdKlnF.js.map +1 -0
- package/dist/_chunks/{vue-i18n-_ouwlDGE.js → vue-i18n-C3J36GV4.js} +2 -2
- package/dist/_chunks/{vue-i18n-_ouwlDGE.js.map → vue-i18n-C3J36GV4.js.map} +1 -1
- package/dist/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
- package/dist/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
- package/dist/ai-elements.es.js +2100 -2159
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-gCuDMxHN.js → Agent-CpIgGdU4.js} +2 -2
- package/dist-vue/_chunks/Agent-CpIgGdU4.js.map +1 -0
- package/dist-vue/_chunks/{Document-iH61Cw06.js → Document-CiaGPYTR.js} +2 -2
- package/dist-vue/_chunks/{Document-iH61Cw06.js.map → Document-CiaGPYTR.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js → PkChatbot-xmjKbljL.js} +7 -7
- package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js.map → PkChatbot-xmjKbljL.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js → PkChatbotMessages-tHQ2JQrb.js} +75 -75
- package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js.map → PkChatbotMessages-tHQ2JQrb.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js → PkChatbotStepPayload-BtsnkJIV.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js.map → PkChatbotStepPayload-BtsnkJIV.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-B0WU0HcD.js → PkChatbotStepToolDetail-CCa95eBO.js} +116 -101
- package/dist-vue/_chunks/PkChatbotStepToolDetail-CCa95eBO.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js +180 -0
- package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js → PkChatbotViewChat-CdiPjQLq.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js.map → PkChatbotViewChat-CdiPjQLq.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js → PkChatbotViewConversations-BP-NJvlK.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js.map → PkChatbotViewConversations-BP-NJvlK.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js → PkChatbotViewFiles-DRUVmxU5.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js.map → PkChatbotViewFiles-DRUVmxU5.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js → PkChatbotViewProfile-ywvIs6N5.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js.map → PkChatbotViewProfile-ywvIs6N5.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BdX5DzEN.js → PkToolRequestGeolocation-BdIyXoPQ.js} +2 -2
- package/{dist/_chunks/PkToolRequestGeolocation-sf6LpUN_.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BdIyXoPQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js → PkToolRequestOAuthConnection-Dnch7xAB.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js.map → PkToolRequestOAuthConnection-Dnch7xAB.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js → PkToolShowDiagram-DgLxNNp7.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js.map → PkToolShowDiagram-DgLxNNp7.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-D2n2rA6J.js → PkToolShowForm-6eLi6Wr0.js} +103 -117
- package/dist-vue/_chunks/PkToolShowForm-6eLi6Wr0.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js → PkToolShowSources-DTJgvDiB.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js.map → PkToolShowSources-DTJgvDiB.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js → PkToolShowSuggestedReply-D9RY2h6Z.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js.map → PkToolShowSuggestedReply-D9RY2h6Z.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js → createChatbotApiClient-12eL7hul.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js.map → createChatbotApiClient-12eL7hul.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-Rj18hAUf.js → useChatbotStore-Chtzi5jc.js} +1086 -1016
- package/dist-vue/_chunks/useChatbotStore-Chtzi5jc.js.map +1 -0
- package/dist-vue/_chunks/{utils-B0jsOUqd.js → utils-DKNWwMTQ.js} +46 -23
- package/dist-vue/_chunks/utils-DKNWwMTQ.js.map +1 -0
- package/dist-vue/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
- package/dist-vue/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +3 -3
- package/dist-vue/index.js +259 -259
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +10 -4
- package/dist-vue/packages/components/src/PkEditorRepeater.d.ts +1 -1
- package/dist-vue/packages/components/src/chat/constants.d.ts +12 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +37 -0
- package/dist-vue/packages/models/src/schema/Agent.d.ts +24 -16
- package/dist-vue/packages/models/src/schema/AgentChatStatistics.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/Chat.d.ts +9 -9
- package/dist-vue/packages/models/src/schema/Document.d.ts +6 -6
- package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +0 -1
- package/dist-vue/packages/models/src/schema/McpServer.d.ts +2 -2
- package/dist-vue/packages/models/src/schema/Member.d.ts +2 -2
- package/dist-vue/packages/models/src/schema/Organization.d.ts +4 -4
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +29 -29
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -20
- package/dist-vue/packages/models/src/schema/User.d.ts +6 -6
- package/dist-vue/packages/models/src/schema/constants.d.ts +2 -0
- package/package.json +10 -5
- package/dist/_chunks/Agent-DG4nPG72.js.map +0 -1
- package/dist/_chunks/Media-3Mo4NRj7.js.map +0 -1
- package/dist/_chunks/PkToolShowForm-DdBAG0Qs.js.map +0 -1
- package/dist/_chunks/browser-DuzNfJq0.js.map +0 -1
- package/dist/_chunks/index.es-DXx8DNKf.js +0 -2986
- package/dist/_chunks/index.es-DXx8DNKf.js.map +0 -1
- package/dist-vue/_chunks/Agent-gCuDMxHN.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotStepToolDetail-B0WU0HcD.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js +0 -177
- package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowForm-D2n2rA6J.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-Rj18hAUf.js.map +0 -1
- package/dist-vue/_chunks/utils-B0jsOUqd.js.map +0 -1
|
@@ -81,12 +81,35 @@ function v(e, t) {
|
|
|
81
81
|
return i ? `${i} ${n}` : n;
|
|
82
82
|
}).join(". ");
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
function y(e) {
|
|
85
|
+
return e?.options ? e.options.map((e) => ({
|
|
86
|
+
label: e.label,
|
|
87
|
+
value: e.label,
|
|
88
|
+
description: e.description
|
|
89
|
+
})) : [];
|
|
90
|
+
}
|
|
91
|
+
function b(e, t) {
|
|
92
|
+
let n = {};
|
|
93
|
+
if (t == null) return n;
|
|
94
|
+
if (typeof t == "string") return e.length === 1 && (n[0] = t), n;
|
|
95
|
+
let r = (t, r) => {
|
|
96
|
+
e.forEach((e, i) => {
|
|
97
|
+
e.id === t && (n[i] = r);
|
|
98
|
+
});
|
|
99
|
+
}, i = t.answers;
|
|
100
|
+
if (Array.isArray(i)) {
|
|
101
|
+
for (let e of i) typeof e?.id == "string" && r(e.id, e.value);
|
|
102
|
+
return n;
|
|
103
|
+
}
|
|
104
|
+
for (let [e, n] of Object.entries(t)) n !== void 0 && r(e, n);
|
|
105
|
+
return n;
|
|
106
|
+
}
|
|
107
|
+
var x = [
|
|
85
108
|
"tool-perplexity_search",
|
|
86
109
|
"tool-parallel_search",
|
|
87
110
|
"tool-web_search",
|
|
88
111
|
"tool-google_search"
|
|
89
|
-
],
|
|
112
|
+
], S = /* @__PURE__ */ new Set([
|
|
90
113
|
"tool-searchInKnowledgeBase",
|
|
91
114
|
"tool-retrieveRevisedAnswers",
|
|
92
115
|
"tool-expandChunkContext",
|
|
@@ -95,45 +118,45 @@ var y = [
|
|
|
95
118
|
"tool-geocode",
|
|
96
119
|
"tool-recallUserMemory",
|
|
97
120
|
"tool-saveUserMemory",
|
|
98
|
-
...
|
|
121
|
+
...x
|
|
99
122
|
]);
|
|
100
|
-
function
|
|
101
|
-
return e(t) &&
|
|
123
|
+
function C(t) {
|
|
124
|
+
return e(t) && S.has(t.type);
|
|
102
125
|
}
|
|
103
|
-
var
|
|
126
|
+
var w = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, T = (e, ...t) => {
|
|
104
127
|
for (let n of t) {
|
|
105
128
|
let t = e?.[n];
|
|
106
129
|
if (typeof t == "string" && t.trim()) return t;
|
|
107
130
|
}
|
|
108
131
|
};
|
|
109
|
-
function
|
|
132
|
+
function E(t) {
|
|
110
133
|
if (!e(t)) return;
|
|
111
|
-
let n =
|
|
112
|
-
if (t.type === "tool-searchInKnowledgeBase" ||
|
|
134
|
+
let n = w("input" in t ? t.input : void 0), r = w("output" in t ? t.output : void 0);
|
|
135
|
+
if (t.type === "tool-searchInKnowledgeBase" || x.includes(t.type)) {
|
|
113
136
|
let e = n?.queries;
|
|
114
137
|
if (Array.isArray(e)) {
|
|
115
138
|
let t = e.filter((e) => typeof e == "string" && !!e.trim());
|
|
116
139
|
return t.length ? t.join(" · ") : void 0;
|
|
117
140
|
}
|
|
118
|
-
return
|
|
141
|
+
return T(n, "query", "objective");
|
|
119
142
|
}
|
|
120
|
-
if (t.type === "tool-retrieveRevisedAnswers") return
|
|
121
|
-
if (t.type === "tool-getWeather") return
|
|
122
|
-
if (t.type === "tool-geocode") return
|
|
123
|
-
if (t.type === "tool-expandChunkContext") return
|
|
124
|
-
if (t.type === "tool-readDocumentFile") return
|
|
125
|
-
if (t.type === "tool-recallUserMemory") return
|
|
126
|
-
if (t.type === "tool-saveUserMemory") return
|
|
127
|
-
}
|
|
128
|
-
function
|
|
143
|
+
if (t.type === "tool-retrieveRevisedAnswers") return T(n, "query");
|
|
144
|
+
if (t.type === "tool-getWeather") return T(r, "location") ?? T(n, "locationName");
|
|
145
|
+
if (t.type === "tool-geocode") return T(n, "locationName");
|
|
146
|
+
if (t.type === "tool-expandChunkContext") return T(r, "documentName");
|
|
147
|
+
if (t.type === "tool-readDocumentFile") return T(r, "name");
|
|
148
|
+
if (t.type === "tool-recallUserMemory") return T(n, "query");
|
|
149
|
+
if (t.type === "tool-saveUserMemory") return T(n, "content", "query");
|
|
150
|
+
}
|
|
151
|
+
function D(r) {
|
|
129
152
|
if (e(r)) return r.type.includes("tool-subagent") ? "ri:robot-2-line" : r.type === "tool-runWorker" ? "ri:flow-chart" : r.type === "tool-fetchTeamsChannelHistory" ? "ri:chat-history-line" : r.type.includes("tool-mcp") ? "octicon:mcp-16" : r.type === "tool-retrieveRevisedAnswers" ? "ri:file-edit-line" : r.type === "tool-searchInKnowledgeBase" ? "ri:search-line" : r.type === "tool-expandChunkContext" ? "ri:file-search-line" : r.type === "tool-readDocumentFile" ? "ri:file-text-line" : r.type === "tool-geocode" ? "ri:map-2-line" : r.type === "tool-getWeather" ? "ri:sun-cloudy-line" : r.type === "tool-recallUserMemory" ? "ri:brain-line" : r.type === "tool-saveUserMemory" ? "ri:save-3-line" : r.type === "tool-showWeather" ? "ri:sun-line" : r.type === "tool-showDiagram" ? "ri:flow-chart" : r.type === "tool-showSources" ? "ri:book-2-line" : r.type === "tool-showForm" ? "ri:survey-line" : r.type === "tool-showMultipleChoice" ? "ri:checkbox-multiple-line" : r.type === "tool-showArtifact" ? "ri:file-code-line" : r.type === "tool-showEmail" ? "ri:mail-line" : r.type === "tool-showMessage" ? "ri:chat-1-line" : r.type === "tool-showWebPages" ? "ri:pages-line" : r.type === "tool-showProductList" ? "ri:shopping-bag-line" : r.type === "tool-showContactForm" ? "ri:send-plane-2-line" : r.type === "tool-showCalendarEvent" ? "ri:calendar-event-line" : r.type === "tool-showComparison" ? "ri:scales-line" : r.type === "tool-showLocation" ? "ri:map-pin-line" : r.type === "tool-showQrCode" ? "ri:qr-code-line" : r.type === "tool-showImageGallery" ? "ri:image-line" : r.type === "tool-showVideo" ? "ri:film-line" : r.type === "tool-showSuggestedReply" ? "ri:corner-down-right-line" : r.type === "tool-requestGeolocation" ? "ri:map-pin-user-line" : r.type === "tool-perplexity_search" || r.type === "tool-parallel_search" || r.type === "tool-web_search" || r.type === "tool-google_search" ? "ri:global-line" : "ri:tools-line";
|
|
130
153
|
if (t(r)) return "ri:lightbulb-line";
|
|
131
154
|
if (n(r)) return "ri:double-quotes-r";
|
|
132
155
|
}
|
|
133
|
-
function
|
|
134
|
-
return e(r) ? r.type.includes("tool-subagent") ? n("messagePart.runSubagent") : r.type === "tool-runWorker" ? n("messagePart.runWorker") : r.type === "tool-fetchTeamsChannelHistory" ? n("messagePart.fetchTeamsChannelHistory") : r.type === "tool-retrieveRevisedAnswers" ? n("messagePart.revisedAnswers") : r.type === "tool-searchInKnowledgeBase" ? n("messagePart.searchingDocuments") : r.type === "tool-expandChunkContext" ? n("messagePart.expandChunkContext") : r.type === "tool-readDocumentFile" ? n("messagePart.readDocumentFile") : r.type === "tool-geocode" ? n("messagePart.geocode") : r.type === "tool-getWeather" ? n("messagePart.getWeather") : r.type === "tool-recallUserMemory" ? n("messagePart.recallUserMemory") : r.type === "tool-saveUserMemory" ? n("messagePart.saveUserMemory") : r.type === "tool-showWeather" ? n("messagePart.showWeather") : r.type === "tool-showForm" ? n("messagePart.showForm") : r.type === "tool-showDiagram" ? n("messagePart.showDiagram") : r.type === "tool-showSources" ? n("messagePart.showSources") : r.type === "tool-showMultipleChoice" ? n("messagePart.showMultipleChoice") : r.type === "tool-showArtifact" ? n("messagePart.showArtifact") : r.type === "tool-showEmail" ? n("messagePart.showEmail") : r.type === "tool-showMessage" ? n("messagePart.showMessage") : r.type === "tool-showWebPages" ? n("messagePart.showWebPages") : r.type === "tool-showProducts" ? n("messagePart.showProducts") : r.type === "tool-showContactForm" ? n("messagePart.showContactForm") : r.type === "tool-showCalendarEvent" ? n("messagePart.showCalendarEvent") : r.type === "tool-showComparison" ? n("messagePart.showComparison") : r.type === "tool-showLocation" ? n("messagePart.showLocation") : r.type === "tool-showQrCode" ? n("messagePart.showQrCode") : r.type === "tool-showImageGallery" ? n("messagePart.showImageGallery") : r.type === "tool-showVideo" ? n("messagePart.showVideo") : r.type === "tool-showSuggestedReply" ? n("messagePart.showSuggestedReply") : r.type === "tool-requestGeolocation" ? n("messagePart.requestGeolocation") :
|
|
156
|
+
function O(n, r) {
|
|
157
|
+
return e(r) ? r.type.includes("tool-subagent") ? n("messagePart.runSubagent") : r.type === "tool-runWorker" ? n("messagePart.runWorker") : r.type === "tool-fetchTeamsChannelHistory" ? n("messagePart.fetchTeamsChannelHistory") : r.type === "tool-retrieveRevisedAnswers" ? n("messagePart.revisedAnswers") : r.type === "tool-searchInKnowledgeBase" ? n("messagePart.searchingDocuments") : r.type === "tool-expandChunkContext" ? n("messagePart.expandChunkContext") : r.type === "tool-readDocumentFile" ? n("messagePart.readDocumentFile") : r.type === "tool-geocode" ? n("messagePart.geocode") : r.type === "tool-getWeather" ? n("messagePart.getWeather") : r.type === "tool-recallUserMemory" ? n("messagePart.recallUserMemory") : r.type === "tool-saveUserMemory" ? n("messagePart.saveUserMemory") : r.type === "tool-showWeather" ? n("messagePart.showWeather") : r.type === "tool-showForm" ? n("messagePart.showForm") : r.type === "tool-showDiagram" ? n("messagePart.showDiagram") : r.type === "tool-showSources" ? n("messagePart.showSources") : r.type === "tool-showMultipleChoice" ? n("messagePart.showMultipleChoice") : r.type === "tool-showArtifact" ? n("messagePart.showArtifact") : r.type === "tool-showEmail" ? n("messagePart.showEmail") : r.type === "tool-showMessage" ? n("messagePart.showMessage") : r.type === "tool-showWebPages" ? n("messagePart.showWebPages") : r.type === "tool-showProducts" ? n("messagePart.showProducts") : r.type === "tool-showContactForm" ? n("messagePart.showContactForm") : r.type === "tool-showCalendarEvent" ? n("messagePart.showCalendarEvent") : r.type === "tool-showComparison" ? n("messagePart.showComparison") : r.type === "tool-showLocation" ? n("messagePart.showLocation") : r.type === "tool-showQrCode" ? n("messagePart.showQrCode") : r.type === "tool-showImageGallery" ? n("messagePart.showImageGallery") : r.type === "tool-showVideo" ? n("messagePart.showVideo") : r.type === "tool-showSuggestedReply" ? n("messagePart.showSuggestedReply") : r.type === "tool-requestGeolocation" ? n("messagePart.requestGeolocation") : x.includes(r.type) ? n("messagePart.webSearch") : n("messagePart.tool") : t(r) ? n("messagePart.reasoning") : n("messagePart.streaming");
|
|
135
158
|
}
|
|
136
159
|
//#endregion
|
|
137
|
-
export {
|
|
160
|
+
export { c as _, y as a, g as b, d as c, E as d, _ as f, i as g, f as h, b as i, u as l, l as m, x as n, h as o, C as p, v as r, D as s, s as t, O as u, r as v, m as y };
|
|
138
161
|
|
|
139
|
-
//# sourceMappingURL=utils-
|
|
162
|
+
//# sourceMappingURL=utils-DKNWwMTQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-DKNWwMTQ.js","names":[],"sources":["../../../../packages/components/src/chat/utils.ts"],"sourcesContent":["import type { UIMessage } from 'ai'\nimport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n} from 'utils'\n\nexport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n}\n\n/**\n * Merges consecutive text parts into a single text part.\n * Claude (and other models) often produce multiple text parts during streaming\n * that should logically be a single block of text.\n */\nexport function mergeConsecutiveTextParts(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const merged: UIMessage['parts'] = []\n for (const part of parts) {\n if (!isTextPart(part)) {\n merged.push(part)\n continue\n }\n const prev = merged[merged.length - 1]\n if (prev && isTextPart(prev)) {\n merged[merged.length - 1] = { ...prev, text: prev.text + part.text }\n } else {\n merged.push(part)\n }\n }\n return merged\n}\n\nexport function isStreamingPart(\n part: UIMessage['parts'][number] | null | undefined,\n): part is Extract<UIMessage['parts'][number], { streaming?: boolean }> {\n if (!part) return false\n if ('state' in part) {\n return part.state === 'streaming' || part.state === 'input-streaming'\n }\n return false\n}\n\n/**\n * States a tool part goes through when it needs the user's approval. They are\n * rendered by `PkToolApprovalCard` whatever the tool is, so the decision (and\n * its outcome) stays visible in the transcript.\n */\nconst TOOL_APPROVAL_STATES = new Set([\n 'approval-requested',\n 'approval-responded',\n 'output-denied',\n])\n\nexport function isToolApprovalPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n if (!isToolPart(part)) {\n return false\n }\n if (TOOL_APPROVAL_STATES.has(part.state)) {\n return true\n }\n // An executed (or errored) call that went through the gate keeps its\n // verdict in `approval`: the card stays in the transcript, so the user's\n // decision remains visible in the chat and in the log viewers (parity\n // with requestConfirm, whose 'confirmed' output is persisted).\n return (part as { approval?: unknown }).approval != null\n}\n\n/**\n * The client-side tool the model uses to have an action it described approved.\n * It predates the SDK's approval gate and keeps its own round-trip (it resolves\n * through `addToolOutput`), but it asks the user the very same question, so it\n * shares `PkToolApprovalCard` instead of having a card of its own.\n */\nexport const CONFIRM_TOOL_NAME = 'requestConfirm'\n\nexport function isToolConfirmPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return isToolPart(part) && part.type === `tool-${CONFIRM_TOOL_NAME}`\n}\n\n/** True for any part the confirmation card is responsible for. */\nexport function isConfirmationCardPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return isToolApprovalPart(part) || isToolConfirmPart(part)\n}\n\n/** The id of the pending approval request on a tool part, if any. */\nexport function getToolApprovalId(\n part: UIMessage['parts'][number] | null | undefined,\n): string | undefined {\n if (!isToolPart(part)) {\n return undefined\n }\n return (part as { approval?: { id?: string } }).approval?.id\n}\n\nexport function getPartState(\n part: UIMessage['parts'][number] | null | undefined,\n): string | undefined {\n if (!part) return undefined\n if ('state' in part) {\n return part.state\n }\n return undefined\n}\n\nexport function isLoadingState(state?: string): boolean {\n if (!state) return false\n return ['streaming'].includes(state)\n}\n\nexport function getContrast(hexcolor: string = '000000'): 'black' | 'white' {\n let hex = hexcolor.replace('#', '')\n\n // Expand 3-character hex to 6-character (e.g., #ccc -> #cccccc)\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n\n // WCAG relative luminance\n const r = parseInt(hex.substring(0, 2), 16) / 255\n const g = parseInt(hex.substring(2, 4), 16) / 255\n const b = parseInt(hex.substring(4, 6), 16) / 255\n\n const linearize = (c: number) =>\n c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n\n const luminance =\n 0.2126 * linearize(r) + 0.7152 * linearize(g) + 0.0722 * linearize(b)\n\n return luminance > 0.179 ? 'black' : 'white'\n}\n\n/**\n * Resolves the contrast color based on the user's `textColor` preference.\n * Falls back to WCAG auto-detection via `getContrast` when set to `'auto'` or `undefined`.\n */\nexport function resolveContrastColor(\n textColor: 'auto' | 'white' | 'black' | undefined,\n mainColor: string | undefined,\n): 'black' | 'white' {\n if (textColor === 'white' || textColor === 'black') {\n return textColor\n }\n return getContrast(mainColor)\n}\n\n/**\n * Formats a duration in milliseconds using the i18n `seconds` number format\n * (e.g. \"12,4 secondi\" / \"12.4 seconds\"). Returns undefined for durations\n * that would render as \"0 seconds\" (less than 0.05s).\n */\nexport function formatDuration(\n $n: (value: number, format: string) => string,\n ms?: number,\n): string | undefined {\n if (ms === undefined || ms < 50) {\n return undefined\n }\n return $n(ms / 1000, 'seconds')\n}\n\n/**\n * Stringifies a tool payload for the raw fallback view. Returns undefined for\n * empty values so the caller can skip rendering the block entirely.\n */\nexport function stringifyPayload(value: unknown): string | undefined {\n if (value === undefined) {\n return undefined\n }\n if (typeof value === 'string') {\n return value.trim() || undefined\n }\n try {\n const json = JSON.stringify(value, null, 2)\n return json === '{}' || json === '[]' ? undefined : json\n } catch {\n return undefined\n }\n}\n\n/**\n * True when a tool payload carries something worth rendering, so a caller can\n * skip the block without stringifying the value twice.\n */\nexport function hasPayload(value: unknown): boolean {\n return stringifyPayload(value) !== undefined\n}\n\n/**\n * Turns the answers of a form into the sentence the caller would have said.\n *\n * On a call the tool loop is over by the time the form is on screen, so the\n * answers go back to the agent as a user message (see `sendUserMessage` in\n * `useVoiceSession`). Each answer is paired with its question, because that is\n * how a person would say it and because the agent hears it with no widget\n * attached.\n */\nexport function formAnswerAsSpoken(\n part: unknown,\n answer: string | { answers: { id: string; value: unknown }[] },\n): string {\n const input = (\n part as {\n input?: {\n steps?: { id: string; question?: string }[]\n question?: string\n }\n }\n )?.input\n\n if (typeof answer === 'string') {\n const question = input?.question ?? input?.steps?.[0]?.question\n return question ? `${question} ${answer}` : answer\n }\n\n const questionById = new Map(\n (input?.steps ?? []).map((step) => [step.id, step.question]),\n )\n const lines = answer.answers\n .filter(\n ({ value }) =>\n value !== null &&\n value !== '' &&\n !(Array.isArray(value) && !value.length),\n )\n .map(({ id, value }) => {\n const said = Array.isArray(value) ? value.join(', ') : String(value)\n const question = questionById.get(id)\n return question ? `${question} ${said}` : said\n })\n\n return lines.join('. ')\n}\n\n/**\n * The choices of a form step, as the radio and checkbox editors take them.\n *\n * The `value` is the LABEL and not the position, because it is what travels\n * back to the model as the answer: it reads the words it wrote, not an index.\n * Nothing here caps the list, and nothing should: the number of options an\n * agent configures is advice to the model, so a step can legitimately carry\n * more (see `showForm.tool.ts`).\n */\nexport function formStepOptions(\n step: { options?: { label: string; description?: string }[] } | undefined,\n): { label: string; value: string; description?: string }[] {\n if (!step?.options) {\n return []\n }\n return step.options.map((option) => ({\n label: option.label,\n value: option.label,\n description: option.description,\n }))\n}\n\n/**\n * Spreads the answers a form comes back with onto one slot PER STEP.\n *\n * A form's answers travel paired with step ids, and the tool schema does not\n * enforce that those ids are unique: a `.refine()` there would refuse the whole\n * form over a duplicate, which is the failure the schema was just cured of (see\n * the gotchas entry \"A configurable cap does not belong in an inputSchema\").\n * So the duplicate has to be survivable here. Keyed by id, two steps sharing\n * one collapsed onto a single answer: the second question showed the first\n * one's reply, and submitting sent that reply twice. Keyed by position, each\n * step keeps its own.\n *\n * A duplicated id restores the same incoming value to every step claiming it,\n * which is as much as the payload allows: the ids are all it says.\n */\nexport function formAnswerSlots(\n steps: { id: string }[],\n output: unknown,\n): Record<number, unknown> {\n const slots: Record<number, unknown> = {}\n if (output === undefined || output === null) {\n return slots\n }\n // A legacy single-choice answer is the plain string, and it can only\n // belong to a single-step form.\n if (typeof output === 'string') {\n if (steps.length === 1) {\n slots[0] = output\n }\n return slots\n }\n const assign = (id: string, value: unknown) => {\n steps.forEach((step, index) => {\n if (step.id === id) {\n slots[index] = value\n }\n })\n }\n const list = (output as { answers?: unknown }).answers\n if (Array.isArray(list)) {\n for (const answer of list as { id?: unknown; value?: unknown }[]) {\n if (typeof answer?.id === 'string') {\n assign(answer.id, answer.value)\n }\n }\n return slots\n }\n // Forms answered on a platform channel (the Teams modal) come back as a\n // flat record keyed by step id.\n for (const [id, value] of Object.entries(\n output as Record<string, unknown>,\n )) {\n if (value !== undefined) {\n assign(id, value)\n }\n }\n return slots\n}\n\n// Provider-native web search tool part types\nexport const WEB_SEARCH_TOOL_TYPES = [\n 'tool-perplexity_search',\n 'tool-parallel_search',\n 'tool-web_search',\n 'tool-google_search',\n]\n\n// Tool part types with a dedicated rich rendering in PkChatbotStepToolDetail\nconst RICH_DETAIL_TOOL_TYPES = new Set([\n 'tool-searchInKnowledgeBase',\n 'tool-retrieveRevisedAnswers',\n 'tool-expandChunkContext',\n 'tool-readDocumentFile',\n 'tool-getWeather',\n 'tool-geocode',\n 'tool-recallUserMemory',\n 'tool-saveUserMemory',\n ...WEB_SEARCH_TOOL_TYPES,\n])\n\nexport function hasRichToolDetail(\n part?: UIMessage['parts'][number] | null,\n): boolean {\n return isToolPart(part) && RICH_DETAIL_TOOL_TYPES.has(part.type)\n}\n\nconst asRecord = (value: unknown): Record<string, unknown> | undefined =>\n value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined\n\nconst pickString = (\n record: Record<string, unknown> | undefined,\n ...keys: string[]\n): string | undefined => {\n for (const key of keys) {\n const value = record?.[key]\n if (typeof value === 'string' && value.trim()) {\n return value\n }\n }\n return undefined\n}\n\n/**\n * Returns a short inline summary for a tool part (search queries, location,\n * document name, ...) to be shown next to the step label without expanding\n * the step body.\n */\nexport function getToolPartSummary(\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (!isToolPart(part)) {\n return undefined\n }\n const input = asRecord('input' in part ? part.input : undefined)\n const output = asRecord('output' in part ? part.output : undefined)\n if (\n part.type === 'tool-searchInKnowledgeBase' ||\n WEB_SEARCH_TOOL_TYPES.includes(part.type)\n ) {\n const queries = input?.queries\n if (Array.isArray(queries)) {\n const valid = queries.filter(\n (query): query is string =>\n typeof query === 'string' && Boolean(query.trim()),\n )\n return valid.length ? valid.join(' · ') : undefined\n }\n return pickString(input, 'query', 'objective')\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return pickString(input, 'query')\n }\n if (part.type === 'tool-getWeather') {\n return (\n pickString(output, 'location') ?? pickString(input, 'locationName')\n )\n }\n if (part.type === 'tool-geocode') {\n return pickString(input, 'locationName')\n }\n if (part.type === 'tool-expandChunkContext') {\n return pickString(output, 'documentName')\n }\n if (part.type === 'tool-readDocumentFile') {\n return pickString(output, 'name')\n }\n if (part.type === 'tool-recallUserMemory') {\n return pickString(input, 'query')\n }\n if (part.type === 'tool-saveUserMemory') {\n return pickString(input, 'content', 'query')\n }\n return undefined\n}\n\n// Get part icon\nexport function getPartIcon(\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (isToolPart(part)) {\n if (part.type.includes('tool-subagent')) {\n return 'ri:robot-2-line'\n }\n if (part.type === 'tool-runWorker') {\n return 'ri:flow-chart'\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return 'ri:chat-history-line'\n }\n if (part.type.includes('tool-mcp')) {\n return 'octicon:mcp-16'\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return 'ri:file-edit-line'\n }\n if (part.type === 'tool-searchInKnowledgeBase') {\n return 'ri:search-line'\n }\n if (part.type === 'tool-expandChunkContext') {\n return 'ri:file-search-line'\n }\n if (part.type === 'tool-readDocumentFile') {\n return 'ri:file-text-line'\n }\n if (part.type === 'tool-geocode') {\n return 'ri:map-2-line'\n }\n if (part.type === 'tool-getWeather') {\n return 'ri:sun-cloudy-line'\n }\n if (part.type === 'tool-recallUserMemory') {\n return 'ri:brain-line'\n }\n if (part.type === 'tool-saveUserMemory') {\n return 'ri:save-3-line'\n }\n if (part.type === 'tool-showWeather') {\n return 'ri:sun-line'\n }\n if (part.type === 'tool-showDiagram') {\n return 'ri:flow-chart'\n }\n if (part.type === 'tool-showSources') {\n return 'ri:book-2-line'\n }\n if (part.type === 'tool-showForm') {\n return 'ri:survey-line'\n }\n if (part.type === 'tool-showMultipleChoice') {\n return 'ri:checkbox-multiple-line'\n }\n if (part.type === 'tool-showArtifact') {\n return 'ri:file-code-line'\n }\n if (part.type === 'tool-showEmail') {\n return 'ri:mail-line'\n }\n if (part.type === 'tool-showMessage') {\n return 'ri:chat-1-line'\n }\n if (part.type === 'tool-showWebPages') {\n return 'ri:pages-line'\n }\n if (part.type === 'tool-showProductList') {\n return 'ri:shopping-bag-line'\n }\n if (part.type === 'tool-showContactForm') {\n return 'ri:send-plane-2-line'\n }\n if (part.type === 'tool-showCalendarEvent') {\n return 'ri:calendar-event-line'\n }\n if (part.type === 'tool-showComparison') {\n return 'ri:scales-line'\n }\n if (part.type === 'tool-showLocation') {\n return 'ri:map-pin-line'\n }\n if (part.type === 'tool-showQrCode') {\n return 'ri:qr-code-line'\n }\n if (part.type === 'tool-showImageGallery') {\n return 'ri:image-line'\n }\n if (part.type === 'tool-showVideo') {\n return 'ri:film-line'\n }\n if (part.type === 'tool-showSuggestedReply') {\n return 'ri:corner-down-right-line'\n }\n if (part.type === 'tool-requestGeolocation') {\n return 'ri:map-pin-user-line'\n }\n if (\n part.type === 'tool-perplexity_search' ||\n part.type === 'tool-parallel_search' ||\n part.type === 'tool-web_search' ||\n part.type === 'tool-google_search'\n ) {\n return 'ri:global-line'\n }\n return 'ri:tools-line'\n }\n if (isReasoningPart(part)) {\n return 'ri:lightbulb-line'\n }\n if (isTextPart(part)) {\n return 'ri:double-quotes-r'\n }\n return undefined\n}\n\n// Get part label\nexport function getToolPartLabel(\n $t: (key: string) => string,\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (isToolPart(part)) {\n if (part.type.includes('tool-subagent')) {\n return $t(`messagePart.runSubagent`)\n }\n if (part.type === 'tool-runWorker') {\n return $t(`messagePart.runWorker`)\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return $t(`messagePart.fetchTeamsChannelHistory`)\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return $t(`messagePart.revisedAnswers`)\n }\n if (part.type === 'tool-searchInKnowledgeBase') {\n return $t(`messagePart.searchingDocuments`)\n }\n if (part.type === 'tool-expandChunkContext') {\n return $t(`messagePart.expandChunkContext`)\n }\n if (part.type === 'tool-readDocumentFile') {\n return $t(`messagePart.readDocumentFile`)\n }\n if (part.type === 'tool-geocode') {\n return $t(`messagePart.geocode`)\n }\n if (part.type === 'tool-getWeather') {\n return $t(`messagePart.getWeather`)\n }\n if (part.type === 'tool-recallUserMemory') {\n return $t(`messagePart.recallUserMemory`)\n }\n if (part.type === 'tool-saveUserMemory') {\n return $t(`messagePart.saveUserMemory`)\n }\n if (part.type === 'tool-showWeather') {\n return $t(`messagePart.showWeather`)\n }\n if (part.type === 'tool-showForm') {\n return $t(`messagePart.showForm`)\n }\n if (part.type === 'tool-showDiagram') {\n return $t(`messagePart.showDiagram`)\n }\n if (part.type === 'tool-showSources') {\n return $t(`messagePart.showSources`)\n }\n if (part.type === 'tool-showMultipleChoice') {\n return $t(`messagePart.showMultipleChoice`)\n }\n if (part.type === 'tool-showArtifact') {\n return $t(`messagePart.showArtifact`)\n }\n if (part.type === 'tool-showEmail') {\n return $t(`messagePart.showEmail`)\n }\n if (part.type === 'tool-showMessage') {\n return $t(`messagePart.showMessage`)\n }\n if (part.type === 'tool-showWebPages') {\n return $t(`messagePart.showWebPages`)\n }\n if (part.type === 'tool-showProducts') {\n return $t(`messagePart.showProducts`)\n }\n if (part.type === 'tool-showContactForm') {\n return $t(`messagePart.showContactForm`)\n }\n if (part.type === 'tool-showCalendarEvent') {\n return $t(`messagePart.showCalendarEvent`)\n }\n if (part.type === 'tool-showComparison') {\n return $t(`messagePart.showComparison`)\n }\n if (part.type === 'tool-showLocation') {\n return $t(`messagePart.showLocation`)\n }\n if (part.type === 'tool-showQrCode') {\n return $t(`messagePart.showQrCode`)\n }\n if (part.type === 'tool-showImageGallery') {\n return $t(`messagePart.showImageGallery`)\n }\n if (part.type === 'tool-showVideo') {\n return $t(`messagePart.showVideo`)\n }\n if (part.type === 'tool-showSuggestedReply') {\n return $t(`messagePart.showSuggestedReply`)\n }\n if (part.type === 'tool-requestGeolocation') {\n return $t(`messagePart.requestGeolocation`)\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(part.type)) {\n return $t(`messagePart.webSearch`)\n }\n return $t(`messagePart.tool`)\n }\n if (isReasoningPart(part)) {\n return $t(`messagePart.reasoning`)\n }\n return $t(`messagePart.streaming`)\n}\n"],"mappings":";;;AA4BA,SAAgB,EACZ,GACkB;CAClB,IAAM,IAA6B,CAAC;CACpC,KAAK,IAAM,KAAQ,GAAO;EACtB,IAAI,CAAC,EAAW,CAAI,GAAG;GACnB,EAAO,KAAK,CAAI;GAChB;EACJ;EACA,IAAM,IAAO,EAAO,EAAO,SAAS;EACpC,AAAI,KAAQ,EAAW,CAAI,IACvB,EAAO,EAAO,SAAS,KAAK;GAAE,GAAG;GAAM,MAAM,EAAK,OAAO,EAAK;EAAK,IAEnE,EAAO,KAAK,CAAI;CAExB;CACA,OAAO;AACX;AAEA,SAAgB,EACZ,GACoE;CAKpE,OAJK,KACD,WAAW,IACJ,EAAK,UAAU,eAAe,EAAK,UAAU,oBAEjD;AACX;AAOA,IAAM,oBAAuB,IAAI,IAAI;CACjC;CACA;CACA;AACJ,CAAC;AAED,SAAgB,EACZ,GACO;CAWP,OAVK,EAAW,CAAI,IAGhB,EAAqB,IAAI,EAAK,KAAK,IAC5B,KAMH,EAAgC,YAAY,OATzC;AAUf;AAQA,IAAa,IAAoB;AAEjC,SAAgB,EACZ,GACO;CACP,OAAO,EAAW,CAAI,KAAK,EAAK,SAAS;AAC7C;AAGA,SAAgB,EACZ,GACO;CACP,OAAO,EAAmB,CAAI,KAAK,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SAAS,oBACP,EAAG,wBAAwB,IAElC,EAAK,SAAS,0BACP,EAAG,8BAA8B,IAExC,EAAK,SAAS,mBACP,EAAG,uBAAuB,IAEjC,EAAK,SAAS,4BACP,EAAG,gCAAgC,IAE1C,EAAK,SAAS,4BACP,EAAG,gCAAgC,IAE1C,EAAsB,SAAS,EAAK,IAAI,IACjC,EAAG,uBAAuB,IAE9B,EAAG,kBAAkB,IAE5B,EAAgB,CAAI,IACb,EAAG,uBAAuB,IAE9B,EAAG,uBAAuB;AACrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/BaseConnection.js
|
|
2
2
|
var e = class {
|
|
3
3
|
queue = [];
|
|
4
4
|
outgoingQueue = [];
|
|
@@ -62,7 +62,7 @@ function t(e) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
65
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/assert.js
|
|
66
66
|
function n(e) {
|
|
67
67
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
68
68
|
}
|
|
@@ -70,7 +70,7 @@ function r(e, t = "Expected a JSON object") {
|
|
|
70
70
|
if (!n(e)) throw Error(t);
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
73
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/errors.js
|
|
74
74
|
async function i(e) {
|
|
75
75
|
try {
|
|
76
76
|
let t = await e.json();
|
|
@@ -90,10 +90,10 @@ var a = class extends Error {
|
|
|
90
90
|
}
|
|
91
91
|
}, o = Object.freeze({
|
|
92
92
|
name: "js_sdk",
|
|
93
|
-
version: "1.
|
|
93
|
+
version: "1.24.0"
|
|
94
94
|
});
|
|
95
95
|
//#endregion
|
|
96
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
96
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/events.js
|
|
97
97
|
function s(e) {
|
|
98
98
|
return !!e.type;
|
|
99
99
|
}
|
|
@@ -18412,7 +18412,7 @@ g(Q, "code", "ERR_JOSE_GENERIC"), g(class extends Q {
|
|
|
18412
18412
|
}
|
|
18413
18413
|
}, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
|
|
18414
18414
|
//#endregion
|
|
18415
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18415
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/overrides.js
|
|
18416
18416
|
var bp = "conversation_initiation_client_data";
|
|
18417
18417
|
function xp(e) {
|
|
18418
18418
|
let t = { type: bp };
|
|
@@ -18440,7 +18440,7 @@ function xp(e) {
|
|
|
18440
18440
|
}), t;
|
|
18441
18441
|
}
|
|
18442
18442
|
//#endregion
|
|
18443
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18443
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/audio.js
|
|
18444
18444
|
function Sp(e) {
|
|
18445
18445
|
let t = new Uint8Array(e);
|
|
18446
18446
|
return btoa(String.fromCharCode(...t));
|
|
@@ -18451,7 +18451,7 @@ function Cp(e) {
|
|
|
18451
18451
|
return r.buffer;
|
|
18452
18452
|
}
|
|
18453
18453
|
//#endregion
|
|
18454
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18454
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/volumeProvider.js
|
|
18455
18455
|
var wp = {
|
|
18456
18456
|
getVolume: () => 0,
|
|
18457
18457
|
getByteFrequencyData: () => {}
|
|
@@ -18464,7 +18464,7 @@ function Ep(e, t, n) {
|
|
|
18464
18464
|
}
|
|
18465
18465
|
}
|
|
18466
18466
|
//#endregion
|
|
18467
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18467
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/WebRTCAudioAdapter.js
|
|
18468
18468
|
var Dp;
|
|
18469
18469
|
function Op(e) {
|
|
18470
18470
|
Dp = e;
|
|
@@ -18473,7 +18473,7 @@ function kp() {
|
|
|
18473
18473
|
return Dp?.() ?? null;
|
|
18474
18474
|
}
|
|
18475
18475
|
//#endregion
|
|
18476
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18476
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/WebRTCConnection.js
|
|
18477
18477
|
var Ap = "wss://livekit.rtc.elevenlabs.io", jp = "https://api.elevenlabs.io", Mp = .01;
|
|
18478
18478
|
function Np(e) {
|
|
18479
18479
|
return e.replace(/^wss:\/\//, "https://");
|
|
@@ -18575,31 +18575,31 @@ var Pp = class r extends e {
|
|
|
18575
18575
|
throw t instanceof Error && t.message.includes("401") && (n = "Your agent has authentication enabled, but no signed URL or conversation token was provided."), Error(`Failed to fetch conversation token for agent ${e.agentId}: ${n}`);
|
|
18576
18576
|
}
|
|
18577
18577
|
else throw Error("Either conversationToken or agentId is required for WebRTC connection");
|
|
18578
|
-
let s = new _p();
|
|
18578
|
+
let s = e.webRtc?.singlePeerConnection, c = new _p(s === void 0 ? void 0 : { singlePeerConnection: s });
|
|
18579
18579
|
try {
|
|
18580
|
-
let n = `room_${Date.now()}`, i = t("pcm_48000"), o = t("pcm_48000"),
|
|
18581
|
-
|
|
18582
|
-
|
|
18580
|
+
let n = `room_${Date.now()}`, i = t("pcm_48000"), o = t("pcm_48000"), s = new r(c, n, i, o, e), l = e.livekitUrl || Ap, u = e.textOnly ? Promise.resolve() : new Promise((t, n) => {
|
|
18581
|
+
c.once(F.SignalConnected, () => {
|
|
18582
|
+
s.enableMicrophone(e.inputDeviceId).then(() => t()).catch(n);
|
|
18583
18583
|
});
|
|
18584
18584
|
}), d = e.webRtc?.iceTransportPolicy;
|
|
18585
|
-
await
|
|
18586
|
-
if (
|
|
18585
|
+
await c.connect(l, a, { rtcConfig: d ? { iceTransportPolicy: d } : void 0 }), await new Promise((e) => {
|
|
18586
|
+
if (s.isConnected) e();
|
|
18587
18587
|
else {
|
|
18588
18588
|
let t = () => {
|
|
18589
|
-
|
|
18589
|
+
c.off(F.Connected, t), e();
|
|
18590
18590
|
};
|
|
18591
|
-
|
|
18591
|
+
c.on(F.Connected, t);
|
|
18592
18592
|
}
|
|
18593
18593
|
}), await u;
|
|
18594
|
-
let f =
|
|
18595
|
-
f &&
|
|
18594
|
+
let f = c.localParticipant.getTrackPublication(V.Source.Microphone)?.track;
|
|
18595
|
+
f && s.setupInputAnalyser(f.mediaStreamTrack), c.name && (s.conversationId = c.name.match(/(conv_[a-zA-Z0-9]+)/)?.[0] || c.name);
|
|
18596
18596
|
let p = xp(e);
|
|
18597
|
-
return
|
|
18597
|
+
return s.debug({
|
|
18598
18598
|
type: bp,
|
|
18599
18599
|
message: p
|
|
18600
|
-
}), await
|
|
18600
|
+
}), await s.sendRequiredMessage(p), s;
|
|
18601
18601
|
} catch (e) {
|
|
18602
|
-
throw await
|
|
18602
|
+
throw await c.disconnect(), e;
|
|
18603
18603
|
}
|
|
18604
18604
|
}
|
|
18605
18605
|
setupRoomEventListeners() {
|
|
@@ -18782,7 +18782,7 @@ function Ip(e) {
|
|
|
18782
18782
|
return /* @__PURE__ */ Error(`No ${e} registered. ${Fp}`);
|
|
18783
18783
|
}
|
|
18784
18784
|
//#endregion
|
|
18785
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18785
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/VoiceSessionSetup.js
|
|
18786
18786
|
var Lp;
|
|
18787
18787
|
function Rp(e) {
|
|
18788
18788
|
Lp = e;
|
|
@@ -18802,7 +18802,7 @@ function Bp(e) {
|
|
|
18802
18802
|
};
|
|
18803
18803
|
}
|
|
18804
18804
|
//#endregion
|
|
18805
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18805
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/createWorkletModuleLoader.js
|
|
18806
18806
|
var Vp = /* @__PURE__ */ new Map();
|
|
18807
18807
|
function Hp(e, t) {
|
|
18808
18808
|
return t ? `${e} ${t}` : e;
|
|
@@ -18833,14 +18833,14 @@ function Up(e, t) {
|
|
|
18833
18833
|
};
|
|
18834
18834
|
}
|
|
18835
18835
|
//#endregion
|
|
18836
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18836
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/audioConcatProcessor.generated.js
|
|
18837
18837
|
var Wp = Up("audioConcatProcessor", "/*\n * ulaw decoding logic taken from the wavefile library\n * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js\n * USED BY @elevenlabs/client\n */\n\nconst decodeTable = [0, 132, 396, 924, 1980, 4092, 8316, 16764];\n\nfunction decodeSample(muLawSample) {\n let sign;\n let exponent;\n let mantissa;\n let sample;\n muLawSample = ~muLawSample;\n sign = muLawSample & 0x80;\n exponent = (muLawSample >> 4) & 0x07;\n mantissa = muLawSample & 0x0f;\n sample = decodeTable[exponent] + (mantissa << (exponent + 3));\n if (sign !== 0) sample = -sample;\n\n return sample;\n}\n\nclass AudioConcatProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffers = []; // Initialize an empty buffer\n this.cursor = 0;\n this.currentBuffer = null;\n this.wasInterrupted = false;\n this.finished = false;\n\n this.port.onmessage = ({ data }) => {\n switch (data.type) {\n case \"setFormat\":\n this.format = data.format;\n if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) {\n globalThis.LibSampleRate.create(\n 1,\n data.sampleRate,\n sampleRate\n ).then(resampler => {\n this.resampler = resampler;\n });\n }\n break;\n case \"buffer\":\n this.wasInterrupted = false;\n this.buffers.push(\n this.format === \"ulaw\"\n ? new Uint8Array(data.buffer)\n : new Int16Array(data.buffer)\n );\n break;\n case \"interrupt\":\n this.wasInterrupted = true;\n break;\n case \"clearInterrupted\":\n if (this.wasInterrupted) {\n this.wasInterrupted = false;\n this.buffers = [];\n this.currentBuffer = null;\n }\n }\n };\n }\n process(_, outputs) {\n let finished = false;\n const output = outputs[0][0];\n for (let i = 0; i < output.length; i++) {\n if (!this.currentBuffer) {\n if (this.buffers.length === 0) {\n finished = true;\n break;\n }\n this.currentBuffer = this.buffers.shift();\n if (this.resampler) {\n this.currentBuffer = this.resampler.full(this.currentBuffer);\n }\n this.cursor = 0;\n }\n\n let value = this.currentBuffer[this.cursor];\n if (this.format === \"ulaw\") {\n value = decodeSample(value);\n }\n output[i] = value / 32768;\n this.cursor++;\n\n if (this.cursor >= this.currentBuffer.length) {\n this.currentBuffer = null;\n }\n }\n\n if (this.finished !== finished) {\n this.finished = finished;\n this.port.postMessage({ type: \"process\", finished });\n }\n\n return true; // Continue processing\n }\n}\n\nregisterProcessor(\"audioConcatProcessor\", AudioConcatProcessor);\n"), Gp = "https://cdn.jsdelivr.net/npm/@alexanderolsen/libsamplerate-js@2.1.2/dist/libsamplerate.worklet.js";
|
|
18838
18838
|
async function Kp(e, t) {
|
|
18839
18839
|
let n = t || Gp;
|
|
18840
18840
|
await e.audioWorklet.addModule(n);
|
|
18841
18841
|
}
|
|
18842
18842
|
//#endregion
|
|
18843
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18843
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/calculateVolume.js
|
|
18844
18844
|
function qp(e) {
|
|
18845
18845
|
if (e.length === 0) return 0;
|
|
18846
18846
|
let t = 0;
|
|
@@ -18848,7 +18848,7 @@ function qp(e) {
|
|
|
18848
18848
|
return t /= e.length, t < 0 ? 0 : t > 1 ? 1 : t;
|
|
18849
18849
|
}
|
|
18850
18850
|
//#endregion
|
|
18851
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18851
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/volumeProvider.js
|
|
18852
18852
|
function Jp(e, t) {
|
|
18853
18853
|
let n = e.frequencyBinCount, r, i;
|
|
18854
18854
|
return {
|
|
@@ -18861,7 +18861,7 @@ function Jp(e, t) {
|
|
|
18861
18861
|
};
|
|
18862
18862
|
}
|
|
18863
18863
|
//#endregion
|
|
18864
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18864
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/compatibility.js
|
|
18865
18865
|
function Yp() {
|
|
18866
18866
|
return [
|
|
18867
18867
|
"iPad Simulator",
|
|
@@ -18876,7 +18876,7 @@ function Xp() {
|
|
|
18876
18876
|
return /android/i.test(navigator.userAgent);
|
|
18877
18877
|
}
|
|
18878
18878
|
//#endregion
|
|
18879
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
18879
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/output.js
|
|
18880
18880
|
function Zp({ sampleRate: e, format: t, worklet: n, audioElement: r }) {
|
|
18881
18881
|
if (!Yp()) return;
|
|
18882
18882
|
let i = Math.floor(e * 100 / 1e3), a = t === "ulaw" ? new Uint8Array(i).fill(255) : new Int16Array(i);
|
|
@@ -19100,7 +19100,7 @@ function am(e) {
|
|
|
19100
19100
|
return e.bedrockInferenceProfile !== void 0 && (t.bedrock_inference_profile = e.bedrockInferenceProfile), e.postCallTranscriptionWebhook && (t.post_call_transcription_webhook = im(e.postCallTranscriptionWebhook)), e.postCallAudioWebhook && (t.post_call_audio_webhook = im(e.postCallAudioWebhook)), t;
|
|
19101
19101
|
}
|
|
19102
19102
|
//#endregion
|
|
19103
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19103
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/WebSocketConnection.js
|
|
19104
19104
|
var om = "convai", sm = "wss://api.elevenlabs.io", cm = "/v1/convai/conversation?agent_id=", lm = class n extends e {
|
|
19105
19105
|
socket;
|
|
19106
19106
|
conversationId;
|
|
@@ -19219,7 +19219,7 @@ var om = "convai", sm = "wss://api.elevenlabs.io", cm = "/v1/convai/conversation
|
|
|
19219
19219
|
}
|
|
19220
19220
|
};
|
|
19221
19221
|
//#endregion
|
|
19222
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19222
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/attachInputToConnection.js
|
|
19223
19223
|
function um(e, t) {
|
|
19224
19224
|
let n = (e) => {
|
|
19225
19225
|
let n = e.data[0];
|
|
@@ -19230,7 +19230,7 @@ function um(e, t) {
|
|
|
19230
19230
|
};
|
|
19231
19231
|
}
|
|
19232
19232
|
//#endregion
|
|
19233
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19233
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/attachConnectionToOutput.js
|
|
19234
19234
|
function dm(e, t) {
|
|
19235
19235
|
let n = (e) => {
|
|
19236
19236
|
t.playAudio(Cp(e.audio_base_64));
|
|
@@ -19240,7 +19240,7 @@ function dm(e, t) {
|
|
|
19240
19240
|
};
|
|
19241
19241
|
}
|
|
19242
19242
|
//#endregion
|
|
19243
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19243
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/ConnectionFactory.js
|
|
19244
19244
|
function fm(e) {
|
|
19245
19245
|
let t = "signedUrl" in e && e.signedUrl, n = "orchestrator" in e && e.orchestrator;
|
|
19246
19246
|
if (t && e.connectionType === "webrtc") throw Error("signedUrl only supports websocket connections. Remove connectionType or set it to 'websocket'.");
|
|
@@ -19257,7 +19257,7 @@ async function pm(e) {
|
|
|
19257
19257
|
}
|
|
19258
19258
|
}
|
|
19259
19259
|
//#endregion
|
|
19260
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19260
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/utils/applyDelay.js
|
|
19261
19261
|
var mm = {
|
|
19262
19262
|
default: 0,
|
|
19263
19263
|
android: 3e3
|
|
@@ -19270,7 +19270,7 @@ async function gm(e) {
|
|
|
19270
19270
|
e > 0 && await new Promise((t) => setTimeout(t, e));
|
|
19271
19271
|
}
|
|
19272
19272
|
//#endregion
|
|
19273
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19273
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/audioUnlock.js
|
|
19274
19274
|
var _m = 3e4, vm = [
|
|
19275
19275
|
"touchstart",
|
|
19276
19276
|
"touchend",
|
|
@@ -19309,7 +19309,7 @@ function Om() {
|
|
|
19309
19309
|
ym && (ym.close().catch(() => {}), ym = null, wm());
|
|
19310
19310
|
}
|
|
19311
19311
|
//#endregion
|
|
19312
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19312
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/VoiceSessionSetup.js
|
|
19313
19313
|
function km() {
|
|
19314
19314
|
return Xp() ? "android" : Yp() ? "ios" : "default";
|
|
19315
19315
|
}
|
|
@@ -19387,7 +19387,7 @@ async function Mm(e) {
|
|
|
19387
19387
|
}
|
|
19388
19388
|
Rp(Mm);
|
|
19389
19389
|
//#endregion
|
|
19390
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19390
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/webAudioAdapter.js
|
|
19391
19391
|
var Nm = class {
|
|
19392
19392
|
audioElements = [];
|
|
19393
19393
|
inputAudioContext = null;
|
|
@@ -19461,7 +19461,7 @@ function Im() {
|
|
|
19461
19461
|
return Pm;
|
|
19462
19462
|
}
|
|
19463
19463
|
//#endregion
|
|
19464
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19464
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/platform/web/scribeAudioProcessor.generated.js
|
|
19465
19465
|
var Lm = Up("scribeAudioProcessor", "/*\n * Scribe Audio Processor for converting microphone audio to PCM16 format\n * Supports resampling for browsers like Firefox that don't support\n * AudioContext sample rate constraints.\n * USED BY @elevenlabs/client\n */\n\nclass ScribeAudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffer = [];\n this.bufferSize = 4096; // Buffer size for optimal chunk transmission\n\n // Resampling state\n this.inputSampleRate = null;\n this.outputSampleRate = null;\n this.resampleRatio = 1;\n this.lastSample = 0;\n this.resampleAccumulator = 0;\n\n this.port.onmessage = ({ data }) => {\n if (data.type === \"configure\") {\n this.inputSampleRate = data.inputSampleRate;\n this.outputSampleRate = data.outputSampleRate;\n if (this.inputSampleRate && this.outputSampleRate) {\n this.resampleRatio = this.inputSampleRate / this.outputSampleRate;\n }\n }\n };\n }\n\n // Linear interpolation resampling\n resample(inputData) {\n if (this.resampleRatio === 1 || !this.inputSampleRate) {\n return inputData;\n }\n\n const outputSamples = [];\n\n for (let i = 0; i < inputData.length; i++) {\n const currentSample = inputData[i];\n\n // Generate output samples using linear interpolation\n while (this.resampleAccumulator < 1) {\n const interpolated =\n this.lastSample +\n (currentSample - this.lastSample) * this.resampleAccumulator;\n outputSamples.push(interpolated);\n this.resampleAccumulator += this.resampleRatio;\n }\n\n this.resampleAccumulator -= 1;\n this.lastSample = currentSample;\n }\n\n return new Float32Array(outputSamples);\n }\n\n process(inputs) {\n const input = inputs[0];\n if (input.length > 0) {\n let channelData = input[0]; // Get first channel (mono)\n\n // Resample if needed (for Firefox and other browsers that don't\n // support AudioContext sample rate constraints)\n if (this.resampleRatio !== 1) {\n channelData = this.resample(channelData);\n }\n\n // Add incoming audio to buffer\n for (let i = 0; i < channelData.length; i++) {\n this.buffer.push(channelData[i]);\n }\n\n // When buffer reaches threshold, convert and send\n if (this.buffer.length >= this.bufferSize) {\n const float32Array = new Float32Array(this.buffer);\n const int16Array = new Int16Array(float32Array.length);\n\n // Convert Float32 [-1, 1] to Int16 [-32768, 32767]\n for (let i = 0; i < float32Array.length; i++) {\n // Clamp the value to prevent overflow\n const sample = Math.max(-1, Math.min(1, float32Array[i]));\n // Scale to PCM16 range\n int16Array[i] = sample < 0 ? sample * 32768 : sample * 32767;\n }\n\n // Send to main thread as transferable ArrayBuffer\n this.port.postMessage(\n {\n audioData: int16Array.buffer\n },\n [int16Array.buffer]\n );\n\n // Clear buffer\n this.buffer = [];\n }\n }\n\n return true; // Continue processing\n }\n}\n\nregisterProcessor(\"scribeAudioProcessor\", ScribeAudioProcessor);\n\n"), Rm = 16e3, zm = async (e, t) => {
|
|
19466
19466
|
let n, r, i, a, o = () => {
|
|
19467
19467
|
for (let e of n?.getTracks() ?? []) e.stop();
|
|
@@ -19509,7 +19509,7 @@ async function Vm({ conversationId: e, origin: t, file: n, filename: a }) {
|
|
|
19509
19509
|
return { fileId: d };
|
|
19510
19510
|
}
|
|
19511
19511
|
//#endregion
|
|
19512
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19512
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/BaseConversation.js
|
|
19513
19513
|
var Hm = {
|
|
19514
19514
|
reason: "agent",
|
|
19515
19515
|
context: {
|
|
@@ -19603,7 +19603,8 @@ var Wm = class {
|
|
|
19603
19603
|
source: "ai",
|
|
19604
19604
|
role: "agent",
|
|
19605
19605
|
message: e.agent_response_event.agent_response,
|
|
19606
|
-
event_id: e.agent_response_event.event_id
|
|
19606
|
+
event_id: e.agent_response_event.event_id,
|
|
19607
|
+
attachments: e.agent_response_event.attachments
|
|
19607
19608
|
});
|
|
19608
19609
|
}
|
|
19609
19610
|
handleAgentResponseCorrection(e) {
|
|
@@ -19949,7 +19950,7 @@ var Wm = class {
|
|
|
19949
19950
|
}
|
|
19950
19951
|
};
|
|
19951
19952
|
//#endregion
|
|
19952
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19953
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/runtime.js
|
|
19953
19954
|
function Gm() {
|
|
19954
19955
|
for (let e of [
|
|
19955
19956
|
"fetch",
|
|
@@ -19962,7 +19963,7 @@ function Gm() {
|
|
|
19962
19963
|
]) if (globalThis[e] === void 0) throw Error(`${e} is not available in this environment.`);
|
|
19963
19964
|
}
|
|
19964
19965
|
//#endregion
|
|
19965
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
19966
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/TextConversation.js
|
|
19966
19967
|
var Km = /* @__PURE__ */ new Uint8Array(), qm = class e extends Wm {
|
|
19967
19968
|
type = "text";
|
|
19968
19969
|
setVolume() {
|
|
@@ -20081,7 +20082,7 @@ function Xm(e, t, n = Ym) {
|
|
|
20081
20082
|
});
|
|
20082
20083
|
}
|
|
20083
20084
|
//#endregion
|
|
20084
|
-
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.
|
|
20085
|
+
//#region ../../node_modules/.pnpm/@elevenlabs+client@1.24.0_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/scribe/connection.js
|
|
20085
20086
|
var Zm = class {
|
|
20086
20087
|
listeners = /* @__PURE__ */ new Map();
|
|
20087
20088
|
on(e, t) {
|
|
@@ -20320,4 +20321,4 @@ Em(), Op(() => new Nm()), Fm(zm);
|
|
|
20320
20321
|
//#endregion
|
|
20321
20322
|
export { eh as AudioFormat, th as CommitStrategy, rh as Conversation, em as DEFAULT_INPUT_CHUNK_DURATION_MS, $m as RealtimeConnection, $ as RealtimeEvents, nh as Scribe, a as SessionConnectionError, qm as TextConversation, Jm as VoiceConversation, Pp as WebRTCConnection, lm as WebSocketConnection, pm as createConnection, Xm as postOverallFeedback };
|
|
20322
20323
|
|
|
20323
|
-
//# sourceMappingURL=web-
|
|
20324
|
+
//# sourceMappingURL=web-CzR5jWfC.js.map
|