euron-code 1.9.4__tar.gz → 1.10.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.9.4 → euron_code-1.10.1}/CHANGELOG.md +29 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/PKG-INFO +1 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/pyproject.toml +1 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/__init__.py +1 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/agent.py +206 -5
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/api.py +5 -0
- euron_code-1.10.1/src/euron_code/doi_guard.py +68 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/modes.py +4 -2
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/progress.py +35 -4
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/prompts.py +1 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/taskstate.py +1 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/__init__.py +2 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/base.py +4 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/citations.py +103 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/fs.py +15 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/transcript.py +1 -1
- euron_code-1.10.1/tests/test_v1100_finish_on_time.py +306 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v170_v2.py +1 -1
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v194_citations.py +59 -2
- {euron_code-1.9.4 → euron_code-1.10.1}/.gitignore +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/LICENSE +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/README.md +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/__main__.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/activity.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/attachments.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/auth.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/autoupdate.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/cache.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/checkpoints.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/cli.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/codeindex.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/config.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/context.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/contextforge/LICENSE +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/contextforge/__init__.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/contextforge/text.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/contextforge/toolout.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/credentials.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/ctxstats.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/doctor.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/documents.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/dotnet.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/error_hints.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/errorlog.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/failures.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/friendly.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/frontmatter.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/hooks.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/keys.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/knowledge.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/licensing.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/llm/__init__.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/llm/anthropic.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/llm/base.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/llm/openai_compat.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/llm/setup.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/logo.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/markdown_view.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/memory.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/migration.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/mvc5.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/osscache.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/ossgithub.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/pasteinput.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/pathfix.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/permissions.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/project_setup.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/repl.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/repomap.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/rules.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/security_scan.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/sessions.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/skills.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/textsafe.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tls.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/background.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/db.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/document.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/erie.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/ignore.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/normalize.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/oss.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/pagecheck.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/pathfind.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/port.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/reuse.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/search.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/shell.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/skill.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/symbols.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/task.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/template.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/todo.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/web.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/tools/websearch.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/trust.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/ui.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/update_check.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/usage_view.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/version_info.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/src/euron_code/webforms.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/conftest.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/fake_providers.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/helpers.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/measure_floor.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/mock_gateway.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/serve_helper.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/sim_long_session.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_agent_mock.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_api_shell.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_bench.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_bench_harness.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_cli_e2e.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_context_memory_sessions.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_dashboard_fixes.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_dashboard_fixes_102.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_db.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_erie.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_knowledge_security.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_markdown_view.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_oss_local.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_permissions.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_powershell_exit_codes.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_qa_attach_secrets.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_qa_long_task.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_qa_print_output.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_qa_reuse_unrelated.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_qa_yolo_outside.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_render_ghost.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_repl.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_reuse_honesty.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_search.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_textsafe.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_tools_fs.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_transcript_ui.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_update_check.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v111_user_reports.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v113_fix_path.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v11_byo.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v11_speed.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v11_tool_fixes.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v130_cut_writes.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v130_reliability.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v140_parity.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v152_migration.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v153_user_errors.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v155_user_errors.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v156_autoupdate.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v156_paste_and_edits.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v157_zero_errors.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v15_hosted_models.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v160_stop_scope_atomic.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v161_residual_errors.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v180_rescue_research_permissions.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v181_silent_failures_verified.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v182_zero_errors.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v184_selfupdate_pep668.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v186_bypass_and_waits.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v187_sleep_wake.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v188_typed_cli_commands.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v189_edit_partial.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v190_refund_fixes.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v191_page_assets.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v2_rules_skills_hooks.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v2_tokens_shortcuts.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v2_usage_headers.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v31_security.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v3_accounts_value_setup.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v3_activity.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v3_attachments.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v3_context.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v3_live_repl.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v3_single_login.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v4.py +0 -0
- {euron_code-1.9.4 → euron_code-1.10.1}/tests/test_v5.py +0 -0
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.10.1 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
- **audit_citations writes reference files and the data.** Next to the manuscript it now also writes RIS, BibTeX and EndNote files (found works with the database's values, the rest with their original text and status) and a JSON of every reference, so other deliverables are built from data instead of retyped references.
|
|
6
|
+
- **Citations in text you write are checked.** The rule now covers writing a review or a paper section: cite only checked works (audit_citations on a .md reference list), mark the rest [unverified], never invent DOIs, volumes or pages.
|
|
7
|
+
- **DOI guard.** After audit_citations or find_papers, every DOI written into a file is checked at doi.org; an unregistered DOI comes back as a warning to fix.
|
|
8
|
+
- **audit_citations is the first move for any reference job**, and its description says it does not use the web_search allowance.
|
|
9
|
+
|
|
10
|
+
## 1.10.0 (2026-11-23)
|
|
11
|
+
|
|
12
|
+
- **Long jobs keep going while they make progress.** In Euron Auto a request that is still changing files,
|
|
13
|
+
finishing its task list or turning a failing check green gets up to three more windows (was one) instead of
|
|
14
|
+
stopping at its step / time budget and waiting for you to type `continue`. A request that stops making progress
|
|
15
|
+
still stops, with the done / left list.
|
|
16
|
+
- **No more re-reading after a summary.** When a long conversation is summarised, the files Euron Code was working
|
|
17
|
+
on come back with the summary, current and counted as read, so it carries on editing instead of reading the same
|
|
18
|
+
files again (and instead of having its edits refused with "the conversation was summarised since you last saw
|
|
19
|
+
this file").
|
|
20
|
+
- A refused edit that comes back with the file's current text no longer counts as a failure: it cannot stop a job
|
|
21
|
+
as "not making progress", and it no longer undoes the other edits of the same step. Parallel edits of one step
|
|
22
|
+
that fail the same way count once, so a batch of edits cannot stop a job in a single step.
|
|
23
|
+
- `cat file`, `type file` and `Get-Content file` printing a whole file now count as reading it, like `read_file`.
|
|
24
|
+
- One step no longer reads a dozen whole files at once: past 40% of the room, further files of that step come back
|
|
25
|
+
as an outline (definitions with line numbers) to read in part, instead of filling the window and forcing a summary.
|
|
26
|
+
- A job stopped for repeated edit errors is no longer reported as "blocked by the environment" just because an
|
|
27
|
+
earlier check once failed on a missing package.
|
|
28
|
+
- When a page check fails while a server Euron Code started before its last change is still running (and does not
|
|
29
|
+
reload by itself), Euron Code is told to restart it first, instead of checking the old code again and again.
|
|
30
|
+
|
|
31
|
+
## 1.9.4 (2026-11-23, shipped in 1.10.0)
|
|
4
32
|
|
|
5
33
|
- **Word documents are read in full.** `read_document` now takes `range` for .docx (lines of the extracted text,
|
|
6
34
|
like a text file: `"201-400"`, `"400-"`); before, every read of a long Word file showed the same first ~6k tokens,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: euron-code
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.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.
|
|
7
|
+
version = "1.10.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"
|
|
@@ -58,7 +58,7 @@ MAX_TOOLS_PER_REQUEST = 128 # servers refuse more tool definitions than this in
|
|
|
58
58
|
CORE_TOOLS = ("read_file", "write_file", "edit_file", "multi_edit", "list_dir", "glob", "grep", "bash", "todo_write",
|
|
59
59
|
"task", "skill", "read_document", "find_symbol", "delete_file", "move_file", "start_background_process",
|
|
60
60
|
"read_process_output", "stop_process", "check_app", "fix_page_assets", "web_fetch", "web_search", "db_query", "port_page",
|
|
61
|
-
"create_mvc5_project", "audit_citations")
|
|
61
|
+
"create_mvc5_project", "audit_citations", "find_papers")
|
|
62
62
|
SESSION_IN_USE_WAIT = 3 # a 409 right after a restart is usually this computer's own previous session
|
|
63
63
|
FIT_TARGET = 0.8 # never send a prompt above 80% of the window (estimate); shrink the history first
|
|
64
64
|
# Compaction (1.1.0). Thresholds are fractions of the CONVERSATION room (usable window minus the fixed floor:
|
|
@@ -89,6 +89,18 @@ SUMMARY_REGROW = 0.25 # ... and only after the conversation grew again by this
|
|
|
89
89
|
SUMMARY_KEEP = 0.2 # the recent tail kept verbatim after a summary, as a share of the conversation room
|
|
90
90
|
SUMMARY_MAX_TOKENS = 900
|
|
91
91
|
AFTER_SUMMARY_MAX = 0.45 # after a summary the conversation must be under this share of its room
|
|
92
|
+
#: 1.10.0: the files the request was working on come back with the summary, current and counted as read.
|
|
93
|
+
#: Prod 16-23 Nov: 36% of tasks had a summary; they finished 41% of the time (1 summary) and 18% (2+), against 71%
|
|
94
|
+
#: without one. After every summary the model re-read the same files (51% of its tool calls were reads) and 361
|
|
95
|
+
#: edits were refused as "summarised since you last saw this file", which the stuck guard then counted as errors.
|
|
96
|
+
WORKING_SET_SHARE = 0.15 # at most this share of the conversation room, and never past AFTER_SUMMARY_MAX
|
|
97
|
+
WORKING_SET_FILES = 4
|
|
98
|
+
WORKING_SET_RECENT_STEPS = 10 # files edited or read within this many steps before the summary
|
|
99
|
+
WORKING_SET_WHOLE_LINES = 220 # a file up to this long comes back whole, a longer one as its last-read part
|
|
100
|
+
WORKING_SET_PART_LINES = 140
|
|
101
|
+
#: one step's reads in full stop at this share of the conversation room; later files of the step come back as an
|
|
102
|
+
#: outline (1.10.0: a step reading 12 files at once filled the 32k window, was summarised and read them all again)
|
|
103
|
+
STEP_READ_SHARE = 0.4
|
|
92
104
|
DENIED = "denied"
|
|
93
105
|
EFFORTS = ("low", "medium", "high")
|
|
94
106
|
OUTPUT_FLOOR = 1024 # never ask for fewer output tokens than this
|
|
@@ -112,6 +124,13 @@ DEFAULT_STEP_BUDGET = 60
|
|
|
112
124
|
MAX_MIGRATION_NUDGES = 2 # "these legacy files are not carried over yet" asks per request
|
|
113
125
|
HANDOVERS_PER_STEP = 2 # legacy pages pasted into one step's results (8 at once overflowed the 32k context)
|
|
114
126
|
_EXIT_RE = re.compile(r"^Exit code: (-?\d+)")
|
|
127
|
+
#: servers that pick up code changes by themselves (no restart needed after an edit)
|
|
128
|
+
_RELOADING_RE = re.compile(r"--reload|--watch|\bwatch\b|nodemon|\bdev\b|vite|next |artisan serve|php -S|ng serve|"
|
|
129
|
+
r"webpack serve|--debug|debug=true|ts-node-dev|live-server|http-server|http\.server", re.I)
|
|
130
|
+
#: a shell command that only prints one whole file (1.10.0)
|
|
131
|
+
_SHELL_READ_RE = re.compile(
|
|
132
|
+
r"^\s*(cat|type|get-content|gc)\s+(?:-(?:raw|path|encoding\s+\S+)\s+)*"
|
|
133
|
+
r"(?:\"([^\"|<>;&]+)\"|'([^'|<>;&]+)'|([^\s\"'|<>;&]+))(?:\s+-(?:raw|encoding\s+\S+))*\s*$", re.I)
|
|
115
134
|
#: changes with nothing to build or test: plain CSS, images, icons (1.8.0, no verify round trip for them)
|
|
116
135
|
_NO_BUILD_RE = re.compile(r"\.(css|svg|png|jpe?g|gif|webp|ico|woff2?|ttf|eot|map)$", re.I)
|
|
117
136
|
_DOC_RE = re.compile(r"(\.(md|txt|rst|adoc)$|^(LICENSE|NOTICE|THIRD_PARTY_NOTICES)|(^|/)\.euron/)", re.I)
|
|
@@ -1057,7 +1076,11 @@ class Agent:
|
|
|
1057
1076
|
"edits": bool(self._real_edits()), "verified": bool(self._real_edits()) and self._verified(),
|
|
1058
1077
|
"last_check": (last[1], last[2], last[3]) if last else None,
|
|
1059
1078
|
"checks_after_edit": bool(self._checks_after_edit()), "open_todos": len(self._open_todos()),
|
|
1060
|
-
"tier": self._tier, "budget_kind": self._budget_kind
|
|
1079
|
+
"tier": self._tier, "budget_kind": self._budget_kind,
|
|
1080
|
+
# 1.10.0: a stop for repeated edit errors is not "blocked by the environment" just because an
|
|
1081
|
+
# older check once failed on a missing package (prod 22 Nov)
|
|
1082
|
+
"stuck_on_check": (str(self._stuck or "").startswith("the same failure came back")
|
|
1083
|
+
or bool(self._checks and self._checks[-1][0] >= self.steps - 3))}
|
|
1061
1084
|
|
|
1062
1085
|
def _checkpoint(self, result: Optional[TurnResult], decided: Optional[Dict[str, Any]], final: bool) -> Dict[str, Any]:
|
|
1063
1086
|
steps, minutes = self.budget()
|
|
@@ -1285,6 +1308,9 @@ class Agent:
|
|
|
1285
1308
|
turns += 1
|
|
1286
1309
|
self.steps += 1
|
|
1287
1310
|
self.ctx.turn = self.steps
|
|
1311
|
+
self.ctx.step_read_used = 0 # 1.10.0: one step may not read more than a share of the room in full
|
|
1312
|
+
self.ctx.step_read_budget = (0 if self.settings.get("stepReadCap", True) is False else
|
|
1313
|
+
int(STEP_READ_SHARE * self.conversation_room() * context.CHARS_PER_TOKEN))
|
|
1288
1314
|
self._plan_effort(first_step=(turns == 1))
|
|
1289
1315
|
try:
|
|
1290
1316
|
self.maybe_compact()
|
|
@@ -1583,7 +1609,7 @@ class Agent:
|
|
|
1583
1609
|
def _may_extend(self, turns: int) -> bool:
|
|
1584
1610
|
"""A request at its budget line goes on (its mode's extra windows) only while the evidence says it is
|
|
1585
1611
|
getting somewhere: in the window since the last line, files changed or todo items were finished, and
|
|
1586
|
-
the latest check is not failing the same way again. Never for a question, never past
|
|
1612
|
+
the latest check is not failing the same way again. Never for a question, never past 2.5x the budget
|
|
1587
1613
|
(V2 phase 7: 348 of 3,235 tasks in 7 days stopped at the budget, many of them mid-way through work)."""
|
|
1588
1614
|
if (self.is_subagent or self._tier == "question" or self._extensions >= self.policy.extensions
|
|
1589
1615
|
or self._stuck or self.settings.get("taskStepBudget") == 0):
|
|
@@ -2532,6 +2558,7 @@ class Agent:
|
|
|
2532
2558
|
for p in req.paths:
|
|
2533
2559
|
rel = self.ctx.rel(p)
|
|
2534
2560
|
self.ledger["edits"].append((step, rel))
|
|
2561
|
+
self._last_edit_mono, self._last_edit_rel = time.monotonic(), rel
|
|
2535
2562
|
n = sum(1 for _, r in self.ledger["edits"] if r == rel)
|
|
2536
2563
|
cmds = self.ledger["commands"]
|
|
2537
2564
|
if (n == EDIT_THRASH_AT and cmds and cmds[-1][2] != 0 and not self.is_subagent
|
|
@@ -2546,11 +2573,56 @@ class Agent:
|
|
|
2546
2573
|
m = _EXIT_RE.match(content)
|
|
2547
2574
|
if m:
|
|
2548
2575
|
self.ledger["commands"].append((step, req.command or "", int(m.group(1))))
|
|
2576
|
+
if m.group(1) == "0":
|
|
2577
|
+
self._mark_shell_read(req.command or "", content)
|
|
2549
2578
|
elif name == "check_app":
|
|
2550
2579
|
# A passing HTTP / browser check of the running app is verification
|
|
2551
2580
|
# too (live 2026-11-05: the nudge asked to re-verify after check_app).
|
|
2552
2581
|
self.ledger["commands"].append((step, "check_app", 0))
|
|
2553
2582
|
|
|
2583
|
+
def _stale_server_note(self) -> str:
|
|
2584
|
+
"""A page check failed while a server Euron Code started BEFORE the last code change is still running and
|
|
2585
|
+
does not reload by itself (1.10.0 replay of "run this project": the app was fixed, but the old process kept
|
|
2586
|
+
answering 500 and six identical checks stopped the request as stuck)."""
|
|
2587
|
+
pm = getattr(self.ctx, "processes", None)
|
|
2588
|
+
edited = getattr(self, "_last_edit_mono", 0.0)
|
|
2589
|
+
if pm is None or not edited:
|
|
2590
|
+
return ""
|
|
2591
|
+
noted = self.__dict__.setdefault("_stale_noted", set())
|
|
2592
|
+
for p in pm.running():
|
|
2593
|
+
cmd = str(getattr(p, "command", "") or "")
|
|
2594
|
+
if p.started >= edited or _RELOADING_RE.search(cmd) or (p.id, edited) in noted:
|
|
2595
|
+
continue
|
|
2596
|
+
noted.add((p.id, edited))
|
|
2597
|
+
label = f"{p.name or p.id} (`{cmd[:60]}`)"
|
|
2598
|
+
return (f"[Euron Code: {label} was started before your last change ({getattr(self, '_last_edit_rel', '')}) "
|
|
2599
|
+
"and does not reload by itself, so it still runs the old code. Restart it (stop_process, then "
|
|
2600
|
+
"start_background_process) before you check the page again.]")
|
|
2601
|
+
return ""
|
|
2602
|
+
|
|
2603
|
+
def _mark_shell_read(self, command: str, content: str) -> None:
|
|
2604
|
+
"""`cat file` / `type file` / `Get-Content file` printed a whole file: it counts as read, like read_file
|
|
2605
|
+
(1.10.0: prod 22 Nov, the model re-read six files with cat after a summary, then all six edits were
|
|
2606
|
+
refused as "summarised since you last saw this file" and the job stopped as stuck)."""
|
|
2607
|
+
m = _SHELL_READ_RE.match(command or "")
|
|
2608
|
+
if not m or "output truncated" in content:
|
|
2609
|
+
return
|
|
2610
|
+
raw = (m.group(2) or m.group(3) or m.group(4) or "").strip()
|
|
2611
|
+
if not raw or any(ch in raw for ch in "*?$"):
|
|
2612
|
+
return
|
|
2613
|
+
try:
|
|
2614
|
+
base = Path(getattr(self.ctx.shell, "cwd", None) or self.root)
|
|
2615
|
+
p = Path(raw) if os.path.isabs(raw) else base / raw
|
|
2616
|
+
if not p.is_file():
|
|
2617
|
+
return
|
|
2618
|
+
size = p.stat().st_size
|
|
2619
|
+
if size > 200_000 or len(content) < 0.7 * size - 64:
|
|
2620
|
+
return
|
|
2621
|
+
from euron_code.tools.fs import TO_END
|
|
2622
|
+
self.ctx.tracker.mark_read(p, (1, TO_END), self.steps, len(content), self.ctx.call_id)
|
|
2623
|
+
except (OSError, ValueError):
|
|
2624
|
+
return
|
|
2625
|
+
|
|
2554
2626
|
# ---------------------------------------------------------- calls cut by the output limit
|
|
2555
2627
|
def _repair_cut_calls(self, resp: "Response") -> int:
|
|
2556
2628
|
"""The answer stopped at the output limit while writing its tool calls. Complete calls before the last
|
|
@@ -2628,8 +2700,12 @@ class Agent:
|
|
|
2628
2700
|
self._stall_files |= fresh
|
|
2629
2701
|
self._stall_s = 0.0
|
|
2630
2702
|
self._mark_progress()
|
|
2631
|
-
v = self.guard.tool_result(name, content, is_check=is_check)
|
|
2703
|
+
v = self.guard.tool_result(name, content, is_check=is_check, step=self.steps)
|
|
2632
2704
|
notes = [v.note] if v.note else []
|
|
2705
|
+
if name == "check_app" and failed:
|
|
2706
|
+
stale = self._stale_server_note()
|
|
2707
|
+
if stale:
|
|
2708
|
+
notes.append(stale)
|
|
2633
2709
|
if not failed and req is not None and req.category == "Edit" and name != "oss_adopt":
|
|
2634
2710
|
for p in req.paths[:4]:
|
|
2635
2711
|
try:
|
|
@@ -3740,7 +3816,8 @@ class Agent:
|
|
|
3740
3816
|
result = tool.run(args, self.ctx)
|
|
3741
3817
|
except ToolError as e:
|
|
3742
3818
|
result = ToolResult(str(e), is_error=True)
|
|
3743
|
-
|
|
3819
|
+
if not progress.handed_back(str(e)): # 1.10.0: a refusal with the current text undoes nothing else
|
|
3820
|
+
self._mark_step_failure()
|
|
3744
3821
|
from euron_code import errorlog
|
|
3745
3822
|
errorlog.report("tool", "tool_error", str(e), tool=name)
|
|
3746
3823
|
except KeyboardInterrupt:
|
|
@@ -3760,6 +3837,18 @@ class Agent:
|
|
|
3760
3837
|
undone = self._migration_guard(stash)
|
|
3761
3838
|
if undone:
|
|
3762
3839
|
result = ToolResult(undone, is_error=True)
|
|
3840
|
+
if name in ("audit_citations", "find_papers") and not result.is_error:
|
|
3841
|
+
self._citation_job = True
|
|
3842
|
+
elif (getattr(self, "_citation_job", False) and not result.is_error
|
|
3843
|
+
and name in ("write_file", "edit_file", "multi_edit")):
|
|
3844
|
+
# 1.10.1: a DOI written after a citation job must exist (doi_guard.py)
|
|
3845
|
+
from euron_code import doi_guard
|
|
3846
|
+
try:
|
|
3847
|
+
warn = doi_guard.warning_for(name, args)
|
|
3848
|
+
except Exception:
|
|
3849
|
+
warn = None
|
|
3850
|
+
if warn:
|
|
3851
|
+
result = ToolResult(f"{result.content}\n\n{warn}", is_error=False, preview=result.preview)
|
|
3763
3852
|
if name != "todo_write":
|
|
3764
3853
|
self.ui.tool_result(result.preview if result.preview is not None else result.content, result.is_error)
|
|
3765
3854
|
content = result.content
|
|
@@ -4047,6 +4136,7 @@ class Agent:
|
|
|
4047
4136
|
# the conversation as the model last saw it, before stage 1 edits old tool outputs in place:
|
|
4048
4137
|
# a summary asked at its end reuses the GPU prefix cache (stage 1 replaces messages by index)
|
|
4049
4138
|
sent = list(self.messages)
|
|
4139
|
+
recent_reads = self._recent_reads() # before stage 1 forgets them: the working set after a summary
|
|
4050
4140
|
# stage 1: drop bulky old tool outputs
|
|
4051
4141
|
if not manual:
|
|
4052
4142
|
self._supersede_stale_reads()
|
|
@@ -4170,6 +4260,7 @@ class Agent:
|
|
|
4170
4260
|
head += "\n\nContinue the task from where the work below left off."
|
|
4171
4261
|
self.messages = [self.messages[0], {"role": "user", "content": head}] + recent
|
|
4172
4262
|
self.ctx.tracker.clear(stale=True) # every file must be seen again before it is changed (1.6.0)
|
|
4263
|
+
self._attach_working_set(recent_reads, room, target) # ... except the ones that come back now (1.10.0)
|
|
4173
4264
|
self.rules.reset()
|
|
4174
4265
|
self.checkpoints.forget_positions() # message indices are stale after a summary
|
|
4175
4266
|
self._persist_compaction()
|
|
@@ -4188,6 +4279,116 @@ class Agent:
|
|
|
4188
4279
|
self.ui.dim(f"Compacted: {before} -> {after} tokens (estimated).")
|
|
4189
4280
|
return True
|
|
4190
4281
|
|
|
4282
|
+
def _recent_reads(self, within: int = WORKING_SET_RECENT_STEPS) -> Dict[str, Tuple[Path, int, int, int]]:
|
|
4283
|
+
"""Files whose text the model saw in the last `within` steps: key -> (path, offset, limit, step)."""
|
|
4284
|
+
out: Dict[str, Tuple[Path, int, int, int]] = {}
|
|
4285
|
+
floor = self.steps - within
|
|
4286
|
+
for key, rec in list(self.ctx.tracker.files.items()):
|
|
4287
|
+
for r in rec.ranges:
|
|
4288
|
+
t = max(r.turn, getattr(r, "seen", 0) or 0)
|
|
4289
|
+
if t >= floor and (key not in out or t > out[key][3]):
|
|
4290
|
+
out[key] = (Path(key), r.offset, r.limit, t)
|
|
4291
|
+
return out
|
|
4292
|
+
|
|
4293
|
+
def _working_set(self, reads: Dict[str, Tuple[Path, int, int, int]], budget_chars: int
|
|
4294
|
+
) -> Tuple[str, List[Tuple[Path, Tuple[int, int], int]]]:
|
|
4295
|
+
"""The current text of the files this request was working on (edited or read in the last steps), most
|
|
4296
|
+
recent first, within `budget_chars`: small files whole, a longer one as the part read last. Returns the
|
|
4297
|
+
block for the post-summary message and the (path, range, chars) to mark as read."""
|
|
4298
|
+
from euron_code.tools.fs import TO_END, load_text
|
|
4299
|
+
floor = self.steps - WORKING_SET_RECENT_STEPS
|
|
4300
|
+
cands: List[Tuple[int, Path, Optional[Tuple[int, int]]]] = []
|
|
4301
|
+
for st, rel in self._real_edits():
|
|
4302
|
+
if st >= floor:
|
|
4303
|
+
p = Path(rel) if os.path.isabs(rel) else self.root / rel
|
|
4304
|
+
cands.append((st + 1000, p, None)) # edited files first: they are what the next step changes
|
|
4305
|
+
for _key, (p, off, lim, turn) in reads.items():
|
|
4306
|
+
cands.append((turn, p, (off, lim)))
|
|
4307
|
+
cands.sort(key=lambda c: -c[0])
|
|
4308
|
+
seen: set = set()
|
|
4309
|
+
parts: List[str] = []
|
|
4310
|
+
marks: List[Tuple[Path, Tuple[int, int], int]] = []
|
|
4311
|
+
used = 0
|
|
4312
|
+
for _rank, p, rng in cands:
|
|
4313
|
+
if len(marks) >= WORKING_SET_FILES:
|
|
4314
|
+
break
|
|
4315
|
+
try:
|
|
4316
|
+
key = self.ctx.tracker._key(p)
|
|
4317
|
+
if key in seen or not p.is_file() or p.stat().st_size > 400_000:
|
|
4318
|
+
continue
|
|
4319
|
+
seen.add(key)
|
|
4320
|
+
if rng is None: # an edited file: its last-read part if it was read, else the whole (small) file
|
|
4321
|
+
r = reads.get(key)
|
|
4322
|
+
rng = (r[1], r[2]) if r else (1, TO_END)
|
|
4323
|
+
lines = load_text(p).text.replace("\r\n", "\n").split("\n")
|
|
4324
|
+
except (OSError, ToolError, ValueError):
|
|
4325
|
+
continue
|
|
4326
|
+
if lines and lines[-1] == "":
|
|
4327
|
+
lines.pop()
|
|
4328
|
+
n = len(lines)
|
|
4329
|
+
if not n:
|
|
4330
|
+
continue
|
|
4331
|
+
if n <= WORKING_SET_WHOLE_LINES:
|
|
4332
|
+
a, b = 1, n
|
|
4333
|
+
else:
|
|
4334
|
+
a = max(1, min(rng[0], n))
|
|
4335
|
+
b = min(n, a + min(rng[1], WORKING_SET_PART_LINES) - 1)
|
|
4336
|
+
rows = [f"{i:>6}\t{ln[:400]}" for i, ln in enumerate(lines[a - 1:b], start=a)]
|
|
4337
|
+
room_left = budget_chars - used - 120
|
|
4338
|
+
size = sum(len(r) + 1 for r in rows)
|
|
4339
|
+
while rows and size > room_left: # too long for what is left: keep the first lines that fit
|
|
4340
|
+
size -= len(rows.pop()) + 1
|
|
4341
|
+
if len(rows) < min(30, b - a + 1):
|
|
4342
|
+
continue # too little of it would fit; a smaller file further down may still fit
|
|
4343
|
+
b = a + len(rows) - 1
|
|
4344
|
+
head = (f"--- {self.ctx.rel(p)} " + ("(whole file" if (a, b) == (1, n) else f"(lines {a}-{b} of {n}")
|
|
4345
|
+
+ ", current text) ---")
|
|
4346
|
+
text = head + "\n" + "\n".join(rows)
|
|
4347
|
+
parts.append(text)
|
|
4348
|
+
used += len(text)
|
|
4349
|
+
marks.append((p, (a, TO_END if b >= n else b - a + 1), len(text)))
|
|
4350
|
+
if not parts:
|
|
4351
|
+
return "", []
|
|
4352
|
+
block = ("\n\n[Current text of the files you were working on: these count as read, so edit them from this "
|
|
4353
|
+
"text without reading them again (line numbers are not part of the files). Read any other file "
|
|
4354
|
+
"again before you change it.]\n" + "\n\n".join(parts))
|
|
4355
|
+
return block, marks
|
|
4356
|
+
|
|
4357
|
+
def _attach_working_set(self, reads: Dict[str, Tuple[Path, int, int, int]], room: int, target: int) -> None:
|
|
4358
|
+
"""After a summary: put the working set into the summary message (1.10.0), within the post-summary target
|
|
4359
|
+
so the next step is not summarised again at once."""
|
|
4360
|
+
if self.settings.get("summaryWorkingSet", True) is False or len(self.messages) < 2:
|
|
4361
|
+
return
|
|
4362
|
+
try:
|
|
4363
|
+
budget_tok = min(int(WORKING_SET_SHARE * room), target - self.context_usage() - 300)
|
|
4364
|
+
if budget_tok < 400:
|
|
4365
|
+
return
|
|
4366
|
+
block, marks = self._working_set(reads, int(budget_tok * context.CHARS_PER_TOKEN))
|
|
4367
|
+
if not block:
|
|
4368
|
+
return
|
|
4369
|
+
m = dict(self.messages[1])
|
|
4370
|
+
c = m.get("content")
|
|
4371
|
+
if isinstance(c, list):
|
|
4372
|
+
items = [dict(x) for x in c]
|
|
4373
|
+
for x in items:
|
|
4374
|
+
if x.get("type") == "text":
|
|
4375
|
+
x["text"] = str(x.get("text") or "") + block
|
|
4376
|
+
break
|
|
4377
|
+
else:
|
|
4378
|
+
items.insert(0, {"type": "text", "text": block})
|
|
4379
|
+
m["content"] = items
|
|
4380
|
+
else:
|
|
4381
|
+
m["content"] = str(c or "") + block
|
|
4382
|
+
self.messages[1] = m
|
|
4383
|
+
for p, rng, chars in marks:
|
|
4384
|
+
try:
|
|
4385
|
+
self.ctx.tracker.mark_read(p, rng, self.steps, chars, None)
|
|
4386
|
+
except OSError:
|
|
4387
|
+
pass
|
|
4388
|
+
self._working_set_files = [self.ctx.rel(p) for p, _, _ in marks]
|
|
4389
|
+
except Exception: # never let a convenience break a summary
|
|
4390
|
+
return
|
|
4391
|
+
|
|
4191
4392
|
def _seen_paths(self, limit: int = 40) -> List[str]:
|
|
4192
4393
|
out: List[str] = []
|
|
4193
4394
|
for key in reversed(self.ctx.tracker.known_paths()):
|
|
@@ -625,6 +625,11 @@ class Client:
|
|
|
625
625
|
body = {"fileName": file_name, "fileBase64": base64.b64encode(data).decode("ascii"), "claims": bool(claims)}
|
|
626
626
|
return self._json("POST", "/v1/citations/audit", json=body, headers=self._service_headers(), timeout=120.0)
|
|
627
627
|
|
|
628
|
+
def citations_search(self, query: str, rows: int = 8) -> Dict[str, Any]:
|
|
629
|
+
"""POST /v1/citations/search (1.10.1): real papers for a topic (Crossref + PubMed) with DOIs."""
|
|
630
|
+
return self._json("POST", "/v1/citations/search", json={"query": query, "rows": int(rows)},
|
|
631
|
+
headers=self._service_headers(), timeout=60.0)
|
|
632
|
+
|
|
628
633
|
def citations_audit_status(self, job_id: str) -> Dict[str, Any]:
|
|
629
634
|
"""GET /v1/citations/audit/<jobId>: the job's stage, and when done its results and exports."""
|
|
630
635
|
from urllib.parse import quote
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""DOI guard (1.10.1): after a citation job, a DOI written into a file must exist.
|
|
2
|
+
|
|
3
|
+
The acceptance replay of ticket 6316814e showed the model typing replacement DOIs that do not exist (two of
|
|
4
|
+
four in one run). When the session has used audit_citations or find_papers, every DOI in text the agent
|
|
5
|
+
writes (write_file, edit_file, multi_edit) is checked at doi.org's handle API; a DOI that is not registered
|
|
6
|
+
comes back to the model as a warning on the tool result, so it fixes or marks the reference [unverified]
|
|
7
|
+
before finishing. Network trouble never blocks a write (unknown = not reported).
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import re
|
|
14
|
+
import urllib.parse
|
|
15
|
+
import urllib.request
|
|
16
|
+
from typing import Dict, Iterable, List, Optional
|
|
17
|
+
|
|
18
|
+
DOI_RE = re.compile(r"\b10\.\d{4,9}/[^\s\"'<>{}\]\)|,;]+")
|
|
19
|
+
_cache: Dict[str, Optional[bool]] = {}
|
|
20
|
+
MAX_CHECKS = 30
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def dois_in(texts: Iterable[str]) -> List[str]:
|
|
24
|
+
out: List[str] = []
|
|
25
|
+
for t in texts:
|
|
26
|
+
for m in DOI_RE.findall(t or ""):
|
|
27
|
+
d = m.rstrip(".,;:").lower()
|
|
28
|
+
if d not in out:
|
|
29
|
+
out.append(d)
|
|
30
|
+
return out
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def registered(doi: str, timeout: float = 4.0) -> Optional[bool]:
|
|
34
|
+
"""True/False from doi.org; None when it could not be asked."""
|
|
35
|
+
if doi in _cache:
|
|
36
|
+
return _cache[doi]
|
|
37
|
+
try:
|
|
38
|
+
req = urllib.request.Request("https://doi.org/api/handles/" + urllib.parse.quote(doi),
|
|
39
|
+
headers={"User-Agent": "euron-code-doi-guard (mailto:contact@euron.one)"})
|
|
40
|
+
with urllib.request.urlopen(req, timeout=timeout) as r: # noqa: S310 (fixed https host)
|
|
41
|
+
code = json.loads(r.read().decode("utf-8")).get("responseCode")
|
|
42
|
+
ok: Optional[bool] = True if code == 1 else False if code == 100 else None
|
|
43
|
+
except Exception as e: # 404 means not registered; anything else is unknown
|
|
44
|
+
ok = False if "404" in str(e) else None
|
|
45
|
+
_cache[doi] = ok
|
|
46
|
+
return ok
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def written_text(name: str, args: dict) -> List[str]:
|
|
50
|
+
if name == "write_file":
|
|
51
|
+
return [str(args.get("content") or "")]
|
|
52
|
+
if name == "edit_file":
|
|
53
|
+
return [str(args.get("new_string") or "")]
|
|
54
|
+
if name == "multi_edit":
|
|
55
|
+
return [str(e.get("new_string") or "") for e in (args.get("edits") or []) if isinstance(e, dict)]
|
|
56
|
+
return []
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def warning_for(name: str, args: dict, check=registered) -> Optional[str]:
|
|
60
|
+
dois = dois_in(written_text(name, args))[:MAX_CHECKS]
|
|
61
|
+
bad = [d for d in dois if check(d) is False]
|
|
62
|
+
if not bad:
|
|
63
|
+
return None
|
|
64
|
+
return ("WARNING (Euron citation check): these DOIs are not registered at doi.org, so they point to no paper: "
|
|
65
|
+
+ ", ".join(bad[:10]) + ". Do not present them as working references. If a DOI is quoted from the "
|
|
66
|
+
"user's original manuscript, keep it inside the original text and mark that reference [unverified]. "
|
|
67
|
+
"For a replacement, use only a DOI from audit_citations (suggestedReplacements / matched) or find_papers "
|
|
68
|
+
"results, copied exactly; never type or edit a DOI. Fix the file now.")
|
|
@@ -31,8 +31,10 @@ class Policy:
|
|
|
31
31
|
|
|
32
32
|
POLICIES: Dict[str, Policy] = {
|
|
33
33
|
# Auto = Balanced with progress-aware extensions: a job that keeps finishing items or fixing checks goes on
|
|
34
|
-
# instead of stopping at the line (7 days to 13 Nov: 348 of 3,235 tasks stopped by budget)
|
|
35
|
-
|
|
34
|
+
# instead of stopping at the line (7 days to 13 Nov: 348 of 3,235 tasks stopped by budget). 1.10.0: up to 3
|
|
35
|
+
# windows, each only while the last one changed files, finished todos or fixed a check (16-23 Nov: 242 tasks
|
|
36
|
+
# stopped at the budget, 199 of them with files changed, and 242 "continue" resumes typed by 27 people)
|
|
37
|
+
"auto": Policy(1.0, 3, 2, None, False, "picks the effort per request; the default"),
|
|
36
38
|
"economy": Policy(0.6, 0, 1, "low", False, "fewer steps and less thinking, for routine changes"),
|
|
37
39
|
"balanced": Policy(1.0, 0, 2, None, False, "a fixed budget per request, no extensions"),
|
|
38
40
|
"advanced": Policy(1.5, 2, 3, "high", True, "more steps, more checks and more careful planning, same model"),
|
|
@@ -26,6 +26,7 @@ CHECK_SAME_FAIL_NOTE = 3 # the same build / test failure after a change, this m
|
|
|
26
26
|
CHECK_SAME_FAIL_STOP = 6 # ... and this many: stop
|
|
27
27
|
REVERT_NOTE_AT = 1 # a file edited back to a state it already had (A -> B -> A)
|
|
28
28
|
REVERT_STOP_AT = 3
|
|
29
|
+
PER_STEP_STREAK = 3 # parallel failures of one step add at most this much to the failure streak (1.10.0)
|
|
29
30
|
|
|
30
31
|
_ERRORISH = re.compile(r"(error|Error|ERROR|ERR!|failed|FAILED|Traceback|Exception|not found|Cannot find|"
|
|
31
32
|
r"cannot find|No module named|is not recognized|undefined|Unexpected)")
|
|
@@ -50,6 +51,15 @@ def failed_result(content: str) -> bool:
|
|
|
50
51
|
not content.startswith("Exit code: 0"))
|
|
51
52
|
|
|
52
53
|
|
|
54
|
+
#: refusals that carry the file's current text (the retry works from it): never counted as a repeated error
|
|
55
|
+
_HANDED_BACK = re.compile(r"was not changed: the conversation was summari[sz]ed since you last saw this file|"
|
|
56
|
+
r"Its current content is below; retry the edit against it")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def handed_back(content: str) -> bool:
|
|
60
|
+
return bool(_HANDED_BACK.search((content or "")[:2000]))
|
|
61
|
+
|
|
62
|
+
|
|
53
63
|
def error_signature(content: str) -> str:
|
|
54
64
|
"""What makes two failures "the same": for a command, its last error-looking output line (the first line is
|
|
55
65
|
just "Exit code: 1" for every failing command); for a tool error, its first line. Paths, quoted names and
|
|
@@ -81,6 +91,8 @@ class ProgressGuard:
|
|
|
81
91
|
check_fails: Dict[str, int] = field(default_factory=dict)
|
|
82
92
|
history: Dict[str, List[str]] = field(default_factory=dict) # file -> content digests, oldest first
|
|
83
93
|
reverts: int = 0
|
|
94
|
+
step_fails: Dict[int, int] = field(default_factory=dict) # failed results in the current step
|
|
95
|
+
sig_step: Dict[str, int] = field(default_factory=dict) # the step a failure signature was last counted in
|
|
84
96
|
notes: int = 0
|
|
85
97
|
stopped: str = ""
|
|
86
98
|
_noted: set = field(default_factory=set)
|
|
@@ -89,15 +101,34 @@ class ProgressGuard:
|
|
|
89
101
|
self.__init__() # type: ignore[misc]
|
|
90
102
|
|
|
91
103
|
# ------------------------------------------------------------------ feeds
|
|
92
|
-
def tool_result(self, name: str, content: str, is_check: bool = False) -> Verdict:
|
|
93
|
-
"""One tool result. `is_check`: a build / test / run command (its failures are compared by output).
|
|
104
|
+
def tool_result(self, name: str, content: str, is_check: bool = False, step: Optional[int] = None) -> Verdict:
|
|
105
|
+
"""One tool result. `is_check`: a build / test / run command (its failures are compared by output). `step`:
|
|
106
|
+
the model step it belongs to; parallel calls of ONE step that fail the same way count once (1.10.0 replay: nine
|
|
107
|
+
parallel edits after a summary, six "old_string was not found" in a single step, stopped the job at step 9)
|
|
108
|
+
and add at most PER_STEP_STREAK to the failure streak."""
|
|
94
109
|
failed = failed_result(content)
|
|
95
110
|
if not failed:
|
|
96
111
|
self.fail_streak = 0
|
|
97
112
|
return Verdict()
|
|
98
|
-
|
|
113
|
+
if handed_back(content):
|
|
114
|
+
# 1.10.0: a refusal that hands the model the file's current text is a protocol step, not a failure (prod
|
|
115
|
+
# 22 Nov: six edits refused at once after a summary stopped a progressing job as "stuck" and it was
|
|
116
|
+
# reported as blocked by the environment)
|
|
117
|
+
return Verdict()
|
|
99
118
|
sig = error_signature(content)
|
|
100
|
-
|
|
119
|
+
if step is None:
|
|
120
|
+
self.fail_streak += 1
|
|
121
|
+
n = self.errors[sig] = self.errors.get(sig, 0) + 1
|
|
122
|
+
else:
|
|
123
|
+
k = self.step_fails.get(step, 0)
|
|
124
|
+
self.step_fails = {step: k + 1} # only the current step is ever needed
|
|
125
|
+
if k < PER_STEP_STREAK:
|
|
126
|
+
self.fail_streak += 1
|
|
127
|
+
if self.sig_step.get(sig) == step:
|
|
128
|
+
n = self.errors.get(sig, 0) # the same failure again in the same step: already counted
|
|
129
|
+
else:
|
|
130
|
+
self.sig_step[sig] = step
|
|
131
|
+
n = self.errors[sig] = self.errors.get(sig, 0) + 1
|
|
101
132
|
v = Verdict()
|
|
102
133
|
if is_check:
|
|
103
134
|
c = self.check_fails[sig] = self.check_fails.get(sig, 0) + 1
|
|
@@ -30,7 +30,7 @@ CORE = """You are Euron Code, an AI coding agent that works inside the user's pr
|
|
|
30
30
|
- Big task (5 or more distinct steps): first a short numbered plan with todo_write, then do it, one item in_progress at a time, marking items completed as you go; update it in the same step as your next tool call, never as a step of its own. Stop when the list is done.
|
|
31
31
|
- Independent parts of a big build (for example a Dockerfile and a training script) can go to sub-agents: call task several times in one step (up to 3 run at once), each with mode "write" and its own `paths`. Not for a small app of a few files (HTML/CSS/JS, one script): write those yourself, in parts.
|
|
32
32
|
- Building a new app in an empty folder: you may call find_reusable once (1-8 components). Not for existing projects, small edits, bug fixes or questions.
|
|
33
|
-
- Citations and references: to audit or verify the references of a manuscript, call audit_citations once for the whole file; never web_search references one by one. A reference that is not found is unverified, never fabricated: only the status CONFIRMED_FABRICATION from audit_citations means fabricated. Never invent replacement references, authors or DOIs, and never write placeholders such as "[Original ref 1]" where the original citation text belongs; copy it from the file. If a document could not be read in full (for example its references section was never reached), say so and stop instead of auditing it.
|
|
33
|
+
- Citations and references: to audit or verify the references of a manuscript, call audit_citations once for the whole file; never web_search references one by one. A reference that is not found is unverified, never fabricated: only the status CONFIRMED_FABRICATION from audit_citations means fabricated. Never invent replacement references, authors or DOIs, and never write placeholders such as "[Original ref 1]" where the original citation text belongs; copy it from the file. If a document could not be read in full (for example its references section was never reached), say so and stop instead of auditing it. When you WRITE text with citations (a review, a paper section, a thesis chapter), find papers with find_papers (never guess DOIs) and cite only works you have checked: put the reference list in a .md file and run audit_citations on it (it does not use the web_search allowance), mark anything it does not return as VERIFIED as [unverified], and never invent authors, years, DOIs, volumes or page numbers.
|
|
34
34
|
- Use the details the user gave (name, photo, email, links) exactly; never leave placeholders like "Your Name" or Lorem ipsum.
|
|
35
35
|
- Reuse with care: your own scaffold is always the base. Reuse a reference file only when it does the same job in the same language and framework, is small, and you can see it is correct; copy the smallest set of files with oss_adopt (it keeps the licence header) and adapt them, or record hand adaptations with add_third_party_notice. Never clone or copy a whole repository, and never pull in a reference's dependencies or build setup. If adopted code does not build after two fixes, delete it and write that part yourself. Skip reuse for ordinary app code; cite sources in your summary. At most about 3 searches and 5 reads.
|
|
36
36
|
- For UI: use the component system the project already has; otherwise adapt a permissive kit you found. Copy layout and structure, then adapt; do not hand-write CSS from scratch.
|
|
@@ -266,7 +266,7 @@ def decide_status(ev: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
266
266
|
out.update(status="budget_exhausted", failureClass="budget_exhaustion", limitHit="task")
|
|
267
267
|
return out
|
|
268
268
|
if stop in ("loop", "stuck"):
|
|
269
|
-
if failures.blocks(last_cls) == "env":
|
|
269
|
+
if failures.blocks(last_cls) == "env" and ev.get("stuck_on_check", True):
|
|
270
270
|
out.update(status="blocked_env", failureClass=last_cls)
|
|
271
271
|
else:
|
|
272
272
|
out.update(status="partial" if edits else "failed", failureClass="stuck_loop")
|
|
@@ -7,7 +7,7 @@ from typing import Any, Dict, List, Optional
|
|
|
7
7
|
|
|
8
8
|
from euron_code.tools.base import Tool, ToolContext, ToolError, ToolResult, truncate
|
|
9
9
|
from euron_code.tools.background import CheckApp, ReadProcessOutput, StartBackgroundProcess, StopProcess
|
|
10
|
-
from euron_code.tools.citations import AuditCitations
|
|
10
|
+
from euron_code.tools.citations import AuditCitations, FindPapers
|
|
11
11
|
from euron_code.tools.db import DbQuery
|
|
12
12
|
from euron_code.tools.document import ReadDocument
|
|
13
13
|
from euron_code.tools.fs import DeleteFile, EditFile, ListDir, MoveFile, MultiEdit, ReadFile, WriteFile
|
|
@@ -59,6 +59,7 @@ def default_tools(settings: Dict[str, Any], subagents: bool = True) -> List[Tool
|
|
|
59
59
|
tools.append(WebSearch()) # 1.8.0, appended: keeps the prefix stable
|
|
60
60
|
tools.append(FixPageAssets()) # 1.9.1, appended: keeps the prefix stable
|
|
61
61
|
tools.append(AuditCitations()) # 1.9.4, appended: keeps the prefix stable
|
|
62
|
+
tools.append(FindPapers()) # 1.10.1, appended
|
|
62
63
|
return _without_reuse(tools, settings)
|
|
63
64
|
|
|
64
65
|
|
|
@@ -29,6 +29,7 @@ class ReadRange:
|
|
|
29
29
|
turn: int
|
|
30
30
|
chars: int # size of the output the model got (for the savings counter)
|
|
31
31
|
call_id: Optional[str] = None
|
|
32
|
+
seen: int = 0 # 1.10.0: the last step that asked for this text again (a dedupe hit): it is still in use
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
@dataclass
|
|
@@ -182,6 +183,9 @@ class ToolContext:
|
|
|
182
183
|
processes: Any = None # background.ProcessManager, created on first use
|
|
183
184
|
last_repo: Optional[str] = None # the open-source repo the agent used last (oss_grep's default)
|
|
184
185
|
read_misses: int = 0 # read_file calls in a row for files that do not exist (1.5.3 guessing guard)
|
|
186
|
+
# 1.10.0: characters of file text read in the current step, and the most one step may read in full (0 = no cap)
|
|
187
|
+
step_read_used: int = 0
|
|
188
|
+
step_read_budget: int = 0
|
|
185
189
|
|
|
186
190
|
@property
|
|
187
191
|
def max_output_chars(self) -> int:
|