lcode-cli 0.61.0__py3-none-any.whl → 0.62.0__py3-none-any.whl
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.
- lcode/__init__.py +1 -1
- lcode/agent_checks.py +39 -6
- lcode/checkpoints.py +12 -0
- lcode/checks.py +83 -7
- lcode/docs/automation.md +1 -1
- lcode/docs/public-benchmarks.md +11 -5
- lcode/docs/quickstart.md +1 -1
- lcode/docs/usage.md +16 -5
- lcode/harbor_bench.py +16 -5
- {lcode_cli-0.61.0.dist-info → lcode_cli-0.62.0.dist-info}/METADATA +1 -1
- {lcode_cli-0.61.0.dist-info → lcode_cli-0.62.0.dist-info}/RECORD +14 -14
- {lcode_cli-0.61.0.dist-info → lcode_cli-0.62.0.dist-info}/WHEEL +0 -0
- {lcode_cli-0.61.0.dist-info → lcode_cli-0.62.0.dist-info}/entry_points.txt +0 -0
- {lcode_cli-0.61.0.dist-info → lcode_cli-0.62.0.dist-info}/licenses/LICENSE +0 -0
lcode/__init__.py
CHANGED
lcode/agent_checks.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from collections.abc import Iterable
|
|
6
|
+
from pathlib import Path
|
|
6
7
|
from typing import TYPE_CHECKING, cast
|
|
7
8
|
|
|
8
9
|
from lcode import (
|
|
@@ -115,17 +116,30 @@ class Checks(AgentBase):
|
|
|
115
116
|
def model_ran_checks(self, command: str, result: str) -> bool:
|
|
116
117
|
"""Whether a command the model ran was the project's checks, and they passed."""
|
|
117
118
|
check = self.project_check()
|
|
118
|
-
if check is None or not checks.covers(check, command) or checks.
|
|
119
|
+
if check is None or not checks.covers(check, command) or not checks.run_passed(check, command, result):
|
|
119
120
|
return False
|
|
120
121
|
self.check_results.append({"command": check.command, "exit_code": 0, "by": "model"})
|
|
121
122
|
return True
|
|
122
123
|
|
|
124
|
+
def check_folder(self, check: checks.Check) -> Path:
|
|
125
|
+
"""Where the checks run: the project's root, wherever the model's last `cd` left its shell. A command from the
|
|
126
|
+
user's own setting runs where they started lcode."""
|
|
127
|
+
return self.workspace if check.source == checks.YOUR_SETTING else project_root_or_cwd(self.cwd)
|
|
128
|
+
|
|
129
|
+
def files_changed(self) -> list[str]:
|
|
130
|
+
"""The files this request changed, with the model's file tools or with its shell commands."""
|
|
131
|
+
return [*self.tools.before, *self.checkpoints.changed_so_far()]
|
|
132
|
+
|
|
123
133
|
def run_check(self, check: checks.Check, round_: int) -> str | None:
|
|
124
134
|
"""Run the checks after a change. Returns what to tell the model when they fail, else None."""
|
|
125
135
|
self.say(f"Checking the work: {check.command} (from {check.source})")
|
|
126
136
|
result = self.replay.check_result(check.command) if self.replay is not None else None
|
|
127
137
|
if result is None:
|
|
128
|
-
|
|
138
|
+
here, self.cwd = self.cwd, self.check_folder(check)
|
|
139
|
+
try:
|
|
140
|
+
result = self.tools.run("bash", {"command": check.command, "timeout": checks.TIMEOUT})
|
|
141
|
+
finally:
|
|
142
|
+
self.cwd = here
|
|
129
143
|
code = checks.exit_code(result)
|
|
130
144
|
if self.trace is not None:
|
|
131
145
|
self.trace.check(check.command, result, code)
|
|
@@ -138,15 +152,34 @@ class Checks(AgentBase):
|
|
|
138
152
|
return None
|
|
139
153
|
if checks.no_tests(check, result):
|
|
140
154
|
self.say(f"The checks found no tests to run ({check.command}).")
|
|
141
|
-
|
|
142
|
-
if checks.missing(check, result):
|
|
155
|
+
elif checks.missing(check, result):
|
|
143
156
|
self.say(
|
|
144
157
|
f"The checks couldn't run ({check.command}): {result.splitlines()[0][:160]}. Install what they need, "
|
|
145
158
|
'or set the command: lcode config set checks "…" (or checks off).',
|
|
146
159
|
warning=True,
|
|
147
160
|
)
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
elif checks.no_test_ran(check, result) and not checks.names_any(result, self.files_changed()):
|
|
162
|
+
self.say(
|
|
163
|
+
f"The checks stopped before running a test ({check.command}): {checks.stop_reason(result)} It doesn't "
|
|
164
|
+
"name a file this request changed, so the model isn't asked to fix it. To get checks that run, fix "
|
|
165
|
+
'that or set the command: lcode config set checks "…" (or checks off).',
|
|
166
|
+
warning=True,
|
|
167
|
+
)
|
|
168
|
+
else:
|
|
169
|
+
return self.failed_check(check, result, code, round_)
|
|
170
|
+
self.check_results[-1]["exit_code"] = None # no test ran: whoever reads this later shouldn't read a failure
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
|
+
def failed_check(self, check: checks.Check, result: str, code: int, round_: int) -> str:
|
|
174
|
+
"""Say that the checks failed, or didn't finish; what to tell the model."""
|
|
175
|
+
if checks.timed_out(result):
|
|
176
|
+
self.check_results[-1]["exit_code"] = None
|
|
177
|
+
self.say(
|
|
178
|
+
f"The checks didn't finish in {checks.TIMEOUT} seconds and were stopped ({check.command}). To use a "
|
|
179
|
+
'faster command: lcode config set checks "…" (or checks off).',
|
|
180
|
+
warning=True,
|
|
181
|
+
)
|
|
182
|
+
elif round_ >= checks.MAX_ROUNDS:
|
|
150
183
|
then = "" if self.can_escalate() else ": the model will say what's left"
|
|
151
184
|
self.say(f"Checks still fail ({check.command}, exit code {code}){then}.", warning=True)
|
|
152
185
|
else:
|
lcode/checkpoints.py
CHANGED
|
@@ -386,6 +386,18 @@ class Checkpoints:
|
|
|
386
386
|
f"[dim]↶ Checkpoint {cp.n}: {count} file{'' if count == 1 else 's'} changed · /undo reverts them[/]"
|
|
387
387
|
)
|
|
388
388
|
|
|
389
|
+
def changed_so_far(self) -> list[str]:
|
|
390
|
+
"""The files changed so far in the running request, by shell commands too, without a nested repository's."""
|
|
391
|
+
cp = self._current
|
|
392
|
+
if cp is None:
|
|
393
|
+
return []
|
|
394
|
+
store = Store(Path(cp.worktree))
|
|
395
|
+
try:
|
|
396
|
+
changes = store.changes(cp.before, store.tree())
|
|
397
|
+
except CheckpointError:
|
|
398
|
+
return []
|
|
399
|
+
return [c["path"] for c in changes if not (store.worktree / c["path"]).is_dir()]
|
|
400
|
+
|
|
389
401
|
def ref(self, n: int) -> str:
|
|
390
402
|
return f"refs/lcode/{self.session_id}/{n}"
|
|
391
403
|
|
lcode/checks.py
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Small models call work done after a syntax check, and telling them to verify isn't enough. So after a request
|
|
4
4
|
that changed files, lcode runs the project's check command itself (its tests, or a linter) before the answer
|
|
5
5
|
counts as final. When it fails, the output goes back to the model, which keeps working, at most `MAX_ROUNDS`
|
|
6
|
-
times; then the answer says plainly that the checks still fail.
|
|
6
|
+
times; then the answer says plainly that the checks still fail. A run in which no test ran says nothing about the
|
|
7
|
+
change, so it only goes back to the model when its error names a file the request changed.
|
|
7
8
|
|
|
8
9
|
The command is, in order: the repository's `.lcode/settings.toml` (`[checks] command = "…"`, used once the
|
|
9
10
|
repository is trusted, like its hooks), the user's `checks` setting, or what the project looks like: pytest,
|
|
@@ -25,6 +26,7 @@ MAX_ROUNDS = 2 # times the model gets failing checks back before lcode stops as
|
|
|
25
26
|
TIMEOUT = 600 # seconds a check may run
|
|
26
27
|
OUTPUT_TAIL = 6000 # characters of a failing check's output the model gets back
|
|
27
28
|
EXIT = re.compile(r"\[exit code: (-?\d+)\]\s*$")
|
|
29
|
+
YOUR_SETTING = "your configuration (checks)" # the source of a command from the user's own `checks` setting
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
@dataclass
|
|
@@ -49,7 +51,7 @@ def find(root: Path, setting: str, trusted: bool) -> Check | None:
|
|
|
49
51
|
if command:
|
|
50
52
|
return Check(command, ".lcode/settings.toml")
|
|
51
53
|
if setting != "auto":
|
|
52
|
-
return Check(setting,
|
|
54
|
+
return Check(setting, YOUR_SETTING)
|
|
53
55
|
return detect(root)
|
|
54
56
|
|
|
55
57
|
|
|
@@ -154,6 +156,51 @@ def no_tests(check: Check, result: str) -> bool:
|
|
|
154
156
|
return exit_code(result) == NO_TESTS and bool(re.search(r"pytest|unittest", check.command))
|
|
155
157
|
|
|
156
158
|
|
|
159
|
+
PYTEST_STOPPED = (2, 3, 4) # pytest's exit codes for: interrupted (errors while collecting), internal error, bad usage
|
|
160
|
+
PYTEST_COUNTS = re.compile(r"\b\d+ (?:passed|failed)\b")
|
|
161
|
+
UNITTEST_COUNT = re.compile(r"^Ran \d+ tests? in ", re.M)
|
|
162
|
+
NOT_IMPORTED = re.compile(r"No module named '([\w.]+)'")
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def no_test_ran(check: Check, result: str) -> bool:
|
|
166
|
+
"""Whether the test runner stopped before its first test, so the run says nothing about the code.
|
|
167
|
+
|
|
168
|
+
pytest stops at an error while collecting. unittest ends in a traceback instead of `Ran N tests` when its discovery
|
|
169
|
+
fails; a test module that doesn't import is a failed test there (`Ran 1 test`), so that's not this.
|
|
170
|
+
"""
|
|
171
|
+
code = exit_code(result)
|
|
172
|
+
if re.search(r"\bpytest\b", check.command):
|
|
173
|
+
return code in PYTEST_STOPPED and not PYTEST_COUNTS.search(result)
|
|
174
|
+
if re.search(r"\bunittest\b", check.command):
|
|
175
|
+
return code == 1 and "Traceback (most recent call last)" in result and not UNITTEST_COUNT.search(result)
|
|
176
|
+
return False
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def names_any(result: str, files: Iterable[str]) -> bool:
|
|
180
|
+
"""Whether a check's output points at one of these files: by its path, or as a module it can't find."""
|
|
181
|
+
|
|
182
|
+
def mentions(text: str, name: str) -> bool:
|
|
183
|
+
return re.search(rf"(?<![\w-]){re.escape(name)}(?![\w-])", text) is not None
|
|
184
|
+
|
|
185
|
+
modules = [module.replace(".", "/") for module in NOT_IMPORTED.findall(result)]
|
|
186
|
+
return any(mentions(result, rel) or any(mentions(rel, module) for module in modules) for rel in files)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
REASON_LIMIT = 240 # Django's ImproperlyConfigured says what to set, in 224
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def stop_reason(result: str) -> str:
|
|
193
|
+
"""A sentence on why a test run stopped before its first test: pytest's first error, or a traceback's end."""
|
|
194
|
+
lines = [line.strip() for line in result.splitlines() if line.strip() and not line.startswith("[")]
|
|
195
|
+
reason = next((line[1:].strip() for line in lines if line.startswith("E ")), lines[-1] if lines else "no output")
|
|
196
|
+
return reason.rstrip(".") + "." if len(reason) <= REASON_LIMIT else reason[: REASON_LIMIT - 1] + "…"
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def timed_out(result: str) -> bool:
|
|
200
|
+
"""Whether lcode stopped the check at its time limit: it didn't fail, it didn't finish."""
|
|
201
|
+
return exit_code(result) == -9 and "\n[Command timed out after " in result
|
|
202
|
+
|
|
203
|
+
|
|
157
204
|
def exit_code(result: str) -> int | None:
|
|
158
205
|
"""The exit code at the end of a bash tool result (None: it didn't run, e.g. not allowed)."""
|
|
159
206
|
found = EXIT.search(result)
|
|
@@ -165,7 +212,31 @@ def covers(check: Check, command: str) -> bool:
|
|
|
165
212
|
return " ".join(check.command.split()) in " ".join(command.split())
|
|
166
213
|
|
|
167
214
|
|
|
215
|
+
KEEPS_EXIT_CODE = re.compile(r"\d*>&\d+|&>>?|&&") # redirections and `&&`, after the check
|
|
216
|
+
HIDES_EXIT_CODE = re.compile(r"[|;&\n]") # a pipe, `||`, `;`, `&` or another line: the exit code isn't the check's
|
|
217
|
+
RUN_FAILED = re.compile(r"\b[1-9]\d* (?:failed|errors?)\b|^(?:FAILED|ERROR)\b", re.M)
|
|
218
|
+
RUN_PASSED = re.compile(r"\b[1-9]\d* passed\b|^OK\b", re.M)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def run_passed(check: Check, command: str, result: str) -> bool:
|
|
222
|
+
"""Whether the model's own run of the check passed. `pytest -q | tail` exits with tail's 0 when tests fail, so when
|
|
223
|
+
the exit code isn't the check's, only the output can say: a test runner's summary, with nothing failing."""
|
|
224
|
+
if exit_code(result) != 0:
|
|
225
|
+
return False
|
|
226
|
+
found = re.search(r"\s+".join(map(re.escape, check.command.split())), command)
|
|
227
|
+
after = KEEPS_EXIT_CODE.sub(" ", command[found.end() :]).rstrip() if found else ""
|
|
228
|
+
if not HIDES_EXIT_CODE.search(after):
|
|
229
|
+
return True
|
|
230
|
+
return RUN_PASSED.search(result) is not None and RUN_FAILED.search(result) is None
|
|
231
|
+
|
|
232
|
+
|
|
168
233
|
def failure_note(check: Check, result: str, round_: int) -> str:
|
|
234
|
+
if timed_out(result):
|
|
235
|
+
return (
|
|
236
|
+
f"[lcode] The project's checks (`{check.command}`) didn't finish in {TIMEOUT} seconds and were stopped, so "
|
|
237
|
+
"they don't say whether your changes work. If your change could make something hang, look at that. "
|
|
238
|
+
"Otherwise run the tests that cover your change, and say in your answer that the full checks didn't finish."
|
|
239
|
+
)
|
|
169
240
|
output = result if len(result) <= OUTPUT_TAIL else "…" + result[-OUTPUT_TAIL:]
|
|
170
241
|
last = round_ >= MAX_ROUNDS
|
|
171
242
|
return (
|
|
@@ -267,10 +338,12 @@ def unrun_note(scripts: list[str]) -> str:
|
|
|
267
338
|
|
|
268
339
|
# ----------------------------------------------------------------------------- code written, never run
|
|
269
340
|
|
|
341
|
+
# Not .sql: one can be a migration, and asking the model to run that could change a real database.
|
|
270
342
|
CODE_SUFFIXES = frozenset(
|
|
271
343
|
{".py", ".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx", ".rs", ".go", ".c", ".cc", ".cpp", ".java", ".kt", ".rb",
|
|
272
|
-
".php", ".pl", ".lua", ".jl", ".r", ".scala", ".swift", ".cs"}
|
|
344
|
+
".php", ".pl", ".lua", ".jl", ".r", ".scala", ".swift", ".cs", ".sparql", ".rq"}
|
|
273
345
|
) # fmt: skip
|
|
346
|
+
SPARQL_SUFFIXES = (".sparql", ".rq")
|
|
274
347
|
# Checks that read the code without running it (syntax, lint, types): they don't show that it works.
|
|
275
348
|
STATIC_ONLY = re.compile(
|
|
276
349
|
r"\bast\.parse\b|\bpy_compile\b|\bcompileall\b|(?:^|\s)-fsyntax-only\b|\b(?:node|deno)\s+(?:-c|--check)\b"
|
|
@@ -288,7 +361,7 @@ NOT_FOUND = re.compile(r"(?:^|:\s)([\w.+-]+): (?:command )?not found\s*$", re.M)
|
|
|
288
361
|
|
|
289
362
|
|
|
290
363
|
def is_code(rel: str) -> bool:
|
|
291
|
-
"""Whether a file is a program or
|
|
364
|
+
"""Whether a file is a program, module or query in a language that runs (shell scripts have their own check)."""
|
|
292
365
|
return Path(rel).suffix.lower() in CODE_SUFFIXES
|
|
293
366
|
|
|
294
367
|
|
|
@@ -319,16 +392,19 @@ def untested_note(files: list[str], missing: list[str], uv: bool) -> str:
|
|
|
319
392
|
note = (
|
|
320
393
|
f"[lcode] You wrote {names} in this request but haven't run {it} since your last change. Run {it} now and fix "
|
|
321
394
|
f"what fails, so you know {it} works before you say so: for a module, import it and call what you wrote; "
|
|
322
|
-
"for a server or anything else that keeps running, start it in the
|
|
323
|
-
"doesn't show that it works."
|
|
395
|
+
"for a query, run it on its data; for a server or anything else that keeps running, start it in the "
|
|
396
|
+
"background and try it. A syntax check doesn't show that it works."
|
|
324
397
|
)
|
|
325
398
|
if missing:
|
|
326
399
|
note += f" {', '.join(f'`{m}`' for m in missing)} isn't installed here."
|
|
327
|
-
|
|
400
|
+
sparql = any(f.lower().endswith(SPARQL_SUFFIXES) for f in files)
|
|
401
|
+
if uv and (sparql or any(f.endswith(".py") for f in files)):
|
|
328
402
|
note += (
|
|
329
403
|
" To run Python code without changing this machine's Python, `uv run --with PACKAGE python FILE` fetches "
|
|
330
404
|
"Python and the packages it needs into a throwaway environment."
|
|
331
405
|
)
|
|
406
|
+
if sparql:
|
|
407
|
+
note += " For a SPARQL query, the package is `rdflib`."
|
|
332
408
|
return note + f" If you can't run {it}, say plainly in your answer that {it} is untested, and why."
|
|
333
409
|
|
|
334
410
|
|
lcode/docs/automation.md
CHANGED
|
@@ -56,7 +56,7 @@ went: `0` success, `1` an error, `3` stopped at `--max-steps`, `4` stopped becau
|
|
|
56
56
|
| `files_changed` | Files the request added (`A`), modified (`M`) or deleted (`D`), shell commands included |
|
|
57
57
|
| `usage` | Model requests and tokens; `prompt_tokens` includes tokens served from the prompt cache |
|
|
58
58
|
| `review` | What the [review](usage.md#a-review-before-the-answer) sent back to the model (`[]` when it found nothing; `null` when no review ran) |
|
|
59
|
-
| `checks` | The [checks](usage.md#checks-before-done) that ran after the change: `command`, `exit_code` (`null` when they weren't allowed to run) and `by` (`lcode`, or `model` when the model ran them itself) |
|
|
59
|
+
| `checks` | The [checks](usage.md#checks-before-done) that ran after the change: `command`, `exit_code` (`null` when they say nothing about the change: they weren't allowed to run, no test ran, or they didn't finish) and `by` (`lcode`, or `model` when the model ran them itself) |
|
|
60
60
|
| `error` | What went wrong, when `status` is `error` |
|
|
61
61
|
| `session_id` | Continue the conversation later with `lcode --resume <id>` |
|
|
62
62
|
|
lcode/docs/public-benchmarks.md
CHANGED
|
@@ -17,9 +17,13 @@ whether it passed.
|
|
|
17
17
|
## What you need
|
|
18
18
|
|
|
19
19
|
- **Docker**, running.
|
|
20
|
-
- **uv**: lcode runs Harbor with `uvx`, so there's nothing else to install.
|
|
20
|
+
- **uv**: lcode runs Harbor with `uvx`, so there's nothing else to install. Harbor runs from uv's
|
|
21
|
+
cache, so don't clear it during a run (`uv cache clean`): the attempts still to come can't start.
|
|
21
22
|
- **Disk space** for the tasks' images: about 20 GB for the dev slice. Each SWE-bench task has an
|
|
22
|
-
image of its own, 1–3 GB.
|
|
23
|
+
image of its own, 1–3 GB. Keep about 25 GB free beyond that while it runs: an attempt at
|
|
24
|
+
`torch-tensor-parallelism` takes about 21 GB until it ends, because the model and then the task's
|
|
25
|
+
tests each install torch with its GPU libraries. On a smaller disk, run the other tasks with
|
|
26
|
+
`--tasks` (`lcode bench --harbor dev --list` shows them).
|
|
23
27
|
- **A model server the containers can reach.** lcode in a container finds your machine by itself:
|
|
24
28
|
as `host.docker.internal` with Docker Desktop (macOS, Windows), or as the container's gateway on
|
|
25
29
|
Linux. Ollama has to listen on more than `127.0.0.1` for that:
|
|
@@ -123,9 +127,11 @@ limits, so part of a difference can come from the machine rather than from lcode
|
|
|
123
127
|
|
|
124
128
|
The noise is how far pass@1 moves between runs of the same setup, estimated from how much each
|
|
125
129
|
task's attempts disagree: a task that always passes or always fails adds nothing, one that passes
|
|
126
|
-
half the time the most.
|
|
127
|
-
|
|
128
|
-
with
|
|
130
|
+
half the time the most. One attempt can't disagree with itself, so that task's pass rate comes from
|
|
131
|
+
both runs. A change counts when it's more than twice the standard error of the difference. On the dev
|
|
132
|
+
slice, with three attempts per task, that's about 9 points. `--compare` warns when the two runs didn't
|
|
133
|
+
have the same number of attempts (a container that didn't start, say), and exits with 1 when the second
|
|
134
|
+
result dropped beyond the noise, so a script can stop on it.
|
|
129
135
|
|
|
130
136
|
**The release rule:** a release that changes lcode's prompts, tools or context handling ships only
|
|
131
137
|
if the dev slice doesn't drop beyond the noise against the last baseline, and the comparison goes on
|
lcode/docs/quickstart.md
CHANGED
lcode/docs/usage.md
CHANGED
|
@@ -224,9 +224,19 @@ runs the project's checks itself before the answer is final:
|
|
|
224
224
|
- **When they fail,** the model gets the output and keeps working, twice at most. After that its answer
|
|
225
225
|
says what still fails instead of claiming success. A failure that the change didn't cause is
|
|
226
226
|
reported, not chased, and the checks run again only if the model changes something more.
|
|
227
|
-
- **When
|
|
228
|
-
|
|
227
|
+
- **When no test ran,** lcode says so and doesn't send it to the model: no tests were collected, the
|
|
228
|
+
test runner isn't installed, or the run stopped before its first test (pytest on an error while
|
|
229
|
+
collecting, unittest with a traceback instead of `Ran N tests`). A project can be like that before
|
|
230
|
+
anything changes, and then the run says nothing about the change. If the error names a file the
|
|
231
|
+
request changed, shell commands included, it's the model's to fix, and it gets the output like any
|
|
232
|
+
other failure.
|
|
233
|
+
- **When they don't finish** in 10 minutes, lcode stops them and tells the model that they don't say
|
|
234
|
+
whether its change works. A suite that's simply this slow needs a faster command (below).
|
|
229
235
|
- **When the model already ran them** after its last change and they passed, they aren't run again.
|
|
236
|
+
A run piped into another program (`pytest -q | tail`) exits with that program's code, so it counts
|
|
237
|
+
only if its output shows a test summary with nothing failing.
|
|
238
|
+
- **Where they run:** in the project's root, wherever the model's shell went last. A command from your
|
|
239
|
+
own `checks` setting runs in the folder you started lcode in.
|
|
230
240
|
- **Permission:** they run like any other command, so in `ask` mode the first run asks (++a++ allows
|
|
231
241
|
them for the session).
|
|
232
242
|
- **Programs** using `lcode -p --output json` see the runs in the result's `checks`.
|
|
@@ -263,9 +273,10 @@ or reading it doesn't count as running it. `checks = "off"` turns this off too.
|
|
|
263
273
|
|
|
264
274
|
**Code it never ran.** A model that writes a new module and finds no Python, or checks only its
|
|
265
275
|
syntax, tends to call it done, and the first run shows the error. When a request wrote a new code
|
|
266
|
-
file (Python, JavaScript, TypeScript, Rust, Go, C, Java and other languages that run
|
|
267
|
-
since its last change ran it, lcode sends it back once: run it (import a module
|
|
268
|
-
wrote; start a server in the background and try it) and fix
|
|
276
|
+
file (Python, JavaScript, TypeScript, Rust, Go, C, Java and other languages that run, or a SPARQL
|
|
277
|
+
query) and no command since its last change ran it, lcode sends it back once: run it (import a module
|
|
278
|
+
and call what it wrote; run a query on its data; start a server in the background and try it) and fix
|
|
279
|
+
what fails, or say plainly that it's
|
|
269
280
|
untested and why. A command counts when it names the file or its module, or runs tests, and its
|
|
270
281
|
program was there: a syntax, lint or type check, `python3: command not found` or a command that
|
|
271
282
|
only reads doesn't count. When `uv` is installed, the note adds that `uv run --with PACKAGE python FILE` runs
|
lcode/harbor_bench.py
CHANGED
|
@@ -602,10 +602,14 @@ def pass_at_1(passed: list[list[bool]]) -> float:
|
|
|
602
602
|
return statistics.fmean(statistics.fmean(p) for p in passed)
|
|
603
603
|
|
|
604
604
|
|
|
605
|
-
def standard_error(passed: list[list[bool]]) -> float:
|
|
605
|
+
def standard_error(passed: list[list[bool]], other: list[list[bool]]) -> float:
|
|
606
606
|
"""How much pass@1 would move between runs, from how much each task's attempts disagree: a task that always
|
|
607
|
-
passes or always fails adds nothing, one that passes half the time the most.
|
|
608
|
-
|
|
607
|
+
passes or always fails adds nothing, one that passes half the time the most. One attempt can't disagree with
|
|
608
|
+
itself, so that task's pass rate comes from both runs (`other` is the other run's attempts, task by task)."""
|
|
609
|
+
variance = 0.0
|
|
610
|
+
for attempts, others in zip(passed, other, strict=True):
|
|
611
|
+
rate = statistics.fmean(attempts if len(attempts) > 1 else attempts + others)
|
|
612
|
+
variance += rate * (1 - rate) / max(len(attempts) - 1, 1)
|
|
609
613
|
return math.sqrt(variance) / len(passed)
|
|
610
614
|
|
|
611
615
|
|
|
@@ -638,8 +642,15 @@ def compare(old: Saved, new: Saved) -> tuple[list[str], bool]:
|
|
|
638
642
|
lines.append(f" {task}: {sum(before)}/{len(before)} → {sum(after)}/{len(after)}")
|
|
639
643
|
if not both:
|
|
640
644
|
return [*lines, "[red]No task ran in both, so there's nothing to compare.[/]"], False
|
|
641
|
-
|
|
642
|
-
|
|
645
|
+
runs_before, runs_after = [old.passed[t] for t in both], [new.passed[t] for t in both]
|
|
646
|
+
ran_before, ran_after = sum(map(len, runs_before)), sum(map(len, runs_after))
|
|
647
|
+
if ran_before != ran_after:
|
|
648
|
+
lines.append(
|
|
649
|
+
f"[yellow]Not the same number of attempts ran: {ran_before} before and {ran_after} after, over the tasks "
|
|
650
|
+
"in both. With fewer attempts, a result says less.[/]"
|
|
651
|
+
)
|
|
652
|
+
a, b = pass_at_1(runs_before), pass_at_1(runs_after)
|
|
653
|
+
noise = 2 * math.hypot(standard_error(runs_before, runs_after), standard_error(runs_after, runs_before))
|
|
643
654
|
change = f"{(b - a) * 100:+.0f} points; the noise is ±{noise * 100:.0f}"
|
|
644
655
|
if a - b > noise + 1e-9:
|
|
645
656
|
verdict = f"[red]a drop beyond the noise ({change})[/]"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: lcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.62.0
|
|
4
4
|
Summary: A local-first terminal coding agent powered by open-weight models on your own GPU or Mac, via Ollama.
|
|
5
5
|
Project-URL: Homepage, https://nasser1941.github.io/lcode/
|
|
6
6
|
Project-URL: Documentation, https://nasser1941.github.io/lcode/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
lcode/docs/agents.md,sha256=A1heI40IKf767li9ffAH1grLlo2RhfbmB7lHL2uhZ4g,6915
|
|
2
|
-
lcode/docs/automation.md,sha256=
|
|
2
|
+
lcode/docs/automation.md,sha256=wfpLlEjFuIsOgveKNIW8WU-Vu5HwJR-xMmOf58OENUA,9521
|
|
3
3
|
lcode/docs/bench.md,sha256=GKbhecNRVI8PTLnsB0a7eU8B7wD1qo9Y9wGylONbagc,18960
|
|
4
4
|
lcode/docs/commands.md,sha256=PpRcOoKZXw1OQyGxEbmipEPDYAid1fLDiaarHax7ynU,5973
|
|
5
5
|
lcode/docs/configuration.md,sha256=9L5mZtN9HyDQ5cXugUpUX5AXxxR1qNrwLmNMUlxGKgc,11112
|
|
@@ -14,21 +14,21 @@ lcode/docs/mcp.md,sha256=Ol3ScuP4i2KsoN9xaSEbnm86Tvoc1qnUV7zkRprWwHo,15168
|
|
|
14
14
|
lcode/docs/memory.md,sha256=XbsNnTwRdnUEYW7_2U1GHbtK0uOjTxR-s2EujgJbR0Y,6889
|
|
15
15
|
lcode/docs/models.md,sha256=Un3iWRduCkjQ1abajv46roFaTuJYeuE8Rw2XtgWXbYU,18144
|
|
16
16
|
lcode/docs/modes.md,sha256=vNQv5K-lk6egNQNlnOHk8YeIdoAsmyaWvSu-RbQeZnQ,34039
|
|
17
|
-
lcode/docs/public-benchmarks.md,sha256=
|
|
18
|
-
lcode/docs/quickstart.md,sha256=
|
|
17
|
+
lcode/docs/public-benchmarks.md,sha256=vYv4-kUV0RN3G-FK_YCcr2_WkIgn41kgtA_DDqwKNkA,11052
|
|
18
|
+
lcode/docs/quickstart.md,sha256=sI36KW-L0MbPs2X79gKzvGAAiwECO7kMmIFeawRZn6s,3403
|
|
19
19
|
lcode/docs/sandbox.md,sha256=-_jc2I0LXKQIYCz_JOuHGaP2ehVuEqEepKqMATlFpZY,4064
|
|
20
20
|
lcode/docs/search.md,sha256=1Sqkfc9NRftpcfBFG9b_D8Ns-octH399AaaSNBPHq28,4251
|
|
21
21
|
lcode/docs/servers.md,sha256=0ddumHseQXx0CP0nqzgwV-493s81kdEBa6qtUYe9t6k,5718
|
|
22
22
|
lcode/docs/traces.md,sha256=_rP0XIgyeiZPld4VjP-ISlyf6ZPoKQBTQPLVbyp5fUE,10201
|
|
23
23
|
lcode/docs/troubleshooting.md,sha256=ISHpvFtWNt3H1sANDOqicP12L4umpqNzkCw_o0X-89Y,8184
|
|
24
|
-
lcode/docs/usage.md,sha256=
|
|
25
|
-
lcode/__init__.py,sha256=
|
|
24
|
+
lcode/docs/usage.md,sha256=BMQ0yXYXaH0-ZvFcdN1TYMMROXQElB0S8vyD30L026Y,51268
|
|
25
|
+
lcode/__init__.py,sha256=WdoZUGYgPTCCB5Z7Yaulmg5d65rPDL3y0aLQ5W8Fi_U,473
|
|
26
26
|
lcode/__main__.py,sha256=s5N5pryX2FAu93GGZ3FxUrIXHWGzxz66lKUoaV_h8Ws,35
|
|
27
27
|
lcode/acp.py,sha256=9S2n1ycB_IWeOv3zIbuwa6oFW2wyC-GKXcc3Jg5AfQk,30326
|
|
28
28
|
lcode/action.py,sha256=wuT5F9EJCdEligPeytzmEi8FpahWBhXer528tpuTj_k,16711
|
|
29
29
|
lcode/agent.py,sha256=Xd4dW9RJWBri435eQ4ECVxgaluwvjFDcI3xQmheUgkw,37778
|
|
30
30
|
lcode/agent_base.py,sha256=55HSTcWzdUKAu6dqtDak8eMQRJf9kDqMfL0m9fe8ihQ,12958
|
|
31
|
-
lcode/agent_checks.py,sha256=
|
|
31
|
+
lcode/agent_checks.py,sha256=CGmrbr7VWMHx5wHprv_ouCOe861eHHxiUUReV0FuYQA,9257
|
|
32
32
|
lcode/agent_context.py,sha256=arKDF7qYmKEadtcjXDDkCWXBMjT1dut3Rhp7rzT1Yck,7894
|
|
33
33
|
lcode/agent_model.py,sha256=LH7luk4OT_9muiDpb-otWi1eztaaLmbwO753Ih3C-B0,16446
|
|
34
34
|
lcode/agent_prompt.py,sha256=zRWCQpjgUklZ-bwYIPpvfQuNh2OCnSHsGYg5qd6cdTM,13930
|
|
@@ -47,8 +47,8 @@ lcode/bench_quick.py,sha256=6TwPzj3QF-sUVxc2DX7q1C1Sg1q9x5fHsPZRt9va4ZY,21073
|
|
|
47
47
|
lcode/bench_quotes.py,sha256=vdVqxrUEjnmP5Bb55ChRI4E0Qmk8IUrldUqukKzwkc4,21868
|
|
48
48
|
lcode/bench_runtime.py,sha256=r2J9qkIMUftSB8X6PQnatBH8lFmJTytOXUQrnhfJIJU,6842
|
|
49
49
|
lcode/catalog.py,sha256=eqTRyLBjLF32cIP8mnBK08cugbJ9kpovhX0qOA5V4lw,4938
|
|
50
|
-
lcode/checkpoints.py,sha256=
|
|
51
|
-
lcode/checks.py,sha256=
|
|
50
|
+
lcode/checkpoints.py,sha256=brfxR2lbE3UsdvQOzb82m2puDXWz0FfSUGIk6-rnTF4,18845
|
|
51
|
+
lcode/checks.py,sha256=MxXBmlXr1c0_TL7jnAv3LZYizVmm8aPWAl48eZmvijo,21006
|
|
52
52
|
lcode/cli.py,sha256=xj1SN3ohnndw21J9sHgQHUr_6jvWr5La6zfZwRj-q8s,32269
|
|
53
53
|
lcode/cli_args.py,sha256=LHxIRCGSPbVUkcFaRBF8h1H4YG9KV2p-lxg8HR-iuCg,12450
|
|
54
54
|
lcode/clipboard.py,sha256=nTSdJyCXPdtjH947RjvB3QvRqnL5HZsS9KB8EkC42cc,5138
|
|
@@ -66,7 +66,7 @@ lcode/film.py,sha256=uuysRu9p-oxVgSE_OPIOJoKyH3eH9QGxgOo2FMVymF0,14472
|
|
|
66
66
|
lcode/frontmatter.py,sha256=Bx0n4vLPhp7ZCWx-g7xqzqNy5VoKBxyeeikh5UFB_gA,2441
|
|
67
67
|
lcode/gitflow.py,sha256=6j_nnCBZXkX1qhTI7K4CyZ5D0NAZLpH96weFEo64AkQ,27913
|
|
68
68
|
lcode/harbor.py,sha256=2lBANNvisos_spIuOuscoWS4sSzXsr_XQRg7VJxHm84,3616
|
|
69
|
-
lcode/harbor_bench.py,sha256=
|
|
69
|
+
lcode/harbor_bench.py,sha256=EmVxCFDDBlgcyRJMTC5zP9r3G0VEje5A08_fEr-ncNc,40361
|
|
70
70
|
lcode/hardware.py,sha256=GmQiT65jO0d_ghbKpodsZYcingO9GbcGBm6OMJesFo4,6318
|
|
71
71
|
lcode/hooks.py,sha256=iZM9H2hwGjT--xbkbCVLH44oB20Q_SV5XrFTo50NtIM,9398
|
|
72
72
|
lcode/imageopts.py,sha256=9gubf2j1CjiDHwXAlZ_CybJ5wj38NDtsItvwxrSUlL8,9760
|
|
@@ -149,8 +149,8 @@ lcode/workflows/wan21-vace.json,sha256=vJsiRvLCXCjKIibOO0SGM3fT6bedAGxF8N2sN2vcP
|
|
|
149
149
|
lcode/workflows/wan22-fun-inp-5b.json,sha256=4HbKEezik8MHvxTMP6PjQUPQPfCeSu10U9FrC-DHKYw,3327
|
|
150
150
|
lcode/workflows/wan22-ti2v-5b.json,sha256=RcTehoC2pNizzlb7Ed3keJ56DiE7V5lhXmsvR2Y0smQ,3371
|
|
151
151
|
lcode/workflows/z-image-turbo-t2i.json,sha256=sHsL7xnnuULOuWGYlQrDl4jOTySdAmb2T82c_cChv0s,1585
|
|
152
|
-
lcode_cli-0.
|
|
153
|
-
lcode_cli-0.
|
|
154
|
-
lcode_cli-0.
|
|
155
|
-
lcode_cli-0.
|
|
156
|
-
lcode_cli-0.
|
|
152
|
+
lcode_cli-0.62.0.dist-info/METADATA,sha256=Nm6h7_9yT8bGYyk19HxhiI9E8FWV9D65ZRZwoD815DM,14260
|
|
153
|
+
lcode_cli-0.62.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
154
|
+
lcode_cli-0.62.0.dist-info/entry_points.txt,sha256=Hxsn_itbnbgft3U0FwxWdmEt0yoAV2LB-nJDnL9WT20,172
|
|
155
|
+
lcode_cli-0.62.0.dist-info/licenses/LICENSE,sha256=JWjmoL7nNIC1XUa-dZm2hwLUgjUQMFo6k8APb0idNzs,1074
|
|
156
|
+
lcode_cli-0.62.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|