euron-code 1.5.7__tar.gz → 1.6.1__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 (155) hide show
  1. {euron_code-1.5.7 → euron_code-1.6.1}/CHANGELOG.md +48 -0
  2. {euron_code-1.5.7 → euron_code-1.6.1}/PKG-INFO +6 -4
  3. {euron_code-1.5.7 → euron_code-1.6.1}/README.md +5 -3
  4. {euron_code-1.5.7 → euron_code-1.6.1}/pyproject.toml +1 -1
  5. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/__init__.py +1 -1
  6. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/agent.py +295 -17
  7. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/checkpoints.py +100 -0
  8. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/config.py +4 -2
  9. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/llm/base.py +15 -0
  10. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/prompts.py +4 -2
  11. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/repl.py +22 -2
  12. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/background.py +1 -0
  13. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/base.py +19 -2
  14. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/fs.py +231 -10
  15. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/shell.py +5 -0
  16. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_qa_print_output.py +2 -1
  17. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_tools_fs.py +4 -2
  18. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v155_user_errors.py +1 -1
  19. euron_code-1.6.1/tests/test_v160_stop_scope_atomic.py +283 -0
  20. euron_code-1.6.1/tests/test_v161_residual_errors.py +123 -0
  21. {euron_code-1.5.7 → euron_code-1.6.1}/.gitignore +0 -0
  22. {euron_code-1.5.7 → euron_code-1.6.1}/LICENSE +0 -0
  23. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/__main__.py +0 -0
  24. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/activity.py +0 -0
  25. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/api.py +0 -0
  26. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/attachments.py +0 -0
  27. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/auth.py +0 -0
  28. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/autoupdate.py +0 -0
  29. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
  30. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
  31. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
  32. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
  33. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/cache.py +0 -0
  34. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/cli.py +0 -0
  35. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/context.py +0 -0
  36. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/contextforge/LICENSE +0 -0
  37. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/contextforge/__init__.py +0 -0
  38. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/contextforge/text.py +0 -0
  39. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/contextforge/toolout.py +0 -0
  40. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/credentials.py +0 -0
  41. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/doctor.py +0 -0
  42. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/documents.py +0 -0
  43. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/dotnet.py +0 -0
  44. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/error_hints.py +0 -0
  45. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/errorlog.py +0 -0
  46. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/friendly.py +0 -0
  47. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/frontmatter.py +0 -0
  48. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/hooks.py +0 -0
  49. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/keys.py +0 -0
  50. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/knowledge.py +0 -0
  51. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/licensing.py +0 -0
  52. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/llm/__init__.py +0 -0
  53. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/llm/anthropic.py +0 -0
  54. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/llm/openai_compat.py +0 -0
  55. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/llm/setup.py +0 -0
  56. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/logo.py +0 -0
  57. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/markdown_view.py +0 -0
  58. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/memory.py +0 -0
  59. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/migration.py +0 -0
  60. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/mvc5.py +0 -0
  61. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/osscache.py +0 -0
  62. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/ossgithub.py +0 -0
  63. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/pasteinput.py +0 -0
  64. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/pathfix.py +0 -0
  65. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/permissions.py +0 -0
  66. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/progress.py +0 -0
  67. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/project_setup.py +0 -0
  68. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/repomap.py +0 -0
  69. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/rules.py +0 -0
  70. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/security_scan.py +0 -0
  71. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/sessions.py +0 -0
  72. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/skills.py +0 -0
  73. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/textsafe.py +0 -0
  74. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/__init__.py +0 -0
  75. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/db.py +0 -0
  76. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/document.py +0 -0
  77. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/erie.py +0 -0
  78. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/ignore.py +0 -0
  79. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/normalize.py +0 -0
  80. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/oss.py +0 -0
  81. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/pathfind.py +0 -0
  82. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/port.py +0 -0
  83. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/reuse.py +0 -0
  84. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/search.py +0 -0
  85. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/skill.py +0 -0
  86. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/symbols.py +0 -0
  87. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/task.py +0 -0
  88. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/todo.py +0 -0
  89. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/tools/web.py +0 -0
  90. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/transcript.py +0 -0
  91. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/trust.py +0 -0
  92. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/ui.py +0 -0
  93. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/update_check.py +0 -0
  94. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/usage_view.py +0 -0
  95. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/version_info.py +0 -0
  96. {euron_code-1.5.7 → euron_code-1.6.1}/src/euron_code/webforms.py +0 -0
  97. {euron_code-1.5.7 → euron_code-1.6.1}/tests/conftest.py +0 -0
  98. {euron_code-1.5.7 → euron_code-1.6.1}/tests/fake_providers.py +0 -0
  99. {euron_code-1.5.7 → euron_code-1.6.1}/tests/helpers.py +0 -0
  100. {euron_code-1.5.7 → euron_code-1.6.1}/tests/measure_floor.py +0 -0
  101. {euron_code-1.5.7 → euron_code-1.6.1}/tests/mock_gateway.py +0 -0
  102. {euron_code-1.5.7 → euron_code-1.6.1}/tests/serve_helper.py +0 -0
  103. {euron_code-1.5.7 → euron_code-1.6.1}/tests/sim_long_session.py +0 -0
  104. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_agent_mock.py +0 -0
  105. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_api_shell.py +0 -0
  106. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_bench.py +0 -0
  107. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_bench_harness.py +0 -0
  108. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_cli_e2e.py +0 -0
  109. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_context_memory_sessions.py +0 -0
  110. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_dashboard_fixes.py +0 -0
  111. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_dashboard_fixes_102.py +0 -0
  112. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_db.py +0 -0
  113. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_erie.py +0 -0
  114. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_knowledge_security.py +0 -0
  115. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_markdown_view.py +0 -0
  116. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_oss_local.py +0 -0
  117. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_permissions.py +0 -0
  118. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_powershell_exit_codes.py +0 -0
  119. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_qa_attach_secrets.py +0 -0
  120. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_qa_long_task.py +0 -0
  121. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_qa_reuse_unrelated.py +0 -0
  122. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_qa_yolo_outside.py +0 -0
  123. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_repl.py +0 -0
  124. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_reuse_honesty.py +0 -0
  125. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_search.py +0 -0
  126. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_textsafe.py +0 -0
  127. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_transcript_ui.py +0 -0
  128. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_update_check.py +0 -0
  129. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v111_user_reports.py +0 -0
  130. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v113_fix_path.py +0 -0
  131. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v11_byo.py +0 -0
  132. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v11_speed.py +0 -0
  133. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v11_tool_fixes.py +0 -0
  134. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v130_cut_writes.py +0 -0
  135. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v130_reliability.py +0 -0
  136. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v140_parity.py +0 -0
  137. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v152_migration.py +0 -0
  138. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v153_user_errors.py +0 -0
  139. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v156_autoupdate.py +0 -0
  140. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v156_paste_and_edits.py +0 -0
  141. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v157_zero_errors.py +0 -0
  142. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v15_hosted_models.py +0 -0
  143. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
  144. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v2_rules_skills_hooks.py +0 -0
  145. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v2_tokens_shortcuts.py +0 -0
  146. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v2_usage_headers.py +0 -0
  147. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v31_security.py +0 -0
  148. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v3_accounts_value_setup.py +0 -0
  149. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v3_activity.py +0 -0
  150. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v3_attachments.py +0 -0
  151. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v3_context.py +0 -0
  152. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v3_live_repl.py +0 -0
  153. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v3_single_login.py +0 -0
  154. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v4.py +0 -0
  155. {euron_code-1.5.7 → euron_code-1.6.1}/tests/test_v5.py +0 -0
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.1 (2026-11-13)
4
+
5
+ What was still left in a review of every Euron Code error of 7-13 Nov (3,354 requests).
6
+
7
+ - `continue` typed as the first message in a new terminal picks up your last session in this folder (from the
8
+ last 24 hours) instead of starting from nothing. `/clear` starts fresh.
9
+ - An API key that cannot be a key (a provider's name, a pasted `euron --model ...` command, a `<placeholder>`)
10
+ is refused before anything is sent, wherever it came from (environment variables too), with how to fix it.
11
+ - When today's allowance is used up, the message says what you can do now: use your own model with `/model add`
12
+ (and `/model euron` to come back), or wait for the reset time shown.
13
+ - Edits: fields sent under other names (`old_str`, `search`, `replace`, ...) are understood; when the text to
14
+ replace appears in several places, each place comes back with the lines around it, so the next try can pick
15
+ one at once.
16
+ - Reading Euron Code's own project notes (`.euron/knowledge/`) before anything is recorded is no longer an error.
17
+ - `/rewind` no longer says shell changes are not undone (since 1.6.0 they are).
18
+
19
+ ## 1.6.0 (2026-11-13)
20
+
21
+ Finishes small jobs quickly, stops at a clear point, and does not break code that already worked. From a review of
22
+ every Euron Code session of 5-12 Nov (135 people, 3,106 requests).
23
+
24
+ - **A budget that fits the request.** A question gets up to 12 steps / 6 minutes, a small change 30 steps / 15
25
+ minutes, a big job 60 steps / 30 minutes (was 120 steps / 40 minutes for everything). Time spent waiting for
26
+ your answer to a question ("Apply this change?") no longer counts. Set `taskStepBudget` /
27
+ `taskTimeBudgetMinutes` (or `--no-budget`) to choose your own.
28
+ - **A clear stopping point.** When a request stops at its budget you get a plain list: files changed, the last
29
+ check and whether it passed, what is still open, and how to go on (`continue`) or undo (`/rewind`).
30
+ - **Questions are answered, not acted on.** "How do I run the backend?" no longer edits your files; Euron Code
31
+ answers and says what it would change, and you decide.
32
+ - **Edits are all-or-nothing.** When one of several edits in a step fails, the others in that step are undone, so
33
+ no file (or pair of files) is left half-changed. A failed `multi_edit` says on its first line that nothing was
34
+ applied.
35
+ - **No edits from memory after a summary.** After a long conversation is summarised, a file must be looked at
36
+ again before it is changed; the refusal carries the file's current text, so this costs no extra step. The
37
+ summary also lists the exact paths already used, so paths are not guessed.
38
+ - **No second copy of what was there.** An edit that adds a second spinner, loader, overlay or modal next to the
39
+ old one (or repeats an import or definition) is flagged so the old one is replaced. Rewriting most of a working
40
+ file with `write_file` is refused once in favour of a targeted edit.
41
+ - **/rewind also undoes what commands changed** (a script, `sed -i`, a formatter), not only Euron Code's own
42
+ edits, for projects up to 4,000 small files.
43
+ - **Never an empty answer.** When the model's reply is empty twice, Euron Code writes the summary itself from what
44
+ really happened (files changed, last check, what is left).
45
+ - Fewer edit errors: an edit whose text is already in the file is a no-op instead of an error; a failed edit in a
46
+ big file returns the 80 lines around its target (so the retry needs no extra read); `multi_edit` accepts its
47
+ edits as a JSON string or with `edit_file`'s arguments.
48
+ - Every program Euron Code starts (commands, servers, hooks) runs with UTF-8 output (`PYTHONUTF8=1`), so Python
49
+ scripts on Windows no longer crash printing Hindi or emoji.
50
+
3
51
  ## 1.5.7 (2026-11-12)
4
52
 
5
53
  No errors to act on: what went wrong for people this week is now handled by Euron Code itself.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: euron-code
3
- Version: 1.5.7
3
+ Version: 1.6.1
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>
@@ -657,9 +657,11 @@ Euron Code manages the conversation for you, with nothing to set up:
657
657
  - **Reasoning effort** is `medium` for planning and after a failure, lower for routine steps (continuing
658
658
  after successful edits, reads and commands), and `low` for quick follow-ups ("thanks", "continue");
659
659
  change it with `/effort low|medium|high` (`adaptiveEffort: false` keeps one level for every step).
660
- - **Finishes in time.** A request has a soft budget of 40 minutes or 120 steps (`taskTimeBudgetMinutes`,
661
- `taskStepBudget`; `--no-budget` for one run). Then Euron Code stops and tells you what is done, what is
662
- left and the next step; say "continue" to go on. When the same error keeps coming back, it stops and
660
+ - **Finishes in time.** A request has a soft budget that fits its size: a question 12 steps / 6 minutes, a
661
+ small change 30 steps / 15 minutes, a big job 60 steps / 30 minutes. Time spent waiting for your answer does
662
+ not count. Set your own with `taskTimeBudgetMinutes` / `taskStepBudget` (`--no-budget` for one run). Then
663
+ Euron Code stops and lists what is done (files, last check), what is left and the next step; say "continue"
664
+ to go on, or `/rewind` to undo the request's changes (including what its commands changed). When the same error keeps coming back, it stops and
663
665
  re-plans instead of repeating itself.
664
666
  - **Sub-agents in parallel.** For independent parts of a big task the agent can start up to 3 sub-agents
665
667
  at once: read-only researchers, or builders that each own their own files (for example one writes the
@@ -591,9 +591,11 @@ Euron Code manages the conversation for you, with nothing to set up:
591
591
  - **Reasoning effort** is `medium` for planning and after a failure, lower for routine steps (continuing
592
592
  after successful edits, reads and commands), and `low` for quick follow-ups ("thanks", "continue");
593
593
  change it with `/effort low|medium|high` (`adaptiveEffort: false` keeps one level for every step).
594
- - **Finishes in time.** A request has a soft budget of 40 minutes or 120 steps (`taskTimeBudgetMinutes`,
595
- `taskStepBudget`; `--no-budget` for one run). Then Euron Code stops and tells you what is done, what is
596
- left and the next step; say "continue" to go on. When the same error keeps coming back, it stops and
594
+ - **Finishes in time.** A request has a soft budget that fits its size: a question 12 steps / 6 minutes, a
595
+ small change 30 steps / 15 minutes, a big job 60 steps / 30 minutes. Time spent waiting for your answer does
596
+ not count. Set your own with `taskTimeBudgetMinutes` / `taskStepBudget` (`--no-budget` for one run). Then
597
+ Euron Code stops and lists what is done (files, last check), what is left and the next step; say "continue"
598
+ to go on, or `/rewind` to undo the request's changes (including what its commands changed). When the same error keeps coming back, it stops and
597
599
  re-plans instead of repeating itself.
598
600
  - **Sub-agents in parallel.** For independent parts of a big task the agent can start up to 3 sub-agents
599
601
  at once: read-only researchers, or builders that each own their own files (for example one writes the
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "euron-code"
7
- version = "1.5.7"
7
+ version = "1.6.1"
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"
@@ -1,3 +1,3 @@
1
1
  """Euron Code: an agentic coding assistant for the terminal."""
2
2
 
3
- __version__ = "1.5.7"
3
+ __version__ = "1.6.1"
@@ -59,8 +59,15 @@ SUBAGENT_STEPS = {"read": 15, "write": 30}
59
59
  #: tools whose success means the next step is mechanical (continue the plan): no thinking needed for it
60
60
  MECHANICAL_TOOLS = {"todo_write", "write_file", "edit_file", "multi_edit", "add_third_party_notice", "move_file",
61
61
  "delete_file", "stop_process", "start_background_process", "oss_adopt"}
62
- DEFAULT_TIME_BUDGET_MIN = 40 # soft wall-clock budget per request: then the agent wraps up
63
- DEFAULT_TASK_STEPS = 120 # ... or after this many steps on one request
62
+ DEFAULT_TIME_BUDGET_MIN = 30 # soft budget per request (active time, not waiting for you): then it wraps up
63
+ DEFAULT_TASK_STEPS = 60 # ... or after this many steps on one request
64
+ #: budget per request by its size (1.6.0). Prod 5-12 Nov: a learner's "how do I run the backend?" ran 65 steps and
65
+ #: 90 minutes and changed files; 22% of 1.5.7 tasks ended on the 40 min / 120 step wrap-up. A question is answered,
66
+ #: a small change is a small budget, only a big job gets the full one. Explicit settings still win.
67
+ TIER_BUDGETS = {"question": (12, 6), "small": (30, 15), "large": (DEFAULT_TASK_STEPS, DEFAULT_TIME_BUDGET_MIN)}
68
+ SMALL_REQUEST_CHARS = 400
69
+ MAX_STEP_ROLLBACKS = 2 # a step whose edits failed in part is undone at most this often per request
70
+ EDIT_TOOLS = ("edit_file", "multi_edit", "write_file", "delete_file", "move_file")
64
71
  SAME_ERROR_NOTE_AT = 3 # the same error text (any tool, any arguments) this many times: re-plan
65
72
  EDIT_THRASH_AT = 6 # the same file edited this many times in one request while checks keep failing
66
73
  SMALL_WINDOW = 40000 # a context this small gets the lean system prompt and tool schemas
@@ -103,6 +110,49 @@ SIMPLE_FOLLOWUP = re.compile(
103
110
  PLAN_BLOCKED = ("Edit", "Bash", "DbWrite") # permission categories plan mode never runs
104
111
 
105
112
 
113
+ _QUESTION_RE = re.compile(
114
+ r"^\s*(how|what|why|which|where|when|who|whose|is|are|was|were|does|do|did|can i|could i|should i|"
115
+ r"explain|tell me|show me how|kya|kaise|kaisa|kyu|kyun|kyon|kaun|kab|kahan|kitna)\b", re.I)
116
+ _CHANGE_RE = re.compile(
117
+ r"\b(fix|add|make|create|build|change|update|implement|write|remove|delete|refactor|rename|convert|migrate|"
118
+ r"replace|install|setup|set up|generate|improve|optimi[sz]e|redesign|polish|bana|banao|bna|bnao|banado|bnado|"
119
+ r"kar ?do|kr ?do|kro|karo|hatao|badlo|sudhar|sudharo|thik|theek|lagao|daalo|dalo|do it|go ahead|apply)\b", re.I)
120
+ _BIG_RE = re.compile(
121
+ r"\b(all|every|entire|whole|complete|full|end[- ]to[- ]end|pura|poora|pure|sab|sabhi|saare|sare|from scratch|"
122
+ r"redesign|overhaul|audit|module|modules|project|application|website|everything|25|dont stop|don't stop)\b", re.I)
123
+
124
+
125
+ def request_tier(text: str) -> str:
126
+ """"question", "small" or "large": how much budget a request gets, and whether it may change files."""
127
+ typed = re.sub(r"<attached-file\b[^>]*>.*?</attached-file>", " ", text or "", flags=re.S)
128
+ typed = re.sub(r"\[attached file[^\]]*\]", " ", typed).strip()
129
+ has_attachment = typed != (text or "").strip()
130
+ if not typed:
131
+ return "small"
132
+ if (_QUESTION_RE.match(typed) or typed.rstrip().endswith("?")) and not _CHANGE_RE.search(typed):
133
+ return "question"
134
+ if len(typed) <= SMALL_REQUEST_CHARS and not has_attachment and not _BIG_RE.search(typed) \
135
+ and typed.count("\n") < 6:
136
+ return "small"
137
+ return "large"
138
+
139
+
140
+ class _WaitClock:
141
+ """Seconds spent waiting for the person (permission questions, "continue?"): not part of a request's time
142
+ budget (1.6.0: a 3-step answer was stopped "at its budget" because its approval waited 100 minutes)."""
143
+
144
+ def __init__(self) -> None:
145
+ self.total = 0.0
146
+ self._lock = threading.Lock()
147
+
148
+ def add(self, seconds: float) -> None:
149
+ with self._lock:
150
+ self.total += max(0.0, seconds)
151
+
152
+
153
+ WAIT_CLOCK = _WaitClock()
154
+
155
+
106
156
  def hook_block(event: str, text: str) -> str:
107
157
  return f'<hook-output event="{event}">\n{text.strip()}\n</hook-output>'
108
158
 
@@ -260,6 +310,11 @@ class Agent:
260
310
  self.guard = progress.ProgressGuard() # loops, stalls, edit-revert cycles (1.3.0)
261
311
  self._stuck = "" # why the guard stopped this request
262
312
  self._done_nudges = 0
313
+ self._tier: Optional[str] = None # "question" / "small" / "large": the request's budget (1.6.0)
314
+ self._question_blocked = False
315
+ self._rollbacks = 0
316
+ self._step_journal: Optional[Dict[str, Optional[bytes]]] = None
317
+ self._shell_snap = None
263
318
  self._last_check: Optional[Tuple[str, int, str]] = None # (command, exit code, error tail)
264
319
  self._adopt_fails = 0
265
320
  self._rolled_back: List[str] = [] # repos whose adopted code was removed this request
@@ -468,6 +523,14 @@ class Agent:
468
523
  def _run_top_turn(self, user_text: str, max_turns: Optional[int]) -> TurnResult:
469
524
  self.client.task_id = api.new_task_id() # X-Euron-Task: one per user prompt
470
525
  self.ledger = {"edits": [], "commands": [], "reused": [], "read": [], "adopted": []}
526
+ tier = request_tier(user_text)
527
+ if SIMPLE_FOLLOWUP.match(user_text.strip()) and getattr(self, "_tier", None):
528
+ tier = self._tier if self._tier != "question" else "small" # "continue" carries on the same job
529
+ self._tier = tier
530
+ self._question_blocked = False
531
+ self._rollbacks = 0
532
+ self.ctx._rewrite_warned = set()
533
+ self._shell_snap = None
471
534
  self._reuse_chars = {}
472
535
  self._read_bodies = {}
473
536
  self._references = []
@@ -595,6 +658,7 @@ class Agent:
595
658
  todos_at_start = list(self.ctx.todos)
596
659
  self._last_step_tools = []
597
660
  started_at = time.monotonic()
661
+ self._waited_at_start = WAIT_CLOCK.total
598
662
  wrapped = False
599
663
  while True:
600
664
  if max_turns and turns >= max_turns:
@@ -605,7 +669,12 @@ class Agent:
605
669
  return self._wrap_up(turns, last_text)
606
670
  if not max_turns and not self.is_subagent and turns >= budget:
607
671
  ask = self.on_step_limit
608
- if ask is None or not ask(turns):
672
+ t0 = time.monotonic()
673
+ try:
674
+ more = ask is not None and ask(turns)
675
+ finally:
676
+ WAIT_CLOCK.add(time.monotonic() - t0)
677
+ if not more:
609
678
  self.ui.warn(f"Stopped after {turns} steps on this request (the step budget). Say what to do "
610
679
  "next, or raise maxStepsPerPrompt.")
611
680
  return TurnResult(last_text, "max_turns", turns)
@@ -664,8 +733,19 @@ class Agent:
664
733
  empty_retry = True
665
734
  self._append({"role": "assistant", "content": "(empty reply)"})
666
735
  self._append({"role": "user", "content": prompts.EMPTY_NUDGE})
667
- self.ui.dim("(the answer came back empty; asking again)")
736
+ # answer in words this time: no tools, little reasoning (1.6.0: some retries came back empty too)
737
+ self._effort_once = "low"
738
+ if self.ledger.get("edits") or self.ledger.get("commands"):
739
+ self._tool_choice_once = "none" if self.uses_euron else None
740
+ self.ui.dim("(the answer came back empty; asking for the summary)")
668
741
  continue
742
+ if (not resp.tool_calls and not (partial + resp.content).strip() and empty_retry
743
+ and not self.is_subagent):
744
+ text = self.local_summary()
745
+ self.ui.plain(text)
746
+ self._append({"role": "assistant", "content": text})
747
+ self._footer()
748
+ return TurnResult(text, "end_turn", turns)
669
749
  msg: Dict[str, Any] = {"role": "assistant", "content": resp.content}
670
750
  if resp.tool_calls:
671
751
  msg["tool_calls"] = resp.tool_calls
@@ -752,24 +832,40 @@ class Agent:
752
832
  return TurnResult(last_text, "interrupted", turns)
753
833
 
754
834
  # ---------------------------------------------------------- finish in time
755
- def _over_budget(self, turns: int, started_at: float) -> bool:
835
+ def budget(self) -> Tuple[int, float]:
836
+ """(steps, minutes) for this request: its tier's budget, unless the settings name one (0 = none)."""
837
+ tier_steps, tier_min = TIER_BUDGETS.get(getattr(self, "_tier", None) or "large", TIER_BUDGETS["large"])
756
838
  try:
757
- minutes = float(self.settings.get("taskTimeBudgetMinutes", DEFAULT_TIME_BUDGET_MIN) or 0)
839
+ raw = self.settings.get("taskTimeBudgetMinutes")
840
+ minutes = float(tier_min) if raw is None else float(raw or 0)
758
841
  except (TypeError, ValueError):
759
- minutes = DEFAULT_TIME_BUDGET_MIN
842
+ minutes = float(tier_min)
760
843
  try:
761
- steps = int(self.settings.get("taskStepBudget", DEFAULT_TASK_STEPS) or 0)
844
+ raw = self.settings.get("taskStepBudget")
845
+ steps = tier_steps if raw is None else int(raw or 0)
762
846
  except (TypeError, ValueError):
763
- steps = DEFAULT_TASK_STEPS
764
- if minutes > 0 and time.monotonic() - started_at > minutes * 60:
847
+ steps = tier_steps
848
+ return steps, minutes
849
+
850
+ def active_seconds(self, started_at: float) -> float:
851
+ """Time this request has been working, without the time it waited for the person."""
852
+ waited = WAIT_CLOCK.total - getattr(self, "_waited_at_start", WAIT_CLOCK.total)
853
+ return max(0.0, time.monotonic() - started_at - waited)
854
+
855
+ def _over_budget(self, turns: int, started_at: float) -> bool:
856
+ steps, minutes = self.budget()
857
+ self._budget_used = (turns, self.active_seconds(started_at))
858
+ if minutes > 0 and self._budget_used[1] > minutes * 60:
765
859
  return True
766
860
  return bool(steps > 0 and turns >= steps)
767
861
 
768
862
  def _wrap_up(self, turns: int, last_text: str, nudge: Optional[str] = None, reason: str = "budget") -> TurnResult:
769
863
  """Ask once, without tools, for: what is done, what is left, the next step. Then stop cleanly."""
770
864
  if nudge is None:
771
- self.ui.warn("This request reached its time / step budget (taskTimeBudgetMinutes, taskStepBudget); "
772
- "asking Euron Code to wrap up. Say \"continue\" to keep going.")
865
+ steps, minutes = self.budget()
866
+ self.ui.warn(f"This request used its budget ({steps} steps / {int(minutes)} min for a "
867
+ f"{getattr(self, '_tier', 'large')} request); asking Euron Code for what is done and what "
868
+ "is left. Say \"continue\" to keep going.")
773
869
  self._append({"role": "user", "content": (nudge or prompts.WRAP_UP_NUDGE) + self._migration_left()})
774
870
  self._effort_once = "low"
775
871
  saved = self.tool_schemas
@@ -792,10 +888,63 @@ class Agent:
792
888
  self._tool_choice_once = None
793
889
  if resp.tool_calls: # a wrap-up answers in words; a tool call here is not run
794
890
  resp.content = resp.content or "(no summary)"
795
- self._append({"role": "assistant", "content": resp.content or "(no summary)"})
891
+ text = (resp.content or "").strip() or self.local_summary(stopped=True)
892
+ if not (resp.content or "").strip():
893
+ self.ui.plain(text)
894
+ self._append({"role": "assistant", "content": text})
796
895
  if not self.is_subagent:
896
+ self._progress_list()
797
897
  self._footer()
798
- return TurnResult(resp.content or last_text, reason, turns + 1)
898
+ return TurnResult(text, reason, turns + 1)
899
+
900
+ def _progress_list(self) -> None:
901
+ """Shown to the person when a request stops before it is done: the plain list of what changed, what
902
+ was checked and what is still open (1.6.0: after a budget stop people had no clear done / left list)."""
903
+ changed = self.files_changed()
904
+ cmds = [(c, code) for _, c, code in self.ledger.get("commands") or []]
905
+ open_todos = [t for t in self.ctx.todos if isinstance(t, dict) and t.get("status") in ("pending", "in_progress")]
906
+ done_todos = [t for t in self.ctx.todos if isinstance(t, dict) and t.get("status") == "completed"]
907
+ lines = ["Progress on this request:"]
908
+ lines.append(f" done: {len(changed)} file(s) changed" + (f" ({', '.join(changed[:6])}"
909
+ f"{' ...' if len(changed) > 6 else ''})" if changed else ""))
910
+ for t in done_todos[:6]:
911
+ lines.append(f" [x] {str(t.get('content'))[:90]}")
912
+ if cmds:
913
+ c, code = cmds[-1]
914
+ lines.append(f" check: `{c[:70]}` " + ("passed" if code == 0 else f"failed (exit {code})"))
915
+ else:
916
+ lines.append(" check: nothing was run to check the change")
917
+ for t in open_todos[:8]:
918
+ lines.append(f" left: [ ] {str(t.get('content'))[:90]}")
919
+ lines.append(" Type `continue` to go on, or /rewind to undo this request's file changes.")
920
+ for ln in lines:
921
+ self.ui.dim(ln)
922
+
923
+ def local_summary(self, stopped: bool = False) -> str:
924
+ """A short summary written by Euron Code itself from what really happened, for when the model's answer
925
+ came back empty (prod: "Your last reply was empty" nudges; the person got no answer at all)."""
926
+ changed = self.files_changed()
927
+ cmds = [(c, code) for _, c, code in self.ledger.get("commands") or []]
928
+ if not changed and not cmds and not stopped:
929
+ return ("(Euron Code: the model sent no answer, twice. Nothing was changed. Send your message again, "
930
+ "or say it in other words.)")
931
+ parts = []
932
+ if changed:
933
+ parts.append(f"Changed {len(changed)} file(s): {', '.join(changed[:10])}{' ...' if len(changed) > 10 else ''}.")
934
+ else:
935
+ parts.append("No files were changed.")
936
+ if cmds:
937
+ c, code = cmds[-1]
938
+ parts.append(f"Last check: `{c[:80]}` " + ("passed." if code == 0 else f"failed (exit {code})."))
939
+ elif changed:
940
+ parts.append("Nothing was run to check the change yet.")
941
+ open_todos = [str(t.get("content"))[:80] for t in self.ctx.todos
942
+ if isinstance(t, dict) and t.get("status") in ("pending", "in_progress")]
943
+ if open_todos:
944
+ parts.append("Still open: " + "; ".join(open_todos[:5]) + ".")
945
+ if stopped:
946
+ parts.append("Say \"continue\" to carry on.")
947
+ return "(Euron Code summary: the model sent no text.) " + " ".join(parts)
799
948
 
800
949
  # ---------------------------------------------------------- model request
801
950
  # ---------------------------------------------------------- budget
@@ -1245,6 +1394,71 @@ class Agent:
1245
1394
 
1246
1395
  # ---------------------------------------------------------- tools
1247
1396
  def _run_tools(self, tool_calls: List[Dict[str, Any]], truncated: bool = False) -> Optional[str]:
1397
+ """Run one step's tool calls. Edits in one step are all-or-nothing (1.6.0): when one of several edits
1398
+ fails, the others of that step are undone, so no file (or pair of files) is left half-changed."""
1399
+ edits = [tc for tc in tool_calls if (tc.get("function") or {}).get("name") in EDIT_TOOLS]
1400
+ self._step_journal = {} if len(edits) >= 2 else None
1401
+ self._step_failed_ids = set()
1402
+ out: List[Dict[str, Any]] = []
1403
+ real_append = self._append
1404
+ self._append = out.append # type: ignore[assignment] # this step's tool messages, sent below
1405
+ try:
1406
+ stop = self._run_tools_inner(tool_calls, truncated)
1407
+ finally:
1408
+ self._append = real_append # type: ignore[assignment]
1409
+ journal, self._step_journal = self._step_journal, None
1410
+ if journal:
1411
+ self._settle_step(out, journal)
1412
+ for m in out:
1413
+ self._append(m)
1414
+ return stop
1415
+
1416
+ def _mark_step_failure(self) -> None:
1417
+ """An edit tool itself failed (not a refusal before it ran: outside a sub-agent's paths, plan mode, a
1418
+ deny rule, a question): the step's other edits are undone."""
1419
+ if getattr(self, "_step_journal", None) is not None:
1420
+ self._step_failed_ids.add(self.ctx.call_id)
1421
+
1422
+ def _settle_step(self, msgs: List[Dict[str, Any]], journal: Dict[str, Optional[bytes]]) -> None:
1423
+ tool_msgs = [m for m in msgs if m.get("role") == "tool" and m.get("name") in EDIT_TOOLS]
1424
+ failed = [m for m in tool_msgs if m.get("tool_call_id") in self._step_failed_ids]
1425
+ ok = [m for m in tool_msgs if m not in failed and not str(m.get("content") or "").startswith(("Skipped", "Error"))]
1426
+ if not failed or not ok:
1427
+ return
1428
+ if self._rollbacks >= MAX_STEP_ROLLBACKS:
1429
+ for m in failed:
1430
+ m["content"] += (f"\n[Euron Code: the other {len(ok)} edit(s) of this step WERE applied; only this "
1431
+ "one is missing. Re-read the files involved before the next change.]")
1432
+ return
1433
+ self._rollbacks += 1
1434
+ undone = []
1435
+ for key, data in journal.items():
1436
+ p = Path(key)
1437
+ try:
1438
+ now = p.read_bytes() if p.is_file() else None
1439
+ if now == data:
1440
+ continue
1441
+ if data is None:
1442
+ if p.is_file():
1443
+ p.unlink()
1444
+ else:
1445
+ p.parent.mkdir(parents=True, exist_ok=True)
1446
+ p.write_bytes(data)
1447
+ undone.append(self.ctx.rel(p))
1448
+ except OSError:
1449
+ continue
1450
+ first = str(failed[0].get("content") or "").splitlines()[0][:160]
1451
+ for m in ok:
1452
+ m["content"] = ("Undone: this change was rolled back because another edit in the same step failed "
1453
+ f"({first}). A step's edits are applied together or not at all, so no file is left "
1454
+ "half-changed. Send it again together with the fixed call.")
1455
+ failed[-1]["content"] += (f"\n[Euron Code: the {len(ok)} other edit(s) of this step were undone too (files "
1456
+ f"back as before: {', '.join(undone[:6]) or 'none changed'}). Fix this call and send "
1457
+ "all of the step's edits again, in one step.]")
1458
+ if undone:
1459
+ self.ui.dim(f"(undid this step's other {len(ok)} edit(s): one failed, so the files stay consistent)")
1460
+
1461
+ def _run_tools_inner(self, tool_calls: List[Dict[str, Any]], truncated: bool = False) -> Optional[str]:
1248
1462
  stop: Optional[str] = None
1249
1463
  self._last_step_tools = []
1250
1464
  task_ids = [tc["id"] for tc in tool_calls if (tc.get("function") or {}).get("name") == "task"]
@@ -2279,6 +2493,14 @@ class Agent:
2279
2493
  why = r.stderr.strip() or "no reason given"
2280
2494
  self.ui.tool_result(f"blocked by a PreToolUse hook: {why}", is_error=True)
2281
2495
  return f"Error: a PreToolUse hook blocked this call: {why}", None
2496
+ if (req.category == "Edit" and getattr(self, "_tier", None) == "question" and not self.is_subagent
2497
+ and not self._question_blocked and self.permissions.mode != "plan"):
2498
+ # a question is answered, not acted on (prod: "how do I run the backend?" edited config files)
2499
+ self._question_blocked = True
2500
+ msg = ("The user asked a question, so no file was changed. Answer it first. If a change would help, "
2501
+ "say in one line what you would change and why; the user will ask for it.")
2502
+ self.ui.tool_result("not applied: the request is a question", is_error=True)
2503
+ return "Error: " + msg, None
2282
2504
  decision = self.permissions.check(req)
2283
2505
  if decision == "deny":
2284
2506
  msg = "Permission denied by a deny rule in settings. Do not retry this action."
@@ -2301,7 +2523,15 @@ class Agent:
2301
2523
  if req.category == "Edit":
2302
2524
  for p in req.paths:
2303
2525
  self.checkpoints.capture(p)
2526
+ journal = getattr(self, "_step_journal", None)
2527
+ if journal is not None:
2528
+ try:
2529
+ journal.setdefault(str(p.resolve()), p.read_bytes() if p.is_file() else None)
2530
+ except OSError:
2531
+ pass
2304
2532
  stash = self._migration_stash(req) if name != "port_page" else []
2533
+ if name == "bash":
2534
+ self._shell_before()
2305
2535
  from euron_code.permissions import is_instruction_path
2306
2536
  if req.category == "Edit" and any(is_instruction_path(p, self.root) for p in req.paths):
2307
2537
  from euron_code import trust
@@ -2311,6 +2541,7 @@ class Agent:
2311
2541
  result = tool.run(args, self.ctx)
2312
2542
  except ToolError as e:
2313
2543
  result = ToolResult(str(e), is_error=True)
2544
+ self._mark_step_failure()
2314
2545
  from euron_code import errorlog
2315
2546
  errorlog.report("tool", "tool_error", str(e), tool=name)
2316
2547
  except KeyboardInterrupt:
@@ -2319,6 +2550,7 @@ class Agent:
2319
2550
  UnicodeError, OSError) as e:
2320
2551
  # the file system or a bad value said no: a clear tool error for the model, never a crash
2321
2552
  result = ToolResult(_friendly_os_error(name, e), is_error=True)
2553
+ self._mark_step_failure()
2322
2554
  from euron_code import errorlog
2323
2555
  errorlog.report("tool", type(e).__name__, str(e), tool=name)
2324
2556
  except Exception as e: # a tool bug must not kill the session
@@ -2334,6 +2566,8 @@ class Agent:
2334
2566
  content = result.content
2335
2567
  if result.is_error and not content.startswith(("Error", "Exit code")):
2336
2568
  content = "Error: " + content
2569
+ if name == "bash":
2570
+ self._shell_after()
2337
2571
  self._record(name, req, content, result.is_error)
2338
2572
  if not self.is_subagent:
2339
2573
  content = self._progress(name, req, args, content, result.is_error)
@@ -2426,7 +2660,11 @@ class Agent:
2426
2660
  options.append(("a", f"always allow {req.category} (session)"))
2427
2661
  if req.category not in ("DbWrite",):
2428
2662
  options.append(("s", "always, and remember for this project"))
2429
- choice = self.ui.ask_permission(title, detail, options)
2663
+ t0 = time.monotonic()
2664
+ try:
2665
+ choice = self.ui.ask_permission(title, detail, options)
2666
+ finally:
2667
+ WAIT_CLOCK.add(time.monotonic() - t0)
2430
2668
  if choice == "y":
2431
2669
  return "allow", None
2432
2670
  if choice in ("a", "p", "s"):
@@ -2439,7 +2677,11 @@ class Agent:
2439
2677
  return "allow", None
2440
2678
  feedback = ""
2441
2679
  if getattr(self.ui, "interactive", False):
2442
- feedback = self.ui.ask_text(" Tell Euron Code what to do instead (Enter to stop): ").strip()
2680
+ t0 = time.monotonic()
2681
+ try:
2682
+ feedback = self.ui.ask_text(" Tell Euron Code what to do instead (Enter to stop): ").strip()
2683
+ finally:
2684
+ WAIT_CLOCK.add(time.monotonic() - t0)
2443
2685
  return "deny", feedback or None
2444
2686
 
2445
2687
  # ---------------------------------------------------------- compaction
@@ -2639,6 +2881,13 @@ class Agent:
2639
2881
  head += "\n\nLast error seen:\n" + err
2640
2882
  if self.ctx.todos:
2641
2883
  head += "\n\nCurrent todo list:\n" + render_todos(self.ctx.todos)
2884
+ seen = self._seen_paths()
2885
+ if seen:
2886
+ # prod 7 Nov: after 4 summaries in 15 minutes the agent guessed paths (bms/api/src/bms/sms/router.py)
2887
+ head += ("\n\nFiles read or written in this session (exact paths; do not guess others, glob first): "
2888
+ + ", ".join(seen))
2889
+ head += ("\n\nAfter this summary the files' contents are no longer in your context: read a file again "
2890
+ "before you change it.")
2642
2891
  last_user = next((m for m in reversed(old) if m.get("role") == "user"), None)
2643
2892
  if recent[0].get("role") == "user":
2644
2893
  first = dict(recent[0])
@@ -2658,7 +2907,7 @@ class Agent:
2658
2907
  head += "\n\n[The user's current request, verbatim]\n" + req
2659
2908
  head += "\n\nContinue the task from where the work below left off."
2660
2909
  self.messages = [self.messages[0], {"role": "user", "content": head}] + recent
2661
- self.ctx.tracker.clear()
2910
+ self.ctx.tracker.clear(stale=True) # every file must be seen again before it is changed (1.6.0)
2662
2911
  self.rules.reset()
2663
2912
  self.checkpoints.forget_positions() # message indices are stale after a summary
2664
2913
  self._persist_compaction()
@@ -2677,6 +2926,16 @@ class Agent:
2677
2926
  self.ui.dim(f"Compacted: {before} -> {after} tokens (estimated).")
2678
2927
  return True
2679
2928
 
2929
+ def _seen_paths(self, limit: int = 40) -> List[str]:
2930
+ out: List[str] = []
2931
+ for key in reversed(self.ctx.tracker.known_paths()):
2932
+ rel = self.ctx.rel(Path(key))
2933
+ if rel not in out and not rel.startswith(".."):
2934
+ out.append(rel)
2935
+ if len(out) >= limit:
2936
+ break
2937
+ return out
2938
+
2680
2939
  def _cached_summary_payload(self, sent: List[Dict[str, Any]], cut: int, cap: int,
2681
2940
  instructions: Optional[str]) -> Optional[Dict[str, Any]]:
2682
2941
  """The summary asked at the end of the conversation the model last saw, with the same tools: the
@@ -2771,6 +3030,25 @@ class Agent:
2771
3030
  self._persist_compaction()
2772
3031
  return snap, restored, skipped
2773
3032
 
3033
+ def _shell_before(self) -> None:
3034
+ """Before the request's first command: remember the project's files, so /rewind can also undo what
3035
+ commands changed (a script, `sed -i`, a formatter), not only the file tools' edits (1.6.0)."""
3036
+ if self.is_subagent and self.subagent_mode != "write":
3037
+ return
3038
+ if getattr(self, "_shell_snap", None) is None:
3039
+ from euron_code.checkpoints import ProjectSnapshot
3040
+ self._shell_snap = ProjectSnapshot.take(self.root)
3041
+
3042
+ def _shell_after(self) -> None:
3043
+ snap = getattr(self, "_shell_snap", None)
3044
+ if not snap:
3045
+ return
3046
+ try:
3047
+ for key, before in snap.changes(self.root):
3048
+ self.checkpoints.capture_bytes(key, before)
3049
+ except Exception:
3050
+ pass
3051
+
2774
3052
  def run_shell(self, command: str):
2775
3053
  """`!command` typed by the user: run it directly (no permission prompt; the user typed it)
2776
3054
  and queue the output as context for the next prompt. Returns (exit code, output)."""