@arisutalk/character-spec 0.0.4 → 0.0.6
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/dist/index.d.ts +4 -4
- package/dist/v0/Character/Assets.d.ts +30 -17
- package/dist/v0/Character/Assets.js +8 -4
- package/dist/v0/Character/Assets.js.map +1 -1
- package/dist/v0/Character/Character.d.ts +74 -63
- package/dist/v0/Character/Character.js +11 -10
- package/dist/v0/Character/Character.js.map +1 -1
- package/dist/v0/Character/Chat.d.ts +11 -4
- package/dist/v0/Character/Chat.js +1 -1
- package/dist/v0/Character/Chat.js.map +1 -1
- package/dist/v0/Character/Lorebook.d.ts +32 -25
- package/dist/v0/Character/Lorebook.js +14 -14
- package/dist/v0/Character/Lorebook.js.map +1 -1
- package/dist/v0/Character/Message.d.ts +23 -11
- package/dist/v0/Character/Message.js +8 -8
- package/dist/v0/Character/Message.js.map +1 -1
- package/dist/v0/Character/Meta.d.ts +19 -0
- package/dist/v0/Character/index.d.ts +2 -1
- package/dist/v0/Character.d.ts +2 -6
- package/dist/v0/Character.js +5 -3
- package/dist/v0/Character.js.map +1 -1
- package/dist/v0/Executables/Executable.d.ts +13 -8
- package/dist/v0/Executables/Executable.js +11 -8
- package/dist/v0/Executables/Executable.js.map +1 -1
- package/dist/v0/Executables/ReplaceHook.d.ts +66 -57
- package/dist/v0/Executables/ReplaceHook.js +10 -10
- package/dist/v0/Executables/ReplaceHook.js.map +1 -1
- package/dist/v0/Executables/index.d.ts +1 -1
- package/dist/v0/Executables.d.ts +2 -3
- package/dist/v0/index.d.ts +3 -1
- package/dist/v0/utils.d.ts +31 -6
- package/dist/v0/utils.js +21 -8
- package/dist/v0/utils.js.map +1 -1
- package/dist/v0.d.ts +1 -1
- package/dist/v0.js +5 -3
- package/package.json +7 -3
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
// Auto-generated TypeScript
|
|
2
|
-
//
|
|
3
|
-
import type { z } from "zod";
|
|
1
|
+
// Auto-generated TypeScript declarations from Zod schemas. DO NOT EDIT.
|
|
2
|
+
// Regenerate with: pnpm generate-types
|
|
4
3
|
|
|
4
|
+
import type { ZodType } from "zod";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a single message in a chat history.
|
|
8
|
+
*/
|
|
5
9
|
export type Message = {
|
|
6
10
|
/** Unique identifier for the message. */
|
|
7
11
|
id: string;
|
|
@@ -12,32 +16,40 @@ export type Message = {
|
|
|
12
16
|
/** The content of the message. */
|
|
13
17
|
content: {
|
|
14
18
|
/** The message content is a simple string. */
|
|
15
|
-
type: "
|
|
19
|
+
type: "text";
|
|
16
20
|
/** The message content. */
|
|
17
21
|
data: string;
|
|
18
22
|
} | {
|
|
19
23
|
/** The file content is stored in the separated storage. */
|
|
20
24
|
type: "file";
|
|
21
|
-
/**
|
|
22
|
-
data: string;
|
|
25
|
+
/** The file content. */
|
|
26
|
+
data: string | Uint8Array;
|
|
23
27
|
/** MIME type of the file. */
|
|
24
28
|
mimeType: string;
|
|
25
29
|
};
|
|
26
30
|
/** The timestamp when the message was created. */
|
|
27
31
|
timestamp?: number | undefined;
|
|
28
|
-
/** The inlays of the message. It is not intended to be exported as public. */
|
|
29
32
|
inlays: {
|
|
30
|
-
/** The URL of the asset. */
|
|
31
|
-
url: string;
|
|
32
33
|
/** MIME type of the asset. Usually `image/*` or `video/*`. */
|
|
33
34
|
mimeType: string;
|
|
34
35
|
/** The name of the asset. Used as the file name. Should be unique. */
|
|
35
36
|
name: string;
|
|
37
|
+
/** The data of the asset. */
|
|
38
|
+
data: string | Uint8Array;
|
|
36
39
|
}[];
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Represents a single message in a chat history.
|
|
44
|
+
*/
|
|
45
|
+
export declare const MessageSchema: ZodType<Message>;
|
|
40
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Represents the role of the message sender.
|
|
49
|
+
*/
|
|
41
50
|
export type Role = "user" | "assistant" | "system";
|
|
42
51
|
|
|
43
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Represents the role of the message sender.
|
|
54
|
+
*/
|
|
55
|
+
export declare const RoleSchema: ZodType<Role>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
2
|
import { AssetEntitySchema as s } from "./Assets.js";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
3
|
+
import { FileSchema as i, unique as n } from "../utils.js";
|
|
4
|
+
const a = e.enum(["user", "assistant", "system"]).meta({ description: "Represents the role of the message sender." }), t = {
|
|
5
5
|
text: e.object({
|
|
6
|
-
type: e.literal("
|
|
6
|
+
type: e.literal("text").meta({
|
|
7
7
|
description: "The message content is a simple string."
|
|
8
8
|
}),
|
|
9
9
|
data: e.string().meta({ description: "The message content." })
|
|
@@ -12,7 +12,7 @@ const n = e.enum(["user", "assistant", "system"]).meta({ description: "Represent
|
|
|
12
12
|
type: e.literal("file").meta({
|
|
13
13
|
description: "The file content is stored in the separated storage."
|
|
14
14
|
}),
|
|
15
|
-
data: i.meta({ description: "
|
|
15
|
+
data: i.meta({ description: "The file content." }),
|
|
16
16
|
mimeType: e.string().meta({ description: "MIME type of the file." })
|
|
17
17
|
}).meta({ description: "File message content." })
|
|
18
18
|
}, c = e.object({
|
|
@@ -20,7 +20,7 @@ const n = e.enum(["user", "assistant", "system"]).meta({ description: "Represent
|
|
|
20
20
|
chatId: e.string().meta({
|
|
21
21
|
description: "The ID of the chat associated with this message."
|
|
22
22
|
}),
|
|
23
|
-
role:
|
|
23
|
+
role: a.meta({
|
|
24
24
|
description: "The role of the message sender."
|
|
25
25
|
}),
|
|
26
26
|
content: e.discriminatedUnion("type", [
|
|
@@ -30,12 +30,12 @@ const n = e.enum(["user", "assistant", "system"]).meta({ description: "Represent
|
|
|
30
30
|
timestamp: e.number().optional().meta({
|
|
31
31
|
description: "The timestamp when the message was created."
|
|
32
32
|
}),
|
|
33
|
-
inlays: e.array(s).refine(
|
|
33
|
+
inlays: e.array(s).refine(n("name"), { message: "Not unique key: name" }).meta({
|
|
34
34
|
description: "The inlays of the message. It is not intended to be exported as public."
|
|
35
|
-
})
|
|
35
|
+
}).default([])
|
|
36
36
|
}).meta({ description: "Represents a single message in a chat history." });
|
|
37
37
|
export {
|
|
38
38
|
c as MessageSchema,
|
|
39
|
-
|
|
39
|
+
a as RoleSchema
|
|
40
40
|
};
|
|
41
41
|
//# sourceMappingURL=Message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","sources":["../../../src/types/v0/Character/Message.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AssetEntitySchema } from \"@/types/v0/Character/Assets\";\nimport {
|
|
1
|
+
{"version":3,"file":"Message.js","sources":["../../../src/types/v0/Character/Message.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AssetEntitySchema } from \"@/types/v0/Character/Assets\";\nimport { FileSchema, unique } 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(\"text\").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: FileSchema.meta({ description: \"The file content.\" }),\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 chatId: z.string().meta({\n description: \"The ID of the chat associated with this message.\",\n }),\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 inlays: z\n .array(AssetEntitySchema)\n .refine(unique(\"name\"), { message: \"Not unique key: name\" })\n .meta({\n description:\n \"The inlays of the message. It is not intended to be exported as public.\",\n })\n .default([]),\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","FileSchema","MessageSchema","AssetEntitySchema","unique"],"mappings":";;;AAOO,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,MAAM,EAAE,KAAK;AAAA,MACzB,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,EAAW,KAAK,EAAE,aAAa,qBAAqB;AAAA,IAC1D,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,QAAQA,EAAE,OAAA,EAAS,KAAK;AAAA,IACpB,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,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;AAAA,EACD,QAAQA,EACH,MAAMI,CAAiB,EACvB,OAAOC,EAAO,MAAM,GAAG,EAAE,SAAS,uBAAA,CAAwB,EAC1D,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP,EACA,QAAQ,CAAA,CAAE;AACnB,CAAC,EACA,KAAK,EAAE,aAAa,kDAAkD;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Auto-generated TypeScript declarations from Zod schemas. DO NOT EDIT.
|
|
2
|
+
// Regenerate with: pnpm generate-types
|
|
3
|
+
|
|
4
|
+
import type { ZodType } from "zod";
|
|
5
|
+
|
|
6
|
+
export type Meta = {
|
|
7
|
+
/** The author of the character. Optional. */
|
|
8
|
+
author?: string | undefined;
|
|
9
|
+
/** 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. */
|
|
10
|
+
license: string;
|
|
11
|
+
/** The version of the character. Optional. */
|
|
12
|
+
version?: string | undefined;
|
|
13
|
+
/** The distributed page of the character.URL is recommended. Optional. */
|
|
14
|
+
distributedOn?: string | undefined;
|
|
15
|
+
/** Additional information about the character, which can't be represented by other fields. Optional. */
|
|
16
|
+
additionalInfo?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export declare const MetaSchema: ZodType<Meta>;
|
package/dist/v0/Character.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
// Auto-generated barrel export
|
|
2
|
-
export * from "./Character/
|
|
3
|
-
export * from "./Character/Character";
|
|
4
|
-
export * from "./Character/Chat";
|
|
5
|
-
export * from "./Character/Lorebook";
|
|
6
|
-
export * from "./Character/Message";
|
|
1
|
+
// Auto-generated barrel export. DO NOT EDIT.
|
|
2
|
+
export * from "./Character/index";
|
package/dist/v0/Character.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { AssetEntitySchema as a, AssetsSettingSchema as t } from "./Character/Assets.js";
|
|
2
2
|
import { CharacterPromptDataSchema as m, CharacterSchema as h } from "./Character/Character.js";
|
|
3
3
|
import { ChatSchema as S } from "./Character/Chat.js";
|
|
4
|
-
import {
|
|
4
|
+
import { LorebookConditionDetails as i, LorebookConditionSchema as n, LorebookDataSchema as p, LorebookEntrySchema as f } from "./Character/Lorebook.js";
|
|
5
5
|
import { MessageSchema as C, RoleSchema as b } from "./Character/Message.js";
|
|
6
|
+
import { MetaSchema as L } from "./Character/Meta.js";
|
|
6
7
|
export {
|
|
7
8
|
a as AssetEntitySchema,
|
|
8
9
|
t as AssetsSettingSchema,
|
|
9
10
|
m as CharacterPromptDataSchema,
|
|
10
11
|
h as CharacterSchema,
|
|
11
12
|
S as ChatSchema,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
i as LorebookConditionDetails,
|
|
14
|
+
n as LorebookConditionSchema,
|
|
14
15
|
p as LorebookDataSchema,
|
|
15
16
|
f as LorebookEntrySchema,
|
|
16
17
|
C as MessageSchema,
|
|
18
|
+
L as MetaSchema,
|
|
17
19
|
b as RoleSchema
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=Character.js.map
|
package/dist/v0/Character.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Character.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Character.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
// Auto-generated TypeScript
|
|
2
|
-
//
|
|
3
|
-
import type { z } from "zod";
|
|
1
|
+
// Auto-generated TypeScript declarations from Zod schemas. DO NOT EDIT.
|
|
2
|
+
// Regenerate with: pnpm generate-types
|
|
4
3
|
|
|
4
|
+
import type { ZodType } from "zod";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Script settings for character. Includes hooks and script settings.
|
|
8
|
+
*/
|
|
5
9
|
export type ScriptSetting = {
|
|
6
10
|
/** Runtime settings for the script. Controls runtime environment. All values capped at user's configuration. */
|
|
7
11
|
runtimeSetting: {
|
|
8
12
|
/** The maximum memory usage of the script, in MB. Not an exact limit. May be exceeded or ignored. */
|
|
9
13
|
mem?: number | undefined;
|
|
14
|
+
/** The maximum execution time of the script, in seconds. Not an exact limit. May be exceeded or ignored. It is used per call, not a total limit. Default is 3 seconds. */
|
|
15
|
+
timeout: number;
|
|
10
16
|
};
|
|
11
17
|
/** Replace hooks for the script. */
|
|
12
18
|
replaceHooks: {
|
|
13
|
-
/** Replace hooks for display. Doesn't edit the data, only changes the display. */
|
|
14
19
|
display: {
|
|
15
20
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
16
21
|
input: string;
|
|
@@ -36,7 +41,6 @@ export type ScriptSetting = {
|
|
|
36
41
|
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
37
42
|
output: string;
|
|
38
43
|
}[];
|
|
39
|
-
/** Replace hooks for input. User chat input will be edited by this. */
|
|
40
44
|
input: {
|
|
41
45
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
42
46
|
input: string;
|
|
@@ -62,7 +66,6 @@ export type ScriptSetting = {
|
|
|
62
66
|
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
63
67
|
output: string;
|
|
64
68
|
}[];
|
|
65
|
-
/** Replace hooks for output. Character response will be edited by this. */
|
|
66
69
|
output: {
|
|
67
70
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
68
71
|
input: string;
|
|
@@ -88,7 +91,6 @@ export type ScriptSetting = {
|
|
|
88
91
|
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
89
92
|
output: string;
|
|
90
93
|
}[];
|
|
91
|
-
/** 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. */
|
|
92
94
|
request: {
|
|
93
95
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
94
96
|
input: string;
|
|
@@ -117,4 +119,7 @@ export type ScriptSetting = {
|
|
|
117
119
|
};
|
|
118
120
|
};
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Script settings for character. Includes hooks and script settings.
|
|
124
|
+
*/
|
|
125
|
+
export declare const ScriptSettingSchema: ZodType<ScriptSetting>;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
import { ReplaceHookSchema as
|
|
3
|
-
import { positiveInteger as
|
|
4
|
-
const
|
|
2
|
+
import { ReplaceHookSchema as i } from "./ReplaceHook.js";
|
|
3
|
+
import { positiveInteger as t } from "../utils.js";
|
|
4
|
+
const n = e.object({
|
|
5
5
|
runtimeSetting: e.object({
|
|
6
|
-
mem:
|
|
6
|
+
mem: t.optional().meta({
|
|
7
7
|
description: "The maximum memory usage of the script, in MB. Not an exact limit. May be exceeded or ignored."
|
|
8
|
+
}),
|
|
9
|
+
timeout: t.default(3).meta({
|
|
10
|
+
description: "The maximum execution time of the script, in seconds. Not an exact limit. May be exceeded or ignored. It is used per call, not a total limit. Default is 3 seconds."
|
|
8
11
|
})
|
|
9
|
-
}).meta({
|
|
12
|
+
}).prefault({}).meta({
|
|
10
13
|
description: "Runtime settings for the script. Controls runtime environment. All values capped at user's configuration."
|
|
11
14
|
}),
|
|
12
|
-
replaceHooks:
|
|
15
|
+
replaceHooks: i.meta({
|
|
13
16
|
description: "Replace hooks for the script."
|
|
14
17
|
})
|
|
15
|
-
}).meta({
|
|
18
|
+
}).prefault({}).meta({
|
|
16
19
|
description: "Script settings for character. Includes hooks and script settings."
|
|
17
20
|
});
|
|
18
21
|
export {
|
|
19
|
-
|
|
22
|
+
n as ScriptSettingSchema
|
|
20
23
|
};
|
|
21
24
|
//# sourceMappingURL=Executable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Executable.js","sources":["../../../src/types/v0/Executables/Executable.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ReplaceHookSchema } from \"@/types/v0/Executables/ReplaceHook\";\nimport { positiveInteger } from \"@/types/v0/utils\";\n\n/**\n * This is the script for character. It includes hook, script settings, something else.\n */\nexport const ScriptSettingSchema = z\n .object({\n runtimeSetting: z\n .object({\n mem: positiveInteger.optional().meta({\n description:\n \"The maximum memory usage of the script, in MB. Not an exact limit. May be exceeded or ignored.\",\n }),\n })\n .meta({\n description:\n \"Runtime settings for the script. Controls runtime environment. All values capped at user's configuration.\",\n }),\n replaceHooks: ReplaceHookSchema.meta({\n description: \"Replace hooks for the script.\",\n }),\n })\n .meta({\n description:\n \"Script settings for character. Includes hooks and script settings.\",\n });\n"],"names":["ScriptSettingSchema","z","positiveInteger","ReplaceHookSchema"],"mappings":";;;AAOO,MAAMA,IAAsBC,EAC9B,OAAO;AAAA,EACJ,gBAAgBA,EACX,OAAO;AAAA,IACJ,KAAKC,EAAgB,SAAA,EAAW,KAAK;AAAA,MACjC,aACI;AAAA,IAAA,CACP;AAAA,EAAA,CACJ,EACA,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP;AAAA,EACL,cAAcC,EAAkB,KAAK;AAAA,IACjC,aAAa;AAAA,EAAA,CAChB;AACL,CAAC,EACA,KAAK;AAAA,EACF,aACI;AACR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Executable.js","sources":["../../../src/types/v0/Executables/Executable.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ReplaceHookSchema } from \"@/types/v0/Executables/ReplaceHook\";\nimport { positiveInteger } from \"@/types/v0/utils\";\n\n/**\n * This is the script for character. It includes hook, script settings, something else.\n */\nexport const ScriptSettingSchema = z\n .object({\n runtimeSetting: z\n .object({\n mem: positiveInteger.optional().meta({\n description:\n \"The maximum memory usage of the script, in MB. Not an exact limit. May be exceeded or ignored.\",\n }),\n timeout: positiveInteger.default(3).meta({\n description:\n \"The maximum execution time of the script, in seconds. Not an exact limit. May be exceeded or ignored. \" +\n \"It is used per call, not a total limit. Default is 3 seconds.\",\n }),\n })\n .prefault({})\n .meta({\n description:\n \"Runtime settings for the script. Controls runtime environment. All values capped at user's configuration.\",\n }),\n replaceHooks: ReplaceHookSchema.meta({\n description: \"Replace hooks for the script.\",\n }),\n })\n .prefault({})\n .meta({\n description:\n \"Script settings for character. Includes hooks and script settings.\",\n });\n"],"names":["ScriptSettingSchema","z","positiveInteger","ReplaceHookSchema"],"mappings":";;;AAOO,MAAMA,IAAsBC,EAC9B,OAAO;AAAA,EACJ,gBAAgBA,EACX,OAAO;AAAA,IACJ,KAAKC,EAAgB,SAAA,EAAW,KAAK;AAAA,MACjC,aACI;AAAA,IAAA,CACP;AAAA,IACD,SAASA,EAAgB,QAAQ,CAAC,EAAE,KAAK;AAAA,MACrC,aACI;AAAA,IAAA,CAEP;AAAA,EAAA,CACJ,EACA,SAAS,EAAE,EACX,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP;AAAA,EACL,cAAcC,EAAkB,KAAK;AAAA,IACjC,aAAa;AAAA,EAAA,CAChB;AACL,CAAC,EACA,SAAS,EAAE,EACX,KAAK;AAAA,EACF,aACI;AACR,CAAC;"}
|
|
@@ -1,9 +1,67 @@
|
|
|
1
|
-
// Auto-generated TypeScript
|
|
2
|
-
//
|
|
3
|
-
import type { z } from "zod";
|
|
1
|
+
// Auto-generated TypeScript declarations from Zod schemas. DO NOT EDIT.
|
|
2
|
+
// Regenerate with: pnpm generate-types
|
|
4
3
|
|
|
4
|
+
import type { ZodType } from "zod";
|
|
5
|
+
|
|
6
|
+
export type ReplaceHookEntity = {
|
|
7
|
+
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
8
|
+
input: string;
|
|
9
|
+
/** The meta data for the replace hook. */
|
|
10
|
+
meta: ({
|
|
11
|
+
/** The input pattern is a RegExp. */
|
|
12
|
+
type: "regex";
|
|
13
|
+
/** The flag for RegExp. */
|
|
14
|
+
flag: string;
|
|
15
|
+
} | {
|
|
16
|
+
/** The input pattern is a simple string. */
|
|
17
|
+
type: "string";
|
|
18
|
+
/** If true, the input pattern is case sensitive. */
|
|
19
|
+
caseSensitive: boolean;
|
|
20
|
+
}) & {
|
|
21
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
22
|
+
isInputPatternScripted: boolean;
|
|
23
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
24
|
+
isOutputScripted: boolean;
|
|
25
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
26
|
+
priority: number;
|
|
27
|
+
};
|
|
28
|
+
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
29
|
+
output: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export declare const ReplaceHookEntitySchema: ZodType<ReplaceHookEntity>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The meta data for the replace hook.
|
|
36
|
+
*/
|
|
37
|
+
export type ReplaceHookMeta = ({
|
|
38
|
+
/** The input pattern is a RegExp. */
|
|
39
|
+
type: "regex";
|
|
40
|
+
/** The flag for RegExp. */
|
|
41
|
+
flag: string;
|
|
42
|
+
} | {
|
|
43
|
+
/** The input pattern is a simple string. */
|
|
44
|
+
type: "string";
|
|
45
|
+
/** If true, the input pattern is case sensitive. */
|
|
46
|
+
caseSensitive: boolean;
|
|
47
|
+
}) & {
|
|
48
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
49
|
+
isInputPatternScripted: boolean;
|
|
50
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
51
|
+
isOutputScripted: boolean;
|
|
52
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
53
|
+
priority: number;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The meta data for the replace hook.
|
|
58
|
+
*/
|
|
59
|
+
export declare const ReplaceHookMetaSchema: ZodType<ReplaceHookMeta>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Replace hooks. RegExp for request, display, and response.
|
|
63
|
+
*/
|
|
5
64
|
export type ReplaceHook = {
|
|
6
|
-
/** Replace hooks for display. Doesn't edit the data, only changes the display. */
|
|
7
65
|
display: {
|
|
8
66
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
9
67
|
input: string;
|
|
@@ -29,7 +87,6 @@ export type ReplaceHook = {
|
|
|
29
87
|
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
30
88
|
output: string;
|
|
31
89
|
}[];
|
|
32
|
-
/** Replace hooks for input. User chat input will be edited by this. */
|
|
33
90
|
input: {
|
|
34
91
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
35
92
|
input: string;
|
|
@@ -55,7 +112,6 @@ export type ReplaceHook = {
|
|
|
55
112
|
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
56
113
|
output: string;
|
|
57
114
|
}[];
|
|
58
|
-
/** Replace hooks for output. Character response will be edited by this. */
|
|
59
115
|
output: {
|
|
60
116
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
61
117
|
input: string;
|
|
@@ -81,7 +137,6 @@ export type ReplaceHook = {
|
|
|
81
137
|
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
82
138
|
output: string;
|
|
83
139
|
}[];
|
|
84
|
-
/** 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. */
|
|
85
140
|
request: {
|
|
86
141
|
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
87
142
|
input: string;
|
|
@@ -109,53 +164,7 @@ export type ReplaceHook = {
|
|
|
109
164
|
}[];
|
|
110
165
|
};
|
|
111
166
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
input: string;
|
|
117
|
-
/** The meta data for the replace hook. */
|
|
118
|
-
meta: ({
|
|
119
|
-
/** The input pattern is a RegExp. */
|
|
120
|
-
type: "regex";
|
|
121
|
-
/** The flag for RegExp. */
|
|
122
|
-
flag: string;
|
|
123
|
-
} | {
|
|
124
|
-
/** The input pattern is a simple string. */
|
|
125
|
-
type: "string";
|
|
126
|
-
/** If true, the input pattern is case sensitive. */
|
|
127
|
-
caseSensitive: boolean;
|
|
128
|
-
}) & {
|
|
129
|
-
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
130
|
-
isInputPatternScripted: boolean;
|
|
131
|
-
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
132
|
-
isOutputScripted: boolean;
|
|
133
|
-
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
134
|
-
priority: number;
|
|
135
|
-
};
|
|
136
|
-
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
137
|
-
output: string;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export declare const ReplaceHookEntitySchema: z.ZodType<ReplaceHookEntity>;
|
|
141
|
-
|
|
142
|
-
export type ReplaceHookMeta = ({
|
|
143
|
-
/** The input pattern is a RegExp. */
|
|
144
|
-
type: "regex";
|
|
145
|
-
/** The flag for RegExp. */
|
|
146
|
-
flag: string;
|
|
147
|
-
} | {
|
|
148
|
-
/** The input pattern is a simple string. */
|
|
149
|
-
type: "string";
|
|
150
|
-
/** If true, the input pattern is case sensitive. */
|
|
151
|
-
caseSensitive: boolean;
|
|
152
|
-
}) & {
|
|
153
|
-
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
154
|
-
isInputPatternScripted: boolean;
|
|
155
|
-
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
156
|
-
isOutputScripted: boolean;
|
|
157
|
-
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
158
|
-
priority: number;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export declare const ReplaceHookMetaSchema: z.ZodType<ReplaceHookMeta>;
|
|
167
|
+
/**
|
|
168
|
+
* Replace hooks. RegExp for request, display, and response.
|
|
169
|
+
*/
|
|
170
|
+
export declare const ReplaceHookSchema: ZodType<ReplaceHook>;
|
|
@@ -22,31 +22,31 @@ const i = [
|
|
|
22
22
|
priority: e.number().default(0).meta({
|
|
23
23
|
description: "The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional."
|
|
24
24
|
})
|
|
25
|
-
})
|
|
26
|
-
)
|
|
25
|
+
}).prefault({})
|
|
26
|
+
).meta({
|
|
27
|
+
description: "The meta data for the replace hook."
|
|
28
|
+
}), t = e.object({
|
|
27
29
|
input: e.string().meta({
|
|
28
30
|
description: "The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true."
|
|
29
31
|
}),
|
|
30
|
-
meta: a
|
|
31
|
-
description: "The meta data for the replace hook."
|
|
32
|
-
}),
|
|
32
|
+
meta: a,
|
|
33
33
|
output: e.string().meta({
|
|
34
34
|
description: "The output. May contain additional javascript expression if `isOutputScripted` is true."
|
|
35
35
|
})
|
|
36
36
|
}), o = e.object({
|
|
37
37
|
display: e.array(t).meta({
|
|
38
38
|
description: "Replace hooks for display. Doesn't edit the data, only changes the display."
|
|
39
|
-
}),
|
|
39
|
+
}).default([]),
|
|
40
40
|
input: e.array(t).meta({
|
|
41
41
|
description: "Replace hooks for input. User chat input will be edited by this."
|
|
42
|
-
}),
|
|
42
|
+
}).default([]),
|
|
43
43
|
output: e.array(t).meta({
|
|
44
44
|
description: "Replace hooks for output. Character response will be edited by this."
|
|
45
|
-
}),
|
|
45
|
+
}).default([]),
|
|
46
46
|
request: e.array(t).meta({
|
|
47
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({
|
|
48
|
+
}).default([])
|
|
49
|
+
}).prefault({}).meta({
|
|
50
50
|
description: "Replace hooks. RegExp for request, display, and response."
|
|
51
51
|
});
|
|
52
52
|
export {
|
|
@@ -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.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
|
|
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\n .intersection(\n z.discriminatedUnion(\"type\", ReplaceHookMetaType),\n z\n .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 .prefault({}),\n )\n .meta({\n description: \"The meta data for the replace hook.\",\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,\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\n .array(ReplaceHookEntitySchema)\n .meta({\n description:\n \"Replace hooks for display. Doesn't edit the data, only changes the display.\",\n })\n .default([]),\n input: z\n .array(ReplaceHookEntitySchema)\n .meta({\n description:\n \"Replace hooks for input. User chat input will be edited by this.\",\n })\n .default([]),\n output: z\n .array(ReplaceHookEntitySchema)\n .meta({\n description:\n \"Replace hooks for output. Character response will be edited by this.\",\n })\n .default([]),\n request: z\n .array(ReplaceHookEntitySchema)\n .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 .default([]),\n })\n .prefault({})\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,EAChC;AAAA,EACGA,EAAE,mBAAmB,QAAQD,CAAmB;AAAA,EAChDC,EACK,OAAO;AAAA,IACJ,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,EACA,SAAS,CAAA,CAAE;AACpB,EACC,KAAK;AAAA,EACF,aAAa;AACjB,CAAC,GAEQE,IAA0BF,EAAE,OAAO;AAAA,EAC5C,OAAOA,EAAE,OAAA,EAAS,KAAK;AAAA,IACnB,aACI;AAAA,EAAA,CACP;AAAA,EACD,MAAMC;AAAA,EACN,QAAQD,EAAE,OAAA,EAAS,KAAK;AAAA,IACpB,aACI;AAAA,EAAA,CACP;AACL,CAAC,GAKYG,IAAoBH,EAC5B,OAAO;AAAA,EACJ,SAASA,EACJ,MAAME,CAAuB,EAC7B,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP,EACA,QAAQ,EAAE;AAAA,EACf,OAAOF,EACF,MAAME,CAAuB,EAC7B,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP,EACA,QAAQ,EAAE;AAAA,EACf,QAAQF,EACH,MAAME,CAAuB,EAC7B,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP,EACA,QAAQ,EAAE;AAAA,EACf,SAASF,EACJ,MAAME,CAAuB,EAC7B,KAAK;AAAA,IACF,aACI;AAAA,EAAA,CACP,EACA,QAAQ,CAAA,CAAE;AACnB,CAAC,EACA,SAAS,EAAE,EACX,KAAK;AAAA,EACF,aACI;AACR,CAAC;"}
|
package/dist/v0/Executables.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
// Auto-generated barrel export
|
|
2
|
-
export * from "./Executables/
|
|
3
|
-
export * from "./Executables/ReplaceHook";
|
|
1
|
+
// Auto-generated barrel export. DO NOT EDIT.
|
|
2
|
+
export * from "./Executables/index";
|
package/dist/v0/index.d.ts
CHANGED
package/dist/v0/utils.d.ts
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
// Auto-generated TypeScript
|
|
2
|
-
//
|
|
3
|
-
import type { z } from "zod";
|
|
1
|
+
// Auto-generated TypeScript declarations from Zod schemas. DO NOT EDIT.
|
|
2
|
+
// Regenerate with: pnpm generate-types
|
|
4
3
|
|
|
4
|
+
import type { ZodType } from "zod";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a file, either as a URL or as binary data (Uint8Array).
|
|
8
|
+
* @type {string | Uint8Array}
|
|
9
|
+
*/
|
|
10
|
+
export type FileType = string | Uint8Array;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Represents a file, either as a URL or as binary data (Uint8Array).
|
|
14
|
+
* @type {string | Uint8Array}
|
|
15
|
+
*/
|
|
16
|
+
export declare const FileSchema: ZodType<FileType>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* URL of an image. `local:` for browser storage (OpFS), otherwise a fetchable URL. While it can be `data:` URL for base64 encoded images, it's not recommended.
|
|
20
|
+
*/
|
|
5
21
|
export type ImageURL = string;
|
|
6
22
|
|
|
7
|
-
|
|
23
|
+
/**
|
|
24
|
+
* URL of an image. `local:` for browser storage (OpFS), otherwise a fetchable URL. While it can be `data:` URL for base64 encoded images, it's not recommended.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ImageURLSchema: ZodType<ImageURL>;
|
|
8
27
|
|
|
9
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The binary data of the file. Used for local assets.
|
|
30
|
+
*/
|
|
31
|
+
export type Uint8ArrayType = Uint8Array;
|
|
10
32
|
|
|
11
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The binary data of the file. Used for local assets.
|
|
35
|
+
*/
|
|
36
|
+
export declare const Uint8ArraySchema: ZodType<Uint8ArrayType>;
|
package/dist/v0/utils.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
const i =
|
|
3
|
-
description: "URL of an image. `
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
const i = e.url().meta({
|
|
3
|
+
description: "URL of an image. `local:` for browser storage (OpFS), otherwise a fetchable URL. While it can be `data:` URL for base64 encoded images, it's not recommended."
|
|
4
|
+
}), r = e.instanceof(Uint8Array).meta({
|
|
5
|
+
description: "The binary data of the file. Used for local assets.",
|
|
6
|
+
tsType: "Uint8Array"
|
|
7
|
+
}), s = e.union([
|
|
8
|
+
// URL Asset
|
|
9
|
+
i,
|
|
10
|
+
r
|
|
11
|
+
]).meta({
|
|
12
|
+
description: `Represents a file, either as a URL or as binary data (Uint8Array).
|
|
13
|
+
@type {string | Uint8Array}
|
|
14
|
+
`
|
|
4
15
|
});
|
|
5
|
-
function
|
|
6
|
-
return (
|
|
16
|
+
function c(n) {
|
|
17
|
+
return (t) => new Set(t.map((a) => a[n])).size === t.length;
|
|
7
18
|
}
|
|
8
|
-
const
|
|
19
|
+
const m = e.int().min(1).meta({ description: "Positive integer (>= 1)" });
|
|
9
20
|
export {
|
|
21
|
+
s as FileSchema,
|
|
10
22
|
i as ImageURLSchema,
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
r as Uint8ArraySchema,
|
|
24
|
+
m as positiveInteger,
|
|
25
|
+
c as unique
|
|
13
26
|
};
|
|
14
27
|
//# sourceMappingURL=utils.js.map
|