@pagelines/sdk 1.0.877 → 1.0.878
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/AgentWrap.js +34 -16
- package/dist/AgentWrap.js.map +1 -1
- package/dist/agent/AgentController.d.ts +1 -0
- package/dist/agent/voice/providers/livekit/provider.d.ts +4 -3
- package/dist/agent/voice/voice-session-client.d.ts +1 -0
- package/dist/agent.js +7 -5
- package/dist/agent.js.map +1 -1
- package/dist/provider2.js +15 -23
- package/dist/provider2.js.map +1 -1
- package/dist/sdk.css +1 -1
- package/package.json +1 -1
package/dist/AgentWrap.js
CHANGED
|
@@ -765,7 +765,15 @@ Current User:
|
|
|
765
765
|
transientIssue: void 0,
|
|
766
766
|
turnOutcome: void 0
|
|
767
767
|
}));
|
|
768
|
-
let u = `stream-${Date.now()}-${c}`, p = !1, m = !1, isCurrentTurn = () => s === this.turnEpoch && !this.suppressedStreamTokens.has(c),
|
|
768
|
+
let u = `stream-${Date.now()}-${c}`, p = !1, m = !1, isCurrentTurn = () => s === this.turnEpoch && !this.suppressedStreamTokens.has(c), onUserMessage = (e) => {
|
|
769
|
+
if (s !== this.turnEpoch || !o) return;
|
|
770
|
+
let t = this.sharedMessages.value;
|
|
771
|
+
if (this.sharedMessages.value = t.some((t) => t.id === e.id) ? t.filter((t) => t.id !== o || t.id === e.id) : t.map((t) => t.id === o ? e : t), this.queuedMessageIdSet.value.has(o)) {
|
|
772
|
+
let t = new Set(this.queuedMessageIdSet.value);
|
|
773
|
+
t.delete(o), t.add(e.id), this.queuedMessageIdSet.value = t;
|
|
774
|
+
}
|
|
775
|
+
o = e.id;
|
|
776
|
+
}, claimLiveTurn = () => {
|
|
769
777
|
this.runningStreamToken !== c && (this.runningStreamToken = c, this.consumeQueuedThrough(o), this.resetWorkJournalTiming(), this.updateState(this.textState, {
|
|
770
778
|
isThinking: !0,
|
|
771
779
|
workingDescription: void 0,
|
|
@@ -809,17 +817,12 @@ Current User:
|
|
|
809
817
|
toolActivities: [],
|
|
810
818
|
turnOutcome: void 0
|
|
811
819
|
});
|
|
812
|
-
let i = this.sharedMessages.value, a = i.findIndex((e) => e.id === r.id);
|
|
813
|
-
|
|
820
|
+
let i = this.sharedMessages.value.filter((e) => e.id !== u), a = i.findIndex((e) => e.id === r.id);
|
|
821
|
+
a >= 0 ? this.sharedMessages.value = [
|
|
814
822
|
...i.slice(0, a),
|
|
815
823
|
r,
|
|
816
824
|
...i.slice(a + 1)
|
|
817
|
-
];
|
|
818
|
-
else {
|
|
819
|
-
let e = i[i.length - 1];
|
|
820
|
-
this.sharedMessages.value = e?.id === u ? [...i.slice(0, -1), r] : [...i, r];
|
|
821
|
-
}
|
|
822
|
-
r.sender === "system" && r.issue?.bucket === "account" ? this.updateState(this.textState, { sendBlockedReason: "account" }) : r.sender === "system" && r.issue?.code && De.has(r.issue.code) && this.updateState(this.textState, { sendBlockedReason: "agent_deleted" });
|
|
825
|
+
] : this.sharedMessages.value = [...i, r], r.sender === "system" && r.issue?.bucket === "account" ? this.updateState(this.textState, { sendBlockedReason: "account" }) : r.sender === "system" && r.issue?.code && De.has(r.issue.code) && this.updateState(this.textState, { sendBlockedReason: "agent_deleted" });
|
|
823
826
|
}, onDone = (e) => {
|
|
824
827
|
if (!isCurrentTurn()) return;
|
|
825
828
|
if (!p && !m) {
|
|
@@ -894,6 +897,7 @@ Current User:
|
|
|
894
897
|
history: this.buildHistory(),
|
|
895
898
|
onDelta,
|
|
896
899
|
onMessage,
|
|
900
|
+
onUserMessage,
|
|
897
901
|
onDone,
|
|
898
902
|
onError,
|
|
899
903
|
onStatus,
|
|
@@ -915,6 +919,8 @@ Current User:
|
|
|
915
919
|
}));
|
|
916
920
|
} catch (e) {
|
|
917
921
|
onError(e.message || "Something went wrong");
|
|
922
|
+
} finally {
|
|
923
|
+
this.runningStreamToken === c && (this.runningStreamToken = void 0);
|
|
918
924
|
}
|
|
919
925
|
}
|
|
920
926
|
async stopChatTurn() {
|
|
@@ -944,13 +950,25 @@ Current User:
|
|
|
944
950
|
}
|
|
945
951
|
loadMessages(e) {
|
|
946
952
|
this.conversationId = e.conversationId;
|
|
947
|
-
let t = this.sharedMessages.value, n = e.messages.filter((e) => e.sender !== "agent" || !f(e.text)), r = new Set(n.map((e) => e.id));
|
|
948
|
-
this.sharedMessages.value = [
|
|
953
|
+
let t = this.sharedMessages.value, n = e.messages.filter((e) => e.sender !== "agent" || !f(e.text)), r = new Set(n.map((e) => e.id)), i = t.filter((e) => !r.has(e.id)), a = n[0]?.sequence, isBeforePage = (e) => !!a && !!e.sequence && e.sequence < a;
|
|
954
|
+
if (this.sharedMessages.value = [
|
|
955
|
+
...i.filter(isBeforePage),
|
|
956
|
+
...n,
|
|
957
|
+
...i.filter((e) => !isBeforePage(e))
|
|
958
|
+
], this.runningStreamToken !== void 0) return;
|
|
959
|
+
let o = new Set(this.sharedMessages.value.flatMap((e) => e.toolActivities?.map((e) => e.turnId) ?? [])), s = new Set(this.textState.value.turnOutcome === "stopped" ? this.textState.value.toolActivities?.map((e) => e.turnId) : []), c = (e.activeToolActivities ?? []).filter((e) => !o.has(e.turnId) && !s.has(e.turnId));
|
|
960
|
+
c.length ? (c.forEach((e) => this.rememberToolActivity(e)), this.updateState(this.textState, {
|
|
949
961
|
isThinking: !0,
|
|
950
962
|
workingDescription: void 0,
|
|
951
|
-
toolActivities:
|
|
952
|
-
transientIssue: void 0
|
|
953
|
-
|
|
963
|
+
toolActivities: c,
|
|
964
|
+
transientIssue: void 0,
|
|
965
|
+
turnOutcome: void 0
|
|
966
|
+
})) : this.textState.value.toolActivities?.some((e) => o.has(e.turnId)) && this.updateState(this.textState, {
|
|
967
|
+
isThinking: !1,
|
|
968
|
+
workingDescription: void 0,
|
|
969
|
+
toolActivities: [],
|
|
970
|
+
turnOutcome: void 0
|
|
971
|
+
});
|
|
954
972
|
}
|
|
955
973
|
async destroy() {
|
|
956
974
|
this.clearBoundaryTimer(), this.voiceRecorder.teardown(), await this.endConversation();
|
|
@@ -5152,7 +5170,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5152
5170
|
async function endVoiceConversation() {
|
|
5153
5171
|
if (!qe.value) return;
|
|
5154
5172
|
let t = Je.value;
|
|
5155
|
-
qe.value = !1, Ye.value = void 0, await A(), await
|
|
5173
|
+
qe.value = !1, Ye.value = void 0, await A(), await t?.end(), window.matchMedia("(pointer: coarse)").matches || i.value?.focus(), await e.chatController?.refreshMessages();
|
|
5156
5174
|
}
|
|
5157
5175
|
let J = v(() => e.variant === "light"), rt = v(() => J.value ? "bg-theme-200/70" : "bg-white/15"), it = v(() => J.value ? "text-theme-300" : "text-white/30");
|
|
5158
5176
|
ne(async () => {
|
|
@@ -5725,7 +5743,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5725
5743
|
], 64))], !0)], 10, wa)
|
|
5726
5744
|
], 2));
|
|
5727
5745
|
}
|
|
5728
|
-
}), [["__scopeId", "data-v-
|
|
5746
|
+
}), [["__scopeId", "data-v-74b8670b"]]), Ya = { class: "agent-wrap" }, Xa = {
|
|
5729
5747
|
key: 0,
|
|
5730
5748
|
class: "flex items-center justify-center h-full"
|
|
5731
5749
|
}, Za = {
|