@evomap/evolver-proxy 2.0.0 → 2.0.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.
@@ -1,124 +1 @@
1
- const DEFAULT_COOLDOWN_MS = 6 * 60 * 60_000;
2
- const MIN_COOLDOWN_MS = 60_000;
3
- const MAX_COOLDOWN_MS = 30 * 24 * 60 * 60_000;
4
- const MAX_STATE_ENTRIES = 32;
5
- const STATE_KEY = 'lifecycle:claim_nudge:v1';
6
- const CLAIM_CODE_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{1,127}$/;
7
- export function createClaimNudge(options) {
8
- const env = options.env ?? process.env;
9
- const now = options.now ?? (() => Date.now());
10
- const write = options.write ?? ((text) => { process.stderr.write(text); });
11
- let memory = { version: 1, entries: {} };
12
- return (result) => {
13
- if (!result.ok || env['EVOLVER_DISABLE_CLAIM_NUDGE'] === '1')
14
- return false;
15
- const code = normalizeClaimCode(result.claimCode);
16
- const url = code ? trustedClaimUrl(result.claimUrl, options.hubUrl) : undefined;
17
- if (!code || !url)
18
- return false;
19
- const at = now();
20
- const cooldownMs = claimNudgeCooldownMs(env['EVOLVER_CLAIM_NUDGE_COOLDOWN_MS']);
21
- const state = mergeState(readState(options.store), memory);
22
- const lastPrintedAt = state.entries[code] ?? 0;
23
- if (lastPrintedAt > 0 && at - lastPrintedAt < cooldownMs)
24
- return false;
25
- const message = [
26
- '',
27
- '[evolver-proxy] This node is not linked to an EvoMap web account.',
28
- `Claim URL: ${url}`,
29
- `Claim code: ${code}`,
30
- 'Claiming is optional; the proxy continues to run without it.',
31
- '',
32
- ].join('\n');
33
- try {
34
- write(message);
35
- }
36
- catch {
37
- return false;
38
- }
39
- memory = pruneState({ ...state.entries, [code]: at });
40
- try {
41
- options.store.setState(STATE_KEY, JSON.stringify(memory));
42
- }
43
- catch { /* memory still suppresses repeats */ }
44
- return true;
45
- };
46
- }
47
- export function wrapHelloWithClaimNudge(hello, nudge) {
48
- return async (options) => {
49
- const result = await hello(options);
50
- try {
51
- nudge(result);
52
- }
53
- catch { /* a terminal nudge must never break hello */ }
54
- return result;
55
- };
56
- }
57
- export function claimNudgeCooldownMs(raw) {
58
- const parsed = Number(raw);
59
- if (!Number.isFinite(parsed) || parsed <= 0)
60
- return DEFAULT_COOLDOWN_MS;
61
- return Math.max(MIN_COOLDOWN_MS, Math.min(Math.floor(parsed), MAX_COOLDOWN_MS));
62
- }
63
- function normalizeClaimCode(value) {
64
- const code = value?.trim();
65
- return code && CLAIM_CODE_RE.test(code) ? code : undefined;
66
- }
67
- function trustedClaimUrl(value, hubUrl) {
68
- const raw = value?.trim();
69
- if (!raw || raw.length > 2_048)
70
- return undefined;
71
- try {
72
- const url = new URL(raw);
73
- const hub = new URL(hubUrl);
74
- if (url.username || url.password)
75
- return undefined;
76
- const sameOrigin = url.origin === hub.origin;
77
- const evomapHost = url.hostname === 'evomap.ai' || url.hostname.endsWith('.evomap.ai');
78
- if (url.protocol === 'https:' && (sameOrigin || evomapHost))
79
- return url.toString();
80
- if (url.protocol === 'http:' && sameOrigin && isLoopback(url.hostname))
81
- return url.toString();
82
- }
83
- catch {
84
- // Invalid or non-absolute URLs are never printed.
85
- }
86
- return undefined;
87
- }
88
- function isLoopback(hostname) {
89
- return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '[::1]';
90
- }
91
- function readState(store) {
92
- try {
93
- const raw = store.getState(STATE_KEY);
94
- if (!raw)
95
- return { version: 1, entries: {} };
96
- const parsed = JSON.parse(raw);
97
- if (parsed.version !== 1 || !parsed.entries || typeof parsed.entries !== 'object' || Array.isArray(parsed.entries)) {
98
- return { version: 1, entries: {} };
99
- }
100
- const entries = {};
101
- for (const [code, value] of Object.entries(parsed.entries)) {
102
- if (CLAIM_CODE_RE.test(code) && typeof value === 'number' && Number.isFinite(value) && value > 0)
103
- entries[code] = value;
104
- }
105
- return { version: 1, entries };
106
- }
107
- catch {
108
- return { version: 1, entries: {} };
109
- }
110
- }
111
- function mergeState(a, b) {
112
- const entries = { ...a.entries };
113
- for (const [code, at] of Object.entries(b.entries))
114
- entries[code] = Math.max(entries[code] ?? 0, at);
115
- return { version: 1, entries };
116
- }
117
- function pruneState(entries) {
118
- return {
119
- version: 1,
120
- entries: Object.fromEntries(Object.entries(entries)
121
- .sort((left, right) => right[1] - left[1])
122
- .slice(0, MAX_STATE_ENTRIES)),
123
- };
124
- }
1
+ const _0x32f8b4=_0x5767;(function(_0x3516bf,_0x2ecabd){const _0x526c54=_0x5767,_0x3ec89a=_0x3516bf();while(!![]){try{const _0x5cee3d=parseInt(_0x526c54(0x101,'\x67\x74\x50\x29'))/(-0x9b3*0x4+0x11bf+0x150e)+parseInt(_0x526c54(0x161,'\x6d\x41\x25\x63'))/(-0x1f6c+-0x19cf+0x393d)+-parseInt(_0x526c54(0x149,'\x28\x45\x67\x31'))/(0x1e03+0x45*0xf+-0x220b)+parseInt(_0x526c54(0x145,'\x76\x4f\x54\x46'))/(-0x679+-0x1c46*0x1+0x22c3)+-parseInt(_0x526c54(0xff,'\x29\x53\x72\x6f'))/(0xef5+0xf3*0x1f+-0x2c5d*0x1)+parseInt(_0x526c54(0x11a,'\x6d\x71\x69\x51'))/(-0x4*-0x67b+0x25dc+-0x3fc2)*(parseInt(_0x526c54(0x12d,'\x2a\x42\x63\x25'))/(0x7f8+0x8*-0x1e7+-0x1*-0x747))+parseInt(_0x526c54(0x163,'\x36\x33\x53\x36'))/(-0x31*-0x97+-0x66*-0x38+-0x332f)*(-parseInt(_0x526c54(0xfd,'\x47\x5d\x61\x47'))/(0x1d62+-0x2332+0x1*0x5d9));if(_0x5cee3d===_0x2ecabd)break;else _0x3ec89a['push'](_0x3ec89a['shift']());}catch(_0x5e3302){_0x3ec89a['push'](_0x3ec89a['shift']());}}}(_0x3cc8,-0x1*0xa9cc+-0x8b*-0x1539+-0x3c292));function _0x3cc8(){const _0x59e46f=['\x6e\x32\x5a\x64\x4f\x53\x6f\x39\x57\x36\x76\x64\x57\x50\x78\x63\x4c\x57','\x6b\x47\x70\x63\x54\x43\x6f\x42\x57\x35\x66\x59\x57\x36\x33\x63\x47\x57','\x57\x37\x69\x67\x57\x50\x4a\x63\x49\x38\x6f\x71\x57\x36\x74\x64\x4a\x71','\x57\x52\x5a\x63\x4f\x63\x52\x64\x54\x48\x68\x64\x52\x53\x6b\x69\x41\x61','\x57\x51\x7a\x45\x57\x35\x61','\x67\x6d\x6f\x7a\x57\x36\x4a\x63\x50\x4b\x54\x78\x6b\x43\x6b\x4e\x6c\x65\x78\x63\x4a\x43\x6b\x77\x57\x34\x34','\x57\x34\x52\x64\x55\x64\x69\x4f\x74\x6d\x6b\x38','\x73\x78\x64\x64\x56\x43\x6f\x52','\x6c\x43\x6f\x39\x69\x77\x70\x64\x55\x6d\x6f\x33\x57\x35\x74\x63\x4c\x72\x6c\x63\x4c\x59\x69','\x57\x36\x2f\x64\x55\x62\x70\x64\x4f\x74\x79','\x57\x37\x44\x6d\x57\x35\x76\x32\x57\x52\x5a\x64\x4c\x30\x4e\x63\x53\x61','\x66\x4b\x78\x64\x47\x38\x6f\x72\x57\x37\x66\x4c\x57\x51\x37\x63\x53\x57','\x57\x35\x30\x39\x57\x37\x76\x2f\x57\x51\x75','\x74\x43\x6f\x65\x41\x67\x47\x69\x57\x37\x64\x63\x4b\x61','\x57\x37\x64\x63\x4b\x4e\x70\x64\x48\x43\x6b\x69\x57\x35\x4b','\x57\x4f\x46\x64\x4b\x6d\x6f\x4f\x57\x34\x30\x76\x57\x52\x62\x6a\x57\x34\x5a\x64\x54\x43\x6f\x64\x57\x35\x65\x70\x57\x37\x4b','\x57\x52\x75\x39\x61\x38\x6b\x6e\x57\x4f\x50\x62\x57\x37\x57\x75','\x77\x68\x56\x64\x4a\x43\x6b\x51\x57\x51\x75\x41\x57\x50\x78\x63\x47\x77\x58\x34\x62\x6d\x6f\x69\x57\x36\x34','\x78\x43\x6b\x70\x57\x4f\x5a\x64\x4f\x47\x61\x6b\x46\x53\x6b\x52','\x6c\x66\x66\x75\x75\x43\x6f\x57\x57\x50\x33\x64\x4e\x38\x6b\x72\x66\x43\x6b\x6e\x6a\x38\x6b\x44\x57\x52\x69','\x77\x53\x6f\x57\x65\x63\x69\x62\x76\x57','\x65\x53\x6b\x32\x72\x6d\x6f\x6b\x72\x6d\x6b\x44\x57\x37\x52\x64\x4c\x71','\x6b\x6d\x6f\x66\x57\x37\x74\x63\x54\x6d\x6b\x38\x6b\x43\x6f\x4d\x57\x34\x69','\x46\x38\x6f\x4f\x73\x76\x4f\x4a\x57\x35\x70\x63\x55\x38\x6f\x48','\x45\x5a\x70\x64\x4a\x67\x76\x30\x57\x51\x52\x63\x4e\x38\x6f\x67','\x42\x38\x6b\x53\x57\x4f\x33\x64\x4f\x43\x6f\x38\x78\x33\x66\x74','\x57\x34\x4e\x64\x52\x5a\x75\x4f\x75\x43\x6b\x36','\x43\x6d\x6b\x63\x57\x4f\x56\x64\x50\x43\x6f\x52\x44\x38\x6b\x4b\x57\x37\x62\x47\x57\x50\x5a\x63\x52\x6d\x6b\x36\x6a\x47','\x77\x38\x6b\x30\x70\x73\x2f\x64\x4b\x76\x78\x64\x47\x71','\x68\x38\x6f\x56\x66\x38\x6b\x4d\x69\x71','\x6f\x43\x6b\x31\x76\x53\x6f\x78\x72\x38\x6f\x43\x57\x37\x74\x64\x4e\x57','\x76\x53\x6f\x46\x71\x31\x5a\x63\x50\x53\x6f\x4c\x57\x37\x2f\x63\x4c\x57','\x63\x38\x6b\x4d\x71\x38\x6f\x49\x57\x51\x46\x64\x4e\x47','\x69\x62\x48\x2b\x78\x57\x56\x63\x53\x64\x6e\x4c\x63\x43\x6f\x68\x57\x50\x2f\x64\x51\x38\x6f\x67','\x69\x32\x78\x64\x4d\x38\x6b\x44\x57\x34\x6a\x71\x70\x4e\x44\x50\x66\x43\x6b\x4c\x6d\x61','\x57\x52\x33\x63\x56\x76\x48\x72\x57\x50\x76\x4b\x78\x53\x6b\x36\x57\x50\x56\x64\x56\x78\x65\x5a','\x63\x49\x70\x63\x4c\x43\x6f\x37\x57\x37\x66\x34\x57\x35\x68\x63\x55\x47','\x41\x63\x68\x63\x48\x6d\x6f\x46\x57\x50\x79','\x57\x51\x79\x6f\x79\x30\x42\x63\x55\x38\x6b\x32\x57\x50\x62\x4b','\x73\x4d\x5a\x64\x4b\x53\x6f\x53\x57\x52\x46\x64\x50\x64\x65\x4f','\x74\x66\x6c\x64\x54\x43\x6f\x31\x57\x37\x4e\x64\x55\x49\x61\x56','\x68\x6d\x6b\x31\x77\x6d\x6f\x72\x77\x61','\x57\x4f\x34\x65\x79\x32\x68\x63\x55\x57','\x57\x51\x65\x51\x76\x53\x6f\x7a','\x78\x72\x6a\x4d','\x46\x49\x70\x63\x48\x6d\x6f\x61\x57\x50\x69\x77\x78\x76\x4f','\x57\x37\x64\x63\x4a\x43\x6f\x4e\x57\x52\x37\x63\x50\x64\x4c\x75\x66\x47','\x70\x32\x56\x64\x51\x61','\x61\x6d\x6f\x5a\x72\x38\x6f\x5a\x57\x36\x6c\x64\x47\x4e\x48\x50','\x41\x71\x71\x46\x65\x47','\x65\x43\x6b\x32\x78\x43\x6f\x30','\x57\x50\x6c\x64\x56\x63\x65','\x57\x4f\x6d\x72\x57\x52\x61\x74\x57\x35\x50\x56\x57\x36\x56\x63\x4c\x47','\x44\x6d\x6f\x7a\x44\x31\x71','\x68\x43\x6f\x55\x67\x38\x6b\x47\x6b\x49\x70\x63\x4f\x75\x34','\x6f\x49\x61\x32\x67\x43\x6b\x6b\x57\x51\x38\x46\x46\x71','\x57\x34\x52\x64\x4d\x64\x33\x64\x48\x57\x4e\x64\x49\x6d\x6b\x5a\x78\x47','\x45\x61\x38\x79\x66\x6d\x6b\x48\x57\x34\x52\x63\x4e\x61','\x57\x51\x6d\x39\x61\x38\x6b\x75\x57\x51\x62\x6d\x57\x36\x43\x6b','\x69\x59\x61\x51\x57\x35\x78\x64\x54\x53\x6f\x41\x6f\x6d\x6f\x35','\x7a\x4e\x35\x6e\x57\x50\x68\x64\x52\x43\x6f\x46\x68\x53\x6f\x55\x79\x67\x43','\x68\x4e\x4c\x73\x6a\x38\x6b\x66','\x74\x47\x79\x5a\x43\x65\x52\x63\x50\x31\x62\x67','\x57\x51\x78\x64\x52\x61\x53\x63\x57\x34\x53\x4e\x46\x43\x6b\x63','\x67\x58\x50\x72\x57\x34\x78\x64\x4d\x61\x62\x76\x74\x57','\x70\x71\x47\x79\x73\x61','\x68\x38\x6b\x56\x77\x6d\x6f\x74\x73\x38\x6b\x6d\x57\x52\x4e\x64\x4b\x71','\x57\x35\x68\x64\x49\x43\x6f\x69\x45\x6d\x6b\x59','\x44\x53\x6f\x42\x75\x73\x30\x62\x46\x4c\x5a\x64\x52\x61','\x74\x43\x6b\x4a\x6a\x47\x2f\x64\x51\x61','\x61\x38\x6b\x31\x75\x67\x69\x42\x61\x43\x6f\x37\x57\x34\x46\x63\x53\x5a\x4b','\x64\x43\x6b\x69\x67\x64\x57\x5a','\x67\x38\x6f\x59\x64\x6d\x6b\x4d','\x57\x4f\x6e\x4e\x57\x4f\x76\x34\x57\x35\x71','\x63\x53\x6b\x39\x74\x38\x6f\x53\x57\x37\x4e\x63\x4a\x67\x6e\x31','\x65\x49\x33\x63\x4f\x53\x6b\x31\x57\x36\x64\x63\x56\x78\x65\x46\x57\x4f\x30\x30\x69\x53\x6f\x31\x57\x4f\x38','\x57\x35\x37\x63\x50\x53\x6b\x53\x78\x53\x6b\x2b\x57\x4f\x46\x64\x48\x71\x47','\x57\x35\x46\x64\x50\x71\x78\x64\x50\x6d\x6b\x67\x65\x53\x6f\x51\x57\x37\x57','\x57\x37\x43\x79\x57\x34\x6a\x4f\x57\x52\x74\x64\x4d\x31\x43','\x76\x6d\x6f\x4d\x67\x38\x6b\x58\x57\x37\x64\x64\x4c\x78\x35\x2b\x72\x4c\x53\x42','\x74\x67\x33\x64\x56\x43\x6f\x49\x57\x52\x64\x64\x4f\x57','\x75\x38\x6b\x70\x57\x34\x61','\x57\x35\x78\x63\x50\x43\x6b\x2b\x71\x38\x6b\x39\x57\x51\x78\x64\x48\x57\x4b','\x77\x53\x6b\x31\x78\x53\x6f\x71\x71\x43\x6b\x7a\x57\x37\x70\x63\x4b\x61','\x57\x34\x70\x63\x4f\x6d\x6b\x73\x6a\x6d\x6b\x4d\x41\x38\x6f\x74\x6c\x71','\x62\x58\x50\x59\x57\x35\x37\x64\x4d\x61\x48\x6d\x74\x57','\x57\x36\x74\x64\x54\x71\x71','\x44\x6d\x6b\x39\x44\x47\x46\x63\x55\x6d\x6f\x49','\x6d\x38\x6f\x43\x76\x4e\x38\x68\x41\x31\x53','\x79\x38\x6b\x36\x57\x36\x57\x2f','\x57\x34\x6c\x63\x4a\x43\x6b\x55\x57\x4f\x57','\x57\x34\x6c\x63\x55\x38\x6b\x32\x72\x57','\x6c\x6d\x6f\x78\x57\x34\x4f','\x57\x4f\x35\x42\x57\x4f\x50\x57\x57\x37\x71\x71\x57\x36\x2f\x63\x51\x57','\x57\x35\x4a\x63\x56\x6d\x6b\x59\x73\x6d\x6b\x31\x57\x50\x71','\x64\x67\x2f\x63\x48\x6d\x6f\x47\x57\x37\x6e\x76\x57\x35\x52\x64\x54\x47','\x71\x43\x6b\x70\x57\x51\x5a\x64\x4f\x48\x57\x63\x46\x43\x6b\x50','\x57\x35\x33\x63\x53\x65\x4a\x64\x55\x43\x6b\x54\x57\x51\x7a\x35\x57\x4f\x61','\x57\x4f\x38\x70\x57\x51\x2f\x63\x50\x58\x72\x51','\x70\x67\x33\x64\x53\x71','\x65\x6d\x6b\x46\x45\x4c\x42\x63\x4c\x47','\x57\x51\x72\x7a\x57\x51\x30\x70\x57\x35\x50\x5a\x57\x37\x68\x63\x4e\x61','\x57\x51\x75\x64\x45\x76\x42\x63\x51\x71','\x57\x4f\x46\x64\x55\x38\x6f\x50\x67\x53\x6f\x50\x57\x35\x42\x63\x4e\x64\x39\x36\x57\x4f\x43\x4c\x79\x6d\x6f\x36','\x57\x35\x5a\x63\x49\x57\x4f\x4f\x57\x37\x70\x63\x54\x59\x66\x65','\x57\x37\x4e\x64\x50\x48\x70\x64\x55\x49\x56\x64\x54\x6d\x6b\x73\x7a\x57','\x70\x59\x61\x6b\x57\x35\x78\x64\x51\x53\x6f\x73\x6f\x38\x6f\x37','\x57\x37\x69\x6a\x57\x50\x68\x64\x55\x6d\x6f\x58\x41\x4e\x74\x64\x51\x77\x62\x6e\x73\x43\x6b\x44\x67\x61','\x57\x35\x5a\x64\x4b\x38\x6f\x69\x45\x53\x6f\x48\x57\x50\x42\x64\x4b\x71','\x6b\x43\x6f\x63\x57\x34\x42\x63\x52\x43\x6f\x4f','\x6e\x4e\x6e\x74\x61\x6d\x6b\x78','\x77\x43\x6b\x62\x57\x51\x5a\x64\x50\x71\x75\x6d\x79\x53\x6b\x4f','\x57\x52\x69\x39\x62\x43\x6b\x6e\x57\x4f\x61','\x57\x50\x6c\x64\x54\x64\x43','\x57\x35\x2f\x64\x51\x4a\x62\x49\x6b\x66\x74\x63\x52\x32\x57','\x57\x51\x74\x64\x50\x61\x37\x64\x4f\x74\x5a\x64\x52\x53\x6b\x47\x6b\x57'];_0x3cc8=function(){return _0x59e46f;};return _0x3cc8();}const DEFAULT_COOLDOWN_MS=(-0x147c+0x1*-0xbbf+0x167*0x17)*(-0x2167+-0x1190+0x3333)*(0x13b34*-0x1+-0x1a394+0x3c928),MIN_COOLDOWN_MS=0x782a*-0x3+-0x137*0x5b+0x4021*0xb,MAX_COOLDOWN_MS=(-0x7fb+-0x250b+0x2d24)*(0x1*0x1dfb+-0x3*0x311+-0x14b0)*(-0x6*-0x51b+0x10*0x14c+-0x3326)*(0x1*-0x158d1+0x1405c+0x102d5),MAX_STATE_ENTRIES=-0x236*-0x1+0xcd+-0x2e3,STATE_KEY='\x6c\x69\x66\x65\x63\x79\x63\x6c'+_0x32f8b4(0x15c,'\x51\x32\x2a\x63')+_0x32f8b4(0x132,'\x5a\x73\x63\x78'),CLAIM_CODE_RE=/^[A-Za-z0-9][A-Za-z0-9_-]{1,127}$/;export function createClaimNudge(_0x289ffe){const _0x3c351c=_0x32f8b4,_0x434c02=_0x289ffe[_0x3c351c(0x156,'\x28\x45\x67\x31')]??process.env,_0xd1caf2=_0x289ffe[_0x3c351c(0x141,'\x77\x45\x39\x28')]??(()=>Date['\x6e\x6f\x77']()),_0x16c39b=_0x289ffe[_0x3c351c(0x14e,'\x39\x43\x36\x56')]??(_0xd67e6e=>{const _0x282587=_0x3c351c;process['\x73\x74\x64\x65\x72\x72'][_0x282587(0xfb,'\x51\x4b\x7a\x75')](_0xd67e6e);});let _0x1bda7f={'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':{}};return _0x1723bc=>{const _0x3a1f58=_0x3c351c;if(_0x3a1f58(0x14c,'\x5d\x78\x54\x6c')===_0x3a1f58(0x108,'\x62\x31\x61\x66')){if(!_0x1723bc['\x6f\x6b']||_0x434c02[_0x3a1f58(0x13f,'\x46\x6f\x4a\x23')+_0x3a1f58(0xf5,'\x70\x73\x73\x72')+_0x3a1f58(0x116,'\x61\x74\x6c\x77')+_0x3a1f58(0x12f,'\x56\x23\x52\x42')]==='\x31')return![];const _0x14b672=normalizeClaimCode(_0x1723bc[_0x3a1f58(0x130,'\x76\x4f\x54\x46')+'\x65']),_0x4596bb=_0x14b672?trustedClaimUrl(_0x1723bc[_0x3a1f58(0x102,'\x36\x33\x53\x36')],_0x289ffe[_0x3a1f58(0x135,'\x55\x74\x71\x59')]):undefined;if(!_0x14b672||!_0x4596bb)return![];const _0x2bca07=_0xd1caf2(),_0xf6c30d=claimNudgeCooldownMs(_0x434c02[_0x3a1f58(0xf7,'\x65\x23\x73\x37')+_0x3a1f58(0x153,'\x36\x33\x53\x36')+_0x3a1f58(0x15d,'\x77\x45\x39\x28')+'\x44\x4f\x57\x4e\x5f\x4d\x53']),_0x3652de=mergeState(readState(_0x289ffe[_0x3a1f58(0x142,'\x47\x5d\x61\x47')]),_0x1bda7f),_0x2147e3=_0x3652de[_0x3a1f58(0x117,'\x77\x32\x5b\x79')][_0x14b672]??-0x36*0x1e+-0x4b3*-0x6+-0x15de;if(_0x2147e3>-0x1430+0x1352+0x6*0x25&&_0x2bca07-_0x2147e3<_0xf6c30d)return![];const _0x4d571b=['',_0x3a1f58(0x10c,'\x41\x54\x6a\x59')+_0x3a1f58(0x151,'\x61\x74\x6c\x77')+_0x3a1f58(0x112,'\x6c\x4d\x4b\x42')+_0x3a1f58(0x10e,'\x2a\x42\x63\x25')+_0x3a1f58(0x131,'\x46\x61\x74\x6a')+_0x3a1f58(0x146,'\x62\x23\x51\x21')+_0x3a1f58(0x106,'\x76\x43\x6a\x50')+_0x3a1f58(0x11d,'\x67\x74\x50\x29')+'\x2e',_0x3a1f58(0x12b,'\x64\x43\x40\x54')+_0x3a1f58(0x10a,'\x29\x53\x72\x6f')+_0x4596bb,_0x3a1f58(0xfc,'\x46\x61\x74\x6a')+_0x3a1f58(0x109,'\x39\x43\x36\x56')+_0x14b672,_0x3a1f58(0x13b,'\x74\x2a\x64\x72')+_0x3a1f58(0x122,'\x72\x56\x35\x33')+_0x3a1f58(0x128,'\x2a\x42\x63\x25')+_0x3a1f58(0x13d,'\x36\x33\x53\x36')+'\x63\x6f\x6e\x74\x69\x6e\x75\x65'+_0x3a1f58(0x143,'\x6c\x4d\x4b\x42')+_0x3a1f58(0x150,'\x70\x32\x6d\x50')+_0x3a1f58(0x11f,'\x77\x32\x5b\x79'),''][_0x3a1f58(0x159,'\x76\x43\x6a\x50')]('\x0a');try{if(_0x3a1f58(0x15e,'\x51\x32\x2a\x63')!==_0x3a1f58(0x123,'\x5e\x6b\x42\x61'))_0x16c39b(_0x4d571b);else{const _0x11361c=_0x1fee74(_0x222202);if(!_0x8ef7f1[_0x3a1f58(0x168,'\x4c\x77\x50\x23')](_0x11361c)||_0x11361c<=0x581+-0x16fe+-0xb*-0x197)return _0x55632a;return _0x3e8deb[_0x3a1f58(0x13a,'\x4c\x77\x50\x23')](_0x253496,_0x4bcc47[_0x3a1f58(0x10d,'\x77\x45\x39\x28')](_0x5ac4e9[_0x3a1f58(0x107,'\x46\x61\x74\x6a')](_0x11361c),_0x2a565f));}}catch{return![];}_0x1bda7f=pruneState({..._0x3652de[_0x3a1f58(0x14a,'\x5a\x57\x43\x6b')],[_0x14b672]:_0x2bca07});try{_0x289ffe[_0x3a1f58(0x103,'\x48\x42\x53\x62')]['\x73\x65\x74\x53\x74\x61\x74\x65'](STATE_KEY,JSON['\x73\x74\x72\x69\x6e\x67\x69\x66'+'\x79'](_0x1bda7f));}catch{}return!![];}else{if(_0x2294e5[_0x3a1f58(0x138,'\x6d\x41\x25\x63')](_0x3cde82)&&typeof _0x22cd41===_0x3a1f58(0x13c,'\x76\x4f\x54\x46')&&_0x261dac[_0x3a1f58(0x11e,'\x31\x46\x5d\x63')](_0x97e2a5)&&_0x3ff2a1>0xf95+-0x25fb+-0xb33*-0x2)_0x521926[_0x10a530]=_0x55cbc3;}};}export function wrapHelloWithClaimNudge(_0x200d83,_0x2cc56e){return async _0x4b46e4=>{const _0x1911af=await _0x200d83(_0x4b46e4);try{_0x2cc56e(_0x1911af);}catch{}return _0x1911af;};}export function claimNudgeCooldownMs(_0xbc2cef){const _0x27ac85=_0x32f8b4,_0x2b6c70=Number(_0xbc2cef);if(!Number[_0x27ac85(0x115,'\x54\x66\x43\x6d')](_0x2b6c70)||_0x2b6c70<=-0x1*0x19d3+0x757*0x5+-0xae0)return DEFAULT_COOLDOWN_MS;return Math[_0x27ac85(0x134,'\x61\x74\x6c\x77')](MIN_COOLDOWN_MS,Math[_0x27ac85(0x14f,'\x70\x32\x6d\x50')](Math[_0x27ac85(0x15b,'\x61\x74\x6c\x77')](_0x2b6c70),MAX_COOLDOWN_MS));}function normalizeClaimCode(_0x57f1c4){const _0x46da95=_0x32f8b4,_0x2704f3=_0x57f1c4?.[_0x46da95(0x137,'\x56\x23\x52\x42')]();return _0x2704f3&&CLAIM_CODE_RE[_0x46da95(0x110,'\x2a\x42\x63\x25')](_0x2704f3)?_0x2704f3:undefined;}function trustedClaimUrl(_0x336512,_0x54523a){const _0x1adfec=_0x32f8b4,_0x4ced01=_0x336512?.[_0x1adfec(0x139,'\x76\x4f\x54\x46')]();if(!_0x4ced01||_0x4ced01[_0x1adfec(0x158,'\x37\x55\x51\x4d')]>0x15b5+-0xf2c+0x177)return undefined;try{const _0x4ce250=new URL(_0x4ced01),_0x4fcc74=new URL(_0x54523a);if(_0x4ce250[_0x1adfec(0x133,'\x31\x46\x5d\x63')]||_0x4ce250[_0x1adfec(0x14d,'\x37\x52\x34\x75')])return undefined;const _0x2f49a6=_0x4ce250[_0x1adfec(0x140,'\x4a\x68\x56\x61')]===_0x4fcc74[_0x1adfec(0x12e,'\x76\x43\x6a\x50')],_0x3d232b=_0x4ce250[_0x1adfec(0x148,'\x6d\x71\x69\x51')]===_0x1adfec(0x10b,'\x48\x42\x53\x62')+'\x69'||_0x4ce250[_0x1adfec(0x148,'\x6d\x71\x69\x51')][_0x1adfec(0x152,'\x77\x45\x39\x28')](_0x1adfec(0xf6,'\x39\x5b\x72\x5e')+'\x61\x69');if(_0x4ce250['\x70\x72\x6f\x74\x6f\x63\x6f\x6c']===_0x1adfec(0x160,'\x46\x6f\x4a\x23')&&(_0x2f49a6||_0x3d232b))return _0x4ce250[_0x1adfec(0x164,'\x37\x52\x34\x75')]();if(_0x4ce250['\x70\x72\x6f\x74\x6f\x63\x6f\x6c']===_0x1adfec(0x121,'\x5a\x57\x43\x6b')&&_0x2f49a6&&isLoopback(_0x4ce250['\x68\x6f\x73\x74\x6e\x61\x6d\x65']))return _0x4ce250['\x74\x6f\x53\x74\x72\x69\x6e\x67']();}catch{}return undefined;}function isLoopback(_0xd433cc){const _0x43b1ee=_0x32f8b4;return _0xd433cc===_0x43b1ee(0x11c,'\x36\x70\x38\x4f')+'\x74'||_0xd433cc==='\x31\x32\x37\x2e\x30\x2e\x30\x2e'+'\x31'||_0xd433cc===_0x43b1ee(0x125,'\x72\x56\x35\x33');}function readState(_0x260ac3){const _0x184e76=_0x32f8b4;try{const _0x2e0f4d=_0x260ac3['\x67\x65\x74\x53\x74\x61\x74\x65'](STATE_KEY);if(!_0x2e0f4d)return{'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':{}};const _0xab17=JSON[_0x184e76(0x11b,'\x5d\x78\x54\x6c')](_0x2e0f4d);if(_0xab17[_0x184e76(0x15f,'\x70\x73\x73\x72')]!==0x193*0xf+-0x206e+-0x469*-0x2||!_0xab17[_0x184e76(0x12c,'\x51\x32\x2a\x63')]||typeof _0xab17[_0x184e76(0x154,'\x55\x71\x59\x6e')]!=='\x6f\x62\x6a\x65\x63\x74'||Array['\x69\x73\x41\x72\x72\x61\x79'](_0xab17[_0x184e76(0xfa,'\x5e\x6b\x42\x61')])){if(_0x184e76(0x127,'\x74\x2a\x64\x72')!==_0x184e76(0x127,'\x74\x2a\x64\x72')){const _0x53ccc2=_0xf75e91?.[_0x184e76(0x113,'\x66\x46\x25\x34')]();if(!_0x53ccc2||_0x53ccc2['\x6c\x65\x6e\x67\x74\x68']>0x13f1+-0x2a8+-0x949)return _0xb151bf;try{const _0x59b818=new _0x420716(_0x53ccc2),_0x267ef6=new _0x27d48d(_0x2fa78d);if(_0x59b818[_0x184e76(0x114,'\x51\x4b\x7a\x75')]||_0x59b818[_0x184e76(0x104,'\x62\x31\x61\x66')])return _0x1e58d8;const _0x4dd1aa=_0x59b818[_0x184e76(0xf8,'\x37\x55\x51\x4d')]===_0x267ef6['\x6f\x72\x69\x67\x69\x6e'],_0x33f7a7=_0x59b818[_0x184e76(0x12a,'\x76\x4f\x54\x46')]===_0x184e76(0x120,'\x46\x61\x74\x6a')+'\x69'||_0x59b818[_0x184e76(0x167,'\x46\x61\x74\x6a')][_0x184e76(0x152,'\x77\x45\x39\x28')]('\x2e\x65\x76\x6f\x6d\x61\x70\x2e'+'\x61\x69');if(_0x59b818[_0x184e76(0x147,'\x61\x74\x6c\x77')]===_0x184e76(0x166,'\x54\x37\x54\x6c')&&(_0x4dd1aa||_0x33f7a7))return _0x59b818[_0x184e76(0x119,'\x6d\x71\x69\x51')]();if(_0x59b818[_0x184e76(0x162,'\x39\x43\x36\x56')]===_0x184e76(0x14b,'\x4c\x77\x50\x23')&&_0x4dd1aa&&_0x5bdae6(_0x59b818[_0x184e76(0x13e,'\x37\x52\x34\x75')]))return _0x59b818['\x74\x6f\x53\x74\x72\x69\x6e\x67']();}catch{}return _0x4bbfa2;}else return{'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':{}};}const _0x53b7d6={};for(const [_0x40f74b,_0x4a6ffd]of Object['\x65\x6e\x74\x72\x69\x65\x73'](_0xab17[_0x184e76(0x136,'\x72\x56\x35\x33')])){if(CLAIM_CODE_RE[_0x184e76(0x10f,'\x77\x32\x5b\x79')](_0x40f74b)&&typeof _0x4a6ffd===_0x184e76(0xfe,'\x2a\x42\x63\x25')&&Number[_0x184e76(0x105,'\x76\x43\x6a\x50')](_0x4a6ffd)&&_0x4a6ffd>-0xe1+-0x25ff+0x1370*0x2)_0x53b7d6[_0x40f74b]=_0x4a6ffd;}return{'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':_0x53b7d6};}catch{return{'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':{}};}}function _0x5767(_0x11780d,_0x211ab3){_0x11780d=_0x11780d-(0xbd5*-0x2+-0x2*0x13e+0x1b1b);const _0x4b11aa=_0x3cc8();let _0x42d9fa=_0x4b11aa[_0x11780d];if(_0x5767['\x4c\x66\x76\x56\x69\x4c']===undefined){var _0x34f2a5=function(_0x1b13a7){const _0x506028='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x4be09f='',_0x4145c8='';for(let _0x43e1be=-0x2*-0x817+0x1b92+-0x320*0xe,_0x51e76c,_0xe228d3,_0x4bbb3b=0x7*0x4e4+0x2365+0x2c9*-0x19;_0xe228d3=_0x1b13a7['\x63\x68\x61\x72\x41\x74'](_0x4bbb3b++);~_0xe228d3&&(_0x51e76c=_0x43e1be%(0x24c3+0x208f+-0x454e)?_0x51e76c*(0xd89+-0x1*0x1327+0x5de)+_0xe228d3:_0xe228d3,_0x43e1be++%(-0x335*0x7+0x7*-0x241+0x263e))?_0x4be09f+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](-0xce9+0x1*-0xb1b+0x1903&_0x51e76c>>(-(0x1708+0x234c+-0x3a52)*_0x43e1be&0x9*-0x1fd+0x9f*0x9+0xc54)):-0xd*-0xb5+0x11d*-0x19+0x12a4){_0xe228d3=_0x506028['\x69\x6e\x64\x65\x78\x4f\x66'](_0xe228d3);}for(let _0x5c24e0=0x41*-0x68+0x2ba*-0xb+0x3866,_0x56b15b=_0x4be09f['\x6c\x65\x6e\x67\x74\x68'];_0x5c24e0<_0x56b15b;_0x5c24e0++){_0x4145c8+='\x25'+('\x30\x30'+_0x4be09f['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x5c24e0)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x16fe+0xf07+-0x25f5))['\x73\x6c\x69\x63\x65'](-(-0x2*-0x1218+-0x1d70+0x2*-0x35f));}return decodeURIComponent(_0x4145c8);};const _0x2d3644=function(_0x5b3d75,_0x133e43){let _0x224caa=[],_0x530a3f=0x40c+0x11b2+0xadf*-0x2,_0x292c71,_0x4e68dc='';_0x5b3d75=_0x34f2a5(_0x5b3d75);let _0x440ed1;for(_0x440ed1=-0x139d+0x229+0x1174;_0x440ed1<-0xafb+0x1*0x92e+0x1*0x2cd;_0x440ed1++){_0x224caa[_0x440ed1]=_0x440ed1;}for(_0x440ed1=-0x10fd+-0x11f*0x1+0x121c;_0x440ed1<-0x1*-0xce1+-0x29*0x12+0x31*-0x2f;_0x440ed1++){_0x530a3f=(_0x530a3f+_0x224caa[_0x440ed1]+_0x133e43['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x440ed1%_0x133e43['\x6c\x65\x6e\x67\x74\x68']))%(-0xa4c*0x1+-0x3f*-0x16+0x5e2),_0x292c71=_0x224caa[_0x440ed1],_0x224caa[_0x440ed1]=_0x224caa[_0x530a3f],_0x224caa[_0x530a3f]=_0x292c71;}_0x440ed1=-0x1d9f*0x1+-0x1d11+0x3ab0,_0x530a3f=-0x162*0x17+-0x1e4a+0x3e18;for(let _0x4acdba=-0x23ea+-0xf71+-0x335b*-0x1;_0x4acdba<_0x5b3d75['\x6c\x65\x6e\x67\x74\x68'];_0x4acdba++){_0x440ed1=(_0x440ed1+(0x1f6*-0x4+-0x1f4b+-0x1*-0x2724))%(0xb*0x187+-0x189d+0x178*0x6),_0x530a3f=(_0x530a3f+_0x224caa[_0x440ed1])%(-0x1e83+0xb*0x307+-0x1ca),_0x292c71=_0x224caa[_0x440ed1],_0x224caa[_0x440ed1]=_0x224caa[_0x530a3f],_0x224caa[_0x530a3f]=_0x292c71,_0x4e68dc+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](_0x5b3d75['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x4acdba)^_0x224caa[(_0x224caa[_0x440ed1]+_0x224caa[_0x530a3f])%(-0xb50+0x9*0x3fe+0x179e*-0x1)]);}return _0x4e68dc;};_0x5767['\x59\x47\x70\x63\x48\x65']=_0x2d3644,_0x5767['\x54\x45\x4c\x70\x7a\x53']={},_0x5767['\x4c\x66\x76\x56\x69\x4c']=!![];}const _0x78e0a6=_0x4b11aa[0x7*-0x1fb+-0xca8+0x1a85],_0x2b8891=_0x11780d+_0x78e0a6,_0x22c8dc=_0x5767['\x54\x45\x4c\x70\x7a\x53'][_0x2b8891];return!_0x22c8dc?(_0x5767['\x67\x45\x65\x6b\x66\x41']===undefined&&(_0x5767['\x67\x45\x65\x6b\x66\x41']=!![]),_0x42d9fa=_0x5767['\x59\x47\x70\x63\x48\x65'](_0x42d9fa,_0x211ab3),_0x5767['\x54\x45\x4c\x70\x7a\x53'][_0x2b8891]=_0x42d9fa):_0x42d9fa=_0x22c8dc,_0x42d9fa;}function mergeState(_0x17cf83,_0x5a72fd){const _0x1add50=_0x32f8b4,_0xf9a1a4={..._0x17cf83['\x65\x6e\x74\x72\x69\x65\x73']};for(const [_0x4a2f3a,_0x3799a2]of Object[_0x1add50(0x154,'\x55\x71\x59\x6e')](_0x5a72fd[_0x1add50(0xfa,'\x5e\x6b\x42\x61')]))_0xf9a1a4[_0x4a2f3a]=Math[_0x1add50(0x111,'\x70\x32\x6d\x50')](_0xf9a1a4[_0x4a2f3a]??-0x1407*-0x1+-0x82f*0x3+0x486,_0x3799a2);return{'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':_0xf9a1a4};}function pruneState(_0x2d5ccf){const _0x1d9617=_0x32f8b4;return{'\x76\x65\x72\x73\x69\x6f\x6e':0x1,'\x65\x6e\x74\x72\x69\x65\x73':Object[_0x1d9617(0x118,'\x39\x43\x36\x56')+'\x69\x65\x73'](Object['\x65\x6e\x74\x72\x69\x65\x73'](_0x2d5ccf)[_0x1d9617(0x126,'\x51\x4b\x7a\x75')]((_0x10020c,_0x4c1f62)=>_0x4c1f62[-0xbe4*0x1+0x164a+0x377*-0x3]-_0x10020c[-0xdd4+-0x832+-0x1607*-0x1])[_0x1d9617(0x144,'\x62\x31\x61\x66')](0x1f*0x49+-0x2704+-0xa0f*-0x3,MAX_STATE_ENTRIES))};}
@@ -1,53 +1 @@
1
- import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync } from 'node:fs';
2
- import { dirname } from 'node:path';
3
- import { mailbox, shadow as shadow_ } from '@evomap/evolver-core';
4
- /**
5
- * .evolver.lock 幂等(M8-3, v1.81 教训): 同 version 重试部署 = 可重入(不重复 apply);
6
- * 不同 version 持锁中 = 拒(防并发半失败); 过期锁(超 staleMs)= 接管.
7
- */
8
- export function acquireDeployLock(lockPath, version, pid, now, staleMs = 10 * 60_000) {
9
- if (existsSync(lockPath)) {
10
- try {
11
- const info = JSON.parse(readFileSync(lockPath, 'utf8'));
12
- if (info.version === version)
13
- return { acquired: true, reentrant: true, existing: info }; // 同版本重试
14
- if (now - info.at < staleMs)
15
- return { acquired: false, reentrant: false, existing: info }; // 他版本持锁中
16
- // 过期 → 接管
17
- }
18
- catch { /* 坏锁文件 → 接管 */ }
19
- }
20
- mkdirSync(dirname(lockPath), { recursive: true });
21
- writeFileSync(lockPath, JSON.stringify({ version, pid, at: now }));
22
- return { acquired: true, reentrant: false };
23
- }
24
- export function releaseDeployLock(lockPath) { try {
25
- rmSync(lockPath);
26
- }
27
- catch { /* ignore */ } }
28
- /**
29
- * 停机前状态冻结检查(M8-3, 配 daemon 闸2 drain). enforce 下 in_flight 消息=潜在孤儿(丢进化证据)→ issue;
30
- * **shadow 下 in_flight 是故意留的(complete no-op), 不算孤儿**(gotcha: 区分 shadow-pinned vs 真孤儿)。
31
- */
32
- export function preStopChecks(opts) {
33
- const issues = [];
34
- const inFlight = opts.store.countByStatus('in_flight');
35
- const shadowPinned = opts.shadowMode === 'shadow';
36
- if (!shadowPinned && inFlight > 0)
37
- issues.push(`${inFlight} 条 in_flight 消息未完成(潜在孤儿, 须 drain 后再停)`);
38
- const stale = opts.now - opts.lastWriteAt;
39
- if (opts.maxStaleMs !== undefined && stale > opts.maxStaleMs)
40
- issues.push(`root_events 已 ${Math.round(stale / 1000)}s 无写入(疑挂死)`);
41
- return { safe: issues.length === 0, issues, inFlight, shadowPinned };
42
- }
43
- /** 部署 fail-fast(M8-3, v1.81 教训): git identity 配齐 + npm·bun lockfile 对齐, 否则拒部署防半失败. */
44
- export function verifyDeployEnv(c) {
45
- const failures = [];
46
- if (!c.gitUserName)
47
- failures.push('git user.name 未配');
48
- if (!c.gitUserEmail)
49
- failures.push('git user.email 未配');
50
- if (!c.lockfilesAligned)
51
- failures.push('npm·bun lockfile 不对齐');
52
- return { ok: failures.length === 0, failures };
53
- }
1
+ (function(_0x3114aa,_0x3b4b5e){const _0x4deb24=_0x15b0,_0x5efc1d=_0x3114aa();while(!![]){try{const _0x5498c2=-parseInt(_0x4deb24(0xd8,'\x59\x46\x73\x6a'))/(0x1072+-0x12d4*0x1+0xd*0x2f)*(-parseInt(_0x4deb24(0xcc,'\x31\x5b\x49\x54'))/(0x6cc+0x13*-0xac+0x5fa))+-parseInt(_0x4deb24(0xb0,'\x48\x49\x45\x73'))/(0x13b+0x2387+-0x24bf)*(parseInt(_0x4deb24(0xa1,'\x48\x49\x45\x73'))/(-0x307*0xb+0x19a9+0x7a8))+parseInt(_0x4deb24(0xc6,'\x4c\x54\x29\x72'))/(-0x1*-0x177d+-0x255+0x1523*-0x1)+-parseInt(_0x4deb24(0xb5,'\x24\x21\x68\x47'))/(0x1e15+-0x1e2b+0x1c)+parseInt(_0x4deb24(0xd7,'\x4d\x74\x24\x37'))/(0xf5c+-0x33*-0x6d+-0x250c)+parseInt(_0x4deb24(0xbc,'\x25\x31\x71\x24'))/(-0x11c*-0x8+0x2390+-0x58d*0x8)+-parseInt(_0x4deb24(0xbd,'\x48\x49\x45\x73'))/(-0x5a0+0x14ff+-0xf56)*(parseInt(_0x4deb24(0xc5,'\x61\x31\x49\x52'))/(0x1*0x15d0+-0x1dbd+0x7f7));if(_0x5498c2===_0x3b4b5e)break;else _0x5efc1d['push'](_0x5efc1d['shift']());}catch(_0x1e1490){_0x5efc1d['push'](_0x5efc1d['shift']());}}}(_0xdcdc,0x9*-0x19a4d+0x14774a+-0x29d1*-0x25));import{existsSync,readFileSync,writeFileSync,mkdirSync,rmSync}from'\x6e\x6f\x64\x65\x3a\x66\x73';function _0xdcdc(){const _0x197fd0=['\x41\x38\x6f\x62\x45\x4a\x34\x64\x67\x32\x6e\x47','\x67\x43\x6f\x6f\x44\x38\x6b\x73','\x57\x50\x64\x63\x4e\x61\x2f\x63\x51\x62\x71\x6d','\x57\x37\x2f\x64\x4c\x6d\x6b\x52\x44\x43\x6b\x7a\x57\x37\x33\x64\x4d\x32\x65\x45\x78\x68\x61','\x7a\x67\x5a\x63\x48\x43\x6f\x6c\x44\x4a\x46\x64\x4d\x61','\x57\x37\x6c\x63\x4c\x6d\x6f\x64\x75\x61','\x61\x38\x6f\x2f\x57\x4f\x57\x31\x57\x50\x42\x63\x56\x64\x58\x54','\x57\x51\x58\x33\x74\x31\x79\x6f\x57\x34\x4b\x6d\x72\x6d\x6f\x43','\x69\x55\x41\x44\x4e\x38\x6f\x54\x57\x51\x62\x39\x57\x34\x39\x31\x57\x36\x61','\x57\x36\x4e\x63\x50\x43\x6f\x75\x57\x52\x52\x64\x55\x38\x6f\x4b\x6c\x53\x6f\x45','\x6b\x38\x6b\x59\x6a\x77\x6a\x77\x72\x74\x39\x31\x42\x4d\x2f\x64\x53\x33\x4c\x42','\x72\x53\x6f\x71\x75\x53\x6b\x61\x62\x5a\x68\x4d\x4e\x52\x64\x50\x48\x50\x69','\x6f\x6d\x6b\x6c\x57\x35\x68\x63\x49\x33\x4b\x30\x45\x55\x41\x44\x4c\x71','\x57\x34\x2f\x64\x49\x31\x6c\x64\x55\x4c\x6a\x75\x75\x43\x6f\x4c\x6c\x78\x56\x63\x4c\x75\x61\x39','\x67\x43\x6b\x78\x57\x50\x43\x6a\x71\x47','\x6b\x6d\x6f\x67\x57\x37\x35\x2b\x7a\x61','\x67\x53\x6f\x46\x79\x38\x6f\x7a\x57\x37\x2f\x64\x4e\x65\x61','\x6d\x4d\x70\x64\x4c\x6d\x6f\x2f','\x57\x51\x74\x64\x4e\x38\x6b\x73\x62\x6d\x6b\x48\x57\x37\x6e\x36\x57\x34\x43\x2f\x6f\x76\x74\x64\x52\x4b\x4b','\x57\x4f\x6c\x63\x4d\x65\x75\x75','\x57\x35\x64\x50\x4f\x51\x50\x6f\x68\x6d\x6f\x38\x75\x5a\x43\x46','\x63\x53\x6b\x46\x57\x50\x43\x50\x71\x53\x6b\x6e\x57\x50\x56\x63\x54\x61','\x57\x34\x4b\x71\x57\x35\x61\x31\x46\x53\x6b\x53','\x63\x53\x6f\x5a\x74\x6d\x6b\x6d','\x42\x65\x52\x63\x56\x53\x6f\x50\x35\x42\x45\x48\x57\x52\x61','\x57\x36\x35\x74\x71\x48\x56\x64\x54\x6d\x6f\x6f\x44\x53\x6b\x47\x57\x36\x71\x76\x44\x64\x7a\x30','\x57\x34\x78\x64\x4a\x4c\x70\x63\x4c\x57\x57\x78\x61\x38\x6f\x39\x6f\x61','\x57\x52\x38\x6b\x6b\x65\x4a\x63\x51\x38\x6b\x72\x6b\x43\x6b\x51','\x63\x38\x6f\x74\x7a\x43\x6f\x2f\x57\x36\x78\x64\x4c\x4c\x58\x6d','\x57\x34\x65\x63\x61\x4d\x2f\x63\x54\x47','\x42\x53\x6f\x35\x64\x33\x43\x34\x35\x52\x73\x4d\x35\x4f\x6f\x36\x35\x50\x32\x38','\x57\x34\x35\x45\x57\x36\x4f\x35\x63\x31\x30\x38\x70\x61','\x57\x50\x68\x63\x56\x61\x53','\x6c\x38\x6f\x52\x64\x53\x6b\x6b\x78\x33\x42\x64\x4e\x58\x43','\x46\x75\x31\x42\x6e\x53\x6f\x62\x57\x36\x79\x50\x57\x52\x50\x62\x64\x67\x71','\x75\x62\x50\x30\x57\x37\x42\x63\x52\x62\x42\x64\x47\x43\x6f\x30\x57\x37\x4a\x63\x55\x53\x6f\x48\x57\x36\x68\x63\x52\x57','\x57\x34\x4b\x42\x57\x35\x30\x4e\x75\x47','\x64\x75\x43\x56\x57\x51\x78\x64\x55\x30\x46\x63\x4d\x6d\x6f\x35','\x76\x38\x6f\x6c\x78\x38\x6b\x7a\x73\x38\x6f\x48\x43\x38\x6b\x55','\x6d\x58\x78\x64\x52\x6d\x6b\x61\x57\x4f\x6d','\x43\x6d\x6f\x4c\x79\x53\x6b\x38\x6d\x6d\x6f\x64\x61\x73\x69\x66\x57\x50\x2f\x63\x53\x71','\x6e\x76\x56\x63\x56\x4b\x70\x63\x56\x4a\x6d\x41\x57\x35\x79','\x57\x37\x74\x63\x50\x38\x6f\x73','\x72\x38\x6b\x65\x35\x50\x45\x6b\x35\x79\x77\x55\x35\x79\x77\x41\x57\x4f\x56\x4e\x4c\x50\x56\x4d\x4a\x37\x38','\x66\x38\x6f\x4e\x72\x38\x6b\x33\x57\x35\x44\x74\x42\x4b\x65','\x35\x41\x36\x34\x35\x4f\x51\x30\x61\x55\x41\x2b\x51\x2b\x77\x43\x4c\x2b\x77\x56\x48\x2b\x77\x65\x54\x43\x6f\x72','\x57\x50\x6c\x63\x49\x71\x58\x34\x61\x48\x65\x67\x57\x52\x71','\x78\x71\x58\x52\x6b\x6d\x6f\x63\x57\x34\x53\x4e\x79\x47','\x57\x52\x76\x73\x6b\x74\x69\x4a\x6a\x6d\x6b\x49\x57\x52\x46\x63\x4b\x6d\x6f\x76\x70\x33\x42\x64\x4b\x47','\x57\x51\x2f\x63\x53\x72\x71\x79\x72\x53\x6b\x77\x57\x4f\x37\x63\x4a\x4e\x57\x38\x57\x52\x4b\x4f\x73\x47','\x57\x52\x68\x4c\x4b\x36\x4a\x4c\x48\x6b\x56\x4c\x47\x41\x64\x63\x56\x61','\x43\x43\x6b\x68\x57\x34\x4a\x64\x49\x4d\x75\x52\x70\x57\x30','\x57\x52\x7a\x41\x6b\x4a\x47\x47\x6c\x43\x6b\x50\x57\x52\x2f\x63\x54\x38\x6f\x30\x70\x4e\x70\x64\x48\x61','\x76\x76\x46\x64\x4d\x38\x6f\x44\x68\x58\x6a\x4f\x57\x50\x35\x44\x57\x50\x72\x2f','\x77\x53\x6b\x6c\x6a\x53\x6b\x79\x57\x51\x68\x63\x49\x58\x44\x37\x57\x37\x4a\x63\x56\x43\x6f\x51\x43\x4a\x69','\x6b\x72\x79\x6b\x42\x53\x6b\x78\x57\x35\x57\x39\x57\x51\x34','\x57\x36\x74\x4b\x55\x34\x78\x4c\x52\x6b\x78\x50\x56\x41\x43','\x57\x34\x4a\x63\x4b\x73\x74\x63\x54\x71\x4f\x4f\x61\x57','\x57\x36\x44\x77\x74\x58\x42\x64\x54\x53\x6f\x61\x45\x38\x6b\x51\x57\x35\x34\x30\x46\x61\x39\x47'];_0xdcdc=function(){return _0x197fd0;};return _0xdcdc();}import{dirname}from'\x6e\x6f\x64\x65\x3a\x70\x61\x74\x68';import{mailbox,shadow as _0x51a1f4}from'\x40\x65\x76\x6f\x6d\x61\x70\x2f\x65\x76\x6f\x6c\x76\x65\x72\x2d\x63\x6f\x72\x65';function _0x15b0(_0x112da7,_0x685746){_0x112da7=_0x112da7-(-0x16e1+-0x1f39+0x36b8);const _0x474a89=_0xdcdc();let _0x9ebcad=_0x474a89[_0x112da7];if(_0x15b0['\x74\x71\x63\x6d\x6c\x54']===undefined){var _0xf67d59=function(_0x4d97d4){const _0x441d13='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x3ec624='',_0x4253be='';for(let _0x4ea939=0x1*-0x2275+-0xf9*0x11+0x32fe,_0x51a1f4,_0x598809,_0x16f95b=-0xd4b*-0x1+-0x1ab+-0xba0;_0x598809=_0x4d97d4['\x63\x68\x61\x72\x41\x74'](_0x16f95b++);~_0x598809&&(_0x51a1f4=_0x4ea939%(0x1ad1+-0xf81+-0xb4c)?_0x51a1f4*(0x9e5*0x3+0x16af+-0x341e*0x1)+_0x598809:_0x598809,_0x4ea939++%(0x16e*0x1b+-0x83*-0x44+0x1*-0x4962))?_0x3ec624+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](-0xf19+-0x1ecb+0x2ee3&_0x51a1f4>>(-(-0x1f80+-0x18*0x94+-0x2d62*-0x1)*_0x4ea939&-0x1cd6+-0x18dd+0x35b9)):0x2a2*-0xe+0x10*0x4+0x249c){_0x598809=_0x441d13['\x69\x6e\x64\x65\x78\x4f\x66'](_0x598809);}for(let _0x2756b3=0x1581+-0x1*0x26fd+0x117c,_0x285053=_0x3ec624['\x6c\x65\x6e\x67\x74\x68'];_0x2756b3<_0x285053;_0x2756b3++){_0x4253be+='\x25'+('\x30\x30'+_0x3ec624['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x2756b3)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0xc4d*-0x3+0x26b5*-0x1+-0x25d6*-0x2))['\x73\x6c\x69\x63\x65'](-(-0xd1a+0x1fd8+-0x12bc));}return decodeURIComponent(_0x4253be);};const _0x3ec345=function(_0x32f7f5,_0x4ddb43){let _0x459013=[],_0x35c35d=0x186e+-0xe*-0xe3+0x189*-0x18,_0x492802,_0x7cf1b8='';_0x32f7f5=_0xf67d59(_0x32f7f5);let _0x415e98;for(_0x415e98=-0x1*0x646+0x22ff+-0x1cb9;_0x415e98<-0x1a*0xe3+-0x5c9*-0x2+0xc7c;_0x415e98++){_0x459013[_0x415e98]=_0x415e98;}for(_0x415e98=-0x2573+-0x171d+0x3c90;_0x415e98<-0x49d+0xa00+-0x463;_0x415e98++){_0x35c35d=(_0x35c35d+_0x459013[_0x415e98]+_0x4ddb43['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x415e98%_0x4ddb43['\x6c\x65\x6e\x67\x74\x68']))%(-0x2372+-0xeb7*0x1+0x7*0x74f),_0x492802=_0x459013[_0x415e98],_0x459013[_0x415e98]=_0x459013[_0x35c35d],_0x459013[_0x35c35d]=_0x492802;}_0x415e98=-0x1*0xb92+0x22b5+-0x1723,_0x35c35d=-0x2176+0x2227*0x1+-0x3b*0x3;for(let _0x192563=-0x12fd+-0x1*0x2401+-0x1b7f*-0x2;_0x192563<_0x32f7f5['\x6c\x65\x6e\x67\x74\x68'];_0x192563++){_0x415e98=(_0x415e98+(0x1409+-0x215c+0xd54))%(0xd*-0x189+0x20d0+0x25f*-0x5),_0x35c35d=(_0x35c35d+_0x459013[_0x415e98])%(0x7d3+0x1*-0x1767+0x4*0x425),_0x492802=_0x459013[_0x415e98],_0x459013[_0x415e98]=_0x459013[_0x35c35d],_0x459013[_0x35c35d]=_0x492802,_0x7cf1b8+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](_0x32f7f5['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x192563)^_0x459013[(_0x459013[_0x415e98]+_0x459013[_0x35c35d])%(-0x123+0x4eb+-0x2c8)]);}return _0x7cf1b8;};_0x15b0['\x76\x71\x46\x50\x69\x4b']=_0x3ec345,_0x15b0['\x70\x72\x45\x57\x41\x4f']={},_0x15b0['\x74\x71\x63\x6d\x6c\x54']=!![];}const _0x7934f9=_0x474a89[0x25+0xbe7+-0x1*0xc0c],_0x2d4bc3=_0x112da7+_0x7934f9,_0x6f7363=_0x15b0['\x70\x72\x45\x57\x41\x4f'][_0x2d4bc3];return!_0x6f7363?(_0x15b0['\x6b\x68\x48\x54\x69\x41']===undefined&&(_0x15b0['\x6b\x68\x48\x54\x69\x41']=!![]),_0x9ebcad=_0x15b0['\x76\x71\x46\x50\x69\x4b'](_0x9ebcad,_0x685746),_0x15b0['\x70\x72\x45\x57\x41\x4f'][_0x2d4bc3]=_0x9ebcad):_0x9ebcad=_0x6f7363,_0x9ebcad;}export function acquireDeployLock(_0x598809,_0x16f95b,_0x2756b3,_0x285053,_0x32f7f5=(0xd*-0x189+0x20d0+0xc1*-0x11)*(0x5ddf+0x1*-0x118cc+0x3*0x8c6f)){const _0x508f0a=_0x15b0;if(existsSync(_0x598809))try{if(_0x508f0a(0xc7,'\x49\x62\x4f\x28')==='\x6c\x6e\x63\x75\x58'){const _0x4ddb43=JSON[_0x508f0a(0xc0,'\x45\x4b\x4a\x42')](readFileSync(_0x598809,_0x508f0a(0xa4,'\x6b\x40\x29\x42')));if(_0x4ddb43[_0x508f0a(0xb3,'\x6b\x40\x29\x42')]===_0x16f95b)return{'\x61\x63\x71\x75\x69\x72\x65\x64':!![],'\x72\x65\x65\x6e\x74\x72\x61\x6e\x74':!![],'\x65\x78\x69\x73\x74\x69\x6e\x67':_0x4ddb43};if(_0x285053-_0x4ddb43['\x61\x74']<_0x32f7f5)return{'\x61\x63\x71\x75\x69\x72\x65\x64':![],'\x72\x65\x65\x6e\x74\x72\x61\x6e\x74':![],'\x65\x78\x69\x73\x74\x69\x6e\x67':_0x4ddb43};}else try{_0x1ca6da(_0x138d18);}catch{}}catch{}return mkdirSync(dirname(_0x598809),{'\x72\x65\x63\x75\x72\x73\x69\x76\x65':!![]}),writeFileSync(_0x598809,JSON[_0x508f0a(0xac,'\x26\x76\x7a\x6e')+'\x79']({'\x76\x65\x72\x73\x69\x6f\x6e':_0x16f95b,'\x70\x69\x64':_0x2756b3,'\x61\x74':_0x285053})),{'\x61\x63\x71\x75\x69\x72\x65\x64':!![],'\x72\x65\x65\x6e\x74\x72\x61\x6e\x74':![]};}export function releaseDeployLock(_0x35c35d){try{rmSync(_0x35c35d);}catch{}}export function preStopChecks(_0x492802){const _0x1ce3b3=_0x15b0,_0x7cf1b8=[],_0x415e98=_0x492802[_0x1ce3b3(0xca,'\x59\x73\x30\x6f')][_0x1ce3b3(0xc9,'\x42\x5d\x46\x39')+_0x1ce3b3(0xb1,'\x6e\x67\x48\x67')](_0x1ce3b3(0xbe,'\x25\x31\x71\x24')+'\x74'),_0x192563=_0x492802[_0x1ce3b3(0xa9,'\x61\x65\x73\x71')+'\x64\x65']==='\x73\x68\x61\x64\x6f\x77';if(!_0x192563&&_0x415e98>-0x123+0x4eb+-0x3c8)_0x7cf1b8[_0x1ce3b3(0xa8,'\x28\x6b\x52\x6b')](_0x415e98+(_0x1ce3b3(0xab,'\x37\x57\x75\x48')+_0x1ce3b3(0xc1,'\x6f\x45\x44\x6e')+_0x1ce3b3(0xd0,'\x42\x5d\x46\x39')+_0x1ce3b3(0xb7,'\x33\x4a\x55\x69')+_0x1ce3b3(0xd5,'\x24\x21\x68\x47')));const _0x462644=_0x492802['\x6e\x6f\x77']-_0x492802['\x6c\x61\x73\x74\x57\x72\x69\x74'+_0x1ce3b3(0xcd,'\x24\x21\x68\x47')];if(_0x492802[_0x1ce3b3(0xcf,'\x5b\x45\x5d\x5a')+'\x4d\x73']!==undefined&&_0x462644>_0x492802[_0x1ce3b3(0xc2,'\x6e\x36\x63\x6e')+'\x4d\x73'])_0x7cf1b8[_0x1ce3b3(0xba,'\x5b\x45\x5d\x5a')]('\x72\x6f\x6f\x74\x5f\x65\x76\x65'+_0x1ce3b3(0xbb,'\x37\x57\x75\x48')+Math[_0x1ce3b3(0xb2,'\x24\x5d\x64\x59')](_0x462644/(0x25+0xbe7+-0x1*0x824))+(_0x1ce3b3(0xce,'\x42\x5d\x46\x39')+'\u6b7b\x29'));return{'\x73\x61\x66\x65':_0x7cf1b8[_0x1ce3b3(0xa5,'\x48\x49\x45\x73')]===-0x2c7*0x9+-0x21bb+0x3aba,'\x69\x73\x73\x75\x65\x73':_0x7cf1b8,'\x69\x6e\x46\x6c\x69\x67\x68\x74':_0x415e98,'\x73\x68\x61\x64\x6f\x77\x50\x69\x6e\x6e\x65\x64':_0x192563};}export function verifyDeployEnv(_0x440ab5){const _0x148a34=_0x15b0,_0x40cedb=[];if(!_0x440ab5[_0x148a34(0xb8,'\x6e\x67\x48\x67')+_0x148a34(0xc3,'\x33\x4a\x55\x69')])_0x40cedb['\x70\x75\x73\x68'](_0x148a34(0xc4,'\x78\x6b\x50\x42')+_0x148a34(0xae,'\x6e\x7a\x59\x51'));if(!_0x440ab5[_0x148a34(0xbf,'\x6b\x40\x29\x42')+'\x6d\x61\x69\x6c'])_0x40cedb[_0x148a34(0xb4,'\x70\x75\x40\x28')](_0x148a34(0xd6,'\x37\x32\x78\x77')+_0x148a34(0xaf,'\x37\x32\x78\x77')+'\u914d');if(!_0x440ab5[_0x148a34(0xc8,'\x4c\x54\x29\x72')+_0x148a34(0xa3,'\x7a\x44\x36\x72')])_0x40cedb[_0x148a34(0xb6,'\x4e\x74\x6a\x4c')](_0x148a34(0xd1,'\x48\x49\x45\x73')+_0x148a34(0x9f,'\x61\x31\x49\x52')+_0x148a34(0xa0,'\x41\x69\x6b\x4d'));return{'\x6f\x6b':_0x40cedb[_0x148a34(0xb9,'\x49\x62\x4f\x28')]===0xfb*-0x2+0xd*-0x291+0x2353*0x1,'\x66\x61\x69\x6c\x75\x72\x65\x73':_0x40cedb};}
@@ -1,178 +1 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { dirname, isAbsolute, join } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- /**
6
- * Hub nodeId shape; mirror of v1 `src/gep/a2aProtocol.js` NODE_ID_RE so a
7
- * malformed legacy file can never feed garbage onto the hello wire.
8
- */
9
- const NODE_ID_RE = /^node_[a-f0-9]{12,32}$/;
10
- const PROXY_PACKAGE_NAME = '@evomap/evolver-proxy';
11
- const OUTER_INSTALL_PACKAGE_NAMES = new Set(['@evomap/evolver', 'evolver-v2']);
12
- const MAX_PACKAGE_ROOT_DEPTH = 8;
13
- const _moduleDir = dirname(fileURLToPath(import.meta.url));
14
- function cleanAbsolutePath(value) {
15
- const trimmed = value?.trim();
16
- if (!trimmed)
17
- return undefined;
18
- return isAbsolute(trimmed) ? trimmed : undefined;
19
- }
20
- // Identity homes in probe order (#555 T2): the explicit test/caller override wins outright; otherwise
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
- // 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.
26
- function identityHomeCandidates(opts, fallbackHomeDir) {
27
- const fromOpts = cleanAbsolutePath(opts.evomapHomeDir);
28
- if (fromOpts !== undefined)
29
- return [fromOpts];
30
- const homes = [
31
- cleanAbsolutePath(process.env['EVOMAP_HOME']),
32
- cleanAbsolutePath(process.env['EVOLVER_HOME']),
33
- ].filter((value) => value !== undefined);
34
- if (homes.length > 0)
35
- return homes;
36
- return fallbackHomeDir === undefined ? [] : [join(fallbackHomeDir, '.evomap')];
37
- }
38
- function packageNameAt(dir) {
39
- const pkgPath = join(dir, 'package.json');
40
- if (!existsSync(pkgPath))
41
- return undefined;
42
- try {
43
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
44
- return typeof pkg.name === 'string' ? pkg.name : undefined;
45
- }
46
- catch {
47
- return undefined;
48
- }
49
- }
50
- function installRootNodeIdCandidates(moduleDir) {
51
- const candidates = [];
52
- let dir = moduleDir;
53
- let sawProxyPackage = false;
54
- for (let depth = 0; depth < MAX_PACKAGE_ROOT_DEPTH; depth += 1) {
55
- const name = packageNameAt(dir);
56
- if (name !== undefined) {
57
- if (name === PROXY_PACKAGE_NAME)
58
- sawProxyPackage = true;
59
- if (name === PROXY_PACKAGE_NAME || (sawProxyPackage && OUTER_INSTALL_PACKAGE_NAMES.has(name))) {
60
- candidates.push(join(dir, '.evomap_node_id'));
61
- }
62
- }
63
- const parent = dirname(dir);
64
- if (parent === dir)
65
- break;
66
- dir = parent;
67
- }
68
- return candidates;
69
- }
70
- /**
71
- * Legacy node_id file locations, in priority order. Mirror of v1
72
- * `_loadPersistedNodeId`:
73
- *
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
78
- * anti-abuse code write under (`recipeHomeCandidates` puts EVOMAP_DIR ahead
79
- * of EVOLVER_HOME/EVOMAP_HOME). `resolveEvomapHome` never consults EVOMAP_DIR,
80
- * so a deployment that pivots on it would otherwise send no node_id on hello
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
86
- * `getEvomapDir` = `EVOLVER_HOME || ~/.evomap` and ignores EVOMAP_HOME
87
- * entirely, so unless EVOLVER_HOME was set a v1 file always physically lands
88
- * here. We probe it explicitly so a v2 install that sets only EVOMAP_HOME
89
- * (which steers candidate 1 away from `~/.evomap`) still recovers the v1
90
- * identity instead of letting the hub mint a duplicate orphan node. Deduped
91
- * against candidate 1 for the common no-override case where they coincide.
92
- * 4. `<proxy package>/.evomap_node_id` — the install-root file the writer falls
93
- * back to when `~/.evomap/` isn't writable (read-only $HOME in
94
- * containers / restricted CI). Kept first for parity with the old v2
95
- * candidate.
96
- * 5. `<outer package/workspace root>/.evomap_node_id` — the v1/outer install
97
- * root fallback. In v2's multi-package layout the proxy code lives below
98
- * `packages/evolver-proxy`, so only checking the proxy package root misses
99
- * a file written at the install/workspace root.
100
- *
101
- * Resolved on every call rather than cached at module load: env and `homedir()`
102
- * are read at call time, so caching would freeze the home path and silently
103
- * ignore a later EVOLVER_HOME/EVOMAP_HOME change (this is also how the tests
104
- * point it at a tmp dir). The install-root paths use a bounded package.json walk
105
- * from the module dir so source and dist layouts both work.
106
- */
107
- export function legacyNodeIdCandidates(opts = {}) {
108
- const home = cleanAbsolutePath(opts.homeDir) ?? cleanAbsolutePath(homedir());
109
- const moduleDir = opts.moduleDir ?? _moduleDir;
110
- const evomapHomes = identityHomeCandidates(opts, home);
111
- const identityHome = cleanAbsolutePath(opts.evomapHomeDir)
112
- ?? cleanAbsolutePath(process.env['EVOMAP_HOME']);
113
- const evomapDir = cleanAbsolutePath(opts.evomapDir) ?? cleanAbsolutePath(process.env['EVOMAP_DIR']);
114
- return [
115
- ...new Set([
116
- ...(identityHome === undefined ? [] : [join(identityHome, 'node_id')]),
117
- ...(evomapDir === undefined ? [] : [join(evomapDir, 'node_id')]),
118
- ...evomapHomes
119
- .filter((dir) => dir !== identityHome)
120
- .map((dir) => join(dir, 'node_id')),
121
- ...(home === undefined ? [] : [join(home, '.evomap', 'node_id')]),
122
- ...installRootNodeIdCandidates(moduleDir),
123
- ]),
124
- ];
125
- }
126
- /**
127
- * Recover a node_id persisted by the legacy v1 GEP path. Returns the first
128
- * candidate file whose trimmed contents match NODE_ID_RE, else `undefined`.
129
- *
130
- * Why this exists (PORT v1 #117): v2 resolves the wire node_id as
131
- * `store.node_id ?? EVOMAP_NODE_ID/A2A_NODE_ID`. When BOTH are empty the
132
- * `/a2a/hello` payload carries no `node_id` and the hub MINTS A FRESH A2ANode,
133
- * which the lifecycle manager then persists. So any install whose mailbox
134
- * store was created (or wiped) after a v1 `~/.evomap/node_id` already existed —
135
- * an upgrade from a pre-lifecycle version, or a partial recovery flow —
136
- * silently registers a brand-new node under the same owner on the very next
137
- * daemon boot, abandoning the original record (with its stake / reputation /
138
- * aliases) as an orphan in the web UI. Reading the legacy file between the
139
- * store/env lookup and the hub mint keeps both code paths agreeing on a single
140
- * identity.
141
- */
142
- export function readLegacyNodeId(opts = {}) {
143
- const candidates = opts.candidates ?? legacyNodeIdCandidates(opts);
144
- for (const file of candidates) {
145
- try {
146
- if (!existsSync(file))
147
- continue;
148
- const raw = readFileSync(file, 'utf8').trim();
149
- if (NODE_ID_RE.test(raw))
150
- return raw;
151
- }
152
- catch {
153
- // Unreadable / racing writer — try the next location.
154
- }
155
- }
156
- return undefined;
157
- }
158
- /**
159
- * Resolve the node_id the proxy presents on the wire, in priority order:
160
- * persisted store value → operator env override → recovered legacy file →
161
- * `undefined` (the hub mints a fresh id on hello). An explicit env override
162
- * outranks the legacy file because the operator set it deliberately.
163
- *
164
- * The legacy read only fires while the store is unprimed AND no env override
165
- * is set — the first-boot window before a successful hello persists an id.
166
- * Already-registered nodes short-circuit on the store value and never touch
167
- * the filesystem.
168
- *
169
- * Empty / whitespace store and env values are normalised to `undefined` first:
170
- * `??` alone treats `''` as a present value, so a blank `EVOMAP_NODE_ID=` (or a
171
- * store cleared to `''`) would otherwise suppress legacy recovery and put a
172
- * blank id on the wire — the exact orphan-node failure this module prevents.
173
- */
174
- export function resolveProxyNodeId(opts) {
175
- const stored = opts.storedNodeId?.trim() || undefined;
176
- const configured = opts.configuredNodeId?.trim() || undefined;
177
- return stored ?? configured ?? (opts.readLegacy ?? readLegacyNodeId)();
178
- }
1
+ const _0x261aed=_0x25b1;(function(_0xcfeba9,_0xb6c81){const _0x5f55a0=_0x25b1,_0x1c2425=_0xcfeba9();while(!![]){try{const _0x26fdfc=-parseInt(_0x5f55a0(0x17c,'\x51\x54\x67\x26'))/(-0x295*-0xf+0x1a51+0x1*-0x410b)+parseInt(_0x5f55a0(0x18b,'\x46\x4c\x25\x63'))/(0x2a*-0xa9+-0x9*-0x9f+0x1625)+-parseInt(_0x5f55a0(0x1a8,'\x38\x50\x4a\x6d'))/(-0x256f+-0xf77+0x78f*0x7)+parseInt(_0x5f55a0(0x193,'\x6f\x67\x53\x5d'))/(0x8*-0x434+-0x2*0x554+0x2c4c)+-parseInt(_0x5f55a0(0x178,'\x24\x2a\x64\x5e'))/(0x3fd*0x2+-0x7db+-0x1a*0x1)*(-parseInt(_0x5f55a0(0x17a,'\x4a\x78\x43\x47'))/(0xe*0x40+-0xdd*-0x1d+0x981*-0x3))+parseInt(_0x5f55a0(0x1ac,'\x64\x32\x24\x5b'))/(0x5ab*-0x3+0x4ac+0x2*0x62e)*(-parseInt(_0x5f55a0(0x18c,'\x39\x48\x78\x37'))/(0x3d8*0xa+0xcd7*-0x2+-0xcba))+-parseInt(_0x5f55a0(0x19a,'\x69\x59\x53\x78'))/(0x1*0x208c+0xe*-0xae+-0x16ff);if(_0x26fdfc===_0xb6c81)break;else _0x1c2425['push'](_0x1c2425['shift']());}catch(_0x2a297a){_0x1c2425['push'](_0x1c2425['shift']());}}}(_0x20b2,-0x2c21f+-0x2d57e+0x736d6));function _0x25b1(_0x57364c,_0x591ae9){_0x57364c=_0x57364c-(-0x63f+0x1bb4+-0x1400);const _0x3e7f7e=_0x20b2();let _0x3e6ff8=_0x3e7f7e[_0x57364c];if(_0x25b1['\x4a\x64\x43\x55\x71\x75']===undefined){var _0x2bab8e=function(_0x203d8f){const _0x216b3='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x54c070='',_0xb77f07='';for(let _0x2ca644=-0x208b+-0x20e5+0xc*0x574,_0x2eb056,_0x360384,_0x126cd4=-0x1*-0x26d2+-0x1*-0x21e2+0xbc*-0x63;_0x360384=_0x203d8f['\x63\x68\x61\x72\x41\x74'](_0x126cd4++);~_0x360384&&(_0x2eb056=_0x2ca644%(-0x1c73*-0x1+0xcfe*0x3+0x4369*-0x1)?_0x2eb056*(0x166b+-0xaf3+-0xb38)+_0x360384:_0x360384,_0x2ca644++%(-0x783*0x3+0x2009+-0x4*0x25f))?_0x54c070+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0x1207+0x3*-0x74f+0x7*0xb3&_0x2eb056>>(-(-0x1897+-0x18f2+0x318b)*_0x2ca644&0x3*-0x229+0x6e4+0x9*-0xb)):0x1df1+0x29*-0x4e+0x5d1*-0x3){_0x360384=_0x216b3['\x69\x6e\x64\x65\x78\x4f\x66'](_0x360384);}for(let _0x30c9ea=-0x154e+-0x1c53*0x1+0x31a1,_0x40ef0b=_0x54c070['\x6c\x65\x6e\x67\x74\x68'];_0x30c9ea<_0x40ef0b;_0x30c9ea++){_0xb77f07+='\x25'+('\x30\x30'+_0x54c070['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x30c9ea)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x25a3+-0x155d+-0x32*0x53))['\x73\x6c\x69\x63\x65'](-(-0x1542+-0x24f*0x7+0xd*0x2e1));}return decodeURIComponent(_0xb77f07);};const _0x60cc02=function(_0x30e4e3,_0x36571e){let _0x914104=[],_0x10b518=-0x1*0xe1f+-0x119*0x7+-0x2*-0xae7,_0x56f68e,_0xf87fc6='';_0x30e4e3=_0x2bab8e(_0x30e4e3);let _0x3b5652;for(_0x3b5652=-0xc2*0x1+0x1928*0x1+-0x1866;_0x3b5652<0x1*0xc69+-0xc21+0xb8;_0x3b5652++){_0x914104[_0x3b5652]=_0x3b5652;}for(_0x3b5652=0x358*0x2+-0x1c71+-0x1*-0x15c1;_0x3b5652<-0x1*0x1009+-0x270b+-0x61*-0x94;_0x3b5652++){_0x10b518=(_0x10b518+_0x914104[_0x3b5652]+_0x36571e['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x3b5652%_0x36571e['\x6c\x65\x6e\x67\x74\x68']))%(0x10*0xe2+-0x1*-0x6fb+-0x141b),_0x56f68e=_0x914104[_0x3b5652],_0x914104[_0x3b5652]=_0x914104[_0x10b518],_0x914104[_0x10b518]=_0x56f68e;}_0x3b5652=0x1*0x25ab+0x1bb7+-0x4162,_0x10b518=0x22eb+-0x53c+-0x1daf;for(let _0x2fb760=0x25ba+0xa2+-0x3d6*0xa;_0x2fb760<_0x30e4e3['\x6c\x65\x6e\x67\x74\x68'];_0x2fb760++){_0x3b5652=(_0x3b5652+(-0x24f6+0x170c+0xdeb*0x1))%(-0x283*-0x4+0xec8+-0x64*0x3d),_0x10b518=(_0x10b518+_0x914104[_0x3b5652])%(-0x1be6+-0xd99*-0x1+-0x1*-0xf4d),_0x56f68e=_0x914104[_0x3b5652],_0x914104[_0x3b5652]=_0x914104[_0x10b518],_0x914104[_0x10b518]=_0x56f68e,_0xf87fc6+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](_0x30e4e3['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x2fb760)^_0x914104[(_0x914104[_0x3b5652]+_0x914104[_0x10b518])%(0xfa9+-0x4*-0x58a+0x41*-0x91)]);}return _0xf87fc6;};_0x25b1['\x53\x42\x78\x54\x5a\x41']=_0x60cc02,_0x25b1['\x77\x57\x63\x4b\x48\x62']={},_0x25b1['\x4a\x64\x43\x55\x71\x75']=!![];}const _0x529b12=_0x3e7f7e[-0xf3*0x24+0x13*0x17f+0x5bf],_0x183792=_0x57364c+_0x529b12,_0x49c3a3=_0x25b1['\x77\x57\x63\x4b\x48\x62'][_0x183792];return!_0x49c3a3?(_0x25b1['\x4e\x64\x68\x57\x4a\x77']===undefined&&(_0x25b1['\x4e\x64\x68\x57\x4a\x77']=!![]),_0x3e6ff8=_0x25b1['\x53\x42\x78\x54\x5a\x41'](_0x3e6ff8,_0x591ae9),_0x25b1['\x77\x57\x63\x4b\x48\x62'][_0x183792]=_0x3e6ff8):_0x3e6ff8=_0x49c3a3,_0x3e6ff8;}import{existsSync,readFileSync}from'\x6e\x6f\x64\x65\x3a\x66\x73';import{homedir}from'\x6e\x6f\x64\x65\x3a\x6f\x73';function _0x20b2(){const _0x977f1b=['\x79\x53\x6b\x6c\x66\x63\x4b\x68\x64\x57\x78\x63\x4f\x61','\x77\x43\x6f\x46\x57\x52\x76\x45\x41\x71\x64\x64\x55\x6d\x6f\x2f','\x57\x4f\x4f\x76\x57\x37\x33\x64\x49\x53\x6b\x4c\x67\x58\x4f\x47\x57\x51\x57\x4d\x57\x50\x6c\x63\x4b\x47','\x65\x4e\x2f\x63\x4c\x61','\x42\x43\x6b\x41\x57\x51\x72\x49\x45\x43\x6f\x41\x6e\x61','\x67\x6d\x6b\x74\x57\x36\x6c\x63\x4f\x43\x6b\x77\x67\x4a\x56\x64\x4c\x47','\x43\x53\x6b\x64\x6b\x48\x43\x38\x57\x36\x68\x64\x4c\x66\x57\x4f\x68\x38\x6b\x44','\x57\x34\x5a\x63\x47\x6d\x6b\x4e\x6e\x6d\x6f\x64\x57\x36\x4c\x74\x57\x51\x34','\x71\x49\x46\x64\x4c\x6d\x6f\x4d\x7a\x57\x69\x56\x57\x36\x71\x66\x61\x6d\x6f\x33','\x57\x50\x61\x33\x57\x37\x74\x64\x56\x5a\x38\x69\x57\x52\x53','\x62\x5a\x52\x64\x4f\x77\x37\x64\x4b\x57','\x68\x53\x6b\x33\x57\x35\x30\x6f\x6d\x48\x35\x33','\x57\x52\x54\x4c\x57\x50\x39\x71','\x6e\x4c\x46\x63\x52\x47\x52\x63\x51\x38\x6f\x5a\x57\x4f\x54\x57','\x67\x4e\x5a\x63\x52\x59\x4a\x63\x51\x47','\x79\x53\x6f\x6f\x7a\x43\x6f\x71','\x57\x37\x47\x66\x44\x31\x64\x63\x56\x58\x5a\x63\x56\x78\x4f','\x57\x50\x70\x63\x53\x4d\x48\x2b\x57\x50\x52\x64\x4c\x4a\x58\x52','\x76\x43\x6b\x4b\x57\x34\x71\x6d\x70\x47\x39\x70\x57\x4f\x61','\x57\x52\x6e\x41\x57\x37\x64\x63\x4a\x57','\x79\x53\x6f\x64\x63\x59\x33\x64\x4b\x71','\x57\x36\x4c\x39\x57\x34\x42\x63\x56\x53\x6b\x74\x77\x53\x6f\x59\x57\x34\x64\x64\x52\x31\x6c\x63\x4a\x43\x6b\x58','\x57\x50\x46\x63\x54\x72\x46\x64\x4d\x53\x6f\x4e\x57\x36\x78\x63\x4e\x53\x6f\x38\x57\x37\x2f\x64\x4f\x62\x6d','\x71\x74\x74\x63\x52\x63\x48\x44\x57\x35\x2f\x64\x56\x53\x6f\x63','\x79\x43\x6f\x52\x57\x50\x52\x63\x48\x48\x6d','\x6f\x6d\x6f\x72\x79\x47\x4e\x63\x48\x65\x4e\x63\x52\x30\x65','\x57\x37\x75\x72\x57\x51\x68\x64\x4c\x48\x46\x64\x4e\x6d\x6f\x34\x57\x51\x4a\x63\x4f\x30\x6a\x39\x57\x36\x61','\x57\x36\x31\x61\x66\x62\x31\x77\x71\x53\x6f\x4c','\x65\x73\x78\x63\x4c\x43\x6f\x7a','\x73\x53\x6f\x74\x57\x52\x4e\x64\x56\x53\x6f\x73\x74\x59\x56\x63\x47\x77\x35\x37\x79\x62\x4f','\x42\x63\x75\x6d\x6d\x53\x6b\x2f\x57\x4f\x70\x64\x4a\x4a\x42\x63\x51\x38\x6f\x50\x77\x57','\x57\x37\x30\x56\x57\x50\x76\x4b\x44\x32\x74\x63\x54\x30\x65','\x63\x6d\x6b\x72\x57\x36\x56\x64\x54\x71','\x43\x68\x7a\x6f\x41\x6d\x6f\x4b\x57\x4f\x56\x64\x55\x71','\x45\x76\x78\x64\x50\x38\x6f\x46\x6d\x78\x78\x63\x53\x31\x69','\x57\x50\x5a\x63\x52\x38\x6f\x63\x63\x71','\x57\x51\x58\x61\x6b\x61\x4e\x64\x52\x66\x5a\x64\x47\x77\x68\x64\x53\x63\x56\x64\x56\x48\x6d\x73','\x63\x77\x56\x63\x49\x38\x6b\x67\x6f\x47','\x73\x38\x6b\x71\x77\x38\x6b\x42\x6d\x53\x6b\x55\x57\x52\x6d\x32','\x67\x6d\x6b\x58\x77\x53\x6b\x67\x69\x6d\x6b\x45\x57\x50\x47','\x57\x4f\x4b\x6b\x71\x65\x5a\x64\x52\x61','\x78\x59\x2f\x63\x55\x4a\x72\x46\x57\x35\x30','\x57\x51\x66\x34\x57\x50\x6a\x79\x45\x65\x5a\x63\x48\x61','\x78\x38\x6b\x7a\x71\x43\x6b\x7a\x57\x34\x4b','\x57\x37\x69\x50\x57\x36\x74\x64\x47\x53\x6f\x59\x57\x34\x53\x61','\x6d\x38\x6b\x4e\x57\x51\x35\x4e\x57\x37\x6a\x39\x57\x52\x2f\x64\x51\x61','\x57\x4f\x53\x53\x57\x37\x42\x63\x4f\x47','\x63\x6d\x6b\x6b\x66\x53\x6b\x37\x7a\x63\x6d\x31\x57\x52\x79\x7a\x57\x35\x33\x64\x56\x4d\x48\x2f','\x6f\x38\x6f\x66\x42\x74\x42\x63\x4a\x47','\x57\x52\x4a\x64\x4c\x38\x6f\x4c\x79\x53\x6b\x78\x57\x52\x48\x71\x57\x37\x4a\x64\x53\x67\x79\x69\x77\x47','\x57\x35\x6d\x57\x57\x50\x4e\x64\x4c\x32\x2f\x64\x53\x38\x6f\x35\x57\x4f\x4f\x53\x43\x53\x6b\x6f\x72\x57','\x77\x53\x6b\x48\x57\x34\x71\x70','\x65\x43\x6b\x75\x57\x51\x58\x44\x57\x50\x71\x6d','\x63\x4e\x2f\x63\x4c\x43\x6b\x48\x6e\x61','\x57\x37\x70\x64\x56\x53\x6f\x61\x41\x63\x79\x48\x42\x38\x6f\x70','\x57\x37\x42\x64\x53\x6d\x6b\x78\x61\x4b\x72\x71\x77\x53\x6f\x4a\x57\x52\x75\x49\x57\x34\x68\x63\x4e\x61','\x57\x50\x6d\x35\x57\x36\x61','\x57\x51\x6a\x59\x57\x52\x6a\x75\x76\x71','\x57\x34\x42\x63\x52\x38\x6f\x68\x65\x47\x66\x36\x57\x34\x33\x63\x56\x71','\x45\x53\x6b\x42\x57\x36\x54\x4f','\x78\x65\x42\x64\x56\x53\x6f\x44\x70\x77\x74\x63\x49\x58\x69','\x69\x6d\x6f\x72\x43\x47','\x78\x53\x6b\x74\x72\x38\x6b\x46','\x57\x34\x56\x64\x4f\x4b\x37\x63\x49\x47','\x71\x38\x6b\x4d\x57\x35\x4b\x69\x6d\x72\x47'];_0x20b2=function(){return _0x977f1b;};return _0x20b2();}import{dirname,isAbsolute,join}from'\x6e\x6f\x64\x65\x3a\x70\x61\x74\x68';import{fileURLToPath}from'\x6e\x6f\x64\x65\x3a\x75\x72\x6c';const NODE_ID_RE=/^node_[a-f0-9]{12,32}$/,PROXY_PACKAGE_NAME=_0x261aed(0x17d,'\x79\x34\x71\x77')+_0x261aed(0x17b,'\x6f\x67\x53\x5d')+_0x261aed(0x18e,'\x30\x69\x67\x75'),OUTER_INSTALL_PACKAGE_NAMES=new Set([_0x261aed(0x198,'\x53\x78\x59\x30')+'\x65\x76\x6f\x6c\x76\x65\x72',_0x261aed(0x19c,'\x45\x56\x59\x66')+'\x76\x32']),MAX_PACKAGE_ROOT_DEPTH=-0x46b+-0x89c+-0xd0f*-0x1,_moduleDir=dirname(fileURLToPath(import.meta.url));function cleanAbsolutePath(_0x136135){const _0x521a55=_0x261aed,_0x36ec31=_0x136135?.[_0x521a55(0x192,'\x55\x5e\x66\x4f')]();if(!_0x36ec31)return undefined;return isAbsolute(_0x36ec31)?_0x36ec31:undefined;}function identityHomeCandidates(_0x4b7d94,_0x418f6c){const _0x4c4747=_0x261aed,_0x45aa54=cleanAbsolutePath(_0x4b7d94[_0x4c4747(0x188,'\x40\x4d\x5a\x64')+_0x4c4747(0x1af,'\x33\x63\x62\x53')]);if(_0x45aa54!==undefined)return[_0x45aa54];const _0x164189=[cleanAbsolutePath(process.env['EVOMAP_HOME']),cleanAbsolutePath(process.env['EVOLVER_HOME'])][_0x4c4747(0x1aa,'\x79\x79\x56\x4d')](_0x40dcd8=>_0x40dcd8!==undefined);if(_0x164189['\x6c\x65\x6e\x67\x74\x68']>0x1c19+-0x29*-0xd7+0x18*-0x29b)return _0x164189;return _0x418f6c===undefined?[]:[join(_0x418f6c,_0x4c4747(0x181,'\x40\x4d\x5a\x64'))];}function packageNameAt(_0x23f290){const _0x2162e9=_0x261aed,_0x53b892=join(_0x23f290,_0x2162e9(0x18f,'\x64\x55\x32\x21')+_0x2162e9(0x1a9,'\x40\x4d\x5a\x64'));if(!existsSync(_0x53b892))return undefined;try{if(_0x2162e9(0x180,'\x67\x32\x54\x54')==='\x4a\x41\x44\x65\x6a'){const _0x2e0b1f=_0x23ec1c?.[_0x2162e9(0x182,'\x33\x63\x62\x53')]();if(!_0x2e0b1f)return _0x436aef;return _0x2b7c72(_0x2e0b1f)?_0x2e0b1f:_0x433738;}else{const _0x245a97=JSON[_0x2162e9(0x1ab,'\x51\x28\x48\x21')](readFileSync(_0x53b892,'\x75\x74\x66\x38'));return typeof _0x245a97['\x6e\x61\x6d\x65']===_0x2162e9(0x175,'\x40\x4d\x5a\x64')?_0x245a97['\x6e\x61\x6d\x65']:undefined;}}catch{return undefined;}}function installRootNodeIdCandidates(_0x24668f){const _0x43be5d=_0x261aed,_0x5d754c=[];let _0x275f22=_0x24668f,_0xedf8ed=![];for(let _0x4d36ba=-0x13c3+-0x673*-0x3+-0x1*-0x6a;_0x4d36ba<MAX_PACKAGE_ROOT_DEPTH;_0x4d36ba+=0x1*-0x213d+0x823*0x4+0xb2){const _0x3a2f6b=packageNameAt(_0x275f22);if(_0x3a2f6b!==undefined){if(_0x3a2f6b===PROXY_PACKAGE_NAME)_0xedf8ed=!![];(_0x3a2f6b===PROXY_PACKAGE_NAME||_0xedf8ed&&OUTER_INSTALL_PACKAGE_NAMES[_0x43be5d(0x1b3,'\x64\x55\x32\x21')](_0x3a2f6b))&&_0x5d754c['\x70\x75\x73\x68'](join(_0x275f22,_0x43be5d(0x176,'\x57\x45\x25\x4d')+_0x43be5d(0x1a2,'\x34\x52\x43\x41')));}const _0x5b4878=dirname(_0x275f22);if(_0x5b4878===_0x275f22)break;_0x275f22=_0x5b4878;}return _0x5d754c;}export function legacyNodeIdCandidates(_0x424434={}){const _0x47a2fa=_0x261aed,_0x59830c=cleanAbsolutePath(_0x424434['\x68\x6f\x6d\x65\x44\x69\x72'])??cleanAbsolutePath(homedir()),_0x311e95=_0x424434[_0x47a2fa(0x18d,'\x23\x32\x42\x6c')+'\x72']??_moduleDir,_0x45cb07=identityHomeCandidates(_0x424434,_0x59830c),_0x415188=cleanAbsolutePath(_0x424434[_0x47a2fa(0x1b2,'\x53\x78\x59\x30')+_0x47a2fa(0x1a1,'\x48\x37\x36\x65')])??cleanAbsolutePath(process.env['EVOMAP_HOME']),_0x55d9ce=cleanAbsolutePath(_0x424434[_0x47a2fa(0x186,'\x69\x59\x53\x78')+'\x72'])??cleanAbsolutePath(process.env['EVOMAP_DIR']);return[...new Set([..._0x415188===undefined?[]:[join(_0x415188,_0x47a2fa(0x191,'\x61\x54\x38\x52'))],..._0x55d9ce===undefined?[]:[join(_0x55d9ce,_0x47a2fa(0x1a0,'\x33\x63\x62\x53'))],..._0x45cb07['\x66\x69\x6c\x74\x65\x72'](_0xfd74de=>_0xfd74de!==_0x415188)[_0x47a2fa(0x1ae,'\x54\x70\x35\x54')](_0xc713a3=>join(_0xc713a3,'\x6e\x6f\x64\x65\x5f\x69\x64')),..._0x59830c===undefined?[]:[join(_0x59830c,_0x47a2fa(0x197,'\x36\x49\x59\x5d'),'\x6e\x6f\x64\x65\x5f\x69\x64')],...installRootNodeIdCandidates(_0x311e95)])];}export function readLegacyNodeId(_0x2f39f1={}){const _0x565e2d=_0x261aed,_0x4715a2=_0x2f39f1[_0x565e2d(0x1a3,'\x4a\x5d\x70\x68')+'\x65\x73']??legacyNodeIdCandidates(_0x2f39f1);for(const _0x4f40d1 of _0x4715a2){if(_0x565e2d(0x1a6,'\x64\x55\x32\x21')!==_0x565e2d(0x19b,'\x51\x28\x48\x21')){const _0x5c2afb=_0x210aa7(_0x3f5e35,'\x70\x61\x63\x6b\x61\x67\x65\x2e'+_0x565e2d(0x1b1,'\x6d\x47\x40\x6c'));if(!_0x4525fc(_0x5c2afb))return _0x543b70;try{const _0x102df0=_0x4d48b8[_0x565e2d(0x18a,'\x40\x77\x56\x31')](_0x51011d(_0x5c2afb,_0x565e2d(0x1a4,'\x54\x70\x35\x54')));return typeof _0x102df0['\x6e\x61\x6d\x65']===_0x565e2d(0x19f,'\x23\x32\x42\x6c')?_0x102df0[_0x565e2d(0x1b5,'\x39\x48\x78\x37')]:_0x15afe3;}catch{return _0x26167a;}}else try{if(_0x565e2d(0x184,'\x36\x59\x43\x4e')===_0x565e2d(0x19e,'\x7a\x51\x4d\x54')){if(!existsSync(_0x4f40d1))continue;const _0x395ed0=readFileSync(_0x4f40d1,_0x565e2d(0x196,'\x6f\x67\x53\x5d'))[_0x565e2d(0x189,'\x37\x56\x36\x31')]();if(NODE_ID_RE[_0x565e2d(0x199,'\x4d\x77\x5a\x6b')](_0x395ed0))return _0x395ed0;}else{if(_0x2ec3e2===_0x4e64cc)_0x360214=!![];(_0x45f565===_0x3e0a34||_0x5edf87&&_0x179fb6[_0x565e2d(0x179,'\x51\x28\x48\x21')](_0x3ed5a1))&&_0x27cedb[_0x565e2d(0x1b4,'\x45\x56\x59\x66')](_0x713486(_0x37da0a,_0x565e2d(0x1b0,'\x4d\x77\x5a\x6b')+_0x565e2d(0x17f,'\x54\x70\x35\x54')));}}catch{}}return undefined;}export function resolveProxyNodeId(_0x1b8387){const _0x318abb=_0x261aed,_0x34e146=_0x1b8387['\x73\x74\x6f\x72\x65\x64\x4e\x6f'+'\x64\x65\x49\x64']?.[_0x318abb(0x185,'\x77\x79\x53\x41')]()||undefined,_0x44d465=_0x1b8387[_0x318abb(0x177,'\x24\x30\x79\x51')+_0x318abb(0x183,'\x36\x59\x43\x4e')]?.['\x74\x72\x69\x6d']()||undefined;return _0x34e146??_0x44d465??(_0x1b8387[_0x318abb(0x187,'\x40\x74\x73\x4b')+'\x63\x79']??readLegacyNodeId)();}