@personaai/runtime 0.19.0 → 0.21.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.19.0";
410
+ declare const RUNTIME_VERSION = "0.21.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.19.0";
410
+ declare const RUNTIME_VERSION = "0.21.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.19.0";
134
+ var RUNTIME_VERSION = "0.21.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",
@@ -578,16 +589,26 @@ async function* withHeartbeats(source, intervalMs = 15e3) {
578
589
  }
579
590
 
580
591
  // src/routes/chat.ts
581
- function parseTools(value) {
592
+ var MAX_ATTACHMENTS = 4;
593
+ function parseAttachments(value) {
582
594
  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")) {
595
+ if (!Array.isArray(value) || !value.every(
596
+ (a) => typeof a === "object" && a !== null && typeof a.fileId === "string" && a.fileId.length > 0 && a.fileId.length <= 64
597
+ )) {
584
598
  throw new RuntimeHttpError(
585
599
  400,
586
600
  "INVALID_REQUEST",
587
- '"tools" must be an array of { name, description?, parameters? } objects.'
601
+ '"attachments" must be an array of { fileId } objects.'
588
602
  );
589
603
  }
590
- return value.length > 0 ? value : void 0;
604
+ if (value.length > MAX_ATTACHMENTS) {
605
+ throw new RuntimeHttpError(
606
+ 400,
607
+ "INVALID_REQUEST",
608
+ `At most ${MAX_ATTACHMENTS} attachments per message.`
609
+ );
610
+ }
611
+ return value.length > 0 ? value.map((a) => ({ fileId: a.fileId })) : void 0;
591
612
  }
592
613
  function parseChatBody(body) {
593
614
  if (typeof body !== "object" || body === null) {
@@ -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: parseFrontendTools(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", {
@@ -850,10 +873,12 @@ var createVoiceSession = async (request, ctx) => {
850
873
  const threadId = typeof body.threadId === "string" && body.threadId ? body.threadId : void 0;
851
874
  const contextOverride = typeof body.contextOverride === "string" && body.contextOverride ? body.contextOverride : void 0;
852
875
  const context = validateTurnContext(body.context);
876
+ const tools = parseFrontendTools(body.tools);
853
877
  const ticket = await ctx.client.voice.createSession(agentId, {
854
878
  ...threadId ? { threadId } : {},
855
879
  ...contextOverride ? { contextOverride } : {},
856
- ...context ? { context } : {}
880
+ ...context ? { context } : {},
881
+ ...tools ? { tools } : {}
857
882
  });
858
883
  await ctx.hooks?.onVoiceSessionCreate?.({
859
884
  userId: request.userId,
@@ -983,6 +1008,7 @@ var createAgent = async (request, ctx) => {
983
1008
  webSearchEnabled: typeof body.webSearchEnabled === "boolean" ? body.webSearchEnabled : void 0,
984
1009
  sandboxEnabled: typeof body.sandboxEnabled === "boolean" ? body.sandboxEnabled : void 0,
985
1010
  frontendToolsEnabled: typeof body.frontendToolsEnabled === "boolean" ? body.frontendToolsEnabled : void 0,
1011
+ imageInputEnabled: typeof body.imageInputEnabled === "boolean" ? body.imageInputEnabled : void 0,
986
1012
  visibility: body.visibility,
987
1013
  category: body.category,
988
1014
  skills: Array.isArray(body.skills) ? body.skills : void 0,