@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/index.d.ts CHANGED
@@ -1,166 +1,15 @@
1
- import { ArraySchema } from 'valibot';
2
- import { BooleanSchema } from 'valibot';
3
- import { CheckAction } from 'valibot';
4
- import { CustomSchema } from 'valibot';
5
- import { IntegerAction } from 'valibot';
6
- import { LiteralSchema } from 'valibot';
7
- import { MinValueAction } from 'valibot';
8
- import { NumberSchema } from 'valibot';
9
- import { ObjectSchema } from 'valibot';
10
- import { OptionalSchema } from 'valibot';
11
- import { PicklistSchema } from 'valibot';
12
- import { SchemaWithPipe } from 'valibot';
13
- import { StringSchema } from 'valibot';
14
- import { UrlAction } from 'valibot';
15
- import * as v from 'valibot';
16
-
17
- /**
18
- * Represents a specific AI character personality.
19
- */
20
- declare type Character = v.InferOutput<typeof CharacterSchema>;
21
-
22
- export declare type CharacterMap = {
23
- "0": Character;
24
- };
25
-
26
- declare const characterMap: {
27
- readonly 0: ObjectSchema< {
28
- readonly specVersion: LiteralSchema<0, undefined>;
29
- readonly id: StringSchema<undefined>;
30
- readonly name: StringSchema<undefined>;
31
- readonly description: StringSchema<undefined>;
32
- readonly avatarUrl: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, UrlAction<string, undefined>]>, undefined>;
33
- readonly prompt: ObjectSchema< {
34
- readonly description: StringSchema<undefined>;
35
- readonly authorsNote: StringSchema<undefined>;
36
- readonly lorebook: ObjectSchema< {
37
- readonly config: ObjectSchema< {
38
- readonly tokenLimit: SchemaWithPipe<readonly [NumberSchema<undefined>, IntegerAction<number, undefined>, MinValueAction<number, 1, undefined>]>;
39
- }, undefined>;
40
- readonly data: OptionalSchema<SchemaWithPipe<readonly [ArraySchema<ObjectSchema< {
41
- readonly id: OptionalSchema<StringSchema<undefined>, undefined>;
42
- readonly name: StringSchema<undefined>;
43
- readonly condition: OptionalSchema<ArraySchema<CustomSchema< {
44
- type: "regex_match";
45
- regexPattern: string;
46
- regexFlags?: string | undefined;
47
- } | {
48
- type: "plain_text_match";
49
- text: string;
50
- } | {
51
- type: "always";
52
- }, undefined>, undefined>, undefined>;
53
- readonly multipleConditionResolveStrategy: OptionalSchema<PicklistSchema<["all", "any"], undefined>, undefined>;
54
- readonly content: StringSchema<undefined>;
55
- readonly priority: OptionalSchema<NumberSchema<undefined>, undefined>;
56
- readonly enabled: OptionalSchema<BooleanSchema<undefined>, undefined>;
57
- }, undefined>, undefined>, CheckAction< {
58
- id?: string | undefined;
59
- name: string;
60
- condition?: ({
61
- type: "regex_match";
62
- regexPattern: string;
63
- regexFlags?: string | undefined;
64
- } | {
65
- type: "plain_text_match";
66
- text: string;
67
- } | {
68
- type: "always";
69
- })[] | undefined;
70
- multipleConditionResolveStrategy?: "all" | "any" | undefined;
71
- content: string;
72
- priority?: number | undefined;
73
- enabled?: boolean | undefined;
74
- }[], "Duplicated id is not allowed.">]>, readonly []>;
75
- }, undefined>;
76
- }, undefined>;
77
- }, undefined>;
78
- };
79
- export { characterMap }
80
- export default characterMap;
81
-
82
- /**
83
- * @see {@link Character}
84
- */
85
- declare const CharacterSchema: v.ObjectSchema<{
86
- /**
87
- * The version of the character spec.
88
- * This is used to determine which schema to use for parsing.
89
- * Also tries to migrate the character to the latest version.
90
- */
91
- readonly specVersion: v.LiteralSchema<0, undefined>;
92
- /**
93
- * Unique identifier for the character.
94
- */
95
- readonly id: v.StringSchema<undefined>;
96
- /**
97
- * The display name of the character.
98
- * Human readable, not scriptable.
99
- */
100
- readonly name: v.StringSchema<undefined>;
101
- /**
102
- * A short description of the character.
103
- * Human readable, not scriptable.
104
- */
105
- readonly description: v.StringSchema<undefined>;
106
- /**
107
- * Optional URL for the character's avatar image.
108
- */
109
- readonly avatarUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>, undefined>;
110
- readonly prompt: v.ObjectSchema<{
111
- /**
112
- * The character description.
113
- */
114
- readonly description: v.StringSchema<undefined>;
115
- /**
116
- * The authors note. It's usually used to mock the user's message(differ by prompt).
117
- */
118
- readonly authorsNote: v.StringSchema<undefined>;
119
- /**
120
- * Lorebook data.
121
- * @see {@link LorebookDataSchema}
122
- */
123
- readonly lorebook: v.ObjectSchema<{
124
- readonly config: v.ObjectSchema<{
125
- readonly tokenLimit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
126
- }, undefined>;
127
- readonly data: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
128
- readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
129
- readonly name: v.StringSchema<undefined>;
130
- readonly condition: v.OptionalSchema<v.ArraySchema<v.CustomSchema<{
131
- type: "regex_match";
132
- regexPattern: string;
133
- regexFlags?: string | undefined;
134
- } | {
135
- type: "plain_text_match";
136
- text: string;
137
- } | {
138
- type: "always";
139
- }, undefined>, undefined>, undefined>;
140
- readonly multipleConditionResolveStrategy: v.OptionalSchema<v.PicklistSchema<["all", "any"], undefined>, undefined>;
141
- readonly content: v.StringSchema<undefined>;
142
- readonly priority: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
143
- readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
144
- }, undefined>, undefined>, v.CheckAction<{
145
- id?: string | undefined;
146
- name: string;
147
- condition?: ({
148
- type: "regex_match";
149
- regexPattern: string;
150
- regexFlags?: string | undefined;
151
- } | {
152
- type: "plain_text_match";
153
- text: string;
154
- } | {
155
- type: "always";
156
- })[] | undefined;
157
- multipleConditionResolveStrategy?: "all" | "any" | undefined;
158
- content: string;
159
- priority?: number | undefined;
160
- enabled?: boolean | undefined;
161
- }[], "Duplicated id is not allowed.">]>, readonly []>;
162
- }, undefined>;
163
- }, undefined>;
164
- }, undefined>;
165
-
166
- export { }
1
+ // Auto-generated TypeScript types from Zod schemas
2
+ import type { z } from "zod";
3
+ import type { Character as CharacterV0 } from "./v0/Character/Character";
4
+ export { CharacterV0 };
5
+ export { CharacterSchema as CharacterV0Schema } from "./v0/Character/Character";
6
+
7
+ export declare const characterMap: {
8
+ readonly 0: z.ZodType<CharacterV0>;
9
+ };
10
+
11
+ export type CharacterMap = {
12
+ "0": CharacterV0;
13
+ };
14
+
15
+ export default characterMap;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as a } from "./Character-Didq99iq.js";
1
+ import { CharacterSchema as a } from "./v0/Character/Character.js";
2
2
  const t = {
3
3
  0: a
4
4
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {\n type Character as CharacterV0,\n CharacterSchema as CharacterV0Schema,\n} from \"@/types/v0/Character\";\n\nexport const characterMap = {\n 0: CharacterV0Schema,\n} as const;\nexport type CharacterMap = {\n \"0\": CharacterV0;\n};\n\nexport default characterMap;\n"],"names":["characterMap","CharacterV0Schema"],"mappings":";AAKO,MAAMA,IAAe;AAAA,EACxB,GAAGC;AACP;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {\n type Character as CharacterV0,\n CharacterSchema as CharacterV0Schema,\n} from \"@/types/v0/Character/Character\";\n\nexport const characterMap = {\n 0: CharacterV0Schema,\n} as const;\nexport type CharacterMap = {\n \"0\": CharacterV0;\n};\n\nexport default characterMap;\n"],"names":["characterMap","CharacterV0Schema"],"mappings":";AAKO,MAAMA,IAAe;AAAA,EACxB,GAAGC;AACP;"}
@@ -0,0 +1,37 @@
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 AssetsSetting = {
6
+ /** The assets of the character. */
7
+ assets: {
8
+ /** The URL of the asset. */
9
+ url: string;
10
+ /** MIME type of the asset. Usually `image/*` or `video/*`. */
11
+ mimeType: string;
12
+ /** The name of the asset. Used as the file name. Should be unique. */
13
+ name: string;
14
+ }[];
15
+ /** The inlays of the character. It is not intended to be exported as public. */
16
+ inlays: {
17
+ /** The URL of the asset. */
18
+ url: string;
19
+ /** MIME type of the asset. Usually `image/*` or `video/*`. */
20
+ mimeType: string;
21
+ /** The name of the asset. Used as the file name. Should be unique. */
22
+ name: string;
23
+ }[];
24
+ };
25
+
26
+ export declare const AssetsSettingSchema: z.ZodType<AssetsSetting>;
27
+
28
+ export type AssetEntity = {
29
+ /** The URL of the asset. */
30
+ url: string;
31
+ /** MIME type of the asset. Usually `image/*` or `video/*`. */
32
+ mimeType: string;
33
+ /** The name of the asset. Used as the file name. Should be unique. */
34
+ name: string;
35
+ };
36
+
37
+ export declare const AssetEntitySchema: z.ZodType<AssetEntity>;
@@ -0,0 +1,21 @@
1
+ import { z as e } from "zod";
2
+ import { ImageURLSchema as a, unique as t } from "../utils.js";
3
+ const s = e.object({
4
+ url: a.meta({ description: "The URL of the asset." }),
5
+ mimeType: e.string().meta({
6
+ description: "MIME type of the asset. Usually `image/*` or `video/*`."
7
+ }),
8
+ name: e.string().meta({
9
+ description: "The name of the asset. Used as the file name. Should be unique."
10
+ })
11
+ }), o = e.object({
12
+ assets: e.array(s).refine(t("name"), { message: "Not unique key: name" }).meta({ description: "The assets of the character." }),
13
+ inlays: e.array(s).refine(t("name"), { message: "Not unique key: name" }).meta({
14
+ description: "The inlays of the character. It is not intended to be exported as public."
15
+ })
16
+ }).meta({ description: "Settings for character assets." });
17
+ export {
18
+ s as AssetEntitySchema,
19
+ o as AssetsSettingSchema
20
+ };
21
+ //# sourceMappingURL=Assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Assets.js","sources":["../../../src/types/v0/Character/Assets.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ImageURLSchema, unique } from \"@/types/v0/utils\";\n\nexport const AssetEntitySchema = z.object({\n url: ImageURLSchema.meta({ description: \"The URL of the asset.\" }),\n mimeType: z.string().meta({\n description: \"MIME type of the asset. Usually `image/*` or `video/*`.\",\n }),\n name: z.string().meta({\n description:\n \"The name of the asset. Used as the file name. Should be unique.\",\n }),\n});\n\n/**\n * @see {@link AssetsSetting}\n */\nexport const AssetsSettingSchema = z\n .object({\n assets: z\n .array(AssetEntitySchema)\n .refine(unique(\"name\"), { message: \"Not unique key: name\" })\n .meta({ description: \"The assets of the character.\" }),\n inlays: z\n .array(AssetEntitySchema)\n .refine(unique(\"name\"), { message: \"Not unique key: name\" })\n .meta({\n description:\n \"The inlays of the character. It is not intended to be exported as public.\",\n }),\n })\n .meta({ description: \"Settings for character assets.\" });\n\n/**\n * This is the settings for character assets.\n */\nexport type AssetsSetting = z.infer<typeof AssetsSettingSchema>;\n"],"names":["AssetEntitySchema","z","ImageURLSchema","AssetsSettingSchema","unique"],"mappings":";;AAGO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACtC,KAAKC,EAAe,KAAK,EAAE,aAAa,yBAAyB;AAAA,EACjE,UAAUD,EAAE,OAAA,EAAS,KAAK;AAAA,IACtB,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,MAAMA,EAAE,OAAA,EAAS,KAAK;AAAA,IAClB,aACI;AAAA,EAAA,CACP;AACL,CAAC,GAKYE,IAAsBF,EAC9B,OAAO;AAAA,EACJ,QAAQA,EACH,MAAMD,CAAiB,EACvB,OAAOI,EAAO,MAAM,GAAG,EAAE,SAAS,wBAAwB,EAC1D,KAAK,EAAE,aAAa,gCAAgC;AAAA,EACzD,QAAQH,EACH,MAAMD,CAAiB,EACvB,OAAOI,EAAO,MAAM,GAAG,EAAE,SAAS,uBAAA,CAAwB,EAC1D,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP;AACT,CAAC,EACA,KAAK,EAAE,aAAa,kCAAkC;"}
@@ -0,0 +1,263 @@
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 Character = {
6
+ /** The version of the character spec. Used to determine which schema to use for parsing and migration. */
7
+ specVersion: 0;
8
+ /** Unique identifier for the character. */
9
+ id: string;
10
+ /** The display name of the character. Human readable, not scriptable. */
11
+ name: string;
12
+ /** A short description of the character. Human readable, not scriptable. */
13
+ description: string;
14
+ /** Optional URL for the character's avatar image. */
15
+ avatarUrl?: string | undefined;
16
+ /** The prompt data for the character. */
17
+ prompt: {
18
+ /** The character description. */
19
+ description: string;
20
+ /** The authors note. It's usually used to mock the user's message (differ by prompt). */
21
+ authorsNote: string;
22
+ /** Lorebook data. */
23
+ lorebook: {
24
+ /** The configuration for the lorebook. Not scriptable. */
25
+ config: {
26
+ /** The token limit for the lorebook. When exceeded, low-priority lorebooks will be deactivated. Positive integer. */
27
+ tokenLimit: number;
28
+ };
29
+ /** Contains the actual lorebooks. Duplicated id is not allowed. */
30
+ data: {
31
+ /** Internally generated ID. */
32
+ id: string;
33
+ /** Human readable name for the lorebook. */
34
+ name: string;
35
+ /** The condition for the lorebook to be activated. If empty, it will not be activated. Use 'always' to activate without any condition. */
36
+ condition: ({
37
+ /** This condition matches the regex pattern. */
38
+ type: "regex_match";
39
+ /** The regex pattern to match. Scriptable. */
40
+ regexPattern: string;
41
+ /** The regex flags to use. Not scriptable. */
42
+ regexFlags?: string | undefined;
43
+ } | {
44
+ /** This condition simply matches the text. */
45
+ type: "plain_text_match";
46
+ /** The text to match. Scriptable. Case insensitive. */
47
+ text: string;
48
+ } | {
49
+ /** This condition is always true. */
50
+ type: "always";
51
+ })[];
52
+ /** The strategy for resolving multiple conditions. 'all' means all must be met, 'any' means at least one. */
53
+ multipleConditionResolveStrategy?: ("all" | "any") | undefined;
54
+ /** The lorebook content to be added on AI prompt. Not for human reading. Scriptable. */
55
+ content: string;
56
+ /** The priority of the lorebook. Higher priority means it will be activated first. May be negative or decimal. Base is 0. */
57
+ priority?: number | undefined;
58
+ /** Whether the lorebook is enabled. */
59
+ enabled?: boolean | undefined;
60
+ }[];
61
+ };
62
+ };
63
+ /** Script and hooks which can be used to control the character's behavior. */
64
+ executables: {
65
+ /** Runtime settings for the script. Controls runtime environment. All values capped at user's configuration. */
66
+ runtimeSetting: {
67
+ /** The maximum memory usage of the script, in MB. Not an exact limit. May be exceeded or ignored. */
68
+ mem?: number | undefined;
69
+ };
70
+ /** Replace hooks for the script. */
71
+ replaceHooks: {
72
+ /** Replace hooks for display. Doesn't edit the data, only changes the display. */
73
+ display: {
74
+ /** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
75
+ input: string;
76
+ /** The meta data for the replace hook. */
77
+ meta: ({
78
+ /** The input pattern is a RegExp. */
79
+ type: "regex";
80
+ /** The flag for RegExp. */
81
+ flag: string;
82
+ } | {
83
+ /** The input pattern is a simple string. */
84
+ type: "string";
85
+ /** If true, the input pattern is case sensitive. */
86
+ caseSensitive: boolean;
87
+ }) & {
88
+ /** If true, input pattern might contain additional javascript expression. Resolved before matching. */
89
+ isInputPatternScripted: boolean;
90
+ /** If true, output might contain additional javascript expression. Resolved after matching. */
91
+ isOutputScripted: boolean;
92
+ /** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
93
+ priority: number;
94
+ };
95
+ /** The output. May contain additional javascript expression if `isOutputScripted` is true. */
96
+ output: string;
97
+ }[];
98
+ /** Replace hooks for input. User chat input will be edited by this. */
99
+ input: {
100
+ /** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
101
+ input: string;
102
+ /** The meta data for the replace hook. */
103
+ meta: ({
104
+ /** The input pattern is a RegExp. */
105
+ type: "regex";
106
+ /** The flag for RegExp. */
107
+ flag: string;
108
+ } | {
109
+ /** The input pattern is a simple string. */
110
+ type: "string";
111
+ /** If true, the input pattern is case sensitive. */
112
+ caseSensitive: boolean;
113
+ }) & {
114
+ /** If true, input pattern might contain additional javascript expression. Resolved before matching. */
115
+ isInputPatternScripted: boolean;
116
+ /** If true, output might contain additional javascript expression. Resolved after matching. */
117
+ isOutputScripted: boolean;
118
+ /** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
119
+ priority: number;
120
+ };
121
+ /** The output. May contain additional javascript expression if `isOutputScripted` is true. */
122
+ output: string;
123
+ }[];
124
+ /** Replace hooks for output. Character response will be edited by this. */
125
+ output: {
126
+ /** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
127
+ input: string;
128
+ /** The meta data for the replace hook. */
129
+ meta: ({
130
+ /** The input pattern is a RegExp. */
131
+ type: "regex";
132
+ /** The flag for RegExp. */
133
+ flag: string;
134
+ } | {
135
+ /** The input pattern is a simple string. */
136
+ type: "string";
137
+ /** If true, the input pattern is case sensitive. */
138
+ caseSensitive: boolean;
139
+ }) & {
140
+ /** If true, input pattern might contain additional javascript expression. Resolved before matching. */
141
+ isInputPatternScripted: boolean;
142
+ /** If true, output might contain additional javascript expression. Resolved after matching. */
143
+ isOutputScripted: boolean;
144
+ /** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
145
+ priority: number;
146
+ };
147
+ /** The output. May contain additional javascript expression if `isOutputScripted` is true. */
148
+ output: string;
149
+ }[];
150
+ /** 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. */
151
+ request: {
152
+ /** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
153
+ input: string;
154
+ /** The meta data for the replace hook. */
155
+ meta: ({
156
+ /** The input pattern is a RegExp. */
157
+ type: "regex";
158
+ /** The flag for RegExp. */
159
+ flag: string;
160
+ } | {
161
+ /** The input pattern is a simple string. */
162
+ type: "string";
163
+ /** If true, the input pattern is case sensitive. */
164
+ caseSensitive: boolean;
165
+ }) & {
166
+ /** If true, input pattern might contain additional javascript expression. Resolved before matching. */
167
+ isInputPatternScripted: boolean;
168
+ /** If true, output might contain additional javascript expression. Resolved after matching. */
169
+ isOutputScripted: boolean;
170
+ /** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
171
+ priority: number;
172
+ };
173
+ /** The output. May contain additional javascript expression if `isOutputScripted` is true. */
174
+ output: string;
175
+ }[];
176
+ };
177
+ };
178
+ /** Additional metadata about the character. Not used by the system, but can be used by the user. */
179
+ metadata: {
180
+ /** The author of the character. Optional. */
181
+ author?: string | undefined;
182
+ /** The license of the character. Optional. Using SPDX license identifier or URL is recommended. Default: ARR, which means the character is all rights reserved by the author. */
183
+ license: string;
184
+ /** The version of the character. Optional. */
185
+ version?: string | undefined;
186
+ /** The distributed page of the character.URL is recommended. Optional. */
187
+ distributedOn?: string | undefined;
188
+ /** Additional information about the character, which can't be represented by other fields. Optional. */
189
+ additionalInfo?: string | undefined;
190
+ };
191
+ /** Assets for the character. */
192
+ assets: {
193
+ /** The assets of the character. */
194
+ assets: {
195
+ /** The URL of the asset. */
196
+ url: string;
197
+ /** MIME type of the asset. Usually `image/*` or `video/*`. */
198
+ mimeType: string;
199
+ /** The name of the asset. Used as the file name. Should be unique. */
200
+ name: string;
201
+ }[];
202
+ /** The inlays of the character. It is not intended to be exported as public. */
203
+ inlays: {
204
+ /** The URL of the asset. */
205
+ url: string;
206
+ /** MIME type of the asset. Usually `image/*` or `video/*`. */
207
+ mimeType: string;
208
+ /** The name of the asset. Used as the file name. Should be unique. */
209
+ name: string;
210
+ }[];
211
+ };
212
+ };
213
+
214
+ export declare const CharacterSchema: z.ZodType<Character>;
215
+
216
+ export type CharacterPromptData = {
217
+ /** The character description. */
218
+ description: string;
219
+ /** The authors note. It's usually used to mock the user's message (differ by prompt). */
220
+ authorsNote: string;
221
+ /** Lorebook data. */
222
+ lorebook: {
223
+ /** The configuration for the lorebook. Not scriptable. */
224
+ config: {
225
+ /** The token limit for the lorebook. When exceeded, low-priority lorebooks will be deactivated. Positive integer. */
226
+ tokenLimit: number;
227
+ };
228
+ /** Contains the actual lorebooks. Duplicated id is not allowed. */
229
+ data: {
230
+ /** Internally generated ID. */
231
+ id: string;
232
+ /** Human readable name for the lorebook. */
233
+ name: string;
234
+ /** The condition for the lorebook to be activated. If empty, it will not be activated. Use 'always' to activate without any condition. */
235
+ condition: ({
236
+ /** This condition matches the regex pattern. */
237
+ type: "regex_match";
238
+ /** The regex pattern to match. Scriptable. */
239
+ regexPattern: string;
240
+ /** The regex flags to use. Not scriptable. */
241
+ regexFlags?: string | undefined;
242
+ } | {
243
+ /** This condition simply matches the text. */
244
+ type: "plain_text_match";
245
+ /** The text to match. Scriptable. Case insensitive. */
246
+ text: string;
247
+ } | {
248
+ /** This condition is always true. */
249
+ type: "always";
250
+ })[];
251
+ /** The strategy for resolving multiple conditions. 'all' means all must be met, 'any' means at least one. */
252
+ multipleConditionResolveStrategy?: ("all" | "any") | undefined;
253
+ /** The lorebook content to be added on AI prompt. Not for human reading. Scriptable. */
254
+ content: string;
255
+ /** The priority of the lorebook. Higher priority means it will be activated first. May be negative or decimal. Base is 0. */
256
+ priority?: number | undefined;
257
+ /** Whether the lorebook is enabled. */
258
+ enabled?: boolean | undefined;
259
+ }[];
260
+ };
261
+ };
262
+
263
+ export declare const CharacterPromptDataSchema: z.ZodType<CharacterPromptData>;
@@ -0,0 +1,46 @@
1
+ import { z as e } from "zod";
2
+ import { AssetsSettingSchema as t } from "./Assets.js";
3
+ import { LorebookDataSchema as a } from "./Lorebook.js";
4
+ import { MetaSchema as r } from "./Meta.js";
5
+ import { ScriptSettingSchema as o } from "../Executables/Executable.js";
6
+ import { ImageURLSchema as i } from "../utils.js";
7
+ const c = e.object({
8
+ description: e.string().meta({ description: "The character description." }),
9
+ authorsNote: e.string().meta({
10
+ description: "The authors note. It's usually used to mock the user's message (differ by prompt)."
11
+ }),
12
+ lorebook: a.meta({ description: "Lorebook data." })
13
+ }).meta({
14
+ description: "The prompt data for a character. Used to generate the character's persona. All parameters are for AI prompt and scriptable."
15
+ }), f = e.object({
16
+ specVersion: e.literal(0).meta({
17
+ description: "The version of the character spec. Used to determine which schema to use for parsing and migration."
18
+ }),
19
+ id: e.string().meta({ description: "Unique identifier for the character." }),
20
+ name: e.string().meta({
21
+ description: "The display name of the character. Human readable, not scriptable."
22
+ }),
23
+ description: e.string().meta({
24
+ description: "A short description of the character. Human readable, not scriptable."
25
+ }),
26
+ avatarUrl: i.optional().meta({
27
+ description: "Optional URL for the character's avatar image."
28
+ }),
29
+ prompt: c.meta({
30
+ description: "The prompt data for the character."
31
+ }),
32
+ executables: o.meta({
33
+ description: "Script and hooks which can be used to control the character's behavior."
34
+ }),
35
+ metadata: r.meta({
36
+ description: "Additional metadata about the character. Not used by the system, but can be used by the user."
37
+ }),
38
+ assets: t.meta({
39
+ description: "Assets for the character."
40
+ })
41
+ }).meta({ description: "Represents a specific AI character personality." });
42
+ export {
43
+ c as CharacterPromptDataSchema,
44
+ f as CharacterSchema
45
+ };
46
+ //# sourceMappingURL=Character.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Character.js","sources":["../../../src/types/v0/Character/Character.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AssetsSettingSchema } from \"@/types/v0/Character/Assets\";\nimport { LorebookDataSchema } from \"@/types/v0/Character/Lorebook\";\nimport { MetaSchema } from \"@/types/v0/Character/Meta\";\nimport { ScriptSettingSchema as ExecutableSettingSchema } from \"@/types/v0/Executables/Executable\";\nimport { ImageURLSchema } from \"@/types/v0/utils\";\n\n/**\n * The prompt data for a character.\n * It is used to generate the character's persona.\n * All of parameters are for AI prompt, and scriptable.\n */\nexport type CharacterPromptData = z.infer<typeof CharacterPromptDataSchema>;\n\nexport const CharacterPromptDataSchema = z\n .object({\n description: z\n .string()\n .meta({ description: \"The character description.\" }),\n authorsNote: z.string().meta({\n description:\n \"The authors note. It's usually used to mock the user's message (differ by prompt).\",\n }),\n lorebook: LorebookDataSchema.meta({ description: \"Lorebook data.\" }),\n })\n .meta({\n description:\n \"The prompt data for a character. Used to generate the character's persona. All parameters are for AI prompt and scriptable.\",\n });\n\nexport const CharacterSchema = z\n .object({\n specVersion: z.literal(0).meta({\n description:\n \"The version of the character spec. Used to determine which schema to use for parsing and migration.\",\n }),\n id: z\n .string()\n .meta({ description: \"Unique identifier for the character.\" }),\n name: z.string().meta({\n description:\n \"The display name of the character. Human readable, not scriptable.\",\n }),\n description: z.string().meta({\n description:\n \"A short description of the character. Human readable, not scriptable.\",\n }),\n avatarUrl: ImageURLSchema.optional().meta({\n description: \"Optional URL for the character's avatar image.\",\n }),\n prompt: CharacterPromptDataSchema.meta({\n description: \"The prompt data for the character.\",\n }),\n executables: ExecutableSettingSchema.meta({\n description:\n \"Script and hooks which can be used to control the character's behavior.\",\n }),\n metadata: MetaSchema.meta({\n description:\n \"Additional metadata about the character. Not used by the system, but can be used by the user.\",\n }),\n assets: AssetsSettingSchema.meta({\n description: \"Assets for the character.\",\n }),\n })\n .meta({ description: \"Represents a specific AI character personality.\" });\n\n/**\n * Represents a specific AI character personality.\n */\nexport type Character = z.infer<typeof CharacterSchema>;\n"],"names":["CharacterPromptDataSchema","z","LorebookDataSchema","CharacterSchema","ImageURLSchema","ExecutableSettingSchema","MetaSchema","AssetsSettingSchema"],"mappings":";;;;;;AAcO,MAAMA,IAA4BC,EACpC,OAAO;AAAA,EACJ,aAAaA,EACR,OAAA,EACA,KAAK,EAAE,aAAa,8BAA8B;AAAA,EACvD,aAAaA,EAAE,OAAA,EAAS,KAAK;AAAA,IACzB,aACI;AAAA,EAAA,CACP;AAAA,EACD,UAAUC,EAAmB,KAAK,EAAE,aAAa,kBAAkB;AACvE,CAAC,EACA,KAAK;AAAA,EACF,aACI;AACR,CAAC,GAEQC,IAAkBF,EAC1B,OAAO;AAAA,EACJ,aAAaA,EAAE,QAAQ,CAAC,EAAE,KAAK;AAAA,IAC3B,aACI;AAAA,EAAA,CACP;AAAA,EACD,IAAIA,EACC,OAAA,EACA,KAAK,EAAE,aAAa,wCAAwC;AAAA,EACjE,MAAMA,EAAE,OAAA,EAAS,KAAK;AAAA,IAClB,aACI;AAAA,EAAA,CACP;AAAA,EACD,aAAaA,EAAE,OAAA,EAAS,KAAK;AAAA,IACzB,aACI;AAAA,EAAA,CACP;AAAA,EACD,WAAWG,EAAe,SAAA,EAAW,KAAK;AAAA,IACtC,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,QAAQJ,EAA0B,KAAK;AAAA,IACnC,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,aAAaK,EAAwB,KAAK;AAAA,IACtC,aACI;AAAA,EAAA,CACP;AAAA,EACD,UAAUC,EAAW,KAAK;AAAA,IACtB,aACI;AAAA,EAAA,CACP;AAAA,EACD,QAAQC,EAAoB,KAAK;AAAA,IAC7B,aAAa;AAAA,EAAA,CAChB;AACL,CAAC,EACA,KAAK,EAAE,aAAa,mDAAmD;"}
@@ -0,0 +1,73 @@
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 Chat = {
6
+ /** Unique identifier for the chat session. */
7
+ id: string;
8
+ /** The ID of the character associated with this chat. */
9
+ characterId: string;
10
+ /** The list of messages in this chat. */
11
+ messages: {
12
+ /** Unique identifier for the message. */
13
+ id: string;
14
+ /** The role of the message sender. */
15
+ role: "user" | "assistant" | "system";
16
+ /** The content of the message. */
17
+ content: {
18
+ /** The message content is a simple string. */
19
+ type: "string";
20
+ /** The message content. */
21
+ data: string;
22
+ } | {
23
+ /** The file content is stored in the separated storage. */
24
+ type: "file";
25
+ /** URL of the file. */
26
+ data: string;
27
+ /** MIME type of the file. */
28
+ mimeType: string;
29
+ };
30
+ /** The timestamp when the message was created. */
31
+ timestamp?: number | undefined;
32
+ }[];
33
+ /** Optional title for the chat. */
34
+ title: string;
35
+ /** creation timestamp (unix epoch) */
36
+ createdAt: number;
37
+ /** Last updated timestamp (unix epoch) */
38
+ updatedAt: number;
39
+ /** Chat specific lorebook data. */
40
+ lorebook?: {
41
+ /** Internally generated ID. */
42
+ id: string;
43
+ /** Human readable name for the lorebook. */
44
+ name: string;
45
+ /** The condition for the lorebook to be activated. If empty, it will not be activated. Use 'always' to activate without any condition. */
46
+ condition: ({
47
+ /** This condition matches the regex pattern. */
48
+ type: "regex_match";
49
+ /** The regex pattern to match. Scriptable. */
50
+ regexPattern: string;
51
+ /** The regex flags to use. Not scriptable. */
52
+ regexFlags?: string | undefined;
53
+ } | {
54
+ /** This condition simply matches the text. */
55
+ type: "plain_text_match";
56
+ /** The text to match. Scriptable. Case insensitive. */
57
+ text: string;
58
+ } | {
59
+ /** This condition is always true. */
60
+ type: "always";
61
+ })[];
62
+ /** The strategy for resolving multiple conditions. 'all' means all must be met, 'any' means at least one. */
63
+ multipleConditionResolveStrategy?: ("all" | "any") | undefined;
64
+ /** The lorebook content to be added on AI prompt. Not for human reading. Scriptable. */
65
+ content: string;
66
+ /** The priority of the lorebook. Higher priority means it will be activated first. May be negative or decimal. Base is 0. */
67
+ priority?: number | undefined;
68
+ /** Whether the lorebook is enabled. */
69
+ enabled?: boolean | undefined;
70
+ }[] | undefined;
71
+ };
72
+
73
+ export declare const ChatSchema: z.ZodType<Chat>;