@agenzo/merchant-cli 0.2.0 → 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/SKILL.md DELETED
@@ -1,165 +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
- [--service-id <id>]
60
- ```
61
-
62
- Returns `{ vehicle_classes: VehicleClass[] }`. Each class carries
63
- `vehicle_class`, `passenger_capacity`, `luggage_capacity`, and a `price` with
64
- `amount`, `currency`, and a `quote_id`. **Carry `quote_id` and the chosen
65
- `vehicle_class` into `book`.** Quotes expire — book promptly.
66
-
67
- ### 2. book (write — idempotency key required)
68
-
69
- ```bash
70
- agenzo-merchant-cli --yes ride-elife book --api-key sk_xxx \
71
- --quote-id <id> --vehicle-class <class> --passenger-name <name> \
72
- [--passenger-phone <phone>] [--passenger-email <email>] \
73
- --idempotency-key <key>
74
- ```
75
-
76
- Returns an order with `ride_id`, `order_id`, initial `status`, plus
77
- `is_scheduled` (true = scheduled/airport, false = realtime) and `order_type`
78
- (`realtime` / `airport`, derived from `pickup-time`). Reuse the **same**
79
- `--idempotency-key` if you retry the same booking, so a network retry never
80
- creates a duplicate order.
81
-
82
- > Realtime rides (`pickup-time=now`) are charged the quoted price at booking,
83
- > then reconciled to the actual fare after the trip ends (backend adjusts the
84
- > settlement balance). Scheduled/airport rides have a fixed price and are not
85
- > reconciled.
86
-
87
- ### 3. get (poll)
88
-
89
- ```bash
90
- agenzo-merchant-cli ride-elife get --order-id <id> --api-key sk_xxx
91
- ```
92
-
93
- Returns the ride status. Poll periodically until a terminal status.
94
-
95
- - Active (keep polling): `Pending`, `Accepted`, `On my way`, `Waiting`, `On board`
96
- - Terminal (stop): `At destination`, `Rejected`, `Cancelled`,
97
- `Customer no show`, `Driver no show`
98
-
99
- Status strings are case-sensitive — match the server casing exactly.
100
-
101
- **Auto-poll with `--watch`** (preferred for agents): instead of looping `get`
102
- yourself, pass `--watch` to poll until a terminal status. Each update is emitted
103
- as one **NDJSON line** on stdout (one JSON object per line — read it with a line
104
- reader, not a single `JSON.parse`). Polling stops at a terminal status or the
105
- timeout.
106
-
107
- ```bash
108
- agenzo-merchant-cli ride-elife get --order-id <id> --api-key sk_xxx \
109
- --watch [--watch-interval <seconds>] [--watch-timeout <seconds>]
110
- ```
111
-
112
- - `--watch-interval` defaults to 5 seconds, `--watch-timeout` to 600 seconds.
113
- - On timeout the final NDJSON line is `{ "watch_status": "timeout", ... }`
114
- instead of an order status.
115
-
116
- ### 4. cancel (optional, write — idempotency key required)
117
-
118
- ```bash
119
- agenzo-merchant-cli --yes ride-elife cancel <order-id> --api-key sk_xxx \
120
- --idempotency-key <key>
121
- ```
122
-
123
- Only while the order is still active. Returns
124
- `{ ride_id, ride_stat, cancellation: { cancellation_fee, reversal_amount, currency }, refund_amount }`
125
- — `refund_amount` is what was credited back to the settlement balance
126
- (paid − cancellation_fee); a cancellation may incur a fee.
127
-
128
- ### Listing
129
-
130
- ```bash
131
- agenzo-merchant-cli ride-elife list-orders --api-key sk_xxx \
132
- [--status <status>] [--page <n>] [--page-size <n>]
133
- ```
134
-
135
- Returns `{ orders, total, page, page_size }` (default `page` 1, `page-size` 20).
136
- Each order includes `is_scheduled`, `scheduled_at`, `price_amount`,
137
- `final_amount` (settled fare; equals `price_amount` until final-fare settlement
138
- runs), `final_settlement_status` (`pending` / `settled` / `no_adjustment` /
139
- `settlement_pending` / `not_applicable`), and `cancellation_fee`.
140
-
141
- ## Idempotency rule
142
-
143
- All write operations (`ride-elife book`, `ride-elife cancel`) require a caller-supplied
144
- `--idempotency-key`. The CLI never auto-generates one.
145
-
146
- - Key format: 1–128 chars from `[A-Za-z0-9_-]`, sent as the `Idempotency-Key`
147
- header (not in the body).
148
- - With `--yes` and no key → hard error `PARAM_IDEMPOTENCY_KEY_REQUIRED`.
149
- - Without `--yes` → the CLI prompts for the key.
150
-
151
- ## Error codes & recovery
152
-
153
- Errors are emitted with a SCREAMING_SNAKE_CASE `code`. Common ones:
154
-
155
- | Code | Meaning | Recovery |
156
- |------|---------|----------|
157
- | `QUOTE_EXPIRED` | The `quote_id` is no longer valid | Re-run `ride-elife quote` and book with the fresh `quote_id`. |
158
- | `VEHICLE_UNAVAILABLE` | The chosen `vehicle_class` is unavailable | Re-quote and pick another `vehicle_class` from `vehicle_classes`. |
159
- | `BOOKING_FAILED` | Booking could not be completed | Re-quote, then retry `book` with a fresh quote and the same idempotency key. |
160
- | `CANCELLATION_NOT_ALLOWED` | Order can't be cancelled (terminal/too late) | Re-check status via `ride-elife get`; no action if already terminal. |
161
- | `SERVICE_NOT_FOUND` | Unknown `service_id` | Re-run `services list` and use a valid, enabled `service_id`. |
162
- | `PARAM_IDEMPOTENCY_KEY_REQUIRED` | Missing/invalid idempotency key on a write op | Pass a valid `--idempotency-key` (1–128 chars, `[A-Za-z0-9_-]`). |
163
-
164
- Other codes you may see: `NETWORK_ERROR` / `TIMEOUT` (retry, check host),
165
- `CLI_OUTDATED` (upgrade the CLI), `CONFIG_ERROR` (fix/reset local config).