@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.d.cts
CHANGED
|
@@ -407,6 +407,6 @@ declare class RuntimeHttpError extends Error {
|
|
|
407
407
|
constructor(status: number, code: string, message: string);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
declare const RUNTIME_VERSION = "0.
|
|
410
|
+
declare const RUNTIME_VERSION = "0.20.0";
|
|
411
411
|
|
|
412
412
|
export { type ChannelsOptions, type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type RcpManifestOptions, type ResolveTwilioChannelUser, type ResolveUser, type RestToolManifestEntry, type RestToolsManifestOptions, type RunContext, type RunResult, type Runtime, type RuntimeBinaryResponse, type RuntimeBufferedResponse, type RuntimeCapabilities, type RuntimeHooks, RuntimeHttpError, type RuntimeMethod, type RuntimeRequest, type RuntimeResponse, type RuntimeStreamResponse, type RuntimeUploadedFile, type ThreadCreateContext, type ToolCallContext, type TwilioChannelOptions, type TwilioChannelRequest, type TwilioChannelUser, type VoiceSessionCreateContext, type WorkflowNodeContext, createRuntime };
|
package/dist/index.d.ts
CHANGED
|
@@ -407,6 +407,6 @@ declare class RuntimeHttpError extends Error {
|
|
|
407
407
|
constructor(status: number, code: string, message: string);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
declare const RUNTIME_VERSION = "0.
|
|
410
|
+
declare const RUNTIME_VERSION = "0.20.0";
|
|
411
411
|
|
|
412
412
|
export { type ChannelsOptions, type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type RcpManifestOptions, type ResolveTwilioChannelUser, type ResolveUser, type RestToolManifestEntry, type RestToolsManifestOptions, type RunContext, type RunResult, type Runtime, type RuntimeBinaryResponse, type RuntimeBufferedResponse, type RuntimeCapabilities, type RuntimeHooks, RuntimeHttpError, type RuntimeMethod, type RuntimeRequest, type RuntimeResponse, type RuntimeStreamResponse, type RuntimeUploadedFile, type ThreadCreateContext, type ToolCallContext, type TwilioChannelOptions, type TwilioChannelRequest, type TwilioChannelUser, type VoiceSessionCreateContext, type WorkflowNodeContext, createRuntime };
|
package/dist/index.js
CHANGED
|
@@ -131,7 +131,7 @@ function evictStaleRuns(runs, now, graceMs = DEFAULT_RUN_GRACE_MS, maxTracked =
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// src/version.ts
|
|
134
|
-
var RUNTIME_VERSION = "0.
|
|
134
|
+
var RUNTIME_VERSION = "0.20.0";
|
|
135
135
|
|
|
136
136
|
// src/routes/health.ts
|
|
137
137
|
var alwaysOnCapabilities = {
|
|
@@ -578,6 +578,27 @@ async function* withHeartbeats(source, intervalMs = 15e3) {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
// src/routes/chat.ts
|
|
581
|
+
var MAX_ATTACHMENTS = 4;
|
|
582
|
+
function parseAttachments(value) {
|
|
583
|
+
if (value === void 0 || value === null) return void 0;
|
|
584
|
+
if (!Array.isArray(value) || !value.every(
|
|
585
|
+
(a) => typeof a === "object" && a !== null && typeof a.fileId === "string" && a.fileId.length > 0 && a.fileId.length <= 64
|
|
586
|
+
)) {
|
|
587
|
+
throw new RuntimeHttpError(
|
|
588
|
+
400,
|
|
589
|
+
"INVALID_REQUEST",
|
|
590
|
+
'"attachments" must be an array of { fileId } objects.'
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
if (value.length > MAX_ATTACHMENTS) {
|
|
594
|
+
throw new RuntimeHttpError(
|
|
595
|
+
400,
|
|
596
|
+
"INVALID_REQUEST",
|
|
597
|
+
`At most ${MAX_ATTACHMENTS} attachments per message.`
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
return value.length > 0 ? value.map((a) => ({ fileId: a.fileId })) : void 0;
|
|
601
|
+
}
|
|
581
602
|
function parseTools(value) {
|
|
582
603
|
if (value === void 0 || value === null) return void 0;
|
|
583
604
|
if (!Array.isArray(value) || !value.every((t) => typeof t === "object" && t !== null && typeof t.name === "string")) {
|
|
@@ -619,7 +640,8 @@ function parseChatBody(body) {
|
|
|
619
640
|
// a 400 on any shape violation (not a flat string/number/boolean
|
|
620
641
|
// object, or over the byte cap) rather than coercing/dropping it.
|
|
621
642
|
context: validateTurnContext(b.context),
|
|
622
|
-
tools: parseTools(b.tools)
|
|
643
|
+
tools: parseTools(b.tools),
|
|
644
|
+
attachments: parseAttachments(b.attachments)
|
|
623
645
|
};
|
|
624
646
|
}
|
|
625
647
|
var chatRoute = async (request, ctx) => {
|
|
@@ -652,7 +674,8 @@ var chatRoute = async (request, ctx) => {
|
|
|
652
674
|
resume: body.resume,
|
|
653
675
|
contextOverride: body.contextOverride,
|
|
654
676
|
context: body.context,
|
|
655
|
-
tools: body.tools
|
|
677
|
+
tools: body.tools,
|
|
678
|
+
attachments: body.attachments
|
|
656
679
|
});
|
|
657
680
|
const runId = crypto.randomUUID();
|
|
658
681
|
logger.info("chat run created", {
|
|
@@ -983,6 +1006,7 @@ var createAgent = async (request, ctx) => {
|
|
|
983
1006
|
webSearchEnabled: typeof body.webSearchEnabled === "boolean" ? body.webSearchEnabled : void 0,
|
|
984
1007
|
sandboxEnabled: typeof body.sandboxEnabled === "boolean" ? body.sandboxEnabled : void 0,
|
|
985
1008
|
frontendToolsEnabled: typeof body.frontendToolsEnabled === "boolean" ? body.frontendToolsEnabled : void 0,
|
|
1009
|
+
imageInputEnabled: typeof body.imageInputEnabled === "boolean" ? body.imageInputEnabled : void 0,
|
|
986
1010
|
visibility: body.visibility,
|
|
987
1011
|
category: body.category,
|
|
988
1012
|
skills: Array.isArray(body.skills) ? body.skills : void 0,
|