@character-foundry/character-foundry 0.4.3-dev.1766103111 → 0.4.3

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 +52 -85
  2. package/dist/charx.cjs.map +1 -1
  3. package/dist/charx.d.cts +22 -22
  4. package/dist/charx.d.ts +22 -22
  5. package/dist/charx.js +52 -85
  6. package/dist/charx.js.map +1 -1
  7. package/dist/exporter.cjs +54 -104
  8. package/dist/exporter.cjs.map +1 -1
  9. package/dist/exporter.d.cts +19 -19
  10. package/dist/exporter.d.ts +19 -19
  11. package/dist/exporter.js +54 -104
  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 +19 -54
  16. package/dist/federation.d.ts +19 -54
  17. package/dist/federation.js +36 -104
  18. package/dist/federation.js.map +1 -1
  19. package/dist/index.cjs +54 -104
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +29 -29
  22. package/dist/index.d.ts +29 -29
  23. package/dist/index.js +54 -104
  24. package/dist/index.js.map +1 -1
  25. package/dist/loader.cjs +31 -171
  26. package/dist/loader.cjs.map +1 -1
  27. package/dist/loader.d.cts +23 -37
  28. package/dist/loader.d.ts +23 -37
  29. package/dist/loader.js +31 -171
  30. package/dist/loader.js.map +1 -1
  31. package/dist/lorebook.d.cts +23 -23
  32. package/dist/lorebook.d.ts +23 -23
  33. package/dist/normalizer.cjs +18 -72
  34. package/dist/normalizer.cjs.map +1 -1
  35. package/dist/normalizer.d.cts +37 -37
  36. package/dist/normalizer.d.ts +37 -37
  37. package/dist/normalizer.js +18 -72
  38. package/dist/normalizer.js.map +1 -1
  39. package/dist/png.cjs +18 -72
  40. package/dist/png.cjs.map +1 -1
  41. package/dist/png.d.cts +25 -25
  42. package/dist/png.d.ts +25 -25
  43. package/dist/png.js +18 -72
  44. package/dist/png.js.map +1 -1
  45. package/dist/schemas.cjs +23 -80
  46. package/dist/schemas.cjs.map +1 -1
  47. package/dist/schemas.d.cts +67 -85
  48. package/dist/schemas.d.ts +67 -85
  49. package/dist/schemas.js +23 -80
  50. package/dist/schemas.js.map +1 -1
  51. package/dist/voxta.cjs +20 -91
  52. package/dist/voxta.cjs.map +1 -1
  53. package/dist/voxta.d.cts +23 -23
  54. package/dist/voxta.d.ts +23 -23
  55. package/dist/voxta.js +20 -91
  56. package/dist/voxta.js.map +1 -1
  57. package/package.json +5 -5
package/dist/schemas.d.ts CHANGED
@@ -142,14 +142,13 @@ export declare const CCv3LorebookEntrySchema: z.ZodObject<{
142
142
  ]>>;
143
143
  }, z.ZodTypeAny, "passthrough">>;
144
144
  /**
145
- * Character book (lorebook) schema for v3 cards.
146
- * Uses preprocessing for numeric fields that often come as strings in wild data.
145
+ * Character book (lorebook) schema for v3 cards
147
146
  */
148
147
  export declare const CCv3CharacterBookSchema: z.ZodObject<{
149
148
  name: z.ZodOptional<z.ZodString>;
150
149
  description: z.ZodOptional<z.ZodString>;
151
- scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
152
- token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
150
+ scan_depth: z.ZodOptional<z.ZodNumber>;
151
+ token_budget: z.ZodOptional<z.ZodNumber>;
153
152
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
154
153
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
155
154
  entries: z.ZodArray<z.ZodObject<{
@@ -385,8 +384,8 @@ export declare const CCv3CharacterBookSchema: z.ZodObject<{
385
384
  }, z.ZodTypeAny, "passthrough">[];
386
385
  name?: string | undefined;
387
386
  description?: string | undefined;
388
- scan_depth?: unknown;
389
- token_budget?: unknown;
387
+ scan_depth?: number | undefined;
388
+ token_budget?: number | undefined;
390
389
  recursive_scanning?: boolean | undefined;
391
390
  extensions?: Record<string, unknown> | undefined;
392
391
  }>;
@@ -415,8 +414,8 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
415
414
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
416
415
  name: z.ZodOptional<z.ZodString>;
417
416
  description: z.ZodOptional<z.ZodString>;
418
- scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
419
- token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
417
+ scan_depth: z.ZodOptional<z.ZodNumber>;
418
+ token_budget: z.ZodOptional<z.ZodNumber>;
420
419
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
421
420
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
422
421
  entries: z.ZodArray<z.ZodObject<{
@@ -652,14 +651,14 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
652
651
  }, z.ZodTypeAny, "passthrough">[];
653
652
  name?: string | undefined;
654
653
  description?: string | undefined;
655
- scan_depth?: unknown;
656
- token_budget?: unknown;
654
+ scan_depth?: number | undefined;
655
+ token_budget?: number | undefined;
657
656
  recursive_scanning?: boolean | undefined;
658
657
  extensions?: Record<string, unknown> | undefined;
659
658
  }>>>;
660
659
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
661
660
  assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
662
- type: z.ZodEffects<z.ZodEnum<[
661
+ type: z.ZodEnum<[
663
662
  "icon",
664
663
  "background",
665
664
  "emotion",
@@ -668,7 +667,7 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
668
667
  "video",
669
668
  "custom",
670
669
  "x-risu-asset"
671
- ]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
670
+ ]>;
672
671
  uri: z.ZodString;
673
672
  name: z.ZodString;
674
673
  ext: z.ZodString;
@@ -679,15 +678,15 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
679
678
  ext: string;
680
679
  }, {
681
680
  name: string;
681
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
682
682
  uri: string;
683
683
  ext: string;
684
- type?: unknown;
685
684
  }>, "many">>;
686
685
  nickname: z.ZodOptional<z.ZodString>;
687
686
  creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
688
687
  source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
689
- creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
690
- modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
688
+ creation_date: z.ZodOptional<z.ZodNumber>;
689
+ modification_date: z.ZodOptional<z.ZodNumber>;
691
690
  }, "strip", z.ZodTypeAny, {
692
691
  name: string;
693
692
  description: string;
@@ -828,8 +827,8 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
828
827
  }, z.ZodTypeAny, "passthrough">[];
829
828
  name?: string | undefined;
830
829
  description?: string | undefined;
831
- scan_depth?: unknown;
832
- token_budget?: unknown;
830
+ scan_depth?: number | undefined;
831
+ token_budget?: number | undefined;
833
832
  recursive_scanning?: boolean | undefined;
834
833
  extensions?: Record<string, unknown> | undefined;
835
834
  } | null | undefined;
@@ -839,15 +838,15 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
839
838
  group_only_greetings?: string[] | undefined;
840
839
  assets?: {
841
840
  name: string;
841
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
842
842
  uri: string;
843
843
  ext: string;
844
- type?: unknown;
845
844
  }[] | undefined;
846
845
  nickname?: string | undefined;
847
846
  creator_notes_multilingual?: Record<string, string> | undefined;
848
847
  source?: string[] | undefined;
849
- creation_date?: unknown;
850
- modification_date?: unknown;
848
+ creation_date?: number | undefined;
849
+ modification_date?: number | undefined;
851
850
  }>;
852
851
  /**
853
852
  * Character Card v3 full structure schema
@@ -873,8 +872,8 @@ export declare const CCv3DataSchema: z.ZodObject<{
873
872
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
874
873
  name: z.ZodOptional<z.ZodString>;
875
874
  description: z.ZodOptional<z.ZodString>;
876
- scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
877
- token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
875
+ scan_depth: z.ZodOptional<z.ZodNumber>;
876
+ token_budget: z.ZodOptional<z.ZodNumber>;
878
877
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
879
878
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
880
879
  entries: z.ZodArray<z.ZodObject<{
@@ -1110,14 +1109,14 @@ export declare const CCv3DataSchema: z.ZodObject<{
1110
1109
  }, z.ZodTypeAny, "passthrough">[];
1111
1110
  name?: string | undefined;
1112
1111
  description?: string | undefined;
1113
- scan_depth?: unknown;
1114
- token_budget?: unknown;
1112
+ scan_depth?: number | undefined;
1113
+ token_budget?: number | undefined;
1115
1114
  recursive_scanning?: boolean | undefined;
1116
1115
  extensions?: Record<string, unknown> | undefined;
1117
1116
  }>>>;
1118
1117
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1119
1118
  assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
1120
- type: z.ZodEffects<z.ZodEnum<[
1119
+ type: z.ZodEnum<[
1121
1120
  "icon",
1122
1121
  "background",
1123
1122
  "emotion",
@@ -1126,7 +1125,7 @@ export declare const CCv3DataSchema: z.ZodObject<{
1126
1125
  "video",
1127
1126
  "custom",
1128
1127
  "x-risu-asset"
1129
- ]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
1128
+ ]>;
1130
1129
  uri: z.ZodString;
1131
1130
  name: z.ZodString;
1132
1131
  ext: z.ZodString;
@@ -1137,15 +1136,15 @@ export declare const CCv3DataSchema: z.ZodObject<{
1137
1136
  ext: string;
1138
1137
  }, {
1139
1138
  name: string;
1139
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
1140
1140
  uri: string;
1141
1141
  ext: string;
1142
- type?: unknown;
1143
1142
  }>, "many">>;
1144
1143
  nickname: z.ZodOptional<z.ZodString>;
1145
1144
  creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1146
1145
  source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1147
- creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1148
- modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1146
+ creation_date: z.ZodOptional<z.ZodNumber>;
1147
+ modification_date: z.ZodOptional<z.ZodNumber>;
1149
1148
  }, "strip", z.ZodTypeAny, {
1150
1149
  name: string;
1151
1150
  description: string;
@@ -1286,8 +1285,8 @@ export declare const CCv3DataSchema: z.ZodObject<{
1286
1285
  }, z.ZodTypeAny, "passthrough">[];
1287
1286
  name?: string | undefined;
1288
1287
  description?: string | undefined;
1289
- scan_depth?: unknown;
1290
- token_budget?: unknown;
1288
+ scan_depth?: number | undefined;
1289
+ token_budget?: number | undefined;
1291
1290
  recursive_scanning?: boolean | undefined;
1292
1291
  extensions?: Record<string, unknown> | undefined;
1293
1292
  } | null | undefined;
@@ -1297,15 +1296,15 @@ export declare const CCv3DataSchema: z.ZodObject<{
1297
1296
  group_only_greetings?: string[] | undefined;
1298
1297
  assets?: {
1299
1298
  name: string;
1299
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
1300
1300
  uri: string;
1301
1301
  ext: string;
1302
- type?: unknown;
1303
1302
  }[] | undefined;
1304
1303
  nickname?: string | undefined;
1305
1304
  creator_notes_multilingual?: Record<string, string> | undefined;
1306
1305
  source?: string[] | undefined;
1307
- creation_date?: unknown;
1308
- modification_date?: unknown;
1306
+ creation_date?: number | undefined;
1307
+ modification_date?: number | undefined;
1309
1308
  }>;
1310
1309
  }, "strip", z.ZodTypeAny, {
1311
1310
  data: {
@@ -1452,8 +1451,8 @@ export declare const CCv3DataSchema: z.ZodObject<{
1452
1451
  }, z.ZodTypeAny, "passthrough">[];
1453
1452
  name?: string | undefined;
1454
1453
  description?: string | undefined;
1455
- scan_depth?: unknown;
1456
- token_budget?: unknown;
1454
+ scan_depth?: number | undefined;
1455
+ token_budget?: number | undefined;
1457
1456
  recursive_scanning?: boolean | undefined;
1458
1457
  extensions?: Record<string, unknown> | undefined;
1459
1458
  } | null | undefined;
@@ -1463,15 +1462,15 @@ export declare const CCv3DataSchema: z.ZodObject<{
1463
1462
  group_only_greetings?: string[] | undefined;
1464
1463
  assets?: {
1465
1464
  name: string;
1465
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
1466
1466
  uri: string;
1467
1467
  ext: string;
1468
- type?: unknown;
1469
1468
  }[] | undefined;
1470
1469
  nickname?: string | undefined;
1471
1470
  creator_notes_multilingual?: Record<string, string> | undefined;
1472
1471
  source?: string[] | undefined;
1473
- creation_date?: unknown;
1474
- modification_date?: unknown;
1472
+ creation_date?: number | undefined;
1473
+ modification_date?: number | undefined;
1475
1474
  };
1476
1475
  spec: "chara_card_v3";
1477
1476
  spec_version: "3.0";
@@ -1521,21 +1520,6 @@ export declare function looksLikeV3Card(data: unknown): data is {
1521
1520
  *
1522
1521
  * Shared types used across all card formats.
1523
1522
  */
1524
- /**
1525
- * Preprocess timestamp values to Unix seconds.
1526
- * Handles: ISO strings, numeric strings, milliseconds, and numbers.
1527
- * Returns undefined for invalid/negative values (defensive).
1528
- */
1529
- export declare function preprocessTimestamp(val: unknown): number | undefined;
1530
- /**
1531
- * Preprocess numeric values that may come as strings.
1532
- * Returns undefined for invalid values.
1533
- */
1534
- export declare function preprocessNumeric(val: unknown): number | undefined;
1535
- /**
1536
- * Preprocess asset type - coerce unknown types to 'custom'.
1537
- */
1538
- export declare function preprocessAssetType(val: unknown): string;
1539
1523
  /**
1540
1524
  * ISO 8601 date string schema
1541
1525
  */
@@ -1573,10 +1557,9 @@ export declare const OriginalShapeSchema: z.ZodEnum<[
1573
1557
  "legacy"
1574
1558
  ]>;
1575
1559
  /**
1576
- * Asset type identifier schema.
1577
- * Uses preprocessing to coerce unknown types to 'custom' for forward compatibility.
1560
+ * Asset type identifier schema
1578
1561
  */
1579
- export declare const AssetTypeSchema: z.ZodEffects<z.ZodEnum<[
1562
+ export declare const AssetTypeSchema: z.ZodEnum<[
1580
1563
  "icon",
1581
1564
  "background",
1582
1565
  "emotion",
@@ -1585,12 +1568,12 @@ export declare const AssetTypeSchema: z.ZodEffects<z.ZodEnum<[
1585
1568
  "video",
1586
1569
  "custom",
1587
1570
  "x-risu-asset"
1588
- ]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
1571
+ ]>;
1589
1572
  /**
1590
1573
  * Asset descriptor schema (v3 spec)
1591
1574
  */
1592
1575
  export declare const AssetDescriptorSchema: z.ZodObject<{
1593
- type: z.ZodEffects<z.ZodEnum<[
1576
+ type: z.ZodEnum<[
1594
1577
  "icon",
1595
1578
  "background",
1596
1579
  "emotion",
@@ -1599,7 +1582,7 @@ export declare const AssetDescriptorSchema: z.ZodObject<{
1599
1582
  "video",
1600
1583
  "custom",
1601
1584
  "x-risu-asset"
1602
- ]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
1585
+ ]>;
1603
1586
  uri: z.ZodString;
1604
1587
  name: z.ZodString;
1605
1588
  ext: z.ZodString;
@@ -1610,16 +1593,16 @@ export declare const AssetDescriptorSchema: z.ZodObject<{
1610
1593
  ext: string;
1611
1594
  }, {
1612
1595
  name: string;
1596
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
1613
1597
  uri: string;
1614
1598
  ext: string;
1615
- type?: unknown;
1616
1599
  }>;
1617
1600
  /**
1618
1601
  * Extracted asset with binary data schema
1619
1602
  */
1620
1603
  export declare const ExtractedAssetSchema: z.ZodObject<{
1621
1604
  descriptor: z.ZodObject<{
1622
- type: z.ZodEffects<z.ZodEnum<[
1605
+ type: z.ZodEnum<[
1623
1606
  "icon",
1624
1607
  "background",
1625
1608
  "emotion",
@@ -1628,7 +1611,7 @@ export declare const ExtractedAssetSchema: z.ZodObject<{
1628
1611
  "video",
1629
1612
  "custom",
1630
1613
  "x-risu-asset"
1631
- ]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
1614
+ ]>;
1632
1615
  uri: z.ZodString;
1633
1616
  name: z.ZodString;
1634
1617
  ext: z.ZodString;
@@ -1639,9 +1622,9 @@ export declare const ExtractedAssetSchema: z.ZodObject<{
1639
1622
  ext: string;
1640
1623
  }, {
1641
1624
  name: string;
1625
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
1642
1626
  uri: string;
1643
1627
  ext: string;
1644
- type?: unknown;
1645
1628
  }>;
1646
1629
  data: z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>;
1647
1630
  mimeType: z.ZodString;
@@ -1657,9 +1640,9 @@ export declare const ExtractedAssetSchema: z.ZodObject<{
1657
1640
  }, {
1658
1641
  descriptor: {
1659
1642
  name: string;
1643
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
1660
1644
  uri: string;
1661
1645
  ext: string;
1662
- type?: unknown;
1663
1646
  };
1664
1647
  data: Uint8Array<ArrayBuffer>;
1665
1648
  mimeType: string;
@@ -1775,14 +1758,13 @@ export declare const CCv2LorebookEntrySchema: z.ZodObject<{
1775
1758
  ]>>>;
1776
1759
  }, z.ZodTypeAny, "passthrough">>;
1777
1760
  /**
1778
- * Character book (lorebook) schema for v2 cards.
1779
- * Uses preprocessing for numeric fields that often come as strings in wild data.
1761
+ * Character book (lorebook) schema for v2 cards
1780
1762
  */
1781
1763
  export declare const CCv2CharacterBookSchema: z.ZodObject<{
1782
1764
  name: z.ZodOptional<z.ZodString>;
1783
1765
  description: z.ZodOptional<z.ZodString>;
1784
- scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1785
- token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1766
+ scan_depth: z.ZodOptional<z.ZodNumber>;
1767
+ token_budget: z.ZodOptional<z.ZodNumber>;
1786
1768
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
1787
1769
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1788
1770
  entries: z.ZodArray<z.ZodObject<{
@@ -1913,8 +1895,8 @@ export declare const CCv2CharacterBookSchema: z.ZodObject<{
1913
1895
  }, z.ZodTypeAny, "passthrough">[];
1914
1896
  name?: string | undefined;
1915
1897
  description?: string | undefined;
1916
- scan_depth?: unknown;
1917
- token_budget?: unknown;
1898
+ scan_depth?: number | undefined;
1899
+ token_budget?: number | undefined;
1918
1900
  recursive_scanning?: boolean | undefined;
1919
1901
  extensions?: Record<string, unknown> | undefined;
1920
1902
  }>;
@@ -1935,8 +1917,8 @@ export declare const CCv2DataSchema: z.ZodObject<{
1935
1917
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
1936
1918
  name: z.ZodOptional<z.ZodString>;
1937
1919
  description: z.ZodOptional<z.ZodString>;
1938
- scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1939
- token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1920
+ scan_depth: z.ZodOptional<z.ZodNumber>;
1921
+ token_budget: z.ZodOptional<z.ZodNumber>;
1940
1922
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
1941
1923
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1942
1924
  entries: z.ZodArray<z.ZodObject<{
@@ -2067,8 +2049,8 @@ export declare const CCv2DataSchema: z.ZodObject<{
2067
2049
  }, z.ZodTypeAny, "passthrough">[];
2068
2050
  name?: string | undefined;
2069
2051
  description?: string | undefined;
2070
- scan_depth?: unknown;
2071
- token_budget?: unknown;
2052
+ scan_depth?: number | undefined;
2053
+ token_budget?: number | undefined;
2072
2054
  recursive_scanning?: boolean | undefined;
2073
2055
  extensions?: Record<string, unknown> | undefined;
2074
2056
  }>>>;
@@ -2162,8 +2144,8 @@ export declare const CCv2DataSchema: z.ZodObject<{
2162
2144
  }, z.ZodTypeAny, "passthrough">[];
2163
2145
  name?: string | undefined;
2164
2146
  description?: string | undefined;
2165
- scan_depth?: unknown;
2166
- token_budget?: unknown;
2147
+ scan_depth?: number | undefined;
2148
+ token_budget?: number | undefined;
2167
2149
  recursive_scanning?: boolean | undefined;
2168
2150
  extensions?: Record<string, unknown> | undefined;
2169
2151
  } | null | undefined;
@@ -2191,8 +2173,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
2191
2173
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
2192
2174
  name: z.ZodOptional<z.ZodString>;
2193
2175
  description: z.ZodOptional<z.ZodString>;
2194
- scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
2195
- token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
2176
+ scan_depth: z.ZodOptional<z.ZodNumber>;
2177
+ token_budget: z.ZodOptional<z.ZodNumber>;
2196
2178
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
2197
2179
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2198
2180
  entries: z.ZodArray<z.ZodObject<{
@@ -2323,8 +2305,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
2323
2305
  }, z.ZodTypeAny, "passthrough">[];
2324
2306
  name?: string | undefined;
2325
2307
  description?: string | undefined;
2326
- scan_depth?: unknown;
2327
- token_budget?: unknown;
2308
+ scan_depth?: number | undefined;
2309
+ token_budget?: number | undefined;
2328
2310
  recursive_scanning?: boolean | undefined;
2329
2311
  extensions?: Record<string, unknown> | undefined;
2330
2312
  }>>>;
@@ -2418,8 +2400,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
2418
2400
  }, z.ZodTypeAny, "passthrough">[];
2419
2401
  name?: string | undefined;
2420
2402
  description?: string | undefined;
2421
- scan_depth?: unknown;
2422
- token_budget?: unknown;
2403
+ scan_depth?: number | undefined;
2404
+ token_budget?: number | undefined;
2423
2405
  recursive_scanning?: boolean | undefined;
2424
2406
  extensions?: Record<string, unknown> | undefined;
2425
2407
  } | null | undefined;
@@ -2518,8 +2500,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
2518
2500
  }, z.ZodTypeAny, "passthrough">[];
2519
2501
  name?: string | undefined;
2520
2502
  description?: string | undefined;
2521
- scan_depth?: unknown;
2522
- token_budget?: unknown;
2503
+ scan_depth?: number | undefined;
2504
+ token_budget?: number | undefined;
2523
2505
  recursive_scanning?: boolean | undefined;
2524
2506
  extensions?: Record<string, unknown> | undefined;
2525
2507
  } | null | undefined;
package/dist/schemas.js CHANGED
@@ -3,58 +3,6 @@ import { z } from "zod";
3
3
  import { z as z2 } from "zod";
4
4
  import { z as z3 } from "zod";
5
5
  import "zod";
6
- function preprocessTimestamp(val) {
7
- if (val === null || val === void 0) return void 0;
8
- let num;
9
- if (typeof val === "number") {
10
- num = val;
11
- } else if (typeof val === "string") {
12
- const trimmed = val.trim();
13
- if (!trimmed) return void 0;
14
- const parsed = Number(trimmed);
15
- if (!isNaN(parsed)) {
16
- num = parsed;
17
- } else {
18
- const date = new Date(trimmed);
19
- if (isNaN(date.getTime())) return void 0;
20
- num = Math.floor(date.getTime() / 1e3);
21
- }
22
- } else {
23
- return void 0;
24
- }
25
- if (num > 1e10) {
26
- num = Math.floor(num / 1e3);
27
- }
28
- if (num < 0) return void 0;
29
- return num;
30
- }
31
- function preprocessNumeric(val) {
32
- if (val === null || val === void 0) return void 0;
33
- if (typeof val === "number") {
34
- return isNaN(val) ? void 0 : val;
35
- }
36
- if (typeof val === "string") {
37
- const trimmed = val.trim();
38
- if (!trimmed) return void 0;
39
- const parsed = Number(trimmed);
40
- return isNaN(parsed) ? void 0 : parsed;
41
- }
42
- return void 0;
43
- }
44
- var KNOWN_ASSET_TYPES = /* @__PURE__ */ new Set([
45
- "icon",
46
- "background",
47
- "emotion",
48
- "user_icon",
49
- "sound",
50
- "video",
51
- "custom",
52
- "x-risu-asset"
53
- ]);
54
- function preprocessAssetType(val) {
55
- if (typeof val !== "string") return "custom";
56
- return KNOWN_ASSET_TYPES.has(val) ? val : "custom";
57
- }
58
6
  var ISO8601Schema = z.string().datetime();
59
7
  var UUIDSchema = z.string().uuid();
60
8
  var SpecSchema = z.enum(["v2", "v3"]);
@@ -77,19 +25,16 @@ var SourceFormatSchema = z.enum([
77
25
  // VoxPkg format
78
26
  ]);
79
27
  var OriginalShapeSchema = z.enum(["wrapped", "unwrapped", "legacy"]);
80
- var AssetTypeSchema = z.preprocess(
81
- preprocessAssetType,
82
- z.enum([
83
- "icon",
84
- "background",
85
- "emotion",
86
- "user_icon",
87
- "sound",
88
- "video",
89
- "custom",
90
- "x-risu-asset"
91
- ])
92
- );
28
+ var AssetTypeSchema = z.enum([
29
+ "icon",
30
+ "background",
31
+ "emotion",
32
+ "user_icon",
33
+ "sound",
34
+ "video",
35
+ "custom",
36
+ "x-risu-asset"
37
+ ]);
93
38
  var AssetDescriptorSchema = z.object({
94
39
  type: AssetTypeSchema,
95
40
  uri: z.string(),
@@ -123,8 +68,8 @@ var CCv2LorebookEntrySchema = z2.object({
123
68
  var CCv2CharacterBookSchema = z2.object({
124
69
  name: z2.string().optional(),
125
70
  description: z2.string().optional(),
126
- scan_depth: z2.preprocess(preprocessNumeric, z2.number().int().nonnegative().optional()),
127
- token_budget: z2.preprocess(preprocessNumeric, z2.number().int().nonnegative().optional()),
71
+ scan_depth: z2.number().int().nonnegative().optional(),
72
+ token_budget: z2.number().int().nonnegative().optional(),
128
73
  recursive_scanning: z2.boolean().optional(),
129
74
  extensions: z2.record(z2.unknown()).optional(),
130
75
  entries: z2.array(CCv2LorebookEntrySchema)
@@ -210,8 +155,8 @@ var CCv3LorebookEntrySchema = z3.object({
210
155
  var CCv3CharacterBookSchema = z3.object({
211
156
  name: z3.string().optional(),
212
157
  description: z3.string().optional(),
213
- scan_depth: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
214
- token_budget: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
158
+ scan_depth: z3.number().int().nonnegative().optional(),
159
+ token_budget: z3.number().int().nonnegative().optional(),
215
160
  recursive_scanning: z3.boolean().optional(),
216
161
  extensions: z3.record(z3.unknown()).optional(),
217
162
  entries: z3.array(CCv3LorebookEntrySchema)
@@ -243,9 +188,10 @@ var CCv3DataInnerSchema = z3.object({
243
188
  nickname: z3.string().optional(),
244
189
  creator_notes_multilingual: z3.record(z3.string()).optional(),
245
190
  source: z3.array(z3.string()).optional(),
246
- // Unix timestamps - preprocess to handle ISO strings, numeric strings, milliseconds
247
- creation_date: z3.preprocess(preprocessTimestamp, z3.number().int().nonnegative().optional()),
248
- modification_date: z3.preprocess(preprocessTimestamp, z3.number().int().nonnegative().optional())
191
+ creation_date: z3.number().int().nonnegative().optional(),
192
+ // Unix timestamp in seconds
193
+ modification_date: z3.number().int().nonnegative().optional()
194
+ // Unix timestamp in seconds
249
195
  });
250
196
  var CCv3DataSchema = z3.object({
251
197
  spec: z3.literal("chara_card_v3"),
@@ -689,7 +635,7 @@ var CardNormalizer = {
689
635
  delete mergedData.character_book;
690
636
  }
691
637
  if (mergedData.character_book && typeof mergedData.character_book === "object") {
692
- mergedData.character_book = CardNormalizer.normalizeCharacterBook(
638
+ mergedData.character_book = this.normalizeCharacterBook(
693
639
  mergedData.character_book,
694
640
  spec
695
641
  );
@@ -714,7 +660,7 @@ var CardNormalizer = {
714
660
  if (spec === "v3") {
715
661
  result.spec = "chara_card_v3";
716
662
  result.spec_version = "3.0";
717
- result.data = CardNormalizer.fixTimestampsInner(mergedData);
663
+ result.data = this.fixTimestampsInner(mergedData);
718
664
  } else {
719
665
  result.spec = "chara_card_v2";
720
666
  result.spec_version = "2.0";
@@ -745,7 +691,7 @@ var CardNormalizer = {
745
691
  if (book.extensions !== void 0) result.extensions = deepClone(book.extensions);
746
692
  const entries = Array.isArray(book.entries) ? book.entries : [];
747
693
  result.entries = entries.map(
748
- (entry) => CardNormalizer.normalizeEntry(entry, spec)
694
+ (entry) => this.normalizeEntry(entry, spec)
749
695
  );
750
696
  return result;
751
697
  },
@@ -816,7 +762,7 @@ var CardNormalizer = {
816
762
  */
817
763
  fixTimestamps(data) {
818
764
  const result = deepClone(data);
819
- result.data = CardNormalizer.fixTimestampsInner(
765
+ result.data = this.fixTimestampsInner(
820
766
  result.data
821
767
  );
822
768
  return result;
@@ -854,7 +800,7 @@ var CardNormalizer = {
854
800
  const spec = detectSpec(data);
855
801
  if (!spec) return null;
856
802
  const targetSpec = spec === "v3" ? "v3" : "v2";
857
- return CardNormalizer.normalize(data, targetSpec);
803
+ return this.normalize(data, targetSpec);
858
804
  }
859
805
  };
860
806
  function zodErrorToMessage(zodError, context) {
@@ -919,9 +865,6 @@ export {
919
865
  parseV3Card,
920
866
  parseV3DataInner,
921
867
  parseWrappedV2,
922
- preprocessAssetType,
923
- preprocessNumeric,
924
- preprocessTimestamp,
925
868
  safeParse,
926
869
  zodErrorToMessage
927
870
  };