@arisutalk/character-spec 0.0.1 → 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.
- package/README.md +2 -0
- package/dist/v0/Character/Assets.d.ts +9 -2
- package/dist/v0/Character/Assets.js +6 -6
- package/dist/v0/Character/Assets.js.map +1 -1
- package/dist/v0/Character/Character.d.ts +21 -0
- package/dist/v0/Character/Character.js +17 -13
- package/dist/v0/Character/Character.js.map +1 -1
- package/dist/v0/Character/Chat.js.map +1 -1
- package/dist/v0/Character/Lorebook.js.map +1 -1
- package/dist/v0/Character/Message.js.map +1 -1
- package/dist/v0/Executables/ReplaceHook.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @arisutalk/character-spec ✨
|
|
2
2
|
|
|
3
|
+
[](https://deepwiki.com/arisutalk/character-spec)
|
|
4
|
+
|
|
3
5
|
Hi there! Welcome to the **character-spec** library for ArisuTalk! 🌸
|
|
4
6
|
|
|
5
7
|
This package defines the official character specification and schemas for ArisuTalk, strictly typed with [Zod](https://zod.dev/). It provides runtime validation and TypeScript types with **full JSDoc comments** for an amazing IDE experience!
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
|
|
5
5
|
export type AssetsSetting = {
|
|
6
|
-
/** The URL of the character's avatar image. */
|
|
7
|
-
avatarUrl?: string | undefined;
|
|
8
6
|
/** The assets of the character. */
|
|
9
7
|
assets: {
|
|
10
8
|
/** The URL of the asset. */
|
|
@@ -14,6 +12,15 @@ export type AssetsSetting = {
|
|
|
14
12
|
/** The name of the asset. Used as the file name. Should be unique. */
|
|
15
13
|
name: string;
|
|
16
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
|
+
}[];
|
|
17
24
|
};
|
|
18
25
|
|
|
19
26
|
export declare const AssetsSettingSchema: z.ZodType<AssetsSetting>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
import { ImageURLSchema as
|
|
2
|
+
import { ImageURLSchema as a, unique as t } from "../utils.js";
|
|
3
3
|
const s = e.object({
|
|
4
|
-
url:
|
|
4
|
+
url: a.meta({ description: "The URL of the asset." }),
|
|
5
5
|
mimeType: e.string().meta({
|
|
6
6
|
description: "MIME type of the asset. Usually `image/*` or `video/*`."
|
|
7
7
|
}),
|
|
@@ -9,10 +9,10 @@ const s = e.object({
|
|
|
9
9
|
description: "The name of the asset. Used as the file name. Should be unique."
|
|
10
10
|
})
|
|
11
11
|
}), o = e.object({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
16
|
}).meta({ description: "Settings for character assets." });
|
|
17
17
|
export {
|
|
18
18
|
s as AssetEntitySchema,
|
|
@@ -1 +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
|
|
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;"}
|
|
@@ -188,6 +188,27 @@ export type Character = {
|
|
|
188
188
|
/** Additional information about the character, which can't be represented by other fields. Optional. */
|
|
189
189
|
additionalInfo?: string | undefined;
|
|
190
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
|
+
};
|
|
191
212
|
};
|
|
192
213
|
|
|
193
214
|
export declare const CharacterSchema: z.ZodType<Character>;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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({
|
|
7
8
|
description: e.string().meta({ description: "The character description." }),
|
|
8
9
|
authorsNote: e.string().meta({
|
|
9
10
|
description: "The authors note. It's usually used to mock the user's message (differ by prompt)."
|
|
10
11
|
}),
|
|
11
|
-
lorebook:
|
|
12
|
+
lorebook: a.meta({ description: "Lorebook data." })
|
|
12
13
|
}).meta({
|
|
13
14
|
description: "The prompt data for a character. Used to generate the character's persona. All parameters are for AI prompt and scriptable."
|
|
14
|
-
}),
|
|
15
|
+
}), f = e.object({
|
|
15
16
|
specVersion: e.literal(0).meta({
|
|
16
17
|
description: "The version of the character spec. Used to determine which schema to use for parsing and migration."
|
|
17
18
|
}),
|
|
@@ -22,21 +23,24 @@ const i = e.object({
|
|
|
22
23
|
description: e.string().meta({
|
|
23
24
|
description: "A short description of the character. Human readable, not scriptable."
|
|
24
25
|
}),
|
|
25
|
-
avatarUrl:
|
|
26
|
+
avatarUrl: i.optional().meta({
|
|
26
27
|
description: "Optional URL for the character's avatar image."
|
|
27
28
|
}),
|
|
28
|
-
prompt:
|
|
29
|
+
prompt: c.meta({
|
|
29
30
|
description: "The prompt data for the character."
|
|
30
31
|
}),
|
|
31
|
-
executables:
|
|
32
|
+
executables: o.meta({
|
|
32
33
|
description: "Script and hooks which can be used to control the character's behavior."
|
|
33
34
|
}),
|
|
34
|
-
metadata:
|
|
35
|
+
metadata: r.meta({
|
|
35
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."
|
|
36
40
|
})
|
|
37
41
|
}).meta({ description: "Represents a specific AI character personality." });
|
|
38
42
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
c as CharacterPromptDataSchema,
|
|
44
|
+
f as CharacterSchema
|
|
41
45
|
};
|
|
42
46
|
//# sourceMappingURL=Character.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Character.js","sources":["../../../src/types/v0/Character/Character.ts"],"sourcesContent":["import { z } from \"zod\";\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 })\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"],"mappings":"
|
|
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;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.js","sources":["../../../src/types/v0/Character/Chat.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { LorebookDataSchema } from \"@/types/v0/Character/Lorebook\";\nimport { MessageSchema } from \"@/types/v0/Character/Message\";\nimport { unique } from \"@/types/v0/utils\";\n\n/**\n * @see {@link Chat}\n */\nexport const ChatSchema = z\n .object({\n id: z\n .string()\n .meta({ description: \"Unique identifier for the chat session.\" }),\n characterId: z
|
|
1
|
+
{"version":3,"file":"Chat.js","sources":["../../../src/types/v0/Character/Chat.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { LorebookDataSchema } from \"@/types/v0/Character/Lorebook\";\nimport { MessageSchema } from \"@/types/v0/Character/Message\";\nimport { unique } from \"@/types/v0/utils\";\n\n/**\n * @see {@link Chat}\n */\nexport const ChatSchema = z\n .object({\n id: z\n .string()\n .meta({ description: \"Unique identifier for the chat session.\" }),\n characterId: z.string().meta({\n description: \"The ID of the character associated with this chat.\",\n }),\n messages: z\n .array(MessageSchema)\n .refine(unique(\"id\"), { message: \"Not unique key: id\" })\n .meta({ description: \"The list of messages in this chat.\" }),\n title: z\n .string()\n .default(\"Chat\")\n .meta({ description: \"Optional title for the chat.\" }),\n createdAt: z\n .number()\n .default(Date.now)\n .meta({ description: \"creation timestamp (unix epoch)\" }),\n updatedAt: z\n .number()\n .default(Date.now)\n .meta({ description: \"Last updated timestamp (unix epoch)\" }),\n lorebook: LorebookDataSchema.shape.data\n .optional()\n .meta({ description: \"Chat specific lorebook data.\" }),\n })\n .meta({ description: \"Represents a chat session with a character.\" });\n\n/**\n * Represents a chat session with a character.\n */\nexport type Chat = z.infer<typeof ChatSchema>;\n"],"names":["ChatSchema","z","MessageSchema","unique","LorebookDataSchema"],"mappings":";;;;AAQO,MAAMA,IAAaC,EACrB,OAAO;AAAA,EACJ,IAAIA,EACC,OAAA,EACA,KAAK,EAAE,aAAa,2CAA2C;AAAA,EACpE,aAAaA,EAAE,OAAA,EAAS,KAAK;AAAA,IACzB,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,UAAUA,EACL,MAAMC,CAAa,EACnB,OAAOC,EAAO,IAAI,GAAG,EAAE,SAAS,sBAAsB,EACtD,KAAK,EAAE,aAAa,sCAAsC;AAAA,EAC/D,OAAOF,EACF,OAAA,EACA,QAAQ,MAAM,EACd,KAAK,EAAE,aAAa,gCAAgC;AAAA,EACzD,WAAWA,EACN,OAAA,EACA,QAAQ,KAAK,GAAG,EAChB,KAAK,EAAE,aAAa,kCAAA,CAAmC;AAAA,EAC5D,WAAWA,EACN,OAAA,EACA,QAAQ,KAAK,GAAG,EAChB,KAAK,EAAE,aAAa,sCAAA,CAAuC;AAAA,EAChE,UAAUG,EAAmB,MAAM,KAC9B,SAAA,EACA,KAAK,EAAE,aAAa,+BAAA,CAAgC;AAC7D,CAAC,EACA,KAAK,EAAE,aAAa,+CAA+C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lorebook.js","sources":["../../../src/types/v0/Character/Lorebook.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { unique } from \"@/types/v0/utils\";\n\n/**\n * @see {@link LorebookConditionSchema}\n */\nexport const LorebookConditionDetailSchema = {\n regex: z\n .object({\n type: z
|
|
1
|
+
{"version":3,"file":"Lorebook.js","sources":["../../../src/types/v0/Character/Lorebook.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { unique } from \"@/types/v0/utils\";\n\n/**\n * @see {@link LorebookConditionSchema}\n */\nexport const LorebookConditionDetailSchema = {\n regex: z\n .object({\n type: z.literal(\"regex_match\").meta({\n description: \"This condition matches the regex pattern.\",\n }),\n regexPattern: z.string().meta({\n description: \"The regex pattern to match. Scriptable.\",\n }),\n regexFlags: z.string().optional().meta({\n description: \"The regex flags to use. Not scriptable.\",\n }),\n })\n .meta({ description: \"Regex match condition.\" }),\n plainText: z\n .object({\n type: z.literal(\"plain_text_match\").meta({\n description: \"This condition simply matches the text.\",\n }),\n text: z.string().meta({\n description: \"The text to match. Scriptable. Case insensitive.\",\n }),\n })\n .meta({ description: \"Plain text match condition.\" }),\n always: z\n .object({\n type: z\n .literal(\"always\")\n .meta({ description: \"This condition is always true.\" }),\n })\n .meta({ description: \"Always active condition.\" }),\n} as const;\n\n/**\n * The condition for the lorebook to be activated.\n */\nexport const LorebookConditionSchema = z.discriminatedUnion(\"type\", [\n LorebookConditionDetailSchema.regex,\n LorebookConditionDetailSchema.plainText,\n LorebookConditionDetailSchema.always,\n]);\n\n/**\n * The condition for the lorebook to be activated.\n * @see {@link LorebookConditionSchema}\n */\nexport type LorebookCondition = z.infer<typeof LorebookConditionSchema>;\n\n/**\n * @see {@link LorebookEntry}\n */\nexport const LorebookEntrySchema = z\n .object({\n id: z.string().meta({ description: \"Internally generated ID.\" }),\n name: z\n .string()\n .meta({ description: \"Human readable name for the lorebook.\" }),\n condition: z.array(LorebookConditionSchema).default([]).meta({\n description:\n \"The condition for the lorebook to be activated. If empty, it will not be activated. Use 'always' to activate without any condition.\",\n }),\n multipleConditionResolveStrategy: z\n .enum([\"all\", \"any\"])\n .optional()\n .meta({\n description:\n \"The strategy for resolving multiple conditions. 'all' means all must be met, 'any' means at least one.\",\n }),\n content: z.string().meta({\n description:\n \"The lorebook content to be added on AI prompt. Not for human reading. Scriptable.\",\n }),\n priority: z.number().optional().meta({\n description:\n \"The priority of the lorebook. Higher priority means it will be activated first. May be negative or decimal. Base is 0.\",\n }),\n enabled: z\n .boolean()\n .optional()\n .meta({ description: \"Whether the lorebook is enabled.\" }),\n })\n .meta({\n description:\n \"A lorebook entry. Small part of prompts activated by session's text matching.\",\n });\n\n/**\n * A lorebook is a collection of lorebooks.\n * Lorebook is a small part of prompts which is activated by session's text matching.\n */\nexport type LorebookEntry = z.infer<typeof LorebookEntrySchema>;\n\n/**\n * @see {@link LorebookData}\n */\nexport const LorebookDataSchema = z\n .object({\n config: z\n .object({\n tokenLimit: z.number().int().min(1).meta({\n description:\n \"The token limit for the lorebook. When exceeded, low-priority lorebooks will be deactivated. Positive integer.\",\n }),\n })\n .meta({\n description:\n \"The configuration for the lorebook. Not scriptable.\",\n }),\n data: z\n .array(LorebookEntrySchema)\n .refine(unique(\"id\"), { message: \"Not unique key: id\" })\n .default([])\n .meta({\n description:\n \"Contains the actual lorebooks. Duplicated id is not allowed.\",\n }),\n })\n .meta({\n description:\n \"Object containing all data for the lorebook. Meant to be stored in the database.\",\n });\n\n/**\n * Object containing all data for the lorebook.\n * It's meant to be stored in the database and many other places.\n */\nexport type LorebookData = z.infer<typeof LorebookDataSchema>;\n"],"names":["LorebookConditionDetailSchema","z","LorebookConditionSchema","LorebookEntrySchema","LorebookDataSchema","unique"],"mappings":";;AAMO,MAAMA,IAAgC;AAAA,EACzC,OAAOC,EACF,OAAO;AAAA,IACJ,MAAMA,EAAE,QAAQ,aAAa,EAAE,KAAK;AAAA,MAChC,aAAa;AAAA,IAAA,CAChB;AAAA,IACD,cAAcA,EAAE,OAAA,EAAS,KAAK;AAAA,MAC1B,aAAa;AAAA,IAAA,CAChB;AAAA,IACD,YAAYA,EAAE,OAAA,EAAS,SAAA,EAAW,KAAK;AAAA,MACnC,aAAa;AAAA,IAAA,CAChB;AAAA,EAAA,CACJ,EACA,KAAK,EAAE,aAAa,0BAA0B;AAAA,EACnD,WAAWA,EACN,OAAO;AAAA,IACJ,MAAMA,EAAE,QAAQ,kBAAkB,EAAE,KAAK;AAAA,MACrC,aAAa;AAAA,IAAA,CAChB;AAAA,IACD,MAAMA,EAAE,OAAA,EAAS,KAAK;AAAA,MAClB,aAAa;AAAA,IAAA,CAChB;AAAA,EAAA,CACJ,EACA,KAAK,EAAE,aAAa,+BAA+B;AAAA,EACxD,QAAQA,EACH,OAAO;AAAA,IACJ,MAAMA,EACD,QAAQ,QAAQ,EAChB,KAAK,EAAE,aAAa,iCAAA,CAAkC;AAAA,EAAA,CAC9D,EACA,KAAK,EAAE,aAAa,4BAA4B;AACzD,GAKaC,IAA0BD,EAAE,mBAAmB,QAAQ;AAAA,EAChED,EAA8B;AAAA,EAC9BA,EAA8B;AAAA,EAC9BA,EAA8B;AAClC,CAAC,GAWYG,IAAsBF,EAC9B,OAAO;AAAA,EACJ,IAAIA,EAAE,OAAA,EAAS,KAAK,EAAE,aAAa,4BAA4B;AAAA,EAC/D,MAAMA,EACD,OAAA,EACA,KAAK,EAAE,aAAa,yCAAyC;AAAA,EAClE,WAAWA,EAAE,MAAMC,CAAuB,EAAE,QAAQ,CAAA,CAAE,EAAE,KAAK;AAAA,IACzD,aACI;AAAA,EAAA,CACP;AAAA,EACD,kCAAkCD,EAC7B,KAAK,CAAC,OAAO,KAAK,CAAC,EACnB,SAAA,EACA,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP;AAAA,EACL,SAASA,EAAE,OAAA,EAAS,KAAK;AAAA,IACrB,aACI;AAAA,EAAA,CACP;AAAA,EACD,UAAUA,EAAE,OAAA,EAAS,SAAA,EAAW,KAAK;AAAA,IACjC,aACI;AAAA,EAAA,CACP;AAAA,EACD,SAASA,EACJ,UACA,SAAA,EACA,KAAK,EAAE,aAAa,mCAAA,CAAoC;AACjE,CAAC,EACA,KAAK;AAAA,EACF,aACI;AACR,CAAC,GAWQG,IAAqBH,EAC7B,OAAO;AAAA,EACJ,QAAQA,EACH,OAAO;AAAA,IACJ,YAAYA,EAAE,SAAS,MAAM,IAAI,CAAC,EAAE,KAAK;AAAA,MACrC,aACI;AAAA,IAAA,CACP;AAAA,EAAA,CACJ,EACA,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP;AAAA,EACL,MAAMA,EACD,MAAME,CAAmB,EACzB,OAAOE,EAAO,IAAI,GAAG,EAAE,SAAS,sBAAsB,EACtD,QAAQ,CAAA,CAAE,EACV,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP;AACT,CAAC,EACA,KAAK;AAAA,EACF,aACI;AACR,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","sources":["../../../src/types/v0/Character/Message.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ImageURLSchema } from \"@/types/v0/utils\";\n\n/**\n * Represents the role of the message sender.\n */\nexport const RoleSchema = z\n .enum([\"user\", \"assistant\", \"system\"])\n .meta({ description: \"Represents the role of the message sender.\" });\n\nconst MessageContentSchema = {\n text: z\n .object({\n type: z
|
|
1
|
+
{"version":3,"file":"Message.js","sources":["../../../src/types/v0/Character/Message.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ImageURLSchema } from \"@/types/v0/utils\";\n\n/**\n * Represents the role of the message sender.\n */\nexport const RoleSchema = z\n .enum([\"user\", \"assistant\", \"system\"])\n .meta({ description: \"Represents the role of the message sender.\" });\n\nconst MessageContentSchema = {\n text: z\n .object({\n type: z.literal(\"string\").meta({\n description: \"The message content is a simple string.\",\n }),\n data: z.string().meta({ description: \"The message content.\" }),\n })\n .meta({ description: \"Text message content.\" }),\n file: z\n .object({\n type: z.literal(\"file\").meta({\n description:\n \"The file content is stored in the separated storage.\",\n }),\n data: ImageURLSchema.meta({ description: \"URL of the file.\" }),\n mimeType: z\n .string()\n .meta({ description: \"MIME type of the file.\" }),\n })\n .meta({ description: \"File message content.\" }),\n};\n\n/**\n * @see {@link Message}\n */\nexport const MessageSchema = z\n .object({\n id: z\n .string()\n .meta({ description: \"Unique identifier for the message.\" }),\n role: RoleSchema.meta({\n description: \"The role of the message sender.\",\n }),\n content: z\n .discriminatedUnion(\"type\", [\n MessageContentSchema.text,\n MessageContentSchema.file,\n ])\n .meta({ description: \"The content of the message.\" }),\n timestamp: z.number().optional().meta({\n description: \"The timestamp when the message was created.\",\n }),\n })\n .meta({ description: \"Represents a single message in a chat history.\" });\n\n/**\n * Represents a single message in a chat history.\n */\nexport type Message = z.infer<typeof MessageSchema>;\n"],"names":["RoleSchema","z","MessageContentSchema","ImageURLSchema","MessageSchema"],"mappings":";;AAMO,MAAMA,IAAaC,EACrB,KAAK,CAAC,QAAQ,aAAa,QAAQ,CAAC,EACpC,KAAK,EAAE,aAAa,8CAA8C,GAEjEC,IAAuB;AAAA,EACzB,MAAMD,EACD,OAAO;AAAA,IACJ,MAAMA,EAAE,QAAQ,QAAQ,EAAE,KAAK;AAAA,MAC3B,aAAa;AAAA,IAAA,CAChB;AAAA,IACD,MAAMA,EAAE,OAAA,EAAS,KAAK,EAAE,aAAa,wBAAwB;AAAA,EAAA,CAChE,EACA,KAAK,EAAE,aAAa,yBAAyB;AAAA,EAClD,MAAMA,EACD,OAAO;AAAA,IACJ,MAAMA,EAAE,QAAQ,MAAM,EAAE,KAAK;AAAA,MACzB,aACI;AAAA,IAAA,CACP;AAAA,IACD,MAAME,EAAe,KAAK,EAAE,aAAa,oBAAoB;AAAA,IAC7D,UAAUF,EACL,OAAA,EACA,KAAK,EAAE,aAAa,0BAA0B;AAAA,EAAA,CACtD,EACA,KAAK,EAAE,aAAa,yBAAyB;AACtD,GAKaG,IAAgBH,EACxB,OAAO;AAAA,EACJ,IAAIA,EACC,OAAA,EACA,KAAK,EAAE,aAAa,sCAAsC;AAAA,EAC/D,MAAMD,EAAW,KAAK;AAAA,IAClB,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,SAASC,EACJ,mBAAmB,QAAQ;AAAA,IACxBC,EAAqB;AAAA,IACrBA,EAAqB;AAAA,EAAA,CACxB,EACA,KAAK,EAAE,aAAa,+BAA+B;AAAA,EACxD,WAAWD,EAAE,OAAA,EAAS,SAAA,EAAW,KAAK;AAAA,IAClC,aAAa;AAAA,EAAA,CAChB;AACL,CAAC,EACA,KAAK,EAAE,aAAa,kDAAkD;"}
|
|
@@ -1 +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
|
|
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.boolean().default(true).meta({\n description: \"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,EAAE,QAAA,EAAU,QAAQ,EAAI,EAAE,KAAK;AAAA,MAC1C,aAAa;AAAA,IAAA,CAChB;AAAA,EAAA,CACJ,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;"}
|