lmcurl guide

Overview

lmcurl combines an upstream libcurl HTTP/HTTPS engine, a pure C++17 BER/ASN.1 LDAPv3 client, a JSONPath/XPath/JSON Schema contract assertion layer, a cost-bounded LLM evaluation harness, and the 226-signature lmcode_std_v3 standard library inside a single native executable. Programs can run as standalone command-line utilities or as compiled _lmcode_ bytecode modules orchestrated by lmscript.

Architecture and protocol modes

The host divides network and assertion workloads into composable layers so scripts remain concise and deterministic:

Security, redaction, and resource boundaries

Automated network and LLM testing often handles credentials and untrusted payloads. lmcurl enforces strict runtime safeguards:

Standard lmcode_std_v3 REST and CLI interfaces

In addition to its client contexts, lmcurl embeds the full 226-signature lmcode_std_v3 standard library (cpp/stdlib/rest.hpp). Any _lmcode_ function annotated with a route or flag string can implement one of the standard interfaces:

p = _lmcode_ cli="lmcurl" install="github:lmctl-ai/lmcurl@latest";
@"--env"
fn opt_env(x: RestExchange) -> void implements CliOption {
  x.set("env", x.query("env"));
}

@"status"
fn cmd_status(x: RestExchange) -> void implements CliCommand {
  let count = x.increment("hits");
  x.send(x.get("env") + ":" + str_from_int(count));
}

@"/items/:id"
fn get_item(x: RestExchange) -> void implements RestGet {
  x.set_header("X-Item-Id", x.param("id"));
  x.json("{\"id\":\"" + x.param("id") + "\"}");
}

rest_config("session", "global");
assert_eq(rest_cli(str_split("--env=staging status", " ")), "staging:1");
assert_eq(rest_cli(str_split("/items/42", " ")), "{\"id\":\"42\"}");
end _lmcode_

Combining lmcurl with lmhtml and lmldap

In multi-host LMScript workflows, lmcurl downloads pages or queries directory services and writes structured JSON, CSV, or HTML artifacts that downstream hosts consume. For example, web scraping workflows fetch HTML documents with lmcurl using parallel download batches and Request.proxy(""), then invoke lmhtml to select DOM nodes, verify links, or diff structural snapshots. Similarly, identity integration tests start an ephemeral lmldap server and exercise both RFC 4516 search URLs and authenticated modify or compare operations from lmcurl.