@personaai/runtime 0.18.0 → 0.19.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 +16 -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 +16 -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.19.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.19.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.19.0";
|
|
135
135
|
|
|
136
136
|
// src/routes/health.ts
|
|
137
137
|
var alwaysOnCapabilities = {
|
|
@@ -578,6 +578,17 @@ async function* withHeartbeats(source, intervalMs = 15e3) {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
// src/routes/chat.ts
|
|
581
|
+
function parseTools(value) {
|
|
582
|
+
if (value === void 0 || value === null) return void 0;
|
|
583
|
+
if (!Array.isArray(value) || !value.every((t) => typeof t === "object" && t !== null && typeof t.name === "string")) {
|
|
584
|
+
throw new RuntimeHttpError(
|
|
585
|
+
400,
|
|
586
|
+
"INVALID_REQUEST",
|
|
587
|
+
'"tools" must be an array of { name, description?, parameters? } objects.'
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
return value.length > 0 ? value : void 0;
|
|
591
|
+
}
|
|
581
592
|
function parseChatBody(body) {
|
|
582
593
|
if (typeof body !== "object" || body === null) {
|
|
583
594
|
throw new RuntimeHttpError(400, "INVALID_REQUEST", "Request body must be a JSON object.");
|
|
@@ -607,7 +618,8 @@ function parseChatBody(body) {
|
|
|
607
618
|
// ever read live by an RCP tool's resolver. validateTurnContext throws
|
|
608
619
|
// a 400 on any shape violation (not a flat string/number/boolean
|
|
609
620
|
// object, or over the byte cap) rather than coercing/dropping it.
|
|
610
|
-
context: validateTurnContext(b.context)
|
|
621
|
+
context: validateTurnContext(b.context),
|
|
622
|
+
tools: parseTools(b.tools)
|
|
611
623
|
};
|
|
612
624
|
}
|
|
613
625
|
var chatRoute = async (request, ctx) => {
|
|
@@ -639,7 +651,8 @@ var chatRoute = async (request, ctx) => {
|
|
|
639
651
|
threadId: body.threadId,
|
|
640
652
|
resume: body.resume,
|
|
641
653
|
contextOverride: body.contextOverride,
|
|
642
|
-
context: body.context
|
|
654
|
+
context: body.context,
|
|
655
|
+
tools: body.tools
|
|
643
656
|
});
|
|
644
657
|
const runId = crypto.randomUUID();
|
|
645
658
|
logger.info("chat run created", {
|