// Hints are the `hint` field we return alongside every tool result. The LLM
// reads them and often surfaces the guidance into its reply to the human, so
// the text is written for a human audience: NEVER name specific tools
// (fast_wallet_import, fast_shop_search, etc.) — non-developer users shouldn't
// have to learn our tool vocabulary. Describe what the HUMAN needs to do,
// then trust the LLM to pick the right tool from context.
export const ERROR_HINTS = {
    WALLET_NOT_FOUND: "No Agent Wallet is loaded yet. Tell the human to visit https://app.fast.xyz/, create an exclusive Agent Fast Wallet there, and paste the private key back in the chat. Only ask for the private key — the address will be derived automatically.",
    WALLET_LOAD_FAILED: "The wallet file on disk is unreadable. Tell the human to delete ~/.fast/keys/default.json and paste the private key from https://app.fast.xyz/ again.",
    INVALID_PRIVATE_KEY: "The private key looks malformed. Ask the human to re-copy the exact value from the Agent Wallet page at https://app.fast.xyz/ — it should be a 64-character hex string.",
    WALLET_ALREADY_EXISTS: "A different Agent Wallet is already saved on this machine. The human should back up or remove ~/.fast/keys/default.json before pasting a new private key — otherwise the existing wallet's funds become unreachable.",
    CONFIRMATION_REQUIRED: "Show the full details to the human for approval, then retry with their explicit confirmation.",
    SHOP_QUOTE_EXPIRED: "The quote has expired. Request a fresh quote before proceeding.",
    SHOP_AUTH_FAILED: "The merchant rejected this request's authentication. This is NOT a missing-private-key situation — if you've already seen a wallet address from any prior call, the key is on disk. Most common causes: (a) the search hint expired (re-run the search to mint fresh hints); (b) the merchant is mid-rotation on its hint secret (retry once); (c) the quote_id was for a different merchant. Do NOT ask the human for the private key — check wallet readiness first.",
    X402_PAYMENT_FAILED: "The on-chain payment step failed. Common causes: insufficient balance, network blip, or the merchant's payment requirements moved between quote and pay. Compare the wallet balance to the quote's price_usdc before retrying. Do NOT interpret this as a missing private key — if any prior tool returned the wallet address, the key is on disk and signing works. Retry once if the user wants to.",
    SHOP_RATE_LIMITED: "Rate limited by the shop API. Wait a moment and try again.",
    NETWORK_ERROR: "Network request failed. Check connectivity and retry.",
    X402_INVALID_REQUIREMENTS: "The merchant's payment requirements came back malformed. This is usually transient — retry.",
    SHOP_HTTP_ERROR: "The shop API returned an unexpected error. Retry, or try a different query.",
    BUYER_IDENTITY_REQUIRED: "This merchant requires additional buyer identity information before a quote can be issued. " +
        "The `detail` field in the error specifies exactly which fields are needed (e.g. cpf, birth_date). " +
        "Ask the buyer for those specific values — explain what each is and why the merchant needs it " +
        "(e.g. \"Hidratei requires your Brazilian CPF (11-digit tax ID) and date of birth for regulatory " +
        "reasons — these go directly to the store and are not stored by Fast\"). " +
        "Once the buyer supplies them, retry the quote with buyer_identity included. " +
        "NEVER generate, guess, or invent identity documents — only use what the buyer provides.",
    FAST_CHECKOUT_NOT_SUPPORTED: "This merchant only supports self-checkout — the buyer pays the store directly with their own card on a Shopify-hosted checkout page. Fast does not quote or take payment for this shop. Switch to the hand-off checkout flow to generate a pre-filled checkout link, then surface that link to the buyer. Do not retry with the quote/pay path; this is a routing decision, not a transient failure.",
    SELF_CHECKOUT_NOT_SUPPORTED: "This merchant does not expose a hand-off checkout flow — it only supports automated Fast checkout (quote → pay). Switch to the standard quote-then-confirm path. Do not retry hand-off for this shop; this is a routing decision, not a transient failure.",
};
export const TOOL_HINTS = {
    wallet_import: "Agent Wallet saved locally. You can now check its balance or continue with any pending purchase silently — the human already did their part by pasting the key.",
    wallet_send: "Transfer complete. Verify the new balance silently before reporting the result.",
    shop_list_merchants: "AUTHORITATIVE list of merchants available on Fast Shop. " +
        "When the human asks what stores are available, reply with ONLY the `displayName` values " +
        "from the `merchants` array above — do not add 'amazon', 'walmart', 'home depot', 'target', " +
        "'best buy', 'allbirds', 'ebay', 'etsy', 'ikea', 'costco', or any other name not in that " +
        "array. Do not list 'shopify' as a merchant — it's a platform (shown in the `platform` field). " +
        "If the human mentions a specific merchant not in this list, tell them it's not supported on " +
        "Fast Shop and offer to search the available merchants for something similar.",
    shop_search: "Products found. Look up full details + seller offers for any product the human is considering. " +
        "CRITICAL — render prices using each result's `display_price` string verbatim (\"R$ 39,90\", \"$39.90\", \"€19.99\"); " +
        "do NOT format `price` (cents) yourself. Different merchants list in different currencies — Hidratei + Insider " +
        "are BRL, EU merchants are EUR, US merchants are USD — and the LLM defaults to \"$X\" which lies to the buyer " +
        "when the merchant isn't USD. If `display_price` is absent, fall back to `<price/100> <currency_code>` " +
        "(\"39.90 BRL\"), never to bare \"$X\".",
    shop_get_product: "Product details loaded. To buy, get a delivered-price quote with a complete shipping address that INCLUDES a phone_number — retailers reject checkouts without a delivery phone, so ask the buyer for it if they haven't provided one. " +
        "For US merchants: 10-digit US phone, ZIP code, full street with leading number in address_line1. " +
        "For Brazilian merchants (e.g. Hidratei, Insider): country=\"BR\", phone with +55 country code, CEP in postal_code, street name only in address_line1, the house number in `street_number`, the neighborhood in `neighborhood`. " +
        "Do not ask for CPF or birth date up front. If the quote returns BUYER_IDENTITY_REQUIRED, ask only for the exact identity fields named in that error.",
    shop_quote: "Quote ready. TWO-TURN PAYMENT PROTOCOL — do not collapse into one message.\n" +
        "Turn 1 (present + wait): show the `note` field EXACTLY as returned inside a fenced monospace code block — it already includes the correct currency symbol for the active network (fastUSD on mainnet, testUSDC on testnet). Do not substitute or rename it. Also list the alternatives from `delivery_options` (e.g. \"Available shipping: Standard (Free), Two-Day ($10.95), One-Day ($16.95). Your quote uses the cheapest option — let me know if you'd rather upgrade.\"). Then ask for explicit confirmation: \"Reply 'pay' to authorize, or 'cancel' to back out.\" Do NOT place the order in this turn.\n" +
        "If the human requests a different shipping tier, re-quote with `shipping_method_index` matching the desired tier: 0=Standard, 1=Two-Day, 2=One-Day, etc. The new quote will reflect the updated shipping cost and total price.\n" +
        "Turn 2 (accept + order): only place the order when the human replies with a whole-word confirmation — `yes`, `confirm`, `pay`, `proceed`, `authorize`, `authorise`. On ambiguous replies (\"looks good\", \"ok\", \"sure\"), re-ask: \"Please confirm by replying 'pay' or 'cancel'.\" On cancel, stop.\n" +
        "quote_id is a UUID v4 (e.g. f47ac10b-58cc-4372-a567-0e02b2c3d479). Copy it VERBATIM when placing the order — never prefix it with `quote_`/`q_`, never invent one, never regenerate. Pass `confirmation: true`. The quoted total is the payment cap — the two-turn protocol makes the human approve it before you ever submit. Quotes expire in 10 minutes; if expired, get a fresh one.",
    shop_handoff_checkout: "Hand-off checkout link ready. Surface ALL of these to the human, in this order:\n" +
        "1. The `checkout_url` as a clickable link.\n" +
        "2. The `total_cents` formatted as USD (e.g. \"~$15.21 estimated\") so they know what to expect — this is informational only, the buyer will see Shopify's authoritative number on the page.\n" +
        "3. The `instructions` string verbatim (it already explains that Fast doesn't see the card and that the cart expires).\n" +
        "Do NOT ask for confirmation, do NOT call any other tool after this. The buyer's next action is on Shopify, not in chat. Do NOT claim anything about order placement, tracking, or refunds — Fast is not in the loop after this point. If the buyer reports a problem with the merchant order later, advise them to contact the store's support directly (Fast did not handle the payment).",
    shop_create_order: "Payment accepted but the order is NOT YET CONFIRMED. This tool polled the merchant until the order reached a terminal state; inspect `status` in the response and report honestly:\n" +
        "  `placed`      → the order is confirmed. Include any shopify_order_id / tracking present.\n" +
        "  `failed`      → the physical checkout was declined by the store. Look at `refund_status`: `sent` = funds refunded (done); `pending` = refund in flight, should arrive within a minute; `failed` = automatic refund did NOT go through, tell the human to contact support with the order id.\n" +
        "  `cancelled`   → the order was cancelled. Refund already sent.\n" +
        "  `submitted` or `pending` or `processing` → still in progress after the poll timeout. Tell the human we're still working on it and they should ask again in ~1 minute; do NOT claim the order is placed.\n" +
        "HARD RULE: do not use phrases like \"Order placed\", \"Order confirmed\", \"Shipping to …\", \"Your order is on its way\", \"Shipped\", \"On its way\" unless status is exactly `placed`. Never invent shipping dates, tracking numbers, or confirmation details that aren't in the response.\n" +
        "HARD RULE 2 (merchant communication): never claim or imply the merchant will follow up by email, SMS, push, or any channel — Fast has zero visibility into the merchant's post-purchase comms and the merchant may not have the buyer's email at all. Forbidden phrasing includes: \"the store will email/SMS you\", \"<merchant> will follow up\", \"watch for a tracking email\", \"you'll receive a confirmation\", \"check your inbox\". Only state what's literally in the response (status, shopify_order_id if present, refund_status). If the human asks about tracking or email confirmation, answer: \"I can't see the merchant's communications — check the order page directly with the order id, or contact the store's support if you don't see anything from them.\"",
    shop_list_orders: "Orders listed. Look up details + tracking for any the human wants to follow up on.",
    shop_get_order: "Order details retrieved. Report honestly based on `status`:\n" +
        "  `placed`            → confirmed; share shopify_order_id / tracking if present.\n" +
        "  `failed` or `cancelled` → not placed. Inspect `refund_status`: `sent` = funds returned, `pending` = refund in flight, `failed` = refund stuck — human must contact support with the order id.\n" +
        "  `pending` / `processing` → still in progress; suggest checking back shortly.\n" +
        "Only `pending` orders are cancellable. Never claim completion details that aren't in the response.",
    shop_cancel_order: "Order cancelled. Refund is queued; confirm status by re-checking the order details if asked.",
};
export function hintForError(errorCode) {
    return ERROR_HINTS[errorCode] ?? "Something unexpected went wrong. Check the details and retry if it looks transient.";
}
export function hintForBalance(amount, token, fundingUrl) {
    if (parseFloat(amount) === 0) {
        const link = fundingUrl ?? "https://app.fast.xyz/";
        return `Balance is zero. Send this link to the human to top up the Agent Wallet — they'll be offered Cash, Crypto, or an existing balance to fund from: ${link}`;
    }
    return `Wallet has ${amount} ${token}. Ready to shop.`;
}
export function hintForOnboard(funded, fundingUrl) {
    if (!funded) {
        return `The Agent Wallet has no balance yet. Send this link to the human — it lets them fund the wallet with Cash, Crypto, or an existing fastUSD balance, all targeting this exact address: ${fundingUrl}`;
    }
    return "Agent Wallet is funded and ready. Proceed with the purchase.";
}
/**
 * Hint to surface when an x402 payment fails because the agent wallet's
 * fastUSD balance is short of the order total. Returns a structured /fund
 * link with the exact gap pre-filled, so the human can top up just the
 * missing amount and the agent can retry.
 */
export function hintForInsufficientFunds(fundingUrl, missingAmount, token) {
    return `Wallet is short of the order total by ${missingAmount} ${token}. Send the human this link to top up the gap and retry the purchase: ${fundingUrl}`;
}
//# sourceMappingURL=hints.js.map