@anuma/sdk 6.36.0 → 6.38.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.
@@ -35,6 +35,7 @@ __export(index_exports, {
35
35
  AgentresError: () => AgentresError,
36
36
  AgentresPathError: () => AgentresPathError,
37
37
  AnumaJsxError: () => AnumaJsxError,
38
+ CHOICE_TOOL_NAME: () => CHOICE_TOOL_NAME,
38
39
  CONNECTOR_ERROR_MARKER: () => CONNECTOR_ERROR_MARKER,
39
40
  CREATE_DOCUMENT_SCHEMA: () => CREATE_DOCUMENT_SCHEMA,
40
41
  CREATE_FILE_SCHEMA: () => CREATE_FILE_SCHEMA,
@@ -2596,9 +2597,10 @@ function createChartTool(options) {
2596
2597
  }
2597
2598
 
2598
2599
  // src/tools/choice.ts
2600
+ var CHOICE_TOOL_NAME = "prompt_user_choice";
2599
2601
  function createChoiceTool(options) {
2600
2602
  return createInteractiveTool(options, {
2601
- name: "prompt_user_choice",
2603
+ name: CHOICE_TOOL_NAME,
2602
2604
  description: "Show a clickable choice menu when the user needs to pick between specific options. Examples: choosing a restaurant for dinner or selecting a travel destination.",
2603
2605
  parameters: {
2604
2606
  type: "object",
@@ -2660,10 +2662,59 @@ function createChoiceTool(options) {
2660
2662
 
2661
2663
  // src/tools/confirmConstants.ts
2662
2664
  var CONFIRM_TOOL_NAME = "prompt_user_confirm";
2665
+ var BOOK_RESTAURANT = {
2666
+ tool: "AnumaPaymentsMCP-anuma_book_restaurant",
2667
+ status: "confirmed_not_booked",
2668
+ fields: ["venue_id", "config_id", "party_size", "day", "venue_name", "time"]
2669
+ };
2670
+ var CANCEL_RESERVATION = {
2671
+ tool: "AnumaPaymentsMCP-anuma_cancel_reservation",
2672
+ status: "confirmed_not_cancelled",
2673
+ fields: [
2674
+ "reservation_id",
2675
+ "venue_name",
2676
+ "day",
2677
+ "time",
2678
+ "party_size",
2679
+ "fee_applies",
2680
+ "fee_amount"
2681
+ ]
2682
+ };
2683
+ var CONFIRM_REQUIRED_FIELDS = /* @__PURE__ */ new Map([
2684
+ ["book_restaurant", BOOK_RESTAURANT],
2685
+ ["anuma_book_restaurant", BOOK_RESTAURANT],
2686
+ ["anumapaymentsmcp-anuma_book_restaurant", BOOK_RESTAURANT],
2687
+ ["cancel_reservation", CANCEL_RESERVATION],
2688
+ ["anuma_cancel_reservation", CANCEL_RESERVATION],
2689
+ ["anumapaymentsmcp-anuma_cancel_reservation", CANCEL_RESERVATION]
2690
+ ]);
2691
+ function confirmRequirement(action) {
2692
+ if (typeof action !== "string") return void 0;
2693
+ return CONFIRM_REQUIRED_FIELDS.get(action.trim().toLowerCase());
2694
+ }
2695
+ function missingConfirmFields(action, parameters) {
2696
+ const requirement = confirmRequirement(action);
2697
+ if (!requirement) return [];
2698
+ const shown = /* @__PURE__ */ new Set();
2699
+ for (const parameter of Array.isArray(parameters) ? parameters : []) {
2700
+ const { name, value } = parameter ?? {};
2701
+ if (typeof name === "string" && typeof value === "string" && value.trim()) shown.add(name);
2702
+ }
2703
+ return requirement.fields.filter((field) => !shown.has(field));
2704
+ }
2663
2705
 
2664
2706
  // src/tools/confirm.ts
2707
+ function isWellFormedCard(args) {
2708
+ const { title, action, parameters } = args;
2709
+ if (typeof title !== "string" || !title) return false;
2710
+ if (typeof action !== "string" || !action) return false;
2711
+ if (!Array.isArray(parameters) || parameters.length === 0) return false;
2712
+ return parameters.every((parameter) => {
2713
+ return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
2714
+ });
2715
+ }
2665
2716
  function createConfirmTool(options) {
2666
- return createInteractiveTool(options, {
2717
+ const tool = createInteractiveTool(options, {
2667
2718
  name: CONFIRM_TOOL_NAME,
2668
2719
  description: "Ask the user to approve a specific action before it happens. Use before anything that spends money or is hard to undo, such as booking or cancelling a restaurant table, or placing an order. List every parameter of the action, with the exact values you are about to use \u2014 the user approves what this card shows, and nothing else. Returns whether they confirmed. Do not use for ordinary yes/no questions; use prompt_user_choice for those.",
2669
2720
  parameters: {
@@ -2707,25 +2758,35 @@ function createConfirmTool(options) {
2707
2758
  required: ["title", "action", "parameters"]
2708
2759
  },
2709
2760
  interactionType: "confirm",
2710
- validate: (args) => {
2711
- const { title, action, parameters } = args;
2712
- if (typeof title !== "string" || !title) return false;
2713
- if (typeof action !== "string" || !action) return false;
2714
- if (!Array.isArray(parameters) || parameters.length === 0) return false;
2715
- return parameters.every((parameter) => {
2716
- return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
2717
- });
2718
- },
2761
+ validate: isWellFormedCard,
2719
2762
  mapResult: (result, args) => {
2720
2763
  if (typeof result.confirmed !== "boolean") return { cancelled: true };
2764
+ const requirement = result.confirmed ? confirmRequirement(args.action) : void 0;
2721
2765
  return {
2722
2766
  confirmed: result.confirmed,
2723
2767
  action: args.action,
2724
2768
  parameters: args.parameters,
2725
- answeredAt: (/* @__PURE__ */ new Date()).toISOString()
2769
+ answeredAt: (/* @__PURE__ */ new Date()).toISOString(),
2770
+ ...requirement && {
2771
+ status: requirement.status,
2772
+ next_step: `call ${requirement.tool} now with these exact values`
2773
+ }
2726
2774
  };
2727
2775
  }
2728
2776
  });
2777
+ const showCard = tool.executor;
2778
+ return {
2779
+ ...tool,
2780
+ executor: (args, signal) => {
2781
+ const missing = missingConfirmFields(args.action, args.parameters);
2782
+ if (missing.length > 0) {
2783
+ return Promise.resolve({
2784
+ error: `card is missing ${missing.join(", ")}; look them up and call ${CONFIRM_TOOL_NAME} again with every field`
2785
+ });
2786
+ }
2787
+ return showCard?.(args, signal);
2788
+ }
2789
+ };
2729
2790
  }
2730
2791
 
2731
2792
  // src/tools/connectorOffer.ts
@@ -13839,6 +13900,7 @@ function createXTools(callProxy) {
13839
13900
  AgentresError,
13840
13901
  AgentresPathError,
13841
13902
  AnumaJsxError,
13903
+ CHOICE_TOOL_NAME,
13842
13904
  CONNECTOR_ERROR_MARKER,
13843
13905
  CREATE_DOCUMENT_SCHEMA,
13844
13906
  CREATE_FILE_SCHEMA,
@@ -1411,6 +1411,8 @@ type DisplayChartResult = {
1411
1411
  */
1412
1412
  declare function createChartTool(options: CreateUIToolsOptions): ToolConfig;
1413
1413
 
1414
+ /** Tool name surfaced to the LLM. */
1415
+ declare const CHOICE_TOOL_NAME = "prompt_user_choice";
1414
1416
  type ChoiceOption = {
1415
1417
  /** Unique identifier for this option */
1416
1418
  value: string;
@@ -1448,8 +1450,9 @@ type ConfirmParameter = {
1448
1450
  value: string;
1449
1451
  };
1450
1452
  /**
1451
- * What the tool returns: the user's answer, or `{ cancelled: true }` when
1452
- * nobody answered.
1453
+ * What the tool returns: the user's answer, `{ cancelled: true }` when nobody
1454
+ * answered, or `{ error }` when a restaurant card lacked a required field and
1455
+ * was never shown.
1453
1456
  */
1454
1457
  type ConfirmToolResult = {
1455
1458
  /** True when the user agreed, false when they declined. */
@@ -1460,6 +1463,16 @@ type ConfirmToolResult = {
1460
1463
  parameters: ConfirmParameter[];
1461
1464
  /** ISO-8601 timestamp of the answer, for a server-side freshness window. */
1462
1465
  answeredAt: string;
1466
+ /**
1467
+ * On an approved restaurant action: `confirmed_not_booked` or
1468
+ * `confirmed_not_cancelled`. Approval alone changes nothing.
1469
+ */
1470
+ status?: "confirmed_not_booked" | "confirmed_not_cancelled";
1471
+ /** On an approved restaurant action: the call that carries it out. */
1472
+ next_step?: string;
1473
+ } | {
1474
+ /** Why no card was shown, worded for the model. */
1475
+ error: string;
1463
1476
  } | {
1464
1477
  /** Timed out, cleared, never shown, or the card replied without a decision. */
1465
1478
  cancelled: true;
@@ -2826,4 +2839,4 @@ interface XGetMyPostsArgs {
2826
2839
  */
2827
2840
  declare function createXTools(callProxy: XProxyCaller): Record<string, ToolConfig>;
2828
2841
 
2829
- 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, 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 };
2842
+ 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 };
@@ -1411,6 +1411,8 @@ type DisplayChartResult = {
1411
1411
  */
1412
1412
  declare function createChartTool(options: CreateUIToolsOptions): ToolConfig;
1413
1413
 
1414
+ /** Tool name surfaced to the LLM. */
1415
+ declare const CHOICE_TOOL_NAME = "prompt_user_choice";
1414
1416
  type ChoiceOption = {
1415
1417
  /** Unique identifier for this option */
1416
1418
  value: string;
@@ -1448,8 +1450,9 @@ type ConfirmParameter = {
1448
1450
  value: string;
1449
1451
  };
1450
1452
  /**
1451
- * What the tool returns: the user's answer, or `{ cancelled: true }` when
1452
- * nobody answered.
1453
+ * What the tool returns: the user's answer, `{ cancelled: true }` when nobody
1454
+ * answered, or `{ error }` when a restaurant card lacked a required field and
1455
+ * was never shown.
1453
1456
  */
1454
1457
  type ConfirmToolResult = {
1455
1458
  /** True when the user agreed, false when they declined. */
@@ -1460,6 +1463,16 @@ type ConfirmToolResult = {
1460
1463
  parameters: ConfirmParameter[];
1461
1464
  /** ISO-8601 timestamp of the answer, for a server-side freshness window. */
1462
1465
  answeredAt: string;
1466
+ /**
1467
+ * On an approved restaurant action: `confirmed_not_booked` or
1468
+ * `confirmed_not_cancelled`. Approval alone changes nothing.
1469
+ */
1470
+ status?: "confirmed_not_booked" | "confirmed_not_cancelled";
1471
+ /** On an approved restaurant action: the call that carries it out. */
1472
+ next_step?: string;
1473
+ } | {
1474
+ /** Why no card was shown, worded for the model. */
1475
+ error: string;
1463
1476
  } | {
1464
1477
  /** Timed out, cleared, never shown, or the card replied without a decision. */
1465
1478
  cancelled: true;
@@ -2826,4 +2839,4 @@ interface XGetMyPostsArgs {
2826
2839
  */
2827
2840
  declare function createXTools(callProxy: XProxyCaller): Record<string, ToolConfig>;
2828
2841
 
2829
- 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, 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 };
2842
+ 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 };
@@ -2440,9 +2440,10 @@ function createChartTool(options) {
2440
2440
  }
2441
2441
 
2442
2442
  // src/tools/choice.ts
2443
+ var CHOICE_TOOL_NAME = "prompt_user_choice";
2443
2444
  function createChoiceTool(options) {
2444
2445
  return createInteractiveTool(options, {
2445
- name: "prompt_user_choice",
2446
+ name: CHOICE_TOOL_NAME,
2446
2447
  description: "Show a clickable choice menu when the user needs to pick between specific options. Examples: choosing a restaurant for dinner or selecting a travel destination.",
2447
2448
  parameters: {
2448
2449
  type: "object",
@@ -2504,10 +2505,59 @@ function createChoiceTool(options) {
2504
2505
 
2505
2506
  // src/tools/confirmConstants.ts
2506
2507
  var CONFIRM_TOOL_NAME = "prompt_user_confirm";
2508
+ var BOOK_RESTAURANT = {
2509
+ tool: "AnumaPaymentsMCP-anuma_book_restaurant",
2510
+ status: "confirmed_not_booked",
2511
+ fields: ["venue_id", "config_id", "party_size", "day", "venue_name", "time"]
2512
+ };
2513
+ var CANCEL_RESERVATION = {
2514
+ tool: "AnumaPaymentsMCP-anuma_cancel_reservation",
2515
+ status: "confirmed_not_cancelled",
2516
+ fields: [
2517
+ "reservation_id",
2518
+ "venue_name",
2519
+ "day",
2520
+ "time",
2521
+ "party_size",
2522
+ "fee_applies",
2523
+ "fee_amount"
2524
+ ]
2525
+ };
2526
+ var CONFIRM_REQUIRED_FIELDS = /* @__PURE__ */ new Map([
2527
+ ["book_restaurant", BOOK_RESTAURANT],
2528
+ ["anuma_book_restaurant", BOOK_RESTAURANT],
2529
+ ["anumapaymentsmcp-anuma_book_restaurant", BOOK_RESTAURANT],
2530
+ ["cancel_reservation", CANCEL_RESERVATION],
2531
+ ["anuma_cancel_reservation", CANCEL_RESERVATION],
2532
+ ["anumapaymentsmcp-anuma_cancel_reservation", CANCEL_RESERVATION]
2533
+ ]);
2534
+ function confirmRequirement(action) {
2535
+ if (typeof action !== "string") return void 0;
2536
+ return CONFIRM_REQUIRED_FIELDS.get(action.trim().toLowerCase());
2537
+ }
2538
+ function missingConfirmFields(action, parameters) {
2539
+ const requirement = confirmRequirement(action);
2540
+ if (!requirement) return [];
2541
+ const shown = /* @__PURE__ */ new Set();
2542
+ for (const parameter of Array.isArray(parameters) ? parameters : []) {
2543
+ const { name, value } = parameter ?? {};
2544
+ if (typeof name === "string" && typeof value === "string" && value.trim()) shown.add(name);
2545
+ }
2546
+ return requirement.fields.filter((field) => !shown.has(field));
2547
+ }
2507
2548
 
2508
2549
  // src/tools/confirm.ts
2550
+ function isWellFormedCard(args) {
2551
+ const { title, action, parameters } = args;
2552
+ if (typeof title !== "string" || !title) return false;
2553
+ if (typeof action !== "string" || !action) return false;
2554
+ if (!Array.isArray(parameters) || parameters.length === 0) return false;
2555
+ return parameters.every((parameter) => {
2556
+ return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
2557
+ });
2558
+ }
2509
2559
  function createConfirmTool(options) {
2510
- return createInteractiveTool(options, {
2560
+ const tool = createInteractiveTool(options, {
2511
2561
  name: CONFIRM_TOOL_NAME,
2512
2562
  description: "Ask the user to approve a specific action before it happens. Use before anything that spends money or is hard to undo, such as booking or cancelling a restaurant table, or placing an order. List every parameter of the action, with the exact values you are about to use \u2014 the user approves what this card shows, and nothing else. Returns whether they confirmed. Do not use for ordinary yes/no questions; use prompt_user_choice for those.",
2513
2563
  parameters: {
@@ -2551,25 +2601,35 @@ function createConfirmTool(options) {
2551
2601
  required: ["title", "action", "parameters"]
2552
2602
  },
2553
2603
  interactionType: "confirm",
2554
- validate: (args) => {
2555
- const { title, action, parameters } = args;
2556
- if (typeof title !== "string" || !title) return false;
2557
- if (typeof action !== "string" || !action) return false;
2558
- if (!Array.isArray(parameters) || parameters.length === 0) return false;
2559
- return parameters.every((parameter) => {
2560
- return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
2561
- });
2562
- },
2604
+ validate: isWellFormedCard,
2563
2605
  mapResult: (result, args) => {
2564
2606
  if (typeof result.confirmed !== "boolean") return { cancelled: true };
2607
+ const requirement = result.confirmed ? confirmRequirement(args.action) : void 0;
2565
2608
  return {
2566
2609
  confirmed: result.confirmed,
2567
2610
  action: args.action,
2568
2611
  parameters: args.parameters,
2569
- answeredAt: (/* @__PURE__ */ new Date()).toISOString()
2612
+ answeredAt: (/* @__PURE__ */ new Date()).toISOString(),
2613
+ ...requirement && {
2614
+ status: requirement.status,
2615
+ next_step: `call ${requirement.tool} now with these exact values`
2616
+ }
2570
2617
  };
2571
2618
  }
2572
2619
  });
2620
+ const showCard = tool.executor;
2621
+ return {
2622
+ ...tool,
2623
+ executor: (args, signal) => {
2624
+ const missing = missingConfirmFields(args.action, args.parameters);
2625
+ if (missing.length > 0) {
2626
+ return Promise.resolve({
2627
+ error: `card is missing ${missing.join(", ")}; look them up and call ${CONFIRM_TOOL_NAME} again with every field`
2628
+ });
2629
+ }
2630
+ return showCard?.(args, signal);
2631
+ }
2632
+ };
2573
2633
  }
2574
2634
 
2575
2635
  // src/tools/connectorOffer.ts
@@ -13682,6 +13742,7 @@ export {
13682
13742
  AgentresError,
13683
13743
  AgentresPathError,
13684
13744
  AnumaJsxError,
13745
+ CHOICE_TOOL_NAME,
13685
13746
  CONNECTOR_ERROR_MARKER,
13686
13747
  CREATE_DOCUMENT_SCHEMA,
13687
13748
  CREATE_FILE_SCHEMA,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.36.0",
3
+ "version": "6.38.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",