@anuma/sdk 8.0.2 → 8.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/expo/index.cjs +228 -5
- package/dist/expo/index.d.mts +113 -2
- package/dist/expo/index.d.ts +113 -2
- package/dist/expo/index.mjs +224 -5
- package/dist/index.cjs +21 -1
- package/dist/index.mjs +21 -1
- package/dist/react/index.cjs +238 -5
- package/dist/react/index.d.mts +117 -2
- package/dist/react/index.d.ts +117 -2
- package/dist/react/index.mjs +234 -5
- package/dist/server/index.cjs +54 -3
- package/dist/server/index.d.mts +6 -1
- package/dist/server/index.d.ts +6 -1
- package/dist/server/index.mjs +54 -3
- package/dist/tools/index.cjs +142 -0
- package/dist/tools/index.d.mts +91 -1
- package/dist/tools/index.d.ts +91 -1
- package/dist/tools/index.mjs +138 -0
- package/dist/tools/selection/index.cjs +25 -3
- package/dist/tools/selection/index.d.mts +1 -1
- package/dist/tools/selection/index.d.ts +1 -1
- package/dist/tools/selection/index.mjs +25 -3
- package/package.json +1 -1
package/dist/expo/index.d.ts
CHANGED
|
@@ -8239,7 +8239,7 @@ declare function clearConversationMemoriesOp(ctx: ConversationMemoryOperationsCo
|
|
|
8239
8239
|
* - v48: Added kind, kind_value (encrypted) and level to memory_vault; level is
|
|
8240
8240
|
* backfilled from scope where SQL steps run
|
|
8241
8241
|
*/
|
|
8242
|
-
declare const SDK_SCHEMA_VERSION =
|
|
8242
|
+
declare const SDK_SCHEMA_VERSION = 49;
|
|
8243
8243
|
/**
|
|
8244
8244
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
8245
8245
|
*
|
|
@@ -11004,6 +11004,117 @@ declare function createNotionTools(getAccessToken: () => string | null, requestN
|
|
|
11004
11004
|
*/
|
|
11005
11005
|
declare function createNotionProxyTools(callMcp: NotionMcpCaller): ToolConfig[];
|
|
11006
11006
|
|
|
11007
|
+
/**
|
|
11008
|
+
* Minimal context interface required by tool factories.
|
|
11009
|
+
* Matches the methods provided by UIInteractionProvider.
|
|
11010
|
+
*/
|
|
11011
|
+
type UIInteractionContext = {
|
|
11012
|
+
createInteraction: (id: string, type: string, data: unknown) => Promise<unknown>;
|
|
11013
|
+
/** Rejects and removes a pending interaction. Optional for older contexts. */
|
|
11014
|
+
cancelInteraction?: (id: string) => void;
|
|
11015
|
+
createDisplayInteraction: (id: string, displayType: string, data: unknown, result: unknown, toolVersion?: number, replacesInteractionId?: string) => void;
|
|
11016
|
+
};
|
|
11017
|
+
/**
|
|
11018
|
+
* Options for context injection, following the same getter pattern
|
|
11019
|
+
* as createGoogleCalendarTool and createDriveTools.
|
|
11020
|
+
*/
|
|
11021
|
+
type CreateUIToolsOptions = {
|
|
11022
|
+
/** Returns the current UIInteractionContext (or null if unavailable) */
|
|
11023
|
+
getContext: () => UIInteractionContext | null;
|
|
11024
|
+
/** Returns the ID of the last message in the conversation (used for anchoring) */
|
|
11025
|
+
getLastMessageId?: () => string | undefined;
|
|
11026
|
+
};
|
|
11027
|
+
|
|
11028
|
+
/** A wallet the user can pay from, as the wallet picker card shows it. */
|
|
11029
|
+
type PaymentWallet = {
|
|
11030
|
+
address: string;
|
|
11031
|
+
chainType: "solana";
|
|
11032
|
+
label?: string;
|
|
11033
|
+
walletName?: string;
|
|
11034
|
+
usdcBalance?: string;
|
|
11035
|
+
builtIn?: boolean;
|
|
11036
|
+
};
|
|
11037
|
+
/** What the wallet picker returns to the model. */
|
|
11038
|
+
type SelectPaymentWalletResult = {
|
|
11039
|
+
confirmed: true;
|
|
11040
|
+
offer_id: string;
|
|
11041
|
+
funding_wallet: string;
|
|
11042
|
+
} | {
|
|
11043
|
+
confirmed: false;
|
|
11044
|
+
} | {
|
|
11045
|
+
cancelled: true;
|
|
11046
|
+
} | {
|
|
11047
|
+
error_code: "wallets_unavailable";
|
|
11048
|
+
retryable: true;
|
|
11049
|
+
};
|
|
11050
|
+
/** One passenger as the payment card collects it. */
|
|
11051
|
+
type WalletPaymentPassenger = Record<string, unknown>;
|
|
11052
|
+
/** What the caller's `pay` function receives once the user has filled in the payment card. */
|
|
11053
|
+
type WalletPaymentRequest = {
|
|
11054
|
+
provider: string;
|
|
11055
|
+
reference: string;
|
|
11056
|
+
passengers: WalletPaymentPassenger[];
|
|
11057
|
+
};
|
|
11058
|
+
/** What the caller's `pay` function resolves with. */
|
|
11059
|
+
type WalletPaymentOutcome = {
|
|
11060
|
+
paid: true;
|
|
11061
|
+
provider: string;
|
|
11062
|
+
reference: string;
|
|
11063
|
+
status: string;
|
|
11064
|
+
} | {
|
|
11065
|
+
paid: false;
|
|
11066
|
+
error_code: string;
|
|
11067
|
+
retryable: boolean;
|
|
11068
|
+
};
|
|
11069
|
+
/** What the payment tool returns to the model. */
|
|
11070
|
+
type WalletPaymentResult = WalletPaymentOutcome | {
|
|
11071
|
+
cancelled: true;
|
|
11072
|
+
};
|
|
11073
|
+
/** Options for {@link createSelectPaymentWalletTool}. */
|
|
11074
|
+
type CreateSelectPaymentWalletToolOptions = CreateUIToolsOptions & {
|
|
11075
|
+
listWallets: () => Promise<PaymentWallet[]>;
|
|
11076
|
+
};
|
|
11077
|
+
/** Options for {@link createWalletPaymentTool}. */
|
|
11078
|
+
type CreateWalletPaymentToolOptions = CreateUIToolsOptions & {
|
|
11079
|
+
/** Pays the booking: if `signal` fires before submitting, stop there; if it fires after submitting, show the user the real outcome, because the tool result will read cancelled. */
|
|
11080
|
+
pay: (request: WalletPaymentRequest, signal?: AbortSignal) => Promise<WalletPaymentOutcome>;
|
|
11081
|
+
};
|
|
11082
|
+
/**
|
|
11083
|
+
* Create the select_payment_wallet tool, which shows the user's wallets for a flight offer and returns the one they chose.
|
|
11084
|
+
*
|
|
11085
|
+
* @example
|
|
11086
|
+
* ```typescript
|
|
11087
|
+
* import { createSelectPaymentWalletTool } from "@anuma/sdk/tools";
|
|
11088
|
+
*
|
|
11089
|
+
* const selectWalletTool = createSelectPaymentWalletTool({
|
|
11090
|
+
* getContext: () => uiInteraction,
|
|
11091
|
+
* getLastMessageId: () => lastMsgId,
|
|
11092
|
+
* listWallets: async () => wallets,
|
|
11093
|
+
* });
|
|
11094
|
+
* ```
|
|
11095
|
+
*/
|
|
11096
|
+
declare function createSelectPaymentWalletTool(options: CreateSelectPaymentWalletToolOptions): ToolConfig;
|
|
11097
|
+
/**
|
|
11098
|
+
* Create the prompt_wallet_payment tool, which collects the passengers on a card and then pays the booking through the caller's `pay` function.
|
|
11099
|
+
*
|
|
11100
|
+
* @example
|
|
11101
|
+
* ```typescript
|
|
11102
|
+
* import { createWalletPaymentTool } from "@anuma/sdk/tools";
|
|
11103
|
+
*
|
|
11104
|
+
* const paymentTool = createWalletPaymentTool({
|
|
11105
|
+
* getContext: () => uiInteraction,
|
|
11106
|
+
* getLastMessageId: () => lastMsgId,
|
|
11107
|
+
* pay: (request, signal) => payFromWallet(request, signal),
|
|
11108
|
+
* });
|
|
11109
|
+
* ```
|
|
11110
|
+
*/
|
|
11111
|
+
declare function createWalletPaymentTool(options: CreateWalletPaymentToolOptions): ToolConfig;
|
|
11112
|
+
|
|
11113
|
+
/** Name of the client tool that shows the wallet picker card for a flight payment. */
|
|
11114
|
+
declare const SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
11115
|
+
/** Name of the client tool that collects passengers and pays a booking from the chosen wallet. */
|
|
11116
|
+
declare const WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
11117
|
+
|
|
11007
11118
|
type SendMessageArgs = BaseSendMessageArgs & {
|
|
11008
11119
|
/**
|
|
11009
11120
|
* Per-request callback for thinking/reasoning chunks.
|
|
@@ -11529,4 +11640,4 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
11529
11640
|
*/
|
|
11530
11641
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
11531
11642
|
|
|
11532
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, memoryCipher, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
|
11643
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateSelectPaymentWalletToolOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CreateWalletPaymentToolOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PaymentWallet, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectPaymentWalletResult, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSelectPaymentWalletTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, memoryCipher, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
package/dist/expo/index.mjs
CHANGED
|
@@ -4847,6 +4847,17 @@ function missingConfirmFields(action, parameters) {
|
|
|
4847
4847
|
return requirement.fields.filter((field10) => !shown.has(field10));
|
|
4848
4848
|
}
|
|
4849
4849
|
|
|
4850
|
+
// src/tools/walletPaymentConstants.ts
|
|
4851
|
+
var SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
4852
|
+
var WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
4853
|
+
var FLIGHT_BOOK_TOOL_SET = "flight-book";
|
|
4854
|
+
var FLIGHT_SERVER_TOOL_NAMES = [
|
|
4855
|
+
"AnumaPaymentsMCP-anuma_search_flights",
|
|
4856
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
4857
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
4858
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
4859
|
+
];
|
|
4860
|
+
|
|
4850
4861
|
// src/lib/storage/mcpImages.ts
|
|
4851
4862
|
var IMAGE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
4852
4863
|
"AnumaMediaMCP-anuma_create_image",
|
|
@@ -5542,7 +5553,8 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
5542
5553
|
"AnumaPaymentsMCP-anuma_cancel_reservation"
|
|
5543
5554
|
],
|
|
5544
5555
|
anchors: []
|
|
5545
|
-
}
|
|
5556
|
+
},
|
|
5557
|
+
{ name: FLIGHT_BOOK_TOOL_SET, members: [...FLIGHT_SERVER_TOOL_NAMES], anchors: [] }
|
|
5546
5558
|
];
|
|
5547
5559
|
var CONFIRMED_ACTION_TOOL_SETS = /* @__PURE__ */ new Map([
|
|
5548
5560
|
["book_restaurant", "restaurant-book"],
|
|
@@ -5674,6 +5686,16 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
5674
5686
|
members: ["AnumaPaymentsMCP-anuma_list_reservations"],
|
|
5675
5687
|
anchors: ["AnumaPaymentsMCP-anuma_cancel_reservation"],
|
|
5676
5688
|
anchorMinSimilarity: 0.5
|
|
5689
|
+
},
|
|
5690
|
+
{
|
|
5691
|
+
name: "flight-book-lookup",
|
|
5692
|
+
members: [
|
|
5693
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
5694
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
5695
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
5696
|
+
],
|
|
5697
|
+
anchors: ["AnumaPaymentsMCP-anuma_search_flights"],
|
|
5698
|
+
anchorMinSimilarity: 0.5
|
|
5677
5699
|
}
|
|
5678
5700
|
];
|
|
5679
5701
|
var defaultServerToolsFilter = createServerToolsFilter({
|
|
@@ -7935,7 +7957,14 @@ function getToolName(tool) {
|
|
|
7935
7957
|
function toolsAfterConfirmation(apiTools, executionResults) {
|
|
7936
7958
|
const members = /* @__PURE__ */ new Set();
|
|
7937
7959
|
let keepConfirm = false;
|
|
7960
|
+
let keepPaymentTools = false;
|
|
7938
7961
|
for (const r of executionResults) {
|
|
7962
|
+
if (r.name === SELECT_PAYMENT_WALLET_TOOL_NAME && r.result?.confirmed === true) {
|
|
7963
|
+
const flightSet = BUILT_IN_TOOL_SETS.find((s) => s.name === FLIGHT_BOOK_TOOL_SET);
|
|
7964
|
+
for (const member of flightSet?.members ?? []) members.add(member);
|
|
7965
|
+
keepPaymentTools = true;
|
|
7966
|
+
continue;
|
|
7967
|
+
}
|
|
7939
7968
|
if (r.name !== CONFIRM_TOOL_NAME) continue;
|
|
7940
7969
|
const answer = r.result;
|
|
7941
7970
|
if (answer?.confirmed !== true || typeof answer.action !== "string") continue;
|
|
@@ -7947,7 +7976,7 @@ function toolsAfterConfirmation(apiTools, executionResults) {
|
|
|
7947
7976
|
if (!apiTools.some((t) => members.has(getToolName(t) ?? ""))) return void 0;
|
|
7948
7977
|
return apiTools.filter((t) => {
|
|
7949
7978
|
const name = getToolName(t) ?? "";
|
|
7950
|
-
return members.has(name) || name === TOOL_SEARCH_TOOL_NAME || keepConfirm && name === CONFIRM_TOOL_NAME;
|
|
7979
|
+
return members.has(name) || name === TOOL_SEARCH_TOOL_NAME || keepConfirm && name === CONFIRM_TOOL_NAME || keepPaymentTools && (name === SELECT_PAYMENT_WALLET_TOOL_NAME || name === WALLET_PAYMENT_TOOL_NAME);
|
|
7951
7980
|
});
|
|
7952
7981
|
}
|
|
7953
7982
|
var STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
|
|
@@ -10321,6 +10350,9 @@ __decorateClass([
|
|
|
10321
10350
|
__decorateClass([
|
|
10322
10351
|
text11("personality")
|
|
10323
10352
|
], UserPreference.prototype, "personality", 2);
|
|
10353
|
+
__decorateClass([
|
|
10354
|
+
text11("external_wallets")
|
|
10355
|
+
], UserPreference.prototype, "externalWallets", 2);
|
|
10324
10356
|
__decorateClass([
|
|
10325
10357
|
field8("created_at")
|
|
10326
10358
|
], UserPreference.prototype, "createdAt", 2);
|
|
@@ -10358,7 +10390,7 @@ __decorateClass([
|
|
|
10358
10390
|
], VaultFolder.prototype, "context", 2);
|
|
10359
10391
|
|
|
10360
10392
|
// src/lib/db/schema.ts
|
|
10361
|
-
var SDK_SCHEMA_VERSION =
|
|
10393
|
+
var SDK_SCHEMA_VERSION = 49;
|
|
10362
10394
|
var sdkSchema = appSchema2({
|
|
10363
10395
|
version: SDK_SCHEMA_VERSION,
|
|
10364
10396
|
tables: [
|
|
@@ -10444,6 +10476,7 @@ var sdkSchema = appSchema2({
|
|
|
10444
10476
|
{ name: "description", type: "string", isOptional: true },
|
|
10445
10477
|
{ name: "models", type: "string", isOptional: true },
|
|
10446
10478
|
{ name: "personality", type: "string", isOptional: true },
|
|
10479
|
+
{ name: "external_wallets", type: "string", isOptional: true },
|
|
10447
10480
|
{ name: "created_at", type: "number" },
|
|
10448
10481
|
{ name: "updated_at", type: "number" }
|
|
10449
10482
|
]
|
|
@@ -11148,6 +11181,15 @@ var sdkMigrations = schemaMigrations2({
|
|
|
11148
11181
|
"UPDATE memory_vault SET level = CASE WHEN scope IN ('shared', 'public') THEN 'matching' ELSE 'private' END WHERE level IS NULL;"
|
|
11149
11182
|
)
|
|
11150
11183
|
]
|
|
11184
|
+
},
|
|
11185
|
+
{
|
|
11186
|
+
toVersion: 49,
|
|
11187
|
+
steps: [
|
|
11188
|
+
addColumns2({
|
|
11189
|
+
table: "userPreferences",
|
|
11190
|
+
columns: [{ name: "external_wallets", type: "string", isOptional: true }]
|
|
11191
|
+
})
|
|
11192
|
+
]
|
|
11151
11193
|
}
|
|
11152
11194
|
]
|
|
11153
11195
|
});
|
|
@@ -24095,7 +24137,7 @@ function computeToolGuidance(selectedServerTools, selectedClientTools, extraTool
|
|
|
24095
24137
|
async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embeddingOptions, extraToolSets = [], activeToolSets = [], noEmbeddingsReason = "short-prompt") {
|
|
24096
24138
|
const isAlwaysIncluded = (t) => {
|
|
24097
24139
|
const name = getToolName2(t);
|
|
24098
|
-
return name.startsWith("memory_vault_") || name === RECALL_TOOL_NAME || name === CONFIRM_TOOL_NAME;
|
|
24140
|
+
return name.startsWith("memory_vault_") || name === RECALL_TOOL_NAME || name === CONFIRM_TOOL_NAME || name === SELECT_PAYMENT_WALLET_TOOL_NAME || name === WALLET_PAYMENT_TOOL_NAME;
|
|
24099
24141
|
};
|
|
24100
24142
|
const alwaysInclude = clientTools.filter(isAlwaysIncluded);
|
|
24101
24143
|
const filterCandidates = clientTools.filter((t) => !isAlwaysIncluded(t));
|
|
@@ -24107,7 +24149,7 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
|
|
|
24107
24149
|
}
|
|
24108
24150
|
if (!promptEmbeddings) {
|
|
24109
24151
|
if (activeToolSets.length === 0) {
|
|
24110
|
-
return { tools:
|
|
24152
|
+
return { tools: alwaysInclude, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
|
|
24111
24153
|
}
|
|
24112
24154
|
const allSets = extraToolSets.length > 0 ? [...BUILT_IN_TOOL_SETS, ...extraToolSets] : BUILT_IN_TOOL_SETS;
|
|
24113
24155
|
const activeSets = allSets.filter((s) => activeToolSets.includes(s.name));
|
|
@@ -25253,6 +25295,179 @@ function createNotionProxyTools(callMcp) {
|
|
|
25253
25295
|
return NOTION_TOOLS.map((tool) => tool(run));
|
|
25254
25296
|
}
|
|
25255
25297
|
|
|
25298
|
+
// src/tools/uiInteraction.ts
|
|
25299
|
+
function generateInteractionId(prefix) {
|
|
25300
|
+
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
25301
|
+
}
|
|
25302
|
+
function createInteractiveTool(options, config) {
|
|
25303
|
+
return {
|
|
25304
|
+
type: "function",
|
|
25305
|
+
function: {
|
|
25306
|
+
name: config.name,
|
|
25307
|
+
description: config.description,
|
|
25308
|
+
arguments: config.parameters
|
|
25309
|
+
},
|
|
25310
|
+
executor: async (args, signal) => {
|
|
25311
|
+
if (config.validate && !config.validate(args)) {
|
|
25312
|
+
return { cancelled: true };
|
|
25313
|
+
}
|
|
25314
|
+
const context = options.getContext();
|
|
25315
|
+
if (!context) {
|
|
25316
|
+
return { cancelled: true };
|
|
25317
|
+
}
|
|
25318
|
+
const interactionId = generateInteractionId(config.interactionType);
|
|
25319
|
+
const interactionData = config.mapArgs ? config.mapArgs(args) : args;
|
|
25320
|
+
const onAbort = () => context.cancelInteraction?.(interactionId);
|
|
25321
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
25322
|
+
try {
|
|
25323
|
+
const result = await context.createInteraction(interactionId, config.interactionType, {
|
|
25324
|
+
...interactionData,
|
|
25325
|
+
afterMessageId: options.getLastMessageId?.()
|
|
25326
|
+
});
|
|
25327
|
+
if (config.mapResult) {
|
|
25328
|
+
return config.mapResult(result, args);
|
|
25329
|
+
}
|
|
25330
|
+
return result;
|
|
25331
|
+
} catch {
|
|
25332
|
+
return { cancelled: true };
|
|
25333
|
+
} finally {
|
|
25334
|
+
signal?.removeEventListener("abort", onAbort);
|
|
25335
|
+
}
|
|
25336
|
+
},
|
|
25337
|
+
executorTimeout: Infinity
|
|
25338
|
+
};
|
|
25339
|
+
}
|
|
25340
|
+
|
|
25341
|
+
// src/tools/walletPayment.ts
|
|
25342
|
+
var CANCELLED = { cancelled: true };
|
|
25343
|
+
function isNonEmptyString(value) {
|
|
25344
|
+
return typeof value === "string" && value.length > 0;
|
|
25345
|
+
}
|
|
25346
|
+
function hasPassengers(value) {
|
|
25347
|
+
return Array.isArray(value?.passengers);
|
|
25348
|
+
}
|
|
25349
|
+
function createSelectPaymentWalletTool(options) {
|
|
25350
|
+
const tool = createInteractiveTool(options, {
|
|
25351
|
+
name: SELECT_PAYMENT_WALLET_TOOL_NAME,
|
|
25352
|
+
description: "Show the user a card with the flight offer and their wallets, and let them pick the wallet to pay from. Call it after anuma_flight_offer_details, with the exact offer id, price and currency from that result. Returns the chosen wallet, or that the user declined.",
|
|
25353
|
+
parameters: {
|
|
25354
|
+
type: "object",
|
|
25355
|
+
properties: {
|
|
25356
|
+
offer_id: {
|
|
25357
|
+
type: "string",
|
|
25358
|
+
description: "The offer id from anuma_flight_offer_details"
|
|
25359
|
+
},
|
|
25360
|
+
summary: {
|
|
25361
|
+
type: "string",
|
|
25362
|
+
description: "Route, dates and fare of the offer, as shown to the user"
|
|
25363
|
+
},
|
|
25364
|
+
amount: {
|
|
25365
|
+
type: "string",
|
|
25366
|
+
description: "Total price of the offer, e.g. '412.50'"
|
|
25367
|
+
},
|
|
25368
|
+
currency: {
|
|
25369
|
+
type: "string",
|
|
25370
|
+
description: "Currency of the price, e.g. 'USD'"
|
|
25371
|
+
}
|
|
25372
|
+
},
|
|
25373
|
+
required: ["offer_id", "amount", "currency"]
|
|
25374
|
+
},
|
|
25375
|
+
interactionType: "select_payment_wallet",
|
|
25376
|
+
validate: (args) => isNonEmptyString(args.offer_id),
|
|
25377
|
+
mapArgs: ({ offer_id, summary, amount, currency, wallets }) => ({
|
|
25378
|
+
offer_id,
|
|
25379
|
+
summary,
|
|
25380
|
+
amount,
|
|
25381
|
+
currency,
|
|
25382
|
+
wallets
|
|
25383
|
+
}),
|
|
25384
|
+
mapResult: (result, args) => {
|
|
25385
|
+
if (result?.confirmed === true && isNonEmptyString(result.funding_wallet)) {
|
|
25386
|
+
return {
|
|
25387
|
+
confirmed: true,
|
|
25388
|
+
offer_id: args.offer_id,
|
|
25389
|
+
funding_wallet: result.funding_wallet
|
|
25390
|
+
};
|
|
25391
|
+
}
|
|
25392
|
+
if (result?.confirmed === false) return { confirmed: false };
|
|
25393
|
+
return CANCELLED;
|
|
25394
|
+
}
|
|
25395
|
+
});
|
|
25396
|
+
const showCard = tool.executor;
|
|
25397
|
+
return {
|
|
25398
|
+
...tool,
|
|
25399
|
+
executor: async (args, signal) => {
|
|
25400
|
+
if (!isNonEmptyString(args.offer_id)) return CANCELLED;
|
|
25401
|
+
let wallets;
|
|
25402
|
+
try {
|
|
25403
|
+
wallets = await options.listWallets();
|
|
25404
|
+
} catch {
|
|
25405
|
+
return { error_code: "wallets_unavailable", retryable: true };
|
|
25406
|
+
}
|
|
25407
|
+
if (signal?.aborted) return CANCELLED;
|
|
25408
|
+
return showCard?.({ ...args, wallets }, signal);
|
|
25409
|
+
}
|
|
25410
|
+
};
|
|
25411
|
+
}
|
|
25412
|
+
function createWalletPaymentTool(options) {
|
|
25413
|
+
const tool = createInteractiveTool(options, {
|
|
25414
|
+
name: WALLET_PAYMENT_TOOL_NAME,
|
|
25415
|
+
description: "Show the user a card to enter the passengers, then pay the flight booking from the wallet they chose. Call it after anuma_create_flight_intent, with the provider and reference from that result. Returns whether the payment went through.",
|
|
25416
|
+
parameters: {
|
|
25417
|
+
type: "object",
|
|
25418
|
+
properties: {
|
|
25419
|
+
provider: {
|
|
25420
|
+
type: "string",
|
|
25421
|
+
description: "The payment provider from anuma_create_flight_intent"
|
|
25422
|
+
},
|
|
25423
|
+
reference: {
|
|
25424
|
+
type: "string",
|
|
25425
|
+
description: "The payment reference from anuma_create_flight_intent"
|
|
25426
|
+
},
|
|
25427
|
+
passenger_count: {
|
|
25428
|
+
type: "integer",
|
|
25429
|
+
minimum: 1,
|
|
25430
|
+
description: "How many passengers the booking is for"
|
|
25431
|
+
}
|
|
25432
|
+
},
|
|
25433
|
+
required: ["provider", "reference", "passenger_count"]
|
|
25434
|
+
},
|
|
25435
|
+
interactionType: "prompt_wallet_payment",
|
|
25436
|
+
validate: (args) => isNonEmptyString(args.provider) && isNonEmptyString(args.reference) && Number.isInteger(args.passenger_count) && args.passenger_count >= 1,
|
|
25437
|
+
mapArgs: ({ provider, reference, passenger_count }) => ({
|
|
25438
|
+
provider,
|
|
25439
|
+
reference,
|
|
25440
|
+
passenger_count
|
|
25441
|
+
}),
|
|
25442
|
+
mapResult: (result) => hasPassengers(result) ? { passengers: result.passengers } : CANCELLED
|
|
25443
|
+
});
|
|
25444
|
+
const showCard = tool.executor;
|
|
25445
|
+
return {
|
|
25446
|
+
...tool,
|
|
25447
|
+
executor: async (args, signal) => {
|
|
25448
|
+
const answer = await showCard?.(args, signal);
|
|
25449
|
+
if (!hasPassengers(answer) || signal?.aborted) return CANCELLED;
|
|
25450
|
+
const provider = args.provider;
|
|
25451
|
+
const reference = args.reference;
|
|
25452
|
+
let outcome2;
|
|
25453
|
+
try {
|
|
25454
|
+
outcome2 = await options.pay({ provider, reference, passengers: answer.passengers }, signal);
|
|
25455
|
+
} catch {
|
|
25456
|
+
return { paid: false, error_code: "payment_failed", retryable: false };
|
|
25457
|
+
}
|
|
25458
|
+
if (outcome2.paid) {
|
|
25459
|
+
return {
|
|
25460
|
+
paid: true,
|
|
25461
|
+
provider: outcome2.provider,
|
|
25462
|
+
reference: outcome2.reference,
|
|
25463
|
+
status: outcome2.status
|
|
25464
|
+
};
|
|
25465
|
+
}
|
|
25466
|
+
return { paid: false, error_code: outcome2.error_code, retryable: outcome2.retryable };
|
|
25467
|
+
}
|
|
25468
|
+
};
|
|
25469
|
+
}
|
|
25470
|
+
|
|
25256
25471
|
// src/expo/useChat.ts
|
|
25257
25472
|
import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
25258
25473
|
function useChat(options) {
|
|
@@ -28419,6 +28634,7 @@ export {
|
|
|
28419
28634
|
RemoteMemoryPartialCreateError,
|
|
28420
28635
|
RerankerUnavailableError,
|
|
28421
28636
|
SDK_SCHEMA_VERSION,
|
|
28637
|
+
SELECT_PAYMENT_WALLET_TOOL_NAME,
|
|
28422
28638
|
SHORT_TTL_MS,
|
|
28423
28639
|
STREAM_RESUMABLE_HEADER,
|
|
28424
28640
|
VaultFolder as StoredVaultFolderModel,
|
|
@@ -28431,6 +28647,7 @@ export {
|
|
|
28431
28647
|
TREND_RECENT_WINDOW_DAYS,
|
|
28432
28648
|
TREND_STALE_WINDOW_DAYS,
|
|
28433
28649
|
VAULT_SIZE_HOP_CAP,
|
|
28650
|
+
WALLET_PAYMENT_TOOL_NAME,
|
|
28434
28651
|
WalletPoller,
|
|
28435
28652
|
addConversationMemoriesOp,
|
|
28436
28653
|
archiveVaultMemoryOp,
|
|
@@ -28485,12 +28702,14 @@ export {
|
|
|
28485
28702
|
createRemoteMemoryPersistence,
|
|
28486
28703
|
createRemoteMemoryPipeline,
|
|
28487
28704
|
createRemoteMemoryStore,
|
|
28705
|
+
createSelectPaymentWalletTool,
|
|
28488
28706
|
createStockPricePreProcessor,
|
|
28489
28707
|
createStreamingDeAnonymizer,
|
|
28490
28708
|
createVaultEmbeddingCache,
|
|
28491
28709
|
createVaultFolderOp,
|
|
28492
28710
|
createVaultMemoriesBatchOp,
|
|
28493
28711
|
createVaultMemoryOp,
|
|
28712
|
+
createWalletPaymentTool,
|
|
28494
28713
|
createWeatherPreProcessor,
|
|
28495
28714
|
createWebSearchPreProcessor,
|
|
28496
28715
|
decodeChunkVector,
|
package/dist/index.cjs
CHANGED
|
@@ -3281,6 +3281,15 @@ async function* withSseKeepalive(source, options = {}) {
|
|
|
3281
3281
|
}
|
|
3282
3282
|
}
|
|
3283
3283
|
|
|
3284
|
+
// src/tools/walletPaymentConstants.ts
|
|
3285
|
+
var FLIGHT_BOOK_TOOL_SET = "flight-book";
|
|
3286
|
+
var FLIGHT_SERVER_TOOL_NAMES = [
|
|
3287
|
+
"AnumaPaymentsMCP-anuma_search_flights",
|
|
3288
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
3289
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
3290
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
3291
|
+
];
|
|
3292
|
+
|
|
3284
3293
|
// src/tools/appBuilderPrompt.ts
|
|
3285
3294
|
var APP_BUILDER_PROMPT = `App Builder tools (create_file, patch_file, and the rest described below) are available this turn, but they are OPTIONAL \u2014 having them does not mean you should build anything.
|
|
3286
3295
|
|
|
@@ -3784,7 +3793,8 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
3784
3793
|
"AnumaPaymentsMCP-anuma_cancel_reservation"
|
|
3785
3794
|
],
|
|
3786
3795
|
anchors: []
|
|
3787
|
-
}
|
|
3796
|
+
},
|
|
3797
|
+
{ name: FLIGHT_BOOK_TOOL_SET, members: [...FLIGHT_SERVER_TOOL_NAMES], anchors: [] }
|
|
3788
3798
|
];
|
|
3789
3799
|
function applyToolSets(matchedNames, availableNames, scores, toolSets = BUILT_IN_TOOL_SETS, independentThreshold = 0.65) {
|
|
3790
3800
|
const activatedSets = [];
|
|
@@ -3927,6 +3937,16 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
3927
3937
|
members: ["AnumaPaymentsMCP-anuma_list_reservations"],
|
|
3928
3938
|
anchors: ["AnumaPaymentsMCP-anuma_cancel_reservation"],
|
|
3929
3939
|
anchorMinSimilarity: 0.5
|
|
3940
|
+
},
|
|
3941
|
+
{
|
|
3942
|
+
name: "flight-book-lookup",
|
|
3943
|
+
members: [
|
|
3944
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
3945
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
3946
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
3947
|
+
],
|
|
3948
|
+
anchors: ["AnumaPaymentsMCP-anuma_search_flights"],
|
|
3949
|
+
anchorMinSimilarity: 0.5
|
|
3930
3950
|
}
|
|
3931
3951
|
];
|
|
3932
3952
|
var defaultServerToolsFilter = createServerToolsFilter({
|
package/dist/index.mjs
CHANGED
|
@@ -3077,6 +3077,15 @@ async function* withSseKeepalive(source, options = {}) {
|
|
|
3077
3077
|
}
|
|
3078
3078
|
}
|
|
3079
3079
|
|
|
3080
|
+
// src/tools/walletPaymentConstants.ts
|
|
3081
|
+
var FLIGHT_BOOK_TOOL_SET = "flight-book";
|
|
3082
|
+
var FLIGHT_SERVER_TOOL_NAMES = [
|
|
3083
|
+
"AnumaPaymentsMCP-anuma_search_flights",
|
|
3084
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
3085
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
3086
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
3087
|
+
];
|
|
3088
|
+
|
|
3080
3089
|
// src/tools/appBuilderPrompt.ts
|
|
3081
3090
|
var APP_BUILDER_PROMPT = `App Builder tools (create_file, patch_file, and the rest described below) are available this turn, but they are OPTIONAL \u2014 having them does not mean you should build anything.
|
|
3082
3091
|
|
|
@@ -3580,7 +3589,8 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
3580
3589
|
"AnumaPaymentsMCP-anuma_cancel_reservation"
|
|
3581
3590
|
],
|
|
3582
3591
|
anchors: []
|
|
3583
|
-
}
|
|
3592
|
+
},
|
|
3593
|
+
{ name: FLIGHT_BOOK_TOOL_SET, members: [...FLIGHT_SERVER_TOOL_NAMES], anchors: [] }
|
|
3584
3594
|
];
|
|
3585
3595
|
function applyToolSets(matchedNames, availableNames, scores, toolSets = BUILT_IN_TOOL_SETS, independentThreshold = 0.65) {
|
|
3586
3596
|
const activatedSets = [];
|
|
@@ -3723,6 +3733,16 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
3723
3733
|
members: ["AnumaPaymentsMCP-anuma_list_reservations"],
|
|
3724
3734
|
anchors: ["AnumaPaymentsMCP-anuma_cancel_reservation"],
|
|
3725
3735
|
anchorMinSimilarity: 0.5
|
|
3736
|
+
},
|
|
3737
|
+
{
|
|
3738
|
+
name: "flight-book-lookup",
|
|
3739
|
+
members: [
|
|
3740
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
3741
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
3742
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
3743
|
+
],
|
|
3744
|
+
anchors: ["AnumaPaymentsMCP-anuma_search_flights"],
|
|
3745
|
+
anchorMinSimilarity: 0.5
|
|
3726
3746
|
}
|
|
3727
3747
|
];
|
|
3728
3748
|
var defaultServerToolsFilter = createServerToolsFilter({
|