ulysses/src
Kenny Van de Maele 7443c36bd9
feat: Add edit_file tool + file-change diffs (#1239)
* Add edit_file tool + file-change diffs

edit_file is an exact old_string -> new_string replacement on a file on disk
(fails if old_string is missing or non-unique unless replace_all); write_file
also returns a unified diff. Diffs render collapsed in the tool bubble
(filename + +adds/-dels, theme colors); the raw JSON command box is hidden.

Security: edit_file is a sensitive filesystem-write tool, treated everywhere
write_file is —
  - added to NON_ADMIN_BLOCKED_TOOLS (is_public_blocked_tool / blocked_tools_for_owner),
    so on auth-enabled deployments a non-admin cannot run it; execute_tool_block
    refuses it for non-admin owners.
  - confined by the same path policy as read_file/write_file (allowlist +
    sensitive-file deny) via _resolve_tool_path.

Disambiguation in tool descriptions + bash prompt: edit_file/write_file are the
only way to write files (they show a diff) — never edit_document (editor panel)
or a bash heredoc/redirect.

Tests (tests/test_edit_file.py): non-admin block (policy + execution gate),
successful edit, not-found old_string, non-unique old_string (+ replace_all),
and path outside the allowed roots.

Files: src/tool_execution.py, src/agent_loop.py, src/tool_schemas.py,
src/agent_tools.py, src/tool_index.py, static/js/chat.js, static/style.css,
tests/test_edit_file.py.

* Drop redundant import os in write_file closure

os is already imported at module top.
2026-06-04 18:29:10 +02:00
..
search chore: deduplicate src/search modules (cache, content, query) into shims (#2506) 2026-06-04 18:10:55 +02:00
action_intents.py Fix calendar routing and user-local time context (#408) 2026-06-04 13:20:04 +01:00
agent_loop.py feat: Add edit_file tool + file-change diffs (#1239) 2026-06-04 18:29:10 +02:00
agent_runs.py Handle incomplete detached agent streams 2026-06-01 16:54:11 +09:00
agent_tools.py feat: Add edit_file tool + file-change diffs (#1239) 2026-06-04 18:29:10 +02:00
ai_interaction.py fix(ai): scope tool model resolution by owner 2026-06-04 00:37:28 +01:00
api_key_manager.py Stop API key save() from writing other providers' keys as plaintext (#1944) 2026-06-04 04:47:13 +01:00
app_helpers.py fix: inside_base_dir raises TypeError on a non-string path instead of failing closed (#1619) 2026-06-03 09:00:04 +09:00
app_initializer.py feat(memory): add provider interface (#72) 2026-06-04 16:26:11 +01:00
assistant_log.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
auth_helpers.py fix: require_privilege 500s on a non-dict privileges blob from auth.json (#1693) 2026-06-03 13:37:54 +09:00
bg_jobs.py Ignore invalid background job store rows (#1261) 2026-06-03 14:07:14 +09:00
bg_monitor.py Ignore non-string background stream deltas (#1549) 2026-06-03 14:11:45 +09:00
builtin_actions.py Fix issue 135 chat context bleed (#281) 2026-06-04 13:27:46 +01:00
builtin_mcp.py Add native Windows compatibility layer 2026-06-01 15:09:47 +09:00
caldav_sync.py fix(calendar): scope CalDAV event lookup by calendar 2026-06-04 04:01:21 +01:00
caldav_writeback.py Decrypt CalDAV password before write-back (#1731) 2026-06-03 11:36:12 +09:00
chat_handler.py Use LM Studio-reported vision capability for image passthrough (#1130) 2026-06-02 23:01:04 +09:00
chat_helpers.py fix(vision): recognize Gemma 4 and Phi-4 as vision-capable models (#1704) 2026-06-03 13:36:50 +09:00
chat_processor.py Fix calendar routing and user-local time context (#408) 2026-06-04 13:20:04 +01:00
chroma_client.py fix: ChromaDB unreachable blocks app startup for 30-60s (#326) (#476) 2026-06-01 22:22:41 +09:00
cleanup_service.py Replace cleanup service datetime.utcnow calls (#1494) 2026-06-03 14:14:27 +09:00
config.py Add native Windows compatibility layer 2026-06-01 15:09:47 +09:00
constants.py Align SearXNG fallback URL 2026-06-01 10:50:07 +09:00
context_budget.py feat: adapt agent_input_token_budget to the model context window (#1170) (#1230) 2026-06-03 00:13:53 +09:00
context_compactor.py fix: context_compactor token helpers crash on non-string message text (#1634) 2026-06-03 14:12:14 +09:00
database.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
deep_research.py fix: deep research runs the prompt's example queries when the model echoes them (#1666) 2026-06-03 14:23:07 +09:00
document_actions.py fix: document tidy crashes on a duplicate with NULL timestamps (#1772) 2026-06-03 13:23:01 +09:00
document_processor.py fix: treat Nix files as readable uploads (#2249) 2026-06-04 12:06:24 +02:00
email_thread_parser.py Ignore non-string email thread bodies (#1654) 2026-06-03 14:06:31 +09:00
embeddings.py Add native Windows compatibility layer 2026-06-01 15:09:47 +09:00
endpoint_resolver.py fix(endpoint): import ModelEndpoint from core database 2026-06-04 11:51:47 +01:00
event_bus.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
exceptions.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
goal_based_extractor.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
integrations.py Ignore invalid integration rows (#1404) 2026-06-03 14:07:11 +09:00
llm_core.py fix: SSE stream parser crashes with NoneType on providers sending null choice/usage/tc entries (#2389) 2026-06-04 13:53:10 +01:00
markitdown_runtime.py fix: is_markitdown_format crashes on a non-string path (#1618) 2026-06-03 09:00:10 +09:00
mcp_manager.py fix: close AsyncExitStack on MCP init/tool-discovery failure (#1493) 2026-06-03 14:23:46 +09:00
memory.py refactor(memory): canonicalize memory imports (#50) 2026-06-04 05:31:15 +01:00
memory_provider.py feat(memory): add provider interface (#72) 2026-06-04 16:26:11 +01:00
memory_vector.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
model_context.py fix(models): stabilize proxy endpoint refresh behavior 2026-06-04 04:56:11 +01:00
model_discovery.py Reject invalid Tailscale discovery JSON (#1556) 2026-06-03 14:11:31 +09:00
pdf_form_doc.py fix(forms): keep PDF-form export from dropping values when the label has '*' (#1407) 2026-06-03 14:24:07 +09:00
pdf_forms.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
pdf_runtime.py Show a clear message when PyMuPDF is missing 2026-06-01 18:27:17 +09:00
personal_docs.py Skip malformed personal keyword index rows 2026-06-03 13:42:05 +09:00
preset_manager.py Fall back from invalid preset stores (#1402) 2026-06-03 14:12:31 +09:00
prompt_security.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
rag_manager.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
rag_singleton.py Re-enable VectorRAG init with lazy retry 2026-06-01 14:32:13 +09:00
rag_vector.py fix: RAG keyword fallback leaked owner-less documents across users (#1722) 2026-06-03 13:31:33 +09:00
rate_limiter.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
readiness.py feat: add /api/ready readiness probe (DB, data dir, local-first) (#1200) 2026-06-02 23:33:22 +09:00
request_models.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
research_handler.py fix: research source extraction crashes on a non-dict finding (#1714) 2026-06-03 13:34:40 +09:00
research_utils.py Treat non-string research summaries as low quality 2026-06-03 13:42:24 +09:00
secret_storage.py Add native Windows compatibility layer 2026-06-01 15:09:47 +09:00
session_actions.py Fix issue 135 chat context bleed (#281) 2026-06-04 13:27:46 +01:00
settings.py fix(settings): catch PermissionError in load_settings + error-path tests (#1570) 2026-06-03 14:23:27 +09:00
settings_scrub.py Ignore non-object settings scrub inputs (#1645) 2026-06-03 14:11:05 +09:00
task_endpoint.py Harden session endpoint owner scope (#1308) 2026-06-03 02:40:22 +09:00
task_scheduler.py Fix issue 135 chat context bleed (#281) 2026-06-04 13:27:46 +01:00
teacher_escalation.py fix: evaluate_turn_regex crashes on a non-string agent_reply (#1723) 2026-06-03 13:31:26 +09:00
text_helpers.py fix: _strip_reasoning_prose discards the answer when reasoning trails it (#1643) 2026-06-03 14:23:15 +09:00
tls_overrides.py Support extra CA bundle for private-CA LLM providers (#769) 2026-06-04 13:18:50 +01:00
tool_execution.py feat: Add edit_file tool + file-change diffs (#1239) 2026-06-04 18:29:10 +02:00
tool_implementations.py fix: updating a calendar event ignores user timezone and shifts the time (#1695) 2026-06-03 13:37:39 +09:00
tool_index.py feat: Add edit_file tool + file-change diffs (#1239) 2026-06-04 18:29:10 +02:00
tool_parsing.py fix: tool-block parsing crashes on a non-string input (#1628) 2026-06-03 08:59:42 +09:00
tool_schemas.py feat: Add edit_file tool + file-change diffs (#1239) 2026-06-04 18:29:10 +02:00
tool_security.py feat: Add edit_file tool + file-change diffs (#1239) 2026-06-04 18:29:10 +02:00
topic_analyzer.py Topics: hydrate session history before analysis 2026-06-02 20:44:27 +09:00
upload_handler.py fix: treat Nix files as readable uploads (#2249) 2026-06-04 12:06:24 +02:00
upload_limits.py fix(uploads): bound direct upload reads 2026-06-04 00:32:50 +01:00
url_safety.py fix: check_outbound_url crashes on a truthy non-string URL (#1623) 2026-06-03 08:59:49 +09:00
url_security.py Reapply "Merge branch 'main' of github.com:pewdiepie-archdaemon/odysseus" 2026-06-03 22:47:00 +09:00
user_time.py Fix calendar routing and user-local time context (#408) 2026-06-04 13:20:04 +01:00
visual_report.py security: sanitize rendered research-report HTML (#364) 2026-06-04 13:42:49 +01:00
webhook_manager.py Replace webhook manager datetime.utcnow calls (#1499) 2026-06-03 14:14:23 +09:00
youtube_handler.py fix: youtube transcript formatter crashes on a non-dict segment (#1745) 2026-06-03 13:29:08 +09:00