@xenosystem/primitives 0.2.2 → 0.3.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/README.md CHANGED
@@ -10,6 +10,16 @@ XENO back-end rung 1. Two families, one subpath each:
10
10
 
11
11
  Authority: `XENO LOCAL HOME - SPEC.md` (LOCKED). Zero runtime dependencies. Proprietary (`UNLICENSED`).
12
12
 
13
+ **Where it lives (0.3.0, owner 2026-10-25):** `~/.xeno/{config,data,secrets,state,cache,run}` on every OS — on Windows
14
+ `C:\Users\<name>\.xeno`. `XENO_HOME=<absolute path>` moves the whole folder. Platform folders (`APPDATA`,
15
+ `LOCALAPPDATA`, `XDG_*`, `TMPDIR`) no longer place anything; 0.1.x–0.2.x used them, and `xeno-home migrate` copies what
16
+ those versions wrote into `~/.xeno` (config, data, secrets and state; cache and run are reported, not copied; links are
17
+ never followed). `resolvePlatformNativeRoots` names the old locations for a product's own migration.
18
+
19
+ **Tree rules (0.3.1):** a product's migration rule may match a whole directory — `match: 'plugins/**'` with target
20
+ segments `['plugins', '{path}']` copies every file below `plugins/`, keeping the structure. Links inside are refused;
21
+ the rule must copy and name the remainder with exactly one `{path}` segment.
22
+
13
23
  ```ts
14
24
  import { createDirs } from '@xenosystem/primitives/dirs';
15
25
  import { createSecretStore, createOsKeyStore } from '@xenosystem/primitives/secrets';
@@ -6,7 +6,9 @@
6
6
  * homedir-call a call that asks the OS for the home directory (homedir(), home_dir(), Path.home(), UserHomeDir())
7
7
  * platform-dir-read reading HOME, USERPROFILE, APPDATA, LOCALAPPDATA or XDG_* from the environment to build a path
8
8
  * legacy-home-name the legacy folders .xeno-agent, .xeno-anima, .xeno-code
9
- * legacy-home-path ~/.xeno, %USERPROFILE%\.xeno, $HOME/.xeno and the %APPDATA%\XENO form (a per-project `.xeno/` is fine)
9
+ * legacy-home-path ~/.xeno, %USERPROFILE%\.xeno, $HOME/.xeno and the 0.2.x %APPDATA%\XENO form, built by hand. Since
10
+ * 2026-10-25 ~/.xeno IS the XENO home, so only the resolver builds a path into it (a per-project
11
+ * `.xeno/` is fine)
10
12
  * legacy-home-env a XENO_*_HOME variable other than XENO_HOME (the thirteen legacy overrides)
11
13
  * A line (or the line above it) carrying `xeno-dirs-allow: <reason>` is exempt; the reason is mandatory.
12
14
  */
@@ -16,7 +16,7 @@ exports.RULES = [
16
16
  { id: 'platform-dir-read', description: 'reads a platform directory variable; use the dirs resolver', re: /\bvar(?:_os)?\s*\(\s*"(?:HOME|USERPROFILE|APPDATA|LOCALAPPDATA|XDG_[A-Z_]+)"/, langs: ['rs'] },
17
17
  { id: 'platform-dir-read', description: 'reads a platform directory variable; use the dirs resolver', re: /\b(?:os\.environ(?:\.get\s*\(|\s*\[)|os\.getenv\s*\()\s*['"](?:HOME|USERPROFILE|APPDATA|LOCALAPPDATA|XDG_[A-Z_]+)['"]/, langs: ['py'] },
18
18
  { id: 'legacy-home-name', description: 'names a legacy XENO home; use the dirs resolver', re: /(?<![\w-])\.xeno-(?:agent|anima|code)(?![\w-])/, langs: [...JS, 'rs', 'py', 'go'] },
19
- { id: 'legacy-home-path', description: 'builds a path into the legacy home folder or the XENO app-data folder by hand', re: /(?:~|\$\{?HOME\}?|%USERPROFILE%|%HOMEPATH%|\$env:USERPROFILE)[\\/]+\.xeno(?![\w-])|(?:%APPDATA%|%LOCALAPPDATA%|AppData[\\/]+(?:Roaming|Local))[\\/]+XENO\b/, langs: [...JS, 'rs', 'py', 'go'] },
19
+ { id: 'legacy-home-path', description: 'builds a path into the XENO home or the 0.2.x app-data folder by hand; only the dirs resolver builds it', re: /(?:~|\$\{?HOME\}?|%USERPROFILE%|%HOMEPATH%|\$env:USERPROFILE)[\\/]+\.xeno(?![\w-])|(?:%APPDATA%|%LOCALAPPDATA%|AppData[\\/]+(?:Roaming|Local))[\\/]+XENO\b/, langs: [...JS, 'rs', 'py', 'go'] },
20
20
  { id: 'legacy-home-env', description: 'uses a legacy XENO_*_HOME variable; XENO_HOME is the only override', re: /\bXENO_(?!HOME\b)[A-Z0-9_]*_HOME\b/, langs: [...JS, 'rs', 'py', 'go'] },
21
21
  ];
22
22
  const DEFAULT_EXCLUDE_DIRS = new Set(['node_modules', 'dist', 'build', 'target', '.git', 'coverage', '.next', 'out', '.turbo', '.venv', '__pycache__', 'release', '.worktrees']);
@@ -3,12 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  // xeno-home print every resolved location (the engine behind `xeno home`)
5
5
  // xeno-home doctor [--json] list entries no registry path allows (`xeno home doctor`; exit 1 if any)
6
- // xeno-home migrate [--confirm] copy legacy homes into the layout (dry run unless --confirm; never deletes)
6
+ // xeno-home migrate [--confirm] copy legacy homes and the 0.2.x platform folders into the layout (dry run unless --confirm; never deletes)
7
7
  // xeno-home inputs show the owner-decided contract inputs
8
8
  const inputs_ts_1 = require("./inputs.js");
9
9
  const dirs_ts_1 = require("./dirs.js");
10
10
  const doctor_ts_1 = require("./doctor.js");
11
11
  const host_ts_1 = require("./host.js");
12
+ const roots_ts_1 = require("./roots.js");
12
13
  const migrate_ts_1 = require("./migrate.js");
13
14
  const [cmd, ...rest] = process.argv.slice(2);
14
15
  const json = rest.includes('--json');
@@ -43,7 +44,15 @@ async function main() {
43
44
  return r.ok ? 0 : 1;
44
45
  }
45
46
  if (cmd === 'migrate') {
46
- const plan = (0, migrate_ts_1.planMigration)({ dirs, home: (0, host_ts_1.hostHome)() });
47
+ // 0.1.x-0.2.x placed kinds in the platform folders; they are relocated into ~/.xeno with the legacy homes.
48
+ let previousRoots;
49
+ try {
50
+ previousRoots = (0, roots_ts_1.resolvePlatformNativeRoots)({ platform: dirs.platform, home: (0, host_ts_1.hostHome)(), env: (0, host_ts_1.hostEnv)() }).roots;
51
+ }
52
+ catch {
53
+ previousRoots = undefined;
54
+ }
55
+ const plan = (0, migrate_ts_1.planMigration)({ dirs, home: (0, host_ts_1.hostHome)(), ...(previousRoots ? { previousRoots } : {}) });
47
56
  const confirm = rest.includes('--confirm');
48
57
  const result = await (0, migrate_ts_1.runMigration)(plan, { dirs, confirm });
49
58
  if (json)
@@ -1,5 +1,5 @@
1
1
  export { DirsError, isDirsError, type DirsErrorCode } from './errors.ts';
2
- export { KINDS, SEP, isAbsolutePath, joinPath, normalizeBase, resolveRoots, type Kind, type Platform, type ResolveInput, type ResolvedRoots } from './roots.ts';
2
+ export { KINDS, SEP, isAbsolutePath, joinPath, normalizeBase, resolvePlatformNativeRoots, resolveRoots, type Kind, type Platform, type ResolveInput, type ResolvedRoots } from './roots.ts';
3
3
  export { segmentProblem, assertSegment } from './segments.ts';
4
4
  export { AREAS, LOCK_SUFFIX, findArea, registeredRelativePath, lockRelativePath, type AreaEntry } from './registry.ts';
5
5
  export { SUPPORTED_LAYOUT, parseLayout, type LayoutState } from './layout.ts';
@@ -8,6 +8,6 @@ export { acquireLockFile, judgeLock, type AcquireOptions, type LockHandle, type
8
8
  export { isProcessAlive, processStartTime } from './procinfo.ts';
9
9
  export { XenoDirs, createDirs, createDirsAt, type CreateDirsOptions } from './dirs.ts';
10
10
  export { contractInputs } from './inputs.ts';
11
- export { BUILTIN_RULES, journalPath, planId, planMigration, readJournal, runMigration, verifyMigration, type EntryResult, type EntryStatus, type MigrationPlan, type MigrationResult, type MigrationRule, type PlanEntry, type PlanOptions, type Refusal, type RunOptions, type SecretSink, type VerifyResult, } from './migrate.ts';
11
+ export { BUILTIN_RULES, RELOCATED_KINDS, RELOCATE_RULE_ID, journalPath, planId, planMigration, readJournal, runMigration, verifyMigration, type EntryResult, type EntryStatus, type MigrationPlan, type MigrationResult, type MigrationRule, type PlanEntry, type PlanOptions, type Refusal, type RunOptions, type SecretSink, type VerifyResult, } from './migrate.ts';
12
12
  export { doctor, type DoctorReport, type Unregistered } from './doctor.ts';
13
13
  export { CONFIG_NAME, RULES, checkSource, loadConfig, scanText, type CheckConfig, type CheckResult, type Rule, type Violation } from './check.ts';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scanText = exports.loadConfig = exports.checkSource = exports.RULES = exports.CONFIG_NAME = exports.doctor = exports.verifyMigration = exports.runMigration = exports.readJournal = exports.planMigration = exports.planId = exports.journalPath = exports.BUILTIN_RULES = exports.contractInputs = exports.createDirsAt = exports.createDirs = exports.XenoDirs = exports.processStartTime = exports.isProcessAlive = exports.judgeLock = exports.acquireLockFile = exports.atomicWriteFile = exports.parseLayout = exports.SUPPORTED_LAYOUT = exports.lockRelativePath = exports.registeredRelativePath = exports.findArea = exports.LOCK_SUFFIX = exports.AREAS = exports.assertSegment = exports.segmentProblem = exports.resolveRoots = exports.normalizeBase = exports.joinPath = exports.isAbsolutePath = exports.SEP = exports.KINDS = exports.isDirsError = exports.DirsError = void 0;
3
+ exports.scanText = exports.loadConfig = exports.checkSource = exports.RULES = exports.CONFIG_NAME = exports.doctor = exports.verifyMigration = exports.runMigration = exports.readJournal = exports.planMigration = exports.planId = exports.journalPath = exports.RELOCATE_RULE_ID = exports.RELOCATED_KINDS = exports.BUILTIN_RULES = exports.contractInputs = exports.createDirsAt = exports.createDirs = exports.XenoDirs = exports.processStartTime = exports.isProcessAlive = exports.judgeLock = exports.acquireLockFile = exports.atomicWriteFile = exports.parseLayout = exports.SUPPORTED_LAYOUT = exports.lockRelativePath = exports.registeredRelativePath = exports.findArea = exports.LOCK_SUFFIX = exports.AREAS = exports.assertSegment = exports.segmentProblem = exports.resolveRoots = exports.resolvePlatformNativeRoots = exports.normalizeBase = exports.joinPath = exports.isAbsolutePath = exports.SEP = exports.KINDS = exports.isDirsError = exports.DirsError = void 0;
4
4
  var errors_ts_1 = require("./errors.js");
5
5
  Object.defineProperty(exports, "DirsError", { enumerable: true, get: function () { return errors_ts_1.DirsError; } });
6
6
  Object.defineProperty(exports, "isDirsError", { enumerable: true, get: function () { return errors_ts_1.isDirsError; } });
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "SEP", { enumerable: true, get: function () { ret
10
10
  Object.defineProperty(exports, "isAbsolutePath", { enumerable: true, get: function () { return roots_ts_1.isAbsolutePath; } });
11
11
  Object.defineProperty(exports, "joinPath", { enumerable: true, get: function () { return roots_ts_1.joinPath; } });
12
12
  Object.defineProperty(exports, "normalizeBase", { enumerable: true, get: function () { return roots_ts_1.normalizeBase; } });
13
+ Object.defineProperty(exports, "resolvePlatformNativeRoots", { enumerable: true, get: function () { return roots_ts_1.resolvePlatformNativeRoots; } });
13
14
  Object.defineProperty(exports, "resolveRoots", { enumerable: true, get: function () { return roots_ts_1.resolveRoots; } });
14
15
  var segments_ts_1 = require("./segments.js");
15
16
  Object.defineProperty(exports, "segmentProblem", { enumerable: true, get: function () { return segments_ts_1.segmentProblem; } });
@@ -39,6 +40,8 @@ var inputs_ts_1 = require("./inputs.js");
39
40
  Object.defineProperty(exports, "contractInputs", { enumerable: true, get: function () { return inputs_ts_1.contractInputs; } });
40
41
  var migrate_ts_1 = require("./migrate.js");
41
42
  Object.defineProperty(exports, "BUILTIN_RULES", { enumerable: true, get: function () { return migrate_ts_1.BUILTIN_RULES; } });
43
+ Object.defineProperty(exports, "RELOCATED_KINDS", { enumerable: true, get: function () { return migrate_ts_1.RELOCATED_KINDS; } });
44
+ Object.defineProperty(exports, "RELOCATE_RULE_ID", { enumerable: true, get: function () { return migrate_ts_1.RELOCATE_RULE_ID; } });
42
45
  Object.defineProperty(exports, "journalPath", { enumerable: true, get: function () { return migrate_ts_1.journalPath; } });
43
46
  Object.defineProperty(exports, "planId", { enumerable: true, get: function () { return migrate_ts_1.planId; } });
44
47
  Object.defineProperty(exports, "planMigration", { enumerable: true, get: function () { return migrate_ts_1.planMigration; } });
@@ -86,18 +86,40 @@ async function breakStale(path, judged) {
86
86
  }
87
87
  await node_fs_1.promises.rm(moved, { force: true }).catch(() => undefined);
88
88
  }
89
+ /**
90
+ * Windows reports a lock file that its holder is deleting ("delete pending") as access denied or busy, not as
91
+ * "exists", for a link onto it and for a read of it. That is contention, not a failure. Bounded, so a real permission
92
+ * problem still surfaces as its own error rather than as "held".
93
+ */
94
+ const TRANSIENT_WINDOWS_CODES = new Set(['EPERM', 'EACCES', 'EBUSY']);
95
+ const TRANSIENT_RETRIES = 20;
96
+ const isTransientContention = (e) => process.platform === 'win32' && TRANSIENT_WINDOWS_CODES.has(e?.code ?? '');
89
97
  /** Acquires a lock file at an absolute path produced by `XenoDirs.lockPath`. */
90
98
  async function acquireLockFile(path, options = {}) {
91
99
  const probe = { ...defaultProbe, ...options.probe };
92
100
  await node_fs_1.promises.mkdir((0, node_path_1.dirname)(path), { recursive: true });
93
101
  const deadline = Date.now() + (options.timeoutMs ?? 0);
94
102
  const startTime = options.probe?.startTime ? await options.probe.startTime(process.pid) : await (0, procinfo_ts_1.ownProcessStartTime)();
103
+ let transient = 0;
95
104
  for (;;) {
96
105
  const rec = {
97
106
  v: 1, pid: process.pid, startTime, host: probe.host(), token: (0, node_crypto_1.randomBytes)(12).toString('hex'),
98
107
  owner: options.owner ?? '', createdAt: new Date().toISOString(),
99
108
  };
100
- if (await tryCreate(path, rec)) {
109
+ let created;
110
+ let cur;
111
+ try {
112
+ created = await tryCreate(path, rec);
113
+ cur = created ? null : await readRecord(path);
114
+ }
115
+ catch (e) {
116
+ if (!isTransientContention(e) || (++transient > TRANSIENT_RETRIES && Date.now() >= deadline))
117
+ throw e;
118
+ await new Promise((r) => setTimeout(r, 10));
119
+ continue;
120
+ }
121
+ transient = 0;
122
+ if (created) {
101
123
  return {
102
124
  path, record: rec,
103
125
  async release() {
@@ -109,7 +131,6 @@ async function acquireLockFile(path, options = {}) {
109
131
  },
110
132
  };
111
133
  }
112
- const cur = await readRecord(path);
113
134
  if (cur === null)
114
135
  continue; // vanished between our attempt and our read: try again
115
136
  if (cur.rec === null) {
@@ -1,5 +1,5 @@
1
1
  import type { XenoDirs } from './dirs.ts';
2
- import type { Kind } from './roots.ts';
2
+ import { type Kind } from './roots.ts';
3
3
  /**
4
4
  * The copy-only migrator (XENO LOCAL HOME - SPEC.md section 10). It copies known legacy files to their registered
5
5
  * locations, records source, destination and SHA-256 in a journal under state/platform/migrations/, verifies every
@@ -52,10 +52,14 @@ export interface Refusal {
52
52
  }
53
53
  export interface MigrationPlan {
54
54
  id: string;
55
+ /**
56
+ * `not-relocated`: a previous kind root that is deliberately not copied (cache is re-creatable, run is ephemeral);
57
+ * reported so a person can see it, never silently dropped.
58
+ */
55
59
  homes: {
56
60
  name: string;
57
61
  path: string;
58
- state: 'present' | 'absent' | 'refused-link';
62
+ state: 'present' | 'absent' | 'refused-link' | 'not-relocated';
59
63
  }[];
60
64
  entries: PlanEntry[];
61
65
  refused: Refusal[];
@@ -78,7 +82,17 @@ export interface PlanOptions {
78
82
  home: string;
79
83
  rules?: readonly MigrationRule[];
80
84
  legacyHomes?: readonly string[];
85
+ /**
86
+ * Where 0.1.x-0.2.x placed each kind (`resolvePlatformNativeRoots`). When given, config, data, secrets and state are
87
+ * relocated one to one into this layout's roots; cache and run are reported, not copied. Links and junctions are
88
+ * never followed, and the previous roots are left in place.
89
+ */
90
+ previousRoots?: Readonly<Record<Kind, string>>;
81
91
  }
92
+ /** Kinds a relocation copies. Cache is re-creatable and run is ephemeral, so copying them only costs disk. */
93
+ export declare const RELOCATED_KINDS: readonly Kind[];
94
+ /** The rule id every relocation entry carries. */
95
+ export declare const RELOCATE_RULE_ID = "relocate-layout-1";
82
96
  export declare function planMigration(options: PlanOptions): MigrationPlan;
83
97
  export type EntryStatus = 'copied' | 'already' | 'secret' | 'conflict' | 'refused' | 'failed';
84
98
  export interface EntryResult {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BUILTIN_RULES = void 0;
3
+ exports.RELOCATE_RULE_ID = exports.RELOCATED_KINDS = exports.BUILTIN_RULES = void 0;
4
4
  exports.planId = planId;
5
5
  exports.planMigration = planMigration;
6
6
  exports.journalPath = journalPath;
@@ -14,6 +14,7 @@ const contract_ts_1 = require("../generated/contract.js");
14
14
  const atomic_ts_1 = require("./atomic.js");
15
15
  const errors_ts_1 = require("./errors.js");
16
16
  const segments_ts_1 = require("./segments.js");
17
+ const roots_ts_1 = require("./roots.js");
17
18
  /** Rules the contract itself knows (only those the ecosystem documents state explicitly). Owners add their own. */
18
19
  exports.BUILTIN_RULES = contract_ts_1.LEGACY_MAP_JSON.rules;
19
20
  const SAMPLE = 200;
@@ -25,23 +26,58 @@ function globMatch(pattern, name) {
25
26
  const re = new RegExp('^' + pattern.split('*').map((s) => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('.*') + '$');
26
27
  return re.test(name);
27
28
  }
29
+ /**
30
+ * A rule whose `match` ends in `/**` matches every file below that prefix, at any depth (an installed plugin is a
31
+ * tree). Its target names the remainder with one whole `{path}` segment. Links are still never followed.
32
+ */
33
+ const TREE = '**';
34
+ const PATH_TOKEN = '{path}';
28
35
  function matchRule(rule, rel) {
29
36
  const want = rule.match.split('/');
30
37
  const got = rel.split('/');
38
+ if (want[want.length - 1] === TREE) {
39
+ const prefix = want.slice(0, -1);
40
+ if (got.length <= prefix.length)
41
+ return null;
42
+ for (let i = 0; i < prefix.length; i++)
43
+ if (prefix[i] !== got[i])
44
+ return null;
45
+ return { file: got[got.length - 1], rest: got.slice(prefix.length) };
46
+ }
31
47
  if (want.length !== got.length)
32
48
  return null;
33
49
  for (let i = 0; i < want.length - 1; i++)
34
50
  if (want[i] !== got[i])
35
51
  return null;
36
52
  const last = got[got.length - 1];
37
- return globMatch(want[want.length - 1], last) ? { file: last } : null;
53
+ return globMatch(want[want.length - 1], last) ? { file: last, rest: [] } : null;
38
54
  }
39
55
  const fill = (s, file) => s.split('{file}').join(file);
56
+ /** A target's segments with `{file}` filled and a whole `{path}` segment expanded into the matched remainder. */
57
+ const expand = (segments, m) => segments.flatMap((x) => (x === PATH_TOKEN ? m.rest : [fill(x, m.file)]));
58
+ function assertRuleShape(r) {
59
+ const parts = r.match.split('/');
60
+ const tree = parts[parts.length - 1] === TREE;
61
+ if (parts.slice(0, -1).includes(TREE))
62
+ throw new errors_ts_1.DirsError('invalid-argument', `rule ${r.id}: '**' is allowed only as the last segment of match`);
63
+ if (!tree)
64
+ return;
65
+ if (r.action !== 'copy')
66
+ throw new errors_ts_1.DirsError('invalid-argument', `rule ${r.id}: a tree rule ('/**') must copy; a secret is one file`);
67
+ if (r.target.segments.filter((x) => x === PATH_TOKEN).length !== 1)
68
+ throw new errors_ts_1.DirsError('invalid-argument', `rule ${r.id}: a tree rule names the remainder with exactly one '{path}' segment`);
69
+ }
40
70
  /** Deterministic id: the same plan (rules, sources, destinations) always has the same journal. */
41
71
  function planId(entries) {
42
72
  const lines = entries.map((e) => `${e.rule}\t${e.legacyHome}\t${e.sourceRel}\t${e.destRel}`).sort().join('\n');
43
73
  return 'm-' + (0, node_crypto_1.createHash)('sha256').update(lines).digest('hex').slice(0, 12);
44
74
  }
75
+ /** Kinds a relocation copies. Cache is re-creatable and run is ephemeral, so copying them only costs disk. */
76
+ exports.RELOCATED_KINDS = ['config', 'data', 'secrets', 'state'];
77
+ /** The rule id every relocation entry carries. */
78
+ exports.RELOCATE_RULE_ID = 'relocate-layout-1';
79
+ /** The note the migrator writes into each source it copied from; it is never itself migrated. */
80
+ const NOTE_NAME = 'XENO-MIGRATED.txt';
45
81
  function planMigration(options) {
46
82
  const rules = [...exports.BUILTIN_RULES, ...(options.rules ?? [])];
47
83
  const seen = new Set();
@@ -49,6 +85,7 @@ function planMigration(options) {
49
85
  if (seen.has(r.id))
50
86
  throw new errors_ts_1.DirsError('invalid-argument', `duplicate migration rule id: ${r.id}`);
51
87
  seen.add(r.id);
88
+ assertRuleShape(r);
52
89
  }
53
90
  const names = options.legacyHomes ?? contract_ts_1.INPUTS_JSON.legacyHomes;
54
91
  const homes = [];
@@ -57,6 +94,10 @@ function planMigration(options) {
57
94
  const unplaced = { count: 0, sample: [], truncated: false };
58
95
  let visited = 0;
59
96
  const sep = options.dirs.platform === 'windows' ? '\\' : '/';
97
+ // The current layout may sit INSIDE a legacy home (the default is <home>/.xeno/<kind>, and .xeno is also a legacy
98
+ // home), so its own roots are skipped rather than migrated into themselves.
99
+ const key = (q) => (options.dirs.platform === 'windows' ? q.toLowerCase() : q);
100
+ const ownRoots = new Set(roots_ts_1.KINDS.map((k) => key(options.dirs.root(k))));
60
101
  for (const name of names) {
61
102
  const path = options.home + sep + name;
62
103
  let st;
@@ -93,6 +134,8 @@ function planMigration(options) {
93
134
  return;
94
135
  }
95
136
  const abs = dir + sep + entry;
137
+ if (ownRoots.has(key(abs)) || (rel === '' && entry === NOTE_NAME))
138
+ continue;
96
139
  const r = rel ? `${rel}/${entry}` : entry;
97
140
  const s = (0, node_fs_1.lstatSync)(abs);
98
141
  const hits = mine.map((rule) => ({ rule, m: matchRule(rule, r) })).filter((h) => h.m !== null);
@@ -123,7 +166,7 @@ function planMigration(options) {
123
166
  const { rule, m } = hits[0];
124
167
  try {
125
168
  if (rule.action === 'copy') {
126
- const segs = rule.target.segments.map((x) => fill(x, m.file));
169
+ const segs = expand(rule.target.segments, m);
127
170
  const dest = options.dirs.path(rule.target.kind, rule.target.area, ...segs);
128
171
  entries.push({ rule: rule.id, action: 'copy', legacyHome: name, sourceRel: r, source: abs, bytes: s.size, dest, destRel: [rule.target.area, ...segs].join('/'), destKind: rule.target.kind });
129
172
  }
@@ -141,6 +184,76 @@ function planMigration(options) {
141
184
  };
142
185
  walk(path, '');
143
186
  }
187
+ if (options.previousRoots) {
188
+ for (const kind of roots_ts_1.KINDS) {
189
+ const from = options.previousRoots[kind];
190
+ const name = `layout-1:${kind}`;
191
+ if (key(from) === key(options.dirs.root(kind)))
192
+ continue; // the same place; nothing to relocate
193
+ let st;
194
+ try {
195
+ st = (0, node_fs_1.lstatSync)(from);
196
+ }
197
+ catch {
198
+ homes.push({ name, path: from, state: 'absent' });
199
+ continue;
200
+ }
201
+ if (st.isSymbolicLink()) {
202
+ homes.push({ name, path: from, state: 'refused-link' });
203
+ refused.push({ path: from, reason: 'the previous kind root is a link or junction' });
204
+ continue;
205
+ }
206
+ if (!st.isDirectory()) {
207
+ homes.push({ name, path: from, state: 'absent' });
208
+ continue;
209
+ }
210
+ if (!exports.RELOCATED_KINDS.includes(kind)) {
211
+ homes.push({ name, path: from, state: 'not-relocated' });
212
+ continue;
213
+ }
214
+ homes.push({ name, path: from, state: 'present' });
215
+ const relocate = (dir, rel) => {
216
+ let list;
217
+ try {
218
+ list = (0, node_fs_1.readdirSync)(dir);
219
+ }
220
+ catch {
221
+ refused.push({ path: dir, reason: 'unreadable directory' });
222
+ return;
223
+ }
224
+ for (const entry of list) {
225
+ if (++visited > WALK_CAP) {
226
+ unplaced.truncated = true;
227
+ return;
228
+ }
229
+ if (rel === '' && entry === NOTE_NAME)
230
+ continue;
231
+ const abs = dir + sep + entry;
232
+ const r = rel ? `${rel}/${entry}` : entry;
233
+ const s = (0, node_fs_1.lstatSync)(abs);
234
+ // Never followed: a junction (Spawn's session pool) points at data that is relocated on its own, and its
235
+ // owner re-creates the link in the new layout.
236
+ if (s.isSymbolicLink()) {
237
+ refused.push({ path: abs, reason: 'a link or junction is never followed; its owner re-creates it' });
238
+ continue;
239
+ }
240
+ if (s.isDirectory()) {
241
+ relocate(abs, r);
242
+ continue;
243
+ }
244
+ if (!s.isFile()) {
245
+ unplaced.count++;
246
+ if (unplaced.sample.length < SAMPLE)
247
+ unplaced.sample.push(`${name}/${r}`);
248
+ continue;
249
+ }
250
+ const dest = options.dirs.root(kind) + sep + r.split('/').join(sep);
251
+ entries.push({ rule: exports.RELOCATE_RULE_ID, action: 'copy', legacyHome: name, sourceRel: r, source: abs, bytes: s.size, dest, destRel: r, destKind: kind });
252
+ }
253
+ };
254
+ relocate(from, '');
255
+ }
256
+ }
144
257
  // Two sources must never map to one destination.
145
258
  const byDest = new Map();
146
259
  for (const e of entries)
@@ -382,7 +495,7 @@ async function runMigration(plan, options) {
382
495
  '',
383
496
  ].join('\n');
384
497
  try {
385
- await (0, atomic_ts_1.atomicWriteFile)(h.path + sep + 'XENO-MIGRATED.txt', note);
498
+ await (0, atomic_ts_1.atomicWriteFile)(h.path + sep + NOTE_NAME, note);
386
499
  }
387
500
  catch { /* a read-only legacy home is not a failure of the migration */ }
388
501
  }
@@ -20,4 +20,17 @@ export declare function isAbsolutePath(platform: Platform, p: string): boolean;
20
20
  /** Normalises separators and drops trailing ones, so `base + sep + name` is always well formed. */
21
21
  export declare function normalizeBase(platform: Platform, p: string): string;
22
22
  export declare function joinPath(platform: Platform, base: string, ...parts: string[]): string;
23
+ /**
24
+ * Where every kind lives: `<home>/.xeno/<kind>` on every OS, or `<XENO_HOME>/<kind>` when XENO_HOME is absolute.
25
+ *
26
+ * Owner decision, 2026-10-25 ("ok then lets have it done right"): one folder in the person's home that they and their
27
+ * agents can find, the way `~/.claude` and `~/.codex` are found, with the spec's structure inside it. Platform folders
28
+ * (APPDATA, LOCALAPPDATA, XDG_*, TMPDIR) no longer place anything. `resolvePlatformNativeRoots` keeps the previous
29
+ * placement so the migrator can find what 0.1.x-0.2.x wrote there.
30
+ */
23
31
  export declare function resolveRoots(input: ResolveInput): ResolvedRoots;
32
+ /**
33
+ * The platform-native placement of 0.1.x-0.2.x (XENO LOCAL HOME - SPEC.md section 4 before its 2026-10-25
34
+ * amendment). Not the default: the migrator reads it to find data those versions wrote.
35
+ */
36
+ export declare function resolvePlatformNativeRoots(input: ResolveInput): ResolvedRoots;
@@ -5,6 +5,7 @@ exports.isAbsolutePath = isAbsolutePath;
5
5
  exports.normalizeBase = normalizeBase;
6
6
  exports.joinPath = joinPath;
7
7
  exports.resolveRoots = resolveRoots;
8
+ exports.resolvePlatformNativeRoots = resolvePlatformNativeRoots;
8
9
  const contract_ts_1 = require("../generated/contract.js");
9
10
  const errors_ts_1 = require("./errors.js");
10
11
  exports.KINDS = ['config', 'data', 'secrets', 'state', 'cache', 'run'];
@@ -39,7 +40,41 @@ function getEnv(platform, env, name) {
39
40
  return env[k];
40
41
  return undefined;
41
42
  }
43
+ /**
44
+ * Where every kind lives: `<home>/.xeno/<kind>` on every OS, or `<XENO_HOME>/<kind>` when XENO_HOME is absolute.
45
+ *
46
+ * Owner decision, 2026-10-25 ("ok then lets have it done right"): one folder in the person's home that they and their
47
+ * agents can find, the way `~/.claude` and `~/.codex` are found, with the spec's structure inside it. Platform folders
48
+ * (APPDATA, LOCALAPPDATA, XDG_*, TMPDIR) no longer place anything. `resolvePlatformNativeRoots` keeps the previous
49
+ * placement so the migrator can find what 0.1.x-0.2.x wrote there.
50
+ */
42
51
  function resolveRoots(input) {
52
+ const { platform, home, env } = input;
53
+ const sep = exports.SEP[platform];
54
+ const override = getEnv(platform, env, 'XENO_HOME');
55
+ const warnings = [];
56
+ let base;
57
+ if (override !== undefined && override !== '') {
58
+ if (isAbsolutePath(platform, override))
59
+ base = normalizeBase(platform, override);
60
+ else
61
+ warnings.push('xeno-home-relative-ignored');
62
+ }
63
+ const overridden = base !== undefined;
64
+ if (base === undefined) {
65
+ if (!home || !isAbsolutePath(platform, home)) {
66
+ throw new errors_ts_1.DirsError('home-unresolvable', 'the home directory is unknown or relative, and no XENO_HOME override is set');
67
+ }
68
+ base = normalizeBase(platform, home) + sep + contract_ts_1.INPUTS_JSON.inputs.defaultHomeDir.value;
69
+ }
70
+ const roots = Object.fromEntries(exports.KINDS.map((k) => [k, base + sep + k]));
71
+ return { platform, roots, warnings, overridden };
72
+ }
73
+ /**
74
+ * The platform-native placement of 0.1.x-0.2.x (XENO LOCAL HOME - SPEC.md section 4 before its 2026-10-25
75
+ * amendment). Not the default: the migrator reads it to find data those versions wrote.
76
+ */
77
+ function resolvePlatformNativeRoots(input) {
43
78
  const { platform, home, env } = input;
44
79
  const warnings = [];
45
80
  const get = (n) => getEnv(platform, env, n);
@@ -109,6 +109,13 @@ export declare const INPUTS_JSON: {
109
109
  source: string;
110
110
  note: string;
111
111
  };
112
+ defaultHomeDir: {
113
+ value: string;
114
+ status: string;
115
+ decided: string;
116
+ source: string;
117
+ note: string;
118
+ };
112
119
  };
113
120
  legacyHomes: string[];
114
121
  windowsVendorDir: string;
@@ -198,6 +198,13 @@ exports.INPUTS_JSON = {
198
198
  "decided": "2026-10-11",
199
199
  "source": "XENO LOCAL HOME - SPEC.md section 11.2",
200
200
  "note": "Releases after a product adopts the layout during which it still reads the legacy location. The legacy copy is never deleted automatically."
201
+ },
202
+ "defaultHomeDir": {
203
+ "value": ".xeno",
204
+ "status": "locked",
205
+ "decided": "2026-10-25",
206
+ "source": "XENO LOCAL HOME - SPEC.md section 4 (amended 2026-10-25)",
207
+ "note": "The default XENO home is <user home>/<value> on every OS, with config/data/secrets/state/cache/run inside. XENO_HOME overrides it. Platform folders (APPDATA, LOCALAPPDATA, XDG_*, TMPDIR) no longer place anything."
201
208
  }
202
209
  },
203
210
  "legacyHomes": [
@@ -213,7 +220,7 @@ exports.INPUTS_JSON = {
213
220
  "$comment2": "secretsKeyService/Account name the single OS-store entry that holds the per-machine master key (spec section 6). The service equals the locked bundle identifier."
214
221
  };
215
222
  exports.LEGACY_MAP_JSON = {
216
- "$comment": "Built-in migration rules: legacy file -> registered location. Deliberately minimal: only mappings the ecosystem documents explicitly. Each product owner supplies the rest as rules; anything unmatched is reported as unplaced, never guessed (XENO LOCAL HOME - SPEC.md section 10.6). A 'copy' rule names kind+area+segments; a 'secret' rule names area+name and needs a secret sink. '{file}' stands for the matched file name; only the last path segment of 'match' may contain '*'.",
223
+ "$comment": "Built-in migration rules: legacy file -> registered location. Deliberately minimal: only mappings the ecosystem documents explicitly. Each product owner supplies the rest as rules; anything unmatched is reported as unplaced, never guessed (XENO LOCAL HOME - SPEC.md section 10.6). A 'copy' rule names kind+area+segments; a 'secret' rule names area+name and needs a secret sink. '{file}' stands for the matched file name; only the last path segment of 'match' may contain '*'. A 'match' ending in '/**' (0.3.1) is a tree rule: it matches every file below that prefix at any depth, must be a copy, and names the remainder with exactly one whole '{path}' target segment; links inside the tree are refused, never followed.",
217
224
  "rules": [
218
225
  {
219
226
  "id": "shell-window-state",
@@ -228,6 +235,66 @@ exports.LEGACY_MAP_JSON = {
228
235
  ]
229
236
  },
230
237
  "source": "xeno-primitives/ADOPTION.md, xeno-shell row (~/.xeno/shell/state.json -> apps/shell); window state is kind state (LOCAL HOME spec section 5)"
238
+ },
239
+ {
240
+ "id": "extensions-plugins",
241
+ "legacyHome": ".xeno",
242
+ "match": "plugins/**",
243
+ "action": "copy",
244
+ "target": {
245
+ "kind": "data",
246
+ "area": "extensions",
247
+ "segments": [
248
+ "plugins",
249
+ "{path}"
250
+ ]
251
+ },
252
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; installed plugins, their registry, trust decisions and event log are one tree owned by the SDK plugin host"
253
+ },
254
+ {
255
+ "id": "extensions-mcp-servers",
256
+ "legacyHome": ".xeno",
257
+ "match": "mcp/servers.json",
258
+ "action": "copy",
259
+ "target": {
260
+ "kind": "config",
261
+ "area": "extensions",
262
+ "segments": [
263
+ "mcp",
264
+ "servers.json"
265
+ ]
266
+ },
267
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; MCP server definitions and policies are settings"
268
+ },
269
+ {
270
+ "id": "extensions-mcp-sdk-approvals",
271
+ "legacyHome": ".xeno",
272
+ "match": "mcp/sdk-approvals.json",
273
+ "action": "copy",
274
+ "target": {
275
+ "kind": "config",
276
+ "area": "extensions",
277
+ "segments": [
278
+ "mcp",
279
+ "sdk-approvals.json"
280
+ ]
281
+ },
282
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; hash-bound approvals for SDK-configured servers are settings"
283
+ },
284
+ {
285
+ "id": "extensions-mcp-approval-log",
286
+ "legacyHome": ".xeno",
287
+ "match": "mcp/approvals.jsonl",
288
+ "action": "copy",
289
+ "target": {
290
+ "kind": "data",
291
+ "area": "extensions",
292
+ "segments": [
293
+ "mcp",
294
+ "approvals.jsonl"
295
+ ]
296
+ },
297
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; the approval audit history cannot be re-created"
231
298
  }
232
299
  ]
233
300
  };
@@ -6,7 +6,9 @@
6
6
  * homedir-call a call that asks the OS for the home directory (homedir(), home_dir(), Path.home(), UserHomeDir())
7
7
  * platform-dir-read reading HOME, USERPROFILE, APPDATA, LOCALAPPDATA or XDG_* from the environment to build a path
8
8
  * legacy-home-name the legacy folders .xeno-agent, .xeno-anima, .xeno-code
9
- * legacy-home-path ~/.xeno, %USERPROFILE%\.xeno, $HOME/.xeno and the %APPDATA%\XENO form (a per-project `.xeno/` is fine)
9
+ * legacy-home-path ~/.xeno, %USERPROFILE%\.xeno, $HOME/.xeno and the 0.2.x %APPDATA%\XENO form, built by hand. Since
10
+ * 2026-10-25 ~/.xeno IS the XENO home, so only the resolver builds a path into it (a per-project
11
+ * `.xeno/` is fine)
10
12
  * legacy-home-env a XENO_*_HOME variable other than XENO_HOME (the thirteen legacy overrides)
11
13
  * A line (or the line above it) carrying `xeno-dirs-allow: <reason>` is exempt; the reason is mandatory.
12
14
  */
@@ -10,7 +10,7 @@ export const RULES = [
10
10
  { id: 'platform-dir-read', description: 'reads a platform directory variable; use the dirs resolver', re: /\bvar(?:_os)?\s*\(\s*"(?:HOME|USERPROFILE|APPDATA|LOCALAPPDATA|XDG_[A-Z_]+)"/, langs: ['rs'] },
11
11
  { id: 'platform-dir-read', description: 'reads a platform directory variable; use the dirs resolver', re: /\b(?:os\.environ(?:\.get\s*\(|\s*\[)|os\.getenv\s*\()\s*['"](?:HOME|USERPROFILE|APPDATA|LOCALAPPDATA|XDG_[A-Z_]+)['"]/, langs: ['py'] },
12
12
  { id: 'legacy-home-name', description: 'names a legacy XENO home; use the dirs resolver', re: /(?<![\w-])\.xeno-(?:agent|anima|code)(?![\w-])/, langs: [...JS, 'rs', 'py', 'go'] },
13
- { id: 'legacy-home-path', description: 'builds a path into the legacy home folder or the XENO app-data folder by hand', re: /(?:~|\$\{?HOME\}?|%USERPROFILE%|%HOMEPATH%|\$env:USERPROFILE)[\\/]+\.xeno(?![\w-])|(?:%APPDATA%|%LOCALAPPDATA%|AppData[\\/]+(?:Roaming|Local))[\\/]+XENO\b/, langs: [...JS, 'rs', 'py', 'go'] },
13
+ { id: 'legacy-home-path', description: 'builds a path into the XENO home or the 0.2.x app-data folder by hand; only the dirs resolver builds it', re: /(?:~|\$\{?HOME\}?|%USERPROFILE%|%HOMEPATH%|\$env:USERPROFILE)[\\/]+\.xeno(?![\w-])|(?:%APPDATA%|%LOCALAPPDATA%|AppData[\\/]+(?:Roaming|Local))[\\/]+XENO\b/, langs: [...JS, 'rs', 'py', 'go'] },
14
14
  { id: 'legacy-home-env', description: 'uses a legacy XENO_*_HOME variable; XENO_HOME is the only override', re: /\bXENO_(?!HOME\b)[A-Z0-9_]*_HOME\b/, langs: [...JS, 'rs', 'py', 'go'] },
15
15
  ];
16
16
  const DEFAULT_EXCLUDE_DIRS = new Set(['node_modules', 'dist', 'build', 'target', '.git', 'coverage', '.next', 'out', '.turbo', '.venv', '__pycache__', 'release', '.worktrees']);
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  // xeno-home print every resolved location (the engine behind `xeno home`)
3
3
  // xeno-home doctor [--json] list entries no registry path allows (`xeno home doctor`; exit 1 if any)
4
- // xeno-home migrate [--confirm] copy legacy homes into the layout (dry run unless --confirm; never deletes)
4
+ // xeno-home migrate [--confirm] copy legacy homes and the 0.2.x platform folders into the layout (dry run unless --confirm; never deletes)
5
5
  // xeno-home inputs show the owner-decided contract inputs
6
6
  import { contractInputs } from "./inputs.js";
7
7
  import { createDirs } from "./dirs.js";
8
8
  import { doctor } from "./doctor.js";
9
- import { hostHome } from "./host.js";
9
+ import { hostEnv, hostHome } from "./host.js";
10
+ import { resolvePlatformNativeRoots } from "./roots.js";
10
11
  import { planMigration, runMigration } from "./migrate.js";
11
12
  const [cmd, ...rest] = process.argv.slice(2);
12
13
  const json = rest.includes('--json');
@@ -41,7 +42,15 @@ async function main() {
41
42
  return r.ok ? 0 : 1;
42
43
  }
43
44
  if (cmd === 'migrate') {
44
- const plan = planMigration({ dirs, home: hostHome() });
45
+ // 0.1.x-0.2.x placed kinds in the platform folders; they are relocated into ~/.xeno with the legacy homes.
46
+ let previousRoots;
47
+ try {
48
+ previousRoots = resolvePlatformNativeRoots({ platform: dirs.platform, home: hostHome(), env: hostEnv() }).roots;
49
+ }
50
+ catch {
51
+ previousRoots = undefined;
52
+ }
53
+ const plan = planMigration({ dirs, home: hostHome(), ...(previousRoots ? { previousRoots } : {}) });
45
54
  const confirm = rest.includes('--confirm');
46
55
  const result = await runMigration(plan, { dirs, confirm });
47
56
  if (json)
@@ -1,5 +1,5 @@
1
1
  export { DirsError, isDirsError, type DirsErrorCode } from './errors.ts';
2
- export { KINDS, SEP, isAbsolutePath, joinPath, normalizeBase, resolveRoots, type Kind, type Platform, type ResolveInput, type ResolvedRoots } from './roots.ts';
2
+ export { KINDS, SEP, isAbsolutePath, joinPath, normalizeBase, resolvePlatformNativeRoots, resolveRoots, type Kind, type Platform, type ResolveInput, type ResolvedRoots } from './roots.ts';
3
3
  export { segmentProblem, assertSegment } from './segments.ts';
4
4
  export { AREAS, LOCK_SUFFIX, findArea, registeredRelativePath, lockRelativePath, type AreaEntry } from './registry.ts';
5
5
  export { SUPPORTED_LAYOUT, parseLayout, type LayoutState } from './layout.ts';
@@ -8,6 +8,6 @@ export { acquireLockFile, judgeLock, type AcquireOptions, type LockHandle, type
8
8
  export { isProcessAlive, processStartTime } from './procinfo.ts';
9
9
  export { XenoDirs, createDirs, createDirsAt, type CreateDirsOptions } from './dirs.ts';
10
10
  export { contractInputs } from './inputs.ts';
11
- export { BUILTIN_RULES, journalPath, planId, planMigration, readJournal, runMigration, verifyMigration, type EntryResult, type EntryStatus, type MigrationPlan, type MigrationResult, type MigrationRule, type PlanEntry, type PlanOptions, type Refusal, type RunOptions, type SecretSink, type VerifyResult, } from './migrate.ts';
11
+ export { BUILTIN_RULES, RELOCATED_KINDS, RELOCATE_RULE_ID, journalPath, planId, planMigration, readJournal, runMigration, verifyMigration, type EntryResult, type EntryStatus, type MigrationPlan, type MigrationResult, type MigrationRule, type PlanEntry, type PlanOptions, type Refusal, type RunOptions, type SecretSink, type VerifyResult, } from './migrate.ts';
12
12
  export { doctor, type DoctorReport, type Unregistered } from './doctor.ts';
13
13
  export { CONFIG_NAME, RULES, checkSource, loadConfig, scanText, type CheckConfig, type CheckResult, type Rule, type Violation } from './check.ts';
@@ -1,5 +1,5 @@
1
1
  export { DirsError, isDirsError } from "./errors.js";
2
- export { KINDS, SEP, isAbsolutePath, joinPath, normalizeBase, resolveRoots } from "./roots.js";
2
+ export { KINDS, SEP, isAbsolutePath, joinPath, normalizeBase, resolvePlatformNativeRoots, resolveRoots } from "./roots.js";
3
3
  export { segmentProblem, assertSegment } from "./segments.js";
4
4
  export { AREAS, LOCK_SUFFIX, findArea, registeredRelativePath, lockRelativePath } from "./registry.js";
5
5
  export { SUPPORTED_LAYOUT, parseLayout } from "./layout.js";
@@ -8,6 +8,6 @@ export { acquireLockFile, judgeLock } from "./lock.js";
8
8
  export { isProcessAlive, processStartTime } from "./procinfo.js";
9
9
  export { XenoDirs, createDirs, createDirsAt } from "./dirs.js";
10
10
  export { contractInputs } from "./inputs.js";
11
- export { BUILTIN_RULES, journalPath, planId, planMigration, readJournal, runMigration, verifyMigration, } from "./migrate.js";
11
+ export { BUILTIN_RULES, RELOCATED_KINDS, RELOCATE_RULE_ID, journalPath, planId, planMigration, readJournal, runMigration, verifyMigration, } from "./migrate.js";
12
12
  export { doctor } from "./doctor.js";
13
13
  export { CONFIG_NAME, RULES, checkSource, loadConfig, scanText } from "./check.js";
@@ -82,18 +82,40 @@ async function breakStale(path, judged) {
82
82
  }
83
83
  await fsp.rm(moved, { force: true }).catch(() => undefined);
84
84
  }
85
+ /**
86
+ * Windows reports a lock file that its holder is deleting ("delete pending") as access denied or busy, not as
87
+ * "exists", for a link onto it and for a read of it. That is contention, not a failure. Bounded, so a real permission
88
+ * problem still surfaces as its own error rather than as "held".
89
+ */
90
+ const TRANSIENT_WINDOWS_CODES = new Set(['EPERM', 'EACCES', 'EBUSY']);
91
+ const TRANSIENT_RETRIES = 20;
92
+ const isTransientContention = (e) => process.platform === 'win32' && TRANSIENT_WINDOWS_CODES.has(e?.code ?? '');
85
93
  /** Acquires a lock file at an absolute path produced by `XenoDirs.lockPath`. */
86
94
  export async function acquireLockFile(path, options = {}) {
87
95
  const probe = { ...defaultProbe, ...options.probe };
88
96
  await fsp.mkdir(dirname(path), { recursive: true });
89
97
  const deadline = Date.now() + (options.timeoutMs ?? 0);
90
98
  const startTime = options.probe?.startTime ? await options.probe.startTime(process.pid) : await ownProcessStartTime();
99
+ let transient = 0;
91
100
  for (;;) {
92
101
  const rec = {
93
102
  v: 1, pid: process.pid, startTime, host: probe.host(), token: randomBytes(12).toString('hex'),
94
103
  owner: options.owner ?? '', createdAt: new Date().toISOString(),
95
104
  };
96
- if (await tryCreate(path, rec)) {
105
+ let created;
106
+ let cur;
107
+ try {
108
+ created = await tryCreate(path, rec);
109
+ cur = created ? null : await readRecord(path);
110
+ }
111
+ catch (e) {
112
+ if (!isTransientContention(e) || (++transient > TRANSIENT_RETRIES && Date.now() >= deadline))
113
+ throw e;
114
+ await new Promise((r) => setTimeout(r, 10));
115
+ continue;
116
+ }
117
+ transient = 0;
118
+ if (created) {
97
119
  return {
98
120
  path, record: rec,
99
121
  async release() {
@@ -105,7 +127,6 @@ export async function acquireLockFile(path, options = {}) {
105
127
  },
106
128
  };
107
129
  }
108
- const cur = await readRecord(path);
109
130
  if (cur === null)
110
131
  continue; // vanished between our attempt and our read: try again
111
132
  if (cur.rec === null) {
@@ -1,5 +1,5 @@
1
1
  import type { XenoDirs } from './dirs.ts';
2
- import type { Kind } from './roots.ts';
2
+ import { type Kind } from './roots.ts';
3
3
  /**
4
4
  * The copy-only migrator (XENO LOCAL HOME - SPEC.md section 10). It copies known legacy files to their registered
5
5
  * locations, records source, destination and SHA-256 in a journal under state/platform/migrations/, verifies every
@@ -52,10 +52,14 @@ export interface Refusal {
52
52
  }
53
53
  export interface MigrationPlan {
54
54
  id: string;
55
+ /**
56
+ * `not-relocated`: a previous kind root that is deliberately not copied (cache is re-creatable, run is ephemeral);
57
+ * reported so a person can see it, never silently dropped.
58
+ */
55
59
  homes: {
56
60
  name: string;
57
61
  path: string;
58
- state: 'present' | 'absent' | 'refused-link';
62
+ state: 'present' | 'absent' | 'refused-link' | 'not-relocated';
59
63
  }[];
60
64
  entries: PlanEntry[];
61
65
  refused: Refusal[];
@@ -78,7 +82,17 @@ export interface PlanOptions {
78
82
  home: string;
79
83
  rules?: readonly MigrationRule[];
80
84
  legacyHomes?: readonly string[];
85
+ /**
86
+ * Where 0.1.x-0.2.x placed each kind (`resolvePlatformNativeRoots`). When given, config, data, secrets and state are
87
+ * relocated one to one into this layout's roots; cache and run are reported, not copied. Links and junctions are
88
+ * never followed, and the previous roots are left in place.
89
+ */
90
+ previousRoots?: Readonly<Record<Kind, string>>;
81
91
  }
92
+ /** Kinds a relocation copies. Cache is re-creatable and run is ephemeral, so copying them only costs disk. */
93
+ export declare const RELOCATED_KINDS: readonly Kind[];
94
+ /** The rule id every relocation entry carries. */
95
+ export declare const RELOCATE_RULE_ID = "relocate-layout-1";
82
96
  export declare function planMigration(options: PlanOptions): MigrationPlan;
83
97
  export type EntryStatus = 'copied' | 'already' | 'secret' | 'conflict' | 'refused' | 'failed';
84
98
  export interface EntryResult {
@@ -5,6 +5,7 @@ import { INPUTS_JSON, LEGACY_MAP_JSON } from "../generated/contract.js";
5
5
  import { atomicWriteFile } from "./atomic.js";
6
6
  import { DirsError } from "./errors.js";
7
7
  import { assertSegment } from "./segments.js";
8
+ import { KINDS as KIND_LIST } from "./roots.js";
8
9
  /** Rules the contract itself knows (only those the ecosystem documents state explicitly). Owners add their own. */
9
10
  export const BUILTIN_RULES = LEGACY_MAP_JSON.rules;
10
11
  const SAMPLE = 200;
@@ -16,23 +17,58 @@ function globMatch(pattern, name) {
16
17
  const re = new RegExp('^' + pattern.split('*').map((s) => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('.*') + '$');
17
18
  return re.test(name);
18
19
  }
20
+ /**
21
+ * A rule whose `match` ends in `/**` matches every file below that prefix, at any depth (an installed plugin is a
22
+ * tree). Its target names the remainder with one whole `{path}` segment. Links are still never followed.
23
+ */
24
+ const TREE = '**';
25
+ const PATH_TOKEN = '{path}';
19
26
  function matchRule(rule, rel) {
20
27
  const want = rule.match.split('/');
21
28
  const got = rel.split('/');
29
+ if (want[want.length - 1] === TREE) {
30
+ const prefix = want.slice(0, -1);
31
+ if (got.length <= prefix.length)
32
+ return null;
33
+ for (let i = 0; i < prefix.length; i++)
34
+ if (prefix[i] !== got[i])
35
+ return null;
36
+ return { file: got[got.length - 1], rest: got.slice(prefix.length) };
37
+ }
22
38
  if (want.length !== got.length)
23
39
  return null;
24
40
  for (let i = 0; i < want.length - 1; i++)
25
41
  if (want[i] !== got[i])
26
42
  return null;
27
43
  const last = got[got.length - 1];
28
- return globMatch(want[want.length - 1], last) ? { file: last } : null;
44
+ return globMatch(want[want.length - 1], last) ? { file: last, rest: [] } : null;
29
45
  }
30
46
  const fill = (s, file) => s.split('{file}').join(file);
47
+ /** A target's segments with `{file}` filled and a whole `{path}` segment expanded into the matched remainder. */
48
+ const expand = (segments, m) => segments.flatMap((x) => (x === PATH_TOKEN ? m.rest : [fill(x, m.file)]));
49
+ function assertRuleShape(r) {
50
+ const parts = r.match.split('/');
51
+ const tree = parts[parts.length - 1] === TREE;
52
+ if (parts.slice(0, -1).includes(TREE))
53
+ throw new DirsError('invalid-argument', `rule ${r.id}: '**' is allowed only as the last segment of match`);
54
+ if (!tree)
55
+ return;
56
+ if (r.action !== 'copy')
57
+ throw new DirsError('invalid-argument', `rule ${r.id}: a tree rule ('/**') must copy; a secret is one file`);
58
+ if (r.target.segments.filter((x) => x === PATH_TOKEN).length !== 1)
59
+ throw new DirsError('invalid-argument', `rule ${r.id}: a tree rule names the remainder with exactly one '{path}' segment`);
60
+ }
31
61
  /** Deterministic id: the same plan (rules, sources, destinations) always has the same journal. */
32
62
  export function planId(entries) {
33
63
  const lines = entries.map((e) => `${e.rule}\t${e.legacyHome}\t${e.sourceRel}\t${e.destRel}`).sort().join('\n');
34
64
  return 'm-' + createHash('sha256').update(lines).digest('hex').slice(0, 12);
35
65
  }
66
+ /** Kinds a relocation copies. Cache is re-creatable and run is ephemeral, so copying them only costs disk. */
67
+ export const RELOCATED_KINDS = ['config', 'data', 'secrets', 'state'];
68
+ /** The rule id every relocation entry carries. */
69
+ export const RELOCATE_RULE_ID = 'relocate-layout-1';
70
+ /** The note the migrator writes into each source it copied from; it is never itself migrated. */
71
+ const NOTE_NAME = 'XENO-MIGRATED.txt';
36
72
  export function planMigration(options) {
37
73
  const rules = [...BUILTIN_RULES, ...(options.rules ?? [])];
38
74
  const seen = new Set();
@@ -40,6 +76,7 @@ export function planMigration(options) {
40
76
  if (seen.has(r.id))
41
77
  throw new DirsError('invalid-argument', `duplicate migration rule id: ${r.id}`);
42
78
  seen.add(r.id);
79
+ assertRuleShape(r);
43
80
  }
44
81
  const names = options.legacyHomes ?? INPUTS_JSON.legacyHomes;
45
82
  const homes = [];
@@ -48,6 +85,10 @@ export function planMigration(options) {
48
85
  const unplaced = { count: 0, sample: [], truncated: false };
49
86
  let visited = 0;
50
87
  const sep = options.dirs.platform === 'windows' ? '\\' : '/';
88
+ // The current layout may sit INSIDE a legacy home (the default is <home>/.xeno/<kind>, and .xeno is also a legacy
89
+ // home), so its own roots are skipped rather than migrated into themselves.
90
+ const key = (q) => (options.dirs.platform === 'windows' ? q.toLowerCase() : q);
91
+ const ownRoots = new Set(KIND_LIST.map((k) => key(options.dirs.root(k))));
51
92
  for (const name of names) {
52
93
  const path = options.home + sep + name;
53
94
  let st;
@@ -84,6 +125,8 @@ export function planMigration(options) {
84
125
  return;
85
126
  }
86
127
  const abs = dir + sep + entry;
128
+ if (ownRoots.has(key(abs)) || (rel === '' && entry === NOTE_NAME))
129
+ continue;
87
130
  const r = rel ? `${rel}/${entry}` : entry;
88
131
  const s = lstatSync(abs);
89
132
  const hits = mine.map((rule) => ({ rule, m: matchRule(rule, r) })).filter((h) => h.m !== null);
@@ -114,7 +157,7 @@ export function planMigration(options) {
114
157
  const { rule, m } = hits[0];
115
158
  try {
116
159
  if (rule.action === 'copy') {
117
- const segs = rule.target.segments.map((x) => fill(x, m.file));
160
+ const segs = expand(rule.target.segments, m);
118
161
  const dest = options.dirs.path(rule.target.kind, rule.target.area, ...segs);
119
162
  entries.push({ rule: rule.id, action: 'copy', legacyHome: name, sourceRel: r, source: abs, bytes: s.size, dest, destRel: [rule.target.area, ...segs].join('/'), destKind: rule.target.kind });
120
163
  }
@@ -132,6 +175,76 @@ export function planMigration(options) {
132
175
  };
133
176
  walk(path, '');
134
177
  }
178
+ if (options.previousRoots) {
179
+ for (const kind of KIND_LIST) {
180
+ const from = options.previousRoots[kind];
181
+ const name = `layout-1:${kind}`;
182
+ if (key(from) === key(options.dirs.root(kind)))
183
+ continue; // the same place; nothing to relocate
184
+ let st;
185
+ try {
186
+ st = lstatSync(from);
187
+ }
188
+ catch {
189
+ homes.push({ name, path: from, state: 'absent' });
190
+ continue;
191
+ }
192
+ if (st.isSymbolicLink()) {
193
+ homes.push({ name, path: from, state: 'refused-link' });
194
+ refused.push({ path: from, reason: 'the previous kind root is a link or junction' });
195
+ continue;
196
+ }
197
+ if (!st.isDirectory()) {
198
+ homes.push({ name, path: from, state: 'absent' });
199
+ continue;
200
+ }
201
+ if (!RELOCATED_KINDS.includes(kind)) {
202
+ homes.push({ name, path: from, state: 'not-relocated' });
203
+ continue;
204
+ }
205
+ homes.push({ name, path: from, state: 'present' });
206
+ const relocate = (dir, rel) => {
207
+ let list;
208
+ try {
209
+ list = readdirSync(dir);
210
+ }
211
+ catch {
212
+ refused.push({ path: dir, reason: 'unreadable directory' });
213
+ return;
214
+ }
215
+ for (const entry of list) {
216
+ if (++visited > WALK_CAP) {
217
+ unplaced.truncated = true;
218
+ return;
219
+ }
220
+ if (rel === '' && entry === NOTE_NAME)
221
+ continue;
222
+ const abs = dir + sep + entry;
223
+ const r = rel ? `${rel}/${entry}` : entry;
224
+ const s = lstatSync(abs);
225
+ // Never followed: a junction (Spawn's session pool) points at data that is relocated on its own, and its
226
+ // owner re-creates the link in the new layout.
227
+ if (s.isSymbolicLink()) {
228
+ refused.push({ path: abs, reason: 'a link or junction is never followed; its owner re-creates it' });
229
+ continue;
230
+ }
231
+ if (s.isDirectory()) {
232
+ relocate(abs, r);
233
+ continue;
234
+ }
235
+ if (!s.isFile()) {
236
+ unplaced.count++;
237
+ if (unplaced.sample.length < SAMPLE)
238
+ unplaced.sample.push(`${name}/${r}`);
239
+ continue;
240
+ }
241
+ const dest = options.dirs.root(kind) + sep + r.split('/').join(sep);
242
+ entries.push({ rule: RELOCATE_RULE_ID, action: 'copy', legacyHome: name, sourceRel: r, source: abs, bytes: s.size, dest, destRel: r, destKind: kind });
243
+ }
244
+ };
245
+ relocate(from, '');
246
+ }
247
+ }
135
248
  // Two sources must never map to one destination.
136
249
  const byDest = new Map();
137
250
  for (const e of entries)
@@ -373,7 +486,7 @@ export async function runMigration(plan, options) {
373
486
  '',
374
487
  ].join('\n');
375
488
  try {
376
- await atomicWriteFile(h.path + sep + 'XENO-MIGRATED.txt', note);
489
+ await atomicWriteFile(h.path + sep + NOTE_NAME, note);
377
490
  }
378
491
  catch { /* a read-only legacy home is not a failure of the migration */ }
379
492
  }
@@ -20,4 +20,17 @@ export declare function isAbsolutePath(platform: Platform, p: string): boolean;
20
20
  /** Normalises separators and drops trailing ones, so `base + sep + name` is always well formed. */
21
21
  export declare function normalizeBase(platform: Platform, p: string): string;
22
22
  export declare function joinPath(platform: Platform, base: string, ...parts: string[]): string;
23
+ /**
24
+ * Where every kind lives: `<home>/.xeno/<kind>` on every OS, or `<XENO_HOME>/<kind>` when XENO_HOME is absolute.
25
+ *
26
+ * Owner decision, 2026-10-25 ("ok then lets have it done right"): one folder in the person's home that they and their
27
+ * agents can find, the way `~/.claude` and `~/.codex` are found, with the spec's structure inside it. Platform folders
28
+ * (APPDATA, LOCALAPPDATA, XDG_*, TMPDIR) no longer place anything. `resolvePlatformNativeRoots` keeps the previous
29
+ * placement so the migrator can find what 0.1.x-0.2.x wrote there.
30
+ */
23
31
  export declare function resolveRoots(input: ResolveInput): ResolvedRoots;
32
+ /**
33
+ * The platform-native placement of 0.1.x-0.2.x (XENO LOCAL HOME - SPEC.md section 4 before its 2026-10-25
34
+ * amendment). Not the default: the migrator reads it to find data those versions wrote.
35
+ */
36
+ export declare function resolvePlatformNativeRoots(input: ResolveInput): ResolvedRoots;
@@ -32,7 +32,41 @@ function getEnv(platform, env, name) {
32
32
  return env[k];
33
33
  return undefined;
34
34
  }
35
+ /**
36
+ * Where every kind lives: `<home>/.xeno/<kind>` on every OS, or `<XENO_HOME>/<kind>` when XENO_HOME is absolute.
37
+ *
38
+ * Owner decision, 2026-10-25 ("ok then lets have it done right"): one folder in the person's home that they and their
39
+ * agents can find, the way `~/.claude` and `~/.codex` are found, with the spec's structure inside it. Platform folders
40
+ * (APPDATA, LOCALAPPDATA, XDG_*, TMPDIR) no longer place anything. `resolvePlatformNativeRoots` keeps the previous
41
+ * placement so the migrator can find what 0.1.x-0.2.x wrote there.
42
+ */
35
43
  export function resolveRoots(input) {
44
+ const { platform, home, env } = input;
45
+ const sep = SEP[platform];
46
+ const override = getEnv(platform, env, 'XENO_HOME');
47
+ const warnings = [];
48
+ let base;
49
+ if (override !== undefined && override !== '') {
50
+ if (isAbsolutePath(platform, override))
51
+ base = normalizeBase(platform, override);
52
+ else
53
+ warnings.push('xeno-home-relative-ignored');
54
+ }
55
+ const overridden = base !== undefined;
56
+ if (base === undefined) {
57
+ if (!home || !isAbsolutePath(platform, home)) {
58
+ throw new DirsError('home-unresolvable', 'the home directory is unknown or relative, and no XENO_HOME override is set');
59
+ }
60
+ base = normalizeBase(platform, home) + sep + INPUTS_JSON.inputs.defaultHomeDir.value;
61
+ }
62
+ const roots = Object.fromEntries(KINDS.map((k) => [k, base + sep + k]));
63
+ return { platform, roots, warnings, overridden };
64
+ }
65
+ /**
66
+ * The platform-native placement of 0.1.x-0.2.x (XENO LOCAL HOME - SPEC.md section 4 before its 2026-10-25
67
+ * amendment). Not the default: the migrator reads it to find data those versions wrote.
68
+ */
69
+ export function resolvePlatformNativeRoots(input) {
36
70
  const { platform, home, env } = input;
37
71
  const warnings = [];
38
72
  const get = (n) => getEnv(platform, env, n);
@@ -109,6 +109,13 @@ export declare const INPUTS_JSON: {
109
109
  source: string;
110
110
  note: string;
111
111
  };
112
+ defaultHomeDir: {
113
+ value: string;
114
+ status: string;
115
+ decided: string;
116
+ source: string;
117
+ note: string;
118
+ };
112
119
  };
113
120
  legacyHomes: string[];
114
121
  windowsVendorDir: string;
@@ -195,6 +195,13 @@ export const INPUTS_JSON = {
195
195
  "decided": "2026-10-11",
196
196
  "source": "XENO LOCAL HOME - SPEC.md section 11.2",
197
197
  "note": "Releases after a product adopts the layout during which it still reads the legacy location. The legacy copy is never deleted automatically."
198
+ },
199
+ "defaultHomeDir": {
200
+ "value": ".xeno",
201
+ "status": "locked",
202
+ "decided": "2026-10-25",
203
+ "source": "XENO LOCAL HOME - SPEC.md section 4 (amended 2026-10-25)",
204
+ "note": "The default XENO home is <user home>/<value> on every OS, with config/data/secrets/state/cache/run inside. XENO_HOME overrides it. Platform folders (APPDATA, LOCALAPPDATA, XDG_*, TMPDIR) no longer place anything."
198
205
  }
199
206
  },
200
207
  "legacyHomes": [
@@ -210,7 +217,7 @@ export const INPUTS_JSON = {
210
217
  "$comment2": "secretsKeyService/Account name the single OS-store entry that holds the per-machine master key (spec section 6). The service equals the locked bundle identifier."
211
218
  };
212
219
  export const LEGACY_MAP_JSON = {
213
- "$comment": "Built-in migration rules: legacy file -> registered location. Deliberately minimal: only mappings the ecosystem documents explicitly. Each product owner supplies the rest as rules; anything unmatched is reported as unplaced, never guessed (XENO LOCAL HOME - SPEC.md section 10.6). A 'copy' rule names kind+area+segments; a 'secret' rule names area+name and needs a secret sink. '{file}' stands for the matched file name; only the last path segment of 'match' may contain '*'.",
220
+ "$comment": "Built-in migration rules: legacy file -> registered location. Deliberately minimal: only mappings the ecosystem documents explicitly. Each product owner supplies the rest as rules; anything unmatched is reported as unplaced, never guessed (XENO LOCAL HOME - SPEC.md section 10.6). A 'copy' rule names kind+area+segments; a 'secret' rule names area+name and needs a secret sink. '{file}' stands for the matched file name; only the last path segment of 'match' may contain '*'. A 'match' ending in '/**' (0.3.1) is a tree rule: it matches every file below that prefix at any depth, must be a copy, and names the remainder with exactly one whole '{path}' target segment; links inside the tree are refused, never followed.",
214
221
  "rules": [
215
222
  {
216
223
  "id": "shell-window-state",
@@ -225,6 +232,66 @@ export const LEGACY_MAP_JSON = {
225
232
  ]
226
233
  },
227
234
  "source": "xeno-primitives/ADOPTION.md, xeno-shell row (~/.xeno/shell/state.json -> apps/shell); window state is kind state (LOCAL HOME spec section 5)"
235
+ },
236
+ {
237
+ "id": "extensions-plugins",
238
+ "legacyHome": ".xeno",
239
+ "match": "plugins/**",
240
+ "action": "copy",
241
+ "target": {
242
+ "kind": "data",
243
+ "area": "extensions",
244
+ "segments": [
245
+ "plugins",
246
+ "{path}"
247
+ ]
248
+ },
249
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; installed plugins, their registry, trust decisions and event log are one tree owned by the SDK plugin host"
250
+ },
251
+ {
252
+ "id": "extensions-mcp-servers",
253
+ "legacyHome": ".xeno",
254
+ "match": "mcp/servers.json",
255
+ "action": "copy",
256
+ "target": {
257
+ "kind": "config",
258
+ "area": "extensions",
259
+ "segments": [
260
+ "mcp",
261
+ "servers.json"
262
+ ]
263
+ },
264
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; MCP server definitions and policies are settings"
265
+ },
266
+ {
267
+ "id": "extensions-mcp-sdk-approvals",
268
+ "legacyHome": ".xeno",
269
+ "match": "mcp/sdk-approvals.json",
270
+ "action": "copy",
271
+ "target": {
272
+ "kind": "config",
273
+ "area": "extensions",
274
+ "segments": [
275
+ "mcp",
276
+ "sdk-approvals.json"
277
+ ]
278
+ },
279
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; hash-bound approvals for SDK-configured servers are settings"
280
+ },
281
+ {
282
+ "id": "extensions-mcp-approval-log",
283
+ "legacyHome": ".xeno",
284
+ "match": "mcp/approvals.jsonl",
285
+ "action": "copy",
286
+ "target": {
287
+ "kind": "data",
288
+ "area": "extensions",
289
+ "segments": [
290
+ "mcp",
291
+ "approvals.jsonl"
292
+ ]
293
+ },
294
+ "source": "XENO LOCAL HOME - SPEC.md section 5 (extensions: config, data, cache) and xeno-primitives/ADOPTION.md 0.3.1: the Agent host plugin/MCP store (xeno-agent-interface PluginMcpManagerService) moves from ~/.xeno/{plugins,mcp}; the approval audit history cannot be re-created"
228
295
  }
229
296
  ]
230
297
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenosystem/primitives",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "XENO back-end rung 1 primitives: dirs (the XENO local home), secrets (envelope-encrypted credentials) and updates (the gated app updater).",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",