Elyra
Elyra The coding agent eTerm The terminal that knows where each command ends Huskarl AI colleagues on your own Mac Starf An activity monitor for Apple silicon that never invents a number etrans An SSH and SFTP client for macOS Elyra VM Virtual machines for macOS, Linux and Windows on your Mac Litr A small, native web browser for macOS Notr A notebook for macOS e The native code editor Elyra Grove Native local development environment Askr The real server for Laravel & PHP Elyra Framework Rust + Svelte 5 framework for desktop apps Elyra Conductor Local project conductor Refr Local-first PDF workspace for macOS Elyra Workspace A desktop workspace for coding agents eDock A container runtime for the Mac Elyra SQL Server MySQL-compatible SQL server in Rust Elyra Félagi Agents as teammates on one board Elyra SQL Client Native desktop SQL workbench Elyra SQL Anywhere Replication-ready SQL engine Elyra Sjá SEO & GEO workspace for macOS Elyra DataGrid Server-driven data grid for Laravel
Reference
Ratatosk CLI
Roadmap
RFC 0001: make:resource
RFC 0002: live queries
RFC 0003: MCP server
RFC 0004: MCP resource templates
RFC 0005: a Laravel backend
RFC 0006: Laravel broadcasting
RFC 0007: offline and sync
RFC 0008: Laravel notifications
RFC 0009: Files
RFC 0010: Laravel abilities
RFC 0011: an assistant in the app
RFC 0012: @elyra/ui
RFC 0013: the assistant sees the window
RFC 0014: Elyra Inspector
RFC 0015: presence
RFC 0016: capabilities per window
RFC 0017: record invalidation
RFC 0018: the assistant's answer, streamed
RFC 0019: a window from the tray
RFC 0020: an app that stays in the tray
RFC 0021: a server chosen at sign-in
RFC 0022: signed in to more than one server
RFC 0023: private channels a window listens to
RFC 0024: updates from the backend
RFC 0025: commands and configuration
RFC 0026: the running app, for coding agents
RFC 0027: the assistant's code mode
RFC 0028: the tray's icon, and the app's
RFC 0029: installers
RFC 0030: the app's identity on Windows
RFC 0031: a token per workspace
RFC 0032: the microphone
RFC 0033: diagnostics the user can send
RFC 0034: one screen in several states at once
RFC 0035: point at it, and hand it to the agent
RFC 0036: rata check, the app checked as a whole
RFC 0037: Theme Studio
RFC 0038: edit it in its own app
RFC 0039: a write shown at once in every window
RFC 0040: the two halves agree
RFC 0041: Quick Look
RFC 0042: follow a colleague
RFC 0043: every write seen
RFC 0044: composite keys
RFC 0045: bigint all the way
RFC 0046: pivot columns
RFC 0047: relations on any key
RFC 0048: more providers
RFC 0049: OpenAI web search
RFC 0050: integer-keyed arguments
RFC 0051: citations
RFC 0052: open documents
RFC 0053: exit hooks
RFC 0054: the gui feature
RFC 0055: menus that change
RFC 0056: the framework's own words
RFC 0057: rata upgrade
RFC 0058: @elyra/charts
RFC 0059: all of WireCharts
RFC 0060: exporting a chart
RFC 0061: zoom
RFC 0062: printing
RFC 0063: linked charts
RFC 0064: report pages
RFC 0065: marks
RFC 0066: taking a table out
RFC 0067: totals
RFC 0068: columns the user picks
RFC 0069: filters
RFC 0070: saved views
RFC 0071: lists over Laravel
RFC 0072: targets
RFC 0073: every row out
RFC 0074: grouped rows
RFC 0075: pinned columns
RFC 0076: views on the server
RFC 0077: every match selected
RFC 0078: editing in the table
RFC 0079: many cells at once
RFC 0080: a value for the selected rows
RFC 0081: a new row in the table
RFC 0082: a related record in a cell
RFC 0083: a filter by a related record
RFC 0084: one write for many rows
RFC 0085: the keys shown
RFC 0086: many rows in Laravel
RFC 0087: many rows deleted
RFC 0088: the trash
Release notes
Changelog
Elyra

HTTP client

Http is Laravel's Http facade in Rust, over reqwest (feature http). App binds one, so a command resolves it. It's the base for the Laravel backend (RFC 0005), and works for any other API.

use elyra::http::Http;
use std::time::Duration;

#[command]
async fn rates(ctx: Ctx) -> elyra::Result<Rates> {
    let res = ctx.get::<Http>()
        .get("https://api.example.com/rates")
        .query(&[("base", "NOK")])
        .token(&api_key)                       // Authorization: Bearer …
        .timeout(Duration::from_secs(10))
        .retry(3, Duration::from_millis(200))
        .send()
        .await?;
    Ok(res.json()?)
}

The request

Method Does
.get(url) / .post / .put / .patch / .delete start a request
.query(&q) query parameters: a struct, a map, or pairs. None fields are left out; a list becomes key[]=…, as Laravel reads it
.json(&body) a JSON body
.header(name, value) / .token(t) headers; token is Authorization: Bearer
.attach(name, path) a file, streamed from disk as a multipart/form-data part (files)
.attach_as(name, path, file_name, type) / .attach_bytes(name, bytes, file_name, type) a file under another name and type, or bytes as a file
.field(name, value) / .fields(&f) text fields beside the files; fields flattens a struct as query does
.on_progress(f) called with the bytes sent or received so far, and the total
.timeout(d) the deadline (30 s by default); for a transfer, the time without progress
.retry(times, sleep) try again after a failed connection or a 5xx, for GET / PUT / DELETE
.retry_any_method() retry POST / PATCH too, when the server makes it safe
.send().await a Response, or an HttpError when no answer came
.download_to(path).await / .download_into(dir).await stream a successful answer to disk (files)

Every request asks for JSON (Accept: application/json), which is also what makes Laravel answer a failed validation with 422 JSON instead of a redirect.

The response

Any status is a Response: res.status(), res.ok() (2xx), res.header(name), res.text(), res.bytes(), res.json::<T>(). What a 404 means is up to the caller. The body is read whole, up to 32 MiB.

An HttpError means no usable answer:

  • Unreachable: the connection, DNS, TLS, or the timeout.
  • Insecure: not HTTPS.
  • InvalidUrl.
  • Encode / Decode: the query or body couldn't be encoded, or the response isn't the type asked for.
  • TooLarge.
  • File: a file to send or save to couldn't be read or written.
  • FileChanged: a file's size or modification time changed while it was sent.

? turns it into a command error.

Files

An attached file makes the body multipart/form-data, which Laravel reads with $request->file('receipt'). Files are read from disk in chunks while they're sent, so a large one costs no more memory than a small one:

let res = ctx.get::<Http>()
    .post("https://api.example.com/expenses")
    .attach("receipt", &path)               // its name, and a type from its extension
    .fields(&expense)                       // amount=129.5, paid=1, tags[]=…
    .on_progress(|p| println!("{} of {:?}", p.done, p.total))
    .send()
    .await?;
  • The body has a known length (Content-Length), which PHP and nginx prefer to chunks.
  • A retry reads the file again from the start. A POST is retried only with .retry_any_method(), when the server makes repeating it safe.
  • If the file's size or modification time changes while it's sent, the request stops with FileChanged instead of sending a mix of two versions.

A download streams a successful answer to disk instead of into memory, so the 32 MiB limit doesn't apply:

// To a path the user chose in a save dialog, replacing it:
http.get(url).download_to(&path).await?;

// Into a folder, under the server's name:
let res = http.get(url).download_into(&folder).await?;
let saved = res.saved_to();   // Some("…/Invoice 7.pdf")
  • The body is written to <name>.part and renamed when it's complete, so a download that stops halfway leaves nothing that looks finished.
  • download_into names the file from Content-Disposition (filename* first) or the URL's last segment. The name is cleaned: no folders, no leading dot, none of the characters a file system refuses, not a Windows device name. A taken name is numbered: Invoice 7 (1).pdf.
  • An answer that isn't a success isn't saved: it's an ordinary Response with its body, and saved_to() is None.

For a transfer, .timeout(d) is the time without progress: a slow upload or download that keeps moving isn't cut off, and one that stalls for d is.

Safety

  • HTTPS only, except to loopback (localhost, 127.0.0.1, ::1), and that holds for every redirect too.
  • A redirect to another host or port doesn't carry Authorization or cookies.
  • Logs (elyra::http) show the method, the host, the path, the status and the duration, and a transfer's size. They never show the query, the body, a header, or a file's name.
  • A file error names the file, not its folder, which can hold the user's name.

Testing

HttpFake answers from a table, never touches the network, and records each request:

use elyra::http::{Http, HttpFake, Method};

let fake = HttpFake::new()
    .get("https://api.example.com/rates", 200, json!({ "nok": 11.0 }))
    .post("https://api.example.com/orders", 422, json!({ "errors": { "qty": ["Too many."] } }))
    .unreachable(Method::Get, "https://api.example.com/down");
let app = TestApp::new(app().swap(Http::fake(fake.clone())));

// … invoke commands …
let sent = fake.assert_sent("GET", "https://api.example.com/rates");
assert_eq!(sent.header("authorization"), Some("Bearer t0ken"));
fake.assert_not_sent("DELETE", "https://api.example.com/orders/1");

Multipart parts are recorded too, and get_bytes answers a download:

let fake = HttpFake::new()
    .post("https://api.example.com/expenses", 201, json!({ "id": 1 }))
    .get_bytes("https://api.example.com/invoices/7/pdf", 200, pdf, "invoice-7.pdf");
// …
let sent = fake.assert_sent("POST", "https://api.example.com/expenses");
let receipt = sent.part("receipt").unwrap();
assert_eq!(receipt.file_name.as_deref(), Some("receipt.pdf"));
assert_eq!(sent.part("amount").unwrap().text(), "129.5");

Routes match the URL without its query. A trailing * matches the rest, and a later route wins over an earlier one. A request with no route fails clearly, rather than getting an empty answer.

Related