arisa 2.3.20 → 2.3.22

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/bin/arisa.js CHANGED
@@ -3,7 +3,6 @@
3
3
  const { spawn, spawnSync } = require("node:child_process");
4
4
  const {
5
5
  closeSync,
6
- cpSync,
7
6
  existsSync,
8
7
  mkdirSync,
9
8
  openSync,
@@ -12,7 +11,7 @@ const {
12
11
  writeFileSync,
13
12
  } = require("node:fs");
14
13
  const { homedir, platform } = require("node:os");
15
- const { join, resolve } = require("node:path");
14
+ const { dirname, join, resolve } = require("node:path");
16
15
 
17
16
  const pkgRoot = resolve(__dirname, "..");
18
17
  const daemonEntry = join(pkgRoot, "src", "daemon", "index.ts");
@@ -474,10 +473,8 @@ if (isRoot() && arisaUserExists()) {
474
473
 
475
474
  // One-time migration from root's data dir
476
475
  if (existsSync(rootDataDir) && !existsSync(arisaDataDir)) {
477
- try {
478
- cpSync(rootDataDir, arisaDataDir, { recursive: true });
479
- spawnSync("chown", ["-R", "arisa:arisa", arisaDataDir], { stdio: "ignore" });
480
- } catch {}
476
+ spawnSync("cp", ["-r", rootDataDir, arisaDataDir], { stdio: "ignore" });
477
+ spawnSync("chown", ["-R", "arisa:arisa", arisaDataDir], { stdio: "ignore" });
481
478
  }
482
479
 
483
480
  // Ensure arisa data dir exists with correct ownership
@@ -486,11 +483,22 @@ if (isRoot() && arisaUserExists()) {
486
483
  spawnSync("chown", ["-R", "arisa:arisa", arisaDataDir], { stdio: "ignore" });
487
484
  }
488
485
 
489
- // Ensure arisa can read project files (Core runs as arisa with bun --watch)
486
+ // Ensure arisa can traverse to and read project files.
487
+ // When installed globally under /root/.bun/..., parent dirs are mode 700.
488
+ // Add o+x (traverse only, not read) on each ancestor so arisa can reach pkgRoot.
489
+ let traverseDir = pkgRoot;
490
+ while (traverseDir !== "/") {
491
+ spawnSync("chmod", ["o+x", traverseDir], { stdio: "ignore" });
492
+ traverseDir = dirname(traverseDir);
493
+ }
490
494
  spawnSync("chmod", ["-R", "o+rX", pkgRoot], { stdio: "ignore" });
491
495
 
492
496
  // All processes use arisa's data dir (inherited by Daemon → Core)
493
497
  process.env.ARISA_DATA_DIR = arisaDataDir;
498
+
499
+ // Permissive umask so files Daemon (root) creates at runtime in the shared
500
+ // data dir are readable/writable by Core (arisa). Safe in Docker containers.
501
+ process.umask(0o000);
494
502
  }
495
503
 
496
504
  // Then fall through to normal daemon startup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arisa",
3
- "version": "2.3.20",
3
+ "version": "2.3.22",
4
4
  "description": "Arisa - dynamic agent runtime with daemon/core architecture that evolves through user interaction",
5
5
  "keywords": [
6
6
  "tinyclaw",
@@ -15,6 +15,7 @@ import { config } from "../shared/config";
15
15
  import { createLogger } from "../shared/logger";
16
16
  import { attemptAutoFix } from "./autofix";
17
17
  import { isRunningAsRoot } from "../shared/ai-cli";
18
+ import { spawnSync } from "child_process";
18
19
  import { join } from "path";
19
20
 
20
21
  const log = createLogger("daemon");
@@ -126,6 +127,10 @@ export function startCore() {
126
127
  // (tokens, ARISA_DATA_DIR, API keys). We only override HOME/BUN/PATH.
127
128
  let cmd: string[];
128
129
  if (isRunningAsRoot()) {
130
+ // Ensure arisa owns all data dir files created during Daemon init
131
+ // (encryption keys, DB, PID files, etc.) before Core reads them.
132
+ spawnSync("chown", ["-R", "arisa:arisa", config.arisaDir], { stdio: "ignore" });
133
+
129
134
  const bunEnv = "export HOME=/home/arisa && export BUN_INSTALL=/home/arisa/.bun && export PATH=/home/arisa/.bun/bin:$PATH";
130
135
  const inner = `${bunEnv} && cd ${config.projectDir} && exec bun --watch ${coreEntry}`;
131
136
  cmd = ["su", "arisa", "-s", "/bin/bash", "-c", inner];