@nuvin/nuvin-core 1.0.0 → 1.1.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/dist/VERSION +2 -2
- package/dist/index.d.ts +26 -181
- package/dist/index.js +302 -686
- package/package.json +1 -1
package/dist/VERSION
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -290,6 +290,7 @@ type Message = {
|
|
|
290
290
|
tool_calls?: ToolCall[];
|
|
291
291
|
tool_call_id?: string;
|
|
292
292
|
name?: string;
|
|
293
|
+
usage?: UsageData;
|
|
293
294
|
};
|
|
294
295
|
type MessageResponse = {
|
|
295
296
|
id: string;
|
|
@@ -439,7 +440,6 @@ declare const AgentEventTypes: {
|
|
|
439
440
|
readonly AssistantChunk: "assistant_chunk";
|
|
440
441
|
readonly AssistantMessage: "assistant_message";
|
|
441
442
|
readonly StreamFinish: "stream_finish";
|
|
442
|
-
readonly MemoryAppended: "memory_appended";
|
|
443
443
|
readonly Done: "done";
|
|
444
444
|
readonly Error: "error";
|
|
445
445
|
readonly MCPStderr: "mcp_stderr";
|
|
@@ -461,6 +461,7 @@ type AgentEvent = {
|
|
|
461
461
|
conversationId: string;
|
|
462
462
|
messageId: string;
|
|
463
463
|
toolCalls: ToolCall[];
|
|
464
|
+
usage?: UsageData;
|
|
464
465
|
} | {
|
|
465
466
|
type: typeof AgentEventTypes.ToolApprovalRequired;
|
|
466
467
|
conversationId: string;
|
|
@@ -497,10 +498,6 @@ type AgentEvent = {
|
|
|
497
498
|
messageId: string;
|
|
498
499
|
finishReason?: string;
|
|
499
500
|
usage?: UsageData;
|
|
500
|
-
} | {
|
|
501
|
-
type: typeof AgentEventTypes.MemoryAppended;
|
|
502
|
-
conversationId: string;
|
|
503
|
-
delta: Message[];
|
|
504
501
|
} | {
|
|
505
502
|
type: typeof AgentEventTypes.Done;
|
|
506
503
|
conversationId: string;
|
|
@@ -799,7 +796,7 @@ declare class SystemClock implements Clock {
|
|
|
799
796
|
}
|
|
800
797
|
|
|
801
798
|
declare class SimpleCost implements CostCalculator {
|
|
802
|
-
estimate(_model: string,
|
|
799
|
+
estimate(_model: string, usage?: UsageData): number | undefined;
|
|
803
800
|
}
|
|
804
801
|
|
|
805
802
|
declare class NoopReminders implements RemindersPort {
|
|
@@ -1088,12 +1085,6 @@ declare class BashTool implements FunctionTool<BashParams, ToolExecutionContext>
|
|
|
1088
1085
|
private shellArgs;
|
|
1089
1086
|
}
|
|
1090
1087
|
|
|
1091
|
-
declare class EchoLLM implements LLMPort {
|
|
1092
|
-
generateCompletion(params: CompletionParams): Promise<CompletionResult>;
|
|
1093
|
-
private hasTool;
|
|
1094
|
-
private id;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
1088
|
type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
1098
1089
|
type LogFormat = 'json' | 'structured';
|
|
1099
1090
|
type PersistOptions = {
|
|
@@ -1151,42 +1142,6 @@ declare class GithubAuthTransport implements HttpTransport {
|
|
|
1151
1142
|
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1152
1143
|
}
|
|
1153
1144
|
|
|
1154
|
-
declare class OpenRouterAuthTransport implements HttpTransport {
|
|
1155
|
-
private readonly inner;
|
|
1156
|
-
private readonly apiKey?;
|
|
1157
|
-
private readonly baseUrl;
|
|
1158
|
-
constructor(inner: FetchTransport, apiKey?: string, baseUrl?: string);
|
|
1159
|
-
private buildFullUrl;
|
|
1160
|
-
private makeAuthHeaders;
|
|
1161
|
-
get(url: string, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1162
|
-
postJson(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1163
|
-
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
declare class DeepInfraAuthTransport implements HttpTransport {
|
|
1167
|
-
private readonly inner;
|
|
1168
|
-
private readonly apiKey?;
|
|
1169
|
-
private readonly baseUrl;
|
|
1170
|
-
constructor(inner: FetchTransport, apiKey?: string, baseUrl?: string);
|
|
1171
|
-
private buildFullUrl;
|
|
1172
|
-
private makeAuthHeaders;
|
|
1173
|
-
get(url: string, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1174
|
-
postJson(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1175
|
-
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
declare class ZAIAuthTransport implements HttpTransport {
|
|
1179
|
-
private readonly inner;
|
|
1180
|
-
private readonly apiKey?;
|
|
1181
|
-
private readonly baseUrl;
|
|
1182
|
-
constructor(inner: FetchTransport, apiKey?: string, baseUrl?: string);
|
|
1183
|
-
private buildFullUrl;
|
|
1184
|
-
private makeAuthHeaders;
|
|
1185
|
-
get(url: string, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1186
|
-
postJson(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1187
|
-
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
1145
|
declare class LLMError extends Error {
|
|
1191
1146
|
readonly statusCode?: number;
|
|
1192
1147
|
readonly isRetryable: boolean;
|
|
@@ -1222,138 +1177,6 @@ declare class GithubLLM extends BaseLLM implements LLMPort {
|
|
|
1222
1177
|
protected createTransport(): GithubAuthTransport;
|
|
1223
1178
|
}
|
|
1224
1179
|
|
|
1225
|
-
type OpenRouterOptions = {
|
|
1226
|
-
apiKey?: string;
|
|
1227
|
-
apiUrl?: string;
|
|
1228
|
-
httpLogFile?: string;
|
|
1229
|
-
enablePromptCaching?: boolean;
|
|
1230
|
-
includeUsage?: boolean;
|
|
1231
|
-
};
|
|
1232
|
-
type OpenRouterModel = {
|
|
1233
|
-
id: string;
|
|
1234
|
-
canonical_slug: string;
|
|
1235
|
-
hugging_face_id: string;
|
|
1236
|
-
name: string;
|
|
1237
|
-
created: number;
|
|
1238
|
-
description: string;
|
|
1239
|
-
context_length: number;
|
|
1240
|
-
architecture: {
|
|
1241
|
-
modality: string;
|
|
1242
|
-
input_modalities: string[];
|
|
1243
|
-
output_modalities: string[];
|
|
1244
|
-
tokenizer: string;
|
|
1245
|
-
instruct_type: string | null;
|
|
1246
|
-
};
|
|
1247
|
-
pricing: {
|
|
1248
|
-
prompt: string;
|
|
1249
|
-
completion: string;
|
|
1250
|
-
request: string;
|
|
1251
|
-
image: string;
|
|
1252
|
-
web_search: string;
|
|
1253
|
-
internal_reasoning: string;
|
|
1254
|
-
input_cache_read: string;
|
|
1255
|
-
};
|
|
1256
|
-
top_provider: {
|
|
1257
|
-
context_length: number;
|
|
1258
|
-
max_completion_tokens: number | null;
|
|
1259
|
-
is_moderated: boolean;
|
|
1260
|
-
};
|
|
1261
|
-
per_request_limits: {
|
|
1262
|
-
prompt_tokens: string;
|
|
1263
|
-
completion_tokens: string;
|
|
1264
|
-
} | null;
|
|
1265
|
-
supported_parameters: string[];
|
|
1266
|
-
default_parameters: {
|
|
1267
|
-
temperature: number | null;
|
|
1268
|
-
top_p: number | null;
|
|
1269
|
-
frequency_penalty: number | null;
|
|
1270
|
-
};
|
|
1271
|
-
};
|
|
1272
|
-
declare class OpenRouterLLM extends BaseLLM implements LLMPort {
|
|
1273
|
-
private readonly includeUsage;
|
|
1274
|
-
constructor(opts?: OpenRouterOptions);
|
|
1275
|
-
private readonly opts;
|
|
1276
|
-
protected createTransport(): OpenRouterAuthTransport;
|
|
1277
|
-
generateCompletion(params: CompletionParams, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1278
|
-
streamCompletion(params: CompletionParams, handlers?: {
|
|
1279
|
-
onChunk?: (delta: string, usage?: UsageData) => void;
|
|
1280
|
-
onToolCallDelta?: (tc: ToolCall) => void;
|
|
1281
|
-
onStreamFinish?: (finishReason?: string, usage?: UsageData) => void;
|
|
1282
|
-
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1283
|
-
getModels(signal?: AbortSignal): Promise<OpenRouterModel[]>;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
type DeepInfraOptions = {
|
|
1287
|
-
apiKey?: string;
|
|
1288
|
-
apiUrl?: string;
|
|
1289
|
-
httpLogFile?: string;
|
|
1290
|
-
};
|
|
1291
|
-
type DeepInfraModel = {
|
|
1292
|
-
id: string;
|
|
1293
|
-
object: string;
|
|
1294
|
-
created: number;
|
|
1295
|
-
owned_by: string;
|
|
1296
|
-
root: string;
|
|
1297
|
-
parent: string | null;
|
|
1298
|
-
metadata: {
|
|
1299
|
-
description: string;
|
|
1300
|
-
context_length: number;
|
|
1301
|
-
max_tokens: number;
|
|
1302
|
-
pricing: {
|
|
1303
|
-
input_tokens: number;
|
|
1304
|
-
output_tokens: number;
|
|
1305
|
-
cache_read_tokens?: number;
|
|
1306
|
-
};
|
|
1307
|
-
tags: string[];
|
|
1308
|
-
};
|
|
1309
|
-
};
|
|
1310
|
-
declare class DeepInfraLLM extends BaseLLM implements LLMPort {
|
|
1311
|
-
private readonly opts;
|
|
1312
|
-
constructor(opts?: DeepInfraOptions);
|
|
1313
|
-
protected createTransport(): DeepInfraAuthTransport;
|
|
1314
|
-
getModels(signal?: AbortSignal): Promise<DeepInfraModel[]>;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
type ZaiOptions = {
|
|
1318
|
-
apiKey?: string;
|
|
1319
|
-
apiUrl?: string;
|
|
1320
|
-
httpLogFile?: string;
|
|
1321
|
-
};
|
|
1322
|
-
declare class ZaiLLM extends BaseLLM implements LLMPort {
|
|
1323
|
-
private readonly opts;
|
|
1324
|
-
constructor(opts?: ZaiOptions);
|
|
1325
|
-
protected createTransport(): ZAIAuthTransport;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
type AnthropicOptions = {
|
|
1329
|
-
apiKey?: string;
|
|
1330
|
-
oauth?: {
|
|
1331
|
-
type: 'oauth';
|
|
1332
|
-
access: string;
|
|
1333
|
-
refresh: string;
|
|
1334
|
-
expires: number;
|
|
1335
|
-
};
|
|
1336
|
-
apiUrl?: string;
|
|
1337
|
-
httpLogFile?: string;
|
|
1338
|
-
};
|
|
1339
|
-
declare class AnthropicLLM {
|
|
1340
|
-
private transport;
|
|
1341
|
-
private readonly opts;
|
|
1342
|
-
private readonly apiUrl;
|
|
1343
|
-
constructor(opts?: AnthropicOptions);
|
|
1344
|
-
private getTransport;
|
|
1345
|
-
private transformToAnthropicMessages;
|
|
1346
|
-
private transformTools;
|
|
1347
|
-
private transformToolChoice;
|
|
1348
|
-
private transformResponse;
|
|
1349
|
-
generateCompletion(params: CompletionParams, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1350
|
-
streamCompletion(params: CompletionParams, handlers?: {
|
|
1351
|
-
onChunk?: (delta: string, usage?: UsageData) => void;
|
|
1352
|
-
onToolCallDelta?: (tc: ToolCall) => void;
|
|
1353
|
-
onStreamFinish?: (finishReason?: string, usage?: UsageData) => void;
|
|
1354
|
-
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
1180
|
type AnthropicAISDKOptions = {
|
|
1358
1181
|
apiKey?: string;
|
|
1359
1182
|
oauth?: {
|
|
@@ -1394,6 +1217,28 @@ declare class AnthropicAISDKLLM {
|
|
|
1394
1217
|
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1395
1218
|
}
|
|
1396
1219
|
|
|
1220
|
+
type ModelConfig = false | true | string | string[] | Array<{
|
|
1221
|
+
id: string;
|
|
1222
|
+
name?: string;
|
|
1223
|
+
[key: string]: unknown;
|
|
1224
|
+
}>;
|
|
1225
|
+
interface LLMOptions {
|
|
1226
|
+
apiKey?: string;
|
|
1227
|
+
apiUrl?: string;
|
|
1228
|
+
httpLogFile?: string;
|
|
1229
|
+
enablePromptCaching?: boolean;
|
|
1230
|
+
includeUsage?: boolean;
|
|
1231
|
+
version?: string;
|
|
1232
|
+
}
|
|
1233
|
+
interface CustomProviderDefinition {
|
|
1234
|
+
type?: 'openai-compat' | 'anthropic';
|
|
1235
|
+
baseUrl?: string;
|
|
1236
|
+
models?: ModelConfig;
|
|
1237
|
+
}
|
|
1238
|
+
declare function createLLM(providerName: string, options?: LLMOptions, customProviders?: Record<string, CustomProviderDefinition>): LLMPort;
|
|
1239
|
+
declare function getAvailableProviders(customProviders?: Record<string, CustomProviderDefinition>): string[];
|
|
1240
|
+
declare function supportsGetModels(providerName: string, customProviders?: Record<string, CustomProviderDefinition>): boolean;
|
|
1241
|
+
|
|
1397
1242
|
type MCPHttpOptions = {
|
|
1398
1243
|
type: 'http';
|
|
1399
1244
|
url: string;
|
|
@@ -1483,4 +1328,4 @@ declare function resolveBackspaces(s: string): string;
|
|
|
1483
1328
|
declare function stripAnsiAndControls(s: string): string;
|
|
1484
1329
|
declare function canonicalizeTerminalPaste(raw: string): string;
|
|
1485
1330
|
|
|
1486
|
-
export { AGENT_CREATOR_SYSTEM_PROMPT, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM,
|
|
1331
|
+
export { AGENT_CREATOR_SYSTEM_PROMPT, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM, type AssignParams, BashTool, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type FolderTreeOptions, GithubLLM, InMemoryMemory, InMemoryMetadata, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type MCPConfig, type MCPServerConfig, MCPToolPort, type MemoryPort, MemoryPortMetadataAdapter, type Message, type MessageContent, type MessageContentPart, type MetadataPort, NoopReminders, type OrchestratorAwareToolPort, PersistedMemory, PersistingConsoleEventPort, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SpecialistAgentConfig, type SpecialistAgentResult, SystemClock, type ToolApprovalDecision, type ToolCall, type ToolExecutionResult, type ToolPort, ToolRegistry, type UserAttachment, type UserMessagePayload, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, createLLM, generateFolderTree, getAvailableProviders, loadMCPConfig, normalizeNewlines, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels };
|