@noodleseed/assistant 1.29.0 → 1.31.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-3VZ3M5BE.js → chunk-5EVZFPTD.js} +29 -2
- package/dist/chunk-5EVZFPTD.js.map +1 -0
- package/dist/{chunk-DOWFW3KA.js → chunk-PIYWT67H.js} +3 -3
- package/dist/{chunk-DOWFW3KA.js.map → chunk-PIYWT67H.js.map} +1 -1
- package/dist/client.cjs +31 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/embed.global.js +38 -38
- package/dist/index.cjs +29 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/react/client.cjs +31 -1
- package/dist/react/client.cjs.map +1 -1
- package/dist/react/client.js +1 -1
- package/dist/react.cjs +29 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3VZ3M5BE.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -27921,6 +27921,32 @@ function isAbortError2(error51) {
|
|
|
27921
27921
|
return error51 instanceof DOMException && error51.name === "AbortError";
|
|
27922
27922
|
}
|
|
27923
27923
|
|
|
27924
|
+
// src/visitor-id.ts
|
|
27925
|
+
var STORAGE_PREFIX = "noodleseed.assistant.visitor.";
|
|
27926
|
+
function randomVisitorId() {
|
|
27927
|
+
try {
|
|
27928
|
+
return globalThis.crypto.randomUUID();
|
|
27929
|
+
} catch {
|
|
27930
|
+
return void 0;
|
|
27931
|
+
}
|
|
27932
|
+
}
|
|
27933
|
+
function visitorIdForSource(sourceKey) {
|
|
27934
|
+
const key = `${STORAGE_PREFIX}${sourceKey}`;
|
|
27935
|
+
try {
|
|
27936
|
+
const stored = globalThis.localStorage?.getItem(key);
|
|
27937
|
+
if (typeof stored === "string" && stored.length > 0) return stored;
|
|
27938
|
+
} catch {
|
|
27939
|
+
return void 0;
|
|
27940
|
+
}
|
|
27941
|
+
const created = randomVisitorId();
|
|
27942
|
+
if (created === void 0) return void 0;
|
|
27943
|
+
try {
|
|
27944
|
+
globalThis.localStorage?.setItem(key, created);
|
|
27945
|
+
} catch {
|
|
27946
|
+
}
|
|
27947
|
+
return created;
|
|
27948
|
+
}
|
|
27949
|
+
|
|
27924
27950
|
// src/client.ts
|
|
27925
27951
|
var DefaultAssistantClient = class {
|
|
27926
27952
|
#source;
|
|
@@ -28315,11 +28341,12 @@ var DefaultAssistantClient = class {
|
|
|
28315
28341
|
}
|
|
28316
28342
|
async #createSession(signal) {
|
|
28317
28343
|
const source = this.#source;
|
|
28344
|
+
const visitorId = source.kind === "public" ? visitorIdForSource(sessionSourceKey({ embedId: source.embedId, serviceUrl: source.url })) : void 0;
|
|
28318
28345
|
const response = await this.#requestSession(source, {
|
|
28319
28346
|
method: "POST",
|
|
28320
28347
|
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
28321
28348
|
body: JSON.stringify(
|
|
28322
|
-
source.kind === "public" ? { embedId: source.embedId } : this.#context ? { context: this.#context } : {}
|
|
28349
|
+
source.kind === "public" ? { embedId: source.embedId, ...visitorId ? { visitorId } : {} } : this.#context ? { context: this.#context } : {}
|
|
28323
28350
|
),
|
|
28324
28351
|
credentials: source.kind === "public" ? "omit" : "same-origin",
|
|
28325
28352
|
signal
|
|
@@ -33190,7 +33217,7 @@ var AssistantElementWebMcpController = class {
|
|
|
33190
33217
|
#bridge;
|
|
33191
33218
|
/** Guards against a late `startWebMcpBridge` resolving after the session it belonged to is gone. */
|
|
33192
33219
|
#generation = 0;
|
|
33193
|
-
/** Called when resolved configuration arrives; the
|
|
33220
|
+
/** Called when resolved configuration arrives; the server already resolved surface over deployment. */
|
|
33194
33221
|
configure(enabled) {
|
|
33195
33222
|
this.#enabled = enabled;
|
|
33196
33223
|
if (!enabled) this.stop();
|