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

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 +87 -54
  2. package/dist/charx.cjs.map +1 -1
  3. package/dist/charx.d.cts +40 -31
  4. package/dist/charx.d.ts +40 -31
  5. package/dist/charx.js +87 -54
  6. package/dist/charx.js.map +1 -1
  7. package/dist/exporter.cjs +106 -56
  8. package/dist/exporter.cjs.map +1 -1
  9. package/dist/exporter.d.cts +37 -28
  10. package/dist/exporter.d.ts +37 -28
  11. package/dist/exporter.js +106 -56
  12. package/dist/exporter.js.map +1 -1
  13. package/dist/federation.cjs +104 -36
  14. package/dist/federation.cjs.map +1 -1
  15. package/dist/federation.d.cts +72 -28
  16. package/dist/federation.d.ts +72 -28
  17. package/dist/federation.js +104 -36
  18. package/dist/federation.js.map +1 -1
  19. package/dist/index.cjs +106 -56
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +71 -50
  22. package/dist/index.d.ts +71 -50
  23. package/dist/index.js +106 -56
  24. package/dist/index.js.map +1 -1
  25. package/dist/loader.cjs +173 -33
  26. package/dist/loader.cjs.map +1 -1
  27. package/dist/loader.d.cts +65 -37
  28. package/dist/loader.d.ts +65 -37
  29. package/dist/loader.js +173 -33
  30. package/dist/loader.js.map +1 -1
  31. package/dist/lorebook.d.cts +57 -40
  32. package/dist/lorebook.d.ts +57 -40
  33. package/dist/normalizer.cjs +74 -20
  34. package/dist/normalizer.cjs.map +1 -1
  35. package/dist/normalizer.d.cts +97 -67
  36. package/dist/normalizer.d.ts +97 -67
  37. package/dist/normalizer.js +74 -20
  38. package/dist/normalizer.js.map +1 -1
  39. package/dist/png.cjs +74 -20
  40. package/dist/png.cjs.map +1 -1
  41. package/dist/png.d.cts +57 -41
  42. package/dist/png.d.ts +57 -41
  43. package/dist/png.js +74 -20
  44. package/dist/png.js.map +1 -1
  45. package/dist/schemas.cjs +82 -25
  46. package/dist/schemas.cjs.map +1 -1
  47. package/dist/schemas.d.cts +181 -115
  48. package/dist/schemas.d.ts +181 -115
  49. package/dist/schemas.js +82 -25
  50. package/dist/schemas.js.map +1 -1
  51. package/dist/voxta.cjs +93 -22
  52. package/dist/voxta.cjs.map +1 -1
  53. package/dist/voxta.d.cts +51 -37
  54. package/dist/voxta.d.ts +51 -37
  55. package/dist/voxta.js +93 -22
  56. package/dist/voxta.js.map +1 -1
  57. package/package.json +5 -5
@@ -3,8 +3,8 @@ import { z } from 'zod';
3
3
  declare const CCv3CharacterBookSchema: z.ZodObject<{
4
4
  name: z.ZodOptional<z.ZodString>;
5
5
  description: z.ZodOptional<z.ZodString>;
6
- scan_depth: z.ZodOptional<z.ZodNumber>;
7
- token_budget: z.ZodOptional<z.ZodNumber>;
6
+ scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
7
+ token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
8
8
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
9
9
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
10
  entries: z.ZodArray<z.ZodObject<{
@@ -23,7 +23,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
23
23
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
24
24
  z.ZodEnum<[
25
25
  "before_char",
26
- "after_char"
26
+ "after_char",
27
+ "in_chat"
27
28
  ]>,
28
29
  z.ZodNumber,
29
30
  z.ZodLiteral<"">
@@ -66,7 +67,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
66
67
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
67
68
  z.ZodEnum<[
68
69
  "before_char",
69
- "after_char"
70
+ "after_char",
71
+ "in_chat"
70
72
  ]>,
71
73
  z.ZodNumber,
72
74
  z.ZodLiteral<"">
@@ -109,7 +111,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
109
111
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
110
112
  z.ZodEnum<[
111
113
  "before_char",
112
- "after_char"
114
+ "after_char",
115
+ "in_chat"
113
116
  ]>,
114
117
  z.ZodNumber,
115
118
  z.ZodLiteral<"">
@@ -154,7 +157,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
154
157
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
155
158
  z.ZodEnum<[
156
159
  "before_char",
157
- "after_char"
160
+ "after_char",
161
+ "in_chat"
158
162
  ]>,
159
163
  z.ZodNumber,
160
164
  z.ZodLiteral<"">
@@ -205,7 +209,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
205
209
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
206
210
  z.ZodEnum<[
207
211
  "before_char",
208
- "after_char"
212
+ "after_char",
213
+ "in_chat"
209
214
  ]>,
210
215
  z.ZodNumber,
211
216
  z.ZodLiteral<"">
@@ -235,8 +240,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
235
240
  }, z.ZodTypeAny, "passthrough">[];
236
241
  name?: string | undefined;
237
242
  description?: string | undefined;
238
- scan_depth?: number | undefined;
239
- token_budget?: number | undefined;
243
+ scan_depth?: unknown;
244
+ token_budget?: unknown;
240
245
  recursive_scanning?: boolean | undefined;
241
246
  extensions?: Record<string, unknown> | undefined;
242
247
  }>;
@@ -261,8 +266,8 @@ declare const CCv3DataSchema: z.ZodObject<{
261
266
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
262
267
  name: z.ZodOptional<z.ZodString>;
263
268
  description: z.ZodOptional<z.ZodString>;
264
- scan_depth: z.ZodOptional<z.ZodNumber>;
265
- token_budget: z.ZodOptional<z.ZodNumber>;
269
+ scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
270
+ token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
266
271
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
267
272
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
268
273
  entries: z.ZodArray<z.ZodObject<{
@@ -281,7 +286,8 @@ declare const CCv3DataSchema: z.ZodObject<{
281
286
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
282
287
  z.ZodEnum<[
283
288
  "before_char",
284
- "after_char"
289
+ "after_char",
290
+ "in_chat"
285
291
  ]>,
286
292
  z.ZodNumber,
287
293
  z.ZodLiteral<"">
@@ -324,7 +330,8 @@ declare const CCv3DataSchema: z.ZodObject<{
324
330
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
325
331
  z.ZodEnum<[
326
332
  "before_char",
327
- "after_char"
333
+ "after_char",
334
+ "in_chat"
328
335
  ]>,
329
336
  z.ZodNumber,
330
337
  z.ZodLiteral<"">
@@ -367,7 +374,8 @@ declare const CCv3DataSchema: z.ZodObject<{
367
374
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
368
375
  z.ZodEnum<[
369
376
  "before_char",
370
- "after_char"
377
+ "after_char",
378
+ "in_chat"
371
379
  ]>,
372
380
  z.ZodNumber,
373
381
  z.ZodLiteral<"">
@@ -412,7 +420,8 @@ declare const CCv3DataSchema: z.ZodObject<{
412
420
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
413
421
  z.ZodEnum<[
414
422
  "before_char",
415
- "after_char"
423
+ "after_char",
424
+ "in_chat"
416
425
  ]>,
417
426
  z.ZodNumber,
418
427
  z.ZodLiteral<"">
@@ -463,7 +472,8 @@ declare const CCv3DataSchema: z.ZodObject<{
463
472
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
464
473
  z.ZodEnum<[
465
474
  "before_char",
466
- "after_char"
475
+ "after_char",
476
+ "in_chat"
467
477
  ]>,
468
478
  z.ZodNumber,
469
479
  z.ZodLiteral<"">
@@ -493,14 +503,14 @@ declare const CCv3DataSchema: z.ZodObject<{
493
503
  }, z.ZodTypeAny, "passthrough">[];
494
504
  name?: string | undefined;
495
505
  description?: string | undefined;
496
- scan_depth?: number | undefined;
497
- token_budget?: number | undefined;
506
+ scan_depth?: unknown;
507
+ token_budget?: unknown;
498
508
  recursive_scanning?: boolean | undefined;
499
509
  extensions?: Record<string, unknown> | undefined;
500
510
  }>>>;
501
511
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
502
512
  assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
503
- type: z.ZodEnum<[
513
+ type: z.ZodEffects<z.ZodEnum<[
504
514
  "icon",
505
515
  "background",
506
516
  "emotion",
@@ -509,7 +519,7 @@ declare const CCv3DataSchema: z.ZodObject<{
509
519
  "video",
510
520
  "custom",
511
521
  "x-risu-asset"
512
- ]>;
522
+ ]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
513
523
  uri: z.ZodString;
514
524
  name: z.ZodString;
515
525
  ext: z.ZodString;
@@ -520,15 +530,15 @@ declare const CCv3DataSchema: z.ZodObject<{
520
530
  ext: string;
521
531
  }, {
522
532
  name: string;
523
- type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
524
533
  uri: string;
525
534
  ext: string;
535
+ type?: unknown;
526
536
  }>, "many">>;
527
537
  nickname: z.ZodOptional<z.ZodString>;
528
538
  creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
529
539
  source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
530
- creation_date: z.ZodOptional<z.ZodNumber>;
531
- modification_date: z.ZodOptional<z.ZodNumber>;
540
+ creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
541
+ modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
532
542
  }, "strip", z.ZodTypeAny, {
533
543
  name: string;
534
544
  description: string;
@@ -562,7 +572,8 @@ declare const CCv3DataSchema: z.ZodObject<{
562
572
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
563
573
  z.ZodEnum<[
564
574
  "before_char",
565
- "after_char"
575
+ "after_char",
576
+ "in_chat"
566
577
  ]>,
567
578
  z.ZodNumber,
568
579
  z.ZodLiteral<"">
@@ -637,7 +648,8 @@ declare const CCv3DataSchema: z.ZodObject<{
637
648
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
638
649
  z.ZodEnum<[
639
650
  "before_char",
640
- "after_char"
651
+ "after_char",
652
+ "in_chat"
641
653
  ]>,
642
654
  z.ZodNumber,
643
655
  z.ZodLiteral<"">
@@ -667,8 +679,8 @@ declare const CCv3DataSchema: z.ZodObject<{
667
679
  }, z.ZodTypeAny, "passthrough">[];
668
680
  name?: string | undefined;
669
681
  description?: string | undefined;
670
- scan_depth?: number | undefined;
671
- token_budget?: number | undefined;
682
+ scan_depth?: unknown;
683
+ token_budget?: unknown;
672
684
  recursive_scanning?: boolean | undefined;
673
685
  extensions?: Record<string, unknown> | undefined;
674
686
  } | null | undefined;
@@ -678,15 +690,15 @@ declare const CCv3DataSchema: z.ZodObject<{
678
690
  group_only_greetings?: string[] | undefined;
679
691
  assets?: {
680
692
  name: string;
681
- type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
682
693
  uri: string;
683
694
  ext: string;
695
+ type?: unknown;
684
696
  }[] | undefined;
685
697
  nickname?: string | undefined;
686
698
  creator_notes_multilingual?: Record<string, string> | undefined;
687
699
  source?: string[] | undefined;
688
- creation_date?: number | undefined;
689
- modification_date?: number | undefined;
700
+ creation_date?: unknown;
701
+ modification_date?: unknown;
690
702
  }>;
691
703
  }, "strip", z.ZodTypeAny, {
692
704
  data: {
@@ -722,7 +734,8 @@ declare const CCv3DataSchema: z.ZodObject<{
722
734
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
723
735
  z.ZodEnum<[
724
736
  "before_char",
725
- "after_char"
737
+ "after_char",
738
+ "in_chat"
726
739
  ]>,
727
740
  z.ZodNumber,
728
741
  z.ZodLiteral<"">
@@ -801,7 +814,8 @@ declare const CCv3DataSchema: z.ZodObject<{
801
814
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
802
815
  z.ZodEnum<[
803
816
  "before_char",
804
- "after_char"
817
+ "after_char",
818
+ "in_chat"
805
819
  ]>,
806
820
  z.ZodNumber,
807
821
  z.ZodLiteral<"">
@@ -831,8 +845,8 @@ declare const CCv3DataSchema: z.ZodObject<{
831
845
  }, z.ZodTypeAny, "passthrough">[];
832
846
  name?: string | undefined;
833
847
  description?: string | undefined;
834
- scan_depth?: number | undefined;
835
- token_budget?: number | undefined;
848
+ scan_depth?: unknown;
849
+ token_budget?: unknown;
836
850
  recursive_scanning?: boolean | undefined;
837
851
  extensions?: Record<string, unknown> | undefined;
838
852
  } | null | undefined;
@@ -842,15 +856,15 @@ declare const CCv3DataSchema: z.ZodObject<{
842
856
  group_only_greetings?: string[] | undefined;
843
857
  assets?: {
844
858
  name: string;
845
- type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
846
859
  uri: string;
847
860
  ext: string;
861
+ type?: unknown;
848
862
  }[] | undefined;
849
863
  nickname?: string | undefined;
850
864
  creator_notes_multilingual?: Record<string, string> | undefined;
851
865
  source?: string[] | undefined;
852
- creation_date?: number | undefined;
853
- modification_date?: number | undefined;
866
+ creation_date?: unknown;
867
+ modification_date?: unknown;
854
868
  };
855
869
  spec: "chara_card_v3";
856
870
  spec_version: "3.0";
@@ -877,8 +891,8 @@ declare const CCv2DataSchema: z.ZodObject<{
877
891
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
878
892
  name: z.ZodOptional<z.ZodString>;
879
893
  description: z.ZodOptional<z.ZodString>;
880
- scan_depth: z.ZodOptional<z.ZodNumber>;
881
- token_budget: z.ZodOptional<z.ZodNumber>;
894
+ scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
895
+ token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
882
896
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
883
897
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
884
898
  entries: z.ZodArray<z.ZodObject<{
@@ -898,7 +912,8 @@ declare const CCv2DataSchema: z.ZodObject<{
898
912
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
899
913
  z.ZodEnum<[
900
914
  "before_char",
901
- "after_char"
915
+ "after_char",
916
+ "in_chat"
902
917
  ]>,
903
918
  z.ZodNumber,
904
919
  z.ZodLiteral<"">
@@ -920,7 +935,8 @@ declare const CCv2DataSchema: z.ZodObject<{
920
935
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
921
936
  z.ZodEnum<[
922
937
  "before_char",
923
- "after_char"
938
+ "after_char",
939
+ "in_chat"
924
940
  ]>,
925
941
  z.ZodNumber,
926
942
  z.ZodLiteral<"">
@@ -942,7 +958,8 @@ declare const CCv2DataSchema: z.ZodObject<{
942
958
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
943
959
  z.ZodEnum<[
944
960
  "before_char",
945
- "after_char"
961
+ "after_char",
962
+ "in_chat"
946
963
  ]>,
947
964
  z.ZodNumber,
948
965
  z.ZodLiteral<"">
@@ -966,7 +983,8 @@ declare const CCv2DataSchema: z.ZodObject<{
966
983
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
967
984
  z.ZodEnum<[
968
985
  "before_char",
969
- "after_char"
986
+ "after_char",
987
+ "in_chat"
970
988
  ]>,
971
989
  z.ZodNumber,
972
990
  z.ZodLiteral<"">
@@ -996,7 +1014,8 @@ declare const CCv2DataSchema: z.ZodObject<{
996
1014
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
997
1015
  z.ZodEnum<[
998
1016
  "before_char",
999
- "after_char"
1017
+ "after_char",
1018
+ "in_chat"
1000
1019
  ]>,
1001
1020
  z.ZodNumber,
1002
1021
  z.ZodLiteral<"">
@@ -1004,8 +1023,8 @@ declare const CCv2DataSchema: z.ZodObject<{
1004
1023
  }, z.ZodTypeAny, "passthrough">[];
1005
1024
  name?: string | undefined;
1006
1025
  description?: string | undefined;
1007
- scan_depth?: number | undefined;
1008
- token_budget?: number | undefined;
1026
+ scan_depth?: unknown;
1027
+ token_budget?: unknown;
1009
1028
  recursive_scanning?: boolean | undefined;
1010
1029
  extensions?: Record<string, unknown> | undefined;
1011
1030
  }>>>;
@@ -1043,7 +1062,8 @@ declare const CCv2DataSchema: z.ZodObject<{
1043
1062
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1044
1063
  z.ZodEnum<[
1045
1064
  "before_char",
1046
- "after_char"
1065
+ "after_char",
1066
+ "in_chat"
1047
1067
  ]>,
1048
1068
  z.ZodNumber,
1049
1069
  z.ZodLiteral<"">
@@ -1089,7 +1109,8 @@ declare const CCv2DataSchema: z.ZodObject<{
1089
1109
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1090
1110
  z.ZodEnum<[
1091
1111
  "before_char",
1092
- "after_char"
1112
+ "after_char",
1113
+ "in_chat"
1093
1114
  ]>,
1094
1115
  z.ZodNumber,
1095
1116
  z.ZodLiteral<"">
@@ -1097,8 +1118,8 @@ declare const CCv2DataSchema: z.ZodObject<{
1097
1118
  }, z.ZodTypeAny, "passthrough">[];
1098
1119
  name?: string | undefined;
1099
1120
  description?: string | undefined;
1100
- scan_depth?: number | undefined;
1101
- token_budget?: number | undefined;
1121
+ scan_depth?: unknown;
1122
+ token_budget?: unknown;
1102
1123
  recursive_scanning?: boolean | undefined;
1103
1124
  extensions?: Record<string, unknown> | undefined;
1104
1125
  } | null | undefined;
@@ -1123,8 +1144,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1123
1144
  character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
1124
1145
  name: z.ZodOptional<z.ZodString>;
1125
1146
  description: z.ZodOptional<z.ZodString>;
1126
- scan_depth: z.ZodOptional<z.ZodNumber>;
1127
- token_budget: z.ZodOptional<z.ZodNumber>;
1147
+ scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1148
+ token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
1128
1149
  recursive_scanning: z.ZodOptional<z.ZodBoolean>;
1129
1150
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1130
1151
  entries: z.ZodArray<z.ZodObject<{
@@ -1144,7 +1165,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1144
1165
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1145
1166
  z.ZodEnum<[
1146
1167
  "before_char",
1147
- "after_char"
1168
+ "after_char",
1169
+ "in_chat"
1148
1170
  ]>,
1149
1171
  z.ZodNumber,
1150
1172
  z.ZodLiteral<"">
@@ -1166,7 +1188,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1166
1188
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1167
1189
  z.ZodEnum<[
1168
1190
  "before_char",
1169
- "after_char"
1191
+ "after_char",
1192
+ "in_chat"
1170
1193
  ]>,
1171
1194
  z.ZodNumber,
1172
1195
  z.ZodLiteral<"">
@@ -1188,7 +1211,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1188
1211
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1189
1212
  z.ZodEnum<[
1190
1213
  "before_char",
1191
- "after_char"
1214
+ "after_char",
1215
+ "in_chat"
1192
1216
  ]>,
1193
1217
  z.ZodNumber,
1194
1218
  z.ZodLiteral<"">
@@ -1212,7 +1236,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1212
1236
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1213
1237
  z.ZodEnum<[
1214
1238
  "before_char",
1215
- "after_char"
1239
+ "after_char",
1240
+ "in_chat"
1216
1241
  ]>,
1217
1242
  z.ZodNumber,
1218
1243
  z.ZodLiteral<"">
@@ -1242,7 +1267,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1242
1267
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1243
1268
  z.ZodEnum<[
1244
1269
  "before_char",
1245
- "after_char"
1270
+ "after_char",
1271
+ "in_chat"
1246
1272
  ]>,
1247
1273
  z.ZodNumber,
1248
1274
  z.ZodLiteral<"">
@@ -1250,8 +1276,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1250
1276
  }, z.ZodTypeAny, "passthrough">[];
1251
1277
  name?: string | undefined;
1252
1278
  description?: string | undefined;
1253
- scan_depth?: number | undefined;
1254
- token_budget?: number | undefined;
1279
+ scan_depth?: unknown;
1280
+ token_budget?: unknown;
1255
1281
  recursive_scanning?: boolean | undefined;
1256
1282
  extensions?: Record<string, unknown> | undefined;
1257
1283
  }>>>;
@@ -1289,7 +1315,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1289
1315
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1290
1316
  z.ZodEnum<[
1291
1317
  "before_char",
1292
- "after_char"
1318
+ "after_char",
1319
+ "in_chat"
1293
1320
  ]>,
1294
1321
  z.ZodNumber,
1295
1322
  z.ZodLiteral<"">
@@ -1335,7 +1362,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1335
1362
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1336
1363
  z.ZodEnum<[
1337
1364
  "before_char",
1338
- "after_char"
1365
+ "after_char",
1366
+ "in_chat"
1339
1367
  ]>,
1340
1368
  z.ZodNumber,
1341
1369
  z.ZodLiteral<"">
@@ -1343,8 +1371,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1343
1371
  }, z.ZodTypeAny, "passthrough">[];
1344
1372
  name?: string | undefined;
1345
1373
  description?: string | undefined;
1346
- scan_depth?: number | undefined;
1347
- token_budget?: number | undefined;
1374
+ scan_depth?: unknown;
1375
+ token_budget?: unknown;
1348
1376
  recursive_scanning?: boolean | undefined;
1349
1377
  extensions?: Record<string, unknown> | undefined;
1350
1378
  } | null | undefined;
@@ -1383,7 +1411,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1383
1411
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1384
1412
  z.ZodEnum<[
1385
1413
  "before_char",
1386
- "after_char"
1414
+ "after_char",
1415
+ "in_chat"
1387
1416
  ]>,
1388
1417
  z.ZodNumber,
1389
1418
  z.ZodLiteral<"">
@@ -1433,7 +1462,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1433
1462
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
1434
1463
  z.ZodEnum<[
1435
1464
  "before_char",
1436
- "after_char"
1465
+ "after_char",
1466
+ "in_chat"
1437
1467
  ]>,
1438
1468
  z.ZodNumber,
1439
1469
  z.ZodLiteral<"">
@@ -1441,8 +1471,8 @@ declare const CCv2WrappedSchema: z.ZodObject<{
1441
1471
  }, z.ZodTypeAny, "passthrough">[];
1442
1472
  name?: string | undefined;
1443
1473
  description?: string | undefined;
1444
- scan_depth?: number | undefined;
1445
- token_budget?: number | undefined;
1474
+ scan_depth?: unknown;
1475
+ token_budget?: unknown;
1446
1476
  recursive_scanning?: boolean | undefined;
1447
1477
  extensions?: Record<string, unknown> | undefined;
1448
1478
  } | null | undefined;
@@ -3,6 +3,58 @@ 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
+ }
6
58
  var ISO8601Schema = z.string().datetime();
7
59
  var UUIDSchema = z.string().uuid();
8
60
  var SpecSchema = z.enum(["v2", "v3"]);
@@ -25,16 +77,19 @@ var SourceFormatSchema = z.enum([
25
77
  // VoxPkg format
26
78
  ]);
27
79
  var OriginalShapeSchema = z.enum(["wrapped", "unwrapped", "legacy"]);
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
- ]);
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
+ );
38
93
  var AssetDescriptorSchema = z.object({
39
94
  type: AssetTypeSchema,
40
95
  uri: z.string(),
@@ -63,13 +118,13 @@ var CCv2LorebookEntrySchema = z2.object({
63
118
  selective: z2.boolean().nullable().optional(),
64
119
  secondary_keys: z2.array(z2.string()).nullable().optional(),
65
120
  constant: z2.boolean().nullable().optional(),
66
- position: z2.union([z2.enum(["before_char", "after_char"]), z2.number().int(), z2.literal("")]).nullable().optional()
121
+ position: z2.union([z2.enum(["before_char", "after_char", "in_chat"]), z2.number().int(), z2.literal("")]).nullable().optional()
67
122
  }).passthrough();
68
123
  var CCv2CharacterBookSchema = z2.object({
69
124
  name: z2.string().optional(),
70
125
  description: z2.string().optional(),
71
- scan_depth: z2.number().int().nonnegative().optional(),
72
- token_budget: z2.number().int().nonnegative().optional(),
126
+ scan_depth: z2.preprocess(preprocessNumeric, z2.number().int().nonnegative().optional()),
127
+ token_budget: z2.preprocess(preprocessNumeric, z2.number().int().nonnegative().optional()),
73
128
  recursive_scanning: z2.boolean().optional(),
74
129
  extensions: z2.record(z2.unknown()).optional(),
75
130
  entries: z2.array(CCv2LorebookEntrySchema)
@@ -130,7 +185,7 @@ var CCv3LorebookEntrySchema = z3.object({
130
185
  selective: z3.boolean().nullable().optional(),
131
186
  secondary_keys: z3.array(z3.string()).nullable().optional(),
132
187
  constant: z3.boolean().nullable().optional(),
133
- position: z3.union([z3.enum(["before_char", "after_char"]), z3.number().int(), z3.literal("")]).nullable().optional(),
188
+ position: z3.union([z3.enum(["before_char", "after_char", "in_chat"]), z3.number().int(), z3.literal("")]).nullable().optional(),
134
189
  extensions: z3.record(z3.unknown()).optional(),
135
190
  // v3 specific - also lenient with types since SillyTavern uses numbers for enums
136
191
  automation_id: z3.string().optional(),
@@ -146,8 +201,8 @@ var CCv3LorebookEntrySchema = z3.object({
146
201
  var CCv3CharacterBookSchema = z3.object({
147
202
  name: z3.string().optional(),
148
203
  description: z3.string().optional(),
149
- scan_depth: z3.number().int().nonnegative().optional(),
150
- token_budget: z3.number().int().nonnegative().optional(),
204
+ scan_depth: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
205
+ token_budget: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
151
206
  recursive_scanning: z3.boolean().optional(),
152
207
  extensions: z3.record(z3.unknown()).optional(),
153
208
  entries: z3.array(CCv3LorebookEntrySchema)
@@ -179,10 +234,9 @@ var CCv3DataInnerSchema = z3.object({
179
234
  nickname: z3.string().optional(),
180
235
  creator_notes_multilingual: z3.record(z3.string()).optional(),
181
236
  source: z3.array(z3.string()).optional(),
182
- creation_date: z3.number().int().nonnegative().optional(),
183
- // Unix timestamp in seconds
184
- modification_date: z3.number().int().nonnegative().optional()
185
- // Unix timestamp in seconds
237
+ // Unix timestamps - preprocess to handle ISO strings, numeric strings, milliseconds
238
+ creation_date: z3.preprocess(preprocessTimestamp, z3.number().int().nonnegative().optional()),
239
+ modification_date: z3.preprocess(preprocessTimestamp, z3.number().int().nonnegative().optional())
186
240
  });
187
241
  var CCv3DataSchema = z3.object({
188
242
  spec: z3.literal("chara_card_v3"),