@aeon-ai-pay/aigateway 0.1.5 → 0.2.1
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 +22 -0
- package/bin/cli.mjs +20 -32
- package/docs/exit-codes.md +2 -1
- package/docs/release-process.md +9 -7
- package/package.json +1 -1
- package/skills/aigateway/SKILL.md +369 -267
- package/src/catalog.mjs +38 -0
- package/src/commands/sb-invoke.mjs +407 -0
- package/src/commands/sb-tools.mjs +37 -0
- package/src/commands/wallet-init.mjs +1 -3
- package/src/config.mjs +21 -22
- package/src/error-codes.mjs +11 -3
- package/src/funding.mjs +2 -2
- package/src/inputs-validator.mjs +125 -0
- package/src/output.mjs +1 -1
- package/src/tools-download.mjs +264 -0
- package/src/update-check.mjs +50 -47
- package/src/x402.mjs +1 -1
- package/skills/aigateway/references/check-status.md +0 -68
- package/skills/aigateway/references/create-card.md +0 -114
- package/skills/aigateway/references/store.md +0 -87
- package/src/commands/create-card-status.mjs +0 -67
- package/src/commands/create-card.mjs +0 -352
- package/src/commands/create-image.mjs +0 -428
- package/src/sanitize.mjs +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.6] — 2026-05-19
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- **`update-check.mjs` is now synchronous / foreground.** A newer published
|
|
14
|
+
version triggers `npm install -g` + `scripts/postinstall.mjs` *inline*,
|
|
15
|
+
with `npm`'s own progress streamed to stderr. After the upgrade the CLI
|
|
16
|
+
emits an envelope with `error.code === "UPDATE_APPLIED"` (and `error.from`
|
|
17
|
+
/ `error.to`) and exits with code 2 **without running the original
|
|
18
|
+
command**. The caller / agent reruns the command on the new CLI + new
|
|
19
|
+
SKILL.md.
|
|
20
|
+
- Replaces the previous detached-background upgrade, which could leave the
|
|
21
|
+
global package half-replaced (`bin/cli.mjs` already updated while
|
|
22
|
+
`src/commands/*` still old → `ERR_MODULE_NOT_FOUND` on the very next
|
|
23
|
+
invocation) and could fail silently (e.g. `ENOTEMPTY` on Windows / nvm).
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- New error code `UPDATE_APPLIED` (exit 2) emitted by `update-check.mjs`
|
|
27
|
+
after a successful synchronous upgrade.
|
|
28
|
+
- SKILL.md Hard Rules: new clause telling the agent how to react when it
|
|
29
|
+
sees `error.code === "UPDATE_APPLIED"` (briefly inform the user of the
|
|
30
|
+
version transition, then rerun the same command).
|
|
31
|
+
|
|
10
32
|
## [0.1.5] — 2026-05-19
|
|
11
33
|
|
|
12
34
|
### Changed
|
package/bin/cli.mjs
CHANGED
|
@@ -104,45 +104,33 @@ program
|
|
|
104
104
|
return withdraw(opts);
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.
|
|
111
|
-
.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.
|
|
115
|
-
.
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
return createCard(opts);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
program
|
|
122
|
-
.command("create-image")
|
|
123
|
-
.description("Generate an AI image via Skill Boss, paying with USDT on BSC via x402")
|
|
124
|
-
.requiredOption("--prompt <text>", "Image prompt text")
|
|
107
|
+
// ─── x402 unified paid-call entry ──────────────────────────────────────────
|
|
108
|
+
// The only paid-call surface: `sb invoke --model <id> --inputs <json|@file>`.
|
|
109
|
+
const sb = program
|
|
110
|
+
.command("sb")
|
|
111
|
+
.description("AI tools — invoke any of ~200+ endpoints via x402 (USDT on BSC)");
|
|
112
|
+
|
|
113
|
+
sb
|
|
114
|
+
.command("invoke")
|
|
115
|
+
.description("Invoke any AI tool model (run `aigateway sb tools` first to populate the local catalog)")
|
|
116
|
+
.requiredOption("--model <id>", "Model id, e.g. replicate/black-forest-labs/flux-schnell")
|
|
117
|
+
.requiredOption("--inputs <json>", "Inputs as JSON literal or @path/to/file.json")
|
|
125
118
|
.option("--app-id <id>", "Merchant app ID", DEFAULT_APP_ID)
|
|
126
|
-
.option("--
|
|
127
|
-
.option("--
|
|
128
|
-
.option("--model <id>", "Model identifier")
|
|
129
|
-
.option("--output <dir>", "Output directory (default ~/aigateway-images)")
|
|
119
|
+
.option("--output <dir>", "Output directory for binary downloads (image/video/audio)")
|
|
120
|
+
.option("--raw", "Skip auto-download and emit the upstream response as-is", false)
|
|
130
121
|
.option("--topup-amount <usdt>", "USDT top-up amount when balance is insufficient (≥5)")
|
|
131
122
|
.option("--private-key <key>", "Override EVM private key")
|
|
132
123
|
.action(async (opts) => {
|
|
133
|
-
const {
|
|
134
|
-
return
|
|
124
|
+
const { sbInvokeCommand } = await import("../src/commands/sb-invoke.mjs");
|
|
125
|
+
return sbInvokeCommand(opts);
|
|
135
126
|
});
|
|
136
127
|
|
|
137
|
-
|
|
138
|
-
.command("
|
|
139
|
-
.description("
|
|
140
|
-
.requiredOption("--order-no <orderNo>", "Order number returned by create-card")
|
|
141
|
-
.option("--app-id <id>", "Merchant app ID", DEFAULT_APP_ID)
|
|
142
|
-
.option("--poll", "Poll until terminal status", false)
|
|
128
|
+
sb
|
|
129
|
+
.command("tools")
|
|
130
|
+
.description("Fetch and display the AI tool catalog from the server (no caching, always live)")
|
|
143
131
|
.action(async (opts) => {
|
|
144
|
-
const {
|
|
145
|
-
return
|
|
132
|
+
const { sbTools } = await import("../src/commands/sb-tools.mjs");
|
|
133
|
+
return sbTools(opts);
|
|
146
134
|
});
|
|
147
135
|
|
|
148
136
|
program
|
package/docs/exit-codes.md
CHANGED
|
@@ -38,8 +38,9 @@ The full set of `error.code` values, grouped by exit code, is defined in [`src/e
|
|
|
38
38
|
| ---- | ---- |
|
|
39
39
|
| `PAYMENT_TIMEOUT` | WalletConnect / signature request timed out (5 minutes). |
|
|
40
40
|
| `WC_SESSION_EXPIRED` | WalletConnect session dropped mid-flow. |
|
|
41
|
-
| `POLL_TIMEOUT` | `status --poll` exhausted attempts. Card may still be provisioning. |
|
|
41
|
+
| `POLL_TIMEOUT` | `create-card-status --poll` exhausted attempts. Card may still be provisioning. |
|
|
42
42
|
| `TX_TIMEOUT` | On-chain receipt wait exceeded 60 s. |
|
|
43
|
+
| `UPDATE_APPLIED` | The CLI just upgraded itself synchronously to a newer version. The previous command was not executed — the caller (or the agent) must rerun it on the new version. Envelope carries `error.from` / `error.to` showing the version transition. |
|
|
43
44
|
|
|
44
45
|
### Exit 3 — Service / Network
|
|
45
46
|
|
package/docs/release-process.md
CHANGED
|
@@ -59,15 +59,17 @@ We follow [SemVer](https://semver.org/):
|
|
|
59
59
|
|
|
60
60
|
## What happens for users after publish
|
|
61
61
|
|
|
62
|
-
`src/update-check.mjs` runs
|
|
62
|
+
`src/update-check.mjs` runs at the start of every CLI invocation. On the **next** `aigateway <cmd>` call by any user with a stale version, they will:
|
|
63
63
|
|
|
64
|
-
1. See `[update] @aeon-ai-pay/aigateway 0.1.0 → 0.1.1, upgrading
|
|
65
|
-
2.
|
|
66
|
-
3.
|
|
67
|
-
4. The
|
|
68
|
-
5.
|
|
64
|
+
1. See `[update] @aeon-ai-pay/aigateway 0.1.0 → 0.1.1, upgrading (foreground)...` on stderr.
|
|
65
|
+
2. **`npm install -g @aeon-ai-pay/aigateway@<latest>` runs synchronously**, with `npm`'s own progress streamed to stderr.
|
|
66
|
+
3. **`scripts/postinstall.mjs` runs synchronously**, calling `npx skills add ... -g -y --copy` to refresh every detected IDE skill folder (Cursor / Claude Code / Codex / Windsurf / Cline / …).
|
|
67
|
+
4. The CLI emits an envelope with `error.code === "UPDATE_APPLIED"` and **exits with code 2** without executing the original command.
|
|
68
|
+
5. The caller (or the agent — `error.code` is stable, agents should match on it) **reruns the original command**, which now executes on the new CLI + new SKILL.md.
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Why foreground instead of detached background: a backgrounded `npm install -g` mid-command can leave the global package in a half-replaced state (`bin/cli.mjs` already updated while `src/commands/*` still old, or vice versa), causing `ERR_MODULE_NOT_FOUND` on the very next invocation. Synchronous upgrade keeps the package consistent.
|
|
71
|
+
|
|
72
|
+
If the upgrade itself fails (network, permissions, `ENOTEMPTY` on Windows / nvm), the failure is logged to stderr and the command continues on the current version — the user is never silently left on a half-installed package.
|
|
71
73
|
|
|
72
74
|
## Rolling back
|
|
73
75
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeon-ai-pay/aigateway",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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": {
|