WeKnora/internal/agent/tools
wizardchen 79995b996f fix(agent): scope the sandbox tools to the workspace they actually serve
Three inconsistencies in how the sandbox tools are granted and bounded.

Tool checkboxes that decide nothing. list/read/write/edit_sandbox_file,
shell_exec, read_skill and execute_skill_script were offered in the settings
UI, but registerSandboxFileTools, registerSandboxShellIfAllowed and
initializeSkillsManager all register from the capability (a sandbox with a
session filesystem, SkillsEnabled, install mode) and never consult
AllowedTools. Clearing a checkbox changed nothing. Drop them from
AvailableToolDefinitions the way search_memory and web_search already are,
so the switch that decides is the only thing shown.

Readers narrower than writers. write_sandbox_file accepts anything under
/workspace except the attachment tree, while list/read stopped at the
artifact output dir, so the agent could not read back the scratch script it
had just written and had to detour through `shell_exec cat`. Since
shell_exec reaches those files anyway the narrowing bought no safety; the
inspectable roots now cover /workspace, still ordered so a reported root
names the artifact or attachment tree when the path is inside one.

Two answers for one directory. A WEKNORA_SKILL_OUTPUT_DIR override was
validated on the execution path (falling back to /workspace/output) but
taken as-is from the host environment by the tools and ArtifactCollector, so
an override outside /workspace pointed the readers at a directory no skill
could write. Both now go through sandbox.ValidatedSessionOutputDir.
2026-09-02 16:16:52 +08:00
..
capabilities.go refactor(agent): remove final_answer tool references and update related logic 2026-06-04 15:48:04 +08:00
data_analysis.go fix(agent): harden search-target scope and model-handle policies 2026-07-27 11:05:43 +08:00
data_analysis_duckdb_test.go test(agent): add end-to-end DuckDB excel tests and fix sheet enumeration (#1007) 2026-04-24 19:57:56 +08:00
data_analysis_materialize_test.go fix: deep-copy stored files and images when cloning a knowledge base 2026-06-03 14:45:59 +08:00
data_analysis_test.go feat(memory): add cross-session long-term memory 2026-08-13 18:00:02 +08:00
data_schema.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
database_query.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
database_query_test.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
definitions.go fix(agent): scope the sandbox tools to the workspace they actually serve 2026-09-02 16:16:52 +08:00
exec_context.go feat: scope API MCP OAuth by principal 2026-06-30 20:01:05 +08:00
faq_snippet.go feat(faq): enhance FAQ handling and localization support 2026-06-04 21:43:16 +08:00
faq_snippet_test.go feat(faq): enhance FAQ handling and localization support 2026-06-04 21:43:16 +08:00
get_document_info.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
grep_chunks.go fix(agent): harden search-target scope and model-handle policies 2026-07-27 11:05:43 +08:00
grep_chunks_aggregate_test.go feat(agent): add tool result persistence trimming for large outputs 2026-06-16 01:09:23 +08:00
grep_chunks_scope_test.go fix(agent): avoid expanding tag scopes for grep chunks 2026-06-29 19:17:42 +08:00
grep_chunks_snippet_test.go feat(faq): enhance FAQ handling and localization support 2026-06-04 21:43:16 +08:00
image_markdown_output_test.go fix(chat): use Markdown for LLM image context and normalize legacy XML 2026-07-15 18:10:31 +08:00
json_repair.go fix(agent): recover tool arguments with a stray trailing fragment 2026-09-02 10:12:55 +08:00
json_repair_test.go fix(agent): recover tool arguments with a stray trailing fragment 2026-09-02 10:12:55 +08:00
knowledge_search.go fix(agent): stop using the chat model to rerank knowledge search 2026-08-27 11:44:30 +08:00
knowledge_search_metadata_test.go refactor(knowledge): keep metadata document scoped 2026-07-28 20:23:48 +08:00
knowledge_search_mmr_test.go perf(agent): make knowledge_search MMR selection incremental 2026-08-20 15:44:32 +08:00
knowledge_search_rerank_test.go fix(agent): stop using the chat model to rerank knowledge search 2026-08-27 11:44:30 +08:00
list_knowledge_chunks.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
mcp_oauth.go fix(mcp): coordinate OAuth token refresh and authorization polling 2026-07-23 15:35:24 +08:00
mcp_tool.go feat(agent): add configurable MCP OAuth wait timeout per agent 2026-07-01 14:37:37 +08:00
mcp_tool_image_test.go feat: auto-describe MCP tool result images via VLM 2026-03-25 21:38:15 +08:00
mcp_tool_test.go feat(tests): add comprehensive tests for MCPTool functionality 2026-03-25 22:08:29 +08:00
normalize_id.go feat(agent): enhance tool execution and message sanitization 2026-03-25 22:08:29 +08:00
normalize_id_test.go feat(agent): enhance tool execution and message sanitization 2026-03-25 22:08:29 +08:00
output_budget.go fix(agent): keep batched wiki_read_page results within output budget 2026-07-27 13:22:16 +08:00
output_budget_test.go fix(agent): keep batched wiki_read_page results within output budget 2026-07-27 13:22:16 +08:00
param_cast.go fix(agent): harden tool parameter parsing against LLM type mismatches (#1505) 2026-05-28 07:50:26 +08:00
param_cast_test.go refactor(prompt): streamline context handling in templates 2026-03-25 22:08:29 +08:00
param_validate.go feat(agent): implement memory consolidation and context management 2026-03-25 22:08:29 +08:00
param_validate_test.go feat(agent): implement memory consolidation and context management 2026-03-25 22:08:29 +08:00
persist.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
persist_test.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
python_syntax.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
python_syntax_test.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
query_knowledge_graph.go fix(agent): harden search-target scope and model-handle policies 2026-07-27 11:05:43 +08:00
query_knowledge_graph_test.go Simplify KB duplicate API and improve naming/docs coverage. 2026-07-08 20:55:54 +08:00
registry.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
registry_test.go fix(agent/tools): sort function definitions for deterministic ordering 2026-05-25 16:47:14 +08:00
sandbox_edit.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
sandbox_edit_test.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
sandbox_ls.go fix(agent): scope the sandbox tools to the workspace they actually serve 2026-09-02 16:16:52 +08:00
sandbox_read.go fix(agent): scope the sandbox tools to the workspace they actually serve 2026-09-02 16:16:52 +08:00
sandbox_read_test.go fix(agent): scope the sandbox tools to the workspace they actually serve 2026-09-02 16:16:52 +08:00
sandbox_write.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
sandbox_write_test.go fix(agent): scope the sandbox tools to the workspace they actually serve 2026-09-02 16:16:52 +08:00
sanitize_messages.go feat(agent): enhance tool execution and message sanitization 2026-03-25 22:08:29 +08:00
sanitize_messages_test.go feat(agent): enhance tool execution and message sanitization 2026-03-25 22:08:29 +08:00
scope_authorization.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
scope_authorization_test.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
search_conversations.go feat(memory): add cross-session long-term memory 2026-08-13 18:00:02 +08:00
search_memory.go feat(memory): introduce long-term memory feature with i18n updates 2026-08-13 18:00:02 +08:00
search_memory_test.go feat(memory): introduce long-term memory feature with i18n updates 2026-08-13 18:00:02 +08:00
sequentialthinking.go refactor(agent): remove final_answer tool references and update related logic 2026-06-04 15:48:04 +08:00
shell_env_extract.go fix(sandbox): make skill env capture fill blanks only 2026-08-27 14:32:00 +08:00
shell_env_extract_test.go fix(sandbox): make skill env capture fill blanks only 2026-08-27 14:32:00 +08:00
shell_exec.go feat(agent): tell session agents which workspace they are working in 2026-09-02 16:16:52 +08:00
shell_exec_test.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
skill_execute.go feat(agent): tell session agents which workspace they are working in 2026-09-02 16:16:52 +08:00
skill_execute_test.go fix(skill): 解析 stringified JSON 数组形式的 args 2026-09-02 15:37:14 +08:00
skill_file.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
skill_file_test.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
skill_read.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
skill_read_environment_test.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
skill_read_path_test.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
skill_runtime_guard.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
skill_runtime_guard_test.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
strip_think.go refactor(agent): remove query display from DatabaseQuery component and update tool result structure 2026-03-25 22:08:29 +08:00
strip_think_test.go refactor(agent): remove query display from DatabaseQuery component and update tool result structure 2026-03-25 22:08:29 +08:00
think_stream.go feat(agent): enhance event routing for reasoning and answers in streaming 2026-06-04 15:48:04 +08:00
think_stream_test.go feat(agent): enhance event routing for reasoning and answers in streaming 2026-06-04 15:48:04 +08:00
todo_write.go fix(agent): harden tool parameter parsing against LLM type mismatches (#1505) 2026-05-28 07:50:26 +08:00
tool.go feat: use language-neutral English prompts for multilingual LLM responses 2026-03-06 21:08:12 +08:00
tool_policy_coverage_test.go refactor(skills): introduce write_skill_file and edit_skill_file tools for skill directory management 2026-09-02 15:08:05 +08:00
truncate.go fix(agent): keep batched wiki_read_page results within output budget 2026-07-27 13:22:16 +08:00
truncate_test.go feat(agent): implement memory consolidation and context management 2026-03-25 22:08:29 +08:00
web_fetch.go fix(web_fetch): address review follow-ups for structured fetch results 2026-07-28 22:17:31 +08:00
web_fetch_test.go fix(web_fetch): address review follow-ups for structured fetch results 2026-07-28 22:17:31 +08:00
web_search.go fix(agent): preserve web evidence when page fetches fail 2026-07-28 22:17:31 +08:00
wiki_delete_page.go feat(wiki): add page revision history with diff, revert, and manual editing 2026-07-27 15:03:24 +08:00
wiki_flag_issue.go fix(agent): harden search-target scope and model-handle policies 2026-07-27 11:05:43 +08:00
wiki_index_overview_test.go perf(wiki): move ingest log to event table and index to on-demand API 2026-05-08 21:48:52 +08:00
wiki_link_mutation.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
wiki_link_mutation_test.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
wiki_read_issue.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
wiki_read_page_budget_test.go fix(agent): keep batched wiki_read_page results within output budget 2026-07-27 13:22:16 +08:00
wiki_read_source_doc.go fix(agent): exclude disabled FAQ entries 2026-07-29 14:40:54 +08:00
wiki_rename_page.go feat(wiki): add page revision history with diff, revert, and manual editing 2026-07-27 15:03:24 +08:00
wiki_replace_text.go fix: replace all exact wiki text matches 2026-08-05 19:30:40 +08:00
wiki_replace_text_test.go fix: replace all exact wiki text matches 2026-08-05 19:30:40 +08:00
wiki_route_resolver.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
wiki_tools.go Remove redundant Wiki operation log 2026-07-28 11:18:33 +08:00
wiki_tools_test.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
wiki_update_issue.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
wiki_write_page.go feat(wiki): add page revision history with diff, revert, and manual editing 2026-07-27 15:03:24 +08:00
wiki_write_page_test.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00