@noodleseed/assistant 1.15.0 → 1.16.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/{chunk-SUHNNWKP.js → chunk-7L52WJ2E.js} +67 -2
- package/dist/chunk-7L52WJ2E.js.map +1 -0
- package/dist/{chunk-RRJIK473.js → chunk-NPV64PUX.js} +6 -1
- package/dist/{chunk-RRJIK473.js.map → chunk-NPV64PUX.js.map} +1 -1
- package/dist/{client-B_l59rWg.d.cts → client-401BAJqk.d.cts} +13 -1
- package/dist/{client-MnLfiyo2.d.ts → client-Ii_xTV09.d.ts} +13 -1
- package/dist/client.cjs +5 -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 +70 -0
- 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 +5 -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 +70 -0
- 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
package/dist/index.cjs
CHANGED
|
@@ -27092,6 +27092,11 @@ function toAssistantClientEvent(event) {
|
|
|
27092
27092
|
return event;
|
|
27093
27093
|
}
|
|
27094
27094
|
break;
|
|
27095
|
+
case "auth_requested":
|
|
27096
|
+
if (hasString(value, "id") && hasString(value, "tool") && hasString(value, "continuation") && hasString(value, "expiresAt") && hasOptionalTurnId(value)) {
|
|
27097
|
+
return event;
|
|
27098
|
+
}
|
|
27099
|
+
break;
|
|
27095
27100
|
case "interaction_resolved":
|
|
27096
27101
|
if (hasString(value, "id") && (value.action === void 0 || isInteractionAction(value.action)) && hasOptionalTurnId(value)) {
|
|
27097
27102
|
return event;
|
|
@@ -31041,6 +31046,28 @@ function renderMarkdown(text3) {
|
|
|
31041
31046
|
});
|
|
31042
31047
|
}
|
|
31043
31048
|
|
|
31049
|
+
// src/sign-in-card.ts
|
|
31050
|
+
function createSignInCard(options) {
|
|
31051
|
+
const card = document.createElement("div");
|
|
31052
|
+
card.className = "noodle-assistant-card noodle-assistant-sign-in";
|
|
31053
|
+
card.dataset.tool = options.tool;
|
|
31054
|
+
card.setAttribute("role", "status");
|
|
31055
|
+
const heading = document.createElement("p");
|
|
31056
|
+
heading.className = "noodle-assistant-card-heading";
|
|
31057
|
+
heading.textContent = options.labels.heading;
|
|
31058
|
+
card.append(heading);
|
|
31059
|
+
const action = document.createElement("button");
|
|
31060
|
+
action.type = "button";
|
|
31061
|
+
action.className = "noodle-assistant-card-action";
|
|
31062
|
+
action.textContent = options.labels.action;
|
|
31063
|
+
action.addEventListener("click", () => {
|
|
31064
|
+
action.disabled = true;
|
|
31065
|
+
options.onSignIn();
|
|
31066
|
+
});
|
|
31067
|
+
card.append(action);
|
|
31068
|
+
return card;
|
|
31069
|
+
}
|
|
31070
|
+
|
|
31044
31071
|
// src/element-event-controller.ts
|
|
31045
31072
|
var AssistantElementEventController = class {
|
|
31046
31073
|
#host;
|
|
@@ -31135,6 +31162,15 @@ var AssistantElementEventController = class {
|
|
|
31135
31162
|
);
|
|
31136
31163
|
return;
|
|
31137
31164
|
}
|
|
31165
|
+
if (name21 === "auth_requested" && typeof data.continuation === "string") {
|
|
31166
|
+
this.#appendSignInRequest(
|
|
31167
|
+
String(data.id ?? ""),
|
|
31168
|
+
String(data.tool ?? "this"),
|
|
31169
|
+
data.continuation,
|
|
31170
|
+
String(data.expiresAt ?? "")
|
|
31171
|
+
);
|
|
31172
|
+
return;
|
|
31173
|
+
}
|
|
31138
31174
|
if (name21 === "input_requested" && isRecord5(data.requestedSchema)) {
|
|
31139
31175
|
this.#appendInputRequest(
|
|
31140
31176
|
String(data.id ?? ""),
|
|
@@ -31220,6 +31256,40 @@ var AssistantElementEventController = class {
|
|
|
31220
31256
|
})
|
|
31221
31257
|
);
|
|
31222
31258
|
}
|
|
31259
|
+
/**
|
|
31260
|
+
* The host application owns the login. This renders the prompt and raises
|
|
31261
|
+
* `assistant-sign-in-requested`; the page signs the visitor in however it already does, then its
|
|
31262
|
+
* backend spends the continuation. Nothing here talks to an identity provider.
|
|
31263
|
+
*/
|
|
31264
|
+
#appendSignInRequest(id, tool, continuation, expiresAt) {
|
|
31265
|
+
const messages = this.#host.messages();
|
|
31266
|
+
if (!messages) return;
|
|
31267
|
+
this.#proposalCards.get(id)?.remove();
|
|
31268
|
+
const card = createSignInCard({
|
|
31269
|
+
tool,
|
|
31270
|
+
continuation,
|
|
31271
|
+
expiresAt,
|
|
31272
|
+
labels: {
|
|
31273
|
+
heading: "Sign in to continue",
|
|
31274
|
+
action: "Sign in"
|
|
31275
|
+
},
|
|
31276
|
+
onSignIn: () => this.#host.element.dispatchEvent(
|
|
31277
|
+
new CustomEvent("assistant-sign-in-requested", {
|
|
31278
|
+
detail: { id, tool, continuation, expiresAt },
|
|
31279
|
+
bubbles: true,
|
|
31280
|
+
composed: true
|
|
31281
|
+
})
|
|
31282
|
+
)
|
|
31283
|
+
});
|
|
31284
|
+
messages.append(card);
|
|
31285
|
+
this.#proposalCards.set(id, card);
|
|
31286
|
+
this.#host.revealLatest();
|
|
31287
|
+
this.#host.element.dispatchEvent(
|
|
31288
|
+
new CustomEvent("assistant-sign-in-required", {
|
|
31289
|
+
detail: { id, tool, continuation, expiresAt }
|
|
31290
|
+
})
|
|
31291
|
+
);
|
|
31292
|
+
}
|
|
31223
31293
|
#appendInputRequest(id, message, requestedSchema) {
|
|
31224
31294
|
const messages = this.#host.messages();
|
|
31225
31295
|
if (!messages || !id) return;
|