@personaai/runtime 0.12.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.js CHANGED
@@ -979,12 +979,12 @@ var bulkDeleteFiles = async (request, ctx) => {
979
979
 
980
980
  // src/routes/memory.ts
981
981
  function requireScope(query) {
982
- const scope = query.scope === "agent" ? "agent" : query.scope === "user" ? "user" : void 0;
983
- 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) {
984
984
  throw new RuntimeHttpError(
985
985
  400,
986
986
  "INVALID_REQUEST",
987
- '"agentId" is required when scope is "agent".'
987
+ `"agentId" is required when scope is "${scope}".`
988
988
  );
989
989
  }
990
990
  return { scope, agentId: query.agentId };
@@ -1003,13 +1003,13 @@ var writeMemoryFile = async (request, ctx) => {
1003
1003
  const body = requireBodyObject(request.body);
1004
1004
  const path = requireStringField(body, "path");
1005
1005
  const content = requireStringField(body, "content");
1006
- 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;
1007
1007
  const agentId = typeof body.agentId === "string" ? body.agentId : void 0;
1008
- if (scope === "agent" && !agentId) {
1008
+ if ((scope === "agent" || scope === "workspace") && !agentId) {
1009
1009
  throw new RuntimeHttpError(
1010
1010
  400,
1011
1011
  "INVALID_REQUEST",
1012
- '"agentId" is required when scope is "agent".'
1012
+ `"agentId" is required when scope is "${scope}".`
1013
1013
  );
1014
1014
  }
1015
1015
  const file = await ctx.client.memory.writeFile({ path, content, scope, agentId });