@aeon-ai-pay/aigateway 0.1.1 → 0.1.3

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,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.3] — 2026-05-19
11
+
12
+ ### Fixed
13
+ - **`wallet-init` no longer requires `mainWallet` field in config to consider the wallet "funded".**
14
+ Previously the decision tree was `created || !config.mainWallet ⇒ needsTopup=true`, which meant
15
+ a session wallet that had USDT and was already approved on-chain — but whose local config had
16
+ never recorded a `mainWallet` (e.g. funded by an external CEX transfer, or copied from another
17
+ machine without that field) — would still be flagged as needing a top-up, sending the agent
18
+ through a redundant `wallet-topup` flow. The decision now relies only on on-chain state
19
+ (USDT balance ≥ `LOW_BALANCE_THRESHOLD` and `allowance > 0`). `mainWallet` is treated purely
20
+ as a withdraw-default and has no effect on `needsTopup`.
21
+ - `topupReason` enum updated: `no_prior_funding` removed; new values are `first_time` (replaces
22
+ the created branch), `low_balance`, `no_approve`, and `chain_check_failed`.
23
+
24
+ ## [0.1.2] — 2026-05-19
25
+
26
+ ### Changed
27
+ - **SKILL.md wording discipline**: `wallet-topup` ask and `create-card` ask now have
28
+ enforced lexical separation. Step 2 (`wallet-topup`) explicitly says "load USDT
29
+ **into your session wallet**" / "往**本地钱包**充值 USDT". Step 3a (`create-card`)
30
+ says "card **face value**" / "**开多少美元的卡** / 卡的面额", and explicitly
31
+ forbids translating it as "充值". Fixes a UX confusion where a user with a
32
+ funded wallet would be asked "请问您想充值多少美元到虚拟卡上?" and reasonably
33
+ wonder if it was another wallet top-up prompt.
34
+ - New "Wording Discipline" section in SKILL.md `## Copy Constraints` to lock this in.
35
+
10
36
  ## [0.1.1] — 2026-05-19
11
37
 
12
38
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeon-ai-pay/aigateway",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1"
19
+ version: "0.1.3"
20
20
  author: AEON-Project
21
21
  openclaw:
22
22
  requires:
@@ -160,9 +160,15 @@ Trigger: `wallet-init` envelope reports `needsTopup: true` (any of `no_prior_fun
160
160
 
161
161
  ### Amount selection
162
162
 
163
+ This is a **session-wallet top-up** in USDT (NOT card face value). Make the wording unambiguously about the wallet to avoid the user confusing it with the card face value asked in Step 3a.
164
+
163
165
  - Presets: **5 / 10 / 20 / 50 USDT**. Custom amounts must be ≥ 5 USDT.
164
- - Ask the user **before** running the command:
165
- > How much USDT would you like to load? (presets: 5 / 10 / 20 / 50, or any custom amount ≥ 5)
166
+ - Ask the user **before** running the command. **Make "wallet" / "钱包" explicit in the question:**
167
+
168
+ > How much USDT would you like to load **into your session wallet**? (presets: 5 / 10 / 20 / 50, or any custom amount ≥ 5)
169
+
170
+ (Suggested Chinese phrasing: "请问要往**本地钱包**充值多少 USDT?预设 5 / 10 / 20 / 50,或自定义 ≥ 5。")
171
+
166
172
  - Once the user picks an amount, run:
167
173
 
168
174
  ```bash
@@ -205,9 +211,12 @@ Trigger: user wants to **buy / create / get a virtual card** *and* Step 1 envelo
205
211
 
206
212
  ### Amount confirmation
207
213
 
208
- Amount must be in `amountLimits.min ~ amountLimits.max` (from Step 1; never hardcode). If user did not specify, ask once:
214
+ This is the **card face value** the user wants to issue (NOT a wallet top-up). Amount must be in `amountLimits.min ~ amountLimits.max` (from Step 1; never hardcode). If user did not specify, ask once — **use the word "card face value" / "面额", never "充值" / "top up"** to avoid confusing it with the `wallet-topup` step:
215
+
216
+ > What card face value would you like to issue? Allowed range: ${min}~${max} USD.
209
217
 
210
- > You can create a card of up to ${min}~${max}. How much would you like to load onto the card?
218
+ (Suggested Chinese phrasing: "请问要开多少美元的卡?允许范围 $${min} ~ $${max}。"
219
+ **Do not** translate this as "充值多少美元" — that wording belongs to `wallet-topup` and confuses users.)
211
220
 
212
221
  Once specified, **execute immediately**.
213
222
 
@@ -405,3 +414,14 @@ The following first-line / key-phrase strings must be **exactly reproduced** —
405
414
  | Wallet prepared header | `✅ Wallet prepared` |
406
415
 
407
416
  Address rendering: always `0x0...{last4}` (first 3 + ellipsis + last 4 chars).
417
+
418
+ ### Wording Discipline: "wallet top-up" vs "card face value"
419
+
420
+ These two amounts are **different concepts** asked at **different steps**. Translators must keep them lexically distinct so users don't conflate them:
421
+
422
+ | Step | Concept | Required wording (English) | Suggested Chinese | Forbidden mix-ups |
423
+ | --- | --- | --- | --- | --- |
424
+ | Step 2 (`wallet-topup`) | USDT into the **session wallet** | "load USDT **into your session wallet**" | "往**本地钱包**充值 USDT" | Don't say "充值到卡里" / "load onto the card" — that's Step 3a |
425
+ | Step 3a (`create-card`) | USD **face value** loaded onto a new card | "card **face value**" / "issue a card with how much" | "**开多少美元的卡** / 卡的面额" | Don't say "充值多少" / "充值到卡" without strong "card" qualifier — confuses with Step 2 |
426
+
427
+ **Rule of thumb**: if the agent's question contains the word "充值" (top up), the noun *must* be "钱包" (wallet); if the question is about a card's amount, prefer "**面额**" or "**开多少美元的卡**", never "充值".
@@ -68,16 +68,24 @@ export async function initWallet(opts) {
68
68
  }
69
69
  }
70
70
 
71
- // 决策:是否需要 topup
71
+ // 决策:是否需要 topup —— 只看链上真实状态,不依赖 config.mainWallet 字段。
72
+ // 之前用 !config.mainWallet 当判断条件是错的:mainWallet 只是 withdraw 默认目标地址,
73
+ // 即使为 null(如用户外部转账 / 旧版本未记录),只要链上 USDT/allowance 充足就应该
74
+ // 直接允许付费调用,不要强制再走一次 wallet-topup。
72
75
  let needsTopup = false;
73
76
  let topupReason = null;
74
- if (created || !config.mainWallet) {
77
+ if (created) {
78
+ // 刚生成的 session key 必然没钱,无需查链
79
+ needsTopup = true;
80
+ topupReason = "first_time";
81
+ } else if (!chainCheckOk) {
82
+ // 链上查询失败 —— 保守标记需要 topup 由用户决定下一步
75
83
  needsTopup = true;
76
- topupReason = "no_prior_funding";
77
- } else if (chainCheckOk && usdtNum < LOW_BALANCE_THRESHOLD) {
84
+ topupReason = "chain_check_failed";
85
+ } else if (usdtNum < LOW_BALANCE_THRESHOLD) {
78
86
  needsTopup = true;
79
87
  topupReason = "low_balance";
80
- } else if (chainCheckOk && allowance === 0n) {
88
+ } else if (allowance === 0n) {
81
89
  needsTopup = true;
82
90
  topupReason = "no_approve";
83
91
  }