Simplify the payable-tool registration API by merging
AddPayableToolWithResolver into AddPayableTool, and thread a configurable
MaxTimeoutSeconds plus Extra through the payment options. getStyleProfile
keeps its 600s advertise timeout.
Extend x402 actual-cost settlement beyond getStyleProfile to every
Twitter-capable tool (findSimilarUsers, getEngagementMetrics,
getPostingPatterns, getTopicModeling, getSentimentTrends,
getEngagementDrivers). Each carries a twitterPostCount (or source
platform + post count) in its response so settlement passes on the
realized Twitter API lookup and per-post costs.
- tools: payableDef uses UsesTwitter + TwitterPostCap instead of a
fixed Scheme; registerTools advertises upto at the cap-derived
maximum when Twitter is enabled, otherwise exact at the flat base
price.
- x402: export pricing constants and MaxTwitterCostMicro /
FormatPriceMicro / MicroFromPriceString helpers; add
AddPayableToolWithResolver and a per-tool settleResolvers map used
by both the MCP wrapper and REST override; buildSchemeConfigs
registers only the schemes declared in a tool's requirements.
- analytics: default aggregates include Twitter only when enabled;
result count recorded before caching and returned as twitterPostCount.
- server/twitterEnabled gates the upto switch (config bearer token).
- Added Scheme field to payableDef struct in tools.go
- getStyleProfile now uses 'upto' scheme (variable pricing: base + per-post)
- Modified buildRequirements in settlement.go to accept scheme parameter
- Default scheme is 'exact' for backwards compatibility
- getStyleProfile uses 'upto' scheme to match its variable pricing model
(base /bin/bash.10 + /bin/bash.01 user lookup + /bin/bash.005 per post)
- This fixes 'invalid_exact_evm_payload_authorization_value' error from facilitator
which expected upto scheme for variable pricing
- Changed 'actor' to 'author' in schemaExtra input BodyFields for:
- getPost
- getLatestPosts
- getPostsInTime
- getStyleProfile
- findSimilarUsers
- These now match the actual request struct field names (Author)
- Output BodyFields remain unchanged (still use 'actor' for response)