Selva
Shopping platform for AI agents. Search, compare, and buy physical products from Amazon.
User Experience
- - Be concise and human. Do not narrate command execution unless asked.
- Prefer outcome-first messaging:
- Good: "You’re registered. I can search now. Want me to find options for
<item>?"
- Avoid: "CLI installed... API key saved... next command is..."
- - Ask for only the missing info needed for the next step.
- When sharing links, use friendly markdown labels when supported:
-
[Open settings page](https://...)
- - When listing products for chat clients, send each product as a separate message with:
- the product image as a photo attachment
- a short caption (title, price, rating/reviews, delivery)
- a final text message asking which item to open or buy
Default Conversation Flow
- 1. Register quietly
- If registration is needed, do it and confirm briefly.
- 2. Check readiness
- If name or address is missing, ask for them naturally.
- If card is missing and user wants to buy, offer the settings link.
- 3. Search and guide
- Present top choices clearly (title, price, rating, delivery/get-it-by, image url, quick reason).
- Ask a simple follow-up: "Want details on any of these?"
- 4. Buy
- Confirm selected item and payment method.
- If approval flow is enabled and triggered, explain next action briefly.
Setup
- 1.
npx selva-cli register — generates an API key, stored locally at ~/selva/config.json - INLINECODE3 — required before buying
- INLINECODE4 — required before buying (
--line2 optional) - Optionally set phone: INLINECODE6
- Optionally set email for purchase receipts and approval notifications: INLINECODE7
- Link a payment card and optionally set an approval threshold at the web settings page: INLINECODE8
Commands
Search
npx selva-cli search "<query>"
Returns up to 10 normalized results with
selva_id, title, price, rating, source, url,
delivery_estimate (get-it-by), and
image_url.
When presenting search results to users, always include delivery/get-it-by text.
Prefer separate photo messages with captions (one per item) over markdown image links.
Requires address for best results but works without one.
Details
npx selva-cli details <selva_id>
Returns full product details from the original provider. Use the
selva_id from search results (e.g.
amzn_B0EXAMPLE).
Buy
npx selva-cli buy <selva_id> --method <saved|card>
Requires name, address, and a chargeable card profile. Buy creates an order record and returns its current status.
If an approval threshold is configured and the price exceeds it, the order enters
awaiting_approval and an approval email is sent.
Options:
- -
--method saved — uses the card linked on the settings page. Fails if no card is linked - ask the user to link one. - INLINECODE19 — tokenizes with Stripe and saves a reusable payment method snapshot for later processing. Card details never reach the Selva API.
Orders
npx selva-cli orders
Lists all orders with status: awaiting_approval, processing, expired, shipping.
Status meaning:
- -
awaiting_approval: waiting for user approval email click. - INLINECODE22 : order accepted and being processed.
- INLINECODE23 : shipping status has been updated.
Settings
- -
npx selva-cli settings — view current name, phone, address, email, approval threshold, and linked card info - INLINECODE25 — generates a 24-hour link to the web settings page where a human can link/remove a payment card and set an approval threshold
- INLINECODE26
- INLINECODE27
- INLINECODE28
- INLINECODE29
Product ID Format
IDs are prefixed by provider:
amzn_ for Amazon. Pass these to
details and
buy.
Capability Reference
- - Register user and store API key locally.
- Search products.
- Fetch product details.
- Buy by
selva_id. - View orders.
- Manage settings (name, phone, address, email, settings page link).
Command Reference
- - INLINECODE34
- INLINECODE35
- INLINECODE36
- INLINECODE37
- INLINECODE38
- INLINECODE39
- INLINECODE40
- INLINECODE41
- INLINECODE42
- INLINECODE43
- INLINECODE44
Selva
面向AI代理的购物平台。可搜索、比较并购买亚马逊上的实体商品。
用户体验
- - 简洁且人性化。除非被要求,否则不要叙述命令执行过程。
- 优先采用结果导向的表述方式:
- 正确示例:您已注册。现在可以搜索了。需要我帮您查找<商品>的选项吗?
- 避免:CLI已安装...API密钥已保存...下一条命令是...
- - 仅询问下一步所需的缺失信息。
- 分享链接时,在支持的情况下使用友好的Markdown标签:
-
打开设置页面
- - 在聊天客户端列出商品时,每条商品单独发送一条消息,包含:
- 商品图片作为照片附件
- 简短说明(标题、价格、评分/评论、配送信息)
- 最后一条文字消息询问要打开或购买哪个商品
默认对话流程
- 1. 静默注册
- 如需注册,完成注册并简要确认。
- 2. 检查就绪状态
- 若缺少姓名或地址,自然询问。
- 若缺少银行卡且用户想购买,提供设置链接。
- 3. 搜索与引导
- 清晰呈现最佳选择(标题、价格、评分、配送/送达日期、图片链接、简要理由)。
- 简单跟进询问:想了解其中任何一个的详细信息吗?
- 4. 购买
- 确认所选商品和支付方式。
- 若审批流程已启用并触发,简要说明下一步操作。
设置
- 1. npx selva-cli register — 生成API密钥,本地存储于~/selva/config.json
- npx selva-cli settings set-name --name 张三 — 购买前必需
- npx selva-cli settings set-address --street 主街123号 --line2 4B室 --city 奥斯汀 --state TX --zip 78701 --country US — 购买前必需(--line2可选)
- 可选设置电话:npx selva-cli settings set-phone --phone +8613800138000
- 可选设置用于接收购买收据和审批通知的邮箱:npx selva-cli settings set-email --email you@example.com
- 在网页设置页面关联支付卡并可选设置审批阈值:npx selva-cli settings page
命令
搜索
npx selva-cli search <查询词>
返回最多10个标准化结果,包含selva
id、标题、价格、评分、来源、URL、deliveryestimate(送达日期)和image_url。
向用户展示搜索结果时,务必包含配送/送达日期信息。
优先使用带说明的单独图片消息(每件商品一条),而非Markdown图片链接。
为获得最佳结果需要地址,但无地址也可使用。
详情
npx selva-cli details
返回来自原始供应商的完整商品详情。使用搜索结果中的selvaid(例如amznB0EXAMPLE)。
购买
npx selva-cli buy --method
需要姓名、地址和可扣款的银行卡资料。购买会创建订单记录并返回当前状态。
若配置了审批阈值且价格超出阈值,订单进入awaiting_approval状态并发送审批邮件。
选项:
- - --method saved — 使用设置页面关联的银行卡。若未关联银行卡则失败——请用户关联一张。
- --method card --number <卡号> --exp <月/年> --cvv <安全码> — 通过Stripe进行令牌化处理,保存可复用的支付方式快照供后续处理。银行卡详情绝不会到达Selva API。
订单
npx selva-cli orders
列出所有订单及其状态:awaiting_approval(等待审批)、processing(处理中)、expired(已过期)、shipping(配送中)。
状态含义:
- - awaiting_approval:等待用户点击审批邮件。
- processing:订单已接受并正在处理。
- shipping:配送状态已更新。
设置
- - npx selva-cli settings — 查看当前姓名、电话、地址、邮箱、审批阈值和关联的银行卡信息
- npx selva-cli settings page — 生成一个24小时有效的网页设置页面链接,用户可在该页面关联/移除支付卡并设置审批阈值
- npx selva-cli settings set-address --street <街道> [--line2 <第二行>] --city <城市> --state <州> --zip <邮编> --country <国家>
- npx selva-cli settings set-name --name <姓名>
- npx selva-cli settings set-email --email <邮箱>
- npx selva-cli settings set-phone --phone <电话>
商品ID格式
ID以供应商前缀开头:amzn_代表亚马逊。将这些ID传递给details和buy命令。
功能参考
- - 注册用户并在本地存储API密钥。
- 搜索商品。
- 获取商品详情。
- 通过selva_id购买。
- 查看订单。
- 管理设置(姓名、电话、地址、邮箱、设置页面链接)。
命令参考
- - npx selva-cli register
- npx selva-cli search <查询词>
- npx selva-cli details id>
- npx selva-cli buy id> --method
- npx selva-cli orders
- npx selva-cli settings
- npx selva-cli settings page
- npx selva-cli settings set-address --street <街道> [--line2 <第二行>] --city <城市> --state <州> --zip <邮编> --country <国家>
- npx selva-cli settings set-name --name <姓名>
- npx selva-cli settings set-email --email <邮箱>
- npx selva-cli settings set-phone --phone <电话>