From b1e8086c78d3505f130def022d7c45132a8ca1f1 Mon Sep 17 00:00:00 2001 From: drapeau Date: Fri, 22 May 2026 19:16:39 +0000 Subject: [PATCH 1/2] cli: add report command for agent observability Add `link-cli report` command that reports purchase outcomes. Exposed as MCP tool when running with --mcp. Co-Authored-By: Claude Opus 4.6 (1M context) Committed-By-Agent: claude --- packages/cli/src/cli.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/src/cli.tsx b/packages/cli/src/cli.tsx index efc8cc5..782b19b 100644 --- a/packages/cli/src/cli.tsx +++ b/packages/cli/src/cli.tsx @@ -9,6 +9,7 @@ import { createReportCli } from './commands/report'; import { createShippingAddressCli } from './commands/shipping-address'; import { createSpendRequestCli } from './commands/spend-request'; import { createUserInfoCli } from './commands/user-info'; +import { createReportCli } from './commands/report'; import { createWebBotAuthCli } from './commands/web-bot-auth'; import { ResourceFactory } from './utils/resource-factory'; import { @@ -88,6 +89,9 @@ cli.command( createWebBotAuthCli(() => factory.createWebBotAuthResource(), authStorage), ); cli.command(createReportCli(() => factory.createReportResource(), authStorage)); +cli.command( + createReportCli(() => factory.createReportResource(), authStorage), +); cli.command( createDemoCli( authRepo, From f4c05f0773f0d2397b46318b99fb9a9b15d5c7ce Mon Sep 17 00:00:00 2001 From: drapeau Date: Fri, 8 May 2026 21:29:07 +0000 Subject: [PATCH 2/2] skill: add reporting instructions to SKILL.md Agents must report purchase outcomes (success/blocked/abandoned) after every attempt. Documents the report command, valid tags, and usage examples. Co-Authored-By: Claude Opus 4.6 Committed-By-Agent: claude --- packages/cli/src/cli.tsx | 4 -- skills/create-payment-credential/SKILL.md | 56 +++++++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/cli.tsx b/packages/cli/src/cli.tsx index 782b19b..efc8cc5 100644 --- a/packages/cli/src/cli.tsx +++ b/packages/cli/src/cli.tsx @@ -9,7 +9,6 @@ import { createReportCli } from './commands/report'; import { createShippingAddressCli } from './commands/shipping-address'; import { createSpendRequestCli } from './commands/spend-request'; import { createUserInfoCli } from './commands/user-info'; -import { createReportCli } from './commands/report'; import { createWebBotAuthCli } from './commands/web-bot-auth'; import { ResourceFactory } from './utils/resource-factory'; import { @@ -89,9 +88,6 @@ cli.command( createWebBotAuthCli(() => factory.createWebBotAuthResource(), authStorage), ); cli.command(createReportCli(() => factory.createReportResource(), authStorage)); -cli.command( - createReportCli(() => factory.createReportResource(), authStorage), -); cli.command( createDemoCli( authRepo, diff --git a/skills/create-payment-credential/SKILL.md b/skills/create-payment-credential/SKILL.md index da9c784..32dcccb 100644 --- a/skills/create-payment-credential/SKILL.md +++ b/skills/create-payment-credential/SKILL.md @@ -216,6 +216,62 @@ All errors are output as JSON with `code` and `message` fields, with exit code 1 | Spend request approved but payment fails immediately | Wrong credential type for the merchant (e.g. `card` on a 402-only endpoint) | Go back to Step 2, re-evaluate the merchant, create a new spend request with the correct `credential_type` | | Auth token expired mid-session (exit code 1 during approval polling) | Token refresh failure during background polling | Re-authenticate with `auth login`, then retrieve the existing spend request or resume polling. Only create a new spend request if the original one expired, was denied, was canceled, or its shared payment token was already consumed | +## Reporting outcomes + +**REQUIRED:** After every purchase attempt, report the outcome. This applies whether the purchase succeeded, was blocked, or was abandoned. + +```bash +link-cli report \ + --domain \ + --outcome \ + --spend-request-id \ + [--tag ] \ + [--step ] \ + [--freeform-context "
"] +``` + +### When to report + +- **success** -- payment completed and order confirmed +- **blocked** -- the agent could not complete payment due to an obstacle (captcha, WAF, rate limit, etc.) +- **abandoned** -- the agent chose to stop (user canceled, site error, timeout, etc.) + +### Tags + +Add one or more `--tag` flags to classify what happened: + +| Tag | Meaning | +|---|---| +| `stripe_checkout` | Merchant uses Stripe checkout | +| `captcha` | Blocked by CAPTCHA | +| `anti_bot_script` | Blocked by bot detection script | +| `cdn_block` | Blocked by CDN (Cloudflare, etc.) | +| `waf_block` | Blocked by WAF | +| `dns_block` | DNS-level block | +| `rate_limited` | Rate limited | +| `login_required` | Login wall prevented checkout | +| `3ds_challenge` | 3DS challenge could not be completed | +| `page_inaccessible` | Page returned error or could not load | +| `timeout` | Operation timed out | +| `site_error` | Merchant site returned an error | +| `payment_declined` | Payment was declined by processor | +| `other` | Other (describe in freeform-context) | + +### Examples + +```bash +# Successful purchase +link-cli report --domain shop.example.com --outcome success --spend-request-id lsrq_abc123 + +# Blocked by captcha +link-cli report --domain shop.example.com --outcome blocked --spend-request-id lsrq_abc123 --tag captcha --step "checkout page" + +# Abandoned due to site error +link-cli report --domain shop.example.com --outcome abandoned --spend-request-id lsrq_abc123 --tag site_error --freeform-context "500 error on payment submission" +``` + +Report output is agent-only (not shown to the user). Always report, even if the purchase failed. + ## Further docs - MPP/x402 protocol: https://mpp.dev/protocol.md, https://mpp.dev/protocol/http-402.md, https://mpp.dev/protocol/challenges.md