@noodleseed/assistant 1.23.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-view-element-7ZQZLYbL.d.ts → app-view-element-DDtXu08a.d.ts} +1 -1
- package/dist/{app-view-element-1i_w6FDf.d.cts → app-view-element-DSPtyEul.d.cts} +1 -1
- package/dist/app-view.d.cts +3 -3
- package/dist/app-view.d.ts +3 -3
- package/dist/{appearance-Cc-eqSbp.d.cts → appearance-0nS2LFjb.d.cts} +1 -0
- package/dist/{appearance-Cc-eqSbp.d.ts → appearance-0nS2LFjb.d.ts} +1 -0
- package/dist/{chunk-X7UQDIGS.js → chunk-6PVDV7SO.js} +40 -23
- package/dist/chunk-6PVDV7SO.js.map +1 -0
- package/dist/{client-uo57Swlm.d.cts → client-By4gqB1k.d.cts} +1 -1
- package/dist/{client-Bp_VKpMg.d.ts → client-Cf38TgwN.d.ts} +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/embed.global.js +33 -33
- package/dist/index.cjs +39 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/react/client.d.cts +2 -2
- package/dist/react/client.d.ts +2 -2
- package/dist/react.cjs +39 -22
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-X7UQDIGS.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -22448,6 +22448,7 @@ var DEFAULT_APPEARANCE = {
|
|
|
22448
22448
|
copy: "Copy",
|
|
22449
22449
|
newMessages: "New messages",
|
|
22450
22450
|
reconnect: "Reconnect",
|
|
22451
|
+
newConversation: "New conversation",
|
|
22451
22452
|
retry: "Try again",
|
|
22452
22453
|
unavailable: "The assistant is temporarily unavailable.",
|
|
22453
22454
|
sessionExpired: "Your assistant session expired. Reopen it to continue.",
|
|
@@ -28157,6 +28158,27 @@ function appInteractionStopped(action) {
|
|
|
28157
28158
|
};
|
|
28158
28159
|
}
|
|
28159
28160
|
|
|
28161
|
+
// src/conversation-recovery.ts
|
|
28162
|
+
function appendConversationRecovery(input) {
|
|
28163
|
+
if (!input.messages) return;
|
|
28164
|
+
input.messages.querySelector(".conversation-error")?.remove();
|
|
28165
|
+
const error51 = document.createElement("section");
|
|
28166
|
+
error51.className = "conversation-error";
|
|
28167
|
+
error51.setAttribute("role", input.action ? "alert" : "status");
|
|
28168
|
+
const text3 = document.createElement("p");
|
|
28169
|
+
text3.textContent = input.message;
|
|
28170
|
+
error51.append(text3);
|
|
28171
|
+
if (input.action) {
|
|
28172
|
+
const button2 = document.createElement("button");
|
|
28173
|
+
button2.type = "button";
|
|
28174
|
+
button2.textContent = input.action.label;
|
|
28175
|
+
button2.addEventListener("click", input.action.run);
|
|
28176
|
+
error51.append(button2);
|
|
28177
|
+
}
|
|
28178
|
+
input.messages.append(error51);
|
|
28179
|
+
input.revealLatest();
|
|
28180
|
+
}
|
|
28181
|
+
|
|
28160
28182
|
// src/input-request-card.ts
|
|
28161
28183
|
function createInputRequestCard(options) {
|
|
28162
28184
|
const card = document.createElement("section");
|
|
@@ -32843,33 +32865,28 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
32843
32865
|
this.#setSessionState("error");
|
|
32844
32866
|
}
|
|
32845
32867
|
const detail = error51 instanceof AssistantClientError ? error51.detail : { code: fallbackCode, retryable: false };
|
|
32846
|
-
|
|
32847
|
-
|
|
32868
|
+
const startNewConversation = detail.serviceCode === "session_turn_budget_exhausted";
|
|
32869
|
+
const reconnect = detail.retryable !== false || detail.serviceCode === void 0;
|
|
32870
|
+
const recoveryAction = startNewConversation ? {
|
|
32871
|
+
label: this.#appearance.labels.newConversation,
|
|
32872
|
+
run: () => this.#startNewConversation()
|
|
32873
|
+
} : reconnect ? { label: this.#appearance.labels.reconnect, run: () => this.reconnect() } : void 0;
|
|
32874
|
+
appendConversationRecovery({
|
|
32875
|
+
messages: this.#messages,
|
|
32876
|
+
message: detail.code === "session_expired" ? this.#appearance.labels.sessionExpired : this.#appearance.labels.unavailable,
|
|
32848
32877
|
// A spent or switched-off daily budget offers no retry. Reconnecting cannot succeed, and every
|
|
32849
32878
|
// open tab trying is exactly the load the cap was set to refuse — so the button goes, not just
|
|
32850
32879
|
// the alarming words. A spent *session* keeps it: reconnect mints a fresh one, which is the fix.
|
|
32851
|
-
|
|
32852
|
-
|
|
32880
|
+
...recoveryAction === void 0 ? {} : { action: recoveryAction },
|
|
32881
|
+
revealLatest: () => this.#revealLatest()
|
|
32882
|
+
});
|
|
32853
32883
|
this.#dispatchError(detail);
|
|
32854
32884
|
}
|
|
32855
|
-
#
|
|
32856
|
-
|
|
32857
|
-
this.#
|
|
32858
|
-
|
|
32859
|
-
|
|
32860
|
-
error51.setAttribute("role", offerRetry ? "alert" : "status");
|
|
32861
|
-
const text3 = document.createElement("p");
|
|
32862
|
-
text3.textContent = message;
|
|
32863
|
-
error51.append(text3);
|
|
32864
|
-
if (offerRetry) {
|
|
32865
|
-
const retry = document.createElement("button");
|
|
32866
|
-
retry.type = "button";
|
|
32867
|
-
retry.textContent = this.#appearance.labels.reconnect;
|
|
32868
|
-
retry.addEventListener("click", () => this.reconnect());
|
|
32869
|
-
error51.append(retry);
|
|
32870
|
-
}
|
|
32871
|
-
this.#messages.append(error51);
|
|
32872
|
-
this.#revealLatest();
|
|
32885
|
+
#startNewConversation() {
|
|
32886
|
+
this.resetSession();
|
|
32887
|
+
this.#setSessionState("loading");
|
|
32888
|
+
this.#primeSession();
|
|
32889
|
+
this.dispatchEvent(new CustomEvent("assistant-new-conversation"));
|
|
32873
32890
|
}
|
|
32874
32891
|
#resolvedMode() {
|
|
32875
32892
|
const configured = this.getAttribute("theme") ?? this.#appearance.theme.defaultMode;
|