@agenzo/merchant-cli 0.2.2 → 0.3.0
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/README.md +144 -176
- package/dist/index.js +940 -820
- package/dist/index.js.map +1 -1
- package/package.json +5 -40
- package/SKILL.md +0 -195
package/SKILL.md
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# @agenzo/merchant-cli — AI Agent Skill
|
|
2
|
-
|
|
3
|
-
CLI for ordering rides and querying merchant services. This skill tells an AI
|
|
4
|
-
Agent how to discover capabilities and drive the full ride lifecycle.
|
|
5
|
-
|
|
6
|
-
## Setup
|
|
7
|
-
|
|
8
|
-
- Binary: `agenzo-merchant-cli`
|
|
9
|
-
- Auth: every runtime command needs `--api-key <key>` (sent as `X-API-Key`).
|
|
10
|
-
- Output: JSON by default (machine-readable). Add `--format table` only for
|
|
11
|
-
human display.
|
|
12
|
-
- Streams: parse **stdout** for results. Progress spinners and status lines go
|
|
13
|
-
to **stderr** and never contaminate stdout — read only stdout as data. (The
|
|
14
|
-
spinner is auto-suppressed when stderr is not a TTY, e.g. agent-invoked.)
|
|
15
|
-
- Automation: pass `--yes` to skip interactive prompts. In `--yes` mode every
|
|
16
|
-
required value must be supplied via flags.
|
|
17
|
-
- Host: defaults to `https://agent.everonet.com`. Change with
|
|
18
|
-
`config set-host <url>`; reset with `config reset-host`.
|
|
19
|
-
- **Amounts are decimals in the currency's standard unit** (e.g. `12.50` USD),
|
|
20
|
-
never minor units / cents.
|
|
21
|
-
|
|
22
|
-
## Capability discovery
|
|
23
|
-
|
|
24
|
-
Before quoting, discover which services exist and are enabled:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
agenzo-merchant-cli services list --api-key sk_xxx
|
|
28
|
-
agenzo-merchant-cli services get <service-id> --api-key sk_xxx
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
- `services list` → `{ services: Service[] }`. Each `Service` has
|
|
32
|
-
`service_id`, `name`, `provider`, `cli_noun`, `version`, `verbs`.
|
|
33
|
-
- `services get <service-id>` → a single service capability (adds
|
|
34
|
-
`description`, `verb_descriptions`, `workflow`, `since`, `discovery`). A
|
|
35
|
-
missing/unknown id raises `SERVICE_NOT_FOUND`.
|
|
36
|
-
- Use a discovered `service_id` as the optional `--service-id` on `ride-elife quote`.
|
|
37
|
-
|
|
38
|
-
> Note: `services` is a CLI-bundled catalog, not a live per-key feed. Whether a
|
|
39
|
-
> developer pays per call or by monthly settlement is decided by the backend and
|
|
40
|
-
> surfaced in the `ride-elife book` response (`payment_status`) / error codes —
|
|
41
|
-
> it is not advertised by `services`.
|
|
42
|
-
|
|
43
|
-
## Ride workflow (closed loop)
|
|
44
|
-
|
|
45
|
-
The ride lifecycle is `quote → book → get (poll) → [cancel]`.
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
quote ──► book ──► get (poll until terminal) ──► [cancel if still active]
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 1. quote
|
|
52
|
-
|
|
53
|
-
Request fare quotes for a trip between two points.
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
agenzo-merchant-cli ride-elife quote --api-key sk_xxx \
|
|
57
|
-
--pickup-lat <num> --pickup-lng <num> --pickup-name <str> \
|
|
58
|
-
--dropoff-lat <num> --dropoff-lng <num> --dropoff-name <str> \
|
|
59
|
-
--pickup-time <epoch|"now"> \
|
|
60
|
-
[--passenger-name <name>] [--passenger-phone <phone>] \
|
|
61
|
-
[--passenger-count <n>] [--luggage-count <n>] [--children-count <n>]
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
- `--passenger-name` / `--passenger-phone` are **optional** for quoting (elife
|
|
65
|
-
does not require them). They are required at booking.
|
|
66
|
-
- `--pickup-time now` → realtime ride quotes. `--pickup-time <epoch>` →
|
|
67
|
-
scheduled/airport ride quotes (must be 16+ hours in the future for sandbox).
|
|
68
|
-
|
|
69
|
-
Returns `{ vehicle_classes: VehicleClass[] }`. Each class carries
|
|
70
|
-
`vehicle_class`, `passenger_capacity`, `luggage_capacity`, and a `price` with
|
|
71
|
-
`amount`, `currency`, and a `quote_id`. **Carry `quote_id` and the chosen
|
|
72
|
-
`vehicle_class` into `book`.** Quotes expire (~4 min) — book promptly.
|
|
73
|
-
|
|
74
|
-
### 2. book (write — idempotency key required)
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
agenzo-merchant-cli --yes ride-elife book --api-key sk_xxx \
|
|
78
|
-
--quote-id <id> --vehicle-class <class> \
|
|
79
|
-
--price-amount <amount> --price-currency <USD> \
|
|
80
|
-
--passenger-name <name> --passenger-phone <phone> \
|
|
81
|
-
[--passenger-email <email>] \
|
|
82
|
-
--pickup-lat <num> --pickup-lng <num> --pickup-name <str> \
|
|
83
|
-
--dropoff-lat <num> --dropoff-lng <num> --dropoff-name <str> \
|
|
84
|
-
--pickup-time <epoch|"now"> \
|
|
85
|
-
[--meet-and-greet] [--welcome-sign <text>] \
|
|
86
|
-
[--child-seat-count <n>] [--infant-seat-count <n>] [--toddler-seat-count <n>] \
|
|
87
|
-
[--arrival-flight-no <no>] [--departure-flight-no <no>] \
|
|
88
|
-
--idempotency-key <key>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Important notes:**
|
|
92
|
-
- `--price-amount` and `--vehicle-class` **must match** the quote response.
|
|
93
|
-
Mismatches are rejected (error 1811 PRICE_MISMATCH / 1812 VEHICLE_CLASS_MISMATCH).
|
|
94
|
-
- `--passenger-email` is **required for scheduled/airport rides** (elife
|
|
95
|
-
requires it). Optional for realtime rides.
|
|
96
|
-
- `--child-seat-count`, `--infant-seat-count`, `--toddler-seat-count` (0-5 each)
|
|
97
|
-
correspond to elife's `add_service` children/infant/toddler seats.
|
|
98
|
-
|
|
99
|
-
Returns an order with `ride_id`, `order_id`, initial `status`, plus
|
|
100
|
-
`is_scheduled` (true = scheduled/airport, false = realtime) and `order_type`
|
|
101
|
-
(`realtime` / `airport`, derived from `pickup-time`). Reuse the **same**
|
|
102
|
-
`--idempotency-key` if you retry the same booking, so a network retry never
|
|
103
|
-
creates a duplicate order.
|
|
104
|
-
|
|
105
|
-
> Realtime rides (`pickup-time=now`) are charged the quoted price at booking,
|
|
106
|
-
> then reconciled to the actual fare after the trip ends (backend adjusts the
|
|
107
|
-
> settlement balance). Scheduled/airport rides have a fixed price and are not
|
|
108
|
-
> reconciled.
|
|
109
|
-
|
|
110
|
-
### 3. get (poll)
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
agenzo-merchant-cli ride-elife get --order-id <ride_id> --api-key sk_xxx
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Returns the ride status. Poll periodically until a terminal status.
|
|
117
|
-
|
|
118
|
-
- Active (keep polling): `INIT`, `Pending`, `Accepted`, `On my way`, `Waiting`, `On board`
|
|
119
|
-
- Terminal (stop): `At destination`, `Rejected`, `Cancelled`,
|
|
120
|
-
`Customer no show`, `Driver no show`
|
|
121
|
-
|
|
122
|
-
Status strings are case-sensitive — match the server casing exactly.
|
|
123
|
-
|
|
124
|
-
Response fields include `from_location`, `to_location`, `pickup_time`,
|
|
125
|
-
`vehicle_class`, `price`, `driver` (after assignment), `vehicle` (after
|
|
126
|
-
assignment).
|
|
127
|
-
|
|
128
|
-
**Auto-poll with `--watch`** (preferred for agents): instead of looping `get`
|
|
129
|
-
yourself, pass `--watch` to poll until a terminal status. Each update is emitted
|
|
130
|
-
as one **NDJSON line** on stdout (one JSON object per line — read it with a line
|
|
131
|
-
reader, not a single `JSON.parse`). Polling stops at a terminal status or the
|
|
132
|
-
timeout.
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
agenzo-merchant-cli ride-elife get --order-id <ride_id> --api-key sk_xxx \
|
|
136
|
-
--watch [--watch-interval <seconds>] [--watch-timeout <seconds>]
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
- `--watch-interval` defaults to 5 seconds, `--watch-timeout` to 600 seconds.
|
|
140
|
-
- On timeout the final NDJSON line is `{ "watch_status": "timeout", ... }`
|
|
141
|
-
instead of an order status.
|
|
142
|
-
|
|
143
|
-
### 4. cancel (optional, write — idempotency key required)
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
agenzo-merchant-cli --yes ride-elife cancel --order-id <ride_id> --api-key sk_xxx \
|
|
147
|
-
--idempotency-key <key>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Only while the order is still active. Returns
|
|
151
|
-
`{ ride_id, ride_stat, cancellation: { cancellation_fee, reversal_amount, currency }, refund_amount }`
|
|
152
|
-
— `refund_amount` is what was credited back to the settlement balance
|
|
153
|
-
(paid − cancellation_fee); a cancellation may incur a fee.
|
|
154
|
-
|
|
155
|
-
### Listing
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
agenzo-merchant-cli ride-elife list-orders --api-key sk_xxx \
|
|
159
|
-
[--status <status>] [--page <n>] [--page-size <n>]
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
Returns `{ orders, total, page, page_size }` (default `page` 1, `page-size` 20).
|
|
163
|
-
Each order includes `is_scheduled`, `scheduled_at`, `price_amount`,
|
|
164
|
-
`final_amount` (settled fare; equals `price_amount` until final-fare settlement
|
|
165
|
-
runs), `final_settlement_status` (`pending` / `settled` / `no_adjustment` /
|
|
166
|
-
`settlement_pending` / `not_applicable`), and `cancellation_fee`.
|
|
167
|
-
|
|
168
|
-
## Idempotency rule
|
|
169
|
-
|
|
170
|
-
All write operations (`ride-elife book`, `ride-elife cancel`) require a caller-supplied
|
|
171
|
-
`--idempotency-key`. The CLI never auto-generates one.
|
|
172
|
-
|
|
173
|
-
- Key format: 1–128 chars from `[A-Za-z0-9_-]`, sent as the `Idempotency-Key`
|
|
174
|
-
header (not in the body).
|
|
175
|
-
- With `--yes` and no key → hard error `PARAM_IDEMPOTENCY_KEY_REQUIRED`.
|
|
176
|
-
- Without `--yes` → the CLI prompts for the key.
|
|
177
|
-
|
|
178
|
-
## Error codes & recovery
|
|
179
|
-
|
|
180
|
-
Errors are emitted with a SCREAMING_SNAKE_CASE `code`. Common ones:
|
|
181
|
-
|
|
182
|
-
| Code | Meaning | Recovery |
|
|
183
|
-
|------|---------|----------|
|
|
184
|
-
| `QUOTE_EXPIRED` (1802) | The `quote_id` is no longer valid | Re-run `ride-elife quote` and book with the fresh `quote_id`. |
|
|
185
|
-
| `VEHICLE_UNAVAILABLE` (1801) | The chosen `vehicle_class` is unavailable | Re-quote and pick another `vehicle_class` from `vehicle_classes`. |
|
|
186
|
-
| `BOOKING_FAILED` (1803) | Booking could not be completed (details in message) | Re-quote, then retry `book` with a fresh quote and the same idempotency key. |
|
|
187
|
-
| `PRICE_MISMATCH` (1811) | `price_amount` doesn't match the quoted price | Use the exact `price.amount` from the quote response. |
|
|
188
|
-
| `VEHICLE_CLASS_MISMATCH` (1812) | `vehicle_class` doesn't match the quote | Use the exact `vehicle_class` from the quote response. |
|
|
189
|
-
| `CANCELLATION_NOT_ALLOWED` (1804) | Order can't be cancelled (terminal/too late) | Re-check status via `ride-elife get`; no action if already terminal. |
|
|
190
|
-
| `ACCOUNT_INSUFFICIENT_BALANCE` (1809) | Settlement balance too low | Top up the settlement account and retry. |
|
|
191
|
-
| `SERVICE_NOT_FOUND` | Unknown `service_id` | Re-run `services list` and use a valid, enabled `service_id`. |
|
|
192
|
-
| `PARAM_IDEMPOTENCY_KEY_REQUIRED` | Missing/invalid idempotency key on a write op | Pass a valid `--idempotency-key` (1–128 chars, `[A-Za-z0-9_-]`). |
|
|
193
|
-
|
|
194
|
-
Other codes you may see: `NETWORK_ERROR` / `TIMEOUT` (retry, check host),
|
|
195
|
-
`CLI_OUTDATED` (upgrade the CLI), `CONFIG_ERROR` (fix/reset local config).
|