Commit Graph
54 Commits
Author SHA1 Message Date
linkliti e4b79fb5c5 feat(tools): expose tool_step_description hook for streamed step text
The response_stream log extension hardcoded one tool name to build the step label beside a streamed call. The label now comes from build_step_description, which seeds the generic text from the humanized tool name (underscores as spaces) and dispatches a display-only tool_step_description hook plugins rewrite, with the compact serialized args length appended centrally after the chain so argument streaming stays visible.

Validation: pytest tests/test_tool_step_description.py (14 passed), tests/test_plain_response_logging.py (18 passed), tests/test_response_stream_cadence.py (3 passed)
2026-11-28 13:35:54 +03:00
Jan Tomášek 7dab0f7b6f Improve sandbox defaults and terminal sessions 2026-11-22 10:47:13 +01:00
Jan Tomášek c32314770c Build the slim v3 image and publish tagged multi-architecture previews 2026-11-19 17:49:23 +00:00
Jan Tomášek 0fa1a85261 Unify agent execution and file destinations 2026-11-19 16:50:34 +00:00
Alessandro Frau df506015a8 Merge branch 'ready' into v3
Keep the v3 browser and filesystem observer implementations. Restore secure Telegram project and agent-profile scopes on the v3 sandboxed transport, including migration, session ownership, and current authorization checks.
2026-11-19 15:53:46 +01:00
Jan Tomášek 969905872d Default development to sandboxes and scan plugin dependency placement 2026-11-19 14:06:02 +00:00
Jan Tomášek 540ec7d854 Replace gVisor with PRoot and shared copy-on-write sandbox files
Run guests under separate Linux UIDs while retaining PRoot fake-root for
installers. Share immutable image files through hardlinks and copy each file
before mutation. Preserve existing disk roots during migration, maintain worker
bindings and lifecycle behavior, and remove gVisor sidecars and the Compose
seccomp override.

Build the pinned runtime in a disposable stage, bootstrap source updates, and
keep Unix socket scratch paths short. Preserve worker request ACLs and translate
fake-root Unix credentials for browser audio.

Validation: 3,398 unit tests and six real runtime checks passed. Verified default
Docker seccomp, missing-bundle image build, source bootstrap, persistent PTY,
worker RPC, browser render/input/audio/downloads/profile restart, and WebUI HTTP
startup. Fresh base is about 71 MiB smaller; a clean default sandbox uses about
9.7 MiB private disk. Ubuntu AppArmor and ARM64 were not available to test.
2026-11-16 18:42:18 +00:00
Alessandro e824cf5d99 Fix chat loading for malformed code execution arguments
Reuse the existing command text conversion before building execution
titles so rejected non-string arguments no longer abort streamed
rendering or saved-chat replay. Preserve original log arguments and
normal command copying and output.

Add regressions for malformed arguments in both delivery paths and
document the renderer contract.

Validation: 71 focused tests passed; both previously affected DeepSeek
chats reopened and reloaded with zero browser console errors.
2026-11-10 17:57:51 +01:00
Jan Tomášek 188cff2073 Move optional runtimes into persistent gVisor plugin sandboxes
Move tunnel, browser, document, speech and integration runtimes into plugin-owned
sandboxes with lazy dependencies and instance-scoped lifecycle management.
Reuse Tuxee display assets and the sandbox image's Python/Node runtimes, enable
automatic Desktop login, and show elapsed time for each browser launch.

Slim the outer image, use offline ONNX embeddings, and calculate sandbox storage
only on demand. Include regression coverage and updated runtime documentation.
Exclude local handoff notes and temporary verification artifacts from publication.
2026-11-08 21:43:22 +01:00
Jan Tomášek dadcbfa4d9 Reconstruct preserved sandbox WIP from sanitized source snapshot
Reconstructed against verified original base 93d1131ce1. Original local commits and index metadata were not present in the transfer.
2026-11-08 21:42:13 +01:00
DZH166 5fb00bd909 fix(code-execution): reject non-string code before shell dispatch 2026-11-03 00:29:20 +08:00
Alessandro c7c733ec04 Copy full execution commands while keeping compact previews
Restore matching command previews from the stored, masked command when
copying execution output or opening step details. Preserve command
whitespace and the output body while keeping the chat preview compact
and retaining existing log size limits.

Cover Bash, PowerShell, Python and Node.js prefixes, streamed updates,
masked placeholders and output without a matching command preview.

Validation: 48 focused WebUI tests passed, git diff --check passed, and
an actual browser clipboard check passed using frontend assets served
by the live instance at localhost:32081.
2026-11-01 07:16:55 +01:00
linkliti ad02938ce9 feat(tools): drop agent prefix from tool log headlines
The subordinate, unknown, MCP, and generic fallback tool log headlines no longer repeat the agent name. The unknown tool inherits the prefix-free base heading and takes the class-level blank line used by sibling tools, MCP keeps the tool name visible as an argument row, parallel children without a resolvable dedicated tool log through the prefix-free fallback, and the input and text editor fallback headings drop the prefix too. Framework helper DOX and both plugin AGENTS files document the prefix-free fallback rows, and regression tests cover the named headings for method and no-method calls, the generic fallback rows, and source guards for the plugin fallbacks.

Validation: pytest tests/test_tool_heading_prefixes.py tests/test_text_editor_message_handler.py tests/test_parallel_tool.py
2026-10-21 23:37:32 +03:00
linkliti 8fbcbdbc00 refactor(tools): unify boolean argument coercion in helpers.tool
Centralize boolean argument coercion in helpers.tool and route the promoted and core tools through it. This removes the duplicated private coercion helpers, including one in the remote code execution tool, along with the repairable-error messages and prompt files that only the strict boolean validation used. Strict boolean argument validation gives way to the shared coercion, which maps common true/false strings and falls back to truthiness, so invalid reset and dedicated_context values stop returning repairable errors. Browser regression tests now import the real modules before installing their stubs.

Validation: pytest tests/test_tool_action_contracts.py tests/test_browser_agent_regressions.py
2026-10-21 19:04:33 +03:00
Alessandro ad5bebbea5 Send complete SSH commands without blocking the event loop
Paramiko Channel.send can accept only part of a command. Ignoring its byte
count truncated large inputs, including heredocs whose closing delimiters
never reached the shell.

Use sendall through asyncio.to_thread and route shell initialization through
the same send path. Close the SSH connection when an in-flight send is
cancelled so partial input cannot contaminate later commands. Cancellation
intentionally discards that SSH session and its shell state.

Add regressions for multi-packet Unicode delivery and blocked-window
responsiveness/cancellation, and document the SSH send contract.

Validation: 24 focused tests passed. Real Paramiko transport and container
OpenSSH probes delivered complete large single/nested heredocs and preserved
shell state across terminal, Python and Node.js calls. No local TTY, prompt
readiness, tool-dispatch, or platform-specific heredoc workaround changes.
2026-10-06 18:49:30 +02:00
Alessandro 95ba588abc Fix native Windows TTY cleanup
Choose graceful or forced termination inside the existing process helper so
Windows never evaluates the POSIX-only SIGKILL constant. Pass SIGTERM to
pywinpty.kill(), whose native API requires an explicit signal argument.
Keep POSIX process-group TERM-then-KILL escalation and cleanup unchanged.

Cover normal close, forced escalation, kill, and destructor cleanup with a
Windows-shaped process adapter. All 22 focused TTY/pager tests pass, and a
native Windows 11 probe verifies state preservation, destructor termination,
fresh-shell close, and normal asyncio shutdown.
2026-10-06 18:49:30 +02:00
Alessandro c58061f0ee Keep terminal I/O from blocking shared event loops
Use nonblocking POSIX PTY reads and buffered, cooperative writes so a full
terminal or stale readiness notification cannot stall other chats. Discard
a shell on cancellation only while command bytes remain unsent, preserving
shell state after a fully drained send.

Use best-effort synchronous destruction instead of reentering asyncio;
explicit close retains the existing awaited cleanup and signal escalation.

Add isolated regression checks for payload integrity, loop responsiveness,
partial and complete-send cancellation, descriptor reuse, cross-thread
cleanup, and destruction. Document the terminal lifecycle contracts.

Validation: 28 focused terminal, parallel-lifetime, and pager tests passed.
Four real Codex II chats also completed concurrent Linux terminal, Python,
and Node workloads with 29.87 seconds of overlap and intact shell state.
2026-10-06 18:49:30 +02:00
Alessandro ab88f87b6f Fix flashing process groups during memory search
Text Editor logs rendered as process steps but were missing from raw-log
classification, allowing a following hidden utility message to hide the
whole group. Let plugins register process-step types through the existing
extension system and use those types for grouping and paging.

Preserve the generic tool-step fallback by classifying types that select
that renderer before merging logs. Document the custom handler contract
in the bundled plugin authoring skill.

Validated with 46 targeted tests and live desktop/mobile rendering checks,
including disabled plugins, fallback types, paging, and chat-switch races.
2026-09-16 16:17:37 +02:00
linkliti bd06096a3d Document remaining tool arguments in prompts and DOX
Add model-facing tool arguments found by a manual audit: call_subordinate name, office_artifact sheet plus edit count and preview_chars, browser skill value, paths, ref, keys, and selectors, and computer_use_remote include_hidden, include_offscreen, max_windows, mode, target, value, and path. Keep prompts canonical-only and record legacy aliases and action-value spellings in the owning DOX files for browser, a0_connector, office, text_editor, code_execution, goal, call_subordinate, and parallel.

Verified the argument flows against tool source in three independent manual audit passes covering core tools, plugin tools, helpers, and WebUI handlers. Verified prompt catalog and plugin scan tests in the framework runtime and kept the mirrored core instance in sync for live testing.
2026-09-10 17:00:19 +03:00
Alessandro 2d400f5099 fix(prompts): validate examples and sharpen skill descriptions
Fix trailing commas in six JSON examples while preserving all examples and thoroughness instructions. Rewrite 23 skill descriptions to fit the catalog preview, retaining existing triggers and adding explicit discovery phrases where needed.

Document the description preview contract and add regression checks for complete JSON examples, description lengths, and skill search. All four checks pass against the staged snapshot.
2026-09-08 02:37:44 +02:00
Alessandro 98f943b853 Keep parallel terminal jobs alive until their commands finish
Preserve the worker and its event-loop-owned terminal across output timeouts, publishing tool progress through the existing job result. Use parallel job IDs for await/cancel and reject session follow-ups that would create an unrelated worker.

Close parallel shells explicitly on completion or cancellation, including partial connections, and leave context cleanup to worker finally. Top-level persistent terminal behavior is unchanged. Verified with 117 focused tests, real isolated terminal and cancellation probes, and a live Venice background job completing after 22.465 seconds.
2026-09-06 21:01:11 +02:00
linkliti d1907bcd41 Add text_editor custom message handler and CSS
Override get_log_object in TextEditor and TextEditorRemote to log type=text_editor so the WebUI get_message_handler extension routes to _10_text_editor_handler.js. Move EXE colors out of core process-group.css into the _code_execution plugin. Hides _tool_name from display and uses dynamic action+path headings (remote adds (remote) suffix). Behavioral tests instantiate the tools and assert log item attrs.
2026-09-03 15:08:59 +03:00
Alessandro afff2e3c05 Harden scoped tool policy enforcement
Resolve effective policy through inherited layers without letting empty upper configs shadow restrictions, and carry canonical tool identities through local and MCP execution.

Enforce required policy hooks and parent delegation checks at runtime, keep installed connector capabilities configurable while disconnected, and remove complete blocked-tool examples from rendered prompts.

Use the canonical tool prompts for concise catalog descriptions and add regressions for plugin activation, dotted local names, MCP calls, layered policies, and parallel subordinate paths.
2026-08-12 14:34:15 +02:00
Alessandro 0ddb5fb31d fix: release Paramiko import traceback
Paramiko caches its optional invoke import error with the original traceback, retaining the code-execution tool-loading stack and first agent.

Clear only the stale traceback while preserving the exception, and add focused regression coverage.
2026-07-21 00:56:59 +02:00
Alessandro 21c62f6716 fix: release deferred task resources
Clear DeferredTask callables and arguments after completion or cancellation while running each invocation from a safe private snapshot. Preserve result retrieval and active restart behavior, clean up child tasks, and add best-effort local and SSH session destructors with focused lifecycle regression coverage.
2026-07-20 21:15:35 +02:00
frdel 4ffcdf5246 Handle shell/SSH process exits as completion
Detect and treat terminated local/SSH/TTY shells as definitive command completion. Add is_terminated and get_exit_code helpers to LocalInteractiveSession, SSHInteractiveSession, and TTYSession; expand _is_closed_pty_error to recognize exited TTY processes. CodeExecution now reports a shell-exit prompt, recreates terminated sessions lazily before the next command, and returns immediately when a shell has exited. Docs and README updated to describe strict-mode/exit behavior, and tests were added/updated to cover the new termination detection and handling.
2026-07-20 17:04:05 +02:00
Alessandro d3bec80611 Clarify code execution status handling
Treat trailing framework status as execution guidance rather than command output, preserving correct wait, reset, rerun, and continuation decisions.
2026-07-17 15:20:33 +02:00
Alessandro 9837ff3432 Group multiline terminal commands
Execute multiline terminal input as one current-shell compound so intermediate prompts cannot complete queued work early. Preserve shell state and cover Bash and PowerShell grouping with regression tests.
2026-07-10 18:53:19 +02:00
Alessandro f1787b65f5 Fix code execution PTY reset hangs
Start local PTY shells in a new process session and make close() escalate from SIGTERM to SIGKILL when a foreground command refuses to exit. This keeps code_execution_tool reset from blocking indefinitely on stuck terminal processes.\n\nAdd regression coverage for closing a TERM-resistant shell and document the reset lifecycle contract.
2026-07-09 03:29:52 +02:00
Alessandro Frau e2a23aafe6 Merge pull request #1705 from TriTechAI/fix/git-pager-cpu-spin
Disable pagers in non-interactive code execution shells
2026-06-24 11:14:27 +02:00
Alessandro a18a35977a Fix pytest capture import in TTY session
Guard stream reconfiguration so pytest capture objects without reconfigure support can import the code execution TTY helper while preserving UTF-8 error handling for normal streams.
2026-06-24 11:13:42 +02:00
shisan 528c33b7ef Disable pagers in non-interactive code execution shells
The code execution tool runs commands inside TTY-backed shells (local PTY and
remote SSH). Commands like `git diff`/`git log` detect the TTY and pipe output
through a pager (more/less). These shells never receive interactive input, so
the pager blocks forever and spins at 100% CPU per process — on a 16-core host
5 pager processes pegged 5 cores for 8+ hours (#1697).

Disable pagers in both session types:
- LocalInteractiveSession: inject PAGER=cat / GIT_PAGER=cat into the TTY env
- SSHInteractiveSession: export the same in the initial shell command

`cat` streams the output through instead of blocking, and also covers other
pager-using tools (man, systemctl, journalctl). Adds regression tests.

Fixes #1697
2026-06-13 21:17:57 +08:00
frdel e138e33ca9 Add file-level DOX docs & update AGENTS indexes
Add comprehensive file-level DOX documentation across the repo and update directory AGENTS.md indexes. Many new `*.py.dox.md` files were added under api, helpers, tools, plugins, extensions, webui, and other dirs to document endpoint purpose, ownership, runtime contracts, work guidance, and verification. Several AGENTS.md files were created or updated (agents profiles, api, docker, extensions, helpers, plugins, skills, webui components, etc.) to list child DOX files and clarify documentation/work guidance. Also add example and bundled profile DOX files (agent0, default, developer, hacker, researcher) and minor updates to helpers/dirty_json.py and its tests. These changes improve on-disk documentation coverage and establish the convention that each direct runtime file should have a matching `*.dox.md` describing its contracts and verification steps.
2026-06-08 12:41:53 +02:00
Alessandro e05a285dcf Tune code execution timeouts
Raise bundled defaults and fallback timeout tuples for normal and output runtimes so builds, installs, servers, tests, and training jobs have room to stream or poll without premature timeout.

Document the long-running work behavior while keeping normal command execution bounded and directing extended work toward output polling.
2026-06-02 09:15:57 +02:00
Alessandro 7ad9a44e76 Improve coding-agent verification discipline
Generalize benchmark lessons into prompt guidance for reading specs and tests first, making narrow edits, verifying exact artifacts, cleaning temporary work, recovering from tool failures, and avoiding success claims after partial output or timeouts.

Update the developer profile to skip unnecessary interviews for clear bounded tasks while keeping structured clarification for broad mandates. Add code-execution prompt guardrails for long-running and exact-output work without encoding benchmark-specific answers.
2026-06-02 09:15:48 +02:00
Alessandro b52b4220d9 Revert "Add builtin ACP plugin"
This reverts commit 46112c9750.
2026-06-02 01:05:09 +02:00
Alessandro 46112c9750 Add builtin ACP plugin
Expose Agent Zero over the Agent Client Protocol as a builtin stdio plugin with session lifecycle support, streaming bridges, registry metadata, and editor workspace handling.

Add lazy dependency installation through the ACP plugin hook using the root requirements pin so self-updated instances can recover without a fresh Docker image.

Pin agent-client-protocol, add focused static coverage, and allow ACP sessions to override the per-context workdir for code execution and workdir prompts.
2026-06-01 02:40:28 +02:00
Alessandro daf95ec3ab Normalize tool contracts and slim prompt surface
Standardize multi-action tools around tool_args.action while keeping parser compatibility for older tool/args, tool_name:action, and method-shaped requests. This keeps new prompts clean without breaking agents that learned the previous dialect.

Move A0 connector remote execution/file tools into stable standard prompts, make remote targeting independent of the active chat context, and skill-gate beta computer-use remote so it no longer weighs down the always-on tool list.

Align text editor, scheduler, skills, office artifact, memory, notify, and browser prompts/tools around the canonical action contract. Add scheduler update/timezone handling, skills_tool read_file, text editor patch coverage, and fixes for memory_forget, behaviour_adjustment, and code execution progress warnings.

Reduce default prompt pressure by compacting browser and scheduler prompts into skill-backed manifests, shortening skill catalog descriptions, and pruning noisy framework knowledge. Remove obsolete connector prompt stubs and root tool-call knowledge examples.

Tests: conda run -n a0 pytest tests/test_a0_connector_prompt_gating.py tests/test_tool_action_contracts.py tests/test_task_scheduler_timezone.py tests/test_text_editor_context_patch.py tests/test_tool_request_normalization.py tests/test_office_document_store.py::test_odf_is_advertised_and_docx_remains_explicit_compatibility tests/test_office_document_store.py::test_document_artifact_accepts_method_alias_for_ods_create tests/test_skills_runtime.py tests/test_default_prompt_budget.py::test_a0_small_profile_removed_and_prompt_text_generic -q
2026-05-09 21:54:43 +02:00
Agent Zero Local eecbb5ba34 fix(code_execution): handle closed PTYs while reading output 2026-05-02 21:33:08 +00:00
Agent Zero Local d4eaa7c030 fix(code_execution): avoid double-close of PTY master fd
Use a shared mutable holder for the POSIX PTY master fd and invalidate it before close. This keeps EOF cleanup and TTYSession.close()/kill() idempotent and prevents closing an unrelated resource if the OS reuses the old fd number.
2026-05-02 21:32:12 +00:00
Agent Zero Local a0f0c2e8d2 fix(code_execution): recover from closed PTY sessions
Detect closed or exited local TTY sessions before writing, convert invalid PTY write errors into retryable session failures, and reset/retry the terminal session once after send/read failures.
2026-05-02 21:32:12 +00:00
Agent Zero Local 2ce1947b0f fix(code_execution): close PTY file descriptors
Store and close POSIX PTY master descriptors when terminal sessions are closed or killed, and make local terminal session shutdown await the full TTY cleanup path. This prevents leaked /dev/ptmx descriptors from exhausting the process file descriptor limit.
2026-05-02 21:32:12 +00:00
Alessandro 86dca86f6f prompts: restore legacy, plugins, agent0 profile
Restore main.communication, main.solving, main.tips and tool.response, which made the model dumber. For some reasons the drawback was more visible with frontier LLMs.

restore builtin plugins and agent0 profile
2026-04-03 06:49:25 +02:00
Alessandro ef92a5e378 prompts: restore tool examples for better model guidance
Commit 54362bf8ee went too far stripping too many JSON examples to guide LLMs.
2026-04-02 18:50:13 +02:00
Alessandro 54362bf8ee prompts: adopt compact defaults and rebalance guidance
Promote the a0_small prompt work into the shipped default stack.

Token count for default prompt, accounting for tools, plugins, secrets placeholders, inactive project, etc: 2996 tokens.

- migrate compact prompt fragments into core prompts, plugin-owned prompts, and the agent0 overlay
- remove the obsolete a0_small profile and rename the tool-call knowledge reference to a generic framework file
- keep a small set of high-value JSON examples while preserving key guardrails for tool names, tool args, and method-style calls
- bake balanced conciseness into default response behavior without changing the initial greeting
- drop the call_sub prompt-side loader and keep call_sub guidance self-contained
- restore essential secrets/security guidance, preserve inactive-project messaging, and rebalance the A2A prompt
- add a regression test that verifies the assembled default agent0 prompt stays under the token budget and retains critical guardrails
2026-03-30 21:44:20 +02:00
keyboardstaff 1bd5bc01d6 refactor(chat_branching): ID-based log ↔ history linking for precise branch trimming 2026-03-24 03:04:09 -07:00
Jan Tomášek 69317765c9 Merge pull request #1293 from linuztx/refactor-split-system-prompt
Refactor prompts system
2026-03-22 17:00:07 +01:00
frdel 6181ac9c20 refactor: mask secrets in code execution command output and increase truncation limit
- Import secrets helper module
- Increase initial command truncation from 200 to 250 characters
- Add secret masking to format_command_for_output using agent context's secrets manager
- Apply masking before final truncation to prevent secret exposure in logs
2026-03-22 16:57:51 +01:00
frdel fd3b5253c7 refactor: normalize plugin paths, add README viewer to plugin info modal, and update plugin hub filters
- Normalize plugin paths using files.normalize_a0_path in get_enhanced_plugins_list
- Add collapsible README section to plugin info modal with loading/error states
- Implement loadPluginReadme function to fetch and render plugin documentation
- Update plugin hub pagination from 20 to 24 items per page
- Change popular filter threshold from >0 to >=3 stars
- Add comprehensive README styling with support
2026-03-22 08:05:32 +01:00
linuztx 2566ee134d refactor: split system prompt into per-concern extensions with extensibility hooks
- split monolithic _10_system_prompt.py into focused extensions: main (10), tools (11), mcp (12), skills (13), secrets (13), project (14)
- each extension exposes a build_prompt() function with call_extensions_async hook for plugin extensibility
- move tool prompt collection from VariablesPlugin to _11_tools_prompt using subagents.get_paths for proper directory coverage
- add {{include original}} directive to process_includes allowing prompt inheritance without copy-paste
- add agent.system.main.specifics.md for subagent-specific additions without overriding entire role
- remove redundant plugin prompt extensions (_15_text_editor, _20_code_execution) that duplicated tool collection
- add _09_text_editor_config to register per-file kwargs via agent.data instead of VariablesPlugin in prompts dir
2026-03-20 12:12:47 +08:00