@agentvault/agentvault 0.14.6 → 0.14.7

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
@@ -46037,7 +46037,7 @@ __export(workspace_handlers_exports, {
46037
46037
  handleWorkspaceUpload: () => handleWorkspaceUpload,
46038
46038
  validateWorkspaceFilename: () => validateWorkspaceFilename
46039
46039
  });
46040
- import { readdir, readFile as readFile2, writeFile as writeFile2, rename as rename2, stat, unlink } from "node:fs/promises";
46040
+ import { readdir, readFile as readFile2, writeFile as writeFile2, rename as rename2, stat, unlink, mkdir as mkdir2 } from "node:fs/promises";
46041
46041
  import { join as join2 } from "node:path";
46042
46042
  import { randomUUID } from "node:crypto";
46043
46043
  function validateWorkspaceFilename(filename) {
@@ -46092,6 +46092,7 @@ async function handleWorkspaceUpload(data, workspaceDir) {
46092
46092
  if (!verified) {
46093
46093
  return { status: "error", error: "Invalid signature \u2014 file may have been tampered with" };
46094
46094
  }
46095
+ await mkdir2(workspaceDir, { recursive: true });
46095
46096
  const targetPath = join2(workspaceDir, data.filename);
46096
46097
  const tempPath = join2(workspaceDir, `.tmp_${randomUUID()}_${data.filename}`);
46097
46098
  try {
@@ -46172,7 +46173,7 @@ var init_workspace_handlers = __esm({
46172
46173
  import { EventEmitter } from "node:events";
46173
46174
  import { createServer } from "node:http";
46174
46175
  import { randomUUID as randomUUID2 } from "node:crypto";
46175
- import { writeFile as writeFile3, mkdir as mkdir2 } from "node:fs/promises";
46176
+ import { writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
46176
46177
  import { join as join3 } from "node:path";
46177
46178
  import { readFile as readFile3 } from "node:fs/promises";
46178
46179
  import WebSocket from "ws";
@@ -48097,7 +48098,7 @@ ${messageText}`;
48097
48098
  */
48098
48099
  async _downloadAndDecryptAttachment(info) {
48099
48100
  const attachDir = join3(this.config.dataDir, "attachments");
48100
- await mkdir2(attachDir, { recursive: true });
48101
+ await mkdir3(attachDir, { recursive: true });
48101
48102
  const url = `${this.config.apiUrl}${info.blobUrl}`;
48102
48103
  const res = await fetch(url, {
48103
48104
  headers: { Authorization: `Bearer ${this._deviceJwt}` }
@@ -48232,22 +48233,23 @@ ${messageText}`;
48232
48233
  */
48233
48234
  _resolveWorkspaceDir() {
48234
48235
  const homedir = process.env.HOME ?? process.env.USERPROFILE ?? "/tmp";
48236
+ const agentName = this.config.agentName;
48235
48237
  try {
48236
48238
  const configPath = join3(homedir, ".openclaw", "openclaw.json");
48237
48239
  const raw = __require("node:fs").readFileSync(configPath, "utf-8");
48238
48240
  const config = JSON.parse(raw);
48239
48241
  const agents = config?.agents?.list;
48240
- if (Array.isArray(agents)) {
48242
+ if (Array.isArray(agents) && agentName) {
48241
48243
  for (const agent of agents) {
48242
- if (agent.workspace && typeof agent.workspace === "string") {
48244
+ if ((agent.id === agentName || agent.name === agentName) && agent.workspace && typeof agent.workspace === "string") {
48243
48245
  return agent.workspace;
48244
48246
  }
48245
48247
  }
48246
48248
  }
48247
48249
  } catch {
48248
48250
  }
48249
- if (this.config.dataDir) {
48250
- return join3(this.config.dataDir, "..", "workspace");
48251
+ if (agentName && agentName !== "CLI Agent" && agentName !== "OpenClaw Agent") {
48252
+ return join3(homedir, ".openclaw", `workspace-${agentName}`);
48251
48253
  }
48252
48254
  return join3(homedir, ".openclaw", "workspace");
48253
48255
  }