@anuma/sdk 2.6.1 → 3.0.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.
@@ -2211,6 +2211,23 @@ type RunToolLoopOptions = {
2211
2211
  headers?: Record<string, string>;
2212
2212
  /** Which API backend to use. @default "auto" */
2213
2213
  apiType?: ApiType;
2214
+ /**
2215
+ * Optional per-call override for the request path. When set, every streaming
2216
+ * request targets this path instead of the endpoint the strategy resolves from
2217
+ * the model. Only the URL path changes — the request body and response parsing
2218
+ * follow the resolved strategy exactly as they would without the override.
2219
+ *
2220
+ * Must be a non-empty, root-relative path (e.g. `"/api/v1/utility/responses"`);
2221
+ * a missing leading slash is normalized on. Empty/whitespace-only values and
2222
+ * protocol-relative (`"//host"`) or absolute (`"scheme://host"`) URLs are
2223
+ * rejected — the transport builds the URL as `baseUrl + endpoint`, so a bad
2224
+ * value would silently hit the portal root or send the request (and its Bearer
2225
+ * token) off-origin. An invalid override is reported like any other pre-flight
2226
+ * failure: `onRunError` fires and the run resolves to `{ data: null, error }`
2227
+ * (no throw).
2228
+ * @default undefined (path resolved from the model / `apiType`)
2229
+ */
2230
+ endpointOverride?: string;
2214
2231
  /** Controls randomness (0.0 to 2.0). */
2215
2232
  temperature?: number;
2216
2233
  /** Maximum tokens to generate. */
@@ -2483,33 +2500,6 @@ type StreamingTransportResult = {
2483
2500
  * transport both honor this contract.
2484
2501
  */
2485
2502
  type StreamingTransport = (options: StreamingTransportOptions) => StreamingTransportResult;
2486
- /**
2487
- * Framework-agnostic tool execution loop.
2488
- *
2489
- * Sends a streaming completion request, auto-executes tools that have executors,
2490
- * feeds results back to the model, and repeats until the model stops emitting
2491
- * tool calls or hits the iteration limit.
2492
- *
2493
- * This is the same loop that powers `useChat` in the React SDK, extracted so
2494
- * it can be used from Node.js servers, CLI tools, and background workers.
2495
- *
2496
- * @example
2497
- * ```ts
2498
- * import { runToolLoop } from "@anuma/sdk/server";
2499
- *
2500
- * const result = await runToolLoop({
2501
- * messages: [{ role: "user", content: [{ type: "text", text: "What's the weather?" }] }],
2502
- * model: "fireworks/accounts/fireworks/models/kimi-k2p5",
2503
- * token: "my-api-token",
2504
- * tools: [{
2505
- * type: "function",
2506
- * function: { name: "get_weather", parameters: { type: "object", properties: { city: { type: "string" } } } },
2507
- * executor: async ({ city }) => fetchWeather(city),
2508
- * }],
2509
- * onData: (chunk) => process.stdout.write(chunk),
2510
- * });
2511
- * ```
2512
- */
2513
2503
  declare function runToolLoop(options: RunToolLoopOptions): Promise<RunToolLoopResult>;
2514
2504
 
2515
2505
  /**
@@ -3276,6 +3266,32 @@ interface SearchSource {
3276
3266
  snippet?: string;
3277
3267
  date?: string;
3278
3268
  }
3269
+ /** Options for keyset-paginated conversation-list reads ({@link getConversationsPageOp}). */
3270
+ interface GetConversationsPageOptions {
3271
+ /**
3272
+ * Upper-bound `created_at` cursor (epoch ms). Without
3273
+ * `boundaryExcludeUniqueIds` it is EXCLUSIVE: only conversations with
3274
+ * `createdAt < before` are returned. Omit to fetch the newest page.
3275
+ */
3276
+ before?: number;
3277
+ /**
3278
+ * uniqueIds of the rows the caller already holds AT the `before` boundary.
3279
+ * `created_at` is NOT unique (a bulk restore/import writes many rows with the
3280
+ * same timestamp) — with an exclusive cursor, an unseen row sharing the
3281
+ * boundary timestamp would be silently skipped by every page. When provided,
3282
+ * the boundary timestamp is fetched INCLUSIVELY and these known rows are
3283
+ * filtered out, so a boundary-timestamp row is returned exactly once. Mirrors
3284
+ * {@link GetMessagesPageOptions.boundaryExcludeUniqueIds}.
3285
+ */
3286
+ boundaryExcludeUniqueIds?: string[];
3287
+ /**
3288
+ * Maximum rows to return — the NEWEST `limit` rows of the matching range.
3289
+ * Defaults to 200. A non-positive or non-finite value yields an EMPTY page
3290
+ * (never an unbounded read — SQLite treats `LIMIT -1` as "no limit");
3291
+ * fractional values are floored.
3292
+ */
3293
+ limit?: number;
3294
+ }
3279
3295
  interface StoredMessage {
3280
3296
  uniqueId: string;
3281
3297
  messageId: number;
@@ -3603,6 +3619,19 @@ declare function getEncryptionKey(address: string, version?: EncryptionKeyVersio
3603
3619
  * @category Encryption
3604
3620
  */
3605
3621
  declare function encryptData(plaintext: string | Uint8Array, address: string): Promise<string>;
3622
+ /**
3623
+ * Like {@link encryptData} but takes raw bytes and returns the raw encrypted
3624
+ * `[IV][ciphertext+tag]` Uint8Array instead of a hex string. Avoids the hex
3625
+ * round-trip (`encryptData` returns hex, which callers immediately convert back
3626
+ * to bytes) — for large binary media that hex string is a ~1.37x copy of the
3627
+ * whole payload. Use for binary uploads (e.g. enc:v3 media frames).
3628
+ *
3629
+ * @param plaintext - The raw bytes to encrypt
3630
+ * @param address - The wallet address associated with the encryption key
3631
+ * @returns Encrypted data as raw bytes (IV + ciphertext + auth tag)
3632
+ * @category Encryption
3633
+ */
3634
+ declare function encryptDataBytes(plaintext: Uint8Array, address: string): Promise<Uint8Array>;
3606
3635
  /**
3607
3636
  * Decrypts data using AES-GCM with the stored encryption key.
3608
3637
  *
@@ -3639,6 +3668,21 @@ declare function decryptData(encryptedHex: string, address: string, version?: En
3639
3668
  * @returns Decrypted data as Uint8Array
3640
3669
  */
3641
3670
  declare function decryptDataBytes(encryptedHex: string, address: string, version?: EncryptionKeyVersion): Promise<Uint8Array>;
3671
+ /**
3672
+ * Like {@link decryptDataBytes} but takes the raw encrypted bytes
3673
+ * (`[IV][ciphertext+tag]`) directly instead of a hex string. Skips the
3674
+ * `hexToBytes` conversion — for large binary media the hex string the caller
3675
+ * would otherwise build is a ~1.37x copy of the whole payload (a ~1GB string
3676
+ * for a 500MB video), plus this avoids a second byte copy. Same key resolution
3677
+ * as decryptDataBytes.
3678
+ *
3679
+ * @param encrypted - Raw encrypted bytes (IV + ciphertext + auth tag), no hex
3680
+ * @param address - The wallet address associated with the encryption key
3681
+ * @param version - Encryption key version to decrypt with (defaults to "v3")
3682
+ * @returns Decrypted data as Uint8Array
3683
+ * @category Encryption
3684
+ */
3685
+ declare function decryptDataBytesFromBytes(encrypted: Uint8Array, address: string, version?: EncryptionKeyVersion): Promise<Uint8Array>;
3642
3686
  /**
3643
3687
  * Checks if an encryption key exists in memory for the given wallet address
3644
3688
  */
@@ -3806,6 +3850,20 @@ declare function getConversationsOp(ctx: StorageOperationsContext): Promise<Stor
3806
3850
  * for `decryptField` is exactly zero.
3807
3851
  */
3808
3852
  declare function getConversationsLazyOp(ctx: StorageOperationsContext): Promise<LazyStoredConversation[]>;
3853
+ /**
3854
+ * Keyset-paginated, lazy (no-decrypt) variant of {@link getConversationsLazyOp}.
3855
+ *
3856
+ * Returns at most `limit` conversations (newest first by `created_at`), each
3857
+ * with its raw stored title under `encryptedTitle` — pair with
3858
+ * {@link decryptConversationTitle} to decrypt on render. Page through older
3859
+ * threads by passing the oldest loaded `createdAt` as `before` plus the
3860
+ * uniqueIds held at that boundary as `boundaryExcludeUniqueIds`.
3861
+ *
3862
+ * Decrypts nothing and builds no WatermelonDB Model (the never-evicted
3863
+ * RecordCache stays empty — web Pile-2). Sort order, soft-delete filtering,
3864
+ * and the encrypted-title projection all match `getConversationsLazyOp`.
3865
+ */
3866
+ declare function getConversationsPageOp(ctx: StorageOperationsContext, options?: GetConversationsPageOptions): Promise<LazyStoredConversation[]>;
3809
3867
  /**
3810
3868
  * Lazy variant of {@link getConversationsByProjectOp}.
3811
3869
  *
@@ -5285,8 +5343,13 @@ interface EmbeddingOptions {
5285
5343
  * are looked up in this map before calling the API, and new embeddings
5286
5344
  * are stored after generation. Useful when the same texts are embedded
5287
5345
  * repeatedly (e.g., across eval iterations or re-indexing runs).
5346
+ *
5347
+ * Values are stored as `Float32Array` (the embedding model's native
5348
+ * precision) rather than a float64 `number[]`, halving the resident RAM of
5349
+ * the cache with no precision loss. `generateEmbedding(s)` still return
5350
+ * `number[]` at the API boundary, so callers are unaffected.
5288
5351
  */
5289
- cache?: Map<string, number[]>;
5352
+ cache?: Map<string, Float32Array>;
5290
5353
  /** Called after each embedding API call with the token usage from the response. */
5291
5354
  onUsage?: (usage: {
5292
5355
  promptTokens: number;
@@ -7791,4 +7854,4 @@ declare function sanitizeQuotes(s: string): string;
7791
7854
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
7792
7855
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
7793
7856
 
7794
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, supersedeVaultMemoryOp, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
7857
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, supersedeVaultMemoryOp, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
@@ -30,6 +30,7 @@ import {
30
30
  decryptData,
31
31
  decryptDataBatch,
32
32
  decryptDataBytes,
33
+ decryptDataBytesFromBytes,
33
34
  decryptDataWithKey,
34
35
  decryptField,
35
36
  decryptJsonField,
@@ -41,6 +42,7 @@ import {
41
42
  embedMessage,
42
43
  encryptData,
43
44
  encryptDataBatch,
45
+ encryptDataBytes,
44
46
  encryptDataWithKey,
45
47
  encryptField,
46
48
  encryptJsonField,
@@ -56,6 +58,7 @@ import {
56
58
  getConversationsByProjectOp,
57
59
  getConversationsLazyOp,
58
60
  getConversationsOp,
61
+ getConversationsPageOp,
59
62
  getEncryptionKey,
60
63
  getMemoriesNeedingTopicExtractionOp,
61
64
  getMessagesOp,
@@ -105,7 +108,7 @@ import {
105
108
  updateVaultMemoryOp,
106
109
  upsertMessageOp,
107
110
  vaultMemoryToStored
108
- } from "./chunk-Z6II54I7.mjs";
111
+ } from "./chunk-QQOIC37O.mjs";
109
112
  import {
110
113
  createStreamingDeAnonymizer,
111
114
  resolvePiiRedactor
@@ -7083,6 +7086,7 @@ var WalletPoller = class {
7083
7086
  };
7084
7087
 
7085
7088
  // src/lib/processors/encoding.ts
7089
+ var B64_ENCODE_CHUNK = 32768 * 3;
7086
7090
  async function dataUrlToArrayBuffer(dataUrl) {
7087
7091
  if (dataUrl.startsWith("blob:") || dataUrl.startsWith("http://") || dataUrl.startsWith("https://")) {
7088
7092
  const response = await fetch(dataUrl);
@@ -7105,11 +7109,16 @@ function uint8ArrayToBase64(data) {
7105
7109
  if (typeof Buffer !== "undefined") {
7106
7110
  return Buffer.from(data).toString("base64");
7107
7111
  }
7108
- let binary = "";
7109
- for (let i = 0; i < data.length; i++) {
7110
- binary += String.fromCharCode(data[i]);
7112
+ let base64 = "";
7113
+ for (let i = 0; i < data.length; i += B64_ENCODE_CHUNK) {
7114
+ const slice = data.subarray(i, i + B64_ENCODE_CHUNK);
7115
+ let binary = "";
7116
+ for (let j = 0; j < slice.length; j++) {
7117
+ binary += String.fromCharCode(slice[j]);
7118
+ }
7119
+ base64 += btoa(binary);
7111
7120
  }
7112
- return btoa(binary);
7121
+ return base64;
7113
7122
  }
7114
7123
 
7115
7124
  // src/lib/processors/ExcelProcessor.ts
@@ -10026,6 +10035,22 @@ function linkAbortSignals(a, b) {
10026
10035
  }
10027
10036
  };
10028
10037
  }
10038
+ function validateEndpointOverride(override) {
10039
+ const trimmed = override.trim();
10040
+ if (trimmed === "") {
10041
+ return {
10042
+ valid: false,
10043
+ message: 'endpointOverride must be a non-empty, root-relative path (e.g. "/api/v1/utility/responses"); received an empty or whitespace-only string'
10044
+ };
10045
+ }
10046
+ if (trimmed.startsWith("//") || trimmed.includes("://")) {
10047
+ return {
10048
+ valid: false,
10049
+ message: `endpointOverride must be a root-relative path (e.g. "/api/v1/utility/responses"), not a protocol-relative or absolute URL; received "${trimmed}"`
10050
+ };
10051
+ }
10052
+ return { valid: true, endpoint: trimmed.startsWith("/") ? trimmed : `/${trimmed}` };
10053
+ }
10029
10054
  async function runToolLoop(options) {
10030
10055
  const {
10031
10056
  model,
@@ -10033,6 +10058,7 @@ async function runToolLoop(options) {
10033
10058
  baseUrl = BASE_URL,
10034
10059
  headers,
10035
10060
  apiType = "auto",
10061
+ endpointOverride,
10036
10062
  temperature,
10037
10063
  maxOutputTokens,
10038
10064
  tools,
@@ -10115,6 +10141,20 @@ async function runToolLoop(options) {
10115
10141
  await fireRunError({ error: msg, stage: "model", errorObject: new Error(msg) });
10116
10142
  return { data: null, error: msg };
10117
10143
  }
10144
+ let effectiveEndpoint = strategy.endpoint;
10145
+ if (endpointOverride !== void 0) {
10146
+ const overrideValidation = validateEndpointOverride(endpointOverride);
10147
+ if (!overrideValidation.valid) {
10148
+ if (onError) onError(new Error(overrideValidation.message));
10149
+ await fireRunError({
10150
+ error: overrideValidation.message,
10151
+ stage: "model",
10152
+ errorObject: new Error(overrideValidation.message)
10153
+ });
10154
+ return { data: null, error: overrideValidation.message };
10155
+ }
10156
+ effectiveEndpoint = overrideValidation.endpoint;
10157
+ }
10118
10158
  const { signal: combinedSignal, cleanup: cleanupSignalLink } = linkAbortSignals(
10119
10159
  signal,
10120
10160
  detachSignal
@@ -10298,7 +10338,7 @@ async function runToolLoop(options) {
10298
10338
  if (onRequest) onRequest(measureRequest(0, attempt, requestBody, messages, apiTools));
10299
10339
  const sseResult = makeStreamingRequest({
10300
10340
  baseUrl,
10301
- endpoint: strategy.endpoint,
10341
+ endpoint: effectiveEndpoint,
10302
10342
  body: requestBody,
10303
10343
  token,
10304
10344
  headers: effectiveHeaders,
@@ -10770,7 +10810,7 @@ Executing tool: ${toolInfo}
10770
10810
  const continuationRound = toolIteration;
10771
10811
  const continuationResult = makeStreamingRequest({
10772
10812
  baseUrl,
10773
- endpoint: strategy.endpoint,
10813
+ endpoint: effectiveEndpoint,
10774
10814
  body: continuationRequestBody,
10775
10815
  token,
10776
10816
  headers: effectiveHeaders,
@@ -11515,6 +11555,7 @@ export {
11515
11555
  decryptData,
11516
11556
  decryptDataBatch,
11517
11557
  decryptDataBytes,
11558
+ decryptDataBytesFromBytes,
11518
11559
  decryptDataWithKey,
11519
11560
  defaultServerToolsFilter,
11520
11561
  deleteAllVaultMemoriesForUserOp,
@@ -11533,6 +11574,7 @@ export {
11533
11574
  embedMessage,
11534
11575
  encryptData,
11535
11576
  encryptDataBatch,
11577
+ encryptDataBytes,
11536
11578
  encryptDataWithKey,
11537
11579
  ensureDefaultFoldersOp,
11538
11580
  estimateMessagesTokens,
@@ -11561,6 +11603,7 @@ export {
11561
11603
  getConversationsByProjectOp,
11562
11604
  getConversationsLazyOp,
11563
11605
  getConversationsOp,
11606
+ getConversationsPageOp,
11564
11607
  getDocumentsOp,
11565
11608
  getEncryptionKey,
11566
11609
  getImagesOp,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-Z6II54I7.mjs";
3
+ } from "./chunk-QQOIC37O.mjs";
4
4
  import "./chunk-AHJT66EO.mjs";
5
5
  import "./chunk-3RPGXXPZ.mjs";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "2.6.1",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",