@agent-cards/commerce-sdk 0.18.13 → 0.18.14

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.
Files changed (2) hide show
  1. package/dist/buy-tool.js +9 -1
  2. package/package.json +1 -1
package/dist/buy-tool.js CHANGED
@@ -1667,7 +1667,14 @@ export function buyTool(options) {
1667
1667
  // A step link held for the message that introduces it goes out before this call hands over any of its own.
1668
1668
  explicit?.release?.();
1669
1669
  const withdrawalsAtStart = withdrawals;
1670
- const input = parseBuyToolInput(raw);
1670
+ const parsedInput = parseBuyToolInput(raw);
1671
+ // A tapped turn's first call that names no product and no store picks the tapped card (TurnState.tapped).
1672
+ const tappedId = explicit?.tapped ?? null;
1673
+ if (explicit)
1674
+ explicit.tapped = null;
1675
+ const input = tappedId && !parsedInput.confirm && !parsedInput.new_order && !parsedInput.product_id && !parsedInput.store_id
1676
+ ? { ...parsedInput, product_id: tappedId }
1677
+ : parsedInput;
1671
1678
  // With carts at more than one store waiting, a new order would drop every one of them: "cancel the
1672
1679
  // reservation, keep the flowers" started a new conversation and lost the flowers cart (2026-10-20).
1673
1680
  // The ask goes to the same purchase instead, and Agentcard drops only the cart it names.
@@ -2619,6 +2626,7 @@ export function buyTool(options) {
2619
2626
  const answered = previousTurn !== null && (previousTurn.results?.length ?? 0) > 0;
2620
2627
  // A tap names its card by the id its link carried, whatever answer showed it: the pick goes straight with that id.
2621
2628
  const tappedId = typeof options?.tapped?.productId === 'string' && options.tapped.productId.trim() ? options.tapped.productId.trim() : null;
2629
+ state.tapped = tappedId;
2622
2630
  // A `nextStep` turn's call is the same whatever the model writes (`stepPlan` reads where the purchase stands), so it goes
2623
2631
  // straight too: with `replyAsWritten`, a step whose answer is a link, such as the approval after a saved card, needs no model.
2624
2632
  const direct = !directOn || running > 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-cards/commerce-sdk",
3
- "version": "0.18.13",
3
+ "version": "0.18.14",
4
4
  "description": "Give your agent one tool that buys for your shoppers at real stores, and post each purchase update Agentcard sends into the shopper's chat, over a connection your server opens or a webhook endpoint.",
5
5
  "homepage": "https://opencommerce.sh",
6
6
  "type": "module",