@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 CHANGED
@@ -159,7 +159,7 @@ function evictStaleRuns(runs, now, graceMs = DEFAULT_RUN_GRACE_MS, maxTracked =
159
159
  }
160
160
 
161
161
  // src/version.ts
162
- var RUNTIME_VERSION = "0.18.0";
162
+ var RUNTIME_VERSION = "0.19.0";
163
163
 
164
164
  // src/routes/health.ts
165
165
  var alwaysOnCapabilities = {
@@ -606,6 +606,17 @@ async function* withHeartbeats(source, intervalMs = 15e3) {
606
606
  }
607
607
 
608
608
  // src/routes/chat.ts
609
+ function parseTools(value) {
610
+ if (value === void 0 || value === null) return void 0;
611
+ if (!Array.isArray(value) || !value.every((t) => typeof t === "object" && t !== null && typeof t.name === "string")) {
612
+ throw new RuntimeHttpError(
613
+ 400,
614
+ "INVALID_REQUEST",
615
+ '"tools" must be an array of { name, description?, parameters? } objects.'
616
+ );
617
+ }
618
+ return value.length > 0 ? value : void 0;
619
+ }
609
620
  function parseChatBody(body) {
610
621
  if (typeof body !== "object" || body === null) {
611
622
  throw new RuntimeHttpError(400, "INVALID_REQUEST", "Request body must be a JSON object.");
@@ -635,7 +646,8 @@ function parseChatBody(body) {
635
646
  // ever read live by an RCP tool's resolver. validateTurnContext throws
636
647
  // a 400 on any shape violation (not a flat string/number/boolean
637
648
  // object, or over the byte cap) rather than coercing/dropping it.
638
- context: validateTurnContext(b.context)
649
+ context: validateTurnContext(b.context),
650
+ tools: parseTools(b.tools)
639
651
  };
640
652
  }
641
653
  var chatRoute = async (request, ctx) => {
@@ -667,7 +679,8 @@ var chatRoute = async (request, ctx) => {
667
679
  threadId: body.threadId,
668
680
  resume: body.resume,
669
681
  contextOverride: body.contextOverride,
670
- context: body.context
682
+ context: body.context,
683
+ tools: body.tools
671
684
  });
672
685
  const runId = crypto.randomUUID();
673
686
  logger.info("chat run created", {