@personaai/runtime 0.20.0 → 0.22.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.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.20.0";
410
+ declare const RUNTIME_VERSION = "0.22.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.20.0";
410
+ declare const RUNTIME_VERSION = "0.22.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.20.0";
134
+ var RUNTIME_VERSION = "0.22.0";
135
135
 
136
136
  // src/routes/health.ts
137
137
  var alwaysOnCapabilities = {
@@ -163,6 +163,17 @@ var healthRoute = async (_request, ctx) => {
163
163
  };
164
164
 
165
165
  // src/routeHelpers.ts
166
+ function parseFrontendTools(value) {
167
+ if (value === void 0 || value === null) return void 0;
168
+ if (!Array.isArray(value) || !value.every((t) => typeof t === "object" && t !== null && typeof t.name === "string")) {
169
+ throw new RuntimeHttpError(
170
+ 400,
171
+ "INVALID_REQUEST",
172
+ '"tools" must be an array of { name, description?, parameters? } objects.'
173
+ );
174
+ }
175
+ return value.length > 0 ? value : void 0;
176
+ }
166
177
  function json(status, value) {
167
178
  return {
168
179
  kind: "buffered",
@@ -599,17 +610,6 @@ function parseAttachments(value) {
599
610
  }
600
611
  return value.length > 0 ? value.map((a) => ({ fileId: a.fileId })) : void 0;
601
612
  }
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
- }
613
613
  function parseChatBody(body) {
614
614
  if (typeof body !== "object" || body === null) {
615
615
  throw new RuntimeHttpError(400, "INVALID_REQUEST", "Request body must be a JSON object.");
@@ -640,7 +640,7 @@ function parseChatBody(body) {
640
640
  // a 400 on any shape violation (not a flat string/number/boolean
641
641
  // object, or over the byte cap) rather than coercing/dropping it.
642
642
  context: validateTurnContext(b.context),
643
- tools: parseTools(b.tools),
643
+ tools: parseFrontendTools(b.tools),
644
644
  attachments: parseAttachments(b.attachments)
645
645
  };
646
646
  }
@@ -873,10 +873,12 @@ var createVoiceSession = async (request, ctx) => {
873
873
  const threadId = typeof body.threadId === "string" && body.threadId ? body.threadId : void 0;
874
874
  const contextOverride = typeof body.contextOverride === "string" && body.contextOverride ? body.contextOverride : void 0;
875
875
  const context = validateTurnContext(body.context);
876
+ const tools = parseFrontendTools(body.tools);
876
877
  const ticket = await ctx.client.voice.createSession(agentId, {
877
878
  ...threadId ? { threadId } : {},
878
879
  ...contextOverride ? { contextOverride } : {},
879
- ...context ? { context } : {}
880
+ ...context ? { context } : {},
881
+ ...tools ? { tools } : {}
880
882
  });
881
883
  await ctx.hooks?.onVoiceSessionCreate?.({
882
884
  userId: request.userId,