lcode-cli 0.54.0__tar.gz → 0.55.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.
Files changed (228) hide show
  1. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/CHANGELOG.md +17 -1
  2. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/PKG-INFO +1 -1
  3. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/public-benchmarks.md +5 -2
  4. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/quickstart.md +1 -1
  5. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/traces.md +3 -1
  6. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/__init__.py +1 -1
  7. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/harbor.py +5 -3
  8. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/harbor_bench.py +73 -13
  9. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/traces.py +45 -3
  10. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/conftest.py +2 -0
  11. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_harbor_bench.py +82 -1
  12. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_traces.py +41 -0
  13. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.editorconfig +0 -0
  14. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/CODEOWNERS +0 -0
  15. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  16. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  17. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  18. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/ISSUE_TEMPLATE/model_request.yml +0 -0
  19. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  20. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/dependabot.yml +0 -0
  21. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/workflows/ci.yml +0 -0
  22. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/workflows/docs.yml +0 -0
  23. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.github/workflows/release.yml +0 -0
  24. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.gitignore +0 -0
  25. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/.pre-commit-config.yaml +0 -0
  26. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/AGENTS.md +0 -0
  27. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/CODE_OF_CONDUCT.md +0 -0
  28. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/CONTRIBUTING.md +0 -0
  29. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/LICENSE +0 -0
  30. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/README.md +0 -0
  31. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/SECURITY.md +0 -0
  32. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/action.yml +0 -0
  33. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/agents.md +0 -0
  34. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/assets/demo.svg +0 -0
  35. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/assets/extra.css +0 -0
  36. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/assets/film-fox-and-kitten.jpg +0 -0
  37. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/assets/long-clip-tulip.jpg +0 -0
  38. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/automation.md +0 -0
  39. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/bench.md +0 -0
  40. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/changelog.md +0 -0
  41. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/commands.md +0 -0
  42. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/configuration.md +0 -0
  43. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/contributing.md +0 -0
  44. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/editors.md +0 -0
  45. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/git.md +0 -0
  46. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/hooks.md +0 -0
  47. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/how-it-works.md +0 -0
  48. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/index.md +0 -0
  49. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/installation.md +0 -0
  50. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/lsp.md +0 -0
  51. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/mcp.md +0 -0
  52. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/memory.md +0 -0
  53. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/models.md +0 -0
  54. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/modes.md +0 -0
  55. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/sandbox.md +0 -0
  56. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/search.md +0 -0
  57. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/servers.md +0 -0
  58. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/troubleshooting.md +0 -0
  59. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/docs/usage.md +0 -0
  60. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/examples/README.md +0 -0
  61. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/examples/api/fix_tests.py +0 -0
  62. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/examples/commands/review.md +0 -0
  63. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/examples/skills/commit-message/SKILL.md +0 -0
  64. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/examples/skills/commit-message/scripts/staged.sh +0 -0
  65. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/install.sh +0 -0
  66. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/mkdocs.yml +0 -0
  67. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/overrides/main.html +0 -0
  68. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/pyproject.toml +0 -0
  69. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/scripts/make_logos.py +0 -0
  70. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/scripts/record_demo.py +0 -0
  71. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/scripts/social-preview.html +0 -0
  72. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/__main__.py +0 -0
  73. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/acp.py +0 -0
  74. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/action.py +0 -0
  75. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/agent.py +0 -0
  76. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/api.py +0 -0
  77. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/assistant.py +0 -0
  78. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/backends.py +0 -0
  79. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/bench.py +0 -0
  80. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/bench_backend.py +0 -0
  81. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/bench_runtime.py +0 -0
  82. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/catalog.py +0 -0
  83. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/checkpoints.py +0 -0
  84. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/checks.py +0 -0
  85. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/cli.py +0 -0
  86. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/clipboard.py +0 -0
  87. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/cloud.py +0 -0
  88. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/codesearch.py +0 -0
  89. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/comfy.py +0 -0
  90. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/config.py +0 -0
  91. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/context.py +0 -0
  92. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/edits.py +0 -0
  93. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/escalate.py +0 -0
  94. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/extensions.py +0 -0
  95. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/film.py +0 -0
  96. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/frontmatter.py +0 -0
  97. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/gitflow.py +0 -0
  98. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/hardware.py +0 -0
  99. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/hooks.py +0 -0
  100. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/imageopts.py +0 -0
  101. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/jobs.py +0 -0
  102. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/limits.py +0 -0
  103. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/lsp.py +0 -0
  104. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/manual.py +0 -0
  105. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/matching.py +0 -0
  106. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/__init__.py +0 -0
  107. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/auth.py +0 -0
  108. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/catalog.py +0 -0
  109. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/catalog.toml +0 -0
  110. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/client.py +0 -0
  111. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/commands.py +0 -0
  112. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/config.py +0 -0
  113. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/http.py +0 -0
  114. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/manager.py +0 -0
  115. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/protocol.py +0 -0
  116. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/server.py +0 -0
  117. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/mcp/stdio.py +0 -0
  118. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/media.py +0 -0
  119. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/media.toml +0 -0
  120. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/media_catalog.py +0 -0
  121. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/media_cloud.py +0 -0
  122. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/memory.py +0 -0
  123. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/models.toml +0 -0
  124. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/modes.py +0 -0
  125. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/notify.py +0 -0
  126. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/ollama.py +0 -0
  127. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/permissions.py +0 -0
  128. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/planning.py +0 -0
  129. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/preview.py +0 -0
  130. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/render.py +0 -0
  131. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/repeats.py +0 -0
  132. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/repl.py +0 -0
  133. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/replay.py +0 -0
  134. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/repoid.py +0 -0
  135. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/repomap.py +0 -0
  136. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/residency.py +0 -0
  137. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/review.py +0 -0
  138. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/sandbox.py +0 -0
  139. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/screenshots.py +0 -0
  140. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/secretscan.py +0 -0
  141. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/servers/__init__.py +0 -0
  142. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/servers/encord.py +0 -0
  143. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/servers/valohai.py +0 -0
  144. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/servers/xai.py +0 -0
  145. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/sessions.py +0 -0
  146. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/steer.py +0 -0
  147. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/subagents.py +0 -0
  148. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/tools.py +0 -0
  149. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/unreachable.py +0 -0
  150. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/update.py +0 -0
  151. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/vision.py +0 -0
  152. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/web.py +0 -0
  153. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/__init__.py +0 -0
  154. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/flux2-klein-4b-t2i.json +0 -0
  155. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/remove-background.json +0 -0
  156. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/smooth-film.json +0 -0
  157. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/sound-stable-audio.json +0 -0
  158. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/upscale-esrgan.json +0 -0
  159. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/upscale-video-esrgan.json +0 -0
  160. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/wan21-fun-camera.json +0 -0
  161. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/wan21-vace.json +0 -0
  162. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/wan22-fun-inp-5b.json +0 -0
  163. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/wan22-ti2v-5b.json +0 -0
  164. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/src/lcode/workflows/z-image-turbo-t2i.json +0 -0
  165. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/comfy_standin.py +0 -0
  166. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/fake_lsp_server.py +0 -0
  167. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/fake_mcp_server.py +0 -0
  168. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_acp.py +0 -0
  169. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_action.py +0 -0
  170. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_agent.py +0 -0
  171. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_api.py +0 -0
  172. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_assistant.py +0 -0
  173. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_backends.py +0 -0
  174. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_bench.py +0 -0
  175. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_catalog.py +0 -0
  176. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_checkpoints.py +0 -0
  177. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_checks.py +0 -0
  178. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_cli.py +0 -0
  179. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_clipboard.py +0 -0
  180. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_cloud.py +0 -0
  181. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_codesearch.py +0 -0
  182. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_comfy.py +0 -0
  183. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_config.py +0 -0
  184. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_context.py +0 -0
  185. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_context_picker.py +0 -0
  186. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_conversations.py +0 -0
  187. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_escalate.py +0 -0
  188. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_extensions.py +0 -0
  189. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_film.py +0 -0
  190. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_gitflow.py +0 -0
  191. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_gpu_handover.py +0 -0
  192. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_hooks.py +0 -0
  193. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_image_edit.py +0 -0
  194. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_image_generate.py +0 -0
  195. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_jobs.py +0 -0
  196. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_long_clips.py +0 -0
  197. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_look.py +0 -0
  198. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_lsp.py +0 -0
  199. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_manual.py +0 -0
  200. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_matching.py +0 -0
  201. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_mcp.py +0 -0
  202. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_media_catalog.py +0 -0
  203. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_media_cloud.py +0 -0
  204. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_memory.py +0 -0
  205. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_model_picker.py +0 -0
  206. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_modes.py +0 -0
  207. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_permissions.py +0 -0
  208. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_plan_mode.py +0 -0
  209. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_repeats.py +0 -0
  210. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_repomap.py +0 -0
  211. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_residency.py +0 -0
  212. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_review.py +0 -0
  213. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_robustness.py +0 -0
  214. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_sandbox.py +0 -0
  215. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_screenshots.py +0 -0
  216. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_secretscan.py +0 -0
  217. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_servers.py +0 -0
  218. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_sessions.py +0 -0
  219. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_steer.py +0 -0
  220. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_stuck.py +0 -0
  221. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_subagents.py +0 -0
  222. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_tools.py +0 -0
  223. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_update.py +0 -0
  224. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_video.py +0 -0
  225. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_vision.py +0 -0
  226. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_web.py +0 -0
  227. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/tests/test_xai.py +0 -0
  228. {lcode_cli-0.54.0 → lcode_cli-0.55.0}/uv.lock +0 -0
@@ -6,6 +6,21 @@ All notable changes to lcode are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.55.0] - 2026-11-02
10
+
11
+ ### Added
12
+
13
+ - `lcode bench --harbor` says how long the whole run took, and `lcode-bench.json` saves when it
14
+ started and its duration (`started`, `seconds`).
15
+
16
+ ### Fixed
17
+
18
+ - **Tokens of unfinished work in `lcode bench --harbor` and in traces.** An attempt stopped at its
19
+ task's time limit reported 0 tokens. So did a reply lcode stopped because it went round in
20
+ circles, since the server counts a reply only when it ends. The bench now counts what the
21
+ attempt's trace recorded, and the trace estimates a stopped reply's tokens (`estimated_in` and
22
+ `estimated_out`; `lcode trace show` marks them "about"). An attempt with no record shows `–`, not 0.
23
+
9
24
  ## [0.54.0] - 2026-11-01
10
25
 
11
26
  ### Added
@@ -1186,7 +1201,8 @@ First public release.
1186
1201
  - `AGENTS.md` project instructions and `/init` to generate them.
1187
1202
  - One-line installer for Linux and macOS.
1188
1203
 
1189
- [Unreleased]: https://github.com/nasser1941/lcode/compare/v0.54.0...HEAD
1204
+ [Unreleased]: https://github.com/nasser1941/lcode/compare/v0.55.0...HEAD
1205
+ [0.55.0]: https://github.com/nasser1941/lcode/compare/v0.54.0...v0.55.0
1190
1206
  [0.54.0]: https://github.com/nasser1941/lcode/compare/v0.53.0...v0.54.0
1191
1207
  [0.53.0]: https://github.com/nasser1941/lcode/compare/v0.52.0...v0.53.0
1192
1208
  [0.52.0]: https://github.com/nasser1941/lcode/compare/v0.51.0...v0.52.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lcode-cli
3
- Version: 0.54.0
3
+ Version: 0.55.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/
@@ -82,7 +82,9 @@ With three attempts, the last line also gives each run's pass rate and the sprea
82
82
  - **runs and spread**: the pass rate of each task's first attempt, its second and its third. Single
83
83
  runs of the same setup differ by several points, so differences smaller than the spread are noise.
84
84
  - **Time and tokens** per attempt, from lcode's own record of the request (its
85
- [trace](traces.md)).
85
+ [trace](traces.md)). An attempt stopped at the task's time limit counts the tokens recorded
86
+ until then, and a reply lcode stopped counts with an estimate. `–` means no attempt of the task
87
+ has a record.
86
88
 
87
89
  Attempts whose container didn't start (a failed image download, say) count neither as passed nor
88
90
  as failed. The report shows how many there were.
@@ -90,7 +92,8 @@ as failed. The report shows how many there were.
90
92
  Everything is saved in `~/.local/state/lcode/bench/<slice>-<time>/`:
91
93
 
92
94
  - `lcode-bench.json`: the results, with the lcode and Harbor versions, the model, the context, the
93
- machine, the date and the command that reproduces them. `--json FILE` saves a copy.
95
+ machine, when the run started and how long it took, and the command that reproduces them.
96
+ `--json FILE` saves a copy.
94
97
  - Harbor's own results: each attempt's log, the task's test output, and lcode's trace and session.
95
98
  `uvx --from harbor harbor view <folder>` browses them.
96
99
 
@@ -12,7 +12,7 @@ lcode
12
12
 
13
13
  ```text
14
14
  ╭──────────────────────────────────────────────╮
15
- │ lcode v0.54.0 — local coding agent │
15
+ │ lcode v0.55.0 — local coding agent │
16
16
  │ │
17
17
  │ model lcode-qwen3.6-35b │
18
18
  │ context 256K tokens │
@@ -20,7 +20,9 @@ lcode trace path # the folder the traces are in
20
20
  failed check, a note about a malformed tool call, a note you typed while it worked.
21
21
  - **Each model call:** the answer (text, reasoning and tool calls), the time to the first token,
22
22
  the total time, and the tokens in and out. With Ollama, also how long loading the model and
23
- reading the prompt took.
23
+ reading the prompt took. The server counts a reply's tokens only when the reply ends, so for one
24
+ lcode stopped (it went round in circles, or you interrupted it) the trace has an estimate:
25
+ `estimated_in` and `estimated_out`, shown as "about".
24
26
  - **Each tool call:** its arguments, the result the model got, and how long it took. A result
25
27
  longer than 200,000 characters keeps its start and end. When lcode cut a long output for the
26
28
  model, the result says where the full output was saved.
@@ -3,7 +3,7 @@
3
3
  From a program: `from lcode import Session` (see lcode.api).
4
4
  """
5
5
 
6
- __version__ = "0.54.0"
6
+ __version__ = "0.55.0"
7
7
 
8
8
  API = ("Session", "Result", "Options", "SetupError")
9
9
 
@@ -67,8 +67,10 @@ class Lcode(BaseInstalledAgent):
67
67
  end = harbor_bench.trace_usage(Path(self.logs_dir) / "lcode")
68
68
  if end is None:
69
69
  return
70
- context.n_input_tokens = int(end.get("tokens_in") or 0)
71
- context.n_output_tokens = int(end.get("tokens_out") or 0)
70
+ context.n_input_tokens, context.n_output_tokens = harbor_bench.usage_tokens(end)
72
71
  context.cost_usd = 0.0
73
- keys = ("status", "seconds", "steps", "model_calls", "tool_calls", "model_seconds", "tool_seconds")
72
+ keys = (
73
+ *("status", "seconds", "steps", "model_calls", "tool_calls", "model_seconds", "tool_seconds"),
74
+ *("tokens_in", "tokens_out", "estimated_in", "estimated_out"), # the estimates: replies lcode stopped
75
+ )
74
76
  context.metadata = {**(context.metadata or {}), "lcode": {key: end.get(key) for key in keys}}
@@ -19,6 +19,7 @@ import json
19
19
  import shlex
20
20
  import statistics
21
21
  import subprocess
22
+ import time
22
23
  from dataclasses import asdict, dataclass, field
23
24
  from pathlib import Path
24
25
 
@@ -108,23 +109,63 @@ def run_env(model: str | None) -> dict[str, str]:
108
109
 
109
110
 
110
111
  def trace_usage(home: Path) -> dict | None:
111
- """How the newest request traced in `home` (lcode's LCODE_HOME in the task) went: its end event."""
112
+ """How the newest request traced in `home` (lcode's LCODE_HOME in the task) went: its end event. When lcode
113
+ was stopped before the request ended (at the task's time limit), the totals of what its trace recorded."""
112
114
  traces = sorted((home / "traces").glob("*.jsonl"), key=lambda path: path.stat().st_mtime)
113
115
  for path in reversed(traces):
114
116
  try:
115
117
  lines = path.read_text(errors="replace").splitlines()
116
118
  except OSError:
117
119
  continue
118
- for line in reversed(lines):
120
+ events = []
121
+ for line in lines:
119
122
  try:
120
123
  event = json.loads(line)
121
124
  except ValueError:
122
125
  continue
123
- if isinstance(event, dict) and event.get("type") == "end":
124
- return event
126
+ if isinstance(event, dict):
127
+ events.append(event)
128
+ end = next((event for event in reversed(events) if event.get("type") == "end"), None)
129
+ if end is not None:
130
+ return end
131
+ if any(event.get("type") == "model" for event in events):
132
+ return unfinished_usage(events)
125
133
  return None
126
134
 
127
135
 
136
+ def unfinished_usage(events: list[dict]) -> dict:
137
+ """An end event's totals for a request that never ended, from the events its trace has."""
138
+ usage: dict = {"type": "end", "status": "unfinished", "steps": 0, "model_calls": 0, "tool_calls": 0}
139
+ usage.update(dict.fromkeys(("tokens_in", "tokens_out", "estimated_in", "estimated_out"), 0))
140
+ usage.update(seconds=0.0, model_seconds=0.0, tool_seconds=0.0)
141
+ for event in events:
142
+ usage["seconds"] = max(usage["seconds"], number(event.get("at")))
143
+ if event.get("type") == "model":
144
+ usage["model_calls"] += 1
145
+ for key in ("tokens_in", "tokens_out", "estimated_in", "estimated_out"):
146
+ usage[key] += int(number(event.get(key)))
147
+ usage["model_seconds"] += number(event.get("seconds"))
148
+ if event.get("lane", "main") == "main" and event.get("kind") == "step":
149
+ usage["steps"] = max(usage["steps"], int(number(event.get("step"))))
150
+ elif event.get("type") == "tool":
151
+ usage["tool_calls"] += 1
152
+ usage["tool_seconds"] += number(event.get("seconds"))
153
+ return usage
154
+
155
+
156
+ def number(value: object) -> float:
157
+ return float(value) if isinstance(value, (int, float)) and not isinstance(value, bool) else 0.0
158
+
159
+
160
+ def usage_tokens(usage: dict) -> tuple[int, int]:
161
+ """Tokens in and out of a traced request, with the estimates for replies lcode stopped before the server
162
+ counted them."""
163
+ return (
164
+ int(number(usage.get("tokens_in")) + number(usage.get("estimated_in"))),
165
+ int(number(usage.get("tokens_out")) + number(usage.get("estimated_out"))),
166
+ )
167
+
168
+
128
169
  # ----------------------------------------------------------------------------- running Harbor, and the report
129
170
 
130
171
 
@@ -165,8 +206,8 @@ class Trial:
165
206
  reward: float | None # None: the task's tests didn't run (its container didn't start, say)
166
207
  started: str = ""
167
208
  seconds: float | None = None # lcode's time on the task
168
- tokens_in: int = 0
169
- tokens_out: int = 0
209
+ tokens_in: int | None = None # None: not known (no trace)
210
+ tokens_out: int | None = None
170
211
  error: str = ""
171
212
 
172
213
 
@@ -194,6 +235,11 @@ def read_trials(job: Path, dataset: str) -> list[Trial]:
194
235
  if error and problem.get("exception_message"):
195
236
  error += ": " + str(problem["exception_message"]).strip().splitlines()[-1][:300]
196
237
  name = str(result.get("task_name") or path.parent.name.rsplit("__", 1)[0])
238
+ tokens_in, tokens_out = agent.get("n_input_tokens"), agent.get("n_output_tokens")
239
+ if tokens_in is None and tokens_out is None: # lcode 0.54.0 gave none for an attempt stopped at its limit
240
+ usage = trace_usage(path.parent / "agent" / "lcode")
241
+ if usage is not None:
242
+ tokens_in, tokens_out = usage_tokens(usage)
197
243
  trials.append(
198
244
  Trial(
199
245
  dataset=dataset,
@@ -201,8 +247,8 @@ def read_trials(job: Path, dataset: str) -> list[Trial]:
201
247
  reward=float(reward) if isinstance(reward, (int, float)) else None,
202
248
  started=str(result.get("started_at") or ""),
203
249
  seconds=seconds_between(result.get("agent_execution")),
204
- tokens_in=int(agent.get("n_input_tokens") or 0),
205
- tokens_out=int(agent.get("n_output_tokens") or 0),
250
+ tokens_in=None if tokens_in is None else int(number(tokens_in)),
251
+ tokens_out=None if tokens_out is None else int(number(tokens_out)),
206
252
  error=error,
207
253
  )
208
254
  )
@@ -216,8 +262,8 @@ class TaskResult:
216
262
  passed: list[bool] = field(default_factory=list) # each attempt whose tests ran, in the order they ran
217
263
  not_run: int = 0
218
264
  seconds: float | None = None # per attempt, on average
219
- tokens_in: int = 0
220
- tokens_out: int = 0
265
+ tokens_in: int | None = None # per attempt, on average, of those whose tokens are known
266
+ tokens_out: int | None = None
221
267
 
222
268
 
223
269
  @dataclass
@@ -242,6 +288,8 @@ def summarize(trials: list[Trial], attempts: int = ATTEMPTS) -> Summary:
242
288
  for (dataset, task), group in groups.items():
243
289
  ran = [t for t in group if t.reward is not None]
244
290
  timed = [t.seconds for t in ran if t.seconds is not None]
291
+ counted_in = [t.tokens_in for t in ran if t.tokens_in is not None]
292
+ counted_out = [t.tokens_out for t in ran if t.tokens_out is not None]
245
293
  tasks.append(
246
294
  TaskResult(
247
295
  dataset,
@@ -249,8 +297,8 @@ def summarize(trials: list[Trial], attempts: int = ATTEMPTS) -> Summary:
249
297
  [(t.reward or 0) >= 1 for t in ran],
250
298
  len(group) - len(ran),
251
299
  statistics.fmean(timed) if timed else None,
252
- round(statistics.fmean(t.tokens_in for t in ran)) if ran else 0,
253
- round(statistics.fmean(t.tokens_out for t in ran)) if ran else 0,
300
+ round(statistics.fmean(counted_in)) if counted_in else None,
301
+ round(statistics.fmean(counted_out)) if counted_out else None,
254
302
  )
255
303
  )
256
304
  scored = [t for t in tasks if t.passed]
@@ -278,7 +326,9 @@ def print_summary(console, summary: Summary) -> None:
278
326
  for t in summary.tasks:
279
327
  passed = f"{sum(t.passed)}/{len(t.passed)}" + (f" ({t.not_run} didn't run)" if t.not_run else "")
280
328
  took = "–" if t.seconds is None else f"{t.seconds / 60:.1f} min"
281
- table.add_row(t.task, t.dataset, passed, took, f"{t.tokens_in:,}", f"{t.tokens_out:,}")
329
+ tokens_in = "–" if t.tokens_in is None else f"{t.tokens_in:,}"
330
+ tokens_out = "–" if t.tokens_out is None else f"{t.tokens_out:,}"
331
+ table.add_row(t.task, t.dataset, passed, took, tokens_in, tokens_out)
282
332
  console.print(table)
283
333
  k = summary.attempts
284
334
  line = f"pass@1 {percent(summary.pass_at_1)} · pass^{k} {percent(summary.pass_all)}"
@@ -289,6 +339,11 @@ def print_summary(console, summary: Summary) -> None:
289
339
  console.print(f"[yellow]{summary.not_run} attempt(s) didn't run (their container didn't start, say).[/]")
290
340
 
291
341
 
342
+ def took(seconds: float) -> str:
343
+ hours, minutes = divmod(round(seconds / 60), 60)
344
+ return f"{hours} h {minutes} min" if hours else f"{minutes} min"
345
+
346
+
292
347
  def print_slice(console, name: str) -> None:
293
348
  for dataset, tasks in SLICES[name].items():
294
349
  console.print(f"[bold]{DATASETS[dataset]}[/] ({len(tasks)}): {', '.join(tasks)}")
@@ -346,6 +401,7 @@ def command(args, console) -> int:
346
401
  overlay = jobs / "bridge.yaml"
347
402
  overlay.write_text(BRIDGE_OVERLAY)
348
403
  trials: list[Trial] = []
404
+ started, began = dt.datetime.now().astimezone(), time.monotonic()
349
405
  for dataset, tasks in picked.items():
350
406
  if not tasks:
351
407
  continue
@@ -358,7 +414,9 @@ def command(args, console) -> int:
358
414
  subprocess.call(argv)
359
415
  trials += read_trials(jobs / dataset, dataset)
360
416
  summary = summarize(trials, attempts)
417
+ seconds = time.monotonic() - began
361
418
  print_summary(console, summary)
419
+ console.print(f"Took {took(seconds)}.")
362
420
  if any("fully subnetted" in trial.error for trial in trials):
363
421
  console.print(
364
422
  "Docker couldn't make a network for the tasks: all its address ranges overlap your routes (a VPN that "
@@ -375,6 +433,8 @@ def command(args, console) -> int:
375
433
  "docker_bridge": bool(args.docker_bridge),
376
434
  "machine": detect().describe(),
377
435
  "date": dt.datetime.now().astimezone().isoformat(timespec="seconds"),
436
+ "started": started.isoformat(timespec="seconds"),
437
+ "seconds": round(seconds), # the whole run, every task's attempts
378
438
  "command": "lcode " + shlex.join(sys.argv[1:]),
379
439
  "tasks": picked,
380
440
  "summary": {
@@ -6,11 +6,13 @@ in ~/.local/state/lcode/traces/<session id>-<request number>.jsonl. The lines, b
6
6
  - start: the request as typed, the model and its settings, lcode's version, the folder;
7
7
  - env: the git commit and the model's own sampling settings, looked up in the background;
8
8
  - message: what lcode or the user added to the conversation for the model (the request, lcode's notes);
9
- - model: one model call: its answer (text, thinking, tool calls), time to the first token, time and tokens;
9
+ - model: one model call: its answer (text, thinking, tool calls), time to the first token, time and tokens. The
10
+ server counts a reply's tokens only when it ends, so a reply lcode stopped has 0 there and an estimate in
11
+ estimated_in and estimated_out (a token is about three characters);
10
12
  - tool: one tool call: its arguments, the result the model got, how long it took;
11
13
  - check: the project's checks, when lcode ran them; escalate: a stronger model's advice;
12
14
  - compacted: the conversation was summarized; full: the trace reached its size limit;
13
- - end: how the request ended, and its totals.
15
+ - end: how the request ended, and its totals (estimated_in and estimated_out: the stopped replies' estimates).
14
16
 
15
17
  Events carry a "lane": the main agent's is "main", a subagent's "agent 1", "agent 2"…
16
18
 
@@ -88,6 +90,25 @@ def cut(text: str, limit: int = MAX_TEXT) -> str:
88
90
  return f"{text[:head]}\n[… {len(text) - limit} characters left out of the trace …]\n{tail}"
89
91
 
90
92
 
93
+ def estimate(payload: dict, reply: dict) -> tuple[int, int]:
94
+ """About how many tokens a model call took, in and out, for a reply the server never counted: a token is about
95
+ three characters, as lcode.sessions.estimate_tokens counts. For qwen3.6, Ollama counted 2.7 to 3.4 characters
96
+ a token in replies and 3.2 in tool results (the JSON), and about 3.9 in lcode's system prompt and tools. The
97
+ prompt is its messages' and tools' JSON, images left out."""
98
+ try:
99
+ messages = [
100
+ {k: v for k, v in m.items() if k != "images"} if isinstance(m, dict) else m
101
+ for m in payload.get("messages") or []
102
+ ]
103
+ prompt = len(json.dumps(messages, default=str)) + len(json.dumps(payload.get("tools") or [], default=str))
104
+ calls = reply.get("tool_calls") or []
105
+ answer = len(str(reply.get("content") or "")) + len(str(reply.get("thinking") or ""))
106
+ answer += len(json.dumps(calls, default=str)) if calls else 0
107
+ return prompt // 3, answer // 3
108
+ except (TypeError, ValueError, RecursionError): # an estimate never costs the model event
109
+ return 0, 0
110
+
111
+
91
112
  def nanos(value: Any) -> float | None:
92
113
  return round(value / 1e9, 3) if isinstance(value, (int, float)) and value else None
93
114
 
@@ -115,6 +136,8 @@ class Recorder:
115
136
  "tool_calls": 0,
116
137
  "tokens_in": 0,
117
138
  "tokens_out": 0,
139
+ "estimated_in": 0, # replies lcode stopped, which the server never counted
140
+ "estimated_out": 0,
118
141
  "model_seconds": 0.0,
119
142
  "tool_seconds": 0.0,
120
143
  }
@@ -261,6 +284,9 @@ class Lane:
261
284
  event["error"] = error[:4000]
262
285
  elif not finished:
263
286
  event["stopped"] = True # lcode closed the stream: it went round in circles, or was interrupted
287
+ if not final and first is not None: # the server counts a reply only at its end: about what this took
288
+ event["estimated_in"], event["estimated_out"] = estimate(payload, reply)
289
+ self.recorder.add(estimated_in=event["estimated_in"], estimated_out=event["estimated_out"])
264
290
  self.recorder.add(model_calls=1, tokens_in=tokens_in, tokens_out=tokens_out, model_seconds=seconds)
265
291
  self.recorder.write(event)
266
292
 
@@ -376,6 +402,16 @@ class Recording:
376
402
  self.lane.model("chat", payload, began, None, answer, reply or {}, error)
377
403
 
378
404
 
405
+ def stopped_estimate(end: dict) -> str:
406
+ """The end line's note on replies lcode stopped, which the server never counted."""
407
+ if not (end.get("estimated_in") or end.get("estimated_out")):
408
+ return ""
409
+ return (
410
+ f" (and about {format_tokens(end.get('estimated_in') or 0)} in, "
411
+ f"{format_tokens(end.get('estimated_out') or 0)} out in stopped replies)"
412
+ )
413
+
414
+
379
415
  def next_number(folder: Path, session_id: str) -> int:
380
416
  numbers = [0]
381
417
  for f in folder.glob(f"{session_id}-*.jsonl"):
@@ -794,6 +830,11 @@ def show(info: Info, console: Console, verbose: bool = False) -> None:
794
830
  else:
795
831
  head = f"model ({e.get('purpose') or e.get('inside') or e.get('kind')})"
796
832
  numbers = f"{format_tokens(e.get('tokens_in') or 0)} in · {format_tokens(e.get('tokens_out') or 0)} out"
833
+ if "estimated_out" in e: # stopped before the server counted it
834
+ numbers = (
835
+ f"about {format_tokens(e.get('estimated_in') or 0)} in · "
836
+ f"{format_tokens(e.get('estimated_out') or 0)} out"
837
+ )
797
838
  if e.get("first_token") is not None:
798
839
  numbers += f" · first token {duration(e['first_token'])}"
799
840
  if (e.get("load_seconds") or 0) >= 1: # what the wait was: loading the model, reading the prompt
@@ -840,7 +881,8 @@ def show(info: Info, console: Console, verbose: bool = False) -> None:
840
881
  console.print()
841
882
  line = (
842
883
  f"{escape(info.status)} · {end.get('model_calls', 0)} model call(s) · "
843
- f"{format_tokens(end.get('tokens_in') or 0)} tokens in, {format_tokens(end.get('tokens_out') or 0)} out · "
884
+ f"{format_tokens(end.get('tokens_in') or 0)} tokens in, {format_tokens(end.get('tokens_out') or 0)} out"
885
+ f"{stopped_estimate(end)} · "
844
886
  f"model {duration(end.get('model_seconds'))} · tools {duration(end.get('tool_seconds'))} "
845
887
  f"({end.get('tool_calls', 0)} calls) · recording {end.get('trace_seconds', 0) * 1000:.0f} ms"
846
888
  )
@@ -75,8 +75,10 @@ def isolated_state(tmp_path_factory, monkeypatch):
75
75
  """Every test gets its own state folder, so none writes into the user's (approvals, sessions…).
76
76
 
77
77
  And no test finds or starts the user's own ComfyUI: tests that need one use the stand-in (comfy_standin).
78
+ PATH is as it was after each test: lcode.cli.main takes uvx's environment off it (lcode.update).
78
79
  """
79
80
  monkeypatch.setattr("lcode.config.STATE_DIR", tmp_path_factory.mktemp("lcode-state"))
81
+ monkeypatch.setenv("PATH", os.environ.get("PATH", ""))
80
82
  monkeypatch.setattr("lcode.comfy.CANDIDATES", ())
81
83
  monkeypatch.setattr("lcode.comfy.cli_workspace", lambda: None)
82
84
  monkeypatch.setattr("lcode.hardware.gpu_used_gib", lambda: None) # never this machine's GPU
@@ -1,9 +1,12 @@
1
+ import io
1
2
  import json
2
3
  import os
3
4
  import shutil
4
5
  import subprocess
6
+ from pathlib import Path
5
7
 
6
8
  import pytest
9
+ from rich.console import Console
7
10
 
8
11
  from lcode import harbor_bench
9
12
 
@@ -80,6 +83,32 @@ def test_the_newest_traces_end_tells_how_the_request_went(tmp_path):
80
83
  assert harbor_bench.trace_usage(tmp_path) == {"type": "end", "tokens_in": 1}
81
84
 
82
85
 
86
+ def write_unfinished_trace(home):
87
+ """A request killed at its time limit: no end event, and its last reply was one lcode stopped."""
88
+ (home / "traces").mkdir(parents=True)
89
+ events = [
90
+ {"type": "start", "at": 0.0},
91
+ {"type": "model", "at": 30.0, "lane": "main", "kind": "step", "step": 1, "seconds": 30.0,
92
+ "tokens_in": 9000, "tokens_out": 300},
93
+ {"type": "tool", "at": 32.5, "lane": "main", "step": 1, "seconds": 2.5},
94
+ {"type": "model", "at": 40.0, "lane": "agent 1", "kind": "step", "step": 1, "seconds": 5.0,
95
+ "tokens_in": 2000, "tokens_out": 100},
96
+ {"type": "model", "at": 90.0, "lane": "main", "kind": "step", "step": 2, "seconds": 57.5, "tokens_in": 0,
97
+ "tokens_out": 0, "stopped": True, "estimated_in": 9500, "estimated_out": 4000},
98
+ ] # fmt: skip
99
+ (home / "traces" / "a-1.jsonl").write_text("".join(json.dumps(e) + "\n" for e in events) + '{"type": "mod')
100
+
101
+
102
+ def test_a_request_stopped_at_its_time_limit_counts_what_its_trace_recorded(tmp_path):
103
+ write_unfinished_trace(tmp_path)
104
+ usage = harbor_bench.trace_usage(tmp_path)
105
+ assert usage is not None and (usage["status"], usage["steps"], usage["seconds"]) == ("unfinished", 2, 90.0)
106
+ assert (usage["model_calls"], usage["tool_calls"], usage["tool_seconds"]) == (3, 1, 2.5)
107
+ assert (usage["tokens_in"], usage["tokens_out"]) == (11000, 400)
108
+ assert harbor_bench.usage_tokens(usage) == (20500, 4400) # with the estimate for the reply lcode stopped
109
+ assert harbor_bench.usage_tokens({"type": "end", "tokens_in": 900, "tokens_out": 40}) == (900, 40)
110
+
111
+
83
112
  def test_harbor_runs_the_tasks_with_lcode_next_to_it(tmp_path):
84
113
  argv = harbor_bench.harbor_argv(
85
114
  "terminal-bench",
@@ -110,7 +139,7 @@ def write_trial(job, name, task, reward, minute, tokens=(1000, 100)):
110
139
  "started_at": f"2026-11-01T01:{minute:02d}:00Z",
111
140
  "finished_at": f"2026-11-01T01:{minute + 2:02d}:30Z",
112
141
  },
113
- "agent_result": {"n_input_tokens": tokens[0], "n_output_tokens": tokens[1]},
142
+ "agent_result": {"n_input_tokens": tokens and tokens[0], "n_output_tokens": tokens and tokens[1]},
114
143
  "verifier_result": None if reward is None else {"rewards": {"reward": reward}},
115
144
  }
116
145
  if reward is None:
@@ -144,6 +173,58 @@ def test_pass_rates_spread_and_cost_from_harbors_results(tmp_path):
144
173
  assert summary.spread == pytest.approx(2 / 3) and summary.not_run == 1
145
174
 
146
175
 
176
+ def test_tokens_of_attempts_stopped_at_their_time_limit(tmp_path):
177
+ """lcode 0.54.0 gave Harbor no tokens for an attempt stopped at its time limit: they come from its trace, and
178
+ an attempt without one counts as unknown, not as 0."""
179
+ job = tmp_path / "terminal-bench"
180
+ write_trial(job, "slow__0", "terminal-bench/slow", 0.0, 0, None)
181
+ write_unfinished_trace(job / "slow__0" / "agent" / "lcode")
182
+ write_trial(job, "slow__1", "terminal-bench/slow", 1.0, 10, (1500, 600))
183
+ write_trial(job, "slow__2", "terminal-bench/slow", 0.0, 20, None) # no trace either
184
+ write_trial(job, "lost__0", "terminal-bench/lost", 0.0, 30, None)
185
+ trials = harbor_bench.read_trials(job, "terminal-bench")
186
+ slow = [(t.tokens_in, t.tokens_out) for t in trials if t.task == "slow"]
187
+ assert slow == [(20500, 4400), (1500, 600), (None, None)]
188
+ summary = harbor_bench.summarize(trials, attempts=3)
189
+ tasks = {t.task: t for t in summary.tasks}
190
+ assert (tasks["slow"].tokens_in, tasks["slow"].tokens_out) == (11000, 2500) # of the two attempts known
191
+ assert (tasks["lost"].tokens_in, tasks["lost"].tokens_out) == (None, None)
192
+ console = Console(file=io.StringIO(), width=200)
193
+ harbor_bench.print_summary(console, summary)
194
+ [lost] = [line for line in console.file.getvalue().splitlines() if line.startswith("lost")]
195
+ assert lost.split()[-2:] == ["–", "–"]
196
+
197
+
198
+ def test_lcode_bench_harbor_runs_harbor_then_reports_and_saves(capsys, monkeypatch):
199
+ from lcode import cli, config, hardware, update
200
+
201
+ monkeypatch.setattr(shutil, "which", lambda name, *a, **k: f"/usr/bin/{name}")
202
+ monkeypatch.setattr(update, "docker_available", lambda: True)
203
+ monkeypatch.setattr(update, "lcode_install", lambda *a, **k: update.Install("uvx")) # lcode from PyPI
204
+ monkeypatch.setattr(hardware, "detect", lambda: hardware.Hardware("linux", "test CPU", 32.0))
205
+ runs = []
206
+
207
+ def harbor(argv):
208
+ runs.append(argv)
209
+ job = Path(argv[argv.index("-o") + 1]) / argv[argv.index("--job-name") + 1]
210
+ write_trial(job, "prove-plus-comm__a", "terminal-bench/prove-plus-comm", 1.0, 0, (2000, 200))
211
+ return 0
212
+
213
+ monkeypatch.setattr(subprocess, "call", harbor)
214
+ with pytest.raises(SystemExit) as done:
215
+ cli.main(
216
+ ["bench", "--harbor", "dev", "qwen3.6-35b", "--tasks", "prove-plus-comm", "--attempts", "1", "--ctx", "32k"]
217
+ )
218
+ out = " ".join(capsys.readouterr().out.split())
219
+ assert done.value.code == 0 and len(runs) == 1 and "--with lcode-cli==" in " ".join(runs[0])
220
+ assert "pass@1 100%" in out and "Took 0 min." in out
221
+ [saved] = (config.STATE_DIR / "bench").glob("dev-*/lcode-bench.json")
222
+ report = json.loads(saved.read_text())
223
+ assert (report["model"], report["context"], report["attempts"]) == ("qwen3.6-35b", 32768, 1)
224
+ assert report["started"] <= report["date"] and 0 <= report["seconds"] < 60
225
+ assert report["results"][0]["tokens_in"] == 2000 and report["summary"]["pass_at_1"] == 1.0
226
+
227
+
147
228
  def test_lcode_bench_harbor_lists_its_slice_and_refuses_other_tasks(capsys, monkeypatch):
148
229
  from lcode import cli, update
149
230
 
@@ -113,6 +113,47 @@ def test_a_failed_request_still_ends_its_trace(make_agent):
113
113
  assert agent.trace is None and not isinstance(agent.ollama, traces.Recording)
114
114
 
115
115
 
116
+ LOOP = (
117
+ "Let me try to check the actual download page for the correct URL.\n\n"
118
+ "Let me check if there's a way to get the NDK from the Android SDK Manager.\n\n"
119
+ "Actually, let me try a completely different approach with the android.ndk_path option.\n\n"
120
+ )
121
+
122
+
123
+ def test_a_reply_lcode_stopped_gets_an_estimate_of_its_tokens(make_agent, capsys, tmp_path_factory, original):
124
+ """The server counts a reply's tokens only when it ends. For one lcode stopped, the trace has an estimate
125
+ beside the counts, which stay what the server said: a replay serves those."""
126
+ looping = [{"message": {"thinking": LOOP}, "done": False} for _ in range(200)]
127
+ agent = make_agent([looping, reply("The NDK downloads fail from this network.")], trace=True)
128
+ agent.run_turn("Build the APK")
129
+ output(agent)
130
+ info = only_trace()
131
+ events = traces.load(info.path)
132
+ stopped, answered = [e for e in events if e["type"] == "model"]
133
+ assert stopped["stopped"] and (stopped["tokens_in"], stopped["tokens_out"]) == (0, 0)
134
+ assert stopped["estimated_out"] == len(stopped["reply"]["thinking"]) // 3 > 0 # what streamed until it stopped
135
+ assert stopped["estimated_in"] > 1000 # at least the system prompt and the tools
136
+ assert "estimated_in" not in answered and (answered["tokens_in"], answered["tokens_out"]) == (1000, 50)
137
+ end = events[-1]
138
+ assert (end["tokens_in"], end["tokens_out"]) == (1000, 50)
139
+ assert (end["estimated_in"], end["estimated_out"]) == (stopped["estimated_in"], stopped["estimated_out"])
140
+ with pytest.raises(SystemExit):
141
+ cli.main(["trace", "show", "1"])
142
+ shown = " ".join(capsys.readouterr().out.split())
143
+ assert "model 1 about " in shown and "stopped" in shown and "out in stopped replies)" in shown
144
+ report = replay.run(events, fresh_copy(original, tmp_path_factory))
145
+ assert report.ok and report.steps == (2, 2) # the replay stops the same reply at the same place
146
+
147
+
148
+ def test_a_reply_that_failed_has_no_estimate(make_agent):
149
+ agent = make_agent([Raises("Ollama error: the model crashed")], trace=True)
150
+ with pytest.raises(OllamaError):
151
+ agent.run_turn("go")
152
+ events = traces.load(only_trace().path)
153
+ [model] = [e for e in events if e["type"] == "model"]
154
+ assert "estimated_in" not in model and (events[-1]["estimated_in"], events[-1]["estimated_out"]) == (0, 0)
155
+
156
+
116
157
  def test_a_trace_replays_without_a_model_server(make_agent, original, tmp_path_factory):
117
158
  agent = make_agent(
118
159
  [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes