@nuvin/nuvin-core 2.0.0-rc.0 → 2.0.0-rc.2

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": "2.0.0-rc.0",
3
- "commit": "91054e4"
2
+ "version": "2.0.0-rc.2",
3
+ "commit": "96b6846"
4
4
  }
package/dist/index.d.ts CHANGED
@@ -1434,6 +1434,10 @@ type InjectedSystemParams = {
1434
1434
  name: string;
1435
1435
  description: string;
1436
1436
  }>;
1437
+ availableSkills?: Array<{
1438
+ name: string;
1439
+ description: string;
1440
+ }>;
1437
1441
  folderTree?: string;
1438
1442
  shell?: string;
1439
1443
  gitBranch?: string;
@@ -1495,6 +1499,103 @@ declare class PersistedMemory<T = unknown> implements MemoryPort<T> {
1495
1499
  importSnapshot(snapshot: MemorySnapshot<T>): Promise<void>;
1496
1500
  }
1497
1501
 
1502
+ type MemoryType = 'semantic' | 'episodic' | 'procedural';
1503
+ type MemoryScope = 'global' | 'project';
1504
+ type MemorySource = 'extracted' | 'explicit' | 'imported';
1505
+ interface MemoryEntry {
1506
+ id: string;
1507
+ content: string;
1508
+ type: MemoryType;
1509
+ scope: MemoryScope;
1510
+ tags: string[];
1511
+ createdAt: string;
1512
+ updatedAt: string;
1513
+ accessCount: number;
1514
+ lastAccessedAt: string;
1515
+ source: MemorySource;
1516
+ }
1517
+ interface MemorySearchOptions {
1518
+ type?: MemoryType;
1519
+ scope?: MemoryScope;
1520
+ tags?: string[];
1521
+ limit?: number;
1522
+ }
1523
+ interface MemoryStorePort {
1524
+ add(entry: Omit<MemoryEntry, 'id' | 'createdAt' | 'updatedAt' | 'accessCount' | 'lastAccessedAt'>): Promise<MemoryEntry>;
1525
+ update(id: string, updates: Partial<Pick<MemoryEntry, 'content' | 'tags'>>): Promise<MemoryEntry | null>;
1526
+ delete(id: string): Promise<boolean>;
1527
+ get(id: string): Promise<MemoryEntry | null>;
1528
+ search(options?: MemorySearchOptions): Promise<MemoryEntry[]>;
1529
+ getAll(): Promise<MemoryEntry[]>;
1530
+ recordAccess(id: string): Promise<void>;
1531
+ clear(scope?: MemoryScope): Promise<void>;
1532
+ }
1533
+
1534
+ /**
1535
+ * JSON file-backed implementation of MemoryStorePort.
1536
+ *
1537
+ * Persists entries as a flat JSON array at `{dir}/memories.json`.
1538
+ * Lazy-loads from disk on first access; eagerly persists on every mutation.
1539
+ */
1540
+ declare class JsonFileMemoryStore implements MemoryStorePort {
1541
+ private entries;
1542
+ private initialized;
1543
+ private readonly filePath;
1544
+ constructor(dir: string);
1545
+ private ensureInitialized;
1546
+ private loadFromDisk;
1547
+ private persist;
1548
+ private now;
1549
+ private generateId;
1550
+ add(input: Omit<MemoryEntry, 'id' | 'createdAt' | 'updatedAt' | 'accessCount' | 'lastAccessedAt'>): Promise<MemoryEntry>;
1551
+ update(id: string, updates: Partial<Pick<MemoryEntry, 'content' | 'tags'>>): Promise<MemoryEntry | null>;
1552
+ delete(id: string): Promise<boolean>;
1553
+ get(id: string): Promise<MemoryEntry | null>;
1554
+ search(options?: MemorySearchOptions): Promise<MemoryEntry[]>;
1555
+ getAll(): Promise<MemoryEntry[]>;
1556
+ recordAccess(id: string): Promise<void>;
1557
+ clear(scope?: MemoryScope): Promise<void>;
1558
+ }
1559
+
1560
+ /**
1561
+ * Ranks memory entries by a composite score combining recency, frequency, and
1562
+ * type importance. Returns entries sorted descending by score.
1563
+ *
1564
+ * Score formula: recencyScore * 0.5 + frequencyScore * 0.3 + typeWeight * 0.2
1565
+ */
1566
+ declare function rankMemories(entries: MemoryEntry[], limit?: number): MemoryEntry[];
1567
+ /**
1568
+ * Formats a list of memory entries into a prompt-ready markdown string.
1569
+ *
1570
+ * Groups entries by type under labelled section headers, ordered:
1571
+ * semantic → episodic → procedural. Each entry is rendered as a bullet.
1572
+ * Returns an empty string when entries is empty.
1573
+ */
1574
+ declare function formatMemoriesForPrompt(entries: MemoryEntry[]): string;
1575
+
1576
+ type MemoryCandidate = {
1577
+ content: string;
1578
+ type: MemoryType;
1579
+ tags: string[];
1580
+ };
1581
+ declare class MemoryExtractor {
1582
+ /**
1583
+ * Builds a prompt string instructing an LLM to extract memories from the
1584
+ * given conversation messages.
1585
+ *
1586
+ * Returns an empty string when the messages array is empty so callers can
1587
+ * skip the LLM call entirely.
1588
+ */
1589
+ buildExtractionPrompt(messages: Message[]): string;
1590
+ /**
1591
+ * Parses an LLM response into an array of MemoryCandidates.
1592
+ *
1593
+ * Tolerates JSON wrapped in markdown code fences and silently discards any
1594
+ * items that have invalid or missing fields. Never throws.
1595
+ */
1596
+ parseExtractionResponse(response: string): MemoryCandidate[];
1597
+ }
1598
+
1498
1599
  declare class MemoryPortMetadataAdapter<T> implements MetadataPort<T> {
1499
1600
  private memory;
1500
1601
  private prefix;
@@ -1891,6 +1992,10 @@ type SystemContext = {
1891
1992
  gitRepo?: string;
1892
1993
  recentCommits?: string;
1893
1994
  folderTree?: string;
1995
+ availableSkills?: Array<{
1996
+ name: string;
1997
+ description: string;
1998
+ }>;
1894
1999
  };
1895
2000
  type AgentInfo = {
1896
2001
  id: string;
@@ -2040,6 +2145,44 @@ declare class LLMResolver {
2040
2145
  resolve(config: SpecialistAgentConfig): LLMPort;
2041
2146
  }
2042
2147
 
2148
+ declare const memorySaveToolDefinition: {
2149
+ name: string;
2150
+ description: string;
2151
+ parameters: {
2152
+ type: "object";
2153
+ properties: {
2154
+ content: {
2155
+ type: string;
2156
+ description: string;
2157
+ };
2158
+ type: {
2159
+ type: string;
2160
+ enum: string[];
2161
+ description: string;
2162
+ };
2163
+ scope: {
2164
+ type: string;
2165
+ enum: string[];
2166
+ description: string;
2167
+ };
2168
+ tags: {
2169
+ type: string;
2170
+ items: {
2171
+ type: string;
2172
+ };
2173
+ description: string;
2174
+ };
2175
+ };
2176
+ required: string[];
2177
+ };
2178
+ };
2179
+ interface MemorySaveToolInput {
2180
+ content: string;
2181
+ type: 'semantic' | 'episodic' | 'procedural';
2182
+ scope: 'global' | 'project';
2183
+ tags?: string[];
2184
+ }
2185
+
2043
2186
  declare class ToolRegistry implements ToolPort, AgentAwareToolPort, OrchestratorAwareToolPort {
2044
2187
  private tools;
2045
2188
  private toolsMemory?;
@@ -2049,6 +2192,7 @@ declare class ToolRegistry implements ToolPort, AgentAwareToolPort, Orchestrator
2049
2192
  private lspTool?;
2050
2193
  private skillTool?;
2051
2194
  private enabledAgentsConfig;
2195
+ private memoryHandler;
2052
2196
  private orchestratorConfig?;
2053
2197
  private orchestratorTools?;
2054
2198
  private orchestratorLLMFactory?;
@@ -2063,6 +2207,11 @@ declare class ToolRegistry implements ToolPort, AgentAwareToolPort, Orchestrator
2063
2207
  setLspService(service: LspService): void;
2064
2208
  setSkillProvider(provider: SkillProvider): void;
2065
2209
  updateSkillToolDescription(): void;
2210
+ /**
2211
+ * Wire the memory_save tool handler from the CLI layer.
2212
+ * Called after the MemoryService is available (in OrchestratorManager.init).
2213
+ */
2214
+ setMemoryHandler(handler: (input: MemorySaveToolInput) => Promise<string>): void;
2066
2215
  private persistToolNames;
2067
2216
  listRegisteredTools(): Promise<string[]>;
2068
2217
  getToolDefinitions(enabledTools: string[]): ToolDefinition[];
@@ -3425,4 +3574,4 @@ declare function resolveBackspaces(s: string): string;
3425
3574
  declare function stripAnsiAndControls(s: string): string;
3426
3575
  declare function canonicalizeTerminalPaste(raw: string): string;
3427
3576
 
3428
- export { AGENT_CREATOR_SYSTEM_PROMPT, AbortError, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentSession, type AgentStateManager, type AgentTemplate, AnthropicAISDKLLM, type AskUserArgs, type AskUserMetadata, AskUserTool, type AssignErrorResult, type AssignParams, type AssignResult, type AssignSuccessResult$1 as AssignSuccessResult, type AssignTaskArgs, type AssignTaskMetadata, type AuthFlowResult, type AuthServerMetadata, type BaseLLMOptions, type BashErrorResult, type BashParams, type BashResult, type BashSuccessResult$1 as BashSuccessResult, BashTool, type BashToolArgs, type BashToolMetadata, CommandFilePersistence, CommandHookExecutor, type CommandMetadata, type CommandSource, type CompleteAgent, type CompleteCustomCommand, CompositeHookPort, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, type CustomCommandFrontmatter, type CustomCommandTemplate, DEFAULT_RETRY_CONFIG, DefaultAgentStateManager, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationMetadata, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type DirEntry, 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, type GlobArgs, type GlobParams, type GlobResult, type GlobSuccessResult$1 as GlobSuccessResult, type GlobToolMetadata, type GrepArgs, type GrepParams, type GrepResult, type GrepSuccessResult$1 as GrepSuccessResult, type GrepToolMetadata, type HookContext, HookDecision, type HookDecisionType, type HookDefinition, type HookEventConfig, type HookEventType, HookEventTypes, type HookPort, HookRegistry, type HookResult, type HooksConfig, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type LineRangeMetadata, type LsArgs, type LsMetadata, type LsParams, type LsResult, type LsSuccessResult$1 as LsSuccessResult, type LspService, LspTool, type MCPAuthOptions, type MCPCallResult, type MCPConfig, type MCPHttpOptions, MCPOAuthClient, type MCPOAuthConfig, type MCPOptions, type MCPServerConfig, type MCPStdioOptions, type MCPToolCall, MCPToolPort, type MCPToolSchema, 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 ProtectedResourceMetadata, type RetryConfig, RetryTransport, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SkillErrorResult, type SkillMetadata, type SkillParams, type SkillProvider, type SkillResult, type SkillSuccessResult, SkillTool, type SkillInfo as SkillToolInfo, type SpecialistAgentConfig, type SpecialistAgentResult, type StoredTokens, type SubAgentState, type SubAgentToolCall, SystemClock, type TaskOutputMetadata, type TaskOutputParams, type TaskOutputResult, type TaskOutputSuccessResult, type TodoWriteArgs, type TodoWriteMetadata, type TodoWriteResult, type TodoWriteSuccessResult$1 as TodoWriteSuccessResult, type TokenStorage, type ToolApprovalDecision, type ToolArguments, type ToolCall, type ToolCallConversionResult, 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 ValidationError, 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, assignTaskSchema, bashToolSchema, buildAISDKToolResultOutput, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, convertToolCall, convertToolCalls, convertToolCallsWithErrorHandling, createEmptySnapshot, createLLM, deduplicateModels, err, fileEditSchema, fileNewSchema, fileReadSchema, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderAuthMethods, getProviderDefaultModels, getProviderLabel, globToolSchema, grepToolSchema, isAssignResult, isAssignSuccess, isAssignTaskArgs, isBashResult, isBashSuccess, isBashToolArgs, isError, isFileEditArgs, isFileEditResult, isFileEditSuccess, isFileNewArgs, isFileNewResult, isFileNewSuccess, isFileReadArgs, isFileReadResult, isFileReadSuccess, isGlobArgs, isGlobResult, isGlobSuccess, isGrepArgs, isGrepResult, isGrepSuccess, isInsufficientScopeError, isJsonResult, isLsArgs, isLsToolResult, isLsToolSuccess, isRetryableError, isRetryableStatusCode, isSuccess, isSuccessJson, isSuccessText, isTextResult, isTodoWriteArgs, isTodoWriteResult, isTodoWriteSuccess, isUnauthorizedError, isValidCommandId, isWebFetchArgs, isWebFetchResult, isWebFetchSuccess, isWebSearchArgs, isWebSearchResult, isWebSearchSuccess, loadHooksFromFrontmatter, lsToolSchema, mergeAgentConfig, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, okJson, okText, parseJSON, parseSubAgentToolCallArguments, parseToolArguments, parseWWWAuthenticate, renderTemplate, resolveBackspaces, resolveCarriageReturns, sanitizeCommandId, stripAnsiAndControls, supportsGetModels, todoWriteSchema, toolSchemas, toolValidators, validateToolParams, webFetchSchema, webSearchSchema };
3577
+ export { AGENT_CREATOR_SYSTEM_PROMPT, AbortError, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentSession, type AgentStateManager, type AgentTemplate, AnthropicAISDKLLM, type AskUserArgs, type AskUserMetadata, AskUserTool, type AssignErrorResult, type AssignParams, type AssignResult, type AssignSuccessResult$1 as AssignSuccessResult, type AssignTaskArgs, type AssignTaskMetadata, type AuthFlowResult, type AuthServerMetadata, type BaseLLMOptions, type BashErrorResult, type BashParams, type BashResult, type BashSuccessResult$1 as BashSuccessResult, BashTool, type BashToolArgs, type BashToolMetadata, CommandFilePersistence, CommandHookExecutor, type CommandMetadata, type CommandSource, type CompleteAgent, type CompleteCustomCommand, CompositeHookPort, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, type CustomCommandFrontmatter, type CustomCommandTemplate, DEFAULT_RETRY_CONFIG, DefaultAgentStateManager, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationMetadata, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type DirEntry, 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, type GlobArgs, type GlobParams, type GlobResult, type GlobSuccessResult$1 as GlobSuccessResult, type GlobToolMetadata, type GrepArgs, type GrepParams, type GrepResult, type GrepSuccessResult$1 as GrepSuccessResult, type GrepToolMetadata, type HookContext, HookDecision, type HookDecisionType, type HookDefinition, type HookEventConfig, type HookEventType, HookEventTypes, type HookPort, HookRegistry, type HookResult, type HooksConfig, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, JsonFileMemoryPersistence, JsonFileMemoryStore, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type LineRangeMetadata, type LsArgs, type LsMetadata, type LsParams, type LsResult, type LsSuccessResult$1 as LsSuccessResult, type LspService, LspTool, type MCPAuthOptions, type MCPCallResult, type MCPConfig, type MCPHttpOptions, MCPOAuthClient, type MCPOAuthConfig, type MCPOptions, type MCPServerConfig, type MCPStdioOptions, type MCPToolCall, MCPToolPort, type MCPToolSchema, type MemoryCandidate, type MemoryEntry, MemoryExtractor, type MemoryPort, MemoryPortMetadataAdapter, type MemorySaveToolInput, type MemoryScope, type MemorySearchOptions, type MemorySource, type MemoryStorePort, type MemoryType, 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 ProtectedResourceMetadata, type RetryConfig, RetryTransport, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SkillErrorResult, type SkillMetadata, type SkillParams, type SkillProvider, type SkillResult, type SkillSuccessResult, SkillTool, type SkillInfo as SkillToolInfo, type SpecialistAgentConfig, type SpecialistAgentResult, type StoredTokens, type SubAgentState, type SubAgentToolCall, SystemClock, type TaskOutputMetadata, type TaskOutputParams, type TaskOutputResult, type TaskOutputSuccessResult, type TodoWriteArgs, type TodoWriteMetadata, type TodoWriteResult, type TodoWriteSuccessResult$1 as TodoWriteSuccessResult, type TokenStorage, type ToolApprovalDecision, type ToolArguments, type ToolCall, type ToolCallConversionResult, 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 ValidationError, 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, assignTaskSchema, bashToolSchema, buildAISDKToolResultOutput, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, convertToolCall, convertToolCalls, convertToolCallsWithErrorHandling, createEmptySnapshot, createLLM, deduplicateModels, err, fileEditSchema, fileNewSchema, fileReadSchema, formatMemoriesForPrompt, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderAuthMethods, getProviderDefaultModels, getProviderLabel, globToolSchema, grepToolSchema, isAssignResult, isAssignSuccess, isAssignTaskArgs, isBashResult, isBashSuccess, isBashToolArgs, isError, isFileEditArgs, isFileEditResult, isFileEditSuccess, isFileNewArgs, isFileNewResult, isFileNewSuccess, isFileReadArgs, isFileReadResult, isFileReadSuccess, isGlobArgs, isGlobResult, isGlobSuccess, isGrepArgs, isGrepResult, isGrepSuccess, isInsufficientScopeError, isJsonResult, isLsArgs, isLsToolResult, isLsToolSuccess, isRetryableError, isRetryableStatusCode, isSuccess, isSuccessJson, isSuccessText, isTextResult, isTodoWriteArgs, isTodoWriteResult, isTodoWriteSuccess, isUnauthorizedError, isValidCommandId, isWebFetchArgs, isWebFetchResult, isWebFetchSuccess, isWebSearchArgs, isWebSearchResult, isWebSearchSuccess, loadHooksFromFrontmatter, lsToolSchema, memorySaveToolDefinition, mergeAgentConfig, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, okJson, okText, parseJSON, parseSubAgentToolCallArguments, parseToolArguments, parseWWWAuthenticate, rankMemories, renderTemplate, resolveBackspaces, resolveCarriageReturns, sanitizeCommandId, stripAnsiAndControls, supportsGetModels, todoWriteSchema, toolSchemas, toolValidators, validateToolParams, webFetchSchema, webSearchSchema };