@arcadia-eternity/content-sdk 4.6.0 → 4.8.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 (72) hide show
  1. package/README.md +2 -2
  2. package/dist/author-api.d.ts +12 -2
  3. package/dist/author-api.js +11 -2
  4. package/dist/author-git.d.ts +63 -0
  5. package/dist/author-git.js +324 -0
  6. package/dist/author-reference.d.ts +15 -1
  7. package/dist/author-reference.js +20 -1
  8. package/dist/cli.js +5 -4
  9. package/dist/content-query.d.ts +15 -1
  10. package/dist/content-query.js +53 -11
  11. package/dist/content-workspace.d.ts +428 -3
  12. package/dist/content-workspace.js +249 -54
  13. package/dist/debug-environments.d.ts +393 -25
  14. package/dist/debug-environments.js +3 -42
  15. package/dist/demo.js +1 -1
  16. package/dist/effect-declarations.d.ts +14 -0
  17. package/dist/effect-declarations.js +103 -0
  18. package/dist/environment-host-base.d.ts +175 -0
  19. package/dist/environment-host-base.js +86 -0
  20. package/dist/environment-member-transfer.d.ts +5 -0
  21. package/dist/environment-member-transfer.js +95 -0
  22. package/dist/environment-rules.d.ts +728 -3
  23. package/dist/environment-rules.js +158 -74
  24. package/dist/environment-sharing.d.ts +51 -0
  25. package/dist/environment-sharing.js +321 -0
  26. package/dist/environment.d.ts +2 -0
  27. package/dist/environment.js +32 -9
  28. package/dist/jobs.d.ts +5 -0
  29. package/dist/jobs.js +59 -10
  30. package/dist/learnsets.d.ts +47 -0
  31. package/dist/learnsets.js +124 -0
  32. package/dist/lib/content.d.ts +1 -1
  33. package/dist/lib/content.js +26 -2
  34. package/dist/lib/presentation.js +5 -11
  35. package/dist/managed-projects.d.ts +6 -0
  36. package/dist/managed-projects.js +137 -45
  37. package/dist/managed-sources.d.ts +17 -0
  38. package/dist/managed-sources.js +28 -10
  39. package/dist/mcp-contracts.d.ts +405 -4
  40. package/dist/mcp-contracts.js +3 -1
  41. package/dist/mcp.js +23 -1
  42. package/dist/pack-project.d.ts +2 -1
  43. package/dist/pack-project.js +40 -5
  44. package/dist/prepared-document.d.ts +476 -0
  45. package/dist/prepared-document.js +47 -0
  46. package/dist/preview.js +5 -5
  47. package/dist/project.d.ts +3 -1
  48. package/dist/project.js +47 -4
  49. package/dist/rule-composition.d.ts +290 -0
  50. package/dist/rule-composition.js +267 -0
  51. package/dist/template/.github/scripts/release-payload.mjs +91 -0
  52. package/dist/template/.github/scripts/release-test-npm.mjs +27 -0
  53. package/dist/template/.github/scripts/verify-release.mjs +138 -0
  54. package/dist/template/.github/workflows/release-pack.yml +77 -0
  55. package/dist/template/README.md +15 -2
  56. package/dist/template/gitignore-template +7 -0
  57. package/dist/template/npm-lock-template.json +2319 -0
  58. package/dist/template/package.json +4 -2
  59. package/dist/template/skills/arcadia-content-authoring/references/tool-workflows.md +1 -1
  60. package/dist/template/skills/arcadia-content-git/SKILL.md +14 -0
  61. package/dist/template/skills/arcadia-content-release/SKILL.md +29 -0
  62. package/dist/template/test/pack.test.mjs +24 -5
  63. package/dist/testing.d.ts +1 -0
  64. package/dist/testing.js +26 -7
  65. package/dist/workspace-cli.js +2 -2
  66. package/dist/workspace-materials.d.ts +4 -1
  67. package/dist/workspace-materials.js +8 -2
  68. package/dist/workspace.d.ts +11 -0
  69. package/dist/workspace.js +191 -31
  70. package/package.json +16 -4
  71. package/release-payload.mjs +91 -0
  72. package/release-test-npm.mjs +27 -0
@@ -1,26 +1,6 @@
1
+ export { EnvironmentRuleDeclarationSchema, EnvironmentRulesSchema, type EnvironmentRules, } from '@arcadia-eternity/const';
1
2
  import { type AuthorWorkspace } from './workspace.js';
2
3
  import { z } from 'zod';
3
- /** Portable rule data. Runtime consumers must explicitly support every declared capability. */
4
- export declare const EnvironmentRulesSchema: z.ZodObject<{
5
- schemaVersion: z.ZodLiteral<1>;
6
- tier: z.ZodOptional<z.ZodString>;
7
- allow: z.ZodOptional<z.ZodObject<{
8
- species: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
- marks: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
- }, z.core.$strict>>;
12
- deny: z.ZodOptional<z.ZodObject<{
13
- species: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
- marks: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
- }, z.core.$strict>>;
17
- team: z.ZodOptional<z.ZodObject<{
18
- minSize: z.ZodOptional<z.ZodNumber>;
19
- maxSize: z.ZodOptional<z.ZodNumber>;
20
- uniqueSpecies: z.ZodOptional<z.ZodBoolean>;
21
- }, z.core.$strict>>;
22
- }, z.core.$strict>;
23
- export type EnvironmentRules = z.infer<typeof EnvironmentRulesSchema>;
24
4
  export declare const EnvironmentDocumentV2Schema: z.ZodObject<{
25
5
  id: z.ZodString;
26
6
  name: z.ZodString;
@@ -28,8 +8,80 @@ export declare const EnvironmentDocumentV2Schema: z.ZodObject<{
28
8
  sources: z.ZodArray<z.ZodString>;
29
9
  schemaVersion: z.ZodLiteral<2>;
30
10
  rules: z.ZodObject<{
31
- schemaVersion: z.ZodLiteral<1>;
32
- tier: z.ZodOptional<z.ZodString>;
11
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
12
+ mechanics: z.ZodOptional<z.ZodObject<{
13
+ skillSlots: z.ZodOptional<z.ZodObject<{
14
+ normalMax: z.ZodNumber;
15
+ climaxMax: z.ZodNumber;
16
+ climaxMin: z.ZodOptional<z.ZodNumber>;
17
+ }, z.core.$strict>>;
18
+ individualValueDefault: z.ZodOptional<z.ZodNumber>;
19
+ individualValues: z.ZodOptional<z.ZodObject<{
20
+ max: z.ZodNumber;
21
+ }, z.core.$strict>>;
22
+ allowFaintSwitch: z.ZodOptional<z.ZodBoolean>;
23
+ inheritance: z.ZodOptional<z.ZodObject<{
24
+ eligible: z.ZodUnion<readonly [z.ZodEnum<{
25
+ all: "all";
26
+ off: "off";
27
+ species: "species";
28
+ }>, z.ZodArray<z.ZodString>]>;
29
+ pool: z.ZodOptional<z.ZodObject<{
30
+ mode: z.ZodEnum<{
31
+ append: "append";
32
+ fallback: "fallback";
33
+ replace: "replace";
34
+ }>;
35
+ skills: z.ZodArray<z.ZodString>;
36
+ }, z.core.$strict>>;
37
+ }, z.core.$strict>>;
38
+ enhancement: z.ZodOptional<z.ZodObject<{
39
+ mode: z.ZodEnum<{
40
+ active: "active";
41
+ forbidden: "forbidden";
42
+ suppressed: "suppressed";
43
+ }>;
44
+ stages: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
+ species: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
+ }, z.core.$strict>>;
47
+ secondGenerationNatures: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
48
+ all: "all";
49
+ off: "off";
50
+ species: "species";
51
+ }>, z.ZodArray<z.ZodString>]>>;
52
+ }, z.core.$strict>>;
53
+ skillParameters: z.ZodOptional<z.ZodObject<{
54
+ profile: z.ZodOptional<z.ZodString>;
55
+ groups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
56
+ overrides: z.ZodOptional<z.ZodArray<z.ZodObject<{
57
+ skill: z.ZodString;
58
+ useId: z.ZodString;
59
+ parameter: z.ZodString;
60
+ value: z.ZodNumber;
61
+ }, z.core.$strict>>>;
62
+ }, z.core.$strict>>;
63
+ matchups: z.ZodOptional<z.ZodObject<{
64
+ table: z.ZodOptional<z.ZodString>;
65
+ adjustments: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
+ attack: z.ZodString;
67
+ defense: z.ZodString;
68
+ multiplier: z.ZodNumber;
69
+ }, z.core.$strict>>>;
70
+ }, z.core.$strict>>;
71
+ learnsetAdjustments: z.ZodOptional<z.ZodArray<z.ZodObject<{
72
+ species: z.ZodString;
73
+ source: z.ZodEnum<{
74
+ inherited: "inherited";
75
+ normal: "normal";
76
+ }>;
77
+ skill: z.ZodString;
78
+ action: z.ZodEnum<{
79
+ add: "add";
80
+ remove: "remove";
81
+ }>;
82
+ level: z.ZodOptional<z.ZodNumber>;
83
+ }, z.core.$strict>>>;
84
+ tier: z.ZodOptional<z.ZodLiteral<"standard">>;
33
85
  allow: z.ZodOptional<z.ZodObject<{
34
86
  species: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
87
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -45,6 +97,128 @@ export declare const EnvironmentDocumentV2Schema: z.ZodObject<{
45
97
  maxSize: z.ZodOptional<z.ZodNumber>;
46
98
  uniqueSpecies: z.ZodOptional<z.ZodBoolean>;
47
99
  }, z.core.$strict>>;
100
+ constraints: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
101
+ id: z.ZodString;
102
+ allOf: z.ZodArray<z.ZodObject<{
103
+ kind: z.ZodEnum<{
104
+ mark: "mark";
105
+ skill: "skill";
106
+ species: "species";
107
+ }>;
108
+ ids: z.ZodArray<z.ZodString>;
109
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ }, z.core.$strict>>;
111
+ kind: z.ZodLiteral<"ban">;
112
+ scope: z.ZodEnum<{
113
+ pet: "pet";
114
+ team: "team";
115
+ }>;
116
+ exceptWhen: z.ZodOptional<z.ZodArray<z.ZodObject<{
117
+ kind: z.ZodEnum<{
118
+ mark: "mark";
119
+ skill: "skill";
120
+ species: "species";
121
+ }>;
122
+ ids: z.ZodArray<z.ZodString>;
123
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ }, z.core.$strict>>>;
125
+ exceptAny: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
126
+ kind: z.ZodEnum<{
127
+ mark: "mark";
128
+ skill: "skill";
129
+ species: "species";
130
+ }>;
131
+ ids: z.ZodArray<z.ZodString>;
132
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
133
+ }, z.core.$strict>>>>;
134
+ }, z.core.$strict>, z.ZodObject<{
135
+ id: z.ZodString;
136
+ allOf: z.ZodArray<z.ZodObject<{
137
+ kind: z.ZodEnum<{
138
+ mark: "mark";
139
+ skill: "skill";
140
+ species: "species";
141
+ }>;
142
+ ids: z.ZodArray<z.ZodString>;
143
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
144
+ }, z.core.$strict>>;
145
+ kind: z.ZodLiteral<"memberLimit">;
146
+ max: z.ZodNumber;
147
+ }, z.core.$strict>], "kind">>>;
148
+ collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
149
+ id: z.ZodString;
150
+ kind: z.ZodEnum<{
151
+ mark: "mark";
152
+ skill: "skill";
153
+ species: "species";
154
+ }>;
155
+ ids: z.ZodArray<z.ZodString>;
156
+ }, z.core.$strict>>>;
157
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
158
+ constraintEdits: z.ZodOptional<z.ZodObject<{
159
+ remove: z.ZodOptional<z.ZodArray<z.ZodString>>;
160
+ replace: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
161
+ id: z.ZodString;
162
+ allOf: z.ZodArray<z.ZodObject<{
163
+ kind: z.ZodEnum<{
164
+ mark: "mark";
165
+ skill: "skill";
166
+ species: "species";
167
+ }>;
168
+ ids: z.ZodArray<z.ZodString>;
169
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
170
+ }, z.core.$strict>>;
171
+ kind: z.ZodLiteral<"ban">;
172
+ scope: z.ZodEnum<{
173
+ pet: "pet";
174
+ team: "team";
175
+ }>;
176
+ exceptWhen: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
+ kind: z.ZodEnum<{
178
+ mark: "mark";
179
+ skill: "skill";
180
+ species: "species";
181
+ }>;
182
+ ids: z.ZodArray<z.ZodString>;
183
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
184
+ }, z.core.$strict>>>;
185
+ exceptAny: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
186
+ kind: z.ZodEnum<{
187
+ mark: "mark";
188
+ skill: "skill";
189
+ species: "species";
190
+ }>;
191
+ ids: z.ZodArray<z.ZodString>;
192
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
193
+ }, z.core.$strict>>>>;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ id: z.ZodString;
196
+ allOf: z.ZodArray<z.ZodObject<{
197
+ kind: z.ZodEnum<{
198
+ mark: "mark";
199
+ skill: "skill";
200
+ species: "species";
201
+ }>;
202
+ ids: z.ZodArray<z.ZodString>;
203
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
+ }, z.core.$strict>>;
205
+ kind: z.ZodLiteral<"memberLimit">;
206
+ max: z.ZodNumber;
207
+ }, z.core.$strict>], "kind">>>;
208
+ clearExceptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
209
+ exceptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
210
+ target: z.ZodString;
211
+ allOf: z.ZodArray<z.ZodObject<{
212
+ kind: z.ZodEnum<{
213
+ mark: "mark";
214
+ skill: "skill";
215
+ species: "species";
216
+ }>;
217
+ ids: z.ZodArray<z.ZodString>;
218
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
+ }, z.core.$strict>>;
220
+ }, z.core.$strict>>>;
221
+ }, z.core.$strict>>;
48
222
  }, z.core.$strict>;
49
223
  requires: z.ZodObject<{
50
224
  engine: z.ZodOptional<z.ZodString>;
@@ -65,8 +239,80 @@ export declare const EnvironmentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodOb
65
239
  sources: z.ZodArray<z.ZodString>;
66
240
  schemaVersion: z.ZodLiteral<2>;
67
241
  rules: z.ZodObject<{
68
- schemaVersion: z.ZodLiteral<1>;
69
- tier: z.ZodOptional<z.ZodString>;
242
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
243
+ mechanics: z.ZodOptional<z.ZodObject<{
244
+ skillSlots: z.ZodOptional<z.ZodObject<{
245
+ normalMax: z.ZodNumber;
246
+ climaxMax: z.ZodNumber;
247
+ climaxMin: z.ZodOptional<z.ZodNumber>;
248
+ }, z.core.$strict>>;
249
+ individualValueDefault: z.ZodOptional<z.ZodNumber>;
250
+ individualValues: z.ZodOptional<z.ZodObject<{
251
+ max: z.ZodNumber;
252
+ }, z.core.$strict>>;
253
+ allowFaintSwitch: z.ZodOptional<z.ZodBoolean>;
254
+ inheritance: z.ZodOptional<z.ZodObject<{
255
+ eligible: z.ZodUnion<readonly [z.ZodEnum<{
256
+ all: "all";
257
+ off: "off";
258
+ species: "species";
259
+ }>, z.ZodArray<z.ZodString>]>;
260
+ pool: z.ZodOptional<z.ZodObject<{
261
+ mode: z.ZodEnum<{
262
+ append: "append";
263
+ fallback: "fallback";
264
+ replace: "replace";
265
+ }>;
266
+ skills: z.ZodArray<z.ZodString>;
267
+ }, z.core.$strict>>;
268
+ }, z.core.$strict>>;
269
+ enhancement: z.ZodOptional<z.ZodObject<{
270
+ mode: z.ZodEnum<{
271
+ active: "active";
272
+ forbidden: "forbidden";
273
+ suppressed: "suppressed";
274
+ }>;
275
+ stages: z.ZodOptional<z.ZodArray<z.ZodString>>;
276
+ species: z.ZodOptional<z.ZodArray<z.ZodString>>;
277
+ }, z.core.$strict>>;
278
+ secondGenerationNatures: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
279
+ all: "all";
280
+ off: "off";
281
+ species: "species";
282
+ }>, z.ZodArray<z.ZodString>]>>;
283
+ }, z.core.$strict>>;
284
+ skillParameters: z.ZodOptional<z.ZodObject<{
285
+ profile: z.ZodOptional<z.ZodString>;
286
+ groups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
287
+ overrides: z.ZodOptional<z.ZodArray<z.ZodObject<{
288
+ skill: z.ZodString;
289
+ useId: z.ZodString;
290
+ parameter: z.ZodString;
291
+ value: z.ZodNumber;
292
+ }, z.core.$strict>>>;
293
+ }, z.core.$strict>>;
294
+ matchups: z.ZodOptional<z.ZodObject<{
295
+ table: z.ZodOptional<z.ZodString>;
296
+ adjustments: z.ZodOptional<z.ZodArray<z.ZodObject<{
297
+ attack: z.ZodString;
298
+ defense: z.ZodString;
299
+ multiplier: z.ZodNumber;
300
+ }, z.core.$strict>>>;
301
+ }, z.core.$strict>>;
302
+ learnsetAdjustments: z.ZodOptional<z.ZodArray<z.ZodObject<{
303
+ species: z.ZodString;
304
+ source: z.ZodEnum<{
305
+ inherited: "inherited";
306
+ normal: "normal";
307
+ }>;
308
+ skill: z.ZodString;
309
+ action: z.ZodEnum<{
310
+ add: "add";
311
+ remove: "remove";
312
+ }>;
313
+ level: z.ZodOptional<z.ZodNumber>;
314
+ }, z.core.$strict>>>;
315
+ tier: z.ZodOptional<z.ZodLiteral<"standard">>;
70
316
  allow: z.ZodOptional<z.ZodObject<{
71
317
  species: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
318
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -82,6 +328,128 @@ export declare const EnvironmentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodOb
82
328
  maxSize: z.ZodOptional<z.ZodNumber>;
83
329
  uniqueSpecies: z.ZodOptional<z.ZodBoolean>;
84
330
  }, z.core.$strict>>;
331
+ constraints: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
332
+ id: z.ZodString;
333
+ allOf: z.ZodArray<z.ZodObject<{
334
+ kind: z.ZodEnum<{
335
+ mark: "mark";
336
+ skill: "skill";
337
+ species: "species";
338
+ }>;
339
+ ids: z.ZodArray<z.ZodString>;
340
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
341
+ }, z.core.$strict>>;
342
+ kind: z.ZodLiteral<"ban">;
343
+ scope: z.ZodEnum<{
344
+ pet: "pet";
345
+ team: "team";
346
+ }>;
347
+ exceptWhen: z.ZodOptional<z.ZodArray<z.ZodObject<{
348
+ kind: z.ZodEnum<{
349
+ mark: "mark";
350
+ skill: "skill";
351
+ species: "species";
352
+ }>;
353
+ ids: z.ZodArray<z.ZodString>;
354
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
355
+ }, z.core.$strict>>>;
356
+ exceptAny: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
357
+ kind: z.ZodEnum<{
358
+ mark: "mark";
359
+ skill: "skill";
360
+ species: "species";
361
+ }>;
362
+ ids: z.ZodArray<z.ZodString>;
363
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
364
+ }, z.core.$strict>>>>;
365
+ }, z.core.$strict>, z.ZodObject<{
366
+ id: z.ZodString;
367
+ allOf: z.ZodArray<z.ZodObject<{
368
+ kind: z.ZodEnum<{
369
+ mark: "mark";
370
+ skill: "skill";
371
+ species: "species";
372
+ }>;
373
+ ids: z.ZodArray<z.ZodString>;
374
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
375
+ }, z.core.$strict>>;
376
+ kind: z.ZodLiteral<"memberLimit">;
377
+ max: z.ZodNumber;
378
+ }, z.core.$strict>], "kind">>>;
379
+ collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
380
+ id: z.ZodString;
381
+ kind: z.ZodEnum<{
382
+ mark: "mark";
383
+ skill: "skill";
384
+ species: "species";
385
+ }>;
386
+ ids: z.ZodArray<z.ZodString>;
387
+ }, z.core.$strict>>>;
388
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
389
+ constraintEdits: z.ZodOptional<z.ZodObject<{
390
+ remove: z.ZodOptional<z.ZodArray<z.ZodString>>;
391
+ replace: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
392
+ id: z.ZodString;
393
+ allOf: z.ZodArray<z.ZodObject<{
394
+ kind: z.ZodEnum<{
395
+ mark: "mark";
396
+ skill: "skill";
397
+ species: "species";
398
+ }>;
399
+ ids: z.ZodArray<z.ZodString>;
400
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
401
+ }, z.core.$strict>>;
402
+ kind: z.ZodLiteral<"ban">;
403
+ scope: z.ZodEnum<{
404
+ pet: "pet";
405
+ team: "team";
406
+ }>;
407
+ exceptWhen: z.ZodOptional<z.ZodArray<z.ZodObject<{
408
+ kind: z.ZodEnum<{
409
+ mark: "mark";
410
+ skill: "skill";
411
+ species: "species";
412
+ }>;
413
+ ids: z.ZodArray<z.ZodString>;
414
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
415
+ }, z.core.$strict>>>;
416
+ exceptAny: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
417
+ kind: z.ZodEnum<{
418
+ mark: "mark";
419
+ skill: "skill";
420
+ species: "species";
421
+ }>;
422
+ ids: z.ZodArray<z.ZodString>;
423
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
424
+ }, z.core.$strict>>>>;
425
+ }, z.core.$strict>, z.ZodObject<{
426
+ id: z.ZodString;
427
+ allOf: z.ZodArray<z.ZodObject<{
428
+ kind: z.ZodEnum<{
429
+ mark: "mark";
430
+ skill: "skill";
431
+ species: "species";
432
+ }>;
433
+ ids: z.ZodArray<z.ZodString>;
434
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
435
+ }, z.core.$strict>>;
436
+ kind: z.ZodLiteral<"memberLimit">;
437
+ max: z.ZodNumber;
438
+ }, z.core.$strict>], "kind">>>;
439
+ clearExceptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
440
+ exceptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
441
+ target: z.ZodString;
442
+ allOf: z.ZodArray<z.ZodObject<{
443
+ kind: z.ZodEnum<{
444
+ mark: "mark";
445
+ skill: "skill";
446
+ species: "species";
447
+ }>;
448
+ ids: z.ZodArray<z.ZodString>;
449
+ fromCollections: z.ZodOptional<z.ZodArray<z.ZodString>>;
450
+ }, z.core.$strict>>;
451
+ }, z.core.$strict>>>;
452
+ }, z.core.$strict>>;
85
453
  }, z.core.$strict>;
86
454
  requires: z.ZodObject<{
87
455
  engine: z.ZodOptional<z.ZodString>;
@@ -1,3 +1,5 @@
1
+ import { EnvironmentRuleDeclarationSchema, EnvironmentRequirementsSchema } from '@arcadia-eternity/const';
2
+ export { EnvironmentRuleDeclarationSchema, EnvironmentRulesSchema, } from '@arcadia-eternity/const';
1
3
  import { WorkspaceError } from './workspace.js';
2
4
  import { z } from 'zod';
3
5
  const idPattern = /^[a-z0-9][a-z0-9_-]{0,79}$/;
@@ -26,53 +28,12 @@ const sharedFields = {
26
28
  .max(20)
27
29
  .refine(value => new Set(value).size === value.length, '源码包标识不能重复'),
28
30
  };
29
- const reference = z
30
- .string()
31
- .min(1)
32
- .max(256)
33
- .regex(/^[a-zA-Z0-9_./:-]+$/);
34
- const uniqueList = (schema) => z
35
- .array(schema)
36
- .max(10000)
37
- .refine(value => new Set(value).size === value.length, '引用不能重复');
38
- const contentSelection = z
39
- .object({
40
- species: uniqueList(reference).optional(),
41
- skills: uniqueList(reference).optional(),
42
- marks: uniqueList(reference).optional(),
43
- })
44
- .strict();
45
- /** Portable rule data. Runtime consumers must explicitly support every declared capability. */
46
- export const EnvironmentRulesSchema = z
47
- .object({
48
- schemaVersion: z.literal(1),
49
- tier: z.string().regex(idPattern).optional(),
50
- allow: contentSelection.optional(),
51
- deny: contentSelection.optional(),
52
- team: z
53
- .object({
54
- minSize: z.number().int().min(1).max(100).optional(),
55
- maxSize: z.number().int().min(1).max(100).optional(),
56
- uniqueSpecies: z.boolean().optional(),
57
- })
58
- .strict()
59
- .refine(value => value.minSize === undefined || value.maxSize === undefined || value.minSize <= value.maxSize, '队伍最小数量不能大于最大数量')
60
- .optional(),
61
- })
62
- .strict();
63
- const EnvironmentRequirementsSchema = z
64
- .object({
65
- engine: z.string().trim().min(1).max(128).optional(),
66
- sdk: z.string().trim().min(1).max(128).optional(),
67
- capabilities: uniqueList(z.string().regex(/^[a-zA-Z0-9_.:-]{1,128}$/)).optional(),
68
- })
69
- .strict();
70
31
  const EnvironmentDocumentV1Schema = z.object({ schemaVersion: z.literal(1), ...sharedFields }).strict();
71
32
  export const EnvironmentDocumentV2Schema = z
72
33
  .object({
73
34
  schemaVersion: z.literal(2),
74
35
  ...sharedFields,
75
- rules: EnvironmentRulesSchema,
36
+ rules: EnvironmentRuleDeclarationSchema,
76
37
  requires: EnvironmentRequirementsSchema,
77
38
  })
78
39
  .strict();
package/dist/demo.js CHANGED
@@ -11,7 +11,7 @@ try {
11
11
  console.log(`Turn ${battle.currentTurn}: ${pets.join(' | ')}`);
12
12
  });
13
13
  console.log(`Winner: ${result.winner}; finished in ${result.turns} turns.`);
14
- console.log(`ARCADIA_RESULT=${JSON.stringify({ ...result, candidate: example.candidate, environmentRevision: example.environment.revision, packageName: example.manifest.name, files: example.files })}`);
14
+ console.log(`ARCADIA_RESULT=${JSON.stringify({ ...result, candidate: example.candidate, environmentRevision: example.candidate.environmentRevision, packageName: example.manifest.name, files: example.files })}`);
15
15
  }
16
16
  finally {
17
17
  await example.dispose();
@@ -0,0 +1,14 @@
1
+ export interface AuthorEffectDeclaration {
2
+ id: string;
3
+ sourceKind: 'skill' | 'petMark';
4
+ file: string;
5
+ line: number;
6
+ }
7
+ export interface AuthorEffectCatalog {
8
+ definitions: AuthorEffectDeclaration[];
9
+ issues: {
10
+ file: string;
11
+ message: string;
12
+ }[];
13
+ }
14
+ export declare function inspectEffectDeclarations(file: string, text: string, namespace: string): AuthorEffectCatalog;
@@ -0,0 +1,103 @@
1
+ import ts from 'typescript';
2
+ import { runtimeId } from '@arcadia-eternity/pack-loader/native';
3
+ // Parse saved author text without importing the module or running its decorators.
4
+ export function inspectEffectDeclarations(file, text, namespace) {
5
+ const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true);
6
+ const options = { noResolve: true, noLib: true, types: [], target: ts.ScriptTarget.Latest };
7
+ const program = ts.createProgram([file], options, {
8
+ ...ts.createCompilerHost(options),
9
+ getSourceFile: path => (path === file ? source : undefined),
10
+ fileExists: path => path === file,
11
+ readFile: path => (path === file ? text : undefined),
12
+ });
13
+ const result = { definitions: [], issues: [] };
14
+ const issue = (message) => result.issues.push({ file, message });
15
+ const [syntax] = program.getSyntacticDiagnostics(source);
16
+ if (syntax) {
17
+ issue(ts.flattenDiagnosticMessageText(syntax.messageText, '\n'));
18
+ return result;
19
+ }
20
+ const decorators = new Map();
21
+ for (const statement of source.statements) {
22
+ if (!ts.isImportDeclaration(statement) ||
23
+ !ts.isStringLiteral(statement.moduleSpecifier) ||
24
+ !['@arcadia-eternity/content-sdk', '@arcadia-eternity/battle/effect-loading'].includes(statement.moduleSpecifier.text) ||
25
+ statement.importClause?.isTypeOnly)
26
+ continue;
27
+ const imports = statement.importClause?.namedBindings;
28
+ if (!imports)
29
+ continue;
30
+ if (ts.isNamespaceImport(imports)) {
31
+ for (const name of ['effect', 'on'])
32
+ decorators.set(imports.name.text + '.' + name, name);
33
+ }
34
+ else
35
+ for (const binding of imports.elements) {
36
+ if (!binding.isTypeOnly)
37
+ decorators.set(binding.name.text, (binding.propertyName ?? binding.name).text);
38
+ }
39
+ }
40
+ const checker = program.getTypeChecker();
41
+ const module = checker.getSymbolAtLocation(source);
42
+ const exports = module ? checker.getExportsOfModule(module) : [];
43
+ const classes = new Set(exports
44
+ .filter(symbol => !symbol.declarations?.some(ts.isTypeOnlyImportOrExportDeclaration))
45
+ .map(symbol => (symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol).valueDeclaration));
46
+ function calls(node, name) {
47
+ return (ts.getDecorators(node) ?? [])
48
+ .map(decorator => decorator.expression)
49
+ .filter((expr) => ts.isCallExpression(expr) && decorators.get(expr.expression.getText(source)) === name);
50
+ }
51
+ function literal(options, field) {
52
+ const property = checker.getTypeAtLocation(options).getProperty(field);
53
+ const declaration = property?.valueDeclaration;
54
+ if (!declaration)
55
+ return;
56
+ if (ts.isShorthandPropertyAssignment(declaration)) {
57
+ const symbol = checker.getShorthandAssignmentValueSymbol(declaration);
58
+ const type = symbol && checker.getTypeOfSymbolAtLocation(symbol, declaration.name);
59
+ return type?.isStringLiteral() ? type.value : undefined;
60
+ }
61
+ const value = ts.isPropertyAssignment(declaration) ? declaration.initializer : declaration;
62
+ const type = checker.getTypeAtLocation(value);
63
+ if (type.isStringLiteral())
64
+ return type.value;
65
+ }
66
+ for (const node of classes) {
67
+ if (!node || !ts.isClassDeclaration(node))
68
+ continue;
69
+ for (const decorator of calls(node, 'effect')) {
70
+ const options = decorator.arguments[0];
71
+ const id = options && literal(options, 'id');
72
+ const kind = options && literal(options, 'sourceKind');
73
+ if (!id || (kind !== 'skill' && kind !== 'petMark')) {
74
+ issue('无法从声明中确定效果 ID 和适用对象。');
75
+ continue;
76
+ }
77
+ try {
78
+ runtimeId(namespace, id);
79
+ }
80
+ catch {
81
+ issue(`效果 ID 或项目命名空间无效:${id}`);
82
+ continue;
83
+ }
84
+ const methods = node.members
85
+ .filter(ts.isMethodDeclaration)
86
+ .filter(method => method.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.StaticKeyword) &&
87
+ !ts.isPrivateIdentifier(method.name));
88
+ if (!methods.some(method => method.name.getText(source) === 'create' || calls(method, 'on').length)) {
89
+ issue(`${id} 缺少静态 @on 方法或 create 方法。`);
90
+ continue;
91
+ }
92
+ result.definitions.push({
93
+ id,
94
+ sourceKind: kind,
95
+ file,
96
+ line: source.getLineAndCharacterOfPosition(decorator.getStart(source)).line + 1,
97
+ });
98
+ }
99
+ }
100
+ if (!result.definitions.length && !result.issues.length)
101
+ issue('未识别到导出的 @effect 声明。');
102
+ return result;
103
+ }