@arcadia-eternity/content-sdk 4.9.1 → 4.11.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.
- package/dist/content-workspace.d.ts +68 -42
- package/dist/content-workspace.js +46 -6
- package/dist/debug-environments.d.ts +50 -130
- package/dist/debug-environments.js +2 -2
- package/dist/environment-host-base.d.ts +18 -42
- package/dist/environment-host-base.js +1 -1
- package/dist/environment-rules.d.ts +189 -176
- package/dist/environment-rules.js +23 -11
- package/dist/mcp-contracts.d.ts +50 -130
- package/dist/prepared-document.d.ts +51 -126
- package/dist/rule-composition.d.ts +19 -191
- package/dist/rule-composition.js +11 -219
- package/dist/template/package.json +2 -2
- package/dist/testing.js +5 -3
- package/package.json +5 -5
|
@@ -69,6 +69,31 @@ declare const compositionSchema: z.ZodObject<{
|
|
|
69
69
|
max: z.ZodNumber;
|
|
70
70
|
}, z.core.$strict>>;
|
|
71
71
|
allowFaintSwitch: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
timer: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
enabled: z.ZodBoolean;
|
|
74
|
+
turnTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
totalTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
animationPauseEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
maxAnimationDuration: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
}, z.core.$strict>>;
|
|
79
|
+
teamSelection: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
enabled: z.ZodBoolean;
|
|
81
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
FULL_TEAM: "FULL_TEAM";
|
|
83
|
+
TEAM_SELECTION: "TEAM_SELECTION";
|
|
84
|
+
VIEW_ONLY: "VIEW_ONLY";
|
|
85
|
+
}>>;
|
|
86
|
+
minTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
maxTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
allowStarterSelection: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
showOpponentTeam: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
teamInfoVisibility: z.ZodOptional<z.ZodEnum<{
|
|
91
|
+
BASIC: "BASIC";
|
|
92
|
+
FULL: "FULL";
|
|
93
|
+
HIDDEN: "HIDDEN";
|
|
94
|
+
}>>;
|
|
95
|
+
timeLimit: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
}, z.core.$strict>>;
|
|
72
97
|
inheritance: z.ZodOptional<z.ZodObject<{
|
|
73
98
|
eligible: z.ZodUnion<readonly [z.ZodEnum<{
|
|
74
99
|
all: "all";
|
|
@@ -172,6 +197,31 @@ declare const compositionSchema: z.ZodObject<{
|
|
|
172
197
|
max: z.ZodNumber;
|
|
173
198
|
}, z.core.$strict>>;
|
|
174
199
|
allowFaintSwitch: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
+
timer: z.ZodOptional<z.ZodObject<{
|
|
201
|
+
enabled: z.ZodBoolean;
|
|
202
|
+
turnTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
totalTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
animationPauseEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
+
maxAnimationDuration: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
}, z.core.$strict>>;
|
|
207
|
+
teamSelection: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
enabled: z.ZodBoolean;
|
|
209
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
210
|
+
FULL_TEAM: "FULL_TEAM";
|
|
211
|
+
TEAM_SELECTION: "TEAM_SELECTION";
|
|
212
|
+
VIEW_ONLY: "VIEW_ONLY";
|
|
213
|
+
}>>;
|
|
214
|
+
minTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
maxTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
allowStarterSelection: z.ZodOptional<z.ZodBoolean>;
|
|
217
|
+
showOpponentTeam: z.ZodOptional<z.ZodBoolean>;
|
|
218
|
+
teamInfoVisibility: z.ZodOptional<z.ZodEnum<{
|
|
219
|
+
BASIC: "BASIC";
|
|
220
|
+
FULL: "FULL";
|
|
221
|
+
HIDDEN: "HIDDEN";
|
|
222
|
+
}>>;
|
|
223
|
+
timeLimit: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
}, z.core.$strict>>;
|
|
175
225
|
inheritance: z.ZodOptional<z.ZodObject<{
|
|
176
226
|
eligible: z.ZodUnion<readonly [z.ZodEnum<{
|
|
177
227
|
all: "all";
|
|
@@ -579,6 +629,7 @@ export interface ContentWorkspace {
|
|
|
579
629
|
cleanupStaging(): Promise<string[]>;
|
|
580
630
|
}
|
|
581
631
|
export interface OwnedContentWorkspace extends ContentWorkspace {
|
|
632
|
+
refreshBuiltinRules(documents: readonly EnvironmentDocument[]): Promise<void>;
|
|
582
633
|
registerBuiltinEnvironments(keys: string[], adopted: Record<string, string>): Promise<Readonly<Record<string, string>>>;
|
|
583
634
|
}
|
|
584
635
|
export interface ContentWorkspaceConstructor {
|
|
@@ -635,6 +686,23 @@ export declare function readShippedEnvironments(file: string | URL, bundledVersi
|
|
|
635
686
|
max: number;
|
|
636
687
|
} | undefined;
|
|
637
688
|
allowFaintSwitch?: boolean | undefined;
|
|
689
|
+
timer?: {
|
|
690
|
+
enabled: boolean;
|
|
691
|
+
turnTimeLimit?: number | undefined;
|
|
692
|
+
totalTimeLimit?: number | undefined;
|
|
693
|
+
animationPauseEnabled?: boolean | undefined;
|
|
694
|
+
maxAnimationDuration?: number | undefined;
|
|
695
|
+
} | undefined;
|
|
696
|
+
teamSelection?: {
|
|
697
|
+
enabled: boolean;
|
|
698
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
699
|
+
minTeamSize?: number | undefined;
|
|
700
|
+
maxTeamSize?: number | undefined;
|
|
701
|
+
allowStarterSelection?: boolean | undefined;
|
|
702
|
+
showOpponentTeam?: boolean | undefined;
|
|
703
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
704
|
+
timeLimit?: number | undefined;
|
|
705
|
+
} | undefined;
|
|
638
706
|
inheritance?: {
|
|
639
707
|
eligible: "all" | "off" | "species" | string[];
|
|
640
708
|
pool?: {
|
|
@@ -726,48 +794,6 @@ export declare function readShippedEnvironments(file: string | URL, bundledVersi
|
|
|
726
794
|
kind: "mark" | "skill" | "species";
|
|
727
795
|
ids: string[];
|
|
728
796
|
}[] | undefined;
|
|
729
|
-
include?: string[] | undefined;
|
|
730
|
-
constraintEdits?: {
|
|
731
|
-
remove?: string[] | undefined;
|
|
732
|
-
replace?: ({
|
|
733
|
-
id: string;
|
|
734
|
-
allOf: {
|
|
735
|
-
kind: "mark" | "skill" | "species";
|
|
736
|
-
ids: string[];
|
|
737
|
-
fromCollections?: string[] | undefined;
|
|
738
|
-
}[];
|
|
739
|
-
kind: "ban";
|
|
740
|
-
scope: "pet" | "team";
|
|
741
|
-
exceptWhen?: {
|
|
742
|
-
kind: "mark" | "skill" | "species";
|
|
743
|
-
ids: string[];
|
|
744
|
-
fromCollections?: string[] | undefined;
|
|
745
|
-
}[] | undefined;
|
|
746
|
-
exceptAny?: {
|
|
747
|
-
kind: "mark" | "skill" | "species";
|
|
748
|
-
ids: string[];
|
|
749
|
-
fromCollections?: string[] | undefined;
|
|
750
|
-
}[][] | undefined;
|
|
751
|
-
} | {
|
|
752
|
-
id: string;
|
|
753
|
-
allOf: {
|
|
754
|
-
kind: "mark" | "skill" | "species";
|
|
755
|
-
ids: string[];
|
|
756
|
-
fromCollections?: string[] | undefined;
|
|
757
|
-
}[];
|
|
758
|
-
kind: "memberLimit";
|
|
759
|
-
max: number;
|
|
760
|
-
})[] | undefined;
|
|
761
|
-
clearExceptions?: string[] | undefined;
|
|
762
|
-
exceptions?: {
|
|
763
|
-
target: string;
|
|
764
|
-
allOf: {
|
|
765
|
-
kind: "mark" | "skill" | "species";
|
|
766
|
-
ids: string[];
|
|
767
|
-
fromCollections?: string[] | undefined;
|
|
768
|
-
}[];
|
|
769
|
-
}[] | undefined;
|
|
770
|
-
} | undefined;
|
|
771
797
|
};
|
|
772
798
|
requires: {
|
|
773
799
|
engine?: string | undefined;
|
|
@@ -12,11 +12,18 @@ import { withSourceLock } from './source-lock.js';
|
|
|
12
12
|
import { contentError, readJson, materialFiles, writeMaterials } from './workspace-materials.js';
|
|
13
13
|
import { errorCode, isRecord } from './types.js';
|
|
14
14
|
import { compactMaterials, expandSharedMaterials, exportDependencies, } from './environment-sharing.js';
|
|
15
|
-
import { environmentShareMaterials } from './environment-host-base.js';
|
|
15
|
+
import { environmentShareMaterials, hostBaseName } from './environment-host-base.js';
|
|
16
16
|
export { copyEnvironmentMember } from './environment-member-transfer.js';
|
|
17
17
|
import { parseManifestDraft, preparedDocument } from './prepared-document.js';
|
|
18
18
|
export { readInstalledEnvironmentDocument } from './prepared-document.js';
|
|
19
19
|
export { normalizeEnvironmentDocument } from './debug-environments.js';
|
|
20
|
+
function hasHostBase(document) {
|
|
21
|
+
return Object.hasOwn(document.packages, hostBaseName) || document.sources.includes(hostBaseName);
|
|
22
|
+
}
|
|
23
|
+
function assertBaseRetained(before, after) {
|
|
24
|
+
if (before && hasHostBase(before) && !hasHostBase(after))
|
|
25
|
+
throw contentError('ENVIRONMENT_BASE_REQUIRED', '环境必须保留官方基础包。');
|
|
26
|
+
}
|
|
20
27
|
const compositionSchema = z
|
|
21
28
|
.object({
|
|
22
29
|
rules: EnvironmentRulesSchema,
|
|
@@ -210,6 +217,34 @@ class ContentWorkspaceImplementation {
|
|
|
210
217
|
throw error;
|
|
211
218
|
}
|
|
212
219
|
}
|
|
220
|
+
/** Registered builtins use the declarations shipped with the app, including on the first startup after an update. */
|
|
221
|
+
refreshBuiltinRules(documents) {
|
|
222
|
+
return this.#exclusive(async () => {
|
|
223
|
+
for (const document of documents) {
|
|
224
|
+
if (this.builtinEnvironmentIds[document.id] !== document.id)
|
|
225
|
+
continue;
|
|
226
|
+
const directory = this.#directory(document.id);
|
|
227
|
+
const resolved = await realpath(directory).catch(error => {
|
|
228
|
+
if (errorCode(error) !== 'ENOENT')
|
|
229
|
+
throw error;
|
|
230
|
+
return undefined;
|
|
231
|
+
});
|
|
232
|
+
if (!resolved)
|
|
233
|
+
continue;
|
|
234
|
+
if (resolved !== directory)
|
|
235
|
+
throw contentError('WORKSPACE_PATH_INVALID');
|
|
236
|
+
const file = join(directory, 'package.json');
|
|
237
|
+
const manifest = await readJson(file);
|
|
238
|
+
const declaration = manifest.arcadiaEnvironment;
|
|
239
|
+
if (!isRecord(declaration) || declaration.id !== document.id)
|
|
240
|
+
throw contentError('ENVIRONMENT_ID_MISMATCH');
|
|
241
|
+
if (isDeepStrictEqual(declaration.rules, document.rules))
|
|
242
|
+
continue;
|
|
243
|
+
declaration.rules = document.rules;
|
|
244
|
+
await writeFileAtomic(file, json(manifest));
|
|
245
|
+
}
|
|
246
|
+
}, true);
|
|
247
|
+
}
|
|
213
248
|
registerBuiltinEnvironments(keys, adopted) {
|
|
214
249
|
return this.#exclusive(async () => {
|
|
215
250
|
const ids = readBuiltinEnvironmentIds({ builtinEnvironmentIds: Object.fromEntries(keys.map(key => [key, key])) });
|
|
@@ -350,6 +385,8 @@ class ContentWorkspaceImplementation {
|
|
|
350
385
|
});
|
|
351
386
|
if ((previous === null ? null : sha256Hex(previous)) !== input.expectedRevision)
|
|
352
387
|
throw contentError('REVISION_CONFLICT');
|
|
388
|
+
if (previous !== null)
|
|
389
|
+
assertBaseRetained(parseManifestDraft(previous).document, document);
|
|
353
390
|
await regularDirectory(directory);
|
|
354
391
|
await this.#archiveRemovedDeclarations(document.id);
|
|
355
392
|
if (previous !== null) {
|
|
@@ -451,6 +488,7 @@ class ContentWorkspaceImplementation {
|
|
|
451
488
|
const document = normalizeEnvironmentDocument(input.document ?? draft?.document);
|
|
452
489
|
if (document.id !== input.environmentId)
|
|
453
490
|
throw contentError('ENVIRONMENT_ID_MISMATCH');
|
|
491
|
+
assertBaseRetained(draft?.document, document);
|
|
454
492
|
const source = input.projectDirectory ??
|
|
455
493
|
input.directory ??
|
|
456
494
|
input.seedDirectory ??
|
|
@@ -479,15 +517,14 @@ class ContentWorkspaceImplementation {
|
|
|
479
517
|
}
|
|
480
518
|
await writeMaterials(staging, materials, limits);
|
|
481
519
|
const manifest = await readJson(join(staging, 'package.json'));
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const installed = await readJson(join(staging, 'node_modules', base, 'package.json'));
|
|
520
|
+
if (hasHostBase(document)) {
|
|
521
|
+
const installed = await readJson(join(staging, 'node_modules', hostBaseName, 'package.json'));
|
|
485
522
|
if (typeof installed.version !== 'string')
|
|
486
523
|
throw contentError('BUNDLED_PACKAGE_INVALID');
|
|
487
524
|
document = {
|
|
488
525
|
...document,
|
|
489
|
-
packages: { ...document.packages, [
|
|
490
|
-
sources: document.sources.filter(name => name !==
|
|
526
|
+
packages: { ...document.packages, [hostBaseName]: installed.version },
|
|
527
|
+
sources: document.sources.filter(name => name !== hostBaseName),
|
|
491
528
|
};
|
|
492
529
|
}
|
|
493
530
|
await writeFile(join(staging, 'package.json'), json({ ...this.#manifest(document, manifest), dependencies: manifest.dependencies ?? {} }));
|
|
@@ -819,6 +856,7 @@ class ContentWorkspaceImplementation {
|
|
|
819
856
|
});
|
|
820
857
|
if ((previous?.revision ?? null) !== (input.expectedRevision ?? null))
|
|
821
858
|
throw contentError('REVISION_CONFLICT');
|
|
859
|
+
assertBaseRetained(previous?.document, document);
|
|
822
860
|
const staging = join(this.root, 'staging', `import-${randomUUID()}`);
|
|
823
861
|
await mkdir(staging);
|
|
824
862
|
try {
|
|
@@ -1033,6 +1071,8 @@ async function changeEnvironmentPackage(workspace, input) {
|
|
|
1033
1071
|
changed = true;
|
|
1034
1072
|
}
|
|
1035
1073
|
}
|
|
1074
|
+
if (affected.has(hostBaseName))
|
|
1075
|
+
throw contentError('ENVIRONMENT_BASE_REQUIRED', '环境必须保留官方基础包。');
|
|
1036
1076
|
const roots = [...active].filter(key => affected.has(key));
|
|
1037
1077
|
if (!roots.length)
|
|
1038
1078
|
throw contentError('ENVIRONMENT_PACKAGE_NOT_FOUND');
|
|
@@ -20,6 +20,31 @@ export declare const EnvironmentDocumentV2Schema: z.ZodObject<{
|
|
|
20
20
|
max: z.ZodNumber;
|
|
21
21
|
}, z.core.$strict>>;
|
|
22
22
|
allowFaintSwitch: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
timer: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
enabled: z.ZodBoolean;
|
|
25
|
+
turnTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
totalTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
animationPauseEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
maxAnimationDuration: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strict>>;
|
|
30
|
+
teamSelection: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
enabled: z.ZodBoolean;
|
|
32
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
FULL_TEAM: "FULL_TEAM";
|
|
34
|
+
TEAM_SELECTION: "TEAM_SELECTION";
|
|
35
|
+
VIEW_ONLY: "VIEW_ONLY";
|
|
36
|
+
}>>;
|
|
37
|
+
minTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
maxTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
allowStarterSelection: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
showOpponentTeam: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
teamInfoVisibility: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
BASIC: "BASIC";
|
|
43
|
+
FULL: "FULL";
|
|
44
|
+
HIDDEN: "HIDDEN";
|
|
45
|
+
}>>;
|
|
46
|
+
timeLimit: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
23
48
|
inheritance: z.ZodOptional<z.ZodObject<{
|
|
24
49
|
eligible: z.ZodUnion<readonly [z.ZodEnum<{
|
|
25
50
|
all: "all";
|
|
@@ -156,71 +181,6 @@ export declare const EnvironmentDocumentV2Schema: z.ZodObject<{
|
|
|
156
181
|
}>;
|
|
157
182
|
ids: z.ZodArray<z.ZodString>;
|
|
158
183
|
}, z.core.$strict>>>;
|
|
159
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
160
|
-
constraintEdits: z.ZodOptional<z.ZodObject<{
|
|
161
|
-
remove: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
-
replace: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
163
|
-
id: z.ZodString;
|
|
164
|
-
allOf: z.ZodArray<z.ZodObject<{
|
|
165
|
-
kind: z.ZodEnum<{
|
|
166
|
-
mark: "mark";
|
|
167
|
-
skill: "skill";
|
|
168
|
-
species: "species";
|
|
169
|
-
}>;
|
|
170
|
-
ids: z.ZodArray<z.ZodString>;
|
|
171
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
|
-
}, z.core.$strict>>;
|
|
173
|
-
kind: z.ZodLiteral<"ban">;
|
|
174
|
-
scope: z.ZodEnum<{
|
|
175
|
-
pet: "pet";
|
|
176
|
-
team: "team";
|
|
177
|
-
}>;
|
|
178
|
-
exceptWhen: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
-
kind: z.ZodEnum<{
|
|
180
|
-
mark: "mark";
|
|
181
|
-
skill: "skill";
|
|
182
|
-
species: "species";
|
|
183
|
-
}>;
|
|
184
|
-
ids: z.ZodArray<z.ZodString>;
|
|
185
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
186
|
-
}, z.core.$strict>>>;
|
|
187
|
-
exceptAny: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
|
|
188
|
-
kind: z.ZodEnum<{
|
|
189
|
-
mark: "mark";
|
|
190
|
-
skill: "skill";
|
|
191
|
-
species: "species";
|
|
192
|
-
}>;
|
|
193
|
-
ids: z.ZodArray<z.ZodString>;
|
|
194
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
195
|
-
}, z.core.$strict>>>>;
|
|
196
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
197
|
-
id: z.ZodString;
|
|
198
|
-
allOf: z.ZodArray<z.ZodObject<{
|
|
199
|
-
kind: z.ZodEnum<{
|
|
200
|
-
mark: "mark";
|
|
201
|
-
skill: "skill";
|
|
202
|
-
species: "species";
|
|
203
|
-
}>;
|
|
204
|
-
ids: z.ZodArray<z.ZodString>;
|
|
205
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
206
|
-
}, z.core.$strict>>;
|
|
207
|
-
kind: z.ZodLiteral<"memberLimit">;
|
|
208
|
-
max: z.ZodNumber;
|
|
209
|
-
}, z.core.$strict>], "kind">>>;
|
|
210
|
-
clearExceptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
-
exceptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
212
|
-
target: z.ZodString;
|
|
213
|
-
allOf: z.ZodArray<z.ZodObject<{
|
|
214
|
-
kind: z.ZodEnum<{
|
|
215
|
-
mark: "mark";
|
|
216
|
-
skill: "skill";
|
|
217
|
-
species: "species";
|
|
218
|
-
}>;
|
|
219
|
-
ids: z.ZodArray<z.ZodString>;
|
|
220
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
221
|
-
}, z.core.$strict>>;
|
|
222
|
-
}, z.core.$strict>>>;
|
|
223
|
-
}, z.core.$strict>>;
|
|
224
184
|
}, z.core.$strict>;
|
|
225
185
|
requires: z.ZodObject<{
|
|
226
186
|
engine: z.ZodOptional<z.ZodString>;
|
|
@@ -253,6 +213,31 @@ export declare const EnvironmentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
253
213
|
max: z.ZodNumber;
|
|
254
214
|
}, z.core.$strict>>;
|
|
255
215
|
allowFaintSwitch: z.ZodOptional<z.ZodBoolean>;
|
|
216
|
+
timer: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
enabled: z.ZodBoolean;
|
|
218
|
+
turnTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
totalTimeLimit: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
animationPauseEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
+
maxAnimationDuration: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
}, z.core.$strict>>;
|
|
223
|
+
teamSelection: z.ZodOptional<z.ZodObject<{
|
|
224
|
+
enabled: z.ZodBoolean;
|
|
225
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
226
|
+
FULL_TEAM: "FULL_TEAM";
|
|
227
|
+
TEAM_SELECTION: "TEAM_SELECTION";
|
|
228
|
+
VIEW_ONLY: "VIEW_ONLY";
|
|
229
|
+
}>>;
|
|
230
|
+
minTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
maxTeamSize: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
allowStarterSelection: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
showOpponentTeam: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
teamInfoVisibility: z.ZodOptional<z.ZodEnum<{
|
|
235
|
+
BASIC: "BASIC";
|
|
236
|
+
FULL: "FULL";
|
|
237
|
+
HIDDEN: "HIDDEN";
|
|
238
|
+
}>>;
|
|
239
|
+
timeLimit: z.ZodOptional<z.ZodNumber>;
|
|
240
|
+
}, z.core.$strict>>;
|
|
256
241
|
inheritance: z.ZodOptional<z.ZodObject<{
|
|
257
242
|
eligible: z.ZodUnion<readonly [z.ZodEnum<{
|
|
258
243
|
all: "all";
|
|
@@ -389,71 +374,6 @@ export declare const EnvironmentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
389
374
|
}>;
|
|
390
375
|
ids: z.ZodArray<z.ZodString>;
|
|
391
376
|
}, z.core.$strict>>>;
|
|
392
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
393
|
-
constraintEdits: z.ZodOptional<z.ZodObject<{
|
|
394
|
-
remove: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
395
|
-
replace: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
396
|
-
id: z.ZodString;
|
|
397
|
-
allOf: z.ZodArray<z.ZodObject<{
|
|
398
|
-
kind: z.ZodEnum<{
|
|
399
|
-
mark: "mark";
|
|
400
|
-
skill: "skill";
|
|
401
|
-
species: "species";
|
|
402
|
-
}>;
|
|
403
|
-
ids: z.ZodArray<z.ZodString>;
|
|
404
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
405
|
-
}, z.core.$strict>>;
|
|
406
|
-
kind: z.ZodLiteral<"ban">;
|
|
407
|
-
scope: z.ZodEnum<{
|
|
408
|
-
pet: "pet";
|
|
409
|
-
team: "team";
|
|
410
|
-
}>;
|
|
411
|
-
exceptWhen: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
412
|
-
kind: z.ZodEnum<{
|
|
413
|
-
mark: "mark";
|
|
414
|
-
skill: "skill";
|
|
415
|
-
species: "species";
|
|
416
|
-
}>;
|
|
417
|
-
ids: z.ZodArray<z.ZodString>;
|
|
418
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
419
|
-
}, z.core.$strict>>>;
|
|
420
|
-
exceptAny: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
|
|
421
|
-
kind: z.ZodEnum<{
|
|
422
|
-
mark: "mark";
|
|
423
|
-
skill: "skill";
|
|
424
|
-
species: "species";
|
|
425
|
-
}>;
|
|
426
|
-
ids: z.ZodArray<z.ZodString>;
|
|
427
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
428
|
-
}, z.core.$strict>>>>;
|
|
429
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
430
|
-
id: z.ZodString;
|
|
431
|
-
allOf: z.ZodArray<z.ZodObject<{
|
|
432
|
-
kind: z.ZodEnum<{
|
|
433
|
-
mark: "mark";
|
|
434
|
-
skill: "skill";
|
|
435
|
-
species: "species";
|
|
436
|
-
}>;
|
|
437
|
-
ids: z.ZodArray<z.ZodString>;
|
|
438
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
439
|
-
}, z.core.$strict>>;
|
|
440
|
-
kind: z.ZodLiteral<"memberLimit">;
|
|
441
|
-
max: z.ZodNumber;
|
|
442
|
-
}, z.core.$strict>], "kind">>>;
|
|
443
|
-
clearExceptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
444
|
-
exceptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
445
|
-
target: z.ZodString;
|
|
446
|
-
allOf: z.ZodArray<z.ZodObject<{
|
|
447
|
-
kind: z.ZodEnum<{
|
|
448
|
-
mark: "mark";
|
|
449
|
-
skill: "skill";
|
|
450
|
-
species: "species";
|
|
451
|
-
}>;
|
|
452
|
-
ids: z.ZodArray<z.ZodString>;
|
|
453
|
-
fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
454
|
-
}, z.core.$strict>>;
|
|
455
|
-
}, z.core.$strict>>>;
|
|
456
|
-
}, z.core.$strict>>;
|
|
457
377
|
}, z.core.$strict>;
|
|
458
378
|
requires: z.ZodObject<{
|
|
459
379
|
engine: z.ZodOptional<z.ZodString>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IndependentEnvironmentRulesSchema, EnvironmentRequirementsSchema } from '@arcadia-eternity/const';
|
|
2
2
|
export { EnvironmentRuleDeclarationSchema, EnvironmentRulesSchema, } from '@arcadia-eternity/const';
|
|
3
3
|
import { WorkspaceError } from './workspace.js';
|
|
4
4
|
import { z } from 'zod';
|
|
@@ -33,7 +33,7 @@ export const EnvironmentDocumentV2Schema = z
|
|
|
33
33
|
.object({
|
|
34
34
|
schemaVersion: z.literal(2),
|
|
35
35
|
...sharedFields,
|
|
36
|
-
rules:
|
|
36
|
+
rules: IndependentEnvironmentRulesSchema,
|
|
37
37
|
requires: EnvironmentRequirementsSchema,
|
|
38
38
|
})
|
|
39
39
|
.strict();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EnvironmentDocumentV2 } from './debug-environments.js';
|
|
2
|
+
export declare const hostBaseName = "@arcadia-eternity/data-pack-base";
|
|
2
3
|
type Material = {
|
|
3
4
|
path: string;
|
|
4
5
|
bytes: Buffer;
|
|
@@ -32,6 +33,23 @@ export declare function environmentShareMaterials(files: Material[], document: E
|
|
|
32
33
|
max: number;
|
|
33
34
|
} | undefined;
|
|
34
35
|
allowFaintSwitch?: boolean | undefined;
|
|
36
|
+
timer?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
turnTimeLimit?: number | undefined;
|
|
39
|
+
totalTimeLimit?: number | undefined;
|
|
40
|
+
animationPauseEnabled?: boolean | undefined;
|
|
41
|
+
maxAnimationDuration?: number | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
teamSelection?: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
46
|
+
minTeamSize?: number | undefined;
|
|
47
|
+
maxTeamSize?: number | undefined;
|
|
48
|
+
allowStarterSelection?: boolean | undefined;
|
|
49
|
+
showOpponentTeam?: boolean | undefined;
|
|
50
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
51
|
+
timeLimit?: number | undefined;
|
|
52
|
+
} | undefined;
|
|
35
53
|
inheritance?: {
|
|
36
54
|
eligible: "all" | "off" | "species" | string[];
|
|
37
55
|
pool?: {
|
|
@@ -123,48 +141,6 @@ export declare function environmentShareMaterials(files: Material[], document: E
|
|
|
123
141
|
kind: "mark" | "skill" | "species";
|
|
124
142
|
ids: string[];
|
|
125
143
|
}[] | undefined;
|
|
126
|
-
include?: string[] | undefined;
|
|
127
|
-
constraintEdits?: {
|
|
128
|
-
remove?: string[] | undefined;
|
|
129
|
-
replace?: ({
|
|
130
|
-
id: string;
|
|
131
|
-
allOf: {
|
|
132
|
-
kind: "mark" | "skill" | "species";
|
|
133
|
-
ids: string[];
|
|
134
|
-
fromCollections?: string[] | undefined;
|
|
135
|
-
}[];
|
|
136
|
-
kind: "ban";
|
|
137
|
-
scope: "pet" | "team";
|
|
138
|
-
exceptWhen?: {
|
|
139
|
-
kind: "mark" | "skill" | "species";
|
|
140
|
-
ids: string[];
|
|
141
|
-
fromCollections?: string[] | undefined;
|
|
142
|
-
}[] | undefined;
|
|
143
|
-
exceptAny?: {
|
|
144
|
-
kind: "mark" | "skill" | "species";
|
|
145
|
-
ids: string[];
|
|
146
|
-
fromCollections?: string[] | undefined;
|
|
147
|
-
}[][] | undefined;
|
|
148
|
-
} | {
|
|
149
|
-
id: string;
|
|
150
|
-
allOf: {
|
|
151
|
-
kind: "mark" | "skill" | "species";
|
|
152
|
-
ids: string[];
|
|
153
|
-
fromCollections?: string[] | undefined;
|
|
154
|
-
}[];
|
|
155
|
-
kind: "memberLimit";
|
|
156
|
-
max: number;
|
|
157
|
-
})[] | undefined;
|
|
158
|
-
clearExceptions?: string[] | undefined;
|
|
159
|
-
exceptions?: {
|
|
160
|
-
target: string;
|
|
161
|
-
allOf: {
|
|
162
|
-
kind: "mark" | "skill" | "species";
|
|
163
|
-
ids: string[];
|
|
164
|
-
fromCollections?: string[] | undefined;
|
|
165
|
-
}[];
|
|
166
|
-
}[] | undefined;
|
|
167
|
-
} | undefined;
|
|
168
144
|
};
|
|
169
145
|
requires: {
|
|
170
146
|
engine?: string | undefined;
|
|
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
import { readFile } from 'node:fs/promises';
|
|
4
4
|
import { withShippedEnvironmentProject, withShippedCatalogArchive } from '@arcadia-eternity/pack-loader/node';
|
|
5
5
|
import { contentError, materialFiles } from './workspace-materials.js';
|
|
6
|
-
const hostBaseName = '@arcadia-eternity/data-pack-base';
|
|
6
|
+
export const hostBaseName = '@arcadia-eternity/data-pack-base';
|
|
7
7
|
const baseLocation = 'node_modules/' + hostBaseName;
|
|
8
8
|
export function isBaseMaterial(path) {
|
|
9
9
|
return ('/' + path.toLowerCase() + '/').includes('/' + baseLocation + '/');
|