Skip to main content

laravel_rust_studio/
lib.rs

1//! Studio shows what a running [Laravel for Rust](https://laravel.com/rust) application did:
2//! every request with its queries, each error with its source line, the mail it sent, its queued
3//! jobs, and its durable workflow runs. It answers a developer in the browser, and a coding agent
4//! in Markdown and over MCP.
5//!
6//! Add the provider in `src/app.rs`, run the application, and open `/studio`:
7//!
8//! ```no_run
9//! use laravel::Application;
10//! use laravel_rust_studio::StudioServiceProvider;
11//!
12//! Application::configure().with_providers(|providers| {
13//!     providers.add(StudioServiceProvider::new());
14//! });
15//! ```
16//!
17//! Laravel already traces its requests, queries, cache operations, jobs, and workflow steps.
18//! Studio listens to that with a [`StudioLayer`], so an application needs no instrumentation of
19//! its own. What it hears goes into a [`StudioStore`], which each process shares with the others
20//! through files in `storage/studio`. A queue worker's traces and mail therefore show up in the
21//! web server's Studio.
22//!
23//! Studio answers in the `local` and `testing` environments. Elsewhere it responds `403` and
24//! captures nothing, until [`StudioServiceProvider::authorize`] says who may see it.
25//!
26//! # For coding agents
27//!
28//! | | |
29//! | --- | --- |
30//! | `GET /studio/api/agent/diagnose?format=markdown` | What's wrong, with the source line of each problem |
31//! | `GET /studio/api/agent/last-request?format=markdown` | What the latest request did, as a tree of its spans |
32//! | `GET /studio/api/agent/wait?for=mail` | Waits for a job, a workflow, or a message instead of sleeping |
33//! | `POST /studio/mcp` | The same as MCP tools |
34//! | `GET /studio/llms.txt` | Every endpoint |
35//!
36//! The `studio:skill` command writes a skill that teaches an agent all of this.
37//!
38//! # Features
39//!
40//! | Feature | Enables |
41//! | --- | --- |
42//! | `database` (default) | The workflow and queue tables, and each query's bindings and source line. An application without a database turns it off |
43//! | `database-sqlite` | Building Studio on its own, outside an application, which chooses the database driver |
44//! | `database-postgres`, `database-mysql` | Running Studio's own tests against those databases |
45
46pub mod agent;
47pub mod config;
48pub mod docs;
49pub mod http;
50pub mod layer;
51pub mod markdown;
52pub mod mcp;
53pub mod provider;
54pub mod queues;
55pub mod store;
56pub mod types;
57pub mod workflows;
58
59mod hooks;
60mod journal;
61
62pub use crate::config::{AuthorizeFn, StudioConfig, StudioGate};
63pub use crate::layer::StudioLayer;
64pub use crate::provider::StudioServiceProvider;
65pub use crate::store::{ProcessInfo, QueryFilter, StudioStore, TraceFilter};