@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/dist/index.d.cts
CHANGED
|
@@ -113,6 +113,10 @@ interface MemoryWriteContext {
|
|
|
113
113
|
agentId?: string;
|
|
114
114
|
path: string;
|
|
115
115
|
}
|
|
116
|
+
interface VoiceSessionCreateContext {
|
|
117
|
+
userId: string;
|
|
118
|
+
agentId: string;
|
|
119
|
+
}
|
|
116
120
|
/**
|
|
117
121
|
* Lifecycle hooks — the host application's voice inside the runtime's
|
|
118
122
|
* request handling. Plain async event listeners, not middleware: the
|
|
@@ -138,6 +142,8 @@ interface RuntimeHooks {
|
|
|
138
142
|
onThreadCreate?(ctx: ThreadCreateContext): void | Promise<void>;
|
|
139
143
|
/** Fires after a memory file is written via `PUT /memory/file`. */
|
|
140
144
|
onMemoryWrite?(ctx: MemoryWriteContext): void | Promise<void>;
|
|
145
|
+
/** Fires after a voice session ticket is minted via `POST /voice/sessions`. */
|
|
146
|
+
onVoiceSessionCreate?(ctx: VoiceSessionCreateContext): void | Promise<void>;
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
/**
|
|
@@ -246,6 +252,6 @@ declare class RuntimeHttpError extends Error {
|
|
|
246
252
|
constructor(status: number, code: string, message: string);
|
|
247
253
|
}
|
|
248
254
|
|
|
249
|
-
declare const RUNTIME_VERSION = "0.5.
|
|
255
|
+
declare const RUNTIME_VERSION = "0.5.4";
|
|
250
256
|
|
|
251
|
-
export { type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type ResolveUser, 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, createRuntime };
|
|
257
|
+
export { type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type ResolveUser, 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 VoiceSessionCreateContext, createRuntime };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,10 @@ interface MemoryWriteContext {
|
|
|
113
113
|
agentId?: string;
|
|
114
114
|
path: string;
|
|
115
115
|
}
|
|
116
|
+
interface VoiceSessionCreateContext {
|
|
117
|
+
userId: string;
|
|
118
|
+
agentId: string;
|
|
119
|
+
}
|
|
116
120
|
/**
|
|
117
121
|
* Lifecycle hooks — the host application's voice inside the runtime's
|
|
118
122
|
* request handling. Plain async event listeners, not middleware: the
|
|
@@ -138,6 +142,8 @@ interface RuntimeHooks {
|
|
|
138
142
|
onThreadCreate?(ctx: ThreadCreateContext): void | Promise<void>;
|
|
139
143
|
/** Fires after a memory file is written via `PUT /memory/file`. */
|
|
140
144
|
onMemoryWrite?(ctx: MemoryWriteContext): void | Promise<void>;
|
|
145
|
+
/** Fires after a voice session ticket is minted via `POST /voice/sessions`. */
|
|
146
|
+
onVoiceSessionCreate?(ctx: VoiceSessionCreateContext): void | Promise<void>;
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
/**
|
|
@@ -246,6 +252,6 @@ declare class RuntimeHttpError extends Error {
|
|
|
246
252
|
constructor(status: number, code: string, message: string);
|
|
247
253
|
}
|
|
248
254
|
|
|
249
|
-
declare const RUNTIME_VERSION = "0.5.
|
|
255
|
+
declare const RUNTIME_VERSION = "0.5.4";
|
|
250
256
|
|
|
251
|
-
export { type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type ResolveUser, 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, createRuntime };
|
|
257
|
+
export { type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type ResolveUser, 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 VoiceSessionCreateContext, 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.5.
|
|
134
|
+
var RUNTIME_VERSION = "0.5.4";
|
|
135
135
|
|
|
136
136
|
// src/routes/health.ts
|
|
137
137
|
var alwaysOnCapabilities = {
|
|
@@ -710,6 +710,22 @@ var getThreadMessages = async (_request, ctx) => {
|
|
|
710
710
|
const messages = await ctx.client.threads.getMessages(requireParam(ctx.params, "id"));
|
|
711
711
|
return json(200, messages);
|
|
712
712
|
};
|
|
713
|
+
var resetThread = async (_request, ctx) => {
|
|
714
|
+
const thread = await ctx.client.threads.reset(requireParam(ctx.params, "id"));
|
|
715
|
+
return json(200, thread);
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
// src/routes/voice.ts
|
|
719
|
+
var createVoiceSession = async (request, ctx) => {
|
|
720
|
+
const body = requireBodyObject(request.body);
|
|
721
|
+
const agentId = requireStringField(body, "agentId");
|
|
722
|
+
const ticket = await ctx.client.voice.createSession(agentId);
|
|
723
|
+
await ctx.hooks?.onVoiceSessionCreate?.({
|
|
724
|
+
userId: request.userId,
|
|
725
|
+
agentId
|
|
726
|
+
});
|
|
727
|
+
return json(201, ticket);
|
|
728
|
+
};
|
|
713
729
|
|
|
714
730
|
// src/routes/agents.ts
|
|
715
731
|
var listAgents = async (request, ctx) => {
|
|
@@ -1251,6 +1267,11 @@ function buildRoutes(capabilities) {
|
|
|
1251
1267
|
{ method: "PATCH", pattern: ["threads", ":id"], handler: updateThread },
|
|
1252
1268
|
{ method: "DELETE", pattern: ["threads", ":id"], handler: deleteThread },
|
|
1253
1269
|
{ method: "GET", pattern: ["threads", ":id", "messages"], handler: getThreadMessages },
|
|
1270
|
+
{ method: "POST", pattern: ["threads", ":id", "reset"], handler: resetThread },
|
|
1271
|
+
// Voice — always on, end-user-scoped real-time voice sessions
|
|
1272
|
+
// (powered by Gemini Live). Mints a ticket only; the host's own
|
|
1273
|
+
// frontend opens the WebSocket directly, this runtime never proxies it.
|
|
1274
|
+
{ method: "POST", pattern: ["voice", "sessions"], handler: createVoiceSession },
|
|
1254
1275
|
// Agents — read-only discovery always on; write ops behind agentsWrite.
|
|
1255
1276
|
{ method: "GET", pattern: ["agents"], handler: listAgents },
|
|
1256
1277
|
// Files — always on, end-user-scoped uploads.
|