@anuma/sdk 8.0.1 → 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 +542 -227
- package/dist/expo/index.d.mts +113 -2
- package/dist/expo/index.d.ts +113 -2
- package/dist/expo/index.mjs +490 -179
- package/dist/index.cjs +21 -1
- package/dist/index.mjs +21 -1
- package/dist/react/index.cjs +651 -326
- package/dist/react/index.d.mts +117 -2
- package/dist/react/index.d.ts +117 -2
- package/dist/react/index.mjs +593 -272
- package/dist/server/index.cjs +63 -4
- package/dist/server/index.d.mts +6 -1
- package/dist/server/index.d.ts +6 -1
- package/dist/server/index.mjs +63 -4
- 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/tools/index.d.mts
CHANGED
|
@@ -2744,6 +2744,96 @@ interface BuildSlideSystemPromptOptions {
|
|
|
2744
2744
|
}
|
|
2745
2745
|
declare function buildSlideSystemPrompt(options?: BuildSlideSystemPromptOptions): string;
|
|
2746
2746
|
|
|
2747
|
+
/** A wallet the user can pay from, as the wallet picker card shows it. */
|
|
2748
|
+
type PaymentWallet = {
|
|
2749
|
+
address: string;
|
|
2750
|
+
chainType: "solana";
|
|
2751
|
+
label?: string;
|
|
2752
|
+
walletName?: string;
|
|
2753
|
+
usdcBalance?: string;
|
|
2754
|
+
builtIn?: boolean;
|
|
2755
|
+
};
|
|
2756
|
+
/** What the wallet picker returns to the model. */
|
|
2757
|
+
type SelectPaymentWalletResult = {
|
|
2758
|
+
confirmed: true;
|
|
2759
|
+
offer_id: string;
|
|
2760
|
+
funding_wallet: string;
|
|
2761
|
+
} | {
|
|
2762
|
+
confirmed: false;
|
|
2763
|
+
} | {
|
|
2764
|
+
cancelled: true;
|
|
2765
|
+
} | {
|
|
2766
|
+
error_code: "wallets_unavailable";
|
|
2767
|
+
retryable: true;
|
|
2768
|
+
};
|
|
2769
|
+
/** One passenger as the payment card collects it. */
|
|
2770
|
+
type WalletPaymentPassenger = Record<string, unknown>;
|
|
2771
|
+
/** What the caller's `pay` function receives once the user has filled in the payment card. */
|
|
2772
|
+
type WalletPaymentRequest = {
|
|
2773
|
+
provider: string;
|
|
2774
|
+
reference: string;
|
|
2775
|
+
passengers: WalletPaymentPassenger[];
|
|
2776
|
+
};
|
|
2777
|
+
/** What the caller's `pay` function resolves with. */
|
|
2778
|
+
type WalletPaymentOutcome = {
|
|
2779
|
+
paid: true;
|
|
2780
|
+
provider: string;
|
|
2781
|
+
reference: string;
|
|
2782
|
+
status: string;
|
|
2783
|
+
} | {
|
|
2784
|
+
paid: false;
|
|
2785
|
+
error_code: string;
|
|
2786
|
+
retryable: boolean;
|
|
2787
|
+
};
|
|
2788
|
+
/** What the payment tool returns to the model. */
|
|
2789
|
+
type WalletPaymentResult = WalletPaymentOutcome | {
|
|
2790
|
+
cancelled: true;
|
|
2791
|
+
};
|
|
2792
|
+
/** Options for {@link createSelectPaymentWalletTool}. */
|
|
2793
|
+
type CreateSelectPaymentWalletToolOptions = CreateUIToolsOptions & {
|
|
2794
|
+
listWallets: () => Promise<PaymentWallet[]>;
|
|
2795
|
+
};
|
|
2796
|
+
/** Options for {@link createWalletPaymentTool}. */
|
|
2797
|
+
type CreateWalletPaymentToolOptions = CreateUIToolsOptions & {
|
|
2798
|
+
/** 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. */
|
|
2799
|
+
pay: (request: WalletPaymentRequest, signal?: AbortSignal) => Promise<WalletPaymentOutcome>;
|
|
2800
|
+
};
|
|
2801
|
+
/**
|
|
2802
|
+
* Create the select_payment_wallet tool, which shows the user's wallets for a flight offer and returns the one they chose.
|
|
2803
|
+
*
|
|
2804
|
+
* @example
|
|
2805
|
+
* ```typescript
|
|
2806
|
+
* import { createSelectPaymentWalletTool } from "@anuma/sdk/tools";
|
|
2807
|
+
*
|
|
2808
|
+
* const selectWalletTool = createSelectPaymentWalletTool({
|
|
2809
|
+
* getContext: () => uiInteraction,
|
|
2810
|
+
* getLastMessageId: () => lastMsgId,
|
|
2811
|
+
* listWallets: async () => wallets,
|
|
2812
|
+
* });
|
|
2813
|
+
* ```
|
|
2814
|
+
*/
|
|
2815
|
+
declare function createSelectPaymentWalletTool(options: CreateSelectPaymentWalletToolOptions): ToolConfig;
|
|
2816
|
+
/**
|
|
2817
|
+
* Create the prompt_wallet_payment tool, which collects the passengers on a card and then pays the booking through the caller's `pay` function.
|
|
2818
|
+
*
|
|
2819
|
+
* @example
|
|
2820
|
+
* ```typescript
|
|
2821
|
+
* import { createWalletPaymentTool } from "@anuma/sdk/tools";
|
|
2822
|
+
*
|
|
2823
|
+
* const paymentTool = createWalletPaymentTool({
|
|
2824
|
+
* getContext: () => uiInteraction,
|
|
2825
|
+
* getLastMessageId: () => lastMsgId,
|
|
2826
|
+
* pay: (request, signal) => payFromWallet(request, signal),
|
|
2827
|
+
* });
|
|
2828
|
+
* ```
|
|
2829
|
+
*/
|
|
2830
|
+
declare function createWalletPaymentTool(options: CreateWalletPaymentToolOptions): ToolConfig;
|
|
2831
|
+
|
|
2832
|
+
/** Name of the client tool that shows the wallet picker card for a flight payment. */
|
|
2833
|
+
declare const SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
2834
|
+
/** Name of the client tool that collects passengers and pays a booking from the chosen wallet. */
|
|
2835
|
+
declare const WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
2836
|
+
|
|
2747
2837
|
type ForecastDay = {
|
|
2748
2838
|
date: string;
|
|
2749
2839
|
weatherCode: number;
|
|
@@ -2843,4 +2933,4 @@ interface XGetMyPostsArgs {
|
|
|
2843
2933
|
*/
|
|
2844
2934
|
declare function createXTools(callProxy: XProxyCaller): Record<string, ToolConfig>;
|
|
2845
2935
|
|
|
2846
|
-
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CHOICE_TOOL_NAME, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSlackTools, createSlideTools, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
|
2936
|
+
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CHOICE_TOOL_NAME, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSelectPaymentWalletToolOptions, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWalletPaymentToolOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PaymentWallet, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SELECT_PAYMENT_WALLET_TOOL_NAME, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, type SelectPaymentWalletResult, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSelectPaymentWalletTool, createSlackTools, createSlideTools, createWalletPaymentTool, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -2744,6 +2744,96 @@ interface BuildSlideSystemPromptOptions {
|
|
|
2744
2744
|
}
|
|
2745
2745
|
declare function buildSlideSystemPrompt(options?: BuildSlideSystemPromptOptions): string;
|
|
2746
2746
|
|
|
2747
|
+
/** A wallet the user can pay from, as the wallet picker card shows it. */
|
|
2748
|
+
type PaymentWallet = {
|
|
2749
|
+
address: string;
|
|
2750
|
+
chainType: "solana";
|
|
2751
|
+
label?: string;
|
|
2752
|
+
walletName?: string;
|
|
2753
|
+
usdcBalance?: string;
|
|
2754
|
+
builtIn?: boolean;
|
|
2755
|
+
};
|
|
2756
|
+
/** What the wallet picker returns to the model. */
|
|
2757
|
+
type SelectPaymentWalletResult = {
|
|
2758
|
+
confirmed: true;
|
|
2759
|
+
offer_id: string;
|
|
2760
|
+
funding_wallet: string;
|
|
2761
|
+
} | {
|
|
2762
|
+
confirmed: false;
|
|
2763
|
+
} | {
|
|
2764
|
+
cancelled: true;
|
|
2765
|
+
} | {
|
|
2766
|
+
error_code: "wallets_unavailable";
|
|
2767
|
+
retryable: true;
|
|
2768
|
+
};
|
|
2769
|
+
/** One passenger as the payment card collects it. */
|
|
2770
|
+
type WalletPaymentPassenger = Record<string, unknown>;
|
|
2771
|
+
/** What the caller's `pay` function receives once the user has filled in the payment card. */
|
|
2772
|
+
type WalletPaymentRequest = {
|
|
2773
|
+
provider: string;
|
|
2774
|
+
reference: string;
|
|
2775
|
+
passengers: WalletPaymentPassenger[];
|
|
2776
|
+
};
|
|
2777
|
+
/** What the caller's `pay` function resolves with. */
|
|
2778
|
+
type WalletPaymentOutcome = {
|
|
2779
|
+
paid: true;
|
|
2780
|
+
provider: string;
|
|
2781
|
+
reference: string;
|
|
2782
|
+
status: string;
|
|
2783
|
+
} | {
|
|
2784
|
+
paid: false;
|
|
2785
|
+
error_code: string;
|
|
2786
|
+
retryable: boolean;
|
|
2787
|
+
};
|
|
2788
|
+
/** What the payment tool returns to the model. */
|
|
2789
|
+
type WalletPaymentResult = WalletPaymentOutcome | {
|
|
2790
|
+
cancelled: true;
|
|
2791
|
+
};
|
|
2792
|
+
/** Options for {@link createSelectPaymentWalletTool}. */
|
|
2793
|
+
type CreateSelectPaymentWalletToolOptions = CreateUIToolsOptions & {
|
|
2794
|
+
listWallets: () => Promise<PaymentWallet[]>;
|
|
2795
|
+
};
|
|
2796
|
+
/** Options for {@link createWalletPaymentTool}. */
|
|
2797
|
+
type CreateWalletPaymentToolOptions = CreateUIToolsOptions & {
|
|
2798
|
+
/** 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. */
|
|
2799
|
+
pay: (request: WalletPaymentRequest, signal?: AbortSignal) => Promise<WalletPaymentOutcome>;
|
|
2800
|
+
};
|
|
2801
|
+
/**
|
|
2802
|
+
* Create the select_payment_wallet tool, which shows the user's wallets for a flight offer and returns the one they chose.
|
|
2803
|
+
*
|
|
2804
|
+
* @example
|
|
2805
|
+
* ```typescript
|
|
2806
|
+
* import { createSelectPaymentWalletTool } from "@anuma/sdk/tools";
|
|
2807
|
+
*
|
|
2808
|
+
* const selectWalletTool = createSelectPaymentWalletTool({
|
|
2809
|
+
* getContext: () => uiInteraction,
|
|
2810
|
+
* getLastMessageId: () => lastMsgId,
|
|
2811
|
+
* listWallets: async () => wallets,
|
|
2812
|
+
* });
|
|
2813
|
+
* ```
|
|
2814
|
+
*/
|
|
2815
|
+
declare function createSelectPaymentWalletTool(options: CreateSelectPaymentWalletToolOptions): ToolConfig;
|
|
2816
|
+
/**
|
|
2817
|
+
* Create the prompt_wallet_payment tool, which collects the passengers on a card and then pays the booking through the caller's `pay` function.
|
|
2818
|
+
*
|
|
2819
|
+
* @example
|
|
2820
|
+
* ```typescript
|
|
2821
|
+
* import { createWalletPaymentTool } from "@anuma/sdk/tools";
|
|
2822
|
+
*
|
|
2823
|
+
* const paymentTool = createWalletPaymentTool({
|
|
2824
|
+
* getContext: () => uiInteraction,
|
|
2825
|
+
* getLastMessageId: () => lastMsgId,
|
|
2826
|
+
* pay: (request, signal) => payFromWallet(request, signal),
|
|
2827
|
+
* });
|
|
2828
|
+
* ```
|
|
2829
|
+
*/
|
|
2830
|
+
declare function createWalletPaymentTool(options: CreateWalletPaymentToolOptions): ToolConfig;
|
|
2831
|
+
|
|
2832
|
+
/** Name of the client tool that shows the wallet picker card for a flight payment. */
|
|
2833
|
+
declare const SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
2834
|
+
/** Name of the client tool that collects passengers and pays a booking from the chosen wallet. */
|
|
2835
|
+
declare const WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
2836
|
+
|
|
2747
2837
|
type ForecastDay = {
|
|
2748
2838
|
date: string;
|
|
2749
2839
|
weatherCode: number;
|
|
@@ -2843,4 +2933,4 @@ interface XGetMyPostsArgs {
|
|
|
2843
2933
|
*/
|
|
2844
2934
|
declare function createXTools(callProxy: XProxyCaller): Record<string, ToolConfig>;
|
|
2845
2935
|
|
|
2846
|
-
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CHOICE_TOOL_NAME, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSlackTools, createSlideTools, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
|
2936
|
+
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CHOICE_TOOL_NAME, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSelectPaymentWalletToolOptions, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWalletPaymentToolOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PaymentWallet, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SELECT_PAYMENT_WALLET_TOOL_NAME, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, type SelectPaymentWalletResult, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSelectPaymentWalletTool, createSlackTools, createSlideTools, createWalletPaymentTool, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
package/dist/tools/index.mjs
CHANGED
|
@@ -13488,6 +13488,140 @@ ICONS: Material Symbols Rounded \u2014 bolt, lock, search, favorite, star, check
|
|
|
13488
13488
|
COLOR TOKENS: textPrimary, textSecondary, textMuted, accent, card, border, background, slideBg`;
|
|
13489
13489
|
}
|
|
13490
13490
|
|
|
13491
|
+
// src/tools/walletPaymentConstants.ts
|
|
13492
|
+
var SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
13493
|
+
var WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
13494
|
+
|
|
13495
|
+
// src/tools/walletPayment.ts
|
|
13496
|
+
var CANCELLED = { cancelled: true };
|
|
13497
|
+
function isNonEmptyString(value) {
|
|
13498
|
+
return typeof value === "string" && value.length > 0;
|
|
13499
|
+
}
|
|
13500
|
+
function hasPassengers(value) {
|
|
13501
|
+
return Array.isArray(value?.passengers);
|
|
13502
|
+
}
|
|
13503
|
+
function createSelectPaymentWalletTool(options) {
|
|
13504
|
+
const tool = createInteractiveTool(options, {
|
|
13505
|
+
name: SELECT_PAYMENT_WALLET_TOOL_NAME,
|
|
13506
|
+
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.",
|
|
13507
|
+
parameters: {
|
|
13508
|
+
type: "object",
|
|
13509
|
+
properties: {
|
|
13510
|
+
offer_id: {
|
|
13511
|
+
type: "string",
|
|
13512
|
+
description: "The offer id from anuma_flight_offer_details"
|
|
13513
|
+
},
|
|
13514
|
+
summary: {
|
|
13515
|
+
type: "string",
|
|
13516
|
+
description: "Route, dates and fare of the offer, as shown to the user"
|
|
13517
|
+
},
|
|
13518
|
+
amount: {
|
|
13519
|
+
type: "string",
|
|
13520
|
+
description: "Total price of the offer, e.g. '412.50'"
|
|
13521
|
+
},
|
|
13522
|
+
currency: {
|
|
13523
|
+
type: "string",
|
|
13524
|
+
description: "Currency of the price, e.g. 'USD'"
|
|
13525
|
+
}
|
|
13526
|
+
},
|
|
13527
|
+
required: ["offer_id", "amount", "currency"]
|
|
13528
|
+
},
|
|
13529
|
+
interactionType: "select_payment_wallet",
|
|
13530
|
+
validate: (args) => isNonEmptyString(args.offer_id),
|
|
13531
|
+
mapArgs: ({ offer_id, summary, amount, currency, wallets }) => ({
|
|
13532
|
+
offer_id,
|
|
13533
|
+
summary,
|
|
13534
|
+
amount,
|
|
13535
|
+
currency,
|
|
13536
|
+
wallets
|
|
13537
|
+
}),
|
|
13538
|
+
mapResult: (result, args) => {
|
|
13539
|
+
if (result?.confirmed === true && isNonEmptyString(result.funding_wallet)) {
|
|
13540
|
+
return {
|
|
13541
|
+
confirmed: true,
|
|
13542
|
+
offer_id: args.offer_id,
|
|
13543
|
+
funding_wallet: result.funding_wallet
|
|
13544
|
+
};
|
|
13545
|
+
}
|
|
13546
|
+
if (result?.confirmed === false) return { confirmed: false };
|
|
13547
|
+
return CANCELLED;
|
|
13548
|
+
}
|
|
13549
|
+
});
|
|
13550
|
+
const showCard = tool.executor;
|
|
13551
|
+
return {
|
|
13552
|
+
...tool,
|
|
13553
|
+
executor: async (args, signal) => {
|
|
13554
|
+
if (!isNonEmptyString(args.offer_id)) return CANCELLED;
|
|
13555
|
+
let wallets;
|
|
13556
|
+
try {
|
|
13557
|
+
wallets = await options.listWallets();
|
|
13558
|
+
} catch {
|
|
13559
|
+
return { error_code: "wallets_unavailable", retryable: true };
|
|
13560
|
+
}
|
|
13561
|
+
if (signal?.aborted) return CANCELLED;
|
|
13562
|
+
return showCard?.({ ...args, wallets }, signal);
|
|
13563
|
+
}
|
|
13564
|
+
};
|
|
13565
|
+
}
|
|
13566
|
+
function createWalletPaymentTool(options) {
|
|
13567
|
+
const tool = createInteractiveTool(options, {
|
|
13568
|
+
name: WALLET_PAYMENT_TOOL_NAME,
|
|
13569
|
+
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.",
|
|
13570
|
+
parameters: {
|
|
13571
|
+
type: "object",
|
|
13572
|
+
properties: {
|
|
13573
|
+
provider: {
|
|
13574
|
+
type: "string",
|
|
13575
|
+
description: "The payment provider from anuma_create_flight_intent"
|
|
13576
|
+
},
|
|
13577
|
+
reference: {
|
|
13578
|
+
type: "string",
|
|
13579
|
+
description: "The payment reference from anuma_create_flight_intent"
|
|
13580
|
+
},
|
|
13581
|
+
passenger_count: {
|
|
13582
|
+
type: "integer",
|
|
13583
|
+
minimum: 1,
|
|
13584
|
+
description: "How many passengers the booking is for"
|
|
13585
|
+
}
|
|
13586
|
+
},
|
|
13587
|
+
required: ["provider", "reference", "passenger_count"]
|
|
13588
|
+
},
|
|
13589
|
+
interactionType: "prompt_wallet_payment",
|
|
13590
|
+
validate: (args) => isNonEmptyString(args.provider) && isNonEmptyString(args.reference) && Number.isInteger(args.passenger_count) && args.passenger_count >= 1,
|
|
13591
|
+
mapArgs: ({ provider, reference, passenger_count }) => ({
|
|
13592
|
+
provider,
|
|
13593
|
+
reference,
|
|
13594
|
+
passenger_count
|
|
13595
|
+
}),
|
|
13596
|
+
mapResult: (result) => hasPassengers(result) ? { passengers: result.passengers } : CANCELLED
|
|
13597
|
+
});
|
|
13598
|
+
const showCard = tool.executor;
|
|
13599
|
+
return {
|
|
13600
|
+
...tool,
|
|
13601
|
+
executor: async (args, signal) => {
|
|
13602
|
+
const answer = await showCard?.(args, signal);
|
|
13603
|
+
if (!hasPassengers(answer) || signal?.aborted) return CANCELLED;
|
|
13604
|
+
const provider = args.provider;
|
|
13605
|
+
const reference = args.reference;
|
|
13606
|
+
let outcome;
|
|
13607
|
+
try {
|
|
13608
|
+
outcome = await options.pay({ provider, reference, passengers: answer.passengers }, signal);
|
|
13609
|
+
} catch {
|
|
13610
|
+
return { paid: false, error_code: "payment_failed", retryable: false };
|
|
13611
|
+
}
|
|
13612
|
+
if (outcome.paid) {
|
|
13613
|
+
return {
|
|
13614
|
+
paid: true,
|
|
13615
|
+
provider: outcome.provider,
|
|
13616
|
+
reference: outcome.reference,
|
|
13617
|
+
status: outcome.status
|
|
13618
|
+
};
|
|
13619
|
+
}
|
|
13620
|
+
return { paid: false, error_code: outcome.error_code, retryable: outcome.retryable };
|
|
13621
|
+
}
|
|
13622
|
+
};
|
|
13623
|
+
}
|
|
13624
|
+
|
|
13491
13625
|
// src/tools/weather.ts
|
|
13492
13626
|
var DEFAULT_GEOCODING_BASE = "https://geocoding-api.open-meteo.com/v1";
|
|
13493
13627
|
var DEFAULT_FORECAST_BASE = "https://api.open-meteo.com/v1";
|
|
@@ -13770,6 +13904,7 @@ export {
|
|
|
13770
13904
|
READ_FILE_SCHEMA,
|
|
13771
13905
|
READ_SLIDES_SCHEMA,
|
|
13772
13906
|
RUNTIME_ERROR_OVERLAY_SCRIPT,
|
|
13907
|
+
SELECT_PAYMENT_WALLET_TOOL_NAME,
|
|
13773
13908
|
SLIDES_FILE_PATH,
|
|
13774
13909
|
SLIDE_CANVAS_HEIGHT,
|
|
13775
13910
|
SLIDE_CANVAS_WIDTH,
|
|
@@ -13777,6 +13912,7 @@ export {
|
|
|
13777
13912
|
SiwxUnsupportedError,
|
|
13778
13913
|
THEME_ATTRS,
|
|
13779
13914
|
VERIFY_APP_SCHEMA,
|
|
13915
|
+
WALLET_PAYMENT_TOOL_NAME,
|
|
13780
13916
|
applyPatches,
|
|
13781
13917
|
auditDesign,
|
|
13782
13918
|
buildAppFileManifest,
|
|
@@ -13828,8 +13964,10 @@ export {
|
|
|
13828
13964
|
createNotionUpdateDataSourceTool,
|
|
13829
13965
|
createNotionUpdatePageTool,
|
|
13830
13966
|
createPhoneCallOfferTool,
|
|
13967
|
+
createSelectPaymentWalletTool,
|
|
13831
13968
|
createSlackTools,
|
|
13832
13969
|
createSlideTools,
|
|
13970
|
+
createWalletPaymentTool,
|
|
13833
13971
|
createWeatherTool,
|
|
13834
13972
|
createXTools,
|
|
13835
13973
|
documentPath,
|
|
@@ -124,6 +124,17 @@ module.exports = __toCommonJS(index_exports);
|
|
|
124
124
|
// src/tools/confirmConstants.ts
|
|
125
125
|
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
126
126
|
|
|
127
|
+
// src/tools/walletPaymentConstants.ts
|
|
128
|
+
var SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
129
|
+
var WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
130
|
+
var FLIGHT_BOOK_TOOL_SET = "flight-book";
|
|
131
|
+
var FLIGHT_SERVER_TOOL_NAMES = [
|
|
132
|
+
"AnumaPaymentsMCP-anuma_search_flights",
|
|
133
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
134
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
135
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
136
|
+
];
|
|
137
|
+
|
|
127
138
|
// src/lib/memory/recallConstants.ts
|
|
128
139
|
var RECALL_TOOL_NAME = "recall_memory";
|
|
129
140
|
|
|
@@ -2069,7 +2080,8 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
2069
2080
|
"AnumaPaymentsMCP-anuma_cancel_reservation"
|
|
2070
2081
|
],
|
|
2071
2082
|
anchors: []
|
|
2072
|
-
}
|
|
2083
|
+
},
|
|
2084
|
+
{ name: FLIGHT_BOOK_TOOL_SET, members: [...FLIGHT_SERVER_TOOL_NAMES], anchors: [] }
|
|
2073
2085
|
];
|
|
2074
2086
|
function applyToolSets(matchedNames, availableNames, scores, toolSets = BUILT_IN_TOOL_SETS, independentThreshold = 0.65) {
|
|
2075
2087
|
const activatedSets = [];
|
|
@@ -2222,6 +2234,16 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
2222
2234
|
members: ["AnumaPaymentsMCP-anuma_list_reservations"],
|
|
2223
2235
|
anchors: ["AnumaPaymentsMCP-anuma_cancel_reservation"],
|
|
2224
2236
|
anchorMinSimilarity: 0.5
|
|
2237
|
+
},
|
|
2238
|
+
{
|
|
2239
|
+
name: "flight-book-lookup",
|
|
2240
|
+
members: [
|
|
2241
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
2242
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
2243
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
2244
|
+
],
|
|
2245
|
+
anchors: ["AnumaPaymentsMCP-anuma_search_flights"],
|
|
2246
|
+
anchorMinSimilarity: 0.5
|
|
2225
2247
|
}
|
|
2226
2248
|
];
|
|
2227
2249
|
var defaultServerToolsFilter = createServerToolsFilter({
|
|
@@ -2357,7 +2379,7 @@ function computeToolGuidance(selectedServerTools, selectedClientTools, extraTool
|
|
|
2357
2379
|
async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embeddingOptions, extraToolSets = [], activeToolSets = [], noEmbeddingsReason = "short-prompt") {
|
|
2358
2380
|
const isAlwaysIncluded = (t) => {
|
|
2359
2381
|
const name = getToolName(t);
|
|
2360
|
-
return name.startsWith("memory_vault_") || name === RECALL_TOOL_NAME || name === CONFIRM_TOOL_NAME;
|
|
2382
|
+
return name.startsWith("memory_vault_") || name === RECALL_TOOL_NAME || name === CONFIRM_TOOL_NAME || name === SELECT_PAYMENT_WALLET_TOOL_NAME || name === WALLET_PAYMENT_TOOL_NAME;
|
|
2361
2383
|
};
|
|
2362
2384
|
const alwaysInclude = clientTools.filter(isAlwaysIncluded);
|
|
2363
2385
|
const filterCandidates = clientTools.filter((t) => !isAlwaysIncluded(t));
|
|
@@ -2369,7 +2391,7 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
|
|
|
2369
2391
|
}
|
|
2370
2392
|
if (!promptEmbeddings) {
|
|
2371
2393
|
if (activeToolSets.length === 0) {
|
|
2372
|
-
return { tools:
|
|
2394
|
+
return { tools: alwaysInclude, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
|
|
2373
2395
|
}
|
|
2374
2396
|
const allSets = extraToolSets.length > 0 ? [...BUILT_IN_TOOL_SETS, ...extraToolSets] : BUILT_IN_TOOL_SETS;
|
|
2375
2397
|
const activeSets = allSets.filter((s) => activeToolSets.includes(s.name));
|
|
@@ -838,7 +838,7 @@ declare function autoFilterClientTools(clientTools: LlmapiChatCompletionTool[],
|
|
|
838
838
|
}, extraToolSets?: ToolSet[], activeToolSets?: string[],
|
|
839
839
|
/**
|
|
840
840
|
* Why `promptEmbeddings` is null. "short-prompt" (the length gate —
|
|
841
|
-
* deliberate) sends
|
|
841
|
+
* deliberate) sends only the always-included tools, plus any sticky sets; "error" (embedding generation failed —
|
|
842
842
|
* transient) degrades to the FULL catalog so an embeddings outage never
|
|
843
843
|
* strips every tool from every request.
|
|
844
844
|
*/
|
|
@@ -838,7 +838,7 @@ declare function autoFilterClientTools(clientTools: LlmapiChatCompletionTool[],
|
|
|
838
838
|
}, extraToolSets?: ToolSet[], activeToolSets?: string[],
|
|
839
839
|
/**
|
|
840
840
|
* Why `promptEmbeddings` is null. "short-prompt" (the length gate —
|
|
841
|
-
* deliberate) sends
|
|
841
|
+
* deliberate) sends only the always-included tools, plus any sticky sets; "error" (embedding generation failed —
|
|
842
842
|
* transient) degrades to the FULL catalog so an embeddings outage never
|
|
843
843
|
* strips every tool from every request.
|
|
844
844
|
*/
|
|
@@ -6,6 +6,17 @@ import {
|
|
|
6
6
|
// src/tools/confirmConstants.ts
|
|
7
7
|
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
8
8
|
|
|
9
|
+
// src/tools/walletPaymentConstants.ts
|
|
10
|
+
var SELECT_PAYMENT_WALLET_TOOL_NAME = "select_payment_wallet";
|
|
11
|
+
var WALLET_PAYMENT_TOOL_NAME = "prompt_wallet_payment";
|
|
12
|
+
var FLIGHT_BOOK_TOOL_SET = "flight-book";
|
|
13
|
+
var FLIGHT_SERVER_TOOL_NAMES = [
|
|
14
|
+
"AnumaPaymentsMCP-anuma_search_flights",
|
|
15
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
16
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
17
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
18
|
+
];
|
|
19
|
+
|
|
9
20
|
// src/lib/memory/recallConstants.ts
|
|
10
21
|
var RECALL_TOOL_NAME = "recall_memory";
|
|
11
22
|
|
|
@@ -1947,7 +1958,8 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1947
1958
|
"AnumaPaymentsMCP-anuma_cancel_reservation"
|
|
1948
1959
|
],
|
|
1949
1960
|
anchors: []
|
|
1950
|
-
}
|
|
1961
|
+
},
|
|
1962
|
+
{ name: FLIGHT_BOOK_TOOL_SET, members: [...FLIGHT_SERVER_TOOL_NAMES], anchors: [] }
|
|
1951
1963
|
];
|
|
1952
1964
|
function applyToolSets(matchedNames, availableNames, scores, toolSets = BUILT_IN_TOOL_SETS, independentThreshold = 0.65) {
|
|
1953
1965
|
const activatedSets = [];
|
|
@@ -2100,6 +2112,16 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
2100
2112
|
members: ["AnumaPaymentsMCP-anuma_list_reservations"],
|
|
2101
2113
|
anchors: ["AnumaPaymentsMCP-anuma_cancel_reservation"],
|
|
2102
2114
|
anchorMinSimilarity: 0.5
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
name: "flight-book-lookup",
|
|
2118
|
+
members: [
|
|
2119
|
+
"AnumaPaymentsMCP-anuma_flight_offer_details",
|
|
2120
|
+
"AnumaPaymentsMCP-anuma_create_flight_intent",
|
|
2121
|
+
"AnumaPaymentsMCP-anuma_get_flight_booking"
|
|
2122
|
+
],
|
|
2123
|
+
anchors: ["AnumaPaymentsMCP-anuma_search_flights"],
|
|
2124
|
+
anchorMinSimilarity: 0.5
|
|
2103
2125
|
}
|
|
2104
2126
|
];
|
|
2105
2127
|
var defaultServerToolsFilter = createServerToolsFilter({
|
|
@@ -2235,7 +2257,7 @@ function computeToolGuidance(selectedServerTools, selectedClientTools, extraTool
|
|
|
2235
2257
|
async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embeddingOptions, extraToolSets = [], activeToolSets = [], noEmbeddingsReason = "short-prompt") {
|
|
2236
2258
|
const isAlwaysIncluded = (t) => {
|
|
2237
2259
|
const name = getToolName(t);
|
|
2238
|
-
return name.startsWith("memory_vault_") || name === RECALL_TOOL_NAME || name === CONFIRM_TOOL_NAME;
|
|
2260
|
+
return name.startsWith("memory_vault_") || name === RECALL_TOOL_NAME || name === CONFIRM_TOOL_NAME || name === SELECT_PAYMENT_WALLET_TOOL_NAME || name === WALLET_PAYMENT_TOOL_NAME;
|
|
2239
2261
|
};
|
|
2240
2262
|
const alwaysInclude = clientTools.filter(isAlwaysIncluded);
|
|
2241
2263
|
const filterCandidates = clientTools.filter((t) => !isAlwaysIncluded(t));
|
|
@@ -2247,7 +2269,7 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
|
|
|
2247
2269
|
}
|
|
2248
2270
|
if (!promptEmbeddings) {
|
|
2249
2271
|
if (activeToolSets.length === 0) {
|
|
2250
|
-
return { tools:
|
|
2272
|
+
return { tools: alwaysInclude, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
|
|
2251
2273
|
}
|
|
2252
2274
|
const allSets = extraToolSets.length > 0 ? [...BUILT_IN_TOOL_SETS, ...extraToolSets] : BUILT_IN_TOOL_SETS;
|
|
2253
2275
|
const activeSets = allSets.filter((s) => activeToolSets.includes(s.name));
|