@exulu/backend 5.8.0 → 5.8.2
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/index.cjs +48 -3
- package/dist/index.js +48 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36048,7 +36048,9 @@ var publicAgentView = (row, slug) => ({
|
|
|
36048
36048
|
welcomemessage: row.welcomemessage ?? "",
|
|
36049
36049
|
slug,
|
|
36050
36050
|
guest_auth_mode: row.guest_auth_mode || "regular",
|
|
36051
|
-
guest_has_cover: !!row.guest_cover_image
|
|
36051
|
+
guest_has_cover: !!row.guest_cover_image,
|
|
36052
|
+
guest_has_idle_animation: !!row.animation_idle,
|
|
36053
|
+
guest_has_responding_animation: !!row.animation_responding
|
|
36052
36054
|
});
|
|
36053
36055
|
var evaluateGuestChatAccess = async (agent, userId, guestPassword) => {
|
|
36054
36056
|
if (agent.guest_access) {
|
|
@@ -40290,6 +40292,10 @@ ${style.markdown}` : params.prompt;
|
|
|
40290
40292
|
return "";
|
|
40291
40293
|
};
|
|
40292
40294
|
const UUID_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
40295
|
+
const stripBucketPrefix = (key, cfg) => {
|
|
40296
|
+
const bucket = cfg.fileUploads?.s3Bucket;
|
|
40297
|
+
return bucket ? key.replace(`${bucket}/`, "") : key;
|
|
40298
|
+
};
|
|
40293
40299
|
const getGuestAgentById = async (id) => {
|
|
40294
40300
|
if (!UUID_RE3.test(id)) return void 0;
|
|
40295
40301
|
const { db: db2 } = await postgresClient();
|
|
@@ -40305,7 +40311,11 @@ ${style.markdown}` : params.prompt;
|
|
|
40305
40311
|
"welcomemessage",
|
|
40306
40312
|
"model",
|
|
40307
40313
|
"guest_auth_mode",
|
|
40308
|
-
"guest_cover_image"
|
|
40314
|
+
"guest_cover_image",
|
|
40315
|
+
// Presence only — publicAgentView turns these into booleans and the
|
|
40316
|
+
// bytes are served by /public-agents/:id/animation/:kind.
|
|
40317
|
+
"animation_idle",
|
|
40318
|
+
"animation_responding"
|
|
40309
40319
|
);
|
|
40310
40320
|
const views = await Promise.all(
|
|
40311
40321
|
rows.map(
|
|
@@ -40330,7 +40340,10 @@ ${style.markdown}` : params.prompt;
|
|
|
40330
40340
|
}
|
|
40331
40341
|
let bytes;
|
|
40332
40342
|
try {
|
|
40333
|
-
bytes = await getS3ObjectBytes(
|
|
40343
|
+
bytes = await getS3ObjectBytes(
|
|
40344
|
+
stripBucketPrefix(row.guest_cover_image, config),
|
|
40345
|
+
config
|
|
40346
|
+
);
|
|
40334
40347
|
} catch (e) {
|
|
40335
40348
|
if (e?.name === "NoSuchKey" || e?.name === "NotFound" || e?.$metadata?.httpStatusCode === 404) {
|
|
40336
40349
|
res.status(404).json({ detail: "Cover not found." });
|
|
@@ -40347,6 +40360,38 @@ ${style.markdown}` : params.prompt;
|
|
|
40347
40360
|
res.setHeader("Cache-Control", "public, max-age=300");
|
|
40348
40361
|
res.send(bytes);
|
|
40349
40362
|
});
|
|
40363
|
+
app.get(
|
|
40364
|
+
"/public-agents/:id/animation/:kind",
|
|
40365
|
+
async (req, res) => {
|
|
40366
|
+
const kind = req.params.kind;
|
|
40367
|
+
if (kind !== "idle" && kind !== "responding") {
|
|
40368
|
+
res.status(404).json({ detail: "Not found." });
|
|
40369
|
+
return;
|
|
40370
|
+
}
|
|
40371
|
+
const row = await getGuestAgentById(req.params.id ?? "");
|
|
40372
|
+
const key = kind === "idle" ? row?.animation_idle : row?.animation_responding;
|
|
40373
|
+
if (!key) {
|
|
40374
|
+
res.status(404).json({ detail: "Not found." });
|
|
40375
|
+
return;
|
|
40376
|
+
}
|
|
40377
|
+
let bytes;
|
|
40378
|
+
try {
|
|
40379
|
+
bytes = await getS3ObjectBytes(stripBucketPrefix(key, config), config);
|
|
40380
|
+
} catch (e) {
|
|
40381
|
+
if (e?.name === "NoSuchKey" || e?.name === "NotFound" || e?.$metadata?.httpStatusCode === 404) {
|
|
40382
|
+
res.status(404).json({ detail: "Animation not found." });
|
|
40383
|
+
return;
|
|
40384
|
+
}
|
|
40385
|
+
console.error("[EXULU] public-agent animation read failed", e);
|
|
40386
|
+
res.status(500).json({ detail: "Failed to read animation." });
|
|
40387
|
+
return;
|
|
40388
|
+
}
|
|
40389
|
+
res.setHeader("Content-Type", "application/json");
|
|
40390
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
40391
|
+
res.setHeader("Cache-Control", "public, max-age=300");
|
|
40392
|
+
res.send(bytes);
|
|
40393
|
+
}
|
|
40394
|
+
);
|
|
40350
40395
|
app.post(
|
|
40351
40396
|
"/public-agents/:id/verify-password",
|
|
40352
40397
|
async (req, res) => {
|
package/dist/index.js
CHANGED
|
@@ -17198,7 +17198,9 @@ var publicAgentView = (row, slug) => ({
|
|
|
17198
17198
|
welcomemessage: row.welcomemessage ?? "",
|
|
17199
17199
|
slug,
|
|
17200
17200
|
guest_auth_mode: row.guest_auth_mode || "regular",
|
|
17201
|
-
guest_has_cover: !!row.guest_cover_image
|
|
17201
|
+
guest_has_cover: !!row.guest_cover_image,
|
|
17202
|
+
guest_has_idle_animation: !!row.animation_idle,
|
|
17203
|
+
guest_has_responding_animation: !!row.animation_responding
|
|
17202
17204
|
});
|
|
17203
17205
|
var evaluateGuestChatAccess = async (agent, userId, guestPassword) => {
|
|
17204
17206
|
if (agent.guest_access) {
|
|
@@ -21430,6 +21432,10 @@ ${style.markdown}` : params.prompt;
|
|
|
21430
21432
|
return "";
|
|
21431
21433
|
};
|
|
21432
21434
|
const UUID_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
21435
|
+
const stripBucketPrefix = (key, cfg) => {
|
|
21436
|
+
const bucket = cfg.fileUploads?.s3Bucket;
|
|
21437
|
+
return bucket ? key.replace(`${bucket}/`, "") : key;
|
|
21438
|
+
};
|
|
21433
21439
|
const getGuestAgentById = async (id) => {
|
|
21434
21440
|
if (!UUID_RE3.test(id)) return void 0;
|
|
21435
21441
|
const { db } = await postgresClient();
|
|
@@ -21445,7 +21451,11 @@ ${style.markdown}` : params.prompt;
|
|
|
21445
21451
|
"welcomemessage",
|
|
21446
21452
|
"model",
|
|
21447
21453
|
"guest_auth_mode",
|
|
21448
|
-
"guest_cover_image"
|
|
21454
|
+
"guest_cover_image",
|
|
21455
|
+
// Presence only — publicAgentView turns these into booleans and the
|
|
21456
|
+
// bytes are served by /public-agents/:id/animation/:kind.
|
|
21457
|
+
"animation_idle",
|
|
21458
|
+
"animation_responding"
|
|
21449
21459
|
);
|
|
21450
21460
|
const views = await Promise.all(
|
|
21451
21461
|
rows.map(
|
|
@@ -21470,7 +21480,10 @@ ${style.markdown}` : params.prompt;
|
|
|
21470
21480
|
}
|
|
21471
21481
|
let bytes;
|
|
21472
21482
|
try {
|
|
21473
|
-
bytes = await getS3ObjectBytes(
|
|
21483
|
+
bytes = await getS3ObjectBytes(
|
|
21484
|
+
stripBucketPrefix(row.guest_cover_image, config),
|
|
21485
|
+
config
|
|
21486
|
+
);
|
|
21474
21487
|
} catch (e) {
|
|
21475
21488
|
if (e?.name === "NoSuchKey" || e?.name === "NotFound" || e?.$metadata?.httpStatusCode === 404) {
|
|
21476
21489
|
res.status(404).json({ detail: "Cover not found." });
|
|
@@ -21487,6 +21500,38 @@ ${style.markdown}` : params.prompt;
|
|
|
21487
21500
|
res.setHeader("Cache-Control", "public, max-age=300");
|
|
21488
21501
|
res.send(bytes);
|
|
21489
21502
|
});
|
|
21503
|
+
app.get(
|
|
21504
|
+
"/public-agents/:id/animation/:kind",
|
|
21505
|
+
async (req, res) => {
|
|
21506
|
+
const kind = req.params.kind;
|
|
21507
|
+
if (kind !== "idle" && kind !== "responding") {
|
|
21508
|
+
res.status(404).json({ detail: "Not found." });
|
|
21509
|
+
return;
|
|
21510
|
+
}
|
|
21511
|
+
const row = await getGuestAgentById(req.params.id ?? "");
|
|
21512
|
+
const key = kind === "idle" ? row?.animation_idle : row?.animation_responding;
|
|
21513
|
+
if (!key) {
|
|
21514
|
+
res.status(404).json({ detail: "Not found." });
|
|
21515
|
+
return;
|
|
21516
|
+
}
|
|
21517
|
+
let bytes;
|
|
21518
|
+
try {
|
|
21519
|
+
bytes = await getS3ObjectBytes(stripBucketPrefix(key, config), config);
|
|
21520
|
+
} catch (e) {
|
|
21521
|
+
if (e?.name === "NoSuchKey" || e?.name === "NotFound" || e?.$metadata?.httpStatusCode === 404) {
|
|
21522
|
+
res.status(404).json({ detail: "Animation not found." });
|
|
21523
|
+
return;
|
|
21524
|
+
}
|
|
21525
|
+
console.error("[EXULU] public-agent animation read failed", e);
|
|
21526
|
+
res.status(500).json({ detail: "Failed to read animation." });
|
|
21527
|
+
return;
|
|
21528
|
+
}
|
|
21529
|
+
res.setHeader("Content-Type", "application/json");
|
|
21530
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
21531
|
+
res.setHeader("Cache-Control", "public, max-age=300");
|
|
21532
|
+
res.send(bytes);
|
|
21533
|
+
}
|
|
21534
|
+
);
|
|
21490
21535
|
app.post(
|
|
21491
21536
|
"/public-agents/:id/verify-password",
|
|
21492
21537
|
async (req, res) => {
|