@noodleseed/assistant 1.15.0 → 1.16.1
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/{chunk-SUHNNWKP.js → chunk-MZNENVFY.js} +76 -3
- package/dist/chunk-MZNENVFY.js.map +1 -0
- package/dist/{chunk-RRJIK473.js → chunk-RIKRQFKS.js} +10 -1
- package/dist/{chunk-RRJIK473.js.map → chunk-RIKRQFKS.js.map} +1 -1
- package/dist/{client-MnLfiyo2.d.ts → client-B6pnBmF8.d.ts} +14 -1
- package/dist/{client-B_l59rWg.d.cts → client-BQ30Fq-c.d.cts} +14 -1
- package/dist/client.cjs +9 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/embed.global.js +32 -32
- package/dist/index.cjs +83 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/react/client.cjs +9 -0
- package/dist/react/client.cjs.map +1 -1
- package/dist/react/client.d.cts +1 -1
- package/dist/react/client.d.ts +1 -1
- package/dist/react/client.js +1 -1
- package/dist/react.cjs +83 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-SUHNNWKP.js.map +0 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
copyAssistantModelContext,
|
|
4
4
|
createAssistantClient,
|
|
5
5
|
sessionSourceKey
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RIKRQFKS.js";
|
|
7
7
|
import {
|
|
8
8
|
_enum,
|
|
9
9
|
_null,
|
|
@@ -6623,6 +6623,28 @@ function renderMarkdown(text2) {
|
|
|
6623
6623
|
});
|
|
6624
6624
|
}
|
|
6625
6625
|
|
|
6626
|
+
// src/sign-in-card.ts
|
|
6627
|
+
function createSignInCard(options) {
|
|
6628
|
+
const card = document.createElement("div");
|
|
6629
|
+
card.className = "noodle-assistant-card noodle-assistant-sign-in";
|
|
6630
|
+
card.dataset.tool = options.tool;
|
|
6631
|
+
card.setAttribute("role", "status");
|
|
6632
|
+
const heading = document.createElement("p");
|
|
6633
|
+
heading.className = "noodle-assistant-card-heading";
|
|
6634
|
+
heading.textContent = options.labels.heading;
|
|
6635
|
+
card.append(heading);
|
|
6636
|
+
const action = document.createElement("button");
|
|
6637
|
+
action.type = "button";
|
|
6638
|
+
action.className = "noodle-assistant-card-action";
|
|
6639
|
+
action.textContent = options.labels.action;
|
|
6640
|
+
action.addEventListener("click", () => {
|
|
6641
|
+
action.disabled = true;
|
|
6642
|
+
options.onSignIn();
|
|
6643
|
+
});
|
|
6644
|
+
card.append(action);
|
|
6645
|
+
return card;
|
|
6646
|
+
}
|
|
6647
|
+
|
|
6626
6648
|
// src/element-event-controller.ts
|
|
6627
6649
|
var AssistantElementEventController = class {
|
|
6628
6650
|
#host;
|
|
@@ -6717,6 +6739,15 @@ var AssistantElementEventController = class {
|
|
|
6717
6739
|
);
|
|
6718
6740
|
return;
|
|
6719
6741
|
}
|
|
6742
|
+
if (name === "auth_requested" && typeof data.continuation === "string") {
|
|
6743
|
+
this.#appendSignInRequest(
|
|
6744
|
+
String(data.id ?? ""),
|
|
6745
|
+
String(data.tool ?? "this"),
|
|
6746
|
+
data.continuation,
|
|
6747
|
+
String(data.expiresAt ?? "")
|
|
6748
|
+
);
|
|
6749
|
+
return;
|
|
6750
|
+
}
|
|
6720
6751
|
if (name === "input_requested" && isRecord(data.requestedSchema)) {
|
|
6721
6752
|
this.#appendInputRequest(
|
|
6722
6753
|
String(data.id ?? ""),
|
|
@@ -6802,6 +6833,40 @@ var AssistantElementEventController = class {
|
|
|
6802
6833
|
})
|
|
6803
6834
|
);
|
|
6804
6835
|
}
|
|
6836
|
+
/**
|
|
6837
|
+
* The host application owns the login. This renders the prompt and raises
|
|
6838
|
+
* `assistant-sign-in-requested`; the page signs the visitor in however it already does, then its
|
|
6839
|
+
* backend spends the continuation. Nothing here talks to an identity provider.
|
|
6840
|
+
*/
|
|
6841
|
+
#appendSignInRequest(id, tool, continuation, expiresAt) {
|
|
6842
|
+
const messages = this.#host.messages();
|
|
6843
|
+
if (!messages) return;
|
|
6844
|
+
this.#proposalCards.get(id)?.remove();
|
|
6845
|
+
const card = createSignInCard({
|
|
6846
|
+
tool,
|
|
6847
|
+
continuation,
|
|
6848
|
+
expiresAt,
|
|
6849
|
+
labels: {
|
|
6850
|
+
heading: "Sign in to continue",
|
|
6851
|
+
action: "Sign in"
|
|
6852
|
+
},
|
|
6853
|
+
onSignIn: () => this.#host.element.dispatchEvent(
|
|
6854
|
+
new CustomEvent("assistant-sign-in-requested", {
|
|
6855
|
+
detail: { id, tool, continuation, expiresAt },
|
|
6856
|
+
bubbles: true,
|
|
6857
|
+
composed: true
|
|
6858
|
+
})
|
|
6859
|
+
)
|
|
6860
|
+
});
|
|
6861
|
+
messages.append(card);
|
|
6862
|
+
this.#proposalCards.set(id, card);
|
|
6863
|
+
this.#host.revealLatest();
|
|
6864
|
+
this.#host.element.dispatchEvent(
|
|
6865
|
+
new CustomEvent("assistant-sign-in-required", {
|
|
6866
|
+
detail: { id, tool, continuation, expiresAt }
|
|
6867
|
+
})
|
|
6868
|
+
);
|
|
6869
|
+
}
|
|
6805
6870
|
#appendInputRequest(id, message, requestedSchema) {
|
|
6806
6871
|
const messages = this.#host.messages();
|
|
6807
6872
|
if (!messages || !id) return;
|
|
@@ -7688,7 +7753,13 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
7688
7753
|
if (this.#appearance.behavior.startOpen) this.#applyStartOpenPolicy();
|
|
7689
7754
|
this.#render();
|
|
7690
7755
|
this.dispatchEvent(new CustomEvent("assistant-ready"));
|
|
7691
|
-
this
|
|
7756
|
+
if (this.hasAttribute("start-open")) {
|
|
7757
|
+
this.setAttribute("open", "");
|
|
7758
|
+
this.#startOpenApplied = true;
|
|
7759
|
+
this.#primeSession();
|
|
7760
|
+
} else if (!this.embedId) {
|
|
7761
|
+
this.#primeSession();
|
|
7762
|
+
}
|
|
7692
7763
|
}
|
|
7693
7764
|
disconnectedCallback() {
|
|
7694
7765
|
this.#conversationGeneration += 1;
|
|
@@ -7710,6 +7781,7 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
7710
7781
|
}
|
|
7711
7782
|
open() {
|
|
7712
7783
|
this.setAttribute("open", "");
|
|
7784
|
+
this.#primeSession();
|
|
7713
7785
|
this.dispatchEvent(new CustomEvent("assistant-open"));
|
|
7714
7786
|
}
|
|
7715
7787
|
close() {
|
|
@@ -7877,6 +7949,7 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
7877
7949
|
}
|
|
7878
7950
|
#primeSession() {
|
|
7879
7951
|
if (!this.sessionEndpoint && !this.embedId) return;
|
|
7952
|
+
if (this.#sessionBootstrap || this.#client?.hasSession()) return;
|
|
7880
7953
|
const client = this.#ensureClient();
|
|
7881
7954
|
const generation = this.#conversationGeneration;
|
|
7882
7955
|
this.#setSessionState("loading");
|
|
@@ -8240,4 +8313,4 @@ export {
|
|
|
8240
8313
|
dompurify/dist/purify.es.mjs:
|
|
8241
8314
|
(*! @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 *)
|
|
8242
8315
|
*/
|
|
8243
|
-
//# sourceMappingURL=chunk-
|
|
8316
|
+
//# sourceMappingURL=chunk-MZNENVFY.js.map
|