Skip to content

feat(aifp1): describeQuote — say what a payment buys, not just the amount - #56

Merged
enot3615 merged 1 commit into
mainfrom
feat/aifp1-describe-quote
Sep 4, 2026
Merged

feat(aifp1): describeQuote — say what a payment buys, not just the amount#56
enot3615 merged 1 commit into
mainfrom
feat/aifp1-describe-quote

Conversation

@enot3615

@enot3615 enot3615 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Agent-flow audit, point 6. The 402 and the quote answer "1.06 POL" and leave the agent — and whoever is watching it — to work out for what: how many requests, which paths, until when, at what fee.

A payment prompt that states an amount without the terms is one a careful agent should refuse and a careless one over-pays on.

Every field is already in the quote. describeQuote assembles them:

Pay 1.055375555391386 POL ($0.10) for 200 requests to /api/agent/genres
(incl. 1.00% fee), valid until 2026-09-04T13:00:00Z.

Three things it makes legible that the raw fields don't:

  • the on-chain figure and the USD side by side, so neither is a surprise
  • the fee as a rate, from the split the quote carries — an agent can tell 1% from 50% instead of seeing only a total
  • the scope in words — "any path under /api/agent" vs one exact path vs the whole merchant. Scope is the field the wildcard bug proved everyone misreads, and it decides what the money actually buys.

wei converted with no float ("1 POL" is exactly one). No native settlement → falls back to the USD amount rather than inventing a token figure.

Pure function, no I/O — an MCP tool or CLI can put it in front of an LLM or a human unchanged. node suite 215 passing. Version rc.7 → rc.8.

…ount

Agent-flow audit, point 6. The 402 and the quote answer "1.06 POL" and leave the
agent — and whoever is watching it — to work out FOR WHAT: how many requests,
which paths, until when, at what fee. A payment prompt that states an amount
without the terms is one a careful agent should refuse and a careless one
over-pays on.

Every field needed already lives in the quote. describeQuote assembles them into
the sentence a reasonable payer needs before signing:

  Pay 1.055375555391386 POL ($0.10) for 200 requests to /api/agent/genres
  (incl. 1.00% fee), valid until 2026-09-04T13:00:00Z.

Three things it makes legible that the raw fields do not:

  - the on-chain figure AND the USD, side by side, so neither is a surprise
  - the fee as a RATE, computed from the split the quote carries, so an agent
    can tell 1% from 50% rather than seeing only a total
  - the scope in words — "any path under /api/agent" vs one exact path vs the
    whole merchant. Scope is the field the wildcard bug proved everyone misreads,
    and it decides what the money actually buys.

wei is converted with no float, so "1 POL" is exactly one. No native settlement
falls back to the USD amount rather than inventing a token figure.

Pure function, no I/O, so an MCP tool or a CLI can put it in front of an LLM or
a human unchanged. node suite: 215 passing. Version rc.7 -> rc.8.
@enot3615
enot3615 merged commit 3083c62 into main Sep 4, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant