@personaai/runtime 0.18.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 +40 -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 +40 -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,38 @@ 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
|
+
}
|
|
602
|
+
function parseTools(value) {
|
|
603
|
+
if (value === void 0 || value === null) return void 0;
|
|
604
|
+
if (!Array.isArray(value) || !value.every((t) => typeof t === "object" && t !== null && typeof t.name === "string")) {
|
|
605
|
+
throw new RuntimeHttpError(
|
|
606
|
+
400,
|
|
607
|
+
"INVALID_REQUEST",
|
|
608
|
+
'"tools" must be an array of { name, description?, parameters? } objects.'
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
return value.length > 0 ? value : void 0;
|
|
612
|
+
}
|
|
581
613
|
function parseChatBody(body) {
|
|
582
614
|
if (typeof body !== "object" || body === null) {
|
|
583
615
|
throw new RuntimeHttpError(400, "INVALID_REQUEST", "Request body must be a JSON object.");
|
|
@@ -607,7 +639,9 @@ function parseChatBody(body) {
|
|
|
607
639
|
// ever read live by an RCP tool's resolver. validateTurnContext throws
|
|
608
640
|
// a 400 on any shape violation (not a flat string/number/boolean
|
|
609
641
|
// object, or over the byte cap) rather than coercing/dropping it.
|
|
610
|
-
context: validateTurnContext(b.context)
|
|
642
|
+
context: validateTurnContext(b.context),
|
|
643
|
+
tools: parseTools(b.tools),
|
|
644
|
+
attachments: parseAttachments(b.attachments)
|
|
611
645
|
};
|
|
612
646
|
}
|
|
613
647
|
var chatRoute = async (request, ctx) => {
|
|
@@ -639,7 +673,9 @@ var chatRoute = async (request, ctx) => {
|
|
|
639
673
|
threadId: body.threadId,
|
|
640
674
|
resume: body.resume,
|
|
641
675
|
contextOverride: body.contextOverride,
|
|
642
|
-
context: body.context
|
|
676
|
+
context: body.context,
|
|
677
|
+
tools: body.tools,
|
|
678
|
+
attachments: body.attachments
|
|
643
679
|
});
|
|
644
680
|
const runId = crypto.randomUUID();
|
|
645
681
|
logger.info("chat run created", {
|
|
@@ -970,6 +1006,7 @@ var createAgent = async (request, ctx) => {
|
|
|
970
1006
|
webSearchEnabled: typeof body.webSearchEnabled === "boolean" ? body.webSearchEnabled : void 0,
|
|
971
1007
|
sandboxEnabled: typeof body.sandboxEnabled === "boolean" ? body.sandboxEnabled : void 0,
|
|
972
1008
|
frontendToolsEnabled: typeof body.frontendToolsEnabled === "boolean" ? body.frontendToolsEnabled : void 0,
|
|
1009
|
+
imageInputEnabled: typeof body.imageInputEnabled === "boolean" ? body.imageInputEnabled : void 0,
|
|
973
1010
|
visibility: body.visibility,
|
|
974
1011
|
category: body.category,
|
|
975
1012
|
skills: Array.isArray(body.skills) ? body.skills : void 0,
|