@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.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-
|
|
2
|
-
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-
|
|
3
|
-
import './appearance-
|
|
1
|
+
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-By4gqB1k.cjs';
|
|
2
|
+
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-By4gqB1k.cjs';
|
|
3
|
+
import './appearance-0nS2LFjb.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
|
|
6
6
|
interface AssistantSurfaceAppearance {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-
|
|
2
|
-
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-
|
|
3
|
-
import './appearance-
|
|
1
|
+
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-Cf38TgwN.js';
|
|
2
|
+
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-Cf38TgwN.js';
|
|
3
|
+
import './appearance-0nS2LFjb.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
|
|
6
6
|
interface AssistantSurfaceAppearance {
|
package/dist/index.js
CHANGED
package/dist/react/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AssistantPageContext, c as AssistantContext, C as CreateAssistantClientOptions, d as AssistantChatState, A as AssistantClient } from '../client-
|
|
2
|
-
import '../appearance-
|
|
1
|
+
import { b as AssistantPageContext, c as AssistantContext, C as CreateAssistantClientOptions, d as AssistantChatState, A as AssistantClient } from '../client-By4gqB1k.cjs';
|
|
2
|
+
import '../appearance-0nS2LFjb.cjs';
|
|
3
3
|
import 'ai';
|
|
4
4
|
|
|
5
5
|
type UseNoodleAssistantOptions<TPageContext extends AssistantPageContext = AssistantContext> = CreateAssistantClientOptions<TPageContext> & {
|
package/dist/react/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AssistantPageContext, c as AssistantContext, C as CreateAssistantClientOptions, d as AssistantChatState, A as AssistantClient } from '../client-
|
|
2
|
-
import '../appearance-
|
|
1
|
+
import { b as AssistantPageContext, c as AssistantContext, C as CreateAssistantClientOptions, d as AssistantChatState, A as AssistantClient } from '../client-Cf38TgwN.js';
|
|
2
|
+
import '../appearance-0nS2LFjb.js';
|
|
3
3
|
import 'ai';
|
|
4
4
|
|
|
5
5
|
type UseNoodleAssistantOptions<TPageContext extends AssistantPageContext = AssistantContext> = CreateAssistantClientOptions<TPageContext> & {
|
package/dist/react.cjs
CHANGED
|
@@ -22451,6 +22451,7 @@ var DEFAULT_APPEARANCE = {
|
|
|
22451
22451
|
copy: "Copy",
|
|
22452
22452
|
newMessages: "New messages",
|
|
22453
22453
|
reconnect: "Reconnect",
|
|
22454
|
+
newConversation: "New conversation",
|
|
22454
22455
|
retry: "Try again",
|
|
22455
22456
|
unavailable: "The assistant is temporarily unavailable.",
|
|
22456
22457
|
sessionExpired: "Your assistant session expired. Reopen it to continue.",
|
|
@@ -28160,6 +28161,27 @@ function appInteractionStopped(action) {
|
|
|
28160
28161
|
};
|
|
28161
28162
|
}
|
|
28162
28163
|
|
|
28164
|
+
// src/conversation-recovery.ts
|
|
28165
|
+
function appendConversationRecovery(input) {
|
|
28166
|
+
if (!input.messages) return;
|
|
28167
|
+
input.messages.querySelector(".conversation-error")?.remove();
|
|
28168
|
+
const error51 = document.createElement("section");
|
|
28169
|
+
error51.className = "conversation-error";
|
|
28170
|
+
error51.setAttribute("role", input.action ? "alert" : "status");
|
|
28171
|
+
const text3 = document.createElement("p");
|
|
28172
|
+
text3.textContent = input.message;
|
|
28173
|
+
error51.append(text3);
|
|
28174
|
+
if (input.action) {
|
|
28175
|
+
const button2 = document.createElement("button");
|
|
28176
|
+
button2.type = "button";
|
|
28177
|
+
button2.textContent = input.action.label;
|
|
28178
|
+
button2.addEventListener("click", input.action.run);
|
|
28179
|
+
error51.append(button2);
|
|
28180
|
+
}
|
|
28181
|
+
input.messages.append(error51);
|
|
28182
|
+
input.revealLatest();
|
|
28183
|
+
}
|
|
28184
|
+
|
|
28163
28185
|
// src/input-request-card.ts
|
|
28164
28186
|
function createInputRequestCard(options) {
|
|
28165
28187
|
const card = document.createElement("section");
|
|
@@ -32846,33 +32868,28 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
32846
32868
|
this.#setSessionState("error");
|
|
32847
32869
|
}
|
|
32848
32870
|
const detail = error51 instanceof AssistantClientError ? error51.detail : { code: fallbackCode, retryable: false };
|
|
32849
|
-
|
|
32850
|
-
|
|
32871
|
+
const startNewConversation = detail.serviceCode === "session_turn_budget_exhausted";
|
|
32872
|
+
const reconnect = detail.retryable !== false || detail.serviceCode === void 0;
|
|
32873
|
+
const recoveryAction = startNewConversation ? {
|
|
32874
|
+
label: this.#appearance.labels.newConversation,
|
|
32875
|
+
run: () => this.#startNewConversation()
|
|
32876
|
+
} : reconnect ? { label: this.#appearance.labels.reconnect, run: () => this.reconnect() } : void 0;
|
|
32877
|
+
appendConversationRecovery({
|
|
32878
|
+
messages: this.#messages,
|
|
32879
|
+
message: detail.code === "session_expired" ? this.#appearance.labels.sessionExpired : this.#appearance.labels.unavailable,
|
|
32851
32880
|
// A spent or switched-off daily budget offers no retry. Reconnecting cannot succeed, and every
|
|
32852
32881
|
// open tab trying is exactly the load the cap was set to refuse — so the button goes, not just
|
|
32853
32882
|
// the alarming words. A spent *session* keeps it: reconnect mints a fresh one, which is the fix.
|
|
32854
|
-
|
|
32855
|
-
|
|
32883
|
+
...recoveryAction === void 0 ? {} : { action: recoveryAction },
|
|
32884
|
+
revealLatest: () => this.#revealLatest()
|
|
32885
|
+
});
|
|
32856
32886
|
this.#dispatchError(detail);
|
|
32857
32887
|
}
|
|
32858
|
-
#
|
|
32859
|
-
|
|
32860
|
-
this.#
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
|
-
error51.setAttribute("role", offerRetry ? "alert" : "status");
|
|
32864
|
-
const text3 = document.createElement("p");
|
|
32865
|
-
text3.textContent = message;
|
|
32866
|
-
error51.append(text3);
|
|
32867
|
-
if (offerRetry) {
|
|
32868
|
-
const retry = document.createElement("button");
|
|
32869
|
-
retry.type = "button";
|
|
32870
|
-
retry.textContent = this.#appearance.labels.reconnect;
|
|
32871
|
-
retry.addEventListener("click", () => this.reconnect());
|
|
32872
|
-
error51.append(retry);
|
|
32873
|
-
}
|
|
32874
|
-
this.#messages.append(error51);
|
|
32875
|
-
this.#revealLatest();
|
|
32888
|
+
#startNewConversation() {
|
|
32889
|
+
this.resetSession();
|
|
32890
|
+
this.#setSessionState("loading");
|
|
32891
|
+
this.#primeSession();
|
|
32892
|
+
this.dispatchEvent(new CustomEvent("assistant-new-conversation"));
|
|
32876
32893
|
}
|
|
32877
32894
|
#resolvedMode() {
|
|
32878
32895
|
const configured = this.getAttribute("theme") ?? this.#appearance.theme.defaultMode;
|