arkaos 4.13.0 → 4.13.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 4.13.0
1
+ 4.13.1
@@ -8,14 +8,22 @@ import {
8
8
  } from "node:fs";
9
9
  import { join, basename } from "node:path";
10
10
 
11
- // Deploys a stable snapshot of the Python core package (+ VERSION) into
11
+ // Deploys a stable snapshot of the ArkaOS root (+ VERSION) into
12
12
  // ~/.arkaos/lib. `.repo-path` points at whichever npx cache last ran an
13
13
  // install/update — a location `npm cache clean` can purge at any time.
14
14
  // When that happens, every `arka-py -m core.*` entrypoint (hooks,
15
- // /arka update, telemetry CLIs) loses the core package unless it runs
16
- // from a dev checkout. The snapshot is the always-present fallback that
15
+ // /arka update, telemetry CLIs) loses the package unless it runs from a
16
+ // dev checkout. The snapshot is the always-present fallback that
17
17
  // bin/arka-py and core/hooks/_shared.py validate against.
18
18
  //
19
+ // The snapshot must contain every directory the Python core reads
20
+ // root-relative, not just core/ itself — resolve_arkaos_root() hands the
21
+ // snapshot out as a full package root. Known readers: config/
22
+ // (content_syncer, policy_loader, settings_syncer), departments/
23
+ // (agent_provisioner), knowledge/ (registry_gen, registry/generator).
24
+ // A core/-only snapshot broke /arka update on a purged npx cache
25
+ // (v4.13.0: 75× missing user-claude.md, 704× missing agent files).
26
+ //
19
27
  // core/sync/__init__.py is the validation marker: it distinguishes the
20
28
  // full package from the cognitive scheduler's minimal core/ copy in
21
29
  // ~/.arkaos/core (cognition + workflow only).
@@ -23,31 +31,47 @@ import { join, basename } from "node:path";
23
31
  // Shared by installer/index.js (fresh install) and installer/update.js —
24
32
  // same single-implementation rationale as hook-lib.js: the v4.3.2
25
33
  // regression existed because two deploy loops drifted.
34
+ // core/ is deployed LAST: its sync/__init__.py is the validation marker
35
+ // resolve_arkaos_root() checks, so a crash mid-deploy on a fresh install
36
+ // leaves a snapshot that fails validation instead of a core-only root
37
+ // that validates but lacks config/departments/knowledge.
38
+ const SNAPSHOT_DIRS = ["config", "departments", "knowledge", "core"];
39
+
26
40
  export function deployCoreSnapshot(arkaosRoot, installDir) {
27
- const srcCore = join(arkaosRoot, "core");
28
- if (!existsSync(join(srcCore, "sync", "__init__.py"))) return false;
41
+ if (!existsSync(join(arkaosRoot, "core", "sync", "__init__.py"))) return false;
29
42
 
30
43
  const libDir = join(installDir, "lib");
31
- const destCore = join(libDir, "core");
32
- const staging = join(libDir, ".core.staging");
33
- const previous = join(libDir, ".core.previous");
44
+ for (const dir of SNAPSHOT_DIRS) {
45
+ const src = join(arkaosRoot, dir);
46
+ // Only core/ is guaranteed by the marker check above; a source
47
+ // missing an optional dir keeps whatever snapshot already exists
48
+ // rather than deleting it.
49
+ if (!existsSync(src)) continue;
50
+ swapInto(src, libDir, dir);
51
+ }
52
+
53
+ const versionFile = join(arkaosRoot, "VERSION");
54
+ if (existsSync(versionFile)) copyFileSync(versionFile, join(libDir, "VERSION"));
55
+ return true;
56
+ }
57
+
58
+ // Stage + swap so a crash at any point never destroys the last good
59
+ // snapshot: the new tree is fully written to staging first, the old
60
+ // snapshot is only moved aside (not deleted) before the swap, and its
61
+ // removal is the final step.
62
+ function swapInto(src, libDir, dir) {
63
+ const dest = join(libDir, dir);
64
+ const staging = join(libDir, `.${dir}.staging`);
65
+ const previous = join(libDir, `.${dir}.previous`);
34
66
 
35
- // Stage + swap so a crash at any point never destroys the last good
36
- // snapshot: the new tree is fully written to staging first, the old
37
- // snapshot is only moved aside (not deleted) before the swap, and its
38
- // removal is the final step.
39
67
  rmSync(staging, { recursive: true, force: true });
40
68
  rmSync(previous, { recursive: true, force: true });
41
69
  mkdirSync(staging, { recursive: true });
42
- cpSync(srcCore, staging, {
70
+ cpSync(src, staging, {
43
71
  recursive: true,
44
- filter: (src) => basename(src) !== "__pycache__",
72
+ filter: (path) => basename(path) !== "__pycache__",
45
73
  });
46
- if (existsSync(destCore)) renameSync(destCore, previous);
47
- renameSync(staging, destCore);
74
+ if (existsSync(dest)) renameSync(dest, previous);
75
+ renameSync(staging, dest);
48
76
  rmSync(previous, { recursive: true, force: true });
49
-
50
- const versionFile = join(arkaosRoot, "VERSION");
51
- if (existsSync(versionFile)) copyFileSync(versionFile, join(libDir, "VERSION"));
52
- return true;
53
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkaos",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "description": "The Operating System for AI Agent Teams",
5
5
  "type": "module",
6
6
  "bin": {
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "arkaos-core"
3
- version = "4.13.0"
3
+ version = "4.13.1"
4
4
  description = "Core engine for ArkaOS — The Operating System for AI Agent Teams"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}