@agenzo/merchant-cli 0.1.1 → 0.2.2

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 CHANGED
@@ -42,20 +42,28 @@ agenzo-merchant-cli config set-host https://agent.everonet.com
42
42
  agenzo-merchant-cli services list --api-key sk_xxx
43
43
 
44
44
  # 3. Get fare quotes for a trip
45
- agenzo-merchant-cli ride quote --api-key sk_xxx \
46
- --pickup-lat 1.3 --pickup-lng 103.8 --pickup-name "Changi" \
47
- --dropoff-lat 1.29 --dropoff-lng 103.85 --dropoff-name "Marina Bay"
45
+ agenzo-merchant-cli ride-elife quote --api-key sk_xxx \
46
+ --pickup-lat 1.3644 --pickup-lng 103.9915 --pickup-name "Changi Airport" \
47
+ --dropoff-lat 1.2834 --dropoff-lng 103.8607 --dropoff-name "Marina Bay" \
48
+ --pickup-time now
48
49
 
49
50
  # 4. Book against a returned quote (write op → idempotency key required)
50
- agenzo-merchant-cli --yes ride book --api-key sk_xxx \
51
- --quote-id qt_123 --vehicle-class standard \
52
- --passenger-name "Ada" --idempotency-key idem_001
51
+ agenzo-merchant-cli --yes ride-elife book --api-key sk_xxx \
52
+ --quote-id <quote_id> --vehicle-class <vehicle_class> \
53
+ --price-amount <amount> --price-currency USD \
54
+ --passenger-name "Ada" --passenger-phone "+6591234567" \
55
+ --pickup-lat 1.3644 --pickup-lng 103.9915 --pickup-name "Changi Airport" \
56
+ --dropoff-lat 1.2834 --dropoff-lng 103.8607 --dropoff-name "Marina Bay" \
57
+ --pickup-time now --idempotency-key idem_001
53
58
 
54
- # 5. Poll the order until a terminal status
55
- agenzo-merchant-cli ride get ord_123 --api-key sk_xxx
59
+ # 5. Poll the order until a terminal status (NDJSON stream)
60
+ agenzo-merchant-cli ride-elife get --order-id <ride_id> --api-key sk_xxx --watch
56
61
 
57
62
  # 6. Cancel if needed (write op → idempotency key required)
58
- agenzo-merchant-cli --yes ride cancel ord_123 --api-key sk_xxx --idempotency-key idem_002
63
+ agenzo-merchant-cli --yes ride-elife cancel --order-id <ride_id> --api-key sk_xxx --idempotency-key idem_002
64
+
65
+ # 7. List all orders
66
+ agenzo-merchant-cli ride-elife list-orders --api-key sk_xxx
59
67
  ```
60
68
 
61
69
  ## Commands
@@ -67,11 +75,11 @@ agenzo-merchant-cli --yes ride cancel ord_123 --api-key sk_xxx --idempotency-key
67
75
  | `config show` | Show the current configuration |
68
76
  | `services list` | List available merchant services |
69
77
  | `services get <service-id>` | Retrieve a single service by id |
70
- | `ride quote` | Request fare quotes between two points |
71
- | `ride book` | Book a ride against a returned quote |
72
- | `ride get <order-id>` | Retrieve a single ride order |
73
- | `ride cancel <order-id>` | Cancel a ride order (may incur a fee) |
74
- | `ride list-orders` | List ride orders (paginated, optional status filter) |
78
+ | `ride-elife quote` | Request fare quotes between two points |
79
+ | `ride-elife book` | Book a ride against a returned quote |
80
+ | `ride-elife get <order-id>` | Retrieve a single ride order (add `--watch` to poll until terminal, NDJSON stream) |
81
+ | `ride-elife cancel <order-id>` | Cancel a ride order (may incur a fee) |
82
+ | `ride-elife list-orders` | List ride orders (paginated, optional status filter) |
75
83
 
76
84
  ### Command Reference
77
85
 
@@ -85,16 +93,37 @@ agenzo-merchant-cli config show
85
93
  agenzo-merchant-cli services list --api-key sk_xxx
86
94
  agenzo-merchant-cli services get svc_001 --api-key sk_xxx
87
95
 
88
- # Ride flow
89
- agenzo-merchant-cli ride quote --api-key sk_xxx \
96
+ # Ride flow — quote
97
+ agenzo-merchant-cli ride-elife quote --api-key sk_xxx \
98
+ --pickup-lat <lat> --pickup-lng <lng> --pickup-name <name> \
99
+ --dropoff-lat <lat> --dropoff-lng <lng> --dropoff-name <name> \
100
+ --pickup-time <epoch|"now"> \
101
+ [--passenger-name <name>] [--passenger-phone <phone>] \
102
+ [--passenger-count <n>] [--luggage-count <n>] [--children-count <n>]
103
+
104
+ # Ride flow — book (price-amount/vehicle-class must match the quote response)
105
+ agenzo-merchant-cli ride-elife book --api-key sk_xxx \
106
+ --quote-id <id> --vehicle-class <class> \
107
+ --price-amount <amount> --price-currency <USD> \
108
+ --passenger-name <name> --passenger-phone <phone> \
109
+ [--passenger-email <email>] \
90
110
  --pickup-lat <lat> --pickup-lng <lng> --pickup-name <name> \
91
- --dropoff-lat <lat> --dropoff-lng <lng> --dropoff-name <name> [--service-id <id>]
92
- agenzo-merchant-cli ride book --api-key sk_xxx \
93
- --quote-id <id> --vehicle-class <class> --passenger-name <name> \
94
- [--passenger-phone <phone>] [--passenger-email <email>] --idempotency-key <key>
95
- agenzo-merchant-cli ride get <order-id> --api-key sk_xxx
96
- agenzo-merchant-cli ride cancel <order-id> --api-key sk_xxx --idempotency-key <key>
97
- agenzo-merchant-cli ride list-orders --api-key sk_xxx [--status <status>] [--page <n>] [--page-size <n>]
111
+ --dropoff-lat <lat> --dropoff-lng <lng> --dropoff-name <name> \
112
+ --pickup-time <epoch|"now"> \
113
+ [--meet-and-greet] [--welcome-sign <text>] \
114
+ [--child-seat-count <n>] [--infant-seat-count <n>] [--toddler-seat-count <n>] \
115
+ [--arrival-flight-no <no>] [--departure-flight-no <no>] \
116
+ --idempotency-key <key>
117
+
118
+ # Ride flow — get status
119
+ agenzo-merchant-cli ride-elife get --order-id <ride_id> --api-key sk_xxx
120
+ agenzo-merchant-cli ride-elife get --order-id <ride_id> --api-key sk_xxx --watch [--watch-interval <s>] [--watch-timeout <s>]
121
+
122
+ # Ride flow — cancel
123
+ agenzo-merchant-cli ride-elife cancel --order-id <ride_id> --api-key sk_xxx --idempotency-key <key>
124
+
125
+ # Ride flow — list orders
126
+ agenzo-merchant-cli ride-elife list-orders --api-key sk_xxx [--status <status>] [--page <n>] [--page-size <n>]
98
127
  ```
99
128
 
100
129
  ## Global Flags
@@ -103,7 +132,7 @@ agenzo-merchant-cli ride list-orders --api-key sk_xxx [--status <status>] [--pag
103
132
  |------|-------------|
104
133
  | `--format <json\|table>` | Output format. Defaults to `json`; pass `--format table` for a human-readable table. |
105
134
  | `--api-key <key>` | API key for runtime requests, sent as the `X-API-Key` header. |
106
- | `--idempotency-key <key>` | Caller-supplied idempotency key for write operations (`ride book`, `ride cancel`). |
135
+ | `--idempotency-key <key>` | Caller-supplied idempotency key for write operations (`ride-elife book`, `ride-elife cancel`). |
107
136
  | `--yes` | Skip confirmation/interactive prompts (for automation / AI Agents). |
108
137
 
109
138
  ### Output format
@@ -112,7 +141,7 @@ All commands emit JSON by default, which is ideal for scripting and AI Agents.
112
141
  Add `--format table` for a readable summary instead:
113
142
 
114
143
  ```bash
115
- agenzo-merchant-cli ride list-orders --api-key sk_xxx --format table
144
+ agenzo-merchant-cli ride-elife list-orders --api-key sk_xxx --format table
116
145
  ```
117
146
 
118
147
  ### Progress feedback
@@ -124,7 +153,7 @@ redirecting stdout still yields a clean payload:
124
153
 
125
154
  ```bash
126
155
  # stdout stays pure JSON; the spinner (on stderr) does not leak in
127
- agenzo-merchant-cli ride quote --api-key sk_xxx ... | jq '.vehicle_classes'
156
+ agenzo-merchant-cli ride-elife quote --api-key sk_xxx ... | jq '.vehicle_classes'
128
157
  ```
129
158
 
130
159
  The spinner animates only when stderr is an interactive terminal (TTY). When
@@ -134,7 +163,7 @@ suppressed so no control characters end up in logs. Local commands (`config`,
134
163
 
135
164
  ### Idempotency
136
165
 
137
- Write operations (`ride book`, `ride cancel`) require a caller-supplied
166
+ Write operations (`ride-elife book`, `ride-elife cancel`) require a caller-supplied
138
167
  `--idempotency-key`. The CLI **never** auto-generates one:
139
168
 
140
169
  - Without `--yes`, the CLI prompts for the key interactively.
@@ -145,7 +174,7 @@ The key must be 1–128 characters from `[A-Za-z0-9_-]` and is sent as the
145
174
 
146
175
  ## Authentication
147
176
 
148
- Runtime commands (`services`, `ride`) require `--api-key`. The value is sent on
177
+ Runtime commands (`services`, `ride-elife`) require `--api-key`. The value is sent on
149
178
  every request as the `X-API-Key` header. `config` commands are local-only and
150
179
  need no API key.
151
180
 
@@ -161,6 +190,26 @@ agenzo-merchant-cli config reset-host # back to https://a
161
190
  agenzo-merchant-cli config show
162
191
  ```
163
192
 
193
+ ## Error Codes (Ride)
194
+
195
+ | Code | HTTP | Meaning |
196
+ |------|------|---------|
197
+ | 1801 | 404 | `VEHICLE_UNAVAILABLE` — No vehicles available for this trip |
198
+ | 1802 | 410 | `QUOTE_EXPIRED` — Quote has expired, request a new one |
199
+ | 1803 | 502 | `BOOKING_FAILED` — elife rejected the booking (details in response) |
200
+ | 1804 | 409 | `CANCELLATION_NOT_ALLOWED` — Cannot cancel in current status |
201
+ | 1805 | 404 | `RIDE_NOT_FOUND` — Order not found (or belongs to another org) |
202
+ | 1809 | 402 | `ACCOUNT_INSUFFICIENT_BALANCE` — Not enough balance |
203
+ | 1811 | 400 | `PRICE_MISMATCH` — price_amount doesn't match the quoted price |
204
+ | 1812 | 400 | `VEHICLE_CLASS_MISMATCH` — vehicle_class doesn't match the quote |
205
+
206
+ When a booking fails (1803), the response `data.elife_details` contains the
207
+ upstream error for debugging (e.g. missing required fields).
208
+
209
+ **Note:** `--passenger-email` is **required for scheduled/airport rides** (elife
210
+ requires it for the airport partner). Omitting it for a scheduled ride results
211
+ in a 1803 error with message "passenger.email: This field is required".
212
+
164
213
  ## Amounts
165
214
 
166
215
  Monetary amounts are **decimals in the currency's standard unit** (e.g. `12.50`
package/SKILL.md CHANGED
@@ -29,10 +29,16 @@ agenzo-merchant-cli services get <service-id> --api-key sk_xxx
29
29
  ```
30
30
 
31
31
  - `services list` → `{ services: Service[] }`. Each `Service` has
32
- `service_id`, `name`, `enabled`.
33
- - `services get <service-id>` → a single `Service`. A missing/unknown id raises
34
- `SERVICE_NOT_FOUND`.
35
- - Use a discovered `service_id` as the optional `--service-id` on `ride quote`.
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`.
36
42
 
37
43
  ## Ride workflow (closed loop)
38
44
 
@@ -47,67 +53,121 @@ quote ──► book ──► get (poll until terminal) ──► [cancel if st
47
53
  Request fare quotes for a trip between two points.
48
54
 
49
55
  ```bash
50
- agenzo-merchant-cli ride quote --api-key sk_xxx \
56
+ agenzo-merchant-cli ride-elife quote --api-key sk_xxx \
51
57
  --pickup-lat <num> --pickup-lng <num> --pickup-name <str> \
52
58
  --dropoff-lat <num> --dropoff-lng <num> --dropoff-name <str> \
53
- [--service-id <id>]
59
+ --pickup-time <epoch|"now"> \
60
+ [--passenger-name <name>] [--passenger-phone <phone>] \
61
+ [--passenger-count <n>] [--luggage-count <n>] [--children-count <n>]
54
62
  ```
55
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
+
56
69
  Returns `{ vehicle_classes: VehicleClass[] }`. Each class carries
57
70
  `vehicle_class`, `passenger_capacity`, `luggage_capacity`, and a `price` with
58
71
  `amount`, `currency`, and a `quote_id`. **Carry `quote_id` and the chosen
59
- `vehicle_class` into `book`.** Quotes expire — book promptly.
72
+ `vehicle_class` into `book`.** Quotes expire (~4 min) — book promptly.
60
73
 
61
74
  ### 2. book (write — idempotency key required)
62
75
 
63
76
  ```bash
64
- agenzo-merchant-cli --yes ride book --api-key sk_xxx \
65
- --quote-id <id> --vehicle-class <class> --passenger-name <name> \
66
- [--passenger-phone <phone>] [--passenger-email <email>] \
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>] \
67
88
  --idempotency-key <key>
68
89
  ```
69
90
 
70
- Returns an `Order` with `order_id` and an initial `status`. Reuse the **same**
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**
71
102
  `--idempotency-key` if you retry the same booking, so a network retry never
72
103
  creates a duplicate order.
73
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
+
74
110
  ### 3. get (poll)
75
111
 
76
112
  ```bash
77
- agenzo-merchant-cli ride get <order-id> --api-key sk_xxx
113
+ agenzo-merchant-cli ride-elife get --order-id <ride_id> --api-key sk_xxx
78
114
  ```
79
115
 
80
- Returns an `Order` with `status`. Poll periodically until a terminal status.
116
+ Returns the ride status. Poll periodically until a terminal status.
81
117
 
82
- - Active (keep polling): `Pending`, `Accepted`, `On my way`, `Waiting`, `On board`
118
+ - Active (keep polling): `INIT`, `Pending`, `Accepted`, `On my way`, `Waiting`, `On board`
83
119
  - Terminal (stop): `At destination`, `Rejected`, `Cancelled`,
84
120
  `Customer no show`, `Driver no show`
85
121
 
86
122
  Status strings are case-sensitive — match the server casing exactly.
87
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
+
88
143
  ### 4. cancel (optional, write — idempotency key required)
89
144
 
90
145
  ```bash
91
- agenzo-merchant-cli --yes ride cancel <order-id> --api-key sk_xxx \
146
+ agenzo-merchant-cli --yes ride-elife cancel --order-id <ride_id> --api-key sk_xxx \
92
147
  --idempotency-key <key>
93
148
  ```
94
149
 
95
150
  Only while the order is still active. Returns
96
- `{ cancellation: { cancellation_fee, reversal_amount, currency } }` — a
97
- cancellation may incur a fee.
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.
98
154
 
99
155
  ### Listing
100
156
 
101
157
  ```bash
102
- agenzo-merchant-cli ride list-orders --api-key sk_xxx \
158
+ agenzo-merchant-cli ride-elife list-orders --api-key sk_xxx \
103
159
  [--status <status>] [--page <n>] [--page-size <n>]
104
160
  ```
105
161
 
106
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`.
107
167
 
108
168
  ## Idempotency rule
109
169
 
110
- All write operations (`ride book`, `ride cancel`) require a caller-supplied
170
+ All write operations (`ride-elife book`, `ride-elife cancel`) require a caller-supplied
111
171
  `--idempotency-key`. The CLI never auto-generates one.
112
172
 
113
173
  - Key format: 1–128 chars from `[A-Za-z0-9_-]`, sent as the `Idempotency-Key`
@@ -121,10 +181,13 @@ Errors are emitted with a SCREAMING_SNAKE_CASE `code`. Common ones:
121
181
 
122
182
  | Code | Meaning | Recovery |
123
183
  |------|---------|----------|
124
- | `QUOTE_EXPIRED` | The `quote_id` is no longer valid | Re-run `ride quote` and book with the fresh `quote_id`. |
125
- | `VEHICLE_UNAVAILABLE` | The chosen `vehicle_class` is unavailable | Re-quote and pick another `vehicle_class` from `vehicle_classes`. |
126
- | `BOOKING_FAILED` | Booking could not be completed | Re-quote, then retry `book` with a fresh quote and the same idempotency key. |
127
- | `CANCELLATION_NOT_ALLOWED` | Order can't be cancelled (terminal/too late) | Re-check status via `ride get`; no action if already terminal. |
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. |
128
191
  | `SERVICE_NOT_FOUND` | Unknown `service_id` | Re-run `services list` and use a valid, enabled `service_id`. |
129
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_-]`). |
130
193
 
package/dist/index.js CHANGED
@@ -5,17 +5,33 @@ import { Command as Command8 } from "commander";
5
5
 
6
6
  // src/core/errors.ts
7
7
  var ErrorCodes = {
8
+ // -- Ride/elife domain (raised by the backend, recognized here) --
8
9
  QUOTE_EXPIRED: "QUOTE_EXPIRED",
9
10
  VEHICLE_UNAVAILABLE: "VEHICLE_UNAVAILABLE",
10
11
  BOOKING_FAILED: "BOOKING_FAILED",
11
12
  CANCELLATION_NOT_ALLOWED: "CANCELLATION_NOT_ALLOWED",
12
- SERVICE_NOT_FOUND: "SERVICE_NOT_FOUND",
13
+ // -- Billing / settlement-account (monthly_settlement) --
14
+ BILLING_MODE_MISMATCH: "BILLING_MODE_MISMATCH",
15
+ ACCOUNT_NOT_FOUND: "ACCOUNT_NOT_FOUND",
16
+ ACCOUNT_SUSPENDED: "ACCOUNT_SUSPENDED",
17
+ ACCOUNT_INSUFFICIENT_BALANCE: "ACCOUNT_INSUFFICIENT_BALANCE",
18
+ // -- Payment order (pay_per_call; reserved until payment-cli ships) --
19
+ PAYMENT_ORDER_NOT_FOUND: "PAYMENT_ORDER_NOT_FOUND",
20
+ PAYMENT_ORDER_NOT_PAID: "PAYMENT_ORDER_NOT_PAID",
21
+ PAYMENT_ORDER_MISMATCH: "PAYMENT_ORDER_MISMATCH",
22
+ PAYMENT_ORDER_ALREADY_CONSUMED: "PAYMENT_ORDER_ALREADY_CONSUMED",
23
+ // -- Parameter / idempotency --
13
24
  PARAM_IDEMPOTENCY_KEY_REQUIRED: "PARAM_IDEMPOTENCY_KEY_REQUIRED",
25
+ PARAM_IDEMPOTENCY_KEY_CONFLICT: "PARAM_IDEMPOTENCY_KEY_CONFLICT",
26
+ // -- Service discovery --
27
+ SERVICE_NOT_FOUND: "SERVICE_NOT_FOUND",
28
+ // -- CLI-local / transport --
14
29
  NETWORK_ERROR: "NETWORK_ERROR",
15
30
  TIMEOUT: "TIMEOUT",
16
31
  CLI_OUTDATED: "CLI_OUTDATED",
17
32
  CONFIG_ERROR: "CONFIG_ERROR",
18
- NOT_IMPLEMENTED: "NOT_IMPLEMENTED"
33
+ NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
34
+ INTERNAL_ERROR: "INTERNAL_ERROR"
19
35
  };
20
36
  var CliError = class extends Error {
21
37
  constructor(code, message, recovery, exitCode = 1) {
@@ -206,6 +222,9 @@ function emit(data, format = "json") {
206
222
  console.log(JSON.stringify(data, null, 2));
207
223
  }
208
224
  }
225
+ function emitNdjsonLine(data) {
226
+ console.log(JSON.stringify(data));
227
+ }
209
228
  function emitSchema(schema, format = "json") {
210
229
  if (format === "table") {
211
230
  console.log(Formatter.keyValue(Object.entries(schema.params)));
@@ -399,8 +418,8 @@ var quoteSchema = {
399
418
  "dropoff-lng": "number \u2014 dropoff longitude",
400
419
  "dropoff-name": "string \u2014 dropoff location name",
401
420
  "pickup-time": 'number|string \u2014 epoch seconds, or "now"',
402
- "passenger-name": "string \u2014 lead passenger full name",
403
- "passenger-phone": "string \u2014 passenger phone in E.164 format",
421
+ "passenger-name": "string \u2014 optional, lead passenger full name",
422
+ "passenger-phone": "string \u2014 optional, passenger phone in E.164 format",
404
423
  "passenger-count": "number \u2014 optional passenger count",
405
424
  "luggage-count": "number \u2014 optional luggage count",
406
425
  "passenger-email": "string \u2014 optional passenger email",
@@ -441,10 +460,10 @@ function buildQuoteCommand() {
441
460
  lng: num(o.dropoffLng, "dropoff-lng"),
442
461
  name: need(o.dropoffName, "dropoff-name")
443
462
  },
444
- pickup_time: o.pickupTime === "now" ? "now" : num(o.pickupTime, "pickup-time"),
445
- passenger_name: need(o.passengerName, "passenger-name"),
446
- passenger_phone: need(o.passengerPhone, "passenger-phone")
463
+ pickup_time: o.pickupTime === "now" ? "now" : num(o.pickupTime, "pickup-time")
447
464
  };
465
+ if (o.passengerName) body.passenger_name = o.passengerName;
466
+ if (o.passengerPhone) body.passenger_phone = o.passengerPhone;
448
467
  if (o.passengerCount !== void 0) body.passenger_count = num(o.passengerCount, "passenger-count");
449
468
  if (o.luggageCount !== void 0) body.luggage_count = num(o.luggageCount, "luggage-count");
450
469
  if (o.childrenCount !== void 0) body.children_count = num(o.childrenCount, "children-count");
@@ -501,7 +520,7 @@ async function resolveIdempotencyKey(flagValue, options) {
501
520
  var bookSchema = {
502
521
  description: "Book a ride against a previously returned quote.",
503
522
  params: {
504
- "quote-id": "string \u2014 required, quote id from `ride quote`",
523
+ "quote-id": "string \u2014 required, quote id from `ride-elife quote`",
505
524
  "vehicle-class": "string \u2014 required, chosen vehicle class",
506
525
  "price-amount": "number \u2014 required, fare in decimal currency units (not cents)",
507
526
  "price-currency": "string \u2014 currency code (default USD)",
@@ -521,6 +540,9 @@ var bookSchema = {
521
540
  "meet-and-greet": "boolean \u2014 optional meet & greet service",
522
541
  "meet-and-greet-price": "number \u2014 optional meet & greet surcharge",
523
542
  "welcome-sign": "string \u2014 optional welcome sign text",
543
+ "child-seat-count": "number \u2014 optional child seats (0-5)",
544
+ "infant-seat-count": "number \u2014 optional infant seats (0-5)",
545
+ "toddler-seat-count": "number \u2014 optional toddler seats (0-5)",
524
546
  "arrival-flight-no": "string \u2014 optional arrival flight number",
525
547
  "arrival-airline": "string \u2014 optional arrival airline",
526
548
  "departure-flight-no": "string \u2014 optional departure flight number",
@@ -528,16 +550,18 @@ var bookSchema = {
528
550
  "idempotency-key": "string \u2014 required, sent as the Idempotency-Key header (never in body)"
529
551
  },
530
552
  response: {
531
- ride_id: "string \u2014 booked ride id, used by `ride get` / `ride cancel`",
553
+ ride_id: "string \u2014 booked ride id, used by `ride-elife get` / `ride-elife cancel`",
532
554
  order_id: "string \u2014 internal ride order id (rio_...)",
533
555
  status: "string \u2014 initial ride status (e.g. INIT / Pending)",
556
+ is_scheduled: "boolean \u2014 true = scheduled/airport ride, false = realtime",
557
+ order_type: "string \u2014 realtime / airport (derived from pickup-time)",
534
558
  price: "{ amount, currency, quote_id } \u2014 confirmed fare",
535
559
  payment_status: "string \u2014 ON_ACCOUNT (monthly_settlement) or PAID (pay_per_call)",
536
560
  billing_entry_id: "string \u2014 settlement ledger entry id (monthly_settlement only)"
537
561
  }
538
562
  };
539
563
  function buildBookCommand() {
540
- return new Command2("book").description(bookSchema.description).helpOption(false).option("--help", "Show help (add --format json for the machine-readable schema)").option("--format <format>", "Output format: json|table").option("--api-key <key>", "API key for runtime requests").option("--yes", "Skip confirmation prompts").option("--quote-id <id>", "Quote id from `ride quote`").option("--vehicle-class <class>", "Chosen vehicle class").option("--price-amount <amount>", "Fare in decimal currency units (not cents)").option("--price-currency <currency>", "Currency code (default USD)").option("--payment-order-id <id>", "Paid payment order id (pay_per_call mode only)").option("--passenger-name <name>", "Passenger full name").option("--passenger-phone <phone>", "Passenger phone").option("--passenger-email <email>", "Passenger email").option("--luggage-count <n>", "Luggage count").option("--special-requests <text>", "Free-text special requests").option("--pickup-lat <lat>", "Pickup latitude").option("--pickup-lng <lng>", "Pickup longitude").option("--pickup-name <name>", "Pickup location name").option("--dropoff-lat <lat>", "Dropoff latitude").option("--dropoff-lng <lng>", "Dropoff longitude").option("--dropoff-name <name>", "Dropoff location name").option("--pickup-time <time>", 'Pickup time: epoch seconds, or "now"').option("--meet-and-greet", "Enable meet & greet service").option("--meet-and-greet-price <amount>", "Meet & greet surcharge").option("--welcome-sign <text>", "Welcome sign text").option("--arrival-flight-no <no>", "Arrival flight number").option("--arrival-airline <airline>", "Arrival airline").option("--departure-flight-no <no>", "Departure flight number").option("--departure-airline <airline>", "Departure airline").option("--idempotency-key <key>", "Caller-supplied idempotency key").action(async (_options, command) => {
564
+ return new Command2("book").description(bookSchema.description).helpOption(false).option("--help", "Show help (add --format json for the machine-readable schema)").option("--format <format>", "Output format: json|table").option("--api-key <key>", "API key for runtime requests").option("--yes", "Skip confirmation prompts").option("--quote-id <id>", "Quote id from `ride-elife quote`").option("--vehicle-class <class>", "Chosen vehicle class").option("--price-amount <amount>", "Fare in decimal currency units (not cents)").option("--price-currency <currency>", "Currency code (default USD)").option("--payment-order-id <id>", "Paid payment order id (pay_per_call mode only)").option("--passenger-name <name>", "Passenger full name").option("--passenger-phone <phone>", "Passenger phone").option("--passenger-email <email>", "Passenger email").option("--luggage-count <n>", "Luggage count").option("--special-requests <text>", "Free-text special requests").option("--pickup-lat <lat>", "Pickup latitude").option("--pickup-lng <lng>", "Pickup longitude").option("--pickup-name <name>", "Pickup location name").option("--dropoff-lat <lat>", "Dropoff latitude").option("--dropoff-lng <lng>", "Dropoff longitude").option("--dropoff-name <name>", "Dropoff location name").option("--pickup-time <time>", 'Pickup time: epoch seconds, or "now"').option("--meet-and-greet", "Enable meet & greet service").option("--meet-and-greet-price <amount>", "Meet & greet surcharge").option("--welcome-sign <text>", "Welcome sign text").option("--child-seat-count <n>", "Number of child seats needed").option("--infant-seat-count <n>", "Number of infant seats needed").option("--toddler-seat-count <n>", "Number of toddler seats needed").option("--arrival-flight-no <no>", "Arrival flight number").option("--arrival-airline <airline>", "Arrival airline").option("--departure-flight-no <no>", "Departure flight number").option("--departure-airline <airline>", "Departure airline").option("--idempotency-key <key>", "Caller-supplied idempotency key").action(async (_options, command) => {
541
565
  const merged = command.optsWithGlobals();
542
566
  const format = merged.format === "table" ? "table" : "json";
543
567
  if (merged.help) {
@@ -582,10 +606,15 @@ function buildBookCommand() {
582
606
  if (merged.dropoffLat || merged.dropoffLng || merged.dropoffName) {
583
607
  body.dropoff = { lat: Number(merged.dropoffLat), lng: Number(merged.dropoffLng), name: merged.dropoffName };
584
608
  }
585
- if (merged.pickupTime) body.pickup_time = merged.pickupTime;
609
+ if (merged.pickupTime) {
610
+ body.pickup_time = merged.pickupTime === "now" ? "now" : Number(merged.pickupTime);
611
+ }
586
612
  if (merged.meetAndGreet) body.meet_and_greet = true;
587
613
  if (merged.meetAndGreetPrice !== void 0) body.meet_and_greet_price = Number(merged.meetAndGreetPrice);
588
614
  if (merged.welcomeSign) body.welcome_sign = merged.welcomeSign;
615
+ if (merged.childSeatCount !== void 0) body.child_seat_count = Number(merged.childSeatCount);
616
+ if (merged.infantSeatCount !== void 0) body.infant_seat_count = Number(merged.infantSeatCount);
617
+ if (merged.toddlerSeatCount !== void 0) body.toddler_seat_count = Number(merged.toddlerSeatCount);
589
618
  if (merged.arrivalFlightNo || merged.arrivalAirline) {
590
619
  body.arrival_flight = { flight_no: merged.arrivalFlightNo, airline: merged.arrivalAirline };
591
620
  }
@@ -612,25 +641,48 @@ function buildBookCommand() {
612
641
 
613
642
  // src/ride/get.ts
614
643
  import { Command as Command3 } from "commander";
644
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
645
+ "At destination",
646
+ "Cancelled",
647
+ "Rejected",
648
+ "Customer no show",
649
+ "Driver no show"
650
+ ]);
651
+ var DEFAULT_WATCH_INTERVAL_SECONDS = 5;
652
+ var DEFAULT_WATCH_TIMEOUT_SECONDS = 600;
615
653
  var rideGetSchema = {
616
654
  description: "Retrieve a single ride order status by id (repeatable for polling).",
617
655
  params: {
618
- "order-id": "string \u2014 ride order id (the ride_id returned by `ride book`)"
656
+ "order-id": "string \u2014 ride order id (the ride_id returned by `ride-elife book`)",
657
+ watch: "boolean \u2014 poll until a terminal status, emitting one NDJSON line per update (default off)",
658
+ "watch-interval": `number \u2014 seconds between polls when --watch is set (default ${DEFAULT_WATCH_INTERVAL_SECONDS})`,
659
+ "watch-timeout": `number \u2014 max seconds to poll before giving up (default ${DEFAULT_WATCH_TIMEOUT_SECONDS})`
619
660
  },
620
661
  response: {
621
662
  status: "OrderStatus \u2014 case-sensitive; terminal states: At destination | Cancelled | Rejected | Customer no show | Driver no show",
622
- from: "GeoPoint \u2014 pickup",
623
- to: "GeoPoint \u2014 dropoff",
663
+ from_location: "GeoPoint \u2014 pickup",
664
+ to_location: "GeoPoint \u2014 dropoff",
624
665
  pickup_time: "number|string",
625
666
  vehicle_class: "string",
626
667
  price: "Price{amount,currency} \u2014 amount is a decimal in the currency standard unit",
668
+ final_amount: "number \u2014 final settled fare (realtime, after final-fare settlement); local-cache path only",
669
+ final_settlement_status: "string \u2014 pending | settled | no_adjustment | settlement_pending | not_applicable (local-cache path)",
627
670
  passenger: "Passenger",
628
671
  driver: "Driver \u2014 present after assignment",
629
672
  vehicle: "Vehicle \u2014 present after assignment"
630
673
  }
631
674
  };
675
+ function num2(value, fallback) {
676
+ if (value === void 0) return fallback;
677
+ const n = Number(value);
678
+ return Number.isFinite(n) && n > 0 ? n : fallback;
679
+ }
680
+ var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
681
+ function statusOf(data) {
682
+ return data.status;
683
+ }
632
684
  function buildRideGetCommand() {
633
- const cmd = new Command3("get").description(rideGetSchema.description).option("--order-id <id>", "Ride order id (the ride_id returned by `ride book`)").action(async (_opts, command) => {
685
+ const cmd = new Command3("get").description(rideGetSchema.description).option("--order-id <id>", "Ride order id (the ride_id returned by `ride-elife book`)").option("--watch", "Poll until a terminal status, emitting one NDJSON line per update").option("--watch-interval <seconds>", "Seconds between polls when --watch is set").option("--watch-timeout <seconds>", "Max seconds to poll before giving up").action(async (_opts, command) => {
634
686
  const o = command.optsWithGlobals();
635
687
  const format = o.format === "table" ? "table" : "json";
636
688
  const apiKey = await PromptEngine.resolveInput(o.apiKey, {
@@ -639,11 +691,17 @@ function buildRideGetCommand() {
639
691
  });
640
692
  const orderId = await PromptEngine.resolveInput(o.orderId, { message: "Order id:" });
641
693
  const client = new ApiClient({ apiKey });
694
+ const path = `/ride/${encodeURIComponent(orderId)}/status`;
695
+ if (o.watch) {
696
+ await watchUntilTerminal(client, path, {
697
+ intervalMs: num2(o.watchInterval, DEFAULT_WATCH_INTERVAL_SECONDS) * 1e3,
698
+ timeoutMs: num2(o.watchTimeout, DEFAULT_WATCH_TIMEOUT_SECONDS) * 1e3
699
+ });
700
+ return;
701
+ }
642
702
  const spinner = createSpinner("Fetching ride status...");
643
703
  try {
644
- const data = await client.get(
645
- `/ride/${encodeURIComponent(orderId)}/status`
646
- );
704
+ const data = await client.get(path);
647
705
  spinner.stop();
648
706
  emit(data, format);
649
707
  } catch (err) {
@@ -653,6 +711,24 @@ function buildRideGetCommand() {
653
711
  });
654
712
  return attachSchemaHelp(cmd, rideGetSchema);
655
713
  }
714
+ async function watchUntilTerminal(client, path, opts) {
715
+ const deadline = Date.now() + opts.timeoutMs;
716
+ for (; ; ) {
717
+ const data = await client.get(path);
718
+ emitNdjsonLine(data);
719
+ const status = statusOf(data);
720
+ if (status !== void 0 && TERMINAL_STATUSES.has(status)) return;
721
+ if (Date.now() + opts.intervalMs >= deadline) {
722
+ emitNdjsonLine({
723
+ watch_status: "timeout",
724
+ message: `Polling stopped after ${opts.timeoutMs / 1e3}s without reaching a terminal status.`,
725
+ last_status: status ?? null
726
+ });
727
+ return;
728
+ }
729
+ await sleep(opts.intervalMs);
730
+ }
731
+ }
656
732
 
657
733
  // src/ride/cancel.ts
658
734
  import { Command as Command4 } from "commander";
@@ -665,7 +741,8 @@ var cancelSchema = {
665
741
  response: {
666
742
  ride_id: "string \u2014 cancelled ride id",
667
743
  ride_stat: "string \u2014 resulting ride status",
668
- cancellation: "{ cancellation_fee, reversal_amount, currency }"
744
+ cancellation: "{ cancellation_fee, reversal_amount, currency }",
745
+ refund_amount: "number \u2014 amount credited back to the settlement balance (paid \u2212 cancellation_fee)"
669
746
  }
670
747
  };
671
748
  function buildCancelCommand() {
@@ -713,7 +790,7 @@ var listOrdersSchema = {
713
790
  "order-type": "string \u2014 optional order type filter"
714
791
  },
715
792
  response: {
716
- orders: "Order[]",
793
+ orders: "RideOrderListItem[] \u2014 each: order_id, ride_id, status, vehicle_class, is_scheduled, scheduled_at, price_amount, final_amount, price_currency, payment_status, final_settlement_status (pending|settled|no_adjustment|settlement_pending|not_applicable), cancellation_fee, provider, created_at, updated_at",
717
794
  total: "number",
718
795
  page: "number",
719
796
  page_size: "number"
@@ -754,12 +831,12 @@ import { Command as Command6 } from "commander";
754
831
  // src/services/registry.ts
755
832
  var SERVICE_REGISTRY = [
756
833
  {
757
- service_id: "ride",
758
- name: "Ride",
834
+ service_id: "ride-elife",
835
+ name: "Ride hailing (eLife)",
759
836
  description: "On-demand ride ordering: quote a fare, book it, poll status, and cancel.",
760
837
  version: "1.0.0",
761
838
  provider: "elife",
762
- cli_noun: "ride",
839
+ cli_noun: "ride-elife",
763
840
  verbs: ["quote", "book", "get", "cancel", "list-orders"],
764
841
  verb_descriptions: {
765
842
  quote: "Request fare quotes for a ride between two points.",
@@ -770,8 +847,7 @@ var SERVICE_REGISTRY = [
770
847
  },
771
848
  workflow: ["quote", "book", "get (poll for status)", "cancel (optional)"],
772
849
  since: "2026-06-01",
773
- discovery: { help_command: "agenzo-merchant-cli ride --help" },
774
- billing: { mode: "pay_per_call" }
850
+ discovery: { help_command: "agenzo-merchant-cli ride-elife --help" }
775
851
  }
776
852
  ];
777
853
  function findService(serviceId) {
@@ -783,7 +859,7 @@ var servicesListSchema = {
783
859
  description: "List available merchant services from the registry.",
784
860
  params: {},
785
861
  response: {
786
- services: "Service[] \u2014 each with service_id, name, provider, cli_noun, version, verbs, billing_mode"
862
+ services: "Service[] \u2014 each with service_id, name, provider, cli_noun, version, verbs"
787
863
  }
788
864
  };
789
865
  function resolveFormat(cmd) {
@@ -802,8 +878,7 @@ function buildServicesListCommand() {
802
878
  provider: s.provider,
803
879
  cli_noun: s.cli_noun,
804
880
  version: s.version,
805
- verbs: s.verbs.join(", "),
806
- billing_mode: s.billing.mode
881
+ verbs: s.verbs.join(", ")
807
882
  }));
808
883
  emit(services, format);
809
884
  });
@@ -827,8 +902,7 @@ var serviceGetSchema = {
827
902
  verb_descriptions: "Record<verb, description>",
828
903
  workflow: "string[] \u2014 ordered steps quote\u2192book\u2192get(poll)\u2192[cancel]",
829
904
  since: "string \u2014 ISO date",
830
- discovery: "{ help_command: string }",
831
- billing: '{ mode: "pay_per_call" }'
905
+ discovery: "{ help_command: string }"
832
906
  }
833
907
  };
834
908
  function resolveFormat2(cmd) {
@@ -872,12 +946,12 @@ async function main() {
872
946
  config.command("show").description("Show the current configuration").action((_options, cmd) => {
873
947
  emit({ host: getHost() }, resolveFormat3(cmd));
874
948
  });
875
- const ride = program.command("ride").description("Ride ordering: quote, book, get, cancel, list-orders");
876
- ride.addCommand(buildQuoteCommand());
877
- ride.addCommand(buildBookCommand());
878
- ride.addCommand(buildRideGetCommand());
879
- ride.addCommand(buildCancelCommand());
880
- ride.addCommand(buildListOrdersCommand());
949
+ const rideElife = program.command("ride-elife").description("Ride ordering (eLife): quote, book, get, cancel, list-orders");
950
+ rideElife.addCommand(buildQuoteCommand());
951
+ rideElife.addCommand(buildBookCommand());
952
+ rideElife.addCommand(buildRideGetCommand());
953
+ rideElife.addCommand(buildCancelCommand());
954
+ rideElife.addCommand(buildListOrdersCommand());
881
955
  const services = program.command("services").description("Service registry: list, get");
882
956
  services.addCommand(buildServicesListCommand());
883
957
  services.addCommand(buildServiceGetCommand());
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/core/errors.ts","../src/core/config-manager.ts","../src/core/formatter.ts","../src/core/output.ts","../src/core/version.ts","../src/ride/quote.ts","../src/core/api-client.ts","../src/core/prompt-engine.ts","../src/utils/cli-help.ts","../src/ride/book.ts","../src/utils/idempotency.ts","../src/ride/get.ts","../src/ride/cancel.ts","../src/ride/list-orders.ts","../src/services/list.ts","../src/services/registry.ts","../src/services/get.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { CliError } from './core/errors.js';\nimport { getHost, resetHost, setHost } from './core/config-manager.js';\nimport { Formatter } from './core/formatter.js';\nimport { emit, type OutputFormat } from './core/output.js';\nimport { getCurrentVersion } from './core/version.js';\n\n// Ride command builders\nimport { buildQuoteCommand } from './ride/quote.js';\nimport { buildBookCommand } from './ride/book.js';\nimport { buildRideGetCommand } from './ride/get.js';\nimport { buildCancelCommand } from './ride/cancel.js';\nimport { buildListOrdersCommand } from './ride/list-orders.js';\n\n// Services command builders\nimport { buildServicesListCommand } from './services/list.js';\nimport { buildServiceGetCommand } from './services/get.js';\n\nfunction resolveFormat(cmd: Command): OutputFormat {\n return cmd.optsWithGlobals().format === 'table' ? 'table' : 'json';\n}\n\nasync function main(): Promise<void> {\n const program = new Command();\n program\n .name('agenzo-merchant-cli')\n .description('CLI for ordering rides and querying merchant services')\n .version(getCurrentVersion())\n .option('--format <format>', 'Output format: json|table', 'json')\n .option('--yes', 'Skip confirmation prompts (for automation/AI Agents)', false)\n .option('--api-key <key>', 'API key for runtime requests');\n\n // config group — fully implemented locally (no network)\n const config = program.command('config').description('Local API host configuration');\n config\n .command('set-host <url>')\n .description('Set the API host')\n .action((url: string) => {\n setHost(url);\n console.log(Formatter.status('success', `API host set to ${getHost()}`));\n });\n config\n .command('reset-host')\n .description('Reset the API host to the default')\n .action(() => {\n resetHost();\n console.log(Formatter.status('success', `API host reset to ${getHost()}`));\n });\n config\n .command('show')\n .description('Show the current configuration')\n .action((_options, cmd: Command) => {\n emit({ host: getHost() }, resolveFormat(cmd));\n });\n\n // ride group\n const ride = program\n .command('ride')\n .description('Ride ordering: quote, book, get, cancel, list-orders');\n ride.addCommand(buildQuoteCommand());\n ride.addCommand(buildBookCommand());\n ride.addCommand(buildRideGetCommand());\n ride.addCommand(buildCancelCommand());\n ride.addCommand(buildListOrdersCommand());\n\n // services group\n const services = program.command('services').description('Service registry: list, get');\n services.addCommand(buildServicesListCommand());\n services.addCommand(buildServiceGetCommand());\n\n await program.parseAsync(process.argv);\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof CliError) {\n console.error(Formatter.status('error', error.message));\n if (error.recovery) console.error(Formatter.status('info', error.recovery));\n process.exit(error.exitCode);\n }\n console.error(\n Formatter.status('error', error instanceof Error ? error.message : 'An unexpected error occurred'),\n );\n process.exit(1);\n});\n","/**\n * SCREAMING_SNAKE_CASE error codes shared across the CLI. Server-returned\n * codes are passed through verbatim, so this list is the well-known subset the\n * CLI itself raises or special-cases.\n */\nexport const ErrorCodes = {\n QUOTE_EXPIRED: 'QUOTE_EXPIRED',\n VEHICLE_UNAVAILABLE: 'VEHICLE_UNAVAILABLE',\n BOOKING_FAILED: 'BOOKING_FAILED',\n CANCELLATION_NOT_ALLOWED: 'CANCELLATION_NOT_ALLOWED',\n SERVICE_NOT_FOUND: 'SERVICE_NOT_FOUND',\n PARAM_IDEMPOTENCY_KEY_REQUIRED: 'PARAM_IDEMPOTENCY_KEY_REQUIRED',\n NETWORK_ERROR: 'NETWORK_ERROR',\n TIMEOUT: 'TIMEOUT',\n CLI_OUTDATED: 'CLI_OUTDATED',\n CONFIG_ERROR: 'CONFIG_ERROR',\n NOT_IMPLEMENTED: 'NOT_IMPLEMENTED',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/**\n * Single error type for the CLI. `code` identifies the failure class,\n * `recovery` is an optional human-readable next step, and `exitCode` lets\n * specific failures (e.g. CLI_OUTDATED) signal a distinct process exit code.\n */\nexport class CliError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly recovery?: string,\n public readonly exitCode: number = 1,\n ) {\n super(message);\n this.name = 'CliError';\n }\n}\n","/**\n * Local config persisted at ~/.agenzo-merchant-cli/config.json.\n * Only the API host is stored; everything else is runtime/flag driven.\n */\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { CliError, ErrorCodes } from './errors.js';\n\nexport const DEFAULT_HOST = 'https://agent.everonet.com';\n\nconst CONFIG_DIR = join(homedir(), '.agenzo-merchant-cli');\nconst CONFIG_PATH = join(CONFIG_DIR, 'config.json');\n\ninterface Config {\n host: string;\n}\n\nfunction read(): Config {\n let raw: string;\n try {\n raw = readFileSync(CONFIG_PATH, 'utf-8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return { host: DEFAULT_HOST };\n }\n throw error;\n }\n try {\n const parsed = JSON.parse(raw) as Partial<Config>;\n return { host: parsed.host ?? DEFAULT_HOST };\n } catch {\n throw new CliError(\n ErrorCodes.CONFIG_ERROR,\n `Invalid config file: ${CONFIG_PATH}`,\n 'Delete the file to reset to defaults.',\n );\n }\n}\n\nfunction write(config: Config): void {\n mkdirSync(CONFIG_DIR, { recursive: true });\n writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), 'utf-8');\n}\n\nexport function getHost(): string {\n return read().host;\n}\n\nexport function setHost(host: string): void {\n write({ host: host.replace(/\\/+$/, '') });\n}\n\nexport function resetHost(): void {\n write({ host: DEFAULT_HOST });\n}\n","export type StatusType = 'success' | 'error' | 'info' | 'warning';\n\nconst ICONS: Record<StatusType, string> = {\n success: '✓',\n error: '✗',\n info: 'ℹ',\n warning: '⚠',\n};\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nexport interface Spinner {\n /** Update the in-progress message. */\n update(message: string): void;\n /** Stop and clear the spinner line (no final status). */\n stop(): void;\n /** Stop and replace the line with a success status. */\n succeed(message?: string): void;\n /** Stop and replace the line with an error status. */\n fail(message?: string): void;\n}\n\n/**\n * TTY-aware progress spinner. Renders to **stderr** so that stdout stays a\n * clean payload stream (agents/scripts piping `| jq` are unaffected).\n *\n * When stderr is not a TTY (piped, redirected, CI, agent-invoked) the animation\n * is suppressed entirely — no control characters leak into logs. The optional\n * final status (`succeed`/`fail`) is still printed in that case so non-TTY\n * callers get a one-line outcome on stderr without the spinning frames.\n */\nexport function createSpinner(message: string): Spinner {\n const isTty = Boolean(process.stderr.isTTY);\n let current = message;\n\n if (!isTty) {\n return {\n update(msg: string) {\n current = msg;\n },\n stop() {},\n succeed(msg?: string) {\n if (msg) process.stderr.write(`${Formatter.status('success', msg)}\\n`);\n },\n fail(msg?: string) {\n process.stderr.write(`${Formatter.status('error', msg ?? current)}\\n`);\n },\n };\n }\n\n let frame = 0;\n const render = (): void => {\n process.stderr.write(`\\r\\x1b[K${SPINNER_FRAMES[frame]} ${current}`);\n frame = (frame + 1) % SPINNER_FRAMES.length;\n };\n render();\n const timer = setInterval(render, 80);\n\n const clear = (): void => {\n clearInterval(timer);\n process.stderr.write('\\r\\x1b[K');\n };\n\n return {\n update(msg: string) {\n current = msg;\n },\n stop() {\n clear();\n },\n succeed(msg?: string) {\n clear();\n if (msg) process.stderr.write(`${Formatter.status('success', msg)}\\n`);\n },\n fail(msg?: string) {\n clear();\n process.stderr.write(`${Formatter.status('error', msg ?? current)}\\n`);\n },\n };\n}\n\nfunction stringify(value: unknown): string {\n if (value === null || value === undefined) return '';\n if (typeof value === 'object') return JSON.stringify(value);\n return String(value);\n}\n\nexport class Formatter {\n /** Status-prefixed line, e.g. \"✓ done\". */\n static status(type: StatusType, message: string): string {\n return `${ICONS[type]} ${message}`;\n }\n\n /** Aligned columnar table for list output. */\n static table(headers: string[], rows: string[][]): string {\n const widths = headers.map((h, i) =>\n Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)),\n );\n const line = (cells: string[]): string =>\n cells.map((c, i) => (c ?? '').padEnd(widths[i])).join(' ');\n return [\n line(headers),\n widths.map((w) => '-'.repeat(w)).join(' '),\n ...rows.map(line),\n ].join('\\n');\n }\n\n /** Key-value detail output with left-aligned keys. */\n static keyValue(entries: [string, string][]): string {\n const width = Math.max(0, ...entries.map(([k]) => k.length));\n return entries.map(([k, v]) => `${k.padEnd(width)} ${v}`).join('\\n');\n }\n\n /** Best-effort human-readable rendering of arbitrary data. */\n static auto(data: unknown): string {\n if (Array.isArray(data)) {\n return Formatter.arrayTable(data);\n }\n if (data && typeof data === 'object') {\n const obj = data as Record<string, unknown>;\n const scalarEntries: [string, string][] = [];\n const tableSections: string[] = [];\n for (const [k, v] of Object.entries(obj)) {\n // Render an array-of-objects value as its own labelled sub-table\n // instead of dumping raw JSON on a key-value line.\n if (Array.isArray(v) && v.some((i) => i && typeof i === 'object')) {\n tableSections.push(`${k}:\\n${Formatter.arrayTable(v)}`);\n } else {\n scalarEntries.push([k, stringify(v)]);\n }\n }\n const parts: string[] = [];\n if (scalarEntries.length) parts.push(Formatter.keyValue(scalarEntries));\n parts.push(...tableSections);\n return parts.join('\\n\\n');\n }\n return stringify(data);\n }\n\n /** Render an array of objects as an aligned table; falls back gracefully. */\n private static arrayTable(items: unknown[]): string {\n if (items.length === 0) return '(empty)';\n const rows = items.filter(\n (i): i is Record<string, unknown> => Boolean(i) && typeof i === 'object',\n );\n if (rows.length === 0) {\n return items.map((i) => stringify(i)).join(', ');\n }\n const headers = Object.keys(rows[0]);\n return Formatter.table(\n headers,\n rows.map((r) => headers.map((h) => stringify(r[h]))),\n );\n }\n}\n","import { Formatter } from './formatter.js';\n\nexport type OutputFormat = 'json' | 'table';\n\n/** Schema descriptor a verb reserves for `--help --format json`. */\nexport interface VerbSchema {\n description: string;\n params: Record<string, string>;\n response: Record<string, string>;\n}\n\n/** Emit a result payload in the requested format (json default, table via Formatter). */\nexport function emit(data: unknown, format: OutputFormat = 'json'): void {\n if (format === 'table') {\n console.log(Formatter.auto(data));\n } else {\n console.log(JSON.stringify(data, null, 2));\n }\n}\n\n/** Helper for `--help --format json`: print a verb's param/response schema. */\nexport function emitSchema(schema: VerbSchema, format: OutputFormat = 'json'): void {\n if (format === 'table') {\n console.log(Formatter.keyValue(Object.entries(schema.params)));\n } else {\n console.log(JSON.stringify(schema, null, 2));\n }\n}\n","/**\n * CLI version source-of-truth + server-driven min-version negotiation.\n *\n * The running version is read from `package.json` at runtime (it lives outside\n * `rootDir`, so we read it via fs rather than importing it to keep `tsc` happy).\n * The server advertises the floor via the `X-CLI-Min-Version` response header;\n * if the local version is below it we throw CLI_OUTDATED and exit with code 2.\n */\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { CliError, ErrorCodes } from './errors.js';\n\nexport const UPGRADE_COMMAND = 'npm install -g agenzo-merchant-cli@latest';\n\nconst FALLBACK_VERSION = '0.1.0';\n\nlet cached: string | null = null;\n\nexport function getCurrentVersion(): string {\n if (cached !== null) return cached;\n const here = dirname(fileURLToPath(import.meta.url));\n // Both the bundled (dist/index.js) and source layouts resolve to package.json.\n const candidates = [\n join(here, '..', 'package.json'),\n join(here, '..', '..', 'package.json'),\n ];\n for (const p of candidates) {\n try {\n const pkg = JSON.parse(readFileSync(p, 'utf-8')) as { version?: string };\n if (typeof pkg.version === 'string') {\n cached = pkg.version;\n return cached;\n }\n } catch {\n // try the next candidate\n }\n }\n cached = FALLBACK_VERSION;\n return cached;\n}\n\n/** Returns negative / zero / positive comparing `a` against `b` (major.minor.patch). */\nexport function compareVersion(a: string, b: string): number {\n const parse = (v: string): number[] =>\n v\n .trim()\n .replace(/^v/, '')\n .split(/[-+]/)[0]\n .split('.')\n .map((n) => parseInt(n, 10) || 0);\n const pa = parse(a);\n const pb = parse(b);\n for (let i = 0; i < 3; i++) {\n const diff = (pa[i] ?? 0) - (pb[i] ?? 0);\n if (diff !== 0) return diff;\n }\n return 0;\n}\n\n/** Throw CLI_OUTDATED (exit code 2) when the local version is below the header floor. */\nexport function enforceMinVersion(header: string | null): void {\n const min = header?.trim();\n if (!min) return;\n const current = getCurrentVersion();\n if (compareVersion(current, min) < 0) {\n throw new CliError(\n ErrorCodes.CLI_OUTDATED,\n `CLI ${current} is below the required minimum ${min}.`,\n `Upgrade: ${UPGRADE_COMMAND}`,\n 2,\n );\n }\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { CliError } from '../core/errors.js';\nimport { emit, type OutputFormat } from '../core/output.js';\nimport { createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { attachSchemaHelp } from '../utils/cli-help.js';\nimport type { QuoteResponse } from '../types/api.js';\n\n/** Reserved for `--help --format json`. */\nexport const quoteSchema = {\n description: 'Request fare quotes for a ride between two points.',\n params: {\n 'pickup-lat': 'number — pickup latitude',\n 'pickup-lng': 'number — pickup longitude',\n 'pickup-name': 'string — pickup location name',\n 'dropoff-lat': 'number — dropoff latitude',\n 'dropoff-lng': 'number — dropoff longitude',\n 'dropoff-name': 'string — dropoff location name',\n 'pickup-time': 'number|string — epoch seconds, or \"now\"',\n 'passenger-name': 'string — lead passenger full name',\n 'passenger-phone': 'string — passenger phone in E.164 format',\n 'passenger-count': 'number — optional passenger count',\n 'luggage-count': 'number — optional luggage count',\n 'passenger-email': 'string — optional passenger email',\n 'children-count': 'number — optional children count',\n },\n response: {\n vehicle_classes:\n 'VehicleClass[] — each: vehicle_class, price{amount,currency,quote_id}, passenger_capacity, luggage_capacity (amount is a decimal in the currency standard unit, e.g. 42.50 = $42.50)',\n meet_and_greet: 'object|null — { available: boolean, price: { amount, currency } } when applicable',\n is_airport_transfer: 'boolean',\n airport_direction: 'string|null — pickup/dropoff direction for airport transfers',\n },\n};\n\nfunction need(value: string | undefined, flag: string): string {\n if (value === undefined) throw new CliError('PARAM_REQUIRED', `Missing required --${flag}.`);\n return value;\n}\n\nfunction num(value: string | undefined, flag: string): number {\n const n = Number(need(value, flag));\n if (!Number.isFinite(n)) throw new CliError('PARAM_INVALID', `--${flag} must be a number.`);\n return n;\n}\n\nexport function buildQuoteCommand(): Command {\n const cmd = new Command('quote')\n .description(quoteSchema.description)\n .option('--pickup-lat <lat>', 'Pickup latitude')\n .option('--pickup-lng <lng>', 'Pickup longitude')\n .option('--pickup-name <name>', 'Pickup location name')\n .option('--dropoff-lat <lat>', 'Dropoff latitude')\n .option('--dropoff-lng <lng>', 'Dropoff longitude')\n .option('--dropoff-name <name>', 'Dropoff location name')\n .option('--pickup-time <time>', 'Pickup time: epoch seconds, or \"now\"')\n .option('--passenger-name <name>', 'Lead passenger full name')\n .option('--passenger-phone <phone>', 'Passenger phone (E.164)')\n .option('--passenger-count <n>', 'Passenger count')\n .option('--luggage-count <n>', 'Luggage count')\n .option('--passenger-email <email>', 'Passenger email')\n .option('--children-count <n>', 'Children count')\n .action(async (_opts, command: Command) => {\n const o = command.optsWithGlobals();\n const format: OutputFormat = o.format === 'table' ? 'table' : 'json';\n const apiKey = await PromptEngine.resolveInput(o.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n\n const body: Record<string, unknown> = {\n pickup: {\n lat: num(o.pickupLat, 'pickup-lat'),\n lng: num(o.pickupLng, 'pickup-lng'),\n name: need(o.pickupName, 'pickup-name'),\n },\n dropoff: {\n lat: num(o.dropoffLat, 'dropoff-lat'),\n lng: num(o.dropoffLng, 'dropoff-lng'),\n name: need(o.dropoffName, 'dropoff-name'),\n },\n pickup_time: o.pickupTime === 'now' ? 'now' : num(o.pickupTime, 'pickup-time'),\n passenger_name: need(o.passengerName, 'passenger-name'),\n passenger_phone: need(o.passengerPhone, 'passenger-phone'),\n };\n if (o.passengerCount !== undefined) body.passenger_count = num(o.passengerCount, 'passenger-count');\n if (o.luggageCount !== undefined) body.luggage_count = num(o.luggageCount, 'luggage-count');\n if (o.childrenCount !== undefined) body.children_count = num(o.childrenCount, 'children-count');\n if (o.passengerEmail !== undefined) body.passenger_email = o.passengerEmail;\n\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Fetching quotes...');\n try {\n const data = await client.post<QuoteResponse>('/ride/quote', { body });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Quote request failed');\n throw err;\n }\n });\n\n return attachSchemaHelp(cmd, quoteSchema);\n}\n","/**\n * HTTPS client for the ride/services API.\n *\n * - base = configured host; ride endpoints live under the `/api/v3/agent-pay` prefix\n * - auth via `X-Api-Key` header\n * - write operations may carry an `Idempotency-Key` header (never in the body)\n * - unwraps the v3 envelope `{ code, message, data }`: returns `data` on\n * success (code \"0000\"), throws CliError (server code/message) on failure\n * - negotiates the CLI version floor via the `X-CLI-Min-Version` header\n * - maps connection/timeout failures to NETWORK_ERROR / TIMEOUT\n */\nimport { CliError, ErrorCodes } from './errors.js';\nimport { getHost } from './config-manager.js';\nimport { enforceMinVersion, getCurrentVersion } from './version.js';\n\nconst RIDE_PREFIX = '/api/v3/agent-pay';\n\nexport interface ApiClientOptions {\n apiKey: string;\n host?: string;\n timeout?: number;\n}\n\nexport interface RequestOptions {\n body?: Record<string, unknown>;\n idempotencyKey?: string;\n query?: Record<string, string | number | boolean | undefined>;\n}\n\ninterface Envelope<T> {\n code?: string;\n message?: string;\n data?: T;\n}\n\nexport class ApiClient {\n private readonly host: string;\n private readonly apiKey: string;\n private readonly timeout: number;\n\n constructor(options: ApiClientOptions) {\n this.apiKey = options.apiKey;\n this.host = (options.host ?? getHost()).replace(/\\/+$/, '');\n this.timeout = options.timeout ?? 30000;\n }\n\n get<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('GET', path, options);\n }\n\n post<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('POST', path, options);\n }\n\n private async request<T>(\n method: string,\n path: string,\n options: RequestOptions,\n ): Promise<T> {\n let url = `${this.host}${RIDE_PREFIX}${path}`;\n if (options.query) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined) params.set(key, String(value));\n }\n const qs = params.toString();\n if (qs) url += `?${qs}`;\n }\n\n const headers: Record<string, string> = {\n 'X-Api-Key': this.apiKey,\n 'User-Agent': `agenzo-merchant-cli/${getCurrentVersion()}`,\n };\n if (options.body) headers['Content-Type'] = 'application/json';\n if (options.idempotencyKey) headers['Idempotency-Key'] = options.idempotencyKey;\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n let response: Response;\n try {\n response = await fetch(url, {\n method,\n headers,\n body: options.body ? JSON.stringify(options.body) : undefined,\n signal: controller.signal,\n });\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n throw new CliError(\n ErrorCodes.TIMEOUT,\n `Request timed out after ${this.timeout}ms: ${url}`,\n 'Retry, or check your network connection.',\n );\n }\n throw new CliError(\n ErrorCodes.NETWORK_ERROR,\n `Network request failed: ${url}`,\n 'Check your network connection and the configured API host.',\n );\n } finally {\n clearTimeout(timer);\n }\n\n // Enforce the server-advertised version floor before reading the body.\n enforceMinVersion(response.headers.get('x-cli-min-version'));\n\n const text = await response.text();\n let envelope: Envelope<T>;\n try {\n envelope = JSON.parse(text) as Envelope<T>;\n } catch {\n throw new CliError(\n ErrorCodes.NETWORK_ERROR,\n `Unexpected non-JSON response (HTTP ${response.status}) from ${url}`,\n );\n }\n\n if (envelope.code !== undefined && envelope.code !== '0000') {\n const code = envelope.code;\n const message = envelope.message ?? `Request failed (HTTP ${response.status})`;\n throw new CliError(code, message);\n }\n\n return envelope.data as T;\n }\n}\n","import { confirm, input, password, select } from '@inquirer/prompts';\n\nexport interface ResolveOptions {\n message: string;\n type?: 'input' | 'password' | 'select';\n choices?: { name: string; value: string }[];\n validate?: (value: string) => boolean | string;\n}\n\n/**\n * Interactive resolution for missing required parameters (api-key,\n * idempotency-key, etc.). When a flag value is supplied it is returned as-is.\n */\nexport class PromptEngine {\n static async resolveInput(\n flagValue: string | undefined,\n options: ResolveOptions,\n ): Promise<string> {\n if (flagValue !== undefined) return flagValue;\n if (options.type === 'password') {\n return password({ message: options.message, mask: '*' });\n }\n if (options.type === 'select' && options.choices) {\n return select({ message: options.message, choices: options.choices });\n }\n return input({ message: options.message, validate: options.validate });\n }\n\n /** Confirmation prompt; auto-approves when `--yes` is set. */\n static async confirm(message: string, yes: boolean): Promise<boolean> {\n if (yes) return true;\n return confirm({ message });\n }\n}\n","/**\n * `--help --format <fmt>` support shared by the read-only verbs.\n *\n * Commander processes `--help` before later argv tokens, so the resolved\n * `--format` option is not yet available when help renders. We therefore read\n * the format directly from `process.argv`: when it is explicitly `json`/`table`\n * we print the verb schema (via emitSchema) instead of the usage text, and let\n * commander render the default help otherwise.\n */\nimport type { Command } from 'commander';\nimport { emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\n\nfunction explicitFormat(): OutputFormat | undefined {\n const argv = process.argv;\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i];\n if (a === '--format=json' || (a === '--format' && argv[i + 1] === 'json')) return 'json';\n if (a === '--format=table' || (a === '--format' && argv[i + 1] === 'table')) return 'table';\n }\n return undefined;\n}\n\n/** Print `schema` for `--help --format json|table`; otherwise default usage. */\nexport function attachSchemaHelp(cmd: Command, schema: VerbSchema): Command {\n const baseHelp = cmd.helpInformation.bind(cmd);\n cmd.helpInformation = (ctx) => {\n const format = explicitFormat();\n if (!format) return baseHelp(ctx);\n emitSchema(schema, format);\n return '';\n };\n return cmd;\n}\n","/*\n * Booking funding is decided server-side by the developer's billing_mode:\n * - monthly_settlement: no payment handle; fare is deducted from the\n * developer's settlement account (payment_status=ON_ACCOUNT).\n * - pay_per_call: pass --payment-order-id (a PAID order from payment-cli).\n * Reserved — gated server-side until payment-cli ships (BACK-040).\n * The CLI no longer accepts --payment-method-id (the merchant domain never\n * holds a payment credential).\n */\nimport { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { Formatter, createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { resolveIdempotencyKey } from '../utils/idempotency.js';\n\n/** Reserved for `--help --format json`. */\nexport const bookSchema: VerbSchema = {\n description: 'Book a ride against a previously returned quote.',\n params: {\n 'quote-id': 'string — required, quote id from `ride quote`',\n 'vehicle-class': 'string — required, chosen vehicle class',\n 'price-amount': 'number — required, fare in decimal currency units (not cents)',\n 'price-currency': 'string — currency code (default USD)',\n 'payment-order-id': 'string — conditional. Required for pay_per_call billing (a PAID order from payment-cli); omit for monthly_settlement (deducted from the settlement account)',\n 'passenger-name': 'string — required, passenger full name',\n 'passenger-phone': 'string — required, passenger phone',\n 'passenger-email': 'string — optional passenger email',\n 'luggage-count': 'number — optional luggage count',\n 'special-requests': 'string — optional free-text requests',\n 'pickup-lat': 'number — required, pickup latitude',\n 'pickup-lng': 'number — required, pickup longitude',\n 'pickup-name': 'string — required, pickup location name',\n 'dropoff-lat': 'number — required, dropoff latitude',\n 'dropoff-lng': 'number — required, dropoff longitude',\n 'dropoff-name': 'string — required, dropoff location name',\n 'pickup-time': 'number|string — required, epoch seconds or \"now\" (must match quote)',\n 'meet-and-greet': 'boolean — optional meet & greet service',\n 'meet-and-greet-price': 'number — optional meet & greet surcharge',\n 'welcome-sign': 'string — optional welcome sign text',\n 'arrival-flight-no': 'string — optional arrival flight number',\n 'arrival-airline': 'string — optional arrival airline',\n 'departure-flight-no': 'string — optional departure flight number',\n 'departure-airline': 'string — optional departure airline',\n 'idempotency-key': 'string — required, sent as the Idempotency-Key header (never in body)',\n },\n response: {\n ride_id: 'string — booked ride id, used by `ride get` / `ride cancel`',\n order_id: 'string — internal ride order id (rio_...)',\n status: 'string — initial ride status (e.g. INIT / Pending)',\n price: '{ amount, currency, quote_id } — confirmed fare',\n payment_status: 'string — ON_ACCOUNT (monthly_settlement) or PAID (pay_per_call)',\n billing_entry_id: 'string — settlement ledger entry id (monthly_settlement only)',\n },\n};\n\nexport function buildBookCommand(): Command {\n return new Command('book')\n .description(bookSchema.description)\n .helpOption(false)\n .option('--help', 'Show help (add --format json for the machine-readable schema)')\n .option('--format <format>', 'Output format: json|table')\n .option('--api-key <key>', 'API key for runtime requests')\n .option('--yes', 'Skip confirmation prompts')\n .option('--quote-id <id>', 'Quote id from `ride quote`')\n .option('--vehicle-class <class>', 'Chosen vehicle class')\n .option('--price-amount <amount>', 'Fare in decimal currency units (not cents)')\n .option('--price-currency <currency>', 'Currency code (default USD)')\n .option('--payment-order-id <id>', 'Paid payment order id (pay_per_call mode only)')\n .option('--passenger-name <name>', 'Passenger full name')\n .option('--passenger-phone <phone>', 'Passenger phone')\n .option('--passenger-email <email>', 'Passenger email')\n .option('--luggage-count <n>', 'Luggage count')\n .option('--special-requests <text>', 'Free-text special requests')\n .option('--pickup-lat <lat>', 'Pickup latitude')\n .option('--pickup-lng <lng>', 'Pickup longitude')\n .option('--pickup-name <name>', 'Pickup location name')\n .option('--dropoff-lat <lat>', 'Dropoff latitude')\n .option('--dropoff-lng <lng>', 'Dropoff longitude')\n .option('--dropoff-name <name>', 'Dropoff location name')\n .option('--pickup-time <time>', 'Pickup time: epoch seconds, or \"now\"')\n .option('--meet-and-greet', 'Enable meet & greet service')\n .option('--meet-and-greet-price <amount>', 'Meet & greet surcharge')\n .option('--welcome-sign <text>', 'Welcome sign text')\n .option('--arrival-flight-no <no>', 'Arrival flight number')\n .option('--arrival-airline <airline>', 'Arrival airline')\n .option('--departure-flight-no <no>', 'Departure flight number')\n .option('--departure-airline <airline>', 'Departure airline')\n .option('--idempotency-key <key>', 'Caller-supplied idempotency key')\n .action(async (_options, command: Command) => {\n const merged = command.optsWithGlobals();\n const format: OutputFormat = merged.format === 'table' ? 'table' : 'json';\n\n if (merged.help) {\n const wantsSchema = process.argv.some((a) => a === '--format' || a.startsWith('--format='));\n if (wantsSchema) emitSchema(bookSchema, format);\n else command.outputHelp();\n return;\n }\n\n const yes = merged.yes === true;\n const apiKey = await PromptEngine.resolveInput(merged.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n const quoteId = await PromptEngine.resolveInput(merged.quoteId, { message: 'Quote id:' });\n const vehicleClass = await PromptEngine.resolveInput(merged.vehicleClass, {\n message: 'Vehicle class:',\n });\n const priceAmount = await PromptEngine.resolveInput(merged.priceAmount, {\n message: 'Price amount (decimal):',\n });\n const passengerName = await PromptEngine.resolveInput(merged.passengerName, {\n message: 'Passenger name:',\n });\n const passengerPhone = await PromptEngine.resolveInput(merged.passengerPhone, {\n message: 'Passenger phone:',\n });\n\n const body: Record<string, unknown> = {\n quote_id: quoteId,\n vehicle_class: vehicleClass,\n price_amount: Number(priceAmount),\n price_currency: merged.priceCurrency ?? 'USD',\n passenger_name: passengerName,\n passenger_phone: passengerPhone,\n };\n // Funding is decided server-side by the developer's billing_mode:\n // - monthly_settlement: no payment handle (deducted from the account)\n // - pay_per_call: --payment-order-id (a PAID order from payment-cli)\n // Both flags are optional here; the backend rejects the wrong one.\n if (merged.paymentOrderId) body.payment_order_id = merged.paymentOrderId;\n if (merged.passengerEmail) body.passenger_email = merged.passengerEmail;\n if (merged.luggageCount !== undefined) body.luggage_count = Number(merged.luggageCount);\n if (merged.specialRequests) body.special_requests = merged.specialRequests;\n if (merged.pickupLat || merged.pickupLng || merged.pickupName) {\n body.pickup = { lat: Number(merged.pickupLat), lng: Number(merged.pickupLng), name: merged.pickupName };\n }\n if (merged.dropoffLat || merged.dropoffLng || merged.dropoffName) {\n body.dropoff = { lat: Number(merged.dropoffLat), lng: Number(merged.dropoffLng), name: merged.dropoffName };\n }\n if (merged.pickupTime) body.pickup_time = merged.pickupTime;\n if (merged.meetAndGreet) body.meet_and_greet = true;\n if (merged.meetAndGreetPrice !== undefined) body.meet_and_greet_price = Number(merged.meetAndGreetPrice);\n if (merged.welcomeSign) body.welcome_sign = merged.welcomeSign;\n if (merged.arrivalFlightNo || merged.arrivalAirline) {\n body.arrival_flight = { flight_no: merged.arrivalFlightNo, airline: merged.arrivalAirline };\n }\n if (merged.departureFlightNo || merged.departureAirline) {\n body.departure_flight = { flight_no: merged.departureFlightNo, airline: merged.departureAirline };\n }\n\n if (!(await PromptEngine.confirm(`Book ride with quote ${quoteId}?`, yes))) {\n console.log(Formatter.status('info', 'Booking aborted.'));\n return;\n }\n\n const idempotencyKey = await resolveIdempotencyKey(merged.idempotencyKey, { yes });\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Booking ride...');\n try {\n const data = await client.post('/ride/book', { body, idempotencyKey });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Booking failed');\n throw err;\n }\n });\n}\n","import { input } from '@inquirer/prompts';\nimport { CliError, ErrorCodes } from '../core/errors.js';\n\nconst KEY_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\nconst RULE = 'Use 1-128 characters from [A-Za-z0-9_-].';\n\n/** Validate + normalize a caller-supplied idempotency key. */\nexport function normalizeIdempotencyKey(key: string): string {\n const trimmed = key.trim();\n if (!KEY_PATTERN.test(trimmed)) {\n throw new CliError(\n ErrorCodes.PARAM_IDEMPOTENCY_KEY_REQUIRED,\n `Invalid idempotency key: \"${key}\".`,\n RULE,\n );\n }\n return trimmed;\n}\n\n/**\n * Resolve the idempotency key for a write operation. The CLI never generates\n * one: if absent and `--yes` is set it is a hard error, otherwise we prompt.\n */\nexport async function resolveIdempotencyKey(\n flagValue: string | undefined,\n options: { yes?: boolean },\n): Promise<string> {\n if (flagValue !== undefined) return normalizeIdempotencyKey(flagValue);\n if (options.yes) {\n throw new CliError(\n ErrorCodes.PARAM_IDEMPOTENCY_KEY_REQUIRED,\n 'An idempotency key is required for write operations.',\n 'Pass --idempotency-key <key>; the CLI never auto-generates one.',\n );\n }\n const entered = await input({\n message: 'Idempotency key:',\n validate: (v) => KEY_PATTERN.test(v.trim()) || RULE,\n });\n return normalizeIdempotencyKey(entered);\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, type OutputFormat } from '../core/output.js';\nimport { createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { attachSchemaHelp } from '../utils/cli-help.js';\nimport type { GetOrderResponse } from '../types/api.js';\n\n/** Reserved for `--help --format json`. */\nexport const rideGetSchema = {\n description: 'Retrieve a single ride order status by id (repeatable for polling).',\n params: {\n 'order-id': 'string — ride order id (the ride_id returned by `ride book`)',\n },\n response: {\n status:\n 'OrderStatus — case-sensitive; terminal states: At destination | Cancelled | Rejected | Customer no show | Driver no show',\n from: 'GeoPoint — pickup',\n to: 'GeoPoint — dropoff',\n pickup_time: 'number|string',\n vehicle_class: 'string',\n price: 'Price{amount,currency} — amount is a decimal in the currency standard unit',\n passenger: 'Passenger',\n driver: 'Driver — present after assignment',\n vehicle: 'Vehicle — present after assignment',\n },\n};\n\nexport function buildRideGetCommand(): Command {\n const cmd = new Command('get')\n .description(rideGetSchema.description)\n .option('--order-id <id>', 'Ride order id (the ride_id returned by `ride book`)')\n .action(async (_opts, command: Command) => {\n const o = command.optsWithGlobals();\n const format: OutputFormat = o.format === 'table' ? 'table' : 'json';\n const apiKey = await PromptEngine.resolveInput(o.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n const orderId = await PromptEngine.resolveInput(o.orderId, { message: 'Order id:' });\n\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Fetching ride status...');\n try {\n const data = await client.get<GetOrderResponse>(\n `/ride/${encodeURIComponent(orderId)}/status`,\n );\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Failed to fetch ride status');\n throw err;\n }\n });\n\n return attachSchemaHelp(cmd, rideGetSchema);\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { Formatter, createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { resolveIdempotencyKey } from '../utils/idempotency.js';\n\n/** Reserved for `--help --format json`. */\nexport const cancelSchema: VerbSchema = {\n description: 'Cancel a ride order; may incur a cancellation fee.',\n params: {\n 'order-id': 'string — required, order id (a.k.a. ride id) to cancel',\n 'idempotency-key': 'string — required, sent as the Idempotency-Key header (never in body)',\n },\n response: {\n ride_id: 'string — cancelled ride id',\n ride_stat: 'string — resulting ride status',\n cancellation: '{ cancellation_fee, reversal_amount, currency }',\n },\n};\n\nexport function buildCancelCommand(): Command {\n return new Command('cancel')\n .description(cancelSchema.description)\n .helpOption(false)\n .option('--help', 'Show help (add --format json for the machine-readable schema)')\n .option('--format <format>', 'Output format: json|table')\n .option('--api-key <key>', 'API key for runtime requests')\n .option('--yes', 'Skip confirmation prompts')\n .option('--order-id <id>', 'Order id (a.k.a. ride id) to cancel')\n .option('--idempotency-key <key>', 'Caller-supplied idempotency key')\n .action(async (_options, command: Command) => {\n const merged = command.optsWithGlobals();\n const format: OutputFormat = merged.format === 'table' ? 'table' : 'json';\n\n if (merged.help) {\n const wantsSchema = process.argv.some((a) => a === '--format' || a.startsWith('--format='));\n if (wantsSchema) emitSchema(cancelSchema, format);\n else command.outputHelp();\n return;\n }\n\n const yes = merged.yes === true;\n const apiKey = await PromptEngine.resolveInput(merged.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n const orderId = await PromptEngine.resolveInput(merged.orderId, { message: 'Order id:' });\n\n if (!(await PromptEngine.confirm(`Cancel order ${orderId}? This may incur a fee.`, yes))) {\n console.log(Formatter.status('info', 'Cancellation aborted.'));\n return;\n }\n\n const idempotencyKey = await resolveIdempotencyKey(merged.idempotencyKey, { yes });\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Cancelling ride...');\n try {\n const data = await client.post(`/ride/${encodeURIComponent(orderId)}/cancel`, { idempotencyKey });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Cancellation failed');\n throw err;\n }\n });\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, type OutputFormat } from '../core/output.js';\nimport { createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { attachSchemaHelp } from '../utils/cli-help.js';\nimport type { ListOrdersResponse } from '../types/api.js';\n\n/** Reserved for `--help --format json`. */\nexport const listOrdersSchema = {\n description: 'List ride orders with pagination and optional filters.',\n params: {\n page: 'number — page number (default 1)',\n 'page-size': 'number — page size (default 20)',\n status: 'OrderStatus — optional status filter',\n 'order-type': 'string — optional order type filter',\n },\n response: {\n orders: 'Order[]',\n total: 'number',\n page: 'number',\n page_size: 'number',\n },\n};\n\nexport function buildListOrdersCommand(): Command {\n const cmd = new Command('list-orders')\n .description(listOrdersSchema.description)\n .option('--page <page>', 'Page number', '1')\n .option('--page-size <size>', 'Page size', '20')\n .option('--status <status>', 'Filter by order status')\n .option('--order-type <type>', 'Filter by order type')\n .action(async (_opts, command: Command) => {\n const o = command.optsWithGlobals();\n const format: OutputFormat = o.format === 'table' ? 'table' : 'json';\n const apiKey = await PromptEngine.resolveInput(o.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Fetching orders...');\n try {\n const data = await client.get<ListOrdersResponse>('/ride/orders', {\n query: {\n page: Number(o.page),\n page_size: Number(o.pageSize),\n status: o.status,\n order_type: o.orderType,\n },\n });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Failed to fetch orders');\n throw err;\n }\n });\n\n return attachSchemaHelp(cmd, listOrdersSchema);\n}\n","import { Command } from 'commander';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { SERVICE_REGISTRY } from './registry.js';\n\n/** Reserved for `--help --format json`. */\nexport const servicesListSchema: VerbSchema = {\n description: 'List available merchant services from the registry.',\n params: {},\n response: {\n services:\n 'Service[] — each with service_id, name, provider, cli_noun, version, verbs, billing_mode',\n },\n};\n\nfunction resolveFormat(cmd: Command): OutputFormat {\n return cmd.optsWithGlobals().format === 'table' ? 'table' : 'json';\n}\n\nexport function buildServicesListCommand(): Command {\n return new Command('list')\n .description(servicesListSchema.description)\n .helpOption(false)\n .option('-h, --help', 'Show help; with --format json prints the schema')\n .action((opts: { help?: boolean }, cmd: Command) => {\n const format = resolveFormat(cmd);\n if (opts.help) {\n emitSchema(servicesListSchema, format);\n return;\n }\n const services = SERVICE_REGISTRY.map((s) => ({\n service_id: s.service_id,\n name: s.name,\n provider: s.provider,\n cli_noun: s.cli_noun,\n version: s.version,\n verbs: s.verbs.join(', '),\n billing_mode: s.billing.mode,\n }));\n emit(services, format);\n });\n}\n","/**\n * Built-in static capability registry — no backend required.\n *\n * Each entry describes a CLI-exposed service: which `cli_noun` group hosts it,\n * the verbs it offers (with one-line descriptions), the recommended call\n * `workflow`, discovery hints, and its billing mode. `services list` renders a\n * summary of these entries and `services get <service-id>` returns one in full.\n */\n\n/** Billing model for a service. This iteration only ships pay-per-call. */\nexport type BillingMode = 'pay_per_call';\n\nexport interface ServiceBilling {\n mode: BillingMode;\n}\n\nexport interface ServiceDiscovery {\n /** Command an agent can run to discover the verbs in detail. */\n help_command: string;\n}\n\nexport interface ServiceCapability {\n service_id: string;\n name: string;\n description: string;\n version: string;\n /** Upstream capability provider. */\n provider: string;\n /** Top-level CLI noun (command group) that hosts this service's verbs. */\n cli_noun: string;\n /** Verb names exposed under `cli_noun`. */\n verbs: string[];\n /** One-line description per verb, keyed by verb name. */\n verb_descriptions: Record<string, string>;\n /** Ordered call sequence; `[cancel]` is optional. */\n workflow: string[];\n /** ISO date the capability became available. */\n since: string;\n discovery: ServiceDiscovery;\n billing: ServiceBilling;\n}\n\n/** Static registry. This iteration ships a single `ride` capability. */\nexport const SERVICE_REGISTRY: ServiceCapability[] = [\n {\n service_id: 'ride',\n name: 'Ride',\n description: 'On-demand ride ordering: quote a fare, book it, poll status, and cancel.',\n version: '1.0.0',\n provider: 'elife',\n cli_noun: 'ride',\n verbs: ['quote', 'book', 'get', 'cancel', 'list-orders'],\n verb_descriptions: {\n quote: 'Request fare quotes for a ride between two points.',\n book: 'Book a ride using a quote_id returned by quote.',\n get: 'Retrieve a ride order by id (poll for status changes).',\n cancel: 'Cancel a ride order by id.',\n 'list-orders': 'List previously placed ride orders.',\n },\n workflow: ['quote', 'book', 'get (poll for status)', 'cancel (optional)'],\n since: '2026-06-01',\n discovery: { help_command: 'agenzo-merchant-cli ride --help' },\n billing: { mode: 'pay_per_call' },\n },\n];\n\n/** Look up a capability by its service_id. */\nexport function findService(serviceId: string): ServiceCapability | undefined {\n return SERVICE_REGISTRY.find((s) => s.service_id === serviceId);\n}\n","import { Command } from 'commander';\nimport { CliError, ErrorCodes } from '../core/errors.js';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { findService } from './registry.js';\n\n/** Reserved for `--help --format json`. */\nexport const serviceGetSchema: VerbSchema = {\n description: 'Retrieve a single merchant service by id, with verb and workflow detail.',\n params: {\n 'service-id': 'string — service id to retrieve',\n },\n response: {\n service_id: 'string',\n name: 'string',\n description: 'string',\n version: 'string',\n provider: 'string',\n cli_noun: 'string',\n verbs: 'string[]',\n verb_descriptions: 'Record<verb, description>',\n workflow: 'string[] — ordered steps quote→book→get(poll)→[cancel]',\n since: 'string — ISO date',\n discovery: '{ help_command: string }',\n billing: '{ mode: \"pay_per_call\" }',\n },\n};\n\nfunction resolveFormat(cmd: Command): OutputFormat {\n return cmd.optsWithGlobals().format === 'table' ? 'table' : 'json';\n}\n\nexport function buildServiceGetCommand(): Command {\n return new Command('get')\n .description(serviceGetSchema.description)\n .argument('[service-id]', 'Service id to retrieve')\n .helpOption(false)\n .option('-h, --help', 'Show help; with --format json prints the schema')\n .action((serviceId: string | undefined, opts: { help?: boolean }, cmd: Command) => {\n const format = resolveFormat(cmd);\n if (opts.help) {\n emitSchema(serviceGetSchema, format);\n return;\n }\n const service = serviceId ? findService(serviceId) : undefined;\n if (!service) {\n throw new CliError(\n ErrorCodes.SERVICE_NOT_FOUND,\n `Service '${serviceId ?? ''}' not found in the registry (SERVICE_NOT_FOUND).`,\n 'Run \"services list\" to see available services.',\n );\n }\n emit(service, format);\n });\n}\n"],"mappings":";;;AAAA,SAAS,WAAAA,gBAAe;;;ACKjB,IAAM,aAAa;AAAA,EACxB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,mBAAmB;AAAA,EACnB,gCAAgC;AAAA,EAChC,eAAe;AAAA,EACf,SAAS;AAAA,EACT,cAAc;AAAA,EACd,cAAc;AAAA,EACd,iBAAiB;AACnB;AASO,IAAM,WAAN,cAAuB,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;AACX,YAAQ,IAAI,UAAU,OAAO,WAAW,mBAAmB,QAAQ,CAAC,EAAE,CAAC;AAAA,EACzE,CAAC;AACH,SACG,QAAQ,YAAY,EACpB,YAAY,mCAAmC,EAC/C,OAAO,MAAM;AACZ,cAAU;AACV,YAAQ,IAAI,UAAU,OAAO,WAAW,qBAAqB,QAAQ,CAAC,EAAE,CAAC;AAAA,EAC3E,CAAC;AACH,SACG,QAAQ,MAAM,EACd,YAAY,gCAAgC,EAC5C,OAAO,CAAC,UAAU,QAAiB;AAClC,SAAK,EAAE,MAAM,QAAQ,EAAE,GAAGD,eAAc,GAAG,CAAC;AAAA,EAC9C,CAAC;AAGH,QAAM,OAAO,QACV,QAAQ,MAAM,EACd,YAAY,sDAAsD;AACrE,OAAK,WAAW,kBAAkB,CAAC;AACnC,OAAK,WAAW,iBAAiB,CAAC;AAClC,OAAK,WAAW,oBAAoB,CAAC;AACrC,OAAK,WAAW,mBAAmB,CAAC;AACpC,OAAK,WAAW,uBAAuB,CAAC;AAGxC,QAAM,WAAW,QAAQ,QAAQ,UAAU,EAAE,YAAY,6BAA6B;AACtF,WAAS,WAAW,yBAAyB,CAAC;AAC9C,WAAS,WAAW,uBAAuB,CAAC;AAE5C,QAAM,QAAQ,WAAW,QAAQ,IAAI;AACvC;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,MAAI,iBAAiB,UAAU;AAC7B,YAAQ,MAAM,UAAU,OAAO,SAAS,MAAM,OAAO,CAAC;AACtD,QAAI,MAAM,SAAU,SAAQ,MAAM,UAAU,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAC1E,YAAQ,KAAK,MAAM,QAAQ;AAAA,EAC7B;AACA,UAAQ;AAAA,IACN,UAAU,OAAO,SAAS,iBAAiB,QAAQ,MAAM,UAAU,8BAA8B;AAAA,EACnG;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["Command","readFileSync","join","join","readFileSync","Command","input","input","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","resolveFormat","Command","resolveFormat","Command"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/core/errors.ts","../src/core/config-manager.ts","../src/core/formatter.ts","../src/core/output.ts","../src/core/version.ts","../src/ride/quote.ts","../src/core/api-client.ts","../src/core/prompt-engine.ts","../src/utils/cli-help.ts","../src/ride/book.ts","../src/utils/idempotency.ts","../src/ride/get.ts","../src/ride/cancel.ts","../src/ride/list-orders.ts","../src/services/list.ts","../src/services/registry.ts","../src/services/get.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { CliError } from './core/errors.js';\nimport { getHost, resetHost, setHost } from './core/config-manager.js';\nimport { Formatter } from './core/formatter.js';\nimport { emit, type OutputFormat } from './core/output.js';\nimport { getCurrentVersion } from './core/version.js';\n\n// Ride command builders\nimport { buildQuoteCommand } from './ride/quote.js';\nimport { buildBookCommand } from './ride/book.js';\nimport { buildRideGetCommand } from './ride/get.js';\nimport { buildCancelCommand } from './ride/cancel.js';\nimport { buildListOrdersCommand } from './ride/list-orders.js';\n\n// Services command builders\nimport { buildServicesListCommand } from './services/list.js';\nimport { buildServiceGetCommand } from './services/get.js';\n\nfunction resolveFormat(cmd: Command): OutputFormat {\n return cmd.optsWithGlobals().format === 'table' ? 'table' : 'json';\n}\n\nasync function main(): Promise<void> {\n const program = new Command();\n program\n .name('agenzo-merchant-cli')\n .description('CLI for ordering rides and querying merchant services')\n .version(getCurrentVersion())\n .option('--format <format>', 'Output format: json|table', 'json')\n .option('--yes', 'Skip confirmation prompts (for automation/AI Agents)', false)\n .option('--api-key <key>', 'API key for runtime requests');\n\n // config group — fully implemented locally (no network)\n const config = program.command('config').description('Local API host configuration');\n config\n .command('set-host <url>')\n .description('Set the API host')\n .action((url: string) => {\n setHost(url);\n console.log(Formatter.status('success', `API host set to ${getHost()}`));\n });\n config\n .command('reset-host')\n .description('Reset the API host to the default')\n .action(() => {\n resetHost();\n console.log(Formatter.status('success', `API host reset to ${getHost()}`));\n });\n config\n .command('show')\n .description('Show the current configuration')\n .action((_options, cmd: Command) => {\n emit({ host: getHost() }, resolveFormat(cmd));\n });\n\n // ride-elife group\n const rideElife = program\n .command('ride-elife')\n .description('Ride ordering (eLife): quote, book, get, cancel, list-orders');\n rideElife.addCommand(buildQuoteCommand());\n rideElife.addCommand(buildBookCommand());\n rideElife.addCommand(buildRideGetCommand());\n rideElife.addCommand(buildCancelCommand());\n rideElife.addCommand(buildListOrdersCommand());\n\n // services group\n const services = program.command('services').description('Service registry: list, get');\n services.addCommand(buildServicesListCommand());\n services.addCommand(buildServiceGetCommand());\n\n await program.parseAsync(process.argv);\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof CliError) {\n console.error(Formatter.status('error', error.message));\n if (error.recovery) console.error(Formatter.status('info', error.recovery));\n process.exit(error.exitCode);\n }\n console.error(\n Formatter.status('error', error instanceof Error ? error.message : 'An unexpected error occurred'),\n );\n process.exit(1);\n});\n","/**\n * SCREAMING_SNAKE_CASE error codes shared across the CLI. Server-returned\n * codes are passed through verbatim; this catalog is the well-known set the\n * CLI itself raises, special-cases, or recognizes from the backend so that\n * agents (and the schema `error_recovery` blocks) never reference an orphan\n * code. Codes are grouped by origin.\n */\nexport const ErrorCodes = {\n // -- Ride/elife domain (raised by the backend, recognized here) --\n QUOTE_EXPIRED: 'QUOTE_EXPIRED',\n VEHICLE_UNAVAILABLE: 'VEHICLE_UNAVAILABLE',\n BOOKING_FAILED: 'BOOKING_FAILED',\n CANCELLATION_NOT_ALLOWED: 'CANCELLATION_NOT_ALLOWED',\n\n // -- Billing / settlement-account (monthly_settlement) --\n BILLING_MODE_MISMATCH: 'BILLING_MODE_MISMATCH',\n ACCOUNT_NOT_FOUND: 'ACCOUNT_NOT_FOUND',\n ACCOUNT_SUSPENDED: 'ACCOUNT_SUSPENDED',\n ACCOUNT_INSUFFICIENT_BALANCE: 'ACCOUNT_INSUFFICIENT_BALANCE',\n\n // -- Payment order (pay_per_call; reserved until payment-cli ships) --\n PAYMENT_ORDER_NOT_FOUND: 'PAYMENT_ORDER_NOT_FOUND',\n PAYMENT_ORDER_NOT_PAID: 'PAYMENT_ORDER_NOT_PAID',\n PAYMENT_ORDER_MISMATCH: 'PAYMENT_ORDER_MISMATCH',\n PAYMENT_ORDER_ALREADY_CONSUMED: 'PAYMENT_ORDER_ALREADY_CONSUMED',\n\n // -- Parameter / idempotency --\n PARAM_IDEMPOTENCY_KEY_REQUIRED: 'PARAM_IDEMPOTENCY_KEY_REQUIRED',\n PARAM_IDEMPOTENCY_KEY_CONFLICT: 'PARAM_IDEMPOTENCY_KEY_CONFLICT',\n\n // -- Service discovery --\n SERVICE_NOT_FOUND: 'SERVICE_NOT_FOUND',\n\n // -- CLI-local / transport --\n NETWORK_ERROR: 'NETWORK_ERROR',\n TIMEOUT: 'TIMEOUT',\n CLI_OUTDATED: 'CLI_OUTDATED',\n CONFIG_ERROR: 'CONFIG_ERROR',\n NOT_IMPLEMENTED: 'NOT_IMPLEMENTED',\n INTERNAL_ERROR: 'INTERNAL_ERROR',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/**\n * Single error type for the CLI. `code` identifies the failure class,\n * `recovery` is an optional human-readable next step, and `exitCode` lets\n * specific failures (e.g. CLI_OUTDATED) signal a distinct process exit code.\n */\nexport class CliError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly recovery?: string,\n public readonly exitCode: number = 1,\n ) {\n super(message);\n this.name = 'CliError';\n }\n}\n","/**\n * Local config persisted at ~/.agenzo-merchant-cli/config.json.\n * Only the API host is stored; everything else is runtime/flag driven.\n */\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { CliError, ErrorCodes } from './errors.js';\n\nexport const DEFAULT_HOST = 'https://agent.everonet.com';\n\nconst CONFIG_DIR = join(homedir(), '.agenzo-merchant-cli');\nconst CONFIG_PATH = join(CONFIG_DIR, 'config.json');\n\ninterface Config {\n host: string;\n}\n\nfunction read(): Config {\n let raw: string;\n try {\n raw = readFileSync(CONFIG_PATH, 'utf-8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return { host: DEFAULT_HOST };\n }\n throw error;\n }\n try {\n const parsed = JSON.parse(raw) as Partial<Config>;\n return { host: parsed.host ?? DEFAULT_HOST };\n } catch {\n throw new CliError(\n ErrorCodes.CONFIG_ERROR,\n `Invalid config file: ${CONFIG_PATH}`,\n 'Delete the file to reset to defaults.',\n );\n }\n}\n\nfunction write(config: Config): void {\n mkdirSync(CONFIG_DIR, { recursive: true });\n writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), 'utf-8');\n}\n\nexport function getHost(): string {\n return read().host;\n}\n\nexport function setHost(host: string): void {\n write({ host: host.replace(/\\/+$/, '') });\n}\n\nexport function resetHost(): void {\n write({ host: DEFAULT_HOST });\n}\n","export type StatusType = 'success' | 'error' | 'info' | 'warning';\n\nconst ICONS: Record<StatusType, string> = {\n success: '✓',\n error: '✗',\n info: 'ℹ',\n warning: '⚠',\n};\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nexport interface Spinner {\n /** Update the in-progress message. */\n update(message: string): void;\n /** Stop and clear the spinner line (no final status). */\n stop(): void;\n /** Stop and replace the line with a success status. */\n succeed(message?: string): void;\n /** Stop and replace the line with an error status. */\n fail(message?: string): void;\n}\n\n/**\n * TTY-aware progress spinner. Renders to **stderr** so that stdout stays a\n * clean payload stream (agents/scripts piping `| jq` are unaffected).\n *\n * When stderr is not a TTY (piped, redirected, CI, agent-invoked) the animation\n * is suppressed entirely — no control characters leak into logs. The optional\n * final status (`succeed`/`fail`) is still printed in that case so non-TTY\n * callers get a one-line outcome on stderr without the spinning frames.\n */\nexport function createSpinner(message: string): Spinner {\n const isTty = Boolean(process.stderr.isTTY);\n let current = message;\n\n if (!isTty) {\n return {\n update(msg: string) {\n current = msg;\n },\n stop() {},\n succeed(msg?: string) {\n if (msg) process.stderr.write(`${Formatter.status('success', msg)}\\n`);\n },\n fail(msg?: string) {\n process.stderr.write(`${Formatter.status('error', msg ?? current)}\\n`);\n },\n };\n }\n\n let frame = 0;\n const render = (): void => {\n process.stderr.write(`\\r\\x1b[K${SPINNER_FRAMES[frame]} ${current}`);\n frame = (frame + 1) % SPINNER_FRAMES.length;\n };\n render();\n const timer = setInterval(render, 80);\n\n const clear = (): void => {\n clearInterval(timer);\n process.stderr.write('\\r\\x1b[K');\n };\n\n return {\n update(msg: string) {\n current = msg;\n },\n stop() {\n clear();\n },\n succeed(msg?: string) {\n clear();\n if (msg) process.stderr.write(`${Formatter.status('success', msg)}\\n`);\n },\n fail(msg?: string) {\n clear();\n process.stderr.write(`${Formatter.status('error', msg ?? current)}\\n`);\n },\n };\n}\n\nfunction stringify(value: unknown): string {\n if (value === null || value === undefined) return '';\n if (typeof value === 'object') return JSON.stringify(value);\n return String(value);\n}\n\nexport class Formatter {\n /** Status-prefixed line, e.g. \"✓ done\". */\n static status(type: StatusType, message: string): string {\n return `${ICONS[type]} ${message}`;\n }\n\n /** Aligned columnar table for list output. */\n static table(headers: string[], rows: string[][]): string {\n const widths = headers.map((h, i) =>\n Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)),\n );\n const line = (cells: string[]): string =>\n cells.map((c, i) => (c ?? '').padEnd(widths[i])).join(' ');\n return [\n line(headers),\n widths.map((w) => '-'.repeat(w)).join(' '),\n ...rows.map(line),\n ].join('\\n');\n }\n\n /** Key-value detail output with left-aligned keys. */\n static keyValue(entries: [string, string][]): string {\n const width = Math.max(0, ...entries.map(([k]) => k.length));\n return entries.map(([k, v]) => `${k.padEnd(width)} ${v}`).join('\\n');\n }\n\n /** Best-effort human-readable rendering of arbitrary data. */\n static auto(data: unknown): string {\n if (Array.isArray(data)) {\n return Formatter.arrayTable(data);\n }\n if (data && typeof data === 'object') {\n const obj = data as Record<string, unknown>;\n const scalarEntries: [string, string][] = [];\n const tableSections: string[] = [];\n for (const [k, v] of Object.entries(obj)) {\n // Render an array-of-objects value as its own labelled sub-table\n // instead of dumping raw JSON on a key-value line.\n if (Array.isArray(v) && v.some((i) => i && typeof i === 'object')) {\n tableSections.push(`${k}:\\n${Formatter.arrayTable(v)}`);\n } else {\n scalarEntries.push([k, stringify(v)]);\n }\n }\n const parts: string[] = [];\n if (scalarEntries.length) parts.push(Formatter.keyValue(scalarEntries));\n parts.push(...tableSections);\n return parts.join('\\n\\n');\n }\n return stringify(data);\n }\n\n /** Render an array of objects as an aligned table; falls back gracefully. */\n private static arrayTable(items: unknown[]): string {\n if (items.length === 0) return '(empty)';\n const rows = items.filter(\n (i): i is Record<string, unknown> => Boolean(i) && typeof i === 'object',\n );\n if (rows.length === 0) {\n return items.map((i) => stringify(i)).join(', ');\n }\n const headers = Object.keys(rows[0]);\n return Formatter.table(\n headers,\n rows.map((r) => headers.map((h) => stringify(r[h]))),\n );\n }\n}\n","import { Formatter } from './formatter.js';\n\nexport type OutputFormat = 'json' | 'table';\n\n/** Schema descriptor a verb reserves for `--help --format json`. */\nexport interface VerbSchema {\n description: string;\n params: Record<string, string>;\n response: Record<string, string>;\n}\n\n/** Emit a result payload in the requested format (json default, table via Formatter). */\nexport function emit(data: unknown, format: OutputFormat = 'json'): void {\n if (format === 'table') {\n console.log(Formatter.auto(data));\n } else {\n console.log(JSON.stringify(data, null, 2));\n }\n}\n\n/**\n * Emit one NDJSON record (a single-line JSON object terminated by a newline)\n * to stdout. Used by streaming/polling commands (`ride-elife get --watch`):\n * each poll result is written as its own line so an agent can consume the\n * stream incrementally with a line reader. Always compact (no pretty-print),\n * regardless of `--format`, because NDJSON requires one object per line.\n */\nexport function emitNdjsonLine(data: unknown): void {\n console.log(JSON.stringify(data));\n}\n\n/** Helper for `--help --format json`: print a verb's param/response schema. */\nexport function emitSchema(schema: VerbSchema, format: OutputFormat = 'json'): void {\n if (format === 'table') {\n console.log(Formatter.keyValue(Object.entries(schema.params)));\n } else {\n console.log(JSON.stringify(schema, null, 2));\n }\n}\n","/**\n * CLI version source-of-truth + server-driven min-version negotiation.\n *\n * The running version is read from `package.json` at runtime (it lives outside\n * `rootDir`, so we read it via fs rather than importing it to keep `tsc` happy).\n * The server advertises the floor via the `X-CLI-Min-Version` response header;\n * if the local version is below it we throw CLI_OUTDATED and exit with code 2.\n */\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { CliError, ErrorCodes } from './errors.js';\n\nexport const UPGRADE_COMMAND = 'npm install -g agenzo-merchant-cli@latest';\n\nconst FALLBACK_VERSION = '0.1.0';\n\nlet cached: string | null = null;\n\nexport function getCurrentVersion(): string {\n if (cached !== null) return cached;\n const here = dirname(fileURLToPath(import.meta.url));\n // Both the bundled (dist/index.js) and source layouts resolve to package.json.\n const candidates = [\n join(here, '..', 'package.json'),\n join(here, '..', '..', 'package.json'),\n ];\n for (const p of candidates) {\n try {\n const pkg = JSON.parse(readFileSync(p, 'utf-8')) as { version?: string };\n if (typeof pkg.version === 'string') {\n cached = pkg.version;\n return cached;\n }\n } catch {\n // try the next candidate\n }\n }\n cached = FALLBACK_VERSION;\n return cached;\n}\n\n/** Returns negative / zero / positive comparing `a` against `b` (major.minor.patch). */\nexport function compareVersion(a: string, b: string): number {\n const parse = (v: string): number[] =>\n v\n .trim()\n .replace(/^v/, '')\n .split(/[-+]/)[0]\n .split('.')\n .map((n) => parseInt(n, 10) || 0);\n const pa = parse(a);\n const pb = parse(b);\n for (let i = 0; i < 3; i++) {\n const diff = (pa[i] ?? 0) - (pb[i] ?? 0);\n if (diff !== 0) return diff;\n }\n return 0;\n}\n\n/** Throw CLI_OUTDATED (exit code 2) when the local version is below the header floor. */\nexport function enforceMinVersion(header: string | null): void {\n const min = header?.trim();\n if (!min) return;\n const current = getCurrentVersion();\n if (compareVersion(current, min) < 0) {\n throw new CliError(\n ErrorCodes.CLI_OUTDATED,\n `CLI ${current} is below the required minimum ${min}.`,\n `Upgrade: ${UPGRADE_COMMAND}`,\n 2,\n );\n }\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { CliError } from '../core/errors.js';\nimport { emit, type OutputFormat } from '../core/output.js';\nimport { createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { attachSchemaHelp } from '../utils/cli-help.js';\nimport type { QuoteResponse } from '../types/api.js';\n\n/** Reserved for `--help --format json`. */\nexport const quoteSchema = {\n description: 'Request fare quotes for a ride between two points.',\n params: {\n 'pickup-lat': 'number — pickup latitude',\n 'pickup-lng': 'number — pickup longitude',\n 'pickup-name': 'string — pickup location name',\n 'dropoff-lat': 'number — dropoff latitude',\n 'dropoff-lng': 'number — dropoff longitude',\n 'dropoff-name': 'string — dropoff location name',\n 'pickup-time': 'number|string — epoch seconds, or \"now\"',\n 'passenger-name': 'string — optional, lead passenger full name',\n 'passenger-phone': 'string — optional, passenger phone in E.164 format',\n 'passenger-count': 'number — optional passenger count',\n 'luggage-count': 'number — optional luggage count',\n 'passenger-email': 'string — optional passenger email',\n 'children-count': 'number — optional children count',\n },\n response: {\n vehicle_classes:\n 'VehicleClass[] — each: vehicle_class, price{amount,currency,quote_id}, passenger_capacity, luggage_capacity (amount is a decimal in the currency standard unit, e.g. 42.50 = $42.50)',\n meet_and_greet: 'object|null — { available: boolean, price: { amount, currency } } when applicable',\n is_airport_transfer: 'boolean',\n airport_direction: 'string|null — pickup/dropoff direction for airport transfers',\n },\n};\n\nfunction need(value: string | undefined, flag: string): string {\n if (value === undefined) throw new CliError('PARAM_REQUIRED', `Missing required --${flag}.`);\n return value;\n}\n\nfunction num(value: string | undefined, flag: string): number {\n const n = Number(need(value, flag));\n if (!Number.isFinite(n)) throw new CliError('PARAM_INVALID', `--${flag} must be a number.`);\n return n;\n}\n\nexport function buildQuoteCommand(): Command {\n const cmd = new Command('quote')\n .description(quoteSchema.description)\n .option('--pickup-lat <lat>', 'Pickup latitude')\n .option('--pickup-lng <lng>', 'Pickup longitude')\n .option('--pickup-name <name>', 'Pickup location name')\n .option('--dropoff-lat <lat>', 'Dropoff latitude')\n .option('--dropoff-lng <lng>', 'Dropoff longitude')\n .option('--dropoff-name <name>', 'Dropoff location name')\n .option('--pickup-time <time>', 'Pickup time: epoch seconds, or \"now\"')\n .option('--passenger-name <name>', 'Lead passenger full name')\n .option('--passenger-phone <phone>', 'Passenger phone (E.164)')\n .option('--passenger-count <n>', 'Passenger count')\n .option('--luggage-count <n>', 'Luggage count')\n .option('--passenger-email <email>', 'Passenger email')\n .option('--children-count <n>', 'Children count')\n .action(async (_opts, command: Command) => {\n const o = command.optsWithGlobals();\n const format: OutputFormat = o.format === 'table' ? 'table' : 'json';\n const apiKey = await PromptEngine.resolveInput(o.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n\n const body: Record<string, unknown> = {\n pickup: {\n lat: num(o.pickupLat, 'pickup-lat'),\n lng: num(o.pickupLng, 'pickup-lng'),\n name: need(o.pickupName, 'pickup-name'),\n },\n dropoff: {\n lat: num(o.dropoffLat, 'dropoff-lat'),\n lng: num(o.dropoffLng, 'dropoff-lng'),\n name: need(o.dropoffName, 'dropoff-name'),\n },\n pickup_time: o.pickupTime === 'now' ? 'now' : num(o.pickupTime, 'pickup-time'),\n };\n if (o.passengerName) body.passenger_name = o.passengerName;\n if (o.passengerPhone) body.passenger_phone = o.passengerPhone;\n if (o.passengerCount !== undefined) body.passenger_count = num(o.passengerCount, 'passenger-count');\n if (o.luggageCount !== undefined) body.luggage_count = num(o.luggageCount, 'luggage-count');\n if (o.childrenCount !== undefined) body.children_count = num(o.childrenCount, 'children-count');\n if (o.passengerEmail !== undefined) body.passenger_email = o.passengerEmail;\n\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Fetching quotes...');\n try {\n const data = await client.post<QuoteResponse>('/ride/quote', { body });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Quote request failed');\n throw err;\n }\n });\n\n return attachSchemaHelp(cmd, quoteSchema);\n}\n","/**\n * HTTPS client for the ride/services API.\n *\n * - base = configured host; ride endpoints live under the `/api/v3/agent-pay` prefix\n * - auth via `X-Api-Key` header\n * - write operations may carry an `Idempotency-Key` header (never in the body)\n * - unwraps the v3 envelope `{ code, message, data }`: returns `data` on\n * success (code \"0000\"), throws CliError (server code/message) on failure\n * - negotiates the CLI version floor via the `X-CLI-Min-Version` header\n * - maps connection/timeout failures to NETWORK_ERROR / TIMEOUT\n */\nimport { CliError, ErrorCodes } from './errors.js';\nimport { getHost } from './config-manager.js';\nimport { enforceMinVersion, getCurrentVersion } from './version.js';\n\nconst RIDE_PREFIX = '/api/v3/agent-pay';\n\nexport interface ApiClientOptions {\n apiKey: string;\n host?: string;\n timeout?: number;\n}\n\nexport interface RequestOptions {\n body?: Record<string, unknown>;\n idempotencyKey?: string;\n query?: Record<string, string | number | boolean | undefined>;\n}\n\ninterface Envelope<T> {\n code?: string;\n message?: string;\n data?: T;\n}\n\nexport class ApiClient {\n private readonly host: string;\n private readonly apiKey: string;\n private readonly timeout: number;\n\n constructor(options: ApiClientOptions) {\n this.apiKey = options.apiKey;\n this.host = (options.host ?? getHost()).replace(/\\/+$/, '');\n this.timeout = options.timeout ?? 30000;\n }\n\n get<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('GET', path, options);\n }\n\n post<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('POST', path, options);\n }\n\n private async request<T>(\n method: string,\n path: string,\n options: RequestOptions,\n ): Promise<T> {\n let url = `${this.host}${RIDE_PREFIX}${path}`;\n if (options.query) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined) params.set(key, String(value));\n }\n const qs = params.toString();\n if (qs) url += `?${qs}`;\n }\n\n const headers: Record<string, string> = {\n 'X-Api-Key': this.apiKey,\n 'User-Agent': `agenzo-merchant-cli/${getCurrentVersion()}`,\n };\n if (options.body) headers['Content-Type'] = 'application/json';\n if (options.idempotencyKey) headers['Idempotency-Key'] = options.idempotencyKey;\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n let response: Response;\n try {\n response = await fetch(url, {\n method,\n headers,\n body: options.body ? JSON.stringify(options.body) : undefined,\n signal: controller.signal,\n });\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n throw new CliError(\n ErrorCodes.TIMEOUT,\n `Request timed out after ${this.timeout}ms: ${url}`,\n 'Retry, or check your network connection.',\n );\n }\n throw new CliError(\n ErrorCodes.NETWORK_ERROR,\n `Network request failed: ${url}`,\n 'Check your network connection and the configured API host.',\n );\n } finally {\n clearTimeout(timer);\n }\n\n // Enforce the server-advertised version floor before reading the body.\n enforceMinVersion(response.headers.get('x-cli-min-version'));\n\n const text = await response.text();\n let envelope: Envelope<T>;\n try {\n envelope = JSON.parse(text) as Envelope<T>;\n } catch {\n throw new CliError(\n ErrorCodes.NETWORK_ERROR,\n `Unexpected non-JSON response (HTTP ${response.status}) from ${url}`,\n );\n }\n\n if (envelope.code !== undefined && envelope.code !== '0000') {\n const code = envelope.code;\n const message = envelope.message ?? `Request failed (HTTP ${response.status})`;\n throw new CliError(code, message);\n }\n\n return envelope.data as T;\n }\n}\n","import { confirm, input, password, select } from '@inquirer/prompts';\n\nexport interface ResolveOptions {\n message: string;\n type?: 'input' | 'password' | 'select';\n choices?: { name: string; value: string }[];\n validate?: (value: string) => boolean | string;\n}\n\n/**\n * Interactive resolution for missing required parameters (api-key,\n * idempotency-key, etc.). When a flag value is supplied it is returned as-is.\n */\nexport class PromptEngine {\n static async resolveInput(\n flagValue: string | undefined,\n options: ResolveOptions,\n ): Promise<string> {\n if (flagValue !== undefined) return flagValue;\n if (options.type === 'password') {\n return password({ message: options.message, mask: '*' });\n }\n if (options.type === 'select' && options.choices) {\n return select({ message: options.message, choices: options.choices });\n }\n return input({ message: options.message, validate: options.validate });\n }\n\n /** Confirmation prompt; auto-approves when `--yes` is set. */\n static async confirm(message: string, yes: boolean): Promise<boolean> {\n if (yes) return true;\n return confirm({ message });\n }\n}\n","/**\n * `--help --format <fmt>` support shared by the read-only verbs.\n *\n * Commander processes `--help` before later argv tokens, so the resolved\n * `--format` option is not yet available when help renders. We therefore read\n * the format directly from `process.argv`: when it is explicitly `json`/`table`\n * we print the verb schema (via emitSchema) instead of the usage text, and let\n * commander render the default help otherwise.\n */\nimport type { Command } from 'commander';\nimport { emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\n\nfunction explicitFormat(): OutputFormat | undefined {\n const argv = process.argv;\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i];\n if (a === '--format=json' || (a === '--format' && argv[i + 1] === 'json')) return 'json';\n if (a === '--format=table' || (a === '--format' && argv[i + 1] === 'table')) return 'table';\n }\n return undefined;\n}\n\n/** Print `schema` for `--help --format json|table`; otherwise default usage. */\nexport function attachSchemaHelp(cmd: Command, schema: VerbSchema): Command {\n const baseHelp = cmd.helpInformation.bind(cmd);\n cmd.helpInformation = (ctx) => {\n const format = explicitFormat();\n if (!format) return baseHelp(ctx);\n emitSchema(schema, format);\n return '';\n };\n return cmd;\n}\n","/*\n * Booking funding is decided server-side by the developer's billing_mode:\n * - monthly_settlement: no payment handle; fare is deducted from the\n * developer's settlement account (payment_status=ON_ACCOUNT).\n * - pay_per_call: pass --payment-order-id (a PAID order from payment-cli).\n * Reserved — gated server-side until payment-cli ships (BACK-040).\n * The CLI no longer accepts --payment-method-id (the merchant domain never\n * holds a payment credential).\n */\nimport { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { Formatter, createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { resolveIdempotencyKey } from '../utils/idempotency.js';\n\n/** Reserved for `--help --format json`. */\nexport const bookSchema: VerbSchema = {\n description: 'Book a ride against a previously returned quote.',\n params: {\n 'quote-id': 'string — required, quote id from `ride-elife quote`',\n 'vehicle-class': 'string — required, chosen vehicle class',\n 'price-amount': 'number — required, fare in decimal currency units (not cents)',\n 'price-currency': 'string — currency code (default USD)',\n 'payment-order-id': 'string — conditional. Required for pay_per_call billing (a PAID order from payment-cli); omit for monthly_settlement (deducted from the settlement account)',\n 'passenger-name': 'string — required, passenger full name',\n 'passenger-phone': 'string — required, passenger phone',\n 'passenger-email': 'string — optional passenger email',\n 'luggage-count': 'number — optional luggage count',\n 'special-requests': 'string — optional free-text requests',\n 'pickup-lat': 'number — required, pickup latitude',\n 'pickup-lng': 'number — required, pickup longitude',\n 'pickup-name': 'string — required, pickup location name',\n 'dropoff-lat': 'number — required, dropoff latitude',\n 'dropoff-lng': 'number — required, dropoff longitude',\n 'dropoff-name': 'string — required, dropoff location name',\n 'pickup-time': 'number|string — required, epoch seconds or \"now\" (must match quote)',\n 'meet-and-greet': 'boolean — optional meet & greet service',\n 'meet-and-greet-price': 'number — optional meet & greet surcharge',\n 'welcome-sign': 'string — optional welcome sign text',\n 'child-seat-count': 'number — optional child seats (0-5)',\n 'infant-seat-count': 'number — optional infant seats (0-5)',\n 'toddler-seat-count': 'number — optional toddler seats (0-5)',\n 'arrival-flight-no': 'string — optional arrival flight number',\n 'arrival-airline': 'string — optional arrival airline',\n 'departure-flight-no': 'string — optional departure flight number',\n 'departure-airline': 'string — optional departure airline',\n 'idempotency-key': 'string — required, sent as the Idempotency-Key header (never in body)',\n },\n response: {\n ride_id: 'string — booked ride id, used by `ride-elife get` / `ride-elife cancel`',\n order_id: 'string — internal ride order id (rio_...)',\n status: 'string — initial ride status (e.g. INIT / Pending)',\n is_scheduled: 'boolean — true = scheduled/airport ride, false = realtime',\n order_type: 'string — realtime / airport (derived from pickup-time)',\n price: '{ amount, currency, quote_id } — confirmed fare',\n payment_status: 'string — ON_ACCOUNT (monthly_settlement) or PAID (pay_per_call)',\n billing_entry_id: 'string — settlement ledger entry id (monthly_settlement only)',\n },\n};\n\nexport function buildBookCommand(): Command {\n return new Command('book')\n .description(bookSchema.description)\n .helpOption(false)\n .option('--help', 'Show help (add --format json for the machine-readable schema)')\n .option('--format <format>', 'Output format: json|table')\n .option('--api-key <key>', 'API key for runtime requests')\n .option('--yes', 'Skip confirmation prompts')\n .option('--quote-id <id>', 'Quote id from `ride-elife quote`')\n .option('--vehicle-class <class>', 'Chosen vehicle class')\n .option('--price-amount <amount>', 'Fare in decimal currency units (not cents)')\n .option('--price-currency <currency>', 'Currency code (default USD)')\n .option('--payment-order-id <id>', 'Paid payment order id (pay_per_call mode only)')\n .option('--passenger-name <name>', 'Passenger full name')\n .option('--passenger-phone <phone>', 'Passenger phone')\n .option('--passenger-email <email>', 'Passenger email')\n .option('--luggage-count <n>', 'Luggage count')\n .option('--special-requests <text>', 'Free-text special requests')\n .option('--pickup-lat <lat>', 'Pickup latitude')\n .option('--pickup-lng <lng>', 'Pickup longitude')\n .option('--pickup-name <name>', 'Pickup location name')\n .option('--dropoff-lat <lat>', 'Dropoff latitude')\n .option('--dropoff-lng <lng>', 'Dropoff longitude')\n .option('--dropoff-name <name>', 'Dropoff location name')\n .option('--pickup-time <time>', 'Pickup time: epoch seconds, or \"now\"')\n .option('--meet-and-greet', 'Enable meet & greet service')\n .option('--meet-and-greet-price <amount>', 'Meet & greet surcharge')\n .option('--welcome-sign <text>', 'Welcome sign text')\n .option('--child-seat-count <n>', 'Number of child seats needed')\n .option('--infant-seat-count <n>', 'Number of infant seats needed')\n .option('--toddler-seat-count <n>', 'Number of toddler seats needed')\n .option('--arrival-flight-no <no>', 'Arrival flight number')\n .option('--arrival-airline <airline>', 'Arrival airline')\n .option('--departure-flight-no <no>', 'Departure flight number')\n .option('--departure-airline <airline>', 'Departure airline')\n .option('--idempotency-key <key>', 'Caller-supplied idempotency key')\n .action(async (_options, command: Command) => {\n const merged = command.optsWithGlobals();\n const format: OutputFormat = merged.format === 'table' ? 'table' : 'json';\n\n if (merged.help) {\n const wantsSchema = process.argv.some((a) => a === '--format' || a.startsWith('--format='));\n if (wantsSchema) emitSchema(bookSchema, format);\n else command.outputHelp();\n return;\n }\n\n const yes = merged.yes === true;\n const apiKey = await PromptEngine.resolveInput(merged.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n const quoteId = await PromptEngine.resolveInput(merged.quoteId, { message: 'Quote id:' });\n const vehicleClass = await PromptEngine.resolveInput(merged.vehicleClass, {\n message: 'Vehicle class:',\n });\n const priceAmount = await PromptEngine.resolveInput(merged.priceAmount, {\n message: 'Price amount (decimal):',\n });\n const passengerName = await PromptEngine.resolveInput(merged.passengerName, {\n message: 'Passenger name:',\n });\n const passengerPhone = await PromptEngine.resolveInput(merged.passengerPhone, {\n message: 'Passenger phone:',\n });\n\n const body: Record<string, unknown> = {\n quote_id: quoteId,\n vehicle_class: vehicleClass,\n price_amount: Number(priceAmount),\n price_currency: merged.priceCurrency ?? 'USD',\n passenger_name: passengerName,\n passenger_phone: passengerPhone,\n };\n // Funding is decided server-side by the developer's billing_mode:\n // - monthly_settlement: no payment handle (deducted from the account)\n // - pay_per_call: --payment-order-id (a PAID order from payment-cli)\n // Both flags are optional here; the backend rejects the wrong one.\n if (merged.paymentOrderId) body.payment_order_id = merged.paymentOrderId;\n if (merged.passengerEmail) body.passenger_email = merged.passengerEmail;\n if (merged.luggageCount !== undefined) body.luggage_count = Number(merged.luggageCount);\n if (merged.specialRequests) body.special_requests = merged.specialRequests;\n if (merged.pickupLat || merged.pickupLng || merged.pickupName) {\n body.pickup = { lat: Number(merged.pickupLat), lng: Number(merged.pickupLng), name: merged.pickupName };\n }\n if (merged.dropoffLat || merged.dropoffLng || merged.dropoffName) {\n body.dropoff = { lat: Number(merged.dropoffLat), lng: Number(merged.dropoffLng), name: merged.dropoffName };\n }\n if (merged.pickupTime) {\n body.pickup_time = merged.pickupTime === 'now' ? 'now' : Number(merged.pickupTime);\n }\n if (merged.meetAndGreet) body.meet_and_greet = true;\n if (merged.meetAndGreetPrice !== undefined) body.meet_and_greet_price = Number(merged.meetAndGreetPrice);\n if (merged.welcomeSign) body.welcome_sign = merged.welcomeSign;\n if (merged.childSeatCount !== undefined) body.child_seat_count = Number(merged.childSeatCount);\n if (merged.infantSeatCount !== undefined) body.infant_seat_count = Number(merged.infantSeatCount);\n if (merged.toddlerSeatCount !== undefined) body.toddler_seat_count = Number(merged.toddlerSeatCount);\n if (merged.arrivalFlightNo || merged.arrivalAirline) {\n body.arrival_flight = { flight_no: merged.arrivalFlightNo, airline: merged.arrivalAirline };\n }\n if (merged.departureFlightNo || merged.departureAirline) {\n body.departure_flight = { flight_no: merged.departureFlightNo, airline: merged.departureAirline };\n }\n\n if (!(await PromptEngine.confirm(`Book ride with quote ${quoteId}?`, yes))) {\n console.log(Formatter.status('info', 'Booking aborted.'));\n return;\n }\n\n const idempotencyKey = await resolveIdempotencyKey(merged.idempotencyKey, { yes });\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Booking ride...');\n try {\n const data = await client.post('/ride/book', { body, idempotencyKey });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Booking failed');\n throw err;\n }\n });\n}\n","import { input } from '@inquirer/prompts';\nimport { CliError, ErrorCodes } from '../core/errors.js';\n\nconst KEY_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\nconst RULE = 'Use 1-128 characters from [A-Za-z0-9_-].';\n\n/** Validate + normalize a caller-supplied idempotency key. */\nexport function normalizeIdempotencyKey(key: string): string {\n const trimmed = key.trim();\n if (!KEY_PATTERN.test(trimmed)) {\n throw new CliError(\n ErrorCodes.PARAM_IDEMPOTENCY_KEY_REQUIRED,\n `Invalid idempotency key: \"${key}\".`,\n RULE,\n );\n }\n return trimmed;\n}\n\n/**\n * Resolve the idempotency key for a write operation. The CLI never generates\n * one: if absent and `--yes` is set it is a hard error, otherwise we prompt.\n */\nexport async function resolveIdempotencyKey(\n flagValue: string | undefined,\n options: { yes?: boolean },\n): Promise<string> {\n if (flagValue !== undefined) return normalizeIdempotencyKey(flagValue);\n if (options.yes) {\n throw new CliError(\n ErrorCodes.PARAM_IDEMPOTENCY_KEY_REQUIRED,\n 'An idempotency key is required for write operations.',\n 'Pass --idempotency-key <key>; the CLI never auto-generates one.',\n );\n }\n const entered = await input({\n message: 'Idempotency key:',\n validate: (v) => KEY_PATTERN.test(v.trim()) || RULE,\n });\n return normalizeIdempotencyKey(entered);\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, emitNdjsonLine, type OutputFormat } from '../core/output.js';\nimport { createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { attachSchemaHelp } from '../utils/cli-help.js';\nimport type { GetOrderResponse } from '../types/api.js';\n\n/**\n * Terminal ride statuses (schema `polling.terminal_statuses`). Once the order\n * reaches one of these, `--watch` stops polling. Case-sensitive — must match\n * the server casing exactly.\n */\nconst TERMINAL_STATUSES: ReadonlySet<string> = new Set([\n 'At destination',\n 'Cancelled',\n 'Rejected',\n 'Customer no show',\n 'Driver no show',\n]);\n\n/** Schema `polling.recommended_interval_seconds`. */\nconst DEFAULT_WATCH_INTERVAL_SECONDS = 5;\n/** Safety cap so `--watch` can never poll forever. */\nconst DEFAULT_WATCH_TIMEOUT_SECONDS = 600;\n\n/** Reserved for `--help --format json`. */\nexport const rideGetSchema = {\n description: 'Retrieve a single ride order status by id (repeatable for polling).',\n params: {\n 'order-id': 'string — ride order id (the ride_id returned by `ride-elife book`)',\n watch:\n 'boolean — poll until a terminal status, emitting one NDJSON line per update (default off)',\n 'watch-interval': `number — seconds between polls when --watch is set (default ${DEFAULT_WATCH_INTERVAL_SECONDS})`,\n 'watch-timeout': `number — max seconds to poll before giving up (default ${DEFAULT_WATCH_TIMEOUT_SECONDS})`,\n },\n response: {\n status:\n 'OrderStatus — case-sensitive; terminal states: At destination | Cancelled | Rejected | Customer no show | Driver no show',\n from_location: 'GeoPoint — pickup',\n to_location: 'GeoPoint — dropoff',\n pickup_time: 'number|string',\n vehicle_class: 'string',\n price: 'Price{amount,currency} — amount is a decimal in the currency standard unit',\n final_amount: 'number — final settled fare (realtime, after final-fare settlement); local-cache path only',\n final_settlement_status: 'string — pending | settled | no_adjustment | settlement_pending | not_applicable (local-cache path)',\n passenger: 'Passenger',\n driver: 'Driver — present after assignment',\n vehicle: 'Vehicle — present after assignment',\n },\n};\n\nfunction num(value: string | undefined, fallback: number): number {\n if (value === undefined) return fallback;\n const n = Number(value);\n return Number.isFinite(n) && n > 0 ? n : fallback;\n}\n\nconst sleep = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms));\n\nfunction statusOf(data: GetOrderResponse): string | undefined {\n return (data as { status?: string }).status;\n}\n\nexport function buildRideGetCommand(): Command {\n const cmd = new Command('get')\n .description(rideGetSchema.description)\n .option('--order-id <id>', 'Ride order id (the ride_id returned by `ride-elife book`)')\n .option('--watch', 'Poll until a terminal status, emitting one NDJSON line per update')\n .option('--watch-interval <seconds>', 'Seconds between polls when --watch is set')\n .option('--watch-timeout <seconds>', 'Max seconds to poll before giving up')\n .action(async (_opts, command: Command) => {\n const o = command.optsWithGlobals();\n const format: OutputFormat = o.format === 'table' ? 'table' : 'json';\n const apiKey = await PromptEngine.resolveInput(o.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n const orderId = await PromptEngine.resolveInput(o.orderId, { message: 'Order id:' });\n const client = new ApiClient({ apiKey });\n const path = `/ride/${encodeURIComponent(orderId)}/status`;\n\n if (o.watch) {\n await watchUntilTerminal(client, path, {\n intervalMs: num(o.watchInterval, DEFAULT_WATCH_INTERVAL_SECONDS) * 1000,\n timeoutMs: num(o.watchTimeout, DEFAULT_WATCH_TIMEOUT_SECONDS) * 1000,\n });\n return;\n }\n\n const spinner = createSpinner('Fetching ride status...');\n try {\n const data = await client.get<GetOrderResponse>(path);\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Failed to fetch ride status');\n throw err;\n }\n });\n\n return attachSchemaHelp(cmd, rideGetSchema);\n}\n\n/**\n * Poll the status endpoint, writing each result as an NDJSON line on stdout\n * until the order reaches a terminal status or the timeout elapses. Progress\n * is the NDJSON stream itself, so no spinner is shown (stdout stays a clean\n * line stream an agent can consume incrementally). A network/backend error\n * propagates to the top-level handler exactly like the single-shot path.\n */\nasync function watchUntilTerminal(\n client: ApiClient,\n path: string,\n opts: { intervalMs: number; timeoutMs: number },\n): Promise<void> {\n const deadline = Date.now() + opts.timeoutMs;\n for (;;) {\n const data = await client.get<GetOrderResponse>(path);\n emitNdjsonLine(data);\n\n const status = statusOf(data);\n if (status !== undefined && TERMINAL_STATUSES.has(status)) return;\n\n if (Date.now() + opts.intervalMs >= deadline) {\n emitNdjsonLine({\n watch_status: 'timeout',\n message: `Polling stopped after ${opts.timeoutMs / 1000}s without reaching a terminal status.`,\n last_status: status ?? null,\n });\n return;\n }\n await sleep(opts.intervalMs);\n }\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { Formatter, createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { resolveIdempotencyKey } from '../utils/idempotency.js';\n\n/** Reserved for `--help --format json`. */\nexport const cancelSchema: VerbSchema = {\n description: 'Cancel a ride order; may incur a cancellation fee.',\n params: {\n 'order-id': 'string — required, order id (a.k.a. ride id) to cancel',\n 'idempotency-key': 'string — required, sent as the Idempotency-Key header (never in body)',\n },\n response: {\n ride_id: 'string — cancelled ride id',\n ride_stat: 'string — resulting ride status',\n cancellation: '{ cancellation_fee, reversal_amount, currency }',\n refund_amount: 'number — amount credited back to the settlement balance (paid − cancellation_fee)',\n },\n};\n\nexport function buildCancelCommand(): Command {\n return new Command('cancel')\n .description(cancelSchema.description)\n .helpOption(false)\n .option('--help', 'Show help (add --format json for the machine-readable schema)')\n .option('--format <format>', 'Output format: json|table')\n .option('--api-key <key>', 'API key for runtime requests')\n .option('--yes', 'Skip confirmation prompts')\n .option('--order-id <id>', 'Order id (a.k.a. ride id) to cancel')\n .option('--idempotency-key <key>', 'Caller-supplied idempotency key')\n .action(async (_options, command: Command) => {\n const merged = command.optsWithGlobals();\n const format: OutputFormat = merged.format === 'table' ? 'table' : 'json';\n\n if (merged.help) {\n const wantsSchema = process.argv.some((a) => a === '--format' || a.startsWith('--format='));\n if (wantsSchema) emitSchema(cancelSchema, format);\n else command.outputHelp();\n return;\n }\n\n const yes = merged.yes === true;\n const apiKey = await PromptEngine.resolveInput(merged.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n const orderId = await PromptEngine.resolveInput(merged.orderId, { message: 'Order id:' });\n\n if (!(await PromptEngine.confirm(`Cancel order ${orderId}? This may incur a fee.`, yes))) {\n console.log(Formatter.status('info', 'Cancellation aborted.'));\n return;\n }\n\n const idempotencyKey = await resolveIdempotencyKey(merged.idempotencyKey, { yes });\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Cancelling ride...');\n try {\n const data = await client.post(`/ride/${encodeURIComponent(orderId)}/cancel`, { idempotencyKey });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Cancellation failed');\n throw err;\n }\n });\n}\n","import { Command } from 'commander';\nimport { ApiClient } from '../core/api-client.js';\nimport { emit, type OutputFormat } from '../core/output.js';\nimport { createSpinner } from '../core/formatter.js';\nimport { PromptEngine } from '../core/prompt-engine.js';\nimport { attachSchemaHelp } from '../utils/cli-help.js';\nimport type { ListOrdersResponse } from '../types/api.js';\n\n/** Reserved for `--help --format json`. */\nexport const listOrdersSchema = {\n description: 'List ride orders with pagination and optional filters.',\n params: {\n page: 'number — page number (default 1)',\n 'page-size': 'number — page size (default 20)',\n status: 'OrderStatus — optional status filter',\n 'order-type': 'string — optional order type filter',\n },\n response: {\n orders:\n 'RideOrderListItem[] — each: order_id, ride_id, status, vehicle_class, is_scheduled, scheduled_at, price_amount, final_amount, price_currency, payment_status, final_settlement_status (pending|settled|no_adjustment|settlement_pending|not_applicable), cancellation_fee, provider, created_at, updated_at',\n total: 'number',\n page: 'number',\n page_size: 'number',\n },\n};\n\nexport function buildListOrdersCommand(): Command {\n const cmd = new Command('list-orders')\n .description(listOrdersSchema.description)\n .option('--page <page>', 'Page number', '1')\n .option('--page-size <size>', 'Page size', '20')\n .option('--status <status>', 'Filter by order status')\n .option('--order-type <type>', 'Filter by order type')\n .action(async (_opts, command: Command) => {\n const o = command.optsWithGlobals();\n const format: OutputFormat = o.format === 'table' ? 'table' : 'json';\n const apiKey = await PromptEngine.resolveInput(o.apiKey, {\n message: 'API key:',\n type: 'password',\n });\n\n const client = new ApiClient({ apiKey });\n const spinner = createSpinner('Fetching orders...');\n try {\n const data = await client.get<ListOrdersResponse>('/ride/orders', {\n query: {\n page: Number(o.page),\n page_size: Number(o.pageSize),\n status: o.status,\n order_type: o.orderType,\n },\n });\n spinner.stop();\n emit(data, format);\n } catch (err) {\n spinner.fail('Failed to fetch orders');\n throw err;\n }\n });\n\n return attachSchemaHelp(cmd, listOrdersSchema);\n}\n","import { Command } from 'commander';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { SERVICE_REGISTRY } from './registry.js';\n\n/** Reserved for `--help --format json`. */\nexport const servicesListSchema: VerbSchema = {\n description: 'List available merchant services from the registry.',\n params: {},\n response: {\n services:\n 'Service[] — each with service_id, name, provider, cli_noun, version, verbs',\n },\n};\n\nfunction resolveFormat(cmd: Command): OutputFormat {\n return cmd.optsWithGlobals().format === 'table' ? 'table' : 'json';\n}\n\nexport function buildServicesListCommand(): Command {\n return new Command('list')\n .description(servicesListSchema.description)\n .helpOption(false)\n .option('-h, --help', 'Show help; with --format json prints the schema')\n .action((opts: { help?: boolean }, cmd: Command) => {\n const format = resolveFormat(cmd);\n if (opts.help) {\n emitSchema(servicesListSchema, format);\n return;\n }\n const services = SERVICE_REGISTRY.map((s) => ({\n service_id: s.service_id,\n name: s.name,\n provider: s.provider,\n cli_noun: s.cli_noun,\n version: s.version,\n verbs: s.verbs.join(', '),\n }));\n emit(services, format);\n });\n}\n","/**\n * Built-in static capability registry.\n *\n * NOTE: this is a CLI-bundled, single-merchant catalog — NOT a live backend\n * discovery feed. It does not reflect which services are enabled for the\n * current API key, nor the developer's billing mode (that is a per-developer\n * property decided by the backend, surfaced via the `book` response /\n * error codes, not advertised here). When the `merchant-discovery` backend\n * lands, `services list/get` should fetch from it instead of this table.\n *\n * Each entry describes a CLI-exposed service: which `cli_noun` group hosts it,\n * the verbs it offers (with one-line descriptions), the recommended call\n * `workflow`, and discovery hints. `services list` renders a summary of these\n * entries and `services get <service-id>` returns one in full.\n */\n\nexport interface ServiceDiscovery {\n /** Command an agent can run to discover the verbs in detail. */\n help_command: string;\n}\n\nexport interface ServiceCapability {\n service_id: string;\n name: string;\n description: string;\n version: string;\n /** Upstream capability provider. */\n provider: string;\n /** Top-level CLI noun (command group) that hosts this service's verbs. */\n cli_noun: string;\n /** Verb names exposed under `cli_noun`. */\n verbs: string[];\n /** One-line description per verb, keyed by verb name. */\n verb_descriptions: Record<string, string>;\n /** Ordered call sequence; `[cancel]` is optional. */\n workflow: string[];\n /** ISO date the capability became available. */\n since: string;\n discovery: ServiceDiscovery;\n}\n\n/** Static registry. This iteration ships a single `ride-elife` capability. */\nexport const SERVICE_REGISTRY: ServiceCapability[] = [\n {\n service_id: 'ride-elife',\n name: 'Ride hailing (eLife)',\n description: 'On-demand ride ordering: quote a fare, book it, poll status, and cancel.',\n version: '1.0.0',\n provider: 'elife',\n cli_noun: 'ride-elife',\n verbs: ['quote', 'book', 'get', 'cancel', 'list-orders'],\n verb_descriptions: {\n quote: 'Request fare quotes for a ride between two points.',\n book: 'Book a ride using a quote_id returned by quote.',\n get: 'Retrieve a ride order by id (poll for status changes).',\n cancel: 'Cancel a ride order by id.',\n 'list-orders': 'List previously placed ride orders.',\n },\n workflow: ['quote', 'book', 'get (poll for status)', 'cancel (optional)'],\n since: '2026-06-01',\n discovery: { help_command: 'agenzo-merchant-cli ride-elife --help' },\n },\n];\n\n/** Look up a capability by its service_id. */\nexport function findService(serviceId: string): ServiceCapability | undefined {\n return SERVICE_REGISTRY.find((s) => s.service_id === serviceId);\n}\n","import { Command } from 'commander';\nimport { CliError, ErrorCodes } from '../core/errors.js';\nimport { emit, emitSchema, type OutputFormat, type VerbSchema } from '../core/output.js';\nimport { findService } from './registry.js';\n\n/** Reserved for `--help --format json`. */\nexport const serviceGetSchema: VerbSchema = {\n description: 'Retrieve a single merchant service by id, with verb and workflow detail.',\n params: {\n 'service-id': 'string — service id to retrieve',\n },\n response: {\n service_id: 'string',\n name: 'string',\n description: 'string',\n version: 'string',\n provider: 'string',\n cli_noun: 'string',\n verbs: 'string[]',\n verb_descriptions: 'Record<verb, description>',\n workflow: 'string[] — ordered steps quote→book→get(poll)→[cancel]',\n since: 'string — ISO date',\n discovery: '{ help_command: string }',\n },\n};\n\nfunction resolveFormat(cmd: Command): OutputFormat {\n return cmd.optsWithGlobals().format === 'table' ? 'table' : 'json';\n}\n\nexport function buildServiceGetCommand(): Command {\n return new Command('get')\n .description(serviceGetSchema.description)\n .argument('[service-id]', 'Service id to retrieve')\n .helpOption(false)\n .option('-h, --help', 'Show help; with --format json prints the schema')\n .action((serviceId: string | undefined, opts: { help?: boolean }, cmd: Command) => {\n const format = resolveFormat(cmd);\n if (opts.help) {\n emitSchema(serviceGetSchema, format);\n return;\n }\n const service = serviceId ? findService(serviceId) : undefined;\n if (!service) {\n throw new CliError(\n ErrorCodes.SERVICE_NOT_FOUND,\n `Service '${serviceId ?? ''}' not found in the registry (SERVICE_NOT_FOUND).`,\n 'Run \"services list\" to see available services.',\n );\n }\n emit(service, format);\n });\n}\n"],"mappings":";;;AAAA,SAAS,WAAAA,gBAAe;;;ACOjB,IAAM,aAAa;AAAA;AAAA,EAExB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,0BAA0B;AAAA;AAAA,EAG1B,uBAAuB;AAAA,EACvB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,8BAA8B;AAAA;AAAA,EAG9B,yBAAyB;AAAA,EACzB,wBAAwB;AA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,8DAA8D;AAC7E,YAAU,WAAW,kBAAkB,CAAC;AACxC,YAAU,WAAW,iBAAiB,CAAC;AACvC,YAAU,WAAW,oBAAoB,CAAC;AAC1C,YAAU,WAAW,mBAAmB,CAAC;AACzC,YAAU,WAAW,uBAAuB,CAAC;AAG7C,QAAM,WAAW,QAAQ,QAAQ,UAAU,EAAE,YAAY,6BAA6B;AACtF,WAAS,WAAW,yBAAyB,CAAC;AAC9C,WAAS,WAAW,uBAAuB,CAAC;AAE5C,QAAM,QAAQ,WAAW,QAAQ,IAAI;AACvC;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,MAAI,iBAAiB,UAAU;AAC7B,YAAQ,MAAM,UAAU,OAAO,SAAS,MAAM,OAAO,CAAC;AACtD,QAAI,MAAM,SAAU,SAAQ,MAAM,UAAU,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAC1E,YAAQ,KAAK,MAAM,QAAQ;AAAA,EAC7B;AACA,UAAQ;AAAA,IACN,UAAU,OAAO,SAAS,iBAAiB,QAAQ,MAAM,UAAU,8BAA8B;AAAA,EACnG;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["Command","readFileSync","join","join","readFileSync","Command","input","input","Command","Command","num","Command","Command","Command","Command","Command","Command","Command","Command","resolveFormat","Command","resolveFormat","Command"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenzo/merchant-cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.2",
4
4
  "description": "CLI tool for AI Agents to order rides and query merchant services",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",