@arisutalk/character-spec 0.0.0 → 0.0.1

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 +152 -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 +30 -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 +242 -0
  10. package/dist/v0/Character/Character.js +42 -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
@@ -0,0 +1,57 @@
1
+ import { z as e } from "zod";
2
+ const i = [
3
+ e.object({
4
+ type: e.literal("regex").meta({ description: "The input pattern is a RegExp." }),
5
+ flag: e.string().meta({ description: "The flag for RegExp." })
6
+ }).meta({ description: "Regex pattern type." }),
7
+ e.object({
8
+ type: e.literal("string").meta({ description: "The input pattern is a simple string." }),
9
+ caseSensitive: e.boolean().default(!0).meta({
10
+ description: "If true, the input pattern is case sensitive."
11
+ })
12
+ }).meta({ description: "String pattern type." })
13
+ ], a = e.intersection(
14
+ e.discriminatedUnion("type", i),
15
+ e.object({
16
+ isInputPatternScripted: e.boolean().default(!1).meta({
17
+ description: "If true, input pattern might contain additional javascript expression. Resolved before matching."
18
+ }),
19
+ isOutputScripted: e.boolean().default(!1).meta({
20
+ description: "If true, output might contain additional javascript expression. Resolved after matching."
21
+ }),
22
+ priority: e.number().default(0).meta({
23
+ description: "The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional."
24
+ })
25
+ })
26
+ ), t = e.object({
27
+ input: e.string().meta({
28
+ description: "The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true."
29
+ }),
30
+ meta: a.meta({
31
+ description: "The meta data for the replace hook."
32
+ }),
33
+ output: e.string().meta({
34
+ description: "The output. May contain additional javascript expression if `isOutputScripted` is true."
35
+ })
36
+ }), o = e.object({
37
+ display: e.array(t).meta({
38
+ description: "Replace hooks for display. Doesn't edit the data, only changes the display."
39
+ }),
40
+ input: e.array(t).meta({
41
+ description: "Replace hooks for input. User chat input will be edited by this."
42
+ }),
43
+ output: e.array(t).meta({
44
+ description: "Replace hooks for output. Character response will be edited by this."
45
+ }),
46
+ request: e.array(t).meta({
47
+ description: "Replace hooks for request. AI request will be edited by this. Differs from `input` in that it's for AI request. Does not edit the data, only changes the fetching request."
48
+ })
49
+ }).meta({
50
+ description: "Replace hooks. RegExp for request, display, and response."
51
+ });
52
+ export {
53
+ t as ReplaceHookEntitySchema,
54
+ a as ReplaceHookMetaSchema,
55
+ o as ReplaceHookSchema
56
+ };
57
+ //# sourceMappingURL=ReplaceHook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReplaceHook.js","sources":["../../../src/types/v0/Executables/ReplaceHook.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst ReplaceHookMetaType = [\n z\n .object({\n type: z\n .literal(\"regex\")\n .meta({ description: \"The input pattern is a RegExp.\" }),\n flag: z.string().meta({ description: \"The flag for RegExp.\" }),\n })\n .meta({ description: \"Regex pattern type.\" }),\n z\n .object({\n type: z\n .literal(\"string\")\n .meta({ description: \"The input pattern is a simple string.\" }),\n caseSensitive: z\n .boolean()\n .default(true)\n .meta({\n description:\n \"If true, the input pattern is case sensitive.\",\n }),\n })\n .meta({ description: \"String pattern type.\" }),\n] as const;\n\nexport const ReplaceHookMetaSchema = z.intersection(\n z.discriminatedUnion(\"type\", ReplaceHookMetaType),\n z.object({\n isInputPatternScripted: z.boolean().default(false).meta({\n description:\n \"If true, input pattern might contain additional javascript expression. Resolved before matching.\",\n }),\n isOutputScripted: z.boolean().default(false).meta({\n description:\n \"If true, output might contain additional javascript expression. Resolved after matching.\",\n }),\n priority: z.number().default(0).meta({\n description:\n \"The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional.\",\n }),\n }),\n);\n\nexport const ReplaceHookEntitySchema = z.object({\n input: z.string().meta({\n description:\n \"The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true.\",\n }),\n meta: ReplaceHookMetaSchema.meta({\n description: \"The meta data for the replace hook.\",\n }),\n output: z.string().meta({\n description:\n \"The output. May contain additional javascript expression if `isOutputScripted` is true.\",\n }),\n});\n\n/**\n * Replace hooks. It's technically RegExp for request, display, and response.\n */\nexport const ReplaceHookSchema = z\n .object({\n display: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for display. Doesn't edit the data, only changes the display.\",\n }),\n input: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for input. User chat input will be edited by this.\",\n }),\n output: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for output. Character response will be edited by this.\",\n }),\n request: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for request. AI request will be edited by this. Differs from `input` in that it's for AI request. Does not edit the data, only changes the fetching request.\",\n }),\n })\n .meta({\n description:\n \"Replace hooks. RegExp for request, display, and response.\",\n });\n"],"names":["ReplaceHookMetaType","z","ReplaceHookMetaSchema","ReplaceHookEntitySchema","ReplaceHookSchema"],"mappings":";AAEA,MAAMA,IAAsB;AAAA,EACxBC,EACK,OAAO;AAAA,IACJ,MAAMA,EACD,QAAQ,OAAO,EACf,KAAK,EAAE,aAAa,kCAAkC;AAAA,IAC3D,MAAMA,EAAE,OAAA,EAAS,KAAK,EAAE,aAAa,wBAAwB;AAAA,EAAA,CAChE,EACA,KAAK,EAAE,aAAa,uBAAuB;AAAA,EAChDA,EACK,OAAO;AAAA,IACJ,MAAMA,EACD,QAAQ,QAAQ,EAChB,KAAK,EAAE,aAAa,yCAAyC;AAAA,IAClE,eAAeA,EACV,QAAA,EACA,QAAQ,EAAI,EACZ,KAAK;AAAA,MACF,aACI;AAAA,IAAA,CACP;AAAA,EAAA,CACR,EACA,KAAK,EAAE,aAAa,wBAAwB;AACrD,GAEaC,IAAwBD,EAAE;AAAA,EACnCA,EAAE,mBAAmB,QAAQD,CAAmB;AAAA,EAChDC,EAAE,OAAO;AAAA,IACL,wBAAwBA,EAAE,QAAA,EAAU,QAAQ,EAAK,EAAE,KAAK;AAAA,MACpD,aACI;AAAA,IAAA,CACP;AAAA,IACD,kBAAkBA,EAAE,QAAA,EAAU,QAAQ,EAAK,EAAE,KAAK;AAAA,MAC9C,aACI;AAAA,IAAA,CACP;AAAA,IACD,UAAUA,EAAE,OAAA,EAAS,QAAQ,CAAC,EAAE,KAAK;AAAA,MACjC,aACI;AAAA,IAAA,CACP;AAAA,EAAA,CACJ;AACL,GAEaE,IAA0BF,EAAE,OAAO;AAAA,EAC5C,OAAOA,EAAE,OAAA,EAAS,KAAK;AAAA,IACnB,aACI;AAAA,EAAA,CACP;AAAA,EACD,MAAMC,EAAsB,KAAK;AAAA,IAC7B,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,QAAQD,EAAE,OAAA,EAAS,KAAK;AAAA,IACpB,aACI;AAAA,EAAA,CACP;AACL,CAAC,GAKYG,IAAoBH,EAC5B,OAAO;AAAA,EACJ,SAASA,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IAC3C,aACI;AAAA,EAAA,CACP;AAAA,EACD,OAAOF,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IACzC,aACI;AAAA,EAAA,CACP;AAAA,EACD,QAAQF,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IAC1C,aACI;AAAA,EAAA,CACP;AAAA,EACD,SAASF,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IAC3C,aACI;AAAA,EAAA,CACP;AACL,CAAC,EACA,KAAK;AAAA,EACF,aACI;AACR,CAAC;"}
@@ -0,0 +1,3 @@
1
+ // Auto-generated barrel export
2
+ export * from "./Executable";
3
+ export * from "./ReplaceHook";
@@ -0,0 +1,3 @@
1
+ // Auto-generated barrel export
2
+ export * from "./Executables/Executable";
3
+ export * from "./Executables/ReplaceHook";
@@ -0,0 +1,9 @@
1
+ import { ScriptSettingSchema as a } from "./Executables/Executable.js";
2
+ import { ReplaceHookEntitySchema as t, ReplaceHookMetaSchema as m, ReplaceHookSchema as p } from "./Executables/ReplaceHook.js";
3
+ export {
4
+ t as ReplaceHookEntitySchema,
5
+ m as ReplaceHookMetaSchema,
6
+ p as ReplaceHookSchema,
7
+ a as ScriptSettingSchema
8
+ };
9
+ //# sourceMappingURL=Executables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Executables.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+ // Auto-generated barrel export
2
+ export * from "./utils";
@@ -0,0 +1,11 @@
1
+ // Auto-generated TypeScript types from Zod schemas
2
+ // JSDoc comments are extracted from schema .meta({ description }) values
3
+ import type { z } from "zod";
4
+
5
+ export type ImageURL = string;
6
+
7
+ export declare const ImageURLSchema: z.ZodType<ImageURL>;
8
+
9
+ export type PositiveInteger = number;
10
+
11
+ export declare const positiveInteger: z.ZodType<PositiveInteger>;
@@ -0,0 +1,14 @@
1
+ import { z as t } from "zod";
2
+ const i = t.url().meta({
3
+ description: "URL of an image. `data:` for base64 (export only), `local:` for browser storage (OpFS), otherwise a fetchable URL."
4
+ });
5
+ function a(r) {
6
+ return (e) => new Set(e.map((o) => o[r])).size === e.length;
7
+ }
8
+ const s = t.number().int().min(1).meta({ description: "Positive integer (>= 1)" });
9
+ export {
10
+ i as ImageURLSchema,
11
+ s as positiveInteger,
12
+ a as unique
13
+ };
14
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../src/types/v0/utils.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * This type is used to represent the URL of an image.\n * It is used to validate the URL of an image.\n * If its protocol is `data:`, it means the image is base64 encoded.\n * This should only be used in exported character. When importing the character, it should be converted to `local:`.\n * If its protocol is `local:`, it means the image is stored in the browser, usually OpFS.\n * Otherwise, it should be a valid URL which can be fetched in browser.\n */\nexport const ImageURLSchema = z.url().meta({\n description:\n \"URL of an image. `data:` for base64 (export only), `local:` for browser storage (OpFS), otherwise a fetchable URL.\",\n});\n\n/**\n * Custom validator to ensure all objects in the array have unique values for a specific key.\n * @param key The key to check for uniqueness. It should be a string key of the object.\n * @returns A predicate function for `z.refine`.\n * @example\n * ```ts\n * const schema = z.array(z.object({ name: z.string() })).refine(unique(\"name\"), { message: \"Not unique\" });\n * ```\n */\nexport function unique<\n const ARR extends {\n [key: string]: unknown;\n },\n>(key: keyof ARR) {\n return (i: ARR[]) => {\n return new Set(i.map((j) => j[key])).size === i.length;\n };\n}\n\n/**\n * Zod custom schema to ensure the value is a positive integer.\n */\nexport const positiveInteger = z\n .number()\n .int()\n .min(1)\n .meta({ description: \"Positive integer (>= 1)\" });\n"],"names":["ImageURLSchema","z","unique","key","i","j","positiveInteger"],"mappings":";AAUO,MAAMA,IAAiBC,EAAE,IAAA,EAAM,KAAK;AAAA,EACvC,aACI;AACR,CAAC;AAWM,SAASC,EAIdC,GAAgB;AACd,SAAO,CAACC,MACG,IAAI,IAAIA,EAAE,IAAI,CAACC,MAAMA,EAAEF,CAAG,CAAC,CAAC,EAAE,SAASC,EAAE;AAExD;AAKO,MAAME,IAAkBL,EAC1B,OAAA,EACA,IAAA,EACA,IAAI,CAAC,EACL,KAAK,EAAE,aAAa,2BAA2B;"}
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";