@evomap/evolver-proxy 2.0.0-beta.6 → 2.0.0-beta.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.
@@ -12,32 +12,29 @@ export interface LegacyNodeIdCandidateOptions {
12
12
  * Legacy node_id file locations, in priority order. Mirror of v1
13
13
  * `_loadPersistedNodeId`:
14
14
  *
15
- * 0. `<EVOMAP_DIR>/node_id` — the explicit dir the CLI recipe / ATP / proxy
15
+ * 0. `<EVOMAP_HOME>/node_id` — when an explicit identity home is configured, it
16
+ * must precede every state-root candidate. The legacy node_secret resolver uses
17
+ * the same priority, keeping both credentials on one identity in split layouts.
18
+ * 1. `<EVOMAP_DIR>/node_id` — the explicit dir the CLI recipe / ATP / proxy
16
19
  * anti-abuse code write under (`recipeHomeCandidates` puts EVOMAP_DIR ahead
17
20
  * of EVOLVER_HOME/EVOMAP_HOME). `resolveEvomapHome` never consults EVOMAP_DIR,
18
21
  * so a deployment that pivots on it would otherwise send no node_id on hello
19
- * and let the hub mint a duplicate. Probed FIRST and ADDITIVELY (the
20
- * EVOLVER_HOME/EVOMAP_HOME candidates below are kept), so setting EVOMAP_DIR
21
- * never hides an id that lives under one of the home overrides. Deduped.
22
- * 1. `<identity home>/node_id` the override-aware home files. `identityHomeCandidates()`
23
- * probes EVOMAP_HOME first (THE identity home, #555 T2 the evox agentDir split keeps
24
- * node files under `<agentDir>/evomap` while EVOLVER_HOME points at the state root) and
25
- * then EVOLVER_HOME (matching v1 `getEvomapDir`), after dropping blank/relative
26
- * overrides. Probing both keeps the v1 #120 lesson — the reader walks every dir a
27
- * writer may have used — while the order makes a split identity dir win over the
28
- * state root when both hold files.
29
- * 2. `~/.evomap/node_id` — the UNCONDITIONAL v1 location. v1's writer pivots on
22
+ * and let the hub mint a duplicate. It remains first when EVOMAP_HOME is not
23
+ * configured, preserving the existing EVOMAP_DIR-only contract. Deduped.
24
+ * 2. `<EVOLVER_HOME>/node_id` the state-home compatibility candidate, kept
25
+ * after the identity roots so readers still walk every dir a writer may have used.
26
+ * 3. `~/.evomap/node_id` the UNCONDITIONAL v1 location. v1's writer pivots on
30
27
  * `getEvomapDir` = `EVOLVER_HOME || ~/.evomap` and ignores EVOMAP_HOME
31
28
  * entirely, so unless EVOLVER_HOME was set a v1 file always physically lands
32
29
  * here. We probe it explicitly so a v2 install that sets only EVOMAP_HOME
33
30
  * (which steers candidate 1 away from `~/.evomap`) still recovers the v1
34
31
  * identity instead of letting the hub mint a duplicate orphan node. Deduped
35
32
  * against candidate 1 for the common no-override case where they coincide.
36
- * 3. `<proxy package>/.evomap_node_id` — the install-root file the writer falls
33
+ * 4. `<proxy package>/.evomap_node_id` — the install-root file the writer falls
37
34
  * back to when `~/.evomap/` isn't writable (read-only $HOME in
38
35
  * containers / restricted CI). Kept first for parity with the old v2
39
36
  * candidate.
40
- * 4. `<outer package/workspace root>/.evomap_node_id` — the v1/outer install
37
+ * 5. `<outer package/workspace root>/.evomap_node_id` — the v1/outer install
41
38
  * root fallback. In v2's multi-package layout the proxy code lives below
42
39
  * `packages/evolver-proxy`, so only checking the proxy package root misses
43
40
  * a file written at the install/workspace root.
@@ -19,9 +19,10 @@ function cleanAbsolutePath(value) {
19
19
  }
20
20
  // Identity homes in probe order (#555 T2): the explicit test/caller override wins outright; otherwise
21
21
  // EVOMAP_HOME (THE identity home) outranks EVOLVER_HOME (the state root) so the evox agentDir split
22
- // (`--evomap-home <agentDir>/evomap` + `--home <agentDir>/evolver`) reads node files from the evomap dir
23
- // instead of missing them and falling through to the machine-global ~/.evomap node. Both homes stay in the
24
- // candidate union, so single-home setups resolve exactly as before.
22
+ // (`--evomap-home <agentDir>/evomap` + `--home <agentDir>/evolver`) reads node files from the evomap dir.
23
+ // legacyNodeIdCandidates() splices that explicit identity home ahead of EVOMAP_DIR so node_id and
24
+ // node_secret cannot come from different halves of the split layout. Both homes stay in the candidate union,
25
+ // so single-home setups resolve exactly as before.
25
26
  function identityHomeCandidates(opts, fallbackHomeDir) {
26
27
  const fromOpts = cleanAbsolutePath(opts.evomapHomeDir);
27
28
  if (fromOpts !== undefined)
@@ -70,32 +71,29 @@ function installRootNodeIdCandidates(moduleDir) {
70
71
  * Legacy node_id file locations, in priority order. Mirror of v1
71
72
  * `_loadPersistedNodeId`:
72
73
  *
73
- * 0. `<EVOMAP_DIR>/node_id` — the explicit dir the CLI recipe / ATP / proxy
74
+ * 0. `<EVOMAP_HOME>/node_id` — when an explicit identity home is configured, it
75
+ * must precede every state-root candidate. The legacy node_secret resolver uses
76
+ * the same priority, keeping both credentials on one identity in split layouts.
77
+ * 1. `<EVOMAP_DIR>/node_id` — the explicit dir the CLI recipe / ATP / proxy
74
78
  * anti-abuse code write under (`recipeHomeCandidates` puts EVOMAP_DIR ahead
75
79
  * of EVOLVER_HOME/EVOMAP_HOME). `resolveEvomapHome` never consults EVOMAP_DIR,
76
80
  * so a deployment that pivots on it would otherwise send no node_id on hello
77
- * and let the hub mint a duplicate. Probed FIRST and ADDITIVELY (the
78
- * EVOLVER_HOME/EVOMAP_HOME candidates below are kept), so setting EVOMAP_DIR
79
- * never hides an id that lives under one of the home overrides. Deduped.
80
- * 1. `<identity home>/node_id` the override-aware home files. `identityHomeCandidates()`
81
- * probes EVOMAP_HOME first (THE identity home, #555 T2 the evox agentDir split keeps
82
- * node files under `<agentDir>/evomap` while EVOLVER_HOME points at the state root) and
83
- * then EVOLVER_HOME (matching v1 `getEvomapDir`), after dropping blank/relative
84
- * overrides. Probing both keeps the v1 #120 lesson — the reader walks every dir a
85
- * writer may have used — while the order makes a split identity dir win over the
86
- * state root when both hold files.
87
- * 2. `~/.evomap/node_id` — the UNCONDITIONAL v1 location. v1's writer pivots on
81
+ * and let the hub mint a duplicate. It remains first when EVOMAP_HOME is not
82
+ * configured, preserving the existing EVOMAP_DIR-only contract. Deduped.
83
+ * 2. `<EVOLVER_HOME>/node_id` the state-home compatibility candidate, kept
84
+ * after the identity roots so readers still walk every dir a writer may have used.
85
+ * 3. `~/.evomap/node_id` the UNCONDITIONAL v1 location. v1's writer pivots on
88
86
  * `getEvomapDir` = `EVOLVER_HOME || ~/.evomap` and ignores EVOMAP_HOME
89
87
  * entirely, so unless EVOLVER_HOME was set a v1 file always physically lands
90
88
  * here. We probe it explicitly so a v2 install that sets only EVOMAP_HOME
91
89
  * (which steers candidate 1 away from `~/.evomap`) still recovers the v1
92
90
  * identity instead of letting the hub mint a duplicate orphan node. Deduped
93
91
  * against candidate 1 for the common no-override case where they coincide.
94
- * 3. `<proxy package>/.evomap_node_id` — the install-root file the writer falls
92
+ * 4. `<proxy package>/.evomap_node_id` — the install-root file the writer falls
95
93
  * back to when `~/.evomap/` isn't writable (read-only $HOME in
96
94
  * containers / restricted CI). Kept first for parity with the old v2
97
95
  * candidate.
98
- * 4. `<outer package/workspace root>/.evomap_node_id` — the v1/outer install
96
+ * 5. `<outer package/workspace root>/.evomap_node_id` — the v1/outer install
99
97
  * root fallback. In v2's multi-package layout the proxy code lives below
100
98
  * `packages/evolver-proxy`, so only checking the proxy package root misses
101
99
  * a file written at the install/workspace root.
@@ -110,11 +108,16 @@ export function legacyNodeIdCandidates(opts = {}) {
110
108
  const home = cleanAbsolutePath(opts.homeDir) ?? cleanAbsolutePath(homedir());
111
109
  const moduleDir = opts.moduleDir ?? _moduleDir;
112
110
  const evomapHomes = identityHomeCandidates(opts, home);
111
+ const identityHome = cleanAbsolutePath(opts.evomapHomeDir)
112
+ ?? cleanAbsolutePath(process.env['EVOMAP_HOME']);
113
113
  const evomapDir = cleanAbsolutePath(opts.evomapDir) ?? cleanAbsolutePath(process.env['EVOMAP_DIR']);
114
114
  return [
115
115
  ...new Set([
116
+ ...(identityHome === undefined ? [] : [join(identityHome, 'node_id')]),
116
117
  ...(evomapDir === undefined ? [] : [join(evomapDir, 'node_id')]),
117
- ...evomapHomes.map((dir) => join(dir, 'node_id')),
118
+ ...evomapHomes
119
+ .filter((dir) => dir !== identityHome)
120
+ .map((dir) => join(dir, 'node_id')),
118
121
  ...(home === undefined ? [] : [join(home, '.evomap', 'node_id')]),
119
122
  ...installRootNodeIdCandidates(moduleDir),
120
123
  ]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evomap/evolver-proxy",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "系统级 mailbox/hub 同步 daemon (Node)",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@aws-sdk/client-bedrock-runtime": "^3.1053.0",
29
- "@evomap/evolver-adapter-public": "2.0.0-beta.6",
30
- "@evomap/evolver-core": "2.0.0-beta.6"
29
+ "@evomap/evolver-adapter-public": "2.0.0-beta.7",
30
+ "@evomap/evolver-core": "2.0.0-beta.7"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",