@arisutalk/character-spec 0.0.0 → 0.0.2

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 (46) hide show
  1. package/LICENSE +202 -202
  2. package/README.md +154 -64
  3. package/dist/index.d.ts +15 -166
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/v0/Character/Assets.d.ts +37 -0
  7. package/dist/v0/Character/Assets.js +21 -0
  8. package/dist/v0/Character/Assets.js.map +1 -0
  9. package/dist/v0/Character/Character.d.ts +263 -0
  10. package/dist/v0/Character/Character.js +46 -0
  11. package/dist/v0/Character/Character.js.map +1 -0
  12. package/dist/v0/Character/Chat.d.ts +73 -0
  13. package/dist/v0/Character/Chat.js +19 -0
  14. package/dist/v0/Character/Chat.js.map +1 -0
  15. package/dist/v0/Character/Lorebook.d.ts +98 -0
  16. package/dist/v0/Character/Lorebook.js +68 -0
  17. package/dist/v0/Character/Lorebook.js.map +1 -0
  18. package/dist/v0/Character/Message.d.ts +32 -0
  19. package/dist/v0/Character/Message.js +34 -0
  20. package/dist/v0/Character/Message.js.map +1 -0
  21. package/dist/v0/Character/Meta.js +22 -0
  22. package/dist/v0/Character/Meta.js.map +1 -0
  23. package/dist/v0/Character/index.d.ts +6 -0
  24. package/dist/v0/Character.d.ts +6 -0
  25. package/dist/v0/Character.js +19 -0
  26. package/dist/v0/Character.js.map +1 -0
  27. package/dist/v0/Executables/Executable.d.ts +120 -0
  28. package/dist/v0/Executables/Executable.js +21 -0
  29. package/dist/v0/Executables/Executable.js.map +1 -0
  30. package/dist/v0/Executables/ReplaceHook.d.ts +161 -0
  31. package/dist/v0/Executables/ReplaceHook.js +57 -0
  32. package/dist/v0/Executables/ReplaceHook.js.map +1 -0
  33. package/dist/v0/Executables/index.d.ts +3 -0
  34. package/dist/v0/Executables.d.ts +3 -0
  35. package/dist/v0/Executables.js +9 -0
  36. package/dist/v0/Executables.js.map +1 -0
  37. package/dist/v0/index.d.ts +2 -0
  38. package/dist/v0/utils.d.ts +11 -0
  39. package/dist/v0/utils.js +14 -0
  40. package/dist/v0/utils.js.map +1 -0
  41. package/dist/v0.d.ts +2 -507
  42. package/dist/v0.js +4 -96
  43. package/dist/v0.js.map +1 -1
  44. package/package.json +13 -11
  45. package/dist/Character-Didq99iq.js +0 -157
  46. package/dist/Character-Didq99iq.js.map +0 -1
package/dist/v0.d.ts CHANGED
@@ -1,507 +1,2 @@
1
- import * as v from 'valibot';
2
-
3
- /**
4
- * Represents a specific AI character personality.
5
- */
6
- export declare type Character = v.InferOutput<typeof CharacterSchema>;
7
-
8
- /**
9
- * The prompt data for a character.
10
- * It is used to generate the character's persona.
11
- * All of parameters are for AI prompt, and scriptable.
12
- */
13
- export declare type CharacterPromptData = v.InferOutput<typeof CharacterPromptDataSchema>;
14
-
15
- /**
16
- * @see {@link CharacterPromptData}
17
- */
18
- export declare const CharacterPromptDataSchema: v.ObjectSchema<{
19
- /**
20
- * The character description.
21
- */
22
- readonly description: v.StringSchema<undefined>;
23
- /**
24
- * The authors note. It's usually used to mock the user's message(differ by prompt).
25
- */
26
- readonly authorsNote: v.StringSchema<undefined>;
27
- /**
28
- * Lorebook data.
29
- * @see {@link LorebookDataSchema}
30
- */
31
- readonly lorebook: v.ObjectSchema<{
32
- readonly config: v.ObjectSchema<{
33
- readonly tokenLimit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
34
- }, undefined>;
35
- readonly data: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
36
- readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
37
- readonly name: v.StringSchema<undefined>;
38
- readonly condition: v.OptionalSchema<v.ArraySchema<v.CustomSchema<{
39
- type: "regex_match";
40
- regexPattern: string;
41
- regexFlags?: string | undefined;
42
- } | {
43
- type: "plain_text_match";
44
- text: string;
45
- } | {
46
- type: "always";
47
- }, undefined>, undefined>, undefined>;
48
- readonly multipleConditionResolveStrategy: v.OptionalSchema<v.PicklistSchema<["all", "any"], undefined>, undefined>;
49
- readonly content: v.StringSchema<undefined>;
50
- readonly priority: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
51
- readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
52
- }, undefined>, undefined>, v.CheckAction<{
53
- id?: string | undefined;
54
- name: string;
55
- condition?: ({
56
- type: "regex_match";
57
- regexPattern: string;
58
- regexFlags?: string | undefined;
59
- } | {
60
- type: "plain_text_match";
61
- text: string;
62
- } | {
63
- type: "always";
64
- })[] | undefined;
65
- multipleConditionResolveStrategy?: "all" | "any" | undefined;
66
- content: string;
67
- priority?: number | undefined;
68
- enabled?: boolean | undefined;
69
- }[], "Duplicated id is not allowed.">]>, readonly []>;
70
- }, undefined>;
71
- }, undefined>;
72
-
73
- /**
74
- * @see {@link Character}
75
- */
76
- export declare const CharacterSchema: v.ObjectSchema<{
77
- /**
78
- * The version of the character spec.
79
- * This is used to determine which schema to use for parsing.
80
- * Also tries to migrate the character to the latest version.
81
- */
82
- readonly specVersion: v.LiteralSchema<0, undefined>;
83
- /**
84
- * Unique identifier for the character.
85
- */
86
- readonly id: v.StringSchema<undefined>;
87
- /**
88
- * The display name of the character.
89
- * Human readable, not scriptable.
90
- */
91
- readonly name: v.StringSchema<undefined>;
92
- /**
93
- * A short description of the character.
94
- * Human readable, not scriptable.
95
- */
96
- readonly description: v.StringSchema<undefined>;
97
- /**
98
- * Optional URL for the character's avatar image.
99
- */
100
- readonly avatarUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>, undefined>;
101
- readonly prompt: v.ObjectSchema<{
102
- /**
103
- * The character description.
104
- */
105
- readonly description: v.StringSchema<undefined>;
106
- /**
107
- * The authors note. It's usually used to mock the user's message(differ by prompt).
108
- */
109
- readonly authorsNote: v.StringSchema<undefined>;
110
- /**
111
- * Lorebook data.
112
- * @see {@link LorebookDataSchema}
113
- */
114
- readonly lorebook: v.ObjectSchema<{
115
- readonly config: v.ObjectSchema<{
116
- readonly tokenLimit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
117
- }, undefined>;
118
- readonly data: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
119
- readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
120
- readonly name: v.StringSchema<undefined>;
121
- readonly condition: v.OptionalSchema<v.ArraySchema<v.CustomSchema<{
122
- type: "regex_match";
123
- regexPattern: string;
124
- regexFlags?: string | undefined;
125
- } | {
126
- type: "plain_text_match";
127
- text: string;
128
- } | {
129
- type: "always";
130
- }, undefined>, undefined>, undefined>;
131
- readonly multipleConditionResolveStrategy: v.OptionalSchema<v.PicklistSchema<["all", "any"], undefined>, undefined>;
132
- readonly content: v.StringSchema<undefined>;
133
- readonly priority: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
134
- readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
135
- }, undefined>, undefined>, v.CheckAction<{
136
- id?: string | undefined;
137
- name: string;
138
- condition?: ({
139
- type: "regex_match";
140
- regexPattern: string;
141
- regexFlags?: string | undefined;
142
- } | {
143
- type: "plain_text_match";
144
- text: string;
145
- } | {
146
- type: "always";
147
- })[] | undefined;
148
- multipleConditionResolveStrategy?: "all" | "any" | undefined;
149
- content: string;
150
- priority?: number | undefined;
151
- enabled?: boolean | undefined;
152
- }[], "Duplicated id is not allowed.">]>, readonly []>;
153
- }, undefined>;
154
- }, undefined>;
155
- }, undefined>;
156
-
157
- /**
158
- * Represents a chat session with a character.
159
- */
160
- export declare type Chat = v.InferOutput<typeof ChatSchema>;
161
-
162
- /**
163
- * @see {@link Chat}
164
- */
165
- export declare const ChatSchema: v.ObjectSchema<{
166
- /**
167
- * Unique identifier for the chat session.
168
- */
169
- readonly id: v.StringSchema<undefined>;
170
- /**
171
- * The ID of the character associated with this chat.
172
- */
173
- readonly characterId: v.StringSchema<undefined>;
174
- /**
175
- * The list of messages in this chat.
176
- */
177
- readonly messages: v.ArraySchema<v.ObjectSchema<{
178
- readonly id: v.StringSchema<undefined>;
179
- readonly role: v.UnionSchema<[v.LiteralSchema<"user", undefined>, v.LiteralSchema<"assistant", undefined>, v.LiteralSchema<"system", undefined>], undefined>;
180
- readonly content: v.VariantSchema<"type", [v.ObjectSchema<{
181
- readonly type: v.LiteralSchema<"string", undefined>;
182
- readonly data: v.StringSchema<undefined>;
183
- }, undefined>, v.ObjectSchema<{
184
- readonly type: v.LiteralSchema<"file", undefined>;
185
- readonly data: v.StringSchema<undefined>;
186
- readonly mimeType: v.StringSchema<undefined>;
187
- }, undefined>, v.ObjectSchema<{
188
- readonly type: v.LiteralSchema<"inline_file", undefined>;
189
- readonly data: v.UnionSchema<[v.FileSchema<undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>, v.BlobSchema<undefined>], undefined>;
190
- readonly mimeType: v.StringSchema<undefined>;
191
- }, undefined>], undefined>;
192
- readonly timestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
193
- }, undefined>, undefined>;
194
- /**
195
- * Optional title for the chat.
196
- */
197
- readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
198
- /**
199
- * creation timestamp(unix epoch)
200
- */
201
- readonly createdAt: v.OptionalSchema<v.NumberSchema<undefined>, () => number>;
202
- /**
203
- * Last updated timestamp(unix epoch)
204
- */
205
- readonly updatedAt: v.OptionalSchema<v.NumberSchema<undefined>, () => number>;
206
- }, undefined>;
207
-
208
- /**
209
- * The condition for the lorebook to be activated.
210
- * @see {@link LorebookConditionSchema}
211
- */
212
- export declare type LorebookCondition = v.InferOutput<typeof LorebookConditionSchema>;
213
-
214
- /**
215
- * @see {@link LorebookConditionSchema}
216
- */
217
- export declare const LorebookConditionDetailSchema: {
218
- readonly regex: v.ObjectSchema<{
219
- /**
220
- * The type of the condition.
221
- * This condition matches the regex pattern.
222
- */
223
- readonly type: v.LiteralSchema<"regex_match", undefined>;
224
- /**
225
- * The regex pattern to match.
226
- * Note that this is scriptable.
227
- */
228
- readonly regexPattern: v.StringSchema<undefined>;
229
- /**
230
- * The regex flags to use.
231
- * Note that this is not scriptable.
232
- */
233
- readonly regexFlags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
234
- }, undefined>;
235
- readonly plainText: v.ObjectSchema<{
236
- /**
237
- * The type of the condition.
238
- * This condition simply matches the text.
239
- */
240
- readonly type: v.LiteralSchema<"plain_text_match", undefined>;
241
- /**
242
- * The text to match.
243
- * Note that this is scriptable.
244
- * No case sensitive.
245
- */
246
- readonly text: v.StringSchema<undefined>;
247
- }, undefined>;
248
- readonly always: v.ObjectSchema<{
249
- /**
250
- * The type of the condition.
251
- * This condition is always true.
252
- */
253
- readonly type: v.LiteralSchema<"always", undefined>;
254
- }, undefined>;
255
- };
256
-
257
- /**
258
- * The condition for the lorebook to be activated.
259
- */
260
- export declare const LorebookConditionSchema: v.VariantSchema<"type", [v.ObjectSchema<{
261
- /**
262
- * The type of the condition.
263
- * This condition matches the regex pattern.
264
- */
265
- readonly type: v.LiteralSchema<"regex_match", undefined>;
266
- /**
267
- * The regex pattern to match.
268
- * Note that this is scriptable.
269
- */
270
- readonly regexPattern: v.StringSchema<undefined>;
271
- /**
272
- * The regex flags to use.
273
- * Note that this is not scriptable.
274
- */
275
- readonly regexFlags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
276
- }, undefined>, v.ObjectSchema<{
277
- /**
278
- * The type of the condition.
279
- * This condition simply matches the text.
280
- */
281
- readonly type: v.LiteralSchema<"plain_text_match", undefined>;
282
- /**
283
- * The text to match.
284
- * Note that this is scriptable.
285
- * No case sensitive.
286
- */
287
- readonly text: v.StringSchema<undefined>;
288
- }, undefined>, v.ObjectSchema<{
289
- /**
290
- * The type of the condition.
291
- * This condition is always true.
292
- */
293
- readonly type: v.LiteralSchema<"always", undefined>;
294
- }, undefined>], undefined>;
295
-
296
- /**
297
- * Object containing all data for the lorebook.
298
- * It's meant to be stored in the database and many other places.
299
- */
300
- export declare type LorebookData = v.InferOutput<typeof LorebookDataSchema>;
301
-
302
- /**
303
- * @see {@link LorebookData}
304
- */
305
- export declare const LorebookDataSchema: v.ObjectSchema<{
306
- /**
307
- * The configuration for the lorebook.
308
- * It is not scriptable.
309
- */
310
- readonly config: v.ObjectSchema<{
311
- /**
312
- * The token limit for the lorebook.
313
- * When the token limit is exceeded, some low-priority lorebooks will be deactivated to keep the token usage within the limit.
314
- * Positive integer.
315
- */
316
- readonly tokenLimit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
317
- }, undefined>;
318
- /**
319
- * Contains the actual lorebooks.
320
- * Duplicated id is not allowed.
321
- */
322
- readonly data: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
323
- /**
324
- * Internally generated ID.
325
- */
326
- readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
327
- /**
328
- * Human readable name for the lorebook.
329
- */
330
- readonly name: v.StringSchema<undefined>;
331
- /**
332
- * The condition for the lorebook to be activated.
333
- * If empty, it will not be activated.
334
- * Duplicated condition is no effect.
335
- * Use 'always' to activate without any condition. {@link LorebookConditionTypeMap#always}
336
- */
337
- readonly condition: v.OptionalSchema<v.ArraySchema<v.CustomSchema<{
338
- type: "regex_match";
339
- regexPattern: string;
340
- regexFlags?: string | undefined;
341
- } | {
342
- type: "plain_text_match";
343
- text: string;
344
- } | {
345
- type: "always";
346
- }, undefined>, undefined>, undefined>;
347
- /**
348
- * The strategy for resolving multiple conditions.
349
- * "all" means all conditions must be met.
350
- * "any" means at least one condition must be met.
351
- */
352
- readonly multipleConditionResolveStrategy: v.OptionalSchema<v.PicklistSchema<["all", "any"], undefined>, undefined>;
353
- /**
354
- * The lorebook content to be added on AI prompt.
355
- * Not for human reading, and it's scriptable.
356
- */
357
- readonly content: v.StringSchema<undefined>;
358
- /**
359
- * The priority of the lorebook.
360
- * Higher priority means it will be activated first, remains when token limit is exceeded.
361
- * May be negative. Base is 0. Allows demical.
362
- */
363
- readonly priority: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
364
- /**
365
- * Whether the lorebook is enabled.
366
- */
367
- readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
368
- }, undefined>, undefined>, v.CheckAction<{
369
- id?: string | undefined;
370
- name: string;
371
- condition?: ({
372
- type: "regex_match";
373
- regexPattern: string;
374
- regexFlags?: string | undefined;
375
- } | {
376
- type: "plain_text_match";
377
- text: string;
378
- } | {
379
- type: "always";
380
- })[] | undefined;
381
- multipleConditionResolveStrategy?: "all" | "any" | undefined;
382
- content: string;
383
- priority?: number | undefined;
384
- enabled?: boolean | undefined;
385
- }[], "Duplicated id is not allowed.">]>, readonly []>;
386
- }, undefined>;
387
-
388
- /**
389
- * A lorebook is a collection of lorebooks.
390
- * Lorebook is a small part of prompts which is activated by session's text matching.
391
- */
392
- export declare type LorebookEntry = v.InferOutput<typeof LorebookEntrySchema>;
393
-
394
- /**
395
- * @see {@link LorebookEntry}
396
- */
397
- export declare const LorebookEntrySchema: v.ObjectSchema<{
398
- /**
399
- * Internally generated ID.
400
- */
401
- readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
402
- /**
403
- * Human readable name for the lorebook.
404
- */
405
- readonly name: v.StringSchema<undefined>;
406
- /**
407
- * The condition for the lorebook to be activated.
408
- * If empty, it will not be activated.
409
- * Duplicated condition is no effect.
410
- * Use 'always' to activate without any condition. {@link LorebookConditionTypeMap#always}
411
- */
412
- readonly condition: v.OptionalSchema<v.ArraySchema<v.CustomSchema<{
413
- type: "regex_match";
414
- regexPattern: string;
415
- regexFlags?: string | undefined;
416
- } | {
417
- type: "plain_text_match";
418
- text: string;
419
- } | {
420
- type: "always";
421
- }, undefined>, undefined>, undefined>;
422
- /**
423
- * The strategy for resolving multiple conditions.
424
- * "all" means all conditions must be met.
425
- * "any" means at least one condition must be met.
426
- */
427
- readonly multipleConditionResolveStrategy: v.OptionalSchema<v.PicklistSchema<["all", "any"], undefined>, undefined>;
428
- /**
429
- * The lorebook content to be added on AI prompt.
430
- * Not for human reading, and it's scriptable.
431
- */
432
- readonly content: v.StringSchema<undefined>;
433
- /**
434
- * The priority of the lorebook.
435
- * Higher priority means it will be activated first, remains when token limit is exceeded.
436
- * May be negative. Base is 0. Allows demical.
437
- */
438
- readonly priority: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
439
- /**
440
- * Whether the lorebook is enabled.
441
- */
442
- readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
443
- }, undefined>;
444
-
445
- /**
446
- * Represents a single message in a chat history.
447
- */
448
- export declare type Message = v.InferOutput<typeof MessageSchema>;
449
-
450
- /**
451
- * @see {@link Message}
452
- */
453
- export declare const MessageSchema: v.ObjectSchema<{
454
- /** Unique identifier for the message. */
455
- readonly id: v.StringSchema<undefined>;
456
- /** The role of the message sender. */
457
- readonly role: v.UnionSchema<[v.LiteralSchema<"user", undefined>, v.LiteralSchema<"assistant", undefined>, v.LiteralSchema<"system", undefined>], undefined>;
458
- /** The content of the message. */
459
- readonly content: v.VariantSchema<"type", [v.ObjectSchema<{
460
- /**
461
- * string: The message content is a simple string.
462
- */
463
- readonly type: v.LiteralSchema<"string", undefined>;
464
- /**
465
- * The message content.
466
- */
467
- readonly data: v.StringSchema<undefined>;
468
- }, undefined>, v.ObjectSchema<{
469
- /**
470
- * file: The file content is stored in the separated storage.
471
- */
472
- readonly type: v.LiteralSchema<"file", undefined>;
473
- /**
474
- * URL of the file. May be absolute or relative, or even uuid.
475
- * Client should handle the actual file loading.
476
- * Don't use base64 encoded file. Instead, use with type:"inline_file".
477
- */
478
- readonly data: v.StringSchema<undefined>;
479
- /**
480
- * MIME type of the file.
481
- */
482
- readonly mimeType: v.StringSchema<undefined>;
483
- }, undefined>, v.ObjectSchema<{
484
- /**
485
- * inline_file: The file content is embedded in the message.
486
- */
487
- readonly type: v.LiteralSchema<"inline_file", undefined>;
488
- /**
489
- * File content. May be base64 encoded or file, or blob.
490
- * It's good to use url with type:"file" instead, to avoid getting too large message.
491
- */
492
- readonly data: v.UnionSchema<[v.FileSchema<undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>, v.BlobSchema<undefined>], undefined>;
493
- /**
494
- * MIME type of the file.
495
- */
496
- readonly mimeType: v.StringSchema<undefined>;
497
- }, undefined>], undefined>;
498
- /** The timestamp when the message was created. */
499
- readonly timestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
500
- }, undefined>;
501
-
502
- /**
503
- * Represents the role of the message sender.
504
- */
505
- export declare const RoleSchema: v.UnionSchema<[v.LiteralSchema<"user", undefined>, v.LiteralSchema<"assistant", undefined>, v.LiteralSchema<"system", undefined>], undefined>;
506
-
507
- export { }
1
+ // Auto-generated barrel export
2
+ export * from "./v0/index";
package/dist/v0.js CHANGED
@@ -1,99 +1,7 @@
1
- import { a as s, C as l, b as c, c as m, d as p, L as b } from "./Character-Didq99iq.js";
2
- import * as e from "valibot";
3
- const a = e.union([
4
- e.literal("user"),
5
- e.literal("assistant"),
6
- e.literal("system")
7
- ]), t = {
8
- text: e.object({
9
- /**
10
- * string: The message content is a simple string.
11
- */
12
- type: e.literal("string"),
13
- /**
14
- * The message content.
15
- */
16
- data: e.string()
17
- }),
18
- file: e.object({
19
- /**
20
- * file: The file content is stored in the separated storage.
21
- */
22
- type: e.literal("file"),
23
- /**
24
- * URL of the file. May be absolute or relative, or even uuid.
25
- * Client should handle the actual file loading.
26
- * Don't use base64 encoded file. Instead, use with type:"inline_file".
27
- */
28
- data: e.string(),
29
- /**
30
- * MIME type of the file.
31
- */
32
- mimeType: e.string()
33
- }),
34
- inline_file: e.object({
35
- /**
36
- * inline_file: The file content is embedded in the message.
37
- */
38
- type: e.literal("inline_file"),
39
- /**
40
- * File content. May be base64 encoded or file, or blob.
41
- * It's good to use url with type:"file" instead, to avoid getting too large message.
42
- */
43
- data: e.union([e.file(), e.pipe(e.string(), e.base64()), e.blob()]),
44
- /**
45
- * MIME type of the file.
46
- */
47
- mimeType: e.string()
48
- })
49
- }, i = e.object({
50
- /** Unique identifier for the message. */
51
- id: e.string(),
52
- /** The role of the message sender. */
53
- role: a,
54
- /** The content of the message. */
55
- content: e.variant("type", [
56
- t.text,
57
- t.file,
58
- t.inline_file
59
- ]),
60
- /** The timestamp when the message was created. */
61
- timestamp: e.optional(e.number())
62
- }), o = e.object({
63
- /**
64
- * Unique identifier for the chat session.
65
- */
66
- id: e.string(),
67
- /**
68
- * The ID of the character associated with this chat.
69
- */
70
- characterId: e.string(),
71
- /**
72
- * The list of messages in this chat.
73
- */
74
- messages: e.array(i),
75
- /**
76
- * Optional title for the chat.
77
- */
78
- title: e.optional(e.string()),
79
- /**
80
- * creation timestamp(unix epoch)
81
- */
82
- createdAt: e.optional(e.number(), Date.now),
83
- /**
84
- * Last updated timestamp(unix epoch)
85
- */
86
- updatedAt: e.optional(e.number(), Date.now)
87
- });
1
+ import { ImageURLSchema as m, positiveInteger as o, unique as r } from "./v0/utils.js";
88
2
  export {
89
- s as CharacterPromptDataSchema,
90
- l as CharacterSchema,
91
- o as ChatSchema,
92
- c as LorebookConditionDetailSchema,
93
- m as LorebookConditionSchema,
94
- p as LorebookDataSchema,
95
- b as LorebookEntrySchema,
96
- i as MessageSchema,
97
- a as RoleSchema
3
+ m as ImageURLSchema,
4
+ o as positiveInteger,
5
+ r as unique
98
6
  };
99
7
  //# sourceMappingURL=v0.js.map
package/dist/v0.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v0.js","sources":["../src/types/v0/Message.ts","../src/types/v0/Chat.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Represents the role of the message sender.\n */\nexport const RoleSchema = v.union([\n v.literal(\"user\"),\n v.literal(\"assistant\"),\n v.literal(\"system\"),\n]);\n\nconst MessageContentSchema = {\n text: v.object({\n /**\n * string: The message content is a simple string.\n */\n type: v.literal(\"string\"),\n /**\n * The message content.\n */\n data: v.string(),\n }),\n file: v.object({\n /**\n * file: The file content is stored in the separated storage.\n */\n type: v.literal(\"file\"),\n /**\n * URL of the file. May be absolute or relative, or even uuid.\n * Client should handle the actual file loading.\n * Don't use base64 encoded file. Instead, use with type:\"inline_file\".\n */\n data: v.string(),\n /**\n * MIME type of the file.\n */\n mimeType: v.string(),\n }),\n inline_file: v.object({\n /**\n * inline_file: The file content is embedded in the message.\n */\n type: v.literal(\"inline_file\"),\n /**\n * File content. May be base64 encoded or file, or blob.\n * It's good to use url with type:\"file\" instead, to avoid getting too large message.\n */\n data: v.union([v.file(), v.pipe(v.string(), v.base64()), v.blob()]),\n /**\n * MIME type of the file.\n */\n mimeType: v.string(),\n }),\n};\n\n/**\n * @see {@link Message}\n */\nexport const MessageSchema = v.object({\n /** Unique identifier for the message. */\n id: v.string(),\n /** The role of the message sender. */\n role: RoleSchema,\n /** The content of the message. */\n content: v.variant(\"type\", [\n MessageContentSchema.text,\n MessageContentSchema.file,\n MessageContentSchema.inline_file,\n ]),\n /** The timestamp when the message was created. */\n timestamp: v.optional(v.number()),\n});\n\n/**\n * Represents a single message in a chat history.\n */\nexport type Message = v.InferOutput<typeof MessageSchema>;\n","import * as v from \"valibot\";\nimport { MessageSchema } from \"@/types/v0/Message\";\n\n/**\n * @see {@link Chat}\n */\nexport const ChatSchema = v.object({\n /**\n * Unique identifier for the chat session.\n */\n id: v.string(),\n /**\n * The ID of the character associated with this chat.\n */\n characterId: v.string(),\n /**\n * The list of messages in this chat.\n */\n messages: v.array(MessageSchema),\n /**\n * Optional title for the chat.\n */\n title: v.optional(v.string()),\n /**\n * creation timestamp(unix epoch)\n */\n createdAt: v.optional(v.number(), Date.now),\n /**\n * Last updated timestamp(unix epoch)\n */\n updatedAt: v.optional(v.number(), Date.now),\n});\n\n/**\n * Represents a chat session with a character.\n */\nexport type Chat = v.InferOutput<typeof ChatSchema>;\n"],"names":["RoleSchema","v","MessageContentSchema","MessageSchema","ChatSchema"],"mappings":";;AAKO,MAAMA,IAAaC,EAAE,MAAM;AAAA,EAC9BA,EAAE,QAAQ,MAAM;AAAA,EAChBA,EAAE,QAAQ,WAAW;AAAA,EACrBA,EAAE,QAAQ,QAAQ;AACtB,CAAC,GAEKC,IAAuB;AAAA,EACzB,MAAMD,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,IAIX,MAAMA,EAAE,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIxB,MAAMA,EAAE,OAAA;AAAA,EAAO,CAClB;AAAA,EACD,MAAMA,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,IAIX,MAAMA,EAAE,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMtB,MAAMA,EAAE,OAAA;AAAA;AAAA;AAAA;AAAA,IAIR,UAAUA,EAAE,OAAA;AAAA,EAAO,CACtB;AAAA,EACD,aAAaA,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,IAIlB,MAAMA,EAAE,QAAQ,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,IAK7B,MAAMA,EAAE,MAAM,CAACA,EAAE,KAAA,GAAQA,EAAE,KAAKA,EAAE,OAAA,GAAUA,EAAE,OAAA,CAAQ,GAAGA,EAAE,KAAA,CAAM,CAAC;AAAA;AAAA;AAAA;AAAA,IAIlE,UAAUA,EAAE,OAAA;AAAA,EAAO,CACtB;AACL,GAKaE,IAAgBF,EAAE,OAAO;AAAA;AAAA,EAElC,IAAIA,EAAE,OAAA;AAAA;AAAA,EAEN,MAAMD;AAAA;AAAA,EAEN,SAASC,EAAE,QAAQ,QAAQ;AAAA,IACvBC,EAAqB;AAAA,IACrBA,EAAqB;AAAA,IACrBA,EAAqB;AAAA,EAAA,CACxB;AAAA;AAAA,EAED,WAAWD,EAAE,SAASA,EAAE,QAAQ;AACpC,CAAC,GCjEYG,IAAaH,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAI/B,IAAIA,EAAE,OAAA;AAAA;AAAA;AAAA;AAAA,EAIN,aAAaA,EAAE,OAAA;AAAA;AAAA;AAAA;AAAA,EAIf,UAAUA,EAAE,MAAME,CAAa;AAAA;AAAA;AAAA;AAAA,EAI/B,OAAOF,EAAE,SAASA,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA,EAI5B,WAAWA,EAAE,SAASA,EAAE,OAAA,GAAU,KAAK,GAAG;AAAA;AAAA;AAAA;AAAA,EAI1C,WAAWA,EAAE,SAASA,EAAE,OAAA,GAAU,KAAK,GAAG;AAC9C,CAAC;"}
1
+ {"version":3,"file":"v0.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arisutalk/character-spec",
3
3
  "description": "Character specification, schema & migration for ArisuTalk",
4
- "version": "0.0.0",
4
+ "version": "0.0.2",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "concertypin",
@@ -23,33 +23,35 @@
23
23
  ],
24
24
  "type": "module",
25
25
  "scripts": {
26
- "build": "vite build",
26
+ "build": "vite build && pnpm generate-types",
27
+ "generate-types": "tsx scripts/generate-types.ts",
27
28
  "prepare": "pnpm exec simple-git-hooks",
28
29
  "format": "biome format --write .",
29
30
  "lint": "biome check ."
30
31
  },
31
32
  "peerDependencies": {
32
- "valibot": "^1.2.0"
33
+ "zod": "^4.1.13"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@biomejs/biome": "^2.3.5",
36
37
  "lint-staged": "^16.2.6",
37
38
  "simple-git-hooks": "^2.13.1",
38
- "typescript": "^5.9.3",
39
- "valibot": "^1.2.0",
39
+ "tsx": "^4.19.2",
40
+ "typescript": "~5.9.3",
40
41
  "vite": "^6.4.1",
41
- "vite-plugin-dts": "^4.5.4",
42
- "vite-tsconfig-paths": "^5.1.4"
42
+ "vite-tsconfig-paths": "^5.1.4",
43
+ "zod": "^4.1.13",
44
+ "zod-to-ts": "^2.0.0"
43
45
  },
44
46
  "exports": {
45
47
  ".": {
46
48
  "import": "./dist/index.js",
47
49
  "types": "./dist/index.d.ts"
48
50
  },
49
- "./v0": {
50
- "import": "./dist/v0.js",
51
- "types": "./dist/v0.d.ts"
51
+ "./*": {
52
+ "import": "./dist/*.js",
53
+ "types": "./dist/*.d.ts"
52
54
  }
53
55
  },
54
56
  "packageManager": "pnpm@10.16.1+sha512.0e155aa2629db8672b49e8475da6226aa4bdea85fdcdfdc15350874946d4f3c91faaf64cbdc4a5d1ab8002f473d5c3fcedcd197989cf0390f9badd3c04678706"
55
- }
57
+ }