lcode-cli 0.55.0__py3-none-any.whl → 0.56.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/cli.py +6 -0
- lcode/docs/public-benchmarks.md +34 -0
- lcode/docs/quickstart.md +1 -1
- lcode/docs/usage.md +1 -0
- lcode/harbor_bench.py +213 -12
- lcode/ollama.py +7 -0
- {lcode_cli-0.55.0.dist-info → lcode_cli-0.56.0.dist-info}/METADATA +2 -1
- {lcode_cli-0.55.0.dist-info → lcode_cli-0.56.0.dist-info}/RECORD +12 -12
- {lcode_cli-0.55.0.dist-info → lcode_cli-0.56.0.dist-info}/WHEEL +0 -0
- {lcode_cli-0.55.0.dist-info → lcode_cli-0.56.0.dist-info}/entry_points.txt +0 -0
- {lcode_cli-0.55.0.dist-info → lcode_cli-0.56.0.dist-info}/licenses/LICENSE +0 -0
lcode/__init__.py
CHANGED
lcode/cli.py
CHANGED
|
@@ -952,6 +952,12 @@ def build_subparsers() -> dict[str, argparse.ArgumentParser]:
|
|
|
952
952
|
help="public benchmarks instead: a slice of Terminal-Bench 2.0 and SWE-bench Verified, run with Harbor",
|
|
953
953
|
)
|
|
954
954
|
p.add_argument("--attempts", type=int, default=3, help="with --harbor: attempts per task (default: 3, for pass^3)")
|
|
955
|
+
p.add_argument(
|
|
956
|
+
"--agent",
|
|
957
|
+
choices=["lcode", "claude-code", "opencode", "codex"],
|
|
958
|
+
default="lcode",
|
|
959
|
+
help="with --harbor: the agent to run, for a comparison on the same model (default: lcode)",
|
|
960
|
+
)
|
|
955
961
|
p.add_argument(
|
|
956
962
|
"--docker-bridge",
|
|
957
963
|
action="store_true",
|
lcode/docs/public-benchmarks.md
CHANGED
|
@@ -97,6 +97,40 @@ Everything is saved in `~/.local/state/lcode/bench/<slice>-<time>/`:
|
|
|
97
97
|
- Harbor's own results: each attempt's log, the task's test output, and lcode's trace and session.
|
|
98
98
|
`uvx --from harbor harbor view <folder>` browses them.
|
|
99
99
|
|
|
100
|
+
## Other agents on the same model
|
|
101
|
+
|
|
102
|
+
`--agent` runs Claude Code, OpenCode or Codex on the same tasks, with the same model, context
|
|
103
|
+
window and time limits, so you can compare them with lcode:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
lcode bench --harbor dev qwen3.6-35b --context 64k # lcode
|
|
107
|
+
lcode bench --harbor dev qwen3.6-35b --context 64k --agent claude-code
|
|
108
|
+
lcode bench --harbor dev qwen3.6-35b --context 64k --agent opencode
|
|
109
|
+
lcode bench --harbor dev qwen3.6-35b --context 64k --agent codex
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Harbor installs the agent in each task's container, with approvals off. lcode sets the agent up the
|
|
113
|
+
way `ollama launch` does, with the Ollama on your machine:
|
|
114
|
+
|
|
115
|
+
- **Claude Code** uses Ollama's Anthropic-compatible API, with the model for every tier (subagents
|
|
116
|
+
too) and `ollama launch claude`'s settings: no telemetry, error reports or feedback prompts. Like
|
|
117
|
+
`ollama launch claude`, it doesn't tell Claude Code the context window.
|
|
118
|
+
- **OpenCode** uses an Ollama provider on Ollama's OpenAI-compatible API. The model is marked as a
|
|
119
|
+
reasoning model, with the limits of its context window.
|
|
120
|
+
- **Codex** uses Ollama's Responses API and `ollama launch codex`'s model catalog. That catalog gives
|
|
121
|
+
local models no base instructions, so Codex runs without its own system prompt, as it does with
|
|
122
|
+
`ollama launch codex`.
|
|
123
|
+
|
|
124
|
+
These agents' APIs can't set the context window per request, and Ollama's default is small (4K on
|
|
125
|
+
GPUs under 24 GB), so lcode makes a copy of the model with the context set:
|
|
126
|
+
`lcode-qwen3.6-35b-64k` for 64K. It uses the model's files, so nothing is downloaded, and
|
|
127
|
+
`ollama rm lcode-qwen3.6-35b-64k` removes it. Ollama recommends at least 64K for these agents.
|
|
128
|
+
|
|
129
|
+
The time per task leaves out installing the agent, which Harbor does in every task's container: up to
|
|
130
|
+
three minutes for Claude Code, so its runs take longer overall. The results go to
|
|
131
|
+
`~/.local/state/lcode/bench/<slice>-<agent>-<time>/`, and `lcode-bench.json` adds the agent and its
|
|
132
|
+
version.
|
|
133
|
+
|
|
100
134
|
## With Harbor directly
|
|
101
135
|
|
|
102
136
|
`lcode.harbor:Lcode` is an ordinary Harbor agent, so every Harbor dataset and option works:
|
lcode/docs/quickstart.md
CHANGED
lcode/docs/usage.md
CHANGED
|
@@ -11,6 +11,7 @@ lcode media [install MODEL] # image and video models: what fits here, what's in
|
|
|
11
11
|
lcode config [set|unset] # show or change settings
|
|
12
12
|
lcode bench [models] # score models on small coding tasks on this machine
|
|
13
13
|
lcode bench --harbor dev # public benchmarks: Terminal-Bench 2.0 and SWE-bench Verified
|
|
14
|
+
lcode bench --harbor dev --agent codex # the same with another agent on your model, to compare
|
|
14
15
|
lcode trace [action] [N] # past requests: show one step by step, export or replay it (see Run traces)
|
|
15
16
|
lcode mcp [catalog|add|list] # connect MCP servers: Jira, GitHub, AWS, databases… (see MCP servers)
|
|
16
17
|
lcode acp # run inside an editor over the Agent Client Protocol (see Editors)
|
lcode/harbor_bench.py
CHANGED
|
@@ -10,12 +10,16 @@ model can try overnight: Terminal-Bench 2.0 without model training and with at m
|
|
|
10
10
|
task, and SWE-bench Verified's two common difficulties. The dev slice is for everyday checks; the
|
|
11
11
|
held-out set is never used for tuning, only to confirm a change helps beyond the tasks it was
|
|
12
12
|
tuned on.
|
|
13
|
+
|
|
14
|
+
Other agents run on the same slices and the same model for comparison (`--agent`): Claude Code,
|
|
15
|
+
OpenCode and Codex, each set up the way `ollama launch` sets it up.
|
|
13
16
|
"""
|
|
14
17
|
|
|
15
18
|
from __future__ import annotations
|
|
16
19
|
|
|
17
20
|
import datetime as dt
|
|
18
21
|
import json
|
|
22
|
+
import os
|
|
19
23
|
import shlex
|
|
20
24
|
import statistics
|
|
21
25
|
import subprocess
|
|
@@ -23,6 +27,8 @@ import time
|
|
|
23
27
|
from dataclasses import asdict, dataclass, field
|
|
24
28
|
from pathlib import Path
|
|
25
29
|
|
|
30
|
+
from lcode.ollama import OllamaError
|
|
31
|
+
|
|
26
32
|
HARBOR = "harbor==0.25.0" # the Harbor these slices were made and checked with
|
|
27
33
|
HARBOR_PYTHON = "3.13"
|
|
28
34
|
AGENT = "lcode.harbor:Lcode"
|
|
@@ -67,6 +73,143 @@ LOG = "/logs/agent/lcode.txt"
|
|
|
67
73
|
ON_PATH = 'export PATH="$HOME/.local/bin:$PATH";' # where uv puts lcode and itself
|
|
68
74
|
|
|
69
75
|
|
|
76
|
+
# ----------------------------------------------------------------------------- other agents on the same model
|
|
77
|
+
|
|
78
|
+
# The agents compared with lcode (#198), by Harbor's names. Each is set up the way `ollama launch` sets it up (in
|
|
79
|
+
# Ollama's cmd/launch), with your machine's Ollama as a task's container reaches it, approvals off (Harbor's).
|
|
80
|
+
OTHER_AGENTS = ("claude-code", "opencode", "codex")
|
|
81
|
+
OLLAMA_FROM_TASKS = f"http://host.docker.internal:{OLLAMA_PORT}" # with the host-gateway entry in the overlay
|
|
82
|
+
CODEX_CATALOG = "/opt/lcode-bench/codex-models.json" # in the task's container
|
|
83
|
+
CLAUDE_CODE_ENV = { # what `ollama launch claude` sets besides the address, the key and each tier's model (Harbor's)
|
|
84
|
+
"ENABLE_CLAUDEAI_MCP_SERVERS": "false",
|
|
85
|
+
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
|
|
86
|
+
"CLAUDE_CODE_TOTAL_TOKENS_REMINDER": "off",
|
|
87
|
+
"DISABLE_ERROR_REPORTING": "1",
|
|
88
|
+
"DISABLE_FEEDBACK_COMMAND": "1",
|
|
89
|
+
"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY": "1",
|
|
90
|
+
"CLAUDE_CODE_AUTO_MODE_SERVER": "0",
|
|
91
|
+
}
|
|
92
|
+
CODEX_LEVELS = { # Codex's reasoning efforts for Ollama's thinking values, with Ollama's descriptions
|
|
93
|
+
"none": "Turn thinking off",
|
|
94
|
+
"minimal": "Thinking effort",
|
|
95
|
+
"low": "Fast responses with lighter thinking",
|
|
96
|
+
"medium": "Balances speed and thinking depth for everyday tasks",
|
|
97
|
+
"high": "Greater thinking depth for complex tasks",
|
|
98
|
+
"xhigh": "Thinking effort",
|
|
99
|
+
"max": "Maximum thinking depth for the hardest tasks",
|
|
100
|
+
"ultra": "Thinking effort",
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def variant_name(model: str, context: int) -> str:
|
|
105
|
+
"""The Ollama model the other agents get: `model` with its context window set (lcode-qwen3.6-35b-64k), since
|
|
106
|
+
the APIs they use (OpenAI's, Anthropic's) can't set it per request and Ollama's default is small."""
|
|
107
|
+
from lcode.config import format_tokens
|
|
108
|
+
|
|
109
|
+
return f"{model.removesuffix(':latest')}-{format_tokens(context).lower()}"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def agent_overlay(bridge: bool, catalog: Path | None = None) -> str:
|
|
113
|
+
"""The Docker Compose override for another agent's tasks: host.docker.internal is your machine (Docker Desktop
|
|
114
|
+
has it; on Linux it's added), and Codex's model catalog is in the container."""
|
|
115
|
+
lines = ["services:", " main:"]
|
|
116
|
+
if bridge:
|
|
117
|
+
lines.append(" network_mode: bridge")
|
|
118
|
+
lines += [" extra_hosts:", ' - "host.docker.internal:host-gateway"']
|
|
119
|
+
if catalog is not None:
|
|
120
|
+
lines += [" volumes:", f" - {json.dumps(f'{catalog}:{CODEX_CATALOG}:ro')}"]
|
|
121
|
+
return "\n".join(lines) + "\n"
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def opencode_config(model: str, context: int, thinking: bool) -> dict:
|
|
125
|
+
"""`ollama launch opencode`'s provider: Ollama's OpenAI-compatible API, and the model with the limits of the
|
|
126
|
+
context it runs at (a quarter of it for output, at most 8K)."""
|
|
127
|
+
entry: dict = {"name": model}
|
|
128
|
+
if thinking: # a model that can think without levels: on, or "none"
|
|
129
|
+
entry["reasoning"] = True
|
|
130
|
+
entry["variants"] = {
|
|
131
|
+
"none": {"reasoningEffort": "none"},
|
|
132
|
+
"low": {"disabled": True},
|
|
133
|
+
"medium": {"disabled": True},
|
|
134
|
+
"high": {"disabled": True},
|
|
135
|
+
}
|
|
136
|
+
entry["limit"] = {"context": context, "input": context, "output": min(8192, context // 4)}
|
|
137
|
+
provider = {"npm": "@ai-sdk/openai-compatible", "name": "Ollama", "options": {"baseURL": f"{OLLAMA_FROM_TASKS}/v1"}}
|
|
138
|
+
return {"provider": {"ollama": {**provider, "models": {model: entry}}}}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def codex_level(value: object) -> str | None:
|
|
142
|
+
if isinstance(value, bool):
|
|
143
|
+
return "high" if value else "none"
|
|
144
|
+
return value if isinstance(value, str) and value in CODEX_LEVELS and value != "none" else None
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def codex_catalog(model: str, context: int, thinking: dict | None) -> dict:
|
|
148
|
+
"""`ollama launch codex`'s model catalog entry, so Codex knows the model (otherwise it warns that it falls back
|
|
149
|
+
to defaults that "can degrade performance"). `thinking`: Ollama's, as `/api/show` gives it."""
|
|
150
|
+
values = list((thinking or {}).get("values") or [])
|
|
151
|
+
levels: list[str] = []
|
|
152
|
+
for value in values:
|
|
153
|
+
if value is True and "high" in values:
|
|
154
|
+
continue
|
|
155
|
+
level = codex_level(value)
|
|
156
|
+
if level is not None and level not in levels:
|
|
157
|
+
levels.append(level)
|
|
158
|
+
default = codex_level((thinking or {}).get("default"))
|
|
159
|
+
if default not in levels or (len(values) == 1 and False in values):
|
|
160
|
+
default = None
|
|
161
|
+
entry = {
|
|
162
|
+
"slug": model,
|
|
163
|
+
"display_name": model,
|
|
164
|
+
"context_window": context,
|
|
165
|
+
"shell_type": "default",
|
|
166
|
+
"visibility": "list",
|
|
167
|
+
"supported_in_api": True,
|
|
168
|
+
"priority": 0,
|
|
169
|
+
"truncation_policy": {"mode": "bytes", "limit": 10000},
|
|
170
|
+
"input_modalities": ["text"],
|
|
171
|
+
"base_instructions": "",
|
|
172
|
+
"support_verbosity": True,
|
|
173
|
+
"default_verbosity": "low",
|
|
174
|
+
"supports_parallel_tool_calls": False,
|
|
175
|
+
"supports_reasoning_summaries": False,
|
|
176
|
+
"supported_reasoning_levels": [{"effort": level, "description": CODEX_LEVELS[level]} for level in levels],
|
|
177
|
+
"default_reasoning_level": default,
|
|
178
|
+
"experimental_supported_tools": [],
|
|
179
|
+
}
|
|
180
|
+
return {"models": [entry]}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def codex_config() -> dict:
|
|
184
|
+
"""`ollama launch codex`'s profile: Ollama's Responses API, and the model catalog."""
|
|
185
|
+
provider = {"name": "Ollama", "base_url": f"{OLLAMA_FROM_TASKS}/v1/", "wire_api": "responses"}
|
|
186
|
+
return {
|
|
187
|
+
"model_provider": "ollama-launch",
|
|
188
|
+
"model_providers": {"ollama-launch": provider},
|
|
189
|
+
"model_catalog_json": CODEX_CATALOG,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def agent_setup(agent: str, model: str, context: int, show: dict, folder: Path) -> tuple[list[str], Path | None]:
|
|
194
|
+
"""Harbor's arguments for another agent on `model` (the Ollama model at `context`), and Codex's model catalog,
|
|
195
|
+
written in `folder`. `show`: Ollama's `/api/show` for the model."""
|
|
196
|
+
thinking = "thinking" in (show.get("capabilities") or [])
|
|
197
|
+
if agent == "claude-code":
|
|
198
|
+
return [arg for name, value in CLAUDE_CODE_ENV.items() for arg in ("--ae", f"{name}={value}")], None
|
|
199
|
+
if agent == "opencode":
|
|
200
|
+
return ["--ak", "opencode_config=" + json.dumps(opencode_config(model, context, thinking))], None
|
|
201
|
+
if agent == "codex":
|
|
202
|
+
catalog = folder / "codex-models.json"
|
|
203
|
+
catalog.write_text(json.dumps(codex_catalog(model, context, show.get("thinking") if thinking else None)))
|
|
204
|
+
return ["--ak", "config=" + json.dumps(codex_config())], catalog
|
|
205
|
+
raise ValueError(f"unknown agent {agent!r}")
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def harbor_env() -> dict[str, str]:
|
|
209
|
+
"""For Harbor itself: other agents reach Ollama through its `ollama/` provider, which needs a key (any)."""
|
|
210
|
+
return {"OLLAMA_BASE_URL": OLLAMA_FROM_TASKS, "OLLAMA_API_KEY": "ollama"}
|
|
211
|
+
|
|
212
|
+
|
|
70
213
|
def find_ollama(routes: str = "/proc/net/route") -> str:
|
|
71
214
|
"""Shell that sets OLLAMA_HOST, unless it's set, to Ollama on your machine as a task's container sees it:
|
|
72
215
|
host.docker.internal where Docker provides it (Docker Desktop), else the container's default gateway, which is
|
|
@@ -181,17 +324,22 @@ def harbor_argv(
|
|
|
181
324
|
lcode_with: list[str] | None = None,
|
|
182
325
|
wheel: Path | None = None,
|
|
183
326
|
overlay: Path | None = None,
|
|
327
|
+
agent: str = "lcode",
|
|
328
|
+
agent_args: list[str] | None = None,
|
|
184
329
|
) -> list[str]:
|
|
185
|
-
"""`harbor run` for some tasks of a dataset, with uvx, and lcode next to Harbor so it can import the agent.
|
|
330
|
+
"""`harbor run` for some tasks of a dataset, with uvx, and lcode next to Harbor so it can import the agent.
|
|
331
|
+
Another `agent` (Harbor's name) gets `model` as Harbor's `ollama/` model and `agent_args` (agent_setup)."""
|
|
186
332
|
argv = ["uvx", "--python", HARBOR_PYTHON, "--from", HARBOR, *(lcode_with or []), "harbor", "run"]
|
|
187
|
-
|
|
333
|
+
harbor_agent, harbor_model = (AGENT, model) if agent == "lcode" else (agent, f"ollama/{model}")
|
|
334
|
+
argv += ["-d", DATASETS[dataset], "-a", harbor_agent, "-m", harbor_model, "-k", str(attempts), "-n", "1"]
|
|
188
335
|
argv += ["-o", str(jobs), "--job-name", job_name, "-y"]
|
|
189
336
|
for task in tasks:
|
|
190
337
|
argv += ["-i", task, "-i", f"*/{task}"] # the name alone, or with its organization in front
|
|
191
|
-
if context:
|
|
338
|
+
if context and agent == "lcode": # the others get a model with the context set (variant_name)
|
|
192
339
|
argv += ["--ak", f"context={context}"]
|
|
193
340
|
if wheel:
|
|
194
341
|
argv += ["--ak", f"wheel={wheel}"]
|
|
342
|
+
argv += agent_args or []
|
|
195
343
|
if overlay:
|
|
196
344
|
argv += ["--extra-docker-compose", str(overlay)]
|
|
197
345
|
return argv
|
|
@@ -209,6 +357,7 @@ class Trial:
|
|
|
209
357
|
tokens_in: int | None = None # None: not known (no trace)
|
|
210
358
|
tokens_out: int | None = None
|
|
211
359
|
error: str = ""
|
|
360
|
+
version: str = "" # the agent's, in the task's container
|
|
212
361
|
|
|
213
362
|
|
|
214
363
|
def seconds_between(timing: dict | None) -> float | None:
|
|
@@ -250,6 +399,7 @@ def read_trials(job: Path, dataset: str) -> list[Trial]:
|
|
|
250
399
|
tokens_in=None if tokens_in is None else int(number(tokens_in)),
|
|
251
400
|
tokens_out=None if tokens_out is None else int(number(tokens_out)),
|
|
252
401
|
error=error,
|
|
402
|
+
version=str((result.get("agent_info") or {}).get("version") or ""),
|
|
253
403
|
)
|
|
254
404
|
)
|
|
255
405
|
return trials
|
|
@@ -344,6 +494,32 @@ def took(seconds: float) -> str:
|
|
|
344
494
|
return f"{hours} h {minutes} min" if hours else f"{minutes} min"
|
|
345
495
|
|
|
346
496
|
|
|
497
|
+
def context_variant(settings: dict, model: str, context: int, console) -> tuple[str, dict]:
|
|
498
|
+
"""The Ollama model for another agent (variant_name), made when it's missing, and Ollama's `/api/show` for it.
|
|
499
|
+
Making it copies nothing: it's the same files with one more parameter."""
|
|
500
|
+
from rich.markup import escape
|
|
501
|
+
|
|
502
|
+
from lcode.cli import NotInstalled, resolve_model
|
|
503
|
+
from lcode.config import format_tokens
|
|
504
|
+
from lcode.ollama import Ollama
|
|
505
|
+
|
|
506
|
+
if settings.get("backend", "ollama") != "ollama":
|
|
507
|
+
raise OllamaError("--agent runs the other agents on Ollama's models: lcode's backend here isn't Ollama.")
|
|
508
|
+
ollama = Ollama(settings["ollama_host"])
|
|
509
|
+
try:
|
|
510
|
+
tag, _ = resolve_model(ollama, model)
|
|
511
|
+
except NotInstalled as e:
|
|
512
|
+
raise OllamaError(str(e)) from e
|
|
513
|
+
name = variant_name(tag, context)
|
|
514
|
+
if name not in ollama.installed_names():
|
|
515
|
+
ollama.create_variant(name, tag, {"num_ctx": context})
|
|
516
|
+
console.print(
|
|
517
|
+
f"Made [bold]{escape(name)}[/]: {escape(tag)} with a {format_tokens(context)} context window, for the "
|
|
518
|
+
f"other agents, which can't set it per request. `ollama rm {escape(name)}` removes it."
|
|
519
|
+
)
|
|
520
|
+
return name, ollama.show(name)
|
|
521
|
+
|
|
522
|
+
|
|
347
523
|
def print_slice(console, name: str) -> None:
|
|
348
524
|
for dataset, tasks in SLICES[name].items():
|
|
349
525
|
console.print(f"[bold]{DATASETS[dataset]}[/] ({len(tasks)}): {', '.join(tasks)}")
|
|
@@ -372,6 +548,7 @@ def command(args, console) -> int:
|
|
|
372
548
|
model = args.models[0] if args.models else settings["model"]
|
|
373
549
|
# Always given: in a task's container lcode sees no GPU and would pick a context for the CPU.
|
|
374
550
|
context = config.parse_context(args.context or settings.get("context") or 32768)
|
|
551
|
+
agent = getattr(args, "agent", None) or "lcode"
|
|
375
552
|
attempts = max(1, args.attempts)
|
|
376
553
|
wanted = {name.strip() for name in args.tasks.split(",")} if args.tasks else None
|
|
377
554
|
picked = {
|
|
@@ -383,11 +560,25 @@ def command(args, console) -> int:
|
|
|
383
560
|
f"[red]Not in the {args.harbor} slice: {', '.join(unknown)}[/] (lcode bench --harbor {args.harbor} --list)"
|
|
384
561
|
)
|
|
385
562
|
return 2
|
|
386
|
-
|
|
563
|
+
ollama_model, show, agent_args, env = "", {}, None, None
|
|
564
|
+
if agent != "lcode": # on Ollama's model at the context, set up like `ollama launch` does
|
|
565
|
+
try:
|
|
566
|
+
ollama_model, show = context_variant(settings, model, context, console)
|
|
567
|
+
except OllamaError as e:
|
|
568
|
+
console.print(f"[red]{escape(str(e))}[/]")
|
|
569
|
+
return 1
|
|
570
|
+
named = args.harbor if agent == "lcode" else f"{args.harbor}-{agent}"
|
|
571
|
+
jobs = config.STATE_DIR / "bench" / f"{named}-{dt.datetime.now():%Y%m%d-%H%M%S}"
|
|
387
572
|
jobs.mkdir(parents=True, exist_ok=True)
|
|
388
573
|
install = update.lcode_install()
|
|
389
574
|
wheel = None
|
|
390
|
-
if
|
|
575
|
+
if agent != "lcode":
|
|
576
|
+
agent_args, catalog = agent_setup(agent, ollama_model, context, show, jobs)
|
|
577
|
+
overlay = jobs / "overlay.yaml"
|
|
578
|
+
overlay.write_text(agent_overlay(bool(args.docker_bridge), catalog))
|
|
579
|
+
lcode_with = None
|
|
580
|
+
env = {**os.environ, **harbor_env()}
|
|
581
|
+
elif install.kind == "checkout" and install.path: # this checkout, in Harbor and in the containers
|
|
391
582
|
lcode_with = ["--with-editable", str(install.path)]
|
|
392
583
|
build = ["uv", "build", "--wheel", "-q", "-o", str(jobs / "wheel"), str(install.path)]
|
|
393
584
|
if subprocess.run(build, capture_output=True, text=True).returncode != 0:
|
|
@@ -396,25 +587,32 @@ def command(args, console) -> int:
|
|
|
396
587
|
wheel = next((jobs / "wheel").glob("*.whl"), None)
|
|
397
588
|
else:
|
|
398
589
|
lcode_with = ["--with", f"lcode-cli=={__version__}"]
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
590
|
+
if agent == "lcode":
|
|
591
|
+
overlay = None
|
|
592
|
+
if args.docker_bridge:
|
|
593
|
+
overlay = jobs / "bridge.yaml"
|
|
594
|
+
overlay.write_text(BRIDGE_OVERLAY)
|
|
403
595
|
trials: list[Trial] = []
|
|
404
596
|
started, began = dt.datetime.now().astimezone(), time.monotonic()
|
|
405
597
|
for dataset, tasks in picked.items():
|
|
406
598
|
if not tasks:
|
|
407
599
|
continue
|
|
408
600
|
argv = harbor_argv(
|
|
409
|
-
dataset, tasks, model, jobs, dataset, attempts=attempts, context=context,
|
|
410
|
-
wheel=wheel, overlay=overlay,
|
|
601
|
+
dataset, tasks, ollama_model or model, jobs, dataset, attempts=attempts, context=context,
|
|
602
|
+
lcode_with=lcode_with, wheel=wheel, overlay=overlay, agent=agent, agent_args=agent_args,
|
|
411
603
|
) # fmt: skip
|
|
412
604
|
console.print(f"[bold]{DATASETS[dataset]}[/]: {len(tasks)} task(s), {attempts} attempt(s) each")
|
|
413
605
|
console.print(f"[dim]{escape(shlex.join(argv))}[/]")
|
|
414
|
-
|
|
606
|
+
if env is None:
|
|
607
|
+
subprocess.call(argv)
|
|
608
|
+
else:
|
|
609
|
+
subprocess.call(argv, env=env)
|
|
415
610
|
trials += read_trials(jobs / dataset, dataset)
|
|
416
611
|
summary = summarize(trials, attempts)
|
|
417
612
|
seconds = time.monotonic() - began
|
|
613
|
+
version = next((trial.version for trial in trials if trial.version), "")
|
|
614
|
+
if agent != "lcode":
|
|
615
|
+
console.print(f"[bold]{agent}[/] {escape(version)} on {escape(ollama_model)}")
|
|
418
616
|
print_summary(console, summary)
|
|
419
617
|
console.print(f"Took {took(seconds)}.")
|
|
420
618
|
if any("fully subnetted" in trial.error for trial in trials):
|
|
@@ -427,7 +625,10 @@ def command(args, console) -> int:
|
|
|
427
625
|
"lcode": __version__,
|
|
428
626
|
"harbor": HARBOR,
|
|
429
627
|
"slice": args.harbor,
|
|
628
|
+
"agent": agent,
|
|
629
|
+
"agent_version": version, # in the tasks' containers
|
|
430
630
|
"model": model,
|
|
631
|
+
"ollama_model": ollama_model or None, # the other agents': the model with the context set
|
|
431
632
|
"context": context,
|
|
432
633
|
"attempts": attempts,
|
|
433
634
|
"docker_bridge": bool(args.docker_bridge),
|
lcode/ollama.py
CHANGED
|
@@ -125,6 +125,13 @@ class Ollama:
|
|
|
125
125
|
except requests.RequestException as e:
|
|
126
126
|
raise OllamaError(f"pull failed: {e}") from e
|
|
127
127
|
|
|
128
|
+
def create_variant(self, name: str, base: str, parameters: dict) -> None:
|
|
129
|
+
"""Create `name`: `base` with other parameters (a context window, say). It uses `base`'s files: nothing is
|
|
130
|
+
downloaded or copied."""
|
|
131
|
+
payload = {"model": name, "from": base, "parameters": parameters, "stream": False}
|
|
132
|
+
if self._post("/api/create", payload, timeout=600).get("status") != "success":
|
|
133
|
+
raise OllamaError(f"creating {name} failed")
|
|
134
|
+
|
|
128
135
|
def create_text_only(self, name: str, base: str) -> bool:
|
|
129
136
|
"""Create `name` from `base` without its vision projector. Returns False if `base` has none.
|
|
130
137
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: lcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.56.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/
|
|
@@ -182,6 +182,7 @@ lcode
|
|
|
182
182
|
| `lcode models` / `lcode doctor` | what fits this machine / check the installation |
|
|
183
183
|
| `lcode bench qwen3.6-35b qwen3.5-9b` | compare models on small coding tasks on this machine |
|
|
184
184
|
| `lcode bench --harbor dev` | run lcode on a slice of Terminal-Bench 2.0 and SWE-bench Verified, with Harbor |
|
|
185
|
+
| `lcode bench --harbor dev --agent codex` | the same with Claude Code, OpenCode or Codex on your model, to compare |
|
|
185
186
|
| `lcode trace` / `lcode trace show 1` | past requests, step by step with times and tokens; export or replay one |
|
|
186
187
|
| `/undo`, `/rewind` | take back the last request's file changes, or go back further |
|
|
187
188
|
| `lcode mcp catalog` / `lcode mcp add github` | ready-made MCP servers / add one |
|
|
@@ -14,15 +14,15 @@ 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=d9wLOVBlMtnd8_2jQG9f0-qcEbGT6qtnwOdQSco-RD8,17121
|
|
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=n6ef_v_sBIRfS8oJj9TFL0mvOA0SRRA-MPBN_YGPho4,8267
|
|
18
|
+
lcode/docs/quickstart.md,sha256=fZlRieXhoSB4sAs29XPonqihiFzoTUPe13lQxg8QBlU,3403
|
|
19
19
|
lcode/docs/sandbox.md,sha256=-_jc2I0LXKQIYCz_JOuHGaP2ehVuEqEepKqMATlFpZY,4064
|
|
20
20
|
lcode/docs/search.md,sha256=UKYrYG_xo67-bOLU1hLgiiTh3Dy6s9LG4nuc2JTQHa8,4249
|
|
21
21
|
lcode/docs/servers.md,sha256=0ddumHseQXx0CP0nqzgwV-493s81kdEBa6qtUYe9t6k,5718
|
|
22
22
|
lcode/docs/traces.md,sha256=yY3ZT9twJeGqE-Yyo9Raynz3YqKS4uNoShBq8SPsYGI,10036
|
|
23
23
|
lcode/docs/troubleshooting.md,sha256=YcwmrpR6jcxnhDqV1-E7VQKeczfEC3xuokVkejkAoLo,6292
|
|
24
|
-
lcode/docs/usage.md,sha256=
|
|
25
|
-
lcode/__init__.py,sha256=
|
|
24
|
+
lcode/docs/usage.md,sha256=6l48yg2qX9j9oD_AkFn9jjRCg8q4Mc8uBuqy_Mlj43U,48133
|
|
25
|
+
lcode/__init__.py,sha256=rWKAMVTU480j3xZg74rG6FuQpSrWjQyUmVOzUax3W4I,473
|
|
26
26
|
lcode/__main__.py,sha256=s5N5pryX2FAu93GGZ3FxUrIXHWGzxz66lKUoaV_h8Ws,35
|
|
27
27
|
lcode/acp.py,sha256=eFNYdJNJd9tdCbF2UIj1N3UU4RnF2-pcMLA0KBYZbwE,29082
|
|
28
28
|
lcode/action.py,sha256=wuT5F9EJCdEligPeytzmEi8FpahWBhXer528tpuTj_k,16711
|
|
@@ -36,7 +36,7 @@ lcode/bench_runtime.py,sha256=EjzNgIvUkdbT8cbSy1TpmlyeIk6e-ipjlDFpM7Dnqx0,6835
|
|
|
36
36
|
lcode/catalog.py,sha256=pZ1azX9OH2r4JE2c6E5OfwywpgS39-W2oXzoCHJhmtM,4141
|
|
37
37
|
lcode/checkpoints.py,sha256=eqPtmPe44-aweWqc2H21ROogwzIt3NpvcUobsaCHoGY,18354
|
|
38
38
|
lcode/checks.py,sha256=haYYIPhadKavGYEhh8YWAaWrPMcfzrpT2i6638f4xjQ,12933
|
|
39
|
-
lcode/cli.py,sha256=
|
|
39
|
+
lcode/cli.py,sha256=AVZyuOYs4dR9zgUj1SX1FjekKfoOaeo8WRbUlRAmSaY,54561
|
|
40
40
|
lcode/clipboard.py,sha256=nTSdJyCXPdtjH947RjvB3QvRqnL5HZsS9KB8EkC42cc,5138
|
|
41
41
|
lcode/cloud.py,sha256=q5Dl5GuqWvKzBCIso-eh6yomvEOsnQ0LW8ZgaAGwBxc,2131
|
|
42
42
|
lcode/codesearch.py,sha256=Io8leN1nb_Y-Dvlm9xaGtwUWYXX-ooswuznJV6dGU1s,10766
|
|
@@ -50,7 +50,7 @@ lcode/film.py,sha256=nfffI6oMWeherp8AOU_yM7-Cok0JKoQMVeuVtVHKXo0,14455
|
|
|
50
50
|
lcode/frontmatter.py,sha256=Bx0n4vLPhp7ZCWx-g7xqzqNy5VoKBxyeeikh5UFB_gA,2441
|
|
51
51
|
lcode/gitflow.py,sha256=6j_nnCBZXkX1qhTI7K4CyZ5D0NAZLpH96weFEo64AkQ,27913
|
|
52
52
|
lcode/harbor.py,sha256=DwD40Ga5z0GP6Tu3ixXttJb7j4LIhC4vAN5VfGMcLQ0,3314
|
|
53
|
-
lcode/harbor_bench.py,sha256=
|
|
53
|
+
lcode/harbor_bench.py,sha256=wWBszA758n14LMzbEOiJ0eb_tIi6fgRFykIv6Fzy3oE,30829
|
|
54
54
|
lcode/hardware.py,sha256=9j_gxSUYLAVtnSLIEL8FVU2q-jEEjHtMs2SVAax7yU8,5154
|
|
55
55
|
lcode/hooks.py,sha256=K0itOiAuH4rxndJ9gne_uCrqby6oWAzFPRrfB3tCq-E,9324
|
|
56
56
|
lcode/imageopts.py,sha256=qELIIdKUJT3GLv9mhnjr_TeYNhOXhTMW3tgHzpuqW-Q,9715
|
|
@@ -67,7 +67,7 @@ lcode/memory.py,sha256=uyGNn_yNdvn-ie1vnum25-VNieHyZip7lnzrcIzGNb0,24526
|
|
|
67
67
|
lcode/models.toml,sha256=lt2G64zzo_Ryxv2ISRSNZoVD_JqCqYqsM01n8WoXGs8,4098
|
|
68
68
|
lcode/modes.py,sha256=Ybn9Pe2JJjOCIsixZpg-AHvB1nUMckNEiDKGHBLFXjA,5190
|
|
69
69
|
lcode/notify.py,sha256=uieDeXe7XwuVHjOk4tqVyZEW_85XWkoWQmFOWEf77oc,1538
|
|
70
|
-
lcode/ollama.py,sha256=
|
|
70
|
+
lcode/ollama.py,sha256=2-tH2ef9Paz-6916UJJN1ltxHoebTuwv6DBVQ09sEpg,8515
|
|
71
71
|
lcode/permissions.py,sha256=q7CjDsc_Xrblw7t3_BbxA5LUjxFSswGs1RiJmtMi0po,12288
|
|
72
72
|
lcode/planning.py,sha256=a0rjnj57qwlxqremFgfDGCNgKO-fTKWj36Hj4fBmhbg,6562
|
|
73
73
|
lcode/preview.py,sha256=ATzEs6yaI1__bfo2_juWznrTDXUD4QTc_aQMPRCytgA,6253
|
|
@@ -119,8 +119,8 @@ lcode/workflows/wan21-vace.json,sha256=vJsiRvLCXCjKIibOO0SGM3fT6bedAGxF8N2sN2vcP
|
|
|
119
119
|
lcode/workflows/wan22-fun-inp-5b.json,sha256=4HbKEezik8MHvxTMP6PjQUPQPfCeSu10U9FrC-DHKYw,3327
|
|
120
120
|
lcode/workflows/wan22-ti2v-5b.json,sha256=RcTehoC2pNizzlb7Ed3keJ56DiE7V5lhXmsvR2Y0smQ,3371
|
|
121
121
|
lcode/workflows/z-image-turbo-t2i.json,sha256=sHsL7xnnuULOuWGYlQrDl4jOTySdAmb2T82c_cChv0s,1585
|
|
122
|
-
lcode_cli-0.
|
|
123
|
-
lcode_cli-0.
|
|
124
|
-
lcode_cli-0.
|
|
125
|
-
lcode_cli-0.
|
|
126
|
-
lcode_cli-0.
|
|
122
|
+
lcode_cli-0.56.0.dist-info/METADATA,sha256=V0XC5ox-vmCxrWvbYcNtK7zowrJAvu-3iN_KJSvhO14,14260
|
|
123
|
+
lcode_cli-0.56.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
124
|
+
lcode_cli-0.56.0.dist-info/entry_points.txt,sha256=Hxsn_itbnbgft3U0FwxWdmEt0yoAV2LB-nJDnL9WT20,172
|
|
125
|
+
lcode_cli-0.56.0.dist-info/licenses/LICENSE,sha256=JWjmoL7nNIC1XUa-dZm2hwLUgjUQMFo6k8APb0idNzs,1074
|
|
126
|
+
lcode_cli-0.56.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|