Agentica 0.35.0
· release
Agentica 0.35.0 is out. This post lists what changed; the full list is in the changelog.
What is new #
HTTP downloads with no size limit #
HTTP.download, HTTP.read_body and HTTP.open no longer stop a body at 256 MiB. HTTP.download streams the body to a hidden .agc-part file beside the target and renames it over the target only after a clean end, so the target is always the old file or the whole new one. DownloadOptions takes an optional sha256: a body with another digest is an error and leaves the target alone.
Here a download from a local server, with the right digest and then a wrong one:
import HTTP from "std/http"
def main() -> Void
client = HTTP.client().unwrap!
url = "http://127.0.0.1:18350/asset.bin"
good = "16e7bfe7e88ab63c69b0cccdb9e65ca9ba55fdce5e4e605dec9fa418b05dc790"
bad = "00000000000000000000000000000000000000000000000000000000000000ff"
for digest in [good, bad]
case HTTP.download(client, url, "asset.bin", HTTP.DownloadOptions(sha256: some(digest)))
ok(saved) -> puts("ok, #{saved.bytes_written} bytes")
error(e) -> puts(e.message)
end
end
puts(Dir.list(".").unwrap!)
HTTP.close_client(client)
endok, 29 bytes
http: the body does not match the sha256 digest
["asset.bin"]timeout_ms and max_total_bytes are Optional[Int] and none by default; set one with some(...). See HTTP.download.
The rename step is also yours: Path.replace(from, to) renames a file over another in one step, and a reader of to sees the old file or the new one, never neither.
def main() -> Void
_ = File.write_text("settings.json", "{\"v\": 1}")
_ = File.write_text("settings.json.new", "{\"v\": 2}")
puts(Path.replace("settings.json.new", "settings.json").ok?)
puts(File.read_text("settings.json").unwrap!)
endtrue
{"v": 2}See Path.replace.
Dates and times #
Time.Date, Time.TimeOfDay, Time.NaiveDateTime and Time.DateTime (at a fixed UTC offset) are checked builtin records. A value that is not a real date cannot be built. They read and write ISO 8601, take Unix time, add days or microseconds, and print with strftime.
def main() -> Void
day = Time.Date.iso8601("2026-01-31").unwrap!
puts(day.add_days(30).unwrap!.iso8601)
puts(day.cwday)
puts(Time.Date.days_in_month(2028, 2).unwrap!)
stamp = Time.at(1_800_000_000).unwrap!
puts(stamp.iso8601)
puts(stamp.strftime("%a %d %b %Y, %H:%M"))
end2026-03-02
6
29
2027-01-15T08:00:00.000000Z
Fri 15 Jan 2027, 08:00std/utc is deprecated, and it will be removed in a later release: use Time. See dates and times.
JSON keeps key order, and values compare with == #
A JSON object now keeps its keys in the order you gave them, and JSON.parse keeps the order of the text. Two JSON.Values compare with == and !=: object keys in any order, arrays in order, and numbers by value, so 1 == 1.0.
def main() -> Void
a = JSON.parse("{\"b\": 1, \"a\": [1, 2]}").unwrap!
b = JSON.parse("{\"a\": [1.0, 2], \"b\": 1.0}").unwrap!
puts(JSON.encode(a))
puts(a == b)
puts(a == JSON.parse("{\"a\": [2, 1], \"b\": 1}").unwrap!)
end{"b":1,"a":[1,2]}
true
falseA list, map or struct that holds a JSON.Value has equality too, and Test.eq compares the same way. See JSON.
Processes and the program name #
Process.pid(p) gives the operating system’s process id of a child, and System.program_name() gives the path of the main program as it was given, the .agc or the .agcb file.
def main() -> Void
puts(System.program_name())
child = Process.spawn("sleep", ["1"]).unwrap!
puts(Process.pid(child).unwrap! > 0)
_ = Process.wait(child, 5000)
endSee Process.pid.
Breaking changes #
- JSON key order.
JSON.from,JSON.object,JSON.parse, a decodedMapandJSON.nodeno longer sort keys, and a struct writes its fields in declaration order.JSON.encode(JSON.parse(x))keeps the order ofx, so it is not a canonical form and no longer compares two texts regardless of key order. Compare the parsed values with==. Code or goldens that expected sorted keys change. --jsonkey order. The diagnostics and reports of--jsonlist their keys in field order. A tool that matched them as text sees a new order.- No body limit.
HTTP.download,HTTP.read_bodyandHTTP.openno longer end a body at 256 MiB. If a program relied on that cap, setmax_total_byteson a download, or count the bytes in the read loop.DownloadOptions.timeout_msandmax_total_bytesare nowOptional[Int]: writesome(30000)where you wrote30000. - Bytecode. A 0.34 VM rejects a
.agcbbuilt by 0.35, because nearly every one holds the newcasetrap (below). Run a 0.35.agcbon a 0.35 VM. - Log times. They have six fraction digits:
2026-10-12T10:15:02.345000Z, where it was.345Z.
Also #
- A
casethat matches no arm now stops withRUNTIME-CASE-NO-MATCHat the case, instead of going on with a stale value. Only a checker bug allows such acase. - A program whose standard output or error loses its reader (
prog | head) ends quietly with status 141, instead of aRUNTIME-INTERNALerror. agentica add NAME OWNER/REPOtakes a GitHub repository, and a tagNAME-X.Y.Zwith no--subdirtakes the folderNAMEwhen the package is there. A source that is neither anhttps://URL norOWNER/REPOisPKG-SOURCE-INVALIDwith exit 1, no longer a usage error with exit 2.- A dependency can be a whole workspace repository under one name:
finn = { git, tag, workspace = true }, oragentica add NAME URL --tag TAG --workspace. The members are imported aspkg/finn/MEMBER/MODULE. agentica installfetches the packages of one repository, pin and commit with onegit fetch.- Getting started has a Nix flake that fetches the release archives.
To install or upgrade, see getting started. The archives for Linux, macOS and Windows are on the 0.35.0 release page.