@changw98ic/core 1.0.0
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/LICENSE +674 -0
- package/README.md +28 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/types/adapter.d.ts +220 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/adapter.js +72 -0
- package/dist/types/adapter.js.map +1 -0
- package/dist/types/entity.d.ts +327 -0
- package/dist/types/entity.d.ts.map +1 -0
- package/dist/types/entity.js +135 -0
- package/dist/types/entity.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/skill.d.ts +676 -0
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/skill.js +128 -0
- package/dist/types/skill.js.map +1 -0
- package/dist/types/state.d.ts +786 -0
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/state.js +136 -0
- package/dist/types/state.js.map +1 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @changw98ic/core
|
|
2
|
+
|
|
3
|
+
核心类型和 Skill 定义 - 通用网文创作框架。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @changw98ic/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Skill, SkillContext, SkillResult } from '@changw98ic/core';
|
|
15
|
+
import { ProjectState, Entity, EntityType } from '@changw98ic/core/types';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 文档
|
|
19
|
+
|
|
20
|
+
详见 [项目主页](https://github.com/changw98ic/webnovel-writer-skill#readme)
|
|
21
|
+
|
|
22
|
+
## 致谢
|
|
23
|
+
|
|
24
|
+
本项目基于 [lingfengQAQ/webnovel-writer-skill](https://github.com/lingfengQAQ/webnovel-writer-skill) 开发。
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @changw98ic/core
|
|
3
|
+
*
|
|
4
|
+
* 通用网文创作 Skill 框架 - 核心模块
|
|
5
|
+
*/
|
|
6
|
+
// Types
|
|
7
|
+
export * from './types/index.js';
|
|
8
|
+
// Skill Loader (will be implemented)
|
|
9
|
+
// export { SkillLoader } from './skill-loader/index.js';
|
|
10
|
+
// Context Manager (will be implemented)
|
|
11
|
+
// export { ContextManager } from './context/index.js';
|
|
12
|
+
// Workflow Engine (will be implemented)
|
|
13
|
+
// export { WorkflowEngine } from './workflow/index.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAQ;AACR,cAAc,kBAAkB,CAAC;AAEjC,qCAAqC;AACrC,yDAAyD;AAEzD,wCAAwC;AACxC,uDAAuD;AAEvD,wCAAwC;AACxC,wDAAwD"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter Types - 平台适配器类型定义
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const ClaudeCodeSkillMetaSchema: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
description: z.ZodString;
|
|
8
|
+
allowedTools: z.ZodArray<z.ZodString, "many">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
allowedTools: string[];
|
|
13
|
+
}, {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
allowedTools: string[];
|
|
17
|
+
}>;
|
|
18
|
+
export type ClaudeCodeSkillMeta = z.infer<typeof ClaudeCodeSkillMetaSchema>;
|
|
19
|
+
export declare const OpenAIFunctionSchema: z.ZodObject<{
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
description: z.ZodString;
|
|
22
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
parameters: Record<string, unknown>;
|
|
27
|
+
}, {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
parameters: Record<string, unknown>;
|
|
31
|
+
}>;
|
|
32
|
+
export type OpenAIFunction = z.infer<typeof OpenAIFunctionSchema>;
|
|
33
|
+
export declare const OpenAIToolSchema: z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"function">;
|
|
35
|
+
function: z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
description: z.ZodString;
|
|
38
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
parameters: Record<string, unknown>;
|
|
43
|
+
}, {
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
parameters: Record<string, unknown>;
|
|
47
|
+
}>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
function: {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
parameters: Record<string, unknown>;
|
|
53
|
+
};
|
|
54
|
+
type: "function";
|
|
55
|
+
}, {
|
|
56
|
+
function: {
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
parameters: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
type: "function";
|
|
62
|
+
}>;
|
|
63
|
+
export type OpenAITool = z.infer<typeof OpenAIToolSchema>;
|
|
64
|
+
export declare const CursorRulesConfigSchema: z.ZodObject<{
|
|
65
|
+
projectName: z.ZodString;
|
|
66
|
+
triggers: z.ZodArray<z.ZodString, "many">;
|
|
67
|
+
rules: z.ZodArray<z.ZodString, "many">;
|
|
68
|
+
tools: z.ZodArray<z.ZodObject<{
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
description: z.ZodString;
|
|
71
|
+
usage: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
name: string;
|
|
74
|
+
description: string;
|
|
75
|
+
usage?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
usage?: string | undefined;
|
|
80
|
+
}>, "many">;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
tools: {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
usage?: string | undefined;
|
|
86
|
+
}[];
|
|
87
|
+
triggers: string[];
|
|
88
|
+
projectName: string;
|
|
89
|
+
rules: string[];
|
|
90
|
+
}, {
|
|
91
|
+
tools: {
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
usage?: string | undefined;
|
|
95
|
+
}[];
|
|
96
|
+
triggers: string[];
|
|
97
|
+
projectName: string;
|
|
98
|
+
rules: string[];
|
|
99
|
+
}>;
|
|
100
|
+
export type CursorRulesConfig = z.infer<typeof CursorRulesConfigSchema>;
|
|
101
|
+
export declare const OpenClawToolSchema: z.ZodObject<{
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
type: z.ZodEnum<["read", "write", "bash", "http", "custom"]>;
|
|
104
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
type: "read" | "write" | "bash" | "http" | "custom";
|
|
107
|
+
name: string;
|
|
108
|
+
config: Record<string, unknown>;
|
|
109
|
+
}, {
|
|
110
|
+
type: "read" | "write" | "bash" | "http" | "custom";
|
|
111
|
+
name: string;
|
|
112
|
+
config: Record<string, unknown>;
|
|
113
|
+
}>;
|
|
114
|
+
export type OpenClawTool = z.infer<typeof OpenClawToolSchema>;
|
|
115
|
+
export declare const OpenClawSkillSchema: z.ZodObject<{
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
version: z.ZodString;
|
|
118
|
+
description: z.ZodString;
|
|
119
|
+
triggers: z.ZodArray<z.ZodString, "many">;
|
|
120
|
+
tools: z.ZodArray<z.ZodObject<{
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
type: z.ZodEnum<["read", "write", "bash", "http", "custom"]>;
|
|
123
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
type: "read" | "write" | "bash" | "http" | "custom";
|
|
126
|
+
name: string;
|
|
127
|
+
config: Record<string, unknown>;
|
|
128
|
+
}, {
|
|
129
|
+
type: "read" | "write" | "bash" | "http" | "custom";
|
|
130
|
+
name: string;
|
|
131
|
+
config: Record<string, unknown>;
|
|
132
|
+
}>, "many">;
|
|
133
|
+
prompts: z.ZodArray<z.ZodObject<{
|
|
134
|
+
role: z.ZodString;
|
|
135
|
+
content: z.ZodString;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
role: string;
|
|
138
|
+
content: string;
|
|
139
|
+
}, {
|
|
140
|
+
role: string;
|
|
141
|
+
content: string;
|
|
142
|
+
}>, "many">;
|
|
143
|
+
workflow: z.ZodArray<z.ZodObject<{
|
|
144
|
+
step: z.ZodString;
|
|
145
|
+
action: z.ZodString;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
step: string;
|
|
148
|
+
action: string;
|
|
149
|
+
}, {
|
|
150
|
+
step: string;
|
|
151
|
+
action: string;
|
|
152
|
+
}>, "many">;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
name: string;
|
|
155
|
+
description: string;
|
|
156
|
+
tools: {
|
|
157
|
+
type: "read" | "write" | "bash" | "http" | "custom";
|
|
158
|
+
name: string;
|
|
159
|
+
config: Record<string, unknown>;
|
|
160
|
+
}[];
|
|
161
|
+
version: string;
|
|
162
|
+
triggers: string[];
|
|
163
|
+
prompts: {
|
|
164
|
+
role: string;
|
|
165
|
+
content: string;
|
|
166
|
+
}[];
|
|
167
|
+
workflow: {
|
|
168
|
+
step: string;
|
|
169
|
+
action: string;
|
|
170
|
+
}[];
|
|
171
|
+
}, {
|
|
172
|
+
name: string;
|
|
173
|
+
description: string;
|
|
174
|
+
tools: {
|
|
175
|
+
type: "read" | "write" | "bash" | "http" | "custom";
|
|
176
|
+
name: string;
|
|
177
|
+
config: Record<string, unknown>;
|
|
178
|
+
}[];
|
|
179
|
+
version: string;
|
|
180
|
+
triggers: string[];
|
|
181
|
+
prompts: {
|
|
182
|
+
role: string;
|
|
183
|
+
content: string;
|
|
184
|
+
}[];
|
|
185
|
+
workflow: {
|
|
186
|
+
step: string;
|
|
187
|
+
action: string;
|
|
188
|
+
}[];
|
|
189
|
+
}>;
|
|
190
|
+
export type OpenClawSkill = z.infer<typeof OpenClawSkillSchema>;
|
|
191
|
+
export declare const AdapterOutputSchema: z.ZodObject<{
|
|
192
|
+
platform: z.ZodEnum<["claude-code", "openai", "cursor", "openclaw"]>;
|
|
193
|
+
files: z.ZodArray<z.ZodObject<{
|
|
194
|
+
path: z.ZodString;
|
|
195
|
+
content: z.ZodString;
|
|
196
|
+
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
path: string;
|
|
198
|
+
content: string;
|
|
199
|
+
}, {
|
|
200
|
+
path: string;
|
|
201
|
+
content: string;
|
|
202
|
+
}>, "many">;
|
|
203
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
platform: "claude-code" | "openai" | "cursor" | "openclaw";
|
|
206
|
+
files: {
|
|
207
|
+
path: string;
|
|
208
|
+
content: string;
|
|
209
|
+
}[];
|
|
210
|
+
metadata?: Record<string, unknown> | undefined;
|
|
211
|
+
}, {
|
|
212
|
+
platform: "claude-code" | "openai" | "cursor" | "openclaw";
|
|
213
|
+
files: {
|
|
214
|
+
path: string;
|
|
215
|
+
content: string;
|
|
216
|
+
}[];
|
|
217
|
+
metadata?: Record<string, unknown> | undefined;
|
|
218
|
+
}>;
|
|
219
|
+
export type AdapterOutput = z.infer<typeof AdapterOutputSchema>;
|
|
220
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/types/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAIpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAMxE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAMhE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter Types - 平台适配器类型定义
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Claude Code Adapter
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export const ClaudeCodeSkillMetaSchema = z.object({
|
|
9
|
+
name: z.string(),
|
|
10
|
+
description: z.string(),
|
|
11
|
+
allowedTools: z.array(z.string()),
|
|
12
|
+
});
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// OpenAI Adapter
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const OpenAIFunctionSchema = z.object({
|
|
17
|
+
name: z.string(),
|
|
18
|
+
description: z.string(),
|
|
19
|
+
parameters: z.record(z.unknown()), // JSON Schema
|
|
20
|
+
});
|
|
21
|
+
export const OpenAIToolSchema = z.object({
|
|
22
|
+
type: z.literal('function'),
|
|
23
|
+
function: OpenAIFunctionSchema,
|
|
24
|
+
});
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Cursor Adapter
|
|
27
|
+
// ============================================================================
|
|
28
|
+
export const CursorRulesConfigSchema = z.object({
|
|
29
|
+
projectName: z.string(),
|
|
30
|
+
triggers: z.array(z.string()),
|
|
31
|
+
rules: z.array(z.string()),
|
|
32
|
+
tools: z.array(z.object({
|
|
33
|
+
name: z.string(),
|
|
34
|
+
description: z.string(),
|
|
35
|
+
usage: z.string().optional(),
|
|
36
|
+
})),
|
|
37
|
+
});
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// OpenClaw Adapter
|
|
40
|
+
// ============================================================================
|
|
41
|
+
export const OpenClawToolSchema = z.object({
|
|
42
|
+
name: z.string(),
|
|
43
|
+
type: z.enum(['read', 'write', 'bash', 'http', 'custom']),
|
|
44
|
+
config: z.record(z.unknown()),
|
|
45
|
+
});
|
|
46
|
+
export const OpenClawSkillSchema = z.object({
|
|
47
|
+
name: z.string(),
|
|
48
|
+
version: z.string(),
|
|
49
|
+
description: z.string(),
|
|
50
|
+
triggers: z.array(z.string()),
|
|
51
|
+
tools: z.array(OpenClawToolSchema),
|
|
52
|
+
prompts: z.array(z.object({
|
|
53
|
+
role: z.string(),
|
|
54
|
+
content: z.string(),
|
|
55
|
+
})),
|
|
56
|
+
workflow: z.array(z.object({
|
|
57
|
+
step: z.string(),
|
|
58
|
+
action: z.string(),
|
|
59
|
+
})),
|
|
60
|
+
});
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// Adapter Output
|
|
63
|
+
// ============================================================================
|
|
64
|
+
export const AdapterOutputSchema = z.object({
|
|
65
|
+
platform: z.enum(['claude-code', 'openai', 'cursor', 'openclaw']),
|
|
66
|
+
files: z.array(z.object({
|
|
67
|
+
path: z.string(),
|
|
68
|
+
content: z.string(),
|
|
69
|
+
})),
|
|
70
|
+
metadata: z.record(z.unknown()).optional(),
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/types/adapter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CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACjE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC,CAAC;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity Types - 实体类型定义
|
|
3
|
+
*
|
|
4
|
+
* 与 Python 版本保持兼容,用于:
|
|
5
|
+
* - index.db 的 entities 表
|
|
6
|
+
* - state.json 的实体状态
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
export declare const EntityTypeSchema: z.ZodEnum<["角色", "地点", "物品", "势力", "招式", "事件", "概念"]>;
|
|
10
|
+
export type EntityType = z.infer<typeof EntityTypeSchema>;
|
|
11
|
+
export declare const EntityTierSchema: z.ZodEnum<["核心", "重要", "次要", "装饰"]>;
|
|
12
|
+
export type EntityTier = z.infer<typeof EntityTierSchema>;
|
|
13
|
+
export declare const EntitySchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
type: z.ZodEnum<["角色", "地点", "物品", "势力", "招式", "事件", "概念"]>;
|
|
16
|
+
canonical_name: z.ZodString;
|
|
17
|
+
tier: z.ZodDefault<z.ZodEnum<["核心", "重要", "次要", "装饰"]>>;
|
|
18
|
+
current: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
19
|
+
first_appearance: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
last_appearance: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
is_protagonist: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
is_archived: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
desc: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
26
|
+
id: string;
|
|
27
|
+
canonical_name: string;
|
|
28
|
+
tier: "核心" | "重要" | "次要" | "装饰";
|
|
29
|
+
current: Record<string, unknown>;
|
|
30
|
+
first_appearance: number;
|
|
31
|
+
last_appearance: number;
|
|
32
|
+
is_protagonist: boolean;
|
|
33
|
+
is_archived: boolean;
|
|
34
|
+
desc?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
37
|
+
id: string;
|
|
38
|
+
canonical_name: string;
|
|
39
|
+
tier?: "核心" | "重要" | "次要" | "装饰" | undefined;
|
|
40
|
+
current?: Record<string, unknown> | undefined;
|
|
41
|
+
first_appearance?: number | undefined;
|
|
42
|
+
last_appearance?: number | undefined;
|
|
43
|
+
is_protagonist?: boolean | undefined;
|
|
44
|
+
is_archived?: boolean | undefined;
|
|
45
|
+
desc?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export type Entity = z.infer<typeof EntitySchema>;
|
|
48
|
+
export declare const AliasSchema: z.ZodObject<{
|
|
49
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
alias: z.ZodString;
|
|
51
|
+
entity_id: z.ZodString;
|
|
52
|
+
entity_type: z.ZodEnum<["角色", "地点", "物品", "势力", "招式", "事件", "概念"]>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
alias: string;
|
|
55
|
+
entity_id: string;
|
|
56
|
+
entity_type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
57
|
+
id?: number | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
alias: string;
|
|
60
|
+
entity_id: string;
|
|
61
|
+
entity_type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
62
|
+
id?: number | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
export type Alias = z.infer<typeof AliasSchema>;
|
|
65
|
+
export declare const StateChangeSchema: z.ZodObject<{
|
|
66
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
entity_id: z.ZodString;
|
|
68
|
+
field: z.ZodString;
|
|
69
|
+
old_value: z.ZodNullable<z.ZodString>;
|
|
70
|
+
new_value: z.ZodNullable<z.ZodString>;
|
|
71
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
72
|
+
chapter: z.ZodNumber;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
entity_id: string;
|
|
75
|
+
field: string;
|
|
76
|
+
old_value: string | null;
|
|
77
|
+
new_value: string | null;
|
|
78
|
+
chapter: number;
|
|
79
|
+
id?: number | undefined;
|
|
80
|
+
reason?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
entity_id: string;
|
|
83
|
+
field: string;
|
|
84
|
+
old_value: string | null;
|
|
85
|
+
new_value: string | null;
|
|
86
|
+
chapter: number;
|
|
87
|
+
id?: number | undefined;
|
|
88
|
+
reason?: string | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
export type StateChange = z.infer<typeof StateChangeSchema>;
|
|
91
|
+
export declare const RelationshipSchema: z.ZodObject<{
|
|
92
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
from_entity: z.ZodString;
|
|
94
|
+
to_entity: z.ZodString;
|
|
95
|
+
type: z.ZodString;
|
|
96
|
+
description: z.ZodOptional<z.ZodString>;
|
|
97
|
+
chapter: z.ZodNumber;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
type: string;
|
|
100
|
+
chapter: number;
|
|
101
|
+
from_entity: string;
|
|
102
|
+
to_entity: string;
|
|
103
|
+
description?: string | undefined;
|
|
104
|
+
id?: number | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
type: string;
|
|
107
|
+
chapter: number;
|
|
108
|
+
from_entity: string;
|
|
109
|
+
to_entity: string;
|
|
110
|
+
description?: string | undefined;
|
|
111
|
+
id?: number | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
export type Relationship = z.infer<typeof RelationshipSchema>;
|
|
114
|
+
export declare const RelationshipEventSchema: z.ZodObject<{
|
|
115
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
from_entity: z.ZodString;
|
|
117
|
+
to_entity: z.ZodString;
|
|
118
|
+
type: z.ZodString;
|
|
119
|
+
chapter: z.ZodNumber;
|
|
120
|
+
action: z.ZodDefault<z.ZodEnum<["create", "update", "decay", "remove"]>>;
|
|
121
|
+
polarity: z.ZodDefault<z.ZodNumber>;
|
|
122
|
+
strength: z.ZodDefault<z.ZodNumber>;
|
|
123
|
+
description: z.ZodOptional<z.ZodString>;
|
|
124
|
+
scene_index: z.ZodDefault<z.ZodNumber>;
|
|
125
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
126
|
+
confidence: z.ZodDefault<z.ZodNumber>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
type: string;
|
|
129
|
+
action: "create" | "update" | "decay" | "remove";
|
|
130
|
+
chapter: number;
|
|
131
|
+
from_entity: string;
|
|
132
|
+
to_entity: string;
|
|
133
|
+
polarity: number;
|
|
134
|
+
strength: number;
|
|
135
|
+
scene_index: number;
|
|
136
|
+
confidence: number;
|
|
137
|
+
description?: string | undefined;
|
|
138
|
+
id?: number | undefined;
|
|
139
|
+
evidence?: string | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
type: string;
|
|
142
|
+
chapter: number;
|
|
143
|
+
from_entity: string;
|
|
144
|
+
to_entity: string;
|
|
145
|
+
description?: string | undefined;
|
|
146
|
+
action?: "create" | "update" | "decay" | "remove" | undefined;
|
|
147
|
+
id?: number | undefined;
|
|
148
|
+
polarity?: number | undefined;
|
|
149
|
+
strength?: number | undefined;
|
|
150
|
+
scene_index?: number | undefined;
|
|
151
|
+
evidence?: string | undefined;
|
|
152
|
+
confidence?: number | undefined;
|
|
153
|
+
}>;
|
|
154
|
+
export type RelationshipEvent = z.infer<typeof RelationshipEventSchema>;
|
|
155
|
+
export declare const EntityExtractResultSchema: z.ZodObject<{
|
|
156
|
+
entities_appeared: z.ZodArray<z.ZodObject<{
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
type: z.ZodEnum<["角色", "地点", "物品", "势力", "招式", "事件", "概念"]>;
|
|
159
|
+
mentions: z.ZodArray<z.ZodString, "many">;
|
|
160
|
+
confidence: z.ZodNumber;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
163
|
+
id: string;
|
|
164
|
+
confidence: number;
|
|
165
|
+
mentions: string[];
|
|
166
|
+
}, {
|
|
167
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
168
|
+
id: string;
|
|
169
|
+
confidence: number;
|
|
170
|
+
mentions: string[];
|
|
171
|
+
}>, "many">;
|
|
172
|
+
entities_new: z.ZodArray<z.ZodObject<{
|
|
173
|
+
suggested_id: z.ZodString;
|
|
174
|
+
name: z.ZodString;
|
|
175
|
+
type: z.ZodEnum<["角色", "地点", "物品", "势力", "招式", "事件", "概念"]>;
|
|
176
|
+
tier: z.ZodEnum<["核心", "重要", "次要", "装饰"]>;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
179
|
+
name: string;
|
|
180
|
+
tier: "核心" | "重要" | "次要" | "装饰";
|
|
181
|
+
suggested_id: string;
|
|
182
|
+
}, {
|
|
183
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
184
|
+
name: string;
|
|
185
|
+
tier: "核心" | "重要" | "次要" | "装饰";
|
|
186
|
+
suggested_id: string;
|
|
187
|
+
}>, "many">;
|
|
188
|
+
state_changes: z.ZodArray<z.ZodObject<{
|
|
189
|
+
entity_id: z.ZodString;
|
|
190
|
+
field: z.ZodString;
|
|
191
|
+
old: z.ZodString;
|
|
192
|
+
new: z.ZodString;
|
|
193
|
+
reason: z.ZodString;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
entity_id: string;
|
|
196
|
+
field: string;
|
|
197
|
+
reason: string;
|
|
198
|
+
old: string;
|
|
199
|
+
new: string;
|
|
200
|
+
}, {
|
|
201
|
+
entity_id: string;
|
|
202
|
+
field: string;
|
|
203
|
+
reason: string;
|
|
204
|
+
old: string;
|
|
205
|
+
new: string;
|
|
206
|
+
}>, "many">;
|
|
207
|
+
relationships_new: z.ZodArray<z.ZodObject<{
|
|
208
|
+
from: z.ZodString;
|
|
209
|
+
to: z.ZodString;
|
|
210
|
+
type: z.ZodString;
|
|
211
|
+
description: z.ZodString;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
type: string;
|
|
214
|
+
description: string;
|
|
215
|
+
from: string;
|
|
216
|
+
to: string;
|
|
217
|
+
}, {
|
|
218
|
+
type: string;
|
|
219
|
+
description: string;
|
|
220
|
+
from: string;
|
|
221
|
+
to: string;
|
|
222
|
+
}>, "many">;
|
|
223
|
+
scenes_chunked: z.ZodNumber;
|
|
224
|
+
uncertain: z.ZodArray<z.ZodObject<{
|
|
225
|
+
mention: z.ZodString;
|
|
226
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
227
|
+
type: z.ZodEnum<["角色", "地点", "物品", "势力", "招式", "事件", "概念"]>;
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
231
|
+
id: string;
|
|
232
|
+
}, {
|
|
233
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
234
|
+
id: string;
|
|
235
|
+
}>, "many">;
|
|
236
|
+
confidence: z.ZodNumber;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
confidence: number;
|
|
239
|
+
mention: string;
|
|
240
|
+
candidates: {
|
|
241
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
242
|
+
id: string;
|
|
243
|
+
}[];
|
|
244
|
+
}, {
|
|
245
|
+
confidence: number;
|
|
246
|
+
mention: string;
|
|
247
|
+
candidates: {
|
|
248
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
249
|
+
id: string;
|
|
250
|
+
}[];
|
|
251
|
+
}>, "many">;
|
|
252
|
+
warnings: z.ZodArray<z.ZodString, "many">;
|
|
253
|
+
}, "strip", z.ZodTypeAny, {
|
|
254
|
+
entities_appeared: {
|
|
255
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
256
|
+
id: string;
|
|
257
|
+
confidence: number;
|
|
258
|
+
mentions: string[];
|
|
259
|
+
}[];
|
|
260
|
+
entities_new: {
|
|
261
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
262
|
+
name: string;
|
|
263
|
+
tier: "核心" | "重要" | "次要" | "装饰";
|
|
264
|
+
suggested_id: string;
|
|
265
|
+
}[];
|
|
266
|
+
state_changes: {
|
|
267
|
+
entity_id: string;
|
|
268
|
+
field: string;
|
|
269
|
+
reason: string;
|
|
270
|
+
old: string;
|
|
271
|
+
new: string;
|
|
272
|
+
}[];
|
|
273
|
+
relationships_new: {
|
|
274
|
+
type: string;
|
|
275
|
+
description: string;
|
|
276
|
+
from: string;
|
|
277
|
+
to: string;
|
|
278
|
+
}[];
|
|
279
|
+
scenes_chunked: number;
|
|
280
|
+
uncertain: {
|
|
281
|
+
confidence: number;
|
|
282
|
+
mention: string;
|
|
283
|
+
candidates: {
|
|
284
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
285
|
+
id: string;
|
|
286
|
+
}[];
|
|
287
|
+
}[];
|
|
288
|
+
warnings: string[];
|
|
289
|
+
}, {
|
|
290
|
+
entities_appeared: {
|
|
291
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
292
|
+
id: string;
|
|
293
|
+
confidence: number;
|
|
294
|
+
mentions: string[];
|
|
295
|
+
}[];
|
|
296
|
+
entities_new: {
|
|
297
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
298
|
+
name: string;
|
|
299
|
+
tier: "核心" | "重要" | "次要" | "装饰";
|
|
300
|
+
suggested_id: string;
|
|
301
|
+
}[];
|
|
302
|
+
state_changes: {
|
|
303
|
+
entity_id: string;
|
|
304
|
+
field: string;
|
|
305
|
+
reason: string;
|
|
306
|
+
old: string;
|
|
307
|
+
new: string;
|
|
308
|
+
}[];
|
|
309
|
+
relationships_new: {
|
|
310
|
+
type: string;
|
|
311
|
+
description: string;
|
|
312
|
+
from: string;
|
|
313
|
+
to: string;
|
|
314
|
+
}[];
|
|
315
|
+
scenes_chunked: number;
|
|
316
|
+
uncertain: {
|
|
317
|
+
confidence: number;
|
|
318
|
+
mention: string;
|
|
319
|
+
candidates: {
|
|
320
|
+
type: "角色" | "地点" | "物品" | "势力" | "招式" | "事件" | "概念";
|
|
321
|
+
id: string;
|
|
322
|
+
}[];
|
|
323
|
+
}[];
|
|
324
|
+
warnings: string[];
|
|
325
|
+
}>;
|
|
326
|
+
export type EntityExtractResult = z.infer<typeof EntityExtractResultSchema>;
|
|
327
|
+
//# sourceMappingURL=entity.d.ts.map
|