exactor-cli 1.28.0__tar.gz
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.
- exactor_cli-1.28.0/GETTING_STARTED.md +126 -0
- exactor_cli-1.28.0/PKG-INFO +143 -0
- exactor_cli-1.28.0/README.md +265 -0
- exactor_cli-1.28.0/exactor/__init__.py +38 -0
- exactor_cli-1.28.0/exactor/client.py +174 -0
- exactor_cli-1.28.0/exactor_cli.egg-info/PKG-INFO +143 -0
- exactor_cli-1.28.0/exactor_cli.egg-info/SOURCES.txt +12 -0
- exactor_cli-1.28.0/exactor_cli.egg-info/dependency_links.txt +1 -0
- exactor_cli-1.28.0/exactor_cli.egg-info/entry_points.txt +2 -0
- exactor_cli-1.28.0/exactor_cli.egg-info/top_level.txt +3 -0
- exactor_cli-1.28.0/exactor_cli.py +682 -0
- exactor_cli-1.28.0/exactor_client.py +14 -0
- exactor_cli-1.28.0/pyproject.toml +32 -0
- exactor_cli-1.28.0/setup.cfg +4 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Getting Started — primera simplificación en ~2 minutos
|
|
2
|
+
|
|
3
|
+
Cliente Python puro (stdlib, cero dependencias) contra la API hosted en **`https://exactor.tech`**. Sin compilar nada, sin Docker, sin `.env`.
|
|
4
|
+
|
|
5
|
+
## 1. Consigue una API key
|
|
6
|
+
|
|
7
|
+
Regístrate gratis en [exactor.tech](https://exactor.tech) (o login si ya tienes cuenta) → **Console → API Keys → create `ek_...` key**.
|
|
8
|
+
|
|
9
|
+
También sirve el JWT de sesión (`/api/auth/register` → `token`) como Bearer token.
|
|
10
|
+
|
|
11
|
+
## 2. Instala el cliente
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Opción A — pip (recomendada; paquete `exactor-cli`)
|
|
15
|
+
pip install exactor-cli
|
|
16
|
+
|
|
17
|
+
# Opción B — instaladores one-liner
|
|
18
|
+
curl -sSL https://exactor.tech/install.sh | bash # Linux / macOS
|
|
19
|
+
irm https://exactor.tech/install.ps1 | iex # Windows PowerShell
|
|
20
|
+
|
|
21
|
+
# Opción C — sin instalar: baja el archivo único
|
|
22
|
+
curl -sSL https://exactor.tech/exactor_cli.py -o exactor_cli.py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requiere **Python 3.8+**, nada más (`urllib`/`json` de la stdlib).
|
|
26
|
+
|
|
27
|
+
## 3. Login y minimiza
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
exactor login --token ek_TU_API_KEY # guarda config en ~/.exactor/
|
|
31
|
+
exactor whoami # verifica tier y balance SU
|
|
32
|
+
exactor minimize circuit.pla -o out.v # .pla, .json o expresión
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Salida real:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
[*] Circuit parsed: 4 inputs, 6 minterms.
|
|
39
|
+
EXACTOR CLOUD // SYNTHESIS COMPLETE (FORMALLY VERIFIED)
|
|
40
|
+
Solver Latency: 2195 ms
|
|
41
|
+
Gate Reduction: 45.0%
|
|
42
|
+
SU Consumed: 1 SU
|
|
43
|
+
Result Equation: !(x2 ^ x1) & !x0 + (x3 ^ x2) & !x0
|
|
44
|
+
[*] Written synthesized output to: out.v
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
O directo con curl — **sin instalar nada**:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
curl -X POST https://exactor.tech/api/simplify \
|
|
51
|
+
-H "Authorization: Bearer ek_TU_API_KEY" \
|
|
52
|
+
-H "Content-Type: application/json" \
|
|
53
|
+
-d '{"variables":["a","b","c","d"],"minterms":[0,1,2,5,6,7],"emit":["verilog"]}'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Formato de entrada
|
|
57
|
+
|
|
58
|
+
- `variables`: **array de nombres**; `variables[0]` es el bit **más significativo** del índice de minterm (xespresso v1, MSB-first).
|
|
59
|
+
- `minterms`: enteros `0..2^n` del conjunto ON. `dont_cares` para "don't care".
|
|
60
|
+
- El CLI acepta `.pla` (Espresso), `.json` (`{variables, minterms, dont_cares}`) y netlists `exactor-netlist-v1` (salida de `exactor_netlist -format json` del plugin Yosys — incluye cortes secuenciales con `flops`).
|
|
61
|
+
|
|
62
|
+
## Como librería Python
|
|
63
|
+
|
|
64
|
+
El mismo paquete expone `exactor_client` para integrar la API en tu código:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from exactor import ExactorClient, ExactorError # o: from exactor_client import ...
|
|
68
|
+
|
|
69
|
+
client = ExactorClient(token="ek_...") # o EXACTOR_TOKEN / ~/.exactor/config.json
|
|
70
|
+
|
|
71
|
+
# Función booleana por minterms
|
|
72
|
+
res = client.simplify(variables=["a","b","c","d"],
|
|
73
|
+
minterms=[0,1,2,5,6,7],
|
|
74
|
+
emit=["verilog","metrics"])
|
|
75
|
+
print(res["result"], "| su_used:", res["su_used"])
|
|
76
|
+
|
|
77
|
+
# Pre-análisis gratis (0 SU)
|
|
78
|
+
print(client.analyze(["a","b","c"], [0,1,5,7]))
|
|
79
|
+
|
|
80
|
+
# Netlist estructural (exactor-netlist-v1) con FSM
|
|
81
|
+
res = client.simplify_netlist(open("net.json").read(),
|
|
82
|
+
fsm_minimize=True, fsm_init="0")
|
|
83
|
+
print(res["fsm_analysis"], res["minimized_state_bits"])
|
|
84
|
+
|
|
85
|
+
# Cuenta
|
|
86
|
+
print(client.me(), client.balance())
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`ExactorError` lleva `.status` y `.payload`; `.is_quota` (402) e `.is_rate_limited` (429) facilitan el manejo de errores. Resolución de token: argumento → `EXACTOR_TOKEN` env → `EXACTOR_ENDPOINT` env para endpoint → `~/.exactor/config.json`.
|
|
90
|
+
|
|
91
|
+
## Variantes del CLI
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
exactor minimize big.pla --async --wait # job en cluster para >32 vars / funciones grandes
|
|
95
|
+
exactor status <job_id> # consulta un job async
|
|
96
|
+
exactor balance # saldo SU del plan
|
|
97
|
+
exactor minimize net.json --max-sim-vars 24 --esop-budget 200000 # knobs del engine netlist
|
|
98
|
+
exactor minimize net.json --fsm-minimize # (vía API: fsm_minimize/fsm_init en el payload)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Billing en una línea
|
|
102
|
+
|
|
103
|
+
Jobs ligeros (≤32 vars / ≤2K minterms; netlists ≤32 in / ≤5K gates / ≤64 out) = **0 SU en todos los planes** — el registro FREE te da acceso inmediato. Las SU solo se consumen en jobs pesados; el tier FREE tiene rate limit diario.
|
|
104
|
+
|
|
105
|
+
## Self-host (opcional)
|
|
106
|
+
|
|
107
|
+
Para correr tu propia instancia del servicio (no es necesario para usar la API):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git clone <repo> && cd exactor-cloud-service-v128
|
|
111
|
+
cargo run # escucha en 127.0.0.1:3000, SQLite embebido, JWT dev — cero .env
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Luego apunta el cliente: `exactor login --token <JWT> --endpoint http://localhost:3000`.
|
|
115
|
+
|
|
116
|
+
## Troubleshooting
|
|
117
|
+
|
|
118
|
+
| Síntoma | Causa | Fix |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| `401 Access Denied` | Token inválido/ausente | `exactor login --token ek_...` o regístrate en exactor.tech |
|
|
121
|
+
| `403` / límites | Supera caps del plan FREE | Sube de tier (PRO/TEAM) |
|
|
122
|
+
| `402 Insufficient SU` | Job pesado sin saldo | Los ligeros no cobran; PRO incluye 10K SU/mes para pesados |
|
|
123
|
+
| `429 RATE_LIMITED` | Rate limit diario del plan en jobs ligeros | Espera al día siguiente o sube de tier |
|
|
124
|
+
| `variables` rechazado | Entero en vez de array de nombres | `"variables": ["a","b",...]` — `[0]` es MSB |
|
|
125
|
+
|
|
126
|
+
Ver también: `README.md` (referencia de endpoints), `api.html` (snippets curl/Python/JS), Swagger UI en `https://exactor.tech/public-swagger-ui`, `docs/exactor/credits-and-billing.md` (modelo SU v3).
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: exactor-cli
|
|
3
|
+
Version: 1.28.0
|
|
4
|
+
Summary: Exactor thin-client CLI — boolean logic minimization via the Exactor Cloud Engine (https://exactor.tech)
|
|
5
|
+
Author: Exactor Research
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Project-URL: Homepage, https://exactor.tech
|
|
8
|
+
Project-URL: API, https://exactor.tech/public-swagger-ui
|
|
9
|
+
Keywords: boolean,logic-minimization,xor,esop,synthesis,zk,fhe
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Getting Started — primera simplificación en ~2 minutos
|
|
19
|
+
|
|
20
|
+
Cliente Python puro (stdlib, cero dependencias) contra la API hosted en **`https://exactor.tech`**. Sin compilar nada, sin Docker, sin `.env`.
|
|
21
|
+
|
|
22
|
+
## 1. Consigue una API key
|
|
23
|
+
|
|
24
|
+
Regístrate gratis en [exactor.tech](https://exactor.tech) (o login si ya tienes cuenta) → **Console → API Keys → create `ek_...` key**.
|
|
25
|
+
|
|
26
|
+
También sirve el JWT de sesión (`/api/auth/register` → `token`) como Bearer token.
|
|
27
|
+
|
|
28
|
+
## 2. Instala el cliente
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Opción A — pip (recomendada; paquete `exactor-cli`)
|
|
32
|
+
pip install exactor-cli
|
|
33
|
+
|
|
34
|
+
# Opción B — instaladores one-liner
|
|
35
|
+
curl -sSL https://exactor.tech/install.sh | bash # Linux / macOS
|
|
36
|
+
irm https://exactor.tech/install.ps1 | iex # Windows PowerShell
|
|
37
|
+
|
|
38
|
+
# Opción C — sin instalar: baja el archivo único
|
|
39
|
+
curl -sSL https://exactor.tech/exactor_cli.py -o exactor_cli.py
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Requiere **Python 3.8+**, nada más (`urllib`/`json` de la stdlib).
|
|
43
|
+
|
|
44
|
+
## 3. Login y minimiza
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
exactor login --token ek_TU_API_KEY # guarda config en ~/.exactor/
|
|
48
|
+
exactor whoami # verifica tier y balance SU
|
|
49
|
+
exactor minimize circuit.pla -o out.v # .pla, .json o expresión
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Salida real:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
[*] Circuit parsed: 4 inputs, 6 minterms.
|
|
56
|
+
EXACTOR CLOUD // SYNTHESIS COMPLETE (FORMALLY VERIFIED)
|
|
57
|
+
Solver Latency: 2195 ms
|
|
58
|
+
Gate Reduction: 45.0%
|
|
59
|
+
SU Consumed: 1 SU
|
|
60
|
+
Result Equation: !(x2 ^ x1) & !x0 + (x3 ^ x2) & !x0
|
|
61
|
+
[*] Written synthesized output to: out.v
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
O directo con curl — **sin instalar nada**:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
curl -X POST https://exactor.tech/api/simplify \
|
|
68
|
+
-H "Authorization: Bearer ek_TU_API_KEY" \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{"variables":["a","b","c","d"],"minterms":[0,1,2,5,6,7],"emit":["verilog"]}'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Formato de entrada
|
|
74
|
+
|
|
75
|
+
- `variables`: **array de nombres**; `variables[0]` es el bit **más significativo** del índice de minterm (xespresso v1, MSB-first).
|
|
76
|
+
- `minterms`: enteros `0..2^n` del conjunto ON. `dont_cares` para "don't care".
|
|
77
|
+
- El CLI acepta `.pla` (Espresso), `.json` (`{variables, minterms, dont_cares}`) y netlists `exactor-netlist-v1` (salida de `exactor_netlist -format json` del plugin Yosys — incluye cortes secuenciales con `flops`).
|
|
78
|
+
|
|
79
|
+
## Como librería Python
|
|
80
|
+
|
|
81
|
+
El mismo paquete expone `exactor_client` para integrar la API en tu código:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from exactor import ExactorClient, ExactorError # o: from exactor_client import ...
|
|
85
|
+
|
|
86
|
+
client = ExactorClient(token="ek_...") # o EXACTOR_TOKEN / ~/.exactor/config.json
|
|
87
|
+
|
|
88
|
+
# Función booleana por minterms
|
|
89
|
+
res = client.simplify(variables=["a","b","c","d"],
|
|
90
|
+
minterms=[0,1,2,5,6,7],
|
|
91
|
+
emit=["verilog","metrics"])
|
|
92
|
+
print(res["result"], "| su_used:", res["su_used"])
|
|
93
|
+
|
|
94
|
+
# Pre-análisis gratis (0 SU)
|
|
95
|
+
print(client.analyze(["a","b","c"], [0,1,5,7]))
|
|
96
|
+
|
|
97
|
+
# Netlist estructural (exactor-netlist-v1) con FSM
|
|
98
|
+
res = client.simplify_netlist(open("net.json").read(),
|
|
99
|
+
fsm_minimize=True, fsm_init="0")
|
|
100
|
+
print(res["fsm_analysis"], res["minimized_state_bits"])
|
|
101
|
+
|
|
102
|
+
# Cuenta
|
|
103
|
+
print(client.me(), client.balance())
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`ExactorError` lleva `.status` y `.payload`; `.is_quota` (402) e `.is_rate_limited` (429) facilitan el manejo de errores. Resolución de token: argumento → `EXACTOR_TOKEN` env → `EXACTOR_ENDPOINT` env para endpoint → `~/.exactor/config.json`.
|
|
107
|
+
|
|
108
|
+
## Variantes del CLI
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
exactor minimize big.pla --async --wait # job en cluster para >32 vars / funciones grandes
|
|
112
|
+
exactor status <job_id> # consulta un job async
|
|
113
|
+
exactor balance # saldo SU del plan
|
|
114
|
+
exactor minimize net.json --max-sim-vars 24 --esop-budget 200000 # knobs del engine netlist
|
|
115
|
+
exactor minimize net.json --fsm-minimize # (vía API: fsm_minimize/fsm_init en el payload)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Billing en una línea
|
|
119
|
+
|
|
120
|
+
Jobs ligeros (≤32 vars / ≤2K minterms; netlists ≤32 in / ≤5K gates / ≤64 out) = **0 SU en todos los planes** — el registro FREE te da acceso inmediato. Las SU solo se consumen en jobs pesados; el tier FREE tiene rate limit diario.
|
|
121
|
+
|
|
122
|
+
## Self-host (opcional)
|
|
123
|
+
|
|
124
|
+
Para correr tu propia instancia del servicio (no es necesario para usar la API):
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
git clone <repo> && cd exactor-cloud-service-v128
|
|
128
|
+
cargo run # escucha en 127.0.0.1:3000, SQLite embebido, JWT dev — cero .env
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Luego apunta el cliente: `exactor login --token <JWT> --endpoint http://localhost:3000`.
|
|
132
|
+
|
|
133
|
+
## Troubleshooting
|
|
134
|
+
|
|
135
|
+
| Síntoma | Causa | Fix |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `401 Access Denied` | Token inválido/ausente | `exactor login --token ek_...` o regístrate en exactor.tech |
|
|
138
|
+
| `403` / límites | Supera caps del plan FREE | Sube de tier (PRO/TEAM) |
|
|
139
|
+
| `402 Insufficient SU` | Job pesado sin saldo | Los ligeros no cobran; PRO incluye 10K SU/mes para pesados |
|
|
140
|
+
| `429 RATE_LIMITED` | Rate limit diario del plan en jobs ligeros | Espera al día siguiente o sube de tier |
|
|
141
|
+
| `variables` rechazado | Entero en vez de array de nombres | `"variables": ["a","b",...]` — `[0]` es MSB |
|
|
142
|
+
|
|
143
|
+
Ver también: `README.md` (referencia de endpoints), `api.html` (snippets curl/Python/JS), Swagger UI en `https://exactor.tech/public-swagger-ui`, `docs/exactor/credits-and-billing.md` (modelo SU v3).
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Exactor Cloud Service
|
|
2
|
+
|
|
3
|
+
A high-performance cloud service for boolean function simplification using the Exactor Engine (O(n) linear complexity), built with Rust and Axum.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Boolean function simplification via Exactor Engine (Superior to Quine-McCluskey/ESPRESSO, supports native XOR, AND, OR, and NOT with O(n) linear complexity).
|
|
8
|
+
- Supports massive scale simplifications up to **128 variables** via Background Async Jobs processing.
|
|
9
|
+
- Multi-format support: Accepts both `.json` (minterms) and Espresso `.pla` standard file formats.
|
|
10
|
+
- RESTful API endpoints for synchronous simplification, asynchronous background file processing, and payments.
|
|
11
|
+
- Built with async/await (`tokio` / `axum`) for high concurrency.
|
|
12
|
+
- Comprehensive logging and tracing
|
|
13
|
+
- Health check endpoint
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- Rust 1.70 or later
|
|
18
|
+
- Cargo (Rust's package manager)
|
|
19
|
+
|
|
20
|
+
## 📖 API Documentation
|
|
21
|
+
|
|
22
|
+
Exactor Cloud Service provides interactive API documentation using Swagger UI.
|
|
23
|
+
|
|
24
|
+
- **Swagger UI**: Access it at `/public-swagger-ui` while the service is running (e.g., `http://localhost:3000/public-swagger-ui`).
|
|
25
|
+
- **OpenAPI Specification**: You can export the raw `openapi.json` file by running the service with the `--export-openapi` flag:
|
|
26
|
+
```bash
|
|
27
|
+
cargo run -- --export-openapi
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Getting Started
|
|
31
|
+
|
|
32
|
+
> **New here?** See [GETTING_STARTED.md](GETTING_STARTED.md) — first simplification in 3 commands (run → register → simplify), ~5 minutes, zero config.
|
|
33
|
+
|
|
34
|
+
### Installation
|
|
35
|
+
|
|
36
|
+
1. Clone the repository:
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/yourusername/exactor.git
|
|
39
|
+
cd exactor/exactor-cloud-service
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. Build the project:
|
|
43
|
+
```bash
|
|
44
|
+
cargo build --release
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Running the Service
|
|
48
|
+
|
|
49
|
+
Start the service with default settings (listens on 127.0.0.1:3000):
|
|
50
|
+
```bash
|
|
51
|
+
cargo run
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Customize the host and port:
|
|
55
|
+
```bash
|
|
56
|
+
cargo run -- 0.0.0.0 8080
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 📡 API Endpoints
|
|
60
|
+
|
|
61
|
+
For a complete list of endpoints, request/response schemas, and interactive testing, please refer to the **Swagger UI** at `/public-swagger-ui`.
|
|
62
|
+
|
|
63
|
+
### Quick Reference
|
|
64
|
+
|
|
65
|
+
### Health Check
|
|
66
|
+
- **GET** `/health`
|
|
67
|
+
- Returns: `200 OK` with "OK" if service is running
|
|
68
|
+
|
|
69
|
+
### Synchronous Boolean Simplification
|
|
70
|
+
- **POST** `/api/simplify`
|
|
71
|
+
- Requires: `Authorization: Bearer <JWT>` (register at `/api/auth/register`)
|
|
72
|
+
- Request body: JSON object with variable names and minterms
|
|
73
|
+
(`variables[0]` is the MSB of the minterm index — xespresso v1 convention)
|
|
74
|
+
- Example request:
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"variables": ["a", "b", "c", "d"],
|
|
78
|
+
"minterms": [0, 1, 2, 5, 6, 7],
|
|
79
|
+
"dont_cares": [],
|
|
80
|
+
"emit": ["verilog", "metrics"]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
- Response: Simplified boolean expression (`result`, `xespresso`, plus any `emit` fields). Light jobs (≤32 vars / ≤2K minterms) cost 0 SU on every plan.
|
|
84
|
+
|
|
85
|
+
### Asynchronous Boolean Simplification (For Large Datasets up to 128 variables)
|
|
86
|
+
- **POST** `/api/async/simplify`
|
|
87
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
88
|
+
- Request: `multipart/form-data` with a file (either `.pla` or `.json`), optionally a `webhook_url`, and a `variables_count` hint.
|
|
89
|
+
- Response: `202 Accepted` returning a `job_id`.
|
|
90
|
+
|
|
91
|
+
- **GET** `/api/async/jobs/:id`
|
|
92
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
93
|
+
- Response: Current status of the job (`PENDING`, `COMPLETED`, `FAILED`), and the final calculated `cost_su`.
|
|
94
|
+
|
|
95
|
+
- **GET** `/api/async/jobs/:id/download`
|
|
96
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
97
|
+
- Response: Streamed JSON result file.
|
|
98
|
+
- Note: This deducts the calculated Silicon Units from your account upon successful download. If insufficient funds, returns `402 Payment Required`.
|
|
99
|
+
|
|
100
|
+
### Authentication
|
|
101
|
+
|
|
102
|
+
- **POST** `/api/auth/register`
|
|
103
|
+
- Creates a user and returns a JWT.
|
|
104
|
+
- **POST** `/api/auth/login`
|
|
105
|
+
- Logs in and returns a JWT.
|
|
106
|
+
- **POST** `/api/auth/google`
|
|
107
|
+
- Authenticates with Google ID Token / Access Token (`credential` or `access_token`), auto-creates user under `GRATIS` plan with 100 SU if first-time, and returns a session JWT.
|
|
108
|
+
- **GET** `/api/auth/me`
|
|
109
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
110
|
+
- Returns the current user (including `subscription_status` and `subscription_tier`).
|
|
111
|
+
|
|
112
|
+
### PayPal Checkout (Orders API)
|
|
113
|
+
|
|
114
|
+
- **POST** `/api/paypal/create-order`
|
|
115
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
116
|
+
- Request:
|
|
117
|
+
```json
|
|
118
|
+
{ "planId": "SCOUT" }
|
|
119
|
+
```
|
|
120
|
+
- Response:
|
|
121
|
+
```json
|
|
122
|
+
{ "orderID": "..." }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- **POST** `/api/paypal/capture-order`
|
|
126
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
127
|
+
- Request:
|
|
128
|
+
```json
|
|
129
|
+
{ "orderID": "..." }
|
|
130
|
+
```
|
|
131
|
+
- Response:
|
|
132
|
+
```json
|
|
133
|
+
{ "status": "COMPLETED", "captureID": "..." }
|
|
134
|
+
```
|
|
135
|
+
- Notes:
|
|
136
|
+
- The backend validates the `orderID` against a persisted preorder and upgrades the user only when PayPal returns `COMPLETED`.
|
|
137
|
+
|
|
138
|
+
### Rebill.com Checkout & Subscriptions
|
|
139
|
+
|
|
140
|
+
- **POST** `/api/rebill/create-checkout`
|
|
141
|
+
- Requires: `Authorization: Bearer <JWT>`
|
|
142
|
+
- Request:
|
|
143
|
+
```json
|
|
144
|
+
{ "planId": "PRO" }
|
|
145
|
+
```
|
|
146
|
+
- Response:
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"preorder_id": "rb_pre_...",
|
|
150
|
+
"checkout_url": "https://pay.rebill.com/...",
|
|
151
|
+
"plan_id": "PRO",
|
|
152
|
+
"amount": 49.0,
|
|
153
|
+
"currency": "USD",
|
|
154
|
+
"public_key": "pk_..."
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- **POST** `/api/rebill/webhook`
|
|
159
|
+
- Webhook endpoint for Rebill events (HMAC-SHA256 signature verification via `x-rebill-signature`).
|
|
160
|
+
- Automatically activates subscriptions and issues included Silicon Units (SU).
|
|
161
|
+
|
|
162
|
+
### Creem.io Checkout & Subscriptions (self-service PRO/TEAM)
|
|
163
|
+
|
|
164
|
+
- **POST** `/api/creem/create-checkout`
|
|
165
|
+
- Anonymous or `Authorization: Bearer <JWT>` (when authenticated, `metadata.user_id` is attached).
|
|
166
|
+
- Request:
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"planId": "PRO",
|
|
170
|
+
"billingCycle": "monthly",
|
|
171
|
+
"successUrl": "https://exactor.tech/pricing.html?creem_status=success",
|
|
172
|
+
"cancelUrl": "https://exactor.tech/pricing.html?creem_status=cancelled"
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
- `planId`: `PRO` ($79/mo or $65/mo annual, 10,000 SU) or `TEAM` ($399/mo or $329/mo annual, 100,000 SU).
|
|
176
|
+
- Response:
|
|
177
|
+
```json
|
|
178
|
+
{ "checkout_id": "...", "checkout_url": "https://creem.io/checkout/...", "plan_id": "PRO", "billing_cycle": "monthly" }
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- **POST** `/api/creem/webhook`
|
|
182
|
+
- Webhook endpoint for Creem events; verifies `creem-signature` (HMAC-SHA256 hex of the raw body).
|
|
183
|
+
- Handles `checkout.completed`, `subscription.active`, `subscription.canceled`; idempotent via `creem_webhook_events`.
|
|
184
|
+
- Links the subscription to a user by `metadata.user_id` or customer email, activates the tier and grants monthly SU.
|
|
185
|
+
|
|
186
|
+
### Free analysis (0 SU)
|
|
187
|
+
|
|
188
|
+
- **POST** `/api/analyze` (alias `/api/v1/analyze`)
|
|
189
|
+
- Public dry-run: returns variable/minterm/don't-care counts, XOR-affinity score, flat SU cost, required tier and recommendation. Consumes 0 SU and performs no synthesis.
|
|
190
|
+
|
|
191
|
+
### PayPal Webhook (optional)
|
|
192
|
+
|
|
193
|
+
- **POST** `/api/payments/webhook`
|
|
194
|
+
- See [docs/paypal-webhook.md](docs/paypal-webhook.md)
|
|
195
|
+
|
|
196
|
+
## Configuration
|
|
197
|
+
|
|
198
|
+
The service reads configuration from environment variables (via `.env`).
|
|
199
|
+
|
|
200
|
+
### Rebill.com (Sandbox & Production)
|
|
201
|
+
|
|
202
|
+
- `REBILL_API_BASE` = `https://api.rebill.com/v3`
|
|
203
|
+
- `REBILL_PUBLIC_KEY` = `pk_...`
|
|
204
|
+
- `REBILL_SECRET_KEY` = `sk_...`
|
|
205
|
+
- `REBILL_WEBHOOK_SECRET` = (optional HMAC signing secret)
|
|
206
|
+
|
|
207
|
+
### Creem.io (Merchant of Record — PRO/TEAM self-service)
|
|
208
|
+
|
|
209
|
+
- `CREEM_API_KEY` = secret API key (`x-api-key` header)
|
|
210
|
+
- `CREEM_WEBHOOK_SECRET` = webhook signing secret for `creem-signature` HMAC-SHA256
|
|
211
|
+
- `CREEM_API_BASE` = `https://api.creem.io` (use `https://test-api.creem.io` for sandbox)
|
|
212
|
+
- `CREEM_PRODUCT_PRO` = Creem product id for PRO (`prod_...`)
|
|
213
|
+
- `CREEM_PRODUCT_TEAM` = Creem product id for TEAM (`prod_...`)
|
|
214
|
+
|
|
215
|
+
### PayPal
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
- `PAYPAL_ENV` = `sandbox` | `live`
|
|
219
|
+
- `PAYPAL_CLIENT_ID`
|
|
220
|
+
- `PAYPAL_CLIENT_SECRET`
|
|
221
|
+
|
|
222
|
+
Optional / advanced:
|
|
223
|
+
|
|
224
|
+
- `PAYPAL_API_BASE` (overrides base URL)
|
|
225
|
+
- `PAYPAL_WEBHOOK_VERIFY_MODE` = `secret` | `paypal` | `both`
|
|
226
|
+
- `PAYPAL_WEBHOOK_SECRET`
|
|
227
|
+
- `PAYPAL_WEBHOOK_ID`
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
### Building for Development
|
|
232
|
+
```bash
|
|
233
|
+
cargo build
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Running Tests
|
|
237
|
+
```bash
|
|
238
|
+
cargo test
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Formatting Code
|
|
242
|
+
```bash
|
|
243
|
+
cargo fmt
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Linting
|
|
247
|
+
```bash
|
|
248
|
+
cargo clippy
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Deployment
|
|
252
|
+
|
|
253
|
+
See [deployment.md](deployment.md) for detailed deployment instructions.
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
258
|
+
|
|
259
|
+
## Contributing
|
|
260
|
+
|
|
261
|
+
1. Fork the repository
|
|
262
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
263
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
264
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
265
|
+
5. Open a Pull Request
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Exactor Cloud Python SDK.
|
|
3
|
+
|
|
4
|
+
Thin, stdlib-only wrapper over the Exactor Cloud API (https://exactor.tech).
|
|
5
|
+
Install: ``pip install exactor-cli`` — then::
|
|
6
|
+
|
|
7
|
+
from exactor import ExactorClient
|
|
8
|
+
|
|
9
|
+
client = ExactorClient(token="ek_...") # or EXACTOR_TOKEN env var
|
|
10
|
+
result = client.simplify(variables=["a","b","c","d"],
|
|
11
|
+
minterms=[0,1,2,5,6,7],
|
|
12
|
+
emit=["verilog","metrics"])
|
|
13
|
+
print(result["result"], result["su_used"])
|
|
14
|
+
|
|
15
|
+
Also importable as ``exactor_client`` (legacy module name) and usable as
|
|
16
|
+
the ``exactor`` CLI (``exactor login``, ``exactor minimize``).
|
|
17
|
+
|
|
18
|
+
Requires Python 3.8+. No third-party dependencies.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from .client import (
|
|
22
|
+
CONFIG_DIR,
|
|
23
|
+
CONFIG_FILE,
|
|
24
|
+
DEFAULT_ENDPOINT,
|
|
25
|
+
ExactorClient,
|
|
26
|
+
ExactorError,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__version__ = "1.28.0"
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"ExactorClient",
|
|
33
|
+
"ExactorError",
|
|
34
|
+
"DEFAULT_ENDPOINT",
|
|
35
|
+
"CONFIG_DIR",
|
|
36
|
+
"CONFIG_FILE",
|
|
37
|
+
"__version__",
|
|
38
|
+
]
|