mioku 0.9.1 → 0.9.3
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/cli/index.cjs +447 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.js +446 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.cjs +287 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +237 -314
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +237 -314
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +313 -342
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/cli.cjs +0 -467
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.js +0 -466
- package/dist/cli.js.map +0 -1
- /package/dist/{cli.d.cts → cli/index.d.cts} +0 -0
- /package/dist/{cli.d.ts → cli/index.d.ts} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,45 +1,8 @@
|
|
|
1
1
|
import * as mioki0 from "mioki";
|
|
2
2
|
import { MiokiContext, MiokiContext as MiokiContext$1, MiokiPlugin } from "mioki";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 指令权限级别
|
|
8
|
-
* 主人 管理员 群主 群成员
|
|
9
|
-
*/
|
|
10
|
-
type CommandRole$1 = "master" | "admin" | "owner" | "member";
|
|
11
|
-
/**
|
|
12
|
-
* 插件帮助信息
|
|
13
|
-
*/
|
|
14
|
-
interface PluginHelp$1 {
|
|
15
|
-
title: string;
|
|
16
|
-
description: string;
|
|
17
|
-
commands: Array<{
|
|
18
|
-
cmd: string;
|
|
19
|
-
desc: string;
|
|
20
|
-
usage?: string;
|
|
21
|
-
role?: CommandRole$1;
|
|
22
|
-
}>;
|
|
23
|
-
}
|
|
24
|
-
interface AccessHook$1 {
|
|
25
|
-
id: string;
|
|
26
|
-
match?: string;
|
|
27
|
-
event?: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 插件包配置
|
|
32
|
-
* package.json 中的 mioku 字段
|
|
33
|
-
*/
|
|
34
|
-
interface PluginPackageConfig$1 {
|
|
35
|
-
services?: string[];
|
|
36
|
-
help?: PluginHelp$1;
|
|
37
|
-
accessHooks?: AccessHook$1[];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Mioku 服务定义
|
|
41
|
-
*/
|
|
42
|
-
interface MiokuService$1 {
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
interface MiokuService {
|
|
43
6
|
name: string;
|
|
44
7
|
version: string;
|
|
45
8
|
description?: string;
|
|
@@ -47,138 +10,57 @@ interface MiokuService$1 {
|
|
|
47
10
|
api: Record<string, any>;
|
|
48
11
|
dispose?(): Promise<void>;
|
|
49
12
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
version: string;
|
|
56
|
-
description?: string;
|
|
57
|
-
path: string;
|
|
58
|
-
packageJson: any;
|
|
59
|
-
config: PluginPackageConfig$1;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 服务元数据
|
|
63
|
-
*/
|
|
64
|
-
interface ServiceMetadata$1 {
|
|
65
|
-
name: string;
|
|
66
|
-
version: string;
|
|
67
|
-
description?: string;
|
|
68
|
-
path: string;
|
|
69
|
-
packageJson: any;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=types.d.ts.map
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/core/plugin-manager.d.ts
|
|
74
|
-
/**
|
|
75
|
-
* 插件管理器
|
|
76
|
-
*
|
|
77
|
-
* Discover and manage plugins from both local directories and node_modules.
|
|
78
|
-
*/
|
|
79
|
-
declare class PluginManager {
|
|
80
|
-
private pluginMetadata;
|
|
81
|
-
static getInstance(): PluginManager;
|
|
82
|
-
discoverPlugins(miokuConfig?: any): Promise<PluginMetadata$1[]>;
|
|
83
|
-
private discoverFromDir;
|
|
84
|
-
private discoverFromNodeModules;
|
|
85
|
-
private resolveDirectoryPath;
|
|
86
|
-
private loadPluginMetadata;
|
|
87
|
-
collectRequiredServices(): Set<string>;
|
|
88
|
-
getPluginMetadata(name: string): PluginMetadata$1 | undefined;
|
|
89
|
-
getAllMetadata(): PluginMetadata$1[];
|
|
90
|
-
reset(): void;
|
|
91
|
-
}
|
|
92
|
-
declare const _default: PluginManager;
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/core/service-manager.d.ts
|
|
95
|
-
/**
|
|
96
|
-
* 服务管理器
|
|
97
|
-
*/
|
|
98
|
-
declare class ServiceManager {
|
|
99
|
-
private services;
|
|
100
|
-
private serviceMetadata;
|
|
101
|
-
private servicesDir;
|
|
102
|
-
static getInstance(): ServiceManager;
|
|
103
|
-
discoverServices(miokuConfig?: any): Promise<ServiceMetadata$1[]>;
|
|
104
|
-
private discoverFromDir;
|
|
105
|
-
private loadServiceMetadata;
|
|
106
|
-
/**
|
|
107
|
-
* Load built-in services from the package
|
|
108
|
-
*/
|
|
109
|
-
private loadBuiltinServices;
|
|
110
|
-
private discoverFromNodeModules;
|
|
111
|
-
checkMissingServices(requiredServices: Set<string>): Promise<string[]>;
|
|
112
|
-
loadAllServices(ctx: MiokiContext$1): Promise<void>;
|
|
113
|
-
private loadService;
|
|
114
|
-
/**
|
|
115
|
-
* Register a builtin service directly
|
|
116
|
-
*/
|
|
117
|
-
registerBuiltinService(name: string, service: MiokuService$1): void;
|
|
118
|
-
/**
|
|
119
|
-
* Get a loaded service
|
|
120
|
-
*/
|
|
121
|
-
getService(name: string): MiokuService$1 | undefined;
|
|
122
|
-
disposeAll(): Promise<void>;
|
|
123
|
-
reset(): void;
|
|
13
|
+
interface MiokuRuntimeConfig {
|
|
14
|
+
plugins?: string[];
|
|
15
|
+
plugins_dir?: string;
|
|
16
|
+
services_dir?: string;
|
|
17
|
+
[key: string]: unknown;
|
|
124
18
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Auto-register plugin help manifests and AI skills
|
|
130
|
-
*/
|
|
131
|
-
declare function registerPluginArtifacts(ctx: MiokiContext$1): Promise<void>;
|
|
132
|
-
//# sourceMappingURL=plugin-artifact-registry.d.ts.map
|
|
133
|
-
//#endregion
|
|
134
|
-
//#region src/types.d.ts
|
|
135
|
-
/**
|
|
136
|
-
* Mioku Service Definition
|
|
137
|
-
*/
|
|
138
|
-
interface MiokuService {
|
|
139
|
-
name: string;
|
|
140
|
-
version: string;
|
|
19
|
+
interface PackageJsonLike {
|
|
20
|
+
name?: string;
|
|
21
|
+
version?: string;
|
|
141
22
|
description?: string;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
23
|
+
mioki?: MiokuRuntimeConfig;
|
|
24
|
+
mioku?: PluginPackageConfig;
|
|
25
|
+
dependencies?: Record<string, string>;
|
|
145
26
|
}
|
|
146
|
-
/**
|
|
147
|
-
* 插件元数据
|
|
148
|
-
*/
|
|
149
27
|
interface PluginMetadata {
|
|
150
28
|
name: string;
|
|
151
29
|
version: string;
|
|
152
30
|
description?: string;
|
|
153
31
|
path: string;
|
|
154
|
-
packageJson:
|
|
32
|
+
packageJson: PackageJsonLike;
|
|
155
33
|
config: PluginPackageConfig;
|
|
156
34
|
}
|
|
157
|
-
/**
|
|
158
|
-
* 服务元数据
|
|
159
|
-
*/
|
|
160
35
|
interface ServiceMetadata {
|
|
161
36
|
name: string;
|
|
162
37
|
version: string;
|
|
163
38
|
description?: string;
|
|
164
39
|
path: string;
|
|
165
|
-
packageJson:
|
|
40
|
+
packageJson: PackageJsonLike;
|
|
41
|
+
}
|
|
42
|
+
interface PluginPackageConfig {
|
|
43
|
+
services?: string[];
|
|
44
|
+
help?: PluginHelp;
|
|
45
|
+
accessHooks?: AccessHook[];
|
|
166
46
|
}
|
|
47
|
+
interface PluginHelp {
|
|
48
|
+
title: string;
|
|
49
|
+
description: string;
|
|
50
|
+
commands: Array<{
|
|
51
|
+
cmd: string;
|
|
52
|
+
desc: string;
|
|
53
|
+
usage?: string;
|
|
54
|
+
role?: CommandRole;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
type CommandRole = "master" | "admin" | "owner" | "member";
|
|
167
58
|
interface AccessHook {
|
|
168
59
|
id: string;
|
|
169
60
|
match?: string;
|
|
170
61
|
event?: string;
|
|
171
62
|
description?: string;
|
|
172
63
|
}
|
|
173
|
-
/**
|
|
174
|
-
* 插件包配置
|
|
175
|
-
* package.json 中的 mioku 字段
|
|
176
|
-
*/
|
|
177
|
-
interface PluginPackageConfig {
|
|
178
|
-
services?: string[];
|
|
179
|
-
help?: PluginHelp;
|
|
180
|
-
accessHooks?: AccessHook[];
|
|
181
|
-
}
|
|
182
64
|
type AccessAction = "allow" | "block";
|
|
183
65
|
interface AccessRuleEntry {
|
|
184
66
|
action: AccessAction;
|
|
@@ -193,31 +75,6 @@ interface AccessControlConfig {
|
|
|
193
75
|
groups: Record<string, AccessScopeConfig>;
|
|
194
76
|
users: Record<string, AccessScopeConfig>;
|
|
195
77
|
}
|
|
196
|
-
/**
|
|
197
|
-
* 插件帮助信息
|
|
198
|
-
*/
|
|
199
|
-
interface PluginHelp {
|
|
200
|
-
title: string;
|
|
201
|
-
description: string;
|
|
202
|
-
commands: Array<{
|
|
203
|
-
cmd: string;
|
|
204
|
-
desc: string;
|
|
205
|
-
usage?: string;
|
|
206
|
-
role?: CommandRole;
|
|
207
|
-
}>;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* 指令权限级别
|
|
211
|
-
* 主人 管理员 群主 群成员
|
|
212
|
-
*/
|
|
213
|
-
type CommandRole = "master" | "admin" | "owner" | "member";
|
|
214
|
-
//# sourceMappingURL=types.d.ts.map
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/service-types.d.ts
|
|
217
|
-
/**
|
|
218
|
-
* Service interface definitions for built-in services
|
|
219
|
-
* These are used for type annotations in plugins
|
|
220
|
-
*/
|
|
221
78
|
interface ConfigService {
|
|
222
79
|
registerConfig(pluginName: string, configName: string, initialConfig: any): Promise<boolean>;
|
|
223
80
|
updateConfig(pluginName: string, configName: string, updates: any): Promise<boolean>;
|
|
@@ -232,10 +89,10 @@ interface ScreenshotService {
|
|
|
232
89
|
cleanupTemp(olderThanMs?: number): Promise<number>;
|
|
233
90
|
}
|
|
234
91
|
interface HelpService {
|
|
235
|
-
registerHelp(pluginName: string, help:
|
|
236
|
-
getHelp(pluginName: string):
|
|
237
|
-
getAllHelp(): Map<string,
|
|
238
|
-
unregisterHelp(pluginName: string):
|
|
92
|
+
registerHelp(pluginName: string, help: PluginHelp): void;
|
|
93
|
+
getHelp(pluginName: string): PluginHelp | undefined;
|
|
94
|
+
getAllHelp(): Map<string, PluginHelp>;
|
|
95
|
+
unregisterHelp(pluginName: string): boolean;
|
|
239
96
|
}
|
|
240
97
|
interface WebUIService {
|
|
241
98
|
getSettings(): {
|
|
@@ -254,16 +111,25 @@ interface AITool {
|
|
|
254
111
|
};
|
|
255
112
|
handler: (args: any, event?: any) => Promise<any> | any;
|
|
256
113
|
}
|
|
114
|
+
type SkillPermissionRole = "owner" | "admin" | "member";
|
|
257
115
|
interface AISkill {
|
|
258
116
|
name: string;
|
|
259
117
|
description: string;
|
|
260
|
-
permission?:
|
|
118
|
+
permission?: SkillPermissionRole;
|
|
261
119
|
tools: AITool[];
|
|
262
120
|
}
|
|
263
121
|
interface TextMessage {
|
|
264
122
|
role: "system" | "user" | "assistant";
|
|
265
123
|
content: string;
|
|
266
124
|
}
|
|
125
|
+
interface MultimodalContentItem {
|
|
126
|
+
type: "text" | "image_url";
|
|
127
|
+
text?: string;
|
|
128
|
+
image_url?: {
|
|
129
|
+
url: string;
|
|
130
|
+
detail?: "auto" | "low" | "high";
|
|
131
|
+
};
|
|
132
|
+
}
|
|
267
133
|
interface MultimodalMessage {
|
|
268
134
|
role: "system" | "user" | "assistant";
|
|
269
135
|
content: string | MultimodalContentItem[];
|
|
@@ -305,6 +171,65 @@ interface CompleteResponse {
|
|
|
305
171
|
iterations?: number;
|
|
306
172
|
allToolCalls?: ToolCallRecord[];
|
|
307
173
|
}
|
|
174
|
+
interface AIInstance {
|
|
175
|
+
generateText(options: {
|
|
176
|
+
prompt?: string;
|
|
177
|
+
messages: TextMessage[];
|
|
178
|
+
model?: string;
|
|
179
|
+
temperature?: number;
|
|
180
|
+
max_tokens?: number;
|
|
181
|
+
}): Promise<string>;
|
|
182
|
+
generateMultimodal(options: {
|
|
183
|
+
prompt?: string;
|
|
184
|
+
messages: MultimodalMessage[];
|
|
185
|
+
model?: string;
|
|
186
|
+
temperature?: number;
|
|
187
|
+
max_tokens?: number;
|
|
188
|
+
}): Promise<string>;
|
|
189
|
+
complete(options: CompleteOptions): Promise<CompleteResponse>;
|
|
190
|
+
generateWithTools(options: {
|
|
191
|
+
prompt?: string;
|
|
192
|
+
messages: TextMessage[] | MultimodalMessage[];
|
|
193
|
+
model?: string;
|
|
194
|
+
temperature?: number;
|
|
195
|
+
maxIterations?: number;
|
|
196
|
+
}): Promise<any>;
|
|
197
|
+
setUsageContext?(context: AIUsageContext | undefined): void;
|
|
198
|
+
withUsageContext?<T>(context: AIUsageContext | undefined, fn: () => Promise<T>): Promise<T>;
|
|
199
|
+
registerPrompt(name: string, prompt: string): boolean;
|
|
200
|
+
getPrompt(name: string): string | undefined;
|
|
201
|
+
getAllPrompts(): Record<string, string>;
|
|
202
|
+
removePrompt(name: string): boolean;
|
|
203
|
+
}
|
|
204
|
+
interface AIService {
|
|
205
|
+
create(options: {
|
|
206
|
+
name: string;
|
|
207
|
+
apiUrl: string;
|
|
208
|
+
apiKey: string;
|
|
209
|
+
modelType: "text" | "multimodal";
|
|
210
|
+
model?: string;
|
|
211
|
+
}): Promise<AIInstance>;
|
|
212
|
+
get(name: string): AIInstance | undefined;
|
|
213
|
+
list(): string[];
|
|
214
|
+
remove(name: string): boolean;
|
|
215
|
+
setDefault(name: string): boolean;
|
|
216
|
+
getDefault(): AIInstance | undefined;
|
|
217
|
+
registerChatRuntime(runtime: any): boolean;
|
|
218
|
+
getChatRuntime(): any;
|
|
219
|
+
removeChatRuntime(): boolean;
|
|
220
|
+
registerSkill(skill: AISkill): boolean;
|
|
221
|
+
getSkill(skillName: string): AISkill | undefined;
|
|
222
|
+
getAllSkills(): Map<string, AISkill>;
|
|
223
|
+
removeSkill(skillName: string): boolean;
|
|
224
|
+
getTool(toolName: string): AITool | undefined;
|
|
225
|
+
getAllTools(): Map<string, AITool>;
|
|
226
|
+
getUsageSummary?(options: {
|
|
227
|
+
range: AIUsageRange;
|
|
228
|
+
botId?: number;
|
|
229
|
+
}): AIUsageSummary;
|
|
230
|
+
cleanupUsageStats?(retentionMs?: number): number;
|
|
231
|
+
finalizeUsage?(usageId: string, finalization: AIUsageFinalization): boolean;
|
|
232
|
+
}
|
|
308
233
|
interface ChatRuntime {
|
|
309
234
|
generateNotice(options: ChatRuntimeNoticeOptions): Promise<ChatRuntimeResult>;
|
|
310
235
|
requestInformation(options: ChatRuntimeInformationRequestOptions): Promise<ChatRuntimeResult>;
|
|
@@ -312,19 +237,14 @@ interface ChatRuntime {
|
|
|
312
237
|
declare const TOOL_RESULT_FOLLOWUP_KEY = "__miokuFollowup";
|
|
313
238
|
interface ToolResultFollowup {
|
|
314
239
|
text: string;
|
|
315
|
-
images
|
|
240
|
+
images?: Array<{
|
|
316
241
|
url: string;
|
|
317
242
|
detail?: "auto" | "low" | "high";
|
|
318
243
|
}>;
|
|
319
|
-
|
|
320
|
-
type SkillPermissionRole = "owner" | "admin" | "member";
|
|
321
|
-
interface MultimodalContentItem {
|
|
322
|
-
type: "text" | "image_url";
|
|
323
|
-
text?: string;
|
|
324
|
-
image_url?: {
|
|
244
|
+
videos?: Array<{
|
|
325
245
|
url: string;
|
|
326
246
|
detail?: "auto" | "low" | "high";
|
|
327
|
-
}
|
|
247
|
+
}>;
|
|
328
248
|
}
|
|
329
249
|
interface ChatRuntimePromptInjection {
|
|
330
250
|
content: string;
|
|
@@ -365,7 +285,18 @@ interface ChatRuntimeCollectedInfo {
|
|
|
365
285
|
confidence?: number;
|
|
366
286
|
notes?: string;
|
|
367
287
|
}
|
|
288
|
+
interface ChatRuntimeResult {
|
|
289
|
+
messages: string[];
|
|
290
|
+
toolCalls: ToolCallRecord[];
|
|
291
|
+
collectedInfo: ChatRuntimeCollectedInfo | null;
|
|
292
|
+
pendingAt?: number[];
|
|
293
|
+
pendingPoke?: number[];
|
|
294
|
+
pendingQuote?: number;
|
|
295
|
+
emojiPath?: string | null;
|
|
296
|
+
protocolMessages?: any[];
|
|
297
|
+
}
|
|
368
298
|
type AIUsageRange = "today" | "7d" | "30d";
|
|
299
|
+
type AIUsageScope = "all" | "bot";
|
|
369
300
|
interface AIUsageContext {
|
|
370
301
|
usageId?: string;
|
|
371
302
|
source?: string;
|
|
@@ -388,170 +319,162 @@ interface AIUsageFinalization {
|
|
|
388
319
|
sentAssistantMessages?: number;
|
|
389
320
|
breakdown?: AIUsageBreakdown;
|
|
390
321
|
}
|
|
322
|
+
interface AIUsageBotOption {
|
|
323
|
+
botId: number;
|
|
324
|
+
label: string;
|
|
325
|
+
}
|
|
391
326
|
interface AIUsageSummary {
|
|
327
|
+
generatedAt: number;
|
|
392
328
|
range: AIUsageRange;
|
|
393
|
-
|
|
329
|
+
scope: AIUsageScope;
|
|
330
|
+
botId?: number;
|
|
331
|
+
bots: AIUsageBotOption[];
|
|
332
|
+
totals: {
|
|
394
333
|
requests: number;
|
|
334
|
+
successfulRequests: number;
|
|
335
|
+
failedRequests: number;
|
|
336
|
+
userMessages: number;
|
|
337
|
+
assistantMessages: number;
|
|
338
|
+
systemMessages: number;
|
|
339
|
+
toolMessages: number;
|
|
340
|
+
sentUserMessages: number;
|
|
341
|
+
sentAssistantMessages: number;
|
|
395
342
|
inputTokens: number;
|
|
396
343
|
outputTokens: number;
|
|
344
|
+
systemPromptTokens: number;
|
|
345
|
+
totalTokens: number;
|
|
397
346
|
cacheWriteTokens: number;
|
|
398
347
|
cacheReadTokens: number;
|
|
399
|
-
|
|
348
|
+
toolDefinitionTokens: number;
|
|
349
|
+
toolUseTokens: number;
|
|
350
|
+
chatHistoryTokens: number;
|
|
351
|
+
otherContextTokens: number;
|
|
352
|
+
durationMs: number;
|
|
353
|
+
toolCalls: number;
|
|
354
|
+
};
|
|
355
|
+
rates: {
|
|
356
|
+
throughputTokPerMin: number;
|
|
357
|
+
averageTokensPerUserMessage: number;
|
|
358
|
+
averageTokensPerSentMessage: number;
|
|
359
|
+
errorRate: number;
|
|
360
|
+
cacheHitRate: number;
|
|
400
361
|
};
|
|
401
|
-
|
|
402
|
-
|
|
362
|
+
toolRanking: Array<{
|
|
363
|
+
name: string;
|
|
364
|
+
count: number;
|
|
365
|
+
}>;
|
|
366
|
+
groupRanking: Array<{
|
|
367
|
+
groupId: number;
|
|
368
|
+
groupName: string;
|
|
369
|
+
requests: number;
|
|
370
|
+
totalTokens: number;
|
|
371
|
+
userMessages: number;
|
|
372
|
+
assistantMessages: number;
|
|
373
|
+
errorRate: number;
|
|
374
|
+
}>;
|
|
375
|
+
tokenFlow: Array<{
|
|
376
|
+
name: "输入" | "输出" | "缓存写入" | "缓存读取";
|
|
377
|
+
value: number;
|
|
378
|
+
}>;
|
|
379
|
+
tokenCategories: Array<{
|
|
380
|
+
name: "系统提示词" | "工具定义" | "工具使用" | "聊天上下文" | "其他上下文";
|
|
381
|
+
value: number;
|
|
382
|
+
}>;
|
|
383
|
+
dailyActivity: Array<{
|
|
384
|
+
day: string;
|
|
403
385
|
requests: number;
|
|
386
|
+
userMessages: number;
|
|
387
|
+
assistantMessages: number;
|
|
388
|
+
totalTokens: number;
|
|
404
389
|
inputTokens: number;
|
|
405
|
-
outputTokens: number;
|
|
406
|
-
cacheWriteTokens: number;
|
|
407
390
|
cacheReadTokens: number;
|
|
391
|
+
throughputTokPerMin: number;
|
|
392
|
+
averageTokensPerUserMessage: number;
|
|
393
|
+
averageTokensPerSentMessage: number;
|
|
394
|
+
errorRate: number;
|
|
395
|
+
cacheHitRate: number;
|
|
396
|
+
}>;
|
|
397
|
+
hourlyActivity: Array<{
|
|
398
|
+
hour: string;
|
|
399
|
+
requests: number;
|
|
400
|
+
userMessages: number;
|
|
401
|
+
assistantMessages: number;
|
|
408
402
|
totalTokens: number;
|
|
403
|
+
inputTokens: number;
|
|
404
|
+
cacheReadTokens: number;
|
|
405
|
+
throughputTokPerMin: number;
|
|
406
|
+
averageTokensPerUserMessage: number;
|
|
407
|
+
averageTokensPerSentMessage: number;
|
|
408
|
+
errorRate: number;
|
|
409
|
+
cacheHitRate: number;
|
|
409
410
|
}>;
|
|
410
411
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
prompt?: string;
|
|
424
|
-
messages: TextMessage[];
|
|
425
|
-
model?: string;
|
|
426
|
-
temperature?: number;
|
|
427
|
-
max_tokens?: number;
|
|
428
|
-
}): Promise<string>;
|
|
429
|
-
generateMultimodal(options: {
|
|
430
|
-
prompt?: string;
|
|
431
|
-
messages: MultimodalMessage[];
|
|
432
|
-
model?: string;
|
|
433
|
-
temperature?: number;
|
|
434
|
-
max_tokens?: number;
|
|
435
|
-
}): Promise<string>;
|
|
436
|
-
complete(options: CompleteOptions): Promise<CompleteResponse>;
|
|
437
|
-
generateWithTools(options: {
|
|
438
|
-
prompt?: string;
|
|
439
|
-
messages: TextMessage[] | MultimodalMessage[];
|
|
440
|
-
model?: string;
|
|
441
|
-
temperature?: number;
|
|
442
|
-
maxIterations?: number;
|
|
443
|
-
}): Promise<any>;
|
|
444
|
-
setUsageContext?(context: AIUsageContext | undefined): void;
|
|
445
|
-
withUsageContext?<T>(context: AIUsageContext | undefined, fn: () => Promise<T>): Promise<T>;
|
|
446
|
-
registerPrompt(name: string, prompt: string): boolean;
|
|
447
|
-
getPrompt(name: string): string | undefined;
|
|
448
|
-
getAllPrompts(): Record<string, string>;
|
|
449
|
-
removePrompt(name: string): boolean;
|
|
412
|
+
//# sourceMappingURL=types.d.ts.map
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/core/plugin-manager.d.ts
|
|
415
|
+
declare class PluginManager {
|
|
416
|
+
private plugins;
|
|
417
|
+
static getInstance(): PluginManager;
|
|
418
|
+
discoverPlugins(miokuConfig?: MiokuRuntimeConfig): Promise<PluginMetadata[]>;
|
|
419
|
+
private loadPluginMetadata;
|
|
420
|
+
collectRequiredServices(): Set<string>;
|
|
421
|
+
getPluginMetadata(name: string): PluginMetadata | undefined;
|
|
422
|
+
getAllMetadata(): PluginMetadata[];
|
|
423
|
+
reset(): void;
|
|
450
424
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
registerSkill(skill: AISkill): boolean;
|
|
468
|
-
getSkill(skillName: string): AISkill | undefined;
|
|
469
|
-
getAllSkills(): Map<string, AISkill>;
|
|
470
|
-
removeSkill(skillName: string): boolean;
|
|
471
|
-
getTool(toolName: string): AITool | undefined;
|
|
472
|
-
getAllTools(): Map<string, AITool>;
|
|
473
|
-
getUsageSummary?(options: {
|
|
474
|
-
range: AIUsageRange;
|
|
475
|
-
botId?: number;
|
|
476
|
-
}): AIUsageSummary;
|
|
477
|
-
cleanupUsageStats?(retentionMs?: number): number;
|
|
478
|
-
finalizeUsage?(usageId: string, finalization: AIUsageFinalization): boolean;
|
|
425
|
+
declare const _default: PluginManager;
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/core/service-manager.d.ts
|
|
428
|
+
declare class ServiceManager {
|
|
429
|
+
private services;
|
|
430
|
+
private serviceMetadata;
|
|
431
|
+
static getInstance(): ServiceManager;
|
|
432
|
+
discoverServices(miokuConfig?: MiokuRuntimeConfig): Promise<ServiceMetadata[]>;
|
|
433
|
+
private loadServiceMetadata;
|
|
434
|
+
checkMissingServices(required: Set<string>): Promise<string[]>;
|
|
435
|
+
loadAllServices(ctx: MiokiContext$1): Promise<void>;
|
|
436
|
+
private loadService;
|
|
437
|
+
registerBuiltinService(name: string, service: MiokuService): void;
|
|
438
|
+
getService(name: string): MiokuService | undefined;
|
|
439
|
+
disposeAll(): Promise<void>;
|
|
440
|
+
reset(): void;
|
|
479
441
|
}
|
|
480
|
-
|
|
442
|
+
declare const _default$1: ServiceManager;
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/core/plugin-artifact-registry.d.ts
|
|
445
|
+
declare function registerPluginArtifacts(ctx: MiokiContext$1): Promise<void>;
|
|
446
|
+
//# sourceMappingURL=plugin-artifact-registry.d.ts.map
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/core/service-config.d.ts
|
|
449
|
+
declare function registerServiceConfig(serviceName: string, configName: string, defaults: Record<string, unknown>): Promise<void>;
|
|
450
|
+
declare function getServiceConfig(serviceName: string, configName: string): Promise<Record<string, unknown>>;
|
|
451
|
+
declare function updateServiceConfig(serviceName: string, configName: string, value: Record<string, unknown>): Promise<void>;
|
|
452
|
+
declare function getServiceConfigs(serviceName: string): Promise<Record<string, Record<string, unknown>>>;
|
|
453
|
+
declare function deleteServiceConfig(serviceName: string, configName: string): Promise<boolean>;
|
|
454
|
+
//# sourceMappingURL=service-config.d.ts.map
|
|
481
455
|
//#endregion
|
|
482
456
|
//#region src/core/data-paths.d.ts
|
|
483
|
-
/**
|
|
484
|
-
* Data Directory Utilities for Mioku Plugins
|
|
485
|
-
*
|
|
486
|
-
* Provides consistent data path resolution that respects the project directory
|
|
487
|
-
* (process.cwd()) rather than the package installation directory.
|
|
488
|
-
*/
|
|
489
|
-
/**
|
|
490
|
-
* Get the data directory for a specific plugin
|
|
491
|
-
* Returns: {cwd}/data/{pluginName}
|
|
492
|
-
*/
|
|
493
457
|
declare function getPluginDataDir(pluginName: string): string;
|
|
494
|
-
/**
|
|
495
|
-
* Get the data directory for a service
|
|
496
|
-
* Returns: {cwd}/data/{serviceName}
|
|
497
|
-
*/
|
|
498
458
|
declare function getServiceDataDir(serviceName: string): string;
|
|
499
|
-
/**
|
|
500
|
-
* Get the main data directory
|
|
501
|
-
* Returns: {cwd}/data
|
|
502
|
-
*/
|
|
503
459
|
declare function getDataDir(): string;
|
|
504
|
-
/**
|
|
505
|
-
* Get the config directory for a plugin
|
|
506
|
-
* Returns: {cwd}/config/{pluginName}
|
|
507
|
-
*/
|
|
508
460
|
declare function getPluginConfigDir(pluginName: string): string;
|
|
509
|
-
/**
|
|
510
|
-
* Get the config directory for a service
|
|
511
|
-
* Returns: {cwd}/config/{serviceName}
|
|
512
|
-
*/
|
|
513
461
|
declare function getServiceConfigDir(serviceName: string): string;
|
|
514
|
-
/**
|
|
515
|
-
* Get the main config directory
|
|
516
|
-
* Returns: {cwd}/config
|
|
517
|
-
*/
|
|
518
462
|
declare function getConfigDir(): string;
|
|
519
|
-
/**
|
|
520
|
-
* Ensure a directory exists, creating it if necessary
|
|
521
|
-
*/
|
|
522
463
|
declare function ensureDataDir(pluginName: string): string;
|
|
523
464
|
//# sourceMappingURL=data-paths.d.ts.map
|
|
524
465
|
//#endregion
|
|
525
466
|
//#region src/core/plugin-runtime-state.d.ts
|
|
526
|
-
/**
|
|
527
|
-
* Get the runtime state for a plugin
|
|
528
|
-
*/
|
|
529
467
|
declare function getPluginRuntimeState(pluginName: string): Record<string, any>;
|
|
530
|
-
/**
|
|
531
|
-
* Set/update the runtime state for a plugin
|
|
532
|
-
*/
|
|
533
468
|
declare function setPluginRuntimeState(pluginName: string, state: Record<string, any>): Record<string, any>;
|
|
534
|
-
/**
|
|
535
|
-
* Reset the runtime state for a plugin
|
|
536
|
-
*/
|
|
537
469
|
declare function resetPluginRuntimeState(pluginName: string): void;
|
|
538
|
-
/**
|
|
539
|
-
* Get all plugin runtime states (for debugging)
|
|
540
|
-
*/
|
|
541
470
|
//#endregion
|
|
542
471
|
//#region src/index.d.ts
|
|
543
472
|
declare function definePlugin<T extends mioki0.MiokiPlugin>(plugin: T): T;
|
|
544
|
-
/**
|
|
545
|
-
* Start options for Mioku
|
|
546
|
-
*/
|
|
547
473
|
interface MiokuStartOptions {
|
|
548
474
|
cwd?: string;
|
|
549
475
|
}
|
|
550
|
-
/**
|
|
551
|
-
* Start Mioku with plugin and service discovery
|
|
552
|
-
*/
|
|
553
476
|
declare function start(options?: MiokuStartOptions): Promise<void>;
|
|
554
|
-
declare const version
|
|
477
|
+
declare const version: string;
|
|
555
478
|
//#endregion
|
|
556
|
-
export { type AIInstance, type AIService, type AISkill, type AITool, type AIUsageBreakdown, type AIUsageContext, type AIUsageFinalization, type AIUsageRange, type AIUsageSummary, type AccessAction, type AccessControlConfig, type AccessHook, type AccessRuleEntry, type AccessScopeConfig, type ChatRuntime, type ChatRuntimeBaseOptions, type ChatRuntimeCollectedInfo, type ChatRuntimeGroupTarget, type ChatRuntimeInformationRequestOptions, type ChatRuntimeNoticeOptions, type ChatRuntimePrivateTarget, type ChatRuntimePromptInjection, type ChatRuntimeResult, type ChatRuntimeSource, type CommandRole, type CompleteOptions, type CompleteResponse, type ConfigService, type HelpService, type MiokiContext, type MiokiPlugin, type MiokuService, MiokuStartOptions, type MultimodalContentItem, type MultimodalMessage, type PluginHelp, type PluginMetadata, type PluginPackageConfig, type ScreenshotService, type ServiceMetadata, type SessionToolDefinition, type SkillPermissionRole, TOOL_RESULT_FOLLOWUP_KEY, type TextMessage, type ToolCallRecord, type ToolResultFollowup, type WebUIService, definePlugin, ensureDataDir, getConfigDir, getDataDir, getPluginConfigDir, getPluginDataDir, getPluginRuntimeState, getServiceConfigDir, getServiceDataDir, _default as pluginManager, registerPluginArtifacts, resetPluginRuntimeState, _default$1 as serviceManager, setPluginRuntimeState, start, version };
|
|
479
|
+
export { type AIInstance, type AIService, type AISkill, type AITool, type AIUsageBotOption, type AIUsageBreakdown, type AIUsageContext, type AIUsageFinalization, type AIUsageRange, type AIUsageScope, type AIUsageSummary, type AccessAction, type AccessControlConfig, type AccessHook, type AccessRuleEntry, type AccessScopeConfig, type ChatRuntime, type ChatRuntimeBaseOptions, type ChatRuntimeCollectedInfo, type ChatRuntimeGroupTarget, type ChatRuntimeInformationRequestOptions, type ChatRuntimeNoticeOptions, type ChatRuntimePrivateTarget, type ChatRuntimePromptInjection, type ChatRuntimeResult, type ChatRuntimeSource, type CommandRole, type CompleteOptions, type CompleteResponse, type ConfigService, type HelpService, type MiokiContext, type MiokiPlugin, type MiokuRuntimeConfig, type MiokuService, MiokuStartOptions, type MultimodalContentItem, type MultimodalMessage, type PackageJsonLike, type PluginHelp, type PluginMetadata, type PluginPackageConfig, type ScreenshotService, type ServiceMetadata, type SessionToolDefinition, type SkillPermissionRole, TOOL_RESULT_FOLLOWUP_KEY, type TextMessage, type ToolCallRecord, type ToolResultFollowup, type WebUIService, definePlugin, deleteServiceConfig, ensureDataDir, getConfigDir, getDataDir, getPluginConfigDir, getPluginDataDir, getPluginRuntimeState, getServiceConfig, getServiceConfigDir, getServiceConfigs, getServiceDataDir, _default as pluginManager, registerPluginArtifacts, registerServiceConfig, resetPluginRuntimeState, _default$1 as serviceManager, setPluginRuntimeState, start, updateServiceConfig, version };
|
|
557
480
|
//# sourceMappingURL=index.d.cts.map
|