@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AssistantClient, a as AssistantViewAvailableDetail, e as AssistantErrorDetail } from './client-
|
|
1
|
+
import { A as AssistantClient, a as AssistantViewAvailableDetail, e as AssistantErrorDetail } from './client-Cf38TgwN.js';
|
|
2
2
|
|
|
3
3
|
declare const APP_VIEW_TAG_NAME = "noodle-app-view";
|
|
4
4
|
interface AssistantAppViewErrorDetail {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AssistantClient, a as AssistantViewAvailableDetail, e as AssistantErrorDetail } from './client-
|
|
1
|
+
import { A as AssistantClient, a as AssistantViewAvailableDetail, e as AssistantErrorDetail } from './client-By4gqB1k.cjs';
|
|
2
2
|
|
|
3
3
|
declare const APP_VIEW_TAG_NAME = "noodle-app-view";
|
|
4
4
|
interface AssistantAppViewErrorDetail {
|
package/dist/app-view.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as APP_VIEW_TAG_NAME, a as AssistantAppViewErrorDetail, N as NoodleAppViewElement } from './app-view-element-
|
|
2
|
-
export { A as AssistantClient, a as AssistantViewAvailableDetail } from './client-
|
|
3
|
-
import './appearance-
|
|
1
|
+
export { A as APP_VIEW_TAG_NAME, a as AssistantAppViewErrorDetail, N as NoodleAppViewElement } from './app-view-element-DSPtyEul.cjs';
|
|
2
|
+
export { A as AssistantClient, a as AssistantViewAvailableDetail } from './client-By4gqB1k.cjs';
|
|
3
|
+
import './appearance-0nS2LFjb.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
|
|
6
6
|
/** Register the framework-neutral MCP App host. Safe to call more than once or during SSR. */
|
package/dist/app-view.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as APP_VIEW_TAG_NAME, a as AssistantAppViewErrorDetail, N as NoodleAppViewElement } from './app-view-element-
|
|
2
|
-
export { A as AssistantClient, a as AssistantViewAvailableDetail } from './client-
|
|
3
|
-
import './appearance-
|
|
1
|
+
export { A as APP_VIEW_TAG_NAME, a as AssistantAppViewErrorDetail, N as NoodleAppViewElement } from './app-view-element-DDtXu08a.js';
|
|
2
|
+
export { A as AssistantClient, a as AssistantViewAvailableDetail } from './client-Cf38TgwN.js';
|
|
3
|
+
import './appearance-0nS2LFjb.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
|
|
6
6
|
/** Register the framework-neutral MCP App host. Safe to call more than once or during SSR. */
|
|
@@ -124,6 +124,7 @@ interface AssistantLabels {
|
|
|
124
124
|
readonly copy: string;
|
|
125
125
|
readonly newMessages: string;
|
|
126
126
|
readonly reconnect: string;
|
|
127
|
+
readonly newConversation: string;
|
|
127
128
|
readonly retry: string;
|
|
128
129
|
readonly unavailable: string;
|
|
129
130
|
readonly sessionExpired: string;
|
|
@@ -124,6 +124,7 @@ interface AssistantLabels {
|
|
|
124
124
|
readonly copy: string;
|
|
125
125
|
readonly newMessages: string;
|
|
126
126
|
readonly reconnect: string;
|
|
127
|
+
readonly newConversation: string;
|
|
127
128
|
readonly retry: string;
|
|
128
129
|
readonly unavailable: string;
|
|
129
130
|
readonly sessionExpired: string;
|
|
@@ -118,6 +118,7 @@ var DEFAULT_APPEARANCE = {
|
|
|
118
118
|
copy: "Copy",
|
|
119
119
|
newMessages: "New messages",
|
|
120
120
|
reconnect: "Reconnect",
|
|
121
|
+
newConversation: "New conversation",
|
|
121
122
|
retry: "Try again",
|
|
122
123
|
unavailable: "The assistant is temporarily unavailable.",
|
|
123
124
|
sessionExpired: "Your assistant session expired. Reopen it to continue.",
|
|
@@ -393,6 +394,27 @@ function decodeUtf8(bytes, truncated) {
|
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
396
|
|
|
397
|
+
// src/conversation-recovery.ts
|
|
398
|
+
function appendConversationRecovery(input) {
|
|
399
|
+
if (!input.messages) return;
|
|
400
|
+
input.messages.querySelector(".conversation-error")?.remove();
|
|
401
|
+
const error = document.createElement("section");
|
|
402
|
+
error.className = "conversation-error";
|
|
403
|
+
error.setAttribute("role", input.action ? "alert" : "status");
|
|
404
|
+
const text2 = document.createElement("p");
|
|
405
|
+
text2.textContent = input.message;
|
|
406
|
+
error.append(text2);
|
|
407
|
+
if (input.action) {
|
|
408
|
+
const button2 = document.createElement("button");
|
|
409
|
+
button2.type = "button";
|
|
410
|
+
button2.textContent = input.action.label;
|
|
411
|
+
button2.addEventListener("click", input.action.run);
|
|
412
|
+
error.append(button2);
|
|
413
|
+
}
|
|
414
|
+
input.messages.append(error);
|
|
415
|
+
input.revealLatest();
|
|
416
|
+
}
|
|
417
|
+
|
|
396
418
|
// src/input-request-card.ts
|
|
397
419
|
function createInputRequestCard(options) {
|
|
398
420
|
const card = document.createElement("section");
|
|
@@ -5056,33 +5078,28 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
5056
5078
|
this.#setSessionState("error");
|
|
5057
5079
|
}
|
|
5058
5080
|
const detail = error instanceof AssistantClientError ? error.detail : { code: fallbackCode, retryable: false };
|
|
5059
|
-
|
|
5060
|
-
|
|
5081
|
+
const startNewConversation = detail.serviceCode === "session_turn_budget_exhausted";
|
|
5082
|
+
const reconnect = detail.retryable !== false || detail.serviceCode === void 0;
|
|
5083
|
+
const recoveryAction = startNewConversation ? {
|
|
5084
|
+
label: this.#appearance.labels.newConversation,
|
|
5085
|
+
run: () => this.#startNewConversation()
|
|
5086
|
+
} : reconnect ? { label: this.#appearance.labels.reconnect, run: () => this.reconnect() } : void 0;
|
|
5087
|
+
appendConversationRecovery({
|
|
5088
|
+
messages: this.#messages,
|
|
5089
|
+
message: detail.code === "session_expired" ? this.#appearance.labels.sessionExpired : this.#appearance.labels.unavailable,
|
|
5061
5090
|
// A spent or switched-off daily budget offers no retry. Reconnecting cannot succeed, and every
|
|
5062
5091
|
// open tab trying is exactly the load the cap was set to refuse — so the button goes, not just
|
|
5063
5092
|
// the alarming words. A spent *session* keeps it: reconnect mints a fresh one, which is the fix.
|
|
5064
|
-
|
|
5065
|
-
|
|
5093
|
+
...recoveryAction === void 0 ? {} : { action: recoveryAction },
|
|
5094
|
+
revealLatest: () => this.#revealLatest()
|
|
5095
|
+
});
|
|
5066
5096
|
this.#dispatchError(detail);
|
|
5067
5097
|
}
|
|
5068
|
-
#
|
|
5069
|
-
|
|
5070
|
-
this.#
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
error.setAttribute("role", offerRetry ? "alert" : "status");
|
|
5074
|
-
const text2 = document.createElement("p");
|
|
5075
|
-
text2.textContent = message;
|
|
5076
|
-
error.append(text2);
|
|
5077
|
-
if (offerRetry) {
|
|
5078
|
-
const retry = document.createElement("button");
|
|
5079
|
-
retry.type = "button";
|
|
5080
|
-
retry.textContent = this.#appearance.labels.reconnect;
|
|
5081
|
-
retry.addEventListener("click", () => this.reconnect());
|
|
5082
|
-
error.append(retry);
|
|
5083
|
-
}
|
|
5084
|
-
this.#messages.append(error);
|
|
5085
|
-
this.#revealLatest();
|
|
5098
|
+
#startNewConversation() {
|
|
5099
|
+
this.resetSession();
|
|
5100
|
+
this.#setSessionState("loading");
|
|
5101
|
+
this.#primeSession();
|
|
5102
|
+
this.dispatchEvent(new CustomEvent("assistant-new-conversation"));
|
|
5086
5103
|
}
|
|
5087
5104
|
#resolvedMode() {
|
|
5088
5105
|
const configured = this.getAttribute("theme") ?? this.#appearance.theme.defaultMode;
|
|
@@ -5268,4 +5285,4 @@ export {
|
|
|
5268
5285
|
dompurify/dist/purify.es.mjs:
|
|
5269
5286
|
(*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE *)
|
|
5270
5287
|
*/
|
|
5271
|
-
//# sourceMappingURL=chunk-
|
|
5288
|
+
//# sourceMappingURL=chunk-6PVDV7SO.js.map
|