euron-code 1.1.0__tar.gz → 1.1.2__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 (130) hide show
  1. {euron_code-1.1.0 → euron_code-1.1.2}/CHANGELOG.md +18 -0
  2. {euron_code-1.1.0 → euron_code-1.1.2}/PKG-INFO +11 -1
  3. {euron_code-1.1.0 → euron_code-1.1.2}/README.md +10 -0
  4. {euron_code-1.1.0 → euron_code-1.1.2}/pyproject.toml +1 -1
  5. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/__init__.py +1 -1
  6. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/api.py +132 -44
  7. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/cli.py +7 -3
  8. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/repl.py +7 -1
  9. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/fs.py +5 -1
  10. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/update_check.py +2 -2
  11. euron_code-1.1.2/src/euron_code/version_info.py +52 -0
  12. euron_code-1.1.2/tests/test_v111_user_reports.py +114 -0
  13. {euron_code-1.1.0 → euron_code-1.1.2}/.gitignore +0 -0
  14. {euron_code-1.1.0 → euron_code-1.1.2}/LICENSE +0 -0
  15. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/__main__.py +0 -0
  16. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/activity.py +0 -0
  17. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/agent.py +0 -0
  18. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/attachments.py +0 -0
  19. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/auth.py +0 -0
  20. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
  21. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
  22. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
  23. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
  24. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/cache.py +0 -0
  25. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/checkpoints.py +0 -0
  26. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/config.py +0 -0
  27. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/context.py +0 -0
  28. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/contextforge/LICENSE +0 -0
  29. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/contextforge/__init__.py +0 -0
  30. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/contextforge/text.py +0 -0
  31. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/contextforge/toolout.py +0 -0
  32. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/credentials.py +0 -0
  33. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/doctor.py +0 -0
  34. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/documents.py +0 -0
  35. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/error_hints.py +0 -0
  36. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/errorlog.py +0 -0
  37. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/frontmatter.py +0 -0
  38. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/hooks.py +0 -0
  39. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/keys.py +0 -0
  40. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/knowledge.py +0 -0
  41. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/licensing.py +0 -0
  42. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/llm/__init__.py +0 -0
  43. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/llm/anthropic.py +0 -0
  44. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/llm/base.py +0 -0
  45. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/llm/openai_compat.py +0 -0
  46. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/llm/setup.py +0 -0
  47. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/logo.py +0 -0
  48. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/markdown_view.py +0 -0
  49. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/memory.py +0 -0
  50. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/osscache.py +0 -0
  51. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/ossgithub.py +0 -0
  52. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/permissions.py +0 -0
  53. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/project_setup.py +0 -0
  54. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/prompts.py +0 -0
  55. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/repomap.py +0 -0
  56. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/rules.py +0 -0
  57. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/security_scan.py +0 -0
  58. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/sessions.py +0 -0
  59. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/skills.py +0 -0
  60. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/textsafe.py +0 -0
  61. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/__init__.py +0 -0
  62. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/background.py +0 -0
  63. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/base.py +0 -0
  64. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/db.py +0 -0
  65. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/document.py +0 -0
  66. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/erie.py +0 -0
  67. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/ignore.py +0 -0
  68. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/normalize.py +0 -0
  69. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/oss.py +0 -0
  70. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/pathfind.py +0 -0
  71. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/reuse.py +0 -0
  72. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/search.py +0 -0
  73. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/shell.py +0 -0
  74. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/skill.py +0 -0
  75. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/symbols.py +0 -0
  76. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/task.py +0 -0
  77. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/todo.py +0 -0
  78. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/tools/web.py +0 -0
  79. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/transcript.py +0 -0
  80. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/trust.py +0 -0
  81. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/ui.py +0 -0
  82. {euron_code-1.1.0 → euron_code-1.1.2}/src/euron_code/usage_view.py +0 -0
  83. {euron_code-1.1.0 → euron_code-1.1.2}/tests/conftest.py +0 -0
  84. {euron_code-1.1.0 → euron_code-1.1.2}/tests/fake_providers.py +0 -0
  85. {euron_code-1.1.0 → euron_code-1.1.2}/tests/helpers.py +0 -0
  86. {euron_code-1.1.0 → euron_code-1.1.2}/tests/measure_floor.py +0 -0
  87. {euron_code-1.1.0 → euron_code-1.1.2}/tests/mock_gateway.py +0 -0
  88. {euron_code-1.1.0 → euron_code-1.1.2}/tests/serve_helper.py +0 -0
  89. {euron_code-1.1.0 → euron_code-1.1.2}/tests/sim_long_session.py +0 -0
  90. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_agent_mock.py +0 -0
  91. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_api_shell.py +0 -0
  92. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_bench.py +0 -0
  93. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_cli_e2e.py +0 -0
  94. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_context_memory_sessions.py +0 -0
  95. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_dashboard_fixes.py +0 -0
  96. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_dashboard_fixes_102.py +0 -0
  97. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_db.py +0 -0
  98. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_erie.py +0 -0
  99. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_knowledge_security.py +0 -0
  100. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_markdown_view.py +0 -0
  101. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_oss_local.py +0 -0
  102. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_permissions.py +0 -0
  103. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_powershell_exit_codes.py +0 -0
  104. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_qa_attach_secrets.py +0 -0
  105. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_qa_long_task.py +0 -0
  106. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_qa_print_output.py +0 -0
  107. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_qa_reuse_unrelated.py +0 -0
  108. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_qa_yolo_outside.py +0 -0
  109. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_repl.py +0 -0
  110. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_reuse_honesty.py +0 -0
  111. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_search.py +0 -0
  112. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_textsafe.py +0 -0
  113. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_tools_fs.py +0 -0
  114. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_transcript_ui.py +0 -0
  115. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_update_check.py +0 -0
  116. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v11_byo.py +0 -0
  117. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v11_speed.py +0 -0
  118. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v11_tool_fixes.py +0 -0
  119. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v2_rules_skills_hooks.py +0 -0
  120. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v2_tokens_shortcuts.py +0 -0
  121. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v2_usage_headers.py +0 -0
  122. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v31_security.py +0 -0
  123. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v3_accounts_value_setup.py +0 -0
  124. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v3_activity.py +0 -0
  125. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v3_attachments.py +0 -0
  126. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v3_context.py +0 -0
  127. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v3_live_repl.py +0 -0
  128. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v3_single_login.py +0 -0
  129. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v4.py +0 -0
  130. {euron_code-1.1.0 → euron_code-1.1.2}/tests/test_v5.py +0 -0
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.2 (2026-11-07)
4
+
5
+ - A connection that drops in the middle of an answer ("The response stopped part-way ... WinError 10054") now
6
+ also switches Euron Code to IPv4, so the automatic retry of that step takes the working route.
7
+
8
+ ## 1.1.1 (2026-11-07)
9
+
10
+ Fixes from support tickets.
11
+
12
+ - Word, Excel, PowerPoint and PDF files are read as text by `read_file` too, instead of "looks like a binary
13
+ file; not reading it".
14
+ - A connection the network resets (`[WinError 10054] An existing connection was forcibly closed`) is retried
15
+ three times, and Euron Code switches to IPv4 (remembered in `~/.euron/network.json`; force it with
16
+ `EURON_IPV4=1`). The final error says what to check.
17
+ - `euron version`, `euron -V` and `/version`: the running version, the Python it runs from, whether PyPI has a
18
+ newer one, and the update command for that exact Python. Before, `euron version` was sent to the model as a
19
+ prompt.
20
+
3
21
  ## 1.1.0 (2026-11-07)
4
22
 
5
23
  Bring your own model, and fixes for the errors users hit most in the last week.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: euron-code
3
- Version: 1.1.0
3
+ Version: 1.1.2
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>
@@ -175,6 +175,9 @@ https://euron.one/code-agent/usage.
175
175
 
176
176
  ## Use your own model
177
177
 
178
+ > Available from **Euron Code 1.1.0**. Check yours with `euron version` (or `euron --version`, or `/version`
179
+ > inside a session) and update with `pip install -U euron-code`.
180
+
178
181
  The Euron model is included with Euron Plus and Super 30. Any signed-in Euron account can also connect its
179
182
  own model: OpenAI, Claude (Anthropic), Ollama on your computer, Google Gemini, OpenRouter, Groq, or any
180
183
  OpenAI-compatible endpoint (LM Studio, Together, the EURI API, your own server). Everything else works the
@@ -719,6 +722,10 @@ in the editor straight away. Tips:
719
722
 
720
723
  ## Troubleshooting
721
724
 
725
+ **Which version am I running?** `euron version` prints the version, the Python that runs it, whether a newer
726
+ release is on PyPI, and the exact command to update that Python. `euron --version` (or `-V`) prints just the
727
+ number; inside a session use `/version` or `/status`.
728
+
722
729
  | You see | What to do |
723
730
  |---|---|
724
731
  | `You don't have Euron Plus access...` | Euron Code needs Euron Plus or an active Super 30 enrolment: https://euron.one/plus |
@@ -731,6 +738,9 @@ in the editor straight away. Tips:
731
738
  | `Images aren't available right now` | the image service is off; describe the picture in text |
732
739
  | `untrusted project hook(s)` | the folder has hooks you have not approved; run `euron` there interactively once to review them |
733
740
  | `The response stopped part-way` | the connection dropped mid-answer; nothing more was applied, send your message again |
741
+ | `Cannot reach Euron Code ... WinError 10054` (connection forcibly closed) | your network reset the connection (often a broken IPv6 route, a VPN, a proxy or an antivirus web shield). 1.1.1 and later retry and switch to IPv4 by themselves; you can force it with `EURON_IPV4=1`. If it still fails, allow euron.one in the VPN/antivirus and run `euron doctor` |
742
+ | `pip install -U euron-code` did not change the version | pip updated a different Python. `euron version` prints the exact upgrade command for the Python that runs `euron` |
743
+ | `Client_Requirement_Document.docx looks like a binary file` | fixed in 1.1.1: Word, Excel, PowerPoint and PDF files are read as text |
734
744
  | `euron: command not found` | see the VS Code tips above, or run `python -m euron_code` |
735
745
  | garbled colours on old Windows consoles | use Windows Terminal or VS Code's terminal |
736
746
 
@@ -109,6 +109,9 @@ https://euron.one/code-agent/usage.
109
109
 
110
110
  ## Use your own model
111
111
 
112
+ > Available from **Euron Code 1.1.0**. Check yours with `euron version` (or `euron --version`, or `/version`
113
+ > inside a session) and update with `pip install -U euron-code`.
114
+
112
115
  The Euron model is included with Euron Plus and Super 30. Any signed-in Euron account can also connect its
113
116
  own model: OpenAI, Claude (Anthropic), Ollama on your computer, Google Gemini, OpenRouter, Groq, or any
114
117
  OpenAI-compatible endpoint (LM Studio, Together, the EURI API, your own server). Everything else works the
@@ -653,6 +656,10 @@ in the editor straight away. Tips:
653
656
 
654
657
  ## Troubleshooting
655
658
 
659
+ **Which version am I running?** `euron version` prints the version, the Python that runs it, whether a newer
660
+ release is on PyPI, and the exact command to update that Python. `euron --version` (or `-V`) prints just the
661
+ number; inside a session use `/version` or `/status`.
662
+
656
663
  | You see | What to do |
657
664
  |---|---|
658
665
  | `You don't have Euron Plus access...` | Euron Code needs Euron Plus or an active Super 30 enrolment: https://euron.one/plus |
@@ -665,6 +672,9 @@ in the editor straight away. Tips:
665
672
  | `Images aren't available right now` | the image service is off; describe the picture in text |
666
673
  | `untrusted project hook(s)` | the folder has hooks you have not approved; run `euron` there interactively once to review them |
667
674
  | `The response stopped part-way` | the connection dropped mid-answer; nothing more was applied, send your message again |
675
+ | `Cannot reach Euron Code ... WinError 10054` (connection forcibly closed) | your network reset the connection (often a broken IPv6 route, a VPN, a proxy or an antivirus web shield). 1.1.1 and later retry and switch to IPv4 by themselves; you can force it with `EURON_IPV4=1`. If it still fails, allow euron.one in the VPN/antivirus and run `euron doctor` |
676
+ | `pip install -U euron-code` did not change the version | pip updated a different Python. `euron version` prints the exact upgrade command for the Python that runs `euron` |
677
+ | `Client_Requirement_Document.docx looks like a binary file` | fixed in 1.1.1: Word, Excel, PowerPoint and PDF files are read as text |
668
678
  | `euron: command not found` | see the VS Code tips above, or run `python -m euron_code` |
669
679
  | garbled colours on old Windows consoles | use Windows Terminal or VS Code's terminal |
670
680
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "euron-code"
7
- version = "1.1.0"
7
+ version = "1.1.2"
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.1.0"
3
+ __version__ = "1.1.2"
@@ -8,6 +8,7 @@ from __future__ import annotations
8
8
 
9
9
  import hashlib
10
10
  import json
11
+ import os
11
12
  import platform
12
13
  import queue
13
14
  import re
@@ -308,6 +309,51 @@ def device_id() -> Optional[str]:
308
309
  return value or None
309
310
 
310
311
 
312
+ # Some networks (a broken IPv6 route, an ISP or antivirus box) reset the connection to the gateway while a browser,
313
+ # which falls back to IPv4 by itself, works fine: WinError 10054 / ECONNRESET. After one such failure every client
314
+ # in this process uses IPv4, and so do later runs (remembered in ~/.euron/network.json). EURON_IPV4=1 forces it.
315
+ _FORCE_IPV4: Optional[bool] = None
316
+ NET_RETRY_WAITS = (0.6, 1.5, 3.0)
317
+ NETWORK_HINT = (" Check your internet connection. If a VPN, proxy or antivirus web shield is on, allow euron.one "
318
+ "or turn it off for a moment, then run `euron doctor`.")
319
+
320
+
321
+ def _net_file():
322
+ return config.euron_home() / "network.json"
323
+
324
+
325
+ def force_ipv4() -> bool:
326
+ global _FORCE_IPV4
327
+ if os.environ.get("EURON_IPV4", "").strip().lower() in ("1", "true", "yes"):
328
+ return True
329
+ if _FORCE_IPV4 is None:
330
+ try:
331
+ with open(_net_file(), "r", encoding="utf-8") as f:
332
+ _FORCE_IPV4 = bool(json.load(f).get("ipv4"))
333
+ except (OSError, ValueError, AttributeError):
334
+ _FORCE_IPV4 = False
335
+ return bool(_FORCE_IPV4)
336
+
337
+
338
+ def remember_ipv4() -> None:
339
+ global _FORCE_IPV4
340
+ _FORCE_IPV4 = True
341
+ try:
342
+ _net_file().parent.mkdir(parents=True, exist_ok=True)
343
+ with open(_net_file(), "w", encoding="utf-8") as f:
344
+ json.dump({"ipv4": True, "since": int(time.time())}, f)
345
+ except OSError:
346
+ pass
347
+
348
+
349
+ def is_dropped_connection(e: BaseException) -> bool:
350
+ """A connection refused/reset/closed before a full reply: safe and useful to retry."""
351
+ if isinstance(e, httpx.TimeoutException):
352
+ return False
353
+ return isinstance(e, (httpx.ConnectError, httpx.ReadError, httpx.WriteError, httpx.RemoteProtocolError,
354
+ httpx.ProxyError))
355
+
356
+
311
357
  def user_agent() -> str:
312
358
  return f"euron-code/{__version__} ({platform.system()}; Python {platform.python_version()})"
313
359
 
@@ -327,13 +373,32 @@ class Client:
327
373
  self._transport = transport
328
374
  self._is_clone = False
329
375
  self._lock = threading.Lock() # one model request at a time
330
- self._http = httpx.Client(
376
+ self._ipv4 = False
377
+ self._http = self._make_http()
378
+
379
+ def _make_http(self) -> httpx.Client:
380
+ transport = self._transport
381
+ if transport is None and force_ipv4():
382
+ transport = httpx.HTTPTransport(local_address="0.0.0.0") # bind IPv4: never take the IPv6 route
383
+ self._ipv4 = True
384
+ return httpx.Client(
331
385
  timeout=httpx.Timeout(connect=15.0, read=300.0, write=60.0, pool=15.0),
332
386
  headers={"User-Agent": user_agent()},
333
387
  transport=transport,
334
388
  follow_redirects=False,
335
389
  )
336
390
 
391
+ def _after_drop(self) -> None:
392
+ """A dropped connection: switch this client (and later runs) to IPv4 once."""
393
+ if self._transport is not None or self._ipv4:
394
+ return
395
+ remember_ipv4()
396
+ old, self._http = self._http, self._make_http()
397
+ try:
398
+ old.close()
399
+ except Exception:
400
+ pass
401
+
337
402
  def clone(self) -> "Client":
338
403
  """Another connection for the same account and session (a sub-agent running in parallel). It never
339
404
  releases the session lock on close: the main client owns it."""
@@ -380,12 +445,21 @@ class Client:
380
445
  headers = kw.pop("headers", {})
381
446
  if auth:
382
447
  headers.update(self._headers())
383
- try:
384
- return self._http.request(method, self.base_url + path, headers=headers, **kw)
385
- except httpx.TimeoutException as e:
386
- raise NetworkError(f"Request to Euron Code timed out ({type(e).__name__}).") from None
387
- except httpx.HTTPError as e:
388
- raise NetworkError(f"Cannot reach Euron Code at {self.base_url}: {e}") from None
448
+ last: Optional[BaseException] = None
449
+ for attempt in range(len(NET_RETRY_WAITS) + 1):
450
+ if attempt:
451
+ time.sleep(NET_RETRY_WAITS[attempt - 1])
452
+ try:
453
+ return self._http.request(method, self.base_url + path, headers=headers, **kw)
454
+ except httpx.TimeoutException as e:
455
+ raise NetworkError(f"Request to Euron Code timed out ({type(e).__name__})." + NETWORK_HINT) from None
456
+ except httpx.HTTPError as e:
457
+ if not is_dropped_connection(e):
458
+ raise NetworkError(f"Cannot reach Euron Code at {self.base_url}: {e}." + NETWORK_HINT) from None
459
+ last = e
460
+ self._after_drop()
461
+ raise NetworkError(f"Cannot reach Euron Code at {self.base_url}: {last} (tried {len(NET_RETRY_WAITS) + 1} "
462
+ "times)." + NETWORK_HINT)
389
463
 
390
464
  def _json(self, method: str, path: str, **kw: Any) -> Any:
391
465
  resp = self._request(method, path, **kw)
@@ -543,44 +617,58 @@ class Client:
543
617
  body.setdefault("stream_options", {"include_usage": True})
544
618
 
545
619
  def worker() -> None:
546
- try:
547
- with self._http.stream("POST", self.base_url + "/v1/chat/completions",
548
- headers=self._chat_headers(), json=body) as resp:
549
- holder["resp"] = resp
550
- if resp.status_code >= 400:
551
- resp.read()
552
- q.put(("error", _error_from_response(resp)))
620
+ for attempt in range(len(NET_RETRY_WAITS) + 1):
621
+ try:
622
+ run_once()
623
+ return
624
+ except httpx.HTTPError as e:
625
+ # retry only while nothing came back: the request never reached the model, or was refused
626
+ if "resp" in holder or not is_dropped_connection(e) or attempt == len(NET_RETRY_WAITS) or (cancel is not None and cancel.is_set()):
627
+ if is_dropped_connection(e):
628
+ self._after_drop() # the agent's retry of this step goes over IPv4
629
+ if isinstance(e, httpx.TimeoutException):
630
+ q.put(("error", NetworkError("The connection to Euron Code timed out.")))
631
+ else:
632
+ q.put(("error", NetworkError(f"Connection to Euron Code failed: {e}." + NETWORK_HINT)))
553
633
  return
554
- self.takeover_once = False # this session holds the account now
555
- for line in resp.iter_lines():
556
- if cancel is not None and cancel.is_set():
557
- return
558
- if not line or line.startswith(":"):
559
- # keep-alive / queue comment (`: queued, 2 ahead`): progress only
560
- q.put(("tick", line[1:].strip() if line.startswith(":") else None))
561
- continue
562
- if not line.startswith("data:"):
563
- continue
564
- data = line[5:].strip()
565
- if data == "[DONE]":
566
- q.put(("done", None))
567
- return
568
- try:
569
- obj = json.loads(data)
570
- except ValueError:
571
- continue
572
- if isinstance(obj, dict) and obj.get("error"):
573
- q.put(("error", error_from_body(int(obj["error"].get("status") or 500)
574
- if isinstance(obj["error"], dict) else 500, obj)))
575
- return
576
- q.put(("chunk", obj))
577
- q.put(("done", None))
578
- except httpx.TimeoutException:
579
- q.put(("error", NetworkError("The connection to Euron Code timed out.")))
580
- except httpx.HTTPError as e:
581
- q.put(("error", NetworkError(f"Connection to Euron Code failed: {e}")))
582
- except Exception as e: # pragma: no cover - defensive
583
- q.put(("error", EuronError(f"Unexpected error while streaming: {e}")))
634
+ self._after_drop()
635
+ time.sleep(NET_RETRY_WAITS[attempt])
636
+ except Exception as e: # pragma: no cover - defensive
637
+ q.put(("error", EuronError(f"Unexpected error while streaming: {e}")))
638
+ return
639
+
640
+ def run_once() -> None:
641
+ with self._http.stream("POST", self.base_url + "/v1/chat/completions",
642
+ headers=self._chat_headers(), json=body) as resp:
643
+ holder["resp"] = resp
644
+ if resp.status_code >= 400:
645
+ resp.read()
646
+ q.put(("error", _error_from_response(resp)))
647
+ return
648
+ self.takeover_once = False # this session holds the account now
649
+ for line in resp.iter_lines():
650
+ if cancel is not None and cancel.is_set():
651
+ return
652
+ if not line or line.startswith(":"):
653
+ # keep-alive / queue comment (`: queued, 2 ahead`): progress only
654
+ q.put(("tick", line[1:].strip() if line.startswith(":") else None))
655
+ continue
656
+ if not line.startswith("data:"):
657
+ continue
658
+ data = line[5:].strip()
659
+ if data == "[DONE]":
660
+ q.put(("done", None))
661
+ return
662
+ try:
663
+ obj = json.loads(data)
664
+ except ValueError:
665
+ continue
666
+ if isinstance(obj, dict) and obj.get("error"):
667
+ q.put(("error", error_from_body(int(obj["error"].get("status") or 500)
668
+ if isinstance(obj["error"], dict) else 500, obj)))
669
+ return
670
+ q.put(("chunk", obj))
671
+ q.put(("done", None))
584
672
 
585
673
  t = threading.Thread(target=worker, name="euron-stream", daemon=True)
586
674
  t.start()
@@ -18,7 +18,7 @@ from euron_code import __version__, api, auth, config, credentials, llm, session
18
18
  from euron_code.ui import UI, QuietUI
19
19
 
20
20
  EXIT_OK, EXIT_ERROR, EXIT_USAGE, EXIT_NO_PLUS, EXIT_AUTH, EXIT_QUOTA, EXIT_MAX_TURNS, EXIT_INT = 0, 1, 2, 3, 4, 5, 6, 130
21
- SUBCOMMANDS = ("login", "logout", "whoami", "usage", "users", "doctor", "config", "init", "trust", "cache", "models")
21
+ SUBCOMMANDS = ("login", "logout", "whoami", "usage", "users", "doctor", "config", "init", "trust", "cache", "models", "version")
22
22
  STARTED = __import__("time").monotonic() # session uptime counts from here
23
23
 
24
24
 
@@ -52,7 +52,7 @@ def main_parser() -> argparse.ArgumentParser:
52
52
  p = argparse.ArgumentParser(
53
53
  prog="euron",
54
54
  description="Euron Code: an AI coding agent in your terminal (Euron Plus and Super 30).",
55
- epilog="Commands: euron login [--force] | logout | whoami | usage | init | doctor | config get|set|unset|list | "
55
+ epilog="Commands: euron login [--force] | logout | whoami | version | usage | init | doctor | config get|set|unset|list | "
56
56
  "cache list|size|clear | models list|add|remove|use. "
57
57
  "Run `euron` with no arguments for an interactive session.",
58
58
  )
@@ -86,7 +86,7 @@ def main_parser() -> argparse.ArgumentParser:
86
86
  p.add_argument("--allowed-tools", default=None,
87
87
  help="Comma-separated allow rules for this run, e.g. \"Edit,Bash(pytest:*)\".")
88
88
  p.add_argument("--verbose", action="store_true", help="With -p: show progress on stderr.")
89
- p.add_argument("--version", action="version", version=f"euron-code {__version__}")
89
+ p.add_argument("-V", "--version", action="version", version=f"euron-code {__version__}")
90
90
  return p
91
91
 
92
92
 
@@ -124,6 +124,10 @@ def main(argv: Optional[List[str]] = None) -> int:
124
124
  _fix_windows_console()
125
125
  argv = list(sys.argv[1:] if argv is None else argv)
126
126
  try:
127
+ if argv and argv[0] in ("version", "-v"): # `euron version`: version, Python, newer release on PyPI
128
+ from euron_code import version_info
129
+ print(chr(10).join(version_info.report()))
130
+ return 0
127
131
  if argv and argv[0] in SUBCOMMANDS:
128
132
  return run_subcommand(argv[0], sub_parser(argv[0]).parse_args(argv[1:]))
129
133
  args = main_parser().parse_args(argv)
@@ -24,6 +24,7 @@ from euron_code.usage_view import (MODE_LABELS, estimate_value, fmt_int, money,
24
24
  SLASH_COMMANDS = {
25
25
  "/help": "Show this help",
26
26
  "/status": "Account, key, API, model, mode, session, uptime and quota at a glance",
27
+ "/version": "Euron Code version, the Python running it, and whether an update is out",
27
28
  "/usage": "Quota (day/week/month/year), refill times, value at API prices, last 30 days",
28
29
  "/users": "Same as /usage",
29
30
  "/cost": "Tokens this session: sent, cached by the server, saved",
@@ -71,7 +72,7 @@ SLASH_COMMANDS = {
71
72
  #: how /bug names an error kind (the report itself keeps the contract value)
72
73
  BUG_KIND = {"gateway": "service"}
73
74
 
74
- MIDRUN_COMMANDS = {"/usage", "/users", "/effort", "/attach", "/paste-image", "/reuse", "/reference", "/ps",
75
+ MIDRUN_COMMANDS = {"/usage", "/version", "/users", "/effort", "/attach", "/paste-image", "/reuse", "/reference", "/ps",
75
76
  "/components", "/cost", "/context", "/status", "/model", "/help", "/todos", "/permissions",
76
77
  "/whoami", "/bug", "/release-notes", "/config", "/expand"}
77
78
  FEEDBACK_URL = "https://euron.one/code-agent"
@@ -993,6 +994,11 @@ class Repl:
993
994
  return "exit"
994
995
  if cmd == "/help":
995
996
  return self._help()
997
+ if cmd == "/version":
998
+ from euron_code import version_info
999
+ for ln in version_info.report():
1000
+ self.ui.info(escape(ln))
1001
+ return None
996
1002
  if cmd == "/users":
997
1003
  cmd = "/usage" # alias
998
1004
  if cmd == "/usage":
@@ -38,6 +38,7 @@ def outline(lines: List[str], limit: int = 150) -> List[str]:
38
38
  return out
39
39
  MAX_LINE_CHARS = 1000
40
40
  MAX_FILE_BYTES = 5 * 1024 * 1024
41
+ BINARY_DOC_EXT = {".docx", ".xlsx", ".xlsm", ".pptx", ".pdf"}
41
42
  TO_END = 10 ** 9 # a read that reached the end of the file
42
43
 
43
44
 
@@ -65,7 +66,7 @@ def load_text(path: Path) -> TextFile:
65
66
  raise ToolError(f"{path} is {size // 1024} KB, too large to load. Use grep or read a line range.")
66
67
  data = path.read_bytes()
67
68
  if is_binary_bytes(data):
68
- raise ToolError(f"{path} looks like a binary file; not reading it.")
69
+ raise ToolError(f"{path.name} is a binary file, not text. For Word, Excel, PowerPoint or PDF use read_document; for other binaries describe them with bash (file size, type) instead of reading them.")
69
70
  bom = data.startswith(b"\xef\xbb\xbf")
70
71
  if bom:
71
72
  data = data[3:]
@@ -496,6 +497,9 @@ class ReadFile(Tool):
496
497
  raise ToolError(f"File not found: {ctx.rel(path)}." + _project_hint(ctx, args["path"]))
497
498
  if path.is_dir():
498
499
  raise ToolError(f"{ctx.rel(path)} is a folder, not a file. Use list_dir to see what is in it.")
500
+ if path.suffix.lower() in BINARY_DOC_EXT: # Word/Excel/PowerPoint/PDF: read them as text, never refuse
501
+ from euron_code.tools.document import ReadDocument
502
+ return ReadDocument().run({"path": str(path)}, ctx)
499
503
  offset = max(1, opt_int(args, "offset", 1) or 1)
500
504
  limit = max(1, min(opt_int(args, "limit", DEFAULT_READ_LIMIT) or DEFAULT_READ_LIMIT, 2000))
501
505
  rng = (offset, limit)
@@ -66,12 +66,12 @@ def _fetch_latest() -> Optional[str]:
66
66
  return None
67
67
 
68
68
 
69
- def latest_version(now: Optional[float] = None, fetch=_fetch_latest) -> Optional[str]:
69
+ def latest_version(now: Optional[float] = None, fetch=_fetch_latest, fresh: bool = False) -> Optional[str]:
70
70
  """The newest version on PyPI, from the cache when it is less than a day old."""
71
71
  now = time.time() if now is None else now
72
72
  cache = _read_cache()
73
73
  age = now - float(cache.get("checkedAt") or 0)
74
- if cache.get("checkedAt") and 0 <= age < CHECK_EVERY_S: # a clock moved back: check again
74
+ if not fresh and cache.get("checkedAt") and 0 <= age < CHECK_EVERY_S: # a clock moved back: check again
75
75
  return cache.get("latest")
76
76
  latest = fetch()
77
77
  _write_cache({"checkedAt": now, "latest": latest or cache.get("latest")})
@@ -0,0 +1,52 @@
1
+ """`euron version`, `euron -V` and `/version`: which Euron Code is running, from which Python, and whether
2
+ PyPI has a newer one.
3
+
4
+ The usual "I upgraded but it still says the old version" case is two Pythons on one computer: pip upgraded
5
+ one and the `euron` command on PATH belongs to the other. So the report names the Python that is running and
6
+ gives the upgrade command for exactly that Python.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import platform
12
+ import sys
13
+ from typing import Callable, List, Optional
14
+
15
+ from euron_code import __version__
16
+
17
+
18
+ def upgrade_command() -> str:
19
+ exe = sys.executable or "python"
20
+ if " " in exe:
21
+ exe = f'"{exe}"'
22
+ if platform.system() == "Windows" and exe.startswith('"'):
23
+ exe = "& " + exe # PowerShell needs the call operator for a quoted path
24
+ return f"{exe} -m pip install -U euron-code"
25
+
26
+
27
+ def report(latest_fn: Optional[Callable[[], Optional[str]]] = None) -> List[str]:
28
+ from euron_code import update_check
29
+ lines = [f"euron-code {__version__}"]
30
+ lines.append(f"Python {platform.python_version()} at {sys.executable}")
31
+ try:
32
+ import os
33
+ import euron_code
34
+ lines.append(f"Installed in {os.path.dirname(os.path.dirname(os.path.abspath(euron_code.__file__)))}")
35
+ except Exception:
36
+ pass
37
+ latest = None
38
+ try:
39
+ latest = (latest_fn or (lambda: update_check.latest_version(fresh=True)))()
40
+ except Exception:
41
+ latest = None
42
+ if latest and update_check.is_newer(latest):
43
+ lines.append(f"A newer version is out: {latest}. Update with:")
44
+ lines.append(f" {upgrade_command()}")
45
+ lines.append("If `pip install -U euron-code` did not change this version, pip updated a different "
46
+ "Python: use the command above.")
47
+ elif latest:
48
+ lines.append(f"Up to date (latest on PyPI: {latest}).")
49
+ else:
50
+ lines.append("Could not check PyPI for a newer version (offline?). Update any time with:")
51
+ lines.append(f" {upgrade_command()}")
52
+ return lines
@@ -0,0 +1,114 @@
1
+ """1.1.1: user reports of 2026-11-07 (support tickets): .docx refused as binary, WinError 10054 at start-up,
2
+ no way to see the running version."""
3
+
4
+ import httpx
5
+ import pytest
6
+
7
+ from helpers import make_ctx
8
+ from test_v3_attachments import make_docx
9
+
10
+ from euron_code import api, cli, update_check, version_info
11
+ from euron_code.tools.fs import ReadFile
12
+
13
+
14
+ def test_read_file_reads_a_word_document(project):
15
+ make_docx(project / "Client_Requirement_Document.docx")
16
+ res = ReadFile().run({"path": "Client_Requirement_Document.docx"}, make_ctx(project))
17
+ assert "binary" not in res.content.lower()
18
+ assert len(res.content) > 20
19
+
20
+
21
+ def test_binary_error_points_at_read_document(project):
22
+ (project / "blob.bin").write_bytes(b"\x00\x01\x02" * 400)
23
+ with pytest.raises(Exception) as e:
24
+ ReadFile().run({"path": "blob.bin"}, make_ctx(project))
25
+ assert "read_document" in str(e.value)
26
+
27
+
28
+ def _flaky(fails, exc):
29
+ calls = {"n": 0}
30
+
31
+ def handler(req):
32
+ calls["n"] += 1
33
+ if calls["n"] <= fails:
34
+ raise exc("[WinError 10054] An existing connection was forcibly closed by the remote host", request=req)
35
+ return httpx.Response(200, json={"ok": True, "email": "a@b.c"})
36
+ return handler, calls
37
+
38
+
39
+ @pytest.mark.parametrize("exc", [httpx.ConnectError, httpx.ReadError, httpx.RemoteProtocolError])
40
+ def test_dropped_connection_is_retried(monkeypatch, euron_env, exc):
41
+ monkeypatch.setattr(api, "NET_RETRY_WAITS", (0, 0, 0))
42
+ handler, calls = _flaky(2, exc)
43
+ c = api.Client(api_key="sk-eca-test", base_url="http://gw/api/v1/code-agent",
44
+ transport=httpx.MockTransport(handler))
45
+ assert c.me(use_cache=False)["ok"] is True
46
+ assert calls["n"] == 3
47
+
48
+
49
+ def test_dropped_connection_gives_a_clear_error(monkeypatch, euron_env):
50
+ monkeypatch.setattr(api, "NET_RETRY_WAITS", (0, 0, 0))
51
+ handler, calls = _flaky(99, httpx.ConnectError)
52
+ c = api.Client(api_key="sk-eca-test", base_url="http://gw/api/v1/code-agent",
53
+ transport=httpx.MockTransport(handler))
54
+ with pytest.raises(api.NetworkError) as e:
55
+ c.me(use_cache=False)
56
+ assert calls["n"] == 4 and "euron doctor" in str(e.value) and "tried 4 times" in str(e.value)
57
+
58
+
59
+ def test_stream_retries_before_any_reply(monkeypatch, euron_env):
60
+ monkeypatch.setattr(api, "NET_RETRY_WAITS", (0, 0, 0))
61
+ calls = {"n": 0}
62
+ body = 'data: {"choices":[{"index":0,"delta":{"content":"hi"}}]}\n\ndata: [DONE]\n\n'
63
+
64
+ def handler(req):
65
+ calls["n"] += 1
66
+ if calls["n"] == 1:
67
+ raise httpx.ConnectError("[WinError 10054] reset", request=req)
68
+ return httpx.Response(200, text=body, headers={"content-type": "text/event-stream"})
69
+ c = api.Client(api_key="sk-eca-test", base_url="http://gw/api/v1/code-agent",
70
+ transport=httpx.MockTransport(handler))
71
+ chunks = list(c.stream_chat({"model": "m", "messages": []}))
72
+ assert calls["n"] == 2 and chunks[0]["choices"][0]["delta"]["content"] == "hi"
73
+
74
+
75
+ def test_ipv4_fallback_is_remembered(monkeypatch, euron_env):
76
+ monkeypatch.setattr(api, "_FORCE_IPV4", None)
77
+ monkeypatch.delenv("EURON_IPV4", raising=False)
78
+ assert api.force_ipv4() is False
79
+ c = api.Client(api_key="sk-eca-test", base_url="http://gw")
80
+ assert c._ipv4 is False
81
+ c._after_drop()
82
+ assert c._ipv4 is True and (euron_env / "network.json").exists()
83
+ monkeypatch.setattr(api, "_FORCE_IPV4", None) # a later run reads the file
84
+ assert api.force_ipv4() is True and api.Client(api_key="k", base_url="http://gw")._ipv4 is True
85
+
86
+
87
+ def test_euron_version_never_starts_a_session(monkeypatch, capsys, euron_env):
88
+ monkeypatch.setattr(update_check, "latest_version", lambda **kw: "99.0.0")
89
+ assert cli.main(["version"]) == 0
90
+ out = capsys.readouterr().out
91
+ assert "euron-code" in out and "99.0.0" in out and "-m pip install -U euron-code" in out
92
+ with pytest.raises(SystemExit):
93
+ cli.main(["-V"])
94
+
95
+
96
+ def test_version_report_up_to_date():
97
+ lines = version_info.report(latest_fn=lambda: "0.0.1")
98
+ assert any("Up to date" in ln for ln in lines)
99
+
100
+
101
+ def test_midstream_drop_switches_to_ipv4_for_the_retry(monkeypatch, euron_env):
102
+ class Broken(httpx.SyncByteStream):
103
+ def __iter__(self):
104
+ yield b'data: {"choices":[{"index":0,"delta":{"content":"par"}}]}\n\n'
105
+ raise httpx.ReadError("[WinError 10054] An existing connection was forcibly closed")
106
+
107
+ c = api.Client(api_key="sk-eca-test", base_url="http://gw/api/v1/code-agent",
108
+ transport=httpx.MockTransport(lambda req: httpx.Response(
109
+ 200, stream=Broken(), headers={"content-type": "text/event-stream"})))
110
+ drops = []
111
+ monkeypatch.setattr(c, "_after_drop", lambda: drops.append(1))
112
+ with pytest.raises(api.NetworkError):
113
+ list(c.stream_chat({"model": "m", "messages": []}))
114
+ assert drops == [1]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes