@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.cjs
CHANGED
|
@@ -857,27 +857,6 @@ var resetThread = async (_request, ctx) => {
|
|
|
857
857
|
const thread = await ctx.client.threads.reset(requireParam(ctx.params, "id"));
|
|
858
858
|
return json(200, thread);
|
|
859
859
|
};
|
|
860
|
-
var listThreadFiles = async (_request, ctx) => {
|
|
861
|
-
const files = await ctx.client.threads.listFiles(requireParam(ctx.params, "id"));
|
|
862
|
-
return json(200, files);
|
|
863
|
-
};
|
|
864
|
-
var getThreadFile = async (request, ctx) => {
|
|
865
|
-
const path = requireQueryParam(request.query, "path");
|
|
866
|
-
const file = await ctx.client.threads.getFile(requireParam(ctx.params, "id"), path);
|
|
867
|
-
return json(200, file);
|
|
868
|
-
};
|
|
869
|
-
var writeThreadFile = async (request, ctx) => {
|
|
870
|
-
const body = requireBodyObject(request.body);
|
|
871
|
-
const path = requireStringField(body, "path");
|
|
872
|
-
const content = requireStringField(body, "content");
|
|
873
|
-
const file = await ctx.client.threads.writeFile(requireParam(ctx.params, "id"), path, content);
|
|
874
|
-
return json(200, file);
|
|
875
|
-
};
|
|
876
|
-
var deleteThreadFile = async (request, ctx) => {
|
|
877
|
-
const path = requireQueryParam(request.query, "path");
|
|
878
|
-
await ctx.client.threads.deleteFile(requireParam(ctx.params, "id"), path);
|
|
879
|
-
return noContent();
|
|
880
|
-
};
|
|
881
860
|
|
|
882
861
|
// src/routes/voice.ts
|
|
883
862
|
var createVoiceSession = async (request, ctx) => {
|
|
@@ -1028,12 +1007,12 @@ var bulkDeleteFiles = async (request, ctx) => {
|
|
|
1028
1007
|
|
|
1029
1008
|
// src/routes/memory.ts
|
|
1030
1009
|
function requireScope(query) {
|
|
1031
|
-
const scope = query.scope === "agent" ? "agent" : query.scope === "user" ? "user" : void 0;
|
|
1032
|
-
if (scope === "agent" && !query.agentId) {
|
|
1010
|
+
const scope = query.scope === "agent" ? "agent" : query.scope === "workspace" ? "workspace" : query.scope === "user" ? "user" : void 0;
|
|
1011
|
+
if ((scope === "agent" || scope === "workspace") && !query.agentId) {
|
|
1033
1012
|
throw new RuntimeHttpError(
|
|
1034
1013
|
400,
|
|
1035
1014
|
"INVALID_REQUEST",
|
|
1036
|
-
|
|
1015
|
+
`"agentId" is required when scope is "${scope}".`
|
|
1037
1016
|
);
|
|
1038
1017
|
}
|
|
1039
1018
|
return { scope, agentId: query.agentId };
|
|
@@ -1052,13 +1031,13 @@ var writeMemoryFile = async (request, ctx) => {
|
|
|
1052
1031
|
const body = requireBodyObject(request.body);
|
|
1053
1032
|
const path = requireStringField(body, "path");
|
|
1054
1033
|
const content = requireStringField(body, "content");
|
|
1055
|
-
const scope = body.scope === "agent" ? "agent" : body.scope === "user" ? "user" : void 0;
|
|
1034
|
+
const scope = body.scope === "agent" ? "agent" : body.scope === "workspace" ? "workspace" : body.scope === "user" ? "user" : void 0;
|
|
1056
1035
|
const agentId = typeof body.agentId === "string" ? body.agentId : void 0;
|
|
1057
|
-
if (scope === "agent" && !agentId) {
|
|
1036
|
+
if ((scope === "agent" || scope === "workspace") && !agentId) {
|
|
1058
1037
|
throw new RuntimeHttpError(
|
|
1059
1038
|
400,
|
|
1060
1039
|
"INVALID_REQUEST",
|
|
1061
|
-
|
|
1040
|
+
`"agentId" is required when scope is "${scope}".`
|
|
1062
1041
|
);
|
|
1063
1042
|
}
|
|
1064
1043
|
const file = await ctx.client.memory.writeFile({ path, content, scope, agentId });
|
|
@@ -1646,10 +1625,6 @@ function buildRoutes(capabilities) {
|
|
|
1646
1625
|
{ method: "DELETE", pattern: ["threads", ":id"], handler: deleteThread },
|
|
1647
1626
|
{ method: "GET", pattern: ["threads", ":id", "messages"], handler: getThreadMessages },
|
|
1648
1627
|
{ method: "POST", pattern: ["threads", ":id", "reset"], handler: resetThread },
|
|
1649
|
-
{ method: "GET", pattern: ["threads", ":id", "files"], handler: listThreadFiles },
|
|
1650
|
-
{ method: "GET", pattern: ["threads", ":id", "file"], handler: getThreadFile },
|
|
1651
|
-
{ method: "PUT", pattern: ["threads", ":id", "file"], handler: writeThreadFile },
|
|
1652
|
-
{ method: "DELETE", pattern: ["threads", ":id", "file"], handler: deleteThreadFile },
|
|
1653
1628
|
// Voice — always on, end-user-scoped real-time voice sessions
|
|
1654
1629
|
// (powered by Gemini Live). Mints a ticket only; the host's own
|
|
1655
1630
|
// frontend opens the WebSocket directly, this runtime never proxies it.
|