@personaai/runtime 0.13.0 → 0.14.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 +6 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -31
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -829,27 +829,6 @@ var resetThread = async (_request, ctx) => {
|
|
|
829
829
|
const thread = await ctx.client.threads.reset(requireParam(ctx.params, "id"));
|
|
830
830
|
return json(200, thread);
|
|
831
831
|
};
|
|
832
|
-
var listThreadFiles = async (_request, ctx) => {
|
|
833
|
-
const files = await ctx.client.threads.listFiles(requireParam(ctx.params, "id"));
|
|
834
|
-
return json(200, files);
|
|
835
|
-
};
|
|
836
|
-
var getThreadFile = async (request, ctx) => {
|
|
837
|
-
const path = requireQueryParam(request.query, "path");
|
|
838
|
-
const file = await ctx.client.threads.getFile(requireParam(ctx.params, "id"), path);
|
|
839
|
-
return json(200, file);
|
|
840
|
-
};
|
|
841
|
-
var writeThreadFile = async (request, ctx) => {
|
|
842
|
-
const body = requireBodyObject(request.body);
|
|
843
|
-
const path = requireStringField(body, "path");
|
|
844
|
-
const content = requireStringField(body, "content");
|
|
845
|
-
const file = await ctx.client.threads.writeFile(requireParam(ctx.params, "id"), path, content);
|
|
846
|
-
return json(200, file);
|
|
847
|
-
};
|
|
848
|
-
var deleteThreadFile = async (request, ctx) => {
|
|
849
|
-
const path = requireQueryParam(request.query, "path");
|
|
850
|
-
await ctx.client.threads.deleteFile(requireParam(ctx.params, "id"), path);
|
|
851
|
-
return noContent();
|
|
852
|
-
};
|
|
853
832
|
|
|
854
833
|
// src/routes/voice.ts
|
|
855
834
|
var createVoiceSession = async (request, ctx) => {
|
|
@@ -1000,12 +979,12 @@ var bulkDeleteFiles = async (request, ctx) => {
|
|
|
1000
979
|
|
|
1001
980
|
// src/routes/memory.ts
|
|
1002
981
|
function requireScope(query) {
|
|
1003
|
-
const scope = query.scope === "agent" ? "agent" : query.scope === "user" ? "user" : void 0;
|
|
1004
|
-
if (scope === "agent" && !query.agentId) {
|
|
982
|
+
const scope = query.scope === "agent" ? "agent" : query.scope === "workspace" ? "workspace" : query.scope === "user" ? "user" : void 0;
|
|
983
|
+
if ((scope === "agent" || scope === "workspace") && !query.agentId) {
|
|
1005
984
|
throw new RuntimeHttpError(
|
|
1006
985
|
400,
|
|
1007
986
|
"INVALID_REQUEST",
|
|
1008
|
-
|
|
987
|
+
`"agentId" is required when scope is "${scope}".`
|
|
1009
988
|
);
|
|
1010
989
|
}
|
|
1011
990
|
return { scope, agentId: query.agentId };
|
|
@@ -1024,13 +1003,13 @@ var writeMemoryFile = async (request, ctx) => {
|
|
|
1024
1003
|
const body = requireBodyObject(request.body);
|
|
1025
1004
|
const path = requireStringField(body, "path");
|
|
1026
1005
|
const content = requireStringField(body, "content");
|
|
1027
|
-
const scope = body.scope === "agent" ? "agent" : body.scope === "user" ? "user" : void 0;
|
|
1006
|
+
const scope = body.scope === "agent" ? "agent" : body.scope === "workspace" ? "workspace" : body.scope === "user" ? "user" : void 0;
|
|
1028
1007
|
const agentId = typeof body.agentId === "string" ? body.agentId : void 0;
|
|
1029
|
-
if (scope === "agent" && !agentId) {
|
|
1008
|
+
if ((scope === "agent" || scope === "workspace") && !agentId) {
|
|
1030
1009
|
throw new RuntimeHttpError(
|
|
1031
1010
|
400,
|
|
1032
1011
|
"INVALID_REQUEST",
|
|
1033
|
-
|
|
1012
|
+
`"agentId" is required when scope is "${scope}".`
|
|
1034
1013
|
);
|
|
1035
1014
|
}
|
|
1036
1015
|
const file = await ctx.client.memory.writeFile({ path, content, scope, agentId });
|
|
@@ -1618,10 +1597,6 @@ function buildRoutes(capabilities) {
|
|
|
1618
1597
|
{ method: "DELETE", pattern: ["threads", ":id"], handler: deleteThread },
|
|
1619
1598
|
{ method: "GET", pattern: ["threads", ":id", "messages"], handler: getThreadMessages },
|
|
1620
1599
|
{ method: "POST", pattern: ["threads", ":id", "reset"], handler: resetThread },
|
|
1621
|
-
{ method: "GET", pattern: ["threads", ":id", "files"], handler: listThreadFiles },
|
|
1622
|
-
{ method: "GET", pattern: ["threads", ":id", "file"], handler: getThreadFile },
|
|
1623
|
-
{ method: "PUT", pattern: ["threads", ":id", "file"], handler: writeThreadFile },
|
|
1624
|
-
{ method: "DELETE", pattern: ["threads", ":id", "file"], handler: deleteThreadFile },
|
|
1625
1600
|
// Voice — always on, end-user-scoped real-time voice sessions
|
|
1626
1601
|
// (powered by Gemini Live). Mints a ticket only; the host's own
|
|
1627
1602
|
// frontend opens the WebSocket directly, this runtime never proxies it.
|