@personaai/runtime 0.19.0 → 0.20.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/index.cjs +27 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -159,7 +159,7 @@ function evictStaleRuns(runs, now, graceMs = DEFAULT_RUN_GRACE_MS, maxTracked =
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
// src/version.ts
|
|
162
|
-
var RUNTIME_VERSION = "0.
|
|
162
|
+
var RUNTIME_VERSION = "0.20.0";
|
|
163
163
|
|
|
164
164
|
// src/routes/health.ts
|
|
165
165
|
var alwaysOnCapabilities = {
|
|
@@ -606,6 +606,27 @@ async function* withHeartbeats(source, intervalMs = 15e3) {
|
|
|
606
606
|
}
|
|
607
607
|
|
|
608
608
|
// src/routes/chat.ts
|
|
609
|
+
var MAX_ATTACHMENTS = 4;
|
|
610
|
+
function parseAttachments(value) {
|
|
611
|
+
if (value === void 0 || value === null) return void 0;
|
|
612
|
+
if (!Array.isArray(value) || !value.every(
|
|
613
|
+
(a) => typeof a === "object" && a !== null && typeof a.fileId === "string" && a.fileId.length > 0 && a.fileId.length <= 64
|
|
614
|
+
)) {
|
|
615
|
+
throw new RuntimeHttpError(
|
|
616
|
+
400,
|
|
617
|
+
"INVALID_REQUEST",
|
|
618
|
+
'"attachments" must be an array of { fileId } objects.'
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
if (value.length > MAX_ATTACHMENTS) {
|
|
622
|
+
throw new RuntimeHttpError(
|
|
623
|
+
400,
|
|
624
|
+
"INVALID_REQUEST",
|
|
625
|
+
`At most ${MAX_ATTACHMENTS} attachments per message.`
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
return value.length > 0 ? value.map((a) => ({ fileId: a.fileId })) : void 0;
|
|
629
|
+
}
|
|
609
630
|
function parseTools(value) {
|
|
610
631
|
if (value === void 0 || value === null) return void 0;
|
|
611
632
|
if (!Array.isArray(value) || !value.every((t) => typeof t === "object" && t !== null && typeof t.name === "string")) {
|
|
@@ -647,7 +668,8 @@ function parseChatBody(body) {
|
|
|
647
668
|
// a 400 on any shape violation (not a flat string/number/boolean
|
|
648
669
|
// object, or over the byte cap) rather than coercing/dropping it.
|
|
649
670
|
context: validateTurnContext(b.context),
|
|
650
|
-
tools: parseTools(b.tools)
|
|
671
|
+
tools: parseTools(b.tools),
|
|
672
|
+
attachments: parseAttachments(b.attachments)
|
|
651
673
|
};
|
|
652
674
|
}
|
|
653
675
|
var chatRoute = async (request, ctx) => {
|
|
@@ -680,7 +702,8 @@ var chatRoute = async (request, ctx) => {
|
|
|
680
702
|
resume: body.resume,
|
|
681
703
|
contextOverride: body.contextOverride,
|
|
682
704
|
context: body.context,
|
|
683
|
-
tools: body.tools
|
|
705
|
+
tools: body.tools,
|
|
706
|
+
attachments: body.attachments
|
|
684
707
|
});
|
|
685
708
|
const runId = crypto.randomUUID();
|
|
686
709
|
logger.info("chat run created", {
|
|
@@ -1011,6 +1034,7 @@ var createAgent = async (request, ctx) => {
|
|
|
1011
1034
|
webSearchEnabled: typeof body.webSearchEnabled === "boolean" ? body.webSearchEnabled : void 0,
|
|
1012
1035
|
sandboxEnabled: typeof body.sandboxEnabled === "boolean" ? body.sandboxEnabled : void 0,
|
|
1013
1036
|
frontendToolsEnabled: typeof body.frontendToolsEnabled === "boolean" ? body.frontendToolsEnabled : void 0,
|
|
1037
|
+
imageInputEnabled: typeof body.imageInputEnabled === "boolean" ? body.imageInputEnabled : void 0,
|
|
1014
1038
|
visibility: body.visibility,
|
|
1015
1039
|
category: body.category,
|
|
1016
1040
|
skills: Array.isArray(body.skills) ? body.skills : void 0,
|