@lov3kaizen/agentsea-core 0.2.0 → 0.3.1
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.mts +29 -333
- package/dist/index.d.ts +29 -333
- package/dist/index.js +134 -16
- package/dist/index.mjs +244 -16
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,197 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tool, ToolCall, ToolContext, AgentConfig, LLMProvider, MemoryStore, AgentContext, AgentResponse, StreamEvent, Message, ProviderConfig, LLMResponse, LLMStreamChunk, WorkflowConfig, AgentMetrics, SpanContext, OutputFormat, FormatOptions, FormattedContent, VoiceAgentConfig, VoiceMessage, STTConfig, TTSConfig, STTProvider, STTResult, TTSProvider, TTSResult, AudioFormat, TenantStorage, Tenant, TenantStatus, TenantApiKey, TenantQuota } from '@lov3kaizen/agentsea-types';
|
|
2
|
+
export * from '@lov3kaizen/agentsea-types';
|
|
3
|
+
export { AudioFormat, STTConfig, STTProvider, STTResult, TTSConfig, TTSProvider, TTSResult, Tenant, TenantApiKey, TenantContext, TenantQuota, TenantResolver, TenantSettings, TenantStatus, TenantStorage, VoiceAgentConfig, VoiceMessage, VoiceType } from '@lov3kaizen/agentsea-types';
|
|
2
4
|
import { EventEmitter } from 'events';
|
|
3
|
-
|
|
4
|
-
interface Message {
|
|
5
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
6
|
-
content: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
toolCallId?: string;
|
|
9
|
-
}
|
|
10
|
-
type OutputFormat = 'text' | 'markdown' | 'html' | 'react';
|
|
11
|
-
interface FormatOptions {
|
|
12
|
-
includeMetadata?: boolean;
|
|
13
|
-
sanitizeHtml?: boolean;
|
|
14
|
-
highlightCode?: boolean;
|
|
15
|
-
theme?: 'light' | 'dark' | 'auto';
|
|
16
|
-
}
|
|
17
|
-
interface AgentConfig {
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
model: string;
|
|
21
|
-
provider: string;
|
|
22
|
-
systemPrompt?: string;
|
|
23
|
-
tools?: Tool[];
|
|
24
|
-
temperature?: number;
|
|
25
|
-
maxTokens?: number;
|
|
26
|
-
maxIterations?: number;
|
|
27
|
-
memory?: MemoryConfig;
|
|
28
|
-
providerConfig?: ProviderInstanceConfig;
|
|
29
|
-
outputFormat?: OutputFormat;
|
|
30
|
-
formatOptions?: FormatOptions;
|
|
31
|
-
}
|
|
32
|
-
interface ProviderInstanceConfig {
|
|
33
|
-
baseUrl?: string;
|
|
34
|
-
apiKey?: string;
|
|
35
|
-
timeout?: number;
|
|
36
|
-
defaultHeaders?: Record<string, string>;
|
|
37
|
-
organization?: string;
|
|
38
|
-
}
|
|
39
|
-
interface AgentContext {
|
|
40
|
-
conversationId: string;
|
|
41
|
-
userId?: string;
|
|
42
|
-
sessionData: Record<string, any>;
|
|
43
|
-
history: Message[];
|
|
44
|
-
metadata?: Record<string, any>;
|
|
45
|
-
}
|
|
46
|
-
interface FormattedContent {
|
|
47
|
-
raw: string;
|
|
48
|
-
format: OutputFormat;
|
|
49
|
-
rendered?: string;
|
|
50
|
-
metadata?: {
|
|
51
|
-
hasCodeBlocks?: boolean;
|
|
52
|
-
hasTables?: boolean;
|
|
53
|
-
hasLists?: boolean;
|
|
54
|
-
links?: Array<{
|
|
55
|
-
text: string;
|
|
56
|
-
url: string;
|
|
57
|
-
}>;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
interface AgentResponse {
|
|
61
|
-
content: string;
|
|
62
|
-
formatted?: FormattedContent;
|
|
63
|
-
toolCalls?: ToolCall[];
|
|
64
|
-
metadata: {
|
|
65
|
-
tokensUsed: number;
|
|
66
|
-
latencyMs: number;
|
|
67
|
-
iterations: number;
|
|
68
|
-
cost?: number;
|
|
69
|
-
};
|
|
70
|
-
nextAgent?: string;
|
|
71
|
-
finishReason?: 'stop' | 'length' | 'tool_calls' | 'error';
|
|
72
|
-
}
|
|
73
|
-
interface Tool {
|
|
74
|
-
name: string;
|
|
75
|
-
description: string;
|
|
76
|
-
parameters: z.ZodSchema;
|
|
77
|
-
execute: (params: any, context: ToolContext) => Promise<any>;
|
|
78
|
-
retryConfig?: RetryConfig;
|
|
79
|
-
}
|
|
80
|
-
interface ToolContext {
|
|
81
|
-
agentName: string;
|
|
82
|
-
conversationId: string;
|
|
83
|
-
metadata: Record<string, any>;
|
|
84
|
-
}
|
|
85
|
-
interface ToolCall {
|
|
86
|
-
id: string;
|
|
87
|
-
tool: string;
|
|
88
|
-
parameters: any;
|
|
89
|
-
result?: any;
|
|
90
|
-
error?: string;
|
|
91
|
-
}
|
|
92
|
-
interface RetryConfig {
|
|
93
|
-
maxAttempts: number;
|
|
94
|
-
backoff: 'linear' | 'exponential';
|
|
95
|
-
initialDelayMs?: number;
|
|
96
|
-
maxDelayMs?: number;
|
|
97
|
-
retryableErrors?: string[];
|
|
98
|
-
}
|
|
99
|
-
interface MemoryConfig {
|
|
100
|
-
type: 'buffer' | 'summary' | 'vector' | 'hybrid';
|
|
101
|
-
maxMessages?: number;
|
|
102
|
-
storage?: 'memory' | 'redis' | 'database';
|
|
103
|
-
ttl?: number;
|
|
104
|
-
summaryModel?: string;
|
|
105
|
-
}
|
|
106
|
-
interface MemoryStore {
|
|
107
|
-
save(conversationId: string, messages: Message[]): Promise<void>;
|
|
108
|
-
load(conversationId: string): Promise<Message[]>;
|
|
109
|
-
clear(conversationId: string): Promise<void>;
|
|
110
|
-
search?(query: string, limit?: number): Promise<Message[]>;
|
|
111
|
-
}
|
|
112
|
-
interface LLMProvider {
|
|
113
|
-
generateResponse(messages: Message[], config: ProviderConfig): Promise<LLMResponse>;
|
|
114
|
-
streamResponse?(messages: Message[], config: ProviderConfig): AsyncIterable<LLMStreamChunk>;
|
|
115
|
-
parseToolCalls(response: LLMResponse): ToolCall[];
|
|
116
|
-
}
|
|
117
|
-
interface ProviderConfig {
|
|
118
|
-
model: string;
|
|
119
|
-
temperature?: number;
|
|
120
|
-
maxTokens?: number;
|
|
121
|
-
tools?: Tool[];
|
|
122
|
-
systemPrompt?: string;
|
|
123
|
-
topP?: number;
|
|
124
|
-
stopSequences?: string[];
|
|
125
|
-
}
|
|
126
|
-
interface LLMResponse {
|
|
127
|
-
content: string;
|
|
128
|
-
stopReason: string;
|
|
129
|
-
usage: {
|
|
130
|
-
inputTokens: number;
|
|
131
|
-
outputTokens: number;
|
|
132
|
-
};
|
|
133
|
-
rawResponse: any;
|
|
134
|
-
}
|
|
135
|
-
interface LLMStreamChunk {
|
|
136
|
-
type: 'content' | 'tool_call' | 'done';
|
|
137
|
-
content?: string;
|
|
138
|
-
toolCall?: Partial<ToolCall>;
|
|
139
|
-
done?: boolean;
|
|
140
|
-
}
|
|
141
|
-
type StreamEvent = {
|
|
142
|
-
type: 'iteration';
|
|
143
|
-
iteration: number;
|
|
144
|
-
} | {
|
|
145
|
-
type: 'content';
|
|
146
|
-
content: string;
|
|
147
|
-
delta?: boolean;
|
|
148
|
-
} | {
|
|
149
|
-
type: 'tool_calls';
|
|
150
|
-
toolCalls: ToolCall[];
|
|
151
|
-
} | {
|
|
152
|
-
type: 'tool_result';
|
|
153
|
-
toolCall: ToolCall;
|
|
154
|
-
} | {
|
|
155
|
-
type: 'done';
|
|
156
|
-
metadata?: {
|
|
157
|
-
tokensUsed?: number;
|
|
158
|
-
latencyMs?: number;
|
|
159
|
-
iterations?: number;
|
|
160
|
-
};
|
|
161
|
-
} | {
|
|
162
|
-
type: 'error';
|
|
163
|
-
error: string;
|
|
164
|
-
};
|
|
165
|
-
type WorkflowType = 'sequential' | 'parallel' | 'supervisor' | 'custom';
|
|
166
|
-
interface WorkflowConfig {
|
|
167
|
-
name: string;
|
|
168
|
-
type: WorkflowType;
|
|
169
|
-
agents: AgentConfig[];
|
|
170
|
-
routing?: RoutingLogic;
|
|
171
|
-
errorHandling?: ErrorHandlingStrategy;
|
|
172
|
-
}
|
|
173
|
-
interface RoutingLogic {
|
|
174
|
-
strategy: 'conditional' | 'round-robin' | 'dynamic';
|
|
175
|
-
rules?: RoutingRule[];
|
|
176
|
-
}
|
|
177
|
-
interface RoutingRule {
|
|
178
|
-
condition: (context: AgentContext, response: AgentResponse) => boolean;
|
|
179
|
-
nextAgent: string;
|
|
180
|
-
}
|
|
181
|
-
type ErrorHandlingStrategy = 'fail-fast' | 'retry' | 'fallback' | 'continue';
|
|
182
|
-
interface AgentMetrics {
|
|
183
|
-
agentName: string;
|
|
184
|
-
latencyMs: number;
|
|
185
|
-
tokensUsed: number;
|
|
186
|
-
success: boolean;
|
|
187
|
-
error?: string;
|
|
188
|
-
timestamp: Date;
|
|
189
|
-
}
|
|
190
|
-
interface SpanContext {
|
|
191
|
-
traceId: string;
|
|
192
|
-
spanId: string;
|
|
193
|
-
parentSpanId?: string;
|
|
194
|
-
}
|
|
5
|
+
import { z } from 'zod';
|
|
195
6
|
|
|
196
7
|
declare class ToolRegistry {
|
|
197
8
|
private tools;
|
|
@@ -1013,73 +824,6 @@ declare class ConversationManager {
|
|
|
1013
824
|
import(stateJson: string): void;
|
|
1014
825
|
}
|
|
1015
826
|
|
|
1016
|
-
type AudioFormat = 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
|
|
1017
|
-
type VoiceType = string;
|
|
1018
|
-
interface STTConfig {
|
|
1019
|
-
model?: string;
|
|
1020
|
-
language?: string;
|
|
1021
|
-
temperature?: number;
|
|
1022
|
-
prompt?: string;
|
|
1023
|
-
responseFormat?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
|
|
1024
|
-
}
|
|
1025
|
-
interface TTSConfig {
|
|
1026
|
-
model?: string;
|
|
1027
|
-
voice?: VoiceType;
|
|
1028
|
-
speed?: number;
|
|
1029
|
-
format?: AudioFormat;
|
|
1030
|
-
}
|
|
1031
|
-
interface STTResult {
|
|
1032
|
-
text: string;
|
|
1033
|
-
language?: string;
|
|
1034
|
-
duration?: number;
|
|
1035
|
-
segments?: Array<{
|
|
1036
|
-
id: number;
|
|
1037
|
-
start: number;
|
|
1038
|
-
end: number;
|
|
1039
|
-
text: string;
|
|
1040
|
-
}>;
|
|
1041
|
-
words?: Array<{
|
|
1042
|
-
word: string;
|
|
1043
|
-
start: number;
|
|
1044
|
-
end: number;
|
|
1045
|
-
}>;
|
|
1046
|
-
}
|
|
1047
|
-
interface TTSResult {
|
|
1048
|
-
audio: Buffer;
|
|
1049
|
-
format: AudioFormat;
|
|
1050
|
-
duration?: number;
|
|
1051
|
-
byteLength: number;
|
|
1052
|
-
}
|
|
1053
|
-
interface STTProvider {
|
|
1054
|
-
transcribe(audio: Buffer | string, config?: STTConfig): Promise<STTResult>;
|
|
1055
|
-
transcribeStream?(audioStream: ReadableStream | NodeJS.ReadableStream, config?: STTConfig): AsyncIterable<Partial<STTResult>>;
|
|
1056
|
-
supportsStreaming(): boolean;
|
|
1057
|
-
}
|
|
1058
|
-
interface TTSProvider {
|
|
1059
|
-
synthesize(text: string, config?: TTSConfig): Promise<TTSResult>;
|
|
1060
|
-
synthesizeStream?(text: string, config?: TTSConfig): AsyncIterable<Buffer>;
|
|
1061
|
-
supportsStreaming(): boolean;
|
|
1062
|
-
getVoices?(): Promise<Array<{
|
|
1063
|
-
id: string;
|
|
1064
|
-
name: string;
|
|
1065
|
-
language?: string;
|
|
1066
|
-
gender?: 'male' | 'female' | 'neutral';
|
|
1067
|
-
}>>;
|
|
1068
|
-
}
|
|
1069
|
-
interface VoiceMessage {
|
|
1070
|
-
role: 'user' | 'assistant';
|
|
1071
|
-
text: string;
|
|
1072
|
-
audio?: Buffer;
|
|
1073
|
-
timestamp: Date;
|
|
1074
|
-
}
|
|
1075
|
-
interface VoiceAgentConfig {
|
|
1076
|
-
sttProvider: STTProvider;
|
|
1077
|
-
ttsProvider: TTSProvider;
|
|
1078
|
-
sttConfig?: STTConfig;
|
|
1079
|
-
ttsConfig?: TTSConfig;
|
|
1080
|
-
autoSpeak?: boolean;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
827
|
declare class VoiceAgent {
|
|
1084
828
|
private agent;
|
|
1085
829
|
private sttProvider;
|
|
@@ -1115,9 +859,13 @@ declare class VoiceAgent {
|
|
|
1115
859
|
};
|
|
1116
860
|
}
|
|
1117
861
|
|
|
862
|
+
interface OpenAIWhisperConfig {
|
|
863
|
+
apiKey?: string;
|
|
864
|
+
baseURL?: string;
|
|
865
|
+
}
|
|
1118
866
|
declare class OpenAIWhisperProvider implements STTProvider {
|
|
1119
867
|
private client;
|
|
1120
|
-
constructor(
|
|
868
|
+
constructor(config?: string | OpenAIWhisperConfig);
|
|
1121
869
|
transcribe(audio: Buffer | string, config?: STTConfig): Promise<STTResult>;
|
|
1122
870
|
supportsStreaming(): boolean;
|
|
1123
871
|
getSupportedLanguages(): string[];
|
|
@@ -1137,9 +885,17 @@ declare class LocalWhisperProvider implements STTProvider {
|
|
|
1137
885
|
getInstallInstructions(): string;
|
|
1138
886
|
}
|
|
1139
887
|
|
|
888
|
+
declare class LemonFoxSTTProvider extends OpenAIWhisperProvider {
|
|
889
|
+
constructor(apiKey?: string);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
interface OpenAITTSConfig {
|
|
893
|
+
apiKey?: string;
|
|
894
|
+
baseURL?: string;
|
|
895
|
+
}
|
|
1140
896
|
declare class OpenAITTSProvider implements TTSProvider {
|
|
1141
897
|
private client;
|
|
1142
|
-
constructor(
|
|
898
|
+
constructor(config?: string | OpenAITTSConfig);
|
|
1143
899
|
synthesize(text: string, config?: TTSConfig): Promise<TTSResult>;
|
|
1144
900
|
synthesizeStream(text: string, config?: TTSConfig): AsyncIterable<Buffer>;
|
|
1145
901
|
supportsStreaming(): boolean;
|
|
@@ -1195,76 +951,16 @@ declare class PiperTTSProvider implements TTSProvider {
|
|
|
1195
951
|
}>>;
|
|
1196
952
|
}
|
|
1197
953
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
declare enum TenantStatus {
|
|
1209
|
-
ACTIVE = "active",
|
|
1210
|
-
SUSPENDED = "suspended",
|
|
1211
|
-
INACTIVE = "inactive"
|
|
1212
|
-
}
|
|
1213
|
-
interface TenantSettings {
|
|
1214
|
-
maxAgents?: number;
|
|
1215
|
-
maxConversations?: number;
|
|
1216
|
-
rateLimit?: number;
|
|
1217
|
-
dataRetentionDays?: number;
|
|
1218
|
-
allowedProviders?: string[];
|
|
1219
|
-
custom?: Record<string, unknown>;
|
|
1220
|
-
}
|
|
1221
|
-
interface TenantContext {
|
|
1222
|
-
tenant: Tenant;
|
|
1223
|
-
userId?: string;
|
|
1224
|
-
metadata?: Record<string, unknown>;
|
|
1225
|
-
}
|
|
1226
|
-
interface TenantApiKey {
|
|
1227
|
-
id: string;
|
|
1228
|
-
tenantId: string;
|
|
1229
|
-
key: string;
|
|
1230
|
-
name: string;
|
|
1231
|
-
scopes: string[];
|
|
1232
|
-
expiresAt?: Date;
|
|
1233
|
-
createdAt: Date;
|
|
1234
|
-
lastUsedAt?: Date;
|
|
1235
|
-
isActive: boolean;
|
|
1236
|
-
}
|
|
1237
|
-
interface TenantQuota {
|
|
1238
|
-
tenantId: string;
|
|
1239
|
-
resource: string;
|
|
1240
|
-
used: number;
|
|
1241
|
-
limit: number;
|
|
1242
|
-
period: 'hourly' | 'daily' | 'monthly';
|
|
1243
|
-
periodStart: Date;
|
|
1244
|
-
periodEnd: Date;
|
|
1245
|
-
}
|
|
1246
|
-
interface TenantStorage {
|
|
1247
|
-
createTenant(tenant: Omit<Tenant, 'id' | 'createdAt' | 'updatedAt'>): Promise<Tenant>;
|
|
1248
|
-
getTenant(tenantId: string): Promise<Tenant | null>;
|
|
1249
|
-
getTenantBySlug(slug: string): Promise<Tenant | null>;
|
|
1250
|
-
updateTenant(tenantId: string, updates: Partial<Tenant>): Promise<Tenant>;
|
|
1251
|
-
deleteTenant(tenantId: string): Promise<void>;
|
|
1252
|
-
listTenants(options?: {
|
|
1253
|
-
limit?: number;
|
|
1254
|
-
offset?: number;
|
|
1255
|
-
status?: TenantStatus;
|
|
1256
|
-
}): Promise<{
|
|
1257
|
-
tenants: Tenant[];
|
|
1258
|
-
total: number;
|
|
1259
|
-
}>;
|
|
1260
|
-
createApiKey(apiKey: Omit<TenantApiKey, 'id' | 'createdAt'>): Promise<TenantApiKey>;
|
|
1261
|
-
getApiKeyByKey(key: string): Promise<TenantApiKey | null>;
|
|
1262
|
-
revokeApiKey(apiKeyId: string): Promise<void>;
|
|
1263
|
-
updateQuota(quota: TenantQuota): Promise<void>;
|
|
1264
|
-
getQuota(tenantId: string, resource: string, period: string): Promise<TenantQuota | null>;
|
|
1265
|
-
}
|
|
1266
|
-
interface TenantResolver {
|
|
1267
|
-
resolve(context: unknown): Promise<TenantContext | null>;
|
|
954
|
+
declare class LemonFoxTTSProvider extends OpenAITTSProvider {
|
|
955
|
+
constructor(apiKey?: string);
|
|
956
|
+
getVoices(): Promise<Array<{
|
|
957
|
+
id: string;
|
|
958
|
+
name: string;
|
|
959
|
+
language?: string;
|
|
960
|
+
gender?: 'male' | 'female' | 'neutral';
|
|
961
|
+
}>>;
|
|
962
|
+
getModels(): string[];
|
|
963
|
+
getFormats(): AudioFormat[];
|
|
1268
964
|
}
|
|
1269
965
|
|
|
1270
966
|
interface TenantManagerConfig {
|
|
@@ -1343,4 +1039,4 @@ declare class MemoryTenantStorage implements TenantStorage {
|
|
|
1343
1039
|
clear(): void;
|
|
1344
1040
|
}
|
|
1345
1041
|
|
|
1346
|
-
export { type ACPAddress, type ACPCart, type ACPCartItem, type ACPCheckoutSession, ACPClient, type ACPConfig, type ACPCustomer, type ACPDelegatedPaymentConfig, type ACPOrder, type ACPPaginationMeta, type ACPPaymentIntent, type ACPPaymentMethod, type ACPProduct, type ACPProductSearchQuery, type ACPProductSearchResult, type ACPProductVariant, type ACPResponse, type ACPWebhookEvent, Agent,
|
|
1042
|
+
export { type ACPAddress, type ACPCart, type ACPCartItem, type ACPCheckoutSession, ACPClient, type ACPConfig, type ACPCustomer, type ACPDelegatedPaymentConfig, type ACPOrder, type ACPPaginationMeta, type ACPPaymentIntent, type ACPPaymentMethod, type ACPProduct, type ACPProductSearchQuery, type ACPProductSearchResult, type ACPProductVariant, type ACPResponse, type ACPWebhookEvent, Agent, AnthropicProvider, BufferMemory, Cache, ContentFormatter, ConversationManager, ConversationSchema, ConversationSchemaBuilder, type ConversationSchemaConfig, type ConversationState, type ConversationStep, type ConversationTurn, ElevenLabsTTSProvider, GeminiProvider, LMStudioProvider, LRUCache, LemonFoxSTTProvider, LemonFoxTTSProvider, LocalAIProvider, LocalWhisperProvider, type LogLevel, Logger, type LoggerConfig, type MCPCallToolRequest, type MCPCallToolResponse, MCPClient, type MCPListToolsRequest, type MCPListToolsResponse, type MCPMessage, type MCPPrompt, type MCPReadResourceRequest, type MCPReadResourceResponse, MCPRegistry, type MCPResource, type MCPServerCapabilities, type MCPServerConfig, type MCPServerInfo, type MCPTool, type MCPTransport, MemoryTenantStorage, MetricsCollector, OllamaProvider, OpenAICompatibleProvider, OpenAIProvider, type OpenAITTSConfig, OpenAITTSProvider, type OpenAIWhisperConfig, OpenAIWhisperProvider, ParallelWorkflow, PiperTTSProvider, RateLimiter, RedisMemory, SSETransport, SequentialWorkflow, SlidingWindowRateLimiter, type Span, StdioTransport, SummaryMemory, SupervisorWorkflow, TenantBufferMemory, TenantManager, type TenantManagerConfig, TextGenerationWebUIProvider, ToolRegistry, Tracer, VLLMProvider, VoiceAgent, Workflow, WorkflowFactory, calculatorTool, createACPTools, defaultLogger, figmaGetCommentsTool, figmaGetFileTool, figmaGetImagesTool, figmaGetNodesTool, figmaPostCommentTool, fileListTool, fileReadTool, fileWriteTool, globalMetrics, globalTracer, httpRequestTool, mcpToolToAgenticTool, n8nExecuteWorkflowTool, n8nGetExecutionTool, n8nGetWorkflowTool, n8nListWorkflowsTool, n8nTriggerWebhookTool, stringTransformTool, textSummaryTool };
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -33,6 +34,7 @@ __export(index_exports, {
|
|
|
33
34
|
ACPClient: () => ACPClient,
|
|
34
35
|
Agent: () => Agent,
|
|
35
36
|
AnthropicProvider: () => AnthropicProvider,
|
|
37
|
+
AudioFormat: () => import_agentsea_types.AudioFormat,
|
|
36
38
|
BufferMemory: () => BufferMemory,
|
|
37
39
|
Cache: () => Cache,
|
|
38
40
|
ContentFormatter: () => ContentFormatter,
|
|
@@ -43,6 +45,8 @@ __export(index_exports, {
|
|
|
43
45
|
GeminiProvider: () => GeminiProvider,
|
|
44
46
|
LMStudioProvider: () => LMStudioProvider,
|
|
45
47
|
LRUCache: () => LRUCache,
|
|
48
|
+
LemonFoxSTTProvider: () => LemonFoxSTTProvider,
|
|
49
|
+
LemonFoxTTSProvider: () => LemonFoxTTSProvider,
|
|
46
50
|
LocalAIProvider: () => LocalAIProvider,
|
|
47
51
|
LocalWhisperProvider: () => LocalWhisperProvider,
|
|
48
52
|
Logger: () => Logger,
|
|
@@ -60,19 +64,35 @@ __export(index_exports, {
|
|
|
60
64
|
RateLimiter: () => RateLimiter,
|
|
61
65
|
RedisMemory: () => RedisMemory,
|
|
62
66
|
SSETransport: () => SSETransport,
|
|
67
|
+
STTConfig: () => import_agentsea_types.STTConfig,
|
|
68
|
+
STTProvider: () => import_agentsea_types.STTProvider,
|
|
69
|
+
STTResult: () => import_agentsea_types.STTResult,
|
|
63
70
|
SequentialWorkflow: () => SequentialWorkflow,
|
|
64
71
|
SlidingWindowRateLimiter: () => SlidingWindowRateLimiter,
|
|
65
72
|
StdioTransport: () => StdioTransport,
|
|
66
73
|
SummaryMemory: () => SummaryMemory,
|
|
67
74
|
SupervisorWorkflow: () => SupervisorWorkflow,
|
|
75
|
+
TTSConfig: () => import_agentsea_types.TTSConfig,
|
|
76
|
+
TTSProvider: () => import_agentsea_types.TTSProvider,
|
|
77
|
+
TTSResult: () => import_agentsea_types.TTSResult,
|
|
78
|
+
Tenant: () => import_agentsea_types2.Tenant,
|
|
79
|
+
TenantApiKey: () => import_agentsea_types2.TenantApiKey,
|
|
68
80
|
TenantBufferMemory: () => TenantBufferMemory,
|
|
81
|
+
TenantContext: () => import_agentsea_types2.TenantContext,
|
|
69
82
|
TenantManager: () => TenantManager,
|
|
70
|
-
|
|
83
|
+
TenantQuota: () => import_agentsea_types2.TenantQuota,
|
|
84
|
+
TenantResolver: () => import_agentsea_types2.TenantResolver,
|
|
85
|
+
TenantSettings: () => import_agentsea_types2.TenantSettings,
|
|
86
|
+
TenantStatus: () => import_agentsea_types2.TenantStatus,
|
|
87
|
+
TenantStorage: () => import_agentsea_types2.TenantStorage,
|
|
71
88
|
TextGenerationWebUIProvider: () => TextGenerationWebUIProvider,
|
|
72
89
|
ToolRegistry: () => ToolRegistry,
|
|
73
90
|
Tracer: () => Tracer,
|
|
74
91
|
VLLMProvider: () => VLLMProvider,
|
|
75
92
|
VoiceAgent: () => VoiceAgent,
|
|
93
|
+
VoiceAgentConfig: () => import_agentsea_types.VoiceAgentConfig,
|
|
94
|
+
VoiceMessage: () => import_agentsea_types.VoiceMessage,
|
|
95
|
+
VoiceType: () => import_agentsea_types.VoiceType,
|
|
76
96
|
Workflow: () => Workflow,
|
|
77
97
|
WorkflowFactory: () => WorkflowFactory,
|
|
78
98
|
calculatorTool: () => calculatorTool,
|
|
@@ -100,6 +120,13 @@ __export(index_exports, {
|
|
|
100
120
|
});
|
|
101
121
|
module.exports = __toCommonJS(index_exports);
|
|
102
122
|
|
|
123
|
+
// src/types/index.ts
|
|
124
|
+
var types_exports = {};
|
|
125
|
+
__reExport(types_exports, require("@lov3kaizen/agentsea-types"));
|
|
126
|
+
|
|
127
|
+
// src/index.ts
|
|
128
|
+
__reExport(index_exports, types_exports, module.exports);
|
|
129
|
+
|
|
103
130
|
// src/formatters/content-formatter.ts
|
|
104
131
|
var import_marked = require("marked");
|
|
105
132
|
var ContentFormatter = class {
|
|
@@ -4887,6 +4914,9 @@ Respond naturally while ensuring you gather the required information.`;
|
|
|
4887
4914
|
}
|
|
4888
4915
|
};
|
|
4889
4916
|
|
|
4917
|
+
// src/types/voice.ts
|
|
4918
|
+
var import_agentsea_types = require("@lov3kaizen/agentsea-types");
|
|
4919
|
+
|
|
4890
4920
|
// src/voice/voice-agent.ts
|
|
4891
4921
|
var import_fs2 = require("fs");
|
|
4892
4922
|
var import_path2 = require("path");
|
|
@@ -5095,9 +5125,15 @@ var import_fs3 = require("fs");
|
|
|
5095
5125
|
var import_openai3 = __toESM(require("openai"));
|
|
5096
5126
|
var OpenAIWhisperProvider = class {
|
|
5097
5127
|
client;
|
|
5098
|
-
|
|
5128
|
+
/**
|
|
5129
|
+
* Create an OpenAI Whisper provider
|
|
5130
|
+
* @param config - Configuration object or API key string (for backward compatibility)
|
|
5131
|
+
*/
|
|
5132
|
+
constructor(config) {
|
|
5133
|
+
const resolvedConfig = typeof config === "string" ? { apiKey: config } : config || {};
|
|
5099
5134
|
this.client = new import_openai3.default({
|
|
5100
|
-
apiKey: apiKey || process.env.OPENAI_API_KEY
|
|
5135
|
+
apiKey: resolvedConfig.apiKey || process.env.OPENAI_API_KEY,
|
|
5136
|
+
baseURL: resolvedConfig.baseURL
|
|
5101
5137
|
});
|
|
5102
5138
|
}
|
|
5103
5139
|
/**
|
|
@@ -5107,7 +5143,7 @@ var OpenAIWhisperProvider = class {
|
|
|
5107
5143
|
try {
|
|
5108
5144
|
let audioFile;
|
|
5109
5145
|
if (Buffer.isBuffer(audio)) {
|
|
5110
|
-
audioFile =
|
|
5146
|
+
audioFile = await (0, import_openai3.toFile)(audio, "audio.mp3", { type: "audio/mpeg" });
|
|
5111
5147
|
} else if (typeof audio === "string") {
|
|
5112
5148
|
audioFile = (0, import_fs3.createReadStream)(audio);
|
|
5113
5149
|
} else {
|
|
@@ -5375,13 +5411,34 @@ Then configure the provider with the correct path.
|
|
|
5375
5411
|
}
|
|
5376
5412
|
};
|
|
5377
5413
|
|
|
5414
|
+
// src/voice/stt/lemonfox-stt.ts
|
|
5415
|
+
var LEMONFOX_BASE_URL = "https://api.lemonfox.ai/v1";
|
|
5416
|
+
var LemonFoxSTTProvider = class extends OpenAIWhisperProvider {
|
|
5417
|
+
/**
|
|
5418
|
+
* Create a LemonFox STT provider
|
|
5419
|
+
* @param apiKey - LemonFox API key (defaults to LEMONFOX_API_KEY env var)
|
|
5420
|
+
*/
|
|
5421
|
+
constructor(apiKey) {
|
|
5422
|
+
super({
|
|
5423
|
+
apiKey: apiKey || process.env.LEMONFOX_API_KEY,
|
|
5424
|
+
baseURL: LEMONFOX_BASE_URL
|
|
5425
|
+
});
|
|
5426
|
+
}
|
|
5427
|
+
};
|
|
5428
|
+
|
|
5378
5429
|
// src/voice/tts/openai-tts.ts
|
|
5379
5430
|
var import_openai4 = __toESM(require("openai"));
|
|
5380
5431
|
var OpenAITTSProvider = class {
|
|
5381
5432
|
client;
|
|
5382
|
-
|
|
5433
|
+
/**
|
|
5434
|
+
* Create an OpenAI TTS provider
|
|
5435
|
+
* @param config - Configuration object or API key string (for backward compatibility)
|
|
5436
|
+
*/
|
|
5437
|
+
constructor(config) {
|
|
5438
|
+
const resolvedConfig = typeof config === "string" ? { apiKey: config } : config || {};
|
|
5383
5439
|
this.client = new import_openai4.default({
|
|
5384
|
-
apiKey: apiKey || process.env.OPENAI_API_KEY
|
|
5440
|
+
apiKey: resolvedConfig.apiKey || process.env.OPENAI_API_KEY,
|
|
5441
|
+
baseURL: resolvedConfig.baseURL
|
|
5385
5442
|
});
|
|
5386
5443
|
}
|
|
5387
5444
|
/**
|
|
@@ -5762,16 +5819,58 @@ Example:
|
|
|
5762
5819
|
}
|
|
5763
5820
|
};
|
|
5764
5821
|
|
|
5822
|
+
// src/voice/tts/lemonfox-tts.ts
|
|
5823
|
+
var LEMONFOX_BASE_URL2 = "https://api.lemonfox.ai/v1";
|
|
5824
|
+
var LemonFoxTTSProvider = class extends OpenAITTSProvider {
|
|
5825
|
+
/**
|
|
5826
|
+
* Create a LemonFox TTS provider
|
|
5827
|
+
* @param apiKey - LemonFox API key (defaults to LEMONFOX_API_KEY env var)
|
|
5828
|
+
*/
|
|
5829
|
+
constructor(apiKey) {
|
|
5830
|
+
super({
|
|
5831
|
+
apiKey: apiKey || process.env.LEMONFOX_API_KEY,
|
|
5832
|
+
baseURL: LEMONFOX_BASE_URL2
|
|
5833
|
+
});
|
|
5834
|
+
}
|
|
5835
|
+
/**
|
|
5836
|
+
* Get available LemonFox voices
|
|
5837
|
+
*
|
|
5838
|
+
* LemonFox offers 50+ voices across 8 languages.
|
|
5839
|
+
* This returns a sample of common voices; the full list is available at:
|
|
5840
|
+
* https://lemonfox.ai/docs
|
|
5841
|
+
*/
|
|
5842
|
+
getVoices() {
|
|
5843
|
+
return Promise.resolve([
|
|
5844
|
+
// OpenAI-compatible voices
|
|
5845
|
+
{ id: "alloy", name: "Alloy", gender: "neutral" },
|
|
5846
|
+
{ id: "echo", name: "Echo", gender: "male" },
|
|
5847
|
+
{ id: "fable", name: "Fable", gender: "neutral" },
|
|
5848
|
+
{ id: "onyx", name: "Onyx", gender: "male" },
|
|
5849
|
+
{ id: "nova", name: "Nova", gender: "female" },
|
|
5850
|
+
{ id: "shimmer", name: "Shimmer", gender: "female" },
|
|
5851
|
+
// LemonFox-specific voices (sample)
|
|
5852
|
+
{ id: "sarah", name: "Sarah", gender: "female" }
|
|
5853
|
+
]);
|
|
5854
|
+
}
|
|
5855
|
+
/**
|
|
5856
|
+
* Get available models
|
|
5857
|
+
*/
|
|
5858
|
+
getModels() {
|
|
5859
|
+
return ["tts-1"];
|
|
5860
|
+
}
|
|
5861
|
+
/**
|
|
5862
|
+
* Get supported formats
|
|
5863
|
+
*/
|
|
5864
|
+
getFormats() {
|
|
5865
|
+
return ["mp3", "opus", "aac", "flac", "wav", "pcm"];
|
|
5866
|
+
}
|
|
5867
|
+
};
|
|
5868
|
+
|
|
5765
5869
|
// src/tenant/tenant-manager.ts
|
|
5766
5870
|
var import_crypto2 = require("crypto");
|
|
5767
5871
|
|
|
5768
5872
|
// src/types/tenant.ts
|
|
5769
|
-
var
|
|
5770
|
-
TenantStatus2["ACTIVE"] = "active";
|
|
5771
|
-
TenantStatus2["SUSPENDED"] = "suspended";
|
|
5772
|
-
TenantStatus2["INACTIVE"] = "inactive";
|
|
5773
|
-
return TenantStatus2;
|
|
5774
|
-
})(TenantStatus || {});
|
|
5873
|
+
var import_agentsea_types2 = require("@lov3kaizen/agentsea-types");
|
|
5775
5874
|
|
|
5776
5875
|
// src/tenant/tenant-manager.ts
|
|
5777
5876
|
var TenantManager = class {
|
|
@@ -5800,7 +5899,7 @@ var TenantManager = class {
|
|
|
5800
5899
|
slug: data.slug,
|
|
5801
5900
|
metadata: data.metadata,
|
|
5802
5901
|
settings: { ...this.defaultSettings, ...data.settings },
|
|
5803
|
-
status:
|
|
5902
|
+
status: import_agentsea_types2.TenantStatus.ACTIVE
|
|
5804
5903
|
});
|
|
5805
5904
|
return tenant;
|
|
5806
5905
|
}
|
|
@@ -5830,13 +5929,13 @@ var TenantManager = class {
|
|
|
5830
5929
|
* Suspend tenant
|
|
5831
5930
|
*/
|
|
5832
5931
|
async suspendTenant(tenantId) {
|
|
5833
|
-
return this.updateTenant(tenantId, { status:
|
|
5932
|
+
return this.updateTenant(tenantId, { status: import_agentsea_types2.TenantStatus.SUSPENDED });
|
|
5834
5933
|
}
|
|
5835
5934
|
/**
|
|
5836
5935
|
* Activate tenant
|
|
5837
5936
|
*/
|
|
5838
5937
|
async activateTenant(tenantId) {
|
|
5839
|
-
return this.updateTenant(tenantId, { status:
|
|
5938
|
+
return this.updateTenant(tenantId, { status: import_agentsea_types2.TenantStatus.ACTIVE });
|
|
5840
5939
|
}
|
|
5841
5940
|
/**
|
|
5842
5941
|
* Delete tenant and all associated data
|
|
@@ -5886,7 +5985,7 @@ var TenantManager = class {
|
|
|
5886
5985
|
return null;
|
|
5887
5986
|
}
|
|
5888
5987
|
const tenant = await this.storage.getTenant(apiKey.tenantId);
|
|
5889
|
-
if (!tenant || tenant.status !==
|
|
5988
|
+
if (!tenant || tenant.status !== import_agentsea_types2.TenantStatus.ACTIVE) {
|
|
5890
5989
|
return null;
|
|
5891
5990
|
}
|
|
5892
5991
|
return tenant;
|
|
@@ -6100,6 +6199,7 @@ var MemoryTenantStorage = class {
|
|
|
6100
6199
|
ACPClient,
|
|
6101
6200
|
Agent,
|
|
6102
6201
|
AnthropicProvider,
|
|
6202
|
+
AudioFormat,
|
|
6103
6203
|
BufferMemory,
|
|
6104
6204
|
Cache,
|
|
6105
6205
|
ContentFormatter,
|
|
@@ -6110,6 +6210,8 @@ var MemoryTenantStorage = class {
|
|
|
6110
6210
|
GeminiProvider,
|
|
6111
6211
|
LMStudioProvider,
|
|
6112
6212
|
LRUCache,
|
|
6213
|
+
LemonFoxSTTProvider,
|
|
6214
|
+
LemonFoxTTSProvider,
|
|
6113
6215
|
LocalAIProvider,
|
|
6114
6216
|
LocalWhisperProvider,
|
|
6115
6217
|
Logger,
|
|
@@ -6127,19 +6229,35 @@ var MemoryTenantStorage = class {
|
|
|
6127
6229
|
RateLimiter,
|
|
6128
6230
|
RedisMemory,
|
|
6129
6231
|
SSETransport,
|
|
6232
|
+
STTConfig,
|
|
6233
|
+
STTProvider,
|
|
6234
|
+
STTResult,
|
|
6130
6235
|
SequentialWorkflow,
|
|
6131
6236
|
SlidingWindowRateLimiter,
|
|
6132
6237
|
StdioTransport,
|
|
6133
6238
|
SummaryMemory,
|
|
6134
6239
|
SupervisorWorkflow,
|
|
6240
|
+
TTSConfig,
|
|
6241
|
+
TTSProvider,
|
|
6242
|
+
TTSResult,
|
|
6243
|
+
Tenant,
|
|
6244
|
+
TenantApiKey,
|
|
6135
6245
|
TenantBufferMemory,
|
|
6246
|
+
TenantContext,
|
|
6136
6247
|
TenantManager,
|
|
6248
|
+
TenantQuota,
|
|
6249
|
+
TenantResolver,
|
|
6250
|
+
TenantSettings,
|
|
6137
6251
|
TenantStatus,
|
|
6252
|
+
TenantStorage,
|
|
6138
6253
|
TextGenerationWebUIProvider,
|
|
6139
6254
|
ToolRegistry,
|
|
6140
6255
|
Tracer,
|
|
6141
6256
|
VLLMProvider,
|
|
6142
6257
|
VoiceAgent,
|
|
6258
|
+
VoiceAgentConfig,
|
|
6259
|
+
VoiceMessage,
|
|
6260
|
+
VoiceType,
|
|
6143
6261
|
Workflow,
|
|
6144
6262
|
WorkflowFactory,
|
|
6145
6263
|
calculatorTool,
|