euron-code 1.8.1__tar.gz → 1.8.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.
- {euron_code-1.8.1 → euron_code-1.8.2}/CHANGELOG.md +19 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/PKG-INFO +1 -1
- {euron_code-1.8.1 → euron_code-1.8.2}/pyproject.toml +1 -1
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/__init__.py +1 -1
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/agent.py +193 -4
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/permissions.py +45 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/prompts.py +17 -2
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/db.py +9 -2
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/normalize.py +29 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_db.py +1 -1
- euron_code-1.8.2/tests/test_v182_zero_errors.py +300 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/.gitignore +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/LICENSE +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/README.md +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/__main__.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/activity.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/api.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/attachments.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/auth.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/autoupdate.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/cache.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/checkpoints.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/cli.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/codeindex.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/config.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/context.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/contextforge/LICENSE +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/contextforge/__init__.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/contextforge/text.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/contextforge/toolout.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/credentials.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/ctxstats.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/doctor.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/documents.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/dotnet.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/error_hints.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/errorlog.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/failures.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/friendly.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/frontmatter.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/hooks.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/keys.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/knowledge.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/licensing.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/llm/__init__.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/llm/anthropic.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/llm/base.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/llm/openai_compat.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/llm/setup.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/logo.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/markdown_view.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/memory.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/migration.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/modes.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/mvc5.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/osscache.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/ossgithub.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/pasteinput.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/pathfix.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/progress.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/project_setup.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/repl.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/repomap.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/rules.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/security_scan.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/sessions.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/skills.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/taskstate.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/textsafe.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tls.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/__init__.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/background.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/base.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/document.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/erie.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/fs.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/ignore.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/oss.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/pathfind.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/port.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/reuse.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/search.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/shell.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/skill.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/symbols.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/task.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/todo.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/web.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/tools/websearch.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/transcript.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/trust.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/ui.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/update_check.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/usage_view.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/version_info.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/src/euron_code/webforms.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/conftest.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/fake_providers.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/helpers.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/measure_floor.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/mock_gateway.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/serve_helper.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/sim_long_session.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_agent_mock.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_api_shell.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_bench.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_bench_harness.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_cli_e2e.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_context_memory_sessions.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_dashboard_fixes.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_dashboard_fixes_102.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_erie.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_knowledge_security.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_markdown_view.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_oss_local.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_permissions.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_powershell_exit_codes.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_qa_attach_secrets.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_qa_long_task.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_qa_print_output.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_qa_reuse_unrelated.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_qa_yolo_outside.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_repl.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_reuse_honesty.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_search.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_textsafe.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_tools_fs.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_transcript_ui.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_update_check.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v111_user_reports.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v113_fix_path.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v11_byo.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v11_speed.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v11_tool_fixes.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v130_cut_writes.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v130_reliability.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v140_parity.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v152_migration.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v153_user_errors.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v155_user_errors.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v156_autoupdate.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v156_paste_and_edits.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v157_zero_errors.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v15_hosted_models.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v160_stop_scope_atomic.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v161_residual_errors.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v170_v2.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v180_rescue_research_permissions.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v181_silent_failures_verified.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v2_rules_skills_hooks.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v2_tokens_shortcuts.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v2_usage_headers.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v31_security.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v3_accounts_value_setup.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v3_activity.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v3_attachments.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v3_context.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v3_live_repl.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v3_single_login.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v4.py +0 -0
- {euron_code-1.8.1 → euron_code-1.8.2}/tests/test_v5.py +0 -0
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.2 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- **Does what it says it will do.** When an answer ends with "Let me check the files." (or "abhi fix karta hoon")
|
|
6
|
+
but nothing was run, Euron Code now sends it straight back to do it, in the same request. Before, you had to ask
|
|
7
|
+
"done?" and often got the same promise again. A go-ahead such as "continue", "y" or "proceed" now gets full
|
|
8
|
+
thinking (only "thanks"-style replies get a short answer).
|
|
9
|
+
- **Tests for what you asked, written first.** In a project with tests, a request to fix or add behaviour now starts
|
|
10
|
+
with a test for that behaviour, taken from your request (expected results, error cases, edge cases), and the change
|
|
11
|
+
is done when the tests pass. If no test was written, Euron Code asks for one once before it finishes. When its own
|
|
12
|
+
new test stays red after a fix attempt, a stronger helper model can step in sooner. Turn it off with
|
|
13
|
+
`"behaviourTests": false`.
|
|
14
|
+
- **No more failed steps after a cut-off tool call.** A tool call that hit the output limit could leave half-written
|
|
15
|
+
arguments in the conversation, and the helper model then refused the whole request. Euron Code now keeps the
|
|
16
|
+
conversation valid.
|
|
17
|
+
- **Plan mode can look around.** Read-only commands (`git log`, `git show`, `git fetch`, `ls`, `grep`, versions) run
|
|
18
|
+
in plan mode; anything that changes files is still blocked.
|
|
19
|
+
- Small fixes: a shell call whose argument name came through as `parameter=command` now runs; asking for a database
|
|
20
|
+
that is not set up says how to connect it instead of failing again and again.
|
|
21
|
+
|
|
3
22
|
## 1.8.1 (2026-11-14)
|
|
4
23
|
|
|
5
24
|
- **Gets help sooner when it is quietly stuck.** When the same test keeps failing the same way after a fix
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: euron-code
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.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>
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "euron-code"
|
|
7
|
-
version = "1.8.
|
|
7
|
+
version = "1.8.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"
|
|
@@ -25,7 +25,7 @@ from euron_code.api import (BusyError, ContextTooLongError, EuronError, Interrup
|
|
|
25
25
|
NetworkError, RateLimitedError)
|
|
26
26
|
from euron_code.checkpoints import Checkpoints
|
|
27
27
|
from euron_code.keys import EscWatcher
|
|
28
|
-
from euron_code.permissions import Permissions, Request
|
|
28
|
+
from euron_code.permissions import Permissions, Request, is_read_only_command
|
|
29
29
|
from euron_code.sessions import SessionWriter
|
|
30
30
|
from euron_code.tools import ToolContext, ToolError, ToolResult, default_tools, read_only_tools
|
|
31
31
|
from euron_code.tools.base import ReadTracker, Savings
|
|
@@ -124,6 +124,71 @@ _BIG_RE = re.compile(
|
|
|
124
124
|
r"redesign|overhaul|audit|module|modules|project|application|website|everything|25|dont stop|don't stop)\b", re.I)
|
|
125
125
|
|
|
126
126
|
|
|
127
|
+
#: a follow-up that only acknowledges (no work asked): answered with little reasoning. "continue", "y", "proceed",
|
|
128
|
+
#: "do it" are go-aheads and keep the normal effort (1.8.2: prod 13 Nov, low effort after a go-ahead answered
|
|
129
|
+
#: "Let me read the files." and stopped without reading anything, again and again)
|
|
130
|
+
ACK_ONLY = re.compile(r"^(thanks?( you)?|thx|ty|great|perfect|nice|cool|looks good|lgtm|good)[.!\s]*$", re.IGNORECASE)
|
|
131
|
+
|
|
132
|
+
#: the last sentence of an answer that announces work instead of doing it ("Let me read the files:")
|
|
133
|
+
_ANNOUNCE_RE = re.compile(
|
|
134
|
+
r"^(?:ok(?:ay)?[,.!]?\s+|sure[,.!]?\s+|yes[,.!]?\s+|sorry[^.!]*[.!]\s+|now[,]?\s+|next[,]?\s+|first[,]?\s+|then[,]?\s+)*"
|
|
135
|
+
r"(?:let me|let's|i'll|i will|i'm going to|i am going to|i need to|i'm now|i am now|i'll now|i will now|"
|
|
136
|
+
r"now i'll|now i will|now let me|starting|reading|checking|running|fixing|creating|writing|updating|looking)\b",
|
|
137
|
+
re.IGNORECASE)
|
|
138
|
+
_ANNOUNCE_HI_RE = re.compile(
|
|
139
|
+
r"\b(karta|karti|padhta|padhti|dekhta|dekhti|chalata|chalati|likhta|likhti|banata|banati)\s+(hoon|hu|hun)\b|"
|
|
140
|
+
r"\b(kar|padh|dekh|chala|likh|bana)\s+(raha|rahi)\s+(hoon|hu|hun)\b", re.IGNORECASE)
|
|
141
|
+
_ASKS_USER_RE = re.compile(
|
|
142
|
+
r"\b(tell me|let me know|once you|when you|if you|want me|would you|shall i|should i|do you want|you can|"
|
|
143
|
+
r"you need|you'll need|your call|reply|confirm|batao|bataiye|bata do)\b", re.IGNORECASE)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def announces_action(text: str) -> bool:
|
|
147
|
+
"""True when a text-only answer ends by announcing a step it did not take ("Let me check both sites.",
|
|
148
|
+
"Abhi fix karta hoon - reading all files ek saath:"). Prod 13 Nov 2026: 73 of 399 tasks with a captured answer
|
|
149
|
+
(12 of 24 people) ended this way; the person then had to ask "ho gaya?", "did you check", "??"."""
|
|
150
|
+
t = (text or "").strip()
|
|
151
|
+
if not t or len(t) > 700:
|
|
152
|
+
return False # long answers are reports, not announcements
|
|
153
|
+
t = re.sub(r"[*_`#>]+", "", t).strip()
|
|
154
|
+
parts = [p.strip() for p in re.split(r"(?<=[.!?])\s+|\n+", t) if p.strip()]
|
|
155
|
+
if not parts:
|
|
156
|
+
return False
|
|
157
|
+
last = parts[-1]
|
|
158
|
+
if "?" in last or _ASKS_USER_RE.search(last):
|
|
159
|
+
return False # it asks the person something: a fine place to stop
|
|
160
|
+
if last.endswith(":"):
|
|
161
|
+
return True
|
|
162
|
+
return bool(_ANNOUNCE_RE.match(last) or _ANNOUNCE_HI_RE.search(last))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
#: test files: test_x.py, x_test.go, x.test.ts, x.spec.js, anything under tests/ or __tests__/
|
|
166
|
+
_TEST_PATH_RE = re.compile(r"(^|/)(tests?|__tests__|spec)/|(^|/)(test_[^/]*|[^/]*_test\.\w+|[^/]*\.(test|spec)\.\w+)$",
|
|
167
|
+
re.IGNORECASE)
|
|
168
|
+
#: requests where a new behaviour test does not apply: the tests are given, or it is UI / styling / ops / docs work
|
|
169
|
+
_NO_BEHAVIOUR_TEST_RE = re.compile(
|
|
170
|
+
r"(make|get) (all |the )?(\w+ )?tests? (to )?pass|do(n't| not) (edit|touch|change|modify) (the |any )?tests?|"
|
|
171
|
+
r"tests? (are|is) (given|provided|fixed)|no tests?\b|without tests?|"
|
|
172
|
+
r"failing tests?|tests? (are |is )?(failing|broken|red)|refactor|without changing (the |its |any )?behaviou?r|"
|
|
173
|
+
r"\b(css|scss|styl(e|es|ing)|design|ui|ux|layout|theme|colou?rs?|fonts?|spinner|animation|responsive|"
|
|
174
|
+
r"dockerfile|docker|readme|docs?|documentation|deploy|deployment|ci|pipeline|\.env|icons?|logo|images?)\b",
|
|
175
|
+
re.IGNORECASE)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def is_test_path(rel: str) -> bool:
|
|
179
|
+
return bool(_TEST_PATH_RE.search((rel or "").replace("\\", "/")))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def wants_behaviour_tests(text: str, tier: str) -> bool:
|
|
183
|
+
"""A code change whose behaviour a test can pin down (a fix, a feature, a rule): the agent writes the test from
|
|
184
|
+
the request first. Bench 2026-11-09/13: Euron's failures on hidden tests were a rule of the request missed while
|
|
185
|
+
its own checks passed."""
|
|
186
|
+
typed = re.sub(r"<attached-file\b[^>]*>.*?</attached-file>", " ", text or "", flags=re.S).strip()
|
|
187
|
+
if tier == "question" or not typed or not _CHANGE_RE.search(typed) or _NO_BEHAVIOUR_TEST_RE.search(typed):
|
|
188
|
+
return False
|
|
189
|
+
return len(typed) >= 25
|
|
190
|
+
|
|
191
|
+
|
|
127
192
|
def request_tier(text: str) -> str:
|
|
128
193
|
""""question", "small" or "large": how much budget a request gets, and whether it may change files."""
|
|
129
194
|
typed = re.sub(r"<attached-file\b[^>]*>.*?</attached-file>", " ", text or "", flags=re.S)
|
|
@@ -213,6 +278,57 @@ def repair_json(raw: str):
|
|
|
213
278
|
raise ValueError("not valid JSON")
|
|
214
279
|
|
|
215
280
|
|
|
281
|
+
_PATH_ARG_RE = re.compile(r'"(?:path|file_path|filePath)"\s*:\s*"((?:[^"\\]|\\.){1,400})"')
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _cut_stub(raw: str) -> str:
|
|
285
|
+
"""Valid JSON for a tool call the output limit cut off (it is not run). The cut text stayed in the history
|
|
286
|
+
before 1.8.2, and a provider that parses the history rejected the whole request (prod 13 Nov: the rescue model
|
|
287
|
+
answered 400 "Unterminated string starting at: line 1 column 13", so the step failed)."""
|
|
288
|
+
m = _PATH_ARG_RE.search(raw or "")
|
|
289
|
+
stub: Dict[str, Any] = {"_cut": "these arguments were cut off by the output limit; the call was not run"}
|
|
290
|
+
if m:
|
|
291
|
+
try:
|
|
292
|
+
stub = {"path": json.loads('"' + m.group(1) + '"'), **stub}
|
|
293
|
+
except ValueError:
|
|
294
|
+
pass
|
|
295
|
+
return json.dumps(stub)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def valid_history(messages: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
299
|
+
"""The messages with every assistant tool call's `arguments` as valid JSON (a copy only where needed). A model
|
|
300
|
+
can write broken JSON; the Euron model accepts it, but other providers (the rescue model, your own model) reject the request."""
|
|
301
|
+
out: Optional[List[Dict[str, Any]]] = None
|
|
302
|
+
for i, m in enumerate(messages):
|
|
303
|
+
calls = m.get("tool_calls") if m.get("role") == "assistant" else None
|
|
304
|
+
if not calls:
|
|
305
|
+
continue
|
|
306
|
+
fixed = None
|
|
307
|
+
for j, tc in enumerate(calls):
|
|
308
|
+
fn = (tc or {}).get("function") or {}
|
|
309
|
+
raw = fn.get("arguments")
|
|
310
|
+
if not isinstance(raw, str) or not raw.strip():
|
|
311
|
+
good = json.dumps(raw) if isinstance(raw, dict) else "{}"
|
|
312
|
+
else:
|
|
313
|
+
try:
|
|
314
|
+
json.loads(raw)
|
|
315
|
+
continue
|
|
316
|
+
except ValueError:
|
|
317
|
+
try:
|
|
318
|
+
val = repair_json(raw)
|
|
319
|
+
good = json.dumps(val if isinstance(val, dict) else {"value": val})
|
|
320
|
+
except ValueError:
|
|
321
|
+
good = _cut_stub(raw)
|
|
322
|
+
if fixed is None:
|
|
323
|
+
fixed = list(calls)
|
|
324
|
+
fixed[j] = {**fixed[j], "function": {**fn, "arguments": good}}
|
|
325
|
+
if fixed is not None:
|
|
326
|
+
if out is None:
|
|
327
|
+
out = list(messages)
|
|
328
|
+
out[i] = {**m, "tool_calls": fixed}
|
|
329
|
+
return messages if out is None else out
|
|
330
|
+
|
|
331
|
+
|
|
216
332
|
#: placeholder text a generated file must not keep when the user gave real details
|
|
217
333
|
PLACEHOLDER_RE = re.compile(r"Your Name|Lorem ipsum|example@example\.com|TODO: replace", re.I)
|
|
218
334
|
#: form hints such as placeholder="Your name" are correct UI text, not leftover template content
|
|
@@ -352,6 +468,11 @@ class Agent:
|
|
|
352
468
|
self._last_red: Dict[str, Tuple[str, int]] = {}
|
|
353
469
|
self._nodiff_red = 0
|
|
354
470
|
self._has_suite: Optional[bool] = None
|
|
471
|
+
self._has_tests: Optional[bool] = None
|
|
472
|
+
# 1.8.2: a code change a test can pin down: the test comes from the request first, and a red own test after
|
|
473
|
+
# a fix attempt is a model-shaped failure (the "passes its own checks, fails the hidden tests" gap)
|
|
474
|
+
self._behaviour = False
|
|
475
|
+
self._test_nudged = False
|
|
355
476
|
self.last_status: Optional[Dict[str, Any]] = None # the last task's decided status + evidence
|
|
356
477
|
self._job_diff = ""
|
|
357
478
|
self._adopt_fails = 0
|
|
@@ -576,6 +697,11 @@ class Agent:
|
|
|
576
697
|
resume_cp = self._job_for(user_text)
|
|
577
698
|
if resume_cp is not None and resume_cp.get("tier") in TIER_BUDGETS:
|
|
578
699
|
tier = resume_cp["tier"] if resume_cp["tier"] != "question" else "small"
|
|
700
|
+
follow_up = bool(SIMPLE_FOLLOWUP.match(user_text.strip())) or resume_cp is not None
|
|
701
|
+
if not follow_up:
|
|
702
|
+
self._behaviour = (self.settings.get("behaviourTests", True) is not False and self.mode != "economy"
|
|
703
|
+
and wants_behaviour_tests(user_text, tier) and self._project_has_tests())
|
|
704
|
+
self._test_nudged = False
|
|
579
705
|
self._tier = tier
|
|
580
706
|
self._checks = []
|
|
581
707
|
self._last_ok_action = ""
|
|
@@ -815,6 +941,9 @@ class Agent:
|
|
|
815
941
|
if not self.is_subagent:
|
|
816
942
|
text += self._build_context(user_text)
|
|
817
943
|
text += self._migration_context(user_text)
|
|
944
|
+
if (self._behaviour and self.permissions.mode != "plan" and not self._resumed
|
|
945
|
+
and not SIMPLE_FOLLOWUP.match(user_text.strip())):
|
|
946
|
+
text += "\n\n" + prompts.TEST_FIRST_NOTE
|
|
818
947
|
snap = self._small_project_snapshot() if len(self.messages) == 1 else ""
|
|
819
948
|
text += snap
|
|
820
949
|
if not snap and not self._resumed and not SIMPLE_FOLLOWUP.match(user_text.strip()) \
|
|
@@ -847,10 +976,11 @@ class Agent:
|
|
|
847
976
|
|
|
848
977
|
def _loop(self, max_turns: Optional[int], user_text: str) -> TurnResult:
|
|
849
978
|
self.cancel.clear()
|
|
850
|
-
self._turn_effort = "low" if
|
|
979
|
+
self._turn_effort = "low" if ACK_ONLY.match(user_text.strip()) and len(self.messages) > 2 else None
|
|
851
980
|
turns = 0
|
|
852
981
|
last_text = ""
|
|
853
982
|
stop_feedback = 0
|
|
983
|
+
act_nudges = 0 # 1.8.2: "Let me read the files." with no tool call: sent back to do it
|
|
854
984
|
step_budget = int(self.settings.get("maxStepsPerPrompt") or DEFAULT_STEP_BUDGET)
|
|
855
985
|
if not self.is_subagent and step_budget == DEFAULT_STEP_BUDGET: # a limit the person set always wins
|
|
856
986
|
base_steps = self.base_budget()[0]
|
|
@@ -973,6 +1103,16 @@ class Agent:
|
|
|
973
1103
|
stop_feedback += 1
|
|
974
1104
|
self._append({"role": "user", "content": feedback})
|
|
975
1105
|
continue
|
|
1106
|
+
if (act_nudges < 2 and not self.is_subagent and resp.finish_reason != "length"
|
|
1107
|
+
and self.settings.get("actNudge", True) is not False
|
|
1108
|
+
and announces_action(partial + resp.content)):
|
|
1109
|
+
# prod 13 Nov: 18% of answered tasks ended on "Let me check both sites." with nothing run; the
|
|
1110
|
+
# person had to ask "ho gaya?" / "did you check" (and often got the same announcement again)
|
|
1111
|
+
act_nudges += 1
|
|
1112
|
+
self._append({"role": "user", "content": prompts.ACT_NUDGE})
|
|
1113
|
+
self._effort_once = None
|
|
1114
|
+
self.ui.dim("(Euron Code said what it would do next but did not do it; asking it to do it now)")
|
|
1115
|
+
continue
|
|
976
1116
|
where = self._placeholders() if not self._placeholder_nudged and not self.is_subagent else ""
|
|
977
1117
|
if where:
|
|
978
1118
|
self._placeholder_nudged = True
|
|
@@ -1254,7 +1394,7 @@ class Agent:
|
|
|
1254
1394
|
max_tokens = max(min(OUTPUT_FLOOR, max(256, room)), min(self.max_output, room))
|
|
1255
1395
|
payload = {
|
|
1256
1396
|
"model": self.model,
|
|
1257
|
-
"messages": self.messages,
|
|
1397
|
+
"messages": valid_history(self.messages),
|
|
1258
1398
|
"tools": cap_tools(self.tool_schemas),
|
|
1259
1399
|
"tool_choice": getattr(self, "_tool_choice_once", None) or "auto",
|
|
1260
1400
|
"max_tokens": max_tokens,
|
|
@@ -2045,8 +2185,10 @@ class Agent:
|
|
|
2045
2185
|
saved += lines
|
|
2046
2186
|
continue
|
|
2047
2187
|
self._cut_calls[cid] = ("skip", prompts.CUT_WRITE_SKIPPED.format(path=path or "the file", kb=kb))
|
|
2188
|
+
fn["arguments"] = _cut_stub(raw)
|
|
2048
2189
|
continue
|
|
2049
2190
|
self._cut_calls[cid] = ("skip", prompts.CUT_TOOL_NUDGE)
|
|
2191
|
+
fn["arguments"] = _cut_stub(raw)
|
|
2050
2192
|
self._effort_once = "low" # the next step is mechanical: keep writing
|
|
2051
2193
|
return saved
|
|
2052
2194
|
|
|
@@ -2212,6 +2354,11 @@ class Agent:
|
|
|
2212
2354
|
return None
|
|
2213
2355
|
if all(_DOC_RE.search(rel) or _NO_BUILD_RE.search(rel) for rel in self.files_changed()):
|
|
2214
2356
|
return None # docs / notes / plain CSS / images only: nothing to build (1.8.0: no extra steps for these)
|
|
2357
|
+
if (self._behaviour and not self._test_nudged and not self._own_tests()
|
|
2358
|
+
and any(_SOURCE_RE.search(rel) and not _NO_BUILD_RE.search(rel) for rel in self.files_changed())):
|
|
2359
|
+
# the change has no test of the requested behaviour: one ask, then the usual check gate
|
|
2360
|
+
self._test_nudged = True
|
|
2361
|
+
return prompts.TEST_ADD_NUDGE
|
|
2215
2362
|
if self._verified():
|
|
2216
2363
|
return None
|
|
2217
2364
|
last_edit = self._last_edit_step()
|
|
@@ -2861,8 +3008,48 @@ class Agent:
|
|
|
2861
3008
|
edited_since = prev is not None and any(st > prev[1] for st, _ in self._real_edits())
|
|
2862
3009
|
if prev is not None and prev[0] == sig and edited_since:
|
|
2863
3010
|
self._signal = "compilation_failure" if cls == "compilation_failure" else "test_failure"
|
|
3011
|
+
elif prev is not None and self._own_red(content, prev[1]):
|
|
3012
|
+
# 1.8.2: a test the agent wrote for this request is still red after it changed the code: the failure
|
|
3013
|
+
# may look different each time, but the requested behaviour is still wrong
|
|
3014
|
+
self._signal = "test_failure"
|
|
2864
3015
|
self._last_red[key] = (sig, self.steps)
|
|
2865
3016
|
|
|
3017
|
+
def _own_tests(self) -> List[str]:
|
|
3018
|
+
"""Test files this request created or changed."""
|
|
3019
|
+
return [rel for rel in self.files_changed() if is_test_path(rel)]
|
|
3020
|
+
|
|
3021
|
+
def _own_red(self, content: str, since_step: int) -> bool:
|
|
3022
|
+
"""A red run names one of this request's own tests, and a non-test file changed since the last red run."""
|
|
3023
|
+
own = self._own_tests()
|
|
3024
|
+
if not own or not any(st > since_step and not is_test_path(rel) for st, rel in self._real_edits()):
|
|
3025
|
+
return False
|
|
3026
|
+
text = content or ""
|
|
3027
|
+
return any(Path(rel).name in text or Path(rel).stem in text for rel in own)
|
|
3028
|
+
|
|
3029
|
+
def _project_has_tests(self) -> bool:
|
|
3030
|
+
"""The project already has test FILES (a test script or a config alone is not enough: bench 2026-11-14, a
|
|
3031
|
+
fresh Express build with only `"test"` in package.json passed 2/2 on 1.8.1 and 0/2 with tests-first)."""
|
|
3032
|
+
if self._has_tests is None:
|
|
3033
|
+
found = False
|
|
3034
|
+
try:
|
|
3035
|
+
if not found:
|
|
3036
|
+
n = 0
|
|
3037
|
+
for p in self.root.rglob("*"):
|
|
3038
|
+
n += 1
|
|
3039
|
+
if n > 4000:
|
|
3040
|
+
break
|
|
3041
|
+
if any(part in ("node_modules", ".git", ".venv", "venv", "__pycache__") for part in p.parts):
|
|
3042
|
+
continue
|
|
3043
|
+
nm = p.name.lower()
|
|
3044
|
+
if p.is_file() and (re.match(r"test_.*\.py$|.*_test\.(py|go)$|.*\.(test|spec)\.[jt]sx?$", nm)
|
|
3045
|
+
or nm == "conftest.py"):
|
|
3046
|
+
found = True
|
|
3047
|
+
break
|
|
3048
|
+
except (OSError, ValueError):
|
|
3049
|
+
found = False
|
|
3050
|
+
self._has_tests = found
|
|
3051
|
+
return self._has_tests
|
|
3052
|
+
|
|
2866
3053
|
def _note_step_diff(self, edits_before: int) -> None:
|
|
2867
3054
|
"""Steps that change no file while the last check is red: three in a row is a stuck loop."""
|
|
2868
3055
|
red = bool(self._checks) and self._checks[-1][2] != 0
|
|
@@ -3022,7 +3209,9 @@ class Agent:
|
|
|
3022
3209
|
"owns it: do not edit it; mention it in your report.")
|
|
3023
3210
|
self.ui.tool_result(msg, is_error=True)
|
|
3024
3211
|
return "Error: " + msg, None
|
|
3025
|
-
if self.permissions.mode == "plan" and req.category in PLAN_BLOCKED
|
|
3212
|
+
if (self.permissions.mode == "plan" and req.category in PLAN_BLOCKED
|
|
3213
|
+
and not (req.category == "Bash" and name == "bash"
|
|
3214
|
+
and is_read_only_command(req.command or ""))):
|
|
3026
3215
|
msg = prompts.PLAN_MODE_BLOCKED.format(tool=name)
|
|
3027
3216
|
self.ui.tool_result("blocked: plan mode is on (Shift+Tab to change mode)", is_error=True)
|
|
3028
3217
|
return "Error: " + msg, None
|
|
@@ -231,6 +231,51 @@ def is_destructive(command: str) -> bool:
|
|
|
231
231
|
return any(rx.search(command) for rx in DESTRUCTIVE)
|
|
232
232
|
|
|
233
233
|
|
|
234
|
+
#: commands that only look (plan mode may run them; 1.8.2: "git fetch, then git show origin/x:plan.md" in plan mode
|
|
235
|
+
#: was refused as Bash, and the agent spent 24 steps guessing the file instead)
|
|
236
|
+
_READ_ONLY_HEADS = {
|
|
237
|
+
"ls", "dir", "pwd", "cat", "type", "head", "tail", "wc", "grep", "rg", "findstr", "tree", "stat", "file", "du",
|
|
238
|
+
"which", "where", "whoami", "echo", "get-childitem", "get-content", "gci", "gc", "select-string", "sls",
|
|
239
|
+
"get-location", "test-path", "resolve-path", "get-command",
|
|
240
|
+
}
|
|
241
|
+
_READ_ONLY_GIT = {"status", "log", "show", "diff", "fetch", "branch", "blame", "ls-files", "ls-tree", "rev-parse",
|
|
242
|
+
"remote", "describe", "shortlog", "grep", "tag", "cat-file"}
|
|
243
|
+
_VERSION_FLAGS = {"--version", "-v", "-V", "version"}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def is_read_only_command(command: str) -> bool:
|
|
247
|
+
"""True when every part of the command only reads: listings, file views, searches, git history, versions.
|
|
248
|
+
Redirects, substitutions and destructive commands never are."""
|
|
249
|
+
c = (command or "").strip()
|
|
250
|
+
if not c or _has_dangerous_shell_syntax(c) or is_destructive(c):
|
|
251
|
+
return False
|
|
252
|
+
for seg in _segments(c):
|
|
253
|
+
toks = _tokens(seg)
|
|
254
|
+
if not toks:
|
|
255
|
+
return False
|
|
256
|
+
head = os.path.basename(toks[0]).lower()
|
|
257
|
+
head = head[:-4] if head.endswith(".exe") else head
|
|
258
|
+
if head == "cd" and len(toks) <= 2:
|
|
259
|
+
continue
|
|
260
|
+
if head == "git":
|
|
261
|
+
rest = [t for t in toks[1:] if not t.startswith("-")]
|
|
262
|
+
if not rest or rest[0] not in _READ_ONLY_GIT:
|
|
263
|
+
return False
|
|
264
|
+
if rest[0] in ("branch", "tag", "remote") and len(rest) > 1 and rest[1] not in ("-v", "show", "list"):
|
|
265
|
+
return False # `git branch new`, `git tag v1`, `git remote add` change things
|
|
266
|
+
continue
|
|
267
|
+
if head == "find" and not any(t in ("-delete", "-exec", "-execdir", "-ok", "-fprint") for t in toks):
|
|
268
|
+
continue
|
|
269
|
+
if head in _READ_ONLY_HEADS:
|
|
270
|
+
continue
|
|
271
|
+
if len(toks) == 2 and toks[1] in _VERSION_FLAGS:
|
|
272
|
+
continue # `node -v`, `python --version`
|
|
273
|
+
if head in ("pip", "pip3", "npm", "pnpm", "yarn") and len(toks) >= 2 and toks[1] in ("list", "ls", "show", "view", "outdated", "freeze"):
|
|
274
|
+
continue
|
|
275
|
+
return False
|
|
276
|
+
return True
|
|
277
|
+
|
|
278
|
+
|
|
234
279
|
def _expand(token: str) -> str:
|
|
235
280
|
t = token.strip().strip('"').strip("'")
|
|
236
281
|
t = re.sub(r"(?i)\$env:USERPROFILE", os.path.expanduser("~").replace("\\", "/"), t)
|
|
@@ -143,6 +143,19 @@ CUT_WRITE_SKIPPED = ("The output limit cut this write_file of {path} off (about
|
|
|
143
143
|
"file).")
|
|
144
144
|
|
|
145
145
|
ANSWER_NUDGE = "Answer now, briefly, with what you have. Do not deliberate further."
|
|
146
|
+
ACT_NUDGE = ("[Euron Code: you said what you would do next, but your answer had no tool call, so nothing ran and the "
|
|
147
|
+
"user is still waiting. Do it now, in this step, with the tools (read, edit, run). Do not announce it "
|
|
148
|
+
"again. If something blocks you, say exactly what.]")
|
|
149
|
+
TEST_FIRST_NOTE = ("[Euron Code: this project has tests. Before you change the code, add or extend a test in the "
|
|
150
|
+
"project's test suite for the behaviour this request asks for. Take the expected results, names, "
|
|
151
|
+
"formats and error cases from the request text, not from the current code, and cover its edge "
|
|
152
|
+
"cases (empty, invalid, boundary input). Use the test framework, file style and module format the "
|
|
153
|
+
"project already uses; do not change package.json, configs or other files just to make a test "
|
|
154
|
+
"run. Then make the change and run the tests until they pass. Never weaken, skip or delete a "
|
|
155
|
+
"test to make it pass.]")
|
|
156
|
+
TEST_ADD_NUDGE = ("[Euron Code: before you finish, add a test for the behaviour the request asked for to the project's "
|
|
157
|
+
"test suite (expected results and error cases taken from the request text, not from your code), "
|
|
158
|
+
"and run the tests. Fix the code, not the test, if it fails.]")
|
|
146
159
|
EMPTY_NUDGE = ("Your last reply was empty. Reply to the user now: answer the request, or say briefly what "
|
|
147
160
|
"you did and what is left.")
|
|
148
161
|
|
|
@@ -180,11 +193,13 @@ def environment_block(root: Path, shell_kind: str) -> str:
|
|
|
180
193
|
)
|
|
181
194
|
|
|
182
195
|
|
|
183
|
-
PLAN_MODE_NOTE = ("[Plan mode is on: you can only read and search
|
|
196
|
+
PLAN_MODE_NOTE = ("[Plan mode is on: you can only read and search (read-only commands such as git log / git show / "
|
|
197
|
+
"ls / grep may run). Do not try to edit files or run other commands. "
|
|
184
198
|
"Explore what you need, then reply with a short numbered plan (files to change, what, how "
|
|
185
199
|
"to verify). The user leaves plan mode to let you carry it out.]")
|
|
186
200
|
|
|
187
|
-
PLAN_MODE_BLOCKED = ("Plan mode is on, so {tool} is not available
|
|
201
|
+
PLAN_MODE_BLOCKED = ("Plan mode is on, so this {tool} call is not available (only read-only commands run). Do not "
|
|
202
|
+
"retry it. Finish exploring with read-only "
|
|
188
203
|
"tools and present your plan; the user will leave plan mode when they want you to make changes.")
|
|
189
204
|
|
|
190
205
|
|
|
@@ -160,8 +160,15 @@ def resolve_connection(name: Optional[str], ctx: ToolContext) -> Connection:
|
|
|
160
160
|
if not p.is_file():
|
|
161
161
|
raise ToolError(f"SQLite file not found: {ctx.rel(p)}")
|
|
162
162
|
return Connection("sqlite", str(p), ctx.rel(p))
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
if not conns:
|
|
164
|
+
# prod 7-13 Nov: 15 people's agents called db_query("supabase") etc. with nothing set up, and retried
|
|
165
|
+
raise ToolError(f"No database is set up for Euron Code, so {name!r} cannot be queried with db_query. Do not "
|
|
166
|
+
"call db_query again in this task. Query it through the project's own code or CLI instead, "
|
|
167
|
+
"or tell the user they can connect it once with `euron config set db.connections."
|
|
168
|
+
f"{re.sub(r'[^A-Za-z0-9_-]+', '_', str(name))[:40] or 'main'} <connection string>` "
|
|
169
|
+
"(for Supabase / Postgres: the URI under Project Settings > Database).")
|
|
170
|
+
raise ToolError(f"Unknown database {name!r}. Configured: {', '.join(conns)}. Use one of those names, or the "
|
|
171
|
+
"user can add one with `euron config set db.connections.<name> <dsn>`.")
|
|
165
172
|
dsn = expand_env(str(raw))
|
|
166
173
|
low = dsn.lower()
|
|
167
174
|
if low.startswith("sqlite:"):
|
|
@@ -13,6 +13,7 @@ missing, and only for parameters the tool really has. Nothing is guessed beyond
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
15
|
import json
|
|
16
|
+
import re
|
|
16
17
|
from typing import Any, Dict, List, Optional
|
|
17
18
|
|
|
18
19
|
# canonical name -> other names models use for it
|
|
@@ -112,6 +113,33 @@ def _normalize_obj(args: Dict[str, Any], schema: Dict[str, Any]) -> Dict[str, An
|
|
|
112
113
|
return out
|
|
113
114
|
|
|
114
115
|
|
|
116
|
+
_XML_KEY = re.compile(r"^\s*<?\s*(?:parameter|param|arg|argument)\s*[=:]\s*([A-Za-z_][\w.-]*)\s*>?\s*$", re.I)
|
|
117
|
+
_XML_TAIL = re.compile(r"\s*</\s*(?:parameter|param|arg|argument)\s*>\s*(?:</\s*function\s*>\s*)?(?:</\s*tool_call\s*>\s*)?$", re.I)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _xml_param_keys(args: Dict[str, Any], props: Dict[str, Any]) -> Dict[str, Any]:
|
|
121
|
+
"""`{"parameter=command": "ls\\n</parameter>"}`: the XML tool-call format (`<parameter=command>`) leaked into a
|
|
122
|
+
JSON call's keys (prod 7-13 Nov: bash "Missing required parameter `command` (this call had: parameter=command)",
|
|
123
|
+
1.1.0 to 1.8.1). The key is the parameter's name, and the closing tag is not part of its value."""
|
|
124
|
+
if not any(_XML_KEY.match(str(k)) for k in args):
|
|
125
|
+
return args
|
|
126
|
+
out: Dict[str, Any] = {}
|
|
127
|
+
for k, v in args.items():
|
|
128
|
+
m = _XML_KEY.match(str(k))
|
|
129
|
+
if not m:
|
|
130
|
+
out[k] = v
|
|
131
|
+
continue
|
|
132
|
+
name = m.group(1)
|
|
133
|
+
if isinstance(v, str):
|
|
134
|
+
v = _XML_TAIL.sub("", v)
|
|
135
|
+
if v.startswith("\n"):
|
|
136
|
+
v = v[1:]
|
|
137
|
+
if name in args and args[name] not in (None, ""):
|
|
138
|
+
continue # the real key wins
|
|
139
|
+
out[name] = v
|
|
140
|
+
return out
|
|
141
|
+
|
|
142
|
+
|
|
115
143
|
def normalize_args(args: Dict[str, Any], schema: Optional[Dict[str, Any]]) -> Dict[str, Any]:
|
|
116
144
|
"""Return `args` with aliases mapped to the schema's names and values coerced to its types.
|
|
117
145
|
|
|
@@ -131,6 +159,7 @@ def normalize_args(args: Dict[str, Any], schema: Optional[Dict[str, Any]]) -> Di
|
|
|
131
159
|
pass
|
|
132
160
|
if isinstance(v, dict):
|
|
133
161
|
args = v
|
|
162
|
+
args = _xml_param_keys(args, props)
|
|
134
163
|
out = _normalize_obj(args, schema or {})
|
|
135
164
|
if "path" in props and "edits" in props and not out.get("path") and isinstance(out.get("edits"), list):
|
|
136
165
|
# multi_edit with the file named inside every edit instead of once (prod 1.1.x: 73 calls in 35 tasks,
|
|
@@ -100,5 +100,5 @@ def test_mask_dsn():
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
def test_unknown_connection(project):
|
|
103
|
-
with pytest.raises(ToolError, match="
|
|
103
|
+
with pytest.raises(ToolError, match="No database is set up.*Do not call db_query again"):
|
|
104
104
|
DbQuery().run({"action": "list_tables", "database": "prod"}, make_ctx(project))
|