@aeon-ai-pay/aigateway 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.4] — 2026-05-19
11
+
12
+ ### Added
13
+ - **`create-card` envelope now carries a `balance` block** (`initial`, `before`,
14
+ `after`, `charged`, `topup`) parallel to `create-image`, so the agent can
15
+ render the same money-flow narrative for card issuance.
16
+
17
+ ### Changed
18
+ - **Both paid commands adopt an emoji-aligned card-style success template**
19
+ with explicit balance transitions (`{initial} → {before}` for top-up;
20
+ `{before} → {after}` for charge) on dedicated rows. The `💸 Top-up` row is
21
+ conditional — only rendered when `balance.topup` is non-null.
22
+ - `create-card`: header `✅ Card Issued`, rows for Order / Card / State /
23
+ Face value / Usage / Tx / (optional) Top-up / Charged.
24
+ - `create-image`: header `✅ Generated`, second row `🧩 Powered by Skillboss`,
25
+ rows for Path / Format / Dimensions / Size / Tx / (optional) Top-up /
26
+ Charged.
27
+ - SKILL.md Copy Constraints table extended with all new template rows so
28
+ agents must reproduce the glyphs (`→`, `−`, `+`) exactly.
29
+
10
30
  ## [0.1.3] — 2026-05-19
11
31
 
12
32
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeon-ai-pay/aigateway",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "AI Agents discover, invoke, and settle paid LLMs, APIs, and Skills — starting with Skill Boss. No manual key setup. No prepayment. Pay-per-call via x402 or Agent Card.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@ description: >
16
16
  emoji: "🛰️"
17
17
  homepage: https://github.com/AEON-Project/aigateway
18
18
  metadata:
19
- version: "0.1.3"
19
+ version: "0.1.4"
20
20
  author: AEON-Project
21
21
  openclaw:
22
22
  requires:
@@ -238,16 +238,30 @@ Output template first line:
238
238
 
239
239
  ### Success
240
240
 
241
- `envelope.data`: `{ orderNo, data, paymentResponse, pollResult? }`. After fetching details (may take ~30 s), display **verbatim**:
241
+ `envelope.data`: `{ orderNo, amount, data, paymentResponse, balance: { initial, before, after, charged, topup }, pollResult? }`.
242
+
243
+ After fetching details (may take ~30 s), display **verbatim** (emoji, spacing, glyphs `→` / `−` / `+` must match exactly):
242
244
 
243
245
  ```
244
- Order No: {orderNo}
245
- Card: {cardScheme} •••• {last4}
246
- State: Active
247
- Remaining balance: ${amount} USD
248
- Usage: 0 / 1 (single-use)
246
+ Card Issued
247
+ 🆔 Order {orderNo}
248
+ 💳 Card {cardScheme} •••• {last4}
249
+ 🎯 State Active
250
+ 💵 Face value ${amount} USD
251
+ 🔢 Usage 0 / 1 (single-use)
252
+ 🔗 Tx {transaction}
253
+ 💸 Top-up {initial} → {before} USDT (+{topup})
254
+ 💰 Charged {before} → {after} USDT (−{charged})
249
255
  ```
250
256
 
257
+ **Field rules:**
258
+
259
+ - `{cardScheme}` and `••••{last4}` come from `data.data.model` (already sanitized — never show full card number).
260
+ - `{transaction}` is `data.paymentResponse.txHash` or `data.data.transaction`. If absent, render the line as `🔗 Tx —`.
261
+ - The **`💸 Top-up`** row is **conditional**: render only when `data.balance.topup` is non-null and non-zero (i.e. a lazy top-up actually happened during this call). Otherwise **omit the entire `💸 Top-up` line**.
262
+ - The **`💰 Charged`** row is always rendered.
263
+ - Use the minus sign character `−` (U+2212) before `{charged}`, not the hyphen `-`. Use `→` (U+2192) for the balance transition arrow.
264
+
251
265
  Always record `orderNo` — only identifier for status queries.
252
266
 
253
267
  ### Errors
@@ -284,19 +298,31 @@ Output template first line:
284
298
 
285
299
  ### Success
286
300
 
287
- `envelope.data`: `{ prompt, transaction, images: [{ url, localPath, format, width, height, sizeHuman }], balance: { initial, before, after, charged } }`.
301
+ `envelope.data`: `{ prompt, transaction, images: [{ url, localPath, format, width, height, sizeHuman }], balance: { initial, before, after, charged, topup } }`.
288
302
 
289
- Display **verbatim**:
303
+ Display **verbatim** (emoji, spacing, dash glyphs `→` / `−` / `+` must match exactly):
290
304
 
291
305
  ```
292
306
  ✅ Generated
293
- Prompt: {prompt}
294
- Image: {localPath} ({width}×{height}, {sizeHuman})
295
- Transaction: {transaction}
296
- Charged: {balance.charged} USDT
297
- Balance: {balance.after} USDT remaining
307
+ 🧩 Powered by Skillboss
308
+ 📁 Path {localPath}
309
+ 🎨 Format {FORMAT}
310
+ 📐 Dimensions {width} × {height}
311
+ 💾 Size {sizeHuman}
312
+ 🔗 Tx {transaction}
313
+ 💸 Top-up {initial} → {before} USDT (+{topup})
314
+ 💰 Charged {before} → {after} USDT (−{charged})
298
315
  ```
299
316
 
317
+ **Field rules:**
318
+
319
+ - `{FORMAT}` is `data.outputFormat` uppercased (e.g. `PNG`, `JPEG`, `WEBP`).
320
+ - `{width}` / `{height}` / `{sizeHuman}` come from `data.images[0]` (first image only — agent does not list extras unless asked).
321
+ - `{transaction}` is `data.transaction` (may be `null` if the server didn't return one; in that case render the line as `🔗 Tx —`).
322
+ - The **`💸 Top-up`** line is **conditional**: only render it if `data.balance.topup` is not null and not "0" (i.e. a lazy top-up actually happened during this call). Otherwise **omit the entire `💸 Top-up` line**.
323
+ - The **`💰 Charged`** line is always rendered.
324
+ - Use the minus sign character `−` (U+2212) before `{charged}`, not the hyphen `-`. Use `→` (U+2192) for the balance transition arrow.
325
+
300
326
  ### Errors
301
327
 
302
328
  | `error.code` | Action |
@@ -404,6 +430,15 @@ The following first-line / key-phrase strings must be **exactly reproduced** —
404
430
  | Pre-check | `> Pre-check in progress...` |
405
431
  | Top up | `> Topping up wallet...` |
406
432
  | Create card | `> Creating Agent Card...` |
433
+ | Card success header | `✅ Card Issued` |
434
+ | Card Order row | `🆔 Order {orderNo}` |
435
+ | Card scheme row | `💳 Card {cardScheme} •••• {last4}` |
436
+ | Card State row | `🎯 State Active` |
437
+ | Card Face value row | `💵 Face value ${amount} USD` |
438
+ | Card Usage row | `🔢 Usage 0 / 1 (single-use)` |
439
+ | Card Tx row | `🔗 Tx {transaction}` |
440
+ | Card Top-up row (conditional) | `💸 Top-up {initial} → {before} USDT (+{topup})` |
441
+ | Card Charged row | `💰 Charged {before} → {after} USDT (−{charged})` |
407
442
  | Create image | `> Generating image...` |
408
443
  | Fetch details | `> Fetching card details, please wait...` |
409
444
  | Query status | `> Fetching card status...` |
@@ -411,6 +446,14 @@ The following first-line / key-phrase strings must be **exactly reproduced** —
411
446
  | Withdraw target line | `To: main wallet (0x0...{last4})` |
412
447
  | Withdraw status line | `Status: completed` |
413
448
  | Image success header | `✅ Generated` |
449
+ | Image success row 2 | `🧩 Powered by Skillboss` |
450
+ | Image Path row | `📁 Path {localPath}` |
451
+ | Image Format row | `🎨 Format {FORMAT}` |
452
+ | Image Dimensions row | `📐 Dimensions {width} × {height}` |
453
+ | Image Size row | `💾 Size {sizeHuman}` |
454
+ | Image Tx row | `🔗 Tx {transaction}` |
455
+ | Image Top-up row (conditional) | `💸 Top-up {initial} → {before} USDT (+{topup})` |
456
+ | Image Charged row | `💰 Charged {before} → {after} USDT (−{charged})` |
414
457
  | Wallet prepared header | `✅ Wallet prepared` |
415
458
 
416
459
  Address rendering: always `0x0...{last4}` (first 3 + ellipsis + last 4 chars).
@@ -82,11 +82,13 @@ export async function createCard(opts) {
82
82
  let sessionAddress;
83
83
  let topupAmount = null;
84
84
  let balanceInitialUsdt = null;
85
+ let balanceBeforeChargeUsdt = null;
85
86
 
86
87
  try {
87
88
  const { address, usdt, bnb, bnbRaw } = await getWalletBalance(privateKey);
88
89
  sessionAddress = address;
89
90
  balanceInitialUsdt = usdt;
91
+ balanceBeforeChargeUsdt = usdt;
90
92
  const usdtNum = parseFloat(usdt);
91
93
  logInfo(`Wallet: ${address}`);
92
94
  logInfo(`Balance: ${usdt} USDT, ${bnb} BNB`);
@@ -210,6 +212,7 @@ export async function createCard(opts) {
210
212
  logInfo("Re-checking wallet balance...");
211
213
  try {
212
214
  const { usdt, bnbRaw } = await getWalletBalance(privateKey);
215
+ balanceBeforeChargeUsdt = usdt;
213
216
  const usdtNum = parseFloat(usdt);
214
217
  if (needGas && bnbRaw === 0n) {
215
218
  emitErr("create-card", "INSUFFICIENT_BNB", {
@@ -260,12 +263,28 @@ export async function createCard(opts) {
260
263
  const paymentResponse = decodePaymentResponse(response.headers);
261
264
  const orderNo = paymentReq.orderNo || response.data?.model?.orderNo || response.data?.orderNo;
262
265
 
266
+ let balanceAfterUsdt = null;
267
+ try {
268
+ const after = await getWalletBalance(privateKey);
269
+ balanceAfterUsdt = after.usdt;
270
+ } catch (e) {
271
+ logInfo(`Post-payment balance check failed: ${e.message}`);
272
+ }
273
+
263
274
  const sanitizedData = sanitizeOutput(response.data);
264
275
  const successData = {
265
276
  appId,
266
277
  orderNo,
278
+ amount,
267
279
  data: sanitizedData,
268
280
  paymentResponse,
281
+ balance: {
282
+ initial: balanceInitialUsdt,
283
+ before: balanceBeforeChargeUsdt,
284
+ after: balanceAfterUsdt,
285
+ charged: requiredUsdt,
286
+ topup: topupAmount,
287
+ },
269
288
  };
270
289
 
271
290
  function findCardStatus(obj) {