@character-foundry/character-foundry 0.4.3-dev.1766019473 → 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.
- package/dist/charx.cjs +72 -18
- package/dist/charx.cjs.map +1 -1
- package/dist/charx.d.cts +22 -22
- package/dist/charx.d.ts +22 -22
- package/dist/charx.js +72 -18
- package/dist/charx.js.map +1 -1
- package/dist/exporter.cjs +72 -18
- package/dist/exporter.cjs.map +1 -1
- package/dist/exporter.d.cts +19 -19
- package/dist/exporter.d.ts +19 -19
- package/dist/exporter.js +72 -18
- package/dist/exporter.js.map +1 -1
- package/dist/federation.d.cts +19 -19
- package/dist/federation.d.ts +19 -19
- package/dist/index.cjs +72 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -29
- package/dist/index.d.ts +29 -29
- package/dist/index.js +72 -18
- package/dist/index.js.map +1 -1
- package/dist/loader.cjs +72 -18
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.cts +23 -23
- package/dist/loader.d.ts +23 -23
- package/dist/loader.js +72 -18
- package/dist/loader.js.map +1 -1
- package/dist/lorebook.d.cts +23 -23
- package/dist/lorebook.d.ts +23 -23
- package/dist/normalizer.cjs +72 -18
- package/dist/normalizer.cjs.map +1 -1
- package/dist/normalizer.d.cts +37 -37
- package/dist/normalizer.d.ts +37 -37
- package/dist/normalizer.js +72 -18
- package/dist/normalizer.js.map +1 -1
- package/dist/png.cjs +72 -18
- package/dist/png.cjs.map +1 -1
- package/dist/png.d.cts +25 -25
- package/dist/png.d.ts +25 -25
- package/dist/png.js +72 -18
- package/dist/png.js.map +1 -1
- package/dist/schemas.cjs +75 -18
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.d.cts +85 -67
- package/dist/schemas.d.ts +85 -67
- package/dist/schemas.js +75 -18
- package/dist/schemas.js.map +1 -1
- package/dist/voxta.cjs +72 -18
- package/dist/voxta.cjs.map +1 -1
- package/dist/voxta.d.cts +23 -23
- package/dist/voxta.d.ts +23 -23
- package/dist/voxta.js +72 -18
- package/dist/voxta.js.map +1 -1
- package/package.json +5 -5
package/dist/schemas.d.ts
CHANGED
|
@@ -142,13 +142,14 @@ export declare const CCv3LorebookEntrySchema: z.ZodObject<{
|
|
|
142
142
|
]>>;
|
|
143
143
|
}, z.ZodTypeAny, "passthrough">>;
|
|
144
144
|
/**
|
|
145
|
-
* Character book (lorebook) schema for v3 cards
|
|
145
|
+
* Character book (lorebook) schema for v3 cards.
|
|
146
|
+
* Uses preprocessing for numeric fields that often come as strings in wild data.
|
|
146
147
|
*/
|
|
147
148
|
export declare const CCv3CharacterBookSchema: z.ZodObject<{
|
|
148
149
|
name: z.ZodOptional<z.ZodString>;
|
|
149
150
|
description: z.ZodOptional<z.ZodString>;
|
|
150
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
151
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
152
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
152
153
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
153
154
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
154
155
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -384,8 +385,8 @@ export declare const CCv3CharacterBookSchema: z.ZodObject<{
|
|
|
384
385
|
}, z.ZodTypeAny, "passthrough">[];
|
|
385
386
|
name?: string | undefined;
|
|
386
387
|
description?: string | undefined;
|
|
387
|
-
scan_depth?:
|
|
388
|
-
token_budget?:
|
|
388
|
+
scan_depth?: unknown;
|
|
389
|
+
token_budget?: unknown;
|
|
389
390
|
recursive_scanning?: boolean | undefined;
|
|
390
391
|
extensions?: Record<string, unknown> | undefined;
|
|
391
392
|
}>;
|
|
@@ -414,8 +415,8 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
|
|
|
414
415
|
character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
415
416
|
name: z.ZodOptional<z.ZodString>;
|
|
416
417
|
description: z.ZodOptional<z.ZodString>;
|
|
417
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
418
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
418
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
419
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
419
420
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
420
421
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
421
422
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -651,14 +652,14 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
|
|
|
651
652
|
}, z.ZodTypeAny, "passthrough">[];
|
|
652
653
|
name?: string | undefined;
|
|
653
654
|
description?: string | undefined;
|
|
654
|
-
scan_depth?:
|
|
655
|
-
token_budget?:
|
|
655
|
+
scan_depth?: unknown;
|
|
656
|
+
token_budget?: unknown;
|
|
656
657
|
recursive_scanning?: boolean | undefined;
|
|
657
658
|
extensions?: Record<string, unknown> | undefined;
|
|
658
659
|
}>>>;
|
|
659
660
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
660
661
|
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
661
|
-
type: z.ZodEnum<[
|
|
662
|
+
type: z.ZodEffects<z.ZodEnum<[
|
|
662
663
|
"icon",
|
|
663
664
|
"background",
|
|
664
665
|
"emotion",
|
|
@@ -667,7 +668,7 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
|
|
|
667
668
|
"video",
|
|
668
669
|
"custom",
|
|
669
670
|
"x-risu-asset"
|
|
670
|
-
]>;
|
|
671
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
671
672
|
uri: z.ZodString;
|
|
672
673
|
name: z.ZodString;
|
|
673
674
|
ext: z.ZodString;
|
|
@@ -678,15 +679,15 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
|
|
|
678
679
|
ext: string;
|
|
679
680
|
}, {
|
|
680
681
|
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;
|
|
684
685
|
}>, "many">>;
|
|
685
686
|
nickname: z.ZodOptional<z.ZodString>;
|
|
686
687
|
creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
687
688
|
source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
688
|
-
creation_date: z.ZodOptional<z.ZodNumber>;
|
|
689
|
-
modification_date: z.ZodOptional<z.ZodNumber>;
|
|
689
|
+
creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
690
|
+
modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
690
691
|
}, "strip", z.ZodTypeAny, {
|
|
691
692
|
name: string;
|
|
692
693
|
description: string;
|
|
@@ -827,8 +828,8 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
|
|
|
827
828
|
}, z.ZodTypeAny, "passthrough">[];
|
|
828
829
|
name?: string | undefined;
|
|
829
830
|
description?: string | undefined;
|
|
830
|
-
scan_depth?:
|
|
831
|
-
token_budget?:
|
|
831
|
+
scan_depth?: unknown;
|
|
832
|
+
token_budget?: unknown;
|
|
832
833
|
recursive_scanning?: boolean | undefined;
|
|
833
834
|
extensions?: Record<string, unknown> | undefined;
|
|
834
835
|
} | null | undefined;
|
|
@@ -838,15 +839,15 @@ export declare const CCv3DataInnerSchema: z.ZodObject<{
|
|
|
838
839
|
group_only_greetings?: string[] | undefined;
|
|
839
840
|
assets?: {
|
|
840
841
|
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;
|
|
844
845
|
}[] | undefined;
|
|
845
846
|
nickname?: string | undefined;
|
|
846
847
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
847
848
|
source?: string[] | undefined;
|
|
848
|
-
creation_date?:
|
|
849
|
-
modification_date?:
|
|
849
|
+
creation_date?: unknown;
|
|
850
|
+
modification_date?: unknown;
|
|
850
851
|
}>;
|
|
851
852
|
/**
|
|
852
853
|
* Character Card v3 full structure schema
|
|
@@ -872,8 +873,8 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
872
873
|
character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
873
874
|
name: z.ZodOptional<z.ZodString>;
|
|
874
875
|
description: z.ZodOptional<z.ZodString>;
|
|
875
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
876
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
876
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
877
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
877
878
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
878
879
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
879
880
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -1109,14 +1110,14 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1109
1110
|
}, z.ZodTypeAny, "passthrough">[];
|
|
1110
1111
|
name?: string | undefined;
|
|
1111
1112
|
description?: string | undefined;
|
|
1112
|
-
scan_depth?:
|
|
1113
|
-
token_budget?:
|
|
1113
|
+
scan_depth?: unknown;
|
|
1114
|
+
token_budget?: unknown;
|
|
1114
1115
|
recursive_scanning?: boolean | undefined;
|
|
1115
1116
|
extensions?: Record<string, unknown> | undefined;
|
|
1116
1117
|
}>>>;
|
|
1117
1118
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1118
1119
|
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1119
|
-
type: z.ZodEnum<[
|
|
1120
|
+
type: z.ZodEffects<z.ZodEnum<[
|
|
1120
1121
|
"icon",
|
|
1121
1122
|
"background",
|
|
1122
1123
|
"emotion",
|
|
@@ -1125,7 +1126,7 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1125
1126
|
"video",
|
|
1126
1127
|
"custom",
|
|
1127
1128
|
"x-risu-asset"
|
|
1128
|
-
]>;
|
|
1129
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
1129
1130
|
uri: z.ZodString;
|
|
1130
1131
|
name: z.ZodString;
|
|
1131
1132
|
ext: z.ZodString;
|
|
@@ -1136,15 +1137,15 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1136
1137
|
ext: string;
|
|
1137
1138
|
}, {
|
|
1138
1139
|
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;
|
|
1142
1143
|
}>, "many">>;
|
|
1143
1144
|
nickname: z.ZodOptional<z.ZodString>;
|
|
1144
1145
|
creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1145
1146
|
source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1146
|
-
creation_date: z.ZodOptional<z.ZodNumber>;
|
|
1147
|
-
modification_date: z.ZodOptional<z.ZodNumber>;
|
|
1147
|
+
creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
1148
|
+
modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
1148
1149
|
}, "strip", z.ZodTypeAny, {
|
|
1149
1150
|
name: string;
|
|
1150
1151
|
description: string;
|
|
@@ -1285,8 +1286,8 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1285
1286
|
}, z.ZodTypeAny, "passthrough">[];
|
|
1286
1287
|
name?: string | undefined;
|
|
1287
1288
|
description?: string | undefined;
|
|
1288
|
-
scan_depth?:
|
|
1289
|
-
token_budget?:
|
|
1289
|
+
scan_depth?: unknown;
|
|
1290
|
+
token_budget?: unknown;
|
|
1290
1291
|
recursive_scanning?: boolean | undefined;
|
|
1291
1292
|
extensions?: Record<string, unknown> | undefined;
|
|
1292
1293
|
} | null | undefined;
|
|
@@ -1296,15 +1297,15 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1296
1297
|
group_only_greetings?: string[] | undefined;
|
|
1297
1298
|
assets?: {
|
|
1298
1299
|
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;
|
|
1302
1303
|
}[] | undefined;
|
|
1303
1304
|
nickname?: string | undefined;
|
|
1304
1305
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
1305
1306
|
source?: string[] | undefined;
|
|
1306
|
-
creation_date?:
|
|
1307
|
-
modification_date?:
|
|
1307
|
+
creation_date?: unknown;
|
|
1308
|
+
modification_date?: unknown;
|
|
1308
1309
|
}>;
|
|
1309
1310
|
}, "strip", z.ZodTypeAny, {
|
|
1310
1311
|
data: {
|
|
@@ -1451,8 +1452,8 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1451
1452
|
}, z.ZodTypeAny, "passthrough">[];
|
|
1452
1453
|
name?: string | undefined;
|
|
1453
1454
|
description?: string | undefined;
|
|
1454
|
-
scan_depth?:
|
|
1455
|
-
token_budget?:
|
|
1455
|
+
scan_depth?: unknown;
|
|
1456
|
+
token_budget?: unknown;
|
|
1456
1457
|
recursive_scanning?: boolean | undefined;
|
|
1457
1458
|
extensions?: Record<string, unknown> | undefined;
|
|
1458
1459
|
} | null | undefined;
|
|
@@ -1462,15 +1463,15 @@ export declare const CCv3DataSchema: z.ZodObject<{
|
|
|
1462
1463
|
group_only_greetings?: string[] | undefined;
|
|
1463
1464
|
assets?: {
|
|
1464
1465
|
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;
|
|
1468
1469
|
}[] | undefined;
|
|
1469
1470
|
nickname?: string | undefined;
|
|
1470
1471
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
1471
1472
|
source?: string[] | undefined;
|
|
1472
|
-
creation_date?:
|
|
1473
|
-
modification_date?:
|
|
1473
|
+
creation_date?: unknown;
|
|
1474
|
+
modification_date?: unknown;
|
|
1474
1475
|
};
|
|
1475
1476
|
spec: "chara_card_v3";
|
|
1476
1477
|
spec_version: "3.0";
|
|
@@ -1520,6 +1521,21 @@ export declare function looksLikeV3Card(data: unknown): data is {
|
|
|
1520
1521
|
*
|
|
1521
1522
|
* Shared types used across all card formats.
|
|
1522
1523
|
*/
|
|
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;
|
|
1523
1539
|
/**
|
|
1524
1540
|
* ISO 8601 date string schema
|
|
1525
1541
|
*/
|
|
@@ -1557,9 +1573,10 @@ export declare const OriginalShapeSchema: z.ZodEnum<[
|
|
|
1557
1573
|
"legacy"
|
|
1558
1574
|
]>;
|
|
1559
1575
|
/**
|
|
1560
|
-
* Asset type identifier schema
|
|
1576
|
+
* Asset type identifier schema.
|
|
1577
|
+
* Uses preprocessing to coerce unknown types to 'custom' for forward compatibility.
|
|
1561
1578
|
*/
|
|
1562
|
-
export declare const AssetTypeSchema: z.ZodEnum<[
|
|
1579
|
+
export declare const AssetTypeSchema: z.ZodEffects<z.ZodEnum<[
|
|
1563
1580
|
"icon",
|
|
1564
1581
|
"background",
|
|
1565
1582
|
"emotion",
|
|
@@ -1568,12 +1585,12 @@ export declare const AssetTypeSchema: z.ZodEnum<[
|
|
|
1568
1585
|
"video",
|
|
1569
1586
|
"custom",
|
|
1570
1587
|
"x-risu-asset"
|
|
1571
|
-
]>;
|
|
1588
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
1572
1589
|
/**
|
|
1573
1590
|
* Asset descriptor schema (v3 spec)
|
|
1574
1591
|
*/
|
|
1575
1592
|
export declare const AssetDescriptorSchema: z.ZodObject<{
|
|
1576
|
-
type: z.ZodEnum<[
|
|
1593
|
+
type: z.ZodEffects<z.ZodEnum<[
|
|
1577
1594
|
"icon",
|
|
1578
1595
|
"background",
|
|
1579
1596
|
"emotion",
|
|
@@ -1582,7 +1599,7 @@ export declare const AssetDescriptorSchema: z.ZodObject<{
|
|
|
1582
1599
|
"video",
|
|
1583
1600
|
"custom",
|
|
1584
1601
|
"x-risu-asset"
|
|
1585
|
-
]>;
|
|
1602
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
1586
1603
|
uri: z.ZodString;
|
|
1587
1604
|
name: z.ZodString;
|
|
1588
1605
|
ext: z.ZodString;
|
|
@@ -1593,16 +1610,16 @@ export declare const AssetDescriptorSchema: z.ZodObject<{
|
|
|
1593
1610
|
ext: string;
|
|
1594
1611
|
}, {
|
|
1595
1612
|
name: string;
|
|
1596
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
1597
1613
|
uri: string;
|
|
1598
1614
|
ext: string;
|
|
1615
|
+
type?: unknown;
|
|
1599
1616
|
}>;
|
|
1600
1617
|
/**
|
|
1601
1618
|
* Extracted asset with binary data schema
|
|
1602
1619
|
*/
|
|
1603
1620
|
export declare const ExtractedAssetSchema: z.ZodObject<{
|
|
1604
1621
|
descriptor: z.ZodObject<{
|
|
1605
|
-
type: z.ZodEnum<[
|
|
1622
|
+
type: z.ZodEffects<z.ZodEnum<[
|
|
1606
1623
|
"icon",
|
|
1607
1624
|
"background",
|
|
1608
1625
|
"emotion",
|
|
@@ -1611,7 +1628,7 @@ export declare const ExtractedAssetSchema: z.ZodObject<{
|
|
|
1611
1628
|
"video",
|
|
1612
1629
|
"custom",
|
|
1613
1630
|
"x-risu-asset"
|
|
1614
|
-
]>;
|
|
1631
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
1615
1632
|
uri: z.ZodString;
|
|
1616
1633
|
name: z.ZodString;
|
|
1617
1634
|
ext: z.ZodString;
|
|
@@ -1622,9 +1639,9 @@ export declare const ExtractedAssetSchema: z.ZodObject<{
|
|
|
1622
1639
|
ext: string;
|
|
1623
1640
|
}, {
|
|
1624
1641
|
name: string;
|
|
1625
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
1626
1642
|
uri: string;
|
|
1627
1643
|
ext: string;
|
|
1644
|
+
type?: unknown;
|
|
1628
1645
|
}>;
|
|
1629
1646
|
data: z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>;
|
|
1630
1647
|
mimeType: z.ZodString;
|
|
@@ -1640,9 +1657,9 @@ export declare const ExtractedAssetSchema: z.ZodObject<{
|
|
|
1640
1657
|
}, {
|
|
1641
1658
|
descriptor: {
|
|
1642
1659
|
name: string;
|
|
1643
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
1644
1660
|
uri: string;
|
|
1645
1661
|
ext: string;
|
|
1662
|
+
type?: unknown;
|
|
1646
1663
|
};
|
|
1647
1664
|
data: Uint8Array<ArrayBuffer>;
|
|
1648
1665
|
mimeType: string;
|
|
@@ -1758,13 +1775,14 @@ export declare const CCv2LorebookEntrySchema: z.ZodObject<{
|
|
|
1758
1775
|
]>>>;
|
|
1759
1776
|
}, z.ZodTypeAny, "passthrough">>;
|
|
1760
1777
|
/**
|
|
1761
|
-
* Character book (lorebook) schema for v2 cards
|
|
1778
|
+
* Character book (lorebook) schema for v2 cards.
|
|
1779
|
+
* Uses preprocessing for numeric fields that often come as strings in wild data.
|
|
1762
1780
|
*/
|
|
1763
1781
|
export declare const CCv2CharacterBookSchema: z.ZodObject<{
|
|
1764
1782
|
name: z.ZodOptional<z.ZodString>;
|
|
1765
1783
|
description: z.ZodOptional<z.ZodString>;
|
|
1766
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
1767
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
1784
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
1785
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
1768
1786
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
1769
1787
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1770
1788
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -1895,8 +1913,8 @@ export declare const CCv2CharacterBookSchema: z.ZodObject<{
|
|
|
1895
1913
|
}, z.ZodTypeAny, "passthrough">[];
|
|
1896
1914
|
name?: string | undefined;
|
|
1897
1915
|
description?: string | undefined;
|
|
1898
|
-
scan_depth?:
|
|
1899
|
-
token_budget?:
|
|
1916
|
+
scan_depth?: unknown;
|
|
1917
|
+
token_budget?: unknown;
|
|
1900
1918
|
recursive_scanning?: boolean | undefined;
|
|
1901
1919
|
extensions?: Record<string, unknown> | undefined;
|
|
1902
1920
|
}>;
|
|
@@ -1917,8 +1935,8 @@ export declare const CCv2DataSchema: z.ZodObject<{
|
|
|
1917
1935
|
character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
1918
1936
|
name: z.ZodOptional<z.ZodString>;
|
|
1919
1937
|
description: z.ZodOptional<z.ZodString>;
|
|
1920
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
1921
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
1938
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
1939
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
1922
1940
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
1923
1941
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1924
1942
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -2049,8 +2067,8 @@ export declare const CCv2DataSchema: z.ZodObject<{
|
|
|
2049
2067
|
}, z.ZodTypeAny, "passthrough">[];
|
|
2050
2068
|
name?: string | undefined;
|
|
2051
2069
|
description?: string | undefined;
|
|
2052
|
-
scan_depth?:
|
|
2053
|
-
token_budget?:
|
|
2070
|
+
scan_depth?: unknown;
|
|
2071
|
+
token_budget?: unknown;
|
|
2054
2072
|
recursive_scanning?: boolean | undefined;
|
|
2055
2073
|
extensions?: Record<string, unknown> | undefined;
|
|
2056
2074
|
}>>>;
|
|
@@ -2144,8 +2162,8 @@ export declare const CCv2DataSchema: z.ZodObject<{
|
|
|
2144
2162
|
}, z.ZodTypeAny, "passthrough">[];
|
|
2145
2163
|
name?: string | undefined;
|
|
2146
2164
|
description?: string | undefined;
|
|
2147
|
-
scan_depth?:
|
|
2148
|
-
token_budget?:
|
|
2165
|
+
scan_depth?: unknown;
|
|
2166
|
+
token_budget?: unknown;
|
|
2149
2167
|
recursive_scanning?: boolean | undefined;
|
|
2150
2168
|
extensions?: Record<string, unknown> | undefined;
|
|
2151
2169
|
} | null | undefined;
|
|
@@ -2173,8 +2191,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
|
|
|
2173
2191
|
character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
2174
2192
|
name: z.ZodOptional<z.ZodString>;
|
|
2175
2193
|
description: z.ZodOptional<z.ZodString>;
|
|
2176
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
2177
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
2194
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
2195
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
2178
2196
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
2179
2197
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2180
2198
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -2305,8 +2323,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
|
|
|
2305
2323
|
}, z.ZodTypeAny, "passthrough">[];
|
|
2306
2324
|
name?: string | undefined;
|
|
2307
2325
|
description?: string | undefined;
|
|
2308
|
-
scan_depth?:
|
|
2309
|
-
token_budget?:
|
|
2326
|
+
scan_depth?: unknown;
|
|
2327
|
+
token_budget?: unknown;
|
|
2310
2328
|
recursive_scanning?: boolean | undefined;
|
|
2311
2329
|
extensions?: Record<string, unknown> | undefined;
|
|
2312
2330
|
}>>>;
|
|
@@ -2400,8 +2418,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
|
|
|
2400
2418
|
}, z.ZodTypeAny, "passthrough">[];
|
|
2401
2419
|
name?: string | undefined;
|
|
2402
2420
|
description?: string | undefined;
|
|
2403
|
-
scan_depth?:
|
|
2404
|
-
token_budget?:
|
|
2421
|
+
scan_depth?: unknown;
|
|
2422
|
+
token_budget?: unknown;
|
|
2405
2423
|
recursive_scanning?: boolean | undefined;
|
|
2406
2424
|
extensions?: Record<string, unknown> | undefined;
|
|
2407
2425
|
} | null | undefined;
|
|
@@ -2500,8 +2518,8 @@ export declare const CCv2WrappedSchema: z.ZodObject<{
|
|
|
2500
2518
|
}, z.ZodTypeAny, "passthrough">[];
|
|
2501
2519
|
name?: string | undefined;
|
|
2502
2520
|
description?: string | undefined;
|
|
2503
|
-
scan_depth?:
|
|
2504
|
-
token_budget?:
|
|
2521
|
+
scan_depth?: unknown;
|
|
2522
|
+
token_budget?: unknown;
|
|
2505
2523
|
recursive_scanning?: boolean | undefined;
|
|
2506
2524
|
extensions?: Record<string, unknown> | undefined;
|
|
2507
2525
|
} | null | undefined;
|
package/dist/schemas.js
CHANGED
|
@@ -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.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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(),
|
|
@@ -68,8 +123,8 @@ var CCv2LorebookEntrySchema = z2.object({
|
|
|
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)
|
|
@@ -155,8 +210,8 @@ var CCv3LorebookEntrySchema = z3.object({
|
|
|
155
210
|
var CCv3CharacterBookSchema = z3.object({
|
|
156
211
|
name: z3.string().optional(),
|
|
157
212
|
description: z3.string().optional(),
|
|
158
|
-
scan_depth: z3.number().int().nonnegative().optional(),
|
|
159
|
-
token_budget: z3.number().int().nonnegative().optional(),
|
|
213
|
+
scan_depth: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
|
|
214
|
+
token_budget: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
|
|
160
215
|
recursive_scanning: z3.boolean().optional(),
|
|
161
216
|
extensions: z3.record(z3.unknown()).optional(),
|
|
162
217
|
entries: z3.array(CCv3LorebookEntrySchema)
|
|
@@ -188,10 +243,9 @@ var CCv3DataInnerSchema = z3.object({
|
|
|
188
243
|
nickname: z3.string().optional(),
|
|
189
244
|
creator_notes_multilingual: z3.record(z3.string()).optional(),
|
|
190
245
|
source: z3.array(z3.string()).optional(),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
modification_date: z3.number().int().nonnegative().optional()
|
|
194
|
-
// Unix timestamp in seconds
|
|
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())
|
|
195
249
|
});
|
|
196
250
|
var CCv3DataSchema = z3.object({
|
|
197
251
|
spec: z3.literal("chara_card_v3"),
|
|
@@ -865,6 +919,9 @@ export {
|
|
|
865
919
|
parseV3Card,
|
|
866
920
|
parseV3DataInner,
|
|
867
921
|
parseWrappedV2,
|
|
922
|
+
preprocessAssetType,
|
|
923
|
+
preprocessNumeric,
|
|
924
|
+
preprocessTimestamp,
|
|
868
925
|
safeParse,
|
|
869
926
|
zodErrorToMessage
|
|
870
927
|
};
|