euron-code 1.6.0__tar.gz → 1.7.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.
- {euron_code-1.6.0 → euron_code-1.7.0}/CHANGELOG.md +49 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/PKG-INFO +6 -1
- {euron_code-1.6.0 → euron_code-1.7.0}/README.md +5 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/pyproject.toml +1 -1
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/__init__.py +1 -1
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/agent.py +343 -14
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/api.py +21 -1
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/cli.py +16 -0
- euron_code-1.7.0/src/euron_code/codeindex.py +309 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/config.py +6 -0
- euron_code-1.7.0/src/euron_code/ctxstats.py +126 -0
- euron_code-1.7.0/src/euron_code/doctor.py +254 -0
- euron_code-1.7.0/src/euron_code/failures.py +275 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/llm/base.py +15 -0
- euron_code-1.7.0/src/euron_code/modes.py +67 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/prompts.py +1 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/repl.py +42 -3
- euron_code-1.7.0/src/euron_code/taskstate.py +377 -0
- euron_code-1.7.0/src/euron_code/tls.py +74 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/fs.py +49 -1
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/reuse.py +38 -4
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/conftest.py +10 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v155_user_errors.py +1 -1
- euron_code-1.7.0/tests/test_v161_residual_errors.py +123 -0
- euron_code-1.7.0/tests/test_v170_v2.py +471 -0
- euron_code-1.6.0/src/euron_code/doctor.py +0 -114
- {euron_code-1.6.0 → euron_code-1.7.0}/.gitignore +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/LICENSE +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/__main__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/activity.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/attachments.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/auth.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/autoupdate.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/cache.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/checkpoints.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/context.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/contextforge/LICENSE +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/contextforge/__init__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/contextforge/text.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/contextforge/toolout.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/credentials.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/documents.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/dotnet.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/error_hints.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/errorlog.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/friendly.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/frontmatter.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/hooks.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/keys.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/knowledge.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/licensing.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/llm/__init__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/llm/anthropic.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/llm/openai_compat.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/llm/setup.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/logo.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/markdown_view.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/memory.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/migration.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/mvc5.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/osscache.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/ossgithub.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/pasteinput.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/pathfix.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/permissions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/progress.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/project_setup.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/repomap.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/rules.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/security_scan.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/sessions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/skills.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/textsafe.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/__init__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/background.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/base.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/db.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/document.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/erie.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/ignore.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/normalize.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/oss.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/pathfind.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/port.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/search.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/shell.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/skill.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/symbols.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/task.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/todo.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/tools/web.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/transcript.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/trust.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/ui.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/update_check.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/usage_view.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/version_info.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/src/euron_code/webforms.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/fake_providers.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/helpers.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/measure_floor.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/mock_gateway.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/serve_helper.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/sim_long_session.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_agent_mock.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_api_shell.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_bench.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_bench_harness.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_cli_e2e.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_context_memory_sessions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_dashboard_fixes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_dashboard_fixes_102.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_db.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_erie.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_knowledge_security.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_markdown_view.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_oss_local.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_permissions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_powershell_exit_codes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_qa_attach_secrets.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_qa_long_task.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_qa_print_output.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_qa_reuse_unrelated.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_qa_yolo_outside.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_repl.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_reuse_honesty.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_search.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_textsafe.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_tools_fs.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_transcript_ui.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_update_check.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v111_user_reports.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v113_fix_path.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v11_byo.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v11_speed.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v11_tool_fixes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v130_cut_writes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v130_reliability.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v140_parity.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v152_migration.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v153_user_errors.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v156_autoupdate.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v156_paste_and_edits.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v157_zero_errors.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v15_hosted_models.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v160_stop_scope_atomic.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v2_rules_skills_hooks.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v2_tokens_shortcuts.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v2_usage_headers.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v31_security.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v3_accounts_value_setup.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v3_activity.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v3_attachments.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v3_context.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v3_live_repl.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v3_single_login.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v4.py +0 -0
- {euron_code-1.6.0 → euron_code-1.7.0}/tests/test_v5.py +0 -0
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.0 (2026-11-13)
|
|
4
|
+
|
|
5
|
+
Finishes more work per request on the Euron model, says honestly how far a task got, and picks up where it
|
|
6
|
+
stopped.
|
|
7
|
+
|
|
8
|
+
- **Picks up where it stopped.** Every job keeps a checkpoint on your computer (`~/.euron/tasks/`): what you
|
|
9
|
+
asked for, the plan, what is done and what is left, the files changed and their diff, the checks that ran, the
|
|
10
|
+
current error, and the budget used. `continue` (also in a new terminal) resumes from it and does not redo
|
|
11
|
+
finished work. A stop never touches your files.
|
|
12
|
+
- **Keeps going while it is getting somewhere.** In Euron Auto, a request that reaches its budget while it is
|
|
13
|
+
still finishing items or fixing checks gets one more half-budget instead of stopping mid-way. One that keeps
|
|
14
|
+
failing the same way stops, as before.
|
|
15
|
+
- **An honest status at the end.** Each task ends as: completed and verified, completed but not verified, partly
|
|
16
|
+
done, blocked by the environment, blocked by permissions, stopped at its budget, or failed. It comes from the
|
|
17
|
+
checks that really ran (their exit codes), never from the model saying it is done. Shown after the task and in
|
|
18
|
+
`--output-format json` (`status`, `verification`).
|
|
19
|
+
- **Fixes failing checks faster.** When a test or build fails, Euron Code tells the model what kind of failure it
|
|
20
|
+
is (a missing package, a certificate problem, a port in use, a compile error, a failing test) and sends the code
|
|
21
|
+
at the lines the error points to, so it can fix it without another read.
|
|
22
|
+
- **A failing check is no longer missed.** A command that ran and failed was not counted as a check, so the model
|
|
23
|
+
was told "you did not run anything" instead of "the check still fails", and a pass followed by a fail could
|
|
24
|
+
count as verified. Fixed.
|
|
25
|
+
- **Less repeated text.** When a file is read again after a change, the older copy leaves the conversation (it
|
|
26
|
+
showed text that no longer exists). In bigger projects the first step starts from a local index of the likely
|
|
27
|
+
files (what each defines, who imports it). Reuse search looks in your own project first.
|
|
28
|
+
- **Modes.** `/mode` or `--mode`: Euron Auto (default), Economy (fewer steps, routine changes), Balanced (a fixed
|
|
29
|
+
budget) and Advanced (more steps, more checks, more careful planning). The model is the same in every mode; your
|
|
30
|
+
own model (`/model add`) works in all of them.
|
|
31
|
+
- **`euron doctor`** now also checks pip, proxy settings, DNS, the connection, and the HTTPS certificate. If a
|
|
32
|
+
company proxy or antivirus uses its own certificate, it says so and how to fix it
|
|
33
|
+
(`euron config set sslTrustStore system` uses your computer's certificate store). Certificate checks are never
|
|
34
|
+
turned off.
|
|
35
|
+
|
|
36
|
+
## 1.6.1 (2026-11-13)
|
|
37
|
+
|
|
38
|
+
What was still left in a review of every Euron Code error of 7-13 Nov (3,354 requests).
|
|
39
|
+
|
|
40
|
+
- `continue` typed as the first message in a new terminal picks up your last session in this folder (from the
|
|
41
|
+
last 24 hours) instead of starting from nothing. `/clear` starts fresh.
|
|
42
|
+
- An API key that cannot be a key (a provider's name, a pasted `euron --model ...` command, a `<placeholder>`)
|
|
43
|
+
is refused before anything is sent, wherever it came from (environment variables too), with how to fix it.
|
|
44
|
+
- When today's allowance is used up, the message says what you can do now: use your own model with `/model add`
|
|
45
|
+
(and `/model euron` to come back), or wait for the reset time shown.
|
|
46
|
+
- Edits: fields sent under other names (`old_str`, `search`, `replace`, ...) are understood; when the text to
|
|
47
|
+
replace appears in several places, each place comes back with the lines around it, so the next try can pick
|
|
48
|
+
one at once.
|
|
49
|
+
- Reading Euron Code's own project notes (`.euron/knowledge/`) before anything is recorded is no longer an error.
|
|
50
|
+
- `/rewind` no longer says shell changes are not undone (since 1.6.0 they are).
|
|
51
|
+
|
|
3
52
|
## 1.6.0 (2026-11-13)
|
|
4
53
|
|
|
5
54
|
Finishes small jobs quickly, stops at a clear point, and does not break code that already worked. From a review of
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: euron-code
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students.
|
|
5
5
|
Project-URL: Homepage, https://euron.one/code-agent
|
|
6
6
|
Author-email: Euron <contact@euron.one>
|
|
@@ -308,6 +308,7 @@ Type `/` and pick from the menu. The most useful:
|
|
|
308
308
|
| `/compact`, `/clear` | summarise the conversation, or start fresh |
|
|
309
309
|
| `/resume`, `/export` | go back to a saved session, or save this one as Markdown |
|
|
310
310
|
| `/effort low\|medium\|high` | how much the model thinks before answering |
|
|
311
|
+
| `/mode auto\|economy\|balanced\|advanced` | how hard Euron Code works on a request (same model): Euron Auto is the default |
|
|
311
312
|
| `/login`, `/logout`, `/whoami` | switch account, log out, who am I |
|
|
312
313
|
| `/help` | everything else: rules, skills, hooks, memory, permissions, config, bug, release notes |
|
|
313
314
|
|
|
@@ -728,6 +729,10 @@ the connection itself is opened read-only. To let it write (local dev databases
|
|
|
728
729
|
| `microCompactKeepSteps` | `1` | tool outputs of the last N steps are always kept |
|
|
729
730
|
| `outputReserve` | auto | tokens kept free for the answer (default min(8192, window/4)) |
|
|
730
731
|
| `reasoningEffort` | `medium` | `low`, `medium` or `high` (also `/effort`) |
|
|
732
|
+
| `mode` | `auto` | `auto` (Euron Auto), `economy`, `balanced`, `advanced` (also `/mode`, `--mode`); never changes the model |
|
|
733
|
+
| `taskCheckpoints` | `true` | keep a checkpoint per job in `~/.euron/tasks/` so `continue` resumes without redoing work |
|
|
734
|
+
| `taskOutcomeReports` | `true` | send each task's status (no code, no prompt text) to Euron |
|
|
735
|
+
| `sslTrustStore` | `certifi` | `system` uses your computer's certificate store (company proxies); verification is always on |
|
|
731
736
|
| `attachmentMaxTokens` | `6000` | cap per attached document or folder digest |
|
|
732
737
|
| `toolOutputMaxChars` | `12000` | longer tool output is cut to head + tail |
|
|
733
738
|
| `hooks` | `{}` | see [Hooks](#hooks) |
|
|
@@ -242,6 +242,7 @@ Type `/` and pick from the menu. The most useful:
|
|
|
242
242
|
| `/compact`, `/clear` | summarise the conversation, or start fresh |
|
|
243
243
|
| `/resume`, `/export` | go back to a saved session, or save this one as Markdown |
|
|
244
244
|
| `/effort low\|medium\|high` | how much the model thinks before answering |
|
|
245
|
+
| `/mode auto\|economy\|balanced\|advanced` | how hard Euron Code works on a request (same model): Euron Auto is the default |
|
|
245
246
|
| `/login`, `/logout`, `/whoami` | switch account, log out, who am I |
|
|
246
247
|
| `/help` | everything else: rules, skills, hooks, memory, permissions, config, bug, release notes |
|
|
247
248
|
|
|
@@ -662,6 +663,10 @@ the connection itself is opened read-only. To let it write (local dev databases
|
|
|
662
663
|
| `microCompactKeepSteps` | `1` | tool outputs of the last N steps are always kept |
|
|
663
664
|
| `outputReserve` | auto | tokens kept free for the answer (default min(8192, window/4)) |
|
|
664
665
|
| `reasoningEffort` | `medium` | `low`, `medium` or `high` (also `/effort`) |
|
|
666
|
+
| `mode` | `auto` | `auto` (Euron Auto), `economy`, `balanced`, `advanced` (also `/mode`, `--mode`); never changes the model |
|
|
667
|
+
| `taskCheckpoints` | `true` | keep a checkpoint per job in `~/.euron/tasks/` so `continue` resumes without redoing work |
|
|
668
|
+
| `taskOutcomeReports` | `true` | send each task's status (no code, no prompt text) to Euron |
|
|
669
|
+
| `sslTrustStore` | `certifi` | `system` uses your computer's certificate store (company proxies); verification is always on |
|
|
665
670
|
| `attachmentMaxTokens` | `6000` | cap per attached document or folder digest |
|
|
666
671
|
| `toolOutputMaxChars` | `12000` | longer tool output is cut to head + tail |
|
|
667
672
|
| `hooks` | `{}` | see [Hooks](#hooks) |
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "euron-code"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.7.0"
|
|
8
8
|
description = "Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -19,7 +19,7 @@ from dataclasses import dataclass, field
|
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
21
21
|
|
|
22
|
-
from euron_code import api, context, licensing, memory, progress, prompts, rules, skills
|
|
22
|
+
from euron_code import api, context, failures, licensing, memory, modes, progress, prompts, rules, skills, taskstate
|
|
23
23
|
from euron_code.activity import Activity, phase_from_comment, tool_label
|
|
24
24
|
from euron_code.api import (BusyError, ContextTooLongError, EuronError, Interrupted, MidStreamError,
|
|
25
25
|
NetworkError, RateLimitedError)
|
|
@@ -271,6 +271,8 @@ class Agent:
|
|
|
271
271
|
self.ctx = ToolContext(root=self.root, settings=settings, ui=ui, tracker=ReadTracker(), agent=self,
|
|
272
272
|
savings=self.savings)
|
|
273
273
|
self.tokens = context.TokenTracker()
|
|
274
|
+
from euron_code import ctxstats
|
|
275
|
+
self.ctxstats = ctxstats.ContextStats() # repeated context per request (V2 phase 6 measurement)
|
|
274
276
|
self.cancel = threading.Event()
|
|
275
277
|
self.pending_note: Optional[str] = None
|
|
276
278
|
self._notices_shown: set = set() # gateway notices already shown
|
|
@@ -316,6 +318,17 @@ class Agent:
|
|
|
316
318
|
self._step_journal: Optional[Dict[str, Optional[bytes]]] = None
|
|
317
319
|
self._shell_snap = None
|
|
318
320
|
self._last_check: Optional[Tuple[str, int, str]] = None # (command, exit code, error tail)
|
|
321
|
+
# 1.7.0 (V2): jobs, checkpoints, evidence-based status, modes
|
|
322
|
+
self.job_id: Optional[str] = None # one job across "continue" resumes (X-Euron-Job)
|
|
323
|
+
self._resumed = False
|
|
324
|
+
self._objective = "" # the job's request as typed (kept verbatim in checkpoints and summaries)
|
|
325
|
+
self._checks: List[Tuple[int, str, int, Optional[str]]] = [] # (step, command, exit code, failure class)
|
|
326
|
+
self._last_ok_action = ""
|
|
327
|
+
self._extensions = 0 # extra budget windows given to a request still making progress
|
|
328
|
+
self._ext_from = (0, 0.0) # (steps, active seconds) when the current budget window started
|
|
329
|
+
self._budget_kind = "step_budget"
|
|
330
|
+
self.last_status: Optional[Dict[str, Any]] = None # the last task's decided status + evidence
|
|
331
|
+
self._job_diff = ""
|
|
319
332
|
self._adopt_fails = 0
|
|
320
333
|
self._rolled_back: List[str] = [] # repos whose adopted code was removed this request
|
|
321
334
|
self._cut_calls: Dict[str, Tuple[str, str]] = {} # tool call id -> ("saved" | "skip", note)
|
|
@@ -368,6 +381,15 @@ class Agent:
|
|
|
368
381
|
from euron_code import llm as _llm
|
|
369
382
|
return _llm.identity(self.model, self.uses_euron, str(getattr(self.llm, "label", None) or ""))
|
|
370
383
|
|
|
384
|
+
@property
|
|
385
|
+
def mode(self) -> str:
|
|
386
|
+
"""Euron Auto (default), economy, balanced or advanced: how hard to work, never which model (1.7.0)."""
|
|
387
|
+
return modes.current(self.settings)
|
|
388
|
+
|
|
389
|
+
@property
|
|
390
|
+
def policy(self) -> "modes.Policy":
|
|
391
|
+
return modes.POLICIES[self.mode]
|
|
392
|
+
|
|
371
393
|
def set_model(self, model: str, backend, window: Optional[int] = None, max_output: Optional[int] = None) -> None:
|
|
372
394
|
"""Switch who answers (the next model call uses it). The conversation is kept: it is stored in one
|
|
373
395
|
neutral format and converted per provider."""
|
|
@@ -526,7 +548,25 @@ class Agent:
|
|
|
526
548
|
tier = request_tier(user_text)
|
|
527
549
|
if SIMPLE_FOLLOWUP.match(user_text.strip()) and getattr(self, "_tier", None):
|
|
528
550
|
tier = self._tier if self._tier != "question" else "small" # "continue" carries on the same job
|
|
551
|
+
resume_cp = self._job_for(user_text)
|
|
552
|
+
if resume_cp is not None and resume_cp.get("tier") in TIER_BUDGETS:
|
|
553
|
+
tier = resume_cp["tier"] if resume_cp["tier"] != "question" else "small"
|
|
529
554
|
self._tier = tier
|
|
555
|
+
self._checks = []
|
|
556
|
+
self._last_ok_action = ""
|
|
557
|
+
self._extensions = 0
|
|
558
|
+
self._ext_from = (0, 0.0)
|
|
559
|
+
self._budget_kind = "step_budget"
|
|
560
|
+
self._done_at_window = sum(1 for t in self.ctx.todos if isinstance(t, dict) and t.get("status") == "completed")
|
|
561
|
+
self._job_diff = (resume_cp or {}).get("diff") or ""
|
|
562
|
+
self.client.mode = self.mode
|
|
563
|
+
self.client.job_id, self.client.resumed = self.job_id, self._resumed
|
|
564
|
+
if self.llm is not self.client and hasattr(self.llm, "job_id"):
|
|
565
|
+
self.llm.job_id, self.llm.resumed, self.llm.mode = self.job_id, self._resumed, self.mode
|
|
566
|
+
if resume_cp is not None:
|
|
567
|
+
self.add_context(taskstate.resume_note(resume_cp))
|
|
568
|
+
self.ui.dim(f"Resuming the job from its checkpoint ({len(resume_cp.get('filesChanged') or [])} file(s) "
|
|
569
|
+
f"changed, {len(resume_cp.get('pending') or [])} item(s) left); finished work is not redone.")
|
|
530
570
|
self._question_blocked = False
|
|
531
571
|
self._rollbacks = 0
|
|
532
572
|
self.ctx._rewrite_warned = set()
|
|
@@ -562,13 +602,138 @@ class Agent:
|
|
|
562
602
|
self.add_context(hook_block("UserPromptSubmit", r.stdout))
|
|
563
603
|
self.checkpoints.begin(len(self.messages), user_text)
|
|
564
604
|
result: Optional[TurnResult] = None
|
|
605
|
+
self._turn_started = time.monotonic()
|
|
606
|
+
self._turn_waited = WAIT_CLOCK.total
|
|
565
607
|
try:
|
|
566
608
|
result = self._run_turn(user_text, max_turns)
|
|
567
609
|
return result
|
|
568
610
|
finally:
|
|
569
611
|
self.checkpoints.finish()
|
|
612
|
+
self._finish_task(result)
|
|
570
613
|
self._remember_task(user_text, result)
|
|
571
614
|
|
|
615
|
+
# ---------------------------------------------------------- jobs, checkpoints, status (1.7.0, V2 phases 7-8)
|
|
616
|
+
def _job_for(self, user_text: str) -> Optional[Dict[str, Any]]:
|
|
617
|
+
"""Pick this request's job. "continue" after a stop resumes the job (this session's, or the folder's last
|
|
618
|
+
checkpoint from a new terminal) and returns its checkpoint; anything else starts a new job."""
|
|
619
|
+
self._resumed = False
|
|
620
|
+
cont = taskstate.is_continue(user_text) or bool(SIMPLE_FOLLOWUP.match(user_text.strip()) and
|
|
621
|
+
user_text.strip().lower().startswith(("continue", "go on")))
|
|
622
|
+
if cont and self.settings.get("taskCheckpoints", True) is not False:
|
|
623
|
+
cp = taskstate.load(self.root, self.job_id) if self.job_id else taskstate.latest(self.root)
|
|
624
|
+
if taskstate.resumable(cp):
|
|
625
|
+
self.job_id = cp["jobId"]
|
|
626
|
+
self._resumed = True
|
|
627
|
+
self._objective = str(cp.get("objective") or "")
|
|
628
|
+
return cp
|
|
629
|
+
if self.job_id and SIMPLE_FOLLOWUP.match(user_text.strip()):
|
|
630
|
+
return None # "continue" after a finished answer: the same job, nothing to resume
|
|
631
|
+
if not (self.job_id and SIMPLE_FOLLOWUP.match(user_text.strip())):
|
|
632
|
+
self.job_id = taskstate.new_job_id()
|
|
633
|
+
self._objective = user_text
|
|
634
|
+
return None
|
|
635
|
+
|
|
636
|
+
def _open_todos(self) -> List[str]:
|
|
637
|
+
return [str(t.get("content")) for t in self.ctx.todos
|
|
638
|
+
if isinstance(t, dict) and t.get("status") in ("pending", "in_progress")]
|
|
639
|
+
|
|
640
|
+
def _checks_after_edit(self) -> List[Tuple[int, str, int, Optional[str]]]:
|
|
641
|
+
last_edit = self._last_edit_step()
|
|
642
|
+
return [c for c in self._checks if last_edit is None or c[0] >= last_edit]
|
|
643
|
+
|
|
644
|
+
def _evidence(self, result: Optional[TurnResult]) -> Dict[str, Any]:
|
|
645
|
+
last = self._checks[-1] if self._checks else None
|
|
646
|
+
return {"stop_reason": result.stop_reason if result else "error", "error": result.error if result else None,
|
|
647
|
+
"edits": bool(self._real_edits()), "verified": bool(self._real_edits()) and self._verified(),
|
|
648
|
+
"last_check": (last[1], last[2], last[3]) if last else None,
|
|
649
|
+
"checks_after_edit": bool(self._checks_after_edit()), "open_todos": len(self._open_todos()),
|
|
650
|
+
"tier": self._tier, "budget_kind": self._budget_kind}
|
|
651
|
+
|
|
652
|
+
def _checkpoint(self, result: Optional[TurnResult], decided: Optional[Dict[str, Any]], final: bool) -> Dict[str, Any]:
|
|
653
|
+
steps, minutes = self.budget()
|
|
654
|
+
used_steps, used_s = getattr(self, "_budget_used", (0, 0.0))
|
|
655
|
+
done = [str(t.get("content")) for t in self.ctx.todos if isinstance(t, dict) and t.get("status") == "completed"]
|
|
656
|
+
cp_old = taskstate.load(self.root, self.job_id) if self._resumed and self.job_id else None
|
|
657
|
+
files = list(dict.fromkeys(list((cp_old or {}).get("filesChanged") or []) + self.files_changed()))
|
|
658
|
+
err = context.last_error(self.messages[-12:]) if (self._checks and self._checks[-1][2] != 0) or (
|
|
659
|
+
result is not None and result.stop_reason != "end_turn") else None
|
|
660
|
+
cp: Dict[str, Any] = {
|
|
661
|
+
"version": 1, "jobId": self.job_id, "taskId": self.client.task_id,
|
|
662
|
+
"taskIds": list(dict.fromkeys(list((cp_old or {}).get("taskIds") or []) + [self.client.task_id])),
|
|
663
|
+
"sessionId": getattr(self.session, "id", None), "objective": (self._objective or "")[:4000],
|
|
664
|
+
"tier": self._tier, "mode": self.mode, "plan": list(self.ctx.todos)[:40], "completed": done[:40],
|
|
665
|
+
"pending": self._open_todos()[:40], "filesChanged": files[:200],
|
|
666
|
+
"tests": [{"command": c[:300], "exitCode": code, "kind": taskstate.check_kind(c), "failureClass": cls}
|
|
667
|
+
for _, c, code, cls in self._checks[-8:]] or list((cp_old or {}).get("tests") or [])[-3:],
|
|
668
|
+
"errors": {"lastError": (err or "")[:1200], "failureClass": (decided or {}).get("failureClass") or
|
|
669
|
+
(self._checks[-1][3] if self._checks and self._checks[-1][2] != 0 else None)},
|
|
670
|
+
"budget": {"steps": used_steps, "stepsLimit": steps, "activeSec": int(used_s),
|
|
671
|
+
"timeLimitSec": int(minutes * 60), "extensions": self._extensions,
|
|
672
|
+
"limitHit": (decided or {}).get("limitHit")},
|
|
673
|
+
"lastSuccessfulAction": self._last_ok_action, "resumes": int((cp_old or {}).get("resumes") or 0) +
|
|
674
|
+
(1 if self._resumed and final else 0),
|
|
675
|
+
"status": (decided or {}).get("status") or "partial", "stopReason": (decided or {}).get("stopReason"),
|
|
676
|
+
"summary": ((result.text if result else "") or "")[:2000], "diff": self._job_diff,
|
|
677
|
+
}
|
|
678
|
+
if final and self.files_changed():
|
|
679
|
+
d = taskstate.git_diff(self.root, self.files_changed())
|
|
680
|
+
if d is None:
|
|
681
|
+
snap = self.checkpoints.stack[-1].before if self.checkpoints.stack else {}
|
|
682
|
+
d = taskstate.snapshot_diff(self.root, snap)
|
|
683
|
+
cp["diff"] = ((self._job_diff + "\n") if self._job_diff and d and d not in self._job_diff else "") + (d or "")
|
|
684
|
+
cp["diff"] = cp["diff"][-taskstate.MAX_DIFF:]
|
|
685
|
+
return cp
|
|
686
|
+
|
|
687
|
+
def _save_step_checkpoint(self) -> None:
|
|
688
|
+
"""After a step that ran tools: the job's state so far, without a diff (a crash or a closed terminal
|
|
689
|
+
still leaves a checkpoint to resume from)."""
|
|
690
|
+
if self.is_subagent or not self.job_id or self.settings.get("taskCheckpoints", True) is False:
|
|
691
|
+
return
|
|
692
|
+
try:
|
|
693
|
+
taskstate.save(self.root, self._checkpoint(None, {"status": "partial", "stopReason": "in_progress"}, False))
|
|
694
|
+
except Exception:
|
|
695
|
+
pass
|
|
696
|
+
|
|
697
|
+
def _finish_task(self, result: Optional[TurnResult]) -> None:
|
|
698
|
+
"""Decide the task's status from evidence, save the checkpoint, show the status, report it."""
|
|
699
|
+
if self.is_subagent or not self.job_id:
|
|
700
|
+
return
|
|
701
|
+
try:
|
|
702
|
+
decided = taskstate.decide_status(self._evidence(result))
|
|
703
|
+
except Exception:
|
|
704
|
+
return
|
|
705
|
+
self._budget_used = (result.turns if result else 0, max(0.0, time.monotonic() - self._turn_started
|
|
706
|
+
- (WAIT_CLOCK.total - self._turn_waited)))
|
|
707
|
+
after = self._checks_after_edit() if self._real_edits() else self._checks
|
|
708
|
+
last = after[-1] if after else None
|
|
709
|
+
verification = {"command": taskstate.clean_command(last[1], self.root) if last else "",
|
|
710
|
+
"exitCode": last[2] if last else None, "kind": taskstate.check_kind(last[1]) if last else "none"}
|
|
711
|
+
self.last_status = dict(decided, verification=verification, jobId=self.job_id, resumed=self._resumed)
|
|
712
|
+
if self.settings.get("taskCheckpoints", True) is not False:
|
|
713
|
+
try:
|
|
714
|
+
taskstate.save(self.root, self._checkpoint(result, decided, True))
|
|
715
|
+
except Exception:
|
|
716
|
+
pass
|
|
717
|
+
st = decided["status"]
|
|
718
|
+
if self._real_edits() or st not in ("completed_unverified", "completed_verified"):
|
|
719
|
+
how = ""
|
|
720
|
+
if last:
|
|
721
|
+
how = f" (`{last[1][:60]}` " + ("passed)" if last[2] == 0 else f"exit {last[2]})")
|
|
722
|
+
elif self._real_edits():
|
|
723
|
+
how = " (no check ran after the last change)"
|
|
724
|
+
extra = " Progress is saved: say \"continue\" to resume." if st in taskstate.RESUMABLE else ""
|
|
725
|
+
self.ui.dim(f"Status: {taskstate.LABELS[st]}{how}.{extra}")
|
|
726
|
+
if self.uses_euron and taskstate.outcome_enabled(self.settings) and self.client.task_id:
|
|
727
|
+
steps, minutes = self.budget()
|
|
728
|
+
used_steps, used_s = self._budget_used
|
|
729
|
+
payload = taskstate.build_payload(
|
|
730
|
+
task_id=self.client.task_id, job_id=self.job_id, session_id=getattr(self.session, "id", None),
|
|
731
|
+
decided=decided, verification=verification, steps=used_steps, files_changed=len(self.files_changed()),
|
|
732
|
+
mode=self.mode, resumed=self._resumed,
|
|
733
|
+
budget={"steps": used_steps, "stepsLimit": steps, "activeSec": int(used_s),
|
|
734
|
+
"timeLimitSec": int(minutes * 60)})
|
|
735
|
+
taskstate.report(self.client, payload)
|
|
736
|
+
|
|
572
737
|
def _remember_task(self, user_text: str, result: Optional[TurnResult]) -> None:
|
|
573
738
|
"""After every task: rescan the files it changed for security issues, then add it to the
|
|
574
739
|
project's journal, the built-files cache and the learned rules (.euron/knowledge/). Local,
|
|
@@ -617,8 +782,15 @@ class Agent:
|
|
|
617
782
|
if not self.is_subagent:
|
|
618
783
|
text += self._build_context(user_text)
|
|
619
784
|
text += self._migration_context(user_text)
|
|
620
|
-
if len(self.messages) == 1
|
|
621
|
-
|
|
785
|
+
snap = self._small_project_snapshot() if len(self.messages) == 1 else ""
|
|
786
|
+
text += snap
|
|
787
|
+
if not snap and not self._resumed and not SIMPLE_FOLLOWUP.match(user_text.strip()) \
|
|
788
|
+
and self.settings.get("contextIndex", True) is not False and self.permissions.mode != "plan":
|
|
789
|
+
try:
|
|
790
|
+
from euron_code import codeindex
|
|
791
|
+
text += codeindex.relevant_note(self.root, user_text)
|
|
792
|
+
except Exception:
|
|
793
|
+
pass
|
|
622
794
|
content: Any = text
|
|
623
795
|
if self.pending_images and not self.is_subagent:
|
|
624
796
|
content = [{"type": "text", "text": text}] + self.pending_images
|
|
@@ -647,6 +819,10 @@ class Agent:
|
|
|
647
819
|
last_text = ""
|
|
648
820
|
stop_feedback = 0
|
|
649
821
|
step_budget = int(self.settings.get("maxStepsPerPrompt") or DEFAULT_STEP_BUDGET)
|
|
822
|
+
if not self.is_subagent and step_budget == DEFAULT_STEP_BUDGET: # a limit the person set always wins
|
|
823
|
+
base_steps = self.base_budget()[0]
|
|
824
|
+
if base_steps > 0: # the request budget (with its mode's extensions) stops first, cleanly (1.7.0)
|
|
825
|
+
step_budget = max(step_budget, int(base_steps * (1 + 0.5 * self.policy.extensions)) + 2)
|
|
650
826
|
budget = step_budget
|
|
651
827
|
continues = 0 # answer cut by the output limit, continued automatically
|
|
652
828
|
cut_tools = 0
|
|
@@ -820,6 +996,8 @@ class Agent:
|
|
|
820
996
|
if self.ctx.todos != todos_before and self.session is not None:
|
|
821
997
|
self.session.todos(self.ctx.todos)
|
|
822
998
|
todos_before = list(self.ctx.todos)
|
|
999
|
+
if not self.is_subagent:
|
|
1000
|
+
self._save_step_checkpoint()
|
|
823
1001
|
if stop == DENIED:
|
|
824
1002
|
return TurnResult(last_text, "denied", turns)
|
|
825
1003
|
if stop in ("loop", "stuck"):
|
|
@@ -834,15 +1012,25 @@ class Agent:
|
|
|
834
1012
|
# ---------------------------------------------------------- finish in time
|
|
835
1013
|
def budget(self) -> Tuple[int, float]:
|
|
836
1014
|
"""(steps, minutes) for this request: its tier's budget, unless the settings name one (0 = none)."""
|
|
1015
|
+
steps, minutes = self.base_budget()
|
|
1016
|
+
n = getattr(self, "_extensions", 0)
|
|
1017
|
+
if n: # each extension adds half a budget (1.7.0)
|
|
1018
|
+
steps = steps + (steps * n + 1) // 2 if steps > 0 else steps
|
|
1019
|
+
minutes = minutes * (1 + 0.5 * n) if minutes > 0 else minutes
|
|
1020
|
+
return steps, minutes
|
|
1021
|
+
|
|
1022
|
+
def base_budget(self) -> Tuple[int, float]:
|
|
1023
|
+
"""The tier's budget scaled by the mode (explicit settings win, unscaled)."""
|
|
837
1024
|
tier_steps, tier_min = TIER_BUDGETS.get(getattr(self, "_tier", None) or "large", TIER_BUDGETS["large"])
|
|
1025
|
+
scale = self.policy.budget_scale
|
|
838
1026
|
try:
|
|
839
1027
|
raw = self.settings.get("taskTimeBudgetMinutes")
|
|
840
|
-
minutes = float(tier_min) if raw is None else float(raw or 0)
|
|
1028
|
+
minutes = float(tier_min) * scale if raw is None else float(raw or 0)
|
|
841
1029
|
except (TypeError, ValueError):
|
|
842
|
-
minutes = float(tier_min)
|
|
1030
|
+
minutes = float(tier_min) * scale
|
|
843
1031
|
try:
|
|
844
1032
|
raw = self.settings.get("taskStepBudget")
|
|
845
|
-
steps = tier_steps if raw is None else int(raw or 0)
|
|
1033
|
+
steps = max(4, int(round(tier_steps * scale))) if raw is None else int(raw or 0)
|
|
846
1034
|
except (TypeError, ValueError):
|
|
847
1035
|
steps = tier_steps
|
|
848
1036
|
return steps, minutes
|
|
@@ -855,9 +1043,41 @@ class Agent:
|
|
|
855
1043
|
def _over_budget(self, turns: int, started_at: float) -> bool:
|
|
856
1044
|
steps, minutes = self.budget()
|
|
857
1045
|
self._budget_used = (turns, self.active_seconds(started_at))
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
1046
|
+
over_time = minutes > 0 and self._budget_used[1] > minutes * 60
|
|
1047
|
+
over_steps = bool(steps > 0 and turns >= steps)
|
|
1048
|
+
if not (over_time or over_steps):
|
|
1049
|
+
return False
|
|
1050
|
+
self._budget_kind = "time_budget" if over_time else "step_budget"
|
|
1051
|
+
if self._may_extend(turns):
|
|
1052
|
+
self._extensions += 1
|
|
1053
|
+
self._ext_from = (turns, self._budget_used[1])
|
|
1054
|
+
s2, m2 = self.budget()
|
|
1055
|
+
self.ui.dim(f"(still making progress at the budget line: {modes.label(self.mode)} gives "
|
|
1056
|
+
f"this request more room, up to {s2} steps / {int(m2)} min)")
|
|
1057
|
+
return False
|
|
1058
|
+
return True
|
|
1059
|
+
|
|
1060
|
+
def _may_extend(self, turns: int) -> bool:
|
|
1061
|
+
"""A request at its budget line goes on (its mode's extra windows) only while the evidence says it is
|
|
1062
|
+
getting somewhere: in the window since the last line, files changed or todo items were finished, and
|
|
1063
|
+
the latest check is not failing the same way again. Never for a question, never past 2x the budget
|
|
1064
|
+
(V2 phase 7: 348 of 3,235 tasks in 7 days stopped at the budget, many of them mid-way through work)."""
|
|
1065
|
+
if (self.is_subagent or self._tier == "question" or self._extensions >= self.policy.extensions
|
|
1066
|
+
or self._stuck or self.settings.get("taskStepBudget") == 0):
|
|
1067
|
+
return False
|
|
1068
|
+
since = self._ext_from[0]
|
|
1069
|
+
start_step = self.steps - (turns - since)
|
|
1070
|
+
new_edits = {rel for st, rel in self._real_edits() if st > start_step}
|
|
1071
|
+
done_now = sum(1 for t in self.ctx.todos if isinstance(t, dict) and t.get("status") == "completed")
|
|
1072
|
+
finished = done_now > getattr(self, "_done_at_window", 0)
|
|
1073
|
+
self._done_at_window = done_now
|
|
1074
|
+
window_checks = [c for c in self._checks if c[0] > start_step]
|
|
1075
|
+
if window_checks and window_checks[-1][2] != 0:
|
|
1076
|
+
same = [c for c in window_checks if c[2] != 0 and c[3] == window_checks[-1][3]]
|
|
1077
|
+
if len(same) >= 3 or failures.blocks(window_checks[-1][3]):
|
|
1078
|
+
return False # failing the same way again and again, or blocked outside the code
|
|
1079
|
+
fixed = any(c[2] == 0 for c in window_checks) and any(c[2] != 0 for c in self._checks if c[0] <= start_step)
|
|
1080
|
+
return bool(new_edits or finished or fixed)
|
|
861
1081
|
|
|
862
1082
|
def _wrap_up(self, turns: int, last_text: str, nudge: Optional[str] = None, reason: str = "budget") -> TurnResult:
|
|
863
1083
|
"""Ask once, without tools, for: what is done, what is left, the next step. Then stop cleanly."""
|
|
@@ -989,7 +1209,7 @@ class Agent:
|
|
|
989
1209
|
`routineEffort` (default "none", no thinking); after successful reads and commands "low"."""
|
|
990
1210
|
last = getattr(self, "_last_step_tools", None) or []
|
|
991
1211
|
if first_step or not last or any(err for _, err in last):
|
|
992
|
-
self._step_effort = None
|
|
1212
|
+
self._step_effort = self.policy.first_effort if (first_step and not self.is_subagent) else None
|
|
993
1213
|
elif all(name in MECHANICAL_TOOLS for name, _ in last):
|
|
994
1214
|
self._step_effort = str(self.settings.get("routineEffort") or "none")
|
|
995
1215
|
else:
|
|
@@ -1235,6 +1455,8 @@ class Agent:
|
|
|
1235
1455
|
# so "context length exceeded" never reaches the user
|
|
1236
1456
|
self.fit_to_window()
|
|
1237
1457
|
payload = self._payload()
|
|
1458
|
+
if not self.is_subagent:
|
|
1459
|
+
self.ctxstats.observe(self.messages[1:])
|
|
1238
1460
|
sent_n, sent_last = len(self.messages), self.messages[-1]
|
|
1239
1461
|
raw_est = context.estimate_tokens(self.messages, self.tool_schemas)
|
|
1240
1462
|
act = self.activity
|
|
@@ -1411,8 +1633,72 @@ class Agent:
|
|
|
1411
1633
|
self._settle_step(out, journal)
|
|
1412
1634
|
for m in out:
|
|
1413
1635
|
self._append(m)
|
|
1636
|
+
if self.settings.get("supersedeStaleReads") == "always":
|
|
1637
|
+
self._supersede_stale_reads()
|
|
1414
1638
|
return stop
|
|
1415
1639
|
|
|
1640
|
+
def _supersede_stale_reads(self) -> int:
|
|
1641
|
+
"""A file read, then changed, then read again: the earlier read shows text that no longer exists. Keep only
|
|
1642
|
+
the newest copy (the older one becomes a one-line stub): no stale text to copy an old_string from, and
|
|
1643
|
+
fewer repeated tokens. By default this runs only where the history is rewritten anyway (clearing tool
|
|
1644
|
+
outputs, a summary), because changing an old message costs a prefix-cache miss from that point
|
|
1645
|
+
(V2 baseline: uncached prefill is the larger waste). Returns characters saved."""
|
|
1646
|
+
if self.settings.get("supersedeStaleReads", True) is False:
|
|
1647
|
+
return 0
|
|
1648
|
+
calls = context._call_index(self.messages)
|
|
1649
|
+
|
|
1650
|
+
def key_of(cid: str) -> Optional[str]:
|
|
1651
|
+
name, args = calls.get(cid, ("", {}))
|
|
1652
|
+
if name != "read_file" or not isinstance(args, dict) or not args.get("path"):
|
|
1653
|
+
return None
|
|
1654
|
+
try:
|
|
1655
|
+
return ReadTracker._key(self.ctx.resolve(str(args["path"])))
|
|
1656
|
+
except Exception:
|
|
1657
|
+
return None
|
|
1658
|
+
reads: Dict[str, List[int]] = {}
|
|
1659
|
+
edits: Dict[str, List[int]] = {}
|
|
1660
|
+
for i, m in enumerate(self.messages):
|
|
1661
|
+
if m.get("role") == "tool" and m.get("name") == "read_file":
|
|
1662
|
+
c = str(m.get("content") or "")
|
|
1663
|
+
if c.startswith(("Error", "Skipped")) or "has not changed since your last read" in c:
|
|
1664
|
+
continue
|
|
1665
|
+
k = key_of(str(m.get("tool_call_id")))
|
|
1666
|
+
if k:
|
|
1667
|
+
reads.setdefault(k, []).append(i)
|
|
1668
|
+
for tc in m.get("tool_calls") or []:
|
|
1669
|
+
fn = tc.get("function") or {}
|
|
1670
|
+
if fn.get("name") in ("write_file", "edit_file", "multi_edit"):
|
|
1671
|
+
try:
|
|
1672
|
+
raw = json.loads(fn.get("arguments") or "{}").get("path")
|
|
1673
|
+
k = ReadTracker._key(self.ctx.resolve(str(raw))) if raw else None
|
|
1674
|
+
except Exception:
|
|
1675
|
+
k = None
|
|
1676
|
+
if k:
|
|
1677
|
+
edits.setdefault(k, []).append(i)
|
|
1678
|
+
saved, ids = 0, []
|
|
1679
|
+
for k, idx in reads.items():
|
|
1680
|
+
if len(idx) < 2:
|
|
1681
|
+
continue
|
|
1682
|
+
last_read = idx[-1]
|
|
1683
|
+
for i in idx[:-1]:
|
|
1684
|
+
if not any(i < e < last_read for e in edits.get(k, [])):
|
|
1685
|
+
continue # not changed between this read and the newest one: still true, keep it
|
|
1686
|
+
m = self.messages[i]
|
|
1687
|
+
c = str(m.get("content") or "")
|
|
1688
|
+
if len(c) < 300 or context.ELIDED in c:
|
|
1689
|
+
continue
|
|
1690
|
+
name, args = calls.get(str(m.get("tool_call_id")), ("read_file", {}))
|
|
1691
|
+
stub = (f"[{context.describe_call(name, args, c)}] [out of date: the file changed and was read "
|
|
1692
|
+
f"again below] {context.ELIDED}")
|
|
1693
|
+
saved += len(c) - len(stub)
|
|
1694
|
+
self.messages[i] = dict(m, content=stub)
|
|
1695
|
+
ids.append(str(m.get("tool_call_id")))
|
|
1696
|
+
if ids:
|
|
1697
|
+
self.ctx.tracker.forget_calls(ids)
|
|
1698
|
+
self.savings.add("dedupe", saved)
|
|
1699
|
+
self._persist_compaction()
|
|
1700
|
+
return saved
|
|
1701
|
+
|
|
1416
1702
|
def _mark_step_failure(self) -> None:
|
|
1417
1703
|
"""An edit tool itself failed (not a refusal before it ran: outside a sub-agent's paths, plan mode, a
|
|
1418
1704
|
deny rule, a question): the step's other edits are undone."""
|
|
@@ -1566,7 +1852,15 @@ class Agent:
|
|
|
1566
1852
|
return content, False
|
|
1567
1853
|
|
|
1568
1854
|
def _record(self, name: str, req: Optional[Request], content: str, is_error: bool) -> None:
|
|
1569
|
-
if
|
|
1855
|
+
if req is None:
|
|
1856
|
+
return
|
|
1857
|
+
if is_error:
|
|
1858
|
+
# a command that ran and exited non-zero IS evidence (bash returns is_error for exit != 0): up to 1.6.1
|
|
1859
|
+
# failing checks never reached the ledger, so "the last check still fails" never fired for bash and a
|
|
1860
|
+
# pass followed by a fail after the same edit still counted as verified (1.7.0)
|
|
1861
|
+
m = _EXIT_RE.match(content) if name == "bash" else None
|
|
1862
|
+
if m:
|
|
1863
|
+
self.ledger["commands"].append((self.steps, req.command or "", int(m.group(1))))
|
|
1570
1864
|
return
|
|
1571
1865
|
step = self.steps
|
|
1572
1866
|
if req.category == "Edit":
|
|
@@ -1644,6 +1938,12 @@ class Agent:
|
|
|
1644
1938
|
m = _EXIT_RE.match(content)
|
|
1645
1939
|
code = 0 if (name == "check_app" and not failed) else (int(m.group(1)) if m else (1 if failed else 0))
|
|
1646
1940
|
self._last_check = (command or name, code, progress.tail_for(content) if code else "")
|
|
1941
|
+
cls = failures.from_output(content, taskstate.check_kind(command) == "tests") if code else None
|
|
1942
|
+
self._checks.append((self.steps, command or name, code, cls))
|
|
1943
|
+
self._last_check_out = content if code else ""
|
|
1944
|
+
if not failed and req is not None and name not in ("todo_write",):
|
|
1945
|
+
what = (req.command or "") if name == "bash" else ", ".join(self.ctx.rel(p) for p in req.paths[:3])
|
|
1946
|
+
self._last_ok_action = f"step {self.steps}: {name} {what}".strip()[:200]
|
|
1647
1947
|
v = self.guard.tool_result(name, content, is_check=is_check)
|
|
1648
1948
|
notes = [v.note] if v.note else []
|
|
1649
1949
|
if not failed and req is not None and req.category == "Edit" and name != "oss_adopt":
|
|
@@ -1748,10 +2048,29 @@ class Agent:
|
|
|
1748
2048
|
cmd = None
|
|
1749
2049
|
return cmd
|
|
1750
2050
|
|
|
2051
|
+
def _diagnosis(self) -> str:
|
|
2052
|
+
"""The Diagnose step (V2 phase 8): the failure's class and what to do about it, and the code at the places
|
|
2053
|
+
the error points to (marked as read, so the fix needs no extra read_file step)."""
|
|
2054
|
+
cls = self._checks[-1][3] if self._checks and self._checks[-1][2] != 0 else None
|
|
2055
|
+
out = ""
|
|
2056
|
+
h = failures.hint(cls)
|
|
2057
|
+
if h:
|
|
2058
|
+
out += f"\n[Diagnosis: {cls}. {h}]"
|
|
2059
|
+
if cls in ("compilation_failure", "test_failure", "tool_execution_failure") and \
|
|
2060
|
+
self.settings.get("errorContext", True) is not False:
|
|
2061
|
+
from euron_code import codeindex
|
|
2062
|
+
|
|
2063
|
+
def mark(p, first, count):
|
|
2064
|
+
self.ctx.tracker.mark_read(p, (first, count), self.ctx.turn, 0, None)
|
|
2065
|
+
code = codeindex.error_context(getattr(self, "_last_check_out", "") or "", self.root, self.ctx.rel, mark)
|
|
2066
|
+
if code:
|
|
2067
|
+
out += "\n[The code where the error points (as on disk now; you may edit these lines directly):]\n" + code
|
|
2068
|
+
return out
|
|
2069
|
+
|
|
1751
2070
|
def _done_nudge(self) -> Optional[str]:
|
|
1752
2071
|
"""Definition of done: after the last change a real check (build / tests / running it) must pass. Up
|
|
1753
2072
|
to MAX_DONE_NUDGES times the model is sent back: to run one, or to fix the one that fails."""
|
|
1754
|
-
if (self.is_subagent or self._done_nudges >=
|
|
2073
|
+
if (self.is_subagent or self._done_nudges >= self.policy.done_nudges or not self._real_edits()
|
|
1755
2074
|
or self.permissions.mode == "plan" or self.settings.get("verifyNudge", True) is False):
|
|
1756
2075
|
return None
|
|
1757
2076
|
if all(_DOC_RE.search(rel) for rel in self.files_changed()):
|
|
@@ -1765,7 +2084,8 @@ class Agent:
|
|
|
1765
2084
|
and progress.is_check_command(c)]
|
|
1766
2085
|
if after and after[-1][1] != 0 and self._last_check:
|
|
1767
2086
|
cmd, code, tail = self._last_check
|
|
1768
|
-
return prompts.CHECK_FAILED_NUDGE.format(cmd=cmd[:160], code=code, tail=tail[:900] or "(no output)")
|
|
2087
|
+
return prompts.CHECK_FAILED_NUDGE.format(cmd=cmd[:160], code=code, tail=tail[:900] or "(no output)") \
|
|
2088
|
+
+ self._diagnosis()
|
|
1769
2089
|
if self._nudged:
|
|
1770
2090
|
return None # asked once to verify and it chose not to: it says why in its answer
|
|
1771
2091
|
self._nudged = True
|
|
@@ -2372,7 +2692,7 @@ class Agent:
|
|
|
2372
2692
|
OPT-IN (`"specReview": true`): measured on the self-hosted model it cost 6-10 steps and the model
|
|
2373
2693
|
adjusted its own asserts to match its bug, so it is off by default."""
|
|
2374
2694
|
if (self.is_subagent or self._spec_reviewed or self.permissions.mode == "plan"
|
|
2375
|
-
or self.settings.get("specReview",
|
|
2695
|
+
or self.settings.get("specReview", self.policy.spec_review) is not True or not self._real_edits()):
|
|
2376
2696
|
return False
|
|
2377
2697
|
text = re.sub(r'<attached-file path="[^"]*">.*?</attached-file>', " ", user_text or "", flags=re.S)
|
|
2378
2698
|
if len(text.strip()) < self.SPEC_REVIEW_MIN_CHARS:
|
|
@@ -2719,6 +3039,7 @@ class Agent:
|
|
|
2719
3039
|
before = self.context_usage()
|
|
2720
3040
|
if before <= target:
|
|
2721
3041
|
return 0
|
|
3042
|
+
self._supersede_stale_reads() # the history is being rewritten anyway: no extra cache miss (1.7.0)
|
|
2722
3043
|
protect = int(self.settings.get("microCompactKeepSteps") or 1)
|
|
2723
3044
|
saved, ids = context.condense_history(self.messages, protect_steps=protect)
|
|
2724
3045
|
if saved:
|
|
@@ -2795,6 +3116,7 @@ class Agent:
|
|
|
2795
3116
|
sent = list(self.messages)
|
|
2796
3117
|
# stage 1: drop bulky old tool outputs
|
|
2797
3118
|
if not manual:
|
|
3119
|
+
self._supersede_stale_reads()
|
|
2798
3120
|
cf_saved, cf_ids = context.condense_history(self.messages, protect_steps=1)
|
|
2799
3121
|
self.ctx.tracker.forget_calls(cf_ids)
|
|
2800
3122
|
self.savings.add("micro", cf_saved)
|
|
@@ -2868,6 +3190,13 @@ class Agent:
|
|
|
2868
3190
|
self.ui.dim("The summary came back empty; keeping the conversation as it was.")
|
|
2869
3191
|
return False
|
|
2870
3192
|
head = "[Summary of the earlier part of this conversation]\n" + summary
|
|
3193
|
+
obj = " ".join((getattr(self, "_objective", "") or "").split())
|
|
3194
|
+
if obj and not self.is_subagent: # the requirements as typed survive every summary (V2 phase 6B)
|
|
3195
|
+
head += "\n\nThe job's request as the user typed it: " + (obj[:1500] + " ..." if len(obj) > 1500 else obj)
|
|
3196
|
+
if getattr(self, "_checks", None):
|
|
3197
|
+
head += "\n\nChecks so far: " + "; ".join(
|
|
3198
|
+
f"`{c[:80]}` " + ("passed" if code == 0 else f"failed (exit {code}{', ' + cls if cls else ''})")
|
|
3199
|
+
for _, c, code, cls in self._checks[-4:])
|
|
2871
3200
|
changed = self._files_changed()
|
|
2872
3201
|
if changed:
|
|
2873
3202
|
head += "\n\nFiles changed in this session: " + ", ".join(changed)
|