euron-code 1.6.0__tar.gz → 1.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {euron_code-1.6.0 → euron_code-1.6.1}/CHANGELOG.md +16 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/PKG-INFO +1 -1
- {euron_code-1.6.0 → euron_code-1.6.1}/pyproject.toml +1 -1
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/__init__.py +1 -1
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/llm/base.py +15 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/repl.py +22 -2
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/fs.py +49 -1
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v155_user_errors.py +1 -1
- euron_code-1.6.1/tests/test_v161_residual_errors.py +123 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/.gitignore +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/LICENSE +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/README.md +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/__main__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/activity.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/agent.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/api.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/attachments.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/auth.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/autoupdate.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/cache.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/checkpoints.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/cli.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/config.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/context.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/contextforge/LICENSE +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/contextforge/__init__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/contextforge/text.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/contextforge/toolout.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/credentials.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/doctor.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/documents.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/dotnet.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/error_hints.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/errorlog.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/friendly.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/frontmatter.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/hooks.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/keys.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/knowledge.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/licensing.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/llm/__init__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/llm/anthropic.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/llm/openai_compat.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/llm/setup.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/logo.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/markdown_view.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/memory.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/migration.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/mvc5.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/osscache.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/ossgithub.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/pasteinput.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/pathfix.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/permissions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/progress.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/project_setup.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/prompts.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/repomap.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/rules.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/security_scan.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/sessions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/skills.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/textsafe.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/__init__.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/background.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/base.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/db.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/document.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/erie.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/ignore.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/normalize.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/oss.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/pathfind.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/port.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/reuse.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/search.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/shell.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/skill.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/symbols.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/task.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/todo.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/tools/web.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/transcript.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/trust.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/ui.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/update_check.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/usage_view.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/version_info.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/webforms.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/conftest.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/fake_providers.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/helpers.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/measure_floor.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/mock_gateway.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/serve_helper.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/sim_long_session.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_agent_mock.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_api_shell.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_bench.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_bench_harness.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_cli_e2e.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_context_memory_sessions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_dashboard_fixes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_dashboard_fixes_102.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_db.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_erie.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_knowledge_security.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_markdown_view.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_oss_local.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_permissions.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_powershell_exit_codes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_qa_attach_secrets.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_qa_long_task.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_qa_print_output.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_qa_reuse_unrelated.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_qa_yolo_outside.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_repl.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_reuse_honesty.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_search.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_textsafe.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_tools_fs.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_transcript_ui.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_update_check.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v111_user_reports.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v113_fix_path.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v11_byo.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v11_speed.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v11_tool_fixes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v130_cut_writes.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v130_reliability.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v140_parity.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v152_migration.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v153_user_errors.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v156_autoupdate.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v156_paste_and_edits.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v157_zero_errors.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v15_hosted_models.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v160_stop_scope_atomic.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v2_rules_skills_hooks.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v2_tokens_shortcuts.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v2_usage_headers.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v31_security.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v3_accounts_value_setup.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v3_activity.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v3_attachments.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v3_context.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v3_live_repl.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v3_single_login.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v4.py +0 -0
- {euron_code-1.6.0 → euron_code-1.6.1}/tests/test_v5.py +0 -0
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.1 (2026-11-13)
|
|
4
|
+
|
|
5
|
+
What was still left in a review of every Euron Code error of 7-13 Nov (3,354 requests).
|
|
6
|
+
|
|
7
|
+
- `continue` typed as the first message in a new terminal picks up your last session in this folder (from the
|
|
8
|
+
last 24 hours) instead of starting from nothing. `/clear` starts fresh.
|
|
9
|
+
- An API key that cannot be a key (a provider's name, a pasted `euron --model ...` command, a `<placeholder>`)
|
|
10
|
+
is refused before anything is sent, wherever it came from (environment variables too), with how to fix it.
|
|
11
|
+
- When today's allowance is used up, the message says what you can do now: use your own model with `/model add`
|
|
12
|
+
(and `/model euron` to come back), or wait for the reset time shown.
|
|
13
|
+
- Edits: fields sent under other names (`old_str`, `search`, `replace`, ...) are understood; when the text to
|
|
14
|
+
replace appears in several places, each place comes back with the lines around it, so the next try can pick
|
|
15
|
+
one at once.
|
|
16
|
+
- Reading Euron Code's own project notes (`.euron/knowledge/`) before anything is recorded is no longer an error.
|
|
17
|
+
- `/rewind` no longer says shell changes are not undone (since 1.6.0 they are).
|
|
18
|
+
|
|
3
19
|
## 1.6.0 (2026-11-13)
|
|
4
20
|
|
|
5
21
|
Finishes small jobs quickly, stops at a clear point, and does not break code that already worked. From a review of
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: euron-code
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students.
|
|
5
5
|
Project-URL: Homepage, https://euron.one/code-agent
|
|
6
6
|
Author-email: Euron <contact@euron.one>
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "euron-code"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.1"
|
|
8
8
|
description = "Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -129,7 +129,22 @@ def check_header_text(label: str, headers: Dict[str, str], key_hint: str = "") -
|
|
|
129
129
|
sentence or a curly quote pasted with it, made httpx fail with "'ascii' codec can't encode character" before
|
|
130
130
|
the request left the computer (prod 11 Nov, Python 3.15, Windows). Say what is wrong instead."""
|
|
131
131
|
from euron_code.llm import ProviderError
|
|
132
|
+
from euron_code.llm.setup import key_problem
|
|
132
133
|
for name, value in headers.items():
|
|
134
|
+
if isinstance(value, str) and value.isascii() and name.lower() in (
|
|
135
|
+
"authorization", "x-api-key", "api-key", "x-goog-api-key"):
|
|
136
|
+
# prod 7-13 Nov: 31 requests from 6 people sent "openai", "euron --model ..." or a <placeholder> as
|
|
137
|
+
# the key (often from an environment variable) and came back 401 every time (1.6.1)
|
|
138
|
+
raw = value[7:] if value.startswith("Bearer ") else value
|
|
139
|
+
bad = key_problem(label, raw)
|
|
140
|
+
if bad:
|
|
141
|
+
e = ProviderError(
|
|
142
|
+
f"The API key for {label} is not a real key, so the request was not sent: {bad} Set it again "
|
|
143
|
+
"with /model add" + (f" or fix {key_hint}" if key_hint else "")
|
|
144
|
+
+ "; `/model euron` switches back to the Euron model.", status=0, code="provider_auth")
|
|
145
|
+
e.provider = label
|
|
146
|
+
raise e
|
|
147
|
+
continue
|
|
133
148
|
if not isinstance(value, str) or value.isascii():
|
|
134
149
|
continue
|
|
135
150
|
shown = value[7:] if value.startswith("Bearer ") else value # count within the key itself
|
|
@@ -907,8 +907,25 @@ class Repl:
|
|
|
907
907
|
from euron_code.activity import supports_unicode
|
|
908
908
|
return ("\U0001f4ce " if supports_unicode() else "[+] ") + f"{name} (attached)"
|
|
909
909
|
|
|
910
|
+
def _auto_resume(self, text: str) -> None:
|
|
911
|
+
"""`continue` typed as the FIRST message of a new session (prod: a fresh terminal, "continue", and the
|
|
912
|
+
model had nothing to continue): pick up the latest session of this folder from the last 24 hours."""
|
|
913
|
+
import re
|
|
914
|
+
if len(self.agent.messages) > 1 or not re.match(r"^(continue|resume|go on|carry on|keep going|aage badho|"
|
|
915
|
+
r"chalu rakho)[.!\s]*$", text.strip(), re.I):
|
|
916
|
+
return
|
|
917
|
+
try:
|
|
918
|
+
info = sessions.latest(self.agent.root)
|
|
919
|
+
except OSError:
|
|
920
|
+
info = None
|
|
921
|
+
if info is None or info.id == getattr(self.session, "id", None) or time.time() - info.modified > 86400:
|
|
922
|
+
return
|
|
923
|
+
self.ui.dim(f"Picking up your last session in this folder ({info.first_prompt[:60] or info.id}); /clear starts fresh.")
|
|
924
|
+
self._resume(info.id)
|
|
925
|
+
|
|
910
926
|
def turn(self, text: str) -> Optional[int]:
|
|
911
927
|
from euron_code import attachments
|
|
928
|
+
self._auto_resume(text)
|
|
912
929
|
self._last_text = text
|
|
913
930
|
text, pasted = attachments.find_pasted_paths(text) # files dragged into the terminal
|
|
914
931
|
if pasted and not text.strip():
|
|
@@ -1655,7 +1672,7 @@ class Repl:
|
|
|
1655
1672
|
if skipped:
|
|
1656
1673
|
self.ui.warn("Not restored (changed again after that turn; use /rewind --force): "
|
|
1657
1674
|
+ ", ".join(self.agent.ctx.rel(Path(p)) for p in skipped))
|
|
1658
|
-
self.ui.dim("
|
|
1675
|
+
self.ui.dim("Your prompt is back in the input line.")
|
|
1659
1676
|
self._prefill = snap.prompt
|
|
1660
1677
|
return None
|
|
1661
1678
|
|
|
@@ -1959,7 +1976,10 @@ def quota_message(e: api.EuronError, me: Optional[Dict[str, Any]]) -> str:
|
|
|
1959
1976
|
when = local_when(e.resets_at or q.get(key) or blocked.get("resetsAt"))
|
|
1960
1977
|
return f"You have used {word} Euron Code token allowance. It resets at {when} (your local time)."
|
|
1961
1978
|
when = local_when(e.resets_at or q.get("resetsAt"))
|
|
1962
|
-
|
|
1979
|
+
# 1.6.1: say what to do now (prod: a pasted list kept sending, 141 messages refused one by one)
|
|
1980
|
+
return (f"You have used today's Euron Code token allowance. It resets at {when} (your local time). Until "
|
|
1981
|
+
"then, messages to the Euron model are refused; to keep working now, use your own model: "
|
|
1982
|
+
"`/model add` (then `/model euron` to come back).")
|
|
1963
1983
|
|
|
1964
1984
|
|
|
1965
1985
|
def init_skeletons(root: Path) -> List[Path]:
|
|
@@ -564,11 +564,28 @@ def apply_edit_ex(text: str, old: str, new: str, replace_all: bool = False) -> T
|
|
|
564
564
|
if count > 1 and not replace_all:
|
|
565
565
|
raise ToolError(
|
|
566
566
|
f"old_string matches {count} places (lines {_exact_lines(text, old_a)}). Add more surrounding lines to "
|
|
567
|
-
"make it unique, or set replace_all to true to change every occurrence."
|
|
567
|
+
"make it unique, or set replace_all to true to change every occurrence." + _match_contexts(text, old_a)
|
|
568
568
|
)
|
|
569
569
|
return text.replace(old_a, new_a), count, ""
|
|
570
570
|
|
|
571
571
|
|
|
572
|
+
def _match_contexts(text: str, old: str, limit: int = 4, around: int = 2) -> str:
|
|
573
|
+
"""Each place old_string matches, with the lines around it, so the retry can add the lines that make it
|
|
574
|
+
unique in one step (1.6.1; prod 7-13 Nov: 40 "matches N places" errors from 20 people)."""
|
|
575
|
+
lines = text.replace("\r\n", "\n").split("\n")
|
|
576
|
+
starts, i = [], text.find(old)
|
|
577
|
+
while i >= 0 and len(starts) < limit:
|
|
578
|
+
starts.append(text.count("\n", 0, i))
|
|
579
|
+
i = text.find(old, i + 1)
|
|
580
|
+
if not starts:
|
|
581
|
+
return ""
|
|
582
|
+
out = ["\nThe places, with the lines around them (copy enough of them into old_string to pick one):"]
|
|
583
|
+
for s in starts:
|
|
584
|
+
a, b = max(0, s - around), min(len(lines), s + old.count("\n") + 1 + around)
|
|
585
|
+
out.append(f"--- lines {a + 1}-{b}:\n" + "\n".join(lines[a:b]))
|
|
586
|
+
return "\n".join(out)
|
|
587
|
+
|
|
588
|
+
|
|
572
589
|
def apply_edit(text: str, old: str, new: str, replace_all: bool = False) -> Tuple[str, int]:
|
|
573
590
|
"""Replace old with new: exact first, then (unique) tolerant of copied line numbers,
|
|
574
591
|
trailing whitespace and indentation. Returns (new_text, count)."""
|
|
@@ -606,6 +623,12 @@ class ReadFile(Tool):
|
|
|
606
623
|
def run(self, args, ctx):
|
|
607
624
|
path, moved = ctx.locate(require(args, "path"), "file")
|
|
608
625
|
if not path.exists():
|
|
626
|
+
rel = ctx.rel(path)
|
|
627
|
+
if rel.startswith((".euron/knowledge/", ".euron/security/")):
|
|
628
|
+
# the prompt names these files; before the first recorded task they do not exist yet (1.6.1)
|
|
629
|
+
return ToolResult(f"{rel} does not exist yet: Euron Code writes .euron/knowledge/ and "
|
|
630
|
+
".euron/security/ itself after tasks in a set-up project, so nothing is recorded "
|
|
631
|
+
"here so far. Continue without it.")
|
|
609
632
|
raise ToolError(_not_found_message(ctx, path, args["path"]))
|
|
610
633
|
ctx.read_misses = 0
|
|
611
634
|
if path.is_dir():
|
|
@@ -998,6 +1021,7 @@ class EditFile(Tool):
|
|
|
998
1021
|
return ctx.rel(self._target(args, ctx)[0]) if args.get("path") else ""
|
|
999
1022
|
|
|
1000
1023
|
def edits(self, args) -> List[Dict[str, Any]]:
|
|
1024
|
+
args.update({k: v for k, v in _edit_aliases(args).items() if k in ("old_string", "new_string")})
|
|
1001
1025
|
if args.get("old_string") is None and args.get("new_string") is not None:
|
|
1002
1026
|
# seen in production: {path, new_string} only. On a missing or empty file that means "create it";
|
|
1003
1027
|
# _compute decides, and explains otherwise.
|
|
@@ -1138,6 +1162,28 @@ def _current_text_for_retry(ctx: ToolContext, path: Path, tf: TextFile, err: str
|
|
|
1138
1162
|
+ ctx.cut(tf.text, "file shortened"))
|
|
1139
1163
|
|
|
1140
1164
|
|
|
1165
|
+
_OLD_KEYS = ("old_str", "oldString", "old", "search", "find", "from", "before", "original")
|
|
1166
|
+
_NEW_KEYS = ("new_str", "newString", "new", "replace", "replacement", "to", "after", "updated")
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
def _edit_aliases(e: Any) -> Any:
|
|
1170
|
+
"""One edit with the other names models use for its fields (prod: "edit N has no `old_string`", 14 errors
|
|
1171
|
+
from 6 people, the text was there under old_str / search)."""
|
|
1172
|
+
if not isinstance(e, dict):
|
|
1173
|
+
return e
|
|
1174
|
+
if e.get("old_string") is None:
|
|
1175
|
+
for k in _OLD_KEYS:
|
|
1176
|
+
if isinstance(e.get(k), str):
|
|
1177
|
+
e = dict(e, old_string=e[k])
|
|
1178
|
+
break
|
|
1179
|
+
if e.get("new_string") is None:
|
|
1180
|
+
for k in _NEW_KEYS:
|
|
1181
|
+
if isinstance(e.get(k), str):
|
|
1182
|
+
e = dict(e, new_string=e[k])
|
|
1183
|
+
break
|
|
1184
|
+
return e
|
|
1185
|
+
|
|
1186
|
+
|
|
1141
1187
|
class MultiEdit(EditFile):
|
|
1142
1188
|
name = "multi_edit"
|
|
1143
1189
|
description = 'Several exact-string edits to ONE file, in order, all or nothing.'
|
|
@@ -1181,6 +1227,8 @@ class MultiEdit(EditFile):
|
|
|
1181
1227
|
pass
|
|
1182
1228
|
if isinstance(edits, dict):
|
|
1183
1229
|
edits = [edits]
|
|
1230
|
+
if isinstance(edits, list):
|
|
1231
|
+
edits = [_edit_aliases(e) for e in edits]
|
|
1184
1232
|
if (not isinstance(edits, list) or not edits) and args.get("old_string") is not None \
|
|
1185
1233
|
and args.get("new_string") is not None:
|
|
1186
1234
|
edits = [{"old_string": args["old_string"], "new_string": args["new_string"],
|
|
@@ -42,7 +42,7 @@ def test_non_ascii_key_never_reaches_httpx_and_says_what_is_wrong():
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
def test_ascii_headers_pass():
|
|
45
|
-
base.check_header_text("x:y", {"Authorization": "Bearer sk-
|
|
45
|
+
base.check_header_text("x:y", {"Authorization": "Bearer sk-abc0123456789abcdef0123", "anthropic-version": "2023-06-01"})
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
# ------------------------------------------------------------ Gemini thought_signature
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""1.6.1: what was still left after 1.6.0 in the 7-13 Nov prod pass of every Euron Code error.
|
|
2
|
+
|
|
3
|
+
- a key that cannot be a key ("openai", "euron --model ...", "<your-key>") is refused before the request, from
|
|
4
|
+
any source (env var included), with what to do;
|
|
5
|
+
- edit fields under other names (old_str, search, ...) are understood;
|
|
6
|
+
- "old_string matches N places" shows each place with its surroundings;
|
|
7
|
+
- Euron Code's own knowledge files not existing yet is not an error;
|
|
8
|
+
- the daily-allowance message says what to do now;
|
|
9
|
+
- "continue" as the first message of a new session picks up the last session of the folder;
|
|
10
|
+
- a pasted numbered list (the 9 Nov case: 141 lines, 141 tasks) is ONE message.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import pytest
|
|
16
|
+
|
|
17
|
+
from euron_code import api, config, sessions
|
|
18
|
+
from euron_code.agent import Agent
|
|
19
|
+
from euron_code.llm import ProviderError
|
|
20
|
+
from euron_code.llm.base import check_header_text
|
|
21
|
+
from euron_code.permissions import Permissions
|
|
22
|
+
from euron_code.repl import Repl, quota_message
|
|
23
|
+
from euron_code.tools.base import ToolError
|
|
24
|
+
from euron_code.tools.fs import EditFile, MultiEdit, ReadFile, apply_edit
|
|
25
|
+
from helpers import RecordingUI, make_ctx
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.mark.parametrize("key", ["openai", "euron --model openai:gpt-5", "<your-api-key>", "sk-123"])
|
|
29
|
+
def test_a_key_that_cannot_be_a_key_is_refused_before_sending(key):
|
|
30
|
+
with pytest.raises(ProviderError) as ei:
|
|
31
|
+
check_header_text("OpenAI", {"Authorization": f"Bearer {key}"}, "the OPENAI_API_KEY environment variable")
|
|
32
|
+
msg = str(ei.value.message if hasattr(ei.value, "message") else ei.value)
|
|
33
|
+
assert "not sent" in msg and "/model add" in msg and "OPENAI_API_KEY" in msg
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_a_real_looking_key_passes():
|
|
37
|
+
check_header_text("OpenAI", {"Authorization": "Bearer sk-proj-" + "a" * 40})
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_edit_fields_under_other_names(project):
|
|
41
|
+
f = project / "a.py"
|
|
42
|
+
f.write_text("x = 1\ny = 2\n", encoding="utf-8")
|
|
43
|
+
ctx = make_ctx(project)
|
|
44
|
+
ctx.tracker.mark_read(f, (1, 10 ** 9))
|
|
45
|
+
MultiEdit().run({"path": "a.py", "edits": [{"old_str": "x = 1", "new_str": "x = 5"},
|
|
46
|
+
{"search": "y = 2", "replace": "y = 6"}]}, ctx)
|
|
47
|
+
EditFile().run({"path": "a.py", "oldString": "x = 5", "newString": "x = 7"}, ctx)
|
|
48
|
+
assert f.read_text(encoding="utf-8") == "x = 7\ny = 6\n"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_several_matches_come_back_with_their_surroundings():
|
|
52
|
+
text = "def a():\n return 1\n\ndef b():\n return 1\n"
|
|
53
|
+
with pytest.raises(ToolError) as ei:
|
|
54
|
+
apply_edit(text, " return 1", " return 2")
|
|
55
|
+
msg = str(ei.value)
|
|
56
|
+
assert "def a():" in msg and "def b():" in msg and "lines 1-" in msg
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_missing_knowledge_journal_is_not_an_error(project):
|
|
60
|
+
out = ReadFile().run({"path": ".euron/knowledge/journal.md"}, make_ctx(project))
|
|
61
|
+
assert "does not exist yet" in out.content and not out.is_error
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_daily_allowance_message_says_what_to_do():
|
|
65
|
+
e = api.QuotaExceededError("used up", status=429, code="daily_token_limit")
|
|
66
|
+
msg = quota_message(e, {"quota": {"resetsAt": "2026-11-14T00:00:00+05:30"}})
|
|
67
|
+
assert "/model add" in msg and "resets at" in msg
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@pytest.fixture
|
|
71
|
+
def make_repl(project, logged_in, mock_url):
|
|
72
|
+
from prompt_toolkit.input import create_pipe_input
|
|
73
|
+
from prompt_toolkit.output import DummyOutput
|
|
74
|
+
made = []
|
|
75
|
+
|
|
76
|
+
def make(keys: str, typed: bool = True):
|
|
77
|
+
cm = create_pipe_input()
|
|
78
|
+
pipe = cm.__enter__()
|
|
79
|
+
made.append(cm)
|
|
80
|
+
import re
|
|
81
|
+
import threading
|
|
82
|
+
import time
|
|
83
|
+
|
|
84
|
+
def typist():
|
|
85
|
+
if not typed: # a paste: everything at once, then /exit typed a moment later
|
|
86
|
+
time.sleep(0.3)
|
|
87
|
+
pipe.send_text(keys)
|
|
88
|
+
time.sleep(2.5)
|
|
89
|
+
pipe.send_text("/exit\r")
|
|
90
|
+
return
|
|
91
|
+
for i, chunk in enumerate(re.findall(r"[^\r]*\r|[^\r]+$", keys)):
|
|
92
|
+
time.sleep(0.8 if i else 0.3)
|
|
93
|
+
pipe.send_text(chunk)
|
|
94
|
+
threading.Thread(target=typist, daemon=True).start()
|
|
95
|
+
client = api.Client(api_key=logged_in, base_url=mock_url)
|
|
96
|
+
ui = RecordingUI()
|
|
97
|
+
a = Agent(client, ui, project, config.load_settings(project), Permissions(project), "euron-coder",
|
|
98
|
+
session=sessions.SessionWriter(project))
|
|
99
|
+
return Repl(a, client, ui, client.me(), a.session, pt_io=(pipe, DummyOutput())), ui, a
|
|
100
|
+
|
|
101
|
+
yield make
|
|
102
|
+
for cm in made:
|
|
103
|
+
cm.__exit__(None, None, None)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def test_continue_in_a_new_session_picks_up_the_last_one(make_repl):
|
|
107
|
+
repl, ui, a = make_repl("[mock:simple] build the first part\r/exit\r")
|
|
108
|
+
repl.run()
|
|
109
|
+
repl2, ui2, a2 = make_repl("continue\r/exit\r")
|
|
110
|
+
repl2.run()
|
|
111
|
+
assert "Picking up your last session" in ui2.text
|
|
112
|
+
users = [m for m in a2.messages if m.get("role") == "user"]
|
|
113
|
+
assert len(users) >= 2 # the old request is in the context, then "continue"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_pasted_numbered_list_is_one_message(make_repl, mock):
|
|
117
|
+
spec = "\r".join(["build an inventory app with these modules:"] + [f"{i}. Module {i}" for i in range(1, 21)]
|
|
118
|
+
+ ["- Screws", "- Nuts and bolts"]) + "\r"
|
|
119
|
+
repl, ui, a = make_repl(spec, typed=False)
|
|
120
|
+
repl.run()
|
|
121
|
+
users = [m for m in a.messages if m.get("role") == "user"]
|
|
122
|
+
assert len(users) == 1
|
|
123
|
+
assert "20. Module 20" in str(users[0]["content"]) and "- Nuts and bolts" in str(users[0]["content"])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/builtin_skills/build-from-reference/SKILL.md
RENAMED
|
File without changes
|
{euron_code-1.6.0 → euron_code-1.6.1}/src/euron_code/builtin_skills/explain-codebase/SKILL.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|