leanwarp 0.2.6__tar.gz → 0.2.7__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.
- leanwarp-0.2.7/CHANGELOG.md +76 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/PKG-INFO +26 -12
- {leanwarp-0.2.6 → leanwarp-0.2.7}/README.md +16 -5
- {leanwarp-0.2.6 → leanwarp-0.2.7}/docs/agents.md +20 -8
- {leanwarp-0.2.6 → leanwarp-0.2.7}/docs/getting-started.md +66 -10
- {leanwarp-0.2.6 → leanwarp-0.2.7}/docs/http-api.md +187 -59
- {leanwarp-0.2.6 → leanwarp-0.2.7}/pyproject.toml +12 -3
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/__init__.py +19 -2
- leanwarp-0.2.7/src/leanwarp_cloud/_toml.py +10 -0
- leanwarp-0.2.7/src/leanwarp_cloud/agents.py +696 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/amounts.py +4 -2
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/cli.py +165 -73
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/client.py +293 -117
- leanwarp-0.2.7/src/leanwarp_cloud/compact.py +126 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/config.py +6 -1
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/edits.py +1 -4
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/endpoints.py +4 -6
- leanwarp-0.2.7/src/leanwarp_cloud/errors.py +130 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/mcp_server.py +215 -109
- leanwarp-0.2.7/src/leanwarp_cloud/outcome.py +293 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/project.py +335 -6
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/resources.py +1 -1
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/session.py +552 -118
- leanwarp-0.2.7/src/leanwarp_cloud/skills/leanwarp/SKILL.md +296 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/skills/leanwarp/references/usage.md +194 -71
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/transport.py +18 -9
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/updates.py +52 -9
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/fixtures/lake-manifest-1.1.0.json +1 -1
- leanwarp-0.2.7/tests/test_ci.py +528 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_client.py +13 -7
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_config.py +1 -1
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_deadline_transport.py +21 -4
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_environment_compatibility.py +27 -15
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_install.py +33 -4
- leanwarp-0.2.7/tests/test_mcp.py +262 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_project.py +237 -1
- leanwarp-0.2.7/tests/test_replay.py +324 -0
- leanwarp-0.2.7/tests/test_retries.py +508 -0
- leanwarp-0.2.7/tests/test_run_limits.py +85 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_session.py +210 -41
- leanwarp-0.2.7/tests/test_setup.py +549 -0
- leanwarp-0.2.7/tests/test_syntax_floor.py +17 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_tools.py +230 -66
- leanwarp-0.2.6/CHANGELOG.md +0 -28
- leanwarp-0.2.6/src/leanwarp_cloud/agents.py +0 -173
- leanwarp-0.2.6/src/leanwarp_cloud/outcome.py +0 -112
- leanwarp-0.2.6/src/leanwarp_cloud/skills/leanwarp/SKILL.md +0 -218
- {leanwarp-0.2.6 → leanwarp-0.2.7}/.gitignore +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/LICENSE +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/docs/README.md +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/docs/assets/leanwarp-banner.svg +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/examples/lean-4.35/.gitignore +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/examples/lean-4.35/LeanWarpExample.lean +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/examples/lean-4.35/README.md +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/examples/lean-4.35/lake-manifest.json +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/examples/lean-4.35/lakefile.toml +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/examples/lean-4.35/lean-toolchain +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/_version.py +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/src/leanwarp_cloud/py.typed +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/__init__.py +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/fixtures/lake-manifest-1.2.0.json +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_amounts.py +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_feedback.py +0 -0
- {leanwarp-0.2.6 → leanwarp-0.2.7}/tests/test_resources.py +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Update an installed SDK with `leanwarp update`.
|
|
4
|
+
|
|
5
|
+
## 0.2.7
|
|
6
|
+
|
|
7
|
+
- Every result says whether there was a verdict. A check, batch entry or
|
|
8
|
+
verification is `ok`, `error` or `rejected` (a verdict), or `timeout`,
|
|
9
|
+
`infrastructure_failure` or `not_checked` (no verdict, with
|
|
10
|
+
`failure.retryable`). With no verdict, `decided` is `false` and the CLI exits
|
|
11
|
+
`4`: retry rather than change the proof. A batch is `ok`, `failed` or
|
|
12
|
+
`incomplete`.
|
|
13
|
+
- A `verify_batch` entry can carry a `target` (`context`, `statement`,
|
|
14
|
+
`declaration`) to check it against that statement, with a receipt when
|
|
15
|
+
accepted. Receipts use the policy `fixed_target_kernel_check_v2`, which
|
|
16
|
+
`OperationOutcome.verified` requires.
|
|
17
|
+
- A `check` sent over HTTP is strict unless it says `"strict": false`.
|
|
18
|
+
- `suggest` no longer has a `partial` tier: run `sorry2lemma` to give each hole
|
|
19
|
+
its own lemma, then `suggest` on it.
|
|
20
|
+
- A batch entry without `timeout` has 60 seconds. A `timeout` the operation
|
|
21
|
+
cannot honour is refused when it is submitted.
|
|
22
|
+
- Lean options set in your `lakefile` apply to every check and verification.
|
|
23
|
+
`leanwarp status` names any that are not applied.
|
|
24
|
+
- `check_files` and `verify_batch` run proofs that share imports together, keep
|
|
25
|
+
the entries that finished when cancelled, and keep each failing entry's first
|
|
26
|
+
error when results are shortened. A long Lean message keeps its start and its
|
|
27
|
+
goals.
|
|
28
|
+
- A brief outage no longer ends a wait. `wait()` keeps polling through `429`,
|
|
29
|
+
`5xx` and dropped connections, `stop`, `cancel` and `delete` are retried, and
|
|
30
|
+
after a lost response the next command resends the request with the same key.
|
|
31
|
+
- Every error is a `LeanWarpError` with `code`, `status`, `message`,
|
|
32
|
+
`retryable` and `retry_after`.
|
|
33
|
+
- `delete_operation(id)` frees a finished result's storage, and
|
|
34
|
+
`wait_operations(ids)` waits on up to 100 operations at once.
|
|
35
|
+
- MCP tools can be called in parallel and take an `operation_id`. Results are
|
|
36
|
+
compact, errors first; pass `detail: "full"` for everything.
|
|
37
|
+
- For CI: `leanwarp connect --ephemeral`, `leanwarp check --all` and
|
|
38
|
+
`leanwarp stop --delete`, and `--block` to wait for any operation. The
|
|
39
|
+
getting-started guide has a GitHub Actions recipe.
|
|
40
|
+
- `inspect` at a position that selects no single proof hole returns
|
|
41
|
+
`cursor_outside_proof` or `ambiguous_cursor_capture`.
|
|
42
|
+
- Connecting from a partial checkout keeps the workspace's other files, listed
|
|
43
|
+
under `remote_only`; `leanwarp prune` deletes them once you confirm.
|
|
44
|
+
- `leanwarp setup --remove` undoes `leanwarp setup`, and `LEANWARP_FEEDBACK=off`
|
|
45
|
+
turns off feedback.
|
|
46
|
+
- The agent skill starts with setup (install, sign in, connect), so an agent can
|
|
47
|
+
set LeanWarp up from https://isagoge.in/leanwarp/skill.md.
|
|
48
|
+
- The SDK runs on Python 3.10 to 3.14 and accepts older releases of its
|
|
49
|
+
dependencies.
|
|
50
|
+
- When support for your SDK release is due to end, results show the date under
|
|
51
|
+
`update_available`.
|
|
52
|
+
|
|
53
|
+
## 0.2.6
|
|
54
|
+
|
|
55
|
+
- Changed files and the operation that uses them now go to the service in one
|
|
56
|
+
request, so checks and other operations start sooner.
|
|
57
|
+
- The HTTP API reference covers `POST /workspaces/{workspace_id}/run`, which
|
|
58
|
+
uploads files and submits an operation together.
|
|
59
|
+
- The reference explains how `timeout` works in `check_files` and `verify_batch`:
|
|
60
|
+
it starts once imports have loaded, except for sources using `native_decide`,
|
|
61
|
+
and a short `timeout_seconds` still returns finished results.
|
|
62
|
+
- Results now document `engine_` errors on a single batch entry and the
|
|
63
|
+
`elaboration_ms`, `proof_state_ms` and `tactics_ms` timings.
|
|
64
|
+
- The getting-started guide explains how to restate Lean options from your
|
|
65
|
+
`lakefile` as `set_option` lines.
|
|
66
|
+
|
|
67
|
+
## 0.2.5
|
|
68
|
+
|
|
69
|
+
- The MCP server is listed in the official
|
|
70
|
+
[MCP Registry](https://registry.modelcontextprotocol.io) as
|
|
71
|
+
`io.github.Isagoge-Labs/leanwarp`.
|
|
72
|
+
- The documentation is now at
|
|
73
|
+
[isagoge.in/leanwarp/docs](https://isagoge.in/leanwarp/docs). The README and
|
|
74
|
+
the package's links point there.
|
|
75
|
+
- The getting-started guide, agent setup, reference and HTTP API pages are
|
|
76
|
+
rewritten to be shorter and simpler.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: leanwarp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Check and verify Lean proofs on LeanWarp from the command line, MCP or Python
|
|
5
5
|
Project-URL: Repository, https://github.com/Isagoge-Labs/LeanWarp-SDK
|
|
6
6
|
Project-URL: Homepage, https://isagoge.in/leanwarp
|
|
@@ -16,16 +16,19 @@ Classifier: Intended Audience :: Science/Research
|
|
|
16
16
|
Classifier: Operating System :: MacOS
|
|
17
17
|
Classifier: Operating System :: POSIX :: Linux
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
23
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
24
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
23
|
-
Requires-Python: >=3.
|
|
24
|
-
Requires-Dist: httpcore<2,>=1
|
|
25
|
-
Requires-Dist: httpx<1,>=0.
|
|
26
|
-
Requires-Dist: mcp<2,>=1.
|
|
27
|
-
Requires-Dist: pathspec<2,>=
|
|
28
|
-
Requires-Dist: pydantic<3,>=2.
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: httpcore<2,>=1
|
|
27
|
+
Requires-Dist: httpx<1,>=0.27.1
|
|
28
|
+
Requires-Dist: mcp<2,>=1.14
|
|
29
|
+
Requires-Dist: pathspec<2,>=0.10
|
|
30
|
+
Requires-Dist: pydantic<3,>=2.11
|
|
31
|
+
Requires-Dist: tomli<3,>=2.0.1; python_version < '3.11'
|
|
29
32
|
Provides-Extra: test
|
|
30
33
|
Requires-Dist: pytest<10,>=8.4; extra == 'test'
|
|
31
34
|
Description-Content-Type: text/markdown
|
|
@@ -80,8 +83,10 @@ uv tool install leanwarp && leanwarp setup
|
|
|
80
83
|
This installs the `leanwarp` command and its MCP server from
|
|
81
84
|
[PyPI](https://pypi.org/project/leanwarp/). `leanwarp setup` adds the LeanWarp
|
|
82
85
|
skill and MCP server to Claude Code, Codex and Cursor where they are installed,
|
|
83
|
-
and the skill to `~/.agents/skills
|
|
84
|
-
|
|
86
|
+
and the skill to `~/.agents/skills` if that folder exists; `leanwarp setup
|
|
87
|
+
--remove` takes them out again. It runs on Linux, macOS and WSL, with Python
|
|
88
|
+
3.10 to 3.14. You don't need Lean installed: LeanWarp runs Lean and Mathlib for
|
|
89
|
+
you.
|
|
85
90
|
|
|
86
91
|
Or paste this into your agent:
|
|
87
92
|
|
|
@@ -129,9 +134,15 @@ Wait for that operation to finish too, then run `leanwarp stop` when you are don
|
|
|
129
134
|
|
|
130
135
|
Every command prints one JSON object. Results start with `success`: `true` when
|
|
131
136
|
the check passed or the proof was verified, `false` when it did not, and `null`
|
|
132
|
-
while the work is still running, in which case run `leanwarp wait`.
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
while the work is still running, in which case run `leanwarp wait`. `decided` is
|
|
138
|
+
`false` when there was no verdict (a timeout, or a check LeanWarp could not
|
|
139
|
+
complete): retry it rather than changing the proof. The exit code says the same
|
|
140
|
+
thing: `0` passed, `1` did not pass, `2` the command failed, `3` still running,
|
|
141
|
+
`4` no verdict.
|
|
142
|
+
|
|
143
|
+
In CI, `leanwarp connect --ephemeral`, `leanwarp check --all` and, always last,
|
|
144
|
+
`leanwarp stop --delete` check every file and leave nothing behind; see the
|
|
145
|
+
[GitHub Actions recipe](https://isagoge.in/leanwarp/docs/getting-started#6-check-a-project-in-ci).
|
|
135
146
|
|
|
136
147
|
## Use with an agent
|
|
137
148
|
|
|
@@ -199,6 +210,9 @@ Stopping keeps your uploaded files and
|
|
|
199
210
|
completed results; the next operation reconstructs the worker. Set a spending cap
|
|
200
211
|
for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
201
212
|
|
|
213
|
+
LeanWarp is in beta. For more capacity, larger workers, higher limits or a custom
|
|
214
|
+
setup for your team, email contact@isagoge.in or tell us with `leanwarp feedback`.
|
|
215
|
+
|
|
202
216
|
## Concepts
|
|
203
217
|
|
|
204
218
|
| Term | Meaning |
|
|
@@ -48,8 +48,10 @@ uv tool install leanwarp && leanwarp setup
|
|
|
48
48
|
This installs the `leanwarp` command and its MCP server from
|
|
49
49
|
[PyPI](https://pypi.org/project/leanwarp/). `leanwarp setup` adds the LeanWarp
|
|
50
50
|
skill and MCP server to Claude Code, Codex and Cursor where they are installed,
|
|
51
|
-
and the skill to `~/.agents/skills
|
|
52
|
-
|
|
51
|
+
and the skill to `~/.agents/skills` if that folder exists; `leanwarp setup
|
|
52
|
+
--remove` takes them out again. It runs on Linux, macOS and WSL, with Python
|
|
53
|
+
3.10 to 3.14. You don't need Lean installed: LeanWarp runs Lean and Mathlib for
|
|
54
|
+
you.
|
|
53
55
|
|
|
54
56
|
Or paste this into your agent:
|
|
55
57
|
|
|
@@ -97,9 +99,15 @@ Wait for that operation to finish too, then run `leanwarp stop` when you are don
|
|
|
97
99
|
|
|
98
100
|
Every command prints one JSON object. Results start with `success`: `true` when
|
|
99
101
|
the check passed or the proof was verified, `false` when it did not, and `null`
|
|
100
|
-
while the work is still running, in which case run `leanwarp wait`.
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
while the work is still running, in which case run `leanwarp wait`. `decided` is
|
|
103
|
+
`false` when there was no verdict (a timeout, or a check LeanWarp could not
|
|
104
|
+
complete): retry it rather than changing the proof. The exit code says the same
|
|
105
|
+
thing: `0` passed, `1` did not pass, `2` the command failed, `3` still running,
|
|
106
|
+
`4` no verdict.
|
|
107
|
+
|
|
108
|
+
In CI, `leanwarp connect --ephemeral`, `leanwarp check --all` and, always last,
|
|
109
|
+
`leanwarp stop --delete` check every file and leave nothing behind; see the
|
|
110
|
+
[GitHub Actions recipe](https://isagoge.in/leanwarp/docs/getting-started#6-check-a-project-in-ci).
|
|
103
111
|
|
|
104
112
|
## Use with an agent
|
|
105
113
|
|
|
@@ -167,6 +175,9 @@ Stopping keeps your uploaded files and
|
|
|
167
175
|
completed results; the next operation reconstructs the worker. Set a spending cap
|
|
168
176
|
for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
169
177
|
|
|
178
|
+
LeanWarp is in beta. For more capacity, larger workers, higher limits or a custom
|
|
179
|
+
setup for your team, email contact@isagoge.in or tell us with `leanwarp feedback`.
|
|
180
|
+
|
|
170
181
|
## Concepts
|
|
171
182
|
|
|
172
183
|
| Term | Meaning |
|
|
@@ -11,7 +11,7 @@ Lean project the agent may work in.
|
|
|
11
11
|
leanwarp setup
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
This does two things for each agent
|
|
14
|
+
This does two things for each agent installed on this machine:
|
|
15
15
|
|
|
16
16
|
- It installs the LeanWarp skill: the instructions an agent follows. It goes in
|
|
17
17
|
`~/.claude/skills` for Claude Code, `~/.codex/skills` for Codex and
|
|
@@ -19,9 +19,14 @@ This does two things for each agent it finds:
|
|
|
19
19
|
- It adds the MCP server to Claude Code (with `claude mcp add`), Codex
|
|
20
20
|
(`~/.codex/config.toml`) and Cursor (`~/.cursor/mcp.json`).
|
|
21
21
|
|
|
22
|
-
Setup only touches agents whose configuration folder already exists
|
|
23
|
-
`--agent NAME` to set up one anyway, or `--no-mcp` to install only
|
|
24
|
-
It never replaces an existing `leanwarp` MCP
|
|
22
|
+
Setup only touches agents whose configuration folder already exists, `~/.agents`
|
|
23
|
+
included. Use `--agent NAME` to set up one anyway, or `--no-mcp` to install only
|
|
24
|
+
the skills. It never replaces your own skill file or an existing `leanwarp` MCP
|
|
25
|
+
entry; a skill file it leaves is listed under `skill_files_left`.
|
|
26
|
+
|
|
27
|
+
`leanwarp setup --remove` undoes what setup added, and only what is still exactly
|
|
28
|
+
as setup wrote it; anything you have changed since stays and is reported. Add
|
|
29
|
+
`--agent NAME` to remove one agent's.
|
|
25
30
|
|
|
26
31
|
Then run `leanwarp auth login` yourself and restart the agent. Later,
|
|
27
32
|
`leanwarp update` upgrades the command and refreshes the installed skills.
|
|
@@ -41,7 +46,9 @@ a key or costs anything.
|
|
|
41
46
|
|
|
42
47
|
The skill also asks the agent to report real problems with LeanWarp itself
|
|
43
48
|
through `leanwarp feedback`, and to tell you when it does. A report names the
|
|
44
|
-
command that went wrong; it doesn't quote your source.
|
|
49
|
+
command that went wrong; it doesn't quote your source. To turn reports off, set
|
|
50
|
+
`LEANWARP_FEEDBACK=off` in the agent's environment: the command then sends
|
|
51
|
+
nothing and the MCP server offers no `feedback` tool.
|
|
45
52
|
|
|
46
53
|
Sign in yourself with `leanwarp auth login`, or give the agent's environment a
|
|
47
54
|
`LEANWARP_API_KEY`. Never put the key in the instruction.
|
|
@@ -53,8 +60,9 @@ The command line is built for agents:
|
|
|
53
60
|
- Proof commands print a JSON result with `success`: `true`, `false`, or `null`
|
|
54
61
|
while the operation is still running. On `null`, run `leanwarp wait` for the
|
|
55
62
|
same operation; don't submit it again.
|
|
56
|
-
- Exit codes tell apart "did not pass" (`1`), "could not run" (`2`)
|
|
57
|
-
running" (`3`)
|
|
63
|
+
- Exit codes tell apart "did not pass" (`1`), "could not run" (`2`), "still
|
|
64
|
+
running" (`3`) and "no verdict" (`4`: the check timed out or could not be
|
|
65
|
+
completed; retry it instead of changing the proof).
|
|
58
66
|
|
|
59
67
|
For an agent that `leanwarp setup` doesn't know, point its skill installer at
|
|
60
68
|
the [skill folder](../src/leanwarp_cloud/skills/leanwarp), including
|
|
@@ -105,7 +113,11 @@ The agent should first read the resources `leanwarp://guide` and
|
|
|
105
113
|
|
|
106
114
|
The [MCP reference](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#mcp)
|
|
107
115
|
lists every tool and its arguments. Proof tools wait up to 20 seconds for their
|
|
108
|
-
result by default; set `wait_seconds` up to 40.
|
|
116
|
+
result by default; set `wait_seconds` up to 40. Every operation tool returns its
|
|
117
|
+
`operation_id`, and `wait`, `status` and `cancel` accept one, so an agent can run
|
|
118
|
+
tools in parallel: they take turns on the project. Results are compact, with
|
|
119
|
+
errors first and `omitted` counting what was left out; `detail: "full"` returns
|
|
120
|
+
everything.
|
|
109
121
|
|
|
110
122
|
### Spending caps
|
|
111
123
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Getting started
|
|
2
2
|
|
|
3
3
|
This guide takes you from an API key to a verified proof in a few minutes. You
|
|
4
|
-
need the `leanwarp` command
|
|
5
|
-
|
|
4
|
+
need the `leanwarp` command, but you don't need Lean on your machine. Install it
|
|
5
|
+
with [uv](https://docs.astral.sh/uv/getting-started/installation/), on Linux,
|
|
6
|
+
macOS or WSL with Python 3.10 to 3.14:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
uv tool install leanwarp && leanwarp setup
|
|
10
|
+
```
|
|
6
11
|
|
|
7
12
|
If your shell can't find `leanwarp` after you install it, run
|
|
8
13
|
`uv tool update-shell` and open a new terminal.
|
|
@@ -75,10 +80,15 @@ leanwarp connect
|
|
|
75
80
|
Add `.leanwarp/` to `.gitignore`. It holds this project's connection.
|
|
76
81
|
|
|
77
82
|
A project can upload at most 256 `.lean` files and 1 MiB in total.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
The Lean options your `lakefile` sets, such as `maxSynthPendingDepth`, apply to
|
|
84
|
+
every check and verification, as Lake would apply them. Options that could weaken
|
|
85
|
+
checking, such as `debug.*` and `warn.sorry`, are not applied: `leanwarp status`
|
|
86
|
+
lists them under `lean_options_ignored`. LeanWarp checks every file with one set
|
|
87
|
+
of options, so an option that only some of your libraries or executables set, or
|
|
88
|
+
that they set differently, is listed there too instead of reaching the others. A `lakefile.lean`
|
|
89
|
+
must write its options as literal lists, or definitions of them, because LeanWarp
|
|
90
|
+
never runs it. If LeanWarp cannot read every option the lakefile sets, including a
|
|
91
|
+
`-D` argument in `moreLeanArgs`, it applies none and lists `leanOptions` there.
|
|
82
92
|
|
|
83
93
|
`leanwarp files` lists what will upload. Files listed in `.gitignore` are left
|
|
84
94
|
out. To leave out more, such as an archive folder, list it in
|
|
@@ -118,6 +128,7 @@ waits up to 30 seconds and prints the result. A shortened example:
|
|
|
118
128
|
```json
|
|
119
129
|
{
|
|
120
130
|
"success": true,
|
|
131
|
+
"decided": true,
|
|
121
132
|
"kind": "verify_target",
|
|
122
133
|
"state": "completed",
|
|
123
134
|
"revision": 1,
|
|
@@ -126,7 +137,7 @@ waits up to 30 seconds and prints the result. A shortened example:
|
|
|
126
137
|
"file": "LeanWarpExample.lean",
|
|
127
138
|
"status": "ok",
|
|
128
139
|
"receipt": {
|
|
129
|
-
"policy": "
|
|
140
|
+
"policy": "fixed_target_kernel_check_v2",
|
|
130
141
|
"candidate_declaration": "add_zero_example"
|
|
131
142
|
}
|
|
132
143
|
}
|
|
@@ -140,6 +151,10 @@ How to read it:
|
|
|
140
151
|
|
|
141
152
|
- `success` is `true` when the check passed or the proof was verified, and
|
|
142
153
|
`false` when it wasn't. Lean's messages are in `result.result`.
|
|
154
|
+
- `decided` is `false` when there was no verdict: the check timed out
|
|
155
|
+
(`timeout`), LeanWarp could not complete it (`infrastructure_failure`) or it
|
|
156
|
+
was not checked (`not_checked`). The exit code is then `4`: run it again rather
|
|
157
|
+
than changing the proof. A wrong proof is `decided: true` with exit code `1`.
|
|
143
158
|
- If the command takes longer than the wait, `success` is `null` and the exit
|
|
144
159
|
code is `3`. Run `leanwarp wait` to get the result. Don't run the command
|
|
145
160
|
again.
|
|
@@ -178,9 +193,10 @@ leanwarp verify SqNonneg.lean --declaration sq_nonneg_example \
|
|
|
178
193
|
```
|
|
179
194
|
|
|
180
195
|
LeanWarp reads the statement on its own, with only that context, and checks the
|
|
181
|
-
proof against it with Lean's kernel
|
|
182
|
-
statement means.
|
|
183
|
-
|
|
196
|
+
proof against it with Lean's kernel, in a separate checker that never runs your
|
|
197
|
+
source. So the proof can't change what the statement means. The context may
|
|
198
|
+
import only the environment's packages, such as Mathlib. Proofs that use
|
|
199
|
+
`sorry`, `admit`, `native_decide` or new axioms are rejected.
|
|
184
200
|
|
|
185
201
|
## 5. Stop the worker
|
|
186
202
|
|
|
@@ -195,6 +211,46 @@ included, so stop it when you're done. Closing your terminal does not stop it.
|
|
|
195
211
|
Stopping keeps your uploaded files and results in the workspace. The next
|
|
196
212
|
command starts a new worker.
|
|
197
213
|
|
|
214
|
+
## 6. Check a project in CI
|
|
215
|
+
|
|
216
|
+
Three commands check every file in a fresh checkout and leave nothing behind:
|
|
217
|
+
|
|
218
|
+
- `leanwarp connect --ephemeral` creates a workspace for this run alone.
|
|
219
|
+
- `leanwarp check --all` checks every file that uploads, strictly, in as many
|
|
220
|
+
batches of 64 as it needs, and prints one result. It waits until the last
|
|
221
|
+
batch finishes; its exit code is `0` if every file passed, `1` if any failed,
|
|
222
|
+
`4` if a file was left without a verdict (timed out or not completed), and `3`
|
|
223
|
+
if the work outlived the wait.
|
|
224
|
+
- `leanwarp stop --delete` stops the worker, cancels any running operation, then
|
|
225
|
+
deletes the workspace and its results. It deletes only the workspace that
|
|
226
|
+
`--ephemeral` created. If a request whose response was lost cannot be resent,
|
|
227
|
+
it leaves the workspace stopped, keeps the request for `leanwarp recover`, and
|
|
228
|
+
exits `2`; `errors` says which step failed.
|
|
229
|
+
|
|
230
|
+
A GitHub Actions job, with your key saved as the secret `LEANWARP_API_KEY`:
|
|
231
|
+
|
|
232
|
+
```yaml
|
|
233
|
+
jobs:
|
|
234
|
+
lean:
|
|
235
|
+
runs-on: ubuntu-latest
|
|
236
|
+
env:
|
|
237
|
+
LEANWARP_API_KEY: ${{ secrets.LEANWARP_API_KEY }}
|
|
238
|
+
steps:
|
|
239
|
+
- uses: actions/checkout@v4
|
|
240
|
+
- uses: astral-sh/setup-uv@v6
|
|
241
|
+
- run: uv tool install leanwarp
|
|
242
|
+
- run: leanwarp connect --ephemeral --max-spend 1
|
|
243
|
+
- run: leanwarp check --all
|
|
244
|
+
- if: always()
|
|
245
|
+
run: leanwarp stop --delete
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Any other operation takes `--block` to wait until it finishes in the same way,
|
|
249
|
+
for example `leanwarp verify Main.lean --declaration NAME --target '…' --block`,
|
|
250
|
+
and so does `leanwarp wait --block`. A blocking wait ends at the operation's
|
|
251
|
+
`--execution-timeout` (600 seconds unless you set one) plus five minutes to start
|
|
252
|
+
a worker.
|
|
253
|
+
|
|
198
254
|
Next: [set up an agent](agents.md), or read the
|
|
199
255
|
[reference](../src/leanwarp_cloud/skills/leanwarp/references/usage.md) for every
|
|
200
256
|
command, limit and recovery step.
|