The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(artifacts): move artifacts module out of agent
Steven Enamakel52c825556d03
diff --git a/AGENTS.md b/AGENTS.mdindex 329f5f2d40..764c3ec66e 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -548,7 +548,7 @@ Direct rendered submodules under `vendor/`:| Submodule | Owns || --- | --- |-| `tiny-artifacts` | Versioned artifacts as a plain library (no bus contract): the record and version model, the `Artifacts` service and its rules (content fits the kind, file paths stay inside the host's `FileRoots` and pass its guard, revisions append, kept version files, publishing), the agent artifact tools, and the file-system store. OpenHuman owns the ports: the document-backed store, the card UI bridge, the protected-path guard and the cloud-storage publisher (`agent/artifacts/`). |+| `tiny-artifacts` | Versioned artifacts as a plain library (no bus contract): the record and version model, the `Artifacts` service and its rules (content fits the kind, file paths stay inside the host's `FileRoots` and pass its guard, revisions append, kept version files, publishing), the agent artifact tools, and the file-system store. OpenHuman owns the ports: the document-backed store, the card UI bridge, the protected-path guard and the cloud-storage publisher (`artifacts/`). || `tinyagents` | Provider-neutral agent harness and durable typed state graph: model/tool loop, tool-call dialects and parsing, middleware, retries, caching, sessions/transcripts, and graph execution. || `tinybox` | Isolated execution environments for code the host does not trust; box lifecycle and isolation backends. || `tinybus` | TinyBus runtime and module contracts: discovery/loading, ABI and manifest admission, transport, proxies, lifecycle, and module bus behavior. |diff --git a/app/src/services/chatService.ts b/app/src/services/chatService.tsindex 942d4d3248..0afd016229 100644--- a/app/src/services/chatService.ts+++ b/app/src/services/chatService.ts@@ -493,7 +493,7 @@ export interface ChatRunModeChangedEvent {/*** Lowercase variant of the Rust `ArtifactKind` enum surfaced on* artifact lifecycle socket events. Mirrors the slugs produced by- * `ArtifactKind::as_str()` in `crates/openhuman-core/src/agent/artifacts/types.rs`.+ * `ArtifactKind::as_str()` in `crates/openhuman-core/src/artifacts/types.rs`.*/export type ArtifactKind = 'presentation' | 'document' | 'image' | 'video' | 'other';diff --git a/crates/openhuman-core/src/agent/harness/README.md b/crates/openhuman-core/src/agent/harness/README.mdindex edf362e149..2b1e1e34b8 100644--- a/crates/openhuman-core/src/agent/harness/README.md+++ b/crates/openhuman-core/src/agent/harness/README.md@@ -120,7 +120,7 @@ turn lifecycle are in `../session_host/`; `run_subagent`,onto TinyAgents primitives. That file is not checked into this repo, so theplan itself is not documented here, only the citations to it.- `artifact_offload` deliberately has no flat `ArtifactKind` re-export at the- `harness` level. It would shadow `agent::artifacts::ArtifactKind` for glob+ `harness` level. It would shadow `artifacts::ArtifactKind` for globimporters, so use the `artifact_offload::` path instead.- The `Agent` struct, its turn lifecycle, and transcript persistence used tolive under `harness/session/`. That code has moved to `../session_host/`;diff --git a/crates/openhuman-core/src/agent/harness/mod.rs b/crates/openhuman-core/src/agent/harness/mod.rsindex f3aa94972a..c87025a682 100644--- a/crates/openhuman-core/src/agent/harness/mod.rs+++ b/crates/openhuman-core/src/agent/harness/mod.rs@@ -29,7 +29,7 @@ pub(crate) mod test_support;pub(crate) mod tool_result_artifacts;// NOTE: deliberately no flat re-export here. `artifact_offload::ArtifactKind`-// would shadow the unrelated `openhuman::agent::artifacts::ArtifactKind` for anyone+// would shadow the unrelated `openhuman::artifacts::ArtifactKind` for anyone// glob-importing this module; callers import the owning library directly.pub use fork_context::{AgentContextPreparedSource, ParentExecutionContext};diff --git a/crates/openhuman-core/src/agent/session_host/README.md b/crates/openhuman-core/src/agent/session_host/README.mdindex f5b70a2fea..eaa0dee6d7 100644--- a/crates/openhuman-core/src/agent/session_host/README.md+++ b/crates/openhuman-core/src/agent/session_host/README.md@@ -26,7 +26,7 @@ run after each turn commits.| [`prefix_snapshot.rs`](./prefix_snapshot.rs) | Cache-prefix bookkeeping across resumes || [`recorded_tools.rs`](./recorded_tools.rs) | Rebuilds recorded Composio actions as deferred executors on resume || [`prelude_integrations.rs`](./prelude_integrations.rs) | Fetches connected integrations on the first turn of a session instance |-| [`announcement_notes.rs`](./announcement_notes.rs), [`artifact_wiring.rs`](./artifact_wiring.rs) | Smaller product wiring pulled out of the builder |+| [`announcement_notes.rs`](./announcement_notes.rs) | Smaller product wiring pulled out of the builder || `turn/`, [`turn_checkpoint.rs`](./turn_checkpoint.rs) | Per-turn state and checkpointing |Import `OpenHumanSessionHost` and `SessionHostBuilder` from `crate::agent`,diff --git a/crates/openhuman-core/src/agent/session_host/mod.rs b/crates/openhuman-core/src/agent/session_host/mod.rsindex 71cea3b55b..1b61d9e6ef 100644--- a/crates/openhuman-core/src/agent/session_host/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/mod.rs@@ -68,7 +68,6 @@ pub use types::{OpenHumanSessionHost, SessionHostBuilder, TurnOverrides};pub(crate) use builder::dedup_visible_tool_specs;mod announcement_notes;-mod artifact_wiring;#[cfg(test)]mod orphaned_head_resume_tests;diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 8f52bc8119..d4a1993301 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -605,7 +605,7 @@ impl OpenHumanSessionHost {};let autocompact_enabled = context_config.enabled && context_config.autocompact_enabled;let compaction = context_config.compaction_settings();- let artifact_store = super::artifact_wiring::build_artifact_store(+ let artifact_store = crate::artifacts::artifact_wiring::build_artifact_store(&self.workspace_dir,&self.event_session_id,);diff --git a/crates/openhuman-core/src/artifacts/artifact_wiring.rs b/crates/openhuman-core/src/artifacts/artifact_wiring.rsindex 6338f542de..fa3ab89df5 100644--- a/crates/openhuman-core/src/artifacts/artifact_wiring.rs+++ b/crates/openhuman-core/src/artifacts/artifact_wiring.rs@@ -51,7 +51,7 @@ const ARTIFACT_RETENTION: std::time::Duration = std::time::Duration::from_secs(2/// The sweep is best-effort by design: a failed prune must never fail a turn,/// because the worst it costs is disk, while failing the turn costs the user/// their message.-pub(super) fn build_artifact_store(workspace_dir: &Path, session_key: &str) -> HostArtifactStore {+pub(crate) fn build_artifact_store(workspace_dir: &Path, session_key: &str) -> HostArtifactStore {let blobs = artifact_blobs_for(workspace_dir).unwrap_or_else(|| {tracing::warn!("[agent][tool-result-artifacts] no blob store for the acting tenant — artifacts stay in memory for this process"diff --git a/crates/openhuman-core/src/artifacts/mod.rs b/crates/openhuman-core/src/artifacts/mod.rsindex 4da9b385a8..ceb4407b54 100644--- a/crates/openhuman-core/src/artifacts/mod.rs+++ b/crates/openhuman-core/src/artifacts/mod.rs@@ -1,3 +1,4 @@+pub(crate) mod artifact_wiring;pub mod files;pub mod migrate;pub mod ops;diff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rsindex 682d2b6a38..bf45a75953 100644--- a/crates/openhuman-core/src/lib.rs+++ b/crates/openhuman-core/src/lib.rs@@ -53,6 +53,7 @@#![allow(dead_code)]pub mod agent;+pub mod artifacts;pub mod backend;pub mod channels;pub mod commands;diff --git a/crates/openhuman-core/src/media/README.md b/crates/openhuman-core/src/media/README.mdindex b061cf60f7..112e57c927 100644--- a/crates/openhuman-core/src/media/README.md+++ b/crates/openhuman-core/src/media/README.md@@ -102,7 +102,7 @@ Inside `generation/`:- Argument parsing, writing files into the workspace, and result wordingbelong to TinyAgents (`tinyagents_harness::media`, in `vendor/tinyagents`).- Provider keys, billing, and the proxy route belong to the backend.-- Artifact storage belongs to `agent::artifacts`.+- Artifact storage belongs to `artifacts`.## Gotchasdiff --git a/crates/openhuman-core/src/media/generation/artifact_tool.rs b/crates/openhuman-core/src/media/generation/artifact_tool.rsindex 265cfe13d2..22992f4a81 100644--- a/crates/openhuman-core/src/media/generation/artifact_tool.rs+++ b/crates/openhuman-core/src/media/generation/artifact_tool.rs@@ -21,7 +21,7 @@//!//! A run with no context (`execute`/`execute_with_options`, e.g. CLI/tests)//! still creates artifacts — the production simply records no-//! `tool_call_id` and the chat-context bridge in `agent/artifacts/store.rs`+//! `tool_call_id` and the chat-context bridge in `artifacts/store.rs`//! degrades to `thread_id = None` as it already does for every other//! producer.diff --git a/crates/openhuman-core/src/tools/impl/README.md b/crates/openhuman-core/src/tools/impl/README.mdindex 4d591f0598..1479716b7a 100644--- a/crates/openhuman-core/src/tools/impl/README.md+++ b/crates/openhuman-core/src/tools/impl/README.md@@ -30,7 +30,7 @@ tested but no production assembly site constructs it today.| [`filesystem/`](./filesystem/) | Host adapter only: `SecurityPolicy` implements `tinytools_std::filesystem::FsGate`. The tools (`FileReadTool`, `FileWriteTool`, `EditFileTool`, `ApplyPatchTool`, `GrepTool`, `GlobTool`, `ListFilesTool`, `ReadDiffTool`, `CsvExportTool`, `GitOperationsTool`, `RunLinterTool`, `RunTestsTool`, `UpdateMemoryMdTool`) live in `tinytools_std::filesystem` and are imported directly by `tools/ops.rs` | always registered, except `ReadDiffTool`, `RunLinterTool`, and `RunTestsTool`, which are exported, not registered || [`browser/`](./browser/) | `BrowserTool` (TinyComputer browser members and tasks), `BrowserOpenTool` (simple TinyComputer navigation), `ImageInfoTool` | Both browser tools need `browser.enabled` and the `modules` feature, and are deferred until `tool_search`; `ImageInfoTool` remains direct. Browser navigation uses the shared `http_request.allowed_domains` policy, and the checksum-pinned TinyComputer release module. Consequential actions go through the forced approval gate; `browser_unattended.rs` lets trusted cron/background/approval-free workflow turns skip it for the kinds listed in `[browser] unattended_actions`. || [`network/`](./network/) | `HttpRequestTool`, `WebFetchTool`, `CurlTool`, `GitbooksSearchTool`, `GitbooksGetPageTool`, `GmailUnsubscribeTool`, and under the `mcp` Cargo feature `McpListServersTool`, `McpListToolsTool`, `McpCallTool`; `url_guard.rs` is the shared SSRF/allowlist validator, not a tool | `http_request`, `web_fetch`, `curl`, `gmail_unsubscribe` always registered; `gitbooks_*` need `gitbooks.enabled` and, when the active profile sets an `mcp_allowlist`, an entry named `gitbooks`; `mcp_list_servers`/`mcp_list_tools`/`mcp_call_tool` register only when the static `[[mcp_client.servers]]` registry (after the profile allowlist) is non-empty |-| [`document/`](./document/) (feature `documents`) | `DocumentTool` (`generate_document`) | always registered when compiled. Builds `.docx` bytes via the pure-Rust `engine` module (`docx-rs`, no subprocess) inside `spawn_blocking` + `tokio::time::timeout`; allocates the artifact with `agent::artifacts::create_artifact` (kind `Document`), persists `args.json` next to it for the failed-card Retry path, then `finalize_artifact` or `fail_artifact` |+| [`document/`](./document/) (feature `documents`) | `DocumentTool` (`generate_document`) | always registered when compiled. Builds `.docx` bytes via the pure-Rust `engine` module (`docx-rs`, no subprocess) inside `spawn_blocking` + `tokio::time::timeout`; allocates the artifact with `artifacts::create_artifact` (kind `Document`), persists `args.json` next to it for the failed-card Retry path, then `finalize_artifact` or `fail_artifact` || [`presentation/`](./presentation/) (feature `documents`) | `PresentationTool` (`generate_presentation`) | always registered when compiled. Same shape as `document/` with `ppt-rs` producing `.pptx` and kind `Presentation` |## Notesdiff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.mdindex f337ff7305..0a784d829c 100644--- a/docs/TEST-COVERAGE-MATRIX.md+++ b/docs/TEST-COVERAGE-MATRIX.md@@ -271,7 +271,7 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an| 6.1.1 | File Read Access | RU+WD | `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_read/mod.rs`, `app/test/e2e/specs/tool-filesystem-flow.spec.ts` | ✅ | Was 🟡 — WDIO drives memory_read_file + asserts via Node fs. Byte `offset` paging (continues a paged artifact read, #6284): `file_read/test.rs::file_read_offset_continues_from_the_given_byte` (tinytools-std) || 6.1.2 | File Write Access | RU+WD | `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_write/mod.rs`, `app/test/e2e/specs/tool-filesystem-flow.spec.ts` | ✅ | Was 🟡 — WDIO drives memory_write_file + asserts bytes match on disk || 6.1.3 | Path Restriction Enforcement | RU+WD | `crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs`, `app/test/e2e/specs/tool-filesystem-flow.spec.ts` | ✅ | Was 🟡 — WDIO asserts traversal + absolute-path denial envelope |-| 6.1.4 | Agent deliverables in the visible Files folder | RU+VU | `crates/openhuman-core/src/agent/artifacts/files_tests.rs`, `crates/openhuman-core/src/agent/artifacts/migrate_tests.rs`, `crates/openhuman-core/src/agent/artifacts/ops_tests.rs`, `crates/openhuman-app/src/artifact_commands_tests.rs`, `app/src/services/__tests__/artifactDownloadService.test.ts`, `crates/openhuman-core/src/config/ops_files_dir_tests.rs`, `app/src/components/settings/panels/__tests__/FilesFolderSection.test.tsx`, `app/src/features/conversations/aui/MessageArtifactCards.test.tsx`, `app/src/features/conversations/aui/ArtifactPreviewPanel.refresh.test.tsx` | ✅ | Files land in `~/OpenHuman/projects/Files` with human names (`create_new`, ` (2)` on collision, shared across accounts without clobbering; per-account listing); escape guard on the recorded file; "file missing" for a file removed outside OpenHuman; crash-safe idempotent migration of legacy files; Download resolves an artifact id through the core; the folder is chosen in Settings → Agent OS access and validated (absolute, not protected, not inside the data folder); Show in folder on the settings row (#5505); in chat, each ready file is a card in the reply that made it and opens in the preview panel, whose Download saves it through the OS save dialog (the chat Files panel was removed in #7888) |+| 6.1.4 | Agent deliverables in the visible Files folder | RU+VU | `crates/openhuman-core/src/artifacts/files_tests.rs`, `crates/openhuman-core/src/artifacts/migrate_tests.rs`, `crates/openhuman-core/src/artifacts/ops_tests.rs`, `crates/openhuman-app/src/artifact_commands_tests.rs`, `app/src/services/__tests__/artifactDownloadService.test.ts`, `crates/openhuman-core/src/config/ops_files_dir_tests.rs`, `app/src/components/settings/panels/__tests__/FilesFolderSection.test.tsx`, `app/src/features/conversations/aui/MessageArtifactCards.test.tsx`, `app/src/features/conversations/aui/ArtifactPreviewPanel.refresh.test.tsx` | ✅ | Files land in `~/OpenHuman/projects/Files` with human names (`create_new`, ` (2)` on collision, shared across accounts without clobbering; per-account listing); escape guard on the recorded file; "file missing" for a file removed outside OpenHuman; crash-safe idempotent migration of legacy files; Download resolves an artifact id through the core; the folder is chosen in Settings → Agent OS access and validated (absolute, not protected, not inside the data folder); Show in folder on the settings row (#5505); in chat, each ready file is a card in the reply that made it and opens in the preview panel, whose Download saves it through the OS save dialog (the chat Files panel was removed in #7888) |### 6.2 Shell & Gitdiff --git a/scripts/ci/check-storage-bypass.mjs b/scripts/ci/check-storage-bypass.mjsindex f12f2fd079..a62221281d 100755--- a/scripts/ci/check-storage-bypass.mjs+++ b/scripts/ci/check-storage-bypass.mjs@@ -145,13 +145,13 @@ export const ALLOW = new Map("one process-global savings counter snapshot, cheap to lose; not per-user data a scope would mean anything for",],[- "agent/artifacts/files.rs",+ "artifacts/files.rs","json-write","match tokio::fs::OpenOptions::new()","reserves the artifact's content file in the user-visible files folder; the bytes stay a file on every backend (the port has no blob store), only the records moved",],[- "agent/artifacts/tiny_store.rs",+ "artifacts/tiny_store.rs","json-write","tokio::fs::write(&dest, latest.body.as_bytes()).await?;","writes a text artifact's newest version into its file in the user-visible files folder; the deliverable is a user file on every backend, the versioned record itself goes through the artifact store",diff --git a/tests/media_generation_e2e.rs b/tests/media_generation_e2e.rsindex a0475154d6..a7970c6786 100644--- a/tests/media_generation_e2e.rs+++ b/tests/media_generation_e2e.rs@@ -265,7 +265,7 @@ async fn media_tools_deliver_images_and_videos_through_the_backend_proxy() {"blob-backed generation must not leave a filesystem staging directory");for (id, kind) in [(&image_id, "image"), (&video_id, "video")] {- let record = openhuman_core::agent::artifacts::ops::ai_get_artifact(&config, id)+ let record = openhuman_core::artifacts::ops::ai_get_artifact(&config, id).await.expect("filed artifact record").value;