@guanjinke/artifact-client 1.2.0 → 1.4.0

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.
Files changed (84) hide show
  1. package/README.md +146 -1
  2. package/dist/cli/config-manager.d.ts +15 -0
  3. package/dist/cli/config-manager.d.ts.map +1 -1
  4. package/dist/cli/config-manager.js +31 -0
  5. package/dist/cli/config-manager.js.map +1 -1
  6. package/dist/cli/environment.d.ts +6 -0
  7. package/dist/cli/environment.d.ts.map +1 -0
  8. package/dist/cli/environment.js +134 -0
  9. package/dist/cli/environment.js.map +1 -0
  10. package/dist/cli/setup.d.ts.map +1 -1
  11. package/dist/cli/setup.js +200 -18
  12. package/dist/cli/setup.js.map +1 -1
  13. package/dist/cli.js +4 -1
  14. package/dist/cli.js.map +1 -1
  15. package/dist/environment/archive.d.ts +7 -0
  16. package/dist/environment/archive.d.ts.map +1 -0
  17. package/dist/environment/archive.js +132 -0
  18. package/dist/environment/archive.js.map +1 -0
  19. package/dist/environment/builder.d.ts +6 -0
  20. package/dist/environment/builder.d.ts.map +1 -0
  21. package/dist/environment/builder.js +323 -0
  22. package/dist/environment/builder.js.map +1 -0
  23. package/dist/environment/catalog.d.ts +9 -0
  24. package/dist/environment/catalog.d.ts.map +1 -0
  25. package/dist/environment/catalog.js +35 -0
  26. package/dist/environment/catalog.js.map +1 -0
  27. package/dist/environment/config.d.ts +8 -0
  28. package/dist/environment/config.d.ts.map +1 -0
  29. package/dist/environment/config.js +60 -0
  30. package/dist/environment/config.js.map +1 -0
  31. package/dist/environment/manager.d.ts +43 -0
  32. package/dist/environment/manager.d.ts.map +1 -0
  33. package/dist/environment/manager.js +383 -0
  34. package/dist/environment/manager.js.map +1 -0
  35. package/dist/environment/plan.d.ts +10 -0
  36. package/dist/environment/plan.d.ts.map +1 -0
  37. package/dist/environment/plan.js +131 -0
  38. package/dist/environment/plan.js.map +1 -0
  39. package/dist/environment/process.d.ts +94 -0
  40. package/dist/environment/process.d.ts.map +1 -0
  41. package/dist/environment/process.js +381 -0
  42. package/dist/environment/process.js.map +1 -0
  43. package/dist/environment/registry.d.ts +45 -0
  44. package/dist/environment/registry.d.ts.map +1 -0
  45. package/dist/environment/registry.js +157 -0
  46. package/dist/environment/registry.js.map +1 -0
  47. package/dist/environment/root.d.ts +33 -0
  48. package/dist/environment/root.d.ts.map +1 -0
  49. package/dist/environment/root.js +119 -0
  50. package/dist/environment/root.js.map +1 -0
  51. package/dist/environment/types.d.ts +66 -0
  52. package/dist/environment/types.d.ts.map +1 -0
  53. package/dist/environment/types.js +3 -0
  54. package/dist/environment/types.js.map +1 -0
  55. package/dist/environment/update.d.ts +85 -0
  56. package/dist/environment/update.d.ts.map +1 -0
  57. package/dist/environment/update.js +644 -0
  58. package/dist/environment/update.js.map +1 -0
  59. package/dist/environment/validate.d.ts +36 -0
  60. package/dist/environment/validate.d.ts.map +1 -0
  61. package/dist/environment/validate.js +147 -0
  62. package/dist/environment/validate.js.map +1 -0
  63. package/dist/index.d.ts +13 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +29 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/providers/azure-provider.d.ts +1 -1
  68. package/dist/providers/azure-provider.d.ts.map +1 -1
  69. package/dist/providers/azure-provider.js +7 -6
  70. package/dist/providers/azure-provider.js.map +1 -1
  71. package/dist/providers/oss-provider.d.ts +1 -1
  72. package/dist/providers/oss-provider.d.ts.map +1 -1
  73. package/dist/providers/oss-provider.js +7 -6
  74. package/dist/providers/oss-provider.js.map +1 -1
  75. package/dist/providers/storage-provider.d.ts +5 -1
  76. package/dist/providers/storage-provider.d.ts.map +1 -1
  77. package/dist/providers/storage-provider.js.map +1 -1
  78. package/dist/types.d.ts +6 -0
  79. package/dist/types.d.ts.map +1 -1
  80. package/dist/utils/local-path.d.ts +10 -0
  81. package/dist/utils/local-path.d.ts.map +1 -0
  82. package/dist/utils/local-path.js +51 -0
  83. package/dist/utils/local-path.js.map +1 -0
  84. package/package.json +9 -3
@@ -0,0 +1,383 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.EnvironmentManager = exports.ownershipFile = void 0;
37
+ const fs = __importStar(require("fs/promises"));
38
+ const path = __importStar(require("path"));
39
+ const crypto_1 = require("crypto");
40
+ const fast_xml_parser_1 = require("fast-xml-parser");
41
+ const registry_1 = require("./registry");
42
+ const process_1 = require("./process");
43
+ const validate_1 = require("./validate");
44
+ const plan_1 = require("./plan");
45
+ const builder_1 = require("./builder");
46
+ var validate_2 = require("./validate");
47
+ Object.defineProperty(exports, "ownershipFile", { enumerable: true, get: function () { return validate_2.ownershipFile; } });
48
+ class EnvironmentManager {
49
+ dependencies;
50
+ registry;
51
+ processes;
52
+ portCheck;
53
+ pathHolders;
54
+ constructor(dependencies = {}) {
55
+ this.dependencies = dependencies;
56
+ this.registry = dependencies.registry ?? new registry_1.EnvironmentRegistry();
57
+ this.processes = dependencies.processes ?? new process_1.WindowsProcessBackend();
58
+ this.portCheck = dependencies.portCheck ?? process_1.checkPort;
59
+ this.pathHolders = dependencies.pathHolders ?? process_1.describePathHolders;
60
+ }
61
+ async create(name, options, clientFactory, onProgress) {
62
+ if (!options.dryRun && (this.dependencies.platform ?? process.platform) !== 'win32')
63
+ throw new Error('Environment execution is Windows-only. Use dry-run on other platforms.');
64
+ const normalized = await (0, plan_1.validateEnvironmentOptions)(options);
65
+ await (0, validate_1.validateEnvironmentRoot)({ root: normalized.root }, this.registry.directory);
66
+ this.registry.check(await this.registry.read(), name, normalized.root, normalized.port);
67
+ await this.portCheck(normalized.port);
68
+ if (options.dryRun) {
69
+ const plan = await (0, plan_1.buildEnvironmentPlan)(options, clientFactory(), onProgress);
70
+ return { ...plan, managed: { name, root: normalized.root, port: normalized.port } };
71
+ }
72
+ const creator = await this.processes.inspect(process.pid);
73
+ const record = { id: (0, crypto_1.randomUUID)(), name, root: normalized.root, port: normalized.port, edition: normalized.edition, major: normalized.major, profile: normalized.profile, modules: normalized.modules, manifest: path.join(normalized.root, 'environment.lock.json'), createdAt: new Date().toISOString(), state: 'creating', ...(creator.status === 'live' ? { creator: { ...creator.identity, command: `sha256:${(0, crypto_1.createHash)('sha256').update(creator.identity.command).digest('hex')}` } } : {}) };
74
+ await this.registry.update(entries => { this.registry.check(entries, name, record.root, record.port); entries.push(record); });
75
+ return this.registry.locked(`env-${record.id}`, async () => {
76
+ try {
77
+ const client = clientFactory();
78
+ const plan = await (0, plan_1.buildEnvironmentPlan)(options, client, onProgress);
79
+ const result = await (0, builder_1.executeEnvironmentPlan)(plan, { client, onProgress, platform: this.dependencies.platform, managed: { id: record.id, name } });
80
+ record.state = 'ready';
81
+ delete record.creator;
82
+ await this.registry.save(record);
83
+ return result;
84
+ }
85
+ catch (error) {
86
+ // Publication/registry failures must retain a recoverable ownership record.
87
+ let published = false;
88
+ try {
89
+ const marker = JSON.parse(await fs.readFile(path.join(record.root, validate_1.ownershipFile), 'utf8'));
90
+ published = marker.id === record.id;
91
+ }
92
+ catch (readError) {
93
+ if (readError.code !== 'ENOENT')
94
+ published = true;
95
+ }
96
+ if (!published)
97
+ await this.registry.remove(record.id);
98
+ throw error;
99
+ }
100
+ });
101
+ }
102
+ async activeCreator(entry) {
103
+ if (entry.state !== 'creating')
104
+ return;
105
+ if (!entry.creator)
106
+ throw new Error('Creating reservation has unknown owner; refusing lifecycle operation.');
107
+ const inspected = await this.processes.inspect(entry.creator.pid);
108
+ const live = inspected.status === 'live' && entry.creator.command.startsWith('sha256:') ? { ...inspected.identity, command: `sha256:${(0, crypto_1.createHash)('sha256').update(inspected.identity.command).digest('hex')}` } : inspected.status === 'live' ? inspected.identity : undefined;
109
+ if (inspected.status === 'unknown' || live && (0, process_1.sameProcess)(live, entry.creator))
110
+ throw new Error('Creation owner is active or uncertain; refusing lifecycle operation.');
111
+ }
112
+ /**
113
+ * Observed state of every registered environment, including ownership
114
+ * problems and the runtime identity check (`observeRuntimeState`).
115
+ */
116
+ async list() {
117
+ return Promise.all((await this.registry.read()).map(async (entry) => {
118
+ let observedState = await (0, validate_1.observeRuntimeState)(entry, this.processes);
119
+ let problem;
120
+ try {
121
+ await (0, validate_1.validateEnvironmentOwnership)(entry, this.registry.directory);
122
+ }
123
+ catch (error) {
124
+ problem = error.message;
125
+ observedState = observedState === 'running' || observedState === 'unknown' ? observedState : problem.includes('ENOENT') ? 'missing' : 'broken';
126
+ }
127
+ if (entry.state === 'creating' && !entry.run) {
128
+ observedState = 'creating';
129
+ problem = problem ? `Creation not fully published: ${problem}` : 'Creating reservation; inspect creator identity before recovery.';
130
+ }
131
+ else if (observedState === 'unknown' && !problem)
132
+ problem = 'Runtime identity uncertain; inspect registry, OS processes and any .afm-runtime-recovery.json before recovery.';
133
+ return { ...entry, observedState, ...(problem ? { problem } : {}) };
134
+ }));
135
+ }
136
+ async validateRuntime(entry) {
137
+ await (0, validate_1.validateEnvironmentOwnership)(entry, this.registry.directory);
138
+ await (0, validate_1.validateEnvironmentTree)(entry.root);
139
+ for (const file of [(0, validate_1.environmentDll)(entry), path.join(entry.root, 'Server', 'Wyn.Server.runtimeconfig.json'), path.join(entry.root, 'conf', 'Wyn.conf')]) {
140
+ const stat = await fs.lstat(file);
141
+ if (!stat.isFile() || stat.isSymbolicLink())
142
+ throw new Error('Runtime requires regular DLL, runtimeconfig and configuration files.');
143
+ }
144
+ const xml = await fs.readFile(path.join(entry.root, 'conf', 'Wyn.conf'), 'utf8');
145
+ if (/<!DOCTYPE|<!ENTITY/i.test(xml) || fast_xml_parser_1.XMLValidator.validate(xml) !== true)
146
+ throw new Error('Invalid environment configuration.');
147
+ const document = new fast_xml_parser_1.XMLParser({ ignoreAttributes: false, parseTagValue: false, processEntities: false }).parse(xml);
148
+ const expected = `http://localhost:${entry.port}`;
149
+ if (document?.SystemConfig?.Services?.Server?.Urls !== expected || document?.SystemConfig?.GlobalSettings?.IdentityServerUrl !== expected)
150
+ throw new Error('Configured port differs from registry; refusing startup.');
151
+ }
152
+ async stopEntry(entry) {
153
+ await this.activeCreator(entry);
154
+ const state = await (0, validate_1.observeRuntimeState)(entry, this.processes);
155
+ if (state === 'unknown')
156
+ throw new Error('Process identity uncertain; refusing stop/delete.');
157
+ if (state === 'running')
158
+ await this.processes.stop(entry.run);
159
+ if (entry.state !== 'stopped' || entry.run) {
160
+ entry.state = 'stopped';
161
+ delete entry.run;
162
+ await this.registry.save(entry);
163
+ }
164
+ this.dependencies.onProgress?.(`${entry.name}: stopped (verified).`);
165
+ }
166
+ async fresh(name, id) { const entry = await this.registry.get(name); if (entry.id !== id)
167
+ throw new Error('Environment UUID changed during operation.'); return entry; }
168
+ async stop(name) { const entry = await this.registry.get(name); await this.registry.locked(`env-${entry.id}`, async () => this.stopEntry(await this.fresh(name, entry.id))); }
169
+ async launch(entry, mode) {
170
+ await this.activeCreator(entry);
171
+ await this.validateRuntime(entry);
172
+ const state = await (0, validate_1.observeRuntimeState)(entry, this.processes, { ignoreAmbiguous: true });
173
+ if (state === 'running' || state === 'unknown')
174
+ throw new Error(`Cannot start environment: ${state}.`);
175
+ await this.portCheck(entry.port);
176
+ const stdout = path.join(entry.root, 'logs', 'server.stdout.log');
177
+ const stderr = path.join(entry.root, 'logs', 'server.stderr.log');
178
+ await fs.mkdir(path.join(entry.root, 'logs'), { recursive: true });
179
+ if (mode === 'background')
180
+ this.dependencies.onProgress?.('Background mode starts the monitor in its own hidden console so Wyn.Server can set its console title; output is appended to the log files.');
181
+ const remember = async (identity) => {
182
+ entry.state = 'running';
183
+ entry.lastMode = mode;
184
+ entry.run = { ...identity, mode, ...(mode === 'background' ? { stdout, stderr } : {}) };
185
+ try {
186
+ await this.registry.save(entry);
187
+ }
188
+ catch (error) {
189
+ await fs.writeFile(path.join(entry.root, '.afm-runtime-recovery.json'), JSON.stringify({ version: 1, id: entry.id, run: entry.run }, null, 2) + '\n', { flag: 'wx' });
190
+ throw new Error(`Runtime identity saved to ${path.join(entry.root, '.afm-runtime-recovery.json')}; registry recovery required: ${error.message}`);
191
+ }
192
+ };
193
+ let child;
194
+ try {
195
+ child = await this.processes.start((0, validate_1.environmentDll)(entry), mode, stdout, stderr);
196
+ }
197
+ catch (error) {
198
+ if (error instanceof process_1.PendingProcessError)
199
+ await remember(error.identity);
200
+ throw error;
201
+ }
202
+ try {
203
+ const current = await this.processes.inspect(child.identity.pid);
204
+ if (current.status !== 'live' || !(0, process_1.sameProcess)(current.identity, child.identity) || !(0, process_1.isMonitor)(child.identity, (0, validate_1.environmentDll)(entry)))
205
+ throw new Error('Monitor exited or identity cannot be verified.');
206
+ entry.state = 'running';
207
+ entry.lastMode = mode;
208
+ entry.run = { ...child.identity, mode, ...(mode === 'background' ? { stdout, stderr } : {}) };
209
+ await this.registry.save(entry);
210
+ }
211
+ catch (error) {
212
+ try {
213
+ const status = await this.processes.inspect(child.identity.pid);
214
+ if (status.status !== 'absent')
215
+ await this.processes.stop(child.identity);
216
+ else if ((await this.processes.find((0, process_1.monitorCommand)((0, validate_1.environmentDll)(entry)))).some(candidate => candidate.status !== 'absent'))
217
+ throw new Error('Owned descendants or process inspection remain uncertain.');
218
+ }
219
+ catch (cleanupError) {
220
+ try {
221
+ await remember(child.identity);
222
+ }
223
+ finally {
224
+ child.unref();
225
+ }
226
+ throw new Error(`Launch failed and cleanup uncertain; runtime identity retained: ${cleanupError.message}`);
227
+ }
228
+ throw error;
229
+ }
230
+ if (mode === 'background')
231
+ child.unref();
232
+ this.dependencies.onProgress?.(`${entry.name}: monitor running, PID ${child.identity.pid}, ${mode}${mode === 'background' ? `; stdout ${stdout}; stderr ${stderr}` : '; output inherited; Ctrl+C stops the monitor tree'}. HTTP readiness not checked.`);
233
+ return child;
234
+ }
235
+ async foreground(name, id, child) {
236
+ if (!child.exited)
237
+ throw new Error('Foreground launch did not provide a process handle.');
238
+ let cleanup;
239
+ const clean = async () => this.registry.locked(`env-${id}`, async () => { const entries = await this.registry.read(); const entry = entries.find(e => e.id === id); if (!entry || !entry.run || !(0, process_1.sameProcess)(entry.run, child.identity))
240
+ return false; await this.stopEntry(entry); return true; });
241
+ let wake;
242
+ const signalled = new Promise(resolve => { wake = resolve; });
243
+ const stop = () => { cleanup ??= clean(); void cleanup.then(wake, error => { console.error('Foreground cleanup failed:', error.message); process.exitCode = 1; wake(); }); };
244
+ process.on('SIGINT', stop);
245
+ process.on('SIGTERM', stop);
246
+ try {
247
+ await Promise.race([child.exited, signalled]);
248
+ if (cleanup)
249
+ await cleanup;
250
+ else {
251
+ const owned = await clean();
252
+ if (owned && child.exitCode && child.exitCode() !== 0)
253
+ throw new Error(`Monitor exited unexpectedly with code ${child.exitCode()}.`);
254
+ }
255
+ }
256
+ finally {
257
+ process.removeListener('SIGINT', stop);
258
+ process.removeListener('SIGTERM', stop);
259
+ if (cleanup)
260
+ child.unref();
261
+ }
262
+ }
263
+ async runLaunch(name, id, mode, action) {
264
+ let interrupted = false;
265
+ const mark = () => { interrupted = true; };
266
+ process.on('SIGINT', mark);
267
+ process.on('SIGTERM', mark);
268
+ let child;
269
+ try {
270
+ child = await this.registry.locked(`env-${id}`, action);
271
+ }
272
+ finally {
273
+ process.removeListener('SIGINT', mark);
274
+ process.removeListener('SIGTERM', mark);
275
+ }
276
+ if (interrupted) {
277
+ await this.registry.locked(`env-${id}`, async () => { const entries = await this.registry.read(); const entry = entries.find(e => e.id === id); if (entry?.run && (0, process_1.sameProcess)(entry.run, child.identity))
278
+ await this.stopEntry(entry); });
279
+ return;
280
+ }
281
+ if (mode === 'foreground')
282
+ await this.foreground(name, id, child);
283
+ }
284
+ validateMode(mode) { if (!['foreground', 'background'].includes(mode))
285
+ throw new Error('Runtime mode must be foreground or background.'); }
286
+ async start(name, mode = 'foreground') {
287
+ this.validateMode(mode);
288
+ const entry = await this.registry.get(name);
289
+ await this.runLaunch(name, entry.id, mode, async () => this.launch(await this.fresh(name, entry.id), mode));
290
+ }
291
+ async restart(name, mode) {
292
+ if (mode !== undefined)
293
+ this.validateMode(mode);
294
+ const entry = await this.registry.get(name);
295
+ const selected = mode ?? entry.lastMode ?? 'foreground';
296
+ this.validateMode(selected);
297
+ await this.runLaunch(name, entry.id, selected, async () => { const fresh = await this.fresh(name, entry.id); await this.stopEntry(fresh); return this.launch(fresh, selected); });
298
+ }
299
+ async delete(name, confirm) {
300
+ const entry = await this.registry.get(name);
301
+ if (!await confirm(entry))
302
+ return false;
303
+ return this.registry.locked(`env-${entry.id}`, async () => {
304
+ const fresh = await this.registry.get(name);
305
+ if (fresh.id !== entry.id || fresh.root !== entry.root)
306
+ throw new Error('Environment changed after confirmation.');
307
+ await this.activeCreator(fresh);
308
+ const others = await this.registry.read();
309
+ if (others.some(e => e.id !== fresh.id && (e.root.toLowerCase().startsWith(fresh.root.toLowerCase() + path.sep) || fresh.root.toLowerCase().startsWith(e.root.toLowerCase() + path.sep))))
310
+ throw new Error('Environment roots overlap; refusing delete.');
311
+ const exists = await (0, validate_1.validateEnvironmentRoot)(fresh, this.registry.directory);
312
+ if (exists) {
313
+ await (0, validate_1.validateEnvironmentOwnership)(fresh, this.registry.directory);
314
+ await (0, validate_1.validateEnvironmentTree)(fresh.root);
315
+ }
316
+ await this.stopEntry(fresh);
317
+ if (exists) {
318
+ await (0, validate_1.validateEnvironmentOwnership)(fresh, this.registry.directory);
319
+ await (0, validate_1.validateEnvironmentTree)(fresh.root);
320
+ const link = path.join(fresh.root, 'Monitor', 'conf');
321
+ try {
322
+ if ((await fs.lstat(link)).isSymbolicLink())
323
+ await fs.unlink(link);
324
+ }
325
+ catch (error) {
326
+ if (error.code !== 'ENOENT')
327
+ throw error;
328
+ }
329
+ const metadata = await Promise.all([validate_1.ownershipFile, 'environment.lock.json'].map(async (name) => ({ name, content: await fs.readFile(path.join(fresh.root, name), 'utf8') })));
330
+ const rootStat = await fs.lstat(fresh.root);
331
+ try {
332
+ for (const name of await fs.readdir(fresh.root)) {
333
+ if (metadata.some(file => file.name === name))
334
+ continue;
335
+ await fs.rm(path.join(fresh.root, name), { recursive: true });
336
+ }
337
+ for (const file of metadata)
338
+ await fs.unlink(path.join(fresh.root, file.name));
339
+ // A transient scanner or watcher lock can clear on its own: retry briefly
340
+ // before restoring the metadata and reporting.
341
+ for (let attempt = 0;; attempt++) {
342
+ try {
343
+ await fs.rmdir(fresh.root);
344
+ break;
345
+ }
346
+ catch (error) {
347
+ if (attempt >= 2)
348
+ throw error;
349
+ await new Promise(resolve => setTimeout(resolve, 250));
350
+ }
351
+ }
352
+ }
353
+ catch (error) {
354
+ // Restore missing metadata exclusively if final directory removal failed.
355
+ let restored = false;
356
+ try {
357
+ const current = await fs.lstat(fresh.root);
358
+ if (current.isDirectory() && !current.isSymbolicLink() && current.ino === rootStat.ino && current.dev === rootStat.dev) {
359
+ for (const file of metadata)
360
+ await fs.writeFile(path.join(fresh.root, file.name), file.content, { flag: 'wx' }).catch(writeError => { if (writeError.code !== 'EEXIST')
361
+ throw writeError; });
362
+ restored = true;
363
+ }
364
+ }
365
+ catch { /* Keep registry and report manual recovery when metadata cannot be restored. */ }
366
+ const holders = await this.pathHolders(fresh.root).catch(() => []);
367
+ const owner = holders.length
368
+ ? `Processes that mention this directory on their command line: ${holders.join(', ')}. Close them and run \`env delete ${fresh.name}\` again.`
369
+ : `A program, editor or terminal may still have this folder open. Close it and run \`env delete ${fresh.name}\` again.`;
370
+ const advice = restored
371
+ ? `Ownership metadata was restored and the registry record retained, so that retry completes the removal. ${owner}`
372
+ : `Ownership metadata could not be restored; registry retained for manual recovery of the environment record. ${owner}`;
373
+ throw new Error(`Deletion incomplete for ${fresh.name} at ${fresh.root}; registry retained. ${advice} Cause: ${error.message}`);
374
+ }
375
+ }
376
+ await this.registry.remove(fresh.id);
377
+ this.dependencies.onProgress?.(`${fresh.name}: deleted directory ${fresh.root} and registry record.`);
378
+ return true;
379
+ });
380
+ }
381
+ }
382
+ exports.EnvironmentManager = EnvironmentManager;
383
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/environment/manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAA6B;AAC7B,mCAAgD;AAChD,qDAA0D;AAC1D,yCAA6E;AAC7E,uCAA+K;AAC/K,yCAAgK;AAEhK,iCAA0E;AAC1E,uCAAmD;AAEnD,uCAA2C;AAAlC,yGAAA,aAAa,OAAA;AAUtB,MAAa,kBAAkB;IAKA;IAJpB,QAAQ,CAAsB;IACtB,SAAS,CAAiB;IAC1B,SAAS,CAAkC;IAC3C,WAAW,CAAsC;IAClE,YAA6B,eAAoC,EAAE;QAAtC,iBAAY,GAAZ,YAAY,CAA0B;QAAI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CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,uBAAuB,KAAK,CAAC,IAAI,uBAAuB,CAAC,CAAC;YACtG,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzMD,gDAyMC"}
@@ -0,0 +1,10 @@
1
+ import { EnvironmentClient, EnvironmentModule, EnvironmentOptions, EnvironmentPlan } from './types';
2
+ export declare function validateTarget(root: string): Promise<void>;
3
+ export declare function validateEnvironmentOptions(options: EnvironmentOptions): Promise<EnvironmentOptions & {
4
+ edition: 'cn' | 'en';
5
+ profile: 'embedded';
6
+ port: number;
7
+ modules: EnvironmentModule[];
8
+ }>;
9
+ export declare function buildEnvironmentPlan(options: EnvironmentOptions, client: EnvironmentClient, onProgress?: (message: string) => void): Promise<EnvironmentPlan>;
10
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/environment/plan.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpG,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhE;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,GAAG;IAAE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAerM;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAiCnK"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.validateTarget = validateTarget;
37
+ exports.validateEnvironmentOptions = validateEnvironmentOptions;
38
+ exports.buildEnvironmentPlan = buildEnvironmentPlan;
39
+ const fs = __importStar(require("fs/promises"));
40
+ const path = __importStar(require("path"));
41
+ const catalog_1 = require("./catalog");
42
+ const archive_1 = require("./archive");
43
+ async function validateTarget(root) {
44
+ const absolute = path.resolve(root);
45
+ const relative = absolute.slice(path.parse(absolute).root.length).split(path.sep).join('/');
46
+ if (relative)
47
+ (0, archive_1.validateArchivePath)(relative);
48
+ const protectedRoots = [process.env.ProgramFiles, process.env['ProgramFiles(x86)'], process.env.SystemRoot, process.env.WINDIR, process.env.USERPROFILE, process.env.HOME].filter((p) => !!p).map(p => path.resolve(p).toLowerCase());
49
+ const normalized = absolute.toLowerCase();
50
+ if (absolute === path.parse(absolute).root || protectedRoots.some(p => normalized === p || ((p.includes('program files') || p.includes('windows')) && normalized.startsWith(p + path.sep)))) {
51
+ throw new Error('Environment root is a protected directory.');
52
+ }
53
+ // Reject links in all existing ancestors, not only the final directory.
54
+ for (let current = absolute;; current = path.dirname(current)) {
55
+ try {
56
+ const stat = await fs.lstat(current);
57
+ if (stat.isSymbolicLink() || !stat.isDirectory())
58
+ throw new Error('Environment root or ancestor is not a regular directory.');
59
+ if (current === absolute && (await fs.readdir(current)).length)
60
+ throw new Error('Environment root must be absent or empty.');
61
+ }
62
+ catch (error) {
63
+ if (error.code !== 'ENOENT')
64
+ throw error;
65
+ }
66
+ if (current === path.dirname(current))
67
+ break;
68
+ }
69
+ }
70
+ async function validateEnvironmentOptions(options) {
71
+ if (!options.root || !options.major || !/^(9\.1(?:-[A-Za-z0-9][A-Za-z0-9._-]*)?|dev)$/.test(options.major))
72
+ throw new Error('Supported product majors: 9.1, 9.1-* and dev (artifact-derived V91/V100).');
73
+ const edition = options.edition ?? 'cn';
74
+ const profile = options.profile ?? 'embedded';
75
+ const port = options.port ?? 51980;
76
+ if (!['cn', 'en'].includes(edition))
77
+ throw new Error('Edition must be cn or en.');
78
+ if (profile !== 'embedded')
79
+ throw new Error('Only the embedded profile is supported.');
80
+ if (!Number.isInteger(port) || port < 1 || port > 65535)
81
+ throw new Error('Port must be an integer between 1 and 65535.');
82
+ const requestedModules = [...new Set((options.modules ?? []).flatMap(m => m.split(',')).map(m => m.trim()).filter(Boolean))];
83
+ const modules = requestedModules.filter(m => !['server', 'account', 'dataset', 'analysis', 'cot-worker', 'common', 'monitoring'].includes(m)).sort();
84
+ if (modules.some(m => !['dashboard', 'reporting', 'sheets', 'documents'].includes(m)))
85
+ throw new Error('Select optional modules: dashboard, reporting, sheets, documents. Wyn core server, account, dataset, analysis model and cot worker are always included.');
86
+ if (edition !== 'en' && modules.some(m => ['sheets', 'documents'].includes(m)))
87
+ throw new Error('Sheets and documents require EN edition.');
88
+ if (modules.includes('documents'))
89
+ throw new Error('Documents embedded execution is not supported: CollaborationService dependency is unverified.');
90
+ await validateTarget(options.root);
91
+ return { ...options, root: path.resolve(options.root), edition, profile, port, modules: modules };
92
+ }
93
+ async function buildEnvironmentPlan(options, client, onProgress) {
94
+ onProgress?.('Validating environment options and target directory');
95
+ const normalized = await validateEnvironmentOptions(options);
96
+ const autoAddedModules = ['server', 'monitoring', 'common', 'analysis'];
97
+ const artifacts = [];
98
+ const modules = [...autoAddedModules, ...normalized.modules];
99
+ for (const [index, module] of modules.entries()) {
100
+ const entry = catalog_1.catalog[module];
101
+ onProgress?.(`[${index + 1}/${modules.length}] Resolving ${entry.plugin}/${normalized.major}`);
102
+ let version;
103
+ let files;
104
+ try {
105
+ version = (await client.getLatestVersion(entry.plugin, normalized.major)).version;
106
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(version))
107
+ throw new Error('Invalid resolved version');
108
+ files = await client.listArtifacts(entry.plugin, version);
109
+ }
110
+ catch {
111
+ throw new Error(`Unable to resolve artifacts for ${entry.plugin}/${normalized.major}.`);
112
+ }
113
+ const name = entry.filename(version, normalized.edition);
114
+ const candidates = files.filter(f => f.name === name);
115
+ if (candidates.length !== 1)
116
+ throw new Error(`${entry.plugin}/${version}: expected exactly one ${name}, found ${candidates.length}.`);
117
+ // Remote paths must remain credential-free relative object names.
118
+ const remotePath = candidates[0].path;
119
+ if (!remotePath || /[?:\\\x00-\x1f]/.test(remotePath) || remotePath.startsWith('/') || remotePath.split('/').includes('..'))
120
+ throw new Error(`${entry.plugin}/${version}: invalid artifact path.`);
121
+ onProgress?.(`[${index + 1}/${modules.length}] Selected ${entry.plugin}/${version}/${name}`);
122
+ artifacts.push({ module, plugin: entry.plugin, version, name, path: remotePath, mappings: entry.mappings.map(m => ({ ...m, assemblies: [...m.assemblies] })) });
123
+ }
124
+ return {
125
+ root: normalized.root, major: normalized.major, schema: 'pending', edition: normalized.edition, profile: normalized.profile, port: normalized.port,
126
+ selectedModules: normalized.modules, autoAddedModules, artifacts,
127
+ warnings: ['No services are registered or started.', 'Wyn core server, account, dataset, analysis model and cot worker are always included.', 'License, sample data, bootstrap data and optional language/styles-cache archives are not provisioned.'],
128
+ requirements: ['Windows for execution.', '.NET runtime requirements are discovered from downloaded runtimeconfig files.', 'A valid license and database initialization may be required before startup.'],
129
+ };
130
+ }
131
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/environment/plan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wCAoBC;AAED,gEAeC;AAED,oDAiCC;AA9ED,gDAAkC;AAClC,2CAA6B;AAC7B,uCAAoC;AACpC,uCAAgD;AAGzC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5F,IAAI,QAAQ;QAAE,IAAA,6BAAmB,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG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