Commit Graph
3 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 24c3d140ae docs: archive point-in-time records, fix live docs against the tree (#1349)
* docs: archive point-in-time records, drop broken guide symlinks

Status reports, progress trackers, audits, session summaries, completed
migration plans and the 2025 roadmap move to docs/archive/ (same relative
path), with a README saying they describe the day they were written.
.ai-guides/ held only symlinks into a docs/guides/ai/ that no longer
exists, tests/unit/docs/ held a stray copy of an old getting-started page,
and docs/operations/PORT_MANAGEMENT_README.md duplicated port-management.md;
all three are deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* docs: correct drifted paths, links and versions in current docs

Fix in place the reference docs agents use: point paths at where the code
lives now (src/stores/auth.ts, src/lib/supabase/*, scripts/dev/*,
docs/reference/api/CONVENTIONS.md, the squashed baseline migration),
rewrite the development, features, operations and API index pages to list
documents that exist, say plainly where something is gone (/api/metrics,
the CSP report route, .envrc in the repo, Loki's `migrate` script), and
correct the Next.js major. docs-truth findings: 468 -> 2 (both "Next 30/90
Days" headings in the legal overview, a checker false positive).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 14:09:06 +02:00
5d6772da72 feat(payments): HTTP 402 inline payment — speak the standard (L402-style) (#556)
Item 6 of the ledger-and-loop build sequence: being machine-payable in a
private dialect is a phone that only calls phones you manufactured. One
GET now does the whole loop in the convention foreign agents already
speak — no account, no API key, no JSON dialect:

  GET /api/v1/pay/{type}/{id}?amount_btc=X
    → 402 + WWW-Authenticate: L402 token=…, invoice=lnbc…
  (pay the invoice)
  GET + Authorization: L402 <token>:<preimage>
    → 200 receipt

- domain/payments/l402-codec: pure wire codec (header parse/build,
  sha256 preimage proof) — dependency-free for the unit suite
- domain/payments/l402: challenge creation over the existing account-less
  rails (initiatePublicSupport / public status tokens — zero new state,
  zero migrations) + verification: cryptographic preimage-vs-payment_hash
  FIRST (no trust in our own polling), settlement status as the fallback
  for hashless rails (on-chain)
- api/v1/pay/[entity_type]/[entity_id]: the route; per-IP rate limit on
  challenge creation, safe-error surface mirrored from the public route
- standardResponse: apiPaymentRequired joins the response SSOT (402 is
  the protocol working, not an error to log)
- hashPublicStatusToken exported from paymentFlowService (SSOT, was
  file-private)
- OpenAPI + public-api registration; AGENTS.md 'Paying inline (HTTP 402)'
- tests: 10-case suite (codec proofs, both branches, envelope, safe errors)

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 14:58:33 +02:00
c50840a34a feat: Cat spend caps + machine-payable v1 payments (agent buy loop) (#512)
* feat(cat): enforce BTC spend caps — per-action cap + daily budget

max_btc_per_action existed since baseline but was never read; every Cat
payment ignored it. Now enforced in CatPermissionService.checkSpendCaps
(stricter of specific-action and category caps wins), checked early in
executeAction and re-checked as a backstop in performAction so the
confirm-later path can't bypass a cap that changed after proposal.

- New max_btc_per_day column: daily BTC budget derived from
  cat_action_log.amount_btc (executing+completed rows; no new state)
- API: maxSatsPerAction renamed maxBtcPerAction — old name validated
  .int() but stored raw into the BTC column (a '100 sats' cap would have
  stored 100 BTC); caps now omitted=keep, null=clear so grant toggles
  no longer wipe limits
- Spending caps editor on the payments category row (semantic tokens,
  fiat equivalent via useDisplayCurrency)
- 12 new tests: pure cap-combination, service checks, executor wiring

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(api): machine-payable v1 payments — the agent buy loop

Closes the discover → quote → pay → verify loop under the /api/v1
contract. Discovery (entity list/get, /v1/search) already accepted
integration keys; payment creation and settlement polling did not.

- POST /api/v1/payments: dual-auth (ock_ keys with payments.write scope,
  or session), per-key rate bucket, wraps initiatePayment. Key callers
  are gated on the entity being anonymously visible so service-role
  writes can't reach non-public listings
- GET /api/v1/payments/{id}: settlement status (payments.read) —
  'paid' is verified against the receiving wallet, not claimed
- OpenAPI: payments paths registered, including the previously
  unregistered anonymous /payments/public flow; scopes + endpoints
  added to the public-api SSOT (discovery + key-minting UI pick them up)
- docs/api/AGENTS.md: the whole loop with curl examples; v1 README table
- knownPaymentErrors extracted (shared by internal + v1 routes)
- 8 tests: auth/scope/visibility gates + spec-generation pin

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 10:36:32 +02:00