@openclaw-cloud/agent-controller 0.2.3 → 0.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw-cloud/agent-controller",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,9 +1,14 @@
1
1
  import { exec } from 'node:child_process';
2
2
  import fs from 'node:fs/promises';
3
+ import os from 'node:os';
3
4
  import path from 'node:path';
4
5
  import type { AgentCommand, AgentResponse } from '../types.js';
5
6
 
6
- const WORKSPACE_DIR = '/home/node/.openclaw/workspace';
7
+ function getWorkspaceDir(): string {
8
+ const stateDir = process.env.OPENCLAW_STATE_DIR?.trim() ?? path.join(os.homedir(), '.openclaw');
9
+ return path.join(stateDir, 'workspace');
10
+ }
11
+
7
12
  const BACKUP_DIR = '/tmp';
8
13
  const TAR_TIMEOUT = 120_000;
9
14
  const UPLOAD_TIMEOUT = 120_000;
@@ -47,9 +52,10 @@ export function handleBackup(command: AgentCommand): Promise<AgentResponse> {
47
52
  }
48
53
 
49
54
  function createArchive(archivePath: string): Promise<void> {
55
+ const workspaceDir = getWorkspaceDir();
50
56
  return new Promise((resolve, reject) => {
51
57
  exec(
52
- `tar -czf ${archivePath} -C ${path.dirname(WORKSPACE_DIR)} ${path.basename(WORKSPACE_DIR)}`,
58
+ `tar -czf ${archivePath} -C ${path.dirname(workspaceDir)} ${path.basename(workspaceDir)}`,
53
59
  { timeout: TAR_TIMEOUT },
54
60
  (error, _stdout, stderr) => {
55
61
  if (error) {