@character-foundry/character-foundry 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-framework.cjs +12 -3
- package/dist/app-framework.cjs.map +1 -1
- package/dist/app-framework.d.cts +9 -1
- package/dist/app-framework.d.ts +9 -1
- package/dist/app-framework.js +12 -3
- package/dist/app-framework.js.map +1 -1
- package/dist/charx.cjs +85 -52
- 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 +85 -52
- package/dist/charx.js.map +1 -1
- package/dist/exporter.cjs +104 -54
- 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 +104 -54
- package/dist/exporter.js.map +1 -1
- package/dist/federation.cjs +104 -36
- package/dist/federation.cjs.map +1 -1
- package/dist/federation.d.cts +54 -19
- package/dist/federation.d.ts +54 -19
- package/dist/federation.js +104 -36
- package/dist/federation.js.map +1 -1
- package/dist/index.cjs +104 -54
- 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 +104 -54
- package/dist/index.js.map +1 -1
- package/dist/loader.cjs +171 -31
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.cts +37 -23
- package/dist/loader.d.ts +37 -23
- package/dist/loader.js +171 -31
- 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 +80 -23
- 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 +80 -23
- package/dist/schemas.js.map +1 -1
- package/dist/voxta.cjs +91 -20
- 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 +91 -20
- package/dist/voxta.js.map +1 -1
- package/package.json +24 -24
package/dist/voxta.d.cts
CHANGED
|
@@ -13,8 +13,8 @@ export type BinaryData = Uint8Array;
|
|
|
13
13
|
declare const CCv3CharacterBookSchema: z.ZodObject<{
|
|
14
14
|
name: z.ZodOptional<z.ZodString>;
|
|
15
15
|
description: z.ZodOptional<z.ZodString>;
|
|
16
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
17
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
18
18
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
19
19
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
20
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -250,8 +250,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
|
|
|
250
250
|
}, z.ZodTypeAny, "passthrough">[];
|
|
251
251
|
name?: string | undefined;
|
|
252
252
|
description?: string | undefined;
|
|
253
|
-
scan_depth?:
|
|
254
|
-
token_budget?:
|
|
253
|
+
scan_depth?: unknown;
|
|
254
|
+
token_budget?: unknown;
|
|
255
255
|
recursive_scanning?: boolean | undefined;
|
|
256
256
|
extensions?: Record<string, unknown> | undefined;
|
|
257
257
|
}>;
|
|
@@ -276,8 +276,8 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
276
276
|
character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
277
277
|
name: z.ZodOptional<z.ZodString>;
|
|
278
278
|
description: z.ZodOptional<z.ZodString>;
|
|
279
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
280
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
280
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
281
281
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
282
282
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
283
283
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -513,14 +513,14 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
513
513
|
}, z.ZodTypeAny, "passthrough">[];
|
|
514
514
|
name?: string | undefined;
|
|
515
515
|
description?: string | undefined;
|
|
516
|
-
scan_depth?:
|
|
517
|
-
token_budget?:
|
|
516
|
+
scan_depth?: unknown;
|
|
517
|
+
token_budget?: unknown;
|
|
518
518
|
recursive_scanning?: boolean | undefined;
|
|
519
519
|
extensions?: Record<string, unknown> | undefined;
|
|
520
520
|
}>>>;
|
|
521
521
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
522
522
|
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
523
|
-
type: z.ZodEnum<[
|
|
523
|
+
type: z.ZodEffects<z.ZodEnum<[
|
|
524
524
|
"icon",
|
|
525
525
|
"background",
|
|
526
526
|
"emotion",
|
|
@@ -529,7 +529,7 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
529
529
|
"video",
|
|
530
530
|
"custom",
|
|
531
531
|
"x-risu-asset"
|
|
532
|
-
]>;
|
|
532
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
533
533
|
uri: z.ZodString;
|
|
534
534
|
name: z.ZodString;
|
|
535
535
|
ext: z.ZodString;
|
|
@@ -540,15 +540,15 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
540
540
|
ext: string;
|
|
541
541
|
}, {
|
|
542
542
|
name: string;
|
|
543
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
544
543
|
uri: string;
|
|
545
544
|
ext: string;
|
|
545
|
+
type?: unknown;
|
|
546
546
|
}>, "many">>;
|
|
547
547
|
nickname: z.ZodOptional<z.ZodString>;
|
|
548
548
|
creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
549
549
|
source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
550
|
-
creation_date: z.ZodOptional<z.ZodNumber>;
|
|
551
|
-
modification_date: z.ZodOptional<z.ZodNumber>;
|
|
550
|
+
creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
551
|
+
modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
552
552
|
}, "strip", z.ZodTypeAny, {
|
|
553
553
|
name: string;
|
|
554
554
|
description: string;
|
|
@@ -689,8 +689,8 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
689
689
|
}, z.ZodTypeAny, "passthrough">[];
|
|
690
690
|
name?: string | undefined;
|
|
691
691
|
description?: string | undefined;
|
|
692
|
-
scan_depth?:
|
|
693
|
-
token_budget?:
|
|
692
|
+
scan_depth?: unknown;
|
|
693
|
+
token_budget?: unknown;
|
|
694
694
|
recursive_scanning?: boolean | undefined;
|
|
695
695
|
extensions?: Record<string, unknown> | undefined;
|
|
696
696
|
} | null | undefined;
|
|
@@ -700,15 +700,15 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
700
700
|
group_only_greetings?: string[] | undefined;
|
|
701
701
|
assets?: {
|
|
702
702
|
name: string;
|
|
703
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
704
703
|
uri: string;
|
|
705
704
|
ext: string;
|
|
705
|
+
type?: unknown;
|
|
706
706
|
}[] | undefined;
|
|
707
707
|
nickname?: string | undefined;
|
|
708
708
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
709
709
|
source?: string[] | undefined;
|
|
710
|
-
creation_date?:
|
|
711
|
-
modification_date?:
|
|
710
|
+
creation_date?: unknown;
|
|
711
|
+
modification_date?: unknown;
|
|
712
712
|
}>;
|
|
713
713
|
}, "strip", z.ZodTypeAny, {
|
|
714
714
|
data: {
|
|
@@ -855,8 +855,8 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
855
855
|
}, z.ZodTypeAny, "passthrough">[];
|
|
856
856
|
name?: string | undefined;
|
|
857
857
|
description?: string | undefined;
|
|
858
|
-
scan_depth?:
|
|
859
|
-
token_budget?:
|
|
858
|
+
scan_depth?: unknown;
|
|
859
|
+
token_budget?: unknown;
|
|
860
860
|
recursive_scanning?: boolean | undefined;
|
|
861
861
|
extensions?: Record<string, unknown> | undefined;
|
|
862
862
|
} | null | undefined;
|
|
@@ -866,15 +866,15 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
866
866
|
group_only_greetings?: string[] | undefined;
|
|
867
867
|
assets?: {
|
|
868
868
|
name: string;
|
|
869
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
870
869
|
uri: string;
|
|
871
870
|
ext: string;
|
|
871
|
+
type?: unknown;
|
|
872
872
|
}[] | undefined;
|
|
873
873
|
nickname?: string | undefined;
|
|
874
874
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
875
875
|
source?: string[] | undefined;
|
|
876
|
-
creation_date?:
|
|
877
|
-
modification_date?:
|
|
876
|
+
creation_date?: unknown;
|
|
877
|
+
modification_date?: unknown;
|
|
878
878
|
};
|
|
879
879
|
spec: "chara_card_v3";
|
|
880
880
|
spec_version: "3.0";
|
package/dist/voxta.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export type BinaryData = Uint8Array;
|
|
|
13
13
|
declare const CCv3CharacterBookSchema: z.ZodObject<{
|
|
14
14
|
name: z.ZodOptional<z.ZodString>;
|
|
15
15
|
description: z.ZodOptional<z.ZodString>;
|
|
16
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
17
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
18
18
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
19
19
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
20
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -250,8 +250,8 @@ declare const CCv3CharacterBookSchema: z.ZodObject<{
|
|
|
250
250
|
}, z.ZodTypeAny, "passthrough">[];
|
|
251
251
|
name?: string | undefined;
|
|
252
252
|
description?: string | undefined;
|
|
253
|
-
scan_depth?:
|
|
254
|
-
token_budget?:
|
|
253
|
+
scan_depth?: unknown;
|
|
254
|
+
token_budget?: unknown;
|
|
255
255
|
recursive_scanning?: boolean | undefined;
|
|
256
256
|
extensions?: Record<string, unknown> | undefined;
|
|
257
257
|
}>;
|
|
@@ -276,8 +276,8 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
276
276
|
character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
277
277
|
name: z.ZodOptional<z.ZodString>;
|
|
278
278
|
description: z.ZodOptional<z.ZodString>;
|
|
279
|
-
scan_depth: z.ZodOptional<z.ZodNumber>;
|
|
280
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
scan_depth: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
280
|
+
token_budget: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
281
281
|
recursive_scanning: z.ZodOptional<z.ZodBoolean>;
|
|
282
282
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
283
283
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -513,14 +513,14 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
513
513
|
}, z.ZodTypeAny, "passthrough">[];
|
|
514
514
|
name?: string | undefined;
|
|
515
515
|
description?: string | undefined;
|
|
516
|
-
scan_depth?:
|
|
517
|
-
token_budget?:
|
|
516
|
+
scan_depth?: unknown;
|
|
517
|
+
token_budget?: unknown;
|
|
518
518
|
recursive_scanning?: boolean | undefined;
|
|
519
519
|
extensions?: Record<string, unknown> | undefined;
|
|
520
520
|
}>>>;
|
|
521
521
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
522
522
|
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
523
|
-
type: z.ZodEnum<[
|
|
523
|
+
type: z.ZodEffects<z.ZodEnum<[
|
|
524
524
|
"icon",
|
|
525
525
|
"background",
|
|
526
526
|
"emotion",
|
|
@@ -529,7 +529,7 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
529
529
|
"video",
|
|
530
530
|
"custom",
|
|
531
531
|
"x-risu-asset"
|
|
532
|
-
]>;
|
|
532
|
+
]>, "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset", unknown>;
|
|
533
533
|
uri: z.ZodString;
|
|
534
534
|
name: z.ZodString;
|
|
535
535
|
ext: z.ZodString;
|
|
@@ -540,15 +540,15 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
540
540
|
ext: string;
|
|
541
541
|
}, {
|
|
542
542
|
name: string;
|
|
543
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
544
543
|
uri: string;
|
|
545
544
|
ext: string;
|
|
545
|
+
type?: unknown;
|
|
546
546
|
}>, "many">>;
|
|
547
547
|
nickname: z.ZodOptional<z.ZodString>;
|
|
548
548
|
creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
549
549
|
source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
550
|
-
creation_date: z.ZodOptional<z.ZodNumber>;
|
|
551
|
-
modification_date: z.ZodOptional<z.ZodNumber>;
|
|
550
|
+
creation_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
551
|
+
modification_date: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
|
|
552
552
|
}, "strip", z.ZodTypeAny, {
|
|
553
553
|
name: string;
|
|
554
554
|
description: string;
|
|
@@ -689,8 +689,8 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
689
689
|
}, z.ZodTypeAny, "passthrough">[];
|
|
690
690
|
name?: string | undefined;
|
|
691
691
|
description?: string | undefined;
|
|
692
|
-
scan_depth?:
|
|
693
|
-
token_budget?:
|
|
692
|
+
scan_depth?: unknown;
|
|
693
|
+
token_budget?: unknown;
|
|
694
694
|
recursive_scanning?: boolean | undefined;
|
|
695
695
|
extensions?: Record<string, unknown> | undefined;
|
|
696
696
|
} | null | undefined;
|
|
@@ -700,15 +700,15 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
700
700
|
group_only_greetings?: string[] | undefined;
|
|
701
701
|
assets?: {
|
|
702
702
|
name: string;
|
|
703
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
704
703
|
uri: string;
|
|
705
704
|
ext: string;
|
|
705
|
+
type?: unknown;
|
|
706
706
|
}[] | undefined;
|
|
707
707
|
nickname?: string | undefined;
|
|
708
708
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
709
709
|
source?: string[] | undefined;
|
|
710
|
-
creation_date?:
|
|
711
|
-
modification_date?:
|
|
710
|
+
creation_date?: unknown;
|
|
711
|
+
modification_date?: unknown;
|
|
712
712
|
}>;
|
|
713
713
|
}, "strip", z.ZodTypeAny, {
|
|
714
714
|
data: {
|
|
@@ -855,8 +855,8 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
855
855
|
}, z.ZodTypeAny, "passthrough">[];
|
|
856
856
|
name?: string | undefined;
|
|
857
857
|
description?: string | undefined;
|
|
858
|
-
scan_depth?:
|
|
859
|
-
token_budget?:
|
|
858
|
+
scan_depth?: unknown;
|
|
859
|
+
token_budget?: unknown;
|
|
860
860
|
recursive_scanning?: boolean | undefined;
|
|
861
861
|
extensions?: Record<string, unknown> | undefined;
|
|
862
862
|
} | null | undefined;
|
|
@@ -866,15 +866,15 @@ declare const CCv3DataSchema: z.ZodObject<{
|
|
|
866
866
|
group_only_greetings?: string[] | undefined;
|
|
867
867
|
assets?: {
|
|
868
868
|
name: string;
|
|
869
|
-
type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
|
|
870
869
|
uri: string;
|
|
871
870
|
ext: string;
|
|
871
|
+
type?: unknown;
|
|
872
872
|
}[] | undefined;
|
|
873
873
|
nickname?: string | undefined;
|
|
874
874
|
creator_notes_multilingual?: Record<string, string> | undefined;
|
|
875
875
|
source?: string[] | undefined;
|
|
876
|
-
creation_date?:
|
|
877
|
-
modification_date?:
|
|
876
|
+
creation_date?: unknown;
|
|
877
|
+
modification_date?: unknown;
|
|
878
878
|
};
|
|
879
879
|
spec: "chara_card_v3";
|
|
880
880
|
spec_version: "3.0";
|
package/dist/voxta.js
CHANGED
|
@@ -6573,6 +6573,58 @@ import { z } from "zod";
|
|
|
6573
6573
|
import { z as z2 } from "zod";
|
|
6574
6574
|
import { z as z3 } from "zod";
|
|
6575
6575
|
import "zod";
|
|
6576
|
+
function preprocessTimestamp(val) {
|
|
6577
|
+
if (val === null || val === void 0) return void 0;
|
|
6578
|
+
let num;
|
|
6579
|
+
if (typeof val === "number") {
|
|
6580
|
+
num = val;
|
|
6581
|
+
} else if (typeof val === "string") {
|
|
6582
|
+
const trimmed = val.trim();
|
|
6583
|
+
if (!trimmed) return void 0;
|
|
6584
|
+
const parsed = Number(trimmed);
|
|
6585
|
+
if (!isNaN(parsed)) {
|
|
6586
|
+
num = parsed;
|
|
6587
|
+
} else {
|
|
6588
|
+
const date = new Date(trimmed);
|
|
6589
|
+
if (isNaN(date.getTime())) return void 0;
|
|
6590
|
+
num = Math.floor(date.getTime() / 1e3);
|
|
6591
|
+
}
|
|
6592
|
+
} else {
|
|
6593
|
+
return void 0;
|
|
6594
|
+
}
|
|
6595
|
+
if (num > 1e10) {
|
|
6596
|
+
num = Math.floor(num / 1e3);
|
|
6597
|
+
}
|
|
6598
|
+
if (num < 0) return void 0;
|
|
6599
|
+
return num;
|
|
6600
|
+
}
|
|
6601
|
+
function preprocessNumeric(val) {
|
|
6602
|
+
if (val === null || val === void 0) return void 0;
|
|
6603
|
+
if (typeof val === "number") {
|
|
6604
|
+
return isNaN(val) ? void 0 : val;
|
|
6605
|
+
}
|
|
6606
|
+
if (typeof val === "string") {
|
|
6607
|
+
const trimmed = val.trim();
|
|
6608
|
+
if (!trimmed) return void 0;
|
|
6609
|
+
const parsed = Number(trimmed);
|
|
6610
|
+
return isNaN(parsed) ? void 0 : parsed;
|
|
6611
|
+
}
|
|
6612
|
+
return void 0;
|
|
6613
|
+
}
|
|
6614
|
+
var KNOWN_ASSET_TYPES = /* @__PURE__ */ new Set([
|
|
6615
|
+
"icon",
|
|
6616
|
+
"background",
|
|
6617
|
+
"emotion",
|
|
6618
|
+
"user_icon",
|
|
6619
|
+
"sound",
|
|
6620
|
+
"video",
|
|
6621
|
+
"custom",
|
|
6622
|
+
"x-risu-asset"
|
|
6623
|
+
]);
|
|
6624
|
+
function preprocessAssetType(val) {
|
|
6625
|
+
if (typeof val !== "string") return "custom";
|
|
6626
|
+
return KNOWN_ASSET_TYPES.has(val) ? val : "custom";
|
|
6627
|
+
}
|
|
6576
6628
|
var ISO8601Schema = z.string().datetime();
|
|
6577
6629
|
var UUIDSchema = z.string().uuid();
|
|
6578
6630
|
var SpecSchema = z.enum(["v2", "v3"]);
|
|
@@ -6595,16 +6647,19 @@ var SourceFormatSchema = z.enum([
|
|
|
6595
6647
|
// VoxPkg format
|
|
6596
6648
|
]);
|
|
6597
6649
|
var OriginalShapeSchema = z.enum(["wrapped", "unwrapped", "legacy"]);
|
|
6598
|
-
var AssetTypeSchema = z.
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6650
|
+
var AssetTypeSchema = z.preprocess(
|
|
6651
|
+
preprocessAssetType,
|
|
6652
|
+
z.enum([
|
|
6653
|
+
"icon",
|
|
6654
|
+
"background",
|
|
6655
|
+
"emotion",
|
|
6656
|
+
"user_icon",
|
|
6657
|
+
"sound",
|
|
6658
|
+
"video",
|
|
6659
|
+
"custom",
|
|
6660
|
+
"x-risu-asset"
|
|
6661
|
+
])
|
|
6662
|
+
);
|
|
6608
6663
|
var AssetDescriptorSchema = z.object({
|
|
6609
6664
|
type: AssetTypeSchema,
|
|
6610
6665
|
uri: z.string(),
|
|
@@ -6638,8 +6693,8 @@ var CCv2LorebookEntrySchema = z2.object({
|
|
|
6638
6693
|
var CCv2CharacterBookSchema = z2.object({
|
|
6639
6694
|
name: z2.string().optional(),
|
|
6640
6695
|
description: z2.string().optional(),
|
|
6641
|
-
scan_depth: z2.number().int().nonnegative().optional(),
|
|
6642
|
-
token_budget: z2.number().int().nonnegative().optional(),
|
|
6696
|
+
scan_depth: z2.preprocess(preprocessNumeric, z2.number().int().nonnegative().optional()),
|
|
6697
|
+
token_budget: z2.preprocess(preprocessNumeric, z2.number().int().nonnegative().optional()),
|
|
6643
6698
|
recursive_scanning: z2.boolean().optional(),
|
|
6644
6699
|
extensions: z2.record(z2.unknown()).optional(),
|
|
6645
6700
|
entries: z2.array(CCv2LorebookEntrySchema)
|
|
@@ -6702,8 +6757,8 @@ var CCv3LorebookEntrySchema = z3.object({
|
|
|
6702
6757
|
var CCv3CharacterBookSchema = z3.object({
|
|
6703
6758
|
name: z3.string().optional(),
|
|
6704
6759
|
description: z3.string().optional(),
|
|
6705
|
-
scan_depth: z3.number().int().nonnegative().optional(),
|
|
6706
|
-
token_budget: z3.number().int().nonnegative().optional(),
|
|
6760
|
+
scan_depth: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
|
|
6761
|
+
token_budget: z3.preprocess(preprocessNumeric, z3.number().int().nonnegative().optional()),
|
|
6707
6762
|
recursive_scanning: z3.boolean().optional(),
|
|
6708
6763
|
extensions: z3.record(z3.unknown()).optional(),
|
|
6709
6764
|
entries: z3.array(CCv3LorebookEntrySchema)
|
|
@@ -6735,10 +6790,9 @@ var CCv3DataInnerSchema = z3.object({
|
|
|
6735
6790
|
nickname: z3.string().optional(),
|
|
6736
6791
|
creator_notes_multilingual: z3.record(z3.string()).optional(),
|
|
6737
6792
|
source: z3.array(z3.string()).optional(),
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
modification_date: z3.number().int().nonnegative().optional()
|
|
6741
|
-
// Unix timestamp in seconds
|
|
6793
|
+
// Unix timestamps - preprocess to handle ISO strings, numeric strings, milliseconds
|
|
6794
|
+
creation_date: z3.preprocess(preprocessTimestamp, z3.number().int().nonnegative().optional()),
|
|
6795
|
+
modification_date: z3.preprocess(preprocessTimestamp, z3.number().int().nonnegative().optional())
|
|
6742
6796
|
});
|
|
6743
6797
|
var CCv3DataSchema = z3.object({
|
|
6744
6798
|
spec: z3.literal("chara_card_v3"),
|
|
@@ -7212,6 +7266,22 @@ function sanitizeName(name, ext) {
|
|
|
7212
7266
|
if (!safeName) safeName = "asset";
|
|
7213
7267
|
return safeName;
|
|
7214
7268
|
}
|
|
7269
|
+
function sanitizeExtension(ext) {
|
|
7270
|
+
const normalized = ext.trim().replace(/^\./, "").toLowerCase();
|
|
7271
|
+
if (!normalized) {
|
|
7272
|
+
throw new Error("Invalid asset extension: empty extension");
|
|
7273
|
+
}
|
|
7274
|
+
if (normalized.length > 64) {
|
|
7275
|
+
throw new Error(`Invalid asset extension: too long (${normalized.length} chars)`);
|
|
7276
|
+
}
|
|
7277
|
+
if (normalized.includes("/") || normalized.includes("\\") || normalized.includes("\0")) {
|
|
7278
|
+
throw new Error("Invalid asset extension: path separators are not allowed");
|
|
7279
|
+
}
|
|
7280
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(normalized)) {
|
|
7281
|
+
throw new Error(`Invalid asset extension: "${ext}"`);
|
|
7282
|
+
}
|
|
7283
|
+
return normalized;
|
|
7284
|
+
}
|
|
7215
7285
|
function writeVoxta(card, assets, options = {}) {
|
|
7216
7286
|
const { compressionLevel = 6, includePackageJson = false } = options;
|
|
7217
7287
|
const cardData = card.data;
|
|
@@ -7300,8 +7370,9 @@ function writeVoxta(card, assets, options = {}) {
|
|
|
7300
7370
|
let assetCount = 0;
|
|
7301
7371
|
let mainThumbnail;
|
|
7302
7372
|
for (const asset of assets) {
|
|
7303
|
-
const
|
|
7304
|
-
const
|
|
7373
|
+
const safeExt = sanitizeExtension(asset.ext);
|
|
7374
|
+
const safeName = sanitizeName(asset.name, safeExt);
|
|
7375
|
+
const finalFilename = `${safeName}.${safeExt}`;
|
|
7305
7376
|
let voxtaPath = "";
|
|
7306
7377
|
const tags = asset.tags || [];
|
|
7307
7378
|
const isMainIcon = asset.type === "icon" && (tags.includes("portrait-override") || asset.name === "main" || asset.isMain);
|