euron-code 1.8.7__tar.gz → 1.8.9__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 (172) hide show
  1. {euron_code-1.8.7 → euron_code-1.8.9}/CHANGELOG.md +29 -0
  2. {euron_code-1.8.7 → euron_code-1.8.9}/PKG-INFO +1 -1
  3. {euron_code-1.8.7 → euron_code-1.8.9}/pyproject.toml +1 -1
  4. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/__init__.py +1 -1
  5. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/llm/base.py +2 -1
  6. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/repl.py +155 -0
  7. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/fs.py +78 -3
  8. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/ignore.py +75 -75
  9. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_permissions.py +91 -91
  10. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_tools_fs.py +9 -6
  11. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v160_stop_scope_atomic.py +15 -4
  12. euron_code-1.8.9/tests/test_v188_typed_cli_commands.py +167 -0
  13. euron_code-1.8.9/tests/test_v189_edit_partial.py +138 -0
  14. {euron_code-1.8.7 → euron_code-1.8.9}/.gitignore +0 -0
  15. {euron_code-1.8.7 → euron_code-1.8.9}/LICENSE +0 -0
  16. {euron_code-1.8.7 → euron_code-1.8.9}/README.md +0 -0
  17. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/__main__.py +0 -0
  18. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/activity.py +0 -0
  19. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/agent.py +0 -0
  20. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/api.py +0 -0
  21. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/attachments.py +0 -0
  22. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/auth.py +0 -0
  23. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/autoupdate.py +0 -0
  24. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
  25. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
  26. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
  27. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
  28. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/cache.py +0 -0
  29. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/checkpoints.py +0 -0
  30. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/cli.py +0 -0
  31. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/codeindex.py +0 -0
  32. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/config.py +0 -0
  33. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/context.py +0 -0
  34. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/contextforge/LICENSE +0 -0
  35. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/contextforge/__init__.py +0 -0
  36. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/contextforge/text.py +0 -0
  37. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/contextforge/toolout.py +0 -0
  38. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/credentials.py +0 -0
  39. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/ctxstats.py +0 -0
  40. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/doctor.py +0 -0
  41. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/documents.py +0 -0
  42. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/dotnet.py +0 -0
  43. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/error_hints.py +0 -0
  44. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/errorlog.py +0 -0
  45. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/failures.py +0 -0
  46. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/friendly.py +0 -0
  47. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/frontmatter.py +0 -0
  48. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/hooks.py +0 -0
  49. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/keys.py +0 -0
  50. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/knowledge.py +0 -0
  51. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/licensing.py +0 -0
  52. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/llm/__init__.py +0 -0
  53. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/llm/anthropic.py +0 -0
  54. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/llm/openai_compat.py +0 -0
  55. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/llm/setup.py +0 -0
  56. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/logo.py +0 -0
  57. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/markdown_view.py +0 -0
  58. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/memory.py +0 -0
  59. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/migration.py +0 -0
  60. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/modes.py +0 -0
  61. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/mvc5.py +0 -0
  62. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/osscache.py +0 -0
  63. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/ossgithub.py +0 -0
  64. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/pasteinput.py +0 -0
  65. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/pathfix.py +0 -0
  66. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/permissions.py +0 -0
  67. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/progress.py +0 -0
  68. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/project_setup.py +0 -0
  69. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/prompts.py +0 -0
  70. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/repomap.py +0 -0
  71. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/rules.py +0 -0
  72. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/security_scan.py +0 -0
  73. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/sessions.py +0 -0
  74. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/skills.py +0 -0
  75. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/taskstate.py +0 -0
  76. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/textsafe.py +0 -0
  77. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tls.py +0 -0
  78. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/__init__.py +0 -0
  79. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/background.py +0 -0
  80. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/base.py +0 -0
  81. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/db.py +0 -0
  82. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/document.py +0 -0
  83. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/erie.py +0 -0
  84. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/normalize.py +0 -0
  85. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/oss.py +0 -0
  86. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/pathfind.py +0 -0
  87. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/port.py +0 -0
  88. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/reuse.py +0 -0
  89. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/search.py +0 -0
  90. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/shell.py +0 -0
  91. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/skill.py +0 -0
  92. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/symbols.py +0 -0
  93. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/task.py +0 -0
  94. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/todo.py +0 -0
  95. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/web.py +0 -0
  96. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/tools/websearch.py +0 -0
  97. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/transcript.py +0 -0
  98. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/trust.py +0 -0
  99. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/ui.py +0 -0
  100. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/update_check.py +0 -0
  101. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/usage_view.py +0 -0
  102. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/version_info.py +0 -0
  103. {euron_code-1.8.7 → euron_code-1.8.9}/src/euron_code/webforms.py +0 -0
  104. {euron_code-1.8.7 → euron_code-1.8.9}/tests/conftest.py +0 -0
  105. {euron_code-1.8.7 → euron_code-1.8.9}/tests/fake_providers.py +0 -0
  106. {euron_code-1.8.7 → euron_code-1.8.9}/tests/helpers.py +0 -0
  107. {euron_code-1.8.7 → euron_code-1.8.9}/tests/measure_floor.py +0 -0
  108. {euron_code-1.8.7 → euron_code-1.8.9}/tests/mock_gateway.py +0 -0
  109. {euron_code-1.8.7 → euron_code-1.8.9}/tests/serve_helper.py +0 -0
  110. {euron_code-1.8.7 → euron_code-1.8.9}/tests/sim_long_session.py +0 -0
  111. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_agent_mock.py +0 -0
  112. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_api_shell.py +0 -0
  113. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_bench.py +0 -0
  114. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_bench_harness.py +0 -0
  115. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_cli_e2e.py +0 -0
  116. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_context_memory_sessions.py +0 -0
  117. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_dashboard_fixes.py +0 -0
  118. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_dashboard_fixes_102.py +0 -0
  119. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_db.py +0 -0
  120. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_erie.py +0 -0
  121. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_knowledge_security.py +0 -0
  122. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_markdown_view.py +0 -0
  123. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_oss_local.py +0 -0
  124. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_powershell_exit_codes.py +0 -0
  125. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_qa_attach_secrets.py +0 -0
  126. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_qa_long_task.py +0 -0
  127. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_qa_print_output.py +0 -0
  128. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_qa_reuse_unrelated.py +0 -0
  129. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_qa_yolo_outside.py +0 -0
  130. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_render_ghost.py +0 -0
  131. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_repl.py +0 -0
  132. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_reuse_honesty.py +0 -0
  133. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_search.py +0 -0
  134. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_textsafe.py +0 -0
  135. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_transcript_ui.py +0 -0
  136. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_update_check.py +0 -0
  137. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v111_user_reports.py +0 -0
  138. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v113_fix_path.py +0 -0
  139. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v11_byo.py +0 -0
  140. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v11_speed.py +0 -0
  141. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v11_tool_fixes.py +0 -0
  142. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v130_cut_writes.py +0 -0
  143. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v130_reliability.py +0 -0
  144. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v140_parity.py +0 -0
  145. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v152_migration.py +0 -0
  146. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v153_user_errors.py +0 -0
  147. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v155_user_errors.py +0 -0
  148. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v156_autoupdate.py +0 -0
  149. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v156_paste_and_edits.py +0 -0
  150. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v157_zero_errors.py +0 -0
  151. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v15_hosted_models.py +0 -0
  152. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
  153. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v161_residual_errors.py +0 -0
  154. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v170_v2.py +0 -0
  155. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v180_rescue_research_permissions.py +0 -0
  156. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v181_silent_failures_verified.py +0 -0
  157. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v182_zero_errors.py +0 -0
  158. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v184_selfupdate_pep668.py +0 -0
  159. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v186_bypass_and_waits.py +0 -0
  160. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v187_sleep_wake.py +0 -0
  161. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v2_rules_skills_hooks.py +0 -0
  162. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v2_tokens_shortcuts.py +0 -0
  163. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v2_usage_headers.py +0 -0
  164. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v31_security.py +0 -0
  165. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v3_accounts_value_setup.py +0 -0
  166. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v3_activity.py +0 -0
  167. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v3_attachments.py +0 -0
  168. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v3_context.py +0 -0
  169. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v3_live_repl.py +0 -0
  170. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v3_single_login.py +0 -0
  171. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v4.py +0 -0
  172. {euron_code-1.8.7 → euron_code-1.8.9}/tests/test_v5.py +0 -0
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.9 (2026-11-20)
4
+
5
+ - **One wrong edit no longer throws away the good ones.** When Euron Code changes several places in one file at once
6
+ and one of them does not match the file, the others are now applied and only the missing one is reported, with the
7
+ file's real text to copy. Before, nothing was applied and the whole batch had to be sent again (in the last days one
8
+ batch of 21 changes was lost to a single wrong line). If no change matches at all, the file stays as it was.
9
+ - **A change that is already in the file is not an error, and is never added twice.** A change sent again (after a
10
+ summary of a long conversation, or a step that was partly done) used to fail with "old_string was not found"; an
11
+ added line sent again could appear twice. Both are now recognised and skipped, also in files with Windows line ends.
12
+ - On a benchmark built from the shapes of these failures (no user code), the same edits needed about 10% fewer steps
13
+ and over a third less text sent, and a model that re-sends only the change it fixed now ends with the right file
14
+ every time (before: about 1 in 4).
15
+
16
+ ## 1.8.8 (2026-11-20)
17
+
18
+ - **Typing a terminal command at the Euron Code prompt now does what you meant.** Many people typed
19
+ `euron --dangerously-skip-permissions` (or `--dangerously-skip-permissions`, `py -3 -m euron_code ...`) inside a
20
+ running session. It used to go to the model as a request, so bypass never turned on and the next edit still asked.
21
+ Now it turns bypass permissions mode on for the session (sub-agents too, the same as starting with the flag; turn it
22
+ off with `/permissions mode default`). Anything typed after the options is sent as your request, so
23
+ `euron --dangerously-skip-permissions fix the failing test` works in one line. `--permission-mode`, `--no-budget`,
24
+ `-c` / `--continue`, `--mode` and `--model` work the same way.
25
+ - `euron login`, `euron --version`, `euron usage`, `euron doctor`, `euron models ...` and `euron config ...` typed at the
26
+ prompt run the matching /command instead of being sent to the model, and `pip install -U euron-code` shows your
27
+ version (Euron Code updates itself when it starts).
28
+ - Asking in words ("don't ask me for permission") shows how to turn the questions off, and the request still runs.
29
+ - When your own model's provider rejects the key, the message also says `/model euron` takes you back to the Euron
30
+ model.
31
+
3
32
  ## 1.8.7 (2026-11-19)
4
33
 
5
34
  - **A laptop that slept with a request open no longer ends the turn.** After waking, the first network error used
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: euron-code
3
- Version: 1.8.7
3
+ Version: 1.8.9
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>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "euron-code"
7
- version = "1.8.7"
7
+ version = "1.8.9"
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.8.7"
3
+ __version__ = "1.8.9"
@@ -89,7 +89,8 @@ def _provider_error(label: str, status: int, body: Any, retry_after: Optional[fl
89
89
  return e
90
90
  if status in (401, 403) or "invalid_api_key" in low or "authentication" in low:
91
91
  e = ProviderError(f"{label} rejected the API key (HTTP {status}): {msg}. Set the key again with /model add"
92
- + (f" or {key_hint}" if key_hint else "") + ".", **kw)
92
+ + (f" or {key_hint}" if key_hint else "") + ", or `/model euron` to go back to the Euron model "
93
+ "(included with your plan).", **kw)
93
94
  e.code = "provider_auth"
94
95
  return e
95
96
  if status == 429 and not re.search(r"\b(credit|quota|balance)\b", msg, re.I):
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import os
6
6
  import queue
7
+ import re
7
8
  import shutil
8
9
  import subprocess
9
10
  import sys
@@ -103,6 +104,95 @@ SHORTCUTS = [
103
104
  ]
104
105
 
105
106
 
107
+ #: 1.8.8. Prod 6-20 Nov: 21+ people typed a terminal command into the Euron Code prompt (mostly
108
+ #: "euron --dangerously-skip-permissions", also "euron login", "euron --version", "pip install -U euron-code"). It went
109
+ #: to the model as a request, so bypass never turned on and the model guessed at what to do (one ran a 46-step job).
110
+ #: These are handled here instead, without a model call.
111
+ _CLI_PREFIX = re.compile(r"^\s*(?:(?:euron(?:-code)?|euron_code)(?:\.exe)?|(?:py|python[0-9.]*)(?:\s+-3(?:\.\d+)?)?\s+-m\s+euron_code)"
112
+ r"(?=\s|$)\s*(?P<rest>.*)$", re.I | re.S)
113
+ _PIP_SELF = re.compile(r"^\s*(?:(?:py|python[0-9.]*)(?:\s+-3(?:\.\d+)?)?\s+-m\s+)?pip3?\s+install\b[^\n]*\beuron[-_]code\b", re.I)
114
+ _BYPASS_FLAGS = {"--dangerously-skip-permissions", "--yolo", "--bypass", "--dangerously-skip-permission",
115
+ "--dangerously-skip-permissons", "--skip-permissions"}
116
+ _CLI_SUBCOMMANDS = {"login": "/login", "logout": "/logout", "whoami": "/whoami", "usage": "/usage", "users": "/usage",
117
+ "doctor": "/doctor", "version": "/version", "init": "/init", "config": "/config",
118
+ "models": "/model", "update": "/version", "upgrade": "/version"}
119
+ _KNOWN_FLAGS = _BYPASS_FLAGS | {"--permission-mode", "--no-budget", "-c", "--continue", "-v", "--version",
120
+ "--mode", "--model", "--no-reuse", "-y", "--yes", "--verbose", "-r", "--resume"}
121
+ _ASK_NO_PERMISSION = re.compile(
122
+ r"(\b(don'?t|do not|dont|stop|never|without)\b[^.\n]{0,25}\b(ask|asking|take)\b[^.\n]{0,20}\bpermission"
123
+ r"|\bpermission\b[^.\n]{0,25}\b(lene ki (jarurat|jrurat|zarurat)|mat (lo|maango|mango)|nahi chahiye)"
124
+ r"|allow all commands to run without asking)", re.I)
125
+
126
+
127
+ def parse_typed_cli(text: str) -> Optional[Dict[str, Any]]:
128
+ """A terminal command typed into the prompt: {"slash": [...], "bypass", "permission_mode", "no_budget",
129
+ "cont", "ignored": [...], "rest": str, "bare": bool, "pip": bool}, or None when the text is a normal request."""
130
+ t = (text or "").strip()
131
+ if not t or "\n" in t:
132
+ return None
133
+ if _PIP_SELF.match(t):
134
+ return {"slash": ["/version"], "pip": True, "rest": "", "ignored": []}
135
+ m = _CLI_PREFIX.match(t)
136
+ if m:
137
+ rest, bare = m.group("rest").strip(), False
138
+ elif t.split()[0].lower() in _KNOWN_FLAGS and t.startswith("--"):
139
+ rest, bare = t, True
140
+ else:
141
+ return None
142
+ out: Dict[str, Any] = {"slash": [], "bypass": False, "permission_mode": None, "no_budget": False, "cont": False,
143
+ "ignored": [], "rest": "", "bare": bare, "pip": False}
144
+ words = rest.split()
145
+ if not words:
146
+ out["just_euron"] = True
147
+ return out
148
+ first = words[0].lower()
149
+ if first in _CLI_SUBCOMMANDS:
150
+ cmd = _CLI_SUBCOMMANDS[first]
151
+ args = words[1:]
152
+ if first == "models" and args:
153
+ action = args[0].lower()
154
+ if action == "add":
155
+ cmd = "/model add" + ("" if len(args) < 2 else " " + args[1])
156
+ elif action in ("remove", "rm"):
157
+ cmd = "/model remove" + ("" if len(args) < 2 else " " + args[1])
158
+ elif action == "use" and len(args) > 1:
159
+ cmd = "/model " + args[1]
160
+ elif first == "config" and args:
161
+ cmd = "/config " + " ".join(args)
162
+ out["slash"].append(cmd)
163
+ return out
164
+ if not first.startswith("-"):
165
+ return None # "euron please fix the login page": a request that starts with the product's name
166
+ i = 0
167
+ while i < len(words) and words[i].startswith("-"):
168
+ w = words[i]
169
+ flag, _, val = w.partition("=")
170
+ low = flag.lower()
171
+ nxt = words[i + 1] if i + 1 < len(words) else ""
172
+ if low in _BYPASS_FLAGS:
173
+ out["bypass"] = True
174
+ elif low == "--permission-mode":
175
+ if not val and nxt and not nxt.startswith("-"):
176
+ val, i = nxt, i + 1
177
+ out["permission_mode"] = val or None
178
+ elif low == "--no-budget":
179
+ out["no_budget"] = True
180
+ elif low in ("-c", "--continue"):
181
+ out["cont"] = True
182
+ elif low in ("-v", "--version"):
183
+ out["slash"].append("/version")
184
+ elif low in ("--mode", "--model"):
185
+ if not val and nxt and not nxt.startswith("-"):
186
+ val, i = nxt, i + 1
187
+ if val:
188
+ out["slash"].append(("/mode " if low == "--mode" else "/model ") + val)
189
+ else:
190
+ out["ignored"].append(flag)
191
+ i += 1
192
+ out["rest"] = " ".join(words[i:]).strip().strip("\"'").strip()
193
+ return out
194
+
195
+
106
196
  def path_candidates(root: Path, partial: str, limit: int = 60) -> List[str]:
107
197
  """Completions for `@partial`, relative to the project root (dirs end with /)."""
108
198
  partial = partial.replace("\\", "/")
@@ -648,11 +738,70 @@ class Repl:
648
738
  if text.startswith("#") and len(text) > 1:
649
739
  self.add_memory(text[1:].strip())
650
740
  return None
741
+ typed = parse_typed_cli(text)
742
+ if typed is not None:
743
+ rest = self._typed_cli(typed)
744
+ if rest is None:
745
+ return None
746
+ if isinstance(rest, int):
747
+ return rest
748
+ text = rest
749
+ elif _ASK_NO_PERMISSION.search(text) and self.agent.permissions.mode not in ("yolo", "plan"):
750
+ self.ui.dim("Tip: to stop the questions for this session, type --dangerously-skip-permissions here "
751
+ "(edits and commands then run without asking), or press Shift+Tab to auto-accept edits.")
651
752
  return self.turn(text)
652
753
  except KeyboardInterrupt:
653
754
  self.ui.warn("Interrupted.")
654
755
  return None
655
756
 
757
+ def _enable_bypass(self) -> None:
758
+ """--dangerously-skip-permissions typed at the prompt: the same as starting with it (the user typed it)."""
759
+ p = self.agent.permissions
760
+ p.bypass_session = True
761
+ p._before_plan = None
762
+ p.mode = "yolo"
763
+ self.bypass_allowed = True
764
+ self._status_cache = (0.0, "")
765
+ when = " (from the next tool call)" if self._running else ""
766
+ self.ui.error("Bypass permissions mode is on for this session" + when + ": edits and commands run WITHOUT "
767
+ "asking (sub-agents too). Paths outside the project still ask. Turn it off with "
768
+ "/permissions mode default.")
769
+
770
+ def _typed_cli(self, typed: Dict[str, Any]):
771
+ """Run a terminal command typed into the prompt. Returns the text still to send to the model, None when
772
+ nothing is left to send, or an exit code."""
773
+ if typed.get("pip"):
774
+ self.ui.info("Euron Code updates itself each time it starts, so there is no need to run pip here. "
775
+ "Your version:")
776
+ if typed.get("just_euron"):
777
+ self.ui.info("You are already in Euron Code: type what you want done. (Terminal commands such as "
778
+ "`euron login` work here too.)")
779
+ return None
780
+ if typed.get("bypass"):
781
+ self._enable_bypass()
782
+ mode = typed.get("permission_mode")
783
+ if mode:
784
+ from euron_code.permissions import MODE_ALIASES
785
+ if MODE_ALIASES.get(mode, mode) == "yolo":
786
+ self._enable_bypass()
787
+ else:
788
+ self._permissions("mode " + mode)
789
+ if typed.get("no_budget"):
790
+ self.agent.settings["taskTimeBudgetMinutes"] = 0
791
+ self.agent.settings["taskStepBudget"] = 0
792
+ self.ui.info("No time / step budget for this session (--no-budget).")
793
+ for cmd in typed.get("slash") or []:
794
+ res = self.execute(cmd)
795
+ if isinstance(res, int):
796
+ return res
797
+ if typed.get("ignored"):
798
+ self.ui.dim(f"{', '.join(typed['ignored'])}: only works when starting Euron Code from a terminal "
799
+ "(`euron <option>`), so it was ignored here.")
800
+ rest = str(typed.get("rest") or "").strip()
801
+ if typed.get("cont") and not rest:
802
+ rest = "continue"
803
+ return rest or None
804
+
656
805
  # ---------------------------------------------------------- live mode
657
806
  def _run_live(self, initial: Optional[str]) -> int:
658
807
  from prompt_toolkit.patch_stdout import patch_stdout
@@ -744,6 +893,12 @@ class Repl:
744
893
  text = text.strip()
745
894
  if not text:
746
895
  return
896
+ if self.busy:
897
+ typed = parse_typed_cli(text)
898
+ if typed and (typed.get("bypass") or typed.get("permission_mode")) and not typed.get("slash") \
899
+ and not typed.get("rest") and not typed.get("cont"):
900
+ self._typed_cli(typed) # applies from the running task's next tool call, no need to wait for it
901
+ return
747
902
  if self.busy and text.startswith("/"):
748
903
  cmd = text.split(maxsplit=1)[0].lower()
749
904
  if cmd in MIDRUN_COMMANDS:
@@ -515,6 +515,37 @@ def _project_hint(ctx: ToolContext, wanted: str) -> str:
515
515
  return ""
516
516
 
517
517
 
518
+
519
+ #: 1.8.9: new_string must have at least this many non-blank characters to count as "already in the file"
520
+ ALREADY_MIN_CHARS = 20
521
+
522
+
523
+ def _already_applied(text: str, old: str, new: str, count: int) -> str:
524
+ """The edit is already in the file (prod 17-20 Nov: edits retried after a partial step, a summary or a rewind
525
+ failed with "old_string was not found", or an insertion was applied twice). Returns the note, or "".
526
+ - old_string is gone and new_string is there (and new_string is not just a piece of old_string): nothing to do.
527
+ - an insertion (new_string contains old_string) where every occurrence of old_string already sits inside an
528
+ occurrence of new_string: applying it again would add a second copy."""
529
+ core = new.strip()
530
+ if len("".join(core.split())) < ALREADY_MIN_CHARS or not old.strip() or new == old:
531
+ return ""
532
+ if count == 0:
533
+ if new in text and old.strip() not in core:
534
+ return "no change needed: the file already has new_string (this edit was applied before)"
535
+ return ""
536
+ if old in new and new in text:
537
+ off = new.index(old)
538
+ free, at = 0, text.find(old)
539
+ while at >= 0:
540
+ start = at - off
541
+ if not (start >= 0 and text.startswith(new, start)):
542
+ free += 1
543
+ at = text.find(old, at + max(1, len(old)))
544
+ if free == 0:
545
+ return "no change needed: the file already has new_string (applying it again would add a second copy)"
546
+ return ""
547
+
548
+
518
549
  def apply_edit_ex(text: str, old: str, new: str, replace_all: bool = False) -> Tuple[str, int, str]:
519
550
  """apply_edit plus how the match was found ("" = exact)."""
520
551
  if old == "":
@@ -532,6 +563,11 @@ def apply_edit_ex(text: str, old: str, new: str, replace_all: bool = False) -> T
532
563
  if count == 0 and old_a != old:
533
564
  old_a, new_a = old, new
534
565
  count = text.count(old_a)
566
+ done = _already_applied(text, old_a, new_a, count)
567
+ if not done and crlf and count == 0 and "\r\n" not in new: # a CRLF file, LF edit text
568
+ done = _already_applied(text, _adapt_newlines(old, True), _adapt_newlines(new, True), 0)
569
+ if done:
570
+ return text, 0, done
535
571
  if count == 0:
536
572
  # 1. line numbers copied from read_file
537
573
  g_old = _strip_gutter(old)
@@ -1068,6 +1104,9 @@ class EditFile(Tool):
1068
1104
  text = tf.text
1069
1105
  total = 0
1070
1106
  self._notes = []
1107
+ self._skipped = [] # multi_edit (1.8.9): edits that did not match, with why; the others are applied
1108
+ self._n_edits = len(edits)
1109
+ partial_ok = self.name == "multi_edit" and len(edits) > 1 and not strict
1071
1110
 
1072
1111
  def refuse(why: str):
1073
1112
  ctx.tracker.mark_read(path, (1, TO_END), ctx.turn, len(tf.text), ctx.call_id)
@@ -1089,13 +1128,46 @@ class EditFile(Tool):
1089
1128
  if strict and "Its current content is below" not in str(err):
1090
1129
  refuse(f"{ctx.rel(path)} {'was not read in this session (read_file a file before editing it)' if not ctx.tracker.was_read(path) else 'changed since you read it'}"
1091
1130
  f" and edit {i} did not match: {str(err).split(chr(10))[0]}")
1131
+ if partial_ok:
1132
+ # prod 17-20 Nov: 226 "Edit N failed, so none of the M edits were applied" from 20 people; the
1133
+ # retry re-sent every edit and often failed again (up to 21 edits lost for one bad one). The
1134
+ # edits that match are applied; the ones that do not are reported with the text to copy.
1135
+ self._skipped.append((i, e, str(err)))
1136
+ continue
1092
1137
  prefix = (f"Edit {i} failed, so none of the {len(edits)} edits were applied "
1093
1138
  "(the file is unchanged): ") if self.name == "multi_edit" else ""
1094
1139
  raise ToolError(prefix + str(err) + _current_text_for_retry(ctx, path, tf, str(err),
1095
1140
  str(e.get("old_string") or "")))
1096
1141
  total += n
1142
+ if self._skipped and len(self._skipped) == len(edits):
1143
+ i, e, err = self._skipped[0]
1144
+ self._skipped = []
1145
+ raise ToolError(f"None of the {len(edits)} edits matched (the file is unchanged). Edit {i}: " + err
1146
+ + _current_text_for_retry(ctx, path, TextFile(text, tf.bom), err,
1147
+ str(e.get("old_string") or "")))
1097
1148
  return path, tf, text, total
1098
1149
 
1150
+ def _skipped_report(self, ctx, path: Path, text: str, applied: int) -> str:
1151
+ """multi_edit: what was NOT applied, each with its reason and the current text to copy for the retry."""
1152
+ skipped = getattr(self, "_skipped", None) or []
1153
+ if not skipped:
1154
+ return ""
1155
+ nums = ", ".join(str(i) for i, _, _ in skipped)
1156
+ out = [f"\nPARTLY APPLIED: {applied} edit(s) are in the file; edit(s) {nums} were NOT applied (they did not "
1157
+ "match). Send ONLY the missing edit(s) again with old_string copied from the text below; do not "
1158
+ "re-send the applied ones."]
1159
+ tf_now = TextFile(text, False)
1160
+ shown_whole = False
1161
+ for i, e, err in skipped:
1162
+ out.append(f"Edit {i}: " + (err if "matches" in err.split(chr(10))[0] else err.split(chr(10))[0]))
1163
+ if shown_whole:
1164
+ continue
1165
+ extra = _current_text_for_retry(ctx, path, tf_now, err, str(e.get("old_string") or ""))
1166
+ if extra:
1167
+ out.append(extra.lstrip("\n"))
1168
+ shown_whole = extra.startswith("\nThe file as it is now")
1169
+ return "\n".join(out)
1170
+
1099
1171
  def preview(self, args, ctx):
1100
1172
  path, tf, text, _ = self._compute(args, ctx)
1101
1173
  return make_diff(tf.text, text, ctx.rel(path))
@@ -1123,8 +1195,10 @@ class EditFile(Tool):
1123
1195
  + (f" (matched {'; '.join(sorted(set(notes)))}; check the diff)" if notes else "")
1124
1196
  + ".\n"
1125
1197
  + truncate(diff, 3000 if notes else 1500, "diff shortened") + (f"\n{check}" if check else "")
1126
- + (("\n" + dup) if dup else ""),
1127
- preview=f"+{added} -{removed} lines" + (f" ({check})" if check and "error" in check else ""),
1198
+ + (("\n" + dup) if dup else "")
1199
+ + self._skipped_report(ctx, path, text, getattr(self, "_n_edits", 0) - len(getattr(self, "_skipped", None) or [])),
1200
+ preview=f"+{added} -{removed} lines" + (f" ({check})" if check and "error" in check else "")
1201
+ + (f", {len(self._skipped)} edit(s) not applied" if getattr(self, "_skipped", None) else ""),
1128
1202
  )
1129
1203
 
1130
1204
 
@@ -1186,7 +1260,8 @@ def _edit_aliases(e: Any) -> Any:
1186
1260
 
1187
1261
  class MultiEdit(EditFile):
1188
1262
  name = "multi_edit"
1189
- description = 'Several exact-string edits to ONE file, in order, all or nothing.'
1263
+ description = ("Several exact-string edits to ONE file, in order. Edits that match are applied; any that do "
1264
+ "not are reported back with the current text, so re-send only those.")
1190
1265
  parameters = {
1191
1266
  "type": "object",
1192
1267
  "properties": {
@@ -1,75 +1,75 @@
1
- """Best-effort ignore rules for the Python fallbacks of glob/grep/list_dir."""
2
-
3
- from __future__ import annotations
4
-
5
- import fnmatch
6
- import os
7
- from pathlib import Path
8
- from typing import Iterator, List, Tuple
9
-
10
- ALWAYS_SKIP_DIRS = {
11
- ".git", ".hg", ".svn", "node_modules", "__pycache__", ".venv", "venv", "env", ".tox",
12
- ".mypy_cache", ".pytest_cache", ".ruff_cache", ".next", ".nuxt", "dist", "build",
13
- ".idea", ".gradle", "target", ".cache", "coverage", ".turbo", ".parcel-cache",
14
- }
15
-
16
-
17
- class GitIgnore:
18
- """A small subset of .gitignore: root .gitignore, simple globs, dir patterns, negation ignored."""
19
-
20
- def __init__(self, root: Path):
21
- self.root = root
22
- self.patterns: List[Tuple[str, bool]] = [] # (pattern, dir_only)
23
- try:
24
- with open(root / ".gitignore", "r", encoding="utf-8", errors="replace") as f:
25
- for line in f:
26
- line = line.strip()
27
- if not line or line.startswith("#") or line.startswith("!"):
28
- continue
29
- dir_only = line.endswith("/")
30
- self.patterns.append((line.strip("/"), dir_only))
31
- except OSError:
32
- pass
33
-
34
- def ignored(self, rel_posix: str, is_dir: bool) -> bool:
35
- name = rel_posix.rsplit("/", 1)[-1]
36
- for pat, dir_only in self.patterns:
37
- if dir_only and not is_dir:
38
- continue
39
- if "/" in pat:
40
- if fnmatch.fnmatch(rel_posix, pat.lstrip("/")) or fnmatch.fnmatch(rel_posix, pat.lstrip("/") + "/*"):
41
- return True
42
- elif fnmatch.fnmatch(name, pat):
43
- return True
44
- return False
45
-
46
-
47
- def walk_files(base: Path, root: Path) -> Iterator[Path]:
48
- gi = GitIgnore(root)
49
- for dirpath, dirnames, filenames in os.walk(base):
50
- dp = Path(dirpath)
51
- keep = []
52
- for d in dirnames:
53
- if d in ALWAYS_SKIP_DIRS:
54
- continue
55
- try:
56
- rel = (dp / d).relative_to(root).as_posix()
57
- except ValueError:
58
- rel = d
59
- if gi.ignored(rel, True):
60
- continue
61
- keep.append(d)
62
- dirnames[:] = sorted(keep)
63
- for fn in sorted(filenames):
64
- p = dp / fn
65
- try:
66
- rel = p.relative_to(root).as_posix()
67
- except ValueError:
68
- rel = fn
69
- if gi.ignored(rel, False):
70
- continue
71
- yield p
72
-
73
-
74
- def is_binary_bytes(data: bytes) -> bool:
75
- return b"\x00" in data[:8192]
1
+ """Best-effort ignore rules for the Python fallbacks of glob/grep/list_dir."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import fnmatch
6
+ import os
7
+ from pathlib import Path
8
+ from typing import Iterator, List, Tuple
9
+
10
+ ALWAYS_SKIP_DIRS = {
11
+ ".git", ".hg", ".svn", "node_modules", "__pycache__", ".venv", "venv", "env", ".tox",
12
+ ".mypy_cache", ".pytest_cache", ".ruff_cache", ".next", ".nuxt", "dist", "build",
13
+ ".idea", ".gradle", "target", ".cache", "coverage", ".turbo", ".parcel-cache",
14
+ }
15
+
16
+
17
+ class GitIgnore:
18
+ """A small subset of .gitignore: root .gitignore, simple globs, dir patterns, negation ignored."""
19
+
20
+ def __init__(self, root: Path):
21
+ self.root = root
22
+ self.patterns: List[Tuple[str, bool]] = [] # (pattern, dir_only)
23
+ try:
24
+ with open(root / ".gitignore", "r", encoding="utf-8", errors="replace") as f:
25
+ for line in f:
26
+ line = line.strip()
27
+ if not line or line.startswith("#") or line.startswith("!"):
28
+ continue
29
+ dir_only = line.endswith("/")
30
+ self.patterns.append((line.strip("/"), dir_only))
31
+ except OSError:
32
+ pass
33
+
34
+ def ignored(self, rel_posix: str, is_dir: bool) -> bool:
35
+ name = rel_posix.rsplit("/", 1)[-1]
36
+ for pat, dir_only in self.patterns:
37
+ if dir_only and not is_dir:
38
+ continue
39
+ if "/" in pat:
40
+ if fnmatch.fnmatch(rel_posix, pat.lstrip("/")) or fnmatch.fnmatch(rel_posix, pat.lstrip("/") + "/*"):
41
+ return True
42
+ elif fnmatch.fnmatch(name, pat):
43
+ return True
44
+ return False
45
+
46
+
47
+ def walk_files(base: Path, root: Path) -> Iterator[Path]:
48
+ gi = GitIgnore(root)
49
+ for dirpath, dirnames, filenames in os.walk(base):
50
+ dp = Path(dirpath)
51
+ keep = []
52
+ for d in dirnames:
53
+ if d in ALWAYS_SKIP_DIRS:
54
+ continue
55
+ try:
56
+ rel = (dp / d).relative_to(root).as_posix()
57
+ except ValueError:
58
+ rel = d
59
+ if gi.ignored(rel, True):
60
+ continue
61
+ keep.append(d)
62
+ dirnames[:] = sorted(keep)
63
+ for fn in sorted(filenames):
64
+ p = dp / fn
65
+ try:
66
+ rel = p.relative_to(root).as_posix()
67
+ except ValueError:
68
+ rel = fn
69
+ if gi.ignored(rel, False):
70
+ continue
71
+ yield p
72
+
73
+
74
+ def is_binary_bytes(data: bytes) -> bool:
75
+ return b"\x00" in data[:8192]