@nuvin/nuvin-core 1.3.2 → 1.4.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/VERSION +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +37 -18
- package/package.json +1 -1
package/dist/VERSION
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1375,6 +1375,7 @@ interface CustomProviderDefinition {
|
|
|
1375
1375
|
declare function createLLM(providerName: string, options?: LLMOptions, customProviders?: Record<string, CustomProviderDefinition>): LLMPort;
|
|
1376
1376
|
declare function getAvailableProviders(customProviders?: Record<string, CustomProviderDefinition>): string[];
|
|
1377
1377
|
declare function supportsGetModels(providerName: string, customProviders?: Record<string, CustomProviderDefinition>): boolean;
|
|
1378
|
+
declare function getProviderLabel(providerKey: string, customProviders?: Record<string, CustomProviderDefinition>): string | undefined;
|
|
1378
1379
|
|
|
1379
1380
|
type MCPHttpOptions = {
|
|
1380
1381
|
type: 'http';
|
|
@@ -1466,4 +1467,4 @@ declare function resolveBackspaces(s: string): string;
|
|
|
1466
1467
|
declare function stripAnsiAndControls(s: string): string;
|
|
1467
1468
|
declare function canonicalizeTerminalPaste(raw: string): string;
|
|
1468
1469
|
|
|
1469
|
-
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, type CompleteAgent, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, ErrorReason, type FolderTreeOptions, GithubLLM, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, 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, type MetricsChangeHandler, type MetricsPort, type MetricsSnapshot, type ModelInfo, type ModelLimits, NoopMetricsPort, 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 UsageData, type UserAttachment, type UserMessagePayload, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, createEmptySnapshot, createLLM, generateFolderTree, getAvailableProviders, getFallbackLimits, loadMCPConfig, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels };
|
|
1470
|
+
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, type CompleteAgent, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, ErrorReason, type FolderTreeOptions, GithubLLM, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, 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, type MetricsChangeHandler, type MetricsPort, type MetricsSnapshot, type ModelInfo, type ModelLimits, NoopMetricsPort, 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 UsageData, type UserAttachment, type UserMessagePayload, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, createEmptySnapshot, createLLM, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderLabel, loadMCPConfig, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels };
|
package/dist/index.js
CHANGED
|
@@ -5386,7 +5386,7 @@ var AnthropicAISDKLLM = class {
|
|
|
5386
5386
|
var llm_provider_config_default = {
|
|
5387
5387
|
providers: [
|
|
5388
5388
|
{
|
|
5389
|
-
|
|
5389
|
+
key: "deepinfra",
|
|
5390
5390
|
type: "openai-compat",
|
|
5391
5391
|
baseUrl: "https://api.deepinfra.com/v1/openai",
|
|
5392
5392
|
features: {
|
|
@@ -5395,7 +5395,7 @@ var llm_provider_config_default = {
|
|
|
5395
5395
|
}
|
|
5396
5396
|
},
|
|
5397
5397
|
{
|
|
5398
|
-
|
|
5398
|
+
key: "openrouter",
|
|
5399
5399
|
type: "openai-compat",
|
|
5400
5400
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
5401
5401
|
features: {
|
|
@@ -5405,7 +5405,7 @@ var llm_provider_config_default = {
|
|
|
5405
5405
|
}
|
|
5406
5406
|
},
|
|
5407
5407
|
{
|
|
5408
|
-
|
|
5408
|
+
key: "zai",
|
|
5409
5409
|
type: "openai-compat",
|
|
5410
5410
|
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
|
5411
5411
|
features: {
|
|
@@ -5414,7 +5414,7 @@ var llm_provider_config_default = {
|
|
|
5414
5414
|
}
|
|
5415
5415
|
},
|
|
5416
5416
|
{
|
|
5417
|
-
|
|
5417
|
+
key: "moonshot",
|
|
5418
5418
|
type: "openai-compat",
|
|
5419
5419
|
baseUrl: "https://api.moonshot.ai/v1",
|
|
5420
5420
|
features: {
|
|
@@ -5423,7 +5423,8 @@ var llm_provider_config_default = {
|
|
|
5423
5423
|
}
|
|
5424
5424
|
},
|
|
5425
5425
|
{
|
|
5426
|
-
|
|
5426
|
+
key: "kimi",
|
|
5427
|
+
label: "Kimi for Coding",
|
|
5427
5428
|
type: "openai-compat",
|
|
5428
5429
|
baseUrl: "https://api.kimi.com/coding/v1",
|
|
5429
5430
|
features: {
|
|
@@ -5463,7 +5464,14 @@ var GenericLLM = class extends BaseLLM {
|
|
|
5463
5464
|
maxFileSize: 5 * 1024 * 1024,
|
|
5464
5465
|
captureResponseBody: true
|
|
5465
5466
|
});
|
|
5466
|
-
return createTransport(
|
|
5467
|
+
return createTransport(
|
|
5468
|
+
base,
|
|
5469
|
+
this.apiUrl,
|
|
5470
|
+
this.opts.apiKey,
|
|
5471
|
+
this.opts.apiUrl,
|
|
5472
|
+
this.opts.version,
|
|
5473
|
+
this.customHeaders
|
|
5474
|
+
);
|
|
5467
5475
|
}
|
|
5468
5476
|
async getModels(signal) {
|
|
5469
5477
|
if (this.modelConfig === false) {
|
|
@@ -5518,7 +5526,7 @@ function normalizeModelConfig(config) {
|
|
|
5518
5526
|
function mergeProviders(customProviders) {
|
|
5519
5527
|
const merged = /* @__PURE__ */ new Map();
|
|
5520
5528
|
for (const provider of providers) {
|
|
5521
|
-
merged.set(provider.
|
|
5529
|
+
merged.set(provider.key.toLowerCase(), provider);
|
|
5522
5530
|
}
|
|
5523
5531
|
if (customProviders) {
|
|
5524
5532
|
for (const [name, custom] of Object.entries(customProviders)) {
|
|
@@ -5527,7 +5535,7 @@ function mergeProviders(customProviders) {
|
|
|
5527
5535
|
}
|
|
5528
5536
|
const existing = merged.get(name.toLowerCase());
|
|
5529
5537
|
const providerConfig = {
|
|
5530
|
-
name,
|
|
5538
|
+
key: name,
|
|
5531
5539
|
type: custom.type ?? "openai-compat",
|
|
5532
5540
|
baseUrl: custom.baseUrl,
|
|
5533
5541
|
models: custom.models ?? false,
|
|
@@ -5545,29 +5553,39 @@ function mergeProviders(customProviders) {
|
|
|
5545
5553
|
}
|
|
5546
5554
|
function createLLM(providerName, options = {}, customProviders) {
|
|
5547
5555
|
const allProviders = mergeProviders(customProviders);
|
|
5548
|
-
const config = allProviders.find((p) => p.
|
|
5556
|
+
const config = allProviders.find((p) => p.key.toLowerCase() === providerName.toLowerCase());
|
|
5549
5557
|
if (!config) {
|
|
5550
|
-
throw new Error(`Unknown LLM provider: ${providerName}. Available: ${allProviders.map((p) => p.
|
|
5558
|
+
throw new Error(`Unknown LLM provider: ${providerName}. Available: ${allProviders.map((p) => p.key).join(", ")}`);
|
|
5551
5559
|
}
|
|
5552
5560
|
const modelConfig = normalizeModelConfig(config);
|
|
5553
|
-
return new GenericLLM(
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5561
|
+
return new GenericLLM(
|
|
5562
|
+
config.baseUrl,
|
|
5563
|
+
modelConfig,
|
|
5564
|
+
{
|
|
5565
|
+
...options,
|
|
5566
|
+
providerName: config.key,
|
|
5567
|
+
enablePromptCaching: options.enablePromptCaching ?? config.features.promptCaching,
|
|
5568
|
+
includeUsage: options.includeUsage ?? config.features.includeUsage
|
|
5569
|
+
},
|
|
5570
|
+
config.customHeaders
|
|
5571
|
+
);
|
|
5559
5572
|
}
|
|
5560
5573
|
function getAvailableProviders(customProviders) {
|
|
5561
5574
|
const allProviders = mergeProviders(customProviders);
|
|
5562
|
-
return allProviders.map((p) => p.
|
|
5575
|
+
return allProviders.map((p) => p.key);
|
|
5563
5576
|
}
|
|
5564
5577
|
function supportsGetModels(providerName, customProviders) {
|
|
5565
5578
|
const allProviders = mergeProviders(customProviders);
|
|
5566
|
-
const config = allProviders.find((p) => p.
|
|
5579
|
+
const config = allProviders.find((p) => p.key.toLowerCase() === providerName.toLowerCase());
|
|
5567
5580
|
if (!config) return false;
|
|
5568
5581
|
const modelConfig = normalizeModelConfig(config);
|
|
5569
5582
|
return modelConfig !== false;
|
|
5570
5583
|
}
|
|
5584
|
+
function getProviderLabel(providerKey, customProviders) {
|
|
5585
|
+
const allProviders = mergeProviders(customProviders);
|
|
5586
|
+
const config = allProviders.find((p) => p.key.toLowerCase() === providerKey.toLowerCase());
|
|
5587
|
+
return config?.label;
|
|
5588
|
+
}
|
|
5571
5589
|
|
|
5572
5590
|
// mcp/mcp-client.ts
|
|
5573
5591
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
@@ -5885,6 +5903,7 @@ export {
|
|
|
5885
5903
|
generateFolderTree,
|
|
5886
5904
|
getAvailableProviders,
|
|
5887
5905
|
getFallbackLimits,
|
|
5906
|
+
getProviderLabel,
|
|
5888
5907
|
loadMCPConfig,
|
|
5889
5908
|
normalizeModelInfo,
|
|
5890
5909
|
normalizeModelLimits,
|