@character-foundry/character-foundry 0.1.3 → 0.1.5

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 (100) hide show
  1. package/README.md +70 -0
  2. package/dist/app-framework.cjs +1742 -0
  3. package/dist/app-framework.cjs.map +1 -0
  4. package/dist/app-framework.d.cts +881 -0
  5. package/dist/app-framework.d.ts +881 -2
  6. package/dist/app-framework.js +1718 -1
  7. package/dist/app-framework.js.map +1 -1
  8. package/dist/charx.cjs +917 -0
  9. package/dist/charx.cjs.map +1 -0
  10. package/dist/charx.d.cts +640 -0
  11. package/dist/charx.d.ts +640 -2
  12. package/dist/charx.js +893 -1
  13. package/dist/charx.js.map +1 -1
  14. package/dist/core.cjs +668 -0
  15. package/dist/core.cjs.map +1 -0
  16. package/dist/core.d.cts +363 -0
  17. package/dist/core.d.ts +363 -2
  18. package/dist/core.js +644 -1
  19. package/dist/core.js.map +1 -1
  20. package/dist/exporter.cjs +7539 -0
  21. package/dist/exporter.cjs.map +1 -0
  22. package/dist/exporter.d.cts +681 -0
  23. package/dist/exporter.d.ts +681 -2
  24. package/dist/exporter.js +7522 -1
  25. package/dist/exporter.js.map +1 -1
  26. package/dist/federation.cjs +3915 -0
  27. package/dist/federation.cjs.map +1 -0
  28. package/dist/federation.d.cts +2951 -0
  29. package/dist/federation.d.ts +2951 -2
  30. package/dist/federation.js +3891 -1
  31. package/dist/federation.js.map +1 -1
  32. package/dist/index.cjs +9109 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +1119 -0
  35. package/dist/index.d.ts +1113 -20
  36. package/dist/index.js +9092 -26
  37. package/dist/index.js.map +1 -1
  38. package/dist/loader.cjs +8923 -0
  39. package/dist/loader.cjs.map +1 -0
  40. package/dist/loader.d.cts +1037 -0
  41. package/dist/loader.d.ts +1037 -2
  42. package/dist/loader.js +8906 -1
  43. package/dist/loader.js.map +1 -1
  44. package/dist/lorebook.cjs +865 -0
  45. package/dist/lorebook.cjs.map +1 -0
  46. package/dist/lorebook.d.cts +1008 -0
  47. package/dist/lorebook.d.ts +1008 -2
  48. package/dist/lorebook.js +841 -1
  49. package/dist/lorebook.js.map +1 -1
  50. package/dist/media.cjs +6660 -0
  51. package/dist/media.cjs.map +1 -0
  52. package/dist/media.d.cts +87 -0
  53. package/dist/media.d.ts +87 -2
  54. package/dist/media.js +6643 -1
  55. package/dist/media.js.map +1 -1
  56. package/dist/normalizer.cjs +502 -0
  57. package/dist/normalizer.cjs.map +1 -0
  58. package/dist/normalizer.d.cts +1216 -0
  59. package/dist/normalizer.d.ts +1216 -2
  60. package/dist/normalizer.js +478 -1
  61. package/dist/normalizer.js.map +1 -1
  62. package/dist/png.cjs +778 -0
  63. package/dist/png.cjs.map +1 -0
  64. package/dist/png.d.cts +786 -0
  65. package/dist/png.d.ts +786 -2
  66. package/dist/png.js +754 -1
  67. package/dist/png.js.map +1 -1
  68. package/dist/schemas.cjs +799 -0
  69. package/dist/schemas.cjs.map +1 -0
  70. package/dist/schemas.d.cts +2178 -0
  71. package/dist/schemas.d.ts +2178 -2
  72. package/dist/schemas.js +775 -1
  73. package/dist/schemas.js.map +1 -1
  74. package/dist/tokenizers.cjs +153 -0
  75. package/dist/tokenizers.cjs.map +1 -0
  76. package/dist/tokenizers.d.cts +155 -0
  77. package/dist/tokenizers.d.ts +155 -2
  78. package/dist/tokenizers.js +129 -1
  79. package/dist/tokenizers.js.map +1 -1
  80. package/dist/voxta.cjs +7995 -0
  81. package/dist/voxta.cjs.map +1 -0
  82. package/dist/voxta.d.cts +1349 -0
  83. package/dist/voxta.d.ts +1349 -2
  84. package/dist/voxta.js +7978 -1
  85. package/dist/voxta.js.map +1 -1
  86. package/package.json +177 -45
  87. package/dist/app-framework.d.ts.map +0 -1
  88. package/dist/charx.d.ts.map +0 -1
  89. package/dist/core.d.ts.map +0 -1
  90. package/dist/exporter.d.ts.map +0 -1
  91. package/dist/federation.d.ts.map +0 -1
  92. package/dist/index.d.ts.map +0 -1
  93. package/dist/loader.d.ts.map +0 -1
  94. package/dist/lorebook.d.ts.map +0 -1
  95. package/dist/media.d.ts.map +0 -1
  96. package/dist/normalizer.d.ts.map +0 -1
  97. package/dist/png.d.ts.map +0 -1
  98. package/dist/schemas.d.ts.map +0 -1
  99. package/dist/tokenizers.d.ts.map +0 -1
  100. package/dist/voxta.d.ts.map +0 -1
@@ -1,2 +1,1008 @@
1
- export * from '@character-foundry/lorebook';
2
- //# sourceMappingURL=lorebook.d.ts.map
1
+ import { z } from 'zod';
2
+
3
+ declare const CCv3LorebookEntrySchema: z.ZodObject<{
4
+ keys: z.ZodArray<z.ZodString, "many">;
5
+ content: z.ZodString;
6
+ enabled: z.ZodBoolean;
7
+ insertion_order: z.ZodNumber;
8
+ case_sensitive: z.ZodOptional<z.ZodBoolean>;
9
+ name: z.ZodOptional<z.ZodString>;
10
+ priority: z.ZodOptional<z.ZodNumber>;
11
+ id: z.ZodOptional<z.ZodNumber>;
12
+ comment: z.ZodOptional<z.ZodString>;
13
+ selective: z.ZodOptional<z.ZodBoolean>;
14
+ secondary_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ constant: z.ZodOptional<z.ZodBoolean>;
16
+ position: z.ZodOptional<z.ZodEnum<[
17
+ "before_char",
18
+ "after_char"
19
+ ]>>;
20
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
+ automation_id: z.ZodOptional<z.ZodString>;
22
+ role: z.ZodOptional<z.ZodEnum<[
23
+ "system",
24
+ "user",
25
+ "assistant"
26
+ ]>>;
27
+ group: z.ZodOptional<z.ZodString>;
28
+ scan_frequency: z.ZodOptional<z.ZodNumber>;
29
+ probability: z.ZodOptional<z.ZodNumber>;
30
+ use_regex: z.ZodOptional<z.ZodBoolean>;
31
+ depth: z.ZodOptional<z.ZodNumber>;
32
+ selective_logic: z.ZodOptional<z.ZodEnum<[
33
+ "AND",
34
+ "NOT"
35
+ ]>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ keys: string[];
38
+ content: string;
39
+ enabled: boolean;
40
+ insertion_order: number;
41
+ name?: string | undefined;
42
+ extensions?: Record<string, unknown> | undefined;
43
+ case_sensitive?: boolean | undefined;
44
+ priority?: number | undefined;
45
+ id?: number | undefined;
46
+ comment?: string | undefined;
47
+ selective?: boolean | undefined;
48
+ secondary_keys?: string[] | undefined;
49
+ constant?: boolean | undefined;
50
+ position?: "before_char" | "after_char" | undefined;
51
+ automation_id?: string | undefined;
52
+ role?: "system" | "user" | "assistant" | undefined;
53
+ group?: string | undefined;
54
+ scan_frequency?: number | undefined;
55
+ probability?: number | undefined;
56
+ use_regex?: boolean | undefined;
57
+ depth?: number | undefined;
58
+ selective_logic?: "AND" | "NOT" | undefined;
59
+ }, {
60
+ keys: string[];
61
+ content: string;
62
+ enabled: boolean;
63
+ insertion_order: number;
64
+ name?: string | undefined;
65
+ extensions?: Record<string, unknown> | undefined;
66
+ case_sensitive?: boolean | undefined;
67
+ priority?: number | undefined;
68
+ id?: number | undefined;
69
+ comment?: string | undefined;
70
+ selective?: boolean | undefined;
71
+ secondary_keys?: string[] | undefined;
72
+ constant?: boolean | undefined;
73
+ position?: "before_char" | "after_char" | undefined;
74
+ automation_id?: string | undefined;
75
+ role?: "system" | "user" | "assistant" | undefined;
76
+ group?: string | undefined;
77
+ scan_frequency?: number | undefined;
78
+ probability?: number | undefined;
79
+ use_regex?: boolean | undefined;
80
+ depth?: number | undefined;
81
+ selective_logic?: "AND" | "NOT" | undefined;
82
+ }>;
83
+ declare const CCv3CharacterBookSchema: z.ZodObject<{
84
+ name: z.ZodOptional<z.ZodString>;
85
+ description: z.ZodOptional<z.ZodString>;
86
+ scan_depth: z.ZodOptional<z.ZodNumber>;
87
+ token_budget: z.ZodOptional<z.ZodNumber>;
88
+ recursive_scanning: z.ZodOptional<z.ZodBoolean>;
89
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
+ entries: z.ZodArray<z.ZodObject<{
91
+ keys: z.ZodArray<z.ZodString, "many">;
92
+ content: z.ZodString;
93
+ enabled: z.ZodBoolean;
94
+ insertion_order: z.ZodNumber;
95
+ case_sensitive: z.ZodOptional<z.ZodBoolean>;
96
+ name: z.ZodOptional<z.ZodString>;
97
+ priority: z.ZodOptional<z.ZodNumber>;
98
+ id: z.ZodOptional<z.ZodNumber>;
99
+ comment: z.ZodOptional<z.ZodString>;
100
+ selective: z.ZodOptional<z.ZodBoolean>;
101
+ secondary_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
102
+ constant: z.ZodOptional<z.ZodBoolean>;
103
+ position: z.ZodOptional<z.ZodEnum<[
104
+ "before_char",
105
+ "after_char"
106
+ ]>>;
107
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
+ automation_id: z.ZodOptional<z.ZodString>;
109
+ role: z.ZodOptional<z.ZodEnum<[
110
+ "system",
111
+ "user",
112
+ "assistant"
113
+ ]>>;
114
+ group: z.ZodOptional<z.ZodString>;
115
+ scan_frequency: z.ZodOptional<z.ZodNumber>;
116
+ probability: z.ZodOptional<z.ZodNumber>;
117
+ use_regex: z.ZodOptional<z.ZodBoolean>;
118
+ depth: z.ZodOptional<z.ZodNumber>;
119
+ selective_logic: z.ZodOptional<z.ZodEnum<[
120
+ "AND",
121
+ "NOT"
122
+ ]>>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ keys: string[];
125
+ content: string;
126
+ enabled: boolean;
127
+ insertion_order: number;
128
+ name?: string | undefined;
129
+ extensions?: Record<string, unknown> | undefined;
130
+ case_sensitive?: boolean | undefined;
131
+ priority?: number | undefined;
132
+ id?: number | undefined;
133
+ comment?: string | undefined;
134
+ selective?: boolean | undefined;
135
+ secondary_keys?: string[] | undefined;
136
+ constant?: boolean | undefined;
137
+ position?: "before_char" | "after_char" | undefined;
138
+ automation_id?: string | undefined;
139
+ role?: "system" | "user" | "assistant" | undefined;
140
+ group?: string | undefined;
141
+ scan_frequency?: number | undefined;
142
+ probability?: number | undefined;
143
+ use_regex?: boolean | undefined;
144
+ depth?: number | undefined;
145
+ selective_logic?: "AND" | "NOT" | undefined;
146
+ }, {
147
+ keys: string[];
148
+ content: string;
149
+ enabled: boolean;
150
+ insertion_order: number;
151
+ name?: string | undefined;
152
+ extensions?: Record<string, unknown> | undefined;
153
+ case_sensitive?: boolean | undefined;
154
+ priority?: number | undefined;
155
+ id?: number | undefined;
156
+ comment?: string | undefined;
157
+ selective?: boolean | undefined;
158
+ secondary_keys?: string[] | undefined;
159
+ constant?: boolean | undefined;
160
+ position?: "before_char" | "after_char" | undefined;
161
+ automation_id?: string | undefined;
162
+ role?: "system" | "user" | "assistant" | undefined;
163
+ group?: string | undefined;
164
+ scan_frequency?: number | undefined;
165
+ probability?: number | undefined;
166
+ use_regex?: boolean | undefined;
167
+ depth?: number | undefined;
168
+ selective_logic?: "AND" | "NOT" | undefined;
169
+ }>, "many">;
170
+ }, "strip", z.ZodTypeAny, {
171
+ entries: {
172
+ keys: string[];
173
+ content: string;
174
+ enabled: boolean;
175
+ insertion_order: number;
176
+ name?: string | undefined;
177
+ extensions?: Record<string, unknown> | undefined;
178
+ case_sensitive?: boolean | undefined;
179
+ priority?: number | undefined;
180
+ id?: number | undefined;
181
+ comment?: string | undefined;
182
+ selective?: boolean | undefined;
183
+ secondary_keys?: string[] | undefined;
184
+ constant?: boolean | undefined;
185
+ position?: "before_char" | "after_char" | undefined;
186
+ automation_id?: string | undefined;
187
+ role?: "system" | "user" | "assistant" | undefined;
188
+ group?: string | undefined;
189
+ scan_frequency?: number | undefined;
190
+ probability?: number | undefined;
191
+ use_regex?: boolean | undefined;
192
+ depth?: number | undefined;
193
+ selective_logic?: "AND" | "NOT" | undefined;
194
+ }[];
195
+ name?: string | undefined;
196
+ description?: string | undefined;
197
+ scan_depth?: number | undefined;
198
+ token_budget?: number | undefined;
199
+ recursive_scanning?: boolean | undefined;
200
+ extensions?: Record<string, unknown> | undefined;
201
+ }, {
202
+ entries: {
203
+ keys: string[];
204
+ content: string;
205
+ enabled: boolean;
206
+ insertion_order: number;
207
+ name?: string | undefined;
208
+ extensions?: Record<string, unknown> | undefined;
209
+ case_sensitive?: boolean | undefined;
210
+ priority?: number | undefined;
211
+ id?: number | undefined;
212
+ comment?: string | undefined;
213
+ selective?: boolean | undefined;
214
+ secondary_keys?: string[] | undefined;
215
+ constant?: boolean | undefined;
216
+ position?: "before_char" | "after_char" | undefined;
217
+ automation_id?: string | undefined;
218
+ role?: "system" | "user" | "assistant" | undefined;
219
+ group?: string | undefined;
220
+ scan_frequency?: number | undefined;
221
+ probability?: number | undefined;
222
+ use_regex?: boolean | undefined;
223
+ depth?: number | undefined;
224
+ selective_logic?: "AND" | "NOT" | undefined;
225
+ }[];
226
+ name?: string | undefined;
227
+ description?: string | undefined;
228
+ scan_depth?: number | undefined;
229
+ token_budget?: number | undefined;
230
+ recursive_scanning?: boolean | undefined;
231
+ extensions?: Record<string, unknown> | undefined;
232
+ }>;
233
+ declare const CCv3DataSchema: z.ZodObject<{
234
+ spec: z.ZodLiteral<"chara_card_v3">;
235
+ spec_version: z.ZodLiteral<"3.0">;
236
+ data: z.ZodObject<{
237
+ name: z.ZodDefault<z.ZodString>;
238
+ description: z.ZodDefault<z.ZodString>;
239
+ personality: z.ZodDefault<z.ZodNullable<z.ZodString>>;
240
+ scenario: z.ZodDefault<z.ZodString>;
241
+ first_mes: z.ZodDefault<z.ZodString>;
242
+ mes_example: z.ZodDefault<z.ZodNullable<z.ZodString>>;
243
+ creator: z.ZodDefault<z.ZodString>;
244
+ character_version: z.ZodDefault<z.ZodString>;
245
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
246
+ group_only_greetings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
247
+ creator_notes: z.ZodOptional<z.ZodString>;
248
+ system_prompt: z.ZodOptional<z.ZodString>;
249
+ post_history_instructions: z.ZodOptional<z.ZodString>;
250
+ alternate_greetings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
251
+ character_book: z.ZodNullable<z.ZodOptional<z.ZodObject<{
252
+ name: z.ZodOptional<z.ZodString>;
253
+ description: z.ZodOptional<z.ZodString>;
254
+ scan_depth: z.ZodOptional<z.ZodNumber>;
255
+ token_budget: z.ZodOptional<z.ZodNumber>;
256
+ recursive_scanning: z.ZodOptional<z.ZodBoolean>;
257
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
258
+ entries: z.ZodArray<z.ZodObject<{
259
+ keys: z.ZodArray<z.ZodString, "many">;
260
+ content: z.ZodString;
261
+ enabled: z.ZodBoolean;
262
+ insertion_order: z.ZodNumber;
263
+ case_sensitive: z.ZodOptional<z.ZodBoolean>;
264
+ name: z.ZodOptional<z.ZodString>;
265
+ priority: z.ZodOptional<z.ZodNumber>;
266
+ id: z.ZodOptional<z.ZodNumber>;
267
+ comment: z.ZodOptional<z.ZodString>;
268
+ selective: z.ZodOptional<z.ZodBoolean>;
269
+ secondary_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
270
+ constant: z.ZodOptional<z.ZodBoolean>;
271
+ position: z.ZodOptional<z.ZodEnum<[
272
+ "before_char",
273
+ "after_char"
274
+ ]>>;
275
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
276
+ automation_id: z.ZodOptional<z.ZodString>;
277
+ role: z.ZodOptional<z.ZodEnum<[
278
+ "system",
279
+ "user",
280
+ "assistant"
281
+ ]>>;
282
+ group: z.ZodOptional<z.ZodString>;
283
+ scan_frequency: z.ZodOptional<z.ZodNumber>;
284
+ probability: z.ZodOptional<z.ZodNumber>;
285
+ use_regex: z.ZodOptional<z.ZodBoolean>;
286
+ depth: z.ZodOptional<z.ZodNumber>;
287
+ selective_logic: z.ZodOptional<z.ZodEnum<[
288
+ "AND",
289
+ "NOT"
290
+ ]>>;
291
+ }, "strip", z.ZodTypeAny, {
292
+ keys: string[];
293
+ content: string;
294
+ enabled: boolean;
295
+ insertion_order: number;
296
+ name?: string | undefined;
297
+ extensions?: Record<string, unknown> | undefined;
298
+ case_sensitive?: boolean | undefined;
299
+ priority?: number | undefined;
300
+ id?: number | undefined;
301
+ comment?: string | undefined;
302
+ selective?: boolean | undefined;
303
+ secondary_keys?: string[] | undefined;
304
+ constant?: boolean | undefined;
305
+ position?: "before_char" | "after_char" | undefined;
306
+ automation_id?: string | undefined;
307
+ role?: "system" | "user" | "assistant" | undefined;
308
+ group?: string | undefined;
309
+ scan_frequency?: number | undefined;
310
+ probability?: number | undefined;
311
+ use_regex?: boolean | undefined;
312
+ depth?: number | undefined;
313
+ selective_logic?: "AND" | "NOT" | undefined;
314
+ }, {
315
+ keys: string[];
316
+ content: string;
317
+ enabled: boolean;
318
+ insertion_order: number;
319
+ name?: string | undefined;
320
+ extensions?: Record<string, unknown> | undefined;
321
+ case_sensitive?: boolean | undefined;
322
+ priority?: number | undefined;
323
+ id?: number | undefined;
324
+ comment?: string | undefined;
325
+ selective?: boolean | undefined;
326
+ secondary_keys?: string[] | undefined;
327
+ constant?: boolean | undefined;
328
+ position?: "before_char" | "after_char" | undefined;
329
+ automation_id?: string | undefined;
330
+ role?: "system" | "user" | "assistant" | undefined;
331
+ group?: string | undefined;
332
+ scan_frequency?: number | undefined;
333
+ probability?: number | undefined;
334
+ use_regex?: boolean | undefined;
335
+ depth?: number | undefined;
336
+ selective_logic?: "AND" | "NOT" | undefined;
337
+ }>, "many">;
338
+ }, "strip", z.ZodTypeAny, {
339
+ entries: {
340
+ keys: string[];
341
+ content: string;
342
+ enabled: boolean;
343
+ insertion_order: number;
344
+ name?: string | undefined;
345
+ extensions?: Record<string, unknown> | undefined;
346
+ case_sensitive?: boolean | undefined;
347
+ priority?: number | undefined;
348
+ id?: number | undefined;
349
+ comment?: string | undefined;
350
+ selective?: boolean | undefined;
351
+ secondary_keys?: string[] | undefined;
352
+ constant?: boolean | undefined;
353
+ position?: "before_char" | "after_char" | undefined;
354
+ automation_id?: string | undefined;
355
+ role?: "system" | "user" | "assistant" | undefined;
356
+ group?: string | undefined;
357
+ scan_frequency?: number | undefined;
358
+ probability?: number | undefined;
359
+ use_regex?: boolean | undefined;
360
+ depth?: number | undefined;
361
+ selective_logic?: "AND" | "NOT" | undefined;
362
+ }[];
363
+ name?: string | undefined;
364
+ description?: string | undefined;
365
+ scan_depth?: number | undefined;
366
+ token_budget?: number | undefined;
367
+ recursive_scanning?: boolean | undefined;
368
+ extensions?: Record<string, unknown> | undefined;
369
+ }, {
370
+ entries: {
371
+ keys: string[];
372
+ content: string;
373
+ enabled: boolean;
374
+ insertion_order: number;
375
+ name?: string | undefined;
376
+ extensions?: Record<string, unknown> | undefined;
377
+ case_sensitive?: boolean | undefined;
378
+ priority?: number | undefined;
379
+ id?: number | undefined;
380
+ comment?: string | undefined;
381
+ selective?: boolean | undefined;
382
+ secondary_keys?: string[] | undefined;
383
+ constant?: boolean | undefined;
384
+ position?: "before_char" | "after_char" | undefined;
385
+ automation_id?: string | undefined;
386
+ role?: "system" | "user" | "assistant" | undefined;
387
+ group?: string | undefined;
388
+ scan_frequency?: number | undefined;
389
+ probability?: number | undefined;
390
+ use_regex?: boolean | undefined;
391
+ depth?: number | undefined;
392
+ selective_logic?: "AND" | "NOT" | undefined;
393
+ }[];
394
+ name?: string | undefined;
395
+ description?: string | undefined;
396
+ scan_depth?: number | undefined;
397
+ token_budget?: number | undefined;
398
+ recursive_scanning?: boolean | undefined;
399
+ extensions?: Record<string, unknown> | undefined;
400
+ }>>>;
401
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
402
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
403
+ type: z.ZodEnum<[
404
+ "icon",
405
+ "background",
406
+ "emotion",
407
+ "user_icon",
408
+ "sound",
409
+ "video",
410
+ "custom",
411
+ "x-risu-asset"
412
+ ]>;
413
+ uri: z.ZodString;
414
+ name: z.ZodString;
415
+ ext: z.ZodString;
416
+ }, "strip", z.ZodTypeAny, {
417
+ name: string;
418
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
419
+ uri: string;
420
+ ext: string;
421
+ }, {
422
+ name: string;
423
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
424
+ uri: string;
425
+ ext: string;
426
+ }>, "many">>;
427
+ nickname: z.ZodOptional<z.ZodString>;
428
+ creator_notes_multilingual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
429
+ source: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
430
+ creation_date: z.ZodOptional<z.ZodNumber>;
431
+ modification_date: z.ZodOptional<z.ZodNumber>;
432
+ }, "strip", z.ZodTypeAny, {
433
+ name: string;
434
+ description: string;
435
+ personality: string | null;
436
+ scenario: string;
437
+ first_mes: string;
438
+ mes_example: string | null;
439
+ tags: string[];
440
+ creator: string;
441
+ character_version: string;
442
+ group_only_greetings: string[];
443
+ extensions?: Record<string, unknown> | undefined;
444
+ creator_notes?: string | undefined;
445
+ system_prompt?: string | undefined;
446
+ post_history_instructions?: string | undefined;
447
+ alternate_greetings?: string[] | undefined;
448
+ character_book?: {
449
+ entries: {
450
+ keys: string[];
451
+ content: string;
452
+ enabled: boolean;
453
+ insertion_order: number;
454
+ name?: string | undefined;
455
+ extensions?: Record<string, unknown> | undefined;
456
+ case_sensitive?: boolean | undefined;
457
+ priority?: number | undefined;
458
+ id?: number | undefined;
459
+ comment?: string | undefined;
460
+ selective?: boolean | undefined;
461
+ secondary_keys?: string[] | undefined;
462
+ constant?: boolean | undefined;
463
+ position?: "before_char" | "after_char" | undefined;
464
+ automation_id?: string | undefined;
465
+ role?: "system" | "user" | "assistant" | undefined;
466
+ group?: string | undefined;
467
+ scan_frequency?: number | undefined;
468
+ probability?: number | undefined;
469
+ use_regex?: boolean | undefined;
470
+ depth?: number | undefined;
471
+ selective_logic?: "AND" | "NOT" | undefined;
472
+ }[];
473
+ name?: string | undefined;
474
+ description?: string | undefined;
475
+ scan_depth?: number | undefined;
476
+ token_budget?: number | undefined;
477
+ recursive_scanning?: boolean | undefined;
478
+ extensions?: Record<string, unknown> | undefined;
479
+ } | null | undefined;
480
+ assets?: {
481
+ name: string;
482
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
483
+ uri: string;
484
+ ext: string;
485
+ }[] | undefined;
486
+ nickname?: string | undefined;
487
+ creator_notes_multilingual?: Record<string, string> | undefined;
488
+ source?: string[] | undefined;
489
+ creation_date?: number | undefined;
490
+ modification_date?: number | undefined;
491
+ }, {
492
+ name?: string | undefined;
493
+ description?: string | undefined;
494
+ extensions?: Record<string, unknown> | undefined;
495
+ personality?: string | null | undefined;
496
+ scenario?: string | undefined;
497
+ first_mes?: string | undefined;
498
+ mes_example?: string | null | undefined;
499
+ creator_notes?: string | undefined;
500
+ system_prompt?: string | undefined;
501
+ post_history_instructions?: string | undefined;
502
+ alternate_greetings?: string[] | undefined;
503
+ character_book?: {
504
+ entries: {
505
+ keys: string[];
506
+ content: string;
507
+ enabled: boolean;
508
+ insertion_order: number;
509
+ name?: string | undefined;
510
+ extensions?: Record<string, unknown> | undefined;
511
+ case_sensitive?: boolean | undefined;
512
+ priority?: number | undefined;
513
+ id?: number | undefined;
514
+ comment?: string | undefined;
515
+ selective?: boolean | undefined;
516
+ secondary_keys?: string[] | undefined;
517
+ constant?: boolean | undefined;
518
+ position?: "before_char" | "after_char" | undefined;
519
+ automation_id?: string | undefined;
520
+ role?: "system" | "user" | "assistant" | undefined;
521
+ group?: string | undefined;
522
+ scan_frequency?: number | undefined;
523
+ probability?: number | undefined;
524
+ use_regex?: boolean | undefined;
525
+ depth?: number | undefined;
526
+ selective_logic?: "AND" | "NOT" | undefined;
527
+ }[];
528
+ name?: string | undefined;
529
+ description?: string | undefined;
530
+ scan_depth?: number | undefined;
531
+ token_budget?: number | undefined;
532
+ recursive_scanning?: boolean | undefined;
533
+ extensions?: Record<string, unknown> | undefined;
534
+ } | null | undefined;
535
+ tags?: string[] | undefined;
536
+ creator?: string | undefined;
537
+ character_version?: string | undefined;
538
+ group_only_greetings?: string[] | undefined;
539
+ assets?: {
540
+ name: string;
541
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
542
+ uri: string;
543
+ ext: string;
544
+ }[] | undefined;
545
+ nickname?: string | undefined;
546
+ creator_notes_multilingual?: Record<string, string> | undefined;
547
+ source?: string[] | undefined;
548
+ creation_date?: number | undefined;
549
+ modification_date?: number | undefined;
550
+ }>;
551
+ }, "strip", z.ZodTypeAny, {
552
+ data: {
553
+ name: string;
554
+ description: string;
555
+ personality: string | null;
556
+ scenario: string;
557
+ first_mes: string;
558
+ mes_example: string | null;
559
+ tags: string[];
560
+ creator: string;
561
+ character_version: string;
562
+ group_only_greetings: string[];
563
+ extensions?: Record<string, unknown> | undefined;
564
+ creator_notes?: string | undefined;
565
+ system_prompt?: string | undefined;
566
+ post_history_instructions?: string | undefined;
567
+ alternate_greetings?: string[] | undefined;
568
+ character_book?: {
569
+ entries: {
570
+ keys: string[];
571
+ content: string;
572
+ enabled: boolean;
573
+ insertion_order: number;
574
+ name?: string | undefined;
575
+ extensions?: Record<string, unknown> | undefined;
576
+ case_sensitive?: boolean | undefined;
577
+ priority?: number | undefined;
578
+ id?: number | undefined;
579
+ comment?: string | undefined;
580
+ selective?: boolean | undefined;
581
+ secondary_keys?: string[] | undefined;
582
+ constant?: boolean | undefined;
583
+ position?: "before_char" | "after_char" | undefined;
584
+ automation_id?: string | undefined;
585
+ role?: "system" | "user" | "assistant" | undefined;
586
+ group?: string | undefined;
587
+ scan_frequency?: number | undefined;
588
+ probability?: number | undefined;
589
+ use_regex?: boolean | undefined;
590
+ depth?: number | undefined;
591
+ selective_logic?: "AND" | "NOT" | undefined;
592
+ }[];
593
+ name?: string | undefined;
594
+ description?: string | undefined;
595
+ scan_depth?: number | undefined;
596
+ token_budget?: number | undefined;
597
+ recursive_scanning?: boolean | undefined;
598
+ extensions?: Record<string, unknown> | undefined;
599
+ } | null | undefined;
600
+ assets?: {
601
+ name: string;
602
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
603
+ uri: string;
604
+ ext: string;
605
+ }[] | undefined;
606
+ nickname?: string | undefined;
607
+ creator_notes_multilingual?: Record<string, string> | undefined;
608
+ source?: string[] | undefined;
609
+ creation_date?: number | undefined;
610
+ modification_date?: number | undefined;
611
+ };
612
+ spec: "chara_card_v3";
613
+ spec_version: "3.0";
614
+ }, {
615
+ data: {
616
+ name?: string | undefined;
617
+ description?: string | undefined;
618
+ extensions?: Record<string, unknown> | undefined;
619
+ personality?: string | null | undefined;
620
+ scenario?: string | undefined;
621
+ first_mes?: string | undefined;
622
+ mes_example?: string | null | undefined;
623
+ creator_notes?: string | undefined;
624
+ system_prompt?: string | undefined;
625
+ post_history_instructions?: string | undefined;
626
+ alternate_greetings?: string[] | undefined;
627
+ character_book?: {
628
+ entries: {
629
+ keys: string[];
630
+ content: string;
631
+ enabled: boolean;
632
+ insertion_order: number;
633
+ name?: string | undefined;
634
+ extensions?: Record<string, unknown> | undefined;
635
+ case_sensitive?: boolean | undefined;
636
+ priority?: number | undefined;
637
+ id?: number | undefined;
638
+ comment?: string | undefined;
639
+ selective?: boolean | undefined;
640
+ secondary_keys?: string[] | undefined;
641
+ constant?: boolean | undefined;
642
+ position?: "before_char" | "after_char" | undefined;
643
+ automation_id?: string | undefined;
644
+ role?: "system" | "user" | "assistant" | undefined;
645
+ group?: string | undefined;
646
+ scan_frequency?: number | undefined;
647
+ probability?: number | undefined;
648
+ use_regex?: boolean | undefined;
649
+ depth?: number | undefined;
650
+ selective_logic?: "AND" | "NOT" | undefined;
651
+ }[];
652
+ name?: string | undefined;
653
+ description?: string | undefined;
654
+ scan_depth?: number | undefined;
655
+ token_budget?: number | undefined;
656
+ recursive_scanning?: boolean | undefined;
657
+ extensions?: Record<string, unknown> | undefined;
658
+ } | null | undefined;
659
+ tags?: string[] | undefined;
660
+ creator?: string | undefined;
661
+ character_version?: string | undefined;
662
+ group_only_greetings?: string[] | undefined;
663
+ assets?: {
664
+ name: string;
665
+ type: "custom" | "icon" | "background" | "emotion" | "user_icon" | "sound" | "video" | "x-risu-asset";
666
+ uri: string;
667
+ ext: string;
668
+ }[] | undefined;
669
+ nickname?: string | undefined;
670
+ creator_notes_multilingual?: Record<string, string> | undefined;
671
+ source?: string[] | undefined;
672
+ creation_date?: number | undefined;
673
+ modification_date?: number | undefined;
674
+ };
675
+ spec: "chara_card_v3";
676
+ spec_version: "3.0";
677
+ }>;
678
+ /**
679
+ * Lorebook entry for v3 cards
680
+ */
681
+ export type CCv3LorebookEntry = z.infer<typeof CCv3LorebookEntrySchema>;
682
+ /**
683
+ * Character book (lorebook) for v3 cards
684
+ */
685
+ export type CCv3CharacterBook = z.infer<typeof CCv3CharacterBookSchema>;
686
+ /**
687
+ * Character Card v3 full structure
688
+ */
689
+ export type CCv3Data = z.infer<typeof CCv3DataSchema>;
690
+ /**
691
+ * Binary Data Utilities
692
+ *
693
+ * Universal binary data operations using Uint8Array.
694
+ * Works in both Node.js and browser environments.
695
+ */
696
+ /**
697
+ * Universal binary data type (works in both environments)
698
+ */
699
+ export type BinaryData = Uint8Array;
700
+ /**
701
+ * Lorebook Types
702
+ *
703
+ * Type definitions for lorebook handling across formats.
704
+ */
705
+ /**
706
+ * Known lorebook formats
707
+ */
708
+ export type LorebookFormat = "ccv3" | "sillytavern" | "agnai" | "risu" | "wyvern" | "unknown";
709
+ /**
710
+ * Result of parsing a standalone lorebook file
711
+ */
712
+ export interface ParsedLorebook {
713
+ /** Normalized CCv3 format */
714
+ book: CCv3CharacterBook;
715
+ /** Original format detected */
716
+ originalFormat: LorebookFormat;
717
+ /** Raw original data for round-trip preservation */
718
+ originalShape: unknown;
719
+ }
720
+ /**
721
+ * Reference to a linked/external lorebook found in card extensions
722
+ */
723
+ export interface LorebookRef {
724
+ /** Source URL */
725
+ url: string;
726
+ /** Platform identifier */
727
+ platform: string;
728
+ /** ID on source platform */
729
+ id?: string;
730
+ /** Display name if available */
731
+ name?: string;
732
+ }
733
+ /**
734
+ * A downloaded/fetched linked lorebook with source tracking
735
+ */
736
+ export interface LinkedLorebook {
737
+ /** Source URL */
738
+ source: string;
739
+ /** Platform identifier */
740
+ platform: string;
741
+ /** ID on source platform */
742
+ sourceId?: string;
743
+ /** When it was fetched (ISO timestamp) */
744
+ fetchedAt: string;
745
+ /** Display name */
746
+ name?: string;
747
+ /** The actual lorebook content */
748
+ book: CCv3CharacterBook;
749
+ }
750
+ /**
751
+ * Source metadata stamped on entries from linked lorebooks
752
+ * Stored in entry.extensions.lorebookSource
753
+ */
754
+ export interface EntrySourceMeta {
755
+ /** Source URL of the linked lorebook */
756
+ linkedFrom: string;
757
+ /** Platform identifier */
758
+ platform: string;
759
+ /** When the lorebook was fetched */
760
+ fetchedAt: string;
761
+ /** Original entry ID/name in source */
762
+ originalEntryId?: string;
763
+ /** Lorebook name for display */
764
+ lorebookName?: string;
765
+ }
766
+ /**
767
+ * A card's complete lorebook collection (multiple books, never merged)
768
+ */
769
+ export interface LorebookCollection {
770
+ /** Embedded lorebooks (directly in card) - can be multiple */
771
+ embedded: CCv3CharacterBook[];
772
+ /** Linked lorebooks (fetched from external sources) */
773
+ linked: LinkedLorebook[];
774
+ }
775
+ /**
776
+ * Extended entry with source tracking
777
+ */
778
+ export interface TrackedEntry extends CCv3LorebookEntry {
779
+ extensions?: {
780
+ lorebookSource?: EntrySourceMeta;
781
+ [key: string]: unknown;
782
+ };
783
+ }
784
+ /**
785
+ * SillyTavern world_info format (for reference)
786
+ */
787
+ export interface SillyTavernWorldInfo {
788
+ entries: Record<string, SillyTavernEntry>;
789
+ name?: string;
790
+ description?: string;
791
+ }
792
+ export interface SillyTavernEntry {
793
+ uid: number;
794
+ key: string[];
795
+ keysecondary?: string[];
796
+ comment?: string;
797
+ content: string;
798
+ constant?: boolean;
799
+ selective?: boolean;
800
+ selectiveLogic?: number;
801
+ order?: number;
802
+ position?: number;
803
+ disable?: boolean;
804
+ excludeRecursion?: boolean;
805
+ probability?: number;
806
+ useProbability?: boolean;
807
+ depth?: number;
808
+ group?: string;
809
+ scanDepth?: number;
810
+ caseSensitive?: boolean;
811
+ matchWholeWords?: boolean;
812
+ automationId?: string;
813
+ role?: number;
814
+ vectorized?: boolean;
815
+ groupOverride?: boolean;
816
+ groupWeight?: number;
817
+ sticky?: number;
818
+ cooldown?: number;
819
+ delay?: number;
820
+ }
821
+ /**
822
+ * Agnai lorebook format (for reference)
823
+ */
824
+ export interface AgnaiLorebook {
825
+ kind: "memory";
826
+ name: string;
827
+ description?: string;
828
+ entries: AgnaiEntry[];
829
+ }
830
+ export interface AgnaiEntry {
831
+ name: string;
832
+ entry: string;
833
+ keywords: string[];
834
+ priority: number;
835
+ weight: number;
836
+ enabled: boolean;
837
+ }
838
+ /**
839
+ * Lorebook Parser
840
+ *
841
+ * Parse standalone lorebook files from various formats.
842
+ */
843
+ /**
844
+ * Parse a standalone lorebook file
845
+ *
846
+ * Detects format and normalizes to CCv3 character_book structure.
847
+ * Preserves original shape for round-trip.
848
+ */
849
+ export declare function parseLorebook(data: BinaryData): ParsedLorebook;
850
+ /**
851
+ * Detect the format of a lorebook JSON object
852
+ */
853
+ export declare function detectLorebookFormat(data: unknown): LorebookFormat;
854
+ /**
855
+ * Normalize any lorebook format to CCv3 character_book
856
+ */
857
+ export declare function normalizeToCC3(data: unknown, format: LorebookFormat): CCv3CharacterBook;
858
+ /**
859
+ * Lorebook Extractor
860
+ *
861
+ * Extract linked lorebook references from cards and
862
+ * separate linked entries from embedded entries.
863
+ */
864
+ /**
865
+ * Extract linked lorebook references from card extensions
866
+ *
867
+ * Looks for lorebook URLs/IDs in various extension patterns:
868
+ * - extensions.chub.linked_lorebooks
869
+ * - extensions.world_infos
870
+ * - extensions.linked_lorebooks
871
+ * - etc.
872
+ */
873
+ export declare function extractLorebookRefs(card: CCv3Data): LorebookRef[];
874
+ /**
875
+ * Separate embedded entries from linked entries in a character_book
876
+ *
877
+ * Uses entry.extensions.lorebookSource to identify linked entries.
878
+ * Returns the collection with embedded and linked separated.
879
+ */
880
+ export declare function extractLinkedEntries(book: CCv3CharacterBook): {
881
+ embedded: CCv3CharacterBook;
882
+ linked: Map<string, CCv3CharacterBook>;
883
+ };
884
+ /**
885
+ * Get all lorebooks from a card as a collection
886
+ *
887
+ * This extracts:
888
+ * 1. The embedded character_book (may be empty)
889
+ * 2. Any additional embedded lorebooks from extensions
890
+ * 3. Separates linked entries if they have source metadata
891
+ */
892
+ export declare function getLorebookCollection(card: CCv3Data): LorebookCollection;
893
+ /**
894
+ * Lorebook Inserter
895
+ *
896
+ * Stamp entries with source metadata when inserting linked lorebooks.
897
+ * Keeps lorebooks separate - never smooshes to one giant lorebook.
898
+ */
899
+ /**
900
+ * Stamp all entries in a lorebook with source metadata
901
+ *
902
+ * Used when fetching a linked lorebook to mark where entries came from.
903
+ * This allows later extraction/separation of linked vs embedded entries.
904
+ */
905
+ export declare function stampEntriesWithSource(book: CCv3CharacterBook, source: Omit<EntrySourceMeta, "originalEntryId">): CCv3CharacterBook;
906
+ /**
907
+ * Create a LinkedLorebook from a fetched book with source info
908
+ *
909
+ * This is used after downloading/fetching a lorebook from an external source.
910
+ * The book is stamped with source metadata for later extraction.
911
+ */
912
+ export declare function createLinkedLorebook(book: CCv3CharacterBook, sourceUrl: string, platform: string, sourceId?: string): LinkedLorebook;
913
+ /**
914
+ * Add a linked lorebook to a card's collection
915
+ *
916
+ * Does NOT merge into character_book - keeps it separate.
917
+ * Stores in extensions.additional_lorebooks array.
918
+ */
919
+ export declare function addLinkedLorebookToCard(card: CCv3Data, linkedBook: LinkedLorebook): CCv3Data;
920
+ /**
921
+ * Add an embedded lorebook to a card
922
+ *
923
+ * Adds to extensions.additional_lorebooks if character_book already exists.
924
+ * Otherwise sets as the main character_book.
925
+ */
926
+ export declare function addEmbeddedLorebookToCard(card: CCv3Data, book: CCv3CharacterBook): CCv3Data;
927
+ /**
928
+ * Remove a lorebook from a card by name
929
+ *
930
+ * Checks both character_book and additional_lorebooks.
931
+ */
932
+ export declare function removeLorebookFromCard(card: CCv3Data, lorebookName: string): CCv3Data;
933
+ /**
934
+ * Remove linked entries from a card that came from a specific source
935
+ *
936
+ * Useful when unlinking/removing a linked lorebook.
937
+ * Removes entries from ALL lorebooks in the card that have matching source.
938
+ */
939
+ export declare function removeLinkedEntriesBySource(card: CCv3Data, sourceUrl: string): CCv3Data;
940
+ /**
941
+ * Replace a lorebook in a card
942
+ *
943
+ * Matches by name. Updates in place without changing position.
944
+ */
945
+ export declare function replaceLorebookInCard(card: CCv3Data, updatedBook: CCv3CharacterBook): CCv3Data;
946
+ /**
947
+ * Rebuild a card's lorebooks from a LorebookCollection
948
+ *
949
+ * Replaces all lorebooks in the card with the collection contents.
950
+ * Useful after editing operations.
951
+ */
952
+ export declare function setLorebookCollection(card: CCv3Data, collection: LorebookCollection): CCv3Data;
953
+ /**
954
+ * Lorebook Handler
955
+ *
956
+ * Format conversion and serialization utilities.
957
+ */
958
+ /**
959
+ * Convert a CCv3 character_book to a specific format
960
+ *
961
+ * Preserves original shape if available for round-trip fidelity.
962
+ */
963
+ export declare function convertLorebook(book: CCv3CharacterBook, targetFormat: LorebookFormat, originalShape?: unknown): unknown;
964
+ /**
965
+ * Serialize a lorebook to JSON string
966
+ */
967
+ export declare function serializeLorebook(book: CCv3CharacterBook, format?: LorebookFormat, originalShape?: unknown, pretty?: boolean): string;
968
+ /**
969
+ * Round-trip a parsed lorebook back to its original format
970
+ */
971
+ export declare function serializeParsedLorebook(parsed: ParsedLorebook, pretty?: boolean): string;
972
+ /**
973
+ * Merge two lorebooks by combining their entries
974
+ *
975
+ * Note: This combines entries from two books into one.
976
+ * Use with caution - the design preference is to keep lorebooks separate.
977
+ * This is provided for cases where merging is explicitly desired.
978
+ */
979
+ export declare function mergeLorebooks(bookA: CCv3CharacterBook, bookB: CCv3CharacterBook, name?: string): CCv3CharacterBook;
980
+ /**
981
+ * Find entries matching keys (for lookup/search)
982
+ */
983
+ export declare function findEntriesByKeys(book: CCv3CharacterBook, searchKeys: string[], options?: {
984
+ caseSensitive?: boolean;
985
+ matchAll?: boolean;
986
+ }): CCv3LorebookEntry[];
987
+ /**
988
+ * Find entry by name or ID
989
+ */
990
+ export declare function findEntryByNameOrId(book: CCv3CharacterBook, nameOrId: string | number): CCv3LorebookEntry | undefined;
991
+ /**
992
+ * Update an entry in a lorebook
993
+ */
994
+ export declare function updateEntry(book: CCv3CharacterBook, entryId: number | string, updates: Partial<CCv3LorebookEntry>): CCv3CharacterBook;
995
+ /**
996
+ * Add a new entry to a lorebook
997
+ */
998
+ export declare function addEntry(book: CCv3CharacterBook, entry: Omit<CCv3LorebookEntry, "id" | "insertion_order">): CCv3CharacterBook;
999
+ /**
1000
+ * Remove an entry from a lorebook
1001
+ */
1002
+ export declare function removeEntry(book: CCv3CharacterBook, entryId: number | string): CCv3CharacterBook;
1003
+ /**
1004
+ * Reorder entries in a lorebook
1005
+ */
1006
+ export declare function reorderEntries(book: CCv3CharacterBook, entryIds: (number | string)[]): CCv3CharacterBook;
1007
+
1008
+ export {};