@personaai/runtime 0.5.4 → 0.7.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/README.md +8 -1
- package/dist/index.cjs +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +71 -71
package/README.md
CHANGED
|
@@ -91,6 +91,8 @@ user; `resolveUser` returning `null` or throwing responds `401`.
|
|
|
91
91
|
| `PATCH` | `/threads/:id` | `client.threads.update(id, {title?, isArchived?})` |
|
|
92
92
|
| `DELETE` | `/threads/:id` | `client.threads.delete(id)` → `204` |
|
|
93
93
|
| `GET` | `/threads/:id/messages` | `client.threads.getMessages(id)` — full history + graph state, the same data `chat.stream()` resumes from; load a past conversation on page reopen. |
|
|
94
|
+
| `POST` | `/threads/:id/reset` | `client.threads.reset(id)` — clears message history/files/todos/subagent traces in place, keeping the same Thread id/title. |
|
|
95
|
+
| `POST` | `/voice/sessions` | `client.voice.createSession(agentId)` → `{ticket, wsUrl, expiresAt, session}`. `agentId` required in the body. This route only mints the ticket — your frontend takes `wsUrl` (ticket already embedded) and opens `new WebSocket(wsUrl)` **directly to Persona**, not back through this runtime. Real-time audio, powered by Gemini Live. `201` |
|
|
94
96
|
| `GET` | `/agents` | `client.agents.list({page, limit, search, category, scope})` — read-only discovery, e.g. "let the user pick an agent." |
|
|
95
97
|
| `GET` | `/files` | `client.files.list({page, limit})` |
|
|
96
98
|
| `POST` | `/files` | `client.files.upload({filename, content, contentType?, agentId?, threadId?})` — multipart, `file` part required. `201` |
|
|
@@ -229,7 +231,7 @@ resolved identity, is the capability on."
|
|
|
229
231
|
|
|
230
232
|
Plain async event listeners, not middleware — the runtime proceeds with sensible defaults when a
|
|
231
233
|
hook is omitted, and a hook that wants to reject a run just throws (the throw is caught and
|
|
232
|
-
routed through the same sanitized error response as any other failure). **All
|
|
234
|
+
routed through the same sanitized error response as any other failure). **All nine are wired.**
|
|
233
235
|
|
|
234
236
|
```ts
|
|
235
237
|
createRuntime({
|
|
@@ -272,6 +274,11 @@ createRuntime({
|
|
|
272
274
|
onMemoryWrite(ctx) {
|
|
273
275
|
// ctx: { userId, agentId?, path } — fires after PUT /memory/file succeeds.
|
|
274
276
|
},
|
|
277
|
+
onVoiceSessionCreate(ctx) {
|
|
278
|
+
// ctx: { userId, agentId } — fires after POST /voice/sessions mints a
|
|
279
|
+
// ticket. Note this only covers the mint; the actual call happens on
|
|
280
|
+
// a direct browser-to-Persona WebSocket this runtime never sees.
|
|
281
|
+
},
|
|
275
282
|
},
|
|
276
283
|
});
|
|
277
284
|
```
|
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.5.
|
|
162
|
+
var RUNTIME_VERSION = "0.5.4";
|
|
163
163
|
|
|
164
164
|
// src/routes/health.ts
|
|
165
165
|
var alwaysOnCapabilities = {
|
|
@@ -738,6 +738,22 @@ var getThreadMessages = async (_request, ctx) => {
|
|
|
738
738
|
const messages = await ctx.client.threads.getMessages(requireParam(ctx.params, "id"));
|
|
739
739
|
return json(200, messages);
|
|
740
740
|
};
|
|
741
|
+
var resetThread = async (_request, ctx) => {
|
|
742
|
+
const thread = await ctx.client.threads.reset(requireParam(ctx.params, "id"));
|
|
743
|
+
return json(200, thread);
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
// src/routes/voice.ts
|
|
747
|
+
var createVoiceSession = async (request, ctx) => {
|
|
748
|
+
const body = requireBodyObject(request.body);
|
|
749
|
+
const agentId = requireStringField(body, "agentId");
|
|
750
|
+
const ticket = await ctx.client.voice.createSession(agentId);
|
|
751
|
+
await ctx.hooks?.onVoiceSessionCreate?.({
|
|
752
|
+
userId: request.userId,
|
|
753
|
+
agentId
|
|
754
|
+
});
|
|
755
|
+
return json(201, ticket);
|
|
756
|
+
};
|
|
741
757
|
|
|
742
758
|
// src/routes/agents.ts
|
|
743
759
|
var listAgents = async (request, ctx) => {
|
|
@@ -1279,6 +1295,11 @@ function buildRoutes(capabilities) {
|
|
|
1279
1295
|
{ method: "PATCH", pattern: ["threads", ":id"], handler: updateThread },
|
|
1280
1296
|
{ method: "DELETE", pattern: ["threads", ":id"], handler: deleteThread },
|
|
1281
1297
|
{ method: "GET", pattern: ["threads", ":id", "messages"], handler: getThreadMessages },
|
|
1298
|
+
{ method: "POST", pattern: ["threads", ":id", "reset"], handler: resetThread },
|
|
1299
|
+
// Voice — always on, end-user-scoped real-time voice sessions
|
|
1300
|
+
// (powered by Gemini Live). Mints a ticket only; the host's own
|
|
1301
|
+
// frontend opens the WebSocket directly, this runtime never proxies it.
|
|
1302
|
+
{ method: "POST", pattern: ["voice", "sessions"], handler: createVoiceSession },
|
|
1282
1303
|
// Agents — read-only discovery always on; write ops behind agentsWrite.
|
|
1283
1304
|
{ method: "GET", pattern: ["agents"], handler: listAgents },
|
|
1284
1305
|
// Files — always on, end-user-scoped uploads.
|