@personaai/runtime 0.8.0 → 0.9.1

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
@@ -254,6 +254,26 @@ var restToolsManifestRoute = async (request, ctx) => {
254
254
  return json(200, { tools: manifest.tools });
255
255
  };
256
256
 
257
+ // src/routes/rcpManifest.ts
258
+ var rcpManifestRoute = async (request, ctx) => {
259
+ const manifest = ctx.rcpManifest;
260
+ if (!manifest) {
261
+ throw new RuntimeHttpError(404, "NOT_FOUND", "No RCP manifest is configured.");
262
+ }
263
+ if (manifest.authToken) {
264
+ const header = request.headers.authorization;
265
+ const expected = `Bearer ${manifest.authToken}`;
266
+ if (header !== expected) {
267
+ throw new RuntimeHttpError(401, "UNAUTHORIZED", "Invalid or missing manifest bearer token.");
268
+ }
269
+ }
270
+ return json(200, {
271
+ rcpVersion: "0.1",
272
+ auth: manifest.authToken ? { type: "header", header: "Authorization", scheme: "Bearer" } : { type: "none" },
273
+ tools: manifest.tools
274
+ });
275
+ };
276
+
257
277
  // src/runDriver.ts
258
278
  var import_sdk3 = require("@personaai/sdk");
259
279
  function formatSseFrame(event) {
@@ -764,7 +784,11 @@ var createVoiceSession = async (request, ctx) => {
764
784
  const body = requireBodyObject(request.body);
765
785
  const agentId = requireStringField(body, "agentId");
766
786
  const threadId = typeof body.threadId === "string" && body.threadId ? body.threadId : void 0;
767
- const ticket = await ctx.client.voice.createSession(agentId, threadId ? { threadId } : {});
787
+ const contextOverride = typeof body.contextOverride === "string" && body.contextOverride ? body.contextOverride : void 0;
788
+ const ticket = await ctx.client.voice.createSession(agentId, {
789
+ ...threadId ? { threadId } : {},
790
+ ...contextOverride ? { contextOverride } : {}
791
+ });
768
792
  await ctx.hooks?.onVoiceSessionCreate?.({
769
793
  userId: request.userId,
770
794
  agentId,
@@ -1487,6 +1511,14 @@ function createRuntime(options) {
1487
1511
  requiresAuth: false
1488
1512
  });
1489
1513
  }
1514
+ if (options.rcpManifest) {
1515
+ routes.push({
1516
+ method: "GET",
1517
+ pattern: ["rcp", "manifest"],
1518
+ handler: rcpManifestRoute,
1519
+ requiresAuth: false
1520
+ });
1521
+ }
1490
1522
  const mode = resolveMode(options);
1491
1523
  const heartbeatIntervalMs = options.heartbeatIntervalMs ?? 15e3;
1492
1524
  const runGraceMs = options.runGraceMs ?? DEFAULT_RUN_GRACE_MS;
@@ -1653,7 +1685,8 @@ function createRuntime(options) {
1653
1685
  runs,
1654
1686
  capabilities,
1655
1687
  logger: routeLogger,
1656
- restToolsManifest: options.restToolsManifest
1688
+ restToolsManifest: options.restToolsManifest,
1689
+ rcpManifest: options.rcpManifest
1657
1690
  });
1658
1691
  const durationMs = Date.now() - startMs;
1659
1692
  logger.info("handle succeeded", {