@pagelines/sdk 1.0.789 → 1.0.790
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 +31 -5
- package/dist/AgentWrap.js.map +1 -1
- package/dist/agent/AgentController.d.ts +1 -0
- package/dist/contract.js +4 -4
- package/dist/contract.js.map +1 -1
- package/package.json +1 -1
package/dist/AgentWrap.js
CHANGED
|
@@ -424,7 +424,7 @@ var AgentChatController = class extends i {
|
|
|
424
424
|
super("AgentChatController", t), e(this, "isTextMode", !1), e(this, "lastMessage", {
|
|
425
425
|
hash: "",
|
|
426
426
|
time: 0
|
|
427
|
-
}), e(this, "isConnecting", !1), e(this, "turnEpoch", 0), e(this, "nextStreamToken", 0), e(this, "runningStreamToken", void 0), e(this, "suppressedStreamTokens", /* @__PURE__ */ new Set()), e(this, "queuedMessageIdSet", M(/* @__PURE__ */ new Set())), e(this, "queuedMessageIds", p(() => this.queuedMessageIdSet.value)), e(this, "boundaryTimer", void 0), e(this, "nowMs", ie(Date.now())), e(this, "toolActivityTiming", ie({})), e(this, "lastVisibleProgressAtMs", ie()), e(this, "liveSegments", ie([])), e(this, "liveStreamMessageId", ie(void 0)), e(this, "conversationId", void 0), e(this, "textState", M({
|
|
427
|
+
}), e(this, "isConnecting", !1), e(this, "turnEpoch", 0), e(this, "nextStreamToken", 0), e(this, "runningStreamToken", void 0), e(this, "suppressedStreamTokens", /* @__PURE__ */ new Set()), e(this, "pendingStartupSend", void 0), e(this, "queuedMessageIdSet", M(/* @__PURE__ */ new Set())), e(this, "queuedMessageIds", p(() => this.queuedMessageIdSet.value)), e(this, "boundaryTimer", void 0), e(this, "nowMs", ie(Date.now())), e(this, "toolActivityTiming", ie({})), e(this, "lastVisibleProgressAtMs", ie()), e(this, "liveSegments", ie([])), e(this, "liveStreamMessageId", ie(void 0)), e(this, "conversationId", void 0), e(this, "textState", M({
|
|
428
428
|
isActive: !1,
|
|
429
429
|
isConnected: !1,
|
|
430
430
|
isThinking: !1,
|
|
@@ -553,11 +553,20 @@ var AgentChatController = class extends i {
|
|
|
553
553
|
}
|
|
554
554
|
async sendComposerMessage() {
|
|
555
555
|
if (!this.canSend.value) return;
|
|
556
|
+
let e = this.composerState.value.text, t = this.composerState.value.pendingAttachments.length > 0 ? [...this.composerState.value.pendingAttachments] : void 0;
|
|
556
557
|
if (!this.chatEnabled) {
|
|
558
|
+
if (this._agent.state.value.lifecycle === "starting") {
|
|
559
|
+
if (this.pendingStartupSend) return;
|
|
560
|
+
this.composerState.value = {
|
|
561
|
+
...this.composerState.value,
|
|
562
|
+
text: "",
|
|
563
|
+
pendingAttachments: []
|
|
564
|
+
}, await this.sendChatMessage(e, t);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
557
567
|
this.addOfflineSystemReply();
|
|
558
568
|
return;
|
|
559
569
|
}
|
|
560
|
-
let e = this.composerState.value.text, t = this.composerState.value.pendingAttachments.length > 0 ? [...this.composerState.value.pendingAttachments] : void 0;
|
|
561
570
|
this.composerState.value = {
|
|
562
571
|
...this.composerState.value,
|
|
563
572
|
text: "",
|
|
@@ -680,7 +689,7 @@ Current User:
|
|
|
680
689
|
});
|
|
681
690
|
}
|
|
682
691
|
setupAvailabilityWatcher() {
|
|
683
|
-
se(() => this.chatEnabled, (e) => {
|
|
692
|
+
se(() => [this.chatEnabled, this._agent.state.value.lifecycle], ([e, t]) => {
|
|
684
693
|
if (!(!this.isTextMode || this.isConnecting)) {
|
|
685
694
|
if (e) {
|
|
686
695
|
this.textState.value.isConnected || this.updateState(this.textState, {
|
|
@@ -688,8 +697,18 @@ Current User:
|
|
|
688
697
|
connectionStatus: "connected",
|
|
689
698
|
error: void 0
|
|
690
699
|
});
|
|
700
|
+
let e = this.pendingStartupSend;
|
|
701
|
+
e && (this.pendingStartupSend = void 0, this.sendChatMessage(e.message, e.attachments));
|
|
691
702
|
return;
|
|
692
703
|
}
|
|
704
|
+
if (this.pendingStartupSend && t !== "starting") {
|
|
705
|
+
let e = this.pendingStartupSend;
|
|
706
|
+
this.pendingStartupSend = void 0, this.composerState.value.text || (this.composerState.value = {
|
|
707
|
+
...this.composerState.value,
|
|
708
|
+
text: e.message,
|
|
709
|
+
pendingAttachments: e.attachments ?? []
|
|
710
|
+
}), this.addOfflineSystemReply();
|
|
711
|
+
}
|
|
693
712
|
this.textState.value.isConnected && this.updateState(this.textState, {
|
|
694
713
|
isConnected: !1,
|
|
695
714
|
connectionStatus: "disconnected",
|
|
@@ -739,7 +758,7 @@ Current User:
|
|
|
739
758
|
}
|
|
740
759
|
}
|
|
741
760
|
async endConversation() {
|
|
742
|
-
if (this.turnEpoch += 1, this.runningStreamToken = void 0, this.suppressedStreamTokens.clear(), this.queuedMessageIdSet.value = /* @__PURE__ */ new Set(), !this.isTextMode) {
|
|
761
|
+
if (this.turnEpoch += 1, this.pendingStartupSend = void 0, this.runningStreamToken = void 0, this.suppressedStreamTokens.clear(), this.queuedMessageIdSet.value = /* @__PURE__ */ new Set(), !this.isTextMode) {
|
|
743
762
|
this.resetState();
|
|
744
763
|
return;
|
|
745
764
|
}
|
|
@@ -752,6 +771,13 @@ Current User:
|
|
|
752
771
|
async sendChatMessage(e, t) {
|
|
753
772
|
if (!this.isTextMode) return;
|
|
754
773
|
let { chatStreamFn: n } = this.settings;
|
|
774
|
+
if (!this.chatEnabled && this._agent.state.value.lifecycle === "starting") {
|
|
775
|
+
this.pendingStartupSend || (this.pendingStartupSend = {
|
|
776
|
+
message: e,
|
|
777
|
+
attachments: t
|
|
778
|
+
}, this.notify(`${this._agent.displayName.value || "Your assistant"} is starting. Your message will send when ready.`));
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
755
781
|
if (!this.chatEnabled) {
|
|
756
782
|
this.addOfflineSystemReply();
|
|
757
783
|
return;
|
|
@@ -4952,7 +4978,7 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
|
|
|
4952
4978
|
if (!c.value) return;
|
|
4953
4979
|
let e = B.value, t = e[e.length - 1];
|
|
4954
4980
|
return t?.sender === "agent" || t?.sender === "system" ? t.id : void 0;
|
|
4955
|
-
}), W = p(() => !c.value || H.value || he.value || F.value.length ? !1 : ye.value === void 0), be = p(() => H.value ?? (W.value ? "Thinking…" : void 0)), G = p(() => o.value?.sendBlockedReason), Se = p(() => G.value === "agent_deleted"), Ce = p(() => u.value ? `${e.agent.displayName.value || e.agent.name.value || "Assistant"} is offline` : S.value ? "Connecting..." : G.value === "agent_deleted" ? "This assistant was deleted" : `Message ${e.agent.displayName.value || e.agent.name.value || "assistant"}`), we = p(() => e.chatController?.composerState?.value ?? {
|
|
4981
|
+
}), W = p(() => !c.value || H.value || he.value || F.value.length ? !1 : ye.value === void 0), be = p(() => H.value ?? (W.value ? "Thinking…" : void 0)), G = p(() => o.value?.sendBlockedReason), Se = p(() => G.value === "agent_deleted"), Ce = p(() => e.agent.state.value.lifecycle === "starting" ? `Message ${e.agent.displayName.value || e.agent.name.value || "assistant"} — sends when ready` : u.value ? `${e.agent.displayName.value || e.agent.name.value || "Assistant"} is offline` : S.value ? "Connecting..." : G.value === "agent_deleted" ? "This assistant was deleted" : `Message ${e.agent.displayName.value || e.agent.name.value || "assistant"}`), we = p(() => e.chatController?.composerState?.value ?? {
|
|
4956
4982
|
text: "",
|
|
4957
4983
|
pendingAttachments: [],
|
|
4958
4984
|
isUploading: !1
|