@character-foundry/character-foundry 0.4.2-dev.1765997746 → 0.4.2

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 (57) hide show
  1. package/dist/charx.cjs +36 -15
  2. package/dist/charx.cjs.map +1 -1
  3. package/dist/charx.d.cts +9 -18
  4. package/dist/charx.d.ts +9 -18
  5. package/dist/charx.js +36 -15
  6. package/dist/charx.js.map +1 -1
  7. package/dist/exporter.cjs +38 -34
  8. package/dist/exporter.cjs.map +1 -1
  9. package/dist/exporter.d.cts +9 -18
  10. package/dist/exporter.d.ts +9 -18
  11. package/dist/exporter.js +38 -34
  12. package/dist/exporter.js.map +1 -1
  13. package/dist/federation.cjs +36 -104
  14. package/dist/federation.cjs.map +1 -1
  15. package/dist/federation.d.cts +9 -53
  16. package/dist/federation.d.ts +9 -53
  17. package/dist/federation.js +36 -104
  18. package/dist/federation.js.map +1 -1
  19. package/dist/index.cjs +38 -34
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +21 -42
  22. package/dist/index.d.ts +21 -42
  23. package/dist/index.js +38 -34
  24. package/dist/index.js.map +1 -1
  25. package/dist/loader.cjs +15 -101
  26. package/dist/loader.cjs.map +1 -1
  27. package/dist/loader.d.cts +14 -42
  28. package/dist/loader.d.ts +14 -42
  29. package/dist/loader.js +15 -101
  30. package/dist/loader.js.map +1 -1
  31. package/dist/lorebook.d.cts +17 -34
  32. package/dist/lorebook.d.ts +17 -34
  33. package/dist/normalizer.cjs +2 -2
  34. package/dist/normalizer.cjs.map +1 -1
  35. package/dist/normalizer.d.cts +30 -60
  36. package/dist/normalizer.d.ts +30 -60
  37. package/dist/normalizer.js +2 -2
  38. package/dist/normalizer.js.map +1 -1
  39. package/dist/png.cjs +2 -2
  40. package/dist/png.cjs.map +1 -1
  41. package/dist/png.d.cts +16 -32
  42. package/dist/png.d.ts +16 -32
  43. package/dist/png.js +2 -2
  44. package/dist/png.js.map +1 -1
  45. package/dist/schemas.cjs +7 -7
  46. package/dist/schemas.cjs.map +1 -1
  47. package/dist/schemas.d.cts +48 -96
  48. package/dist/schemas.d.ts +48 -96
  49. package/dist/schemas.js +7 -7
  50. package/dist/schemas.js.map +1 -1
  51. package/dist/voxta.cjs +4 -21
  52. package/dist/voxta.cjs.map +1 -1
  53. package/dist/voxta.d.cts +14 -28
  54. package/dist/voxta.d.ts +14 -28
  55. package/dist/voxta.js +4 -21
  56. package/dist/voxta.js.map +1 -1
  57. package/package.json +6 -6
package/dist/index.d.cts CHANGED
@@ -33,8 +33,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
33
33
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
34
34
  z.ZodEnum<[
35
35
  "before_char",
36
- "after_char",
37
- "in_chat"
36
+ "after_char"
38
37
  ]>,
39
38
  z.ZodNumber,
40
39
  z.ZodLiteral<"">
@@ -77,8 +76,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
77
76
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
78
77
  z.ZodEnum<[
79
78
  "before_char",
80
- "after_char",
81
- "in_chat"
79
+ "after_char"
82
80
  ]>,
83
81
  z.ZodNumber,
84
82
  z.ZodLiteral<"">
@@ -121,8 +119,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
121
119
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
122
120
  z.ZodEnum<[
123
121
  "before_char",
124
- "after_char",
125
- "in_chat"
122
+ "after_char"
126
123
  ]>,
127
124
  z.ZodNumber,
128
125
  z.ZodLiteral<"">
@@ -167,8 +164,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
167
164
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
168
165
  z.ZodEnum<[
169
166
  "before_char",
170
- "after_char",
171
- "in_chat"
167
+ "after_char"
172
168
  ]>,
173
169
  z.ZodNumber,
174
170
  z.ZodLiteral<"">
@@ -219,8 +215,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
219
215
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
220
216
  z.ZodEnum<[
221
217
  "before_char",
222
- "after_char",
223
- "in_chat"
218
+ "after_char"
224
219
  ]>,
225
220
  z.ZodNumber,
226
221
  z.ZodLiteral<"">
@@ -296,8 +291,7 @@ declare const CCv3DataSchema: z.ZodObject<{
296
291
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
297
292
  z.ZodEnum<[
298
293
  "before_char",
299
- "after_char",
300
- "in_chat"
294
+ "after_char"
301
295
  ]>,
302
296
  z.ZodNumber,
303
297
  z.ZodLiteral<"">
@@ -340,8 +334,7 @@ declare const CCv3DataSchema: z.ZodObject<{
340
334
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
341
335
  z.ZodEnum<[
342
336
  "before_char",
343
- "after_char",
344
- "in_chat"
337
+ "after_char"
345
338
  ]>,
346
339
  z.ZodNumber,
347
340
  z.ZodLiteral<"">
@@ -384,8 +377,7 @@ declare const CCv3DataSchema: z.ZodObject<{
384
377
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
385
378
  z.ZodEnum<[
386
379
  "before_char",
387
- "after_char",
388
- "in_chat"
380
+ "after_char"
389
381
  ]>,
390
382
  z.ZodNumber,
391
383
  z.ZodLiteral<"">
@@ -430,8 +422,7 @@ declare const CCv3DataSchema: z.ZodObject<{
430
422
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
431
423
  z.ZodEnum<[
432
424
  "before_char",
433
- "after_char",
434
- "in_chat"
425
+ "after_char"
435
426
  ]>,
436
427
  z.ZodNumber,
437
428
  z.ZodLiteral<"">
@@ -482,8 +473,7 @@ declare const CCv3DataSchema: z.ZodObject<{
482
473
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
483
474
  z.ZodEnum<[
484
475
  "before_char",
485
- "after_char",
486
- "in_chat"
476
+ "after_char"
487
477
  ]>,
488
478
  z.ZodNumber,
489
479
  z.ZodLiteral<"">
@@ -582,8 +572,7 @@ declare const CCv3DataSchema: z.ZodObject<{
582
572
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
583
573
  z.ZodEnum<[
584
574
  "before_char",
585
- "after_char",
586
- "in_chat"
575
+ "after_char"
587
576
  ]>,
588
577
  z.ZodNumber,
589
578
  z.ZodLiteral<"">
@@ -658,8 +647,7 @@ declare const CCv3DataSchema: z.ZodObject<{
658
647
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
659
648
  z.ZodEnum<[
660
649
  "before_char",
661
- "after_char",
662
- "in_chat"
650
+ "after_char"
663
651
  ]>,
664
652
  z.ZodNumber,
665
653
  z.ZodLiteral<"">
@@ -744,8 +732,7 @@ declare const CCv3DataSchema: z.ZodObject<{
744
732
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
745
733
  z.ZodEnum<[
746
734
  "before_char",
747
- "after_char",
748
- "in_chat"
735
+ "after_char"
749
736
  ]>,
750
737
  z.ZodNumber,
751
738
  z.ZodLiteral<"">
@@ -824,8 +811,7 @@ declare const CCv3DataSchema: z.ZodObject<{
824
811
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
825
812
  z.ZodEnum<[
826
813
  "before_char",
827
- "after_char",
828
- "in_chat"
814
+ "after_char"
829
815
  ]>,
830
816
  z.ZodNumber,
831
817
  z.ZodLiteral<"">
@@ -944,8 +930,7 @@ declare const CCv2DataSchema: z.ZodObject<{
944
930
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
945
931
  z.ZodEnum<[
946
932
  "before_char",
947
- "after_char",
948
- "in_chat"
933
+ "after_char"
949
934
  ]>,
950
935
  z.ZodNumber,
951
936
  z.ZodLiteral<"">
@@ -967,8 +952,7 @@ declare const CCv2DataSchema: z.ZodObject<{
967
952
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
968
953
  z.ZodEnum<[
969
954
  "before_char",
970
- "after_char",
971
- "in_chat"
955
+ "after_char"
972
956
  ]>,
973
957
  z.ZodNumber,
974
958
  z.ZodLiteral<"">
@@ -990,8 +974,7 @@ declare const CCv2DataSchema: z.ZodObject<{
990
974
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
991
975
  z.ZodEnum<[
992
976
  "before_char",
993
- "after_char",
994
- "in_chat"
977
+ "after_char"
995
978
  ]>,
996
979
  z.ZodNumber,
997
980
  z.ZodLiteral<"">
@@ -1015,8 +998,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1015
998
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1016
999
  z.ZodEnum<[
1017
1000
  "before_char",
1018
- "after_char",
1019
- "in_chat"
1001
+ "after_char"
1020
1002
  ]>,
1021
1003
  z.ZodNumber,
1022
1004
  z.ZodLiteral<"">
@@ -1046,8 +1028,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1046
1028
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1047
1029
  z.ZodEnum<[
1048
1030
  "before_char",
1049
- "after_char",
1050
- "in_chat"
1031
+ "after_char"
1051
1032
  ]>,
1052
1033
  z.ZodNumber,
1053
1034
  z.ZodLiteral<"">
@@ -1094,8 +1075,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1094
1075
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1095
1076
  z.ZodEnum<[
1096
1077
  "before_char",
1097
- "after_char",
1098
- "in_chat"
1078
+ "after_char"
1099
1079
  ]>,
1100
1080
  z.ZodNumber,
1101
1081
  z.ZodLiteral<"">
@@ -1141,8 +1121,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1141
1121
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1142
1122
  z.ZodEnum<[
1143
1123
  "before_char",
1144
- "after_char",
1145
- "in_chat"
1124
+ "after_char"
1146
1125
  ]>,
1147
1126
  z.ZodNumber,
1148
1127
  z.ZodLiteral<"">
package/dist/index.d.ts CHANGED
@@ -33,8 +33,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
33
33
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
34
34
  z.ZodEnum<[
35
35
  "before_char",
36
- "after_char",
37
- "in_chat"
36
+ "after_char"
38
37
  ]>,
39
38
  z.ZodNumber,
40
39
  z.ZodLiteral<"">
@@ -77,8 +76,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
77
76
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
78
77
  z.ZodEnum<[
79
78
  "before_char",
80
- "after_char",
81
- "in_chat"
79
+ "after_char"
82
80
  ]>,
83
81
  z.ZodNumber,
84
82
  z.ZodLiteral<"">
@@ -121,8 +119,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
121
119
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
122
120
  z.ZodEnum<[
123
121
  "before_char",
124
- "after_char",
125
- "in_chat"
122
+ "after_char"
126
123
  ]>,
127
124
  z.ZodNumber,
128
125
  z.ZodLiteral<"">
@@ -167,8 +164,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
167
164
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
168
165
  z.ZodEnum<[
169
166
  "before_char",
170
- "after_char",
171
- "in_chat"
167
+ "after_char"
172
168
  ]>,
173
169
  z.ZodNumber,
174
170
  z.ZodLiteral<"">
@@ -219,8 +215,7 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
219
215
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
220
216
  z.ZodEnum<[
221
217
  "before_char",
222
- "after_char",
223
- "in_chat"
218
+ "after_char"
224
219
  ]>,
225
220
  z.ZodNumber,
226
221
  z.ZodLiteral<"">
@@ -296,8 +291,7 @@ declare const CCv3DataSchema: z.ZodObject<{
296
291
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
297
292
  z.ZodEnum<[
298
293
  "before_char",
299
- "after_char",
300
- "in_chat"
294
+ "after_char"
301
295
  ]>,
302
296
  z.ZodNumber,
303
297
  z.ZodLiteral<"">
@@ -340,8 +334,7 @@ declare const CCv3DataSchema: z.ZodObject<{
340
334
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
341
335
  z.ZodEnum<[
342
336
  "before_char",
343
- "after_char",
344
- "in_chat"
337
+ "after_char"
345
338
  ]>,
346
339
  z.ZodNumber,
347
340
  z.ZodLiteral<"">
@@ -384,8 +377,7 @@ declare const CCv3DataSchema: z.ZodObject<{
384
377
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
385
378
  z.ZodEnum<[
386
379
  "before_char",
387
- "after_char",
388
- "in_chat"
380
+ "after_char"
389
381
  ]>,
390
382
  z.ZodNumber,
391
383
  z.ZodLiteral<"">
@@ -430,8 +422,7 @@ declare const CCv3DataSchema: z.ZodObject<{
430
422
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
431
423
  z.ZodEnum<[
432
424
  "before_char",
433
- "after_char",
434
- "in_chat"
425
+ "after_char"
435
426
  ]>,
436
427
  z.ZodNumber,
437
428
  z.ZodLiteral<"">
@@ -482,8 +473,7 @@ declare const CCv3DataSchema: z.ZodObject<{
482
473
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
483
474
  z.ZodEnum<[
484
475
  "before_char",
485
- "after_char",
486
- "in_chat"
476
+ "after_char"
487
477
  ]>,
488
478
  z.ZodNumber,
489
479
  z.ZodLiteral<"">
@@ -582,8 +572,7 @@ declare const CCv3DataSchema: z.ZodObject<{
582
572
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
583
573
  z.ZodEnum<[
584
574
  "before_char",
585
- "after_char",
586
- "in_chat"
575
+ "after_char"
587
576
  ]>,
588
577
  z.ZodNumber,
589
578
  z.ZodLiteral<"">
@@ -658,8 +647,7 @@ declare const CCv3DataSchema: z.ZodObject<{
658
647
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
659
648
  z.ZodEnum<[
660
649
  "before_char",
661
- "after_char",
662
- "in_chat"
650
+ "after_char"
663
651
  ]>,
664
652
  z.ZodNumber,
665
653
  z.ZodLiteral<"">
@@ -744,8 +732,7 @@ declare const CCv3DataSchema: z.ZodObject<{
744
732
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
745
733
  z.ZodEnum<[
746
734
  "before_char",
747
- "after_char",
748
- "in_chat"
735
+ "after_char"
749
736
  ]>,
750
737
  z.ZodNumber,
751
738
  z.ZodLiteral<"">
@@ -824,8 +811,7 @@ declare const CCv3DataSchema: z.ZodObject<{
824
811
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
825
812
  z.ZodEnum<[
826
813
  "before_char",
827
- "after_char",
828
- "in_chat"
814
+ "after_char"
829
815
  ]>,
830
816
  z.ZodNumber,
831
817
  z.ZodLiteral<"">
@@ -944,8 +930,7 @@ declare const CCv2DataSchema: z.ZodObject<{
944
930
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
945
931
  z.ZodEnum<[
946
932
  "before_char",
947
- "after_char",
948
- "in_chat"
933
+ "after_char"
949
934
  ]>,
950
935
  z.ZodNumber,
951
936
  z.ZodLiteral<"">
@@ -967,8 +952,7 @@ declare const CCv2DataSchema: z.ZodObject<{
967
952
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
968
953
  z.ZodEnum<[
969
954
  "before_char",
970
- "after_char",
971
- "in_chat"
955
+ "after_char"
972
956
  ]>,
973
957
  z.ZodNumber,
974
958
  z.ZodLiteral<"">
@@ -990,8 +974,7 @@ declare const CCv2DataSchema: z.ZodObject<{
990
974
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
991
975
  z.ZodEnum<[
992
976
  "before_char",
993
- "after_char",
994
- "in_chat"
977
+ "after_char"
995
978
  ]>,
996
979
  z.ZodNumber,
997
980
  z.ZodLiteral<"">
@@ -1015,8 +998,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1015
998
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1016
999
  z.ZodEnum<[
1017
1000
  "before_char",
1018
- "after_char",
1019
- "in_chat"
1001
+ "after_char"
1020
1002
  ]>,
1021
1003
  z.ZodNumber,
1022
1004
  z.ZodLiteral<"">
@@ -1046,8 +1028,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1046
1028
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1047
1029
  z.ZodEnum<[
1048
1030
  "before_char",
1049
- "after_char",
1050
- "in_chat"
1031
+ "after_char"
1051
1032
  ]>,
1052
1033
  z.ZodNumber,
1053
1034
  z.ZodLiteral<"">
@@ -1094,8 +1075,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1094
1075
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1095
1076
  z.ZodEnum<[
1096
1077
  "before_char",
1097
- "after_char",
1098
- "in_chat"
1078
+ "after_char"
1099
1079
  ]>,
1100
1080
  z.ZodNumber,
1101
1081
  z.ZodLiteral<"">
@@ -1141,8 +1121,7 @@ declare const CCv2DataSchema: z.ZodObject<{
1141
1121
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1142
1122
  z.ZodEnum<[
1143
1123
  "before_char",
1144
- "after_char",
1145
- "in_chat"
1124
+ "after_char"
1146
1125
  ]>,
1147
1126
  z.ZodNumber,
1148
1127
  z.ZodLiteral<"">
package/dist/index.js CHANGED
@@ -596,7 +596,7 @@ var CCv2LorebookEntrySchema = z2.object({
596
596
  selective: z2.boolean().nullable().optional(),
597
597
  secondary_keys: z2.array(z2.string()).nullable().optional(),
598
598
  constant: z2.boolean().nullable().optional(),
599
- position: z2.union([z2.enum(["before_char", "after_char", "in_chat"]), z2.number().int(), z2.literal("")]).nullable().optional()
599
+ position: z2.union([z2.enum(["before_char", "after_char"]), z2.number().int(), z2.literal("")]).nullable().optional()
600
600
  }).passthrough();
601
601
  var CCv2CharacterBookSchema = z2.object({
602
602
  name: z2.string().optional(),
@@ -660,7 +660,7 @@ var CCv3LorebookEntrySchema = z3.object({
660
660
  selective: z3.boolean().nullable().optional(),
661
661
  secondary_keys: z3.array(z3.string()).nullable().optional(),
662
662
  constant: z3.boolean().nullable().optional(),
663
- position: z3.union([z3.enum(["before_char", "after_char", "in_chat"]), z3.number().int(), z3.literal("")]).nullable().optional(),
663
+ position: z3.union([z3.enum(["before_char", "after_char"]), z3.number().int(), z3.literal("")]).nullable().optional(),
664
664
  extensions: z3.record(z3.unknown()).optional(),
665
665
  // v3 specific - also lenient with types since SillyTavern uses numbers for enums
666
666
  automation_id: z3.string().optional(),
@@ -1339,6 +1339,36 @@ var SAFE_ASSET_TYPES = /* @__PURE__ */ new Set([
1339
1339
  "data",
1340
1340
  "unknown"
1341
1341
  ]);
1342
+ var SAFE_EXTENSIONS = /* @__PURE__ */ new Set([
1343
+ // Images
1344
+ "png",
1345
+ "jpg",
1346
+ "jpeg",
1347
+ "webp",
1348
+ "gif",
1349
+ "avif",
1350
+ "svg",
1351
+ "bmp",
1352
+ "ico",
1353
+ // Audio
1354
+ "mp3",
1355
+ "wav",
1356
+ "ogg",
1357
+ "flac",
1358
+ "m4a",
1359
+ "aac",
1360
+ "opus",
1361
+ // Video
1362
+ "mp4",
1363
+ "webm",
1364
+ "avi",
1365
+ "mov",
1366
+ "mkv",
1367
+ // Data
1368
+ "json",
1369
+ "txt",
1370
+ "bin"
1371
+ ]);
1342
1372
  function getCharxCategory(mimetype) {
1343
1373
  if (mimetype.startsWith("image/")) return "images";
1344
1374
  if (mimetype.startsWith("audio/")) return "audio";
@@ -1354,20 +1384,11 @@ function sanitizeAssetType(type) {
1354
1384
  return sanitized || "custom";
1355
1385
  }
1356
1386
  function sanitizeExtension(ext) {
1357
- const normalized = ext.trim().replace(/^\./, "").toLowerCase();
1358
- if (!normalized) {
1359
- throw new Error("Invalid asset extension: empty extension");
1360
- }
1361
- if (normalized.length > 64) {
1362
- throw new Error(`Invalid asset extension: too long (${normalized.length} chars)`);
1363
- }
1364
- if (normalized.includes("/") || normalized.includes("\\") || normalized.includes("\0")) {
1365
- throw new Error("Invalid asset extension: path separators are not allowed");
1366
- }
1367
- if (!/^[a-z0-9][a-z0-9._-]*$/.test(normalized)) {
1368
- throw new Error(`Invalid asset extension: "${ext}"`);
1387
+ const normalized = ext.replace(/^\./, "").toLowerCase().replace(/[^a-z0-9]/g, "");
1388
+ if (SAFE_EXTENSIONS.has(normalized)) {
1389
+ return normalized;
1369
1390
  }
1370
- return normalized;
1391
+ return "bin";
1371
1392
  }
1372
1393
  function sanitizeName(name, ext) {
1373
1394
  let safeName = name;
@@ -8149,22 +8170,6 @@ function sanitizeName2(name, ext) {
8149
8170
  if (!safeName) safeName = "asset";
8150
8171
  return safeName;
8151
8172
  }
8152
- function sanitizeExtension2(ext) {
8153
- const normalized = ext.trim().replace(/^\./, "").toLowerCase();
8154
- if (!normalized) {
8155
- throw new Error("Invalid asset extension: empty extension");
8156
- }
8157
- if (normalized.length > 64) {
8158
- throw new Error(`Invalid asset extension: too long (${normalized.length} chars)`);
8159
- }
8160
- if (normalized.includes("/") || normalized.includes("\\") || normalized.includes("\0")) {
8161
- throw new Error("Invalid asset extension: path separators are not allowed");
8162
- }
8163
- if (!/^[a-z0-9][a-z0-9._-]*$/.test(normalized)) {
8164
- throw new Error(`Invalid asset extension: "${ext}"`);
8165
- }
8166
- return normalized;
8167
- }
8168
8173
  function writeVoxta(card, assets, options = {}) {
8169
8174
  const { compressionLevel = 6, includePackageJson = false } = options;
8170
8175
  const cardData = card.data;
@@ -8253,9 +8258,8 @@ function writeVoxta(card, assets, options = {}) {
8253
8258
  let assetCount = 0;
8254
8259
  let mainThumbnail;
8255
8260
  for (const asset of assets) {
8256
- const safeExt = sanitizeExtension2(asset.ext);
8257
- const safeName = sanitizeName2(asset.name, safeExt);
8258
- const finalFilename = `${safeName}.${safeExt}`;
8261
+ const safeName = sanitizeName2(asset.name, asset.ext);
8262
+ const finalFilename = `${safeName}.${asset.ext}`;
8259
8263
  let voxtaPath = "";
8260
8264
  const tags = asset.tags || [];
8261
8265
  const isMainIcon = asset.type === "icon" && (tags.includes("portrait-override") || asset.name === "main" || asset.isMain);