@nuvin/nuvin-core 1.7.0 → 1.7.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 CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.7.0",
3
- "commit": "4c993c8"
2
+ "version": "1.7.1",
3
+ "commit": "c220b68"
4
4
  }
package/dist/index.d.ts CHANGED
@@ -2059,12 +2059,15 @@ type ModelInfo = {
2059
2059
  id: string;
2060
2060
  name?: string;
2061
2061
  limits?: ModelLimits;
2062
- [key: string]: unknown;
2062
+ [key: string]: string | number | ModelLimits | undefined | unknown;
2063
+ };
2064
+ type RawModelResponse = {
2065
+ [key: string]: string | number | undefined | unknown;
2063
2066
  };
2064
- type RawModelResponse = Record<string, unknown>;
2065
2067
  declare function normalizeModelLimits(provider: string, model: RawModelResponse): ModelLimits | null;
2066
2068
  declare function getFallbackLimits(provider: string, model: string): ModelLimits | null;
2067
2069
  declare function normalizeModelInfo(provider: string, model: RawModelResponse): ModelInfo;
2070
+ declare function deduplicateModels(models: ModelInfo[]): ModelInfo[];
2068
2071
 
2069
2072
  type GithubOptions = {
2070
2073
  apiKey?: string;
@@ -2246,4 +2249,4 @@ declare function resolveBackspaces(s: string): string;
2246
2249
  declare function stripAnsiAndControls(s: string): string;
2247
2250
  declare function canonicalizeTerminalPaste(raw: string): string;
2248
2251
 
2249
- export { AGENT_CREATOR_SYSTEM_PROMPT, AbortError, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM, type AssignErrorResult, type AssignParams, type AssignResult, type AssignSuccessResult$1 as AssignSuccessResult, type AssignTaskArgs, type AssignTaskMetadata, type BaseLLMOptions, type BashErrorResult, type BashParams, type BashResult, type BashSuccessResult$1 as BashSuccessResult, BashTool, type BashToolArgs, type BashToolMetadata, type CommandMetadata, type CompleteAgent, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DEFAULT_RETRY_CONFIG, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationMetadata, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type DirEntry, type DirLsArgs, type DirLsMetadata, type DirLsParams, type DirLsResult, type DirLsSuccessResult$1 as DirLsSuccessResult, type ErrorMetadata, ErrorReason, type ExecResult, type ExecResultError, type ExecResultSuccess, type FileEditArgs, type FileEditMetadata, type FileEditResult, type FileEditSuccessResult$1 as FileEditSuccessResult, type FileMetadata, type FileNewArgs, type FileNewMetadata, type FileNewParams, type FileNewResult, type FileNewSuccessResult$1 as FileNewSuccessResult, type FileReadArgs, type FileReadErrorResult, type FileReadMetadata, type FileReadParams, type FileReadResult, type FileReadSuccessResult$1 as FileReadSuccessResult, type FolderTreeOptions, type FunctionTool, GithubLLM, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type LineRangeMetadata, 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, type ParseResult, PersistedMemory, PersistingConsoleEventPort, type RetryConfig, RetryTransport, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SpecialistAgentConfig, type SpecialistAgentResult, type SubAgentState, type SubAgentToolCall, SystemClock, type TodoWriteArgs, type TodoWriteMetadata, type TodoWriteResult, type TodoWriteSuccessResult$1 as TodoWriteSuccessResult, type ToolApprovalDecision, type ToolArguments, type ToolCall, type ToolCallValidation, type ToolErrorMetadata, type ToolExecutionContext, type ToolExecutionResult, type ToolMetadataMap, type ToolName, type ToolParameterMap, type ToolPort, ToolRegistry, type ToolValidator, type TypedToolInvocation, type UsageData, type UserAttachment, type UserMessagePayload, type ValidationResult, type WebFetchArgs, type WebFetchMetadata, type WebFetchParams, type WebFetchResult, type WebFetchSuccessResult$1 as WebFetchSuccessResult, type WebSearchArgs, type WebSearchMetadata, type WebSearchParams, type WebSearchResult, type WebSearchSuccessResult$1 as WebSearchSuccessResult, type WebSearchToolResult, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, convertToolCall, convertToolCalls, createEmptySnapshot, createLLM, err, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderLabel, isAssignResult, isAssignSuccess, isAssignTaskArgs, isBashResult, isBashSuccess, isBashToolArgs, isDirLsArgs, isDirLsResult, isDirLsSuccess, isError, isFileEditArgs, isFileEditResult, isFileEditSuccess, isFileNewArgs, isFileNewResult, isFileNewSuccess, isFileReadArgs, isFileReadResult, isFileReadSuccess, isJsonResult, isRetryableError, isRetryableStatusCode, isSuccess, isSuccessJson, isSuccessText, isTextResult, isTodoWriteArgs, isTodoWriteResult, isTodoWriteSuccess, isWebFetchArgs, isWebFetchResult, isWebFetchSuccess, isWebSearchArgs, isWebSearchResult, isWebSearchSuccess, loadMCPConfig, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, okJson, okText, parseJSON, parseSubAgentToolCallArguments, parseToolArguments, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels, toolValidators };
2252
+ export { AGENT_CREATOR_SYSTEM_PROMPT, AbortError, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM, type AssignErrorResult, type AssignParams, type AssignResult, type AssignSuccessResult$1 as AssignSuccessResult, type AssignTaskArgs, type AssignTaskMetadata, type BaseLLMOptions, type BashErrorResult, type BashParams, type BashResult, type BashSuccessResult$1 as BashSuccessResult, BashTool, type BashToolArgs, type BashToolMetadata, type CommandMetadata, type CompleteAgent, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DEFAULT_RETRY_CONFIG, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationMetadata, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type DirEntry, type DirLsArgs, type DirLsMetadata, type DirLsParams, type DirLsResult, type DirLsSuccessResult$1 as DirLsSuccessResult, type ErrorMetadata, ErrorReason, type ExecResult, type ExecResultError, type ExecResultSuccess, type FileEditArgs, type FileEditMetadata, type FileEditResult, type FileEditSuccessResult$1 as FileEditSuccessResult, type FileMetadata, type FileNewArgs, type FileNewMetadata, type FileNewParams, type FileNewResult, type FileNewSuccessResult$1 as FileNewSuccessResult, type FileReadArgs, type FileReadErrorResult, type FileReadMetadata, type FileReadParams, type FileReadResult, type FileReadSuccessResult$1 as FileReadSuccessResult, type FolderTreeOptions, type FunctionTool, GithubLLM, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type LineRangeMetadata, 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, type ParseResult, PersistedMemory, PersistingConsoleEventPort, type RetryConfig, RetryTransport, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SpecialistAgentConfig, type SpecialistAgentResult, type SubAgentState, type SubAgentToolCall, SystemClock, type TodoWriteArgs, type TodoWriteMetadata, type TodoWriteResult, type TodoWriteSuccessResult$1 as TodoWriteSuccessResult, type ToolApprovalDecision, type ToolArguments, type ToolCall, type ToolCallValidation, type ToolErrorMetadata, type ToolExecutionContext, type ToolExecutionResult, type ToolMetadataMap, type ToolName, type ToolParameterMap, type ToolPort, ToolRegistry, type ToolValidator, type TypedToolInvocation, type UsageData, type UserAttachment, type UserMessagePayload, type ValidationResult, type WebFetchArgs, type WebFetchMetadata, type WebFetchParams, type WebFetchResult, type WebFetchSuccessResult$1 as WebFetchSuccessResult, type WebSearchArgs, type WebSearchMetadata, type WebSearchParams, type WebSearchResult, type WebSearchSuccessResult$1 as WebSearchSuccessResult, type WebSearchToolResult, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, convertToolCall, convertToolCalls, createEmptySnapshot, createLLM, deduplicateModels, err, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderLabel, isAssignResult, isAssignSuccess, isAssignTaskArgs, isBashResult, isBashSuccess, isBashToolArgs, isDirLsArgs, isDirLsResult, isDirLsSuccess, isError, isFileEditArgs, isFileEditResult, isFileEditSuccess, isFileNewArgs, isFileNewResult, isFileNewSuccess, isFileReadArgs, isFileReadResult, isFileReadSuccess, isJsonResult, isRetryableError, isRetryableStatusCode, isSuccess, isSuccessJson, isSuccessText, isTextResult, isTodoWriteArgs, isTodoWriteResult, isTodoWriteSuccess, isWebFetchArgs, isWebFetchResult, isWebFetchSuccess, isWebSearchArgs, isWebSearchResult, isWebSearchSuccess, loadMCPConfig, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, okJson, okText, parseJSON, parseSubAgentToolCallArguments, parseToolArguments, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels, toolValidators };
package/dist/index.js CHANGED
@@ -5808,6 +5808,15 @@ function normalizeModelInfo(provider, model) {
5808
5808
  ...limits ? { limits } : {}
5809
5809
  };
5810
5810
  }
5811
+ function deduplicateModels(models) {
5812
+ const uniqueModels = /* @__PURE__ */ new Map();
5813
+ for (const model of models) {
5814
+ if (!uniqueModels.has(model.id)) {
5815
+ uniqueModels.set(model.id, model);
5816
+ }
5817
+ }
5818
+ return Array.from(uniqueModels.values());
5819
+ }
5811
5820
 
5812
5821
  // src/llm-providers/llm-github.ts
5813
5822
  var GithubLLM = class extends BaseLLM {
@@ -5852,7 +5861,8 @@ var GithubLLM = class extends BaseLLM {
5852
5861
  throw new LLMError(text || `Failed to fetch models: ${res.status}`, res.status);
5853
5862
  }
5854
5863
  const body = await res.json();
5855
- return body.data.map((m) => normalizeModelInfo("github", m));
5864
+ const models = body.data.map((m) => normalizeModelInfo("github", m));
5865
+ return deduplicateModels(models);
5856
5866
  }
5857
5867
  handleError(error, model) {
5858
5868
  if (error instanceof LLMError) {
@@ -6289,7 +6299,8 @@ var AnthropicAISDKLLM = class {
6289
6299
  throw new LLMError(text || `Failed to fetch models: ${res.status}`, res.status);
6290
6300
  }
6291
6301
  const data = await res.json();
6292
- return data.data.map((model) => normalizeModelInfo("anthropic", model));
6302
+ const models = data.data.map((model) => normalizeModelInfo("anthropic", model));
6303
+ return deduplicateModels(models);
6293
6304
  } catch (error) {
6294
6305
  if (error instanceof LLMError) {
6295
6306
  throw error;
@@ -6399,10 +6410,11 @@ var GenericLLM = class extends BaseLLM {
6399
6410
  throw new Error("Provider does not support getModels");
6400
6411
  }
6401
6412
  if (Array.isArray(this.modelConfig)) {
6402
- return this.modelConfig.map((m) => {
6413
+ const models2 = this.modelConfig.map((m) => {
6403
6414
  const raw = typeof m === "string" ? { id: m } : m;
6404
6415
  return normalizeModelInfo(this.providerName, raw);
6405
6416
  });
6417
+ return deduplicateModels(models2);
6406
6418
  }
6407
6419
  if (typeof this.modelConfig === "string") {
6408
6420
  const transport2 = this.createTransport();
@@ -6412,7 +6424,8 @@ var GenericLLM = class extends BaseLLM {
6412
6424
  throw new Error(`Failed to fetch models: ${res2.status} ${text}`);
6413
6425
  }
6414
6426
  const data2 = await res2.json();
6415
- return data2.data.map((m) => normalizeModelInfo(this.providerName, m));
6427
+ const models2 = data2.data.map((m) => normalizeModelInfo(this.providerName, m));
6428
+ return deduplicateModels(models2);
6416
6429
  }
6417
6430
  const transport = this.createTransport();
6418
6431
  const res = await transport.get("/models", void 0, signal);
@@ -6421,7 +6434,8 @@ var GenericLLM = class extends BaseLLM {
6421
6434
  throw new Error(`Failed to fetch models: ${res.status} ${text}`);
6422
6435
  }
6423
6436
  const data = await res.json();
6424
- return data.data.map((m) => normalizeModelInfo(this.providerName, m));
6437
+ const models = data.data.map((m) => normalizeModelInfo(this.providerName, m));
6438
+ return deduplicateModels(models);
6425
6439
  }
6426
6440
  async generateCompletion(params, signal) {
6427
6441
  let enhancedParams = params;
@@ -6830,6 +6844,7 @@ export {
6830
6844
  convertToolCalls,
6831
6845
  createEmptySnapshot,
6832
6846
  createLLM,
6847
+ deduplicateModels,
6833
6848
  err,
6834
6849
  generateFolderTree,
6835
6850
  getAvailableProviders,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuvin/nuvin-core",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "dist/index.js",