feat(agent): 「Agent に頼めること」— セットアップ後にそのまま貼れる依頼文 5 本 - #550
Merged
Merged
Conversation
Arc Portal の「あなたのエージェントができること」を参考に、/agent の「Agent を接続」の下へ コピー可能な依頼文を並べる。例はすべて実在の商品とツールに基づく (カタログの一覧・ JPYC Service Monitor の購入・店の注文・購入履歴 = wallet_history・上限の確認)。 - 支払いが起きるのは 1 本だけで、依頼文そのものに上限額 (3 JPYC) を書く。タグで 無料 / 支払いあり / 支払いは自分で を色分け - 「3 JPYC」は価格 SOT (JPYC_SERVICES_RESOURCE.priceJpyc) と DISCLOSED_X402_FEE から導出して テストで固定 (価格や利用料を変えたら落ちる) - 文言 SOT は lib/agentPage.ts (server から props で渡す・messages には置かない) - 1 枚のカードに行を並べる。依頼文ごとのカードだと mobile で 1,135px → 731px に圧縮 (磨き上げ P1 で削った全長を戻さない) - コピーは useHydrationSafeAvailable で server と初回描画を揃える・計測は成功時に id だけ (依頼文の本文は送らない)・a11y 名は可視テキスト + aria-describedby で 5 つのボタンを区別 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…チェック反映) - 計測: @vercel/analytics を直接呼んでいたのを lib/agentTrack.ts の trackAgentEvent に統一。 他の agent イベントと同じく locale を付ける (ja / en を分けて見られない唯一のイベントだった)。 送るのは依頼文の id だけで本文は送らない - 読み上げ: 5 つのボタンの名前そのものを aria-live にしていたため、名前の変更と live region が 二重に読まれていた → ボタンの外に role=status を 1 つだけ置く - 価格フェンス: Number 演算だと小数価格で偽 fail (0.3 + 1 = 1.2999…) → 実装と同じ atomic の BigInt 演算 (parseUnits / formatUnits) に Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc
- lead: 「Agent が支払う」で接続したときの例で、店の注文は「人が支払う」でも使える、を 1 句 (human-pays = order profile には 5 本中 4 本のツールが無い) - paidNote: 「小さいほうが効く」は不正確 (Agent 側の上限のほうが小さいと支払いは拒否される) → 「依頼文の上限を超える支払いは行われない・Agent 側の上限のほうが小さいときは拒否」に Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
何を足すか
/agent の「Agent を接続」の下に、新セクション 「Agent に頼めること」。セットアップ後にそのまま Agent へ貼れる依頼文 5 本を、コピーボタンつきで並べる (Arc Portal の「あなたのエージェントができること」を参考・user 発案 9/22)。
discovery_search・x402_quotex402_payfind_shops・order_menu・createOrderLinkwallet_history(0.16)wallet_status公開文言は user 承認済み (9/22「セクション『Agent に頼めること』良いね。進めて」)。en も同じ 5 本。支払いが起きるのは 1 本だけで、依頼文そのものに上限額を書いてある。
実装
lib/agentPage.tsのtryPrompts(server から props で渡す・messages/には置かない = 既存の /agent の型)components/agent/AgentTryPrompts.tsx(client): 1 枚のカードに 5 行。コピーはuseCopyToClipboard+useHydrationSafeAvailable(feat(agent): Agent activity — Agent Wallet の下に JPYC の入出金と直近の送金額を表示 #538 / fix(ui): コピー欄と支払い控えの hydration 不一致をなくす #541 と同じ hydration 対策)・clipboard が無い環境ではボタンを出さないtrack('agent_try_prompt_copy', { id })— 依頼文の本文は送らない・計測の失敗はコピーに波及させない (掟 13)aria-describedbyで依頼文に紐づけて 5 つを区別・aria-label単独付与なし・タップ領域 44pxJPYC_SERVICES_RESOURCE.priceJpycとDISCLOSED_X402_FEEから導出して、ja / en の依頼文とタグの両方と突き合わせる (価格か利用料を変えたら落ちる)money-path 不変・新規依存なし・page ファイルは import と 1 行の配置だけ (規定外 export なし)。
検証
tests/components/agent+agentPage+pageExports: 11 files / 240 tests pass (新規 21 件)npm run build成功 (Codex 実行)・/[locale]/agent = 354 kB / 予算 356 kBnext dev -p 3143・ja / en × mobile / desktop): 横はみ出し 0・pageerror 0。セクションの高さ mobile 731px (依頼文ごとにカードを分けた初版は 1,135px → 1 枚のカード+タグとコピーを同じ行に、で圧縮)・desktop 608px。ページ全長 mobile 2,690 → 3,406pxOpus 5 抜け漏れチェック (反映済み)
wallet_historyは 0.16 だが Web は 0.15 固定」→ チェック時点の main が古かった。feat(agent): /agent・setup.md・llms.txt を MCP 0.16 に切り替える (wallet_history) #549 (main 916ac75) で 0.16 に切替済み・本 branch も 0.16 を含むlib/agentTrack.ts) を迂回・locale なし →trackAgentEvent('agent_try_prompt_copy', { locale, id })に統一aria-liveをボタン名に付けると二重に読まれる → ボタン外にrole=statusを 1 つ文言の最終形 (ja): lead「…コピーして Agent に貼るだけです。「Agent が支払う」で接続したときの例で、店の注文は「人が支払う」でも使えます。」/ paidNote「依頼文の上限を超える支払いは行われません。Agent 側の上限のほうが小さいときは、支払いは拒否されます。」
反映後の実測: セクション mobile 771px / desktop 628px (ja)・横はみ出し 0・pageerror 0・agent テスト 240 pass。
🤖 Generated with Claude Code
https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc