@auto-mas/auto-mas-plugin-adapter-m9a 0.0.0-stage → 0.2.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.
@@ -0,0 +1,502 @@
1
+ import { open, readFile, realpath, stat } from 'node:fs/promises';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ import { getNodeValue, parseTree, printParseErrorCode } from 'jsonc-parser';
4
+ import { managedRevisionPath, readManagedProject, withinProject } from './managed-project-path.js';
5
+ function object(value) {
6
+ return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
7
+ }
8
+ function string(value) {
9
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
10
+ }
11
+ function requiredString(value, field) {
12
+ const result = string(value);
13
+ if (!result)
14
+ throw new Error(`ProjectInterface ${field} requires a nonempty string.`);
15
+ return result;
16
+ }
17
+ function stringList(value, field) {
18
+ if (value === undefined)
19
+ return undefined;
20
+ if (!Array.isArray(value) || !value.every((item) => typeof item === 'string')) {
21
+ throw new Error(`ProjectInterface ${field} must be an array of strings.`);
22
+ }
23
+ return value;
24
+ }
25
+ function objects(value, field) {
26
+ if (value === undefined)
27
+ return [];
28
+ if (!Array.isArray(value))
29
+ throw new Error(`ProjectInterface ${field} must be an array.`);
30
+ return value.map((item, index) => {
31
+ const result = object(item);
32
+ if (!result)
33
+ throw new Error(`ProjectInterface ${field}[${index}] must be an object.`);
34
+ return result;
35
+ });
36
+ }
37
+ function namedObjects(value, field) {
38
+ const seen = new Set();
39
+ return objects(value, field).map((item, index) => {
40
+ const name = requiredString(item.name, `${field}[${index}].name`);
41
+ if (seen.has(name))
42
+ throw new Error(`ProjectInterface contains duplicate ${field} name "${name}".`);
43
+ seen.add(name);
44
+ return { ...item, name };
45
+ });
46
+ }
47
+ function filters(item, field) {
48
+ return {
49
+ controller: stringList(item.controller, `${field}.controller`),
50
+ resource: stringList(item.resource, `${field}.resource`),
51
+ };
52
+ }
53
+ export function supportsController(type) {
54
+ return type === 'Adb' || (type === 'Win32' && process.platform === 'win32');
55
+ }
56
+ async function readInterfaceText(path, root) {
57
+ if (!root)
58
+ return readFile(path, 'utf8');
59
+ if (!withinProject(root, path))
60
+ throw new Error(`ProjectInterface file is outside the project directory: ${path}.`);
61
+ const file = await open(path, 'r');
62
+ try {
63
+ const info = await file.stat();
64
+ if (!info.isFile() || info.size > 16 * 1024 * 1024)
65
+ throw new Error(`ProjectInterface file cannot be read: ${path}.`);
66
+ const buffer = Buffer.alloc(info.size + 1);
67
+ const { bytesRead } = await file.read(buffer);
68
+ if (bytesRead !== info.size)
69
+ throw new Error(`ProjectInterface file changed while reading: ${path}.`);
70
+ return buffer.toString('utf8', 0, bytesRead);
71
+ }
72
+ finally {
73
+ await file.close();
74
+ }
75
+ }
76
+ async function readObject(path, root) {
77
+ const contents = (await readInterfaceText(path, root)).replace(/^\uFEFF/, '');
78
+ const errors = [];
79
+ const parsed = parseTree(contents, errors, { allowTrailingComma: true });
80
+ const first = errors[0];
81
+ if (first) {
82
+ const line = contents.slice(0, first.offset).split(/\r\n|\n|\r/).length;
83
+ throw new Error(`${path}:${line}: ${printParseErrorCode(first.error)}.`);
84
+ }
85
+ const result = object(parsed && getNodeValue(parsed));
86
+ if (!result)
87
+ throw new Error(`${path}: expected a JSON object.`);
88
+ return result;
89
+ }
90
+ function projectProcesses(value, field) {
91
+ const isAgent = field === 'agent';
92
+ return objects(object(value) ? [value] : value, field).map((item, index) => {
93
+ const location = `${field}[${index}]`;
94
+ const execKey = isAgent ? 'child_exec' : 'exec';
95
+ const argsKey = isAgent ? 'child_args' : 'args';
96
+ return {
97
+ executable: requiredString(item[execKey], `${location}.${execKey}`),
98
+ args: stringList(item[argsKey], `${location}.${argsKey}`) ?? [],
99
+ identifier: isAgent ? string(item.identifier) : undefined,
100
+ name: isAgent ? undefined : string(item.name),
101
+ option: isAgent ? undefined : stringList(item.option, `${location}.option`),
102
+ ...(isAgent ? {} : filters(item, location)),
103
+ };
104
+ });
105
+ }
106
+ export function projectPath(directory, path) {
107
+ return resolve(directory, path.replaceAll('{PROJECT_DIR}', directory));
108
+ }
109
+ export async function loadProject(input, options = {}) {
110
+ if (!input.trim())
111
+ throw new Error('A MaaFramework project directory or interface file is required.');
112
+ const providedPath = resolve(input);
113
+ const directoryInput = (await stat(providedPath)).isDirectory();
114
+ const managed = directoryInput && !options.confined ? await readManagedProject(providedPath) : undefined;
115
+ const path = directoryInput
116
+ ? join(managed ? await managedRevisionPath(providedPath, managed.current) : providedPath, 'interface.json')
117
+ : providedPath;
118
+ const directory = dirname(path);
119
+ const mainCanonical = await realpath(path);
120
+ const root = options.confined ? await realpath(directory) : undefined;
121
+ const main = await readObject(mainCanonical, root);
122
+ if (main.interface_version !== 2)
123
+ throw new Error(`${path}: ProjectInterface version 2 is required.`);
124
+ const fragments = [main];
125
+ const loaded = new Set([mainCanonical]);
126
+ const visiting = new Set([mainCanonical]);
127
+ async function readFragments(document) {
128
+ for (const relative of stringList(document.import, 'import') ?? []) {
129
+ const file = projectPath(directory, relative);
130
+ const canonical = await realpath(file);
131
+ if (visiting.has(canonical))
132
+ throw new Error(`Circular import in ProjectInterface: ${file}.`);
133
+ if (loaded.has(canonical))
134
+ continue;
135
+ visiting.add(canonical);
136
+ const fragment = await readObject(canonical, root);
137
+ fragments.push(fragment);
138
+ await readFragments(fragment);
139
+ visiting.delete(canonical);
140
+ loaded.add(canonical);
141
+ }
142
+ }
143
+ await readFragments(main);
144
+ const warnings = [];
145
+ const languages = object(main.languages) ?? {};
146
+ const language = ['zh_cn', 'en_us', ...Object.keys(languages)].find((key) => string(languages[key]));
147
+ let translations = {};
148
+ if (language) {
149
+ try {
150
+ const file = await realpath(projectPath(directory, String(languages[language])));
151
+ translations = await readObject(file, root);
152
+ }
153
+ catch (error) {
154
+ warnings.push(`Could not load the ${language} ProjectInterface translations: ${String(error)}`);
155
+ }
156
+ }
157
+ function translate(value, fallback) {
158
+ const text = string(value);
159
+ if (!text)
160
+ return fallback;
161
+ return text.startsWith('$') ? string(translations[text.slice(1)]) ?? fallback ?? text : text;
162
+ }
163
+ const name = requiredString(main.name, 'name');
164
+ const controllers = namedObjects(main.controller, 'controller').map((item) => ({
165
+ ...item,
166
+ type: requiredString(item.type, `controller ${item.name}.type`),
167
+ attach_resource_path: stringList(item.attach_resource_path, `controller ${item.name}.attach_resource_path`),
168
+ option: stringList(item.option, `controller ${item.name}.option`),
169
+ }));
170
+ const resources = namedObjects(main.resource, 'resource').map((item) => ({
171
+ ...item,
172
+ ...filters(item, `resource ${item.name}`),
173
+ path: stringList(item.path, `resource ${item.name}.path`) ?? [],
174
+ option: stringList(item.option, `resource ${item.name}.option`),
175
+ }));
176
+ const tasks = namedObjects(fragments.flatMap((fragment) => objects(fragment.task, 'task')), 'task').map((item) => ({
177
+ ...item,
178
+ ...filters(item, `task ${item.name}`),
179
+ entry: requiredString(item.entry, `task ${item.name}.entry`),
180
+ option: stringList(item.option, `task ${item.name}.option`),
181
+ }));
182
+ const presets = namedObjects(fragments.flatMap((fragment) => objects(fragment.preset, 'preset')), 'preset').map(item => {
183
+ const path = `preset ${item.name}`;
184
+ function entries(value, field) {
185
+ return objects(value, field).map((entry, index) => {
186
+ const option = object(entry.option);
187
+ if (entry.option !== undefined && !option)
188
+ throw new Error(`ProjectInterface ${field}[${index}].option must be an object.`);
189
+ return { name: requiredString(entry.name, `${field}[${index}].name`), enabled: entry.enabled !== false, option };
190
+ });
191
+ }
192
+ return { ...item, ...filters(item, path), task: entries(item.task, `${path}.task`),
193
+ pretask: item.pretask === undefined ? undefined : entries(item.pretask, `${path}.pretask`) };
194
+ });
195
+ const projectOptions = new Map();
196
+ for (const fragment of fragments) {
197
+ if (fragment.option === undefined)
198
+ continue;
199
+ const entries = object(fragment.option);
200
+ if (!entries)
201
+ throw new Error('ProjectInterface option must be an object.');
202
+ for (const [key, value] of Object.entries(entries)) {
203
+ const option = object(value);
204
+ if (!option)
205
+ throw new Error(`ProjectInterface option ${key} must be an object.`);
206
+ projectOptions.set(key, { ...option, ...filters(option, `option ${key}`) });
207
+ }
208
+ }
209
+ return {
210
+ path, directory, name, label: translate(main.label, name) ?? name, version: string(main.version), github: string(main.github),
211
+ controllers, resources, tasks, presets, options: projectOptions, language, translate, warnings,
212
+ agents: projectProcesses(main.agent, 'agent'),
213
+ pretasks: fragments.flatMap((fragment) => projectProcesses(fragment.pretask, 'pretask')),
214
+ globalOptions: [...new Set(fragments.flatMap((fragment) => stringList(fragment.global_option, 'global_option') ?? []))],
215
+ };
216
+ }
217
+ export async function inspectProject(path, options) {
218
+ const project = await loadProject(path, options);
219
+ const label = (item) => project.translate(item.label, item.name) ?? item.name;
220
+ return {
221
+ interfacePath: project.path,
222
+ projectPath: project.directory,
223
+ interfaceVersion: 2,
224
+ name: project.name,
225
+ label: project.label,
226
+ version: project.version,
227
+ github: project.github,
228
+ controllers: project.controllers.map((item) => ({
229
+ name: item.name, label: label(item), type: item.type, supported: supportsController(item.type), options: item.option,
230
+ })),
231
+ resources: project.resources.map((item) => ({
232
+ name: item.name, label: label(item), controllers: item.controller, options: item.option,
233
+ })),
234
+ tasks: project.tasks.map((item) => ({
235
+ name: item.name, label: label(item), entry: item.entry, defaultCheck: item.default_check === true,
236
+ controllers: item.controller, resources: item.resource, options: item.option,
237
+ })),
238
+ presets: project.presets.map((item) => ({
239
+ name: item.name, label: label(item), controllers: item.controller, resources: item.resource,
240
+ tasks: item.task.map(({ name, enabled }) => ({ name, enabled })),
241
+ })),
242
+ globalOptions: project.globalOptions,
243
+ options: [...project.options].map(([name, option]) => ({
244
+ name,
245
+ label: label({ ...option, name }),
246
+ type: string(option.type) ?? 'select',
247
+ controllers: option.controller,
248
+ resources: option.resource,
249
+ defaultCase: Array.isArray(option.default_case) ? stringList(option.default_case, `option ${name}.default_case`) : string(option.default_case),
250
+ cases: namedObjects(option.cases, `option ${name}.cases`).map((item) => ({
251
+ name: item.name, label: label(item), options: stringList(item.option, `option ${name}.${item.name}.option`),
252
+ })),
253
+ inputs: namedObjects(option.inputs, `option ${name}.inputs`).map((item) => ({
254
+ name: item.name, label: label(item), type: string(item.pipeline_type),
255
+ default: item.password === true ? undefined : string(item.default),
256
+ password: item.password === true, verify: string(item.verify),
257
+ })),
258
+ })),
259
+ agentCount: project.agents.length,
260
+ warnings: project.warnings,
261
+ };
262
+ }
263
+ function matches(filter, { controller, resource }) {
264
+ return (!filter.controller || filter.controller.includes(controller.name)) &&
265
+ (!filter.resource || filter.resource.includes(resource.name));
266
+ }
267
+ function merge(left, right) {
268
+ return Object.fromEntries(new Map([...Object.entries(left), ...Object.entries(right).map(([key, value]) => {
269
+ const earlier = Object.hasOwn(left, key) ? object(left[key]) : undefined;
270
+ const later = object(value);
271
+ return [key, earlier && later ? merge(earlier, later) : value];
272
+ })]));
273
+ }
274
+ function pipeline(value, where) {
275
+ if (value === undefined)
276
+ return {};
277
+ const result = object(value);
278
+ if (!result)
279
+ throw new Error(`ProjectInterface ${where}.pipeline_override must be an object.`);
280
+ return result;
281
+ }
282
+ function substitute(template, values) {
283
+ if (typeof template === 'string') {
284
+ const whole = /^\{([^{}]+)\}$/.exec(template);
285
+ if (whole && values.has(whole[1]))
286
+ return values.get(whole[1]);
287
+ return template.replace(/\{([^{}]+)\}/g, (token, key) => values.has(key) ? String(values.get(key)) : token);
288
+ }
289
+ if (Array.isArray(template))
290
+ return template.map((item) => substitute(item, values));
291
+ const record = object(template);
292
+ return record ? Object.fromEntries(Object.entries(record).map(([key, value]) => [key, substitute(value, values)])) : template;
293
+ }
294
+ function inputValues(option, key, supplied) {
295
+ const specified = supplied === undefined ? {} : object(supplied);
296
+ if (!specified || Object.values(specified).some((value) => typeof value !== 'string')) {
297
+ throw new Error(`ProjectInterface option "${key}" requires a map of input names to string values.`);
298
+ }
299
+ const inputs = namedObjects(option.inputs, `option ${key}.inputs`);
300
+ for (const name of Object.keys(specified)) {
301
+ if (!inputs.some((item) => item.name === name))
302
+ throw new Error(`ProjectInterface option "${key}" has unknown input "${name}".`);
303
+ }
304
+ const values = new Map();
305
+ const raw = new Map();
306
+ for (const input of inputs) {
307
+ const provided = Object.hasOwn(specified, input.name) ? specified[input.name] : undefined;
308
+ if (input.password === true && provided)
309
+ throw new Error(`ProjectInterface option "${key}.${input.name}" requires password storage, which is unavailable.`);
310
+ const value = input.password === true ? '' : provided ?? string(input.default) ?? '';
311
+ const verify = string(input.verify);
312
+ if (verify && !new RegExp(verify).test(value))
313
+ throw new Error(`ProjectInterface option "${key}" needs a value for "${input.name}".`);
314
+ if (input.password !== true)
315
+ raw.set(input.name, value);
316
+ switch (input.pipeline_type) {
317
+ case 'int': {
318
+ const converted = /^[-+]?\d+$/.test(value) ? Number(value) : NaN;
319
+ if (!Number.isSafeInteger(converted))
320
+ throw new Error(`ProjectInterface option "${key}.${input.name}" requires an integer value.`);
321
+ values.set(input.name, converted);
322
+ break;
323
+ }
324
+ case 'bool': {
325
+ if (!/^(true|false|1|0)$/i.test(value))
326
+ throw new Error(`ProjectInterface option "${key}.${input.name}" requires a Boolean value.`);
327
+ values.set(input.name, /^(true|1)$/i.test(value));
328
+ break;
329
+ }
330
+ default:
331
+ values.set(input.name, value);
332
+ }
333
+ }
334
+ return { raw: Object.fromEntries(raw), values };
335
+ }
336
+ function chosenCases(option, key, type, supplied) {
337
+ const cases = namedObjects(option.cases, `option ${key}.cases`);
338
+ let names;
339
+ if (type === 'checkbox') {
340
+ const value = supplied ?? option.default_case;
341
+ if (value !== undefined && (!Array.isArray(value) || !value.every((item) => typeof item === 'string'))) {
342
+ throw new Error(`ProjectInterface option "${key}" requires an array of case names.`);
343
+ }
344
+ names = value ?? [];
345
+ }
346
+ else {
347
+ let name;
348
+ if (typeof supplied === 'boolean' && type === 'switch') {
349
+ const pattern = supplied ? /^y(es)?$/i : /^no?$/i;
350
+ const found = cases.find((item) => pattern.test(item.name));
351
+ if (!found)
352
+ throw new Error(`ProjectInterface switch "${key}" has no case for the supplied Boolean value.`);
353
+ name = found.name;
354
+ }
355
+ else {
356
+ if (supplied !== undefined && typeof supplied !== 'string')
357
+ throw new Error(`ProjectInterface option "${key}" requires a case name.`);
358
+ const match = supplied ?? string(option.default_case) ?? cases[0]?.name;
359
+ if (!match)
360
+ throw new Error(`ProjectInterface option "${key}" requires a case name.`);
361
+ name = match;
362
+ }
363
+ names = [name];
364
+ }
365
+ const active = cases.filter((item) => names.includes(item.name));
366
+ if (new Set(names).size !== names.length || names.length !== active.length) {
367
+ throw new Error(`ProjectInterface option "${key}" has an unknown case or duplicate selection.`);
368
+ }
369
+ if (type === 'checkbox' && ((typeof option.min_count === 'number' && active.length < option.min_count) ||
370
+ (typeof option.max_count === 'number' && active.length > option.max_count))) {
371
+ throw new Error(`ProjectInterface option "${key}" has an invalid selection count.`);
372
+ }
373
+ return active;
374
+ }
375
+ function resolveOptions(project, selection, keys, overrides) {
376
+ const current = new Set();
377
+ const selected = new Map();
378
+ let override = {};
379
+ function apply(key) {
380
+ const option = project.options.get(key);
381
+ if (!option)
382
+ throw new Error(`ProjectInterface references unknown option "${key}".`);
383
+ if (!matches(option, selection))
384
+ return;
385
+ if (current.has(key))
386
+ throw new Error(`Circular ProjectInterface option reference at "${key}".`);
387
+ current.add(key);
388
+ const type = option.type ?? 'select';
389
+ const supplied = overrides.get(key);
390
+ if (type === 'input') {
391
+ const inputs = inputValues(option, key, supplied);
392
+ selected.set(key, inputs.raw);
393
+ override = merge(override, substitute(pipeline(option.pipeline_override, `option ${key}`), inputs.values));
394
+ }
395
+ else if (type === 'select' || type === 'switch' || type === 'checkbox') {
396
+ const active = chosenCases(option, key, type, supplied);
397
+ selected.set(key, type === 'checkbox' ? active.map((item) => item.name) : active[0].name);
398
+ for (const item of active) {
399
+ override = merge(override, pipeline(item.pipeline_override, `option ${key}.${item.name}`));
400
+ for (const nested of stringList(item.option, `option ${key}.${item.name}.option`) ?? [])
401
+ apply(nested);
402
+ }
403
+ }
404
+ else {
405
+ throw new Error(`ProjectInterface option "${key}" uses unsupported type "${String(type)}".`);
406
+ }
407
+ current.delete(key);
408
+ }
409
+ for (const key of keys)
410
+ apply(key);
411
+ return { override, selected: Object.fromEntries(selected) };
412
+ }
413
+ function translatedSelection(project, item) {
414
+ return JSON.stringify({
415
+ ...item,
416
+ label: project.translate(item.label, item.name),
417
+ description: project.translate(item.description),
418
+ icon: project.translate(item.icon),
419
+ });
420
+ }
421
+ export function planRun(project, input) {
422
+ const specified = input.options === undefined ? {} : object(input.options);
423
+ if (!specified)
424
+ throw new Error('ProjectInterface options must be an object keyed by option name.');
425
+ const overrides = new Map(Object.entries(specified));
426
+ for (const key of overrides.keys()) {
427
+ if (!project.options.has(key))
428
+ throw new Error(`ProjectInterface has unknown option "${key}".`);
429
+ }
430
+ const controller = input.controller === undefined
431
+ ? project.controllers.find((item) => supportsController(item.type))
432
+ : project.controllers.find((item) => item.name === input.controller);
433
+ if (!controller)
434
+ throw new Error(input.controller === undefined ? 'No supported ProjectInterface controller is available.' : `Unknown controller "${input.controller}".`);
435
+ if (!supportsController(controller.type))
436
+ throw new Error(`Controller type "${controller.type}" is unsupported on ${process.platform}.`);
437
+ const resources = project.resources.filter((item) => !item.controller || item.controller.includes(controller.name));
438
+ const resource = input.resource === undefined ? resources[0] : resources.find((item) => item.name === input.resource);
439
+ if (!resource)
440
+ throw new Error(`No ${input.resource ? `resource "${input.resource}"` : 'resource'} is available for controller "${controller.name}".`);
441
+ if (!resource.path.length)
442
+ throw new Error(`Resource "${resource.name}" has no paths to load.`);
443
+ const selection = { controller, resource };
444
+ const preset = input.preset === undefined ? undefined : project.presets.find(item => item.name === input.preset);
445
+ if (input.preset !== undefined && !preset)
446
+ throw new Error(`Unknown ProjectInterface preset "${input.preset}".`);
447
+ if (preset && !matches(preset, selection)) {
448
+ throw new Error(`Preset "${preset.name}" cannot run with controller "${controller.name}" and resource "${resource.name}".`);
449
+ }
450
+ const tasksByName = new Map(project.tasks.map(task => [task.name, task]));
451
+ const presetTasks = preset?.task.filter(item => {
452
+ if (!item.enabled)
453
+ return false;
454
+ const task = tasksByName.get(item.name);
455
+ return !task || matches(task, selection);
456
+ });
457
+ const names = input.tasks ?? presetTasks?.map(task => task.name)
458
+ ?? project.tasks.filter(task => task.default_check === true && matches(task, selection)).map(task => task.name);
459
+ if (names.length === 0)
460
+ throw new Error('No tasks are selected. Choose at least one ProjectInterface task.');
461
+ const presetOptions = new Map();
462
+ for (const task of presetTasks ?? []) {
463
+ const entries = presetOptions.get(task.name) ?? [];
464
+ entries.push(task.option);
465
+ presetOptions.set(task.name, entries);
466
+ }
467
+ const withPreset = (options) => options ? new Map(Object.entries(merge(options, specified))) : overrides;
468
+ const sharedKeys = [...project.globalOptions, ...resource.option ?? [], ...controller.option ?? []];
469
+ const sharedOptions = resolveOptions(project, selection, sharedKeys, overrides).override;
470
+ const tasks = names.map((name) => {
471
+ const task = tasksByName.get(name);
472
+ if (!task)
473
+ throw new Error(`Unknown ProjectInterface task "${name}".`);
474
+ if (!matches(task, selection))
475
+ throw new Error(`Task "${name}" cannot run with controller "${controller.name}" and resource "${resource.name}".`);
476
+ const taskOptions = resolveOptions(project, selection, task.option ?? [], withPreset(presetOptions.get(name)?.shift())).override;
477
+ return { name: task.name, entry: task.entry, override: merge(merge(pipeline(task.pipeline_override, `task ${name}`), sharedOptions), taskOptions) };
478
+ });
479
+ const presetPretasks = preset?.pretask && new Map(preset.pretask.map(item => [item.name, item]));
480
+ return {
481
+ controller, resource, tasks,
482
+ resourcePaths: resource.path.map((path) => projectPath(project.directory, path)),
483
+ attachedPaths: (controller.attach_resource_path ?? []).map((path) => projectPath(project.directory, path)),
484
+ agents: project.agents,
485
+ pretasks: project.pretasks.filter(item => matches(item, selection)
486
+ && (!presetPretasks || item.name && presetPretasks.get(item.name)?.enabled)).map((item) => ({
487
+ ...item,
488
+ optionArgument: item.option?.length
489
+ ? JSON.stringify(resolveOptions(project, selection, item.option, withPreset(item.name ? presetPretasks?.get(item.name)?.option : undefined)).selected)
490
+ : undefined,
491
+ })),
492
+ agentEnvironment: {
493
+ PI_INTERFACE_VERSION: 'v2.8.1',
494
+ PI_CLIENT_NAME: 'Cordis MAS',
495
+ PI_CLIENT_LANGUAGE: project.language ?? 'zh_cn',
496
+ PI_VERSION: project.version ?? '',
497
+ PI_CONTROLLER: translatedSelection(project, controller),
498
+ PI_RESOURCE: translatedSelection(project, resource),
499
+ },
500
+ warnings: project.warnings,
501
+ };
502
+ }