[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M718E0X4VE056S16PA347Z3F":3,"skill-same:01M718E0X4VE056S16PA347Z3F":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":31,"publishedAt":52,"linkOnly":53,"markdownContent":54,"markdownBody":55,"frontMatter":56,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":62,"ownerHtmlUrl":63,"ownerBlogUrl":64,"ownerDescription":6,"updatedAt":65,"install":66,"resources":79},"01M718E0X4VE056S16PA347Z3F","commerce-ui-tools",null,"The reference presentation-tool contract, covering server-side enrichment, suggestion chips, the event stream, progressive rendering, both roles' built-in components, and adding a vertical component. Load when building or reviewing how a commerce agent's output reaches a frontend.","anthropics\u002Fcommerce-agents","anthropics","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F76263028?v=4","01M697XGDPXJAVQ8391V2BCYTE","Anthropic","01M718D5FGWKEA8ZJF2GGGYZWB",3473,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fplugins\u002Fcommerce-builder\u002Fskills\u002Fcommerce-ui-tools\u002FSKILL.md",[18,23,26],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000037","律师与法务","PROFESSION","适用职业",[32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],"ui","Tools","commerce","commerce ui tools","when","load","reference","stream","contract","progressive","frontend","rendering","tool","server-side","event","how","enrichment","component","server","roles","2026-11-10 10:12:30",false,"---\nname: commerce-ui-tools\ndescription: The reference presentation-tool contract, covering server-side enrichment, suggestion chips, the event stream, progressive rendering, both roles' built-in components, and adding a vertical component. Load when building or reviewing how a commerce agent's output reaches a frontend.\n---\n\n# Presentation tools\n\nPaths are in the reference repo: `commerce_common\u002F` is `commerce-common\u002Fcommerce_common\u002F`, `shopping_agent\u002F` is\n`shopping-agent\u002Fcore\u002Fshopping_agent\u002F`, `merchant_agent\u002F` is `merchant-agent\u002Fcore\u002Fmerchant_agent\u002F`.\n\n## The contract\n\n- A component is a tool. The model's arguments carry its judgment: which ids, in what order, the reason or the\n  note for each, what to compare on. The server joins every fact (title, price, image, metric value, change\n  record) from records tools returned this session, so the frontend never renders a model-authored value.\n- One spec per component: `PresentationComponent` in `commerce_common\u002Fpresentation.py` names the tool, the\n  `component` string the host renders, the `payload_model` that validates the arguments (each role's\n  `tools\u002Fpresentation.py`), and the `enrich` hook (each role's `enrichment.py`, collected in `PRESENTATION_COMPONENTS`).\n- `run_presentation` in `commerce_common\u002Fpresentation.py` is the one runner: validate, enrich, emit the `ui` event.\n  The model reads the executor's `displayed_text` plus the hook's notes; the enriched payload goes to the host only.\n- An enrich hook drops ids without provenance and appends a note naming them; with nothing left it raises\n  `PresentationRefused`, which comes back as a held call when it names a gate and as an error otherwise.\n- Shopping joins from `ShoppingSessionState.seen_products`, the cart, or an order read; merchant joins from\n  `MerchantSessionState.latest_snapshot`, `seen_series`, `seen_campaigns`, `seen_analyses`, `seen_listings`, and `seen_changes`.\n  `enrich_change_preview` also removes model text whose currency or weekday disagrees with the change record.\n- Composition rules (which component ends a turn, text carries the reasoning, cards carry the data) are static\n  prompt material; each component's when-to-use line is its tool description (commerce-architecture's layer table).\n\n## Suggestions\n\n- `present_suggestions` is the one tool that carries the turn's chips, up to four; the model calls it in the same\n  round as the turn's last component, or after its text when the turn has none, and a tapped chip is sent as the next\n  user message. No other payload, built-in or extension, carries chips.\n- `sanitize_suggestion_chips` in `commerce_common\u002Ffencing.py` runs on `PresentSuggestionsPayload`: invisible and control\n  characters out, whitespace collapsed, empties dropped, 80 characters each, four at most. The payload fails when no\n  chip survives sanitizing.\n- A round of clean presentation calls that includes `present_suggestions` ends the turn (`round_closes_turn` in\n  `commerce_common\u002Fturn.py`, `close_on_presentation` in the config): the Messages API loop stops there, and the Agent\n  SDK runtimes stop through a `PostToolBatch` hook (`close_on_presentation_hook` in `commerce_common\u002Fagent_sdk.py`).\n  Under host approval the merchant prompt says no chip approves or applies.\n\n## Streaming\n\nThe event list is the docstring of `commerce_common\u002Fstreaming.py`; `to_sse` frames each event and a host ignores\ntypes it does not know. `ui` carries one enriched component, `ui_partial` the same while its call still streams,\n`cart_update` the whole cart after a cart write, and `change_update` a change record after it moved. `outcome_events`\nin `commerce_common\u002Fturn.py` stamps each `ui` event with its call id as `stream_id` and follows it with the\n`tool_result`, whose `status` is `ok`, `error`, or `blocked`. Every tool that is not a presentation tool may take a\n`status` argument first (`with_status` in `commerce_common\u002Fexecution.py`): a few words for the person waiting, which\nthe executor drops before the call runs and the runtime emits as the `tool_call` event's `label`; the web layer shows\nit as the activity line. The MCP servers build their tools without it. The Agent SDK runtimes run the same executor but return the payloads together in `result.ui`\nafter the turn.\n\n## Progressive rendering\n\nA spec with an `enrich_partial` hook is rendered while its arguments arrive: the request marks its tool\n`eager_input_streaming` (`with_eager_input` in `commerce_common\u002Fprompt_assembly.py`), the orchestrator parses the\nbuffer with `parse_partial_json` (a string still being written is left out with its key), calls `enrich_partial`\n(`commerce_common\u002Fpresentation.py`), and yields `ui_partial` whenever `partial_signature` changes (`StreamedRound.frame`\nin `commerce_common\u002Fturn.py`; every visible change with `eager_partial_frames` on the config); the final `ui` event\ncarries the same `stream_id` and replaces it. Input that streams as text that is not JSON comes back to the model as\nan error result and the round goes on (`StreamedRound`). Partial\nhooks are synchronous and join from session state only (`partial_products`, `partial_comparison`, `partial_plan`,\n`partial_guide` in `shopping_agent\u002Fenrichment.py`; `partial_metrics`, `partial_digest`, `partial_change_preview` in\n`merchant_agent\u002Fenrichment.py`).\n\n## Built-in components\n\n- Shopping (`shopping_agent\u002Fenrichment.py`): `present_products`, `present_comparison`, `present_plan`, `present_guide`,\n  `present_order_status`, `checkout` (renders the cart; charges nothing), `present_suggestions`, and `present_disclosure`,\n  registered only with `enable_disclosures` and filled from `StorefrontBackend.get_disclosure`.\n- Merchant (`merchant_agent\u002Fenrichment.py`): `present_metrics`, `present_digest`, `present_change_preview`, `present_suggestions`.\n\n## Adding a vertical component\n\n- Build a `PresentationExtension` (`commerce_common\u002Fpresentation.py`): the tool description and `input_schema` the\n  model sees, the `payload_model` that validates the same shape, the `component` name, and the enrich hook.\n- Pass it as `extra_presentation_tools` to `ShoppingAgent` or `MerchantAgent` (`examples\u002Ftravel\u002Fapi\u002Fmain.py`); on\n  the Agent SDK and MCP paths, subclass the toolset or pass `executor_class=` so the executor receives it as\n  `extensions`. `build_tools` rejects a name that collides with a built-in,\n  and the extension's bytes join the cached tool list (commerce-prompt-caching).\n- The seven in the repo: `examples\u002Ftravel\u002Fapi\u002Fitinerary.py`, `examples\u002Ftravel\u002Fapi\u002Foccupancy.py`,\n  `examples\u002Ftelecom\u002Fapi\u002Fplan_matrix.py`, `examples\u002Ftelecom\u002Fapi\u002Fplan_mix.py`, `examples\u002Fentertainment\u002Fapi\u002Fvenue_map.py`,\n  `examples\u002Fentertainment\u002Fapi\u002Fhold_view.py`, `examples\u002Fentertainment\u002Fapi\u002Fevent_pacing.py`. Each keeps its types and\n  its card in the vertical; nothing is added to a core package.\n","# Presentation tools\n\nPaths are in the reference repo: `commerce_common\u002F` is `commerce-common\u002Fcommerce_common\u002F`, `shopping_agent\u002F` is\n`shopping-agent\u002Fcore\u002Fshopping_agent\u002F`, `merchant_agent\u002F` is `merchant-agent\u002Fcore\u002Fmerchant_agent\u002F`.\n\n## The contract\n\n- A component is a tool. The model's arguments carry its judgment: which ids, in what order, the reason or the\n  note for each, what to compare on. The server joins every fact (title, price, image, metric value, change\n  record) from records tools returned this session, so the frontend never renders a model-authored value.\n- One spec per component: `PresentationComponent` in `commerce_common\u002Fpresentation.py` names the tool, the\n  `component` string the host renders, the `payload_model` that validates the arguments (each role's\n  `tools\u002Fpresentation.py`), and the `enrich` hook (each role's `enrichment.py`, collected in `PRESENTATION_COMPONENTS`).\n- `run_presentation` in `commerce_common\u002Fpresentation.py` is the one runner: validate, enrich, emit the `ui` event.\n  The model reads the executor's `displayed_text` plus the hook's notes; the enriched payload goes to the host only.\n- An enrich hook drops ids without provenance and appends a note naming them; with nothing left it raises\n  `PresentationRefused`, which comes back as a held call when it names a gate and as an error otherwise.\n- Shopping joins from `ShoppingSessionState.seen_products`, the cart, or an order read; merchant joins from\n  `MerchantSessionState.latest_snapshot`, `seen_series`, `seen_campaigns`, `seen_analyses`, `seen_listings`, and `seen_changes`.\n  `enrich_change_preview` also removes model text whose currency or weekday disagrees with the change record.\n- Composition rules (which component ends a turn, text carries the reasoning, cards carry the data) are static\n  prompt material; each component's when-to-use line is its tool description (commerce-architecture's layer table).\n\n## Suggestions\n\n- `present_suggestions` is the one tool that carries the turn's chips, up to four; the model calls it in the same\n  round as the turn's last component, or after its text when the turn has none, and a tapped chip is sent as the next\n  user message. No other payload, built-in or extension, carries chips.\n- `sanitize_suggestion_chips` in `commerce_common\u002Ffencing.py` runs on `PresentSuggestionsPayload`: invisible and control\n  characters out, whitespace collapsed, empties dropped, 80 characters each, four at most. The payload fails when no\n  chip survives sanitizing.\n- A round of clean presentation calls that includes `present_suggestions` ends the turn (`round_closes_turn` in\n  `commerce_common\u002Fturn.py`, `close_on_presentation` in the config): the Messages API loop stops there, and the Agent\n  SDK runtimes stop through a `PostToolBatch` hook (`close_on_presentation_hook` in `commerce_common\u002Fagent_sdk.py`).\n  Under host approval the merchant prompt says no chip approves or applies.\n\n## Streaming\n\nThe event list is the docstring of `commerce_common\u002Fstreaming.py`; `to_sse` frames each event and a host ignores\ntypes it does not know. `ui` carries one enriched component, `ui_partial` the same while its call still streams,\n`cart_update` the whole cart after a cart write, and `change_update` a change record after it moved. `outcome_events`\nin `commerce_common\u002Fturn.py` stamps each `ui` event with its call id as `stream_id` and follows it with the\n`tool_result`, whose `status` is `ok`, `error`, or `blocked`. Every tool that is not a presentation tool may take a\n`status` argument first (`with_status` in `commerce_common\u002Fexecution.py`): a few words for the person waiting, which\nthe executor drops before the call runs and the runtime emits as the `tool_call` event's `label`; the web layer shows\nit as the activity line. The MCP servers build their tools without it. The Agent SDK runtimes run the same executor but return the payloads together in `result.ui`\nafter the turn.\n\n## Progressive rendering\n\nA spec with an `enrich_partial` hook is rendered while its arguments arrive: the request marks its tool\n`eager_input_streaming` (`with_eager_input` in `commerce_common\u002Fprompt_assembly.py`), the orchestrator parses the\nbuffer with `parse_partial_json` (a string still being written is left out with its key), calls `enrich_partial`\n(`commerce_common\u002Fpresentation.py`), and yields `ui_partial` whenever `partial_signature` changes (`StreamedRound.frame`\nin `commerce_common\u002Fturn.py`; every visible change with `eager_partial_frames` on the config); the final `ui` event\ncarries the same `stream_id` and replaces it. Input that streams as text that is not JSON comes back to the model as\nan error result and the round goes on (`StreamedRound`). Partial\nhooks are synchronous and join from session state only (`partial_products`, `partial_comparison`, `partial_plan`,\n`partial_guide` in `shopping_agent\u002Fenrichment.py`; `partial_metrics`, `partial_digest`, `partial_change_preview` in\n`merchant_agent\u002Fenrichment.py`).\n\n## Built-in components\n\n- Shopping (`shopping_agent\u002Fenrichment.py`): `present_products`, `present_comparison`, `present_plan`, `present_guide`,\n  `present_order_status`, `checkout` (renders the cart; charges nothing), `present_suggestions`, and `present_disclosure`,\n  registered only with `enable_disclosures` and filled from `StorefrontBackend.get_disclosure`.\n- Merchant (`merchant_agent\u002Fenrichment.py`): `present_metrics`, `present_digest`, `present_change_preview`, `present_suggestions`.\n\n## Adding a vertical component\n\n- Build a `PresentationExtension` (`commerce_common\u002Fpresentation.py`): the tool description and `input_schema` the\n  model sees, the `payload_model` that validates the same shape, the `component` name, and the enrich hook.\n- Pass it as `extra_presentation_tools` to `ShoppingAgent` or `MerchantAgent` (`examples\u002Ftravel\u002Fapi\u002Fmain.py`); on\n  the Agent SDK and MCP paths, subclass the toolset or pass `executor_class=` so the executor receives it as\n  `extensions`. `build_tools` rejects a name that collides with a built-in,\n  and the extension's bytes join the cached tool list (commerce-prompt-caching).\n- The seven in the repo: `examples\u002Ftravel\u002Fapi\u002Fitinerary.py`, `examples\u002Ftravel\u002Fapi\u002Foccupancy.py`,\n  `examples\u002Ftelecom\u002Fapi\u002Fplan_matrix.py`, `examples\u002Ftelecom\u002Fapi\u002Fplan_mix.py`, `examples\u002Fentertainment\u002Fapi\u002Fvenue_map.py`,\n  `examples\u002Fentertainment\u002Fapi\u002Fhold_view.py`, `examples\u002Fentertainment\u002Fapi\u002Fevent_pacing.py`. Each keeps its types and\n  its card in the vertical; nothing is added to a core package.\n",{"name":5,"description":7},"main","fd4d59224ab96b43c6dc6888207c67b3bd5a24cf","plugins\u002Fcommerce-builder\u002Fskills\u002Fcommerce-ui-tools",714,"https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents","https:\u002F\u002Fclaude.com\u002Fsolutions\u002Fcommerce","https:\u002F\u002Fgithub.com\u002Fanthropics","https:\u002F\u002Fanthropic.com","2026-11-04 19:55:09",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add anthropics\u002Fcommerce-agents --skill commerce-ui-tools",{"tool":72,"command":73},"bunx","bunx skills add anthropics\u002Fcommerce-agents --skill commerce-ui-tools",{"tool":75,"command":76},"pnpm","pnpm dlx skills add anthropics\u002Fcommerce-agents --skill commerce-ui-tools","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fplugins\u002Fcommerce-builder\u002Fskills\u002Fcommerce-ui-tools\u002FSKILL.md",true,[],[81,105,125,146,170,188],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":52},"01M718ECZVF8TFQM4CVAT5HGQG","search-discovery","Turning a described need (several constraints, a gift, a choice between candidates already in view, a search that came back empty or sold out) into a shortlist and a pick. Not needed when one search for the thing the customer named answers the request, or when the customer wants to learn what matters in a category first (purchase-research).","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fshopping-agent\u002Fskills\u002Fsearch-discovery\u002FSKILL.md",[],[88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,36,103,104],"discovery","search","search discovery","back","research","first","gift","view","customer","for","request","pick","purchase","choice","empty","learn","constraints",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":114,"publishedAt":52},"01M718EAXW7452GQ9336TFCEMH","purchase-research","Teaching a customer how to choose before any candidates appear, when they ask what matters in a category, how two approaches to it differ, or where to begin. Not needed once the customer has named the thing they want, however considered the purchase (that is search work), nor for outfitting a space or an event (planning-goals).","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fshopping-agent\u002Fskills\u002Fpurchase-research\u002FSKILL.md",[111],{"categoryNo":112,"categoryName":113,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",[92,115,100,116,117,118,96,47,97,46,119,89,120,121,36,122,123,124],"purchase research","work","goals","planning","choose","space","how to","ask","teaching","it",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":52},"01M718E8N33VV0XXCY2DA4Y548","planning-goals","Planning a coordinated set of items toward a goal, an event, a trip, or a project, where the request only comes together as several purchases with a structure between them, and later changes to a plan you have presented. Not needed when the customer wants a single item, however carefully chosen.","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fshopping-agent\u002Fskills\u002Fplanning-goals\u002FSKILL.md",[],[132,117,118,133,134,135,136,137,138,139,96,140,141,46,98,142,143,36,144,145],"planning goals","SET","with","as","structure","plan","changes","later","project","goal","single","only","you","trip",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":52},"01M718E5ES8CYDTZFZPB5XDTYP","memory-personalization","Requests about what is remembered, however short, from an ask to remember one thing to asks to say what is on file, correct it, or forget it; a bare save or an answer from the profile alone does not cover these. Also applying what the store already knows, recalling an older fact (a past recipient, a size, a recurring order) when it would change the pick, and deciding what should outlast the session. Not needed when the request carries no personal context to apply or keep.","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fshopping-agent\u002Fskills\u002Fmemory-personalization\u002FSKILL.md",[],[153,154,155,156,157,158,159,160,161,162,99,36,163,122,164,165,166,167,168,169],"memory","memory personalization","personalization","bare","remember","recurring","answer","session","correct","short","keep","apply","file","store","forget","say","change",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":52},"01M718E3E3Y51D55XXTQ9979T9","customer-care","Help after a purchase or booking, covering the status of an order or delivery whether or not the customer names it, returns, refunds, exchanges, and cancellations, an item that arrived damaged, incomplete, or late, and questions about the store's terms or a membership. Not needed for finding, comparing, or choosing something new.","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fshopping-agent\u002Fskills\u002Fcustomer-care\u002FSKILL.md",[],[96,177,166,97,178,179,180,181,182,100,183,184,185,124,186,187],"customer care","help","booking","questions","about","delivery","status","new","terms","refunds","returns",{"skillNo":189,"name":190,"nameZh":6,"description":191,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":192,"categories":193,"keywords":194,"publishedAt":52},"01M718DYMDGKG57WYYVCT8V31R","commerce-trust-safety","The rules the reference agents enforce in code for third-party content, writes, grounding, identity, and memory, each with its module, plus two adversarial-eval rules. Load when handling untrusted tool results, guarding a write tool, or scoping what an agent remembers.","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents\u002Fblob\u002Fmain\u002Fplugins\u002Fcommerce-builder\u002Fskills\u002Fcommerce-trust-safety\u002FSKILL.md",[],[195,196,34,197,153,97,198,44,199,200,37,201,36,202,203,134,204,205,206,207],"trust","commerce trust safety","Safety","enforce","eval","module","Rules","code","grounding","adversarial","results","write","party"]