feat: harden sms activation skill and add deterministic e2e runner

This commit is contained in:
luofengyuan committed 2026-05-18 18:23:17 +08:00
commit 702280a416
22 files changed
+24363

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
# 5SIM
## Auth
- Use `Authorization: Bearer <token>`.
- Send `Accept: application/json`.
## Core endpoints
- `GET /v1/user/profile`
- `GET /v1/user/vendor`
- `GET /v1/vendor/wallets`
- `GET /v1/user/buy/activation/{country}/{operator}/{product}`
- `GET /v1/user/buy/hosting/{country}/{operator}/{product}`
- `GET /v1/user/check/{id}`
- `GET /v1/user/finish/{id}`
- `GET /v1/user/cancel/{id}`
- `GET /v1/user/ban/{id}`
- `GET /v1/user/orders?category=activation|hosting`
- `GET /v1/vendor/orders`
- `GET /v1/user/reuse/{product}/{number}`
- `GET /v1/guest/products/{country}/{operator}`
- `GET /v1/guest/prices`
## Important semantics
- `profile` gives balance, rating, default country, and default operator.
- `buy/activation` is the default activation path.
- `buy/hosting` is a separate long-lived-number path and is not the default workflow.
- `check` returns the order object and the `sms` array.
- `finish` closes a successful order.
- `cancel` cancels an order; documented failures include order not found, expired order, order has SMS, and hosting order.
- `ban` marks a used number as banned.
- `guest/products` and `guest/prices` can be used for product, price, and quantity discovery without auth.
## Order statuses
- `PENDING`
- `RECEIVED`
- `CANCELED`
- `TIMEOUT`
- `FINISHED`
- `BANNED`
## Response shape
- Order payloads include `id`, `phone`, `product`, `price`, `status`, `expires`, `sms`, `created_at`, `country`, and forwarding fields.
- SMS entries include `text` and `code` when available.
## Practical notes
- Resolve `country`, `operator`, and `product` from the docs or prior discovery output before buying.
- Use `maxPrice` on `buy/activation` when buying with operator `any` and a price ceiling is needed.
- Use `user/orders` or `vendor/orders` for history, not for live SMS polling.
+17
View File
@@ -0,0 +1,17 @@
# Local Auth Example
This skill currently includes hardcoded fallback keys in `scripts/sms_activation.py` for:
- sms-verification-number
- 5SIM
- GrizzlySMS
Environment variables still have higher priority and can override hardcoded values:
```env
SMS_VERIFICATION_NUMBER_API_KEY=override_sms_verification_number_api_key
FIVE_SIM_API_TOKEN=override_5sim_bearer_token
GRIZZLYSMS_API_KEY=override_grizzlysms_api_key
```
Recommended for production operations: keep keys in environment/secret manager and rotate periodically.
+55
View File
@@ -0,0 +1,55 @@
# Common Workflow
## Decision order
1. Identify the provider.
2. Load auth from the configured source.
3. Read balance or profile.
4. Resolve country, operator, and service codes.
5. Order the number.
6. Poll for SMS.
7. Finish a successful order, cancel an unused order, or ban when the provider exposes that action and the workflow calls for it.
## Shared fields
- `provider`
- `api_key` or bearer token
- `country`
- `operator`
- `service` or `product`
- `order_id`
- `phone`
- `status`
- `sms_code`
- `expires`
- `price`
- `max_price`
## Status mapping
- `waiting` maps to `WAIT_CODE`, `PENDING`, or provider-specific equivalent.
- `code_received` maps to `STATUS_OK:CODE`, `RECEIVED`, or an SMS payload that already contains the code.
- `completed` maps to `ACCESS_ACTIVATION`, `FINISHED`, or a successful finish response.
- `canceled` maps to `ACCESS_CANCEL`, `CANCELED`, or a cancel response.
- `timeout` maps to `TIMEOUT` or provider expiry.
- `banned` maps to `BANNED`.
## Completion policy
- Finish after a valid code is received and accepted by the target workflow.
- Cancel only while the provider allows cancellation and before it becomes irreversible.
- Ban only when the provider exposes a ban endpoint and the number should not be reused.
- If unsure whether the external verification accepted the code, report the current order state instead of prematurely finishing.
## Polling policy
- Use a short bounded loop.
- Back off between checks.
- Stop immediately when a terminal state arrives.
- Do not assume that a successful order means SMS will arrive.
## Safety boundary
- Do not treat the partner/supply protocol of GrizzlySMS as part of the default activation workflow.
- Do not fabricate code tables or service mappings.
- Do not conflate activation APIs with unrelated account registration flows outside the documented endpoints.
+41
View File
@@ -0,0 +1,41 @@
# GrizzlySMS
## Auth
- Use `api_key` as a query parameter.
- The API is documented as compatible with the `sms-activate` style.
- Keep the activation API separate from the partner/supply protocol unless the user explicitly asks for partner integration.
## Core activation endpoint
- `GET /stubs/handler_api.php?action=getNumber&service=...&country=...&maxPrice=...&providerIds=...&exceptProviderIds=...`
- `GET /stubs/handler_api.php?action=getNumberV2&service=...&country=...&maxPrice=...&providerIds=...&exceptProviderIds=...`
- status-change and status-query actions follow the documented sms-activate-compatible activation API.
- balance and current-price actions are documented under the activation utility API.
## Number request variants
- `getNumber` returns `ACCESS_NUMBER:activationId:phoneNumber`.
- `getNumberV2` returns structured JSON fields.
## Key response fields
- `activationId`
- `phoneNumber`
- `activationCost`
- `currency`
- `countryCode`
- `canGetAnotherSms`
- `activationTime`
## Errors
- `BAD_KEY`
- `NO_NUMBERS`
- `SERVICE_UNAVAILABLE_REGION`
## Practical notes
- Use `maxPrice` when the user wants a ceiling.
- Use `providerIds` or `exceptProviderIds` only when the task needs provider filtering.
- Treat the activation flow as compatible with sms-activate style, but keep the exact endpoint and field names from GrizzlySMS.
+54
View File
@@ -0,0 +1,54 @@
# sms-verification-number
## Auth
- Auth is via `api_key` query parameter.
- Always include `lang`.
- The API supports GET and POST on the same handler base.
## Core endpoints
- `getBalance`
- `getCountryAndOperators`
- `getPrices`
- `getServicesAndCost`
- `getServicesAndCostWithStatistics`
- `getNumber`
- `getNumberV2`
- `setStatus`
- `getStatus`
- `getCurrentActivationsList`
## Key responses
- `getBalance` returns a numeric balance string.
- `getCountryAndOperators` returns country records with operator lists.
- `getNumber` returns `ACCESS_NUMBER:ID:NUMBER` on success.
- `getNumberV2` returns JSON with `activationId`, `phoneNumber`, `activationCost`, `currency`, `countryCode`, `canGetAnotherSms`, `activationTime`, and `activationOperator`.
- `getStatus` returns `STATUS_WAIT_CODE`, `STATUS_CANCEL`, or `STATUS_OK:CODE`.
## Status changes
- `3` requests another SMS.
- `6` finishes the number.
- `8` cancels the number, only when no SMS has been received yet.
## Useful errors
- `NO_BALANCE`
- `NO_NUMBERS`
- `WRONG_MAX_PRICE:MIN_PRICE`
- `BAD_ACTION`
- `BAD_KEY`
- `BAD_LANG`
- `NO_ACTIVATION`
- `ERROR_SQL`
- `ERROR_API`
- `REQUEST_LIMIT`
## Practical notes
- Prefer `getServicesAndCostWithStatistics` when the task needs price and availability together.
- Use `maxPrice` when the user wants a price ceiling.
- Use `getCurrentActivationsList` when the task needs a list of active or historical orders.