{
  "schema": 1,
  "extractor": "source",
  "std_pin": "d58f9e1ce3af39b65a1502db21c7e6656b9f2b64",
  "compiler_pin": "0261597230b46f17f7a894c5558452c19fa31b96",
  "wolf_version": "0.2.41",
  "modules": [
    {
      "name": "base64",
      "group": "Formatting and encodings",
      "tier": "core",
      "doc": "std.base64 — RFC 4648 base-64, standard and URL-safe. Stability tier:\ncore.\n\n**The byte sequence is `List[byte]` (sc35).** For eleven sprints it\nwas `List[int]` with every element in 0..255 — an interim this header\ntook on `std.hex`'s reasoning, with the promise that \"every signature\nkeeps its shape when `Bytes` lands\" (F-0035). D72/s135 landed the\ntype and s136 (wolf-lang#231) moved the eight byte builtins to it, so\nthe promise was kept literally: five signatures took the new element\ntype and no body here changed shape.\n\n**`byte_at` used to be the boundary check and is now one cast.** It\nread an element and trapped `assert` on anything outside 0..255; the\nELEMENT TYPE holds that contract now, both guards were unreachable\ncode, and what remains is `[type.byte.cast]`'s widening — spelled,\nbecause the 24-bit group arithmetic below is `int`'s and\n`[type.byte.op]` widens every operand anyway. The three `push`es in\n`decode_with` narrow back the same way (`… as byte`), which is the\nonly other line that moved.\n\n**Strictness is spelled in the name, and documented on each function.**\n`decode` is the strict RFC 4648 §4 profile: the standard alphabet, the\nlength a multiple of four, padding present and correct, and the unused\nlow bits of a truncated group required to be ZERO — so exactly one text\ndecodes to any given byte sequence, which is what makes\n`encode(decode(s)) == s` hold as well as the other direction.\n`decode_lenient` relaxes padding and canonicity for input that came\nfrom somewhere less careful. `url_decode` is §5's alphabet with\noptional padding, because `url_encode` omits it.\n`encode_raw`/`decode_raw` are strict UNPADDED standard base64 for\nage v1: no padding, whitespace, alternate alphabet or nonzero unused\nbits. Their walks are linear in input/output length. Encoding and\ndecoding branch/index on byte values: neither is a fixed-time codec.\n\nRound-tripping is the doctrine: `decode(encode(b))` is `b` for every\nbyte sequence, held over the shared adversarial fixtures in\n`tests/base64/round_trip.lu` — including the three group remainders,\nwhich is where every base-64 implementation's bugs live.\n\nDecoding is TOTAL over arbitrary UTF-8: the alphabet probe runs against\nliterals this module owns, so a non-ASCII character is a `parse` miss\nand never a `bounds` trap. The tag is `parse` and not the contract's\n`base64` because a row tag that shares a name with a module in scope\nresolves to the MODULE, silently (F-0036) — and this module is named\n`base64`.",
      "summary": "std.base64 — RFC 4648 base-64, standard and URL-safe.",
      "items": [
        {
          "name": "encode_raw",
          "kind": "fn",
          "signature": "pub fn encode_raw(b: List[byte]) -> str",
          "doc": "RFC 4648 section 4 standard-alphabet base64 without padding, as age\nspecifies. Empty bytes encode to empty text. Pure, comptime-safe;\ntotal, no rows or traps on well-typed input. Not fixed-time.\n\n```wolf-doc-example\nbase64.encode_raw(\"f\".bytes()) == \"Zg\"\nbase64.encode_raw(\"foo\".bytes()) == \"Zm9v\"\n```",
          "source": "std/base64/base64.lu",
          "line": 57,
          "tier": "core"
        },
        {
          "name": "decode_raw",
          "kind": "fn",
          "signature": "pub fn decode_raw(s: str) -> List[byte] ! {parse}",
          "doc": "Strict unpadded standard base64. Raises `parse` on padding, any\nnonalphabet byte (including whitespace, URL characters and non-ASCII),\na one-character residual group, or nonzero unused trailing bits.\nEmpty text succeeds with empty bytes. Total over UTF-8, no traps.\nPure, comptime-safe; not fixed-time. Never includes input in errors.\n\n```wolf-doc-example\nlet b = base64.decode_raw(\"Zg\")?\nbase64.encode_raw(b) == \"Zg\"\n```",
          "source": "std/base64/base64.lu",
          "line": 86,
          "tier": "core"
        },
        {
          "name": "encode",
          "kind": "fn",
          "signature": "pub fn encode(b: List[byte]) -> str",
          "doc": "`b` encoded with the standard alphabet and `=` padding — RFC 4648 §4,\nthe encoding every `Authorization: Basic` header and every PEM block\nuses. The empty sequence encodes to the empty string; output length is\nalways a multiple of four.\n\nTraps `assert` when an element is outside 0..255 (§2's trap rule).\nTotal otherwise: no error row.\n\n```wolf-doc-example\nvar b = List[byte]()\n(mut b).push(77 as byte)\nbase64.encode(b) == \"TQ==\"\n(mut b).push(97 as byte)\nbase64.encode(b) == \"TWE=\"\n(mut b).push(110 as byte)\nbase64.encode(b) == \"TWFu\"\nvar empty = List[byte]()\nbase64.encode(empty) == \"\"\n```",
          "source": "std/base64/base64.lu",
          "line": 310,
          "tier": "core"
        },
        {
          "name": "url_encode",
          "kind": "fn",
          "signature": "pub fn url_encode(b: List[byte]) -> str",
          "doc": "`b` encoded with the URL- and filename-safe alphabet (`-` and `_` for\n`+` and `/`) and NO padding — RFC 4648 §5 with its padding sentence\ntaken: `=` needs escaping in a query string, which is the whole point\nof the variant. `url_decode` accepts padding anyway, so text from a\npadding-emitting encoder still reads.\n\n```wolf-doc-example\nvar b = List[byte]()\n(mut b).push(255 as byte)\n(mut b).push(239 as byte)\nbase64.url_encode(b) == \"_-8\"\nbase64.encode(b) == \"/+8=\"\n```",
          "source": "std/base64/base64.lu",
          "line": 327,
          "tier": "core"
        },
        {
          "name": "decode",
          "kind": "fn",
          "signature": "pub fn decode(s: str) -> List[byte] ! {parse}",
          "doc": "`s` decoded with the standard alphabet, STRICTLY: `parse` unless the\nlength is a multiple of four, the padding is exactly what the byte\ncount requires, every other character is in the alphabet, and the\nunused low bits of a short final group are zero. That last clause is\nwhat makes the encoding canonical — `\"TQ==\"` decodes and `\"TR==\"`,\nwhich names the same byte with different ignored bits, does not — and\nit is why `encode(decode(s)) == s` holds for every `s` this function\naccepts.\n\nTotal: no traps. Non-ASCII input is an ordinary miss.\n\n```wolf-doc-example\nlet one = base64.decode(\"TQ==\") else List[byte]()\none.len == 1\nlet three = base64.decode(\"TWFu\") else List[byte]()\nthree.len == 3\nlet unpadded = base64.decode(\"TQ\") else List[byte]()\nunpadded.len == 0\nlet noncanonical = base64.decode(\"TR==\") else List[byte]()\nnoncanonical.len == 0\nlet bad = base64.decode(\"T!==\") else List[byte]()\nbad.len == 0\n```",
          "source": "std/base64/base64.lu",
          "line": 354,
          "tier": "core"
        },
        {
          "name": "url_decode",
          "kind": "fn",
          "signature": "pub fn url_decode(s: str) -> List[byte] ! {parse}",
          "doc": "`s` decoded with the URL-safe alphabet, padding optional. `parse` on\nany character outside that alphabet — including `+` and `/`, which\nbelong to the other variant and are a sign the caller mixed the two.\n\n```wolf-doc-example\nlet a = base64.url_decode(\"_-8\") else List[byte]()\na.len == 2\nlet b = base64.url_decode(\"_-8=\") else List[byte]()\nb.len == 2\nlet mixed = base64.url_decode(\"/+8=\") else List[byte]()\nmixed.len == 0\n```",
          "source": "std/base64/base64.lu",
          "line": 370,
          "tier": "core"
        },
        {
          "name": "decode_lenient",
          "kind": "fn",
          "signature": "pub fn decode_lenient(s: str) -> List[byte] ! {parse}",
          "doc": "`s` decoded with the standard alphabet, forgivingly: padding may be\nabsent or short, and a final group's unused bits may be anything.\n`parse` still answers for a character outside the alphabet and for a\ntrailing group of one character, which encodes no byte at all.\n\nUse it for input from elsewhere; use `decode` for input your program\nwill re-encode, because only the strict profile promises the text back\nunchanged.\n\n```wolf-doc-example\nlet a = base64.decode_lenient(\"TQ\") else List[byte]()\na.len == 1\nlet b = base64.decode_lenient(\"TR\") else List[byte]()\nb.len == 1\nlet c = base64.decode_lenient(\"TWFu\") else List[byte]()\nc.len == 3\nlet bad = base64.decode_lenient(\"T\") else List[byte]()\nbad.len == 0\n```",
          "source": "std/base64/base64.lu",
          "line": 393,
          "tier": "core"
        }
      ]
    },
    {
      "name": "bech32",
      "group": "Formatting and encodings",
      "tier": "core",
      "doc": "std.bech32 — BIP-173 checksummed base32. Stability tier: core.\nThe checksum is Bech32 (constant 1), NOT Bech32m. This module has\nno Bitcoin address or witness-version semantics. Generic data are\n5-bit words in List[byte]; the byte helpers additionally check exact\ndecoded length and canonical 8-to-5 padding for native age keys.\nBIP-173's 90-character bound applies here. Native X25519 age keys\nfit; this is not the age extension for arbitrarily long PQ keys.\nDecoders reject mixed case and normalize HRPs to lowercase. Encoders\nproduce lowercase; callers may uppercase the WHOLE result for an age\nidentity's presentation. Neither direction corrects errors or renders\ninput in an error. All failures are `parse`, not traps. Pure,\ncomptime-safe.\n\n**No division, branch or table index on a data character (sc84,\nwolf-std#151).** An age identity is a secret key in this encoding, so\nthe codec treats every data character and word as secret: the\nalphabet is read by a constant 32-step pass with an arithmetic match\n(`value`, `char_of`), case is folded by arithmetic flags, each\nchecksum step selects its generator terms by masks, the 8-to-5 and\n5-to-8 regroupings are shifts and masks on a `wrapping[u64]` word,\nand an invalid character is remembered and refused after the whole\nstring has been read. What still branches: lengths, the HRP (public\nby format), the position of the last `1`, and the final verdicts\n(checksum, padding, length, mixed case), whose outcome is the\npublished answer. This is a source-level statement plus a\ngenerated-code gate: `cargo xtask codegen` fails on any division\ninstruction in this module's default or release objects on the host\ntarget. It is not a timing measurement, and the compiler is not\naudited. One encoder and one decoder serve every caller, secret or\npublic; there is no separate fast path to choose by mistake.",
      "summary": "std.bech32 — BIP-173 checksummed base32.",
      "items": [
        {
          "name": "Decoded",
          "kind": "struct",
          "signature": "pub struct Decoded { hrp: str, data: List[byte], }",
          "doc": "A validated lowercase HRP and 5-bit data words, excluding checksum.\nThe words are encoding data, not necessarily whole or canonical bytes.",
          "source": "std/bech32/bech32.lu",
          "line": 36,
          "tier": "core"
        },
        {
          "name": "encode",
          "kind": "fn",
          "signature": "pub fn encode(hrp: str, data: List[byte]) -> str ! {parse}",
          "doc": "BIP-173 encoding of 5-bit `data` words. HRP must be 1..83 printable\nASCII characters; uppercase letters are normalized to lowercase.\nRaises `parse` on invalid HRP, a word above 31, or total length above\n90 characters. Total over its input types; pure, comptime-safe.\n\n```wolf-doc-example\nbech32.encode(\"a\", List[byte]())? == \"a12uel5l\"\n```",
          "source": "std/bech32/bech32.lu",
          "line": 109,
          "tier": "core"
        },
        {
          "name": "decode",
          "kind": "fn",
          "signature": "pub fn decode(s: str) -> Decoded ! {parse}",
          "doc": "Validates BIP-173 syntax/case/checksum and returns lowercase HRP and\n5-bit data excluding checksum. Raises `parse` on any failure, including\nnon-ASCII, missing/empty HRP, short checksum and length outside 8..90.\nUses the LAST separator. No correction, no input in diagnostics.\nTotal over UTF-8; pure, comptime-safe.\n\n```wolf-doc-example\nlet d = bech32.decode(\"A12UEL5L\")?\nd.hrp == \"a\"\nd.data.len == 0\n```",
          "source": "std/bech32/bech32.lu",
          "line": 149,
          "tier": "core"
        },
        {
          "name": "encode_bytes",
          "kind": "fn",
          "signature": "pub fn encode_bytes(hrp: str, b: List[byte]) -> str ! {parse}",
          "doc": "Encodes bytes as MSB-first 5-bit words with zero padding, then Bech32.\nRows/traps as `encode`; the output must fit BIP-173's 90 characters.\nNative age uses HRP `age` or `age-secret-key-`, and 32 input bytes.\nPure, comptime-safe. No division, branch or table index on the bytes\n(see the module header); never log a real identity.\n\n```wolf-doc-example\nlet s = bech32.encode_bytes(\"age\", \"x\".bytes())?\nbech32.decode_bytes(s, \"age\", 1)?.len == 1\n```",
          "source": "std/bech32/bech32.lu",
          "line": 194,
          "tier": "core"
        },
        {
          "name": "decode_bytes",
          "kind": "fn",
          "signature": "pub fn decode_bytes(s: str, hrp: str, n: int) -> List[byte] ! {parse}",
          "doc": "Decodes canonical MSB-first bytes with exactly `n` bytes and the\nspecified lowercase `hrp`. Raises `parse` for any Bech32 failure,\na different HRP/length, negative n, five or more residual bits, or\nnonzero residual bits. A valid checksum alone is NOT enough.\nPure, comptime-safe; total, no traps, no input in errors.\n\n```wolf-doc-example\nlet s = bech32.encode_bytes(\"age\", \"x\".bytes())?\nlet b = bech32.decode_bytes(s, \"age\", 1)?\nb.len == 1\n```",
          "source": "std/bech32/bech32.lu",
          "line": 227,
          "tier": "core"
        }
      ]
    },
    {
      "name": "bytes",
      "group": "Strings",
      "tier": "core",
      "doc": "std.bytes — raw byte operations, including shared equality with no\nearly exit at source level for equal public lengths. Stability tier: core.\nThe nine-function historical account below predates is_equal_fixed_work;\nthat helper adds no timing certificate to the original byte operations.\n\n**This module had no code for five sprints, s37 gave it a producer, and\ns81 closed the circle.** `str.bytes()` produces the byte view\n(`List[byte]` since sc35 — one octet per element, and the TYPE says\n0..255 now) on all three lanes, and `str_from_utf8` — the prelude's\nvalidating way back, landed at s81\n(wolf-lang#58, F-0057 CLOSED) — is what `to_str` delegates to. **All\nnine reviewed functions are code now**; the module has no contract left.\n`is_utf8` keeps its job, because the question \"are these bytes text?\"\nhas a boolean answer a caller may want without the text.\n\n**`to_str` had unequal lanes for exactly one sprint, and it has three\nnow.** `str_from_utf8` is PURE (no I13 capability, no sandbox category —\nthe second such family after `json_*`) and executed on the compiler rungs\nalone at sc13, where lupin 0.1.11 answered\n`unsupported: `str_from_utf8` does not resolve` — the generic unknown-name\nrefusal rather than a reasoned decline, which is why it was filed as drift\n(F-0075). **lupin 0.1.12 resolves it and the finding is CLOSED**,\nre-measured with its own reproducer at the sc14 pin, so all nine functions\nhere are three-lane and the module has neither a contract nor an unequal\nrow left.\n\n**THE ARGUMENT POSITION IS A LEND NOW, AND EIGHT OF THESE NINE\nFUNCTIONS STOP COPYING** (s89, wolf-lang#86, F-0072 CLOSED — the ask\nthis header carried for two sprints, answered in the shape it asked\nfor). s77 made `s.bytes()` the receiver's own `{ptr, len}` wherever the\ncall was CONSUMED (`for b in s.bytes()`, `s.bytes().len`) and\nmaterialized it everywhere else — including in an ARGUMENT, which is\nhow every function here receives its bytes, so `bytes.len(s.bytes())`\ntook a heap copy of `s` for a length it was going to read in place.\ns89 is the region checker's argument one scale down: a view handed to a\ncallee is LENT for the call, the callee may read it, and it may not\noutlive the call. So write `bytes.find(s.bytes(), needle)` and the view\ncrosses without a copy.\n\nThree consequences worth knowing before writing against it.\n\n- **The verdict is the CALLEE's, and it is decided from its body.** A\n  parameter every one of whose uses is one of s77's read positions (or a\n  re-lend into another lendable parameter) is lendable; anything the\n  analysis has not proved materializes exactly as before, which is never\n  wrong and only slower. Eight of the nine below are lendable and\n  `to_str` is not: it hands its parameter to `str_from_utf8`, and a\n  builtin consumer materializes. That is upstream's measurement\n  (`wolf_mem`'s `byteview` suite, `a_builtin_consumer_materializes`),\n  cited here rather than restated, because no lane in this repository\n  can observe an allocation (§9's sc12 rule).\n- **A lend that would outlive its call is REFUSED, not quietly copied**\n  — `E1015`, with the one-word fix in the diagnostic: bind the bytes\n  first (`let bs = s.bytes()` materializes) and the bound list is an\n  ordinary value the callee may own. Nothing in this module trips it;\n  the shape that would is a function returning its own `List[byte]`\n  parameter.\n- **`from_str` is the way IN and still allocates, which is its job.** A\n  function that RETURNS a list must own it, so the copy is the price of\n  having a VALUE rather than a walk — and a caller who only wants to walk\n  should write `for b in s.bytes()` or call `std.str`'s walks, which do.\n  The `Bytes` type this header has wanted since sc05 is still the thing\n  that would make the interim currency real; the lend is what made the\n  interim stop costing a copy per call.\n\nWhat this module is FOR is unchanged and worth restating in that light:\nbytes a program HOLDS (a decoder's output, a list it built, a buffer it\nwas handed) rather than bytes it is walking through once. A one-pass\nwalk over a string's bytes belongs in `std.str` and is written there.\n\n**THE TYPE IS `List[byte]`, AND THE INTERIM IS OVER (sc35).** For nine\nsprints this header carried a recorded interim — the currency was\n`List[int]`, one element per byte, and the ELEMENT CONTRACT (0..255)\nwas a promise the library made and the type could not keep. Both\nhalves of the wait have landed. D72 / s135 gave the language\n`[type.byte]` — an 8-bit unsigned octet whose `List[byte]` strides by\n1 — and s136 (wolf-lang#231) moved the eight byte BUILTINS to it, which\nis the half that decided whether this module could spend the type.\n**So every signature below is the rename this header promised, and\nnothing else moved**: `from_str` is still `s.bytes()`, `to_str` is\nstill `str_from_utf8(b)?`, and not one function here gained a\nconversion loop.\n\n**What the rename is worth, measured through THIS module's own\nproducers rather than synthetically** (F-0104's after-table, re-run at\nthe io sites — `docs/findings.md`): a 64 KiB buffer read by\n`std.fs.read_bytes` charges **65,584 native and 65,536 checked**,\nwhere the same read as `List[int]` charged 1,048,560 and 1,048,576.\n**16.0x -> 1.00x native, 16.0x -> 1.00x checked.** The native number\nis not the 2.0x sc34 predicted for a byte buffer, and the reason is\ns136's: a PRODUCER mints its list at exact capacity through one\nmemcpy, so it pays no push-growth history at all — the 48 is one list\nheader. The 2.0x is still what a list this module GROWS by `push`\ncosts, and that residue is `[mem.region.account.1]`'s, not the\nelement width's.\n\n**Three things about the element contract are now the TYPE's job and\nnot this module's.** A `List[byte]` cannot hold 300, cannot hold -1,\nand cannot hold a non-byte — so `is_utf8`'s \"an element outside 0..255\nanswers `false`\" clause is unreachable rather than merely untested,\n`to_str`'s matching row is too, and `hex.encode`'s §11 assert has one\nfewer thing to defend. The clauses stay documented where the REASONING\nis still worth having (a validator answers, an encoder traps) and are\nmarked unreachable where the type now forbids the input.\n\n**The element is a `byte`, so reading one is a `byte` and widening is\nSPELLED.** `at` returns `byte` — it is `b[i]`, and `b[i]` on a\n`List[byte]` is an octet — so a caller comparing it to a number writes\n`bytes.at(b, i) as int == 0x80` or `bytes.at(b, i) == 0x80 as byte`.\nThat is `[type.byte.op]`'s rule and not this module's opinion: `byte`\nagainst `int` is the ordinary type mismatch, and every arithmetic\noperator widens to `int` anyway. Comparing two bytes needs no cast at\nall, which is why `find`, `starts_with` and `ends_with` did not change\na line of their bodies.\n\n**Why these five duplicate `std.list`'s names, and why that is right.**\n`len`, `is_empty`, `at`, `find`, `starts_with` and `ends_with` all have\n`std.list` counterparts, and the reason to have both is measured rather\nthan aesthetic: `std.list`'s are GENERIC, and a generic std function\nruns on the interpreter lane alone (both compiler rungs refuse\nmonomorphization at a module boundary, F-0026), while these are\nmonomorphic over `List[byte]` and run on all three. A program that has\nbytes wants the byte-tier operations to be available wherever it\ncompiles. The vocabulary is §8's, deliberately: one concept, one name,\nacross all of std — `len`, `is_empty`, `find`, `starts_with`,\n`ends_with`, `slice`, `at`.\n\n**What byte-land buys, in one line each.** `ends_with` is trivial here\nand needed the boundary primitive over `str`; `slice` can never split a\ncode point because there are no code points here; `at` is legal\nindexing where `s[i]` is refused for `str` (D25 licenses exactly this).\nThe freedom has a price, and it is the whole reason `to_str` validates:\nbytes are where the UTF-8 invariant is ALLOWED to be absent.\n\n**The border post, and why it took five sprints — kept because the\nreason is the design.** `to_str` was a reviewed contract from sc05 to\nsc12 and the blocker was never tables: nothing in the language built a\n`str` from a number (no `char`, no `from_utf8`, no `strbuf.push_byte`,\nprobed four ways at four pins), so the MATERIALIZATION step had nowhere\nto happen while the VALIDATION half sat here written and tested as\n`is_utf8`. An ASCII-only `to_str` would have been a border post that\nrefuses text, which §9 forbids, so the function waited.\n\nWhat it waited for is exactly what landed. s77 made the byte view\nbit-identical to a `str` and deliberately emitted no path back, naming\nthe reason in the compiler's own words — the view \"cannot become a\n`str` … a `List[int] -> str` conversion would have to VALIDATE\n(wolf-std's `bytes.to_str`, still blocked, and this is why: it wants a\nchecked primitive, not a cast)\". s81 wrote that primitive: a `{utf8}`\nrow rather than a trap, a cast nowhere in it, and the same six\nrejection classes `is_utf8` enumerates plus one this library could not\nhave raised at all (an element that is not a byte). std did not lower\nits standard and the toolchain did not take the shortcut; the border\npost is the same function the sc05 contract described, four lines long.",
      "summary": "std.bytes — raw byte operations, including shared equality with no early exit at source level for equal public lengths.",
      "items": [
        {
          "name": "is_equal_fixed_work",
          "kind": "fn",
          "signature": "pub fn is_equal_fixed_work(a: List[byte], b: List[byte]) -> bool",
          "doc": "Byte equality with no early exit at source level for equal lengths.\nUnequal lengths return false immediately: lengths are public inputs.\nEqual-length inputs visit every pair, OR-fold their XOR differences,\nand test the accumulated result once. Empty inputs compare equal.\nTotal: no error row, no traps on well-typed inputs. Pure, comptime-safe.\nThis source contract is NOT a fixed-time certification of generated\ncode, runtime operations, allocation, or any execution tier. Review\ngenerated code separately at the exact compiler/backend/runtime pins.\n\n```wolf-doc-example\nbytes.is_equal_fixed_work(\"abc\".bytes(), \"abc\".bytes()) == true\nbytes.is_equal_fixed_work(\"abc\".bytes(), \"abd\".bytes()) == false\nbytes.is_equal_fixed_work(\"\".bytes(), \"x\".bytes()) == false\n```",
          "source": "std/bytes/bytes.lu",
          "line": 172,
          "tier": "core"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(b: List[byte]) -> int",
          "doc": "The number of bytes in `b`. O(1). Total: no error row, no traps.\n\n```wolf-doc-example\nbytes.len(\"wolf\".bytes()) == 4\nbytes.len(\"é\".bytes()) == 2\nbytes.len(\"\".bytes()) == 0\n```",
          "source": "std/bytes/bytes.lu",
          "line": 190,
          "tier": "core"
        },
        {
          "name": "is_empty",
          "kind": "fn",
          "signature": "pub fn is_empty(b: List[byte]) -> bool",
          "doc": "Whether `b` holds no bytes. Total: no error row, no traps.\n\n```wolf-doc-example\nbytes.is_empty(\"\".bytes()) == true\nbytes.is_empty(\"x\".bytes()) == false\n```",
          "source": "std/bytes/bytes.lu",
          "line": 200,
          "tier": "core"
        },
        {
          "name": "at",
          "kind": "fn",
          "signature": "pub fn at(b: List[byte], i: int) -> byte",
          "doc": "The byte at index `i`. **BYTE INDEXING IS LEGAL HERE** — it is the\nwhole point of this type (D25 licenses `b[i]` exactly where it refuses\n`s[i]`), and this function is the spelling that does not presume the\nanswer to F-0011's builtin-versus-std question.\n\nTraps `bounds` when `i` is out of range — the language's own fault from\nthe language's own indexing, because a caller that could have checked\n`len` and did not has violated a contract (§8). The recoverable\nspelling is `std.list.get`, which raises `none`.\n\n```wolf-doc-example\nbytes.at(\"hé\".bytes(), 0) as int == 104\nbytes.at(\"hé\".bytes(), 1) as int == 195\nbytes.at(\"hé\".bytes(), 2) == 169 as byte\n```",
          "source": "std/bytes/bytes.lu",
          "line": 219,
          "tier": "core"
        },
        {
          "name": "slice",
          "kind": "fn",
          "signature": "pub fn slice(b: List[byte], from: int, to: int) -> List[byte]",
          "doc": "The bytes in `[from, to)`, as a fresh list. Never splits a code point,\nbecause there are no code points here — the freedom this view sells.\n\nTraps `assert` when the range is out of order (`to < from`), starts\nbelow zero, or ends past `len(b)`. **This is a recorded delta from the\nreviewed contract**, which said `bounds`: with `List[byte]` as the\ninterim currency there is no slice SYNTAX to inherit the language's\nfault from, so the check is std's own and the kind is the one std can\nraise (§2 — either way it is a caller contract violation, and either\nway the process ends). It becomes `bounds` when `Bytes` lands with a\nslicing form.\n\n```wolf-doc-example\nbytes.len(bytes.slice(\"wolf\".bytes(), 1, 3)) == 2\nbytes.at(bytes.slice(\"wolf\".bytes(), 1, 3), 0) as int == 111\nbytes.len(bytes.slice(\"wolf\".bytes(), 2, 2)) == 0\nbytes.len(bytes.slice(\"wolf\".bytes(), 0, 4)) == 4\n```",
          "source": "std/bytes/bytes.lu",
          "line": 241,
          "tier": "core"
        },
        {
          "name": "find",
          "kind": "fn",
          "signature": "pub fn find(b: List[byte], needle: List[byte]) -> int ! {none}",
          "doc": "The index of the first occurrence of `needle` in `b`; `none` when it\ndoes not occur. The empty needle occurs at 0, exactly as `str.find`'s\ndoes. A needle longer than `b` is a miss, not a fault. Total otherwise:\nno traps.\n\n```wolf-doc-example\n(bytes.find(\"wolf\".bytes(), \"lf\".bytes()) else 0 - 1) == 2\n(bytes.find(\"wolf\".bytes(), \"z\".bytes()) else 0 - 1) == 0 - 1\n(bytes.find(\"wolf\".bytes(), \"\".bytes()) else 0 - 1) == 0\n```",
          "source": "std/bytes/bytes.lu",
          "line": 280,
          "tier": "core"
        },
        {
          "name": "starts_with",
          "kind": "fn",
          "signature": "pub fn starts_with(b: List[byte], prefix: List[byte]) -> bool",
          "doc": "Whether `b` begins with `prefix`; the empty prefix always does. Total:\nno error row, no traps.\n\n```wolf-doc-example\nbytes.starts_with(\"wolf\".bytes(), \"wo\".bytes()) == true\nbytes.starts_with(\"wolf\".bytes(), \"lf\".bytes()) == false\nbytes.starts_with(\"wolf\".bytes(), \"\".bytes()) == true\n```",
          "source": "std/bytes/bytes.lu",
          "line": 317,
          "tier": "core"
        },
        {
          "name": "ends_with",
          "kind": "fn",
          "signature": "pub fn ends_with(b: List[byte], suffix: List[byte]) -> bool",
          "doc": "Whether `b` ends with `suffix`; the empty suffix always does. Total: no\nerror row, no traps.\n\nNote what byte-land buys: this one is three lines here and needed the\nboundary primitive to exist at all over `str`, where the tail offset\nmay fall inside a code point.\n\n```wolf-doc-example\nbytes.ends_with(\"wolf\".bytes(), \"lf\".bytes()) == true\nbytes.ends_with(\"wolf\".bytes(), \"wo\".bytes()) == false\nbytes.ends_with(\"wolf\".bytes(), \"\".bytes()) == true\n```",
          "source": "std/bytes/bytes.lu",
          "line": 345,
          "tier": "core"
        },
        {
          "name": "from_str",
          "kind": "fn",
          "signature": "pub fn from_str(s: str) -> List[byte]",
          "doc": "`s`'s bytes — infallible, because a valid `str` is always valid bytes.\nThe bare-noun/`as_`-grade direction of §1 (a view, not a conversion of\nmeaning). It is no longer the only producer: `std.fs.read_bytes` and\n`std.fs.read_chunk` hand back bytes that were never a `str` (s90,\nF-0044 closed), which is the case this module's element contract was\nalways written for. `str.bytes(s)` is the same view from the other\nside.\n\n**This function materializes, and after s77 that is a statement about\nits SIGNATURE rather than about the pin.** The language's `s.bytes()` is\nthe receiver's own pointer and length when it is consumed on the spot;\nreturning it — which is all this function does — is one of the positions\nthat still copies, and it must be, because the list outlives the\nexpression that produced it. So the allocation is the price of having a\nvalue rather than a walk, and a caller who only wants to walk should\nwrite `for b in s.bytes()` (or call `std.str`'s walks, which do). Total:\nno error row, no traps beyond allocation.\n\n**Call it when you want to KEEP the bytes, not to pass them.** Since s89\nan argument is a lend, so `bytes.len(s.bytes())` is the spelling that\nhands the eight lendable functions below the string's own two words,\nwhile `bytes.len(bytes.from_str(s))` allocates a list in order to throw\nit away. Reach for this function when the list outlives the call: a\nbuffer a program accumulates into, a decoder's output, anything held\nacross statements — which is what the doc examples below still do\nwherever a value is what the reader needs to see.\n\n```wolf-doc-example\nbytes.at(bytes.from_str(\"A\"), 0) as int == 65\nbytes.len(bytes.from_str(\"🐺\")) == 4\nbytes.at(bytes.from_str(\"🐺\"), 0) as int == 240\n```",
          "source": "std/bytes/bytes.lu",
          "line": 393,
          "tier": "core"
        },
        {
          "name": "to_str",
          "kind": "fn",
          "signature": "pub fn to_str(b: List[byte]) -> str ! {utf8}",
          "doc": "`b` as text, VALIDATED — the border post D24 demands, the one place in\nwolf where bytes become a `str`, and the reason `str` needs no validity\ncheck anywhere else.\n\nRows: `utf8`, and nothing else. **Nothing here traps**, including for\ninput this module's own element contract calls impossible: a stray\ncontinuation byte, a truncated sequence, an overlong form, a surrogate\n(U+D800..U+DFFF), a scalar above U+10FFFF, a byte that begins no\nsequence (`C0`, `C1`, `F5`..`FF`), and an element outside 0..255 are all\na MISS. Bytes are data — §2's rule, and the same reasoning that makes\n`is_utf8` answer `false` rather than trapping on a non-byte.\n\nAn interior NUL is VALID and is not a terminator: a wolf `str` carries\nits length, so `to_str` of `[119, 0, 102]` is a three-byte string.\n\n`is_utf8` is this function's predicate half and the two agree by\nmeasurement, not by construction — they are different code (one is a\ndecoder written here in divisions and range tests, the other is the\ntoolchain's), and `tests/bytes/to_str_border.lu` walks the classes\nthrough both and asserts they answer the same. Ask `is_utf8` for a\nboolean; call `to_str` when you want the text.\n\nPure: `str_from_utf8` carries no I13 capability and no sandbox\ncategory, so with `json_*` it is the second such builtin family and\nthe D33 sandbox has no reason to refuse it. That is a statement about\nthe SANDBOX and not a promise about comptime, because the engine\ncannot reach this function for an unrelated reason: `List[byte]()`\ninside a `comptime fn` is `unsupported` at resolve (F-0077), and a\n`List` is the only way to spell the argument. Measured, both compiler\nrungs, rather than inferred from the absence of a capability.\n\nDelegates to the prelude's `str_from_utf8` (s81, wolf-lang#58). **Three\nlanes** as of the sc14 pins: both compiler rungs had it at s81 and lupin\n0.1.12 resolves it too (F-0075, filed at sc13 and closed one release\nlater), so this function's test columns are all lit and no caller pays a\nlane for reading text out of bytes.\n\n```wolf-doc-example\n(bytes.to_str(bytes.from_str(\"wolf é\")) else \"?\") == \"wolf é\"\n(bytes.to_str(List[byte]()) else \"?\") == \"\"\nvar lone = List[byte]()\n(mut lone).push(128 as byte)\n(bytes.to_str(lone) else \"?\") == \"?\"\n```",
          "source": "std/bytes/bytes.lu",
          "line": 441,
          "tier": "core"
        },
        {
          "name": "is_utf8",
          "kind": "fn",
          "signature": "pub fn is_utf8(b: List[byte]) -> bool",
          "doc": "Whether `b` is well-formed UTF-8 — the predicate half of `to_str`, and\nthe one function here that reads the bytes as text rather than as\nnumbers. The empty sequence is valid.\n\nIt stays hand-written now that `to_str` exists, and the reason has\nOUTLIVED the reason it was written for. It was kept at sc13 because it\nhad three lanes where `to_str` had two (F-0075, since closed), and that\nargument is spent; what is not spent is the other one: two independent\ndecoders that must agree are worth more than one. The agreement is a\ntest (`tests/bytes/to_str_border.lu`) rather than a tautology, and it is\nthe test that would catch either side drifting — this module's RFC 3629\nreading or the toolchain's.\n\nIt rejects everything the standard rejects, not merely truncation: a\nstray continuation byte, a truncated multi-byte sequence, an OVERLONG\nform (`C0 80` for U+0000, `E0 80 80`, `F0 80 80 80`), a surrogate\n(U+D800..U+DFFF, `ED A0 80`), a scalar above U+10FFFF (`F4 90 80 80`),\nand the bytes `C0`, `C1`, `F5`..`FF` which begin no sequence at all.\n\n**An element outside 0..255 makes it `false`, not a trap.** §11 has\nelement-range violations trap `assert`, and that rule is an ENCODER's:\n`hex.encode` must not render a number it was not given. A validator is\nthe opposite case — the question \"are these bytes text?\" has an answer\nfor a non-byte, the answer is no, and a predicate that traps is a\npredicate every caller must guard before calling, which defeats it.\n\nTotal: no error row, no traps.\n\n```wolf-doc-example\nbytes.is_utf8(\"héllo 🐺\".bytes()) == true\nbytes.is_utf8(\"\".bytes()) == true\nvar bad = List[byte]()\n(mut bad).push(255 as byte)\nbytes.is_utf8(bad) == false\n```",
          "source": "std/bytes/bytes.lu",
          "line": 480,
          "tier": "core"
        }
      ]
    },
    {
      "name": "cmp",
      "group": "Foundations and ordering",
      "tier": "core",
      "doc": "std.cmp — comparison and ordering: the `Ordering` enum, the `Eq` and\n`Ord` protocols, and the min/max/clamp family. Stability tier: core.\n\nDecided here and recorded (sc01): f64 ordering. Its `Ord` is\n`total_cmp` (IEEE totalOrder), so sorting floats is legal and NaN\nhas one home (above `+inf`). See `total_cmp` for the two documented\napproximations at the current pins.\n\n**`f64` HAS AN `Eq` NOW, AND sc44 REVERSED sc01 TO GIVE IT ONE.**\nThis header said for forty-three sprints that `f64` has no `Eq`\nbecause \"IEEE partial comparison stays on the builtin operators\".\n`[type.trait.op]` (s155, wolf-lang#5) is what retires that sentence:\nsince the operator bridge landed, `==` on a type parameter IS\n`Eq.eq`, so \"stays on the builtin operator\" and \"goes through `Eq`\"\nstopped being two different places. Withholding the impl would not\nhave kept a partial order out of a total protocol; it would only\nhave made `f64` the one primitive whose `==` does not work under a\nbound, while `<` under the same bound did. The impl's body is\n`self == other` — the clause's rule that a primitive impl IS the\nbuiltin operation — and the law caveat is stated on the impl\nitself: reflexivity fails at NaN, which is exactly what the builtin\ndoes and is why `Ord for f64` is `total_cmp` and not this.\n\nINTERIM SPELLINGS (each filed, flipped on the pin bump that fixes it):\n- The absence-spelling interim is RETIRED (F-0003, dead at the sc05\n  pins, renamed tree-wide at sc06): a lowercase bare tag resolves in\n  every implementation. Until sc12 this line still described the\n  interim, in a half-renamed sentence that said the source said the\n  opposite of what it says.\n- `Ord` requires `Eq` by doctrine, and the requirement is still\n  DOCUMENTARY, but for a smaller reason than it was. s155 gave the\n  grammar a `trait_item` with an `=` form (the alias bound,\n  `[type.trait.op.alias]`) and no supertrait clause, so composition\n  this edition is an alias listing both and not `trait Ord: Eq`.\n  F-0004's operator half is RULED — `==`, `!=` and the relationals\n  dispatch through `Eq`/`Ord` by name on a type parameter or a user\n  type, which is what `std.ops` is written against — and its\n  supertrait half is what remains open.\n- **F-0006 IS RETIRED AND `impl Ord for str` SHIPS.** The finding\n  said \"wolfc rejects `<` on `str` (E0409) and one rejected body\n  poisons every test that imports this module\". Re-measured at the\n  sc44 pins on all three lanes: `cmp.Ord.cmp(\"a\", \"b\").is_lt()` is\n  `true` on the checked tier, the body passes the static ladder on\n  every lane, and nothing is poisoned. The impl is written here in\n  the same shape as `Ord for int` — two relational tests and a\n  fallthrough — and the order it reports is the language's\n  byte-lexicographic one (`[mem.str.order]`), which `std.sort`'s\n  `sort_strs` already documents is not alphabetical in any human\n  language (F-0019 owns collation).",
      "summary": "std.cmp — comparison and ordering: the `Ordering` enum, the `Eq` and `Ord` protocols, and the min/max/clamp family.",
      "items": [
        {
          "name": "Ordering",
          "kind": "enum",
          "signature": "pub enum Ordering { Less, Equal, Greater, }",
          "doc": "",
          "source": "std/cmp/cmp.lu",
          "line": 53,
          "tier": "core"
        },
        {
          "name": "Ordering.reverse",
          "kind": "fn",
          "signature": "pub fn reverse(self) -> Ordering",
          "doc": "The opposite verdict: `Less` <-> `Greater`; `Equal` is its own\nreverse. Total: no error row, no traps.\n\nExample (prose until enum methods execute at the pins, F-0002):\n`total_cmp(1.0, 2.0).reverse()` is `Greater`.",
          "source": "std/cmp/cmp.lu",
          "line": 65,
          "tier": "core"
        },
        {
          "name": "Ordering.then",
          "kind": "fn",
          "signature": "pub fn then(self, other: Ordering) -> Ordering",
          "doc": "Lexicographic composition: keep `self` unless it is `Equal`, in\nwhich case defer to `other`. Chains multi-key comparisons:\n`by_name.then(by_id)`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 76,
          "tier": "core"
        },
        {
          "name": "Ordering.is_lt",
          "kind": "fn",
          "signature": "pub fn is_lt(self) -> bool",
          "doc": "True exactly for `Less`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 85,
          "tier": "core"
        },
        {
          "name": "Ordering.is_le",
          "kind": "fn",
          "signature": "pub fn is_le(self) -> bool",
          "doc": "True for `Less` or `Equal`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 94,
          "tier": "core"
        },
        {
          "name": "Ordering.is_eq",
          "kind": "fn",
          "signature": "pub fn is_eq(self) -> bool",
          "doc": "True exactly for `Equal`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 103,
          "tier": "core"
        },
        {
          "name": "Ordering.is_ne",
          "kind": "fn",
          "signature": "pub fn is_ne(self) -> bool",
          "doc": "True for anything but `Equal`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 112,
          "tier": "core"
        },
        {
          "name": "Ordering.is_ge",
          "kind": "fn",
          "signature": "pub fn is_ge(self) -> bool",
          "doc": "True for `Greater` or `Equal`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 121,
          "tier": "core"
        },
        {
          "name": "Ordering.is_gt",
          "kind": "fn",
          "signature": "pub fn is_gt(self) -> bool",
          "doc": "True exactly for `Greater`. Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 130,
          "tier": "core"
        },
        {
          "name": "Eq",
          "kind": "trait",
          "signature": "pub trait Eq { fn eq(self, other: Self) -> bool }",
          "doc": "Equivalence. Law: `eq` is reflexive, symmetric, transitive; `Ord`\nimplementors agree with it (`cmp(a, b).is_eq() == Eq.eq(a, b)`).",
          "source": "std/cmp/cmp.lu",
          "line": 141,
          "tier": "core"
        },
        {
          "name": "Ord",
          "kind": "trait",
          "signature": "pub trait Ord { fn cmp(self, other: Self) -> Ordering }",
          "doc": "Total order. Law: trichotomy (exactly one of Less/Equal/Greater),\nantisymmetry, transitivity. Requires `Eq` by doctrine (see the\nmodule header for why the requirement is documentary today).",
          "source": "std/cmp/cmp.lu",
          "line": 148,
          "tier": "core"
        },
        {
          "name": "min",
          "kind": "fn",
          "signature": "pub fn min[T: Ord](a: T, b: T) -> T",
          "doc": "Least of `a` and `b` under `Ord`; returns `a` on a tie (the stable\nchoice). Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 327,
          "tier": "core"
        },
        {
          "name": "max",
          "kind": "fn",
          "signature": "pub fn max[T: Ord](a: T, b: T) -> T",
          "doc": "Greatest of `a` and `b` under `Ord`; returns `a` on a tie (the\nstable choice). Total: no error row, no traps.",
          "source": "std/cmp/cmp.lu",
          "line": 337,
          "tier": "core"
        },
        {
          "name": "clamp",
          "kind": "fn",
          "signature": "pub fn clamp[T: Ord](v: T, lo: T, hi: T) -> T",
          "doc": "`v` limited to `[lo, hi]`: `lo` when `v < lo`, `hi` when `v > hi`,\nelse `v`. Traps `assert` when `lo > hi` — a contract violation the\ncallee cannot repair (`[conf.trap.map]`: user assertions).",
          "source": "std/cmp/cmp.lu",
          "line": 348,
          "tier": "core"
        },
        {
          "name": "total_cmp",
          "kind": "fn",
          "signature": "pub fn total_cmp(a: f64, b: f64) -> Ordering",
          "doc": "IEEE totalOrder over floats, monomorphic: -inf < negative reals <\n-0.0 < +0.0 < positive reals < +inf < NaN. Total: no error row, no\ntraps (f64 division by zero is IEEE, not a trap — X3 governs\nintegers).\n\nTwo documented approximations at the current pins (no f64 bit\nintrinsics exist to do better): NaN is one value — the sign and\npayload of a NaN are not observed, so every NaN sorts above `+inf`\nand all NaNs compare `Equal`; totalOrder's -NaN-below--inf home is\nnot represented.\n\n**Back in the fence at sc47, verbatim, as sc44 promised.** These\nfour lines were a `wolf-doc-example` from sc01 to sc43, went to\nprose at sc44 when `==` between two `Ordering`s became\n`fail(E0301)` on both compiler rungs (the operator trait resolved\nby BARE name, and an importer of this module has only `cmp.Eq`),\nand wolf-lang#336 closed that in v0.2.12. Measured here at\n0.2.12/0.1.34: all four lines, all three lanes, `exit(0)`.\n\nEach line is `true`: `total_cmp(1.0, 2.0)` agrees with\n`total_cmp(-1.0e9, 3.5)` (both `Less`), `total_cmp(2.0, 1.0)` with\n`total_cmp(0.0 / 0.0, 1.0)` (both `Greater` — NaN above every real),\n`total_cmp(4.5, 4.5)` with `total_cmp(0.0 / 0.0, 0.0 / 0.0)` (both\n`Equal` — all NaNs are one value here), and `total_cmp(-0.0, 0.0)`\nwith `total_cmp(1.0, 2.0)` (both `Less` — the sign of zero is\nobserved).\n\n```wolf-doc-example\ncmp.total_cmp(1.0, 2.0) == cmp.total_cmp(-1.0e9, 3.5)\ncmp.total_cmp(2.0, 1.0) == cmp.total_cmp(0.0 / 0.0, 1.0)\ncmp.total_cmp(4.5, 4.5) == cmp.total_cmp(0.0 / 0.0, 0.0 / 0.0)\ncmp.total_cmp(-0.0, 0.0) == cmp.total_cmp(1.0, 2.0)\n```",
          "source": "std/cmp/cmp.lu",
          "line": 410,
          "tier": "core"
        }
      ]
    },
    {
      "name": "deque",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.deque — `Deque[T]`, the double-ended queue. Stability tier: core\n(the API; the generic implementation is blocked).\n\nSame blocker as `std.set`, same honesty: a `Deque[T]` is std-defined\ngeneric data, `struct Deque[T] { … }` is E0201 in both implementations\nat the pins (s16), and no implementation provides a deque builtin.\nThe difference is that a deque needs no element protocol at all — only\nstorage — so the semantics ARE provable today at a concrete element\ntype: **`std/x/deque_int/` is the running prototype** (nursery, D31\nclock), a `DequeInt` over one `List[int]` plus a head index, with all\nten operations executing under both implementations. This module's\ngeneric version is that prototype with `int` replaced by `T`.\n\nReviewed inventory (10), each with its contract, exactly as it will\nland:\n\n```text\npush_back[T](mut d: Deque[T], v: T)\n    Appends at the back. Amortized constant. Total.\npush_front[T](mut d: Deque[T], v: T)\n    Prepends at the front. Amortized constant. Total.\npop_back[T](mut d: Deque[T]) -> T ! {none}\n    Removes and returns the back element; `none` when empty.\npop_front[T](mut d: Deque[T]) -> T ! {none}\n    Removes and returns the front element; `none` when empty.\nfront[T](d: Deque[T]) -> T ! {none}\n    The front element, left in place; `none` when empty.\nback[T](d: Deque[T]) -> T ! {none}\n    The back element, left in place; `none` when empty.\nlen[T](d: Deque[T]) -> int\n    Number of elements. Total.\nis_empty[T](d: Deque[T]) -> bool\n    `len(d) == 0`. Total.\nclear[T](mut d: Deque[T])\n    Empties `d`, keeping it usable. Total.\nto_list[T](d: Deque[T]) -> List[T]\n    Fresh list, FRONT to BACK — the one order this type promises.\n```\n\nNo tests ship against this module (nothing to run; an itemless import\nis E0305). The prototype's tests are `tests/x/deque_int/*`, and they\nare the evidence for the contract above.",
      "summary": "std.deque — `Deque[T]`, the double-ended queue.",
      "items": []
    },
    {
      "name": "env",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.env — the program's arguments and the host's environment\nvariables. Stability tier: core.\n\n**This is the module that lets a project stop holding its input as\ndata.** Until argv arrives, every program in a corpus is a literal\nwith a `main` around it; `args()` is the seam where a real one starts.\n\n**Capability: `env` (I13).** Every function here except the two pure\nentry helpers reaches the host's process context, is tagged `env` in\nthe toolchain's sandbox table, and is categorically refused at\ncomptime (D33) for the reason the table gives: *determinism and\nconfinement — environment contents differ per machine and may hold\nsecrets*. The refusal is `E0701`; `tests/env/comptime_refuses.lu`\nholds it one level down at the builtin, because a `comptime fn` cannot\ncall across a module boundary at this pin (F-0051).\n\n`entry_key` and `entry_value` are PURE and comptime-safe — they cut a\n`K=V` line and touch nothing. §14 says to state that exception\nexplicitly, because in a capability module the pure function is the\nsurprising one.\n\n**Errors are rows and the vocabulary is the toolchain's, verbatim**\n(§14): `missing` for a variable the host does not have, `utf8` for a\nvalue the host holds in an encoding this machine cannot decode, and\n`invalid` for a NAME the platform cannot store. std adds no\ntranslation layer, no error type of its own, and no coarsening a\ncaller did not ask for. Nothing here traps: a host that does not have\na variable is not a caller contract violation.\n\n`missing` joins §2's absence family — \"there is nothing here\" — while\n`invalid` is an error mark: it names an argument the CALLER got wrong\n(an empty name, or one containing `=` or NUL), and it is a row rather\nthan a trap only because the platforms disagree about which names they\nwill hold, so a caller cannot portably check in advance.\n\n**The arguments are the program's, not the runtime's.** `args()` is\nwhat the user typed after the program name — it does not include the\nexecutable path, and it does not include the toolchain's own flags.\nUnder `wolf conform-run` and `lupin conform-run` there are NO\narguments on any lane, by design (the checked machine mirrors the\nstdin posture and the native rung runs the binary bare), so\n`args().len` is 0 in every test in this repository and in every doc\nexample below. `wolf run file.lu a b c` is where real arguments\narrive. A test that asserted a specific argument would be asserting\nthe rig, not the language.\n\n**The invocation name and the byte arguments: `arg0` and `args_bytes`\n(sc75, wolf-std#98; s261, `[os.env.argv]`, wolf 0.2.36).** `arg0()` is\nargv[0] exactly as the program was invoked — a bare `PATH` name, an\nabsolute path, `./prog`, a symlink's own name, the name a shell's\n`exec -a` chose — and not the resolved executable, which is the\nreviewed `program()` below. `args_bytes()` is every argument as bytes,\n**the name first** (argv[0], then argv[1..]), verbatim on unix and\nWTF-8 on windows, so a program can read an argument that is not text.\nThe checked machine takes its argv from `conform-run --checked\n--argv-hex=HEX`, repeated, the first occurrence argv[0]\n(`[exec.checked.argv]`; without it the argv is empty, so `arg0()` is\nempty text); `wolf run --checked` is a native build, not that machine.\n\n**The text trap.** `args()`, `arg(i)` and `arg0()` read text, and a\nwolf `str` is UTF-8 by definition, so an argument they read that is not\nUTF-8 is not a row and not a lossy decode: the program traps\n`argument-utf8` (`[conf.trap.set]`; exit 134 at the native process\nboundary), with the message `argument N is not UTF-8; read it with\nenv_args_bytes()`, N the OS argv index (the name is 0). `args()` and\n`arg(i)` never decode the name and `arg0()` decodes nothing else, so a\nprogram that may be handed bytes reads `args_bytes()` and decodes what\nit wants with `str_from_utf8`, which answers its `utf8` row instead.\n\n**`set` writes, and what it writes to is not the same place on every\nlane.** The checked machine keeps a machine-local overlay; the native\nrung writes the real process environment. The same program observes\nthe same answers either way — which is exactly what makes a round\ntrip (`set` then `get`) the honest test — but a value set here is not\nvisible to a child process on the checked lane, and `std.process`\ndoes not exist yet to notice.\n\n**The working directory: `cwd` and `set_cwd` (s215).** `cwd` was a\nreviewed contract here because the builtin tier had a READ (`os_cwd`)\nand no WRITE, and a module that shipped the one without the other\nwould have decided by accident what a directory change is (F-0067).\nwolf-lang s215 added `os_chdir`, so the pair lands together. `cwd` is\na query about this program's situation exactly as `args` and `vars`\nare, and carries their `env` capability. `set_cwd` ACTS — it moves the\ndirectory every later relative path and every child starts in — and\nits capability is `env` too, as `set`'s is: ruling #54 (2026-10-07)\ncharges `os_chdir` to `env`, the process context it changes, and not\nto `io`, which this doc said until the pin carried the ruling (wolf\n0.2.26, `ctfe::intrinsics::host_stub`). Under s217 a package that\nreaches `set_cwd` declares `env`; both are refused at comptime. The\ndirectory is the PROCESS's, shared by every task: a program that\nchanges it while another task resolves a relative path races itself.\nThe checked machine keeps a machine-local directory (`[os.fs.chdir]`),\nfor the reason it keeps `set`'s overlay, and every relation a program\ncan observe is the same there.\n\n**This process's ids: `pid` and `ppid` (s232).** They are queries\nabout this program's situation as `cwd` is, and charge `env` as it\ndoes (ruling #70 R8). They live here and not in `std.process`, whose\n`pid` is a child's.\n\n**Who this process runs as: `uid`, `euid`, `gid`, `egid`, `groups`\n(s236).** The same kind of question as `pid` — about this process,\nread and nothing started — and here for ruling #74's reason: this\nprocess's own ids live in `std.env`. They charge `env`. Changing\nthem is `std.process.set_ids`, which charges `exec`; the names\nbehind the numbers are in the account files, which `std.os.users`\nreads.\n\n**Lanes.** The checked tier and the native rung both execute the\n`env_*` builtins; lupin 0.1.6 has none of them and refuses at resolve.\nIt resolves module bodies LAZILY, so a program that touches only\n`entry_key`/`entry_value` runs there — which is why\n`tests/env/entry_helpers.lu` has three lanes and the rest have two.\n\nReviewed contracts, blocked or unscheduled:\n\n```text\npairs() -> List[(str, str)]\n    `vars()` already split. Blocked by the language: `List[(str,\n    str)]` is `unsupported` in wolfc (F-0026's tuple-element gap),\n    which is why the split ships as two pure functions over one line\n    instead of as a shape.\nprogram() -> str\n    The executable's own path. Not in the builtin tier — `env_args`\n    is the arguments only — and inventing it from `args()` would\n    hand back the first argument, which is a different thing. Nor is\n    it `arg0()` (sc75), which is the name the invoker USED: a symlink\n    or `exec -a` makes the two differ. The resolved path is\n    `os_exe`'s answer, and a wrapper over it is its own ruling.\n```",
      "summary": "std.env — the program's arguments and the host's environment variables.",
      "items": [
        {
          "name": "cwd",
          "kind": "fn",
          "signature": "pub fn cwd() -> str ! {io}",
          "doc": "The process's working directory: the directory every relative path\nresolves against and every child starts in.\n\nRows: `io` when the host cannot answer — the directory was removed\nfrom under the process, or its path is not text this `str` tier can\nhold. Never traps. The answer is the host's canonical one (what\n`getcwd` reports), so after `set_cwd(\"a/..\")` it names the directory\nitself, not the spelling.\n\nCapability `env`; refused at comptime (D33). Delegates to `os_cwd`.\n\n```wolf-doc-example\n(env.cwd() else \"\").len > 0\n```",
          "source": "std/env/env.lu",
          "line": 149,
          "tier": "core"
        },
        {
          "name": "set_cwd",
          "kind": "fn",
          "signature": "pub fn set_cwd(path: str) -> () ! {not_found, denied, io}",
          "doc": "Make `path` the process's working directory. A relative `path`\nresolves against the current one.\n\nRows: `not_found` when nothing is at `path`; `denied` when the host\nwill not let this process enter it; `io` when `path` names something\nthat is not a directory (the host's `ENOTDIR`, which has no tag of its\nown), and for every other host failure. Never traps; a failed change\nleaves the directory where it was.\n\nFrom the call on, every relative path an fs call takes resolves\nagainst the new directory, `cwd()` answers it, and a child\n`std.process` starts begins in it. This is a shell's `cd`: it changes\nthe program, not one command, so a library that needs a child in\nanother directory should not move its caller's.\n\nCapability `env` (ruling #54), as `set`'s; refused at comptime (D33).\nDelegates to `os_chdir` (wolf-lang s215, `[os.fs.chdir]`).\n\n```wolf-doc-example\nlet here = env.cwd()?\nenv.set_cwd(\".\")?\n(env.cwd() else \"\") == here\n```",
          "source": "std/env/env.lu",
          "line": 176,
          "tier": "core"
        },
        {
          "name": "umask",
          "kind": "fn",
          "signature": "pub fn umask(mask: int) -> int ! {invalid, unsupported}",
          "doc": "Set the process's file mode creation mask to `mask`, and answer the\nmask it replaced.\n\n`[os.fs.umask]` (wolf-lang#704): `umask`. The mask is the set of\npermission bits a creation does NOT get — every file and directory\nthis process creates has the mode its creation asked for less the\nmask. Set-and-answer is the only form any host has, so READING the\nmask is two calls: `let m = env.umask(0o022)?` then `env.umask(m)?`.\n\n**The mask is the PROCESS's**: every task's, and every child's at\nits spawn (a shell's `umask` is this call). A program that changes\nit while another task creates a file races itself — the two-call\nread included — so set it where a C program does, before starting\ntasks. `fs.set_mode` after a creation reaches a mode the mask would\nhave taken.\n\nRows: `invalid` when `mask` is outside `0..=0o777` (nothing\nchanges); `unsupported` on a host with no mask (windows, by name).\nNever traps. Unlike `set_cwd` and `set`, the checked machine sets\nthe REAL mask (`[os.fs.umask]` says why); lupin has no host call for\nit and declines by name.\n\nCapability `env` (ruling #54's reading, as `set_cwd`'s); refused at\ncomptime (D33). Delegates to `os_umask`.\n\n```wolf-doc-example\nlet old = env.umask(0o1000) else |_| 0 - 1\nold == 0 - 1\n```",
          "source": "std/env/env.lu",
          "line": 209,
          "tier": "core"
        },
        {
          "name": "pid",
          "kind": "fn",
          "signature": "pub fn pid() -> int",
          "doc": "**s232 (`[os.proc.self]`): this process's id** — a shell's `$$`,\nand what a pid file holds. `std.process.pid` is a CHILD's id, by its\nhandle; this is the caller's own.\n\nTotal: every host has one, so there is no row. Never traps. On the\nchecked machine and on lupin it is the id of the process the program\nruns as (the `wolf` or `lupin` process).\n\nCapability `env` (ruling #70 R8: a read of process context); refused\nat comptime (D33). Delegates to `os_pid`.\n\n```wolf-doc-example\nenv.pid() > 0\nenv.pid() == env.pid()\n```",
          "source": "std/env/env.lu",
          "line": 228,
          "tier": "core"
        },
        {
          "name": "ppid",
          "kind": "fn",
          "signature": "pub fn ppid() -> int ! {unsupported}",
          "doc": "**s232 (`[os.proc.self]`): the id of this process's parent, NOW** —\na shell's `$PPID`. A process whose parent has ended answers the id of\nwhichever process adopted it, so a program that wants the parent it\nwas started by reads this once, at start.\n\nRows: `unsupported` on a host with no such call (windows, by name).\nNever traps.\n\nCapability `env` (ruling #70 R8); refused at comptime (D33).\nDelegates to `os_ppid`.\n\n```wolf-doc-example\nlet parent = env.ppid() else |_| 1\nparent > 0\n```",
          "source": "std/env/env.lu",
          "line": 247,
          "tier": "core"
        },
        {
          "name": "uid",
          "kind": "fn",
          "signature": "pub fn uid() -> int ! {unsupported}",
          "doc": "**s236 (`[os.proc.ids]`): this process's REAL user id** — who\nstarted it (`getuid`). It differs from `euid` only in a program\nstarted set-user-id.\n\nRows: `unsupported` on a host with no user ids (windows, by name).\nNever traps. lupin declines by name (it has no host call for an id),\nso the example is prose: `env.uid()? == env.euid()?` holds in every\nprogram that was not started set-user-id.\n\nCapability `env` (ruling #74's reading of `pid`); refused at\ncomptime (D33). Delegates to `os_uid`.",
          "source": "std/env/env.lu",
          "line": 262,
          "tier": "core"
        },
        {
          "name": "euid",
          "kind": "fn",
          "signature": "pub fn euid() -> int ! {unsupported}",
          "doc": "**s236 (`[os.proc.ids]`): this process's EFFECTIVE user id** — the\none the host checks when the process opens a file, signals another\nprocess or changes an owner (`geteuid`). **0 is the super-user**, so\n\"am I root?\" is `env.euid()? == 0`. A file this process creates is\nowned by this id.\n\nRows: `unsupported` on a host with no user ids (windows, by name).\nNever traps. lupin declines by name, so the example is prose: a\nserver told to drop privilege asks `env.euid()? == 0` first and\nwarns instead when it is not.\n\nCapability `env`; refused at comptime (D33). Delegates to `os_euid`.",
          "source": "std/env/env.lu",
          "line": 278,
          "tier": "core"
        },
        {
          "name": "gid",
          "kind": "fn",
          "signature": "pub fn gid() -> int ! {unsupported}",
          "doc": "**s236 (`[os.proc.ids]`): this process's real group id** (`getgid`).\n\nRows: `unsupported` on a host with no group ids (windows, by name).\nNever traps. lupin declines by name; the example is prose, as\n`uid`'s.\n\nCapability `env`; refused at comptime (D33). Delegates to `os_gid`.",
          "source": "std/env/env.lu",
          "line": 289,
          "tier": "core"
        },
        {
          "name": "egid",
          "kind": "fn",
          "signature": "pub fn egid() -> int ! {unsupported}",
          "doc": "**s236 (`[os.proc.ids]`): this process's effective group id**\n(`getegid`) — the group a file it creates is given on most hosts.\n\nRows: `unsupported` on a host with no group ids (windows, by name).\nNever traps. lupin declines by name; the example is prose, as\n`uid`'s.\n\nCapability `env`; refused at comptime (D33). Delegates to `os_egid`.",
          "source": "std/env/env.lu",
          "line": 301,
          "tier": "core"
        },
        {
          "name": "groups",
          "kind": "fn",
          "signature": "pub fn groups() -> List[int] ! {io, unsupported}",
          "doc": "**s236 (`[os.proc.ids]`): this process's SUPPLEMENTARY groups** —\nthe other groups the host counts it a member of, exactly as the\nhost lists them (`getgroups`), in the host's order.\n\n**Whether the effective group is in the list is the host's**: linux\nlists it only if the list was set so, macOS puts it first. A program\nthat wants every group it is in — what `id -G` prints — takes\n`egid()` first and then this list, dropping a repeat. On macOS the\nlist is what `getgroups(2)` answers there: at most sixteen, and not\nthe directory service's whole membership.\n\nRows: `unsupported` on a host with no group ids (windows, by name);\n`io` when the host will not answer. Never traps. lupin declines by\nname; the example is prose: `for g in env.groups()? { … }`.\n\nCapability `env`; refused at comptime (D33). Delegates to\n`os_groups`.",
          "source": "std/env/env.lu",
          "line": 322,
          "tier": "core"
        },
        {
          "name": "args",
          "kind": "fn",
          "signature": "pub fn args() -> List[str]",
          "doc": "The program's arguments, in the order the user gave them.\n\nTotal: no rows. One trap, the host's and not a contract: an argument\nthat is not UTF-8 traps `argument-utf8` (the module header's \"text\ntrap\"; `args_bytes()` reads it). Excludes the executable's own path\nand the invocation name (see the module header). The list is freshly allocated in the ambient region on\nevery call; nothing here is cached, because a cache would be a\npromise the host has not made.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_args`.\n\n```wolf-doc-example\nenv.args().len >= 0\n```",
          "source": "std/env/env.lu",
          "line": 340,
          "tier": "core"
        },
        {
          "name": "arg",
          "kind": "fn",
          "signature": "pub fn arg(i: int) -> str ! {none}",
          "doc": "The argument at `i`, counting from zero.\n\nRows: `none` when `i` is negative or past the last argument — an\nabsence and not a trap, because an index into argv is DATA the program\nreceived rather than a bound the caller could have checked (§8's rule,\nin the place it matters most: the index usually comes from the\nprogram's own option parser).\n\nTraps `argument-utf8` when an argument is not UTF-8, as `args()` does:\nit reads the same list.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_args`.\n\n```wolf-doc-example\n(env.arg(0) else \"<none>\") == \"<none>\"\n(env.arg(-1) else \"<none>\") == \"<none>\"\n```",
          "source": "std/env/env.lu",
          "line": 361,
          "tier": "core"
        },
        {
          "name": "arg0",
          "kind": "fn",
          "signature": "pub fn arg0() -> str",
          "doc": "The name this program was invoked by: argv[0], exactly as the invoker\nspelled it (a bare `PATH` name, an absolute path, `./prog`, a\nsymlink's own name, `exec -a NAME`'s `NAME`). Not the resolved\nexecutable: a symlink and `exec -a` make the two differ.\n\nTotal: no rows. Empty text when the invoker passed no argv[0], and on\nthe checked machine run without `--argv-hex`. One trap, the host's:\na name that is not UTF-8 traps `argument-utf8` (the module header's\n\"text trap\"), and `args_bytes()[0]` holds it as bytes. It decodes the\nname alone; a non-UTF-8 argument after it does not trap here.\n\nThe answer is materialized in the ambient region, freshly on every\ncall (`env_arg0` is a `[mem.region.escape]` site, as `os_cwd` is).\n\nCapability `env`; refused at comptime (D33). Delegates to `env_arg0`\n(s261, `[os.env.argv]`). **lupin** resolves the builtin from 0.1.59\n(wolf-interp#295).\n\n```wolf-doc-example\nlet raw = env.args_bytes()\nraw.len == 0 || raw[0].len == env.arg0().len\n```",
          "source": "std/env/env.lu",
          "line": 394,
          "tier": "core"
        },
        {
          "name": "args_bytes",
          "kind": "fn",
          "signature": "pub fn args_bytes() -> List[List[byte]]",
          "doc": "Every argument as bytes, **the invocation name first**: argv[0], then\nargv[1..] in order — so `args_bytes().len` is `args().len + 1`\nwhenever the invoker passed a name. No decoding, no entry left out, no\nterminating NUL: verbatim bytes on unix, WTF-8 for windows' UTF-16\narguments (the encoding `fs` uses for the OS's names).\n\nTotal: no rows, no traps. It is the reader for an argument that is not\ntext; `str_from_utf8` on one entry answers its `utf8` row where `args()`\nwould trap. Empty when the invoker passed no argv at all, and on the\nchecked machine run without `--argv-hex`.\n\nThe list and its entries are materialized in the ambient region,\nfreshly on every call.\n\nCapability `env`; refused at comptime (D33). Delegates to\n`env_args_bytes` (s261, `[os.env.argv]`). **lupin** resolves the\nbuiltin from 0.1.59 (wolf-interp#295).\n\n```wolf-doc-example\nlet raw = env.args_bytes()\nraw.len == 0 || raw.len == env.args().len + 1\n```",
          "source": "std/env/env.lu",
          "line": 420,
          "tier": "core"
        },
        {
          "name": "get",
          "kind": "fn",
          "signature": "pub fn get(name: str) -> str ! {missing, utf8}",
          "doc": "The value of the environment variable `name`.\n\nRows: `missing` when the host has no such variable, `utf8` when it has\none whose value is not well-formed UTF-8 (a wolf `str` is UTF-8 by\ndefinition, so a value that cannot decode is a miss and never a lossy\nread). Never traps.\n\nAn empty value is a VALUE: `get` of a variable set to `\"\"` answers\n`\"\"` and not `missing`. That distinction is the whole reason this\nreturns a row instead of a string.\n\nBare `get` is the checked-access spelling and this one can miss (§1),\nso the name is right and the row is not decoration.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_get`.\n\n```wolf-doc-example\nenv.set(\"WOLF_STD_DOC_GET\", \"wolf\")?\n(env.get(\"WOLF_STD_DOC_GET\") else \"?\") == \"wolf\"\n(env.get(\"WOLF_STD_DOC_ABSENT\") else \"?\") == \"?\"\n```",
          "source": "std/env/env.lu",
          "line": 445,
          "tier": "core"
        },
        {
          "name": "has",
          "kind": "fn",
          "signature": "pub fn has(name: str) -> bool",
          "doc": "Whether `get(name)` would answer with a value.\n\nTotal: no rows, no traps. `false` for a variable the host does not\nhave AND for one whose value this machine cannot decode — the two are\ndeliberately one answer, because the question this predicate asks is\n\"can I read it\", and a caller who needs to tell the cases apart calls\n`get` and handles the tags.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_get`.\n\n```wolf-doc-example\nenv.set(\"WOLF_STD_DOC_HAS\", \"1\")?\nenv.has(\"WOLF_STD_DOC_HAS\") == true\nenv.has(\"WOLF_STD_DOC_NOT_SET\") == false\n```",
          "source": "std/env/env.lu",
          "line": 464,
          "tier": "core"
        },
        {
          "name": "vars",
          "kind": "fn",
          "signature": "pub fn vars() -> List[str]",
          "doc": "Every environment variable the host has, as `K=V` lines sorted by\nname.\n\nTotal: no rows, no traps. The sort is the builtin tier's and it is a\nDETERMINISM promise, not a convenience: two runs of one program see\nthe same order, and a program that prints its environment produces a\ndiffable output. Cut a line with `entry_key` and `entry_value`.\n\nA variable whose value the host holds in a non-UTF-8 encoding is\nomitted rather than mangled — the same posture `get`'s `utf8` row\ntakes, in a function that has no row to say it with.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_vars`.\n\n```wolf-doc-example\nenv.set(\"WOLF_STD_DOC_VARS\", \"x\")?\nenv.vars().len > 0\n```",
          "source": "std/env/env.lu",
          "line": 487,
          "tier": "core"
        },
        {
          "name": "set",
          "kind": "fn",
          "signature": "pub fn set(name: str, value: str) -> () ! {invalid}",
          "doc": "Set the environment variable `name` to `value` for this process.\n\nRows: `invalid` when the platform cannot hold the name — empty, or\ncontaining `=` or a NUL. Never traps: which names a platform accepts\ndiffers between hosts, so a caller could not portably have checked\n(§2's trap rule).\n\nSetting is process-global and is not undone at any scope exit; a test\nthat sets a variable is writing to the program it runs in. Use names\nnobody else will (`WOLF_STD_…`), which is what this repository's own\ntests and examples do.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_set`.\n\n```wolf-doc-example\nenv.set(\"WOLF_STD_DOC_SET\", \"value\")?\n(env.get(\"WOLF_STD_DOC_SET\") else \"?\") == \"value\"\n```",
          "source": "std/env/env.lu",
          "line": 509,
          "tier": "core"
        },
        {
          "name": "unset",
          "kind": "fn",
          "signature": "pub fn unset(name: str) -> () ! {invalid}",
          "doc": "Remove `name` from this process's environment.\n\nAfter it, `get` answers `missing`, `has` is false, `vars()` does not\nlist the name, and a child started afterwards does not receive it.\nRemoving a variable that is not there is not an error — the outcome\nthe caller asked for already holds (POSIX `unsetenv`). This is NOT\n`set(name, \"\")`: an empty value is a value, and `has` answers true for\nit; that difference is why std shipped no `unset` until the builtin\nexisted (wolf-lang#534, s225).\n\nRows: `invalid` for a name `set` would refuse — empty, or containing\n`=` or a NUL. Never traps.\n\nRemoving, like setting, is process-global and is not undone at any\nscope exit.\n\nCapability `env`; refused at comptime (D33). Delegates to `env_unset`\n(wolf-lang s225, `[os.env.unset]`).\n\n```wolf-doc-example\nenv.set(\"WOLF_STD_DOC_UNSET\", \"value\")?\nenv.unset(\"WOLF_STD_DOC_UNSET\")?\nenv.has(\"WOLF_STD_DOC_UNSET\") == false\n```",
          "source": "std/env/env.lu",
          "line": 537,
          "tier": "core"
        },
        {
          "name": "entry_key",
          "kind": "fn",
          "signature": "pub fn entry_key(entry: str) -> str",
          "doc": "The name half of a `K=V` line from `vars()`.\n\nTotal: no rows, no traps, and PURE — comptime-safe, reaching no host.\nA line with no `=` at all is all name and no value, which is what a\ncaller wants for the degenerate case: `entry_key(\"BARE\")` is\n`\"BARE\"`.\n\nThe cut is at the FIRST `=`, because a value may contain one and a\nname may not (that is exactly what `set`'s `invalid` row is about).\n\n```wolf-doc-example\nenv.entry_key(\"HOME=/home/wolf\") == \"HOME\"\nenv.entry_key(\"EMPTY=\") == \"EMPTY\"\nenv.entry_key(\"BARE\") == \"BARE\"\nenv.entry_key(\"A=b=c\") == \"A\"\n```",
          "source": "std/env/env.lu",
          "line": 557,
          "tier": "core"
        },
        {
          "name": "entry_value",
          "kind": "fn",
          "signature": "pub fn entry_value(entry: str) -> str",
          "doc": "The value half of a `K=V` line from `vars()`.\n\nTotal: no rows, no traps, and PURE — comptime-safe, reaching no host.\nA line with no `=` has an empty value. Everything after the first `=`\nis the value, `=` signs included.\n\n```wolf-doc-example\nenv.entry_value(\"HOME=/home/wolf\") == \"/home/wolf\"\nenv.entry_value(\"EMPTY=\") == \"\"\nenv.entry_value(\"BARE\") == \"\"\nenv.entry_value(\"A=b=c\") == \"b=c\"\n```",
          "source": "std/env/env.lu",
          "line": 577,
          "tier": "core"
        }
      ]
    },
    {
      "name": "errors",
      "group": "Foundations and ordering",
      "tier": "core",
      "doc": "std.errors — the payload half of the error taxonomy: what a row tag\ncarries, how it is read, how it is rendered, and how a precise error\nbecomes a coarse one on purpose. Stability tier: core.\n\n**The taxonomy in five rules** (API-CONVENTIONS §12 is the binding\nstatement; this module is its worked home, as `std.option` is §2's):\n\n1. A **mark** is a payload-free tag and is spelled lowercase:\n   `none`, `gone`, `eof`, `done`, `parse`, `base`, `utf8`, `overflow`,\n   `div_zero`, `deep`, `boundary`. Every row std shipped in sc01–sc05\n   is a mark, and after sc06's rename every one of them is lowercase\n   in the source too.\n2. A **payload-carrying** tag is CapCase and names its payload type:\n   `Parse(ParseErr)`. The payload is DATA — position, limit, the\n   offending value — never a pre-rendered string. A caller that wants\n   a sentence calls `describe`; a caller that wants to recover reads\n   the fields.\n3. One tag per failure mode **the caller can act on**, not per call\n   site. `hex.decode` raising one `parse` for both \"odd length\" and\n   \"bad digit\" is right while no caller can act differently on them;\n   it becomes `Parse(ParseErr)` the day the offset is worth reporting.\n4. **Absence is not an error.** `none` never carries a payload and\n   never joins an error row's vocabulary of causes; \"there is nothing\n   here\" and \"this went wrong\" are different questions (§2).\n5. **Coarsening is a named operation** the caller opts into —\n   `coarsen` below is the exemplar — never something a std signature\n   does silently, and never a `From` conversion (there is none, D30).\n\n**The chain idiom, documented rather than invented.** wolf has no\nexistentials and no boxing, so an error cannot hold an arbitrary other\nerror. A cause is carried as a FIELD of the coarse payload: `Failure`\nkeeps the `cause` kind of the `ParseErr` it came from, which is enough\nto say \"the config failed at byte 12 because a number was malformed\"\nwithout a type that can hold anything. Where a wrapper needs more, it\ngrows a field of its own — a named field is the whole mechanism, and\n`std.json`'s `escape`-inside-`json` case is the shape it serves.\n\n**Why kinds are `int` and not an enum.** An enum's VALUES cross a\nmodule boundary but nothing that inspects them does (F-0029): a\n`match` on an imported enum does not resolve, a method on one does not\ndispatch, and both compiler rungs refuse the shape. A caller of this\nmodule must be able to branch on the kind, so the kind is an `int`\nfrom a table this module owns and documents:\n\n- `0` unspecified — the kind was not recorded\n- `1` not a value of this type (a byte that cannot start or continue\n  one — the commonest `parse` cause)\n- `2` unexpected end of input\n- `3` trailing text after a complete value\n- `4` the value is outside the type's range\n\nThe table becomes an enum in the sprint that closes F-0029, with these\nnumbers as its discriminants, and `describe` is where the mapping to\nwords already lives so that no caller has written its own.\n\n**Rendering stops at the payload.** `describe` renders THIS module's\npayload types and nothing else: a generic `describe[T: Show]` needs\nthe `Show` trait proposed with the format-spec amendment (F-0033) and\nthe s38 dispatch hook, so it is not written here. Nor is there\noverloading — one name, one signature — which is why the two\nrenderers below are `describe` and `describe_failure` rather than one\nname twice.\n\n**Lanes**: everything here is monomorphic over structs and `int`, so\nlupin and the checked tier both execute it; the native rung refuses\nthe two renderers because an interpolated string in value position is\nan allocating materialization it does not lower yet (c08).",
      "summary": "std.errors — the payload half of the error taxonomy: what a row tag carries, how it is read, how it is rendered, and how a precise error becomes a coarse one on purpose.",
      "items": [
        {
          "name": "ParseErr",
          "kind": "struct",
          "signature": "pub struct ParseErr { offset: int, kind: int, }",
          "doc": "The payload of a `Parse(ParseErr)` row: WHERE the text stopped being a\nvalue of the wanted type, and WHICH way it failed.\n\n`offset` is a byte offset from the start of the input (§9: byte\noffsets are the one currency) and is `0` when the position is not\nknown. `kind` is a code from the module header's table. Both fields\nare public and readable directly (`e.offset`); the accessors exist for\nthe call sites that read better with a name.",
          "source": "std/errors/errors.lu",
          "line": 79,
          "tier": "core"
        },
        {
          "name": "Failure",
          "kind": "struct",
          "signature": "pub struct Failure { offset: int, cause: int, }",
          "doc": "The payload of a coarsened row: a failure that happened at a position,\nremembering the kind of the precise error it came from.\n\n`cause` is the `kind` of the `ParseErr` this was coarsened from, or\n`0` when there was none — the chain idiom of the module header, which\nis a field and not a hidden box.",
          "source": "std/errors/errors.lu",
          "line": 90,
          "tier": "core"
        },
        {
          "name": "parse_err",
          "kind": "fn",
          "signature": "pub fn parse_err(offset: int, kind: int) -> ParseErr",
          "doc": "A `ParseErr` at byte `offset` with kind `kind` (the header's table).\nThe canonical constructor: raise sites write\n`return Parse(errors.parse_err(i, 1))` rather than a struct literal,\nso that a field added later does not break them.\n\nTotal: no rows, no traps. A negative `offset` or an unknown `kind` is\nnot rejected — this type reports a failure and must never become one.\n\n```wolf-doc-example\nlet e = errors.parse_err(7, 2)\ne.offset == 7\ne.kind == 2\n```",
          "source": "std/errors/errors.lu",
          "line": 108,
          "tier": "core"
        },
        {
          "name": "byte_offset",
          "kind": "fn",
          "signature": "pub fn byte_offset(e: ParseErr) -> int",
          "doc": "The byte offset `e` reports. The named accessor of the `offset` field\n— the `byte_offset` convention every position-carrying payload in std\nanswers to, so that a caller reads one spelling across payload types.\n\nNamed `byte_offset`, not `offset_of` (its name until sc54): wolf 0.2.23\nputs `offset_of` in the prelude (kw08's layout query), and a module\nitem with a prelude name shadows it for the whole module (W0304).\n\nTotal: no rows, no traps.\n\n```wolf-doc-example\nerrors.byte_offset(errors.parse_err(12, 1)) == 12\nerrors.byte_offset(errors.parse_err(0, 0)) == 0\n```",
          "source": "std/errors/errors.lu",
          "line": 126,
          "tier": "core"
        },
        {
          "name": "describe",
          "kind": "fn",
          "signature": "pub fn describe(e: ParseErr) -> str",
          "doc": "One line of English for `e`: what went wrong and where. The rendering\nconvention — a payload is data, and `describe` is the one place that\nturns it into words, so no two callers word it differently.\n\nThe text names the kind from the header's table and always ends with\nthe byte offset. Unknown kinds render as \"not a value of that type\",\ndeliberately: a code from a newer library version must still produce a\nsentence.\n\nTotal: no rows, no traps.\n\n```wolf-doc-example\nerrors.describe(errors.parse_err(4, 2)) == \"unexpected end of input at byte 4\"\nerrors.describe(errors.parse_err(0, 3)) == \"trailing text after a complete value at byte 0\"\nerrors.describe(errors.parse_err(9, 99)) == \"not a value of that type at byte 9\"\n```",
          "source": "std/errors/errors.lu",
          "line": 146,
          "tier": "core"
        },
        {
          "name": "describe_failure",
          "kind": "fn",
          "signature": "pub fn describe_failure(f: Failure) -> str",
          "doc": "One line of English for a coarsened failure, naming its cause when it\nhas one. The counterpart of `describe`, spelled with the payload type\nin its name because wolf has no overloading (§1: one concept, one\nname — and two payload types are two concepts).\n\nTotal: no rows, no traps.\n\n```wolf-doc-example\nerrors.describe_failure(errors.coarsen(errors.parse_err(4, 2))) == \"failed at byte 4: unexpected end of input\"\nerrors.describe_failure(errors.coarsen(errors.parse_err(1, 0))) == \"failed at byte 1\"\n```",
          "source": "std/errors/errors.lu",
          "line": 162,
          "tier": "core"
        },
        {
          "name": "coarsen",
          "kind": "fn",
          "signature": "pub fn coarsen(e: ParseErr) -> Failure",
          "doc": "`e` widened into a `Failure`: the precise parse error becomes \"this\noperation failed here, and here is why it did\" — the exemplar of §2's\ncoarsening rule.\n\nThe rule it exists to demonstrate: a function whose row is\n`{Failed(Failure)}` may not silently absorb a callee's\n`{Parse(ParseErr)}`. It calls THIS, at the site, in the caller's own\nsource, so that a reader sees precision being given up. There is no\n`From` conversion and none is wanted (D30): coarsening is a decision,\nnot a coercion.\n\nThe kind survives as `cause` (the chain idiom), so nothing is lost\nthat a message needs; what is given up is the ability to BRANCH on the\nkind, which is exactly what coarsening means.\n\nTotal: no rows, no traps.\n\n```wolf-doc-example\nlet wide = errors.coarsen(errors.parse_err(5, 1))\nwide.offset == 5\nwide.cause == 1\n```",
          "source": "std/errors/errors.lu",
          "line": 192,
          "tier": "core"
        }
      ]
    },
    {
      "name": "fmt",
      "group": "Formatting and encodings",
      "tier": "core",
      "doc": "std.fmt — the text side of every value: padding, alignment, integers\nin every base, and the text→number boundary. Stability tier: core.\n\n**Why this module exists at all, given `{x}`.** Every string literal\nin wolf is an f-string (X9/D26) and `\"{n}\"` already renders an `int`,\nso a formatting module has to earn its place. It earns it twice. The\nfirst reason is that the interpolation grammar reserves a FORMAT SPEC\n— `INTERP ::= '{' expr FORMAT_SPEC? '}'` (spec/01 §1.5) — whose\nsemantics spec §7.4 was supposed to define and does not (F-0033) —\nthough the IMPLEMENTATIONS have converged: re-measured at the sc08 pin,\n`{x:.2}`, `{s:.4}` and `{n:08}` render identically on all three lanes\n(`3.14`, `wolf`, `00000042`), including precision on a `str`, which\nF-0031 recorded as the one clause nothing implemented. F-0031's\ndivergence — lupin padding while wolfc ignored the spec — is retired.\nThe second is that a spec is a spelling, not a capability: a\nprogram that computes a column width, or pads a value it received as\ndata, needs the operation as a FUNCTION. This module is that\nfunction set, and it is also the running reference implementation the\n§7.4 amendment cites (F-0033) — the spec text and these bodies are\nmeant to agree clause for clause.\n\n**Width is measured in BYTES** (§9's one currency, applied). `len` is\nbytes everywhere in std, so `pad_left(\"é\", 3)` adds one byte of fill,\nnot two, and a column of CJK text will not line up in a terminal. This\nis honest rather than convenient: display width needs East Asian Width\ntables and grapheme segmentation (the F-0019 budget decision), and a\nfunction that pretended to count columns would be wrong on exactly the\ntext that makes people care. When the tables land, the display-width\nfamily joins them under its own name — `pad_left` will keep meaning\nbytes.\n\n**What is the language's, the implementation's, and std's** (§8's\nquestion again). The language owns interpolation and its (unspecified)\nformat spec; the implementation owns `repeat`, `starts_with`, `upper`\nand the rendering of `{n}` for a builtin; std owns everything named\nhere. `to_str` delegates to interpolation and says so, because that\nmakes the interpolated rendering part of this function's contract.\n\n**The parse family is re-homed here** (the sprint contract's word).\nsc03 shipped `parse_int`/`parse_float` in `std.str` because that is\nwhere the boundary-safe probe was proven; the number boundary belongs\nto the module that also owns printing, so that `to_str_base` and\n`parse_int_base` can be read — and tested — as inverses. `std.str` no\nlonger declares them. The re-home refined two behaviors, both\ndeliberate:\n\n- a radix outside 2..36 now raises `base` rather than `parse`, because\n  a bad radix is the CALLER's mistake and a bad digit run is the\n  DATA's, and a caller that cannot tell them apart cannot report\n  either one usefully (§2, §10's trap-versus-raise rule read one step\n  further);\n- the accumulator runs NEGATIVE, so `parse_int(\"-9223372036854775808\")`\n  is `int_min()` instead of an overflow trap. Positive `int_min()` has\n  no value to be, and still traps.\n\n**This module's one blocked contract is code as of sc10, and nothing\nhere is a contract now.** `truncate_to` could not be written for the\nreason fifteen `std.str` functions could not: cutting a string at a\nbyte offset requires knowing the offset is a code-point boundary, the\nonly way to ask was to slice there, and slicing at a non-boundary\ntraps uncatchably (D30, F-0018). s37's `str.get` asks instead of\nfaulting, `std.str` spent that primitive in sc09, and sc10 spends it\nhere: the function is a walk down from `width` until the range is\naccepted — three iterations at worst, because no UTF-8 scalar is wider\nthan four bytes — and it is at the bottom of this file.\n\nFloat printing and parsing live in `std.fmt.float`: wolf has no\noverloading, so one module cannot spell both `to_str(n: int)` and\n`to_str(x: f64)` — the same split, for the same reason, as\n`std.math`/`std.math.float` (§10).",
      "summary": "std.fmt — the text side of every value: padding, alignment, integers in every base, and the text→number boundary.",
      "items": [
        {
          "name": "pad_left",
          "kind": "fn",
          "signature": "pub fn pad_left(s: str, width: int) -> str",
          "doc": "`s` padded on the LEFT with spaces to at least `width` bytes —\nright-alignment, the `{x:>w}` spec's meaning. A string already at\nleast `width` bytes long comes back unchanged: this function pads and\nnever truncates, so no data is ever lost to a column. A negative or\nzero `width` is not an error, it simply pads nothing. Total: no error\nrow, no traps beyond allocation.\n\n```wolf-doc-example\nfmt.pad_left(\"42\", 5) == \"   42\"\nfmt.pad_left(\"42\", 2) == \"42\"\nfmt.pad_left(\"42\", 0) == \"42\"\nfmt.pad_left(\"\", 3) == \"   \"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 167,
          "tier": "core"
        },
        {
          "name": "pad_left_with",
          "kind": "fn",
          "signature": "pub fn pad_left_with(s: str, width: int, fill: str) -> str",
          "doc": "`pad_left` with an explicit one-byte `fill`. Traps `assert` when\n`fill` is not exactly one byte: a multi-byte fill cannot reach an\narbitrary byte width, and silently overshooting the column would make\nthe width promise a lie — the caller could have checked, so it is a\ntrap and not a row (§2).\n\n```wolf-doc-example\nfmt.pad_left_with(\"42\", 5, \"0\") == \"00042\"\nfmt.pad_left_with(\"42\", 5, \".\") == \"...42\"\nfmt.pad_left_with(\"42\", 1, \"0\") == \"42\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 182,
          "tier": "core"
        },
        {
          "name": "pad_right",
          "kind": "fn",
          "signature": "pub fn pad_right(s: str, width: int) -> str",
          "doc": "`s` padded on the RIGHT with spaces to at least `width` bytes —\nleft-alignment, the `{x:<w}` spec's meaning. Pads, never truncates.\nTotal: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nfmt.pad_right(\"42\", 5) == \"42   \"\nfmt.pad_right(\"42\", 2) == \"42\"\nfmt.pad_right(\"\", 3) == \"   \"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 203,
          "tier": "core"
        },
        {
          "name": "pad_right_with",
          "kind": "fn",
          "signature": "pub fn pad_right_with(s: str, width: int, fill: str) -> str",
          "doc": "`pad_right` with an explicit one-byte `fill`; the `assert` trap on a\nmulti-byte fill is `pad_left_with`'s, for the same reason.\n\n```wolf-doc-example\nfmt.pad_right_with(\"42\", 5, \"0\") == \"42000\"\nfmt.pad_right_with(\"ab\", 4, \"-\") == \"ab--\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 214,
          "tier": "core"
        },
        {
          "name": "center",
          "kind": "fn",
          "signature": "pub fn center(s: str, width: int) -> str",
          "doc": "`s` centered in `width` bytes with spaces — the `{x:^w}` spec's\nmeaning. An odd remainder goes to the RIGHT (`center(\"a\", 4)` is\n`\"a   \"` with one space before and two after), which is the choice\nevery other language with this spec makes and therefore the one that\nsurprises nobody. Pads, never truncates. Total: no error row, no traps\nbeyond allocation.\n\n```wolf-doc-example\nfmt.center(\"ab\", 6) == \"  ab  \"\nfmt.center(\"a\", 4) == \" a  \"\nfmt.center(\"abc\", 2) == \"abc\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 238,
          "tier": "core"
        },
        {
          "name": "center_with",
          "kind": "fn",
          "signature": "pub fn center_with(s: str, width: int, fill: str) -> str",
          "doc": "`center` with an explicit one-byte `fill`; the `assert` trap on a\nmulti-byte fill is `pad_left_with`'s.\n\n```wolf-doc-example\nfmt.center_with(\"ab\", 6, \"*\") == \"**ab**\"\nfmt.center_with(\"a\", 4, \"-\") == \"-a--\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 249,
          "tier": "core"
        },
        {
          "name": "to_str",
          "kind": "fn",
          "signature": "pub fn to_str(n: int) -> str",
          "doc": "`n` in base ten — the decimal rendering of an `int`, sign included,\nno separators, no padding. Total: no error row, no traps.\n\nThis function DELEGATES to interpolation (`\"{n}\"`), which makes the\nimplementation's rendering of a builtin part of this contract: base\nten, ASCII digits, a leading `-` for negatives, no `+` for positives,\nno grouping, and `int_min()` rendered in full. `with_sign` and `group`\nare the two departures from that, and they are functions rather than\nflags because wolf has no formatting flags to hang them on.\n\n```wolf-doc-example\nfmt.to_str(42) == \"42\"\nfmt.to_str(0) == \"0\"\nfmt.to_str(0 - 42) == \"-42\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 279,
          "tier": "core"
        },
        {
          "name": "to_str_base",
          "kind": "fn",
          "signature": "pub fn to_str_base(n: int, radix: int) -> str ! {base}",
          "doc": "`n` in `radix` (2 through 36) with lowercase digits; `base` when the\nradix is outside that range. Negative values are rendered\nSIGN-MAGNITUDE — `to_str_base(0 - 255, 16)` is `\"-ff\"`, never a\ntwo's-complement `\"ffffffffffffff01\"` — because `int` is a signed\n64-bit value and the bit pattern is `wrapping[u64]`'s business, not a\ntext function's. Total otherwise: no traps, `int_min()` included.\n\nThe radix parameter is spelled `radix` rather than `base` for one\nmechanical reason worth knowing: the error tag IS `base`, and a\nparameter of the same name shadows it at the raise site.\n\n```wolf-doc-example\n(fmt.to_str_base(255, 16) else \"?\") == \"ff\"\n(fmt.to_str_base(255, 2) else \"?\") == \"11111111\"\n(fmt.to_str_base(0, 7) else \"?\") == \"0\"\n(fmt.to_str_base(0 - 255, 16) else \"?\") == \"-ff\"\n(fmt.to_str_base(35, 36) else \"?\") == \"z\"\n(fmt.to_str_base(10, 1) else \"?\") == \"?\"\n(fmt.to_str_base(10, 37) else \"?\") == \"?\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 303,
          "tier": "core"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(n: int) -> str",
          "doc": "`n` in base sixteen with lowercase digits and no `0x` prefix; the\nsign-magnitude rendering `to_str_base` documents. Total: no error row\n(the radix is not the caller's here), no traps.\n\n```wolf-doc-example\nfmt.to_hex(255) == \"ff\"\nfmt.to_hex(0) == \"0\"\nfmt.to_hex(4096) == \"1000\"\nfmt.to_hex(0 - 1) == \"-1\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 323,
          "tier": "core"
        },
        {
          "name": "to_hex_upper",
          "kind": "fn",
          "signature": "pub fn to_hex_upper(n: int) -> str",
          "doc": "`to_hex` with uppercase digits (`\"FF\"`). The uppercasing is the\nimplementation's `upper` applied to ASCII hex digits, where every\nUnicode case-mapping question is moot. Total: no error row, no traps.\n\n```wolf-doc-example\nfmt.to_hex_upper(255) == \"FF\"\nfmt.to_hex_upper(48879) == \"BEEF\"\nfmt.to_hex_upper(0 - 255) == \"-FF\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 336,
          "tier": "core"
        },
        {
          "name": "to_oct",
          "kind": "fn",
          "signature": "pub fn to_oct(n: int) -> str",
          "doc": "`n` in base eight, no `0o` prefix. Total: no error row, no traps.\n\n```wolf-doc-example\nfmt.to_oct(8) == \"10\"\nfmt.to_oct(511) == \"777\"\nfmt.to_oct(0) == \"0\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 348,
          "tier": "core"
        },
        {
          "name": "to_bin",
          "kind": "fn",
          "signature": "pub fn to_bin(n: int) -> str",
          "doc": "`n` in base two, no `0b` prefix and no leading zeros — the shortest\nbinary rendering, so `to_bin(1)` is `\"1\"` and not a 64-bit field. Pad\nit with `pad_left_with(…, 64, \"0\")` when a field is what you want.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nfmt.to_bin(10) == \"1010\"\nfmt.to_bin(1) == \"1\"\nfmt.to_bin(0) == \"0\"\nfmt.pad_left_with(fmt.to_bin(5), 8, \"0\") == \"00000101\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 363,
          "tier": "core"
        },
        {
          "name": "with_sign",
          "kind": "fn",
          "signature": "pub fn with_sign(n: int) -> str",
          "doc": "`n` in base ten with an explicit sign — `\"+42\"`, `\"-42\"`, and `\"+0\"`\nfor zero. This is the `{x:+}` spec's meaning. Zero takes a `+` because\nthe flag asks for a sign and zero's sign, for an `int`, is positive;\nthe float family's `-0.0` is a different question and\n`std.fmt.float` answers it there. Total: no error row, no traps.\n\n```wolf-doc-example\nfmt.with_sign(42) == \"+42\"\nfmt.with_sign(0 - 42) == \"-42\"\nfmt.with_sign(0) == \"+0\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 378,
          "tier": "core"
        },
        {
          "name": "group",
          "kind": "fn",
          "signature": "pub fn group(n: int, sep: str) -> str",
          "doc": "`n` in base ten with `sep` inserted every three digits from the right\n— thousands grouping, sign in front of the first group. `sep` may be\nany string, including a multi-byte one (`group(1234, \"\\u{2009}\")`\nworks), because grouping makes no width promise to break. Total: no\nerror row, no traps, `int_min()` included.\n\nGrouping is a presentation choice and never a locale one: std does not\nknow your locale, will not learn it, and the digit-group size is fixed\nat three (core has no locale-aware number formatting, ever — the\nsprint contract's non-target, and it is a decision rather than an\nomission).\n\n```wolf-doc-example\nfmt.group(1234567, \",\") == \"1,234,567\"\nfmt.group(100, \",\") == \"100\"\nfmt.group(1000, \"_\") == \"1_000\"\nfmt.group(0 - 1234, \",\") == \"-1,234\"\nfmt.group(0, \",\") == \"0\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 404,
          "tier": "core"
        },
        {
          "name": "parse_int",
          "kind": "fn",
          "signature": "pub fn parse_int(s: str) -> int ! {parse}",
          "doc": "`s` parsed as a whole decimal integer; `parse` when it is not one.\n`parse_int_base(s, 10)` exactly, named for the case that is almost\nalways meant.\n\n```wolf-doc-example\n(fmt.parse_int(\"42\") else 0 - 1) == 42\n(fmt.parse_int(\"-42\") else 0) == 0 - 42\n(fmt.parse_int(\"+7\") else 0) == 7\n(fmt.parse_int(\"\") else 0 - 1) == 0 - 1\n(fmt.parse_int(\"4x\") else 0 - 1) == 0 - 1\n(fmt.parse_int(\"0x10\") else 0 - 1) == 0 - 1\n```",
          "source": "std/fmt/fmt.lu",
          "line": 440,
          "tier": "core"
        },
        {
          "name": "parse_int_base",
          "kind": "fn",
          "signature": "pub fn parse_int_base(s: str, radix: int) -> int ! {parse, base}",
          "doc": "`s` parsed as a whole integer in `radix`; `parse` when the text is not\none and `base` when the radix is outside 2..36 — two tags because a\ncaller distinguishes bad data from a bad call (§2, and this module's\nheader on the re-home).\n\nAn optional leading `-` or `+` is accepted, digits above nine are\nletters in either case, and there is no other leniency: no separators,\nno whitespace, no `0x`-style prefixes, and an empty digit run is a\nmiss. Non-ASCII input is a miss and never a trap — the boundary-safe\nprobe (F-0018) is what buys that.\n\nTraps `overflow` (X3) when the value does not fit `int`: the parse\nsucceeded and the arithmetic did not, which is a different failure\nfrom malformed text. `int_min()` itself parses, because the\naccumulator runs negative.\n\n```wolf-doc-example\n(fmt.parse_int_base(\"ff\", 16) else 0) == 255\n(fmt.parse_int_base(\"FF\", 16) else 0) == 255\n(fmt.parse_int_base(\"1010\", 2) else 0) == 10\n(fmt.parse_int_base(\"z\", 36) else 0) == 35\nlet zero: int = 0\n(fmt.parse_int_base(\"-9223372036854775808\", 10) else 0) == zero - 9223372036854775807 - 1\n(fmt.parse_int_base(\"2\", 2) else 0 - 1) == 0 - 1\n(fmt.parse_int_base(\"10\", 1) else 0 - 1) == 0 - 1\n```",
          "source": "std/fmt/fmt.lu",
          "line": 470,
          "tier": "core"
        },
        {
          "name": "parse_bool",
          "kind": "fn",
          "signature": "pub fn parse_bool(s: str) -> bool ! {parse}",
          "doc": "`s` parsed as a boolean; `parse` when it is neither `\"true\"` nor\n`\"false\"`. Exactly those two spellings, lowercase, with nothing around\nthem: `\"True\"`, `\"TRUE\"`, `\"1\"`, `\"yes\"` and `\" true\"` are all misses.\nThe strictness is the point — a configuration file that means `true`\nshould say so, and a parser that guesses turns a typo into a value.\n\n```wolf-doc-example\n(fmt.parse_bool(\"true\") else false) == true\n(fmt.parse_bool(\"false\") else true) == false\n(fmt.parse_bool(\"True\") else false) == false\n(fmt.parse_bool(\"1\") else false) == false\n(fmt.parse_bool(\"\") else false) == false\n```",
          "source": "std/fmt/fmt.lu",
          "line": 523,
          "tier": "core"
        },
        {
          "name": "truncate_to",
          "kind": "fn",
          "signature": "pub fn truncate_to(s: str, width: int) -> str",
          "doc": "The longest prefix of `s` that is at most `width` BYTES long and ends\non a code-point boundary; `s` itself when it already fits.\n\nTotal: never traps, never splits a code point, and never appends an\nellipsis — that is the caller's to add, and its width is the caller's\nto subtract. A `width` of zero or less answers `\"\"`.\n\nWidth is bytes, like every other width in this module (§11) and like\n`len` itself (§9). A prefix that would end inside a multi-byte\ncharacter is backed off to the boundary below it, so the answer can be\nup to three bytes shorter than `width` and is never longer.\n\n**The census row this closes, and how.** For five sprints this was a\nreviewed contract: cutting at a byte offset needs to know the offset\nis a boundary, the only way to ask was to slice there, and slicing\nwrong traps uncatchably (F-0018). s37's `str.get` asks instead of\nfaulting, so the body is a walk down from `width` until the range is\naccepted — three iterations at worst, because no UTF-8 scalar is\nwider than four bytes.\n\nThe recoverable slice is right here and the language's is not: `width`\nis the CALLER's offset (§9's sc09 rule), so a bad one must be refused\nrather than faulted on.\n\n```wolf-doc-example\nfmt.truncate_to(\"wolf\", 10) == \"wolf\"\nfmt.truncate_to(\"wolf\", 4) == \"wolf\"\nfmt.truncate_to(\"wolf\", 2) == \"wo\"\nfmt.truncate_to(\"wolf\", 0) == \"\"\nfmt.truncate_to(\"wolf\", -1) == \"\"\nfmt.truncate_to(\"café\", 5) == \"café\"\nfmt.truncate_to(\"café\", 4) == \"caf\"\nfmt.truncate_to(\"café\", 3) == \"caf\"\nfmt.truncate_to(\"é\", 1) == \"\"\n```",
          "source": "std/fmt/fmt.lu",
          "line": 568,
          "tier": "core"
        }
      ]
    },
    {
      "name": "fmt.decimal",
      "group": "Formatting and encodings",
      "tier": "core",
      "doc": "std.fmt.decimal — the `f64`↔decimal-string boundary, done exactly.\nStability tier: core.\n\n**What this module promises.** Every finite `f64` is exactly a decimal\nnumber (a 53-bit integer times a power of two is a finite decimal), so\nthere is a right answer for every question here and this module gives\nit: `to_str_fixed` and `to_str_exp` round the EXACT value of the input\n— never a floating-point approximation of it — with round-half-even at\nthe last kept digit, and `to_str` produces the SHORTEST digit string\nthat reads back as the same bits. `parse_float` is correctly rounded:\nthe returned `f64` is the one nearest the exact decimal the text\ndenotes, ties to even. The two are inverses on the round trip the\nsprint contract names: `parse_float(to_str(x))` has `to_bits` equal to\n`x`'s for every finite `x`, and `tests/fmt/decimal/round_trip.lu`\nproves it over the torture corpus rather than asserting it.\n\n**How, without a bignum type.** The exactness comes from one small\nengine: a non-negative big integer as a `List[int]` of base-10^9 limbs,\nwith the only two operations these algorithms need — multiply by a\nsmall factor, and render to digits. A double `m * 2^e` becomes an exact\ndecimal by multiplying `m` by `2^e` when `e >= 0` and by `5^(-e)` when\n`e < 0` (because `m / 2^k` is `m * 5^k / 10^k`, and dividing by a power\nof ten in base 10^9 is just where the point goes). Everything else —\nrounding, shortest-digit search, and the comparisons the parser needs —\nis string arithmetic over ASCII digits, which is cheap and exact. The\nshortest search never calls the parser: it compares the candidate\nagainst the two exact MIDPOINTS of the input's rounding interval, so\n\"round-trips\" is decided by arithmetic rather than by trying.\n\n**Why the module is not called `std.fmt.float`.** That is its natural\nname (`std.math`/`std.math.float` set the pattern in §10), and it is\nunavailable: the module namespace is flat at the LAST path segment at\nthese pins, so `std.fmt.float` cannot import `std.math.float` (lupin\ncalls it an import cycle, `float` → `float`, E0303) and cannot be\nimported beside it (wolfc rejects the second binding, E0306, while\nlupin silently keeps one of the two). Filed as F-0034. `decimal` is\nthe noun for the boundary this module owns, so the name the defect\nforced is also the better name, and std keeps it when the defect\ncloses.\n\n**Accuracy, stated as §10 requires.** Exact, not approximate: no ulp\nbudget appears here because none is spent. The printing side rounds the\nexact value once; the parsing side rounds the exact value once. The\nonly inexactness in the module is the first ESTIMATE the parser's slow\npath starts from, and an estimate that is wrong by any number of ulps\ncosts time and not accuracy — the exact comparison that follows moves\nit to the right answer or the guard trips and the estimate is rejected.\n\n**Not here**: locale-aware anything (a non-target, forever, in core),\nhexadecimal float literals (`0x1p-3`, a lexer question), `%g`-style\n\"shortest of fixed and exponential\" (`to_str` already answers the\nquestion `%g` was invented for), and any rendering of a `f64` that\nrounds to fewer digits than it takes to round-trip — that is\n`to_str_fixed`'s job and it is spelled with the precision the caller\nasked for.",
      "summary": "std.fmt.decimal — the `f64`↔decimal-string boundary, done exactly.",
      "items": [
        {
          "name": "to_str_fixed",
          "kind": "fn",
          "signature": "pub fn to_str_fixed(x: f64, prec: int) -> str",
          "doc": "`x` rendered with exactly `prec` digits after the decimal point, the\nexact value rounded half-even at the last one — `%.*f`, done right.\nA negative `prec` traps `assert` (a caller contract violation, §2);\n`prec == 0` renders no point at all. `-0.0` keeps its sign, because\nthe sign of zero is observable and a formatter that hides it is\nlying about the value it was given.\n\nNon-finite inputs render as `\"nan\"`, `\"inf\"` and `\"-inf\"` — the\nspellings `parse_float` deliberately does NOT accept, so a round trip\nthrough text is not a way to smuggle an infinity into a program.\n\nTotal otherwise: no error row, no traps beyond allocation. The cost is\nlinear in the number of exact digits, which for a subnormal is about\n750 — bounded, but not free.\n\n```wolf-doc-example\ndecimal.to_str_fixed(1.5, 2) == \"1.50\"\ndecimal.to_str_fixed(1.0, 0) == \"1\"\ndecimal.to_str_fixed(0.5, 0) == \"0\"\ndecimal.to_str_fixed(1.5, 0) == \"2\"\ndecimal.to_str_fixed(2.5, 0) == \"2\"\ndecimal.to_str_fixed(0.1, 20) == \"0.10000000000000000555\"\ndecimal.to_str_fixed(-0.0, 1) == \"-0.0\"\ndecimal.to_str_fixed(0.0, 3) == \"0.000\"\n```",
          "source": "std/fmt/decimal/decimal.lu",
          "line": 619,
          "tier": "core"
        },
        {
          "name": "to_str_exp",
          "kind": "fn",
          "signature": "pub fn to_str_exp(x: f64, prec: int) -> str",
          "doc": "`x` in exponential notation with exactly `prec` digits after the\npoint in the mantissa — `%.*e`, over the exact value, rounded\nhalf-even. The exponent carries a sign and at least two digits\n(`\"1.50e+00\"`), and `prec == 0` renders the mantissa alone\n(`\"2e+00\"`). A negative `prec` traps `assert`.\n\nZero renders with a zero exponent (`\"0.00e+00\"`), `-0.0` keeps its\nsign, and the non-finite spellings are `to_str_fixed`'s.\n\n```wolf-doc-example\ndecimal.to_str_exp(1.5, 2) == \"1.50e+00\"\ndecimal.to_str_exp(1500.0, 2) == \"1.50e+03\"\ndecimal.to_str_exp(0.015, 1) == \"1.5e-02\"\ndecimal.to_str_exp(2.0, 0) == \"2e+00\"\ndecimal.to_str_exp(0.0, 2) == \"0.00e+00\"\ndecimal.to_str_exp(9.99, 1) == \"1.0e+01\"\n```",
          "source": "std/fmt/decimal/decimal.lu",
          "line": 668,
          "tier": "core"
        },
        {
          "name": "to_str",
          "kind": "fn",
          "signature": "pub fn to_str(x: f64) -> str",
          "doc": "`x` as the SHORTEST decimal string that reads back as exactly `x` —\nthe round-trip contract the sprint names, and the rendering ordinary\ncode wants: `to_str(0.1)` is `\"0.1\"`, not `0.1`'s exact 55-digit\nexpansion, and `parse_float` maps it back to the same bits.\n\nThe digit count is genuinely minimal: the candidate is compared\nagainst the exact midpoints of `x`'s rounding interval, and a\ncandidate that lands exactly ON a midpoint counts when the tie goes\nthis way (round-half-even, so when `x`'s mantissa is even). That\nboundary rule is the difference between `to_str(9.999999999999999e22)`\nbeing `\"1e+23\"` and being seventeen digits, and it is why the shortest\nsearch must know how the READER breaks ties.\n\nLayout: positional when the decimal exponent of the leading digit is\nin -4..16, scientific otherwise (`\"1e+17\"`, `\"1e-05\"`) — the rule\nevery language with this function picks, with the crossover written\ndown instead of discovered. Integral values render without a trailing\n`\".0\"` (`to_str(3.0)` is `\"3\"`); `to_str_fixed(x, 1)` is the spelling\nthat keeps one. `-0.0` renders `\"-0\"`, and the non-finite spellings\nare `to_str_fixed`'s.\n\n```wolf-doc-example\ndecimal.to_str(0.1) == \"0.1\"\ndecimal.to_str(1.5) == \"1.5\"\ndecimal.to_str(3.0) == \"3\"\ndecimal.to_str(100.0) == \"100\"\ndecimal.to_str(0.0) == \"0\"\ndecimal.to_str(-0.0) == \"-0\"\ndecimal.to_str(1e17) == \"1e+17\"\ndecimal.to_str(0.00001) == \"1e-05\"\ndecimal.to_str(0.3333333333333333) == \"0.3333333333333333\"\n```",
          "source": "std/fmt/decimal/decimal.lu",
          "line": 757,
          "tier": "core"
        },
        {
          "name": "parse_float",
          "kind": "fn",
          "signature": "pub fn parse_float(s: str) -> f64 ! {parse, overflow}",
          "doc": "`s` parsed as an `f64`, correctly rounded: the result is the double\nnearest the exact decimal value the text denotes, ties to even.\n`parse` when the text is not a number; `overflow` when the value\nrounds beyond the finite range (§10's tag, meaning here exactly what\nit means for integers: a result outside the type). It is NOT spelled\n`range`: a row tag that shares a name with a module in scope — and\n`std.range` is one — resolves to that MODULE and leaves the function\nas an ordinary value, with no diagnostic and no `else` firing\n(F-0036).\n\nThe accepted shape is an optional sign, decimal digits with an\noptional `.` and fractional digits (at least one digit in total), and\nan optional `e`/`E` exponent with its own optional sign and at least\none digit. Nothing else: no whitespace, no digit separators, no `0x`,\nand no `inf`/`nan` spellings — those are values a program can write\nand not text a caller should be able to smuggle. Non-ASCII input is a\nmiss and never a trap (F-0018's boundary-safe probe).\n\nUnderflow is IEEE's and not an error: a value below half the smallest\nsubnormal rounds to a signed zero, exactly as the arithmetic would.\noverflow IS an error, because rounding `1e400` to `inf()` would turn\ntext that names no `f64` into a value that looks like one.\n\n```wolf-doc-example\n(decimal.parse_float(\"1.5\") else 0.0) == 1.5\n(decimal.parse_float(\"-2.25\") else 0.0) == -2.25\n(decimal.parse_float(\"3\") else 0.0) == 3.0\n(decimal.parse_float(\"1e2\") else 0.0) == 100.0\n(decimal.parse_float(\"5e-1\") else 0.0) == 0.5\n(decimal.parse_float(\"0.1\") else 0.0) == 0.1\n(decimal.parse_float(\"1e400\") else 0.0) == 0.0\n(decimal.parse_float(\"\") else -1.0) == -1.0\n(decimal.parse_float(\"1.2.3\") else -1.0) == -1.0\n```",
          "source": "std/fmt/decimal/decimal.lu",
          "line": 874,
          "tier": "core"
        }
      ]
    },
    {
      "name": "fs",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.fs — the filesystem, over rows: whole texts and whole BYTES, a\nfile-descriptor tier for the streaming cases, directories, metadata,\nand pure path arithmetic. Stability tier: core.\n\n**Errors are rows, never traps** (D30, and API-CONVENTIONS §2's\ntrap rule): a missing file, a refused permission, a host failure and\na text that is not UTF-8 are all ORDINARY outcomes a caller handles\nwith `else` or propagates with `?`. Nothing in this module traps, and\nnothing returns a sentinel. The vocabulary is the builtin tier's,\nadopted verbatim so that std adds no translation layer — s38's five,\nand s90's three:\n\n- `not_found` — the path does not exist (or, on a write, its parent\n  directory does not)\n- `denied` — the host refused the operation for permission reasons\n- `io` — every other host failure, coarsened to one tag because no\n  caller can act differently on them yet (§12's rule 3)\n- `utf8` — the bytes are not well-formed UTF-8; wolf `str` is UTF-8\n  by definition, so a text read that cannot decode is a miss. The\n  BYTE tier below has no `utf8` row anywhere, which is its point.\n- `eof` — a read reached the end of the file, which is an outcome\n  rather than a failure (the fd tier only)\n- `exists` — the path is already there and the operation demanded to\n  create it (`create_dir`, the exclusive creates `create_new`,\n  `create_new_with_mode` and `create_private`, `create_dir_mode`,\n  `symlink` and `link`)\n- `invalid` — DECLARED AND UNREACHABLE FROM TYPED CODE since sc35.\n  It named a `List[int]` element that is not a byte (outside 0..255)\n  offered to a byte write — the WRITE's spelling of the refusal\n  `str_from_utf8` makes on the way in (writing is not decoding, so\n  `utf8` would be a lie). The byte writes take `List[byte]` now, so\n  no typed caller can build the argument that raises it; the tag\n  stays in the vocabulary because §14 says the vocabulary is the\n  toolchain's and an FFI caller's wrong-width list still earns it\n  (wolf-lang#231's own posture, adopted verbatim)\n- `cross_device` — declared by `fs_rename` and never raised by this\n  module: `move_file` HANDLES it, which is what the fallback below is\n  for\n- `busy` — not now, and not the host's fault (sc72, wolf 0.2.35): a\n  lock another open holds (`lock`), a non-blocking handle that takes\n  no byte now (`write_some`), the host's `EAGAIN` either way\n\n**Capability: `fs` (I13).** Every function here reaches the host\nfilesystem, is tagged `fs` in the toolchain's sandbox table, and is\ncategorically refused at comptime (D33) — a `comptime fn` cannot read\na file, and the refusal names the reason. s90 widened the surface and\ndid NOT widen the sandbox: the fifteen new builtins carry the same tag\nand the same categorical refusal. The pure path helpers at the bottom\nof this module are the exception in both directions: they touch\nnothing and are comptime-safe.\n\n**The three-way split** (§8/§9's rule, applied to files). The\nIMPLEMENTATION owns the builtins this module delegates to — s38's\nnine (`fs_read_text`, `fs_write_text`, `fs_open`, `fs_create`,\n`fs_read`, `fs_write`, `fs_close`, `fs_remove`, `fs_exists`) and\ns90's fifteen (`fs_open_mode`, `fs_read_bytes`, `fs_write_bytes`,\n`fs_read_chunk`, `fs_write_chunk`, `fs_read_dir`, `fs_create_dir`,\n`fs_create_dir_all`, `fs_remove_dir`, `fs_remove_dir_all`,\n`fs_rename`, `fs_is_file`, `fs_is_dir`, `fs_size`,\n`fs_modified_ms`), s142's `fs_fstat`, s199's three\n(`fs_seek`, `fs_tell`, `fs_read_at` — wolf-lang#426, with the\nstandard streams as handles 0, 1 and 2, #424), s248's three\n(`fs_sync`, `fs_sync_dir`, `fs_realpath`, wolf 0.2.34), and wolf\n0.2.35's eight: s253's `fs_adopt` and s254's seven (`fs_access`,\n`fs_fstat_record`, `fs_lock`, `fs_unlock`, `fs_mkfifo`,\n`fs_set_nonblock`, `fs_write_some`), with open-mode bit 16\n(`NOFOLLOW`, this module's first constants beside `LOCK_SHARED` and\n`LOCK_EXCLUSIVE`), and the calls wolf-std#141 asked for: wolf\n0.2.26's `fs_copy_chunk` (`[os.fs.copy]`) and wolf 0.2.37's\n`fs_set_mode_fd` (`[os.fs.mode.fd]`), `fs_statfs` (`[os.fs.statfs]`)\nand the nine calls relative to a held directory (`fs_open_at`,\n`fs_stat_at`, `fs_lstat_at`, `fs_remove_at`, `fs_remove_dir_at`,\n`fs_create_dir_at`, `fs_symlink_at`, `fs_link_at`,\n`fs_read_dir_entries_at`, `[os.fs.at]`), with open-mode bit 32\n(`DIRECTORY`, `[os.fs.open.directory]`) — so their\nsemantics are part of this module's contract and are documented per\nfunction. std owns everything else:\nthe `File` value, the consuming `close`, the mode choice behind\n`append_text`/`open_append`, `move_file`'s fast path and its\nfallback, and the path arithmetic. The LANGUAGE owns nothing here;\nthere is no file syntax.\n\n**Paths are `str`, forward slashes travel everywhere.** wolf has no\n`Path` type at v0 and this module does not invent one: a path is a\n`str` the host interprets. Write forward slashes in wolf literals on\nevery platform — windows accepts them at the API, and a backslash in a\nwolf literal is an ESCAPE (`\"C:\\Users\"` does not lex, seven times over\nin the s38 test sweep). The path helpers here therefore split on `/`\nonly, and say so.\n\n**THE WORKAROUNDS ARE GONE, AND WHAT REPLACED THEM IS WORTH NAMING**\n(s90, wolf-lang#51/#52, F-0044 and F-0045 both CLOSED). For seven\nsprints three of this module's functions were shaped by builtins that\ndid not exist, and their docs said so:\n\n- `append_text` read the whole file, concatenated in memory and wrote\n  it back, behind an `fs_exists` check its own doc called a race. It\n  is `fs_open_mode(path, 2)` + one write + one close now: it touches\n  no existing byte, it asks no question whose answer can change under\n  it, and its `utf8` row went with the read that no longer happens.\n- `copy_file` and `move_file` were TEXT operations, so a file holding\n  a lone `0x80` did not survive them. Both are byte operations now,\n  and both lost `utf8` for the same reason.\n- `move_file` was copy-then-remove as its ONLY path. `fs_rename` is\n  the fast path now and copy-then-remove is the FALLBACK, reached\n  through the `cross_device` row the builtin declares for exactly\n  this purpose.\n\n**What is still deliberately absent**, each a reviewed contract\nrather than an approximation:\n\n- `rename(from, to)` as an ATOMIC move — **WITHDRAWN, not blocked.**\n  The contract asked for atomicity; the language deliberately does\n  not promise it, because POSIX `rename(2)` replaces a destination\n  atomically and windows `MoveFileEx` is documented to replace but\n  not to replace atomically. Upstream therefore ships `fs_rename`\n  claiming only the EFFECT and no `fs_rename_atomic` at all, per the\n  platform rule (a promise that cannot be kept on a tier-1 target\n  does not get a `#[cfg]` that keeps it on two out of three). std\n  adopts that reading rather than re-promising it one level up:\n  `move_file` is the wrapper, it says what it does and does not\n  guarantee, and there is no second name for the same call. The one\n  atomically-promisable primitive the language DOES offer everywhere\n  is `fs_open_mode`'s create-new mode, which nothing in std needed\n  until wolf 0.2.34 gave a save its syncs: sc69 wraps it as\n  `create_new` (and `create_new_with_mode`), the first of the atomic\n  save's five calls — `create_new`, write, `sync`, `move_file` (a\n  rename in one directory, atomic on every unix), `sync_dir` — which\n  `sync`'s doc spells out. The promise is the save's, made of calls\n  that each keep theirs; there is still no `rename_atomic`.\n- `stem` / `extension` — a pair that has to decide what a dot means\n  (a leading dot, a doubled extension, no dot at all). That was never\n  a filing about the builtin tier; it is a design question this\n  module has not answered, and the earlier citation of F-0044 beside\n  it was wrong.\n- `is_absolute`, and `join`'s behaviour on an absolute `name` —\n  documented on `join` itself.\n- `io.Read`/`io.Write` traits and buffering — blocked on trait\n  dispatch (F-0004), not on the filesystem. Every write here is\n  unbuffered and every function says so.\n\n**What this module CANNOT witness, stated rather than implied**\n(§14's rule for a claim a green rig would otherwise imply):\n`denied` needs a permission call, `cross_device` needs two\nfilesystems, and `read_dir`'s `utf8` needs a file name the host holds\nin bytes no `str` can carry. None of the three has a portable litmus,\nso no test here observes them; their meanings are documented on the\nfunctions and nothing claims more. `move_file`'s fallback is reached\nonly through `cross_device`, so the TRIGGER is unwitnessed here even\nthough the fallback's body — `copy_file` then `remove` — is two\ntested functions.\n\n**Lanes (re-measured at the sc12 pin, one call at a time).** BOTH\ncompiler rungs are executing lanes: the checked tier performs real\nhost operations and the native rung lowers all twenty-four fs\nbuiltins over the eu ABI (s90, `RT_SYMBOLS` 83 -> 94), so every new\nfunction here lands with two lanes from its first commit rather than\ngaining the second one later. The comptime sandbox is the one place\nthese operations are refused (D33). lupin has no fs builtins by\ndesign, and the refusal for the s90 names is the generic\nunknown-name one (``unsupported: `fs_read_dir` does not resolve``,\nmeasured) rather than a reasoned decline — but lupin resolves module\nbodies LAZILY, so the pure path helpers RUN there:\n`tests/fs/path_helpers.lu` is a lupin `run` row at this pin, which is\na property of the lane split rather than a leak. The posture is the\nrig's to record once (`CONTRIBUTING.md`, the ledger's fs section)\nrather than each test's to restate.",
      "summary": "std.fs — the filesystem, over rows: whole texts and whole BYTES, a file-descriptor tier for the streaming cases, directories, metadata, and pure path arithmetic.",
      "items": [
        {
          "name": "IoErrors",
          "kind": "error",
          "signature": "pub error IoErrors = {not_found, denied, io}",
          "doc": "The row fourteen signatures below carry, named once (`[type.err.alias]`).\nTransparent: the alias and the expanded row are the same type in\nboth directions, and the diagnostic still names tags (`[type.err.alias.diag]`).",
          "source": "std/fs/fs.lu",
          "line": 170,
          "tier": "core"
        },
        {
          "name": "File",
          "kind": "struct",
          "signature": "pub struct File { fd: int, }",
          "doc": "An open file: the host descriptor this process may read from or\nwrite to, according to how it was opened.\n\nThe field is an `int` because that is what the builtin tier hands\nout — a small non-negative index into the machine's file table, never\na pointer, and never reused after `close` at this pin. Reading it is\nlegal and occasionally useful in a diagnostic; passing a hand-built\n`File` to `read` or `write` is not a trap but a miss (`io`), because a\nforged descriptor is a checkable condition rather than a contract\nviolation.\n\n**Staleness is prevented by the mode system, not by a generation\ncounter.** `close` takes its `File` by `take` (X1), so a caller that\ncloses a file and then reads it is rejected statically as a\nuse-after-move — the discipline a generational handle would enforce\ndynamically, enforced earlier and for free. `std.pool`'s handles need\ngenerations because a pool hands out many; a `File` has exactly one\nowner.\n\nThe value does not record which MODE opened it. Writing to a handle\n`open` produced is `io`, and reading one `create` produced is `io`,\nbecause the host refuses — not because this struct checked.",
          "source": "std/fs/fs.lu",
          "line": 199,
          "tier": "core"
        },
        {
          "name": "read_text",
          "kind": "fn",
          "signature": "pub fn read_text(path: str) -> str ! {not_found, denied, io, utf8}",
          "doc": "The whole contents of the file at `path`, decoded as UTF-8.\n\nRows: `not_found` when the path does not exist, `denied` when the\nhost refuses, `io` for any other host failure, `utf8` when the bytes\nare not well-formed UTF-8 (nothing is returned in that case — this is\nnot a lossy decode). Never traps.\n\n`read_bytes` is the same read without the decode, and it is what a\nprogram reaches for when the file is not text.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_text`, whose whole-file read is not incremental: a file\nlarger than the process wants to hold is the fd tier's business.\n\n```wolf-doc-example\nfs.write_text(\"doc-read-text.tmp\", \"three wolves\\n\")?\n(fs.read_text(\"doc-read-text.tmp\") else \"?\") == \"three wolves\\n\"\nfs.remove(\"doc-read-text.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 222,
          "tier": "core"
        },
        {
          "name": "write_text",
          "kind": "fn",
          "signature": "pub fn write_text(path: str, text: str) -> () ! IoErrors",
          "doc": "Write `text` to `path`, replacing whatever was there and creating the\nfile if it does not exist.\n\nRows: `not_found` when the path's parent directory does not exist,\n`denied` when the host refuses, `io` for any other host failure.\nThere is no `utf8` row in either direction: a wolf `str` is already\nwell-formed UTF-8, so writing one cannot fail to encode. Never traps.\n\nNot atomic: a failure part-way leaves the file part-written, exactly\nas the host's write does. A caller who needs all-or-nothing writes to\na temporary path and then calls `move_file` — which is a host rename\nwhen both paths share a filesystem, and which promises the EFFECT\nrather than atomicity (see its doc, and the module header on why the\natomic name does not exist).\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_write_text`.\n\n```wolf-doc-example\nfs.write_text(\"doc-write-text.tmp\", \"alpha\")?\n(fs.read_text(\"doc-write-text.tmp\") else \"?\") == \"alpha\"\nfs.write_text(\"doc-write-text.tmp\", \"beta\")?\n(fs.read_text(\"doc-write-text.tmp\") else \"?\") == \"beta\"\nfs.remove(\"doc-write-text.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 251,
          "tier": "core"
        },
        {
          "name": "append_text",
          "kind": "fn",
          "signature": "pub fn append_text(path: str, text: str) -> () ! IoErrors",
          "doc": "Append `text` to the end of the file at `path`, creating it when it\nis absent.\n\nRows: `not_found` when the parent directory does not exist, `denied`\nwhen the host refuses, `io` for any other host failure. Never traps.\n\n**It is an append now, and the three things that used to be true\nabout it are not.** Until s90 there was no append-mode open, so this\nfunction read the whole file, concatenated in memory and wrote it\nback — behind an `fs_exists` check that was a check-then-use race its\nown doc had to warn about. It opens the file in append mode, writes\nonce and closes:\n\n- it reads NO existing byte, so its cost is in `text` rather than in\n  the file's size, and a `utf8` row is gone with the decode that no\n  longer happens — appending to a file that is not valid UTF-8 is now\n  an ordinary append;\n- it asks no question whose answer can change before it acts: the\n  create and the open are one host call, so the absent-file case\n  needs no probe;\n- every write lands at the end of the file AS IT IS AT THE MOMENT OF\n  THE WRITE (the mode's whole point), so two processes appending\n  lines to one log no longer lose one of them.\n\nWhat it still does not promise: that ONE call is atomic. A single\nshort write to an append handle is what the host makes of it, and\nnothing in the language claims more.\n\nThe handle is closed on every exit, including the error path, by a\n`defer` — which is the idiom §12 records for exactly this and the\nreason a failed write here does not leak a descriptor.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_mode` (mode 2), `fs_write` and `fs_close`.\n\n```wolf-doc-example\nfs.write_text(\"doc-append.tmp\", \"one\\n\")?\nfs.append_text(\"doc-append.tmp\", \"two\\n\")?\n(fs.read_text(\"doc-append.tmp\") else \"?\") == \"one\\ntwo\\n\"\nfs.remove(\"doc-append.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 296,
          "tier": "core"
        },
        {
          "name": "read_bytes",
          "kind": "fn",
          "signature": "pub fn read_bytes(path: str) -> List[byte] ! IoErrors",
          "doc": "The whole contents of the file at `path`, as bytes — no decode, no\n`utf8` row, nothing refused for being data.\n\nRows: `not_found` when the path does not exist, `denied` when the\nhost refuses, `io` for any other host failure. Never traps.\n\nThis is the read `copy_file` is built from, and the reason a file\nholding a lone `0x80` survives this module now. `std.bytes` is the\nvocabulary for what comes back; `std.bytes.to_str` is the way to text\nwhen the caller wants to find out whether it IS text.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_bytes`.\n\n```wolf-doc-example\nvar raw = List[byte]()\n(mut raw).push(128 as byte)\n(mut raw).push(0 as byte)\n(mut raw).push(255 as byte)\nfs.write_bytes(\"doc-read-bytes.tmp\", raw)?\nlet back = fs.read_bytes(\"doc-read-bytes.tmp\") else List[byte]()\nback.len == 3\nback[0] as int == 128\nback[2] as int == 255\nfs.remove(\"doc-read-bytes.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 328,
          "tier": "core"
        },
        {
          "name": "write_bytes",
          "kind": "fn",
          "signature": "pub fn write_bytes(path: str, b: List[byte]) -> () ! {not_found, denied, invalid, io}",
          "doc": "Write `b` to `path` as bytes, replacing whatever was there and\ncreating the file if it does not exist.\n\nRows: `not_found` when the path's parent directory does not exist,\n`denied` when the host refuses, `io` for any other host failure, and\n**`invalid` — declared and UNREACHABLE from typed code (sc35).** It\nnamed an element of `b` that is not a byte (outside 0..255), which\nthe interim `List[int]` currency (§11) made spellable; `b` is a\n`List[byte]` now and cannot hold one. Never traps.\n\nThe tag is not removed, and that is deliberate: §14 says the row\nvocabulary is the toolchain's, `fs_write_bytes` still declares\n`invalid` (wolf-lang#231 kept it on purpose — an FFI caller's\nwrong-width list still earns it), and dropping a tag a caller may\nhave written a handler for is a breaking change this rename is not.\nThe witness moved with the contract: `tests/fs/invalid_row.lu` is a\nstatic E0401 rejection now.\n\nThe row was a deliberate departure from §11's encoder rule, which\nhas `hex.encode` TRAP on an element out of range — and at sc35 both\nhalves of that disagreement are moot, because neither door can be\nreached. The reasoning is kept because it is still the rule for the\nnext row: a library that traps where the toolchain raises has taken\na decision away from its caller.\n\nNot atomic, exactly as `write_text` is not.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_write_bytes`.\n\n```wolf-doc-example\nvar raw = List[byte]()\n(mut raw).push(119 as byte)\n(mut raw).push(0 as byte)\n(mut raw).push(102 as byte)\nfs.write_bytes(\"doc-write-bytes.tmp\", raw)?\n(fs.size(\"doc-write-bytes.tmp\") else 0 - 1) == 3\nfs.remove(\"doc-write-bytes.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 371,
          "tier": "core"
        },
        {
          "name": "exists",
          "kind": "fn",
          "signature": "pub fn exists(path: str) -> bool",
          "doc": "Does something exist at `path`?\n\nTotal: no rows, no traps — a path the process cannot even ask about\nanswers `false` rather than raising, which is what makes this the\nprobe you write before a `read_text` and never the probe you rely on\nafterwards: between the two calls the answer can change, and only the\nrow from the operation itself is authoritative (the check-then-use\nrace is the caller's to avoid, not this function's to hide).\n\nAnswers `true` for a directory as well as a file. `is_file` and\n`is_dir` are the two that say WHICH, and they are total for the same\nreason this one is.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_exists`.\n\n```wolf-doc-example\nfs.exists(\"doc-exists.tmp\") == false\nfs.write_text(\"doc-exists.tmp\", \"x\")?\nfs.exists(\"doc-exists.tmp\") == true\nfs.remove(\"doc-exists.tmp\")?\nfs.exists(\"doc-exists.tmp\") == false\n```",
          "source": "std/fs/fs.lu",
          "line": 397,
          "tier": "core"
        },
        {
          "name": "is_file",
          "kind": "fn",
          "signature": "pub fn is_file(path: str) -> bool",
          "doc": "Is there a regular FILE at `path`?\n\nTotal: no rows, no traps. A missing path is not a file, a directory\nis not a file, and a path the process cannot ask about answers\n`false` — the same posture `exists` takes, and for the same reason\n(a predicate that raised would be a predicate every caller had to\nwrap).\n\nLike `exists`, this is a probe and not a lock: the answer can change\nbetween this call and the next one, and only the row from the\noperation itself is authoritative.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_is_file`.\n\n```wolf-doc-example\nfs.write_text(\"doc-is-file.tmp\", \"x\")?\nfs.is_file(\"doc-is-file.tmp\") == true\nfs.is_dir(\"doc-is-file.tmp\") == false\nfs.is_file(\"doc-is-file-absent.tmp\") == false\nfs.remove(\"doc-is-file.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 423,
          "tier": "core"
        },
        {
          "name": "is_dir",
          "kind": "fn",
          "signature": "pub fn is_dir(path: str) -> bool",
          "doc": "Is there a DIRECTORY at `path`?\n\nTotal: no rows, no traps — `is_file`'s twin, with the same\nprobe-not-lock caveat.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_is_dir`.\n\n```wolf-doc-example\nfs.create_dir(\"doc-is-dir.tmp\")?\nfs.is_dir(\"doc-is-dir.tmp\") == true\nfs.is_file(\"doc-is-dir.tmp\") == false\nfs.is_dir(\"doc-is-dir-absent.tmp\") == false\nfs.remove_dir(\"doc-is-dir.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 441,
          "tier": "core"
        },
        {
          "name": "size",
          "kind": "fn",
          "signature": "pub fn size(path: str) -> int ! IoErrors",
          "doc": "The size of the file at `path`, in BYTES.\n\nRows: `not_found` when the path does not exist, `denied` when the\nhost refuses, `io` for any other host failure. Never traps.\n\nBytes are the currency here as they are in `std.str` (§9): this is\nthe number `read_bytes` will hand back, and for a text file it is the\nnumber `read_text`'s result reports as `len`. The size of a DIRECTORY\nis whatever the host says it is and means nothing portable; ask\n`read_dir` how many entries there are instead.\n\nA size read is not a lease. The file can grow between this call and\nthe read that follows it, which is why nothing in this module sizes a\nfile in order to read it.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_size`.\n\n```wolf-doc-example\nfs.write_text(\"doc-size.tmp\", \"héllo\")?\n(fs.size(\"doc-size.tmp\") else 0 - 1) == 6\n(fs.size(\"doc-size-absent.tmp\") else 0 - 1) == 0 - 1\nfs.remove(\"doc-size.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 468,
          "tier": "core"
        },
        {
          "name": "modified_ms",
          "kind": "fn",
          "signature": "pub fn modified_ms(path: str) -> int ! IoErrors",
          "doc": "When the file at `path` was last modified, in MILLISECONDS from the\nUnix epoch — negative before it.\n\nRows: `not_found` when the path does not exist, `denied` when the\nhost refuses, `io` for any other host failure, which includes a host\nthat has a file but no modification time for it. Never traps.\n\n**The unit is in the name, and that is a departure this doc owes an\nexplanation.** §14's rule is that when a builtin hands std a bare\n`int` whose UNIT is the whole contract, std names the unit in a TYPE\n— which is why `std.time` ships `Instant` and `Duration`. Returning a\n`time.Instant` here would make `std.fs` depend on `std.time`, and a\ndependency between two std modules is charged per PROGRAM at this pin\n(two modules that declare a same-named function cannot be linked into\none native binary, F-0026), so every program that touched a file\nwould carry the calendar. The unit therefore rides in the name, where\nit is at least impossible to miss. The scale is deliberately\n`time_unix_ms`'s, so `time.unix_ms() - fs.modified_ms(p)?` is an age\nin milliseconds with no conversion — and the day a `Path`/`Instant`\npair is worth the dependency, that is the signature change to make.\n\nResolution is the host's: a filesystem that stores seconds answers\nmultiples of 1000, and nothing here rounds or pretends otherwise.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_modified_ms`.\n\n```wolf-doc-example\nfs.write_text(\"doc-modified.tmp\", \"x\")?\nlet stamp = fs.modified_ms(\"doc-modified.tmp\") else 0 - 1\nstamp > 0\n(fs.modified_ms(\"doc-modified-absent.tmp\") else 0 - 1) == 0 - 1\nfs.remove(\"doc-modified.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 506,
          "tier": "core"
        },
        {
          "name": "remove",
          "kind": "fn",
          "signature": "pub fn remove(path: str) -> () ! IoErrors",
          "doc": "Remove the file at `path`.\n\nRows: `not_found` when there is nothing to remove — removing an\nabsent file is a MISS, not a silent success, because a caller who\nwanted \"make sure it is gone\" can say so with `else` and a caller who\nexpected a file wants to hear about it. `denied` when the host\nrefuses, `io` for any other host failure, which includes asking to\nremove a DIRECTORY: `remove_dir` and `remove_dir_all` are the two\nthat do that, and the tag stays `io` because the platforms spell the\nrefusal differently and no caller acts differently on them. Never\ntraps.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_remove`.\n\n```wolf-doc-example\nfs.write_text(\"doc-remove.tmp\", \"x\")?\nfs.remove(\"doc-remove.tmp\")?\nfs.exists(\"doc-remove.tmp\") == false\n```",
          "source": "std/fs/fs.lu",
          "line": 529,
          "tier": "core"
        },
        {
          "name": "copy_file",
          "kind": "fn",
          "signature": "pub fn copy_file(from: str, to: str) -> () ! IoErrors",
          "doc": "Copy the BYTES of `from` to `to`, replacing `to` if it exists.\n\nRows: `not_found` when `from` does not exist or `to`'s parent\ndirectory does not, `denied` when the host refuses either half, `io`\nfor any other host failure. Never traps.\n\n**It is a byte copy now, and the row it lost says so.** Until s90 it\nwas `read_text` + `write_text`, which meant a file holding a lone\n`0x80` came back refused with `utf8` — a copy that works on text and\ncorrupts (or declines) everything else. It is `fs_read_bytes` +\n`fs_write_bytes`, there is no decode anywhere in it, and `utf8` is\ngone from the row because nothing here can raise it.\n\n`fs_write_bytes` declares `invalid` for an element that is not a\nbyte. This function cannot raise it: the bytes came out of\n`fs_read_bytes` one line earlier and are bytes by construction. The\nhandler below therefore reports `io` on that arm — the coarsening a\ncaller could not act on differently — rather than widening this\nsignature with a tag no input can reach (§14: a function's row is the\nunion of what its delegates raise, MINUS what it handles itself).\n\nNot atomic, and it reads the whole file into memory: a file larger\nthan the process wants to hold wants the fd tier's `read_chunk` /\n`write_chunk` in a loop. Copying a file onto itself truncates it and\nis not a supported operation.\n\nCapability `fs`; refused at comptime (D33).\n\n```wolf-doc-example\nfs.write_text(\"doc-copy-src.tmp\", \"wolves\\n\")?\nfs.copy_file(\"doc-copy-src.tmp\", \"doc-copy-dst.tmp\")?\n(fs.read_text(\"doc-copy-dst.tmp\") else \"?\") == \"wolves\\n\"\nfs.remove(\"doc-copy-src.tmp\")?\nfs.remove(\"doc-copy-dst.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 568,
          "tier": "core"
        },
        {
          "name": "move_file",
          "kind": "fn",
          "signature": "pub fn move_file(from: str, to: str) -> () ! IoErrors",
          "doc": "Move the file at `from` to `to`.\n\nRows: `not_found` when `from` does not exist or `to`'s parent\ndirectory does not, `denied` when the host refuses, `io` for any\nother host failure. Never traps.\n\n**The host rename is the fast path and copy-then-remove is the\nfallback** — which is the other way round from every earlier pin,\nwhere the copy was the only path. The rename moves the directory\nentry without reading a byte, so a gigabyte within one filesystem\ncosts the same as an empty file. Two of `fs_rename`'s rows are the\nfallback's triggers rather than failures, and this function handles\nboth:\n\n- `cross_device` — `from` and `to` are on different filesystems\n  (`EXDEV`, `ERROR_NOT_SAME_DEVICE`), which no rename can do\n  anywhere. The fallback is `copy_file` then `remove`, and because\n  `copy_file` is a BYTE copy the fallback is a real fallback and not\n  a text operation wearing a disguise.\n- `exists` — the destination is there and this host's rename will not\n  replace it. unix replaces a file and an empty directory; windows\n  refuses a directory outright. The fallback replaces it, so callers\n  see one behaviour on every tier-1 target instead of the platform's.\n\n**It is not atomic and it does not claim to be.** A host rename is\natomic within a filesystem on unix; windows does not promise that,\nso the LANGUAGE does not promise it (there is no `fs_rename_atomic`)\nand neither does this function. On the fallback path it is plainly\nnot atomic: a failure between the copy and the remove leaves both\nfiles, which is the same exposure this function has always had and is\nnow the uncommon case rather than the only one.\n\nThe fallback's TRIGGER cannot be witnessed portably — a test would\nneed two filesystems — so no test here reaches it, and the module\nheader says so. Its body is `copy_file` followed by `remove`, both of\nwhich are tested.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_rename`,\nand to `copy_file` + `fs_remove` on the fallback.\n\n```wolf-doc-example\nfs.write_text(\"doc-move-src.tmp\", \"pack\\n\")?\nfs.move_file(\"doc-move-src.tmp\", \"doc-move-dst.tmp\")?\nfs.exists(\"doc-move-src.tmp\") == false\n(fs.read_text(\"doc-move-dst.tmp\") else \"?\") == \"pack\\n\"\nfs.remove(\"doc-move-dst.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 625,
          "tier": "core"
        },
        {
          "name": "read_dir",
          "kind": "fn",
          "signature": "pub fn read_dir(path: str) -> List[str] ! {not_found, denied, utf8, io}",
          "doc": "The entry NAMES directly inside the directory at `path`, SORTED.\n\nRows: `not_found` when the path does not exist, `denied` when the\nhost refuses, `io` for any other host failure — which includes\nasking a regular file for its entries. `utf8` when an entry's name is\nbytes no `str` can carry: the LISTING fails rather than the entry\nbeing dropped, because a `read_dir` that silently omits a file lies\nabout the directory. Never traps.\n\n**Names, not paths.** An entry comes back as `\"today.txt\"`, never as\n`\"logs/today.txt\"` — join it yourself with `join`, which is the pure\nhelper at the bottom of this module and exists for exactly this.\nReturning names is the builtin's decision and std does not decorate\nit: a caller who wants paths says so in one call, and a caller who\nwants names cannot get them back out of a path without cutting.\n\n**Sorted is a promise, and it is the toolchain's.** Filesystem order\ndiffers per filesystem, so an unsorted listing makes every program\nwritten against it machine-dependent and every test of one a coin\nflip. The order is by the name's bytes, which is `str`'s own\nrelational order (`[mem.str.order]`) and therefore the order\n`std.sort` would put them in. `.` and `..` are not entries and do not\nappear.\n\nThe listing is a snapshot, not a lock: an entry can be gone by the\ntime the caller opens it, which is the same check-then-use caveat\n`exists` carries.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_dir`.\n\n```wolf-doc-example\nfs.create_dir(\"doc-read-dir.tmp\")?\nfs.write_text(\"doc-read-dir.tmp/beta.txt\", \"b\")?\nfs.write_text(\"doc-read-dir.tmp/alpha.txt\", \"a\")?\nlet names = fs.read_dir(\"doc-read-dir.tmp\") else List[str]()\nnames.len == 2\nnames[0] == \"alpha.txt\"\nnames[1] == \"beta.txt\"\nfs.remove_dir_all(\"doc-read-dir.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 681,
          "tier": "core"
        },
        {
          "name": "create_dir",
          "kind": "fn",
          "signature": "pub fn create_dir(path: str) -> () ! {exists, not_found, denied, io}",
          "doc": "Create ONE directory at `path`.\n\nRows: `exists` when something is already there — a directory, a file,\nanything — because this function's contract is that it CREATED the\ndirectory, and \"it was already here\" is a different outcome a caller\nmay well act on. `not_found` when the parent directory does not\nexist: this form creates exactly one level. `denied` when the host\nrefuses, `io` for any other host failure. Never traps.\n\n`create_dir_all` is the idempotent form: it creates the parents and\nan existing directory is not an error there, which is what makes it\nthe one to reach for before a write. Reach for THIS one when the\ncreation is the point — a lock directory, a run whose output must not\nland on top of an earlier one.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_create_dir`.\n\n```wolf-doc-example\nfs.create_dir(\"doc-create-dir.tmp\")?\nfs.is_dir(\"doc-create-dir.tmp\") == true\nvar again = false\nfs.create_dir(\"doc-create-dir.tmp\") else |_| { again = true }\nagain == true\nfs.remove_dir(\"doc-create-dir.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 711,
          "tier": "core"
        },
        {
          "name": "create_dir_all",
          "kind": "fn",
          "signature": "pub fn create_dir_all(path: str) -> () ! {denied, io}",
          "doc": "Create the directory at `path` and every missing parent of it.\n\nRows: `denied` when the host refuses, `io` for any other host\nfailure — which includes a path whose parent is a regular FILE, since\nno directory can be created under it. Never traps.\n\n**It is idempotent, and that is why it has no `exists` row**: a\ndirectory that is already there is success, because the caller asked\nfor the directory to EXIST rather than for it to be created. There is\nno `not_found` either — a missing parent is the thing this function\nmakes.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_create_dir_all`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-create-all.tmp/a/b\")?\nfs.is_dir(\"doc-create-all.tmp/a/b\") == true\nfs.create_dir_all(\"doc-create-all.tmp/a/b\")?\nfs.remove_dir_all(\"doc-create-all.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 736,
          "tier": "core"
        },
        {
          "name": "remove_dir",
          "kind": "fn",
          "signature": "pub fn remove_dir(path: str) -> () ! IoErrors",
          "doc": "Remove the EMPTY directory at `path`.\n\nRows: `not_found` when there is nothing there, `denied` when the host\nrefuses, `io` for any other host failure — which includes a\ndirectory that is not empty and a path that is a regular file. The\nnon-empty case is `io` rather than a tag of its own because the\nplatforms spell the errno differently and a caller's response is the\nsame either way (§12's rule 3: one tag per failure mode a caller can\nACT on). Never traps.\n\n`remove_dir_all` is the recursive form, and it is the one that\ndeletes data a caller did not name.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_remove_dir`.\n\n```wolf-doc-example\nfs.create_dir(\"doc-remove-dir.tmp\")?\nfs.remove_dir(\"doc-remove-dir.tmp\")?\nfs.exists(\"doc-remove-dir.tmp\") == false\n```",
          "source": "std/fs/fs.lu",
          "line": 761,
          "tier": "core"
        },
        {
          "name": "remove_dir_all",
          "kind": "fn",
          "signature": "pub fn remove_dir_all(path: str) -> () ! IoErrors",
          "doc": "Remove the directory at `path` and EVERYTHING inside it.\n\nRows: `not_found` when there is nothing there, `denied` when the host\nrefuses, `io` for any other host failure. Never traps.\n\n**This deletes files the caller did not name**, which is the one\noperation in this module with that property, and it is worth one\nsentence of ceremony: there is no confirmation, no dry run and no\nundo, and a path assembled from data is a path that can name\nsomewhere unintended. `remove_dir` is the form that refuses to delete\nanything it was not pointed at.\n\nIt is not atomic: a failure part-way leaves part of the tree, exactly\nas the host's walk does.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_remove_dir_all`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-remove-all.tmp/a\")?\nfs.write_text(\"doc-remove-all.tmp/a/x.txt\", \"x\")?\nfs.remove_dir_all(\"doc-remove-all.tmp\")?\nfs.exists(\"doc-remove-all.tmp\") == false\n```",
          "source": "std/fs/fs.lu",
          "line": 789,
          "tier": "core"
        },
        {
          "name": "open",
          "kind": "fn",
          "signature": "pub fn open(path: str) -> File ! IoErrors",
          "doc": "Open the file at `path` for READING and return its handle.\n\nRows: `not_found` when the path does not exist, `denied` when the\nhost refuses, `io` for any other host failure. Never traps.\n\nThe handle must be closed with `close`, which consumes it. `create`\nis the write-and-truncate mode, `open_append` the append mode and\n`create_new` the exclusive create-new mode; the builtin tier also has\na read-write mode, which std does not wrap yet and which the module\nheader accounts for. `defer` is the idiom for the close, and\n`errdefer` the idiom for a close on the error path only (§12);\nneither is available inside a doc example, so the example below\ncloses explicitly.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_open`.\n\n```wolf-doc-example\nfs.write_text(\"doc-open.tmp\", \"abcdef\")?\nvar f = fs.open(\"doc-open.tmp\")?\n(fs.read(mut f, 3) else \"?\") == \"abc\"\nfs.close(take f)?\nfs.remove(\"doc-open.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 816,
          "tier": "core"
        },
        {
          "name": "open_append",
          "kind": "fn",
          "signature": "pub fn open_append(path: str) -> File ! IoErrors",
          "doc": "Open the file at `path` for APPENDING and return its handle,\ncreating the file when it is absent.\n\nRows: `not_found` when the parent directory does not exist, `denied`\nwhen the host refuses, `io` for any other host failure. Never traps.\n\nEvery write through this handle lands at the end of the file as it is\nat the moment of the write, so a second writer cannot be overwritten\nby this one's stale idea of where the end was. The handle is\nwrite-only: reading it is `io`.\n\n`append_text` is this function plus one write and one close, and is\nwhat a program that appends once should call. Reach for the handle\nwhen a program appends repeatedly — a log writer opens once and pays\nfor one open instead of one per line.\n\nThe handle must be closed with `close`, which consumes it.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_mode` (mode 2).\n\n```wolf-doc-example\nfs.write_text(\"doc-open-append.tmp\", \"one\\n\")?\nvar f = fs.open_append(\"doc-open-append.tmp\")?\nfs.write(mut f, \"two\\n\")?\nfs.write(mut f, \"three\\n\")?\nfs.close(take f)?\n(fs.read_text(\"doc-open-append.tmp\") else \"?\") == \"one\\ntwo\\nthree\\n\"\nfs.remove(\"doc-open-append.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 850,
          "tier": "core"
        },
        {
          "name": "create",
          "kind": "fn",
          "signature": "pub fn create(path: str) -> File ! {denied, io}",
          "doc": "Create (or truncate) the file at `path` for WRITING and return its\nhandle.\n\nRows: `denied` when the host refuses, `io` for any other host failure\n— including a parent directory that does not exist, which the builtin\ntier does not distinguish here the way `write_text` does. Never traps.\n\nAn existing file is truncated to nothing, which is the operation's\npoint: `create` is how a program writes a file it means to own. The\nhandle must be closed with `close`, which consumes it.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_create`.\n\n```wolf-doc-example\nvar f = fs.create(\"doc-create.tmp\")?\nfs.write(mut f, \"pack\")?\nfs.close(take f)?\n(fs.read_text(\"doc-create.tmp\") else \"?\") == \"pack\"\nfs.remove(\"doc-create.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 874,
          "tier": "core"
        },
        {
          "name": "create_new",
          "kind": "fn",
          "signature": "pub fn create_new(path: str) -> File ! {exists, not_found, denied, io}",
          "doc": "Create a NEW file at `path`, open for reading and writing, and fail\nif anything is already there: the EXCLUSIVE create, the one atomicity\nevery tier-1 host promises (`[os.fs.open]`'s mode 4).\n\nTwo programs that race to `create_new` one name: exactly one gets the\nfile, the other `exists` — what a lock file, a unique temporary name\nand an atomic save's temporary file need. It never truncates and\nnever follows a name to a file someone else made. The file gets\n`0o666` less the process's umask, as `create` does\n(`create_new_with_mode` names its bits from the first instant).\n\nRows: `exists` when anything is at `path` (a file, a directory, a\nlink, a dangling one included); `not_found` when the parent directory\nis missing; `denied` when the host refuses; `io` otherwise. Never\ntraps. Served on every machine, lupin included, and on windows\n(ruling #97 R3: no third spelling in the toolchain; this is std's).\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_mode` (mode 4).\n\n```wolf-doc-example\nvar f = fs.create_new(\"doc-create-new.tmp\")?\nfs.write(mut f, \"first\")?\nfs.close(take f)?\nvar taken = false\nvar g = fs.create_new(\"doc-create-new.tmp\") else |_| {\n    taken = true\n    fs.File { fd: 0 - 1 }\n}\nfs.close(take g) else |_| { }\nlet text = fs.read_text(\"doc-create-new.tmp\")?\nfs.remove(\"doc-create-new.tmp\")?\ntaken == true && text == \"first\"\n```",
          "source": "std/fs/fs.lu",
          "line": 912,
          "tier": "core"
        },
        {
          "name": "create_new_with_mode",
          "kind": "fn",
          "signature": "pub fn create_new_with_mode(path: str, mode: int) -> File ! { exists, not_found, denied, invalid, unsupported, io, }",
          "doc": "`create_new`, with the permission bits the file has from its first\ninstant: `mode` less the process's umask (`env.umask`), never wider\nfor a moment — an atomic save's temporary file with the target's\nbits, before it is renamed over the target.\n\n`[os.fs.create.mode]`'s `fs_open_perm` with open mode 4. `mode` is the\nnine permission bits; the three above them are set afterwards with\n`set_mode`, because the hosts disagree about them at a creation.\n\nRows: `invalid` when `mode` is outside `0..=0o777`; `exists` when\nanything is at `path`; `not_found` when the parent directory is\nmissing; `denied`; `unsupported` on a host with no permission bits\n(windows, by name: `create_new` is the call there); `io` otherwise.\nNever traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_perm`.\n\n```wolf-doc-example\nvar served = true\nvar f = fs.create_new_with_mode(\"doc-create-new-mode.tmp\", 0o600) else |_| {\n    served = false\n    fs.create_new(\"doc-create-new-mode.tmp\")?\n}\nfs.close(take f)?\nlet info = fs.stat(\"doc-create-new-mode.tmp\")?\nfs.remove(\"doc-create-new-mode.tmp\")?\n(served && info.mode == 0o600) || (!served && !fs.answered(info, 4))\n```",
          "source": "std/fs/fs.lu",
          "line": 952,
          "tier": "core"
        },
        {
          "name": "read",
          "kind": "fn",
          "signature": "pub fn read(mut f: File, max: int) -> str ! {eof, io, utf8}",
          "doc": "Read up to `max` bytes from `f`, decoded as UTF-8, advancing the\nfile's position.\n\nRows: `eof` when the file is already at its end — the outcome that\nends a read loop, and the reason a reader is written as a loop over\nthis function rather than a test against a length. `io` when the\nhandle is closed or foreign, or the host failed. `utf8` when the\nbytes read are not well-formed UTF-8, WHICH INCLUDES a chunk boundary\nthat lands inside a code point: a fixed-size read of text is not safe\nin general. **`read_chunk` is the honest fix and it exists now** — it\nhands back the bytes and lets the caller decide where a code point\nends, which is a decision only the caller can make when the\nboundaries are unknown. ASCII text chunks at any size, and a `max` at\nor above the file's remaining size always decodes.\n\n`mut f` because the operation advances the file's POSITION: the\nbytes a second call sees depend on the first, which is state the\nvalue names even though its `fd` field does not change. `max` at or\nbelow zero reads nothing and answers the empty string.\n\nNever traps. Capability `fs`; refused at comptime (D33). Delegates\nto `fs_read`.\n\n```wolf-doc-example\nfs.write_text(\"doc-read.tmp\", \"wolfwolf\")?\nvar f = fs.open(\"doc-read.tmp\")?\n(fs.read(mut f, 4) else \"?\") == \"wolf\"\n(fs.read(mut f, 4) else \"?\") == \"wolf\"\nfs.close(take f)?\nfs.remove(\"doc-read.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 994,
          "tier": "core"
        },
        {
          "name": "read_chunk",
          "kind": "fn",
          "signature": "pub fn read_chunk(mut f: File, max: int) -> List[byte] ! {eof, io}",
          "doc": "Read up to `max` BYTES from `f`, advancing the file's position — no\ndecode, no `utf8` row, no boundary to land inside.\n\nRows: `eof` when the file is already at its end, `io` when the handle\nis closed, foreign or write-only, or the host failed. Never traps.\n\nThis is the streaming read that works on data: `read` refuses a chunk\nwhose boundary splits a code point, and nothing can choose a safe\nchunk size for a file whose contents are unknown. A caller that wants\ntext from a stream reads chunks, joins them, and decodes the join\nwith `std.bytes.to_str` — where the validation happens once, over the\nwhole thing, instead of once per arbitrary boundary.\n\n`mut f` for the same reason `read` takes it: the position advances,\nand the bytes a second call sees depend on the first.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_chunk`.\n\n```wolf-doc-example\nvar w = fs.create(\"doc-read-chunk.tmp\")?\nfs.write(mut w, \"wolf\")?\nfs.close(take w)?\nvar f = fs.open(\"doc-read-chunk.tmp\")?\nlet head = fs.read_chunk(mut f, 2) else List[byte]()\nhead.len == 2\nhead[0] as int == 119\nfs.close(take f)?\nfs.remove(\"doc-read-chunk.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1028,
          "tier": "core"
        },
        {
          "name": "write",
          "kind": "fn",
          "signature": "pub fn write(mut f: File, text: str) -> () ! {io}",
          "doc": "Write `text` to `f` at its current position, advancing it.\n\nRows: `io` when the handle is closed, foreign or read-only, or the\nhost failed. Never traps, and there is no `utf8` row: a `str` is\nalready well-formed UTF-8.\n\n`mut f` for the same reason `read` takes it: the position advances.\nWrites are unbuffered — every call reaches the host — so a program\nthat writes small pieces in a loop pays for each one, and the\nbuffered writer that would fix it waits on trait dispatch (F-0004).\n\nOn a handle from `open_append` the position is the END of the file at\nthe moment of each write, so \"current position\" means what the mode\nsays rather than what an earlier write left behind.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_write`.\n\n```wolf-doc-example\nvar f = fs.create(\"doc-write.tmp\")?\nfs.write(mut f, \"one \")?\nfs.write(mut f, \"two\")?\nfs.close(take f)?\n(fs.read_text(\"doc-write.tmp\") else \"?\") == \"one two\"\n```",
          "source": "std/fs/fs.lu",
          "line": 1056,
          "tier": "core"
        },
        {
          "name": "write_chunk",
          "kind": "fn",
          "signature": "pub fn write_chunk(mut f: File, b: List[byte]) -> () ! {invalid, io}",
          "doc": "Write the bytes `b` to `f` at its current position, advancing it.\n\nRows: `invalid` when an element of `b` is not a byte (outside\n0..255), `io` when the handle is closed, foreign or read-only, or the\nhost failed. Never traps.\n\n`invalid` is reachable here where it is not reachable inside\n`copy_file`, and the difference is whose bytes they are: a caller\nbuilds this list, so a non-byte in it is data this function must\nreport rather than an impossibility it may coarsen. See `write_bytes`\nfor why the answer is a row and not a trap.\n\nUnbuffered, exactly as `write` is, and `mut f` for the same reason.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_write_chunk`.\n\n```wolf-doc-example\nvar raw = List[byte]()\n(mut raw).push(128 as byte)\n(mut raw).push(255 as byte)\nvar f = fs.create(\"doc-write-chunk.tmp\")?\nfs.write_chunk(mut f, raw)?\nfs.close(take f)?\n(fs.size(\"doc-write-chunk.tmp\") else 0 - 1) == 2\nfs.remove(\"doc-write-chunk.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1087,
          "tier": "core"
        },
        {
          "name": "copy_chunk",
          "kind": "fn",
          "signature": "pub fn copy_chunk(mut src: File, mut dst: File, max: int) -> int ! {eof, io}",
          "doc": "One copy the host makes: at most `max` bytes from `src`'s position to\n`dst`'s, both advancing, and how many moved. It is `read_chunk` then\n`write_chunk` with the bytes never passing through the program, which\nis `cat`'s and `cp`'s inner loop.\n\n`[os.fs.copy]` (wolf-std#141). One call moves at least one byte and at\nmost `max` (the host clamps a call to 1 GiB). How many it moves is the\nhost's choice: linux tries `copy_file_range`, `sendfile` and `splice`\nbefore a read and a write, while macOS, freebsd and windows read and\nwrite at most 256 KiB at a time. So a program loops until `eof` and\nrelies on the total, never on the split. `max` at or below zero\nanswers 0 without asking the host. The standard streams are handles\ntoo (`stdin()`, `stdout()`), and a copy to standard output keeps its\norder with `print`.\n\nRows: `eof` when `src` is already at its end, an outcome as for\n`read_chunk`; `io` for a closed or forged handle on either side\n(checked before `max`), and for a failure of the read or of the write,\nthe host's number in `os_error()`. After an `io` a source that can seek\nstands just past what the sink took (`tell(mut src)` says where), so a\nretry starts from the truth; a pipe or a terminal cannot be put back.\nA caller that must say which side failed retries the read. There is no\n`invalid`: no argument can be malformed once the handles are checked.\nNever traps.\n\n`mut src` and `mut dst`: both positions advance. Capability `fs`;\nrefused at comptime (D33). Delegates to `fs_copy_chunk`, which every\nlane serves; the checked machine and lupin move the bytes through a\nbuffer of their own, with the same bytes and offsets.\n\n```wolf-doc-example\nfs.write_text(\"doc-copy-chunk-a.tmp\", \"wolves\")?\nvar src = fs.open(\"doc-copy-chunk-a.tmp\")?\nvar dst = fs.create(\"doc-copy-chunk-b.tmp\")?\nvar total = 0\nvar more = true\nwhile more { total = total + (fs.copy_chunk(mut src, mut dst, 4) else |_| { more = false; 0 }) }\nlet none = fs.copy_chunk(mut src, mut dst, 0)?\nfs.close(take src)?\nfs.close(take dst)?\nlet text = fs.read_text(\"doc-copy-chunk-b.tmp\")?\nfs.remove(\"doc-copy-chunk-a.tmp\")?\nfs.remove(\"doc-copy-chunk-b.tmp\")?\ntotal == 6 && none == 0 && text == \"wolves\"\n```",
          "source": "std/fs/fs.lu",
          "line": 1136,
          "tier": "core"
        },
        {
          "name": "close",
          "kind": "fn",
          "signature": "pub fn close(take f: File) -> () ! {io}",
          "doc": "Close `f`, consuming it.\n\nRows: `io` when the handle was already closed or is foreign. Never\ntraps.\n\n`take` is the mode of the operation's meaning (§3: `take` only where\nthe value is genuinely gone afterwards): closing ends the handle's\nlife, so the caller spells `fs.close(take f)` and the compiler\nrejects every later use of `f` as a use-after-move. That is the whole\nstaleness story for files, and it costs nothing at run time.\n\nA closed descriptor is never reused by the builtin tier at this pin,\nso a forged or stale `File` answers `io` rather than reaching another\ncaller's file. Do not depend on that beyond this pin: the mode system\nis the guarantee, the table's behaviour is an implementation detail.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_close`.\n\n```wolf-doc-example\nvar f = fs.create(\"doc-close.tmp\")?\nfs.close(take f)?\nfs.remove(\"doc-close.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1163,
          "tier": "core"
        },
        {
          "name": "Stat",
          "kind": "struct",
          "signature": "pub struct Stat { kind: int, size: int, modified_ms: int, }",
          "doc": "What one metadata read on an open handle answers: a kind, a size and\na modification time.\n\n**A typed value rather than the `[kind, size, modified_ms]` triple\nthe builtin hands over.** `fs_fstat` answers a `List[int]`, and a\ncaller reading `got[0]`, `got[1]`, `got[2]` is a caller who has to\nremember an ORDER — §14's rule is that when a builtin hands std a\npositional row whose meaning is the contract, std names the positions\nin a type. `stat.size` cannot be confused with `stat.modified_ms`;\n`got[1]` and `got[2]` can be, and silently.\n\n`kind` is **0** for a regular file, **1** for a directory, **2** for\nanything else — a fifo, a socket, a device. It is an `int` and not an\nenum because `std` has no closed-enum vocabulary at this pin and a\nthree-constant enum invented here would be a shape no other module\nshares; the numbers are the clause's own (`[os.fs.fstat]`) and the\npredicates below are what a program actually calls.\n\n`size` is bytes, `fs.size`'s word in `fs.size`'s units.\n`modified_ms` is milliseconds from the Unix epoch, negative before\nit — `fs.modified_ms`'s word in its units, deliberately, so the\nhandle's answer and the path's compare with no conversion. The unit\nrides in the field name for exactly the reason it rides in\n`modified_ms`'s function name, and that doc carries the argument.",
          "source": "std/fs/fs.lu",
          "line": 1191,
          "tier": "core"
        },
        {
          "name": "fstat",
          "kind": "fn",
          "signature": "pub fn fstat(mut f: File) -> Stat ! IoErrors",
          "doc": "One metadata read on the open handle `f`.\n\n`[os.fs.fstat]`. This is `fs.size` and `fs.modified_ms` and\n`fs.is_dir` and `fs.is_file`, answered together, off the handle a\nprogram is about to read anyway — one host call instead of four path\nresolutions.\n\n**The reason is a measurement, not a tidiness.** wolf-lang#261: a\nstatic-file server was paying four path stats per request\n(`is_dir`, `is_file`, `size`, `modified_ms`) where nginx pays one\n`open` and one `fstat`, and the last two could not move into the\nprogram because nothing in this module answered off a handle. Now\nsomething does, and the four path calls stay exactly where they are\nfor the callers that have a path and no handle.\n\nRows are the path stat's, so one handler serves both spellings:\n`not_found`, `denied`, `io`. On a HANDLE the hosts answer `io` for\nnearly everything — the entry is already resolved, so the misses the\npath calls have are behind it — and a closed or forged handle is\n`io`, this family's rule. A size or a time outside `int` is `io`,\n`fs.size`'s rule. Never traps.\n\n**The one host difference is `fs.open`'s, and it is stated.** linux,\nmacOS and freebsd open a directory read-only, so a `File` over a\ndirectory exists there and `kind` **1** is reachable. **Windows\nrefuses to open a directory as a file — `fs.open` answers `denied`,\nnot this call** — so on windows every handle this function ever sees\nis a file or a device, `kind` 1 never appears, and a server that\nclassifies directories does it BY PATH with `fs.is_dir`, as it did\nbefore this call existed. That is a difference in what can be\nOPENED, not in what `fstat` reports, and no row here moves with the\nhost.\n\n`mut f` because a metadata read is a host call on the handle, and\n§14's stream rule has the call site spell it. The handle's read\nposition is not disturbed.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_fstat`\n(s142) — both compiler lanes. The clause says every tier-1 host on\nevery tier serves it, \"the checked machine reads the same handle\nmetadata the runtime does\", and lupin still answers `unsupported`:\nthe REFERENCE machine has no filesystem at all by design, so the\nwhole fs tier is declined there rather than mocked, and that is a\nposture and not a release date. It is the one place a zero pairing\ngap buys this module nothing.\n\n```wolf-doc-example\nfs.write_text(\"doc-fstat.tmp\", \"wolves\")?\nvar f = fs.open(\"doc-fstat.tmp\")?\nlet st = fs.fstat(mut f)?\nfs.close(take f)?\nfs.remove(\"doc-fstat.tmp\")?\nst.kind == 0 && st.size == 6 && st.modified_ms > 0\n```",
          "source": "std/fs/fs.lu",
          "line": 1251,
          "tier": "core"
        },
        {
          "name": "Info",
          "kind": "struct",
          "signature": "pub struct Info { kind: int, size: int, modified_ms: int, have: int, mode: int, nlink: int, uid: int, gid: int, blocks: int, dev: int, ino: int, rdev: int, atime_s: int, atime_ns: int, mtime_s: int, mtime_ns: int, ctime_s: int, ctime_ns: int, btime_s: int, btime_ns: int, }",
          "doc": "The full stat record of one path: what `ls -l` shows.\n\n`[os.fs.stat]` (wolf-lang#625, #536). Twenty host words, named. The\nfirst three are `Stat`'s, in its units — `kind`, `size` in bytes,\n`modified_ms` from the Unix epoch — and `kind` is finer here: **0**\nregular file, **1** directory, **2** anything the host does not name,\n**3** symbolic link, **4** fifo, **5** socket, **6** character device,\n**7** block device.\n\n`have` says which words the host ANSWERED: bit `i` for word `i` of\nthe clause's table (0 kind, 1 size, 2 modified_ms, 3 have, 4 mode,\n5 nlink, 6 uid, 7 gid, 8 blocks, 9 dev, 10 ino, 11 rdev, 12–13 atime,\n14–15 mtime, 16–17 ctime, 18–19 btime). A word whose bit is clear is\n0 and is the host's refusal, by name — windows answers no `mode`,\n`nlink`, owner, `blocks`, identity or `ctime`; linux answers a birth\ntime only where the filesystem keeps one. `answered(info, word)` reads\nthe bit.\n\n`mode` is the permission bits with set-user-id, set-group-id and\nsticky (`0o7777`), the file type being `kind`. `blocks` is in 512-byte\nunits. `dev` and `ino` are the file's identity: two paths name one\nfile when both agree — compare them, never order them. A time is a\n`timespec`: whole seconds from the epoch (negative before it) and\nnanoseconds in `0..999999999`.\n\n**A new type, not a wider `Stat`**: `Stat`'s three fields are built by\nliteral in programs that already exist, and a wider struct would\nrefuse every one of them.",
          "source": "std/fs/fs.lu",
          "line": 1284,
          "tier": "core"
        },
        {
          "name": "stat",
          "kind": "fn",
          "signature": "pub fn stat(path: str) -> Info ! IoErrors",
          "doc": "The record of `path`, FOLLOWING a final symbolic link: what the link\nnames. A dangling link is `not_found`.\n\n`[os.fs.stat]`: one host call (`stat`). Rows: `not_found`, `denied`,\n`io` — `size`'s. Never traps. Capability `fs`; refused at comptime\n(D33). Delegates to `fs_stat`.\n\n```wolf-doc-example\nfs.write_text(\"doc-stat.tmp\", \"wolves\")?\nlet info = fs.stat(\"doc-stat.tmp\")?\nfs.remove(\"doc-stat.tmp\")?\ninfo.kind == 0 && info.size == 6 && fs.answered(info, 2)\n```",
          "source": "std/fs/fs.lu",
          "line": 1345,
          "tier": "core"
        },
        {
          "name": "lstat",
          "kind": "fn",
          "signature": "pub fn lstat(path: str) -> Info ! IoErrors",
          "doc": "The record of `path` ITSELF, a symbolic link included: a link is\n`kind` 3, its `size` the length of its target, its times its own.\nOn anything that is not a link it is `stat`'s answer.\n\n`[os.fs.stat]`: one host call (`lstat`). Rows as `stat`'s; a dangling\nlink answers a record here and `not_found` there. Capability `fs`;\nrefused at comptime (D33). Delegates to `fs_lstat`.\n\n```wolf-doc-example\nfs.write_text(\"doc-lstat.tmp\", \"x\")?\nlet a = fs.lstat(\"doc-lstat.tmp\")?\nlet b = fs.stat(\"doc-lstat.tmp\")?\nfs.remove(\"doc-lstat.tmp\")?\na.kind == b.kind && a.size == b.size\n```",
          "source": "std/fs/fs.lu",
          "line": 1365,
          "tier": "core"
        },
        {
          "name": "answered",
          "kind": "fn",
          "signature": "pub fn answered(info: Info, word: int) -> bool",
          "doc": "Whether the host answered word `word` of `info` (`Info`'s table);\nfalse for a word outside `0..20`. Total.\n\n```wolf-doc-example\nfs.write_text(\"doc-answered.tmp\", \"x\")?\nlet info = fs.stat(\"doc-answered.tmp\")?\nfs.remove(\"doc-answered.tmp\")?\nfs.answered(info, 0) && fs.answered(info, 14) && !fs.answered(info, 20)\n```",
          "source": "std/fs/fs.lu",
          "line": 1379,
          "tier": "core"
        },
        {
          "name": "FileSystem",
          "kind": "struct",
          "signature": "pub struct FileSystem { have: int, block_size: int, fragment_size: int, blocks: int, free: int, available: int, files: int, free_files: int, name_max: int, flags: int, type_number: int, id: int, }",
          "doc": "The record of a file system, what `df` and `stat -f` print: the twelve\nwords `statfs` answers, named, with `have` saying which of them the host\nanswered.\n\n`[os.fs.statfs]` (wolf-std#141). The fields are the clause's words in\norder: 0 `have`, bit `i` set when word `i` was answered (bit 0 always);\n1 `block_size`, the size the host prefers for a transfer, in bytes;\n2 `fragment_size`, the unit of the next three, in bytes; 3 `blocks`,\n4 `free` and 5 `available`, the total, the free, and the free a process\nthat is not privileged may use, in fragments; 6 `files` and\n7 `free_files`, the file serial numbers, total and free; 8 `name_max`,\nthe longest name a directory entry may have, in bytes; 9 `flags`, bit 0\nread-only and bit 1 set-id bits ignored, the same two bits on every\nhost; 10 `type_number`, the host's number for the file system's type\n(ext4 `0xef53`, tmpfs `0x1021994`); 11 `id`, the file system's identity.\nA word the host did not answer is 0 with its `have` bit clear\n(`has_answer`), never a guess. The counts are the host's unsigned\nwords in an `int`'s 64 bits, and bytes are a count times\n`fragment_size`: the room a copy needs to find is\n`available * fragment_size`.\n\n**Built by `statfs` or by `file_system`, never by a literal.** If a\nlater wolf answers a thirteenth word, this struct gains a field, and a\nliteral of it stops compiling (the CHANGELOG would say so). A program\nthat has the words from elsewhere, a test or a replay, calls\n`file_system`, which keeps compiling.",
          "source": "std/fs/fs.lu",
          "line": 1418,
          "tier": "core"
        },
        {
          "name": "file_system",
          "kind": "fn",
          "signature": "pub fn file_system(words: List[int]) -> FileSystem",
          "doc": "The `FileSystem` of `statfs`'s words in their order, `words[0]` being\n`have`. A word past the end of `words` is 0 with its `have` bit\ncleared, and a word past the twelfth is ignored. Total.\n\n`statfs` builds its answer here, and so does a program that has the\nwords from elsewhere. Pure, comptime-safe: it reaches nothing.\n\n```wolf-doc-example\nlet v = fs.file_system([7, 4096, 512])\nv.block_size == 4096 && v.fragment_size == 512 && v.blocks == 0\nfs.has_answer(v, 2) && !fs.has_answer(v, 3)\n```",
          "source": "std/fs/fs.lu",
          "line": 1445,
          "tier": "core"
        },
        {
          "name": "has_answer",
          "kind": "fn",
          "signature": "pub fn has_answer(v: FileSystem, word: int) -> bool",
          "doc": "Whether the host answered word `word` of `v` (`FileSystem`'s table);\nfalse for a word outside `0..12`. Total and pure.\n\n```wolf-doc-example\nlet v = fs.file_system([1, 4096])\nfs.has_answer(v, 0) && !fs.has_answer(v, 1) && !fs.has_answer(v, 12)\n```",
          "source": "std/fs/fs.lu",
          "line": 1484,
          "tier": "core"
        },
        {
          "name": "statfs",
          "kind": "fn",
          "signature": "pub fn statfs(path: str) -> FileSystem ! IoErrors",
          "doc": "**The record of the file system that holds what `path` names**, a\nfinal symbolic link followed: what `df` and `stat -f` print, from one\nhost call (`statfs(2)`; macOS adds a `pathconf` for `name_max`).\n\n`[os.fs.statfs]` (wolf-std#141). Linux answers every word, `flags`\nwhere the kernel marks them valid; macOS answers every word; windows\nanswers `blocks`, `free` and `available` in bytes with `fragment_size`\n1, and none of the rest (`has_answer` says which). The free counts move\nunder any writer, so two reads may differ; a file's record is its\ndirectory's.\n\nRows: `not_found` when nothing is at `path`, `denied` when the host\nrefuses, `io` otherwise (a path holding a NUL included), the host's\nnumber in `os_error()`: `stat`'s rows. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_statfs`.\nlupin 0.1.62 answers a missing path's row and refuses a record by name,\nsince it has no `statfs` of its own (wolf-interp#315).\n\n```wolf-doc-example\nlet v = fs.statfs(\".\")?\nfs.has_answer(v, 0) && fs.has_answer(v, 5) && v.fragment_size > 0\nv.available <= v.free && v.free <= v.blocks\n```",
          "source": "std/fs/fs.lu",
          "line": 1519,
          "tier": "core"
        },
        {
          "name": "read_link",
          "kind": "fn",
          "signature": "pub fn read_link(path: str) -> List[byte] ! {not_found, denied, invalid, io}",
          "doc": "The target a symbolic link stores, as the host stored it: bytes,\nverbatim — a name need not be UTF-8 (`str_from_utf8` when it is).\nNot resolved and not checked: a dangling link reads back its target.\n\n`[os.fs.readlink]`. Rows: `invalid` when `path` exists and is not a\nlink, `not_found`, `denied`, `io`. Capability `fs`; refused at\ncomptime (D33). Delegates to `fs_read_link`.\n\n```wolf-doc-example\nfs.write_text(\"doc-read-link.tmp\", \"x\")?\nvar not_a_link = false\nlet t = fs.read_link(\"doc-read-link.tmp\") else |_| {\n    not_a_link = true\n    List[byte]()\n}\nfs.remove(\"doc-read-link.tmp\")?\nnot_a_link == true && t.len == 0\n```",
          "source": "std/fs/fs.lu",
          "line": 1542,
          "tier": "core"
        },
        {
          "name": "realpath",
          "kind": "fn",
          "signature": "pub fn realpath(path: str) -> str ! {io, not_found}",
          "doc": "**s248 (`[os.fs.realpath]`): the canonical name of `path`** — absolute,\nevery symbolic link followed, every `.` and `..` taken (a `..` AFTER\nthe link before it, so `l/..` is the parent of the link's TARGET),\nand no trailing slash: what `realpath(3)` resolves. A relative path is\nresolved against the working directory. Two spellings of one file\nanswer one name, which is how an editor keys a workspace by its\ndirectory. The answer is the host's: macOS's `/tmp` is `/private/tmp`,\nand windows answers its final name in the `\\\\?\\` form.\n\nRows: `not_found` for a missing name, a dangling link included, and\nthe empty path; `io` for a loop of links, a component that is not a\ndirectory (on unix; windows says `not_found`), a refused search, and\nan answer that is not UTF-8 (`read_link` is the byte-exact call),\nthe host's number in `os_error()` where it gave one. Never traps.\nlupin 0.1.56 canonicalizes inside its served tree and refuses a path\noutside it by name (0.1.55 did not resolve the call, wolf-interp#268).\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_realpath`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-realpath.tmp\")?\nlet a = fs.realpath(\"doc-realpath.tmp/\")?\nlet b = fs.realpath(\"doc-realpath.tmp/../doc-realpath.tmp\")?\nvar missing = false\nlet none = fs.realpath(\"doc-realpath-none.tmp\") else |_| {\n    missing = true\n    (\"\")\n}\nfs.remove_dir(\"doc-realpath.tmp\")?\na == b && a != \"doc-realpath.tmp\" && missing == true && none == \"\"\n```",
          "source": "std/fs/fs.lu",
          "line": 1578,
          "tier": "core"
        },
        {
          "name": "Entry",
          "kind": "struct",
          "signature": "pub struct Entry { kind: int, name: List[byte], }",
          "doc": "One directory entry: its own kind (`Info`'s codes; a link is 3, never\nwhat it names; 2 when the host gave none) and its name's bytes.",
          "source": "std/fs/fs.lu",
          "line": 1584,
          "tier": "core"
        },
        {
          "name": "entries",
          "kind": "fn",
          "signature": "pub fn entries(path: str) -> List[Entry] ! IoErrors",
          "doc": "The entries of the directory `path` in the order the host keeps them\n— NOT sorted — without `.` and `..`, each with its own kind.\n\n`[os.fs.readdir]` (wolf-lang#626). A name that is not UTF-8 is listed\nlike any other: `name` is bytes, so this listing has no `utf8` row\nand one odd name cannot fail it (`read_dir` keeps its sorted `str`\nnames and its `utf8`). The order differs between filesystems, so a\nprogram that wants one sorts. Rows: `not_found`, `denied`, `io`.\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_dir_entries`.\n\n```wolf-doc-example\nfs.create_dir(\"doc-entries.tmp\")?\nfs.create_dir(\"doc-entries.tmp/sub\")?\nfs.write_text(\"doc-entries.tmp/f\", \"x\")?\nlet es = fs.entries(\"doc-entries.tmp\")?\nfs.remove_dir_all(\"doc-entries.tmp\")?\nes.len == 2 && es[0].kind + es[1].kind == 1\n```",
          "source": "std/fs/fs.lu",
          "line": 1608,
          "tier": "core"
        },
        {
          "name": "stdin",
          "kind": "fn",
          "signature": "pub fn stdin() -> File",
          "doc": "The process's standard input, as a `File`.\n\n`[os.fs.std]` (wolf-lang#424): the handle numbers 0, 1 and 2 are the\nthree streams the process was started with, and no open ever answers\none of them. This is that number in this module's type, so the\nhandle calls below can ask what standard input IS — a regular file\n(`fstat(mut f)?.kind == 0`, and then its size), a pipe or a terminal\n(`kind` 2) — and, when it is a file, read it at an offset without\nreading forward to get there.\n\n**What it serves:** `fstat`, `seek`, `seek_by`, `seek_end`, `tell`\nand `read_at` (wolf 0.2.22, s199), and, from wolf 0.2.26 (s200,\nwolf-lang#405), the BYTES: `read`, `read_chunk`, `write` and\n`write_chunk` serve 0, 1 and 2 as the descriptors themselves\n(`[os.fs.std]`). A read of 0 starts at the offset this process\nshares with whoever started it and moves it; a pipe, socket or\nterminal is read as what it is, and `eof` at its end. A write to 1\nor 2 lands in program order with `print` and `std.io`'s writers,\nunbuffered by this module. A closed standard stream is `io` (the\nhost's `EBADF`), never a silent success. **What it does not:**\n`close` answers `io` on it, as on any handle no open made — nothing\nhere closes a standard stream, and there is no way to.\n`tests/fs/std_bytes_rows.lu` writes 1 between two `print`s and reads\n0 to its end.\n\nTotal, and reaches nothing until a call is made on the value.\nCapability `fs` for the calls that take it.\n\nThe example runs with descriptor 1 a pipe — the rig's — and a pipe\nhas no position, so the seek is refused (`unseekable`, by name;\n`tests/fs/std_handles.lu` asserts the tag):\n\n```wolf-doc-example\nvar o = fs.stdout()\nlet at = fs.seek(mut o, 0) else 0 - 7\nat == 0 - 7\n```",
          "source": "std/fs/fs.lu",
          "line": 1654,
          "tier": "core"
        },
        {
          "name": "stdout",
          "kind": "fn",
          "signature": "pub fn stdout() -> File",
          "doc": "The process's standard output, as a `File` — `stdin`'s doc in every\nrespect, for descriptor 1. `write` and `write_chunk` through it put\nbytes on standard output in program order with `print` (wolf 0.2.26,\n`[os.fs.std]`); `std.io.write` stays the writer for text.",
          "source": "std/fs/fs.lu",
          "line": 1662,
          "tier": "core"
        },
        {
          "name": "stderr",
          "kind": "fn",
          "signature": "pub fn stderr() -> File",
          "doc": "The process's standard error, as a `File` — `stdin`'s doc in every\nrespect, for descriptor 2. `write` and `write_chunk` through it put\nbytes on standard error; `std.io.write_err` stays the writer for text.",
          "source": "std/fs/fs.lu",
          "line": 1669,
          "tier": "core"
        },
        {
          "name": "seek",
          "kind": "fn",
          "signature": "pub fn seek(mut f: File, off: int) -> int ! {invalid, io, unseekable}",
          "doc": "Move `f`'s position to byte `off` from the START of the file, and\nanswer it.\n\n`[os.fs.seek]` (wolf-lang#426), whence 0. Rows: `invalid` when `off`\nis below zero (decided before the host is touched, and the position\ndoes not move), `unseekable` when the handle has no position — a\npipe, a fifo, a socket, a terminal — and `io` for a closed or forged\nhandle or a host failure. A position past the end is legal; a read\nthere is `eof`. Never traps.\n\n`unseekable` is its own tag because the response to it is: a\nprogram that wanted to skip ahead reads forward instead, as `tail`\ndoes through a pipe. Three functions rather than one with a `whence`\nargument, because a bare `int` whose meaning is the contract is the\nshape §14 names in a type or a name — `seek_end(mut f, 0 - 10)`\ncannot be misread, `seek(mut f, 0 - 10, 2)` can.\n\n`mut f` because the position moves.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_seek`.\n\n```wolf-doc-example\nfs.write_text(\"doc-seek.tmp\", \"0123456789\")?\nvar f = fs.open(\"doc-seek.tmp\")?\n(fs.seek(mut f, 6) else 0) == 6\nlet rest = fs.read_chunk(mut f, 8) else List[byte]()\nrest.len == 4\nfs.close(take f)?\nfs.remove(\"doc-seek.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1703,
          "tier": "core"
        },
        {
          "name": "seek_by",
          "kind": "fn",
          "signature": "pub fn seek_by(mut f: File, delta: int) -> int ! {invalid, io, unseekable}",
          "doc": "Move `f`'s position by `delta` bytes from where it is, and answer\nthe new position from the start.\n\n`[os.fs.seek]`, whence 1. Rows as `seek`'s: `invalid` when the move\nwould land below zero (the position does not move), `unseekable`,\n`io`. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_seek`.\n\n```wolf-doc-example\nfs.write_text(\"doc-seek-by.tmp\", \"0123456789\")?\nvar f = fs.open(\"doc-seek-by.tmp\")?\nlet head = fs.read_chunk(mut f, 2) else List[byte]()\nhead.len == 2\n(fs.seek_by(mut f, 3) else 0) == 5\nfs.close(take f)?\nfs.remove(\"doc-seek-by.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1725,
          "tier": "core"
        },
        {
          "name": "seek_end",
          "kind": "fn",
          "signature": "pub fn seek_end(mut f: File, off: int) -> int ! {invalid, io, unseekable}",
          "doc": "Move `f`'s position to `off` bytes from the END of the file — zero\nis the end, negative is before it — and answer it from the start.\n\n`[os.fs.seek]`, whence 2. `seek_end(mut f, 0)` answers the file's\nsize, the way `tail` finds where to walk back from. Rows as\n`seek`'s: `invalid` when the position would land below zero,\n`unseekable`, `io`. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_seek`.\n\n```wolf-doc-example\nfs.write_text(\"doc-seek-end.tmp\", \"0123456789\")?\nvar f = fs.open(\"doc-seek-end.tmp\")?\n(fs.seek_end(mut f, 0) else 0) == 10\n(fs.seek_end(mut f, 0 - 3) else 0) == 7\nlet last = fs.read_chunk(mut f, 8) else List[byte]()\nlast.len == 3\nfs.close(take f)?\nfs.remove(\"doc-seek-end.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1749,
          "tier": "core"
        },
        {
          "name": "tell",
          "kind": "fn",
          "signature": "pub fn tell(mut f: File) -> int ! {io, unseekable}",
          "doc": "`f`'s position, from the start of the file, without moving it.\n\n`[os.fs.tell]` (wolf-lang#426). A handle fresh from `open` answers 0;\nafter reads of `a` and `b` bytes it answers `a + b`. Rows:\n`unseekable` for a handle with no position, `io` for a closed or\nforged handle or a host failure. Never traps.\n\n`mut f` for the stream rule (§14): the call site spells that the\nhandle is in play, as `fstat` does.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_tell`.\n\n```wolf-doc-example\nfs.write_text(\"doc-tell.tmp\", \"wolves\")?\nvar f = fs.open(\"doc-tell.tmp\")?\nlet head = fs.read_chunk(mut f, 4) else List[byte]()\nhead.len == 4\n(fs.tell(mut f) else 0) == 4\nfs.close(take f)?\nfs.remove(\"doc-tell.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1774,
          "tier": "core"
        },
        {
          "name": "read_at",
          "kind": "fn",
          "signature": "pub fn read_at(mut f: File, off: int, max: int) -> List[byte] ! {eof, invalid, io, unseekable}",
          "doc": "Up to `max` bytes of `f` starting at byte `off`, leaving `f`'s own\nposition exactly where it was.\n\n`[os.fs.read_at]` (wolf-lang#426) — `pread`. The order is the fd\ntier's: the handle (closed or forged is `io`), then the offset\n(below zero is `invalid`), then `max` (at or below zero answers the\nempty list and touches nothing), the 1 MiB cap `read_chunk` carries,\nand no bytes at a positive `max` is `eof` — the offset is at or past\nthe end. `unseekable` for a handle with no position. Never traps.\n\nThis is the read for a program that knows where the bytes are:\n`tail -n 10` takes the size from `fstat` and walks back a block at a\ntime, touching a few kilobytes of a file of any size, where reading\nforward touched all of it. Because the position does not move, two\nreaders of one `File` need no seek between them.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_at`.\n\n```wolf-doc-example\nfs.write_text(\"doc-read-at.tmp\", \"0123456789\")?\nvar f = fs.open(\"doc-read-at.tmp\")?\nlet mid = fs.read_at(mut f, 5, 3) else List[byte]()\nmid.len == 3\nmid[0] as int == 53\n(fs.tell(mut f) else 1) == 0\nfs.close(take f)?\nfs.remove(\"doc-read-at.tmp\")?\n```",
          "source": "std/fs/fs.lu",
          "line": 1807,
          "tier": "core"
        },
        {
          "name": "join",
          "kind": "fn",
          "signature": "pub fn join(base: str, name: str) -> str",
          "doc": "`base` and `name` joined with a single `/`.\n\nTotal: no rows, no traps — and pure, so unlike everything above it is\ncomptime-safe and reaches no host. An empty `base` answers `name`\nunchanged; a `base` that already ends in `/` does not grow a second\none. An absolute `name` is NOT special-cased: joining `\"a\"` with\n`\"/b\"` gives `\"a//b\"` rather than silently discarding `base`, because\na path helper that decides to ignore one of its arguments is a\nhelper that hides a bug (the day `is_absolute` exists, this doc says\nwhat it does about it).\n\nThis is the function that turns a `read_dir` NAME into a path, which\nis the shape every directory walk takes.\n\nSeparators are `/` on every platform (see the module header):\nwindows accepts forward slashes at the API, and a backslash in a wolf\nliteral is an escape.\n\n```wolf-doc-example\nfs.join(\"logs\", \"today.txt\") == \"logs/today.txt\"\nfs.join(\"logs/\", \"today.txt\") == \"logs/today.txt\"\nfs.join(\"\", \"today.txt\") == \"today.txt\"\n```",
          "source": "std/fs/fs.lu",
          "line": 1834,
          "tier": "core"
        },
        {
          "name": "parent",
          "kind": "fn",
          "signature": "pub fn parent(path: str) -> str ! {none}",
          "doc": "Everything in `path` before its last `/`.\n\nRows: `none` when there is no `/` at all (a bare file name has no\nparent to name) — absence, not an error, so `else` is the whole\nhandling story. A path whose last `/` is its first character answers\n`\"/\"`, the root, rather than the empty string. Total otherwise: no\ntraps, no host access, comptime-safe.\n\nByte offsets are the currency (§9) and this function never lands\ninside a code point: it cuts at a `/`, which is a one-byte ASCII\nboundary by construction, and reads the result through the\nrecoverable slice.\n\n```wolf-doc-example\n(fs.parent(\"logs/2026/today.txt\") else \"?\") == \"logs/2026\"\n(fs.parent(\"today.txt\") else \"?\") == \"?\"\n(fs.parent(\"/etc/hosts\") else \"?\") == \"/etc\"\n(fs.parent(\"/hosts\") else \"?\") == \"/\"\n```",
          "source": "std/fs/fs.lu",
          "line": 1859,
          "tier": "core"
        },
        {
          "name": "file_name",
          "kind": "fn",
          "signature": "pub fn file_name(path: str) -> str ! {none}",
          "doc": "The last segment of `path` — everything after its last `/`.\n\nRows: `none` when there is no last segment to name: an empty path, or\na path that ends in `/` (a directory spelling names no file). A path\nwith no `/` at all IS its own file name. Total otherwise: no traps,\nno host access, comptime-safe.\n\nThis is the base name including any extension; splitting the\nextension off wants a `stem`/`extension` pair, which is a reviewed\ncontract rather than a guess about what a dot means. That contract is\nblocked on nothing — it is a design decision this module has not\ntaken (see the module header).\n\n```wolf-doc-example\n(fs.file_name(\"logs/2026/today.txt\") else \"?\") == \"today.txt\"\n(fs.file_name(\"today.txt\") else \"?\") == \"today.txt\"\n(fs.file_name(\"logs/\") else \"?\") == \"?\"\n(fs.file_name(\"\") else \"?\") == \"?\"\n```",
          "source": "std/fs/fs.lu",
          "line": 1884,
          "tier": "core"
        },
        {
          "name": "set_mode",
          "kind": "fn",
          "signature": "pub fn set_mode(path: str, mode: int) -> () ! {not_found, denied, invalid, unsupported, io}",
          "doc": "Set the permission bits of what is at `path` to exactly `mode`.\n\n`[os.fs.mode]` (wolf-lang#346): `chmod`. `mode` is the twelve bits\n`Info.mode` reads — the nine permission bits with set-user-id,\nset-group-id and sticky — written in octal, `0o640`; the umask plays\nno part. A final symbolic link is FOLLOWED: the call changes what\nthe link names, never the link.\n\nRows: `invalid` when `mode` is outside `0..=0o7777`, decided before\nthe host is asked; `not_found` when nothing is at `path` (a dangling\nlink included); `denied` when this process does not own the file;\n`unsupported` on a host with no permission bits (windows, by name);\n`io` otherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_set_mode`.\n\n```wolf-doc-example\nfs.write_text(\"doc-set-mode.tmp\", \"x\")?\nvar row = \"ok\"\nfs.set_mode(\"doc-set-mode.tmp\", 0o600) else |_| { row = \"refused\" }\nlet info = fs.stat(\"doc-set-mode.tmp\")?\nfs.remove(\"doc-set-mode.tmp\")?\n(row == \"ok\" && info.mode == 0o600) || (row == \"refused\" && !fs.answered(info, 4))\n```",
          "source": "std/fs/fs.lu",
          "line": 1918,
          "tier": "core"
        },
        {
          "name": "create_private",
          "kind": "fn",
          "signature": "pub fn create_private(path: str) -> File ! {exists, not_found, denied, unsupported, io}",
          "doc": "Create a NEW file at `path` that only its owner can read or write,\nopen for reading and writing.\n\n`[os.fs.create.mode]` (wolf-lang#346, wolf-std#5): one exclusive\ncreate with mode `0o600`, so the file is never readable by anyone\nelse, not even for the instant between a `create` and a `set_mode` —\nthe shape a key, a token or a temporary file wants. It never reuses a\nfile that is already there.\n\nRows: `exists` when anything is at `path`; `not_found` when the\nparent directory is missing; `denied` when the host refuses;\n`unsupported` on a host with no permission bits (windows, by name: a\nprivate file there is an access-control list, which this call does\nnot pretend to write); `io` otherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_perm`.\n\n```wolf-doc-example\nvar made = true\nvar f = fs.create_private(\"doc-create-private.tmp\") else |_| {\n    made = false\n    fs.create(\"doc-create-private.tmp\")?\n}\nfs.close(take f)?\nlet info = fs.stat(\"doc-create-private.tmp\")?\nfs.remove(\"doc-create-private.tmp\")?\n!made || info.mode == 0o600\n```",
          "source": "std/fs/fs.lu",
          "line": 1951,
          "tier": "core"
        },
        {
          "name": "create_with_mode",
          "kind": "fn",
          "signature": "pub fn create_with_mode(path: str, mode: int) -> File ! { not_found, denied, invalid, unsupported, io, }",
          "doc": "`create`, with the permission bits the file gets if this call\ncreates it: `mode` less the process's umask (`env.umask`).\n\n`[os.fs.create.mode]`. An existing file is truncated and KEEPS its\nmode. `mode` is the nine permission bits; the three above them are\nset afterwards with `set_mode`, because the hosts disagree about\nthem at a creation.\n\nRows: `invalid` when `mode` is outside `0..=0o777`; `not_found`,\n`denied`; `unsupported` on a host with no permission bits; `io`\notherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_perm`.\n\n```wolf-doc-example\nvar refused = false\nvar f = fs.create_with_mode(\"doc-create-mode.tmp\", 0o1000) else |_| {\n    refused = true\n    fs.create(\"doc-create-mode.tmp\")?\n}\nfs.close(take f)?\nfs.remove(\"doc-create-mode.tmp\")?\nrefused == true\n```",
          "source": "std/fs/fs.lu",
          "line": 1988,
          "tier": "core"
        },
        {
          "name": "create_dir_mode",
          "kind": "fn",
          "signature": "pub fn create_dir_mode(path: str, mode: int) -> () ! { exists, not_found, denied, invalid, unsupported, io, }",
          "doc": "`create_dir`, with the directory's permission bits: `mode` less the\nprocess's umask.\n\n`[os.fs.create.mode]`. One level, as `create_dir`; `mkdir -m` is this\ncall and then `set_mode`, since `-m` is not subject to the umask.\n\nRows: `invalid` when `mode` is outside `0..=0o777`; `exists`,\n`not_found`, `denied`; `unsupported` on a host with no permission\nbits; `io` otherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_create_dir_mode`.\n\n```wolf-doc-example\nvar row = \"ok\"\nfs.create_dir_mode(\"doc-dir-mode.tmp\", 0o1000) else |_| { row = \"refused\" }\nrow == \"refused\" && !fs.exists(\"doc-dir-mode.tmp\")\n```",
          "source": "std/fs/fs.lu",
          "line": 2024,
          "tier": "core"
        },
        {
          "name": "symlink",
          "kind": "fn",
          "signature": "pub fn symlink(target: str, path: str) -> () ! { exists, not_found, denied, invalid, unsupported, io, }",
          "doc": "Make `path` a symbolic link whose target is `target`, stored\nverbatim.\n\n`[os.fs.symlink]` (wolf-lang#698): `ln -s target path`. The target\nis not resolved, not checked and not made absolute — `read_link`\nreads the same bytes back — so a relative target means what the host\nmakes it mean when the link is followed, and a link to nothing is\nmade like any other.\n\nRows: `invalid` when `target` is empty; `exists` when anything is\nalready at `path` (the call never replaces); `not_found` when the\nparent directory is missing; `denied`; `unsupported` on a host\nwithout unprivileged symbolic links (windows, by name); `io`\notherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_symlink`.\n\n```wolf-doc-example\nvar row = \"ok\"\nfs.symlink(\"\", \"doc-symlink.tmp\") else |_| { row = \"refused\" }\nrow == \"refused\" && !fs.exists(\"doc-symlink.tmp\")\n```",
          "source": "std/fs/fs.lu",
          "line": 2058,
          "tier": "core"
        },
        {
          "name": "link",
          "kind": "fn",
          "signature": "pub fn link(existing: str, path: str) -> () ! {exists, not_found, denied, cross_device, io}",
          "doc": "Make `path` a second name of the file `existing` names.\n\n`[os.fs.link]` (wolf-lang#699): `ln existing path`. One file under\ntwo names: bytes written through either are read through the other,\nand removing one name leaves the file under the other. A final\nsymbolic link in `existing` is NOT followed — the new name is a\nsecond name of the link. The call never replaces, which makes it the\natomic publish `move_file` is not: write a temporary, `link` it into\nplace, and `exists` says someone was first.\n\nRows: `exists` when anything is at `path`; `not_found` when\n`existing` or `path`'s parent is missing; `cross_device` across two\nfile systems (copy instead); `denied` for a directory, and wherever\nthe host refuses; `io` otherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_link`.\n\n```wolf-doc-example\nfs.write_text(\"doc-link-a.tmp\", \"wolves\")?\nfs.link(\"doc-link-a.tmp\", \"doc-link-b.tmp\")?\nfs.remove(\"doc-link-a.tmp\")?\nlet kept = fs.read_text(\"doc-link-b.tmp\")?\nfs.remove(\"doc-link-b.tmp\")?\nkept == \"wolves\"\n```",
          "source": "std/fs/fs.lu",
          "line": 2094,
          "tier": "core"
        },
        {
          "name": "Time",
          "kind": "struct",
          "signature": "pub struct Time { s: int, ns: int, }",
          "doc": "One time `set_times` writes: a moment, \"now\", or \"leave it\".\n\n`[os.fs.times]`. `s` is whole seconds from the Unix epoch (negative\nbefore it) and `ns` nanoseconds in `0..999999999` — `Info`'s\n`mtime_s`/`mtime_ns`, so what `stat` read can be written back — or\n`ns` is one of the clause's two special values, which `time_now` and\n`time_keep` build so that no caller writes the numbers.",
          "source": "std/fs/fs.lu",
          "line": 2105,
          "tier": "core"
        },
        {
          "name": "time",
          "kind": "fn",
          "signature": "pub fn time(s: int, ns: int) -> Time",
          "doc": "The moment `s` seconds and `ns` nanoseconds from the Unix epoch.\n\n```wolf-doc-example\nlet t = fs.time(1577854800, 123456789)\nt.s == 1577854800 && t.ns == 123456789\n```",
          "source": "std/fs/fs.lu",
          "line": 2116,
          "tier": "core"
        },
        {
          "name": "time_now",
          "kind": "fn",
          "signature": "pub fn time_now() -> Time",
          "doc": "\"Now\": the HOST's clock at the `set_times` call, not a clock this\nprogram read (`[os.fs.times]`'s `-1`).\n\n```wolf-doc-example\nfs.time_now().ns == 0 - 1\n```",
          "source": "std/fs/fs.lu",
          "line": 2126,
          "tier": "core"
        },
        {
          "name": "time_keep",
          "kind": "fn",
          "signature": "pub fn time_keep() -> Time",
          "doc": "\"Leave this time as it is\" (`[os.fs.times]`'s `-2`): how one time is\nset and the other kept, with no read in between.\n\n```wolf-doc-example\nfs.time_keep().ns == 0 - 2\n```",
          "source": "std/fs/fs.lu",
          "line": 2136,
          "tier": "core"
        },
        {
          "name": "set_times",
          "kind": "fn",
          "signature": "pub fn set_times(path: str, atime: Time, mtime: Time) -> () ! {not_found, denied, invalid, io}",
          "doc": "Set the access time and the modification time of what is at `path`,\nfollowing a final symbolic link.\n\n`[os.fs.times]` (wolf-lang#700): one host call. Each of `atime` and\n`mtime` is a `time(s, ns)`, `time_now()` or `time_keep()`, so one\ncall sets both, sets one and keeps the other, or stamps now —\n`touch`, `touch -a`, `touch -m`, and the last step of `cp -p`. A\nfile system keeps the precision it has (windows 100 ns steps; some\nkeep seconds): compare what `stat` reads back, not what was asked.\n\nRows: `invalid` when a `Time`'s `ns` is neither a count below one\nsecond nor one of the two special values; `not_found`; `denied`;\n`io` otherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_set_times`.\n\n```wolf-doc-example\nfs.write_text(\"doc-set-times.tmp\", \"x\")?\nfs.set_times(\"doc-set-times.tmp\", fs.time_keep(), fs.time(1500000000, 0))?\nlet info = fs.stat(\"doc-set-times.tmp\")?\nfs.remove(\"doc-set-times.tmp\")?\ninfo.mtime_s == 1500000000 && info.modified_ms == 1500000000000\n```",
          "source": "std/fs/fs.lu",
          "line": 2164,
          "tier": "core"
        },
        {
          "name": "set_link_times",
          "kind": "fn",
          "signature": "pub fn set_link_times(path: str, atime: Time, mtime: Time) -> () ! { not_found, denied, invalid, io, }",
          "doc": "`set_times` on `path` ITSELF: a final symbolic link's own times, its\ntarget's left alone (`touch -h`). On a path that is not a link it is\n`set_times`.\n\n`[os.fs.times]`. Rows as `set_times`'s. lupin, which has no host\ncall for a link's own times, declines a link here by name.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_set_times`.\n\n```wolf-doc-example\nfs.write_text(\"doc-link-times.tmp\", \"x\")?\nfs.set_link_times(\"doc-link-times.tmp\", fs.time_keep(), fs.time(1400000000, 0))?\nlet info = fs.lstat(\"doc-link-times.tmp\")?\nfs.remove(\"doc-link-times.tmp\")?\ninfo.mtime_s == 1400000000\n```",
          "source": "std/fs/fs.lu",
          "line": 2185,
          "tier": "core"
        },
        {
          "name": "owner_keep",
          "kind": "fn",
          "signature": "pub fn owner_keep() -> int",
          "doc": "The word `set_owner` and its kin read as \"leave this id as it is\".\n\nTotal and pure. It is -1, the builtin tier's own word\n(`[os.fs.owner]`); the name exists so no caller writes the number —\n`time_keep`'s reason.\n\n```wolf-doc-example\nfs.owner_keep() == 0 - 1\n```",
          "source": "std/fs/fs.lu",
          "line": 2203,
          "tier": "core"
        },
        {
          "name": "set_owner",
          "kind": "fn",
          "signature": "pub fn set_owner(path: str, uid: int, gid: int) -> () ! { not_found, denied, invalid, unsupported, io, }",
          "doc": "Set the owner and the group of what is at `path`, following a final\nsymbolic link — `chown`.\n\n`[os.fs.owner]` (wolf-lang#701): one host call. `uid` and `gid` are\nthe ids `stat` answers (`Info.uid`, `Info.gid`), or `owner_keep()` to\nleave one as it is — so `chgrp` is `set_owner(p, fs.owner_keep(),\ngid)`. **Who may** is the host's rule: the super-user may set any\nowner; anyone else may move a file they own to a group they are in,\nand may not give a file away. **The host clears the set-user-id and\nset-group-id bits** when an owner changes, so a program that wants\nthem sets the owner first and the mode after (`set_mode`) — `cp -p`'s\norder.\n\nRows: `invalid` when an id is neither `owner_keep()` nor in\n`0..=4294967294` (decided before the host), or is one the host has\nno mapping for; `denied` when this process may not make the change;\n`not_found` (a dangling link included); `unsupported` on a host with\nno owners (windows, by name); `io` otherwise. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_set_owner`.\n\n```wolf-doc-example\nvar refused = false\nfs.set_owner(\"doc-set-owner.tmp\", 0 - 2, fs.owner_keep()) else |_| { refused = true }\nrefused == true\n```",
          "source": "std/fs/fs.lu",
          "line": 2234,
          "tier": "core"
        },
        {
          "name": "set_link_owner",
          "kind": "fn",
          "signature": "pub fn set_link_owner(path: str, uid: int, gid: int) -> () ! { not_found, denied, invalid, unsupported, io, }",
          "doc": "`set_owner` on `path` ITSELF: a final symbolic link's own owner and\ngroup, its target's left alone (`chown -h`). On a path that is not a\nlink it is `set_owner`.\n\n`[os.fs.owner]`. Rows as `set_owner`'s; a dangling link is changed\nlike any other, since nothing is followed.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_set_owner`.\n\n```wolf-doc-example\nvar refused = false\nlet keep = fs.owner_keep()\nfs.set_link_owner(\"doc-set-link-owner.tmp\", keep, 4294967295) else |_| { refused = true }\nrefused == true\n```",
          "source": "std/fs/fs.lu",
          "line": 2260,
          "tier": "core"
        },
        {
          "name": "set_file_owner",
          "kind": "fn",
          "signature": "pub fn set_file_owner(mut f: File, uid: int, gid: int) -> () ! {denied, invalid, unsupported, io}",
          "doc": "Set the owner and the group of the file behind `f` — `fchown`.\n\n`[os.fs.owner]`: the file the handle holds, whatever its name is by\nnow, so a rename between a creation and this call cannot send the\nchange to another file. `stdin()`, `stdout()` and `stderr()` are\nhandles too: handing a terminal to the user a program is about to\nbecome is this call on the stream.\n\nRows: `invalid` and `denied` as `set_owner`'s; `unsupported` on a\nhost with no owners (windows, by name); `io` for a closed or forged\nhandle and for every other host refusal. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_set_owner_fd`.\n\n```wolf-doc-example\nvar refused = false\nvar out = fs.stdout()\nfs.set_file_owner(mut out, 0 - 2, 0 - 2) else |_| { refused = true }\nrefused == true\n```",
          "source": "std/fs/fs.lu",
          "line": 2291,
          "tier": "core"
        },
        {
          "name": "set_file_mode",
          "kind": "fn",
          "signature": "pub fn set_file_mode(mut f: File, mode: int) -> () ! {denied, invalid, io, unsupported}",
          "doc": "Set the permission bits of the file behind `f` to exactly `mode`:\n`fchmod`, the handle form of `set_mode`.\n\n`[os.fs.mode.fd]` (wolf-std#141): the file the handle holds, whatever\nits name is by now, so a mode applied after a creation cannot land on\nanother file renamed over the name in between. `mode` is `set_mode`'s\ntwelve bits, written in octal (`0o600`); the umask plays no part. A\nhandle over a directory is a directory's mode.\n\nRows: `invalid` when `mode` is outside `0..=0o7777`, decided before the\nhost is asked; `denied` when this process does not own the file;\n`unsupported` on windows, which has no permission bits, after the\nshape; `io` for a closed or forged handle and for every other host\nrefusal, the host's number in `os_error()` (macOS refuses a pipe's end\nwith `EINVAL`, where linux sets the pipe's mode). Never traps.\n\n`mut f`, as `set_file_owner`: the call acts on the file the handle\nnames. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_set_mode_fd`, which every lane serves.\n\n```wolf-doc-example\nfs.write_text(\"doc-set-file-mode.tmp\", \"x\")?\nvar f = fs.open(\"doc-set-file-mode.tmp\")?\nvar row = \"set\"\nfs.set_file_mode(mut f, 0o600) else |_| { row = \"refused\" }\nvar past = \"set\"\nfs.set_file_mode(mut f, 0o10000) else |_| { past = \"refused\" }\nlet held = fs.fstat_record(mut f)?\nfs.close(take f)?\nfs.remove(\"doc-set-file-mode.tmp\")?\npast == \"refused\"\n(row == \"set\" && held.mode == 0o600) || (row == \"refused\" && !fs.answered(held, 4))\n```",
          "source": "std/fs/fs.lu",
          "line": 2328,
          "tier": "core"
        },
        {
          "name": "truncate",
          "kind": "fn",
          "signature": "pub fn truncate(mut f: File, len: int) -> () ! {invalid, io}",
          "doc": "Make the file behind `f` exactly `len` bytes long.\n\n`[os.fs.truncate]` (wolf-lang#702): shorter, the tail gone; or\nlonger, the new bytes zeros no write stored. The handle's position\ndoes NOT move, so a write after a truncation lands where the last\none ended.\n\nRows: `invalid` when `len` is negative; `io` for every host refusal\n— a handle not open for writing, a directory, a pipe — and for a\nclosed or forged handle. Never traps.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_truncate`.\n\n```wolf-doc-example\nvar f = fs.create(\"doc-truncate.tmp\")?\nfs.write(mut f, \"0123456789\")?\nfs.truncate(mut f, 4)?\nfs.close(take f)?\nlet size = fs.size(\"doc-truncate.tmp\")?\nfs.remove(\"doc-truncate.tmp\")?\nsize == 4\n```",
          "source": "std/fs/fs.lu",
          "line": 2355,
          "tier": "core"
        },
        {
          "name": "sync",
          "kind": "fn",
          "signature": "pub fn sync(mut f: File) -> () ! {io}",
          "doc": "**s248 (`[os.fs.sync]`): put `f`'s bytes and metadata on the disk**\nbefore answering — `fsync(2)` on linux, `F_FULLFSYNC` on macOS (whose\n`fsync` leaves them in the drive's cache), `FlushFileBuffers` on\nwindows. A write that answered has reached the host, not the disk; a\nprogram that must survive a crash syncs what it wrote. `sync_dir`\nmakes a creation, a rename or a removal in a directory durable.\n\n**The atomic save**, five calls, a crash between any two leaving the\nold file or the new one under the name, whole: `create_new` a\ntemporary file in the target's directory, write it, `sync` it,\n`move_file` it over the target (a rename in one directory: atomic on\nevery unix), `sync_dir` the directory.\n\nRows: `io` for a closed or forged handle, and for every host refusal,\nits number in `os_error()` (a pipe on linux and macOS; a windows\nhandle open only for reading). Never traps. lupin serves it from 0.1.56\n(0.1.55 did not resolve the call, wolf-interp#268). The cost is the\nflush: 5–9 ms for 24 bytes on kasumi's btrfs, 1–9 ms on CI's macOS\nrunner (upstream's measurement).\n\n`mut f`, as `truncate`: the call acts on the file the handle names.\nCapability `fs`; refused at comptime (D33). Delegates to `fs_sync`.\n\n```wolf-doc-example\nvar f = fs.create(\"doc-sync.tmp\")?\nfs.write(mut f, \"kept\")?\nfs.sync(mut f)?\nfs.close(take f)?\nlet text = fs.read_text(\"doc-sync.tmp\")?\nfs.remove(\"doc-sync.tmp\")?\ntext == \"kept\"\n```",
          "source": "std/fs/fs.lu",
          "line": 2391,
          "tier": "core"
        },
        {
          "name": "sync_dir",
          "kind": "fn",
          "signature": "pub fn sync_dir(path: str) -> () ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**s248 (`[os.fs.sync]`): put the directory `path`'s entries on the\ndisk**, so that a creation, a rename or a removal in it survives a\ncrash — the last call of `sync`'s atomic save.\n\nRows: `not_found` for a missing name; `invalid` for a name that is\nnot a directory; `denied` for a refused search; `unsupported` on\nwindows, by name, before the path is read (no directory opens as a\nfile there, and NTFS orders a rename through its own log; ruling #97\nR4); `io` otherwise. Never traps. lupin serves it from 0.1.56 (0.1.55\ndid not resolve the call, wolf-interp#268).\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_sync_dir`.\n\n```wolf-doc-example\nfs.sync_dir(\".\") else |_| { }\nfs.write_text(\"doc-sync-dir.tmp\", \"x\")?\nvar on_a_file = \"synced\"\nfs.sync_dir(\"doc-sync-dir.tmp\") else |_| { on_a_file = \"refused\" }\nvar missing = \"synced\"\nfs.sync_dir(\"doc-sync-dir-none.tmp\") else |_| { missing = \"refused\" }\nfs.remove(\"doc-sync-dir.tmp\")?\non_a_file == \"refused\" && missing == \"refused\"\n```",
          "source": "std/fs/fs.lu",
          "line": 2419,
          "tier": "core"
        },
        {
          "name": "NOFOLLOW",
          "kind": "const",
          "signature": "pub const NOFOLLOW: int = 16",
          "doc": "The flag that makes `open_mode` refuse a final symbolic link\n(`[os.fs.open.nofollow]`, wolf 0.2.35): bit 16, added to any of the\nsix modes — `fs.open_mode(path, 3 + fs.NOFOLLOW)`. A path whose LAST\ncomponent is a link is then `invalid` (the host's `ELOOP` in\n`os_error()`) and nothing is created or truncated; a link in a middle\ncomponent is followed either way. Windows refuses the bit `invalid`,\nbefore the host.\n\n```wolf-doc-example\nfs.NOFOLLOW == 16\n```",
          "source": "std/fs/fs.lu",
          "line": 2434,
          "tier": "core"
        },
        {
          "name": "DIRECTORY",
          "kind": "const",
          "signature": "pub const DIRECTORY: int = 32",
          "doc": "The flag that makes an open refuse anything but a directory\n(`[os.fs.open.directory]`, wolf 0.2.37): bit 32, added to read mode 0\nor 5 of `open_mode` or `open_at`. `fs.open_mode(path, fs.DIRECTORY +\nfs.NOFOLLOW)` is `open_dir`. A name that is not a directory is then\n`invalid` (the host's `ENOTDIR` in `os_error()`), and a fifo is refused\nbefore it is opened, so the open never waits on one. Beside a writing\nmode the bit is `invalid` before the host, and so it is on windows,\nwhere no directory opens as a file.\n\n```wolf-doc-example\nfs.DIRECTORY == 32\n```",
          "source": "std/fs/fs.lu",
          "line": 2448,
          "tier": "core"
        },
        {
          "name": "open_mode",
          "kind": "fn",
          "signature": "pub fn open_mode(path: str, mode: int) -> File ! {not_found, denied, exists, invalid, io}",
          "doc": "**Open `path` in one of `[os.fs.open]`'s six modes, by number** — the\nmoded open the named ones above are spellings of, and the only one\nthat reaches modes 3 and 5 and the `NOFOLLOW` and `DIRECTORY` flags:\n\n- **0** read (`open`), **1** write, creating and truncating\n  (`create`), **2** append, creating (`open_append`);\n- **3** read and write, creating, NOT truncating — an editor's\n  in-place save, a journal reopened;\n- **4** the exclusive create (`create_new`);\n- **5** read without parking: a fifo or a device with no writer\n  answers at once, a regular file is unaffected (a static-file\n  server's open, before `fstat` classifies the handle).\n\n`mode + NOFOLLOW` refuses a final symbolic link (`NOFOLLOW`'s doc);\nmode 4 answers `exists` on a link with or without it. `DIRECTORY`\nadded to mode 0 or 5 refuses anything but a directory (`DIRECTORY`'s\ndoc; `open_dir` is mode 0 with both flags).\n\nRows: `invalid` for a mode outside the six (with or without the flags)\nand any other bit above them, and for `DIRECTORY` beside a writing\nmode, before the filesystem is touched; for a final link under\n`NOFOLLOW` and a name that is not a directory under `DIRECTORY`;\n`exists` for mode 4 on a taken name; `not_found` for a missing name\n(modes 0 and 5) or parent; `denied`; `io` otherwise. Never traps. lupin\nserves the six modes inside its tree, and both flags from 0.1.60\n(wolf-interp#278).\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_mode`.\n\n```wolf-doc-example\nfs.write_text(\"doc-open-mode.tmp\", \"wolf\")?\nvar f = fs.open_mode(\"doc-open-mode.tmp\", 3)?\nfs.write(mut f, \"W\")?\nfs.close(take f)?\nvar bad = false\nvar g = fs.open_mode(\"doc-open-mode.tmp\", 6) else |_| {\n    bad = true\n    fs.File { fd: 0 - 1 }\n}\nfs.close(take g) else |_| { }\nlet text = fs.read_text(\"doc-open-mode.tmp\")?\nfs.remove(\"doc-open-mode.tmp\")?\ntext == \"Wolf\" && bad == true\n```",
          "source": "std/fs/fs.lu",
          "line": 2495,
          "tier": "core"
        },
        {
          "name": "open_dir",
          "kind": "fn",
          "signature": "pub fn open_dir(path: str) -> File ! {not_found, denied, invalid, io}",
          "doc": "**A held directory**: `path` opened read-only as a directory, a final\nsymbolic link refused (`open_mode(path, DIRECTORY + NOFOLLOW)`), for\nthe `…_at` calls, which look a name up in the directory the handle\nholds whatever its path has become.\n\n`[os.fs.open.directory]`, `[os.fs.at]` (wolf-std#141). The handle is a\n`File`: `fstat_record`, `set_file_mode`, `set_file_owner` and `close`\nserve it, and a read of it is `io`. A walk that must stay inside a tree\nstarts here and goes down only by `open_dir_at`, one name at a time. A\nlink in a middle component of `path` is followed, as by every path call.\n\nA link as the last component is refused even when it names a\ndirectory, so on macOS `open_dir(\"/tmp\")` is `invalid` (`/tmp` is a link\nto `/private/tmp`); a program that means to open a linked directory\nresolves the path first, `open_dir(realpath(path)?)`, as the example\ndoes.\n\nRows: `invalid` for a name that is not a directory or is a link (the\nhost's `ENOTDIR` in `os_error()`, on linux and macOS alike), and on\nwindows for every path, before the host; `not_found` for a missing\nname; `denied`; `io` otherwise. Never traps. lupin serves it inside its\ntree.\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_open_mode`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-open-dir.tmp/real\")?\nvar linked = true\nfs.symlink(\"real\", \"doc-open-dir.tmp/link\") else |_| { linked = false }\nvar direct = \"held\"\nvar a = fs.open_dir(\"doc-open-dir.tmp/link\") else |_| { direct = \"refused\"; fs.stdin() }\nlet real = fs.realpath(\"doc-open-dir.tmp/link\") else \"\"\nvar resolved = \"held\"\nvar b = fs.open_dir(real) else |_| { resolved = \"refused\"; fs.stdin() }\nfs.close(take a) else |_| { }\nfs.close(take b) else |_| { }\nfs.remove_dir_all(\"doc-open-dir.tmp\")?\n(linked && direct == \"refused\" && resolved == \"held\") || (!linked && resolved == \"refused\")\n```",
          "source": "std/fs/fs.lu",
          "line": 2539,
          "tier": "core"
        },
        {
          "name": "open_dir_at",
          "kind": "fn",
          "signature": "pub fn open_dir_at(dir: File, name: str) -> File ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**The directory `name` in the held directory `dir`**, opened the way\n`open_dir` opens a path: read-only, a directory or refused, a link\nrefused. A walk that goes down only by this call cannot be carried out\nof its tree by a directory someone swaps for a link between two of its\nsteps.\n\n`[os.fs.at.open]` (wolf-std#141): `open_at(dir, name, DIRECTORY +\nNOFOLLOW, 0)`. One component is the confining use; `..` and a name with\nslashes are served as the host resolves them, as for `open_at`.\n\nRows: `invalid` for an empty or absolute `name`, before the host; for a\nname that is not a directory or is a link; and for a `dir` that is not\na directory (`ENOTDIR` in `os_error()`); `unsupported` on windows, after\nthe shape; `not_found` for a missing name; `denied`; `io` for a closed\nor forged handle and otherwise. Never traps. lupin 0.1.62 checks the\nshape and refuses the call by name (wolf-interp#321).\n\n`dir` is read: the call acts on a name the directory holds, never on\nthe handle, so one handle serves any number of calls. Capability `fs`;\nrefused at comptime (D33). Delegates to `fs_open_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-open-dir-at.tmp/sub\")?\nfs.write_text(\"doc-open-dir-at.tmp/f\", \"x\")?\nvar held = true\nvar d = fs.open_dir(\"doc-open-dir-at.tmp\") else |_| { held = false; fs.stdin() }\nvar sub = \"held\"\nvar s = fs.open_dir_at(d, \"sub\") else |_| { sub = \"refused\"; fs.stdin() }\nvar file = \"held\"\nvar f = fs.open_dir_at(d, \"f\") else |_| { file = \"refused\"; fs.stdin() }\nfs.close(take s) else |_| { }\nfs.close(take f) else |_| { }\nfs.close(take d) else |_| { }\nfs.remove_dir_all(\"doc-open-dir-at.tmp\")?\n(held && sub == \"held\" && file == \"refused\") || (!held && sub == \"refused\")\n```",
          "source": "std/fs/fs.lu",
          "line": 2579,
          "tier": "core"
        },
        {
          "name": "open_at",
          "kind": "fn",
          "signature": "pub fn open_at(dir: File, name: str, mode: int, perm: int) -> File ! { denied, exists, invalid, io, not_found, unsupported, }",
          "doc": "**`name` in the held directory `dir`, opened** in one of `open_mode`'s\nsix modes with its flags, a file the call creates getting `perm` less\nthe umask from its first instant: `openat(2)`, the open relative to a\ndirectory the program holds.\n\n`[os.fs.at.open]` (wolf-std#141). `mode` is `open_mode`'s: 0 read, 1\nwrite creating and truncating, 2 append, 3 read and write creating, 4\nthe exclusive create, 5 read without waiting; plus `NOFOLLOW`, and on 0\nand 5 `DIRECTORY`. `perm` is `create_with_mode`'s nine bits, only\nchecked when nothing is created. `open_dir_at` is this call with\n`DIRECTORY + NOFOLLOW`.\n\nRows: `invalid`, before the host, for a mode outside the six or a bit\nabove the flags, for `perm` outside `0..=0o777` and for an empty or\nabsolute `name`; then for a final link under `NOFOLLOW`, a name that is\nnot a directory under `DIRECTORY` and a `dir` that is not a directory;\n`unsupported` on windows, after the shape; `exists` for mode 4 on a\ntaken name, a link included; `not_found` for a missing name (modes 0\nand 5) or middle component; `denied`; `io` for a closed or forged handle\nand otherwise. Never traps. lupin 0.1.62 checks the shape and refuses\nthe call by name (wolf-interp#321).\n\n`dir` is read, as in every `…_at` call. Capability `fs`; refused at\ncomptime (D33). Delegates to `fs_open_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-open-at.tmp\")?\nvar held = true\nvar d = fs.open_dir(\"doc-open-at.tmp\") else |_| { held = false; fs.stdin() }\nvar made = true\nvar f = fs.open_at(d, \"new\", 4, 0o600) else |_| { made = false; fs.stdin() }\nif made { fs.write(mut f, \"wolves\")? }\nfs.close(take f) else |_| { }\nfs.close(take d) else |_| { }\nlet text = fs.read_text(\"doc-open-at.tmp/new\") else \"\"\nfs.remove_dir_all(\"doc-open-at.tmp\")?\n(held && made && text == \"wolves\") || (!held && !made)\n```",
          "source": "std/fs/fs.lu",
          "line": 2621,
          "tier": "core"
        },
        {
          "name": "stat_at",
          "kind": "fn",
          "signature": "pub fn stat_at(dir: File, name: str) -> Info ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**The record of `name` in the held directory `dir`**, a final link\nfollowed: `stat`'s twenty words as an `Info`, from one host call\nrelative to the handle (`statx(2)` on linux, `fstatat(2)` elsewhere),\nso the record is of the name in that directory whatever its path is by\nnow.\n\n`[os.fs.at.stat]` (wolf-std#141). Rows: `invalid` for an empty or\nabsolute `name`, before the host, and for a `dir` that is not a\ndirectory; `unsupported` on windows, after the shape; `not_found` for a\nmissing name, a dangling link included; `denied`; `io` for a closed or\nforged handle and otherwise. Never traps. lupin 0.1.62 refuses the call\nby name (wolf-interp#321).\n\n`dir` is read. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_stat_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-stat-at.tmp\")?\nfs.write_text(\"doc-stat-at.tmp/f\", \"wolves\")?\nvar held = true\nvar d = fs.open_dir(\"doc-stat-at.tmp\") else |_| { held = false; fs.stdin() }\nvar answered = true\nlet info = fs.stat_at(d, \"f\") else |_| { answered = false; fs.stat(\"doc-stat-at.tmp\")? }\nfs.close(take d) else |_| { }\nfs.remove_dir_all(\"doc-stat-at.tmp\")?\n(held && answered && info.kind == 0 && info.size == 6) || (!held && !answered)\n```",
          "source": "std/fs/fs.lu",
          "line": 2659,
          "tier": "core"
        },
        {
          "name": "lstat_at",
          "kind": "fn",
          "signature": "pub fn lstat_at(dir: File, name: str) -> Info ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**The record of `name` ITSELF in the held directory `dir`**, a link\nincluded (kind 3, its own size and times): `lstat` relative to the\nhandle, the question a walk asks of each entry before it opens one. On\na name that is not a link it is `stat_at`'s record; a dangling link is\na record here and `not_found` there.\n\n`[os.fs.at.lstat]` (wolf-std#141). Rows as `stat_at`'s. lupin 0.1.62\nrefuses the call by name (wolf-interp#321).\n\n`dir` is read. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_lstat_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-lstat-at.tmp\")?\nfs.write_text(\"doc-lstat-at.tmp/f\", \"x\")?\nvar linked = true\nfs.symlink(\"f\", \"doc-lstat-at.tmp/l\") else |_| { linked = false }\nvar d = fs.open_dir(\"doc-lstat-at.tmp\") else |_| { linked = false; fs.stdin() }\nvar kind = 0 - 1\nif linked { kind = fs.lstat_at(d, \"l\")?.kind }\nfs.close(take d) else |_| { }\nfs.remove_dir_all(\"doc-lstat-at.tmp\")?\nkind == 3 || !linked\n```",
          "source": "std/fs/fs.lu",
          "line": 2688,
          "tier": "core"
        },
        {
          "name": "remove_at",
          "kind": "fn",
          "signature": "pub fn remove_at(dir: File, name: str) -> () ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**Remove the name `name` from the held directory `dir`**: a file, a\nlink (never what it names) or a fifo, `remove` relative to the handle.\n\n`[os.fs.at.remove]` (wolf-std#141). Rows: `invalid` for an empty or\nabsolute `name`, before the host, and for a `dir` that is not a\ndirectory; `unsupported` on windows, after the shape; `not_found` for a\nmissing name; `denied` where the host refuses, and on macOS for a\ndirectory (`EPERM`), which linux refuses `io` (`EISDIR`), as `remove`\ndoes; `io` for a closed or forged handle and otherwise. Never traps.\nlupin 0.1.62 refuses the call by name (wolf-interp#321).\n\n`dir` is read. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_remove_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-remove-at.tmp\")?\nfs.write_text(\"doc-remove-at.tmp/f\", \"x\")?\nvar held = true\nvar d = fs.open_dir(\"doc-remove-at.tmp\") else |_| { held = false; fs.stdin() }\nif held { fs.remove_at(d, \"f\")? }\nfs.close(take d) else |_| { }\nlet gone = !fs.exists(\"doc-remove-at.tmp/f\")\nfs.remove_dir_all(\"doc-remove-at.tmp\")?\ngone == held\n```",
          "source": "std/fs/fs.lu",
          "line": 2718,
          "tier": "core"
        },
        {
          "name": "remove_dir_at",
          "kind": "fn",
          "signature": "pub fn remove_dir_at(dir: File, name: str) -> () ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**Remove the EMPTY directory `name` from the held directory `dir`**:\n`remove_dir` relative to the handle. One that is not empty is `io`, and\na file or a link is `invalid`, so a walk never removes through a link;\nwith `open_dir_at` and `remove_at` it is `rm -r` as a walk that never\nnames more than one component.\n\n`[os.fs.at.remove.dir]` (wolf-std#141). Rows: `invalid` for an empty or\nabsolute `name`, before the host, for a name that is a file or a link\nand for a `dir` that is not a directory (`ENOTDIR` in `os_error()`);\n`unsupported` on windows, after the shape; `not_found` for a missing\nname; `denied`; `io` for a directory that is not empty (`ENOTEMPTY`),\nfor a closed or forged handle and otherwise. Never traps. lupin 0.1.62\nrefuses the call by name (wolf-interp#321).\n\n`dir` is read. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_remove_dir_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-remove-dir-at.tmp/sub\")?\nfs.create_dir_all(\"doc-remove-dir-at.tmp/full\")?\nfs.write_text(\"doc-remove-dir-at.tmp/full/f\", \"x\")?\nvar held = true\nvar d = fs.open_dir(\"doc-remove-dir-at.tmp\") else |_| { held = false; fs.stdin() }\nvar full = \"removed\"\nfs.remove_dir_at(d, \"full\") else |_| { full = \"refused\" }\nif held { fs.remove_dir_at(d, \"sub\")? }\nfs.close(take d) else |_| { }\nlet gone = !fs.exists(\"doc-remove-dir-at.tmp/sub\")\nfs.remove_dir_all(\"doc-remove-dir-at.tmp\")?\nfull == \"refused\" && gone == held\n```",
          "source": "std/fs/fs.lu",
          "line": 2753,
          "tier": "core"
        },
        {
          "name": "create_dir_at",
          "kind": "fn",
          "signature": "pub fn create_dir_at(dir: File, name: str, mode: int) -> () ! { denied, exists, invalid, io, not_found, unsupported, }",
          "doc": "**Make the directory `name` in the held directory `dir`**, its\npermission bits `mode` less the umask from its first instant:\n`create_dir_mode` relative to the handle, one level.\n\n`[os.fs.at.mkdir]` (wolf-std#141). Rows: `invalid`, before the host, for\na `mode` outside `0..=0o777` and then for an empty or absolute `name`,\nand for a `dir` that is not a directory; `unsupported` on windows, after\nthe shape; `exists` for a taken name, a dangling link included;\n`not_found` for a missing middle component; `denied`; `io` for a closed\nor forged handle and otherwise. Never traps. lupin 0.1.62 checks the\nshape and refuses the call by name (wolf-interp#321).\n\n`dir` is read. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_create_dir_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-create-dir-at.tmp\")?\nvar held = true\nvar d = fs.open_dir(\"doc-create-dir-at.tmp\") else |_| { held = false; fs.stdin() }\nif held { fs.create_dir_at(d, \"sub\", 0o755)? }\nvar again = \"made\"\nfs.create_dir_at(d, \"sub\", 0o755) else |_| { again = \"refused\" }\nfs.close(take d) else |_| { }\nlet made = fs.is_dir(\"doc-create-dir-at.tmp/sub\")\nfs.remove_dir_all(\"doc-create-dir-at.tmp\")?\nmade == held && again == \"refused\"\n```",
          "source": "std/fs/fs.lu",
          "line": 2784,
          "tier": "core"
        },
        {
          "name": "symlink_at",
          "kind": "fn",
          "signature": "pub fn symlink_at(target: str, dir: File, name: str) -> () ! { denied, exists, invalid, io, not_found, unsupported, }",
          "doc": "**Make `name` in the held directory `dir` a symbolic link whose target\nis `target`**, stored verbatim, never resolved or checked: `symlink`\nrelative to the handle, the target first as there.\n\n`[os.fs.at.symlink]` (wolf-std#141). Rows: `invalid`, before the host,\nfor an empty `target` and then for an empty or absolute `name`, and for\na `dir` that is not a directory; `unsupported` on windows, after the\nshape; `exists` for a taken name; `not_found` for a missing middle\ncomponent; `denied`; `io` for a NUL in `target`, for a closed or forged\nhandle and otherwise. Never traps. lupin 0.1.62 checks the shape and\nrefuses the call by name (wolf-interp#321).\n\n`dir` is read. Capability `fs`; refused at comptime (D33). Delegates to\n`fs_symlink_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-symlink-at.tmp\")?\nvar held = true\nvar d = fs.open_dir(\"doc-symlink-at.tmp\") else |_| { held = false; fs.stdin() }\nif held { fs.symlink_at(\"../elsewhere\", d, \"l\")? }\nfs.close(take d) else |_| { }\nlet t = fs.read_link(\"doc-symlink-at.tmp/l\") else List[byte]()\nfs.remove_dir_all(\"doc-symlink-at.tmp\")?\nt.len == 12 || !held\n```",
          "source": "std/fs/fs.lu",
          "line": 2820,
          "tier": "core"
        },
        {
          "name": "link_at",
          "kind": "fn",
          "signature": "pub fn link_at(src_dir: File, src: str, dst_dir: File, dst: str) -> () ! { cross_device, denied, exists, invalid, io, not_found, unsupported, }",
          "doc": "**Make `dst` in the held directory `dst_dir` a second name of the file\n`src` names in the held directory `src_dir`**, a final link in `src`\nlinked ITSELF (`link`'s rule, on every host). The two directories may\nbe one handle: both are read.\n\n`[os.fs.at.link]` (wolf-std#141). Never a replacement. Rows: `invalid`\nfor an empty or absolute `src` or `dst`, before the host, and for a\nhandle that is not a directory; `unsupported` on windows, after the\nshape; `exists` for a taken `dst`; `not_found` for a missing `src` or\nmiddle component; `cross_device` across two file systems (no test here\ncan make two, so the row is stated and not witnessed); `denied` for a\ndirectory and where the host refuses; `io` for a closed or forged\nhandle and otherwise. Never traps. lupin 0.1.62 checks the shape and\nrefuses the call by name (wolf-interp#321).\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_link_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-link-at.tmp\")?\nfs.write_text(\"doc-link-at.tmp/a\", \"wolves\")?\nvar held = true\nvar d = fs.open_dir(\"doc-link-at.tmp\") else |_| { held = false; fs.stdin() }\nif held { fs.link_at(d, \"a\", d, \"b\")? }\nfs.close(take d) else |_| { }\nlet b = fs.read_text(\"doc-link-at.tmp/b\") else \"\"\nfs.remove_dir_all(\"doc-link-at.tmp\")?\n(b == \"wolves\") == held\n```",
          "source": "std/fs/fs.lu",
          "line": 2859,
          "tier": "core"
        },
        {
          "name": "link_followed_at",
          "kind": "fn",
          "signature": "pub fn link_followed_at(src_dir: File, src: str, dst_dir: File, dst: str) -> () ! { cross_device, denied, exists, invalid, io, not_found, unsupported, }",
          "doc": "**`link_at` with a final link in `src` FOLLOWED**: the new name is a\nsecond name of what the link names (`AT_SYMLINK_FOLLOW`). macOS's\n`link(1)` follows and linux's does not, so a program that matches its\nhost's `ln` picks this call on macOS and `link_at` on linux.\n\n`[os.fs.at.link]` (wolf-std#141). Rows as `link_at`'s; a dangling link\nfollowed is `not_found`. lupin 0.1.62 checks the shape and refuses the\ncall by name (wolf-interp#321).\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_link_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-link-followed-at.tmp\")?\nfs.write_text(\"doc-link-followed-at.tmp/a\", \"x\")?\nvar linked = true\nfs.symlink(\"a\", \"doc-link-followed-at.tmp/l\") else |_| { linked = false }\nvar d = fs.open_dir(\"doc-link-followed-at.tmp\") else |_| { linked = false; fs.stdin() }\nif linked { fs.link_followed_at(d, \"l\", d, \"b\")? }\nfs.close(take d) else |_| { }\nvar kind = 0 - 1\nif linked { kind = fs.lstat(\"doc-link-followed-at.tmp/b\")?.kind }\nfs.remove_dir_all(\"doc-link-followed-at.tmp\")?\nkind == 0 || !linked\n```",
          "source": "std/fs/fs.lu",
          "line": 2895,
          "tier": "core"
        },
        {
          "name": "entries_at",
          "kind": "fn",
          "signature": "pub fn entries_at(mut dir: File) -> List[Entry] ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**The entries of the held directory `dir`**, in `entries`' shape: the\nhost's order (not sorted), no `.` or `..`, each entry its own kind and\nits name's bytes, a name that is not UTF-8 listed like any other. Every\ncall reads from the first entry.\n\n`[os.fs.at.readdir]` (wolf-std#141). The listing is read through a\nduplicate of the handle that shares its position, so two listings of\none handle at once would split the entries between them: `mut dir`\nmakes that a compile error within a program, and a program that lists\none directory in two tasks opens it twice. A kind the host's entry does\nnot carry is asked of the entry without following it; an entry gone in\nbetween is kind 2.\n\nRows: `invalid` for a `dir` that is not a directory (`ENOTDIR`);\n`unsupported` on windows; `not_found`, `denied`; `io` for a closed or\nforged handle and otherwise. Never traps. lupin 0.1.62 refuses the call\nby name (wolf-interp#321).\n\nCapability `fs`; refused at comptime (D33). Delegates to\n`fs_read_dir_entries_at`.\n\n```wolf-doc-example\nfs.create_dir_all(\"doc-entries-at.tmp/sub\")?\nfs.write_text(\"doc-entries-at.tmp/f\", \"x\")?\nvar held = true\nvar d = fs.open_dir(\"doc-entries-at.tmp\") else |_| { held = false; fs.stdin() }\nvar n = 0\nif held { n = fs.entries_at(mut d)?.len }\nvar again = 0\nif held { again = fs.entries_at(mut d)?.len }\nfs.close(take d) else |_| { }\nfs.remove_dir_all(\"doc-entries-at.tmp\")?\n(held && n == 2 && again == 2) || (!held && n == 0)\n```",
          "source": "std/fs/fs.lu",
          "line": 2941,
          "tier": "core"
        },
        {
          "name": "access",
          "kind": "fn",
          "signature": "pub fn access(path: str, mode: int) -> () ! {denied, invalid, io, not_found, unsupported}",
          "doc": "**s254 (`[os.fs.access]`, wolf 0.2.35): may this process do what\n`mode` asks of `path`**, by its REAL user and group ids — `access(2)`,\na final link followed. `mode` is **0** (the name exists) or a sum of\n**4** read, **2** write and **1** execute (POSIX's `R_OK`, `W_OK`,\n`X_OK`, the same numbers on every unix). Ok is a grant.\n\nAdvice, not a lock: the answer can be stale by the next call, and a\nprogram that must know opens. It is the question to ask BEFORE any\nfile is made — whether a directory takes a write, so a save chooses\nthe atomic rename or the in-place write — and it sees what a test of\nthe mode bits cannot: an access-control list, a read-only mount. The\nreal ids are the effective ones unless the program is set-id or has\nchanged its ids (`process.set_ids`); an open uses the effective ones.\nRoot is the host's rule: every read and write granted, an execute\nonly where some execute bit is set.\n\nRows: `invalid` for a `mode` outside `0..=7`, before the host; then\n`unsupported` on windows (its permission is an access-control list\nthe three bits do not describe); `denied` for the host's refusal (a\nwrite on a read-only mount included); `not_found` for a missing name,\na dangling link included; `io` otherwise (a component that is no\ndirectory, a loop of links), the host's number in `os_error()`. Never\ntraps. lupin resolves the call from 0.1.59 (wolf-interp#278).\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_access`.\n\n```wolf-doc-example\nfs.write_text(\"doc-access.tmp\", \"x\")?\nvar row = \"granted\"\nfs.access(\"doc-access.tmp\", 8) else |_| { row = \"refused\" }\nvar missing = \"granted\"\nfs.access(\"doc-access-none.tmp\", 0) else |_| { missing = \"refused\" }\nfs.remove(\"doc-access.tmp\")?\nrow == \"refused\" && missing == \"refused\"\n```",
          "source": "std/fs/fs.lu",
          "line": 2985,
          "tier": "core"
        },
        {
          "name": "fstat_record",
          "kind": "fn",
          "signature": "pub fn fstat_record(mut f: File) -> Info ! {io}",
          "doc": "**s254 (`[os.fs.fstat.record]`, wolf 0.2.35; ruling asked R-sc72-1):\nthe full record of the file `f` HOLDS**, `stat`'s twenty words as an\n`Info`, from one metadata read on the handle (`fstat(2)`, `statx(2)`\non linux) — its identity (`dev`, `ino`), link count, mode, owner and\nnanosecond times with no path walked between the open and the\nquestion. \"Is the file I opened still the one under that name\" is\n`fstat_record(mut f)?` against `stat(name)?`, `dev` and `ino` equal;\n\"is my input my output\" is the same comparison of two handles.\n\n`fstat`'s `Stat` keeps its three words (programs build it by literal);\nthis is the path record's type, so one reader serves both. A handle\nnever names a link (an open follows it, or refuses it under\n`NOFOLLOW`), so `kind` is never 3: a pipe's end is 4, a socket 5. The\nstandard streams are handles 0..2. Windows answers its column of\n`stat`'s table — a handle that is no disk file is `kind` 2 there —\nwith the unanswered words' `have` bits clear.\n\nRows: `io` for every refusal — a closed or forged handle, a word\noutside `int` — because on a handle there is no name to be missing or\nrefused. Never traps. The cost: one host call and one twenty-word\nlist, `stat`'s. lupin serves the call from 0.1.60\n(wolf-interp#278).\n\n`mut f`, as `fstat`. Capability `fs`; refused at comptime (D33).\nDelegates to `fs_fstat_record`.\n\n```wolf-doc-example\nfs.write_text(\"doc-fstat-record.tmp\", \"wolves\")?\nvar f = fs.open(\"doc-fstat-record.tmp\")?\nlet held = fs.fstat_record(mut f)?\nfs.close(take f)?\nlet named = fs.stat(\"doc-fstat-record.tmp\")?\nfs.remove(\"doc-fstat-record.tmp\")?\nheld.kind == 0 && held.size == 6 && held.ino == named.ino && held.dev == named.dev\n```",
          "source": "std/fs/fs.lu",
          "line": 3024,
          "tier": "core"
        },
        {
          "name": "LOCK_SHARED",
          "kind": "const",
          "signature": "pub const LOCK_SHARED: int = 1",
          "doc": "`lock`'s kind 1: a shared lock, any number of which may be held at\nonce through different opens of one file (`[os.fs.lock]`).\n\n```wolf-doc-example\nfs.LOCK_SHARED == 1\n```",
          "source": "std/fs/fs.lu",
          "line": 3035,
          "tier": "core"
        },
        {
          "name": "LOCK_EXCLUSIVE",
          "kind": "const",
          "signature": "pub const LOCK_EXCLUSIVE: int = 2",
          "doc": "`lock`'s kind 2: an exclusive lock, which no other open of the file\nmay hold beside it, shared or exclusive (`[os.fs.lock]`).\n\n```wolf-doc-example\nfs.LOCK_EXCLUSIVE == 2\n```",
          "source": "std/fs/fs.lu",
          "line": 3043,
          "tier": "core"
        },
        {
          "name": "lock",
          "kind": "fn",
          "signature": "pub fn lock(mut f: File, kind: int) -> () ! {busy, invalid, io, unsupported}",
          "doc": "**s254 (`[os.fs.lock]`, wolf 0.2.35): an advisory lock on the file\nbehind `f`**, `LOCK_SHARED` or `LOCK_EXCLUSIVE`, **tried once and\nnever waited for** — a conflicting lock held through ANOTHER OPEN of\nthe file is `busy` (a program polls with its own deadline; a wait in\nthe kernel would park a worker where a kill cannot reach it).\n\n**The lock belongs to the open file** (BSD `flock(2)`'s rule;\n`LockFileEx` over the whole file on windows): two opens of one file\nconflict even in one process; a child's copy of the handle shares the\nlock; the lock lasts until `unlock` or until the last copy is closed,\nand closing some other handle of the file releases nothing. A second\n`lock` on a handle that holds one is the host's (unix converts it,\nnot atomically; windows answers `busy`): a portable program unlocks\nfirst. **Advisory on unix** — it binds only the programs that ask —\nand **mandatory on windows**, where another handle's read or write of\nthe file fails while it is held. On linux an `flock` lock does not\nsee a C program's `fcntl` record lock.\n\nRows: `invalid` for a `kind` other than 1 or 2, before the handle is\nlooked at; `busy` for a conflict (`EWOULDBLOCK` in `os_error()`;\nwindows `ERROR_LOCK_VIOLATION`); `io` for a closed or forged handle;\n`unsupported` where the kernel has no lock call or the filesystem\nkeeps no locks. Never traps. lupin 0.1.56 does not resolve the call\n(wolf-interp#278).\n\n`mut f`: the call acts on the file the handle names. Capability `fs`;\nrefused at comptime (D33). Delegates to `fs_lock`.\n\n```wolf-doc-example\nfs.write_text(\"doc-lock.tmp\", \"x\")?\nvar a = fs.open(\"doc-lock.tmp\")?\nvar b = fs.open(\"doc-lock.tmp\")?\nfs.lock(mut a, fs.LOCK_EXCLUSIVE)?\nvar busy = false\nfs.lock(mut b, fs.LOCK_SHARED) else |_| { busy = true }\nfs.unlock(mut a)?\nfs.lock(mut b, fs.LOCK_SHARED)?\nfs.close(take a)?\nfs.close(take b)?\nfs.remove(\"doc-lock.tmp\")?\nbusy == true\n```",
          "source": "std/fs/fs.lu",
          "line": 3087,
          "tier": "core"
        },
        {
          "name": "unlock",
          "kind": "fn",
          "signature": "pub fn unlock(mut f: File) -> () ! {io, unsupported}",
          "doc": "**s254 (`[os.fs.lock]`, wolf 0.2.35): release the lock `f`'s open\nfile holds.** A handle that holds none is ok on every host.\n\nRows: `io` for a closed or forged handle; `unsupported` where the\nkernel has no lock call. Never traps. lupin 0.1.56 does not resolve\nthe call (wolf-interp#278).\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_unlock`.\n\n```wolf-doc-example\nfs.write_text(\"doc-unlock.tmp\", \"x\")?\nvar a = fs.open(\"doc-unlock.tmp\")?\nfs.unlock(mut a)?\nfs.lock(mut a, fs.LOCK_EXCLUSIVE)?\nfs.unlock(mut a)?\nfs.close(take a)?\nfs.remove(\"doc-unlock.tmp\")?\nfs.exists(\"doc-unlock.tmp\") == false\n```",
          "source": "std/fs/fs.lu",
          "line": 3110,
          "tier": "core"
        },
        {
          "name": "mkfifo",
          "kind": "fn",
          "signature": "pub fn mkfifo(path: str, perm: int) -> () ! {denied, exists, invalid, io, not_found, unsupported}",
          "doc": "**s254 (`[os.fs.mkfifo]`, wolf 0.2.35): make a fifo named `path`**,\n`mkfifo(3)`, its permission bits `perm` less the process's umask\n(`create_dir_mode`'s rule). It is `stat`'s kind 4; `open_mode(path,\n5)` is the open that does not park on it with no writer, and a plain\nread open waits for one.\n\nRows: `invalid` for a `perm` outside `0..=0o777`, before the host;\n`unsupported` on windows, by name, before the path is read (its named\npipes are servers in another namespace), and where the filesystem or\nkernel makes no fifo; `exists` for a taken name, a dangling link\nincluded; `not_found` for a missing parent; `denied` for a refused\nwrite of the directory; `io` otherwise. Never traps. lupin 0.1.56\ndoes not resolve the call (wolf-interp#278).\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_mkfifo`.\n\n```wolf-doc-example\nvar made = true\nfs.mkfifo(\"doc-mkfifo.tmp\", 0o600) else |_| { made = false }\nvar kind = 4\nif made { kind = fs.lstat(\"doc-mkfifo.tmp\")?.kind }\nif made { fs.remove(\"doc-mkfifo.tmp\")? }\nkind == 4\n```",
          "source": "std/fs/fs.lu",
          "line": 3138,
          "tier": "core"
        },
        {
          "name": "set_nonblock",
          "kind": "fn",
          "signature": "pub fn set_nonblock(mut f: File, on: bool) -> () ! {invalid, io, unsupported}",
          "doc": "**s254 (`[os.fs.nonblock]`, wolf 0.2.35): set (`on`) or clear the\nnon-blocking flag on the open file behind `f`** (`O_NONBLOCK`). On a\nhandle with the flag, `write_some` answers `busy` where it would park\nand `read_chunk` answers `io` (`EAGAIN` in `os_error()`) where there\nis nothing to read; `signal.wait_fds` is the wait before either. The\nflag is the open file's: a child's copy of the handle sees it, and a\npipe's two ends are two open files.\n\nRows: `invalid` for the standard streams 0, 1 and 2, by name (their\nopen file is shared with whoever started the process, and a flag set\nthere outlives the program); `unsupported` on windows; `io` for a\nclosed or forged handle. Never traps. The cost: two `fcntl(2)`s (one\nwhen the flag is already as asked). lupin 0.1.56 does not resolve the\ncall (wolf-interp#278).\n\n`mut f`: the call acts on the file the handle names. Capability `fs`;\nrefused at comptime (D33). Delegates to `fs_set_nonblock`. The\nexample uses a standard stream, since a pipe comes from\n`std.process`; a clipboard writer sets its pipe's write end with\n`fs.set_nonblock(mut w, true)?`, writes with `write_some` until\n`busy`, then waits on the end under a deadline.\n\n```wolf-doc-example\nvar out = fs.stdout()\nvar row = \"set\"\nfs.set_nonblock(mut out, true) else |_| { row = \"refused\" }\nrow == \"refused\"\n```",
          "source": "std/fs/fs.lu",
          "line": 3170,
          "tier": "core"
        },
        {
          "name": "write_some",
          "kind": "fn",
          "signature": "pub fn write_some(mut f: File, b: List[byte]) -> int ! {busy, invalid, io}",
          "doc": "**s254 (`[os.fs.nonblock]`, wolf 0.2.35): ONE write of `b` to `f`, and\nhow many bytes the host took** — all of them or a first part; at least\n1 for a non-empty list, 0 for an empty one (the handle still checked).\nOn a non-blocking handle that can take nothing now it is `busy`; on a\nblocking one it waits as `write_chunk` does, for the first byte only.\n`write_chunk` writes everything or answers a row and, on a\nnon-blocking handle, loses how much it wrote: this is the write that\nsays.\n\nRows: `busy` (`EAGAIN` in `os_error()`) as above; `invalid` for a list\nof the wrong element width (an FFI caller's); `io` for a closed or\nforged handle, and for a pipe whose reader has gone once a program\nignores `signal.broken_pipe()` (otherwise the host's `SIGPIPE` comes\nfirst). The standard streams 1 and 2 are written after std's own\nbuffer is flushed. Windows serves it (one `WriteFile`, never `busy`).\nNever traps. The cost: one `write(2)`, no copy of the list. lupin\n0.1.56 does not resolve the call (wolf-interp#278).\n\n`mut f`, as `write_chunk`. Capability `fs`; refused at comptime (D33).\nDelegates to `fs_write_some`.\n\n```wolf-doc-example\nvar raw = List[byte]()\nfor c in [119, 111, 108, 102] { (mut raw).push(c as byte) }\nvar f = fs.create(\"doc-write-some.tmp\")?\nlet n = fs.write_some(mut f, raw)?\nlet none = fs.write_some(mut f, List[byte]())?\nfs.close(take f)?\nlet text = fs.read_text(\"doc-write-some.tmp\")?\nfs.remove(\"doc-write-some.tmp\")?\nn == 4 && none == 0 && text == \"wolf\"\n```\n\n**The partial-write loop** (sc82): a server keeps one output queue per\nclient and never parks on one. The handle is non-blocking; each call\ntakes what fits, and the queue's offset moves by the count; `busy`\nmeans \"nothing fits now\", and the server waits for `WRITE` on the\nhandle (`std.poll`) before writing again. A pty master holds some\nkilobytes (20480 bytes on PAX) and a pipe 64 KiB on linux, so a large\nqueue is written in parts. Here a fifo opened read and write, which\nnobody reads, is the slow client: 16 lists of 8192 bytes are more than\nit holds, and the loop stops at `busy` with part of the queue taken\n(windows has no fifo, and the example asserts only what it made). The\nexample's handler stops on any row, since a line holding a `match`\narm reads as an assertion to §4's extractor; a server's loop matches\n`busy` alone and passes `invalid` and `io` on, as\n`tests/poll/write_partial.lu` does.\n\n```wolf-doc-example\nvar chunk = List[byte]()\nfor i in 0..8192 { (mut chunk).push(120 as byte) }\nvar made = true\nfs.mkfifo(\"doc-write-some.fifo\", 0o600) else |_| { made = false }\nvar f = fs.stdin()\nif made { f = fs.open_mode(\"doc-write-some.fifo\", 3)? }\nif made { fs.set_nonblock(mut f, true)? }\nvar took = 0\nvar stopped = !made\nfor turn in 0..16 { if !stopped { took = took + (fs.write_some(mut f, chunk) else |_| { stopped = true; 0 }) } }\nif made { fs.close(take f)? }\nif made { fs.remove(\"doc-write-some.fifo\")? }\nstopped == true\n(took > 0 && took < 16 * 8192) == made\n```",
          "source": "std/fs/fs.lu",
          "line": 3238,
          "tier": "core"
        },
        {
          "name": "adopt",
          "kind": "fn",
          "signature": "pub fn adopt(fd: int) -> File ! {invalid, io, unsupported}",
          "doc": "**s253 (`[os.proc.adopt]`, wolf 0.2.35): a descriptor this process\nINHERITED, as a `File` that owns it** — `prog 5>out`, a supervisor's\npipe, the ready descriptor a test driver hands its child. Every\nhandle call serves the answer, `close` closes the descriptor, and a\ndescriptor map hands it to a child (`process.set_fd`). The handle is\na number of this module's table, not the descriptor's (3 in a program\nthat has opened nothing); the descriptor keeps its own.\n\nWhat may be adopted is told by close-on-exec: a descriptor that came\nacross `exec` carries no such flag, and every one the runtime makes\ncarries it from birth, as does one adopted before — so the rule is\n**open, and not close-on-exec**. The adoption marks it close-on-exec,\nso a child started after gets it only through a descriptor map; a\nchild started before inherited it as the host passed it.\n\nRows: `invalid` for 0, 1 and 2 (the standard streams, `stdin`,\n`stdout` and `stderr` already) and a number outside\n`3..=2147483647`, before the host; then `unsupported` on windows (a\nhandle there is not a small number a parent names by position); `io`\nfor a number that is not open (`EBADF` in `os_error()`) and for one\nthis process already holds. Never traps. The checked machine adopts\nthe `wolf` process's own inherited descriptor. lupin 0.1.56 does not\nresolve the call (wolf-interp#277).\n\nCapability `fs`; refused at comptime (D33). Delegates to `fs_adopt`.\n\n```wolf-doc-example\nvar row = \"adopted\"\nvar f = fs.adopt(2) else |_| {\n    row = \"refused\"\n    fs.File { fd: 0 - 1 }\n}\nfs.close(take f) else |_| { }\nrow == \"refused\"\n```",
          "source": "std/fs/fs.lu",
          "line": 3277,
          "tier": "core"
        },
        {
          "name": "read_into",
          "kind": "fn",
          "signature": "pub fn read_into(mut f: File, mut buf: List[byte], max: int) -> int ! {eof, io}",
          "doc": "**#94: read up to `max` bytes from `f` INTO `buf`**, whose contents\nbecome the bytes read and whose storage is kept (`List.reset`, then a\npush per byte), and answer how many — C's `read(2)` shape, for a loop\nthat must not grow: an editor's key reader, a pipe pump. **Nothing is\nkept per call**: the chunk the host answers (`read_chunk`'s fresh\nlist) is made in a region this call opens and dropped with it, and\n`buf` grows in its own region only past its largest read so far, so a\nloop of reads holds memory flat (`tests/fs/read_into_rows.lu`\nmeasures it). Not allocation-free in the strict sense: each call still\nopens one region, and the bytes are copied once into `buf`.\n\n`buf`'s parameter is ambient-clean (`[mem.region.outer-write]`: it\ntakes resets and byte pushes only), so a caller may call this inside a\nper-turn `region` block of its own with `buf` declared outside it.\n\nRows: `eof` when the file is already at its end and `io` when the\nhandle is closed or foreign or the host failed (`read_chunk`'s two),\nand on a row `buf` is as it was. `max` at or below zero reads nothing,\nempties `buf` and answers 0. Never traps. lupin 0.1.56 does not\nresolve `List.reset` (wolf-interp#289, is81), so the call is\n`unsupported` there.\n\n`mut f` (the position advances) and `mut buf` (its contents are the\nanswer). Capability `fs`; refused at comptime (D33). Delegates to\n`fs_read_chunk`.\n\n```wolf-doc-example\nfs.write_text(\"doc-read-into.tmp\", \"wolves\")?\nvar f = fs.open(\"doc-read-into.tmp\")?\nvar buf = List[byte]()\nlet n = fs.read_into(mut f, mut buf, 4)?\nlet m = fs.read_into(mut f, mut buf, 4)?\nfs.close(take f)?\nfs.remove(\"doc-read-into.tmp\")?\nn == 4 && m == 2 && buf.len == 2\n```",
          "source": "std/fs/fs.lu",
          "line": 3317,
          "tier": "core"
        }
      ]
    },
    {
      "name": "hex",
      "group": "Formatting and encodings",
      "tier": "core",
      "doc": "std.hex — base-16 encoding and decoding. Stability tier: core.\n\n**The byte sequence is `List[byte]`, and the interim this header\ncarried for eleven sprints is DISCHARGED (sc35).** The currency was\n`List[int]` with every element in 0..255 — documented, checked at the\nboundary, and promised to be \"trivially replaced when the type\nexists, since every signature keeps its shape\" (F-0035). It was, and\nthey did: D72/s135 gave the language `byte` and s136 (wolf-lang#231)\nmoved the eight byte builtins to `List[byte]`, so `encode` and\n`decode` took the new element type and nothing else here moved.\n`std.bytes` is the module to reach for when a program wants to LOOK\nat those bytes rather than encode them.\n\n**What changed in the bodies, and it is two lines.** `encode` reads\nan element and hands it to `byte_digits`, which takes an `int`, so\nthe read is spelled `b[i] as int` (`[type.byte.cast]` — widening is\nnever implicit); `decode` pushes `(hi * 16 + lo) as byte`, because\n`[type.byte.op]` makes every arithmetic result an `int` and narrowing\nback is spelled. **`byte_digits`' `assert` on an element outside\n0..255 is now UNREACHABLE from every door in this module** — the type\nforbids the input — and the guard stays, because it is the function's\nown contract and the one caller that could still violate it is a\nfuture one. §11's encoder rule (an encoder TRAPS on a non-byte where\nan os module RAISES) is not retired; it is simply out of reach here.\n\nWhat that used to cost was one function, and sc10 paid it:\n**`encode_str` is here now.** Hex-encoding text is the commonest use\nof this module in any language and it was missing for four sprints\nbecause nothing could read a `str`'s bytes (F-0035); `s.bytes()` can,\non every lane (s37, and `std.bytes.from_str` wraps it), so the\nfunction is one delegation.\n\n**And `decode_str` is here now too, which closes §11's encoder/decoder\npairing for this module.** It was a refusal for four sprints because\nnothing in the language turned bytes back into a `str`; s81's\nvalidating `str_from_utf8` closed F-0057 at the sc13 pin and\n`std.bytes.to_str` wraps it, so §14's debt clause — a contract ships in\nthe sprint AFTER its blocker closes — comes due here and is paid. The\nmodule has no reviewed contract left.\n\nOne name note: `encode_str` and not `encode`, because wolf has no\noverloading and `encode(b: List[byte])` owns the short name. It goes to\nthe byte form deliberately — that is the operation the round-trip\nproperty is stated over.\n\n**Round-tripping is the doctrine** (the sprint contract's word): every\nencoder here ships beside its decoder, `decode(encode(b))` is `b` for\nevery byte sequence, and `tests/hex/round_trip.lu` holds the property\nover the shared adversarial fixtures rather than over a happy path.\n\nDecoding is TOTAL over arbitrary UTF-8 input, and at the sc12 pin it is\ntotal for a simpler reason than the one it shipped with. sc03's\ninversion — probe the input with an ASCII literal this module owns,\nnever slice the caller's string at a guessed offset — is what made\n`decode(\"é\")` a `parse` miss rather than a `bounds` trap while the\nlanguage had no byte accessor (F-0018). s77 gives the digit probe the\nbyte itself (`s.bytes()[0]`, one load rather than up to thirty-two\n`starts_with` calls), and a byte cannot be a partial code point, so the\ntotality argument is now \"a byte is a byte\" and the answers are\nunchanged member for member. `tests/hex/decode_misses.lu` is what holds\nthem to that.",
      "summary": "std.hex — base-16 encoding and decoding.",
      "items": [
        {
          "name": "encode",
          "kind": "fn",
          "signature": "pub fn encode(b: List[byte]) -> str",
          "doc": "`b` as lowercase hexadecimal, two digits per byte, no separators and\nno `0x` prefix. The empty sequence encodes to the empty string.\n\nTraps `assert` when an element is outside 0..255: the caller promised\nbytes and did not deliver them, which is a contract violation and not\na datum (§2's trap rule). Total otherwise: no error row.\n\n```wolf-doc-example\nvar b = List[byte]()\n(mut b).push(0 as byte)\n(mut b).push(15 as byte)\n(mut b).push(255 as byte)\nhex.encode(b) == \"000fff\"\nvar empty = List[byte]()\nhex.encode(empty) == \"\"\n```",
          "source": "std/hex/hex.lu",
          "line": 135,
          "tier": "core"
        },
        {
          "name": "encode_upper",
          "kind": "fn",
          "signature": "pub fn encode_upper(b: List[byte]) -> str",
          "doc": "`encode` with uppercase digits (`\"000FFF\"`). The uppercasing is the\nimplementation's `upper` over ASCII hex digits, where no Unicode\ncase-mapping question arises. Same `assert` trap on a non-byte.\n\n```wolf-doc-example\nvar b = List[byte]()\n(mut b).push(171 as byte)\n(mut b).push(205 as byte)\nhex.encode_upper(b) == \"ABCD\"\n```",
          "source": "std/hex/hex.lu",
          "line": 157,
          "tier": "core"
        },
        {
          "name": "decode",
          "kind": "fn",
          "signature": "pub fn decode(s: str) -> List[byte] ! {parse}",
          "doc": "`s` decoded from hexadecimal; `parse` when the length is odd or any\ncharacter is not a hex digit. Upper and lower case both decode, and\nthey may be mixed. The empty string decodes to the empty sequence.\n\nThe tag is `parse` — sc03's \"these bytes are not a value of that\ntype\" — and not the `hex` the sprint contract spells, for a reason\nworth knowing before naming any tag: a row tag that shares a name with\na module in scope at the raise site resolves to the MODULE and rides\nout of the function as a value, silently, with no diagnostic and no\n`else` firing (F-0036). `std.hex` raising `hex` was the shape that\nfound it. The two miss cases an even more precise row would separate —\nodd length and bad digit — wait for sc06's payload conventions rather\nthan being spelled as two bare tags.\n\nTotal: every input either decodes or misses — no traps, including on\nnon-ASCII input, which is a miss like any other non-digit.\n\n```wolf-doc-example\nlet b = hex.decode(\"00ff\") else List[byte]()\nb.len == 2\nlet bad = hex.decode(\"0f0\") else List[byte]()\nbad.len == 0\nlet mixed = hex.decode(\"AbCd\") else List[byte]()\nmixed.len == 2\nlet unicode = hex.decode(\"é\") else List[byte]()\nunicode.len == 0\n```",
          "source": "std/hex/hex.lu",
          "line": 189,
          "tier": "core"
        },
        {
          "name": "encode_str",
          "kind": "fn",
          "signature": "pub fn encode_str(s: str) -> str",
          "doc": "The UTF-8 bytes of `s`, hex-encoded — lowercase, two digits per byte,\nno separators, no `0x` prefix.\n\nTotal: no rows, no traps. The empty string encodes to the empty\nstring. Every wolf `str` is well-formed UTF-8 by definition, so there\nis no input this can refuse and no encoding parameter to get wrong.\n\n**The census row this closes.** Hex-encoding text is the commonest use\nof a hex encoder anywhere and this module shipped without it for four\nsprints, because nothing in the language could read a `str`'s bytes\n(F-0035). s37's `s.bytes()` can, on every lane, and the gap was a debt\nrather than a wall after sc09 measured it.\n\n**The body was `encode(s.bytes())` until sc12 and is a walk now.**\nPassing the view to `encode` is exactly the position s77 materializes\nin — an argument — so the delegation copied the whole string into a\n`List[byte]` before rendering a digit. Consuming the view here costs the\nduplication of one four-line loop and no longer allocates a list per\ncall. The digits still come from `byte_digits`, so there is one\nrendering and the two entry points cannot drift; what is duplicated is\nthe LOOP, not the answer.\n\nThe `assert` `encode` documents is unreachable through this door: every\nelement of a `str`'s byte view is a byte by construction.\n\n**Its inverse is `decode_str`, below**, which arrived at sc14 when\n§14's debt clause came due on s81's `str_from_utf8`. §11's\nencoder/decoder pairing rule is satisfied for this module: every\nencoder here ships beside its decoder.\n\nUppercase is `encode_str(s).upper()`; there is no `encode_upper_str`,\nbecause a second name for a call anyone can write is a second thing to\nkeep in agreement (§1).\n\n```wolf-doc-example\nhex.encode_str(\"\") == \"\"\nhex.encode_str(\"wolf\") == \"776f6c66\"\nhex.encode_str(\"é\") == \"c3a9\"\nhex.encode_str(\"\\n\") == \"0a\"\n```",
          "source": "std/hex/hex.lu",
          "line": 251,
          "tier": "core"
        },
        {
          "name": "decode_str",
          "kind": "fn",
          "signature": "pub fn decode_str(s: str) -> str ! {parse, utf8}",
          "doc": "`s` decoded from hexadecimal and read back as text — `encode_str`'s\ninverse, and the round trip §11 requires of every encoder here.\n\n**Two tags, and they are two different failures.** `parse` is\n`decode`'s: the text is not hexadecimal (an odd length, or a character\nthat is not a hex digit). `utf8` is `std.bytes.to_str`'s: the text WAS\nhexadecimal and the bytes it denotes are not well-formed UTF-8, which\nis what `\"ff\"` decodes to. Coarsening them into one tag would tell a\ncaller \"that was not hex\" about a document that was, so the row is the\nunion and neither tag is renamed (§14's verbatim-row rule, and §12's).\nCase is not significant and may be mixed, exactly as in `decode`.\n\nTotal: every input either decodes or misses — no traps, on any input,\nincluding non-ASCII (a miss like any other non-digit).\n\n**The census row this closes, and the clause that made it due.** A hex\ndecoder that cannot answer in text was half a module for four sprints,\nand the reason was never this module's: nothing in the language turned\na `List[int]` back into a `str` (F-0057). s81's validating\n`str_from_utf8` closed it at the sc13 pin, so §14's debt clause — a\ncontract ships in the sprint AFTER its blocker closes — fell due here.\nThe body is `decode` plus one call, which is what the contract always\nsaid it would be.\n\nThree lanes: `str_from_utf8` is the compiler's prelude AND, as of\nlupin 0.1.12, the interpreter's (F-0075 closed).\n\n```wolf-doc-example\n(hex.decode_str(\"776f6c66\") else \"?\") == \"wolf\"\n(hex.decode_str(\"\") else \"?\") == \"\"\n(hex.decode_str(\"c3a9\") else \"?\") == \"é\"\n(hex.decode_str(\"C3A9\") else \"?\") == \"é\"\n(hex.decode_str(\"zz\") else \"not hex\") == \"not hex\"\n(hex.decode_str(\"ff\") else \"not text\") == \"not text\"\n```",
          "source": "std/hex/hex.lu",
          "line": 295,
          "tier": "core"
        }
      ]
    },
    {
      "name": "io",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.io — standard output, standard error, and standard input as\nfunctions: the facade over the language's `print` family and the s38\nline-read builtin. Stability tier: core.\n\n**Why a facade at all, when `print` is ambient.** `print` is a\nprelude intrinsic and stays the spelling ordinary code writes — this\nmodule does not replace it and could not (§1: one concept, one name).\nWhat it adds is the four operations as VALUES of the library rather\nthan magic: a stream chosen by the function you call rather than by a\nname's prefix, the raw-versus-line difference spelled in the name, and\none home for the input side, whose row is the interesting part and\nwhose ambient spelling std may not reuse (see below). A program that\ncomputes what to write, or writes to stderr from a helper, reads\nbetter through these.\n\n**The format spec is the CALLER's, and it passes through untouched.**\nEvery function here takes an already-rendered `str`, so\n`io.write_line(\"{n:>8}\")` is the caller's f-string with the caller's\nspec (spec §7.4, the s38 lowering) and this module adds nothing to it\n— no second interpolation pass, no reformatting, nothing that could\ndisagree with what the literal says. The operations that BUILD a\nrendered string out of data live in `std.fmt` (§11's split), and this\nmodule is where the result goes.\n\n**`is_terminal` (s215) is the one function here that takes a handle**,\nso this module imports `std.fs` for the `File` it asks about; it is\nthe terminal question a prompt depends on, which is why it lives with\nthe prompt rather than with the files.\n\n**Capability: `io` (I13).** The four writers and the line read reach the\nhost's standard streams, are tagged `io` in the toolchain's sandbox\ntable, and are categorically refused at comptime (D33): a `comptime\nfn` cannot read a line, and — because a comptime program's output\nwould be neither reproducible nor visible — cannot write one either.\n\n**Writing cannot fail here, and that is the builtin's contract, not a\nsimplification.** `print`/`eprint` return nothing and raise nothing:\na closed stdout is not reportable at this pin. When the builtin tier\ngrows a fallible write, these signatures gain a row and the change is\na breaking one, which is why it is recorded here rather than\npre-empted with a row that would always miss (F-0046).\n\n**The input side is two functions and one row between them.**\n`input_line` raises `eof` at the end of input — an outcome, not a\nfailure — plus `io` for a host failure and `utf8` for bytes that are not\ntext. `input_all` reads to the end and joins the lines with `\"\\n\"`, so\n`eof` is not in ITS row at all: the end of input is what makes it\nreturn.\n\n`input_all` was a reviewed contract for four sprints and it is worth\nrecording why, because the reason was never \"nobody wrote it\". The loop\nmust stop on ONE tag and re-raise the others, and no handler could tell\ntags apart: a bare identifier in a handler BINDS rather than matching, so\nit catches everything (F-0043), and the shape that should have fixed it —\n`else |e| match e { eof => …, io => … }` — matched its FIRST ARM for\nevery tag on the lane that executed, with no diagnostic (F-0052). A loop\nwritten over that would have treated a read error as the end of input,\nwhich is a silent truncation of someone's data, and §14 forbids shipping\nan operation whose failure mode a module cannot distinguish. s70's match\ntier and s71's payload-pattern ruling closed both, and the function is\nfour lines and one handler.\n\nWhat is still a reviewed contract is the byte-exact read:\n\n- `read_bytes(max: int) -> List[byte] ! {io}` — standard input as it is.\n  `input_all` joins LINES, and the line read strips terminators, so\n  `\"a\\nb\"` and `\"a\\nb\\n\"` are indistinguishable through this module —\n  which is fine for text processing and wrong for anything byte-exact.\n  No builtin returns bytes from standard input (F-0046, unmoved), so\n  std ships nothing rather than a `read_bytes` that could only lie about\n  the last byte.\n\n**Why the reader is `input_line` and not `read_line`.** `read_line` is\nthe name this module wanted, and it is a name std cannot have: it is an\nAMBIENT PRELUDE name, and a module item that shares one is resolved\ndifferently by the two implementations. Measured at these pins, from a\n`pub fn read_line` whose body called `read_line()`: wolfc resolved the\ninner call to the BUILTIN (the delegation worked), and lupin resolved\nit to the module's own item — unbounded recursion, reported as\n`unsupported — call depth exceeded 512 frames`. One source, a facade in\none machine and a stack overflow in the other, with no diagnostic on\neither side (F-0047). So the reader takes a name of its own, the\nwriters keep theirs (nothing ambient is called `write`), and the filing\nasks for what would let the good name come back: retire the ambient\nhost names — the prelude's own comment already promises to, \"the moment\nthe real std surface replaces them\" — and rule the shadowing question\nexplicitly for the names that stay.\n\n**Lanes (re-measured at the sc11 pin).** Both compiler rungs execute\neverything here — the native rung lowers the io tier as of #40, so both\nof this module's tests run natively where both were `unsupported` in\nsc07. Standard input is still EMPTY on the checked lane (`conform-run`\nhas no stdin injection at this pin, F-0046 unmoved), so the `eof` path\nis the one the rig witnesses and the hit path is proven upstream. The\nwriters' stdout is compared by hash; stderr is not in the record\nprotocol, so `write_err` and `write_err_line` are witnessed by their\nexit status alone, which is stated rather than hidden. lupin gained\n`eprint`/`eprint_raw` at 0.1.5, which is what moved\n`tests/io/writers_and_streams.lu` to a lupin `run` row: all four\nwriters work there now and only the READS are refused (this machine has\nno `read_line` and no injectable stdin, by design and with a sentence in\nthe refusal — unchanged at 0.1.8). The capability posture is the rig's to\nrecord once rather than each test's to restate.",
      "summary": "std.io — standard output, standard error, and standard input as functions: the facade over the language's `print` family and the s38 line-read builtin.",
      "items": [
        {
          "name": "is_terminal",
          "kind": "fn",
          "signature": "pub fn is_terminal(f: fs.File) -> bool ! {io}",
          "doc": "Whether `f` names a terminal — the question an interactive program\nasks before it prompts: a shell reads with a prompt only when its\ninput is one.\n\nRows: `io` when `f` is closed or forged — \"not a terminal\" and \"not a\nhandle\" are different answers, so the second is never `false`. Never\ntraps. `fs.stdin()`, `fs.stdout()` and `fs.stderr()` ask the\nprocess's own streams; a file or a pipe end (`std.process.pipe`) asks\nthat handle.\n\nCapability `io`; refused at comptime (D33). Delegates to `os_isatty`\n(wolf-lang s215, `[os.fs.isatty]`).\n\nA prose example, because a doc example imports exactly the documented\nmodule (§4) and cannot reach `std.fs` for a `File`: under the test rig,\nwhich wires standard input to the null device,\n`io.is_terminal(fs.stdin())` is `false` — a device, not a terminal —\nand `tests/io/is_terminal_rows.lu` holds it with a pipe end and a\nforged handle.",
          "source": "std/io/io.lu",
          "line": 128,
          "tier": "core"
        },
        {
          "name": "write",
          "kind": "fn",
          "signature": "pub fn write(text: str)",
          "doc": "Write `text` to standard output exactly as given — no newline, no\nreformatting.\n\nTotal: no rows, no traps (see the module header on the builtin's\ninfallible-write contract). Capability `io`; refused at comptime\n(D33). Delegates to `print_raw`.\n\nThis is the function to build a line out of pieces with, and the one\nto use when the bytes must be exact: a progress indicator, a prompt,\na value that must not gain a terminator it did not ask for.\n\n```wolf-doc-example\nio.write(\"no newline here\")\nio.write(\"\")\n```",
          "source": "std/io/io.lu",
          "line": 147,
          "tier": "core"
        },
        {
          "name": "write_line",
          "kind": "fn",
          "signature": "pub fn write_line(text: str)",
          "doc": "Write `text` to standard output followed by a newline.\n\nTotal: no rows, no traps. Capability `io`; refused at comptime (D33).\nDelegates to `print`, whose terminator is exactly one `\"\\n\"` on every\nplatform — no `\"\\r\\n\"` translation anywhere, which is what keeps a\nstdout hash comparable across the tier-1 hosts.\n\n```wolf-doc-example\nio.write_line(\"one line\")\nio.write_line(\"{2 + 2}\")\n```",
          "source": "std/io/io.lu",
          "line": 162,
          "tier": "core"
        },
        {
          "name": "write_err",
          "kind": "fn",
          "signature": "pub fn write_err(text: str)",
          "doc": "Write `text` to standard error exactly as given — no newline.\n\nTotal: no rows, no traps. Capability `io`; refused at comptime (D33).\nDelegates to `eprint_raw`.\n\nStandard error is the stream for what a program says ABOUT its work\nrather than what its work produced: diagnostics, progress, warnings.\nKeeping them off stdout is what lets a caller pipe the output of a\nwolf program into another one — and it is why the rig can hash stdout\nat all.\n\n```wolf-doc-example\nio.write_err(\"partial diagnostic \")\nio.write_err(\"continued\\n\")\n```",
          "source": "std/io/io.lu",
          "line": 181,
          "tier": "core"
        },
        {
          "name": "write_err_line",
          "kind": "fn",
          "signature": "pub fn write_err_line(text: str)",
          "doc": "Write `text` to standard error followed by a newline.\n\nTotal: no rows, no traps. Capability `io`; refused at comptime (D33).\nDelegates to `eprint`.\n\n```wolf-doc-example\nio.write_err_line(\"a diagnostic line\")\n```",
          "source": "std/io/io.lu",
          "line": 193,
          "tier": "core"
        },
        {
          "name": "input_line",
          "kind": "fn",
          "signature": "pub fn input_line() -> str ! {eof, io, utf8}",
          "doc": "The next line of standard input, without its terminator.\n\nRows: `eof` when there is no more input — the END of the stream is an\noutcome, so a read loop is `while` over this function's misses rather\nthan a length test; `io` for a host failure; `utf8` when the bytes are\nnot well-formed UTF-8 (nothing is returned in that case — this is not\na lossy decode). Never traps.\n\nThe terminator is consumed and dropped, and a `\"\\r\\n\"` ending yields\nthe line without either byte — so a file written on windows reads the\nsame as one written on linux, and a caller cannot tell whether the\nlast line of the input ended with a newline. That last point is a real\nlimitation of the line-oriented shape, not a bug: a caller who needs\nthe bytes as they are wants `read_all`, which is a contract at this\npin (F-0046).\n\nCapability `io`; refused at comptime (D33). Delegates to the prelude's\n`read_line`, whose name this function deliberately does not share —\nsee the module header.\n\nA doc example cannot demonstrate the hit path: an extracted example\nruns with no stdin, so the honest example is the miss, which is also\nthe one every reader gets wrong first.\n\n```wolf-doc-example\n(io.input_line() else \"no input\") == \"no input\"\n```",
          "source": "std/io/io.lu",
          "line": 224,
          "tier": "core"
        },
        {
          "name": "prompt",
          "kind": "fn",
          "signature": "pub fn prompt(text: str) -> str ! {eof, io, utf8}",
          "doc": "Write `text` to standard output with no newline, then read one line\nof standard input.\n\nRows: `input_line`'s exactly — `eof` when the input ends (the user\npressed the terminal's end-of-input, or the pipe closed), `io` for a\nhost failure, `utf8` for bytes that are not text. Never traps.\n\nThe prompt is written with `write` rather than `write_line`, because a\nprompt belongs on the same line as the answer, and it is not flushed\nseparately: standard output is line-buffered on a terminal, so a\nprompt with no newline may appear only when the line is read. That is\nthe host's behaviour and this function does not paper over it; a\nprogram that needs a guaranteed flush before a blocking read wants\nthe flush operation, which no builtin offers yet (F-0046).\n\nCapability `io`; refused at comptime (D33).\n\n```wolf-doc-example\n(io.prompt(\"name? \") else \"anonymous\") == \"anonymous\"\n```",
          "source": "std/io/io.lu",
          "line": 248,
          "tier": "core"
        },
        {
          "name": "input_all",
          "kind": "fn",
          "signature": "pub fn input_all() -> str ! {io, utf8}",
          "doc": "Every remaining line of standard input, joined with `\"\\n\"`.\n\nRows: `io` for a host failure and `utf8` for bytes that are not text —\nboth RE-RAISED unchanged from the line read they came from. `eof` is not\nin the row: the end of input is what makes this function RETURN, which\nis the whole difference between reading everything and failing to read\nsomething. Never traps.\n\n**What it can and cannot tell you.** The result is the input's lines\nwith exactly one `\"\\n\"` between them and NONE at the end, whatever the\ninput's own last byte was: the line read strips the terminator and\nnothing gives it back, so `\"a\\nb\"` and `\"a\\nb\\n\"` both arrive here as\n`\"a\\nb\"` (F-0046 asks for the byte-exact `read_all` that would fix it).\nA caller who must know wants that builtin; a caller who wants lines is\nnot affected, and `std.str.lines` on this result gives them back.\nEmpty input is `\"\"`, which is also what a single empty line looks like,\nfor the same reason.\n\n**Why this function exists only now.** It was a reviewed contract for\nfour sprints because the loop it needs must stop on ONE tag and re-raise\nthe others, and no handler could tell tags apart: a bare binding catches\neverything (F-0043) and a `match` inside a handler matched its first arm\nfor every tag on the lane that executed (F-0052). Both are closed at\nthis pin — the match tier at s70, the payload pattern at s71 — so the\nhandler below discriminates on all three lanes, and the alternative std\nrefused to ship is visible in what it would have done: treated a read\nerror as the end of input and truncated someone's data (§14).\n\nCapability `io`; refused at comptime (D33). Delegates to the prelude's\n`read_line`, once per line.\n\n```wolf-doc-example\n(io.input_all() else \"?\") == \"\"\n```",
          "source": "std/io/io.lu",
          "line": 287,
          "tier": "core"
        }
      ]
    },
    {
      "name": "iter",
      "group": "Containers and regions",
      "tier": "x",
      "doc": "std.iter — the iterator protocol, prototyped. Stability tier: x\n(this module is the working evidence for the F1 spec-amendment\nfiling; it graduates or dies with the filing, D31 clock).\n\nToday `for` over `List`/`Pool`/ranges is a sema builtin (s21) with\nno user-implementable iteration. The filed trait shape is\n`Iter[T]` with `next(mut self) -> T ! {done}` and a `for` desugar;\nthese two monomorphic prototypes prove that shape's semantics\nexecute — explicit `loop`/`next` driving, mut-receiver stepping, a\nrow-tag end signal — before the spec moves. No `for` integration is\nfaked.\n\nINTERIM SPELLINGS, each part of the filing's evidence:\n- The end tag is `done`, which is the convention's own lowercase mark\n  and no longer an interim (F-0003 died at the sc05 pins; the rename\n  landed at sc06, and this line kept describing the interim in a\n  sentence that contradicted itself until sc12).\n- `next` is a free function with an explicit `mut` first parameter,\n  not a method: at the sc01 pins lupin executes no user methods\n  (finding F-0002), and free functions collide across element\n  sources — hence `range_next`/`list_next`. The collision IS\n  evidence for the trait: one `next`, dispatched, is the fix (F1).",
      "summary": "std.iter — the iterator protocol, prototyped.",
      "items": [
        {
          "name": "RangeIter",
          "kind": "struct",
          "signature": "pub struct RangeIter { cur: int, stop: int, }",
          "doc": "A half-open integer range `[cur, stop)` stepped by `next`.",
          "source": "std/iter/iter.lu",
          "line": 27,
          "tier": "x"
        },
        {
          "name": "range_iter",
          "kind": "fn",
          "signature": "pub fn range_iter(start: int, stop: int) -> RangeIter",
          "doc": "A fresh iterator over `start..stop` (half-open; empty when\n`start >= stop`). Total: no error row, no traps.\n\n```wolf-doc-example\nvar it = iter.range_iter(7, 9)\n(iter.range_next(mut it) else 0 - 1) == 7\n(iter.range_next(mut it) else 0 - 1) == 8\n(iter.range_next(mut it) else 0 - 1) == 0 - 1\n```",
          "source": "std/iter/iter.lu",
          "line": 41,
          "tier": "x"
        },
        {
          "name": "range_next",
          "kind": "fn",
          "signature": "pub fn range_next(mut it: RangeIter) -> int ! {done}",
          "doc": "The next element of the range, advancing the iterator; `done` when\nexhausted — the row is the end signal, consumed by `else`. No traps\n(checked arithmetic cannot overflow here: `cur < stop` bounds the\nincrement).",
          "source": "std/iter/iter.lu",
          "line": 49,
          "tier": "x"
        },
        {
          "name": "ListCursor",
          "kind": "struct",
          "signature": "pub struct ListCursor { xs: List[int], i: int, }",
          "doc": "A cursor over an owned `List[int]`, consumed at construction.",
          "source": "std/iter/iter.lu",
          "line": 57,
          "tier": "x"
        },
        {
          "name": "list_cursor",
          "kind": "fn",
          "signature": "pub fn list_cursor(take xs: List[int]) -> ListCursor",
          "doc": "A fresh cursor over `xs`, which the cursor consumes (`take` — the\ncaller is done with the list; X1 true consumption). Total: no error\nrow, no traps.",
          "source": "std/iter/iter.lu",
          "line": 65,
          "tier": "x"
        },
        {
          "name": "list_next",
          "kind": "fn",
          "signature": "pub fn list_next(mut c: ListCursor) -> int ! {done}",
          "doc": "The next element of the list, advancing the cursor; `done` when\nexhausted — the row is the end signal, consumed by `else`. No traps\n(the index is bounds-guarded before the read).",
          "source": "std/iter/iter.lu",
          "line": 72,
          "tier": "x"
        }
      ]
    },
    {
      "name": "json",
      "group": "Formatting and encodings",
      "tier": "core",
      "doc": "std.json — the JSON data model, its accessors, and the serializer.\nStability tier: core.\n\n**The module is a READER now, and that is this sprint's whole story.**\nFor eight sprints this was a complete DOM that could not be built from\ntext: `parse` and `unescape` were reviewed contracts, and `escape`\ncarried a refusal. §14's debt clause — a contract ships in the sprint\nAFTER its blocker closes, one sprint of grace and no more — came due\nhere on all three at once, and all three are below as code.\n\n- **`parse`** was blocked by F-0037 (an enum returned through an error\n  row took the miss path on every call), closed at lupin 0.1.10 and\n  spent at sc13 on `get`/`at`. Its scanner has been writable since\n  sc09; the SIGNATURE was what was missing.\n- **`unescape`** was blocked by F-0057 — the walk was always fine, the\n  walk's OUTPUT was not, because decoding `é` means building `\"é\"` out\n  of the number 233 and nothing in the language built a `str` from a\n  number. s81 landed the prelude's validating `str_from_utf8`, and\n  **lupin 0.1.12 resolves it too** (F-0075 closed), which matters more\n  here than anywhere: the interpreter is this module's only executing\n  lane, so a primitive the compilers alone had would have left\n  `unescape` with no lane at all (sc10's `float_at` rule).\n- **`escape` is TOTAL** and its `boundary` tag is gone. The walk is a\n  byte walk now: the four characters JSON must escape are ASCII, every\n  byte of a multi-byte code point is ≥ 0x80 and therefore never one of\n  them, and a run between two escapes is a slice at offsets this module\n  computed. So the function needs no code-point measurement at all —\n  which is why it was reachable a full wave before anyone thought.\n\n**The signature change that follows, said out loud.** `escape`'s row\ndisappears, so `stringify` and `stringify_pretty` go from\n`{boundary, deep}` to `{deep}` and `quote` becomes total. Every caller\nthat wrote `else \"?\"` still compiles — a narrower row is a subtype at a\n`?` boundary and an `else` over one tag reads the same — but a caller\nmatching on `boundary` by name does not, and there is no deprecation\nperiod in a library at this stage. It is one tag, removed once, in the\nsprint that made it removable.\n\n**What `parse` costs the reader is one number-tier tag**, and the\nsc05 contract did not have it: the row is `{syntax, deep, overflow}`\nrather than `{syntax, deep}`. `overflow` is what a magnitude with no\n`f64` raises (`1e400`), because `std.fmt.decimal.parse_float` refuses\nit rather than answering infinity, and this module refuses to turn\nthat into \"the text is not JSON\" — the two are different sentences and\n§12 gives a distinct actionable failure its own tag. RFC 8259 §6\npermits an implementation to limit the range it accepts; it does not\npermit a parser to lie about which document it was handed.\n\n**The value model.** `Value` is one recursive enum with seven\nvariants: `Null`, `Bool(bool)`, `Int(int)`, `Num(f64)`, `Str(str)`,\n`Arr(List[Value])` and `Obj(Map[str, Value])`. The number posture is\nthe sprint contract's: integers keep their exactness in `Int` and only\nnon-integral (or out-of-range) numbers become `Num`, so a document\ncarrying a 64-bit id round-trips through wolf without passing through\na `f64` that cannot hold it. The i53 boundary is where the two\npostures visibly differ and `tests/json/number_posture_and_depth.lu` pins\nit, from the writing side, with `tests/json/parse_shapes.lu` pinning the\nreading side.\n\n**Constructors are functions, not `Value.Int(3)`.** An enum's variants\ncannot be named from outside the declaring module at these pins —\n`json.Value.Int(3)` is \"`Value` is an enum; traits, enums and\ntype-level items have no dynamic semantics here\" (F-0029) — so the\nseven `from_*`/`null` constructors below exist to give importers any\nway at all to build a value. They are not the API the contract\nimagined; they are the API the language currently allows, and the\nfiling says so.\n\n**Ordering.** `Obj` is a `Map`, whose iteration order is unspecified\n(§8), so `stringify`'s key order is unspecified too and no test in this\nrepo asserts it for a multi-key object. That is a promise deliberately\nnot made rather than an omission; when the ordering question settles\nupstream, this module states whatever the answer is.\n\n**Every lane runs this module (wolf 0.2.35, sc72; wolf-std#93).** From\nsc05 to sc71 this paragraph said the wolfc lane was dark here by\nconstruction — an imported module that produces an enum value was\n`unsupported` on the checked tier with no recorded type natively\n(F-0029, F-0012), and `Map` was untyped. Neither half is true now. The\nchecked machine has run six of the nine `tests/json/` files since the\nsc44 and sc46 pins (`[type.map]` typed the DOM; wolf-lang#337's casts\nconvert), and from wolf 0.2.35 the native rung runs all nine: `Value`'s\npayload slots disagree (`Bool(bool)`, `Int(int)`, `Num(f64)`,\n`Str(str)`, `Arr(…)`, `Obj(…)`), and s257's spilled union\n(`[abi.native.enum]`) gives each conflicting slot a union where the\nrung used to refuse the layout. lupin runs all nine, as it always has.\nThree of the nine end `exit(1)` by design on every lane that runs them\n(`navigation_rows`, `parse_misses`, `unescape_shapes`: the error row\nreaching `main` is the assertion). The checked machine still stops on\nthree (`number_posture_and_depth`, `parse_misses` and\n`pretty_and_escape`: its call-depth budget twice and a tag pattern in\nchecked execution, wolf-lang#882), so their `wolfc` cells stay\n`unsupported`.\n\n**The scanner's tag is `syntax`, not `parse`, and the reason is a\nmeasurement rather than a preference.** A row tag is resolved as an\nordinary name at the raise site, so a tag that shares a name with\nanything in scope silently becomes that thing (F-0036). This module now\ndeclares `pub fn parse`, so a `parse` TAG raised anywhere in it would\nresolve to that function and ride out as a value with no `else` firing\nand no diagnostic. Re-measured at this sprint's pins rather than\ninherited: the compiler closed its half at sc07 and **lupin still hands\nback the colliding thing**, silently. So `unescape` raises `syntax`\ntoo, which reads better anyway — a bad `\\q` escape IS a syntax error in\nthe document it came from.\n\n**What is deliberately NOT accepted.** No comments, no trailing commas,\nno leading `+`, no bare `.5`, no `NaN`/`Infinity` spellings, no raw\ncontrol character inside a string: RFC 8259's grammar, strictly. Every\none of them is a `syntax` miss, because a library that guesses at\nextensions reads a different language from the one its callers' other\ntools read. There is also no offset in the tag — `syntax` is a\npayload-free mark until §12's payload conventions reach this module,\nand when the position arrives the tag GAINS a payload rather than a\nsibling (§12's rule 4).\n\n**Duplicate keys keep the last occurrence**, which is a `Map`\nassignment and not a policy this module implements; a document with\nduplicate keys is legal and its readings differ across libraries, so\nthe rule is stated here and held as a test rather than left to be\ninferred from the container. It is also the language's ruled reading\n(ruling #61, wolf-lang `[os.json.dup]`): a JSON object is a map, one\nmember per name, at the position of its first appearance, holding its\nlast value, and `len` counts names. `std.x.json`'s kernels read the\nsame text the same way from wolf 0.2.27 / lupin 0.1.50 on; before\nthat they answered the first occurrence and counted every repeat.",
      "summary": "std.json — the JSON data model, its accessors, and the serializer.",
      "items": [
        {
          "name": "Value",
          "kind": "enum",
          "signature": "pub enum Value { Null, Bool(bool), Int(int), Num(f64), Str(str), Arr(List[Value]), Obj(Map[str, Value]), }",
          "doc": "A JSON value. Seven variants, one recursive type — the whole data\nmodel (RFC 8259 §3-§7) with the number split the module header\nexplains.",
          "source": "std/json/json.lu",
          "line": 137,
          "tier": "core"
        },
        {
          "name": "depth_limit",
          "kind": "fn",
          "signature": "pub fn depth_limit() -> int",
          "doc": "The nesting depth this module reads and renders before raising `deep` —\none number for `parse`, `stringify` and `stringify_pretty`, so a value\nthat came in can always go back out.\n\nA limit rather than a stack overflow, in BOTH directions and for the\nsame reason: a JSON value can be built to any depth by a program and a\ndocument can be nested to any depth by whoever sent it, and there is no\nunwinding in wolf (D30), so a library that recurses until the stack ends\nhands its caller a denial-of-service surface rather than a function.\n`parse` was the sprint contract's example of the rule; `stringify`\nshipped it first because it shipped first.\n\n```wolf-doc-example\njson.depth_limit() == 64\n```",
          "source": "std/json/json.lu",
          "line": 162,
          "tier": "core"
        },
        {
          "name": "null",
          "kind": "fn",
          "signature": "pub fn null() -> Value",
          "doc": "The JSON null.\n\n```wolf-doc-example\njson.is_null(json.null()) == true\n```",
          "source": "std/json/json.lu",
          "line": 171,
          "tier": "core"
        },
        {
          "name": "from_bool",
          "kind": "fn",
          "signature": "pub fn from_bool(b: bool) -> Value",
          "doc": "A JSON boolean.\n\n```wolf-doc-example\n(json.as_bool(json.from_bool(true)) else false) == true\njson.type_name(json.from_bool(false)) == \"bool\"\n```",
          "source": "std/json/json.lu",
          "line": 181,
          "tier": "core"
        },
        {
          "name": "from_int",
          "kind": "fn",
          "signature": "pub fn from_int(n: int) -> Value",
          "doc": "A JSON number that is an integer, kept exact — the posture the module\nheader describes. `from_int(9007199254740993)` survives a round trip\nthrough this model; the same value through `from_num` does not.\n\n```wolf-doc-example\n(json.as_int(json.from_int(42)) else 0) == 42\njson.type_name(json.from_int(42)) == \"int\"\n```",
          "source": "std/json/json.lu",
          "line": 193,
          "tier": "core"
        },
        {
          "name": "from_num",
          "kind": "fn",
          "signature": "pub fn from_num(x: f64) -> Value",
          "doc": "A JSON number that is not (or need not be) an integer. Non-finite\ninputs are legal here and render as `null`, because JSON has no\nspelling for them — see `stringify`.\n\n```wolf-doc-example\n(json.as_float(json.from_num(1.5)) else 0.0) == 1.5\njson.type_name(json.from_num(1.5)) == \"num\"\n```",
          "source": "std/json/json.lu",
          "line": 205,
          "tier": "core"
        },
        {
          "name": "from_str",
          "kind": "fn",
          "signature": "pub fn from_str(s: str) -> Value",
          "doc": "A JSON string. The text is stored as given; escaping happens at\n`stringify` time and never here, so a value that came from a program\nis never double-escaped.\n\n```wolf-doc-example\n(json.as_str(json.from_str(\"wolf\")) else \"?\") == \"wolf\"\njson.type_name(json.from_str(\"\")) == \"str\"\n```",
          "source": "std/json/json.lu",
          "line": 217,
          "tier": "core"
        },
        {
          "name": "from_list",
          "kind": "fn",
          "signature": "pub fn from_list(xs: List[Value]) -> Value",
          "doc": "A JSON array over an already-built list of values.\n\n```wolf-doc-example\nvar xs = List[json.Value]()\n(mut xs).push(json.from_int(1))\nlet arr = json.from_list(xs)\n(json.len(arr) else 0) == 1\n```",
          "source": "std/json/json.lu",
          "line": 229,
          "tier": "core"
        },
        {
          "name": "from_map",
          "kind": "fn",
          "signature": "pub fn from_map(m: Map[str, Value]) -> Value",
          "doc": "A JSON object over an already-built map. The map's iteration order is\nunspecified and so is the rendered key order (§8).\n\n```wolf-doc-example\nvar m = Map[str, json.Value]()\nm[\"a\"] = json.from_int(1)\nlet obj = json.from_map(m)\njson.type_name(obj) == \"obj\"\n```",
          "source": "std/json/json.lu",
          "line": 242,
          "tier": "core"
        },
        {
          "name": "type_name",
          "kind": "fn",
          "signature": "pub fn type_name(v: Value) -> str",
          "doc": "The variant's name — `\"null\"`, `\"bool\"`, `\"int\"`, `\"num\"`, `\"str\"`,\n`\"arr\"` or `\"obj\"`. The one accessor that never fails, and the one a\ndiagnostic wants: the `kind` row tag says a value was the wrong shape,\nand this says which shape it was. Total: no error row, no traps.\n\nSpelled `type_name` and not `kind`, which is what it would be called\nin any other library: a function and a row tag with the same name in\none module make the tag resolve to the FUNCTION at the raise site —\nsilently, so `as_int(json.null())` yielded a function value instead of\nraising, and `else` never fired (F-0036). `\"int\"` and `\"num\"` are not\nRFC 8259 type names; they are this model's, and the header explains\nwhy the number split exists.\n\n```wolf-doc-example\njson.type_name(json.null()) == \"null\"\njson.type_name(json.from_str(\"x\")) == \"str\"\n```",
          "source": "std/json/json.lu",
          "line": 263,
          "tier": "core"
        },
        {
          "name": "is_null",
          "kind": "fn",
          "signature": "pub fn is_null(v: Value) -> bool",
          "doc": "Whether `v` is the JSON null. A predicate rather than a row, because\n\"is it null\" is a question with a boolean answer (§1). Total.\n\n```wolf-doc-example\njson.is_null(json.null()) == true\njson.is_null(json.from_int(0)) == false\n```",
          "source": "std/json/json.lu",
          "line": 282,
          "tier": "core"
        },
        {
          "name": "as_bool",
          "kind": "fn",
          "signature": "pub fn as_bool(v: Value) -> bool ! {kind}",
          "doc": "The boolean `v` holds; `kind` when it holds something else. No\ncoercion: `as_bool` of `Int(0)` is a miss, not `false`, because JSON's\ntypes are the document's and guessing across them is how a parser\nloses data.\n\n```wolf-doc-example\n(json.as_bool(json.from_bool(true)) else false) == true\n(json.as_bool(json.from_int(1)) else false) == false\n```",
          "source": "std/json/json.lu",
          "line": 298,
          "tier": "core"
        },
        {
          "name": "as_int",
          "kind": "fn",
          "signature": "pub fn as_int(v: Value) -> int ! {kind}",
          "doc": "The integer `v` holds; `kind` for every other variant, `Num`\nincluded. A `Num` that happens to be integral is still not an `Int`:\nthe model records which one the document had, and `as_float` is the\nwidening direction that always works.\n\n```wolf-doc-example\n(json.as_int(json.from_int(42)) else 0) == 42\n(json.as_int(json.from_num(42.0)) else 0) == 0\n```",
          "source": "std/json/json.lu",
          "line": 314,
          "tier": "core"
        },
        {
          "name": "as_float",
          "kind": "fn",
          "signature": "pub fn as_float(v: Value) -> f64 ! {kind}",
          "doc": "The number `v` holds as `f64`; `kind` for every non-numeric variant.\nThis one DOES widen: an `Int` converts, because every JSON number is a\nnumber and a caller asking for `f64` has said it accepts the rounding.\nBeyond 2^53 that rounding is lossy, which is exactly why `as_int`\nexists and does not do it.\n\nThe `Int` line of the fence below was PROSE from sc44 to sc46, for a\nfiled compiler bug rather than anything about this function: on the\nchecked tier a value produced by `int as f64` compared unequal to\nevery `f64` it was numerically equal to — `(3 as f64) == 3.0` was\n`false` there and `true` on the native rung and under lupin, at\nv0.2.10 and v0.2.11 alike (wolf-lang#337). It was a green fence that\nstarted failing at a pin bump and never a claim that was wrong.\nwolf-lang#337 closed in v0.2.12 and the line is back where it\nstarted, measured here at 0.2.12/0.1.34 on all three lanes.\n\n```wolf-doc-example\n(json.as_float(json.from_int(3)) else 0.0) == 3.0\n(json.as_float(json.from_num(1.5)) else 0.0) == 1.5\n(json.as_float(json.from_str(\"3\")) else 0.0) == 0.0\n```",
          "source": "std/json/json.lu",
          "line": 342,
          "tier": "core"
        },
        {
          "name": "as_str",
          "kind": "fn",
          "signature": "pub fn as_str(v: Value) -> str ! {kind}",
          "doc": "The string `v` holds, unescaped (the model stores text, not JSON\nsource); `kind` otherwise.\n\n```wolf-doc-example\n(json.as_str(json.from_str(\"wolf\")) else \"?\") == \"wolf\"\n(json.as_str(json.null()) else \"?\") == \"?\"\n```",
          "source": "std/json/json.lu",
          "line": 357,
          "tier": "core"
        },
        {
          "name": "as_arr",
          "kind": "fn",
          "signature": "pub fn as_arr(v: Value) -> List[Value] ! {kind}",
          "doc": "The array `v` holds; `kind` otherwise. The list is the value's own —\nreading it is free, and this module never hands out a copy it did not\nhave to make.\n\n```wolf-doc-example\nvar xs = List[json.Value]()\n(mut xs).push(json.null())\nlet got = json.as_arr(json.from_list(xs)) else List[json.Value]()\ngot.len == 1\n```",
          "source": "std/json/json.lu",
          "line": 374,
          "tier": "core"
        },
        {
          "name": "as_obj",
          "kind": "fn",
          "signature": "pub fn as_obj(v: Value) -> Map[str, Value] ! {kind}",
          "doc": "The object `v` holds; `kind` otherwise.\n\n```wolf-doc-example\nvar m = Map[str, json.Value]()\nm[\"k\"] = json.from_int(1)\nlet got = json.as_obj(json.from_map(m)) else Map[str, json.Value]()\ngot.len == 1\n```",
          "source": "std/json/json.lu",
          "line": 389,
          "tier": "core"
        },
        {
          "name": "has",
          "kind": "fn",
          "signature": "pub fn has(v: Value, key: str) -> bool",
          "doc": "Whether `v` is an object with an entry at `key`. `false` for every\nother variant, because \"does this document have this field\" has a\nuseful answer for a non-object too, and it is no.\n\nIt survives `get`'s arrival rather than being replaced by it, and the\nreason is §1's: a question with a boolean answer keeps its predicate.\n`has` is what a caller writes when the value is not wanted (a schema\ncheck, a \"did this field appear at all\" branch over a `null` that IS\npresent); `get` is what a caller writes when it is.\n\n```wolf-doc-example\nvar m = Map[str, json.Value]()\nm[\"a\"] = json.from_int(7)\nlet obj = json.from_map(m)\njson.has(obj, \"a\") == true\njson.has(obj, \"b\") == false\njson.has(json.from_int(1), \"a\") == false\n```",
          "source": "std/json/json.lu",
          "line": 414,
          "tier": "core"
        },
        {
          "name": "get",
          "kind": "fn",
          "signature": "pub fn get(v: Value, key: str) -> Value ! {kind, none}",
          "doc": "The value at `key`; `none` when the object has no entry there, `kind`\nwhen `v` is not an object at all.\n\n**Two tags rather than one, because the two questions are different.**\n\"This document has no `port` field\" is a thing a caller routinely plans\nfor; \"the thing you are indexing is a number\" is a caller's mistake\nabout its own data — and §12 keeps them apart so an `else` can too. A\ncaller that genuinely does not care writes `else json.null()`.\n\nBare `get` with a row is §1's checked-access spelling. There is no\n`get_` prefix and no unchecked twin: an absent key is not a fault\n(§8), so the trapping direction this function could have had does not\nexist and never will.\n\n**This function and `at` were written at sc05, tested, and withdrawn\nfor five sprints** — a `Value` returned through an error row took the\nmiss path on every call, silently (F-0037, closed at lupin 0.1.10 and\nre-measured at 0.1.11 and again at 0.1.12). Nothing about the signature\nchanged in the meantime, which is the point: the contract in the module\nheader was right, and what was missing was a machine that ran it.\n\n```wolf-doc-example\nvar m = Map[str, json.Value]()\nm[\"a\"] = json.from_int(7)\nm[\"n\"] = json.null()\nlet obj = json.from_map(m)\nlet a = json.get(obj, \"a\") else json.from_int(0 - 1)\n(json.as_int(a) else 0) == 7\nlet missing = json.get(obj, \"zz\") else json.from_str(\"absent\")\n(json.as_str(missing) else \"?\") == \"absent\"\nlet n = json.get(obj, \"n\") else json.from_int(0 - 1)\njson.is_null(n) == true\nlet wrong = json.get(json.from_int(1), \"a\") else json.from_str(\"not an object\")\n(json.as_str(wrong) else \"?\") == \"not an object\"\n```",
          "source": "std/json/json.lu",
          "line": 472,
          "tier": "core"
        },
        {
          "name": "at",
          "kind": "fn",
          "signature": "pub fn at(v: Value, i: int) -> Value ! {kind, none}",
          "doc": "The element at `i`; `none` when `i` is outside the array, `kind` when\n`v` is not an array.\n\n**A row where `List` traps** (§8, and this is the worked example of\nits rule): an index into a document is DATA — the caller could not have\nchecked what the document contains, because reading the document is\nwhat it is doing — so an out-of-range index is an outcome this function\nreports and never a process this function ends. A negative index is the\nsame miss and not a from-the-end read; `^n` does not exist in wolf and\ninventing it here would be a second dialect.\n\nWithdrawn with `get` at sc05 and shipped with it now; see `get`.\n\n```wolf-doc-example\nvar xs = List[json.Value]()\n(mut xs).push(json.from_str(\"first\"))\n(mut xs).push(json.null())\nlet arr = json.from_list(xs)\nlet a = json.at(arr, 0) else json.from_str(\"?\")\n(json.as_str(a) else \"?\") == \"first\"\nlet past = json.at(arr, 2) else json.from_str(\"past the end\")\n(json.as_str(past) else \"?\") == \"past the end\"\nlet below = json.at(arr, 0 - 1) else json.from_str(\"below zero\")\n(json.as_str(below) else \"?\") == \"below zero\"\nlet wrong = json.at(json.from_int(1), 0) else json.from_str(\"not an array\")\n(json.as_str(wrong) else \"?\") == \"not an array\"\n```",
          "source": "std/json/json.lu",
          "line": 521,
          "tier": "core"
        },
        {
          "name": "keys",
          "kind": "fn",
          "signature": "pub fn keys(v: Value) -> List[str] ! {kind}",
          "doc": "The keys of an object, in the map's unspecified order; `kind` for\nevery other variant. Allocates the list (`to_`-grade, §1).\n\n```wolf-doc-example\nvar m = Map[str, json.Value]()\nm[\"only\"] = json.null()\nlet ks = json.keys(json.from_map(m)) else List[str]()\nks.len == 1\nlet none_here = json.keys(json.from_int(1)) else List[str]()\nnone_here.len == 0\n```",
          "source": "std/json/json.lu",
          "line": 550,
          "tier": "core"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(v: Value) -> int ! {kind}",
          "doc": "The number of elements in an array or entries in an object; `kind` for\nevery scalar. Not a string length: JSON strings are text and\n`std.str.len` is where text length lives.\n\n```wolf-doc-example\nvar xs = List[json.Value]()\n(mut xs).push(json.null())\n(mut xs).push(json.null())\n(json.len(json.from_list(xs)) else 0) == 2\n(json.len(json.from_int(1)) else 0 - 1) == 0 - 1\n```",
          "source": "std/json/json.lu",
          "line": 577,
          "tier": "core"
        },
        {
          "name": "parse",
          "kind": "fn",
          "signature": "pub fn parse(s: str) -> Value ! {syntax, deep, overflow}",
          "doc": "`s` parsed as one JSON document — the direction this module could not\ngo for eight sprints.\n\n**The profile is RFC 8259, strictly**, and the module header lists what\nthat excludes. Whitespace (space, tab, CR, LF) is allowed around every\ntoken and nowhere inside one; trailing content after the value is a\nmiss, so `\"1 2\"` does not parse as `1`.\n\n**Numbers keep the posture the model was built for**: text that denotes\nan integer `int` can hold becomes `Int` and keeps every digit, and\neverything else becomes `Num` through `std.fmt.decimal.parse_float`,\nwhich is correctly rounded. So a document carrying a 64-bit id survives\na round trip and `1e2` arrives as the double `100.0` rather than as the\ninteger 100 — the text said it was not an integer.\n\n**Three tags.** `syntax` is a malformed document. `deep` is nesting\npast `depth_limit()`, raised rather than recursing until the stack\nends: an untrusted document must not be able to end the process, which\nis the same argument `stringify` makes from the writing side. `overflow`\nis a number whose magnitude has no `f64` (`1e400`) — the number tier\nrefuses it rather than answering infinity, and this module refuses to\ncall that a malformed document.\n\nA duplicate key keeps the LAST occurrence.\n\n```wolf-doc-example\nlet v = json.parse(\"[1, true, null]\") else json.null()\n(json.len(v) else 0) == 3\nlet n = json.parse(\"  42  \") else json.null()\n(json.as_int(n) else 0) == 42\nlet s = json.parse(\"\\\"a\\\\nb\\\"\") else json.null()\n(json.as_str(s) else \"?\") == \"a\\nb\"\nlet bad = json.parse(\"[1,]\") else json.from_str(\"not json\")\n(json.as_str(bad) else \"?\") == \"not json\"\n```",
          "source": "std/json/json.lu",
          "line": 620,
          "tier": "core"
        },
        {
          "name": "escape",
          "kind": "fn",
          "signature": "pub fn escape(s: str) -> str",
          "doc": "`s` with the characters JSON forbids inside a string replaced by their\nescapes: `\"` and `\\` by their backslash forms, and every control\ncharacter below U+0020 by `\\b`, `\\f`, `\\n`, `\\r`, `\\t` or `\\u00XX`.\nEvery other character — including every non-ASCII one — passes through\nverbatim, because RFC 8259 permits raw UTF-8 and escaping it would only\nmake the output bigger.\n\n**Total, as of sc14, and its `boundary` tag is gone.** For five sprints\nthis function refused a string that held a non-ASCII code point AND,\nafter it, a character needing an escape: the walk stepped one ASCII\ncharacter at a time and nothing could measure a wider one. What removed\nthe refusal is not the code-point primitive the old contract named but\na change of QUESTION. The four characters that must be escaped are\nASCII; every byte of a multi-byte code point is ≥ 0x80 and so is never\none of them; a run between two escapes is therefore a slice at two\noffsets THIS function computed, and a byte walk needs no code-point\nmeasurement at all. The old body was answering a harder question than\nthe job asked.\n\nThe removal is a signature change and the module header says so:\n`stringify` and `stringify_pretty` lose `boundary` from their rows.\n\nA string needing no escape at all comes back unchanged, and the fast\npath is the walk finding nothing rather than a second pass.\n\n```wolf-doc-example\njson.escape(\"wolf\") == \"wolf\"\njson.escape(\"café\") == \"café\"\njson.escape(\"café \\\"x\\\"\") == \"café \\\\\\\"x\\\\\\\"\"\njson.escape(\"a\\\"b\") == \"a\\\\\\\"b\"\njson.escape(\"a\\\\b\") == \"a\\\\\\\\b\"\njson.escape(\"a\\nb\") == \"a\\\\nb\"\n```",
          "source": "std/json/json.lu",
          "line": 1015,
          "tier": "core"
        },
        {
          "name": "unescape",
          "kind": "fn",
          "signature": "pub fn unescape(s: str) -> str ! {syntax}",
          "doc": "`s` with JSON's escapes resolved — `escape`'s inverse, and the function\n`parse` reads every string payload through.\n\nThe eight two-character escapes (`\\\"`, `\\\\`, `\\/`, `\\b`, `\\f`, `\\n`,\n`\\r`, `\\t`) and `\\uXXXX`, with a surrogate PAIR joined into the one code\npoint it denotes. Any other character after a backslash is a `syntax`\nmiss, and so is a lone surrogate, a truncated `\\u`, and a trailing\nbackslash. Text with no backslash in it comes back unchanged.\n\n**The tag is `syntax` and not the `parse` its sc05 contract named**,\nbecause this module now has a FUNCTION called `parse` and a row tag\nthat shares a name with anything in scope resolves to that thing —\nsilently, with no `else` firing and no diagnostic (F-0036, re-measured\nunder lupin at this sprint's pins and still live there). The rename is\nalso the better name.\n\n**What it waited four sprints for.** Decoding `é` means building\n`\"é\"` out of the number 233, and nothing in the language built a `str`\nfrom a number until s81's validating `str_from_utf8` (F-0057, closed at\nthe sc13 pin, wrapped as `std.bytes.to_str`). An ASCII-only version\nwould have refused text, which §9 forbids.\n\n```wolf-doc-example\n(json.unescape(\"wolf\") else \"?\") == \"wolf\"\n(json.unescape(\"a\\\\nb\") else \"?\") == \"a\\nb\"\n(json.unescape(\"a\\\\\\\"b\") else \"?\") == \"a\\\"b\"\n(json.unescape(\"\\\\u00e9\") else \"?\") == \"é\"\n(json.unescape(\"\\\\ud83d\\\\udc3a\") else \"?\") == \"🐺\"\n(json.unescape(\"a\\\\qb\") else \"bad escape\") == \"bad escape\"\n(json.unescape(\"\\\\ud800\") else \"lone surrogate\") == \"lone surrogate\"\n```",
          "source": "std/json/json.lu",
          "line": 1083,
          "tier": "core"
        },
        {
          "name": "stringify",
          "kind": "fn",
          "signature": "pub fn stringify(v: Value) -> str ! {deep}",
          "doc": "`v` rendered as compact JSON text — no spaces, no newlines, keys in\nthe map's unspecified order. One tag: `deep`, when nesting passes\n`depth_limit()`. It used to be two — `boundary` left with sc14's total\n`escape`, and a caller that named that tag is the one call site this\nmodule's history breaks.\n\nNumbers: an `Int` renders as a decimal integer, exactly; a `Num`\nrenders through `std.fmt.decimal.to_str`, the shortest text that reads\nback as the same double — so `stringify` of a document a program built\nloses nothing. A non-finite `Num` renders as `null`, because JSON has\nno spelling for infinity or NaN and the alternative (a raise, or\ninventing `1e999`) is worse for the caller and worse for the reader;\nJavaScript's own `JSON.stringify` made the same choice.\n\n```wolf-doc-example\n(json.stringify(json.null()) else \"?\") == \"null\"\n(json.stringify(json.from_bool(true)) else \"?\") == \"true\"\n(json.stringify(json.from_int(42)) else \"?\") == \"42\"\n(json.stringify(json.from_num(1.5)) else \"?\") == \"1.5\"\n(json.stringify(json.from_str(\"hi\")) else \"?\") == \"\\\"hi\\\"\"\nvar xs = List[json.Value]()\n(mut xs).push(json.from_int(1))\n(mut xs).push(json.null())\n(json.stringify(json.from_list(xs)) else \"?\") == \"[1,null]\"\n```",
          "source": "std/json/json.lu",
          "line": 1281,
          "tier": "core"
        },
        {
          "name": "stringify_pretty",
          "kind": "fn",
          "signature": "pub fn stringify_pretty(v: Value, indent: int) -> str ! {deep}",
          "doc": "`v` rendered as JSON text with `indent` spaces per nesting level and\none entry per line — the human-readable form. An `indent` of zero\ngives newlines without indentation; a negative `indent` traps\n`assert`. Empty arrays and objects stay on one line (`[]`, `{}`),\nwhich is what every pretty-printer does and what every diff wants.\nThe rows are `stringify`'s.\n\n```wolf-doc-example\n(json.stringify_pretty(json.from_int(1), 2) else \"?\") == \"1\"\nvar xs = List[json.Value]()\n(mut xs).push(json.from_int(1))\n(json.stringify_pretty(json.from_list(xs), 2) else \"?\") == \"[\\n  1\\n]\"\nvar empty = List[json.Value]()\n(json.stringify_pretty(json.from_list(empty), 2) else \"?\") == \"[]\"\n```",
          "source": "std/json/json.lu",
          "line": 1300,
          "tier": "core"
        }
      ]
    },
    {
      "name": "list",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.list — the documented API surface of the language's `List[T]`:\nthe growable sequence every other module hands back. Stability tier:\ncore.\n\n**What is the language's and what is std's** (sc02's structural\nfinding, F-0011): `List[T]` is a language-blessed core type — both\nimplementations provide it natively, the spec owns its semantics, and\nthe three operations below stay the language's own:\n\n- construction: `List[T]()`;\n- indexing: `xs[i]` reads, and an out-of-range index traps `bounds`\n  in every profile (X3 posture) — every function here that names an\n  index inherits exactly that trap;\n- iteration: `for x in xs`.\n\nEverything else — this file — is std's. Functions take the container\nas their first parameter with an honest X1 mode: `mut` where mutation\nIS the operation, the bare `read` default everywhere else.\n\nTwo operations joined the language's list at the sc44 pins and they\nare worth naming because a learner reaches for them first: SLICING\n(`xs[..n]`, `xs[1..]`, `[mem.list.slice]`) runs on all three lanes\nnow, and it is the language's, not std's. There is no\n`list.prefix`/`list.suffix` and there will not be one — §8 forbids a\nstd name that shadows a working builtin — and there cannot be a\n`list.take` either, because `take` is a reserved word (`E0008` on\nboth machines: the ownership verb owns it).\n\n**THE METHOD SPELLINGS ARE NOT STD'S TO GIVE (wolf-std#25).** A\nlearner coming from chapter 5 writes `(mut l).truncate(2)` or\n`l.remove(i)` and gets \"wolf cannot compile this yet — methods on\ngeneric std data\" from the compiler and \"`List` has no method\n`truncate` in this machine's std subset\" from lupin. Both refusals\nare about the LANGUAGE's method surface on the builtin `List`, and\nstd cannot extend it: this module is free functions over a container,\nby §8's rule, and `list.truncate(mut l, 2)` is the spelling it\noffers. All three of `insert`, `remove` and `truncate` are here, with\nbodies, with fenced doc examples that execute, and with three-lane\nledger rows (`list/insert_remove.lu`, `list/clear_truncate_fill.lu`)\n— so the gap the issue found is a gap in what a learner is TOLD, not\nin what std ships. None of the three is written over the slice; since\nsc72 none rebuilds either (the paragraph below).\n\n**The mutators work in place (sc72, wolf-std#92).** `set`, `insert`,\n`remove`, `swap_remove`, `swap`, `clear`, `truncate`, `reverse`,\n`fill`, `pop` and `sort_by` change the caller's list through `mut` by\nthe language's index store (`xs[i] = copy v`), its `push` and `pop`,\nand its `clear` — where through sc71 each rebuilt its result into a\nfresh `List[T]()` and assigned it back. Two things follow. A call\nkeeps nothing per call where it used to allocate a whole list (an\nelement type that reaches no storage allocates nothing at all, and a\n`str` or a `List` element pays one `copy` per slot written, not one\nper element; `tests/list/in_place_allocates_nothing.lu`). And the\n`mut` parameter is AMBIENT-CLEAN under `[mem.region.outer-write]`\n(wolf 0.2.35; `wolf conform-run --dump=mut-clean` says `clean` for\neach): a program may call them inside a per-turn `region` block on a\nlist declared outside it, which the rebuilds made E1010 by name. The\nsignatures did not move. `sort_by` still merges over scratch lists in\nthe ambient region and writes the order back. `push` and `extend`\nstore the caller's value as given and stay unclean: a `copy` there\nwould deep-copy every pushed `str`, and inside a block a caller writes\n`(mut xs).push(copy v)` itself. The helpers that RETURN a list\n(`concat`, `repeat`, `map`, `filter`, `sorted_by`, …) build it fresh,\nwhich is what they are for.\n\nRegions (D10): every function that builds a list allocates it in the\nambient region, a mutator's stores land in the list's own, and no\nsignature asks for one. The `.in(r)` targets are s37's plumbing, not\nthis module's. **s76 made that sentence true of the machine and not\nonly of the API** (the sc12 pin): a `List` allocates in the ambient\nregion AT THE SITE, so a list built inside `region r { }` is freed with\nit and growth stays in the region it was born in. Nothing here changed\nto earn that, which is the point — a region-silent algorithm inherits\nits operands' homes, and now it does so in fact rather than in\nintention.\n\nHISTORY, kept because two campaigns of bodies were shaped by it:\n- **The single-read rule is DEAD** (s72's D40, `[mem.iter.excl]`, closed\n  at the sc11 pin). wolfc's mem tier used to treat every read of a\n  container place as a MOVE, so two read SITES over one binding in one\n  body was E1001 (`xs.len` twice; `xs.len` then `xs[i]`; `for x in xs`\n  then anything), and that is why every body here reads through `len`\n  and the private `at` — one call per site — instead of projecting\n  twice. Iteration takes a read claim over the loop's whole extent now,\n  `for` no longer moves its iterable, and a write during the loop is\n  `E1013` statically and `trap(exclusivity)` dynamically (F-0005 and\n  F-0014, both closed). The bodies keep their shape because they are\n  correct and rewriting them would be churn; new code in this module\n  does not need the ceremony.\n- The absence-spelling interim is retired: the tag is lowercase\n  everywhere as of sc06 (F-0003 dead), and this header carried a\n  half-renamed sentence about it — \"`none`, not the convention's\n  `none`\" — for six sprints afterwards. A rename that touches 148 sites\n  should have a reader on the prose too.\n\nINTERIM SPELLINGS (each filed, flipped by the pin bump that fixes it):\n- The `[T: Eq]` family (`contains`, `index_of`, `last_index_of`,\n  `dedup`, `starts_with`, `ends_with`) is NOT in this file: importing\n  std.cmp for the bound would make every importer of std.list\n  `unsupported` under wolfc's checked tier (its trait/enum items are\n  not executable there — F-0012), on top of trait dispatch running\n  nowhere (F-0002/F-0004). The six sit in `std/x/list_eq/` with their\n  bodies, and the stub comment below is their home here.",
      "summary": "std.list — the documented API surface of the language's `List[T]`: the growable sequence every other module hands back.",
      "items": [
        {
          "name": "push",
          "kind": "fn",
          "signature": "pub fn push[T](mut xs: List[T], v: T)",
          "doc": "Appends `v` to the end of `xs`, growing it. Amortized constant time\n(the buffer doubles; no capacity contract beyond that is promised).\nTotal: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 4)\nlist.push(mut xs, 5)\nlist.len(xs) == 2\n```",
          "source": "std/list/list.lu",
          "line": 145,
          "tier": "core"
        },
        {
          "name": "pop",
          "kind": "fn",
          "signature": "pub fn pop[T](mut xs: List[T]) -> T ! {none}",
          "doc": "Removes and returns the last element; `none` when `xs` is empty —\nthe absence row, consumed by `else` or `?`. No traps: emptiness is a\nrecoverable outcome, not a contract violation (§2).\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 7)\n(list.pop(mut xs) else 0 - 1) == 7\n(list.pop(mut xs) else 0 - 1) == 0 - 1\n```",
          "source": "std/list/list.lu",
          "line": 159,
          "tier": "core"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len[T](xs: List[T]) -> int",
          "doc": "The number of elements in `xs`. Total: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.len(xs) == 1\n```",
          "source": "std/list/list.lu",
          "line": 176,
          "tier": "core"
        },
        {
          "name": "is_empty",
          "kind": "fn",
          "signature": "pub fn is_empty[T](xs: List[T]) -> bool",
          "doc": "Whether `xs` holds no elements — `len(xs) == 0`, spelled as the\npredicate callers reach for (§1). Total: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.is_empty(xs) == true\nlist.push(mut xs, 1)\nlist.is_empty(xs) == false\n```",
          "source": "std/list/list.lu",
          "line": 189,
          "tier": "core"
        },
        {
          "name": "get",
          "kind": "fn",
          "signature": "pub fn get[T](xs: List[T], i: int) -> T ! {none}",
          "doc": "The element at `i`, checked: `none` when `i` is negative or at least\n`len(xs)` — the one checked-access spelling (§1: no `get_` prefix, no\nsentinel). No traps; the unchecked spelling is the language's `xs[i]`,\nwhich traps `bounds`.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 9)\n(list.get(xs, 0) else 0 - 1) == 9\n(list.get(xs, 4) else 0 - 1) == 0 - 1\n(list.get(xs, 0 - 1) else 0 - 1) == 0 - 1\n```",
          "source": "std/list/list.lu",
          "line": 205,
          "tier": "core"
        },
        {
          "name": "set",
          "kind": "fn",
          "signature": "pub fn set[T](mut xs: List[T], i: int, v: T)",
          "doc": "Replaces the element at `i` with `v`, in place. Traps `bounds` when\n`i` is out of range — the same contract as `xs[i]`, and a caller\nviolation rather than a row (§2's trap rule).\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.set(mut xs, 0, 8)\n(list.get(xs, 0) else 0) == 8\n(list.get(xs, 1) else 0) == 2\n```",
          "source": "std/list/list.lu",
          "line": 227,
          "tier": "core"
        },
        {
          "name": "first",
          "kind": "fn",
          "signature": "pub fn first[T](xs: List[T]) -> T ! {none}",
          "doc": "The first element; `none` when `xs` is empty. No traps.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 3)\nlist.push(mut xs, 4)\n(list.first(xs) else 0) == 3\n```",
          "source": "std/list/list.lu",
          "line": 249,
          "tier": "core"
        },
        {
          "name": "last",
          "kind": "fn",
          "signature": "pub fn last[T](xs: List[T]) -> T ! {none}",
          "doc": "The last element; `none` when `xs` is empty. No traps.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 3)\nlist.push(mut xs, 4)\n(list.last(xs) else 0) == 4\n```",
          "source": "std/list/list.lu",
          "line": 264,
          "tier": "core"
        },
        {
          "name": "insert",
          "kind": "fn",
          "signature": "pub fn insert[T](mut xs: List[T], i: int, v: T)",
          "doc": "Inserts `v` at `i`, shifting the elements from `i` onward one place\nto the right; `i == len(xs)` appends. Traps `bounds` when `i` is\nnegative or greater than `len(xs)`.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 3)\nlist.insert(mut xs, 1, 2)\n(list.get(xs, 1) else 0) == 2\nlist.len(xs) == 3\n```",
          "source": "std/list/list.lu",
          "line": 284,
          "tier": "core"
        },
        {
          "name": "remove",
          "kind": "fn",
          "signature": "pub fn remove[T](mut xs: List[T], i: int) -> T",
          "doc": "Removes the element at `i`, shifting the rest left, and returns it.\nTraps `bounds` when `i` is out of range — the caller asked for an\nelement that is not there and could have checked `len` first.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.remove(mut xs, 0) == 1\nlist.len(xs) == 1\n```",
          "source": "std/list/list.lu",
          "line": 317,
          "tier": "core"
        },
        {
          "name": "swap_remove",
          "kind": "fn",
          "signature": "pub fn swap_remove[T](mut xs: List[T], i: int) -> T",
          "doc": "Removes the element at `i` by moving the LAST element into its slot,\nand returns the removed element. Constant time, and the order of the\nremaining elements changes — that is the trade this name announces.\nTraps `bounds` when `i` is out of range.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.push(mut xs, 3)\nlist.swap_remove(mut xs, 0) == 1\n(list.get(xs, 0) else 0) == 3\nlist.len(xs) == 2\n```",
          "source": "std/list/list.lu",
          "line": 345,
          "tier": "core"
        },
        {
          "name": "swap",
          "kind": "fn",
          "signature": "pub fn swap[T](mut xs: List[T], i: int, j: int)",
          "doc": "Exchanges the elements at `i` and `j`, in place; `i == j` is a\nno-op. Traps `bounds` when either index is out of range.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.swap(mut xs, 0, 1)\n(list.get(xs, 0) else 0) == 2\n(list.get(xs, 1) else 0) == 1\n```",
          "source": "std/list/list.lu",
          "line": 366,
          "tier": "core"
        },
        {
          "name": "clear",
          "kind": "fn",
          "signature": "pub fn clear[T](mut xs: List[T])",
          "doc": "Empties `xs`, keeping it usable. Total: no error row, no traps.\nD10 note: the elements' storage belongs to the region, so clearing\ndrops no elements one by one for POD element types.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.clear(mut xs)\nlist.is_empty(xs) == true\n```",
          "source": "std/list/list.lu",
          "line": 382,
          "tier": "core"
        },
        {
          "name": "truncate",
          "kind": "fn",
          "signature": "pub fn truncate[T](mut xs: List[T], n: int)",
          "doc": "Shortens `xs` to at most `n` elements, dropping the tail; a `n` at or\nabove `len(xs)` leaves it alone and a negative `n` empties it. Total:\nno error row, no traps (truncating is not an access).\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.push(mut xs, 3)\nlist.truncate(mut xs, 2)\nlist.len(xs) == 2\n```",
          "source": "std/list/list.lu",
          "line": 398,
          "tier": "core"
        },
        {
          "name": "reverse",
          "kind": "fn",
          "signature": "pub fn reverse[T](mut xs: List[T])",
          "doc": "Reverses `xs` in place. Total: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.push(mut xs, 3)\nlist.reverse(mut xs)\n(list.first(xs) else 0) == 3\n(list.last(xs) else 0) == 1\n```",
          "source": "std/list/list.lu",
          "line": 449,
          "tier": "core"
        },
        {
          "name": "extend",
          "kind": "fn",
          "signature": "pub fn extend[T](mut xs: List[T], other: List[T])",
          "doc": "Appends every element of `other` to `xs`, in order. `other` is read,\nnot consumed — the caller keeps it. Total: no error row, no traps\nbeyond allocation.\n\n```wolf-doc-example\nvar xs = List[int]()\nvar ys = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut ys, 2)\nlist.extend(mut xs, ys)\nlist.len(xs) == 2\n(list.last(xs) else 0) == 2\n```",
          "source": "std/list/list.lu",
          "line": 472,
          "tier": "core"
        },
        {
          "name": "concat",
          "kind": "fn",
          "signature": "pub fn concat[T](a: List[T], b: List[T]) -> List[T]",
          "doc": "A new list holding `a`'s elements followed by `b`'s; both operands\nare read, not consumed (`to_`-style allocation, §1). Total: no error\nrow, no traps beyond allocation.\n\n```wolf-doc-example\nvar a = List[int]()\nvar b = List[int]()\nlist.push(mut a, 1)\nlist.push(mut b, 2)\nlist.len(list.concat(a, b)) == 2\n```",
          "source": "std/list/list.lu",
          "line": 489,
          "tier": "core"
        },
        {
          "name": "fill",
          "kind": "fn",
          "signature": "pub fn fill[T](mut xs: List[T], v: T)",
          "doc": "Overwrites every element of `xs` with `v`, keeping its length.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.fill(mut xs, 9)\n(list.first(xs) else 0) == 9\n(list.last(xs) else 0) == 9\n```",
          "source": "std/list/list.lu",
          "line": 507,
          "tier": "core"
        },
        {
          "name": "repeat",
          "kind": "fn",
          "signature": "pub fn repeat[T](xs: List[T], n: int) -> List[T]",
          "doc": "A new list with `xs`'s elements repeated `n` times; `n <= 0` yields\nan empty list. Total: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.len(list.repeat(xs, 3)) == 6\n```",
          "source": "std/list/list.lu",
          "line": 525,
          "tier": "core"
        },
        {
          "name": "any",
          "kind": "fn",
          "signature": "pub fn any[T](xs: List[T], pred: fn(T) -> bool) -> bool",
          "doc": "Does `pred` hold for ANY element? False on the empty list. Walks in\norder and stops at the first hit.\n\nCall shape (witnessed by `tests/list/predicate_tier.lu` on all\nthree lanes): `fn odd(v: int) -> bool { v % 2 == 1 }` … then\n`list.any(xs, odd)`.",
          "source": "std/list/list.lu",
          "line": 566,
          "tier": "core"
        },
        {
          "name": "all",
          "kind": "fn",
          "signature": "pub fn all[T](xs: List[T], pred: fn(T) -> bool) -> bool",
          "doc": "Does `pred` hold for EVERY element? Vacuously true on the empty\nlist — the logician's `all`, and the one that makes\n`all(xs, p) == !any(xs, not_p)` an identity.",
          "source": "std/list/list.lu",
          "line": 576,
          "tier": "core"
        },
        {
          "name": "count_where",
          "kind": "fn",
          "signature": "pub fn count_where[T](xs: List[T], pred: fn(T) -> bool) -> int",
          "doc": "How many elements satisfy `pred`. The whole walk, always — there is\nnothing to stop early for.",
          "source": "std/list/list.lu",
          "line": 585,
          "tier": "core"
        },
        {
          "name": "index_where",
          "kind": "fn",
          "signature": "pub fn index_where[T](xs: List[T], pred: fn(T) -> bool) -> int ! {none}",
          "doc": "The index of the FIRST element satisfying `pred`; `none` when none\ndoes. The index answers \"where\", `find_where` answers \"what\" — two\nfns because a `T` is not an `int` and a sentinel index is §1's\nforbidden shape.",
          "source": "std/list/list.lu",
          "line": 597,
          "tier": "core"
        },
        {
          "name": "find_where",
          "kind": "fn",
          "signature": "pub fn find_where[T](xs: List[T], pred: fn(T) -> bool) -> T ! {none}",
          "doc": "The first element satisfying `pred`; `none` when none does.",
          "source": "std/list/list.lu",
          "line": 607,
          "tier": "core"
        },
        {
          "name": "min_by",
          "kind": "fn",
          "signature": "pub fn min_by[T](xs: List[T], better: fn(T, T) -> bool) -> T ! {none}",
          "doc": "The BEST element under `better`, where `better(a, b)` reads \"a is\nbetter than b\": the first element such that no later one beats it.\n`none` on the empty list. With `better` = \"less than\" this is the\nminimum; flip the relation and it is the maximum — `max_by` IS this\nfn with the arguments of `better` swapped in the caller's relation,\ndocumented rather than duplicated.",
          "source": "std/list/list.lu",
          "line": 620,
          "tier": "core"
        },
        {
          "name": "max_by",
          "kind": "fn",
          "signature": "pub fn max_by[T](xs: List[T], better: fn(T, T) -> bool) -> T ! {none}",
          "doc": "`min_by` under the flipped relation, named for the call sites that\nread better with it. `max_by(xs, gt)` == `min_by(xs, gt)` when `gt`\nis already \"greater is better\"; the two names exist so neither\ncaller writes a lambdaless flip by hand.",
          "source": "std/list/list.lu",
          "line": 636,
          "tier": "core"
        },
        {
          "name": "is_sorted_by",
          "kind": "fn",
          "signature": "pub fn is_sorted_by[T](xs: List[T], le: fn(T, T) -> bool) -> bool",
          "doc": "Is `xs` sorted under `le`, where `le(a, b)` reads \"a may precede\nb\"? True for the empty and single-element lists. This is the\nwitness `sort_by` will be judged by the day wolf-lang#23 frees the\n`Ordering` comparator; it lands beside that freight deliberately.",
          "source": "std/list/list.lu",
          "line": 644,
          "tier": "core"
        },
        {
          "name": "map",
          "kind": "fn",
          "signature": "pub fn map[T, U](xs: List[T], f: fn(T) -> U) -> List[U]",
          "doc": "A new list holding `f(x)` for every `x` in `xs`, in order; `xs` is\nread, not consumed. The empty list maps to the empty list. Total: no\nerror row, no traps beyond allocation and whatever `f` traps.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.map(f)` is\nthis call (`[type.method.resolve]` step 2), and eager\n(`[type.comb.eager]`). Cost, as the clause states it: one fresh\n`List[U]` of `xs.len` in the ambient region, and `xs.len` calls of\n`f`. A fallible `f` is `par`'s alone (`[conc.task.par]`).\n\n**The one element here that this call OWNS, and the spelling it is\nowed.** What this list holds is `f`'s own return value, not an\nelement moved out of `xs`, so nothing lent escapes\n(`[mem.tier0.mode.read]`, wolf-lang#366); `x` is only LENT to `f` for\nthe call, which is what a `read` parameter is for, and an `f` that\nhands its own argument back is the caller's site, not this one.\nBecause `f(x)` is a temporary this activation owns, the right\nspelling under wolf-lang#385 (ruled option 3, s167, unreleased) is\n`(mut out).push(take f(x))`, which MOVES it where the default copies.\nIt is not written yet because it does not exist yet: at wolf 0.2.14\nboth compiler rungs answer `E1007 — `push` takes `value` as plain\n`read`, no mode is written for it` (measured, F-0136), and that is a\nstatic refusal of this whole module, so every `std.list` row on both\nrungs would pay for it. It lands with the pin that carries s167, and\nthe cost line above changes with it.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlet ys = list.map(xs, fn(v) v * 10)\nlist.len(ys) == 2\n(list.last(ys) else 0) == 20\n```",
          "source": "std/list/list.lu",
          "line": 712,
          "tier": "core"
        },
        {
          "name": "filter",
          "kind": "fn",
          "signature": "pub fn filter[T](xs: List[T], keep: fn(T) -> bool) -> List[T]",
          "doc": "A new list holding the elements of `xs` for which `keep` holds, in\ntheir original order; `xs` is read, not consumed. The in-place\nsibling (`retain`) is not written: a returning `filter` is the\ncombinator, and a `mut` twin would be a second name for one walk.\nTotal: no error row, no traps beyond allocation.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.filter(keep)`\nis this call (`[type.method.resolve]` step 2). Cost, as the clause\nstates it: one fresh `List[T]` of at most `xs.len` in the ambient\nregion, and `xs.len` calls of `keep`, plus one element copy per kept\nelement — `push`'s own, not one spelled here.\n\n**Why no `copy` is written.** `xs` is a `read` parameter, so an\nelement moved out of it is LENT and may not escape this call\n(`[mem.tier0.mode.read]`, wolf-lang#366, in 0.2.15) — and the kept\nelements do escape, in the returned list. That clause says in its own\nwords that it does not reach the builtin store which keeps a `read`\nargument inside its receiver; that is wolf-lang#385, **ruled option\n3** (s167, unreleased): `push` COPIES a non-`Copy` element by\ndefault, and `push(take v)` moves it. The default copy is exactly the\ncopy this function needs, so writing `copy x` here would buy a second\none. `push`'s copy is deep on the native tiers (`[mem.tier0.move.3]`,\nwolf-lang#384): a `List` element copies its buffer, a `str` element\nshares its immutable bytes, a scalar costs nothing. Nothing is lent\nout of this module either way, at this pin or at the next.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.push(mut xs, 3)\nlist.len(list.filter(xs, fn(v) v % 2 == 1)) == 2\n(list.last(list.filter(xs, fn(v) v % 2 == 1)) else 0) == 3\n```",
          "source": "std/list/list.lu",
          "line": 754,
          "tier": "core"
        },
        {
          "name": "fold",
          "kind": "fn",
          "signature": "pub fn fold[T, A](xs: List[T], init: A, step: fn(A, T) -> A) -> A",
          "doc": "Combines every element of `xs` into one value, left to right:\n`f(… f(f(init, x0), x1) …, xn)`. `init` is the answer for the empty\nlist. The accumulator's type `A` need not be the element's. Total:\nno error row, no traps beyond whatever `step` traps.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.fold(init,\nstep)` is this call (`[type.method.resolve]` step 2). Cost, as the\nclause states it: no allocation of its own, and `xs.len` calls of\n`step`, left to right. The clause's `f64` sum is this function:\n`xs.fold(0.0, fn(a, x) a + x)`.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.push(mut xs, 3)\nlist.fold(xs, 0, fn(acc, v) acc + v) == 6\n```",
          "source": "std/list/list.lu",
          "line": 782,
          "tier": "core"
        },
        {
          "name": "sum",
          "kind": "fn",
          "signature": "pub fn sum(xs: List[int]) -> int",
          "doc": "The sum of `xs`; 0 for the empty list. Traps `overflow` the moment a\npartial sum leaves `int` (checked arithmetic, X3), deliberately not a\nrow: `std.search.sum`'s contract, word for word.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.sum()` is\nthis call on a `List[int]`, and on any other `List` it is E0403, not\na match. Cost, as the clause states it: none beyond checked addition\nleft to right (X3).\n\nMonomorphic over `int`, and that is measured, not modest. A generic\n`sum[T: ops.Add]` needs `use std.ops`, which imports `std.cmp`, and\nevery importer of `std.cmp` is `unsupported` on the native rung (the\n`search/*` rows carry exactly that), so the bound would cost every\n`std.list` importer a lane; `std.ops` has no zero for `T` either. The\ngeneric reduction is `fold`. `std.search.sum` stays: two modules may\nshare a function name (a program importing both links at this pin,\nmeasured natively on `list.len` beside `bytes.len`), and this one\nis the three-lane spelling.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\nlist.push(mut xs, 3)\nlist.sum(xs) == 6\n```",
          "source": "std/list/list.lu",
          "line": 816,
          "tier": "core"
        },
        {
          "name": "enumerate",
          "kind": "fn",
          "signature": "pub fn enumerate[T](xs: List[T]) -> List[(int, T)]",
          "doc": "A new list pairing each element of `xs` with its index, in order:\n`(0, x0), (1, x1), …`. The shape `for (i, x) in list.enumerate(xs)`\ndestructures. Total: no error row, no traps beyond allocation.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.enumerate()`\nis this call. Cost, as the clause states it: one fresh `List` of\npairs, indices from 0, plus `push`'s own copy of each pair — the\npairs escape with the element inside them\n(`[mem.tier0.mode.read]`, wolf-lang#366), and the store that copies\nthem is wolf-lang#385's, ruled option 3 (s167, unreleased): `push`\ncopies a non-`Copy` element by default, deeply on the native tiers\n(`[mem.tier0.move.3]`, wolf-lang#384) — a scalar costs nothing, a\n`str` shares its bytes, a `List` element copies its buffer. No `copy`\nis spelled here, because that default is already it.\n\n```wolf-doc-example\nvar xs = List[str]()\nlist.push(mut xs, \"a\")\nlist.push(mut xs, \"b\")\nlet pairs = list.enumerate(xs)\nlet second = pairs[1]\nsecond.0 == 1\nsecond.1 == \"b\"\n```",
          "source": "std/list/list.lu",
          "line": 848,
          "tier": "core"
        },
        {
          "name": "zip",
          "kind": "fn",
          "signature": "pub fn zip[T, U](xs: List[T], ys: List[U]) -> List[(T, U)]",
          "doc": "A new list pairing the elements of `xs` and `ys` position by\nposition: `(x0, y0), (x1, y1), …`, as long as the SHORTER of the two,\nso the longer list's tail is dropped rather than trapped on. Both\noperands are read, not consumed. Built through the private `fresh`\nfor the reason `enumerate` is (F-0133). Total: no error row, no traps\nbeyond allocation.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.zip(ys)` is\nthis call. Cost, as the clause states it: one fresh `List` of\n`min(xs.len, ys.len)` pairs, plus `push`'s own copy of each pair —\nBOTH lists are `read` parameters and both elements escape inside the\npairs (`[mem.tier0.mode.read]`, wolf-lang#366), and the copy that\nmakes that legal is `push`'s under wolf-lang#385, ruled option 3\n(s167, unreleased), deep on the native tiers\n(`[mem.tier0.move.3]`, wolf-lang#384). It stops at the shorter list\nbecause a length mismatch is not an access out of range.\n\n```wolf-doc-example\nvar names = List[str]()\nlist.push(mut names, \"ada\")\nlist.push(mut names, \"grace\")\nvar scores = List[int]()\nlist.push(mut scores, 91)\nlet rows = list.zip(names, scores)\nlist.len(rows) == 1\nvar total = 0\nfor (n, s) in rows { total = total + s + n.len }\ntotal == 94\n```",
          "source": "std/list/list.lu",
          "line": 887,
          "tier": "core"
        },
        {
          "name": "sort_by",
          "kind": "fn",
          "signature": "pub fn sort_by[T](mut xs: List[T], less: fn(T, T) -> bool)",
          "doc": "Sorts `xs` in place, stably, under `less`, where `less(a, b)` reads\n\"`a` goes before `b`\". Equal elements (neither goes before the other)\nkeep their input order: the merge takes from the right run only when\n`less(right, left)` holds. `less` must be a strict weak order or the\nresult is merely a permutation; std cannot check that and does not\npretend to. Total: no error row, no traps beyond allocation and\nwhatever `less` traps. `std.sort`'s bottom-up merge, line for line.\nThe result satisfies `is_sorted_by(xs, fn(a, b) !less(b, a))`.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method\n`(mut xs).sort_by(less)` is this call, its receiver's `mut` spelled\n(`[type.method.resolve]`, X1). Cost, as the clause states it: stable,\nO(n log n) calls of `less`, O(n) scratch in the ambient region, and\nno `copy` at all: the receiver is `mut`, not `read`, so no element\nhere is lent and the sorted elements go back to the caller's own list\n(`[mem.tier0.mode.read]`, wolf-lang#366). The returning twin\n`sorted_by` pays the copies instead, because its receiver is `read`.\n\n**Why the relation is `bool` and why `std.sort` keeps its own.** The\nclause rules it: `std.sort.sort_by` takes a `cmp.Ordering`, and at\nwolf 0.2.14 / lupin 0.1.36 it runs on no lane (re-measured for this\nfunction: lupin declines the enum's dynamics at resolve, the checked\nmachine declines `std.cmp`'s module items, the native rung finds\n`.is_lt()` untyped; F-0029). `std.sort`'s `Ordering` pair keeps its\nqualified spelling; the method is this one. Same mode, same\nstability, same algorithm; the comparator's type is the one\ndifference, and it is stated on both.\n\nCall shape (a prose example, witnessed by `tests/list/sort_by_tier.lu`\non all three lanes): `fn shorter(a: str, b: str) -> bool { a.len <\nb.len }` … then `list.sort_by(mut words, shorter)`. Not fenced: the\ncall is a statement, and §4's extractor reads a line holding the\nrelation's `<` as an assertion. `sorted_by`'s example is fenced and\nshows the same order. Do not name a top-level fn `less` in a program\nthat passes a different relation: the checked machine calls it\ninstead of the argument (F-0134, wolf-lang#400).",
          "source": "std/list/list.lu",
          "line": 937,
          "tier": "core"
        },
        {
          "name": "sorted_by",
          "kind": "fn",
          "signature": "pub fn sorted_by[T](xs: List[T], less: fn(T, T) -> bool) -> List[T]",
          "doc": "`sort_by`'s returning twin: a fresh list holding `xs`'s elements in\n`less`'s order, stably, with `xs` untouched. `less` must be a strict\nweak order or the result is merely a permutation. Total: no error\nrow, no traps beyond allocation and whatever `less` traps.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method\n`xs.sorted_by(less)` is this call, the chain's sort (`corpus/\nwordcount.lu`'s `sorted_by`). Cost, as the clause states it:\n`sort_by` over a fresh copy, plus `push`'s own copy per element\nbuilding that copy — the elements escape in the returned list and\n`xs` is a `read` parameter (`[mem.tier0.mode.read]`, wolf-lang#366),\nand the store that copies them is wolf-lang#385's, ruled option 3\n(s167, unreleased), deep on the native tiers\n(`[mem.tier0.move.3]`, wolf-lang#384).\n`std.sort.sorted_by` is the `Ordering` twin that runs on no lane\n(F-0029) and keeps its qualified spelling.\n\n```wolf-doc-example\nvar xs = List[int]()\nlist.push(mut xs, 3)\nlist.push(mut xs, 1)\nlist.push(mut xs, 2)\n(list.first(list.sorted_by(xs, fn(a, b) a < b)) else 0) == 1\n(list.last(list.sorted_by(xs, fn(a, b) a < b)) else 0) == 3\n(list.first(xs) else 0) == 3\n```",
          "source": "std/list/list.lu",
          "line": 1019,
          "tier": "core"
        },
        {
          "name": "sorted",
          "kind": "fn",
          "signature": "pub fn sorted[T: cmp.Ord](xs: List[T]) -> List[T]",
          "doc": "A fresh list holding `xs`'s elements in `T`'s own ascending order,\nstably, with `xs` untouched. `T: cmp.Ord` is a total order by its own\nlaw, so this needs no relation from the caller. Total: no error row,\nno traps beyond allocation.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `xs.sorted()` is\nthis call. Cost, as the clause states it: `sorted_by` with `<`\n(`[type.trait.op]`) — O(n log n) comparisons, O(n) scratch, plus\n`push`'s own copy per element (#385 option 3, as the other\ncombinators).\n\n**Its lanes, and the two rows behind them** (F-0135). It ships at\nwolf-std `42d42b9` and not before: until sc49 rewrote `std.cmp`'s\n`Ordering` impls without a product pattern, the `use std.cmp` above\nmade EVERY importer of this module `unsupported` on the native rung,\nwhich is the \"budget a module by its worst body\" rule. The checked\nmachine still declines this one function — \"trait dispatch on a\nnon-nominal receiver\" at `a < b`, where `T` is bound through a list\nread (wolf-lang#402) — so `tests/list/sorted_tier.lu` is\n`unsupported` there and nothing else in the module pays for it.\nProse, not a fenced example, for that reason: §4 wants a lane that\nrefuses honestly, and lupin and native both run it —\n`list.sorted(xs)` over `[3, 1, 2]` answers `1, 2, 3`.",
          "source": "std/list/list.lu",
          "line": 1112,
          "tier": "core"
        }
      ]
    },
    {
      "name": "map",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.map — the documented API surface of the prelude's `Map[K, V]`:\nthe keyed store the wordcount exemplar is written against. Stability\ntier: core.\n\n**WHAT IS THE LANGUAGE'S AND WHAT IS STD'S — RULED, and this header\nstops being a filing.** F-0011 asked three questions when this module\nwas written (sc02) and s152 (`[type.map]`, `[type.map.key]`,\n`[mem.map.absent]`; wolf-lang#11 item 4, #154) answers two of them\nand leaves the third exactly as it was:\n\n- **The key protocol: RULED, and there is no `Hash` half.** This\n  header used to say \"hashing lives inside the implementations and is\n  unspecified … the `Hash` half is the filing's open question\".\n  `[type.map.key]` retires that sentence: `Map[K, V]` admits `str`,\n  `int`, `char` and `bool` keys this edition — the four whose\n  equality the LANGUAGE defines — and `[K: Eq]` is satisfied by the\n  four through `std.cmp`'s ordinary impls. So the bound the five\n  functions below already carried is not \"the honest half\" of a\n  protocol; it is the whole of it. A struct key is E0418 and waits on\n  derived equality, which is named upstream and unruled. `impl Eq for\n  char` landed in `std.cmp` at sc44 for this clause: the ruling names\n  four keys and that module shipped three impls.\n- **`tally`: RULED, and it is std's.** The filed question was \"is\n  absent-key-defaulting a language rule or a std function?\" and it\n  closes the way the filing recommended. The LANGUAGE rules the\n  absence — `m[k]` is `V ! {none}`, never `()`; `m[k] = v` inserts;\n  `m[k] op= v` is E0417, whose note names `map.tally(mut m, k)` BY\n  NAME — and STD owns the defaulting. `tally`'s body below is the\n  clause's own spelling, unchanged since sc02 and now ruled rather\n  than proposed.\n- **Iteration order: unchanged, and deliberately.** `keys`, `values`\n  and `pairs` promise the SAME order as each other for an unmodified\n  map, and nothing more. Both machines answer insertion order at\n  these pins and neither promise is made here.\n\n`Map` itself stays the language's. The sc02 recommendation — that it\nbecome a std-defined generic type — is answered in the other\ndirection and the answer is better than the recommendation: `Map` is\n`TyKind::Map` in the compiler, a `wolf_rt::map` seam in the native\nruntime and a served type in the checked machine, so it is a language\ntype with a spec clause instead of scaffolding with a deadline. This\nmodule is the API surface over it, which is what §8's container rule\nhas said all along.\n\n`get` copies only the value selected by the language's index read\n`m[k]`; `has` asks the same read for presence. Both keep its `none` row\nfor an absent key. Neither walks a `pairs()` snapshot or calls `Eq.eq`\nfor every entry. `get_or` and `tally` keep their std defaulting\nbehaviour and inherit `get`'s lookup. The runtime owns the lookup\nalgorithm; a hashed runtime needs no further std change.\n\nThe key functions keep their `[K: cmp.Eq]` bounds: that is the same\npublic key protocol, not a new user-defined equality hook. For all four\nadmitted key types, std.cmp's impl is exactly the language's `==`.\nThe four `tests/map/get_*_agreement.lu` rows compare the old walk with\n`get` on each key type. Checked, native and the local release witness\nrun all four; lupin 0.1.58 cannot resolve the old walk's `Eq.eq` for\nchar. Its exact refusal is gated, while the other small rows run.\nThe full 10k row runs on checked/native; lupin has a 1k companion and\na loud slow cell for 10k at its 60-second ceiling.\n\nAbsence is spelled `none`, the convention's own spelling — F-0003 is\ndead (sc05 pins, renamed at sc06) and nothing here waits on it.",
      "summary": "std.map — the documented API surface of the prelude's `Map[K, V]`: the keyed store the wordcount exemplar is written against.",
      "items": [
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len[K, V](m: Map[K, V]) -> int",
          "doc": "The number of key-value entries. Total: no error row, no traps.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nmap.set(mut m, \"a\", 1)\nmap.len(m) == 1\n```",
          "source": "std/map/map.lu",
          "line": 76,
          "tier": "core"
        },
        {
          "name": "is_empty",
          "kind": "fn",
          "signature": "pub fn is_empty[K, V](m: Map[K, V]) -> bool",
          "doc": "Whether the map holds no entries. Total: no error row, no traps.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nmap.is_empty(m) == true\nmap.set(mut m, \"a\", 1)\nmap.is_empty(m) == false\n```",
          "source": "std/map/map.lu",
          "line": 88,
          "tier": "core"
        },
        {
          "name": "set",
          "kind": "fn",
          "signature": "pub fn set[K, V](mut m: Map[K, V], k: K, v: V)",
          "doc": "Binds `k` to `v`, replacing any previous binding. Total: no error\nrow, no traps beyond allocation.\n\n**The body is `m[k] = copy v` and the `copy` is not decoration.**\nThis function's body was `m[k] = v` from sc02 until sc44 and nothing\nread it, because `Map` was untyped on both compiler rungs. At the\npin that types it the mem tier read it for the first time and\nanswered E1004 — \"this stores a value from `v`'s region into `m`'s\nregion — parameter regions are independent by default\" — which took\nthe WHOLE module down on both rungs, not just this function.\n`copy` is the fix-it the diagnostic itself suggests and it is in the\ngrammar now; the value is copied into the container's region, which\nfor the four key types and every `V` this edition admits is what a\ncaller means by `set`.\n\nThe asymmetry behind it is filed upstream: `(mut xs).push(v)` under\n`[T]` needs no `copy` and `m[k] = v` under `[K, V]` does, and the\nsame body monomorphic at `Map[str, int]` runs on all three lanes.\nFiled as wolf-lang#333; if it is ruled a bug the `copy` comes back\nout and no caller notices.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nmap.set(mut m, \"a\", 1)\nmap.set(mut m, \"a\", 2)\nmap.len(m) == 1\n```",
          "source": "std/map/map.lu",
          "line": 119,
          "tier": "core"
        },
        {
          "name": "keys",
          "kind": "fn",
          "signature": "pub fn keys[K, V](m: Map[K, V]) -> List[K]",
          "doc": "Every key, in the map's unspecified-but-consistent iteration order.\nAllocates a fresh list (`to_`-style, §1). Total: no error row, no\ntraps beyond allocation.\n\nThe example populates through the language's `m[k] = v` rather than\n`set`: a `mut`-mode call followed by an allocating read-mode call is\na false `ub(mem.ub)` under lupin's provenance model (F-0013), and a\ndoc example never ships around a bug quietly.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 1\nm[\"b\"] = 2\nvar seen = 0\nfor k in map.keys(m) { seen = seen + 1 }\nseen == 2\n```",
          "source": "std/map/map.lu",
          "line": 140,
          "tier": "core"
        },
        {
          "name": "values",
          "kind": "fn",
          "signature": "pub fn values[K, V](m: Map[K, V]) -> List[V]",
          "doc": "Every value, in the same order `keys` reports. Total: no error row,\nno traps beyond allocation.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 7\nvar total = 0\nfor v in map.values(m) { total = total + v }\ntotal == 7\n```",
          "source": "std/map/map.lu",
          "line": 158,
          "tier": "core"
        },
        {
          "name": "pairs",
          "kind": "fn",
          "signature": "pub fn pairs[K, V](m: Map[K, V]) -> List[(K, V)]",
          "doc": "Every entry as a `(key, value)` pair, in the map's iteration order —\nthe shape `for (k, v) in map.pairs(m)` destructures. Total: no error\nrow, no traps beyond allocation.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 1\nvar count = 0\nfor pair in map.pairs(m) { count = count + 1 }\ncount == 1\n```",
          "source": "std/map/map.lu",
          "line": 177,
          "tier": "core"
        },
        {
          "name": "clear",
          "kind": "fn",
          "signature": "pub fn clear[K, V](mut m: Map[K, V])",
          "doc": "Empties the map, keeping it usable. Total: no error row, no traps.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nmap.set(mut m, \"a\", 1)\nmap.clear(mut m)\nmap.is_empty(m) == true\n```",
          "source": "std/map/map.lu",
          "line": 189,
          "tier": "core"
        },
        {
          "name": "extend",
          "kind": "fn",
          "signature": "pub fn extend[K, V](mut m: Map[K, V], other: Map[K, V])",
          "doc": "Copies every entry of `other` into `m`. **Right wins**: a key present\nin both ends up bound to `other`'s value. Total: no error row, no\ntraps beyond allocation.\n\n```wolf-doc-example\nvar a = Map[str, int]()\nvar b = Map[str, int]()\nmap.set(mut a, \"k\", 1)\nmap.set(mut b, \"k\", 2)\nmap.extend(mut a, b)\nmap.len(a) == 1\n```",
          "source": "std/map/map.lu",
          "line": 205,
          "tier": "core"
        },
        {
          "name": "get",
          "kind": "fn",
          "signature": "pub fn get[K: cmp.Eq, V](m: Map[K, V], k: K) -> V ! {none}",
          "doc": "An independent copy of the value bound to `k`; `none` when the key\nis absent — the absence row, never a zero-value sentinel (§2). No\ntraps beyond allocation.\n\nReads through the language's `m[k]`, copying only the selected value\nrather than materializing an entry list or calling a trait per entry.\nLookup uses the runtime's algorithm. The absence row is handled before\ncopying, so List values do not ask native to copy a heap-bearing row.\nThe `cmp.Eq` bound stays part of the signature; its four allowed key\nimpls agree with index equality.\n`get_or` and `tally` inherit this lookup without changing their bodies.\n\nUntil sc78, this function walked `m.pairs()` (wolf-std#109). On the\ncompiler tiers a List result could alias the stored List, contrary to\n`[mem.tier0.excl.1]`; lupin already returned independent values. Copying\nthe selected value now prevents a caller's mutation from changing the\nstored value on every machine.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 1\n(map.get(m, \"a\") else 0) == 1\n(map.get(m, \"z\") else 0 - 1) == 0 - 1\n```",
          "source": "std/map/map.lu",
          "line": 235,
          "tier": "core"
        },
        {
          "name": "get_or",
          "kind": "fn",
          "signature": "pub fn get_or[K: cmp.Eq, V](m: Map[K, V], k: K, d: V) -> V",
          "doc": "An independent copy of the value bound to `k`, or of `d` when the\nkey is absent — the eager default (a lazy variant waits on closures,\nc05). Total: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 1\nmap.get_or(m, \"a\", 0) == 1\nmap.get_or(m, \"z\", 0) == 0\n```",
          "source": "std/map/map.lu",
          "line": 250,
          "tier": "core"
        },
        {
          "name": "has",
          "kind": "fn",
          "signature": "pub fn has[K: cmp.Eq, V](m: Map[K, V], k: K) -> bool",
          "doc": "Whether `k` is bound. Total: no error row, no traps.\n\nIt asks the map itself — the index read `m[k]`, whose `none` row IS\n\"absent\" (`[mem.map.absent]`) — and allocates nothing. Until sc57 this\nbody walked `m.pairs()`, which builds a fresh `List` of every entry in\nthe caller's region on every call: about 6.4 KB a call at 200 entries,\nnever freed in a long-running loop (wolf-std#54, measured on pelt's\nvariable lookups). `tests/map/has_allocates_nothing.lu` holds the\nregion's ledger at zero across a hit and a miss.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 1\nmap.has(m, \"a\") == true\nmap.has(m, \"z\") == false\n```",
          "source": "std/map/map.lu",
          "line": 270,
          "tier": "core"
        },
        {
          "name": "remove",
          "kind": "fn",
          "signature": "pub fn remove[K: cmp.Eq, V](mut m: Map[K, V], k: K) -> V ! {none}",
          "doc": "Removes `k`'s entry and returns the value it was bound to; `none`\nwhen the key was absent. No traps.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nm[\"a\"] = 1\n(map.remove(mut m, \"a\") else 0) == 1\nmap.has(m, \"a\") == false\n(map.remove(mut m, \"a\") else 0 - 1) == 0 - 1\n```\n\nDelegates to the language's `m.remove(k)` (`[type.map]`; D50 on\nwolf-lang#11, landed as wolf-lang#344), whose semantics are therefore\nthis function's contract. The erase happens in place. The survivors\nkeep their order, and a miss leaves the map unchanged. Its cost is the\nclause's: one scan to the key and a shift of the entries after it,\nwith nothing allocated and nothing freed. Until sc52 this body rebuilt\nthe whole map through `pairs()`, about N^2 entry copies to empty an\nN-entry map one key at a time. That ran past lupin's and the checked\ntier's step budgets at 3000 keys (`tests/map/remove_many.lu`), and\nthe language had shipped the erase a release earlier (B117).\nThe `[K: cmp.Eq]` bound stays, because it is the module's key\nprotocol (`[type.map.key]`) and removing it would change the signature.\nThe body no longer calls it.",
          "source": "std/map/map.lu",
          "line": 299,
          "tier": "core"
        },
        {
          "name": "tally",
          "kind": "fn",
          "signature": "pub fn tally[K: cmp.Eq](mut m: Map[K, int], k: K) -> int",
          "doc": "Increments the count `k` is bound to and returns the new count,\ntreating an absent key as zero — the wordcount idiom as a named\noperation instead of a defaulting index (`tally[w] += 1`, see the\nmodule header's filed question). Traps `overflow` when the count is\nat `int`'s maximum: arithmetic is checked in every profile (X3).\n\nThe body below is the one `[mem.map.absent]`'s E0417 note names by\nname — a reader who writes `m[k] += 1` is sent here by the compiler.\n\n```wolf-doc-example\nvar m = Map[str, int]()\nmap.tally(mut m, \"a\") == 1\nmap.tally(mut m, \"a\") == 2\n(map.get(m, \"a\") else 0) == 2\n```",
          "source": "std/map/map.lu",
          "line": 318,
          "tier": "core"
        }
      ]
    },
    {
      "name": "math",
      "group": "Numerics",
      "tier": "core",
      "doc": "std.math — integer numerics: the recoverable complements to the\nlanguage's trapping operators, plus the classical integer functions.\nStability tier: core.\n\n**The trapping operators stay the default (X3).** `a + b` is checked\nin every profile and a overflow is a bug that faults deterministically;\n`wrapping[T]` is how intended wraparound is spelled at the type. The\n`checked_*` family here is for the other case — where the OPERANDS are\ndata and an out-of-range result is an ordinary outcome the caller\nhandles (parsing, accumulating user input, bounds arithmetic). Reach\nfor `+` first; reach for `checked_add` when a miss is not a bug.\n\nThe row tags are `overflow` and `div_zero` (API-CONVENTIONS §2, the\nsc04 amendment); they are payload-free marks, so they are lowercase by\nthat section's rule and lowercase in the source below: the CapCase\ninterim every std module once rode died with F-0003 / F-0023 at the\nsc05 pins and was renamed away at sc06.\n\n**The two bounds are functions, not constants** (`int_max`,\n`int_min`). The contract asks for `INT_MIN`/`INT_MAX` constants and\nstd wants them; a `const` cannot carry them at these pins and a\n`const` of any kind costs two of the three execution lanes:\n- lupin types the literal in `-9223372036854775808` (and in\n  `0 - 9223372036854775807`) at `i32` regardless of the declared type,\n  so the initializer traps `overflow` — INT_MIN has no const spelling;\n- USING a module-level `const` is `unsupported` in wolfc's checked\n  tier, and DECLARING one is `unsupported` on the native rung\n  (\"item-initializer lowering (globals, c06)\").\nTwo total zero-argument functions cost one pair of parentheses and\nkeep all three lanes. Filed as F-0025; the constants land with it.\n\nNon-targets recorded for the nursery clock (report 07): no generic\nnumeric tower, no operator traits, no bigint/decimal/complex, no\nstatistics. Unsigned integers have their own op-set question and this\nmodule is signed-`int` only.",
      "summary": "std.math — integer numerics: the recoverable complements to the language's trapping operators, plus the classical integer functions.",
      "items": [
        {
          "name": "int_max",
          "kind": "fn",
          "signature": "pub fn int_max() -> int",
          "doc": "The greatest value of type `int` (2^63 - 1). Total: no error row, no\ntraps. See the module header for why this is a function.\n\n```wolf-doc-example\nmath.int_max() == 9223372036854775807\nmath.int_max() > 0\n```",
          "source": "std/math/math.lu",
          "line": 46,
          "tier": "core"
        },
        {
          "name": "int_min",
          "kind": "fn",
          "signature": "pub fn int_min() -> int",
          "doc": "The least value of type `int` (-2^63). Total: no error row, no traps.\nSee the module header for why this is a function — and note the\ninitializer's shape: the typed zero is what keeps the literal at\n`int` (F-0025).\n\n```wolf-doc-example\nlet zero: int = 0\nmath.int_min() == zero - 9223372036854775807 - 1\nmath.int_min() < 0\n```",
          "source": "std/math/math.lu",
          "line": 60,
          "tier": "core"
        },
        {
          "name": "abs",
          "kind": "fn",
          "signature": "pub fn abs(n: int) -> int",
          "doc": "Absolute value. Traps `overflow` on `int_min()`, whose magnitude is\nnot an `int` — a checked-arithmetic fault (X3), the same one `0 - n`\nraises, and the reason `abs` has no error row: the caller who could\nnot have known has one value to check.\n\n```wolf-doc-example\nmath.abs(5) == 5\nmath.abs(-5) == 5\nmath.abs(0) == 0\n```",
          "source": "std/math/math.lu",
          "line": 75,
          "tier": "core"
        },
        {
          "name": "signum",
          "kind": "fn",
          "signature": "pub fn signum(n: int) -> int",
          "doc": "The sign of `n`: `-1`, `0` or `1`. Total: no error row, no traps.\n\n```wolf-doc-example\nmath.signum(7) == 1\nmath.signum(-7) == -1\nmath.signum(0) == 0\n```",
          "source": "std/math/math.lu",
          "line": 89,
          "tier": "core"
        },
        {
          "name": "pow",
          "kind": "fn",
          "signature": "pub fn pow(b: int, e: int) -> int",
          "doc": "`b` raised to the `e`th power by binary exponentiation. Traps\n`overflow` when the result (or an intermediate square) leaves `int` —\nthe ordinary checked-arithmetic fault, since `pow` multiplies with\n`*`. Traps `assert` on a negative exponent: an integer power of a\nnegative exponent is not an integer, so the caller's contract is\nbroken rather than the value's (§2's trap rule).\n\n`pow(b, 0)` is 1 for every `b`, `0` included.\n\n```wolf-doc-example\nmath.pow(2, 10) == 1024\nmath.pow(2, 0) == 1\nmath.pow(-3, 3) == -27\nmath.pow(0, 0) == 1\n```",
          "source": "std/math/math.lu",
          "line": 114,
          "tier": "core"
        },
        {
          "name": "isqrt",
          "kind": "fn",
          "signature": "pub fn isqrt(n: int) -> int",
          "doc": "The integer square root: the greatest `r` with `r * r <= n`. Traps\n`assert` on a negative `n` (no real root — a caller contract\nviolation). Total on every non-negative `int`, `int_max()` included:\nthe Newton iteration only ever divides, so no intermediate overflows.\n\n```wolf-doc-example\nmath.isqrt(0) == 0\nmath.isqrt(1) == 1\nmath.isqrt(15) == 3\nmath.isqrt(16) == 4\nmath.isqrt(9223372036854775807) == 3037000499\n```",
          "source": "std/math/math.lu",
          "line": 145,
          "tier": "core"
        },
        {
          "name": "gcd",
          "kind": "fn",
          "signature": "pub fn gcd(a: int, b: int) -> int",
          "doc": "The greatest common divisor of `|a|` and `|b|`, by Euclid. `gcd(0, 0)`\nis 0 and `gcd(0, b)` is `|b|`. Traps `overflow` when either argument\nis `int_min()` (it takes absolute values — see `abs`).\n\n```wolf-doc-example\nmath.gcd(12, 18) == 6\nmath.gcd(-12, 18) == 6\nmath.gcd(0, 5) == 5\nmath.gcd(0, 0) == 0\nmath.gcd(17, 5) == 1\n```",
          "source": "std/math/math.lu",
          "line": 174,
          "tier": "core"
        },
        {
          "name": "lcm",
          "kind": "fn",
          "signature": "pub fn lcm(a: int, b: int) -> int",
          "doc": "The least common multiple of `|a|` and `|b|`; 0 when either is 0.\nTraps `overflow` when the multiple leaves `int` (checked `*`), and\nwhen either argument is `int_min()` (see `abs`).\n\n```wolf-doc-example\nmath.lcm(4, 6) == 12\nmath.lcm(0, 5) == 0\nmath.lcm(-4, 6) == 12\nmath.lcm(7, 7) == 7\n```",
          "source": "std/math/math.lu",
          "line": 195,
          "tier": "core"
        },
        {
          "name": "div_floor",
          "kind": "fn",
          "signature": "pub fn div_floor(a: int, b: int) -> int",
          "doc": "Division rounding toward negative infinity — the mathematician's\nquotient, unlike `/`, which truncates toward zero. Traps `div-zero`\nwhen `b` is 0 and `overflow` on `div_floor(int_min(), -1)`, both\ninherited from the language's checked `/` (X3).\n\n```wolf-doc-example\nmath.div_floor(7, 2) == 3\nmath.div_floor(-7, 2) == -4\nmath.div_floor(7, -2) == -4\nmath.div_floor(-7, -2) == 3\nmath.div_floor(6, 3) == 2\n```",
          "source": "std/math/math.lu",
          "line": 218,
          "tier": "core"
        },
        {
          "name": "div_ceil",
          "kind": "fn",
          "signature": "pub fn div_ceil(a: int, b: int) -> int",
          "doc": "Division rounding toward positive infinity. Traps `div-zero` when `b`\nis 0 and `overflow` on `div_ceil(int_min(), -1)`.\n\n```wolf-doc-example\nmath.div_ceil(7, 2) == 4\nmath.div_ceil(-7, 2) == -3\nmath.div_ceil(7, -2) == -3\nmath.div_ceil(-7, -2) == 4\nmath.div_ceil(6, 3) == 2\n```",
          "source": "std/math/math.lu",
          "line": 244,
          "tier": "core"
        },
        {
          "name": "rem_euclid",
          "kind": "fn",
          "signature": "pub fn rem_euclid(a: int, b: int) -> int",
          "doc": "The Euclidean remainder: always in `[0, |b|)`, unlike `%`, whose sign\nfollows the dividend. Traps `div-zero` when `b` is 0.\n\n```wolf-doc-example\nmath.rem_euclid(7, 3) == 1\nmath.rem_euclid(-7, 3) == 2\nmath.rem_euclid(7, -3) == 1\nmath.rem_euclid(-7, -3) == 2\n```",
          "source": "std/math/math.lu",
          "line": 269,
          "tier": "core"
        },
        {
          "name": "checked_add",
          "kind": "fn",
          "signature": "pub fn checked_add(a: int, b: int) -> int ! {overflow}",
          "doc": "`a + b`, or the `overflow` mark when the sum leaves `int`. The\nrecoverable complement of `+`: same operands, no trap. Total — it\nnever performs the operation it is asked to check.\n\n```wolf-doc-example\n(math.checked_add(2, 3) else 0) == 5\n(math.checked_add(math.int_max(), 1) else -1) == -1\n(math.checked_add(math.int_min(), -1) else -1) == -1\n(math.checked_add(math.int_max(), -1) else 0) == 9223372036854775806\n```",
          "source": "std/math/math.lu",
          "line": 290,
          "tier": "core"
        },
        {
          "name": "checked_sub",
          "kind": "fn",
          "signature": "pub fn checked_sub(a: int, b: int) -> int ! {overflow}",
          "doc": "`a - b`, or the `overflow` mark when the difference leaves `int`.\n\n```wolf-doc-example\n(math.checked_sub(5, 3) else 0) == 2\n(math.checked_sub(math.int_min(), 1) else 0) == 0\n(math.checked_sub(math.int_max(), -1) else 0) == 0\n(math.checked_sub(0, math.int_min()) else 0) == 0\n```",
          "source": "std/math/math.lu",
          "line": 312,
          "tier": "core"
        },
        {
          "name": "checked_mul",
          "kind": "fn",
          "signature": "pub fn checked_mul(a: int, b: int) -> int ! {overflow}",
          "doc": "`a * b`, or the `overflow` mark when the product leaves `int`. The\nfour sign cases are checked by division, so nothing here can trap.\n\n```wolf-doc-example\n(math.checked_mul(6, 7) else 0) == 42\n(math.checked_mul(-6, 7) else 0) == -42\n(math.checked_mul(math.int_max(), 2) else 0) == 0\n(math.checked_mul(math.int_min(), -1) else 0) == 0\n(math.checked_mul(0, math.int_min()) else -1) == 0\n```",
          "source": "std/math/math.lu",
          "line": 336,
          "tier": "core"
        },
        {
          "name": "checked_div",
          "kind": "fn",
          "signature": "pub fn checked_div(a: int, b: int) -> int ! {div_zero}",
          "doc": "`a / b` truncating toward zero, or the `div_zero` mark when `b` is 0.\nThe one fault it does NOT recover is `checked_div(int_min(), -1)`,\nwhose quotient leaves `int`: that traps `overflow`, because the row\nthis signature carries is about the divisor, not the range (the\ncontract's choice, and the caller who divides by a possibly-`-1`\ndivisor can ask `checked_mul` first).\n\n```wolf-doc-example\n(math.checked_div(7, 2) else 0) == 3\n(math.checked_div(-7, 2) else 0) == -3\n(math.checked_div(1, 0) else -99) == -99\n(math.checked_div(0, 5) else -1) == 0\n```",
          "source": "std/math/math.lu",
          "line": 399,
          "tier": "core"
        },
        {
          "name": "saturating_add",
          "kind": "fn",
          "signature": "pub fn saturating_add(a: int, b: int) -> int",
          "doc": "`a + b`, clamped to `[int_min(), int_max()]` instead of trapping.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nmath.saturating_add(2, 3) == 5\nmath.saturating_add(math.int_max(), 1) == math.int_max()\nmath.saturating_add(math.int_min(), -1) == math.int_min()\nmath.saturating_add(math.int_max(), math.int_min()) == -1\n```",
          "source": "std/math/math.lu",
          "line": 415,
          "tier": "core"
        },
        {
          "name": "saturating_sub",
          "kind": "fn",
          "signature": "pub fn saturating_sub(a: int, b: int) -> int",
          "doc": "`a - b`, clamped to `[int_min(), int_max()]` instead of trapping.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nmath.saturating_sub(5, 3) == 2\nmath.saturating_sub(math.int_min(), 1) == math.int_min()\nmath.saturating_sub(math.int_max(), -1) == math.int_max()\nmath.saturating_sub(0, math.int_min()) == math.int_max()\n```",
          "source": "std/math/math.lu",
          "line": 438,
          "tier": "core"
        },
        {
          "name": "midpoint",
          "kind": "fn",
          "signature": "pub fn midpoint(a: int, b: int) -> int",
          "doc": "The midpoint of `a` and `b`, rounded toward negative infinity, with\nno intermediate that can leave `int` — `(a + b) / 2` overflows for\nlarge same-sign pairs and this does not. Total: no error row, no\ntraps.\n\nThe halves-and-remainders shape (rather than the bit-twiddling\n`(a & b) + ((a ^ b) >> 1)`) is deliberate: `&`, `^` and `>>` are\n`unsupported` in wolfc's checked tier at this pin, and the arithmetic\nspelling costs nothing and runs on every lane (F-0026).\n\n```wolf-doc-example\nmath.midpoint(1, 3) == 2\nmath.midpoint(1, 2) == 1\nmath.midpoint(-1, -2) == -2\nmath.midpoint(math.int_max(), math.int_max()) == math.int_max()\nmath.midpoint(math.int_min(), math.int_max()) == -1\n```",
          "source": "std/math/math.lu",
          "line": 469,
          "tier": "core"
        }
      ]
    },
    {
      "name": "math.float",
      "group": "Numerics",
      "tier": "core",
      "doc": "std.math.float — floating-point numerics over `f64`: predicates,\ndecomposition, rounding, and the transcendentals. Stability tier: core.\n\n**The pure-wolf decision (sc04's Target 2, D31 applied).** Every\nfunction here is implemented in ordinary wolf — range reduction plus\npolynomial evaluation — and NOT delegated to a platform libm. The\nreason is differential testability: a libm binding would make\n`sin(1.0)` mean whatever the host's C library means, which no\ninterpreter can reproduce bit-for-bit and no two operating systems\nneed agree on. Pure wolf makes the answer a property of the SOURCE:\nevery implementation that evaluates IEEE-754 binary64 arithmetic\ncorrectly gets the same bits, and the tests pin those bits as exact\nliterals. The accuracy contract below is the price, and it is stated\nper function rather than assumed.\n\n**The accuracy contract.** Every algebraic and transcendental\nfunction documents a bound in ulp (units in the last place of the\ncorrectly rounded result), measured over the pinned reference set in\n`tests/ulp/reference.toml` and enforced by `cargo xtask ulp`. The\nbound is a measurement, not an aspiration: where a function does not\nreach 2 ulp on some input class, the function says so. Faithful\nrounding (≤ 1 ulp) is NOT claimed anywhere, and correctly-rounded\n(≤ 0.5 ulp) is not a v1 promise for any transcendental — the s37\nintrinsics layer is where a hardware `sqrt` and friends would earn\nthose, and this source stays the semantic reference either way\n(F-0028).\n\n**Why the constants are functions.** `pi()`, `nan()`, `f_max()` and\nthe rest would be `const` items; a module-level `const` is\n`unsupported` when USED under wolfc's checked tier and when DECLARED\non the native rung, and the native rung is the only compiler-side\nlane that executes float code at all (the checked tier refuses float\nliterals outright). Constants-as-functions keep the whole module\nexecuting on two implementations. Filed as F-0025.\n\n**Never write `x != y` on floats in this module.** The native backend\nlowers `!=` on `f64` to an ORDERED comparison, so `nan != nan` is\nfalse there and true everywhere else (F-0027). Every inequality here\nis spelled `!(x == y)`, which agrees on all three lanes.\n\nNot here, by contract: float parsing and printing (sc05 owns the\ndecimal boundary; this module ships only the binary `to_bits`\ncurrency), statistics, complex, decimal, and any SIMD or intrinsic\nfast path.",
      "summary": "std.math.float — floating-point numerics over `f64`: predicates, decomposition, rounding, and the transcendentals.",
      "items": [
        {
          "name": "pi",
          "kind": "fn",
          "signature": "pub fn pi() -> f64",
          "doc": "π, the ratio of a circle's circumference to its diameter, rounded to\nthe nearest `f64`. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.pi() == 3.141592653589793\nfloat.pi() > 3.14\n```",
          "source": "std/math/float/float.lu",
          "line": 55,
          "tier": "core"
        },
        {
          "name": "tau",
          "kind": "fn",
          "signature": "pub fn tau() -> f64",
          "doc": "τ = 2π. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.tau() == 6.283185307179586\nfloat.tau() == float.pi() * 2.0\n```",
          "source": "std/math/float/float.lu",
          "line": 65,
          "tier": "core"
        },
        {
          "name": "e",
          "kind": "fn",
          "signature": "pub fn e() -> f64",
          "doc": "Euler's number, the base of the natural logarithm. Total: no error\nrow, no traps.\n\n```wolf-doc-example\nfloat.e() == 2.718281828459045\nfloat.e() > 2.7\n```",
          "source": "std/math/float/float.lu",
          "line": 76,
          "tier": "core"
        },
        {
          "name": "inf",
          "kind": "fn",
          "signature": "pub fn inf() -> f64",
          "doc": "Positive infinity. Total: no error row, no traps — float division by\nzero is IEEE, not the checked-arithmetic fault X3 gives integers.\n\n```wolf-doc-example\nfloat.inf() > 1.0e308\nfloat.inf() == 1.0 / 0.0\n```",
          "source": "std/math/float/float.lu",
          "line": 87,
          "tier": "core"
        },
        {
          "name": "neg_inf",
          "kind": "fn",
          "signature": "pub fn neg_inf() -> f64",
          "doc": "Negative infinity. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.neg_inf() < -1.0e308\nfloat.neg_inf() == -float.inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 97,
          "tier": "core"
        },
        {
          "name": "nan",
          "kind": "fn",
          "signature": "pub fn nan() -> f64",
          "doc": "A quiet NaN. Total: no error row, no traps. NaN is the one `f64`\nunequal to itself — probe it with `is_nan`, never with `==`.\n\n```wolf-doc-example\nfloat.is_nan(float.nan()) == true\nfloat.is_nan(0.0) == false\n```",
          "source": "std/math/float/float.lu",
          "line": 108,
          "tier": "core"
        },
        {
          "name": "epsilon",
          "kind": "fn",
          "signature": "pub fn epsilon() -> f64",
          "doc": "The difference between 1.0 and the next representable `f64` (2^-52).\nTotal: no error row, no traps.\n\n```wolf-doc-example\nfloat.epsilon() == 2.220446049250313e-16\n1.0 + float.epsilon() > 1.0\n```",
          "source": "std/math/float/float.lu",
          "line": 119,
          "tier": "core"
        },
        {
          "name": "f_min",
          "kind": "fn",
          "signature": "pub fn f_min() -> f64",
          "doc": "The least finite `f64` — the most negative one, not the smallest\npositive one (that is `f_min_positive`, a nursery candidate this\nmodule names and does not ship). Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.f_min() == -float.f_max()\nfloat.f_min() < -1.0e308\n```",
          "source": "std/math/float/float.lu",
          "line": 131,
          "tier": "core"
        },
        {
          "name": "f_max",
          "kind": "fn",
          "signature": "pub fn f_max() -> f64",
          "doc": "The greatest finite `f64`. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.f_max() == 1.7976931348623157e308\nfloat.f_max() < float.inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 141,
          "tier": "core"
        },
        {
          "name": "is_nan",
          "kind": "fn",
          "signature": "pub fn is_nan(x: f64) -> bool",
          "doc": "True exactly for NaN. Total: no error row, no traps.\n\nThe body is `!(x == x)` rather than the textbook `x != x`: see the\nmodule header (F-0027).\n\n```wolf-doc-example\nfloat.is_nan(0.0 / 0.0) == true\nfloat.is_nan(1.0) == false\nfloat.is_nan(float.inf()) == false\n```",
          "source": "std/math/float/float.lu",
          "line": 155,
          "tier": "core"
        },
        {
          "name": "is_inf",
          "kind": "fn",
          "signature": "pub fn is_inf(x: f64) -> bool",
          "doc": "True for either infinity. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.is_inf(float.inf()) == true\nfloat.is_inf(float.neg_inf()) == true\nfloat.is_inf(1.0e308) == false\nfloat.is_inf(float.nan()) == false\n```",
          "source": "std/math/float/float.lu",
          "line": 167,
          "tier": "core"
        },
        {
          "name": "is_finite",
          "kind": "fn",
          "signature": "pub fn is_finite(x: f64) -> bool",
          "doc": "True for everything that is neither NaN nor an infinity. Total: no\nerror row, no traps.\n\n```wolf-doc-example\nfloat.is_finite(1.0) == true\nfloat.is_finite(0.0) == true\nfloat.is_finite(float.inf()) == false\nfloat.is_finite(float.nan()) == false\n```",
          "source": "std/math/float/float.lu",
          "line": 183,
          "tier": "core"
        },
        {
          "name": "is_sign_negative",
          "kind": "fn",
          "signature": "pub fn is_sign_negative(x: f64) -> bool",
          "doc": "True when `x` carries a negative sign bit — which includes `-0.0`,\nthe value `x < 0.0` cannot see. NaN's sign is not observable at these\npins and answers false. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.is_sign_negative(-1.0) == true\nfloat.is_sign_negative(-0.0) == true\nfloat.is_sign_negative(0.0) == false\nfloat.is_sign_negative(1.0) == false\n```",
          "source": "std/math/float/float.lu",
          "line": 200,
          "tier": "core"
        },
        {
          "name": "abs",
          "kind": "fn",
          "signature": "pub fn abs(x: f64) -> f64",
          "doc": "Magnitude. `abs(-0.0)` is `+0.0` and `abs(NaN)` is NaN. Total: no\nerror row, no traps.\n\n```wolf-doc-example\nfloat.abs(-2.5) == 2.5\nfloat.abs(2.5) == 2.5\nfloat.abs(-0.0) == 0.0\nfloat.is_sign_negative(float.abs(-0.0)) == false\n```",
          "source": "std/math/float/float.lu",
          "line": 224,
          "tier": "core"
        },
        {
          "name": "signum",
          "kind": "fn",
          "signature": "pub fn signum(x: f64) -> f64",
          "doc": "The sign of `x` as a float: `1.0`, `-1.0`, the zero itself for `±0.0`\n(sign preserved), and NaN for NaN. Total: no error row, no traps.\n\nThe zero and NaN answers are the documented choice: `signum` is\nsign EXTRACTION, and a zero's sign is a zero's, not a one's.\n\n```wolf-doc-example\nfloat.signum(3.0) == 1.0\nfloat.signum(-3.0) == -1.0\nfloat.signum(0.0) == 0.0\nfloat.is_nan(float.signum(float.nan())) == true\n```",
          "source": "std/math/float/float.lu",
          "line": 251,
          "tier": "core"
        },
        {
          "name": "copysign",
          "kind": "fn",
          "signature": "pub fn copysign(x: f64, y: f64) -> f64",
          "doc": "`x` with the sign of `y`. `copysign(3.0, -0.0)` is `-3.0`: the sign\nof a zero counts. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.copysign(3.0, -1.0) == -3.0\nfloat.copysign(-3.0, 1.0) == 3.0\nfloat.copysign(3.0, -0.0) == -3.0\nfloat.copysign(-0.0, 1.0) == 0.0\n```",
          "source": "std/math/float/float.lu",
          "line": 273,
          "tier": "core"
        },
        {
          "name": "trunc",
          "kind": "fn",
          "signature": "pub fn trunc(x: f64) -> f64",
          "doc": "Truncation toward zero: the integral part, with the sign of `x`\n(`trunc(-0.5)` is `-0.0`). Infinities and NaN pass through. Total: no\nerror row, no traps.\n\n```wolf-doc-example\nfloat.trunc(2.7) == 2.0\nfloat.trunc(-2.7) == -2.0\nfloat.trunc(2.0) == 2.0\nfloat.trunc(0.5) == 0.0\n```",
          "source": "std/math/float/float.lu",
          "line": 291,
          "tier": "core"
        },
        {
          "name": "floor",
          "kind": "fn",
          "signature": "pub fn floor(x: f64) -> f64",
          "doc": "The greatest integer at or below `x`. Infinities and NaN pass\nthrough. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.floor(2.7) == 2.0\nfloat.floor(-2.7) == -3.0\nfloat.floor(2.0) == 2.0\nfloat.floor(-0.5) == -1.0\n```",
          "source": "std/math/float/float.lu",
          "line": 327,
          "tier": "core"
        },
        {
          "name": "ceil",
          "kind": "fn",
          "signature": "pub fn ceil(x: f64) -> f64",
          "doc": "The least integer at or above `x`. `ceil(-0.5)` is `-0.0`.\nInfinities and NaN pass through. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.ceil(2.1) == 3.0\nfloat.ceil(-2.1) == -2.0\nfloat.ceil(2.0) == 2.0\nfloat.ceil(0.5) == 1.0\n```",
          "source": "std/math/float/float.lu",
          "line": 346,
          "tier": "core"
        },
        {
          "name": "round",
          "kind": "fn",
          "signature": "pub fn round(x: f64) -> f64",
          "doc": "Rounds to the nearest integer, **halves away from zero** — the\nschoolbook rule, not the banker's rounding IEEE arithmetic itself\nuses. `round(0.5)` is `1.0` and `round(-0.5)` is `-1.0`, where\nround-half-to-even would answer `0.0` and `-0.0`. Infinities and NaN\npass through. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.round(0.5) == 1.0\nfloat.round(-0.5) == -1.0\nfloat.round(2.5) == 3.0\nfloat.round(2.4) == 2.0\nfloat.round(-2.6) == -3.0\n```",
          "source": "std/math/float/float.lu",
          "line": 369,
          "tier": "core"
        },
        {
          "name": "fract",
          "kind": "fn",
          "signature": "pub fn fract(x: f64) -> f64",
          "doc": "The fractional part: `x - trunc(x)`, carrying the sign of `x`.\n`fract` of an infinity is NaN (infinity has no fractional part to\nname), and NaN passes through. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.fract(2.75) == 0.75\nfloat.fract(-2.75) == -0.75\nfloat.fract(3.0) == 0.0\nfloat.is_nan(float.fract(float.inf())) == true\n```",
          "source": "std/math/float/float.lu",
          "line": 398,
          "tier": "core"
        },
        {
          "name": "sqrt",
          "kind": "fn",
          "signature": "pub fn sqrt(x: f64) -> f64",
          "doc": "The positive square root. `sqrt` of a negative number is NaN, of\n`±0.0` is that zero, of `+inf` is `+inf`, of NaN is NaN.\n\nAccuracy: **≤ 1 ulp** over the reference set — five Newton steps from\na linear seed on the reduced argument, with the power-of-four scaling\nexact. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.sqrt(4.0) == 2.0\nfloat.sqrt(0.0) == 0.0\nfloat.sqrt(1.0) == 1.0\nfloat.is_nan(float.sqrt(-1.0)) == true\nfloat.sqrt(float.inf()) == float.inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 442,
          "tier": "core"
        },
        {
          "name": "cbrt",
          "kind": "fn",
          "signature": "pub fn cbrt(x: f64) -> f64",
          "doc": "The real cube root, defined for negative arguments too (unlike\n`powf(x, 1.0 / 3.0)`). `cbrt(±0.0)` is that zero, `cbrt(±inf)` is\nthat infinity, `cbrt(NaN)` is NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.cbrt(8.0) == 2.0\nfloat.cbrt(-8.0) == -2.0\nfloat.cbrt(0.0) == 0.0\nfloat.cbrt(1.0) == 1.0\n```",
          "source": "std/math/float/float.lu",
          "line": 489,
          "tier": "core"
        },
        {
          "name": "hypot",
          "kind": "fn",
          "signature": "pub fn hypot(a: f64, b: f64) -> f64",
          "doc": "`sqrt(a*a + b*b)` computed without the intermediate overflow the\nliteral formula suffers. `hypot` of an infinity is `+inf` even when\nthe other argument is NaN (IEEE's rule: the magnitude is already\nknown).\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.hypot(3.0, 4.0) == 5.0\nfloat.hypot(0.0, 0.0) == 0.0\nfloat.hypot(-3.0, -4.0) == 5.0\nfloat.hypot(float.inf(), float.nan()) == float.inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 540,
          "tier": "core"
        },
        {
          "name": "exp",
          "kind": "fn",
          "signature": "pub fn exp(x: f64) -> f64",
          "doc": "e raised to the power `x`. `exp(-inf)` is `0.0`, `exp(+inf)` is\n`+inf`, `exp(NaN)` is NaN; arguments above about 709.78 overflow to\n`+inf` and below about -745.13 underflow to `0.0`, exactly as the\nrange demands.\n\nAccuracy: **≤ 2 ulp** over the reference set, subnormal results\nincluded — the final scaling is staged so that a subnormal answer\nrounds once rather than once per halving (`scale2`). Total: no error\nrow, no traps.\n\n```wolf-doc-example\nfloat.exp(0.0) == 1.0\nfloat.exp(1.0) == 2.7182818284590455\nfloat.exp(float.neg_inf()) == 0.0\nfloat.exp(float.inf()) == float.inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 584,
          "tier": "core"
        },
        {
          "name": "exp2",
          "kind": "fn",
          "signature": "pub fn exp2(x: f64) -> f64",
          "doc": "`2.0` raised to the power `x`, exact at every integral `x` in range.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.exp2(0.0) == 1.0\nfloat.exp2(10.0) == 1024.0\nfloat.exp2(-1.0) == 0.5\nfloat.exp2(0.5) == 1.414213562373095\n```",
          "source": "std/math/float/float.lu",
          "line": 648,
          "tier": "core"
        },
        {
          "name": "ln",
          "kind": "fn",
          "signature": "pub fn ln(x: f64) -> f64",
          "doc": "The natural logarithm. `ln(0.0)` is `-inf`, `ln` of a negative number\nis NaN, `ln(+inf)` is `+inf`, `ln(1.0)` is exactly `0.0`.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.ln(1.0) == 0.0\nfloat.ln(float.e()) == 1.0\nfloat.ln(0.0) == float.neg_inf()\nfloat.is_nan(float.ln(-1.0)) == true\n```",
          "source": "std/math/float/float.lu",
          "line": 684,
          "tier": "core"
        },
        {
          "name": "log2",
          "kind": "fn",
          "signature": "pub fn log2(x: f64) -> f64",
          "doc": "The base-2 logarithm, exact at every power of two. `log2(0.0)` is\n`-inf` and `log2` of a negative number is NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.log2(1.0) == 0.0\nfloat.log2(8.0) == 3.0\nfloat.log2(0.5) == -1.0\nfloat.log2(0.0) == float.neg_inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 751,
          "tier": "core"
        },
        {
          "name": "log10",
          "kind": "fn",
          "signature": "pub fn log10(x: f64) -> f64",
          "doc": "The base-10 logarithm. `log10(0.0)` is `-inf` and `log10` of a\nnegative number is NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set. Exactness at powers of\nten is NOT promised — `log10(1000.0)` is the correctly rounded\nneighbour of 3, not 3 — because the base-ten exponent is not a term\nthis reduction can separate. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.log10(1.0) == 0.0\nfloat.log10(10.0) == 1.0\nfloat.log10(0.0) == float.neg_inf()\nfloat.log10(100.0) == 2.0\n```",
          "source": "std/math/float/float.lu",
          "line": 785,
          "tier": "core"
        },
        {
          "name": "sin",
          "kind": "fn",
          "signature": "pub fn sin(x: f64) -> f64",
          "doc": "The sine of `x` in radians. NaN in, NaN out; an infinite argument has\nno meaningful sine and answers NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set for |x| ≤ 2^20. Beyond\nthat the three-piece argument reduction runs out of bits and the\nerror grows with |x| — the documented limit, not a hidden one.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nfloat.sin(0.0) == 0.0\nfloat.sin(1.0) == 0.8414709848078965\nfloat.is_nan(float.sin(float.inf())) == true\nfloat.abs(float.sin(float.pi())) < 1.0e-15\n```",
          "source": "std/math/float/float.lu",
          "line": 868,
          "tier": "core"
        },
        {
          "name": "cos",
          "kind": "fn",
          "signature": "pub fn cos(x: f64) -> f64",
          "doc": "The cosine of `x` in radians. NaN in, NaN out; an infinite argument\nanswers NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set for |x| ≤ 2^20, with the\nsame reduction limit `sin` documents. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.cos(0.0) == 1.0\nfloat.cos(1.0) == 0.5403023058681398\nfloat.is_nan(float.cos(float.inf())) == true\nfloat.cos(-1.0) == float.cos(1.0)\n```",
          "source": "std/math/float/float.lu",
          "line": 904,
          "tier": "core"
        },
        {
          "name": "tan",
          "kind": "fn",
          "signature": "pub fn tan(x: f64) -> f64",
          "doc": "The tangent of `x` in radians, as `sin(x) / cos(x)` over one shared\nreduction. NaN in, NaN out; an infinite argument answers NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set. The quotient inherits\nboth polynomials' error, and near a pole the cancellation in `cos` is\ngenuine — the reference set includes `tan(pi/2)`, whose enormous\nanswer is the correctly rounded one for the argument actually given.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nfloat.tan(0.0) == 0.0\nfloat.tan(1.0) == 1.557407724654902\nfloat.is_nan(float.tan(float.inf())) == true\nfloat.abs(float.tan(float.pi() * 0.25) - 1.0) < 1.0e-15\n```",
          "source": "std/math/float/float.lu",
          "line": 940,
          "tier": "core"
        },
        {
          "name": "atan",
          "kind": "fn",
          "signature": "pub fn atan(x: f64) -> f64",
          "doc": "The arctangent, in `[-pi/2, pi/2]`. `atan(±inf)` is `±pi/2`, NaN in\nNaN out.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.atan(0.0) == 0.0\nfloat.atan(1.0) == 0.7853981633974483\nfloat.atan(-1.0) == -0.7853981633974483\nfloat.atan(float.inf()) == 1.5707963267948966\n```",
          "source": "std/math/float/float.lu",
          "line": 1014,
          "tier": "core"
        },
        {
          "name": "asin",
          "kind": "fn",
          "signature": "pub fn asin(x: f64) -> f64",
          "doc": "The arcsine, in `[-pi/2, pi/2]`. An argument outside `[-1, 1]` is\nNaN — the value has no real arcsine, and a row would make every\ncaller of a total function handle a case the domain already states.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.asin(0.0) == 0.0\nfloat.asin(1.0) == 1.5707963267948966\nfloat.asin(-1.0) == -1.5707963267948966\nfloat.is_nan(float.asin(2.0)) == true\n```",
          "source": "std/math/float/float.lu",
          "line": 1047,
          "tier": "core"
        },
        {
          "name": "acos",
          "kind": "fn",
          "signature": "pub fn acos(x: f64) -> f64",
          "doc": "The arccosine, in `[0, pi]`. An argument outside `[-1, 1]` is NaN.\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.acos(1.0) == 0.0\nfloat.acos(0.0) == 1.5707963267948966\nfloat.acos(-1.0) == 3.141592653589793\nfloat.is_nan(float.acos(-2.0)) == true\n```",
          "source": "std/math/float/float.lu",
          "line": 1090,
          "tier": "core"
        },
        {
          "name": "atan2",
          "kind": "fn",
          "signature": "pub fn atan2(y: f64, x: f64) -> f64",
          "doc": "The angle of the point `(x, y)` from the positive x-axis, in\n`(-pi, pi]`, with the quadrant taken from both signs. The IEEE\nspecial cases are all here and all documented by the tests: NaN in\neither argument gives NaN; `atan2(±0.0, +x)` is `±0.0`;\n`atan2(±0.0, -x)` is `±pi`; both infinite gives the diagonal\n(`±pi/4`, `±3pi/4`).\n\nAccuracy: **≤ 2 ulp** over the reference set. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nfloat.atan2(0.0, 1.0) == 0.0\nfloat.atan2(1.0, 1.0) == 0.7853981633974483\nfloat.atan2(1.0, 0.0) == 1.5707963267948966\nfloat.atan2(0.0, -1.0) == 3.141592653589793\nfloat.atan2(-1.0, -1.0) == -2.356194490192345\n```",
          "source": "std/math/float/float.lu",
          "line": 1126,
          "tier": "core"
        },
        {
          "name": "powf",
          "kind": "fn",
          "signature": "pub fn powf(b: f64, e: f64) -> f64",
          "doc": "`b` raised to the real power `e`, as `exp(e * ln b)` with the sign\nand the special cases handled first. A negative base is legal only\nfor an integral exponent (the real power is undefined otherwise) and\nanswers NaN if the exponent is not integral.\n\nThe IEEE special cases this follows: `powf(x, 0.0)` is `1.0` for\nevery `x`, NaN included; `powf(1.0, y)` is `1.0` for every `y`;\n`powf(0.0, y)` is `0.0` for positive `y` and `+inf` for negative `y`.\n\nAccuracy: **≤ 4 ulp** over the reference set. An integral exponent of\nmagnitude at most 4096 takes the binary-exponentiation path and is\nexact wherever the answer is (`powf(10.0, 3.0)` is 1000.0,\n`powf(2.0, 100.0)` is the exact power); every other exponent goes\nthrough `exp(e * ln b)`, whose error is `ln b`'s multiplied by `e` —\nso the bound degrades with |e·ln b| and the docs say so rather than\npretending otherwise. Total: no error row, no traps.\n\n```wolf-doc-example\nfloat.powf(2.0, 10.0) == 1024.0\nfloat.powf(4.0, 0.5) == 2.0\nfloat.powf(2.0, 0.0) == 1.0\nfloat.powf(-2.0, 3.0) == -8.0\nfloat.is_nan(float.powf(-2.0, 0.5)) == true\n```",
          "source": "std/math/float/float.lu",
          "line": 1210,
          "tier": "core"
        },
        {
          "name": "to_bits",
          "kind": "fn",
          "signature": "pub fn to_bits(x: f64) -> int",
          "doc": "The IEEE-754 binary64 encoding of `x`, read as a signed `int`: the\nsign bit lands in the sign of the result, so a negative float has a\nnegative encoding and `from_bits` inverts it exactly. This is the\nexactness currency — two floats are the same value exactly when\ntheir bits agree, which `==` cannot say for NaN and says wrongly for\n`-0.0`.\n\nEvery NaN answers one canonical encoding (`0x7FF8000000000000` read\nas an `int`): NaN payloads and sign are not observable at these pins,\nthe same approximation `std.cmp.total_cmp` documents. Total: no error\nrow, no traps.\n\n```wolf-doc-example\nlet zero: int = 0\nfloat.to_bits(0.0) == 0\nfloat.to_bits(1.0) == 4607182418800017408\nfloat.to_bits(2.0) == 4611686018427387904\nfloat.to_bits(-2.0) == zero - 4611686018427387904\nfloat.to_bits(-0.0) < 0\n```",
          "source": "std/math/float/float.lu",
          "line": 1347,
          "tier": "core"
        },
        {
          "name": "from_bits",
          "kind": "fn",
          "signature": "pub fn from_bits(b: int) -> f64",
          "doc": "The `f64` whose IEEE-754 binary64 encoding, read as a signed `int`,\nis `b` — the inverse of `to_bits` on every finite value and on the\ninfinities. Every NaN encoding answers `nan()`, matching `to_bits`'s\none canonical NaN.\n\nTotal: no error row, no traps — every `int` is some float's encoding.\n\n```wolf-doc-example\nlet zero: int = 0\nfloat.from_bits(0) == 0.0\nfloat.from_bits(4607182418800017408) == 1.0\nfloat.from_bits(zero - 4611686018427387904) == -2.0\nfloat.from_bits(float.to_bits(0.125)) == 0.125\nfloat.from_bits(9218868437227405312) == float.inf()\n```",
          "source": "std/math/float/float.lu",
          "line": 1432,
          "tier": "core"
        }
      ]
    },
    {
      "name": "mem",
      "group": "Containers and regions",
      "tier": "namespace",
      "doc": "Namespace for the modules listed below.",
      "summary": "Namespace for the modules listed below.",
      "items": []
    },
    {
      "name": "mem.budget",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.mem.budget — the region ledger, named, and the budget breach made\ninto a ROW. Stability tier: core.\n\n**What is the language's and what is std's** (F-0011, the sc02\nstructural finding, applied again). The language owns all of the\nmachinery here and owns it whole: `region r { … }` and `region()`\n(`[mem.region.create.1]`), the byte ledger and its two builtin\nqueries `region_bytes(r)` / `live_region_bytes()`\n(`[mem.region.account.1/.2]`, wolf-lang s131), the creation-time\nbudget `region r(cap: n) { … }` / `region(cap: n)` and the\ndeterministic `trap(alloc-contract)` a charge past it fires\n(`[mem.region.cap.1/.2]`, s132/D68), and the containment that makes\nthat trap a value at a proc's join — `fault(kind)`, read as\n`is_fault()` / `is_alloc_contract()` (`[mem.region.cap.3]`,\n`[conc.proc.exit]`). std adds exactly two things over that, and\nnothing else: **names for the two queries**, and **the containment\nboilerplate collapsed into one call whose failure is an ordinary\nerror row a caller can handle**.\n\nWhat std deliberately does NOT add: a trap-shaped runner. Asking\n\"does this work fit in n bytes, and kill me if it does not\" is\nalready `region r(cap: n) { … }` — three lanes, zero ceremony, no\nlibrary in the way. A wrapper would be a rename. What a caller\ncannot write in one line is the CONTAINED form, and that is\n`with_cap`.\n\n## THE BUDGET IS DENOMINATED IN LEDGER UNITS, NOT PAYLOAD BYTES\n\nThis is the sharpest thing on the page and it is the clause's own\nsentence (`[mem.region.cap.1]`), restated here because a caller who\nmisses it will size a budget by arithmetic and be wrong by an order\nof magnitude. The ledger is **per-tier**, **cumulative** and\n**high-water**: a byte held as a container element charges the\nELEMENT's storage rather than one byte, and a grown container's\nabandoned buffers stay charged for the region's whole life\n(`[mem.region.account.1]`: \"nothing is ever subtracted while the\nregion lives\"). wolf-lang#203 measured the product on the io path —\na 64 KiB chunk read into a `List[int]` charges about **1 MiB**, 16x\nthe payload: 8x because a byte buffer is one machine int per byte,\n2x because the doubling growth's history stays charged. This\nlibrary's own measurement at the sc32 pin agrees to the byte and is\nrecorded in `docs/findings.md`.\n\n**THE 16x IS COLLECTED, AND THE CAVEAT SHRINKS TO A GROWTH HISTORY\n(sc35).** The paragraph above is now history and is kept as history.\nD72's `byte` (s135) retired the 8x element width; s136\n(wolf-lang#231) moved the eight byte BUILTINS to `List[byte]`, and\nsc35 renamed std's sixteen byte-tier signatures onto them. **Measured\nat the io sites, through `std.fs.read_bytes`, at the sc35 pin: a\n64 KiB read charges 65,584 native and 65,536 checked — 1.00x on both\ntiers, where it charged 1,048,560 / 1,048,576 (16.0x) at every pin\nfrom sc32 to sc34.** Not 2.0x: a PRODUCER mints its list at exact\ncapacity through one memcpy and so has no growth history at all; the\n48 is one list header.\n\n**So the caveat a caller must still act on is not 16x — it is a 2x\nGROWTH HISTORY on the native tier, and 1x on the checked one.** A\n`List[byte]` a program GROWS by `push` to 65,536 elements still\ncharges 131,120 natively (`2 x payload + 48`, the doubling's\nabandoned buffers, `[mem.region.account.1]`) and exactly 65,536 under\n`--checked`, whose shadow model keeps no growth history. That\nresidue is #203's separable preallocation half, it is what\n`reserve(n)` would retire, and no type change can touch it. **Read a\nbuffer with a producer and you pay the payload; build one by pushing\nand you pay it twice on the tier that ships.**\n\nTwo consequences a caller must act on:\n\n- **Derive budgets from measured `charged` readings, never from\n  payload arithmetic or a per-tier constant.** A dry run of the same\n  build pattern under no cap, `charged(r)` read at the end, is the\n  portable way to a number — it is how wolf-lang's own three-tier\n  cap witnesses pin the boundary on every tier at once.\n- **The number is not comparable across lanes and must never be\n  printed into a golden.** The same 100-element list measured at the\n  sc32 pin reads 4064 under lupin, 2032 native and 1600 checked.\n  Every witness in `tests/mem/budget/` therefore prints RELATIONS\n  (zero at creation, monotone, stable, reclaimed) and never a count,\n  which is what lets one `stdout=` hash cover every lane.\n\nAnd one gap the clause names rather than hides: on the native tier\n`str` materialization's ambient region is the process root\n(wolf-lang#191, the c09 seam), so string bytes appear in **no**\nnamed region's ledger there today. Do not read the clause as \"`str`\nnever charges\" — it charges under lupin and the checked machine now,\nand it will charge natively when the seam closes.\n\n## NOTHING COMES BACK OUT OF `with_cap`, AND THAT IS MEASURED\n\nThe obvious signature for this helper is `with_cap[T](n, f) -> T !\n{exhausted}` — run the work, hand back what it made, or the row.\nEvery part of that was probed on all three lanes before a line of\nthis module was written, and it does not exist at this pin. Three\nmeasurements, in the order they close the door:\n\n1. A proc is a FAILURE DOMAIN with no shared address space\n   (`[conc.proc.1]`: \"nothing may assume shared address-space\n   visibility into a proc beyond its channels\"), so the only\n   licensed way out is a channel.\n2. A `channel[int]` in a std function's SIGNATURE is `unsupported —\n   methods on generic std data (the std surface)` on **both** wolf\n   rungs (the F-0026 monomorphization family, reported at the caller's\n   instantiation site).\n3. A `channel[int]` kept entirely inside a std body is `unsupported —\n   methods without resolvable bodies` on the checked rung. It runs\n   natively — but a returning `with_cap` would then be a\n   lupin-and-native-only surface whose two-lane sibling is free.\n\nSo the value stays inside. That is less of a loss than it reads,\nbecause of what the contract already says: the capped region dies\nwith the proc (`[conc.proc.kill]` — regions bulk-free before the\nreason delivers), so nothing it ALLOCATED could have survived the\ncall under any signature. Only a scalar was ever going to cross, and\nthis is the same discipline lobo's own request path already writes\nby hand — the write rows leave its per-response region as an `int`\nbecause heap values must not escape it. `with_cap` answers the one\nquestion a scalar would have carried anyway: **did the work fit?**\n\n## THE ROW IS A MARK, AND IT CARRIES NO NUMBER ON PURPOSE\n\n`exhausted` is lowercase and payload-free (API-CONVENTIONS §12: a\nmark names a failure mode a caller can act on; CapCase is reserved\nfor a tag that carries a payload TYPE). The payload a reader will\nreach for — \"how much did it want?\" — is not merely unavailable, it\nis **unobservable by contract**: `[mem.region.cap.3]` makes teardown\nfree-then-deliver, so the breaching proc's regions are reclaimed\nWHOLESALE before the reason reaches the join and no postmortem query\ncan see the dead proc's charge. A payload here would have to be\ninvented. The cap the caller passed is the caller's own value and\nneeds no return trip.\n\n## Lanes (measured at the sc32 pin: wolf v0.2.2/8cda3aa, lupin\n## 0.1.22/pin 2bfbe5e)\n\n**The query half is three lanes.** `charged` and `live` run on\nlupin, the checked rung and the native rung — including the shape\nthat is not obvious, a `region` passed ACROSS a module boundary.\nRegion values are affine (`[mem.region.create.2]`: they move, they\nare never copied), so a reader is right to expect a call to consume\none; it does not, because the unwritten `read` mode is the spec's own\nanswer (`[mem.tier0.mode.read]`: the callee reads a value immutable\nfor the whole call, \"the caller retains it\"). Probed rather than\nreasoned: two `charged(r)` calls in a row answer the same number on\nevery lane and the region is still usable after both.\n\n**The containment half is TWO lanes, and the missing one is not a\ngap in this module.** `with_cap` is `unsupported — structured\nconcurrency in checked execution (C1 deferred)` on `wolf\nconform-run --checked`, because D68's containment mechanism IS a\nproc and the checked executor defers the whole task layer. lupin\n0.1.22 (is33) and the native rung both run it, byte-identically.\nThe refusal is at the tier, not at this surface: nothing this module\ncould be spelled differently to avoid it, short of not containing\nthe breach at all.\n\n**That refusal is reached at EXECUTION, not statically**, which is\nwhy this module's three witnesses do not share one checked column.\n`tests/mem/budget/negative_cap_trap.lu` calls the same `with_cap`\nand is `run` on all three lanes, because its `assert` fires before\nthe `spawn proc` is ever reached; `breach_is_a_row.lu` reaches the\nspawn and is refused. Probed apart from both, with a `with_cap` call\nbehind a runtime-false branch: the checked rung compiles that file\nand runs it to `exit(0)`. A caller may therefore link this module on\nthe checked tier and only pay for the paths that actually spawn.\n\n**A region value may not be RETURNED from a function on the native\nrung** — `unsupported — first-class region values beyond local\nbindings (c05)` — which is why there is no `capped(n) -> region`\nconstructor here even though it is two lines and runs under lupin\nand the checked rung. The value form `region(cap: n)` is the\nlanguage's, at the caller's own site, where it is three lanes.\n\nRegions (API-CONVENTIONS §5): no function here demands a region for\nordinary use. `charged` takes one because reading a specific\nregion's ledger is the whole operation — it is a query ABOUT a\nregion, not an allocation IN one — and `with_cap` creates and\ndestroys its own.",
      "summary": "std.mem.budget — the region ledger, named, and the budget breach made into a ROW.",
      "items": [
        {
          "name": "charged",
          "kind": "fn",
          "signature": "pub fn charged(r: region) -> int",
          "doc": "The bytes charged to `r`'s ledger — `[mem.region.account.1]`'s\ncumulative count, named. O(1). Total: no error row; the trap\nsurface is the builtin's own (reading a stale region value faults\nexactly where `in r` would).\n\nThe number's UNITS are an implementation-measured fact per tier and\nare **not comparison surface** — see the module header. What every\ntier guarantees, and what a program may rely on: zero at creation,\nmonotone within the region's lifetime, and stable between\nallocations (two reads with no intervening charge agree).\n\n`r` is read, not consumed: the region is usable after the call.\n\n```wolf-doc-example\nlet r = region()\nbudget.charged(r) == 0\n```",
          "source": "std/mem/budget/budget.lu",
          "line": 198,
          "tier": "core"
        },
        {
          "name": "live",
          "kind": "fn",
          "signature": "pub fn live() -> int",
          "doc": "The process-wide total the implementation holds for LIVE first-class\nand sugar regions — `[mem.region.account.2]`, named. O(1). Total: no\nerror row, no traps.\n\nIt is the reclamation counter, **not an RSS proxy**: the process-root\narena is never counted, granularity is implementation-specified, and\na freed region's contribution vanishes wholesale at its free. On a\nprogram with no live region it reads 0, and that is the clause\nworking rather than a broken gauge.\n\n```wolf-doc-example\nbudget.live() >= 0\n```",
          "source": "std/mem/budget/budget.lu",
          "line": 215,
          "tier": "core"
        },
        {
          "name": "with_cap",
          "kind": "fn",
          "signature": "pub fn with_cap(n: int, f: fn()) -> () ! {exhausted}",
          "doc": "Runs `f` under a region capped at `n` LEDGER UNITS, inside a proc, so\nthat a breach comes back as the row `exhausted` instead of ending the\nprocess.\n\nThis is D68's containment made ergonomic. Without it a caller writes\nthe whole join by hand — spawn the proc, take its monitor, `select`\non the exit reason, ask `is_alloc_contract()` — for a question that\nhas one bit of answer. `[mem.region.cap.3]` is what makes the bit\ntrustworthy: the breaching proc dies by the killed-proc sequence, its\nregions bulk-free BEFORE the reason delivers, and `live()` is already\nback to its pre-call reading by the time this function returns. A\nsupervisor that answers 503 on this row was handed the memory back\nfirst.\n\nNothing crosses back on the success path, by contract rather than by\nomission — see the module header's third section. `f` runs in a\nfailure domain with no shared memory, and its region dies with it.\n\nTraps `assert` when `n` is negative: a negative budget is not a\nbudget, it is a caller's arithmetic mistake, and API-CONVENTIONS §2\nsays such a thing traps rather than raising. The check is here, at\nthe door, rather than left to the language's own\n`trap(alloc-contract)` at the creating site — that trap would fire\nINSIDE the proc, be contained, and reach the caller as `exhausted`,\nwhich would answer a bug with a recoverable row. `n == 0` is not a\nmistake: it is a legal budget every charge breaches\n(`[mem.region.cap.2]`), so `with_cap(0, f)` is the honest spelling\nof \"this work may allocate nothing\".\n\nRows: `exhausted` and nothing else.\n\nLanes: lupin and the native rung. `wolf conform-run --checked`\nrefuses it — \"structured concurrency in checked execution (C1\ndeferred)\" — because the containment IS a proc. Measured at the sc32\npin; `tests/mem/budget/breach_is_a_row.lu` is the witness.\n\nExample (prose — the fenced form cannot declare the `fn` this takes,\nand a doc example is one synthesized `main`; the runnable form is\n`tests/mem/budget/breach_is_a_row.lu`):\n`budget.with_cap(4096, build) else |exhausted| { return 503 }` runs\n`build` under a 4 KiB budget and routes the breach.",
          "source": "std/mem/budget/budget.lu",
          "line": 260,
          "tier": "core"
        }
      ]
    },
    {
      "name": "net",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.net — blocking TCP over rows: bind a listener, accept or dial a\nconnection, read and write text on it, and close it exactly once.\nStability tier: core.\n\n**Errors are rows, never traps** (D30, API-CONVENTIONS §2's trap rule\nand §14's restatement of it for the os tier): a refused connection, a\npeer that finished, a deadline, bytes that are not text and every other\nhost failure are ORDINARY outcomes a caller handles with `else` or\npropagates with `?`. Nothing here traps, and nothing returns a\nsentinel. The vocabulary is the s39 builtin tier's, adopted verbatim so\nthat std adds no translation layer:\n\n- `refused` — nobody is listening at that address\n- `timeout` — the operation's deadline expired. Declared from sc08 so\n  the vocabulary would be stable, REACHABLE since sc29: `set_deadline`\n  / `set_listener_deadline` arm the budget (s106's `net_deadline`)\n- `closed` — the peer finished: the socket's `eof`, an outcome rather\n  than a failure, and the value that ends a read loop\n- `utf8` — the bytes read are not well-formed UTF-8; a wolf `str` is\n  UTF-8 by definition, so a read that cannot decode is a miss\n- `io` — every other host failure, including a forged, closed or\n  wrong-kind handle, coarsened to one tag because no caller can act\n  differently on them yet (§12's rule 3)\n\n**Capability: `net` (I13).** Every function here except the two address\nhelpers reaches the host's network stack, is tagged `net` in the\ntoolchain's sandbox table, and is categorically refused at comptime\n(D33) — sockets are the loudest case of that rule: `wolf add` must\nnever mean arbitrary code talks to the network with the builder's\ncredentials. The refusal is `E0701`, and\n`tests/net/comptime_refuses.lu` holds it — one level down, at the builtin,\nbecause a `comptime fn` cannot call across a module boundary at this pin\nand so cannot reach this facade at all (F-0051).\n\n**Loopback and port 0, always — no external network, EVER.** Every\ntest and every doc example in this module binds `127.0.0.1:0`: the\nhost assigns an ephemeral port and the program learns it through\n`port`. Nothing here names a fixed port, a foreign host or a name to\nresolve. `connect` hands its address string to the host, which means a\nhostname WOULD be resolved by the host resolver — std does not do it,\ndoes not test it, and `dns`/`resolve` is not a function this module has\n(see below). `Addr`, the value a resolver will answer, is here (sc67),\nand its tests build their addresses by hand.\n\n**Two operations sc08 withdrew are HERE now** (sc11): `read_all` and\n`read_lines`, with `write_line` as the sending half that pairs with\nthem. All three need a loop that stops on `closed` and re-raises\n`timeout`/`utf8`/`io` unchanged, which needs a handler that can say WHICH\ntag fired — the shape that matched its first arm for every tag on the\nexecuting lane through all of sc08 and sc09 (F-0052, closed at s70;\nF-0043's payload half at s71). The version this module refused to ship\nfor two sprints would have treated a read error as the end of the stream\nand handed back a truncated message with no indication, which is what\n§14's rule about an indistinguishable failure mode exists to prevent.\n\n**The three-way split** (§8/§9's rule, applied to sockets). The\nIMPLEMENTATION owns the builtins this module delegates to\n(`net_listen`, `net_port`, `net_accept`, `net_connect`, `net_read`,\n`net_write`, `net_read_bytes`, `net_write_bytes`, `net_deadline`,\n`net_close`) — their semantics are therefore part of this\nmodule's contract and are documented per function. std owns everything\nelse: the `Listener` and `Socket` values, the consuming closers, the\npure address helpers and `Addr`. The LANGUAGE owns nothing here; there\nis no socket syntax.\n\n**The SECOND address family lives in `std.net.unix` (sc36).** This\nmodule is TCP over `\"host:port\"`; `[os.net.unix]`'s stream socket over\na filesystem PATH is `std.net.unix.listen`/`connect`, and it is a\nseparate module for §1's reason — wolf has no overloading, so `listen`\nand `connect` cannot mean two things here. What that module returns is\none of THESE types: a unix listener is a `Listener`, a unix connection\nis a `Socket`, and every function below serves them call for call\n(`tests/net/unix/stream_surface.lu` measures the byte pair and both\ndeadlines over a socket path). Two functions behave differently on\none, and both say so in their own docs: `port` answers `io` because a\npath has no port, and `close_listener` UNLINKS the path it bound.\n\n**Blocking, and what that means for a program.** `accept` waits for a\nconnection and `read` waits for bytes. `write_some` is the non-parking\nexception: it sends what fits or answers busy; std.poll waits for room. There is no reactor, no task parking and no `select` at this tier\n— X6's completion-io posture is the s35 reactor's story and reaches std\nwhen the builtin tier does. Two consequences a caller must design\naround: a server written over these functions serves one connection at\na time, and an `accept` with no peer coming never returns UNLESS a\ndeadline is armed (`set_listener_deadline`, sc29 — before it, never\nreturns full stop, which is why every test in this module connects\nBEFORE it accepts; the dial-first discipline stays, a deadline is a\nnet for a mistake rather than a license to block).\n\n**What is deliberately absent.** Each of these is a reviewed contract\nwith a filing behind it rather than an approximation:\n\n- ~~`set_deadline(mut s, millis)`~~ — **HERE now (sc29).** For nine\n  sprints the `timeout` tag was declared and unreachable (F-0049: the\n  runtime held a per-socket deadline no builtin exposed); s106's\n  `net_deadline` builtin (#45's builtin half) closed the gap, and\n  `set_deadline` below wraps it on ALL THREE lanes — lupin 0.1.18\n  arms it too, measured. The pure-addition promise this bullet made\n  was kept: no signature changed, the tag the vocabulary carried from\n  day one is simply reachable at last, and\n  `tests/net/read_deadline_row.lu` witnesses it firing.\n- `read_line(mut s) -> str ! {closed, timeout, utf8, io}` — ONE line,\n  as it arrives. Still blocked, and this is now the module's only\n  blocked read: a buffered reader is writable in principle (a `str`\n  field mutated through a `mut` parameter works on both executing lanes,\n  measured in sc08) but FILLING the buffer is a byte-count read, and a\n  chunk that ends inside a code point is a `utf8` miss whose bytes are\n  already gone (F-0050). A line reader that corrupts the moment a stream\n  carries a non-ASCII character is not a partial function, it is a broken\n  one; §9's \"refusal over approximation\" decides it. `read_lines` below\n  is NOT a substitute — it returns nothing until the peer closes — and\n  the difference is stated on both.\n- `write_all` — **not shipped because `write` already is one.** The\n  builtin writes the whole `str` or raises; a short write is not\n  observable, so a `write_all` loop here would be ceremony documenting\n  a hazard that does not exist at this pin. write_some is the partial\n  complement; write and write_bytes still drain the whole input.\n- ~~`write_some`~~ — **HERE now (sc83, wolf 0.2.40)**: one send, never\n  parks, counts the bytes taken, busy when nothing fits. Both TCP and\n  Unix streams use it, including PAX's 4096-byte Unix buffer. The\n  server retains its queue and asks std.poll for WRITE until drained.\n  lupin 0.1.62 serves this send too; the function below states its rows.\n- `shutdown(mut s, half)` — an orderly half-close. No builtin, so a\n  writer cannot say \"I am done sending\" without closing the whole\n  socket (F-0049).\n- `peer_address` / `local_address` — `port` is the only address\n  information the builtin tier reports, and it reports it as an `int`\n  for the LOCAL end (F-0049).\n- `resolve(name, within)` — a NAME turned into its addresses WITHOUT\n  dialling it (wolf-std#4, lobo's ask since ws13). Re-measured at\n  wolf 0.2.33 (sc67): the prelude's twenty `net_*` builtins hold no\n  call that takes a name and answers addresses. `net_connect`\n  resolves inside the dial, answers a socket, and bounds neither the\n  resolve nor the handshake (wolf-lang#217); `net_fetch` is the s16\n  sandbox probe, `unsupported` on all four machines. A resolver in\n  std over today's builtins would be a DNS client speaking for the\n  host's resolver — ignoring `/etc/hosts`, `nsswitch.conf` and the\n  windows resolver, and answering differently from `connect` for the\n  same name — which §14 forbids a capability module. So the call is\n  asked of wolf-lang (a bounded, synchronous `net_resolve`, its exact\n  shape on `Addr` below) and the VALUE it will answer ships now:\n  `Addr`, an address and its IP version, so a consumer (lobo's own\n  stub client, today) can type its answers in the shape `resolve`\n  will hand back.\n- UDP (`send_to`/`recv_from`) and any HTTP: no builtin surface at\n  this pin, and the sprint's non-targets besides. TLS is never this\n  tier's business.\n- ~~Byte-level `read_bytes`/`write_bytes`~~ — **HERE now (sc29).**\n  F-0080 predicted the fix's exact shape from the fs tier's (s90) and\n  s106 shipped it: `net_read_bytes`/`net_write_bytes` carry\n  `List[byte]` with no `utf8` row anywhere — a lone `0x80` is data —\n  and the wrappers below adopt them verbatim. This is what makes a\n  BINARY protocol over TCP writable at all (`std.x.tls.client` is the\n  first consumer: a TLS record is not text). The one lane cost is\n  lupin's: 0.1.18's is18 socket tier is the STR calls only, the byte\n  pair does not resolve there (F-0102, filed), so the byte functions\n  are compiler-lanes-only where the rest of the module is three-lane.\n  `read` keeps its `utf8` row for the callers that want text.\n\n**Lanes (re-measured at the sc29 pin, wolf v0.2.0 + lupin 0.1.18).**\nThe str tier and `set_deadline` run on ALL THREE lanes now: the\nchecked tier since s39, the native rung since s106 crossed net (the\n\"checked lane only at s39\" refusal this paragraph used to record is\nhistory), and lupin since 0.1.18's is18 sockets (nonblocking polls\nunder the baton). The byte tier (`read_bytes`/`write_bytes`) is the\nexception: both compiler rungs run it, lupin does not resolve it\n(F-0102) — a program that reaches it there is an honest `unsupported`\nat resolve, and because lupin resolves module bodies LAZILY the rest\nof the module keeps its lane. Comptime refuses the whole capability\neverywhere (D33).",
      "summary": "std.net — blocking TCP over rows: bind a listener, accept or dial a connection, read and write text on it, and close it exactly once.",
      "items": [
        {
          "name": "Listener",
          "kind": "struct",
          "signature": "pub struct Listener { fd: int, }",
          "doc": "A bound listener: the host socket this process accepts connections on.\n\nTCP when `listen` made it, unix-domain when `std.net.unix.listen` did,\nand nothing in the value records which — the operations are identical\nonce the socket exists, which is why there is one type (sc36). The two\nplaces the family shows through are `port` and `close_listener`, and\nboth are documented where they are.\n\nThe field is an `int` because that is what the builtin tier hands out —\na small non-negative index into the machine's socket table, never a\npointer. Reading it is legal; passing a hand-built `Listener` to\n`accept` is not a trap but a miss (`io`), because a forged descriptor is\na checkable condition rather than a contract violation, and a public\nstruct's field cannot be private at this pin.\n\n**Staleness is prevented by the mode system**, exactly as it is for\n`std.fs.File`: `close_listener` takes its `Listener` by `take` (X1), so\nusing one after closing it is a static use-after-move rather than a\nrow on every operation for a condition the compiler can see.",
          "source": "std/net/net.lu",
          "line": 193,
          "tier": "core"
        },
        {
          "name": "Socket",
          "kind": "struct",
          "signature": "pub struct Socket { fd: int, }",
          "doc": "A connected socket: one end of an established stream, whichever side\nopened it and whichever address family carried it.\n\n`accept`, `connect` and `std.net.unix.connect` all answer one of these,\nand nothing about the value records which — the operations are\nidentical once the connection exists, which is the whole point of the\ntype. No function here behaves differently on a unix-domain stream:\n`close` never touches a path, because the LISTENER owns the name. The field is an `int` for\nthe reasons `Listener`'s is, and `close` consumes the value for the same\nreason `close_listener` does.",
          "source": "std/net/net.lu",
          "line": 207,
          "tier": "core"
        },
        {
          "name": "listen",
          "kind": "fn",
          "signature": "pub fn listen(addr: str) -> Listener ! {io}",
          "doc": "Bind a listening socket to `addr` and return it.\n\n`addr` is `\"host:port\"` as the host understands it — write\n`\"127.0.0.1:0\"` and let the host choose the port, which is what `port`\nbelow is for. Rows: `io` when the address cannot be bound at all\n(already in use, not a local address, malformed), coarsened to one tag\nbecause the builtin tier reports one. Never traps.\n\nThe listener starts accepting immediately: a peer may connect before\n`accept` is ever called and waits in the host's backlog, which is what\nmakes a single-process test deterministic.\n\nCapability `net`; refused at comptime (D33). Delegates to `net_listen`.\n\n```wolf-doc-example\nvar srv = net.listen(net.loopback(0))?\n(net.port(srv) else 0) > 0\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 230,
          "tier": "core"
        },
        {
          "name": "port",
          "kind": "fn",
          "signature": "pub fn port(l: Listener) -> int ! {io}",
          "doc": "The port `l` is bound to.\n\nThis is how a program learns the port the host chose for it after\n`listen(\":0\")` — the port-0 discipline every test in this module\nfollows. Rows: `io` when the handle is closed, forged or the host\ncannot report the address. Never traps.\n\nRead mode: asking a listener its port does not change it. The answer is\nthe LOCAL port only; there is no peer or full-address accessor at this\npin (see the module header).\n\n**On a `std.net.unix` listener this is `io`, always** — a path has no\nport, and the `io` row is the builtin tier's own answer rather than a\ncheck std adds (`[os.net.unix]`, measured on all three lanes and\npinned in `tests/net/unix/echo.lu`). A program that binds either\nfamily and reports its address asks `port` and falls back to the path\nit passed.\n\nCapability `net`; refused at comptime (D33). Delegates to `net_port`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv) else 0\np > 0\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 260,
          "tier": "core"
        },
        {
          "name": "accept",
          "kind": "fn",
          "signature": "pub fn accept(mut l: Listener) -> Socket ! {timeout, io}",
          "doc": "Take the next connection from `l`'s backlog, waiting until one arrives.\n\nRows: `timeout` when an armed deadline expires — arm one with\n`set_listener_deadline` (reachable since sc29; it was declared-only\nunder F-0049 for nine sprints) — and `io` when the handle is closed,\nforged or the host failed. Never traps.\n\n**This parks until a connection is yours, and an armed deadline BOUNDS\nthe park** (`[os.net.accept]`, wolf-lang#242). With a budget armed by\n`set_listener_deadline`, the call returns inside it — the connection,\nor `timeout`. With no budget armed it parks indefinitely, in the\nruntime's own wait rather than the kernel's, so a program that accepts\nbefore anyone dials still waits; the dial-first test discipline stays\nand the doc example below keeps it.\n\n**To ask WITHOUT committing to the wait, use `net.wait`** — thirty\nlines down this file, `[os.net.wait]`. A loop that multiplexes this\nlistener with its open connections asks `wait` for the ready set and\ncalls `accept` only when the answer names `l.fd`. That is the shape\n`wait` exists for, and it is the answer to \"can I poll a listener\".\n\n**A readiness wake is not a claim, and a `timeout` here can mean\nsomeone else took it.** On a listener several processes share — the\nprefork arrangement `[os.proc.inherit]` invites, and the one `wait`'s\nclause points at — one arriving connection wakes EVERY hand and\nexactly one of them takes it. A hand that loses the race finds nothing\nthere and waits again **against the same budget**, the one computed\nwhen its call began and never a fresh one, so a lost race costs at\nmost the budget it already armed. What it eventually answers is\n`timeout`, and on N hands that is the NORMAL outcome for N-1 of them:\nnot a failure to report, not a state change, just the connection this\nhand did not get. A serving loop treats it as \"go round again\". This\nis why a shared-listener hand arms a SHORT budget: there, a deadline\nis the mechanism and not merely the net for a mistake that\n`set_listener_deadline`'s own clause describes.\n\nThe accepted socket is BLOCKING whatever posture the listener holds,\nso nothing about `read`/`write` changes.\n\n`mut l` because accepting ADVANCES the listener: the connection this\ncall takes is one the next call will not see, which is state the value\nnames even though its `fd` field does not change — the same rule\n`std.fs.read` follows for a file's position (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_accept`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nvar conn = net.accept(mut srv)?\nnet.write(mut cli, \"hi\")?\n(net.read(mut conn, 8) else \"?\") == \"hi\"\nnet.close(take cli)?\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 321,
          "tier": "core"
        },
        {
          "name": "connect",
          "kind": "fn",
          "signature": "pub fn connect(addr: str) -> Socket ! {refused, timeout, io}",
          "doc": "Dial `addr` and return the connected socket.\n\nRows: `refused` when nobody is listening there — the commonest network\noutcome there is, and a row rather than a trap because the caller could\nnot have checked; `timeout` when a deadline expires (a CONNECT\ndeadline has no arming surface here — `set_deadline` needs the\n`Socket` this call has not yet produced, so on this function the tag\nis still vocabulary-only); `io` for every other host failure,\nincluding an address that does not parse. Never traps.\n\n**This blocks until the connection completes or fails**, and the host\ndecides how long that takes. `addr` is handed to the host as written,\nso a NAME would be resolved by the host resolver, on the calling\nthread and with no deadline (wolf-lang#217) — std neither resolves nor\ntests names, and every example here is loopback (see the module header\non the no-external-network law, and `Addr` on the resolver std is\nwaiting for).\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_connect`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(net.loopback(p))?\nnet.close(take cli)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 353,
          "tier": "core"
        },
        {
          "name": "read",
          "kind": "fn",
          "signature": "pub fn read(mut s: Socket, max: int) -> str ! {closed, timeout, utf8, io}",
          "doc": "Read up to `max` bytes from `s`, decoded as UTF-8, waiting for at least\none byte.\n\nRows: `closed` when the peer finished — the socket's `eof`, an OUTCOME\nthat ends a read loop rather than a failure, and the tag a reader stops\non rather than reports; `timeout` when an armed deadline expires\n(`set_deadline` — reachable since sc29); `utf8` when the bytes read are not well-formed UTF-8, WHICH\nINCLUDES a chunk boundary that lands inside a code point, and the bytes\nare consumed either way; `io` when the handle is closed, forged or the\nhost failed. Never traps.\n\n**A byte-count read of text is not safe in general**, exactly as\n`std.fs.read` is not: TCP delivers whatever has arrived, so a stream\ncarrying non-ASCII text can split a code point across two reads and the\nsecond byte-sequence is a `utf8` miss. ASCII is safe at any size, and\nthe honest fix is byte-level io (F-0080, and the fs tier has had it\nsince s90 — `fs.read_chunk` is the shape this one wants), filed rather\nthan hidden. `max` at or below zero reads nothing and answers the empty\nstring without touching the socket.\n\n`mut s` because reading CONSUMES from the stream: the bytes this call\ntakes are bytes the next call will not see (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_read`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.write(mut cli, \"wolfpack\")?\nvar conn = net.accept(mut srv)?\n(net.read(mut conn, 4) else \"?\") == \"wolf\"\n(net.read(mut conn, 4) else \"?\") == \"pack\"\nnet.close(take cli)?\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 394,
          "tier": "core"
        },
        {
          "name": "write",
          "kind": "fn",
          "signature": "pub fn write(mut s: Socket, text: str) -> () ! {closed, io}",
          "doc": "Write all of `text` to `s`.\n\nRows: `closed` when the peer has gone away (a write to a finished\nconnection is the row, never a trap), `io` when the handle is closed,\nforged or the host failed. Never traps, and there is no `utf8` row: a\n`str` is already well-formed UTF-8.\n\n**The whole string is written or the call raises** — the builtin loops\ninternally, so a partial write is not an outcome this surface has, and\nthat is why there is no `write_all` beside this function (see the\nmodule header). What it does NOT promise is delivery: bytes handed to\nthe host may still be in flight, and only the peer's own read proves\notherwise.\n\nWrites are unbuffered: every call reaches the host, so a program\nwriting a message in small pieces pays for each one.\n\n**Two writes are TWO SEGMENTS, and since v0.2.8 they stay that way.**\n`[os.net.nodelay]` sets `TCP_NODELAY` on every stream, so the kernel\nno longer coalesces a small second write into the first — which is\nthe point (the 40ms delayed-ACK stall is gone) and which also removes\na coalescing a reader may once have leaned on without noticing. A\npeer calling `read(mut s, 7)` after these two writes may be handed\n`\"one \"` and nothing else: **`read` is one read of UP TO `max` bytes,\nnever a promise of `max`**, and the module header's \"a stream is\nbytes, not messages\" is the whole of it. A reader that needs the\nwhole thing calls `read_all`; a reader that needs a fixed count loops\nuntil it has one. F-0112 is where this cost a doc example that had\nbeen correct-by-Nagle since sc08.\n\nA writer that wants one segment has `writev`, which is the better\nanswer whenever the pieces are known together.\n\n`mut s` because writing advances the stream, the same rule `read`\nfollows (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_write`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.write(mut cli, \"one \")?\nnet.write(mut cli, \"two\")?\nnet.close(take cli)?\nvar conn = net.accept(mut srv)?\n(net.read_all(mut conn) else \"?\") == \"one two\"\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 448,
          "tier": "core"
        },
        {
          "name": "read_bytes",
          "kind": "fn",
          "signature": "pub fn read_bytes(mut s: Socket, max: int) -> List[byte] ! {closed, timeout, io}",
          "doc": "Read up to `max` BYTES from `s` as a `List[byte]` — the binary read.\n\nBytes are bytes: there is no `utf8` row here and can never be one\n(the fs byte tier's posture, adopted verbatim per F-0080's ask —\na lone `0x80` is data, not a miss). This is the read a binary\nprotocol builds on; `read` above is the one for text.\n\nRows: `closed` when the peer finished (the row that ends a read\nloop); `timeout` when an armed deadline expired (`set_deadline`);\n`io` for a host failure or a bad handle. Never traps.\n\n**A short read is normal**: up to `max` means \"what the host had\",\nexactly as `read`'s doc states for text — a caller that needs N\nbytes loops until it has them (`std.x.tls.client.read_exact` is the\nworked example).\n\n`mut s` because reading consumes from the stream (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_read_bytes` (s106) — both compiler lanes; lupin 0.1.18 does\nnot resolve the byte tier (F-0102), so this example's lupin lane is\nan honest `unsupported`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nvar msg = List[byte]()\n(mut msg).push(0 as byte)\n(mut msg).push(255 as byte)\nnet.write_bytes(mut cli, msg)?\nvar conn = net.accept(mut srv)?\nlet got = net.read_bytes(mut conn, 8) else List[byte]()\ngot.len == 2\nnet.close(take cli)?\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 490,
          "tier": "core"
        },
        {
          "name": "write_bytes",
          "kind": "fn",
          "signature": "pub fn write_bytes(mut s: Socket, b: List[byte]) -> () ! {closed, invalid, io}",
          "doc": "Write all of `b` — raw bytes — to `s`.\n\nThe binary twin of `write`, and the same completeness promise: the\nwhole list is written or the call raises, so there is no partial\nwrite to observe.\n\nRows: `closed` when the peer has gone away; **`invalid` — declared\nand UNREACHABLE from typed code since sc35**, the same tag and the\nsame posture as `fs.write_bytes` (§14's os-tier vocabulary, adopted\nverbatim). It named an element of `b` outside 0..255, rejected whole\nbefore anything reached the wire; `b` is a `List[byte]` now and\ncannot hold one, and the tag stays because the vocabulary is the\ntoolchain's (wolf-lang#231 kept `invalid` on `net_write_bytes` for\nthe FFI caller it is still true of). `io` for a host failure or a\nbad handle. Never traps.\n\n`mut s` because writing advances the stream (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_write_bytes` (s106) — both compiler lanes; lupin 0.1.18 does\nnot resolve the byte tier (F-0102).\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nvar msg = List[byte]()\n(mut msg).push(128 as byte)\nnet.write_bytes(mut cli, msg)?\nnet.close(take cli)?\nvar conn = net.accept(mut srv)?\nlet got = net.read_bytes(mut conn, 8) else List[byte]()\ngot.len == 1\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 530,
          "tier": "core"
        },
        {
          "name": "write_some",
          "kind": "fn",
          "signature": "pub fn write_some(mut s: Socket, b: List[byte]) -> int ! {busy, closed, invalid, io}",
          "doc": "Send a prefix of b in one non-parking send, returning its byte count:\nat least 1 for non-empty b, 0 for empty b (the handle is still checked).\nA socket deadline does not apply. The unsent suffix stays the caller's;\nretain it and enable std.poll.WRITE until the queue is drained.\n\nRows: busy when nothing fits now; closed for a peer gone, without\nSIGPIPE; invalid for a wrong-width list (unreachable for typed byte\nlists, retained for the builtin's FFI caller); io for a listener,\nforged/closed handle or other host failure. Never traps.\n\nCapability net; refused at comptime. Delegates to net_write_some, one\nsend with no list copy in the builtin. TCP and Unix streams, both\ncompiler tiers and lupin 0.1.62. Unlike write_bytes, it never drains\nthe whole list on the caller's behalf.\n\n```wolf-doc-example\nvar srv = net.listen(net.loopback(0))?\nvar cli = net.connect(net.loopback(net.port(srv)?))?\nvar peer = net.accept(mut srv)?\nlet n = net.write_some(mut cli, [128 as byte])?\nn == 1\nlet b = net.read_bytes(mut peer, 1)?\nb.len == 1 && b[0] == 128 as byte\nnet.close(take cli)?\nnet.close(take peer)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 561,
          "tier": "core"
        },
        {
          "name": "set_deadline",
          "kind": "fn",
          "signature": "pub fn set_deadline(mut s: Socket, ms: int) -> () ! {io}",
          "doc": "Arm (`ms > 0`) or clear (`ms <= 0`) a deadline BUDGET on `s`: every\nsubsequent parking operation on this socket — `read`, `read_bytes`,\n`write` — resolves as its row's `timeout` tag when the budget fires\nfirst.\n\n**This is what makes `timeout` reachable** — the tag every read and\nwrite signature has carried since sc08, declared against exactly\nthis day (F-0049's deadline half, closed by s106's `net_deadline`).\nA socket with no deadline armed behaves as before: it blocks until\nthe host answers. The budget is per-OPERATION arming, not a\nwall-clock alarm — it is consulted by each parking call, and\nclearing it returns the socket to plain blocking.\n\nRows: `io` — arming fails only on a forged, closed or wrong-kind\nhandle (or a host that cannot hold a deadline). Never traps.\n\n`mut s` because the socket's host state changes even though the\nvalue's field does not (§14's stream rule: the call site spells the\nmutation).\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_deadline` (s106) — ALL THREE lanes, lupin 0.1.18 included\n(measured: an armed 200ms budget resolves a silent-peer read as\n`timeout` there too).\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.set_deadline(mut cli, 150)?\nlet missed = net.read(mut cli, 8) else \"deadline\"\nmissed == \"deadline\"\nnet.close(take cli)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 600,
          "tier": "core"
        },
        {
          "name": "set_listener_deadline",
          "kind": "fn",
          "signature": "pub fn set_listener_deadline(mut l: Listener, ms: int) -> () ! {io}",
          "doc": "Arm (`ms > 0`) or clear (`ms <= 0`) a deadline budget on the\nLISTENER `l`: an `accept` whose peer never dials resolves `timeout`\ninstead of blocking forever.\n\n**Why the name is not `set_deadline`**: `close_listener`'s reason —\nno overloading, one verb per type, and the vocabulary word goes to\nthe connected socket (§1). This is the deadline that retires the\n\"an accept with no peer coming never returns\" hazard the module\nheader documented from sc08 on; the dial-first test discipline\nstays (a deadline is a net for a mistake, not a license to block).\n\n**On a listener several processes accept from, it is the mechanism\nrather than the net.** `[os.net.accept]` bounds a lost race by the\nbudget armed when the call began, so a prefork hand arms a SHORT one\ndeliberately: that budget is the most a connection taken by a sibling\ncan cost it before it goes round its loop again. See `accept`'s clause\nfor what the `timeout` means there.\n\nRows: `io` — a forged, closed or wrong-kind handle. Never traps.\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_deadline` (s106) — all three lanes.\n\nExample (prose, because `accept`'s success type is a `Socket` no\ndeadline-firing example can produce — the fenced form would need a\ndiverging handler around a value the block must still type, F-0040's\nmonomorphic edge in one line): arm\n`net.set_listener_deadline(mut srv, 150)?` and an `accept` with no\npeer dialing resolves its `timeout` tag inside ~150ms instead of\nblocking forever. `tests/net/accept_deadline_row.lu` witnesses the\ntag riding out of `main`.",
          "source": "std/net/net.lu",
          "line": 635,
          "tier": "core"
        },
        {
          "name": "close",
          "kind": "fn",
          "signature": "pub fn close(take s: Socket) -> () ! {io}",
          "doc": "Close `s`, consuming it.\n\nRows: `io` when the handle was already closed or is foreign. Never\ntraps.\n\n`take` is the mode of the operation's meaning (§3, and §14's handle\nrule): closing ends the socket's life, so the caller spells\n`net.close(take s)` and the compiler rejects every later use as a\nuse-after-move. That is the whole staleness story for sockets, it costs\nnothing at run time, and `tests/net/use_after_close.lu` holds it as a\nrejection so it cannot rot.\n\nClosing is also what tells the PEER the stream is finished: it is the\nonly half-close this tier has, so it is what makes the other end's next\nread answer `closed`. A writer that wants to say \"done sending\" and keep\nreading wants `shutdown`, which is a contract at this pin (F-0049).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_close`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.close(take cli)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 665,
          "tier": "core"
        },
        {
          "name": "close_listener",
          "kind": "fn",
          "signature": "pub fn close_listener(take l: Listener) -> () ! {io}",
          "doc": "Close the listener `l`, consuming it.\n\nRows: `io` when it was already closed or is foreign. Never traps.\n\n**Why the name is not `close`.** wolf has no overloading, so one module\ncannot spell one verb for two types (§1: one concept, one name — and\nthe vocabulary word `close` goes to the value a program handles most,\nthe connected socket). Closing a listener stops new connections; the\nones already accepted are separate sockets and are unaffected.\n\n`take` for `close`'s reason: the handle is gone afterwards, and using\nit is a static use-after-move.\n\n**On a `std.net.unix` listener this call also UNLINKS the socket\npath** — the runtime made the file, so the runtime removes it. Nothing\nabout the signature changes and no row is added: the unlink is best\neffort, so a path that has already been moved or removed still closes\nclean (`tests/net/unix/cleanup.lu` and `refused_row.lu`). A TCP\nlistener has no name and this sentence does not apply to one.\n\nCapability `net`; refused at comptime (D33). Delegates to `net_close`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 695,
          "tier": "core"
        },
        {
          "name": "read_all",
          "kind": "fn",
          "signature": "pub fn read_all(mut s: Socket) -> str ! {timeout, utf8, io}",
          "doc": "Every byte the peer sends until it closes, decoded as UTF-8, as one\n`str`.\n\nRows: `timeout` when an armed deadline expires (`set_deadline` —\nreachable since sc29, and on THIS function it turns a peer that stops\nsending without closing from a hang into a row); `utf8` when what\narrived is not well-formed UTF-8, WHICH\nINCLUDES a chunk boundary that lands inside a code point (see below);\n`io` for a host failure or a bad handle. All three are RE-RAISED\nunchanged from the read they came from. `closed` is not in the row: the\npeer finishing is what makes this function RETURN, which is the whole\ndifference between reading everything and failing to read something.\nNever traps.\n\n**This blocks until the peer CLOSES**, not until it stops sending. A\npeer that writes a request and waits for a reply is a peer this function\nnever returns from — so it is the right operation for a stream whose end\nis the message boundary (a one-shot response, a file transfer) and the\nwrong one for a conversation. `read` with a limit is the operation for a\nconversation.\n\n**The `utf8` hazard is inherited and is real**: the socket is read in\n4096-byte chunks and a chunk boundary can split a code point, so a\nstream carrying non-ASCII text can raise `utf8` even though every byte\nit sent was valid (F-0050 — the byte-level read that would fix it does\nnot exist). ASCII is safe at any size. The bytes read before the miss\nare gone either way, which is why this function reports the tag rather\nthan returning a partial answer beside it.\n\n**Why this function exists only now.** It was written and withdrawn\ninside sc08: the loop must stop on `closed` and re-raise the other three\nunchanged, and no handler could tell tags apart — a bare binding catches\neverything (F-0043) and a `match` inside a handler matched its FIRST ARM\nfor every tag on the executing lane (F-0052). Both are closed at this\npin (s70's match tier, s71's payload pattern), so the handler below\ndiscriminates on every lane. The version std refused to ship is visible\nin what it would have done: treated a read error as the end of the\nstream and handed the caller a truncated message with no indication\n(§14's rule about a failure mode a module cannot distinguish).\n\n`mut s` because reading consumes from the stream (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_read`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.write(mut cli, \"the whole message\")?\nnet.close(take cli)?\nvar conn = net.accept(mut srv)?\n(net.read_all(mut conn) else \"?\") == \"the whole message\"\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 754,
          "tier": "core"
        },
        {
          "name": "write_line",
          "kind": "fn",
          "signature": "pub fn write_line(mut s: Socket, text: str) -> () ! {closed, io}",
          "doc": "Write `text` to `s` followed by exactly one `\"\\n\"`.\n\nRows: `write`'s exactly — `closed` when the peer has gone away, `io` for\na host failure or a bad handle. Never traps, and there is no `utf8` row:\na `str` is already well-formed UTF-8.\n\nThis is the SENDING half of a line protocol, and it is one call rather\nthan two so that a message and its terminator cannot be separated by an\nearly return between them. The terminator is one `\"\\n\"` on every\nplatform — no `\"\\r\\n\"` translation anywhere, matching `std.io`'s\nwriters, because a protocol that wants the other terminator can write it\nwith `write` and a program should never have to guess which one it got.\n\n`mut s` because writing advances the stream (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_write`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.write_line(mut cli, \"GET /\")?\nnet.close(take cli)?\nvar conn = net.accept(mut srv)?\n(net.read_all(mut conn) else \"?\") == \"GET /\\n\"\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 808,
          "tier": "core"
        },
        {
          "name": "read_lines",
          "kind": "fn",
          "signature": "pub fn read_lines(mut s: Socket) -> List[str] ! {timeout, utf8, io}",
          "doc": "Every line the peer sends until it closes, terminators stripped.\n\nRows: `read_all`'s exactly — `timeout` (an armed deadline,\n`set_deadline`), `utf8` (including a chunk boundary inside a code point), `io` —\nand `closed` is again the OUTCOME that ends the read rather than a tag.\nNever traps. Allocates the list.\n\nThis is the RECEIVING half of a line protocol, and its shape is the\nhonest one available at this pin: read the whole stream, then split it.\nThe alternative — a `read_line` that returns ONE line as it arrives —\nneeds a buffer filled by a byte-count read, and a chunk that ends inside\na code point loses those bytes with no way to report which line they\nbelonged to (F-0050). That function is a reviewed contract in the module\nheader, and this one is not a substitute for it: a caller who must react\nto each line as it arrives cannot use this, because nothing is returned\nuntil the peer closes.\n\nA trailing terminator produces no final empty line (`\"a\\nb\\n\"` is two\nlines, not three), the empty stream is an empty list, and the split is\n`std.str.lines`'s — Unicode line boundaries, which is the builtin's\ndefinition and therefore part of this contract.\n\n`mut s` because reading consumes from the stream (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to `net_read`.\n\n```wolf-doc-example\nvar srv = net.listen(\"127.0.0.1:0\")?\nlet p = net.port(srv)?\nvar cli = net.connect(\"127.0.0.1:{p}\")?\nnet.write_line(mut cli, \"one\")?\nnet.write_line(mut cli, \"two\")?\nnet.close(take cli)?\nvar conn = net.accept(mut srv)?\nlet got = net.read_lines(mut conn) else List[str]()\ngot.len == 2\nnet.close(take conn)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 851,
          "tier": "core"
        },
        {
          "name": "endpoint",
          "kind": "fn",
          "signature": "pub fn endpoint(host: str, port_number: int) -> str",
          "doc": "`host` and `port_number` joined as the address string `listen` and\n`connect` take.\n\nTotal: no rows, no traps — and pure, so unlike everything above it is\ncomptime-safe and reaches no host, which is why it is the one function\nhere a `comptime fn` may call. An IPv6 host (one containing a `:`) is\nbracketed, because that is what makes `\"::1\"` and a port\nunambiguous; anything else is joined with a single `:`. Nothing is\nvalidated: an address the host cannot parse comes back as an `io` row\nfrom `listen` or `connect`, where the host is the authority.\n\n```wolf-doc-example\nnet.endpoint(\"127.0.0.1\", 8080) == \"127.0.0.1:8080\"\nnet.endpoint(\"::1\", 8080) == \"[::1]:8080\"\nnet.endpoint(\"localhost\", 0) == \"localhost:0\"\n```",
          "source": "std/net/net.lu",
          "line": 872,
          "tier": "core"
        },
        {
          "name": "loopback",
          "kind": "fn",
          "signature": "pub fn loopback(port_number: int) -> str",
          "doc": "The loopback address with `port_number` — `endpoint(\"127.0.0.1\", n)`.\n\nTotal, pure, comptime-safe. It exists to make the discipline this\nmodule tests itself under writable in one call: `loopback(0)` asks the\nhost for an ephemeral port on the interface that cannot leave the\nmachine, which is the only address a std test or doc example is ever\nallowed to name.\n\n```wolf-doc-example\nnet.loopback(0) == \"127.0.0.1:0\"\nnet.loopback(8080) == \"127.0.0.1:8080\"\n```",
          "source": "std/net/net.lu",
          "line": 889,
          "tier": "core"
        },
        {
          "name": "Addr",
          "kind": "struct",
          "signature": "pub struct Addr { version: int, text: str, }",
          "doc": "One address of a host: its IP version and its text — the element\n`resolve` will answer, and the part of a resolver std can fix before\nthe call that makes one exists.\n\n**Nothing in std makes or takes an `Addr` at this pin, and this doc\nsays why rather than hiding it.** A name cannot be turned into its\naddresses without dialling it (wolf-std#4): no builtin at wolf 0.2.33\nresolves (re-measured by sc67; the module header has the list), and a\nDNS client written here would speak for the host's resolver without\nbeing it. The builtin std is waiting for is asked of wolf-lang, the\nfirst half of wolf-lang#217 with its shape made exact:\n\n```text\nnet_resolve(name: str, within_ms: int) -> List[str] ! {invalid, not_found, timeout, io}\n```\n\nSynchronous and bounded: it returns inside `within_ms` with the host\nresolver's answer (`/etc/hosts`, `nsswitch.conf`, the windows\nresolver — the same addresses, in the same order, `connect` would\ntry) or with `timeout`; `not_found` when the resolver says the name\nhas no address, `invalid` for a name or budget refused before the\nhost, `io` for every other failure, a temporary one included. Over\nit std ships `resolve(name, within) -> List[Addr] ! {invalid,\nnot_found, timeout, io}` (the spelling is that lane's), and this\ntype is its element, unchanged.\n\nTwo fields, both public, so a caller builds one directly — a\nconsumer with its own stub client (lobo's, today) can type its\nanswers in the shape `resolve` will hand back:\n\n- `version` is the address family as its IP VERSION, **4 or 6** —\n  the number the IP header itself carries, never the host's\n  `AF_INET`/`AF_INET6` constant, which differs between linux, macOS\n  and windows. An `int` rather than an enum on purpose: at this pin\n  no caller on any of the four machines can name an imported enum's\n  variant, and lupin cannot match one (sc67's probes, F-0154).\n- `text` is the address as the resolver writes it: dotted-quad for\n  version 4, RFC 5952 text for version 6, which always holds a `:`,\n  so the two forms never meet. It is a HOST, not an endpoint:\n  `endpoint(a.text, port)` makes the string `connect` dials, and\n  brackets a version-6 address on the way.\n\nNothing is validated, as nothing is in `endpoint`: a hand-built\n`Addr` whose text the host cannot parse comes back as an `io` row\nfrom `connect`, where the host is the authority, and `version` is the\nbuilder's claim, which a resolver's answer always makes true. Pure\ndata: no capability, comptime-safe.\n\n```wolf-doc-example\nlet a = net.Addr { version: 6, text: \"::1\" }\na.version == 6 && net.endpoint(a.text, 443) == \"[::1]:443\"\nlet b = net.Addr { version: 4, text: \"127.0.0.1\" }\nnet.endpoint(b.text, 0) == net.loopback(0)\n```",
          "source": "std/net/net.lu",
          "line": 947,
          "tier": "core"
        },
        {
          "name": "ListenOpts",
          "kind": "struct",
          "signature": "pub struct ListenOpts { reuse_port: bool, backlog: int, }",
          "doc": "The options `listen_with` takes: what a prefork server needs and\nnothing else.\n\nTwo fields, both public and both meaningful on their own, so a caller\nwrites the literal directly — `net.ListenOpts { reuse_port: true,\nbacklog: 128 }` — or starts from `listen_opts()` below and edits. There\nis no builder here because there are two options; a `Command`-shaped\nbuilder for two booleans-and-an-int would be ceremony (§1).\n\n`reuse_port` sets `SO_REUSEPORT` **before** the bind. That \"before\" is\nwhy this is a call and not a post-bind setter on a `Listener`: after\nthe bind the option is too late, and a setter that silently did\nnothing is the API this shape exists to avoid.\n\n`backlog` is the `listen(2)` queue hint. `<= 0` asks for the\nruntime's default, which is 128 — std's own number, stated here so a\ncaller who wants it can say so explicitly rather than by omission.\nThe host clamps any hint to its own `somaxconn`, so this is a hint in\nthe honest sense: you may ask, the kernel decides.",
          "source": "std/net/net.lu",
          "line": 973,
          "tier": "core"
        },
        {
          "name": "listen_opts",
          "kind": "fn",
          "signature": "pub fn listen_opts() -> ListenOpts",
          "doc": "The options that make `listen_with` behave exactly like `listen`.\n\n`listen_with(addr, listen_opts())` is `listen(addr)` call for call —\nthe clause says so of the builtin (`net_listen_with(addr, false, 0)`\nis `net_listen(addr)`), and this is that sentence made reachable. Use\nit as the base you edit one field of.\n\nTotal: no rows, no traps. Pure and comptime-safe — building options\nbinds nothing.\n\n```wolf-doc-example\nlet o = net.listen_opts()\no.reuse_port == false\no.backlog == 0\n```",
          "source": "std/net/net.lu",
          "line": 993,
          "tier": "core"
        },
        {
          "name": "listen_with",
          "kind": "fn",
          "signature": "pub fn listen_with(addr: str, opts: ListenOpts) -> Listener ! {unsupported, exists, denied, io}",
          "doc": "Bind a listening socket to `addr` with `opts` and return it.\n\n**This is an ACQUISITION call and nothing else.** What it answers is\nthe ordinary `Listener` every other function in this module already\nserves — `port`, `accept`, `set_listener_deadline`, `close_listener`\n— so the surface does not grow by one function for one more way to\nget a listener. That is the same rule `std.net.unix` follows and the\nreason it needed only an address call.\n\n**What `reuse_port` buys, and what it does NOT promise.** With the\noption set, N listeners — in one process or across N processes — may\nhold one address at once, every member of the group carrying the\noption. What the KERNEL then does with the group is the host's, and\nthis module states it rather than promising it: **linux** distributes\naccepts across the group by a 4-tuple hash, so every hand accepts;\n**macOS** hands every SYN to the newest bound socket and falls to a\nsurvivor when that socket closes — the port is shared and failover is\ngap-free, but accepts are NOT distributed. A program that assumes\ndistribution is a program that works on one of this project's two\nserving hosts. Both hosts guarantee exactly two things, and they are\nthe two a caller may build on: **every dial is accepted by SOME\nmember**, and **the survivor takes every dial after the others\nclose**. `tests/net/reuse_port.lu` is the assertion about precisely\nthose two and deliberately asserts nothing about which hand.\n\nRows, and this call has more of them than `listen` on purpose:\n`unsupported` when THE HOST does not serve an option asked for —\nwindows, by name, for `reuse_port`, because its `SO_REUSEADDR` lets\nany process take a bound port and then delivers every dial to the\nfirst socket bound, so the second binds and serves nothing; that is\nrefused rather than aliased. `exists` when another socket already\nholds the address without the option on both sides — the \"already in\nuse\" answer, spelled in the vocabulary `[os.net.unix]` gave this\nfamily rather than a new tag. `denied` for a privileged port the\ncaller may not bind. `io` for the rest. Never traps.\n\n**`listen`'s own row stays `{io}`** — its lowering coarsens — so a\nprogram that wants the distinction calls this one even with default\noptions. That is a real reason to prefer `listen_with`, and the only\none.\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_listen_with`.\n\n```wolf-doc-example\nvar srv = net.listen_with(net.loopback(0), net.listen_opts())?\n(net.port(srv) else 0) > 0\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 1046,
          "tier": "core"
        },
        {
          "name": "adopt_listener",
          "kind": "fn",
          "signature": "pub fn adopt_listener(fd: int) -> Listener ! {unsupported, io}",
          "doc": "Adopt a listening socket this process was HANDED rather than bound.\n\nThis is the child's half of descriptor inheritance: a parent spawns\nwith a set of listeners and the child receives them as descriptors\n`3, 4, …` in the order given, so `adopt_listener(3)` is \"the first\nlistener my parent handed me\" and no number ever has to be told to\nthe child out of band. An ACQUISITION call, like `listen_with`: what\nit answers is the ordinary `Listener`, so accept, both deadlines and\nthe closer come free.\n\n**The runtime asks the KERNEL what the number is** rather than\ntrusting the caller: a stream socket with no peer, and, where the\nkernel keeps a listening flag, that flag. Anything else — not a\nsocket, a connected stream, a family the table does not serve, a\nnumber this process already adopted, a negative or absurd number — is\nthe `io` row. **Never a trap, and never a wrapped stranger**; a\nforged descriptor is a checkable condition, which is the same\nposture `Listener`'s own doc takes about a hand-built handle.\n\n**Ownership at close, which is the sentence a prefork master needs.**\nAn adopted descriptor belongs to exactly one wolf handle, and\n`close_listener` on that handle **does close the inherited fd**. The\nadopter owns the number from the adopt on; a second adopt of a\nstill-live number is `io` rather than a double close waiting to\nhappen, and closing the handle releases the number so a freshly\nhanded one adopts again.\n\n**What the adopter does NOT own is anything OUTSIDE the descriptor.**\nAn adopted `AF_UNIX` listener **does not unlink its socket file at\nclose**. `std.net.unix`'s cleanup posture belongs to the process that\nBOUND the path — for an inherited listener, the parent. A child that\nunlinked the path would delete the address its siblings are still\nserving on, and this is the one place where an adopted listener and a\nbound one behave differently at `close_listener`.\n\nAn adopted descriptor is marked close-on-exec on adoption, so this\nprocess's own children inherit only what it hands them in turn.\n\nRows: `unsupported` where the host or the tier does not serve the\ncall, BY NAME — windows (a `SOCKET` is not a small stable number a\nparent can name by position) and the CHECKED machine, which refuses\nit because it is the `wolf` binary interpreting a program, so a\ndescriptor handed to \"the program's child\" would be handed to the\ncompiler's child. `io` for every failed check above. Never traps.\n\n**The `std.process` half of this pair is `process.start_with(c,\ninherit)`** (sc39, wolf-std#9). This clause said there was none for\ntwo sprints, which was true when sc37 wrote it and stopped being true\nthe day the wrapper landed — the pair is whole at the std tier now\nand a prefork handshake no longer splits across tiers. The `Command`\nquestion that held it up was answered by the consumer that needed it:\nthe inherit set is an argument of the SPAWN, never a field of the\nbuilder, because the listeners belong to the master for its whole\nlife and each spawn borrows them.\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_adopt_listener`.\n\nA prose example, because a doc example cannot spawn its own parent:\na child started by `os_spawn_with(exe, args, [srv])` reaches its\ninherited listener with `let srv = net.adopt_listener(3)?` and from\nthere uses `net.accept` exactly as the binder would.\n`tests/net/adopt_rows.lu` is the witness.",
          "source": "std/net/net.lu",
          "line": 1113,
          "tier": "core"
        },
        {
          "name": "wait",
          "kind": "fn",
          "signature": "pub fn wait(fds: List[int], deadline_ms: int) -> List[int] ! {io}",
          "doc": "Which of `fds` can be read WITHOUT blocking, as a subset in the\ncaller's order.\n\nEvery other blocking call in this module waits on ONE socket. This is\nthe one that waits on many, and it is what a serving loop that spawns\nno tasks has instead of a scheduler: without it a single-loop server\nmust time-slice — a short deadline on the listener, another on every\nopen connection, every idle pass — and spends its life waking up to\nlearn that nothing happened.\n\n**An EMPTY answer is the deadline expiring with nothing ready. That\nis an ANSWER, not a failure**, and a loop that treats it as one is\nthe mistake this sentence exists to prevent. `wait` returns a\npossibly-empty `List[int]`; it does not raise when nothing is ready.\n\n**It takes raw descriptors, not handles, and that is deliberate.** A\nready set mixes listeners and streams — that is the whole point of it\n— and wolf has no sum type that could hold both at this pin. So the\nargument is the `fd` field both `Listener` and `Socket` publish, and\nthe idiom is to build the list from them:\n\n    var set = List[int]()\n    (mut set).push(srv.fd)\n    (mut set).push(cli.fd)\n    let ready = net.wait(set, 50)?\n\nThe answer is a list of those same numbers, so a caller matches each\nagainst the handle it came from. Reading `.fd` is legal by the\n`Listener` doc's own rule; nothing here forges one.\n\n**`deadline_ms`**: negative waits until something is ready, `0` asks\nand returns at once, positive is milliseconds.\n\n**Readiness is level-triggered**: asking consumes nothing, so two\nwaits with the same set answer the same until the program actually\nreads or accepts. A stream whose peer has CLOSED is READY — the\n`read` that follows is what reports `closed`, which is how a loop\nlearns to drop it.\n\nRows: `io` for a forged or closed handle anywhere in the set (nothing\nis waited on), for an EMPTY set with an unbounded deadline (nothing\ncould ever end that wait — a program that means to sleep says\n`time.sleep_ms`), and for a failure of the poll itself. An empty set\nwith a `0` or positive deadline is fine and answers empty. Never\ntraps.\n\nThe call does not interact with the task layer: it neither parks a\ntask nor disturbs the reactor's registrations, so a program may mix\nit with `spawn` freely. Every tier-1 host answers this question and\nevery tier serves it.\n\n**The narrow form:** sockets alone, read readiness alone, no signal.\nstd.poll is the wide form: an owned waiter over files and sockets,\ntheir read/write/hangup/error facts, signal meanings and a deadline.\nIt uses the runtime readiness set; this call remains unchanged and\nsupplies poll's narrow Windows fallback.\n\nCapability `net`; refused at comptime (D33). Delegates to `net_wait`.\n\n```wolf-doc-example\nvar srv = net.listen(net.loopback(0))?\nvar set = List[int]()\n(mut set).push(srv.fd)\nlet ready = net.wait(set, 0)?\nnet.close_listener(take srv)?\nready.len == 0\n```",
          "source": "std/net/net.lu",
          "line": 1184,
          "tier": "core"
        },
        {
          "name": "writev",
          "kind": "fn",
          "signature": "pub fn writev(mut s: Socket, parts: List[List[byte]]) -> () ! {closed, io}",
          "doc": "Write every part of `parts` to `s`, in order, as ONE write.\n\nThe gathered write, `[os.net.writev]`. `writev(2)` on unix and\n`WSASend` on windows take the vector as it stands: the kernel gathers\nthe parts and the runtime never copies them, so a head and a body\nleave in one syscall and where two writes would have been two\nsegments, this is one.\n\n**The shape it exists for is the response**, which is why lobo asked\nfor it: a header built in a `strbuf` and a body already in hand, sent\nwithout concatenating the two into a third list that is the size of\nboth. Write\n\n```text\nvar parts = List[List[byte]]()\n(mut parts).push(head)\n(mut parts).push(body)\nnet.writev(mut conn, parts)?\n```\n\nand the bytes on the wire are `head` then `body`, once. `write_bytes`\nof `head ++ body` puts the same bytes there and allocates the sum to\ndo it; two `write_bytes` calls allocate nothing and cost two syscalls,\nand — before `[os.net.nodelay]` — a 40ms delayed-ACK stall on linux\nfor the second one. This call is the only one of the three that pays\nneither price.\n\nRows are `write_bytes`'s minus one: `closed` when the peer has gone,\n`io` for a host failure, a bad handle or a fired budget. There is no\n`invalid` — that tag is `net_write_bytes`'s refusal of a list holding\nan element outside `0..255`, and a `List[List[byte]]` cannot present\none, so this signature does not declare a row no typed caller can\nreach. Never traps.\n\n**Completeness is `write`'s**: the whole gather drains or the call\nraises, resumed after a park from the byte the kernel stopped at in\nwhichever part it stopped in. Empty parts are permitted and send\nnothing; a call whose parts are ALL empty is a completed write that\nmakes no syscall at all, which is the answer to \"is an empty vector an\nerror\" — it is not.\n\n`mut s` because writing advances the stream (§14).\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_writev` (s141) — all three lanes, lupin 0.1.28 included (is40\nmirrors it at the same pin this repository holds).\n\n```wolf-doc-example\nvar srv = net.listen(net.loopback(0))?\nlet p = net.port(srv)?\nvar cli = net.connect(net.loopback(p))?\nvar head = List[byte]()\n(mut head).push(72 as byte)\nvar body = List[byte]()\n(mut body).push(105 as byte)\nvar parts = List[List[byte]]()\n(mut parts).push(head)\n(mut parts).push(body)\nnet.writev(mut cli, parts)?\nnet.close(take cli)?\nvar conn = net.accept(mut srv)?\nlet got = net.read_bytes(mut conn, 8) else List[byte]()\nnet.close(take conn)?\nnet.close_listener(take srv)?\ngot.len == 2\n```",
          "source": "std/net/net.lu",
          "line": 1254,
          "tier": "core"
        },
        {
          "name": "nodelay",
          "kind": "fn",
          "signature": "pub fn nodelay(mut s: Socket, on: bool) -> () ! {io}",
          "doc": "Set Nagle's algorithm off (`on = true`) or on (`on = false`) for `s`.\n\n**`TCP_NODELAY` is already ON for every stream this module hands\nout** — accepted by `accept`, dialed by `connect`, on every tier-1\nhost and every tier, including the checked machine, whose streams\nenter its table under the same default (`[os.net.nodelay]`). A\nprogram that wants the default does not call this function. It is\nhere so that the default is a STATED one rather than an\nundocumented posture, and so the other half is reachable.\n\n**Why that is the default.** wolf-lang#254 measured it: a server that\nanswers with a head and then a body — two writes, the second small —\nstalls on linux behind the peer's delayed ACK at 40ms per request,\na 108x gap against nginx on the same runner, for a program that did\nnothing wrong. Nagle coalesces the small second write and the peer\nwill not ACK until it has something to say. The posture Go, nginx and\nnode take is the one that makes that naive two-write server correct\nwithout its author having to know this clause exists, and it is the\none taken here.\n\n**What `off` is for.** `nodelay(mut s, false)` puts Nagle back, and\nthere is one shape that wants it: a program that writes many small\npieces it does not need delivered individually — a log shipper, a\nmetrics drain, a bulk feed — and would rather the kernel coalesce\nthem into full segments than pay a packet per piece. That is a\nTHROUGHPUT choice made against a LATENCY default, and a program\nmaking it should be able to say why. `net.writev` above is the other\nanswer to the same problem and the better one when the pieces are\nknown together: gather them and Nagle has nothing to coalesce.\n\nIdempotent, and it takes effect after acquisition — a stream is a\nstream first and an option-carrying stream second, which is why this\nis a setter and `reuse_port` (which must precede the bind) is not.\n\nRows: `io`, and it is the whole row set. A LISTENER, a unix-domain\nstream (the option is TCP's), a closed handle and a forged one are\neach `io`; std adds no check of its own, so the tag is the host's\nanswer. Never traps.\n\n**This is not a generic `setsockopt` and none is planned.** An option\nreaches this module by clause, with its rows and its default stated,\nthe way `reuse_port` did in `listen_opts`. That admits more options of\nthe same kind — a keepalive switch is the obvious next — and admits\nnothing whose meaning differs per host without a measurement to state\nit (linger, buffer sizes).\n\n`mut s` because the socket's host state changes even though the\nvalue's field does not (§14's stream rule).\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_nodelay` (s141) — all three lanes, lupin 0.1.28 included.\n\n```wolf-doc-example\nvar srv = net.listen(net.loopback(0))?\nlet p = net.port(srv)?\nvar cli = net.connect(net.loopback(p))?\nnet.nodelay(mut cli, false)?\nnet.nodelay(mut cli, true)?\nnet.close(take cli)?\nnet.close_listener(take srv)?\n```",
          "source": "std/net/net.lu",
          "line": 1319,
          "tier": "core"
        }
      ]
    },
    {
      "name": "net.unix",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.net.unix — the second address family: a stream socket bound to a\nfilesystem PATH instead of a host and a port (`AF_UNIX`).\nStability tier: core.\n\n**Two address calls and peer credentials.** listen(path) binds and\nlistens; connect(path) dials; peer_credentials reads the connected\npeer's pid and effective ids. The address calls answer ordinary\nstd.net values; credentials are the one family-specific query.\n`listen` returns a `net.Listener`, `connect` returns\na `net.Socket` — so `net.accept`, `net.read`/`net.write`, the byte pair,\n`net.set_deadline`/`net.set_listener_deadline`, `net.close` and\n`net.close_listener` serve a unix socket call for call, with the\nsemantics their own docs state. There is no unix-flavoured read, no\nunix-flavoured close, and no second handle type. Stream operations\nremain shared; peer_credentials is the Unix-family query.\n\n**Why it is a module and not two more functions in `std.net`.** wolf\nhas no overloading, so `listen` and `connect` cannot mean two things in\none module — the same rule that put the `f64` family in\n`std.math.float` (API-CONVENTIONS §1). Spelling them\n`net.listen_unix`/`net.connect_unix` would have kept one import at the\ncost of a name that says its type in its suffix, which §1 spends\nelsewhere. The cost of the split is stated rather than hidden: an\nexample here cannot show the accept-and-read half, because the\nextractor imports exactly the documented module (§4's one-module note),\nso both functions below carry PROSE examples and name the tests that\nrun the real thing — the `std.str.to_strbuf` precedent, at a whole\nmodule's scale.\n\n**Errors are rows, never traps** (D30, §2, §14). The vocabulary is the\nbuiltin tier's, adopted verbatim — std adds no translation layer:\n\n- `unsupported` — THE HOST does not serve the family. This is the tag\n  the rest of the module's vocabulary exists to be distinguished from,\n  and it is the reason `[os.net.unix]` was filed at all: a program that\n  cannot tell \"this machine has no AF_UNIX\" from \"that path is wrong\"\n  cannot choose a fallback transport, and a bare `io` for the first\n  condition is exactly the answer #227 refused to ship. It is a\n  PROPERTY OF THE HOST, not of the arguments: on a host that raises it,\n  every call here raises it, always, for every path\n- `exists` — a path is already there at bind. The runtime never\n  clobbers a path it did not bind (see the cleanup posture below)\n- `not_found` — at bind, a directory on the way to `path` is missing;\n  at dial, there is no socket file at `path`\n- `refused` — at dial only: there IS a socket file and nobody is\n  listening on it. The stale-socket case, and the commonest failure a\n  unix-domain client meets\n- `denied` — the caller lacks the filesystem permission the call needs\n- `io` — every other host failure, coarsened to one tag because no\n  caller can act differently on them yet (§12's rule 3)\n\n**One dial shape is the KERNEL's answer and the two hosts disagree, so\nneither row is promised for it.** A path that names something which is\nnot a socket at all is neither of the clause's two dial cases: macOS\nanswers `ENOTSOCK` and you get `io`; linux answers `ECONNREFUSED` and\nyou get `refused` (is36 found this on a CI runner and no developer's\nmachine — wolf-interp's `net_unix.rs` reads the row and accepts\neither). Both are rows and neither is a trap, which is the part std\nDOES promise. A program that must distinguish \"not a socket\" from \"a\ndead server\" cannot do it from the row on both hosts, and should ask\n`std.fs` about the path instead of the network.\n\n**Capability: `net` (I13)** — the same capability `std.net` carries,\nfor the same reason and with the same refusal: both functions are\ntagged `net` in the toolchain's sandbox table and are categorically\nrefused at comptime (D33, `E0701`). A unix socket reaches no network\ninterface, but it is a socket, it is the transport a control plane\nruns on, and a capability that changed meaning with the address family\nwould be a capability nobody could audit.\n\n**The cleanup posture, stated because it is the surprise.** Binding\nCREATES a filesystem object, so this is the one std surface where a\nsocket leaves something behind. The clause's rule and the measured\nbehaviour agree on all three lanes:\n\n- `net.close_listener` of a unix listener UNLINKS its path. The runtime\n  made the file, so the runtime removes it — you do not unlink it\n  yourself after closing, and a `fs.remove` that follows a close is a\n  `not_found` row waiting to happen\n- `net.close` of an accepted or dialled STREAM never touches any path.\n  A connection is not a name\n- a process that DIES without closing leaves the file. The next bind\n  answers `exists` — never a silent takeover — which is the\n  nginx/haproxy posture: a stale socket is the operator's to remove.\n  A program that OWNS its path removes it before binding, with\n  `std.fs.remove`, and `fs.exists` is the guard that makes that\n  idempotent\n- the unlink is BEST EFFORT and never turns a close into a failure: a\n  listener whose path was renamed out from under it still closes\n  `ok` (measured), and the renamed file survives as a stale socket\n\n**What is deliberately absent.**\n\n- `remove_stale(path)` / any unlink helper — it would be\n  `std.fs.remove` under another name, and it would put the `fs`\n  capability on a `net` module so that an audit of either would have to\n  read the other. The two-line idiom is in `listen`'s doc and in\n  `tests/net/unix/cleanup.lu`; the day a program wants it as one call,\n  it belongs to the caller or to `std.fs`, not here\n- an abstract-namespace (`\"\\0name\"`, linux) address — a wolf `str` is\n  UTF-8 and the builtin takes a path; the clause names no abstract\n  form, so std does not invent a spelling for one\n- a `supported()` predicate — there is no builtin to ask, and a probe\n  that binds a temporary path to find out would answer a different\n  question (it would fold `denied` and `exists` into \"no\"). The row IS\n  the predicate: call `listen`, handle `unsupported`, and the answer\n  costs nothing on a host that serves the family\n- `net.port` on a unix listener — it is `std.net`'s function and it\n  answers `io` here, because a path has no port. Measured on all three\n  lanes and pinned in `tests/net/unix/echo.lu`; nothing in this module\n  shadows it\n- ~~`peer_credentials`~~ — **HERE now (sc83, wolf 0.2.40)**, with\n  Credentials below: Linux and PAX report SO_PEERCRED; macOS reports\n  LOCAL_PEERCRED and LOCAL_PEERPID, pid -1 after the peer has closed;\n  The runtime contract also describes FreeBSD's getpeereid and pid -1;\n  no tested std serving lane is claimed there. Windows is unsupported.\n  lupin 0.1.62 refuses a Unix credential read at run by builtin name.\n\n**Paths.** §14's rule, unchanged: a path is a `str`, the separator is\n`/`, and every test and example here uses a RELATIVE path in the\nprogram's own working directory. There is a second reason beyond\n§14's here, and it is the host's: `sun_path` is about 104 bytes on\nmacOS and 108 on linux, so an absolute path under a deep scratch\ndirectory is a length failure waiting for a different machine. A\nrelative path is also the only spelling lupin serves (below).\n\n**Lanes (measured at the sc36 pin, wolf v0.2.4 + lupin 0.1.25).** All\nthree lanes serve the family: the checked and native rungs since s136,\nand lupin since is36 — the reference machine has no filesystem, and\nstill binds and dials a socket path, because a unix socket is a host\nobject rather than a file the machine has to read. Its one limit is\nstated by name: a path that is absolute or climbs out of the working\ndirectory is `unsupported` at resolve there (wolf-interp#18 item 6),\nwhich the relative-path discipline above already satisfies. What lupin\ndoes NOT have is `std.fs`, so the two witnesses that ASSERT about the\npath — the cleanup posture and the stale-socket `refused` row — are\ncompiler-lanes-only, and the ledger says so on those rows alone.\n\n**Hosts.** linux and macOS serve the family on every tier. Windows\nanswers `unsupported` at this pin, BY NAME: `AF_UNIX` has existed there\nsince Win10 1803 and the toolchain measures the kernel's answer on the\nrunner, but the runtime carries no winsock binding for it, and the\nclause names the serving rung for a later campaign rather than\nclaiming it. A program that must run on all three hosts writes the\n`unsupported` arm and falls back to loopback TCP; a program that has\nno fallback should say so at startup rather than at first connection.",
      "summary": "std.net.unix — the second address family: a stream socket bound to a filesystem PATH instead of a host and a port (`AF_UNIX`).",
      "items": [
        {
          "name": "listen",
          "kind": "fn",
          "signature": "pub fn listen(path: str) -> net.Listener ! {unsupported, exists, not_found, denied, io}",
          "doc": "Bind a listening socket to the filesystem path `path` and return it.\n\n`path` is a path as the host understands it, relative and\nforward-slashed (see the module header). The answer is an ordinary\n`net.Listener`: `net.accept` takes connections from it,\n`net.set_listener_deadline` arms its budget, and `net.close_listener`\ncloses it — and UNLINKS `path`, which is the one thing about this\nlistener that a TCP one does not do.\n\nRows: `unsupported` when the HOST does not serve the family (windows at\nthis pin) — refused by name, never a bare `io`, which is the whole\npoint of the tag; `exists` when something is already at `path` (a live\nsocket, a stale one, or an ordinary file — the runtime never clobbers a\npath it did not bind); `not_found` when a directory on the way to\n`path` is missing; `denied` when the caller lacks permission to create\nit; `io` for every other host failure. Never traps.\n\n**The idiom for a path a program owns**, and it is two lines because\nthe third — deciding whether the socket at that path is somebody\nelse's — is not a decision a library can make for you:\n\n    if fs.exists(path) { fs.remove(path)? }\n    var srv = unix.listen(path)?\n\nRemoving unconditionally is right for a path this program's own\nconfiguration names, and WRONG for a path an operator might be sharing;\n`exists` is the row that lets a careful program stop instead.\n\nThe listener starts accepting immediately: a peer may connect before\n`net.accept` is ever called and waits in the host's backlog.\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_listen_unix`.\n\n**No fenced example**: exercising a listener needs `std.net`'s\n`accept`/`read`/`close_listener`, and the extractor imports exactly the\ndocumented module (§4's one-module note) — the `std.str.to_strbuf`\nprecedent. In prose: after `var srv = unix.listen(\"ctl.sock\")?` the\nfile `ctl.sock` exists and a peer can dial it, a second\n`unix.listen(\"ctl.sock\")` is `exists`, `net.port(srv)` is `io`, and\n`net.close_listener(take srv)?` removes the file again. The runnable\nversions are `tests/net/unix/echo.lu` (three lanes) and\n`tests/net/unix/cleanup.lu`.",
          "source": "std/net/unix/unix.lu",
          "line": 195,
          "tier": "core"
        },
        {
          "name": "connect",
          "kind": "fn",
          "signature": "pub fn connect(path: str) -> net.Socket ! {unsupported, refused, not_found, denied, io}",
          "doc": "Dial the unix-domain socket at `path` and return the connected socket.\n\nThe answer is an ordinary `net.Socket`, indistinguishable from a dialled\nTCP one: `net.read`/`net.write`, the byte pair, `net.set_deadline` and\n`net.close` all serve it, and `net.close` never touches `path` — the\nlistener owns the name, a connection does not.\n\nRows: `unsupported` when the HOST does not serve the family (windows at\nthis pin), refused by name; `not_found` when there is no file at\n`path`; `refused` when there IS a socket file and nobody is listening\non it — the stale-socket case, and the row a client meets when the\nserver died without closing; `denied` when the caller lacks permission;\n`io` for every other host failure. Never traps.\n\n**A `path` that names something which is not a socket at all is the\nKERNEL's call, and the hosts differ**: macOS answers `ENOTSOCK`, which\narrives as `io`, and linux answers `ECONNREFUSED`, which arrives as\n`refused` (is36's measurement, on a linux runner). It is neither of\nthe two dial cases `[os.net.unix]` rules, so std promises only what is\ntrue of both: a row, never a trap. Do not branch on which.\n\n**This blocks until the connection completes or fails.** There is no\nname to resolve and no network to cross, so the wait is the host's\nalone; a connect deadline has no arming surface here for `net.connect`'s\nreason — `net.set_deadline` needs the `Socket` this call has not yet\nproduced.\n\nCapability `net`; refused at comptime (D33). Delegates to\n`net_connect_unix`.\n\n**No fenced example**, for `listen`'s reason (§4's one-module note). In\nprose: `unix.connect(\"ctl.sock\")` answers a `net.Socket` when a\nlistener is bound at `ctl.sock`, `not_found` when nothing is there, and\n`refused` when the file is a socket whose listener has gone. The\nrunnable versions are `tests/net/unix/echo.lu`,\n`tests/net/unix/rows.lu` and `tests/net/unix/refused_row.lu`.",
          "source": "std/net/unix/unix.lu",
          "line": 235,
          "tier": "core"
        },
        {
          "name": "Credentials",
          "kind": "struct",
          "signature": "pub struct Credentials { pid: int, uid: int, gid: int, }",
          "doc": "The peer's process id, effective user id and effective group id, as\nrecorded when the Unix stream connected. pid is -1 when not available.\nPure data, no capability; fields are named integers, not host structs.\n\n```wolf-doc-example\nlet c = unix.Credentials { pid: -1, uid: 0, gid: 0 }\nc.pid == 0 - 1\n```",
          "source": "std/net/unix/unix.lu",
          "line": 247,
          "tier": "core"
        },
        {
          "name": "peer_credentials",
          "kind": "fn",
          "signature": "pub fn peer_credentials(s: net.Socket) -> Credentials ! {io, unsupported}",
          "doc": "The credentials at the other end of connected s, accepted or dialed.\nLinux/PAX keep all three after peer close. macOS keeps uid and gid but\nreports pid -1 after close; ask at accept if the pid is needed. The\nruntime specifies FreeBSD ids and pid -1, but that std lane has not been\nmeasured. No user database lookup is made.\n\nRows: io for TCP, a listener, forged/closed handles or host failure;\nunsupported on Windows. Never traps. Capability net; refused at\ncomptime. Delegates to net_peer_cred. Both compiler tiers serve it;\nlupin 0.1.62 refuses a live Unix stream's query by name at run.\n\nProse example (accept/close need std.net): after accepting a Unix\nstream, let c = unix.peer_credentials(peer)?; compare c.uid to the\nserver's allowed effective uid before reading a request. Runnable\nrows: tests/net/unix/peer_credentials.lu and peer_credentials_child.lu.",
          "source": "std/net/unix/unix.lu",
          "line": 268,
          "tier": "core"
        }
      ]
    },
    {
      "name": "ops",
      "group": "Foundations and ordering",
      "tier": "core",
      "doc": "std.ops — the operator traits: the protocols `+ - * / %` and unary\n`-` dispatch through when their operand is a type parameter or a user\ntype. Stability tier: core.\n\n**This module is what `[type.trait.op]` asks std for, and the shapes\nare the clause's, not this module's opinion.** Since s155 (wolf-lang\n#5, spec/10 §11) an operator whose left operand is a type parameter\nor a user type is a call to a trait method chosen BY NAME: `a + b` is\n`Add.add(a, b)`, `-a` is `Neg.neg(a)`. The compiler refuses any other\nmethod shape with E0514, a missing impl with E0502 and no trait in\nscope with E0301, so the six declarations below are transcriptions\nand a rename here is a break for every caller.\n\n**On primitives the impls ARE the builtin operations** — the clause\nsays so in as many words, so `[T: Add]` instantiated at `int` is the\nmachine add and nothing is interposed. Every body below is one\noperator expression for that reason; a body that did arithmetic of\nits own would be a different function wearing the operator's name.\n\n**`Eq` and `Ord` are NOT here.** They are `std.cmp`'s and they stay\nthere: `Ordering` is one enum in std (API-CONVENTIONS §6) and the\ncompiler reads `Ord.cmp`'s answer by VARIANT NAME, so a second\n`Ordering` would be a second answer to a settled question. A bound\nthat wants both writes `[T: ops.Add + cmp.Ord]`; the composed alias\n`Num` is the next paragraph's subject.\n\n**`trait Num` SHIPS HERE, AND IT IS THE LAST ITEM OF s155's SURFACE\nTHIS MODULE OWED.** `[type.trait.op.alias]` spells it `trait Num =\nAdd + Sub + Mul + Div + Rem + Eq + Ord` and wolf-std#26 asked for it\nby name; sc44 withheld it and wrote its own trigger — \"the\nwolf-interp release whose conformance pin is at or past wolf-lang\n`c9237c1` (v0.2.11)\". is46 is that release: lupin 0.1.34 pins\n`c9237c1` and parses the alias form (wolf-interp#92). Measured\nbefore a line was written, not inherited from the release note.\n`Eq` and `Ord` are qualified because wolf binds whole modules and\nhas no item imports, so the composed bound a caller writes is\n`[T: ops.Num]` and nothing else.\n\n**The second trigger is met too, so `Num` is satisfiable at `f64` on\nthe day it lands rather than a release later.** `impl Rem for f64`\nwas the half sc44 withheld with `Num`: its body is `self % other` by\nthe clause, and at 0.2.11 BOTH compiler tiers refused that expression\n(`no frem op` natively, `unruled: fmod vs remainder` checked), which\ncost every importer a lane rather than costing this one impl. s156's\n`[type.float.rem]` (wolf-lang#327) rules it and lowers it —\ntruncated-division remainder, sign of the dividend, `x % 0.0` is NaN,\nnothing traps — and the impl is below, measured running on all three\nlanes.\n\nINTERIM SPELLINGS (each filed, flipped by the pin bump that fixes it):\n- **`Num`'s own examples are PROSE, and the six traits' are not.**\n  The two reasons sc44 wrote here are both gone: a qualified trait in\n  a BOUND counts as a use of its import on lupin now\n  (wolf-interp#97), and trait dispatch through an imported module's\n  trait executes there (wolf-interp#96) — so every example below is a\n  fenced block that runs on the reference machine, which is what §4\n  wants and what this module could not give until this release. The\n  ONE exception is the alias: an alias reached through an import\n  expands no bound under lupin 0.1.34, so `fn f[T: ops.Num]` is\n  `E0501: the bounds on `T` say nothing about `+`` at resolve while\n  `fn f[T: ops.Add]` through the same import runs, and both compiler\n  rungs run the alias at `int` and at `f64`. Filed as\n  wolf-interp#102. Doc-truth wants the reference machine at\n  `exit(0)` (§4), so `Num`'s example stays prose until it closes —\n  and `tests/ops/num_alias_tier.lu` carries the measurement as the\n  ledger's first `mirror-lag(E0501)` row, which is the word sc46\n  added for exactly this shape (wolf-std#27, F-0121).\n- `impl Div for int` is integer division, truncating toward zero, and\n  it traps `div-zero` on a zero divisor exactly as the operator does —\n  the impl IS the operator, traps included, which is what\n  `tests/ops/div_zero_trap.lu` is for.",
      "summary": "std.ops — the operator traits: the protocols `+ - * / %` and unary `-` dispatch through when their operand is a type parameter or a user type.",
      "items": [
        {
          "name": "Num",
          "kind": "trait",
          "signature": "pub trait Num = Add + Sub + Mul + Div + Rem + cmp.Eq + cmp.Ord",
          "doc": "The composed bound, `[type.trait.op.alias]`'s own example and\nthe one the book's chapter 5 writes: `fn total[T: ops.Num](xs:\nList[T], zero: T) -> T`. An alias is a memberless trait carrying a\nbound — there is no supertrait clause this edition, so composition\nis spelled here and `Ord requires Eq` stays documentary in std.cmp.\n\n`Eq` and `Ord` are `cmp.`-qualified and stay std.cmp's: `Ordering` is\none enum in std (API-CONVENTIONS §6) and the compiler reads\n`Ord.cmp`'s answer by VARIANT NAME, so a second `Ordering` here would\nbe a second answer to a settled question.\n\nProse, not a fenced example, and the reason is filed: an alias\nreached through an IMPORT expands no bound under lupin 0.1.34\n(wolf-interp#102), so a fence here could not reach `exit(0)` on the\nreference machine and §4 sends it to prose. Under `fn total[T:\nops.Num](xs: List[T], zero: T)`, `total` compiles and runs at `int`\nand at `f64` on both compiler rungs; `tests/ops/num_alias_tier.lu`\nis the running witness and the ledger row that reds the day\nwolf-interp#102 closes.",
          "source": "std/ops/ops.lu",
          "line": 96,
          "tier": "core"
        },
        {
          "name": "Add",
          "kind": "trait",
          "signature": "pub trait Add { fn add(self, other: Self) -> Self }",
          "doc": "Addition, `a + b`. The compiler dispatches `+` here when the left\noperand is a type parameter bounded by `Add` or a user type with an\n`Add` impl in scope ([type.trait.op]); both operands are the same\ntype, which the clause calls homogeneity and E0514 enforces.\n\nUnder `fn total[T: ops.Add](xs: List[T], zero: T)`, `acc = acc + x`\nis `Add.add(acc, x)`, and at `int` that is the machine add — which\nis what the fence asserts, since a doc example declares no functions\nof its own.\n\n```wolf-doc-example\nlet a: int = 2\nlet b: int = 3\nops.Add.add(a, b) == 5\n```",
          "source": "std/ops/ops.lu",
          "line": 113,
          "tier": "core"
        },
        {
          "name": "Sub",
          "kind": "trait",
          "signature": "pub trait Sub { fn sub(self, other: Self) -> Self }",
          "doc": "Subtraction, `a - b`. Binary only: unary minus is `Neg`.\n\n```wolf-doc-example\nlet a: int = 9\nlet b: int = 4\nops.Sub.sub(a, b) == 5\n```",
          "source": "std/ops/ops.lu",
          "line": 124,
          "tier": "core"
        },
        {
          "name": "Mul",
          "kind": "trait",
          "signature": "pub trait Mul { fn mul(self, other: Self) -> Self }",
          "doc": "Multiplication, `a * b`.\n\n```wolf-doc-example\nlet a: int = 6\nlet b: int = 7\nops.Mul.mul(a, b) == 42\n```",
          "source": "std/ops/ops.lu",
          "line": 135,
          "tier": "core"
        },
        {
          "name": "Div",
          "kind": "trait",
          "signature": "pub trait Div { fn div(self, other: Self) -> Self }",
          "doc": "Division, `a / b`. The impl inherits the operator's traps: at `int`\na zero divisor traps `divide_by_zero`, at `f64` it is IEEE and traps\nnothing.\n\n```wolf-doc-example\nlet a: int = 7\nlet b: int = 2\nops.Div.div(a, b) == 3\nlet x: f64 = 7.5\nlet y: f64 = 2.0\nops.Div.div(x, y) == 3.75\n```",
          "source": "std/ops/ops.lu",
          "line": 151,
          "tier": "core"
        },
        {
          "name": "Rem",
          "kind": "trait",
          "signature": "pub trait Rem { fn rem(self, other: Self) -> Self }",
          "doc": "Remainder, `a % b`. At `int` the sign follows the dividend\n(truncated remainder) and a zero divisor traps `divide_by_zero`; at\n`f64` it is `fmod` by `[type.float.rem]` — the remainder of the\ntruncated division, the sign of the dividend again, and nothing\ntraps. The `f64` impl landed at sc46 with the clause that lowered\nthe operator (wolf-lang#327).\n\n```wolf-doc-example\nlet a: int = 17\nlet b: int = 5\nops.Rem.rem(a, b) == 2\nlet x: f64 = 7.5\nlet y: f64 = 2.0\nops.Rem.rem(x, y) == 1.5\n```",
          "source": "std/ops/ops.lu",
          "line": 170,
          "tier": "core"
        },
        {
          "name": "Neg",
          "kind": "trait",
          "signature": "pub trait Neg { fn neg(self) -> Self }",
          "doc": "Arithmetic negation, unary `-a`. One argument, unlike the five\nbinary traits, and the clause reads the shape: a `neg` taking two\nparameters is E0514.\n\n```wolf-doc-example\nlet a: int = 5\nops.Neg.neg(a) == 0 - 5\n```",
          "source": "std/ops/ops.lu",
          "line": 182,
          "tier": "core"
        }
      ]
    },
    {
      "name": "option",
      "group": "Foundations and ordering",
      "tier": "core",
      "doc": "std.option — the absence convention over `!T` rows, and the six\nhelpers that name its commonest shapes. Stability tier: core.\n\nThere is no `?T` and no null (D30): absence is the row tag `none` —\n`fn find(…) -> int ! {none}` — consumed by `else` (default and\n`|pat|` forms) and propagated by `?`. Domain-specific absence tags\n(`eof`, `gone` — `weak.upgrade()` already returns `T ! {gone}` per\n`[mem.shared.rc.3]`) are legal where the noun earns it; `none` is the\ndefault. API-CONVENTIONS §2 is the binding statement; this module is\nits worked home.\n\n**THE SIX LAND HERE (sc06), five sprints after they were designed.**\nThey were blocked from sc01 to sc05 by one grammar fact: a `!`-row\nparsed only in RETURN position, so no helper could name its own\nargument (F-0002, then its interpreter half F-0023). lupin 0.1.3\nlanded rows in parameter and `let` positions and 0.1.4 executes them,\nso every signature this header used to carry as a comment is a body\nbelow. Each is thin over `else` by design — a reader learns the\nlanguage form first, and these are names for the four commonest\nshapes plus the two that ask a question about absence:\n\n- `or(v, default)`  ≡ `v else default`\n- `to_list(v)`      ≡ 0 or 1 elements\n- `exists(v)`       ≡ `else |_|` marking\n- `is_none(v)`      ≡ `else |_|` marking, negated\n- `expect(v, msg)`  ≡ `v else |_| { … trap … }` — written, executing,\n  and homed in `std/x/option_expect` (F-0040: a diverging handler\n  needs a bottom type wolf does not spell)\n- `flatten(v)`      ≡ collapsing `(T ! {none}) ! {none}` — written,\n  executing, and homed in `std/x/option_flatten` (F-0039: wolfc's\n  grammar admits one `!` per type)\n\nThe two nursery residents are not a hedge: each is a complete body\nwith a test, refused by ONE implementation for a reason with an issue\nnumber, and one rejected body poisons a module for every importer — so\nkeeping them on this page would cost the other four their clean static\nladder. They graduate back here verbatim, in the pin bump's own\ncommit, when their diagnostics stop firing.\n\n**Absence has no literal, which is why nothing here carries a fenced\nexample.** A row VALUE can only be produced by a function that raises:\n`none` resolves at a raise site and nowhere else, so `option.or(none,\n9)` is `unsupported: none does not resolve` and there is no expression\nan example line could pass to any function on this page (F-0038). §4's\nrule then applies exactly as written — unrunnable means prose — and\nthe runnable evidence lives in `tests/option/`: six entry files, one\nper helper, each with a local producer and both a hit and a miss.\n\n**The lane story**: these six are generic over `T` and take a row, so\nlupin runs them, the checked tier answers `unsupported` at the module\nboundary (F-0015: a raise inside an imported module's item), and the\nnative rung refuses monomorphization. One executing lane is what a\ngeneric row helper gets at these pins, and it is the lane that matters\nhere — the bodies are three lines each; what they encode is a\nconvention.\n\nLazy (closure-taking) variants — `or_else` and friends — still wait on\nc05, and `Option[T]`/`Result[T, E]` as DATA still wait on s16 plus the\ns15 `try` bridge. The recorded decision stands: std wants exactly one\nof reified rows or generic data, and now that the row helpers execute,\nthe row half is the one carrying its weight.",
      "summary": "std.option — the absence convention over `!T` rows, and the six helpers that name its commonest shapes.",
      "items": [
        {
          "name": "or",
          "kind": "fn",
          "signature": "pub fn or[T](v: T ! {none}, default: T) -> T",
          "doc": "`v`'s value, or `default` when `v` is absent. The eager-default form:\n`default` is evaluated whether or not it is needed, so keep it cheap\n(a lazy `or_else` waits on closures, c05).\n\nRows: consumes `none` — the caller receives a `T` and no row.\nTotal: no traps of its own.\n\nExample (prose — a row value has no literal, F-0038; the runnable form\nis `tests/option/or_else_default.lu`): with\n`fn find(x: int) -> int ! {none}`, `option.or(find(5), 9)` is `5` and\n`option.or(find(0), 9)` is `9`.",
          "source": "std/option/option.lu",
          "line": 76,
          "tier": "core"
        },
        {
          "name": "to_list",
          "kind": "fn",
          "signature": "pub fn to_list[T](v: T ! {none}) -> List[T]",
          "doc": "`v` as a list: one element when present, empty when absent. The bridge\nfrom absence into the container vocabulary — `for x in\noption.to_list(v)` is the loop that runs zero times or once.\n\nRows: consumes `none`.\nTotal: no traps. The list is allocated in the ambient region (§5).\n\nExample (prose, F-0038; runnable in\n`tests/option/to_list_roundtrip.lu`): `option.to_list(find(5)).len` is\n`1` and `option.to_list(find(0)).len` is `0`.",
          "source": "std/option/option.lu",
          "line": 114,
          "tier": "core"
        },
        {
          "name": "exists",
          "kind": "fn",
          "signature": "pub fn exists[T](v: T ! {none}) -> bool",
          "doc": "True when `v` is present. This is the question `else` answers by\nmarking, and answering it CONSUMES the value — a caller that wants the\nvalue should reach for `or`/`expect` rather than asking first and\ncalling again.\n\nRows: consumes `none`.\nTotal: no traps.\n\nExample (prose, F-0038; runnable in `tests/option/exists_marking.lu`):\n`option.exists(find(5))` is `true`, `option.exists(find(0))` is\n`false`.",
          "source": "std/option/option.lu",
          "line": 132,
          "tier": "core"
        },
        {
          "name": "is_none",
          "kind": "fn",
          "signature": "pub fn is_none[T](v: T ! {none}) -> bool",
          "doc": "True when `v` is absent — `exists`'s complement, shipped because\n`if option.is_none(v)` reads better than `if !option.exists(v)` at the\ncall sites that ask it that way round. Same consumption caveat.\n\nRows: consumes `none`.\nTotal: no traps.\n\nExample (prose, F-0038; runnable in\n`tests/option/is_none_marking.lu`): `option.is_none(find(0))` is\n`true`, `option.is_none(find(5))` is `false`.",
          "source": "std/option/option.lu",
          "line": 147,
          "tier": "core"
        }
      ]
    },
    {
      "name": "os",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.os — what this program can learn about the MACHINE it is running\non. Stability tier: core.\n\n**Three functions.** `cpus()` answers how many cores this process may\nactually be scheduled on (`[os.cpus]`); `name()` and `arch()` (sc72,\nwolf 0.2.35's s253, `[os.uname]`) which OS and which architecture the\nprogram runs on, as the kernel answers. Until sc72 `cpus` was the\nwhole module, and the reasoning it was placed by holds for all three:\nit is a module rather than a function in\n`std.env` because `std.env` is the program's ARGUMENTS and the host's\nENVIRONMENT — things the program was handed — and the core count is\nneither. It is a property of the machine, which is what upstream's\nown spec calls it: §5 of `11-os.md`, \"The machine's size\".\n\n**Why not `std.process`.** `std.process` starts and reaps children.\nAsking how many to start is the question you ask BEFORE you build a\n`Command`, and answering it there would have made `std.process` the\nmodule you import to learn a number while starting nothing.\n\n**Errors are rows, never traps** (D30, §2, §14). One tag:\n\n- `io` — the host cannot answer. It is a ROW and not a silent `1` on\n  purpose, and the clause is unusually explicit about why: a program\n  resolving `workers auto` must be able to say it did not learn the\n  number, instead of quietly running one worker and looking healthy.\n  **This module will never default to 1 for you.** If you want that\n  fallback you write it, and it is then in your source where a reader\n  can see it — `let n = os.cpus() else 1`.\n\n**Capability: `env` (I13)** — the same capability `os_cwd` and\n`os_exe` carry, and for the clause's own reason: the number is\nMACHINE STATE, so it is not comptime-readable and the call is\ncategorically refused at comptime (D33, `E0701`). A `comptime fn`\nthat could read the builder's core count would bake the builder's\nmachine into the artifact.\n\n**The lanes disagree at this pin, and the reason is a release date.**\n`os_cpus` arrives in wolf-lang v0.2.5 (s137, wolf-lang#233). The\nreference interpreter's newest release, lupin 0.1.26, conforms to\n`982f857` = v0.2.4, so it does not resolve the name at all and the\nwhole module is `unsupported` there. That is F-0110: a lane word\nowed to release ORDERING and not to semantics. It retires at the\nfirst lupin that conforms past `6ade878`, with no edit here.",
      "summary": "std.os — what this program can learn about the MACHINE it is running on.",
      "items": [
        {
          "name": "cpus",
          "kind": "fn",
          "signature": "pub fn cpus() -> int ! {io}",
          "doc": "The number of cores this process may actually be scheduled on.\n\n**\"Schedulable\", not \"installed\"**, and that distinction is the whole\ncontent of the clause. On linux the answer honours a cgroup cpu quota\nand a cpu affinity mask, so a container given two cpus of quota on a\nsixty-four-core host answers `2` — where counting `processor` rows in\n`/proc/cpuinfo`, which is what a program had to do before this call\nexisted, answers `64` and starts sixty-two workers that will never\nget a core between them. macOS reads `hw.ncpu`, windows\n`GetSystemInfo`.\n\n**The answer is always `>= 1` when it answers**, so a caller never\nhas to defend against `0`.\n\nRows: `io` when the host cannot answer, propagated from the builtin\ntier unchanged and never swallowed — see the module header on why\nthis is not a silent `1`. Never traps.\n\nEvery tier answers from the same source, so the native lanes and the\nchecked machine agree on one host. That matters more than it looks:\nthis number decides how many PROCESSES a program starts, and two\ntiers that disagreed would start different servers from one source.\n\nA conformance witness pins the RELATION and never the value — the\nnumber is the runner's, and `tests/os/cpus.lu` asserts `>= 1` and\ncross-lane agreement rather than any particular count.\n\nCapability `env`; refused at comptime (D33). Delegates to `os_cpus`.\n\n```wolf-doc-example\nlet n = os.cpus()?\nn >= 1\n```",
          "source": "std/os/os.lu",
          "line": 80,
          "tier": "core"
        },
        {
          "name": "name",
          "kind": "fn",
          "signature": "pub fn name() -> str",
          "doc": "**s253 (`[os.uname]`, wolf 0.2.35): the OS this program runs on**, as\nthe KERNEL answers (`uname(2)`'s `sysname`, lowercased) and not what\nthe program was built for: **`linux`**, **`macos`** (Darwin's),\n**`freebsd`**, **`pax`** on PAX, and **`windows`** there (which has no\n`uname`). A kernel outside these answers its own name, lowercased. Read\nonce a process. What a program chooses by — a clipboard tool, a path\nconvention, a signal number — where looking at `PATH` was the only\nway before.\n\nTotal: no row, no trap. The checked machine answers the host's (the\n`wolf` process's own `uname`). lupin resolves the call from 0.1.59\n(wolf-interp#277).\n\nCapability `env` (machine state, with `cpus`); refused at comptime\n(D33): the host that compiles is not the one that runs. Delegates to\n`os_name`.\n\n```wolf-doc-example\nlet n = os.name()\nn == \"linux\" || n == \"macos\" || n == \"windows\" || n == \"freebsd\" || n == \"pax\"\n```",
          "source": "std/os/os.lu",
          "line": 105,
          "tier": "core"
        },
        {
          "name": "arch",
          "kind": "fn",
          "signature": "pub fn arch() -> str",
          "doc": "**s253 (`[os.uname]`, wolf 0.2.35): the architecture this program\nruns on**, as the kernel answers (`uname(2)`'s `machine`, lowercased),\nwith macOS's and the BSDs' spellings of the two tier-1 architectures\nas linux's: **`x86_64`** (`amd64`) and **`aarch64`** (`arm64`). A\nprocess under emulation answers what its kernel tells it; windows\nanswers the architecture the program was built for.\n\nTotal: no row, no trap. The checked machine answers the host's.\nlupin resolves the call from 0.1.59 (wolf-interp#277).\n\nCapability `env`; refused at comptime (D33). Delegates to `os_arch`.\n\n```wolf-doc-example\nlet a = os.arch()\na == \"x86_64\" || a == \"aarch64\"\n```",
          "source": "std/os/os.lu",
          "line": 125,
          "tier": "core"
        }
      ]
    },
    {
      "name": "os.random",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.os.random — OS-sourced bytes, never a userspace generator.\nStability tier: core. Capability `env` (platform admission) and Random\n(os_random); categorically refused at comptime. This is not std.rand's\nseeded PCG stream, and never seeds, retries with, or falls back to it.\n\nThe pinned language contract [os.random.platform] specifies Linux\ngetrandom(flags=0), continuing short reads/EINTR and waiting for the\ninitialized kernel pool; macOS getentropy in <=256-byte requests.\nThese are the runtime's calls, not new std bindings. [os.random.trap]\nmakes provider failure an UNCAUGHT assert trap, not an error row.\nThis wrapper cannot convert that trap to entropy_unavailable. A\nreadiness admission can prevent a known unqualified draw, not promise\nfuture provider health; a provider can fail after a successful check.\nOn Linux/macOS require_ready admits the documented OS-call contract,\nNOT a snapshot that the pool is initialized or the next call succeeds.\nLinux can still wait. PAX admission stays behind one private function\npending the kernel's exact readable capability/ABI; until then it\nrefuses by name before any legacy random call. No guessed CPUID,\nprocessor/vendor, flag, file or errno can authorize that draw.\n\nOrdinary lists/regions are not secure erasure, locking or dump policy.\nNever log samples or claim unpredictability from statistical tests.",
      "summary": "std.os.random — OS-sourced bytes, never a userspace generator.",
      "items": [
        {
          "name": "require_ready",
          "kind": "fn",
          "signature": "pub fn require_ready() -> () ! {entropy_unqualified}",
          "doc": "Checks that this platform is admitted for the documented OS-source\ncontract. `entropy_unqualified` refuses PAX until its strict capability\nadapter lands, and any platform outside this Linux/macOS profile.\nIt does not draw bytes or test provider liveness. Callers requiring a\nnamed refusal must check readiness before a draw; bytes also checks it.\nNo error is caught or converted to a deterministic fallback.\nCapability `env`; refused at comptime. No traps on this path.\n\n```wolf-doc-example\nrandom.require_ready() else |entropy_unqualified| { }\n```",
          "source": "std/os/random/random.lu",
          "line": 42,
          "tier": "core"
        },
        {
          "name": "bytes",
          "kind": "fn",
          "signature": "pub fn bytes(n: int) -> List[byte] ! {entropy_unqualified}",
          "doc": "Exactly n OS-sourced bytes, or the named platform-admission refusal\n`entropy_unqualified`. n==0 succeeds without drawing or admission.\nNegative n traps assert (the language's caller contract). OS provider\nfailure STILL TRAPS assert per [os.random.trap], including after an\nadmission check. There is deliberately no claimed entropy_unavailable\nrow. No fallback, seeding, partial successful result or caught trap.\nLinux waits for initialization; macOS uses the runtime's getentropy.\nCapabilities `env` and Random; refused at comptime. Memory is O(n);\ncallers bound n before allocation. This does not promise secret erasure.\n\n```wolf-doc-example\nrandom.bytes(0)?.len == 0\n```",
          "source": "std/os/random/random.lu",
          "line": 61,
          "tier": "core"
        }
      ]
    },
    {
      "name": "os.users",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.os.users — the machine's ACCOUNTS, as its two plain files write\nthem: a user line of `passwd(5)` and a group line of `group(5)`.\nStability tier: core.\n\n**Pure parsing, and nothing else.** Every function here takes TEXT\nthe caller already holds and answers from it. Nothing in this module\nopens a file, asks a name service (NSS, a directory server, a\ncache), or reaches the host at all: it carries no capability and it\nruns at comptime. The program that wants the machine's accounts\nreads them itself and says where from —\n`users.user_named(fs.read_text(\"/etc/passwd\")?, \"wolf\")` — so the\nfile it trusted is in its own source, which is what `su`, `login`,\n`id` and `ls -l` need and all a module without a name service can\nhonestly offer. A host that keeps its accounts somewhere else (a\ndirectory service, macOS's for most of its users) is not answered by\nthese files, and this module does not pretend otherwise — the next\nparagraph says exactly what that costs.\n\n**What the two files cannot see** (wolf-std#68, ruling #99 R2: the\nlimit is documented, and the fix is a builtin, not a better reader).\nmacOS keeps every ordinary user — every account System Settings\nmakes — and every local user's group memberships in its directory\nservice (Open Directory, whose local node is\n`/var/db/dslocal/nodes/Default`). Its `/etc/passwd` and `/etc/group`\ncarry `root`, `nobody`, `daemon` and the system's `_` accounts, and\nthe password file's own header says it is \"consulted directly only\nwhen the system is running in single-user mode\". On linux the same is\ntrue of every account `nsswitch.conf` sends elsewhere: LDAP, NIS,\nSSSD, systemd's dynamic users. For such an account each lookup here\nanswers `none`, `users` and `groups` leave it out, and `groups_of`\ngives the primary id it was handed and nothing more — so `id NAME`,\n`whoami`, `chown user:group`, `chgrp` and `groups` written over this\nmodule say \"no such user\" where the host's own tools answer. bu24\nmeasured it: 30 name-printing cases skip on CI's macOS runner, whose\nown account is the directory service's, and\n`tests/os/users/directory_accounts.lu` holds it as a row there: the\nhost names the runner's uid, `/etc/passwd` answers `none` for it by\nid and by name, and `groups_of` misses groups the process holds.\n\nA pure reader cannot see a name service, so nothing here will grow\none. The future fix is a host account lookup — the C library's\n`getpwnam`, `getpwuid`, `getgrnam`, `getgrgid` and `getgrouplist`,\nwhich ask whatever the host is configured to ask — as wolf builtins,\nasked of wolf-lang from wolf-std#68; when they land, host lookups ship\nBESIDE these functions and every function here keeps its answer.\nUntil then two things still work on every host: the NUMBERS\n(`std.env.uid`, `std.env.groups`, `std.fs.stat` answer ids whatever\nkeeps the names, and printing the number when a lookup is `none` is\nwhat `id` itself does for an id no name service knows), and the\nhost's own tool, started through `std.process` — `/usr/bin/id -un`\nis how the row above learns the name the files do not hold.\n\n**What it is for.** `std.env.uid` and `std.fs.stat` answer NUMBERS;\nthis is where a number gets its name and a name its number, and\nwhere the three arguments of `std.process.set_ids` come from:\n`user_named` gives the user and group ids, `groups_of` the\nsupplementary groups.\n\n**The two lines.**\n\n```text\nname:password:uid:gid:comment:home:shell         a user  (7 fields)\nname:password:gid:member,member,…                a group (4 fields)\n```\n\nThe fields are cut at `:` and at nothing else; none is trimmed. A\nline is well formed when it has exactly that many fields, its name\nis not empty and its ids are decimal. The password field is carried\nby neither type: on every current host it is a placeholder (`x`,\n`*`), the real one being in a file this module does not read.\n\n**An id** is `0..=4294967294`. A leading `-` is read the way the\nhost reads it — as that many below 4294967296 — because macOS writes\n`nobody` as `-2`, which is 4294967294; `-1` is therefore no id (it\nis every host call's \"leave this one alone\") and a line carrying it\nis malformed.\n\n**Errors are rows, never traps** (D30, §2). Two tags:\n\n- `parse` — one line is not a user (or a group) line: `parse_user`,\n  `parse_group`.\n- `none` — the text holds no such account: the four lookups.\n\nThe readers of a whole text (`users`, `groups`, the lookups,\n`groups_of`) SKIP what is not an account line — a blank line, a `#`\ncomment (macOS's file opens with ten), a `+`/`-` compatibility\nentry, a malformed line — instead of failing the file for it: one\nbad line must not lock every user out, and `parse_user` is there for\nthe program that wants to report it.",
      "summary": "std.os.users — the machine's ACCOUNTS, as its two plain files write them: a user line of `passwd(5)` and a group line of `group(5)`.",
      "items": [
        {
          "name": "User",
          "kind": "struct",
          "signature": "pub struct User { name: str, uid: int, gid: int, comment: str, home: str, shell: str, }",
          "doc": "One user: a line of `passwd(5)`, less its password field.",
          "source": "std/os/users/users.lu",
          "line": 94,
          "tier": "core"
        },
        {
          "name": "Group",
          "kind": "struct",
          "signature": "pub struct Group { name: str, gid: int, members: List[str], }",
          "doc": "One group: a line of `group(5)`, less its password field.",
          "source": "std/os/users/users.lu",
          "line": 110,
          "tier": "core"
        },
        {
          "name": "parse_user",
          "kind": "fn",
          "signature": "pub fn parse_user(line: str) -> User ! {parse}",
          "doc": "One user line, parsed.\n\nTotal over text and PURE — comptime-safe, reaching no host. The line\nis taken as written, without its newline.\n\nRows: `parse` when `line` does not have exactly seven `:`-separated\nfields, its name is empty, or its user or group id is not a decimal\nid (the module header says what an id is). Never traps.\n\n```wolf-doc-example\nlet u = users.parse_user(\"wolf:x:1000:1000:A Wolf:/home/wolf:/bin/sh\")?\nu.name == \"wolf\" && u.uid == 1000 && u.gid == 1000\nu.comment == \"A Wolf\" && u.home == \"/home/wolf\" && u.shell == \"/bin/sh\"\nlet nobody = users.parse_user(\"nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false\")?\nnobody.uid == 4294967294\n```",
          "source": "std/os/users/users.lu",
          "line": 172,
          "tier": "core"
        },
        {
          "name": "parse_group",
          "kind": "fn",
          "signature": "pub fn parse_group(line: str) -> Group ! {parse}",
          "doc": "One group line, parsed.\n\nTotal over text and PURE. The member list is cut at `,`; an empty\npiece (a trailing comma, an empty list) is not a member.\n\nRows: `parse` when `line` does not have exactly four `:`-separated\nfields, its name is empty, or its group id is not a decimal id.\nNever traps.\n\n```wolf-doc-example\nlet g = users.parse_group(\"pack:x:2000:wolf,cub\")?\ng.name == \"pack\" && g.gid == 2000 && g.members.len == 2 && g.members[1] == \"cub\"\nlet empty = users.parse_group(\"lone:x:2001:\")?\nempty.members.len == 0\n```",
          "source": "std/os/users/users.lu",
          "line": 197,
          "tier": "core"
        },
        {
          "name": "users",
          "kind": "fn",
          "signature": "pub fn users(text: str) -> List[User]",
          "doc": "Every user in `text` — the text of a `passwd(5)` file — in the\nfile's order.\n\nTotal and PURE. A line that is not a user line (blank, a `#`\ncomment, a `+`/`-` entry, malformed) is passed over; `parse_user`\nsays why one line is refused. **Every user the FILE holds, not every\nuser the host has**: on macOS the list read from `/etc/passwd` is\nroot, nobody, daemon and the `_` system accounts, never the people\n(the module header's \"What the two files cannot see\").\n\n```wolf-doc-example\nlet all = users.users(\"# accounts\\nroot:x:0:0:root:/root:/bin/sh\\nbroken line\\nwolf:x:1000:1000::/home/wolf:\\n\")\nall.len == 2 && all[0].name == \"root\" && all[1].uid == 1000\n```",
          "source": "std/os/users/users.lu",
          "line": 226,
          "tier": "core"
        },
        {
          "name": "groups",
          "kind": "fn",
          "signature": "pub fn groups(text: str) -> List[Group]",
          "doc": "Every group in `text` — the text of a `group(5)` file — in the\nfile's order.\n\nTotal and PURE. Lines that are not group lines are passed over, as\n`users` passes them. Every group the FILE holds, with the members the\nfile writes: a group or a membership the host keeps elsewhere (macOS's\ndirectory service, LDAP, NIS) is not in it.\n\n```wolf-doc-example\nlet all = users.groups(\"root:x:0:\\npack:x:2000:wolf,cub\\n\\n\")\nall.len == 2 && all[1].name == \"pack\" && all[1].members[0] == \"wolf\"\n```",
          "source": "std/os/users/users.lu",
          "line": 252,
          "tier": "core"
        },
        {
          "name": "user_named",
          "kind": "fn",
          "signature": "pub fn user_named(text: str, name: str) -> User ! {none}",
          "doc": "The FIRST user in `text` named `name` — what `su name` looks up.\n\nPURE. The first line wins, as it does for the host's own reader.\n\nRows: `none` when no user line carries that name — which is also\nthe answer for an account the host keeps outside the file (macOS's\ndirectory service, LDAP, NIS), however well the host knows it; the\nmodule header says what that costs `su`, `chown` and `id`. Never\ntraps.\n\n```wolf-doc-example\nlet text = \"root:x:0:0:root:/root:/bin/sh\\nwolf:x:1000:1000::/home/wolf:/bin/sh\\n\"\nlet u = users.user_named(text, \"wolf\")?\nu.uid == 1000 && u.home == \"/home/wolf\"\nlet missing = users.user_named(text, \"cub\") else |_| users.parse_user(\"none:x:7:7:::\")?\nmissing.uid == 7\n```",
          "source": "std/os/users/users.lu",
          "line": 283,
          "tier": "core"
        },
        {
          "name": "user_by_id",
          "kind": "fn",
          "signature": "pub fn user_by_id(text: str, uid: int) -> User ! {none}",
          "doc": "The FIRST user in `text` whose id is `uid` — the name `ls -l` and\n`id` print for a number.\n\nPURE. Two names may share an id; the first line wins.\n\nRows: `none` when no user line carries that id — also for an id\nwhose account the host keeps outside the file, which on macOS is the\nid of every ordinary user (`id` and `ls -l` print the NUMBER then).\nNever traps.\n\n```wolf-doc-example\nlet text = \"root:x:0:0:root:/root:/bin/sh\\nwolf:x:1000:1000::/home/wolf:/bin/sh\\n\"\nlet u = users.user_by_id(text, 0)?\nu.name == \"root\"\n```",
          "source": "std/os/users/users.lu",
          "line": 307,
          "tier": "core"
        },
        {
          "name": "group_named",
          "kind": "fn",
          "signature": "pub fn group_named(text: str, name: str) -> Group ! {none}",
          "doc": "The FIRST group in `text` named `name` — what `chgrp name` looks up.\n\nPURE.\n\nRows: `none` when no group line carries that name, including a group\nthe host keeps outside the file (the module header). Never traps.\n\n```wolf-doc-example\nlet g = users.group_named(\"root:x:0:\\npack:x:2000:wolf\\n\", \"pack\")?\ng.gid == 2000\n```",
          "source": "std/os/users/users.lu",
          "line": 327,
          "tier": "core"
        },
        {
          "name": "group_by_id",
          "kind": "fn",
          "signature": "pub fn group_by_id(text: str, gid: int) -> Group ! {none}",
          "doc": "The FIRST group in `text` whose id is `gid`.\n\nPURE.\n\nRows: `none` when no group line carries that id, including a group\nthe host keeps outside the file (the module header). Never traps.\n\n```wolf-doc-example\nlet g = users.group_by_id(\"root:x:0:\\npack:x:2000:wolf\\n\", 2000)?\ng.name == \"pack\"\n```",
          "source": "std/os/users/users.lu",
          "line": 347,
          "tier": "core"
        },
        {
          "name": "groups_of",
          "kind": "fn",
          "signature": "pub fn groups_of(text: str, name: str, gid: int) -> List[int]",
          "doc": "The groups user `name` belongs to, by the group file's `text`:\n`gid` — the user's own group, from their `User.gid` — first, then\nthe id of every group that lists `name` as a member, in the file's\norder, each id once.\n\nThis is the list a login gives a process (`initgroups`, as far as\nthe file alone decides it), and the third argument of\n`std.process.set_ids`: `process.set_ids(u.uid, u.gid,\nusers.groups_of(group_text, u.name, u.gid))`.\n\n**As far as the file alone decides it, and no further.** A\nmembership the host records elsewhere is not here: macOS writes no\nlocal user into `/etc/group` (the directory service holds every\nmembership), so for such a user this answers `[gid]` alone while the\nprocess the host started holds more (`std.env.groups()` reads\nthose). A program that drops privileges to a directory-service user\nover this list drops them further than a login would.\n\nTotal and PURE.\n\n```wolf-doc-example\nlet text = \"root:x:0:\\nwolf:x:1000:\\npack:x:2000:cub,wolf\\nden:x:3000:wolf\\nfox:x:4000:fox\\n\"\nlet gs = users.groups_of(text, \"wolf\", 1000)\ngs.len == 3 && gs[0] == 1000 && gs[1] == 2000 && gs[2] == 3000\n```",
          "source": "std/os/users/users.lu",
          "line": 381,
          "tier": "core"
        }
      ]
    },
    {
      "name": "poll",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.poll — one wait over files, sockets and signals, answering every\nready entry once. Stability tier: core.\n\nKeep one owned Waiter across the server loop: open, add_file,\nadd_socket and add_listener; modify interests as output queues fill or\nempty; remove entries before closing their handles; close the waiter.\nFiles and sockets share one wait with signal meanings and a monotonic\ndeadline. A meaning never hides ready handles.\n\nThe readiness set opens lazily on the first valid add or wait. Native\nLinux and macOS hold it in the kernel: O(ready) per wait, plus O(polled)\nfor descriptors the kernel set cannot hold (regular files included).\nThe checked machine keeps a set of its own and scans O(N). Where set\nopening answers unsupported, a list feeds os_wait_ready: O(N), up to\ntwo elements per entry. Results follow runtime order, unspecified for\na persistent set and key order for the list fallback. A persistent-set\nwait neither sorts results nor scans the held keys.\n\nA waiter holds at most 256 entries, matching the smallest serving\nruntime's set bound. Registration 257 answers io without changing it;\nshape and duplicate errors still answer invalid first. The capacity\nrefusal makes no host call and does not replace os_error's last result.\nA runtime handle close removes its registration; remove before close\nto release std's bookkeeping and reuse its key.\n\nREAD and WRITE are interests and facts; HANGUP and ERROR are real host\nfacts, returned with the applicable interest. A read loop tests READ\nand lets its read name the end: eof, closed, or a pty master's io on\nLinux. A non-blocking writer uses fs.write_some or net.write_some,\nretains unsent bytes and enables WRITE only while its queue has bytes.\nbusy means wait for room and retry, never discard the unsent bytes.\n\nLinux and macOS serve every combination. Windows preserves its narrow\nsockets-only READ wait, no meanings, through net.wait (only READ facts\nknown there), and its empty deadline-only waits with no meanings.\nOther fallback combinations use os_wait_ready and its host refusal.\nPAX uses the static Linux binary. lupin 0.1.62 refuses readiness calls\nat run by builtin name, not a caught unsupported error mark.\n\nCapability exec for sets/waits, net for the Windows narrow fallback,\nand Clock for its positive deadlines.\nFallback adds validate through fs metadata or a zero-deadline net look\n(fs or net respectively); they publish no key before validation.\nAll host calls are refused at comptime. open, len and constants are\npure. modify/remove\nretain {invalid, io}: unsupported from a set change is explicitly\nhandled as io. A set that opened cannot meet it on that same host;\ntests/poll/set_mutation.lu holds that fact.",
      "summary": "std.poll — one wait over files, sockets and signals, answering every ready entry once.",
      "items": [
        {
          "name": "READ",
          "kind": "const",
          "signature": "pub const READ: int = 1",
          "doc": "Interest and fact: a read or accept would not park, including an end.\n\n```wolf-doc-example\npoll.READ == 1\n```",
          "source": "std/poll/poll.lu",
          "line": 62,
          "tier": "core"
        },
        {
          "name": "WRITE",
          "kind": "const",
          "signature": "pub const WRITE: int = 2",
          "doc": "Interest and fact: room for a byte, or a write that would fail at once.\n\n```wolf-doc-example\npoll.WRITE == 2\n```",
          "source": "std/poll/poll.lu",
          "line": 69,
          "tier": "core"
        },
        {
          "name": "HANGUP",
          "kind": "const",
          "signature": "pub const HANGUP: int = 4",
          "doc": "Fact: the other end hung up, accompanied by an applicable interest.\n\n```wolf-doc-example\npoll.HANGUP == 4\n```",
          "source": "std/poll/poll.lu",
          "line": 76,
          "tier": "core"
        },
        {
          "name": "ERROR",
          "kind": "const",
          "signature": "pub const ERROR: int = 8",
          "doc": "Fact: a host error, accompanied by the requested interest.\n\n```wolf-doc-example\npoll.ERROR == 8\n```",
          "source": "std/poll/poll.lu",
          "line": 83,
          "tier": "core"
        },
        {
          "name": "Waiter",
          "kind": "struct",
          "signature": "pub struct Waiter { set: int, kinds: List[int], handles: List[int], interests: List[int], count: int, }",
          "doc": "An owned waiter holding at most 256 entries, named by stable keys.\nFields are bookkeeping, not an API for constructing a waiter: set is\n-1 before acquisition, -2 for the list fallback, else a runtime set.\nEntry handles remain the caller's.",
          "source": "std/poll/poll.lu",
          "line": 105,
          "tier": "core"
        },
        {
          "name": "Ready",
          "kind": "struct",
          "signature": "pub struct Ready { key: int, facts: int, }",
          "doc": "One ready entry: its key and READ/WRITE/HANGUP/ERROR facts.",
          "source": "std/poll/poll.lu",
          "line": 114,
          "tier": "core"
        },
        {
          "name": "Events",
          "kind": "struct",
          "signature": "pub struct Events { meaning: int, ready: List[Ready], }",
          "doc": "Every ready entry once, in runtime order (unspecified for a set), and\none meaning taken off the queue, or 0. Both may arrive together.\nEmpty ready and meaning 0 means the deadline passed.",
          "source": "std/poll/poll.lu",
          "line": 122,
          "tier": "core"
        },
        {
          "name": "open",
          "kind": "fn",
          "signature": "pub fn open() -> Waiter ! {io}",
          "doc": "A new empty waiter; acquire its host set lazily at add/wait. Pure\nconstruction, but this edition's comptime engine cannot materialize\nits List fields ([type.list.lit.value]). The reserved io row stays\nunchanged; acquisition failures belong to the first add/wait.\n\n```wolf-doc-example\nvar w = poll.open()?\npoll.len(w) == 0\npoll.close(take w)?\n```",
          "source": "std/poll/poll.lu",
          "line": 137,
          "tier": "core"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(w: Waiter) -> int",
          "doc": "The number of entries added and not removed. Total and pure.",
          "source": "std/poll/poll.lu",
          "line": 148,
          "tier": "core"
        },
        {
          "name": "close",
          "kind": "fn",
          "signature": "pub fn close(take w: Waiter) -> () ! {io}",
          "doc": "Close the set, consuming w, leaving its entry handles open. io for a\nfailed close or forged set. Capability exec when acquired; comptime\nrefuses the host call. A never-acquired or fallback waiter has no set.",
          "source": "std/poll/poll.lu",
          "line": 155,
          "tier": "core"
        },
        {
          "name": "add_file",
          "kind": "fn",
          "signature": "pub fn add_file(mut w: Waiter, f: fs.File, interest: int) -> int ! {invalid, io, unsupported}",
          "doc": "Add f with READ, WRITE or both; return the lowest free key, stable\nuntil removal. invalid for duplicates, invalid interest, negative or\nwait-marked handles. io for capacity (256), a closed/forged handle or\nhost failure; unsupported where registration is unsupported. Remove\nbefore closing f. Capability exec for a set, fs for fallback handle\nvalidation; refused at comptime.",
          "source": "std/poll/poll.lu",
          "line": 232,
          "tier": "core"
        },
        {
          "name": "add_socket",
          "kind": "fn",
          "signature": "pub fn add_socket(mut w: Waiter, s: net.Socket, interest: int) -> int ! {invalid, io, unsupported}",
          "doc": "Add a TCP or Unix stream with READ, WRITE or both. Keys and rows are\nadd_file's; file and net handle numbers belong to separate tables.\nCapability exec for a set, net for fallback handle validation;\nrefused at comptime.",
          "source": "std/poll/poll.lu",
          "line": 240,
          "tier": "core"
        },
        {
          "name": "add_listener",
          "kind": "fn",
          "signature": "pub fn add_listener(mut w: Waiter, l: net.Listener) -> int ! {invalid, io, unsupported}",
          "doc": "Add l with READ (a pending connection). Keys and rows are add_file's.\nCapability exec for a set, net for fallback handle validation;\nrefused at comptime.",
          "source": "std/poll/poll.lu",
          "line": 247,
          "tier": "core"
        },
        {
          "name": "modify",
          "kind": "fn",
          "signature": "pub fn modify(mut w: Waiter, key: int, interest: int) -> () ! {invalid, io}",
          "doc": "Change key's interest to READ, WRITE or both. invalid for a non-live\nkey, bad interest, or WRITE on a listener; io for a runtime failure.\nAn opened set cannot answer unsupported on this host; that delegate\noutcome is handled as io. Capability exec when acquired; refused at\ncomptime. No host call is needed on the list fallback.",
          "source": "std/poll/poll.lu",
          "line": 275,
          "tier": "core"
        },
        {
          "name": "remove",
          "kind": "fn",
          "signature": "pub fn remove(mut w: Waiter, key: int) -> () ! {invalid, io}",
          "doc": "Remove key before closing its handle; the key becomes free. invalid\nfor a non-live key; io for a runtime failure, including an already\nclosed handle removed by the runtime. An opened set cannot answer\nunsupported on this host; that delegate outcome is handled as io.\nCapability exec when acquired; refused at comptime.",
          "source": "std/poll/poll.lu",
          "line": 289,
          "tier": "core"
        },
        {
          "name": "wait",
          "kind": "fn",
          "signature": "pub fn wait(mut w: Waiter, meanings: int, deadline_ms: int) -> Events ! {invalid, io, unsupported}",
          "doc": "Wait for every ready entry and one signal meaning, together. meanings\nis 0 or a set listened for through std.signal; deadline_ms is 0 for a\nlook, -1 for no deadline, otherwise monotonic milliseconds. A timeout\nis never answered early; ready entries may answer before the deadline.\nLevel-triggered: readiness remains until consumed.\n\ninvalid for a deadline below -1, a non-listenable meaning bit, or an\nempty waiter with no meanings and no deadline. io for a host failure;\nunsupported where the host or tier does not serve the call. Linux and\nmacOS serve files+sockets, signals+sockets, socket WRITE and files\nwithout meanings. Windows retains its narrow socket READ case and\nempty no-meaning deadline waits. Capability exec (net on that narrow\nfallback, plus Clock for positive deadlines); refused at comptime.\nNever traps for a host failure.\n\n```wolf-doc-example\nvar w = poll.open()?\nlet ev = poll.wait(mut w, 0, 0)?\npoll.close(take w)?\nev.ready.len == 0\nev.meaning == 0\n```",
          "source": "std/poll/poll.lu",
          "line": 330,
          "tier": "core"
        }
      ]
    },
    {
      "name": "pool",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.pool — the ergonomic layer over the language's `Pool[T]` and\n`handle T` (X5). Stability tier: core.\n\nThe X5 contract this module never softens: a handle is checked at\nDEREFERENCE, `pool[h]`, and a dead handle traps `stale-handle` there\nin every profile. There is deliberately no static staleness check, and\nnothing here turns a liveness question into a license — `has` (when it\nbecomes writable, below) is a probe, and code that acts on its answer\nstill dereferences and can still trap.\n\n**What is the language's and what is std's** (F-0011): `Pool[T]` is a\nlanguage-blessed core type. The language owns construction\n(`Pool[T]()`), the two-phase `reserve`/`init` protocol\n(`[mem.shared.handle.1]`: reserve yields the handle, init fills the\nslot — no null handles ever exist), removal (`remove`), and the\nchecked deref `pool[h]`. This module owns the named operations over\nthem, starting with the one-step allocation the two-phase protocol\nmakes verbose.\n\nIteration order over a pool is UNSPECIFIED — and, at the pins, absent:\nneither implementation iterates a pool at all. Do not write code that\ndepends on slot order even when iteration lands.",
      "summary": "std.pool — the ergonomic layer over the language's `Pool[T]` and `handle T` (X5).",
      "items": [
        {
          "name": "alloc",
          "kind": "fn",
          "signature": "pub fn alloc[T](mut p: Pool[T], v: T) -> handle T",
          "doc": "Reserves a slot, initializes it with `v`, and hands back its handle —\nthe two-phase protocol collapsed into the one-step form callers\nusually want. Total: no error row, no traps beyond allocation (the\nhandle is live by construction; there are no null handles).\n\n```wolf-doc-example\nvar p = Pool[int]()\nlet h = pool.alloc(mut p, 41)\np[h] == 41\n```",
          "source": "std/pool/pool.lu",
          "line": 36,
          "tier": "core"
        },
        {
          "name": "free",
          "kind": "fn",
          "signature": "pub fn free[T](mut p: Pool[T], h: handle T)",
          "doc": "Releases `h`'s slot. Every copy of `h` is stale afterwards, and\ndereferencing any of them traps `stale-handle` — in every profile,\nby design (X5). Freeing an already-free handle is itself a stale use\nand traps the same way.\n\n```wolf-doc-example\nvar p = Pool[int]()\nlet h = pool.alloc(mut p, 1)\npool.free(mut p, h)\nlet g = pool.alloc(mut p, 2)\np[g] == 2\n```",
          "source": "std/pool/pool.lu",
          "line": 54,
          "tier": "core"
        }
      ]
    },
    {
      "name": "prelude",
      "group": "Foundations and ordering",
      "tier": "core",
      "doc": "std.prelude — the ambient facade, listed in one place (D31).\nStability tier: core (the facade itself); contents below are sc00\nSCAFFOLDING — three trivial functions that exist to prove the rig's\nstaging loop end to end, replaced by the real facade listing when\nsc01 opens the language work. They follow API-CONVENTIONS.md so the\nfirst real module has a shaped example to copy.",
      "summary": "std.prelude — the ambient facade, listed in one place (D31).",
      "items": [
        {
          "name": "least",
          "kind": "fn",
          "signature": "pub fn least(a: int, b: int) -> int",
          "doc": "Least of two ints; returns `b` when they are equal. Total: no error\nrow, no traps.\n\n```wolf-doc-example\nprelude.least(3, 7) == 3\n```",
          "source": "std/prelude/prelude.lu",
          "line": 16,
          "tier": "core"
        },
        {
          "name": "greatest",
          "kind": "fn",
          "signature": "pub fn greatest(a: int, b: int) -> int",
          "doc": "Greatest of two ints; returns `b` when they are equal. Total: no\nerror row, no traps.\n\n```wolf-doc-example\nprelude.greatest(3, 7) == 7\n```",
          "source": "std/prelude/prelude.lu",
          "line": 26,
          "tier": "core"
        },
        {
          "name": "magnitude",
          "kind": "fn",
          "signature": "pub fn magnitude(n: int) -> int",
          "doc": "Magnitude of `n`. Traps `overflow` at the minimum int, because the\nmagnitude of `int.min` is not representable and arithmetic is checked\nin every profile (X3) — spell a wrapping intent explicitly if you\nmean one.\n\n```wolf-doc-example\nprelude.magnitude(0 - 9) == 9\n```",
          "source": "std/prelude/prelude.lu",
          "line": 38,
          "tier": "core"
        }
      ]
    },
    {
      "name": "process",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.process — build a command as an argument VECTOR, start it — alone,\nor with a set of listeners handed down to it — wait for its exit code,\nkill it, and end this process. Stability tier: core.\n\n**The PARENT half of descriptor inheritance lives here** (`start_with`,\nsc39), and the child half is `std.net.adopt_listener` (sc37). A prefork\nmaster binds its listeners once, spawns each worker with the set, and\neach worker adopts by POSITION — descriptors `3, 4, …` in the order\ngiven, `[os.proc.inherit]`. Until sc39 that handshake was written\nacross two tiers, the parent through the builtin and the child through\n`std.net`, which is the one thing wolf-std#6's consumer named that was\nwolf-std's to fix rather than a consumer's to accept (wolf-std#9). **The\nset is an argument of the SPAWN and never a field of the `Command`** —\nthe reasoning is on `start_with`, and it is about lifetime: a listener\nset belongs to the master and each spawn borrows it.\n\n**There is no shell here, and there never will be.** The builtin tier\ntakes an argv ARRAY and nothing else (`os_spawn(List[str])`), so a\ncommand is a program name plus its arguments as separate values, all\nthe way down to the host's `execve`. No string is ever parsed into\nwords, no `sh -c` exists to parse one, and a file name containing a\nspace, a quote or a `;` is therefore just an argument. Injection is off\nthe table by construction rather than by escaping, which is the whole\nreason this module's builder shape is the ONLY way to spawn: a\nconvenience that took `\"grep -n {pattern} {path}\"` would have to invent\nquoting rules, and every quoting rule anyone has ever written has had a\nhole in it.\n\n**Capability: `Exec` (I13).** `start`, `run`, `wait`, `kill`, `exit`,\n`exit_signal`, `fork`, `poll`, `wait_status_core`, `poll_core`,\n`lead_group`, `join_group`, `start_session`, `lead_session`,\n`set_core_limit` and `core_off` reach the host's process table\n(`own_group`, `own_session` and `core_limit` read this process's\ncontext: `env`), are tagged `exec` in the toolchain's\nsandbox table, and are categorically refused at comptime (D33) — with\nthe sandbox table's own reason, which is worth quoting because it is\nsharper than \"determinism\": *compiling a package must never run or\nterminate programs on the machine that compiles it*. `wolf add` may not\nmean arbitrary code executes with the builder's credentials. The\nrefusal is `E0701` and `tests/process/comptime_refuses.lu` holds it one\nlevel down, at `os_kill`, because a `comptime fn` cannot call across a\nmodule boundary at this pin (F-0051) and because `os_spawn`'s `List[str]`\nargument is outside the comptime engine's subset — the witness has to be\nthe builtin whose only argument is an `int`, with its row HANDLED rather\nthan propagated, since `?` inside a `comptime fn` is `unsupported` and\nmasks the refusal entirely (F-0069). The builder half of this module\n(`command`, `from_argv`, `push_arg`, `argv`, `is_success`) reaches\nNOTHING and is comptime-safe — in an os module the pure function is the\nsurprising one, so it is spelled out here and on each of them (§14).\n\"Comptime-safe\" is a statement about the sandbox and not a promise that\nyou can call it: F-0051 means no `comptime fn` can call across a module\nboundary at this pin, so the builder is comptime-safe and\ncomptime-unreachable at the same time — exactly where `std.net`'s address\nhelpers and `std.fs`'s path helpers stand.\n\n**Errors are rows, never traps** (D30, §14): a program that is not\nthere, a directory that will not execute, a child that died on a\nsignal, a handle that was already reaped — every one of them is an\nORDINARY outcome a caller handles with `else` or propagates with `?`.\nNothing here traps. The vocabulary is the s40 builtin tier's, adopted\nverbatim so std adds no translation layer:\n\n- `not_found` — no such program (and the same tag for an EMPTY argv,\n  which names no program at all)\n- `denied` — the host refused to execute it (permissions, a directory,\n  a file with no execute bit)\n- `signal` — the child died WITHOUT an exit code: killed, or crashed.\n  Its own outcome and never a fake code, because every fake would\n  collide with a code a program can really return (§12: one tag per\n  failure mode a caller can act on)\n- `io` — every other host failure, including a forged, foreign or\n  already-reaped handle, coarsened to one tag because the builtin tier\n  reports one and no caller can act on the difference (§12's rule 3)\n\n**An exit code is an `int`, and a handle is a TYPE.** The builtin tier\nhands out two bare integers whose meanings are unrelated — a child\nhandle from `os_spawn`, an exit code from `os_wait` — and passing one\nwhere the other belongs is the mistake this module exists to make\nimpossible: `Child` is a struct, so a code can never be waited on and a\nhandle can never be compared with 0. The code itself stays an `int`,\nbecause that is what it is: the number the child returned, in\n`0..255` on every tier-1 host, with `0` meaning success (`is_success`\nsays so once so that no caller writes the convention out).\n\n**A child's stdio is INHERITED, and this paragraph said the opposite\nfor four sprints.** It was headed \"the stdio of a child is CLOSED at\nthis pin\" and said `os_spawn` wired all three streams to the host's\nnull device, so nothing a child wrote reached the parent's streams.\n**Measured at sc39 and false**: a self-spawned child's `print` lands\nin the PARENT's stdout on the native lane, and on the checked lane the\nchild's diagnostics land on the parent's stderr. Both spawn builtins\nbehave this way, with an empty inherit set and with a non-empty one.\nThe claim was never checkable here, because until sc39 no test in this\nrepository ran a child at all (F-0066); `tests/process/prefork_handoff.lu`\nis the first, and it is what caught this.\n\nSo: a child's output and diagnostics go WHERE THIS PROGRAM'S GO. Its\ninput does not: `[os.proc.spawn]` wires a child's descriptor 0 to the\nnull device, and the sentence that stood here until s215 (\"a child can\nread this program's input\") was never what the clause said. A library\nthat spawns a helper is putting that helper's chatter into its\ncaller's streams — plan for it.\n\n**Capture arrived at s215, and it is a map, not a mode.** wolf-lang\ns215 added `os_pipe` and `os_spawn_fds` (`[os.proc.pipe]`,\n`[os.proc.fds]`): a `Command` now carries a DESCRIPTOR MAP, built with\n`set_stdin`, `set_stdout`, `set_stderr`, `set_fd` and `close_fd`, and\n`pipe()` makes the two `std.fs` files a map hands down. A pipeline is\ntwo commands and a pipe; `2>&1` is one file given to two descriptors;\n`5<file` is `set_fd(mut c, 5, f)`. The map is DATA — a list of\n(child descriptor, file) pairs the builders keep — so nothing here\nparses a redirection either: a shell that reads `2>&1` from a script\nparses it itself and calls the builders. F-0065's capture half closes\nwith this; its other items stay below.\nFiled upstream as [wolf-lang#256](https://github.com/wolffe-lang/wolf-lang/issues/256):\n`[os.proc]` never states the posture, and `[os.proc.inherit]`'s\n\"descriptors 0, 1 and 2 are the spawn's ordinary stdio\" is the only\nsentence in the spec that touches it — \"ordinary\" being precisely the\nadjective that does not decide the question.\n\n**Waiting is what reaps, and the handle is consumed by it** (§14's\nhandle rule, in its second home). `wait(take ch)` ends the `Child`'s\nlife exactly as `fs.close(take f)` ends a `File`'s: a second wait is a\nstatic use-after-move rather than a row on every operation for a\ncondition the compiler can see, and `tests/process/use_after_wait.lu`\nholds the rejection as `fail(E1001)`. `kill` does NOT reap — it takes\n`mut ch` and leaves the handle alive for the `wait` that must follow,\nbecause a killed child that nobody waits for is a zombie on every unix.\nA `Child` a caller FORGES from data (`process.Child { slot: 4242 }`)\nanswers `io`, never a trap, for the same reason a missing file does: no\nfield is private at this pin, so a forged handle is a checkable\ncondition rather than a contract violation.\n\n**Jobs: the poll, the status and the group (sc64, wolf 0.2.31's s241\nand s242, rulings #79 and #84).** A shell's children change in three\nways, and `Status` keeps them apart: an exit (0..255), an end by a\nsignal (`-N`) and a stop (`256 + N`), which is not an ending — a\nstopped job is alive and waits for `fg` or `bg`. `poll` looks at every\nchild this program started without waiting and reports the first that\nended (reaping it) or stopped; with `std.signal`'s `listen` and `wait`\non `signal.child()` it is the wait a trapped signal cuts short. A job\nis a `Group`: `group_of` a leader started with `start_job(c, 0, …)`,\n`own_group` this process's, and `std.signal.send_group` signals every\nmember. `lead_group` and `join_group` move THIS process (an interactive\nshell at start and at exit; GNU `timeout` before its command).\n\n**A core, and the end by a signal (sc66, wolf 0.2.33's s246, ruling\n#88).** The released `wait_status` and `poll` answer `-N` for an end by\nsignal `N` whether or not the host wrote a core, and `Status` keeps\nevery answer it gave (R3 = D). A program that must say \"(core dumped)\"\nasks the siblings, `wait_status_core` and `poll_core`, whose answer for\nsuch an end is `-(256 + N)`; `status_from_core` reads it as the same\n`Status` and `dumped_core` (or `CoreChange.core`) says there was a core.\nWhich ends dump core is the host's. `exit_signal` ends THIS process by\na signal, so its parent reads the end its command had (R2).\n\n**The fork (sc69, wolf 0.2.34's s247, rulings #90 and #95).** `fork`\nmakes a child that runs on from the call, a copy of this program — a\nshell's subshell, where `start` runs another program. The parent's\nanswer names the child as a `Child` every call above serves; the\nchild's says it is the child (`is_child`) and ends with `exit`. It is\n`busy` while any task is live, so a program forks from `main` before\nits first spawn or after every scope has joined; the checked machine\nand windows answer `unsupported`, and a program's in-process path\nruns there.\n\n**The core a process's end may leave (sc72, wolf 0.2.35's s253,\n`[os.proc.core]`).** `core_limit` reads this process's core limit as a\n`CoreLimit` (soft and hard, -1 unlimited; read first, the limit it was\nborn with), `set_core_limit` sets it for this process and every child\nstarted after, and `core_off` makes THIS process dump no core whatever\nends it, on every host and every core pattern — GNU `timeout`'s own call\nbefore it ends itself by its command's signal (`exit_signal`). The\nreader is `env` (it reads this process's context, with `own_group`);\nthe set and the off call are `exec`, with `exit_signal`.\n\n**A session of its own (sc81, wolf 0.2.39's s290, `[os.proc.session]`,\n`[os.term.session]`).** A session is the unit a terminal belongs to:\nits keys, its hangup and its background stops reach every group of the\nsession that holds it, and nothing outside. `start_session` starts a\nchild that leads a new session, with no controlling terminal; a server\nthat forks calls `lead_session` in the child before its exec, which is\nwhat `sshd` does for each command it runs, so no key, hangup or\n`kill 0` of the server's session reaches the command, and none of the\ncommand's reaches the server. `own_session` reads this process's\nsession id. A child that must have a terminal of its own takes it\nafter `lead_session`, with `std.term.open_controlling`; `std.term`'s\n`Pty` says the whole order.\n\n**What is deliberately absent.** Each is a reviewed contract with a\nfiling behind it rather than an approximation:\n\n```text\noutput(c: Command) -> str ! {not_found, denied, signal, io}\nstdin_text(mut c: Command, text: str)\n    A child's whole stdout as a `str`, and text written to its stdin,\n    as one call each. Buildable since s215 from `pipe` and the map,\n    and left out on purpose until a consumer needs the convenience:\n    the only correct `output` reads the pipe WHILE the child runs (a\n    child that fills a pipe nobody drains blocks forever), which\n    wants a task, and the first consumer (pelt) does its own\n    plumbing.\nenv_for(mut c: Command, name: str, value: str)\ncurrent_dir(mut c: Command, path: str)\n    A child's environment and working directory. `os_spawn` inherits\n    both from the parent and takes no third argument (F-0065). A\n    caller that must change them today changes its OWN with\n    `std.env.set` before spawning, which is a different thing and is\n    not documented as if it were the same.\ntry_wait(mut ch: Child) -> int ! {none, signal, io}\n    Has THIS one finished? Not a per-handle try: since wolf 0.2.31\n    `poll` (s242, ruling #84) answers \"has any child of mine ended or\n    stopped?\" without blocking, and ruling #84 R1 chose that shape\n    over a try per handle (one call per job per look).\nwait_timeout(mut ch: Child, d: Duration)\n    Same gap as the net tier's deadline (F-0049): no builtin arms one.\npid(ch: Child) -> int\n    The `Child`'s field is the MACHINE's table index, not the host's\n    process id, so an accessor named `pid` would name something this\n    tier does not have. Nothing reports a real pid (F-0065).\nsignal_of(…) -> int  (arrived: `signal_of(Status)`, sc64)\n    Which signal killed it. `wait`'s `signal` row still carries no\n    payload; `wait_status` and `poll` answer the number, and\n    `Status` reads it (an end by signal, apart from a stop).\nrun_with(c: Command, inherit: List[net.Listener]) -> int ! {…}\n    `start_with` + `wait`, the way `run` is `start` + `wait`. Absent\n    because the ONLY reason to hand a listener down is that the child\n    goes on serving after the parent returns to its loop, and a call\n    that blocks until the child exits is the opposite of that. `run`\n    earns its place for the commonest case; this one would have no\n    case at all, and a convenience nobody can use is surface (sc39).\n```\n\n**Lanes, and the paragraph that used to stand here was out of date.**\nIt said the checked tier was the only lane that starts a process and\nthat the native rung refused the whole module by name (\"process\nbuiltins in native lowering (checked lane only at s40)\"). Both were\ntrue when written and neither is now: **s107 (`1b149ba`) crossed the\nprocess trio natively**, and the ledger has said `native = \"run\"` for\nevery file in `tests/process/` since. lupin was declined by design at\ns40 and its conformance pin now carries the whole os family, so\n`not_found_row`, `forged_handle_io_rows`, `use_after_wait`,\n`exit_code` and `builder` are all THREE-lane today. The stale sentence\nsurvived four sprints because prose is what no gauntlet reads (sc38's\nlesson, one module over); it is corrected here at sc39 against the\nledger, which is the artifact that measured.\n\n**`start_with` is the one function whose lanes are still uneven, and\nevery word of it is a stated posture rather than a gap.** An EMPTY\ninherit set runs on all three lanes — `[os.proc.inherit]` makes it\n`os_spawn` with the program named apart, served everywhere. A\nNON-EMPTY set is refused BY NAME by two of them, in one construct\nstring they both print verbatim — *fd inheritance across\nos_spawn_with in checked execution* — because each is a binary\nINTERPRETING a program, so a descriptor handed to \"the program's\nchild\" would be handed to the interpreter's child. That is a\nwhole-program `unsupported`, not a catchable row, so the non-empty\nwitness is native-only; windows is the host that would answer the\ncatchable `unsupported` ROW instead, for a different reason again (a\n`SOCKET` is not a small stable number a parent can name by position).\nThree refusals, three reasons, and none of them a calendar.\n\n**No doc example in this module starts a real program**, and that is a\nportability statement rather than a shortcut. (Rows do since sc64 —\n`process/poll_job.lu` starts `/bin/sleep`, sc66's\n`process/wait_core_rows.lu` `/bin/sh` — and print their lines for that\nreason on windows, which has neither; the rest of this paragraph is the\nrecord from before them.) There is no program every tier-1 host has\n(`/bin/sh` is not on windows, `cmd.exe` is not on linux) and the\ndirective schema has no per-platform gate — so\na spawn test that ran anything real would be red on some supported\nhost. What every witness here uses instead is deterministic on ALL of\nthem: a program name no host has (`not_found`), an empty argv\n(`not_found` again), and a forged handle (`io`). The happy path — a live\nchild, its exit code, its `signal` row after a kill — is proven upstream\nin the toolchain's own unix-gated tests, and this module's inability to\nwitness it here is filed as F-0066 rather than papered over.\n\n**One of F-0066's three legs came off at the sc12 pin, and the filing\nstays open — which is worth stating precisely rather than leaving to be\ninferred from a closed finding.** The filing named the cheapest fix as\nan `os_exe` builtin, \"which lets a test spawn ITSELF\", and s90 landed\nexactly that (wolf-lang#69: `os_exe() -> str ! {io}`, the running\nexecutable's path, capability `Env` and comptime-refused beside\n`os_cwd`). So the clause \"a wolf program cannot learn its own path\" is\nRETIRED: it was true from sc11 to sc12 and it is not true now. The\nfinding is not closed, because its other two legs hold. A self-spawn\ntest would run on the CHECKED lane alone — the native rung still refuses\nthe process trio by name and lupin still declines it by design, both\nre-measured at this pin — and a program that spawns itself must tell the\nchild from the parent, which needs an argument the child reads back and\ntherefore a second capability inside the child. std wraps `os_exe`\nnowhere at this pin: nothing in the library needs it, and a\n`process.exe()` whose only caller would be a test this module still\ncannot write is surface without a use.",
      "summary": "std.process — build a command as an argument VECTOR, start it — alone, or with a set of listeners handed down to it — wait for its exit code, kill it, and end this process.",
      "items": [
        {
          "name": "Command",
          "kind": "struct",
          "signature": "pub struct Command { argv: List[str], fds: List[int], }",
          "doc": "A program and its arguments, as the argument VECTOR the host receives.\n\nElement 0 is the program; the rest are its arguments, one value each,\nwith no quoting and no splitting anywhere (see the module header on why\nthere is no shell). Build one with `command` or `from_argv`, extend it\nwith `push_arg`, read it back with `argv`.\n\nThe field is a `List[str]` because that is exactly what `os_spawn`\ntakes. A `Command` reaches nothing until it is started: constructing,\nextending and reading one is pure, and the sandbox has no objection to\nany of it — though nothing in this module is REACHABLE from a `comptime\nfn` at this pin, because none of them can call across a module boundary\n(F-0051). Pure here means \"no capability\", not \"callable at compile\ntime\".",
          "source": "std/process/process.lu",
          "line": 316,
          "tier": "core"
        },
        {
          "name": "Child",
          "kind": "struct",
          "signature": "pub struct Child { slot: int, }",
          "doc": "A started child process: this machine's handle on it.\n\nThe field is an `int` because that is what the builtin tier hands out —\na small non-negative index into the machine's child table, never a\nhost process id (see the module header's absent-list). Reading it is\nlegal and passing a hand-built `Child` to `wait` or `kill` is not a\ntrap but a miss (`io`), because a forged handle is a checkable\ncondition and a public struct's field cannot be private at this pin.\n\n**Staleness is prevented by the mode system**, exactly as it is for\n`std.fs.File` and `std.net.Socket`: `wait` takes its `Child` by `take`\n(X1), so using one after it has been reaped is a static use-after-move\nrather than a row on every operation.",
          "source": "std/process/process.lu",
          "line": 334,
          "tier": "core"
        },
        {
          "name": "command",
          "kind": "fn",
          "signature": "pub fn command(program: str) -> Command",
          "doc": "A `Command` that runs `program` with no arguments.\n\nTotal: no rows, no traps. Pure and comptime-safe — building a command\nstarts nothing. `program` is a path or a bare name; a bare name is\nresolved by the HOST's search rules (`PATH` on every tier-1 platform),\nwhich is the host's business and not this module's, and a name it\ncannot resolve is `start`'s `not_found` row rather than an error here.\n\n```wolf-doc-example\nlet ls = process.command(\"ls\")\nlet vec = process.argv(ls)\nvec.len == 1\nvec[0] == \"ls\"\n```",
          "source": "std/process/process.lu",
          "line": 352,
          "tier": "core"
        },
        {
          "name": "from_argv",
          "kind": "fn",
          "signature": "pub fn from_argv(argv: List[str]) -> Command",
          "doc": "A `Command` from a whole argument vector: element 0 is the program, the\nrest are its arguments.\n\nTotal: no rows, no traps. Pure and comptime-safe. This is the\nconstructor for an argv a program already HAS — `std.env.args()`\nforwarded to a child, a vector read from a configuration — and it is\nwhy `push_arg` is not the only way to build one.\n\nAn EMPTY vector is accepted here and misses at `start` with\n`not_found`: a vector that names no program is data a program can hold\nperfectly well, so refusing it at construction would move a run-time\noutcome into a place that has no row (§2).\n\n```wolf-doc-example\nvar argv = List[str]()\n(mut argv).push(\"grep\")\n(mut argv).push(\"-n\")\nlet c = process.from_argv(argv)\nlet vec = process.argv(c)\nvec.len == 2\nvec[0] == \"grep\"\n```",
          "source": "std/process/process.lu",
          "line": 380,
          "tier": "core"
        },
        {
          "name": "push_arg",
          "kind": "fn",
          "signature": "pub fn push_arg(mut c: Command, value: str)",
          "doc": "Append one argument to `c`.\n\nTotal: no rows, no traps. Pure and comptime-safe. `value` is passed to\nthe child as ONE argument whatever it contains — spaces, quotes,\nnewlines and semicolons are ordinary bytes, because nothing between\nhere and the host's `execve` parses words (the module header's whole\nsubject).\n\n`mut c` because appending is the operation's point (§3), and the call\nsite spells it. The verb is `push_arg` rather than `arg` for two\nreasons: `push` is std's vocabulary word for appending to a sequence\n(§8), and `std.env.arg(i)` already means \"the argument at i\" — a\nprogram that forwards its own argv to a child imports both modules, and\ntwo functions called `arg` doing opposite things in one file is a\ncollision std declines to create (§1: one concept, one name).\n\n```wolf-doc-example\nvar c = process.command(\"grep\")\nprocess.push_arg(mut c, \"-n\")\nprocess.push_arg(mut c, \"the wolf; rm -rf /\")\nlet vec = process.argv(c)\nvec.len == 3\nvec[2] == \"the wolf; rm -rf /\"\n```",
          "source": "std/process/process.lu",
          "line": 408,
          "tier": "core"
        },
        {
          "name": "argv",
          "kind": "fn",
          "signature": "pub fn argv(c: Command) -> List[str]",
          "doc": "`c`'s argument vector: the program first, then its arguments.\n\nTotal: no rows, no traps. Pure and comptime-safe. The list is a copy of\nwhat the child would receive, so pushing to it does not extend the\ncommand — `push_arg` is how a command grows.\n\n```wolf-doc-example\nvar c = process.command(\"wc\")\nprocess.push_arg(mut c, \"-l\")\nlet vec = process.argv(c)\nvec.len == 2\nvec[0] == \"wc\"\n```",
          "source": "std/process/process.lu",
          "line": 425,
          "tier": "core"
        },
        {
          "name": "Pipe",
          "kind": "struct",
          "signature": "pub struct Pipe { read: fs.File, write: fs.File, }",
          "doc": "The two ends of a pipe: what is written to `write` is read from\n`read`, in order, and `read` answers `eof` once every copy of `write`\nis closed — this program's and every child's.\n\nBoth fields are `std.fs` files, so `fs.read`, `fs.read_chunk`,\n`fs.write`, `fs.write_chunk` and `fs.close` serve them, and either end\ncan be handed to a child with `set_stdin`, `set_stdout`, `set_stderr`\nor `set_fd`. Neither end reaches a child unless a map names it: both\nare close-on-exec (`[os.proc.pipe]`).",
          "source": "std/process/process.lu",
          "line": 438,
          "tier": "core"
        },
        {
          "name": "pipe",
          "kind": "fn",
          "signature": "pub fn pipe() -> Pipe ! {io}",
          "doc": "A new pipe.\n\nRows: `io` when the host cannot make one (the process is out of\ndescriptors). Never traps.\n\n**Close what you handed down.** A child given `write` holds its own\ncopy; this program's copy is still open after `start`, and a reader of\n`read` never sees `eof` while any copy is. The pipeline idiom is: make\nthe pipe, start both stages, close this program's two ends, wait.\n\nCapability `exec` (ruling #54: a pipe exists to wire a child, so\n`os_pipe` is charged with the spawn family, not `io`); refused at\ncomptime (D33). Delegates to `os_pipe` (wolf-lang s215,\n`[os.proc.pipe]`).\n\nA prose example, because a doc example imports exactly the documented\nmodule (§4) and the ends are read and written with `std.fs`:\n`let p = process.pipe()?`, `fs.write(mut p.write, \"howl\")?`,\n`fs.close(take p.write)?`, then `fs.read(mut p.read, 64)` answers\n`\"howl\"` and the next read `eof`. `tests/process/pipe_round_trip.lu`\nholds exactly that.",
          "source": "std/process/process.lu",
          "line": 464,
          "tier": "core"
        },
        {
          "name": "set_fd",
          "kind": "fn",
          "signature": "pub fn set_fd(mut c: Command, child: int, f: fs.File)",
          "doc": "The child gets `f` as descriptor `child` — a shell's `N<file`,\n`N>file` or `N>&M`, spelled as data: `child` is the number the CHILD\nsees, and `f` is a file this program holds (`fs.open`'s, a pipe end,\nor `fs.stdin()`/`fs.stdout()`/`fs.stderr()` for this program's own\nstreams).\n\nTotal: nothing is checked or opened until `start`. Naming `child`\nagain replaces the earlier entry, so the last builder call wins, as a\nshell's last redirection does. A `child` outside `0..255` is accepted\nhere and is `start`'s `invalid` row; a closed or forged `f` is\n`start`'s `io`. Pure and comptime-safe — the map is data.\n\n`f` is READ, not consumed: this program still owns its copy and must\nclose it (see `pipe`). Descriptors above 2 are served by the compiler's\nmachines on linux and macOS; lupin serves 0, 1 and 2 only and refuses\na higher one by name.\n\nA prose example (a `File` is `std.fs`'s, which a doc example cannot\nimport, §4): with `p = process.pipe()?`, `set_fd(mut c, 5, p.read)` on\n`process.command(\"cat\")` plus the argument `/dev/fd/5` is\n`cat /dev/fd/5 5<&r`; wolf-lang's `proc_fd_lanes.rs` runs that shape.",
          "source": "std/process/process.lu",
          "line": 490,
          "tier": "core"
        },
        {
          "name": "set_stdin",
          "kind": "fn",
          "signature": "pub fn set_stdin(mut c: Command, f: fs.File)",
          "doc": "The child's standard input is `f` — `set_fd(mut c, 0, f)`.",
          "source": "std/process/process.lu",
          "line": 495,
          "tier": "core"
        },
        {
          "name": "set_stdout",
          "kind": "fn",
          "signature": "pub fn set_stdout(mut c: Command, f: fs.File)",
          "doc": "The child's standard output is `f` — `set_fd(mut c, 1, f)`. With a\npipe's `write` end this is how a caller captures what a child prints.",
          "source": "std/process/process.lu",
          "line": 501,
          "tier": "core"
        },
        {
          "name": "set_stderr",
          "kind": "fn",
          "signature": "pub fn set_stderr(mut c: Command, f: fs.File)",
          "doc": "The child's standard error is `f` — `set_fd(mut c, 2, f)`. Given the\nsame file as `set_stdout`, this is a shell's `2>&1`.",
          "source": "std/process/process.lu",
          "line": 507,
          "tier": "core"
        },
        {
          "name": "close_fd",
          "kind": "fn",
          "signature": "pub fn close_fd(mut c: Command, child: int)",
          "doc": "Descriptor `child` is CLOSED in the child — a shell's `N<&-`. Same\nrules as `set_fd`; lupin refuses a close by name.\n\n```wolf-doc-example\nvar c = process.command(\"ls\")\nprocess.close_fd(mut c, 2)\nprocess.argv(c).len == 1\n```",
          "source": "std/process/process.lu",
          "line": 519,
          "tier": "core"
        },
        {
          "name": "start",
          "kind": "fn",
          "signature": "pub fn start(c: Command) -> Child ! {unsupported, invalid, not_found, denied, io}",
          "doc": "Start `c` and return the handle of the child, WITHOUT waiting for it.\n\nRows: `not_found` when no such program exists — and for an EMPTY argv,\nwhich names no program at all; `denied` when the host refuses to\nexecute it; `io` for every other host failure, and for a `File` in the\ndescriptor map that is closed or forged. Two rows belong to the map\nalone and a command without one never raises them: `invalid` for a\nmap the builders could not make well-formed (a child descriptor\noutside `0..255`), and `unsupported` where the host places no map —\nwindows, by name. Never traps, and a call that answers `invalid`,\n`unsupported` or the map's `io` has started nothing.\n\n**Without a map** the child inherits this process's environment and\nworking directory, and its standard OUTPUT and ERROR: what it writes\ngoes where this program's writes go. Its standard INPUT is the null\ndevice — it reads end-of-file at once and never this program's input\n(`[os.proc.spawn]`; this doc said \"it can read this program's input\"\nuntil s215, which the clause never did). **With a map** (`set_stdin`,\n`set_stdout`, `set_stderr`, `set_fd`, `close_fd`) each descriptor it\nnames is what the child gets, and the rest keep that posture — so\n`set_stdout(mut c, p.write)` with `p = process.pipe()?` is how a caller\nCAPTURES a child's output, F-0065's half that inheriting never was.\nA started child MUST be waited for —\n`wait(take ch)` is what reaps it — or it stays a zombie on every unix\nuntil this process exits.\n\n**Why the name is not `spawn`.** `spawn` is one of the language's 50\nreserved keywords — it opens a task (`s.spawn(fn() { … })`) and a\nsupervised proc (`spawn proc`) — so `pub fn spawn` is `E0008` with no\nraw-identifier escape, exactly as `std.fs.copy_file` is not `copy`.\nThe collision is worth more than the name: a child process and a task\nare different things with different failure models, and a std function\nthat borrowed the keyword's word for the other one would have invited\nthe confusion the type system then has to unpick.\n\nCapability `Exec`; refused at comptime (D33). Delegates to `os_spawn`,\nor to `os_spawn_fds` (wolf-lang s215, `[os.proc.fds]`) when the\ncommand carries a descriptor map.\n\n```wolf-doc-example\nvar missing = process.command(\"wolf-sc11-no-such-program-here\")\nvar child = process.start(missing) else |_| { process.Child { slot: -1 } }\n(process.wait(take child) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 585,
          "tier": "core"
        },
        {
          "name": "start_with",
          "kind": "fn",
          "signature": "pub fn start_with(c: Command, inherit: List[net.Listener]) -> Child ! { unsupported, not_found, denied, io, }",
          "doc": "Start `c` with `inherit` handed down to the child, and answer the\nchild's handle WITHOUT waiting for it — the PARENT half of descriptor\ninheritance, whose child half is `std.net.adopt_listener`.\n\n**The child receives the listeners as descriptors `3, 4, …` in the\norder given**, and that numbering is the whole contract\n(`[os.proc.inherit]`). The parent never learns an OS descriptor\nnumber and the child never has to be told one out of band: \"the\nlistener is 3\" is true by position, so a master hands its argv a\nCOUNT and never a descriptor. Descriptors 0, 1 and 2 are the spawn's\nordinary stdio — INHERITED from this process, exactly as they are for\n`start` — and nothing above `2 + inherit.len` is open in the child\nthat the runtime put there. `tests/process/prefork_handoff.lu`\nwitnesses that upper bound from inside the child: with one listener in\nthe set, descriptor 3 adopts and descriptor 4 answers `io`.\n\n**The set is on the SPAWN and not on the `Command`, and that is the\none design decision in this function.** It was asked as a question at\nsc37 and answered from real code by the consumer that needed it\n(lobo, ws18): a master binds its listeners ONCE and keeps them for\nits whole life, because a REPLACEMENT worker has to inherit the same\nsocket; it then spawns worker 1, worker 2, … and re-spawns worker 2\nafter a `kill -9`. The listener set is a property of the MASTER and\neach spawn is an EVENT THAT BORROWS IT. A `Command` that accumulated\nan inherit set would have to be rebuilt or reset per spawn, and one\nreused across spawns would silently carry state the second spawn\nnever asked for — a `Command` that remembers descriptors is a\n`Command` that can hand a stale one down. The call-argument shape\nmakes the borrow visible at every site and has no state to get wrong.\nPointing the same way: the ORDER of the set IS the contract, and an\nordered argument at the call is where a reader looks for that; a\nbuilder field is not.\n\n**Why `List[net.Listener]` and not `List[int]`, when `net.wait` took\nthe ints.** `wait`'s ready set mixes listeners and streams and wolf\nhas no sum type that can hold both at this pin, so `wait` had no\ntyped container to take. An inherit set has one: the only thing the\nchild can DO with a handed-down descriptor is `net.adopt_listener`,\nso at this pin the set is listeners or it is nothing. Unwrapping to\nthe builtin's `List[int]` is this function's job rather than the\ncaller's, which is the point of a typed tier. If a future pin grows\nan adopt for connected sockets, the container question reopens with\nthe sum type — the same language dependency `wait` is waiting on, and\nthe two should be answered together rather than one at a time.\n\n**An EMPTY set is not a special form.** `start_with(c,\nList[net.Listener]())` is `start(c)` with the program named apart\nfrom its arguments, served on every host and every tier — including\nthe two that decline the non-empty case. A prefork master that has\nnot bound anything yet, or a caller that just wants the same spawn,\nwrites the empty list and gets an answer rather than an\n`unsupported`.\n\nA `Command` that carries a descriptor map is `unsupported` here: the\nlistener set and the map are two spawns' contracts, and\n`[os.proc.fds]` keeps them apart because a net handle and a file handle\nare different numbering spaces. Use `start` for the map.\n\nRows: `unsupported` where the host or the tier does not serve a\nNON-EMPTY set, BY NAME — windows (handle inheritance exists there,\nbut a `SOCKET` is not a small stable number a parent can name by\nposition) and the CHECKED machine, which refuses it because it is the\n`wolf` binary interpreting a program, so a descriptor handed to \"the\nprogram's child\" would be handed to the compiler's child;\n`not_found` when no such program exists — and for an EMPTY argv,\nwhich names no program at all, raised here rather than delegated\nbecause `os_spawn_with` takes the program apart and an empty vector\nhas none to give; `denied` when the host refuses to execute it; `io`\nfor a bad SET as well as for every other host failure. Never traps.\n\n**A bad set spawns NOTHING, and the ordering is load-bearing.** A\nforged or closed listener anywhere in `inherit`, or more than 64 of\nthem, is `io` BEFORE any child exists: the runtime maps handles to\ndescriptors first, so a caller that gets `io` from this call knows no\nprogram was started and has nothing to reap.\n`tests/process/start_with_inherit_rows.lu` witnesses exactly that,\nwith a forged listener and a program name no host has — the row is\n`io` and not `not_found`, which is the mapping happening first.\n\n**What the parent keeps.** Handing a listener down does not consume\nit and does not close it: `inherit` is READ, the master's listeners\nare still the master's after the call, and a master serving N workers\nhands the same `Listener` to each spawn in turn. The child's copy is\na separate descriptor that the CHILD owns from its `adopt_listener`\non — `net.close_listener` there closes the inherited fd and does not\nunlink an `AF_UNIX` path, because the path belongs to the process\nthat bound it.\n\nA started child MUST be waited for — `wait(take ch)` is what reaps it\n— exactly as for `start`.\n\nCapability `Exec`; refused at comptime (D33). Delegates to\n`os_spawn_with`.\n\nA prose example, because a doc example imports exactly the documented\nmodule (§4) and cannot reach `std.net` to bind a listener. A prefork\nmaster binds once, then spawns each worker with the set:\n`let srv = net.listen(net.loopback(8080))?`, build `workers` as a\n`List[net.Listener]` holding `srv`, and\n`let w = process.start_with(cmd, workers)?` — the worker reads\n`net.adopt_listener(3)?` and accepts. `tests/process/start_with_empty_rows.lu`\nand `tests/process/start_with_inherit_rows.lu` are the witnesses.",
          "source": "std/process/process.lu",
          "line": 706,
          "tier": "core"
        },
        {
          "name": "start_job",
          "kind": "fn",
          "signature": "pub fn start_job(c: Command, group: int, defaults: int) -> Child ! { unsupported, invalid, not_found, denied, io, }",
          "doc": "**s219 (`[os.proc.job]`): start `c` as a job.** `group` -1 leaves the\nchild in this process's group, 0 makes it the leader of a new group\n(whose id is `pid(child)`), a positive id joins that group — a\npipeline's later stages join the first's. `defaults` is a set of\n`std.signal` meanings set back to the default in the child: a shell\nthat ignores `quit()` for itself passes it, so its children do not\ninherit the ignore. Everything else is `start`'s, the descriptor map\nincluded.",
          "source": "std/process/process.lu",
          "line": 757,
          "tier": "core"
        },
        {
          "name": "start_foreground",
          "kind": "fn",
          "signature": "pub fn start_foreground(c: Command, group: int, tty: fs.File, defaults: int) -> Child ! { unsupported, invalid, not_found, denied, io, }",
          "doc": "`start_job`, and the job's group takes the terminal `tty` as its\nforeground before the program runs (no race: the child does it before\n`exec`, the parent again after). Take the terminal back with\n`term.set_foreground(tty, term.group())` when the job ends.",
          "source": "std/process/process.lu",
          "line": 773,
          "tier": "core"
        },
        {
          "name": "start_session",
          "kind": "fn",
          "signature": "pub fn start_session(c: Command, defaults: int) -> Child ! { unsupported, invalid, not_found, denied, io, }",
          "doc": "**s290 (`[os.proc.session]`, sc81): start `c` as the leader of a new\nsession**, WITHOUT waiting for it. The child's session id, group id and\nprocess id are one number (`pid(child)`, and `group_of(child)` names its\ngroup). The spawn itself gives it no controlling terminal; `defaults`\nand the descriptor map are placed as `start_job` places them. This\ndescribes the child before exec, not what the program may do afterwards.\nNothing of this process moves: its session, group and terminal stay\nas they were.\n\n**A terminal is not given here.** A pty's slave in the map\n(`set_stdin`, `set_stdout`, `set_stderr`) is a terminal on those\ndescriptors, but the map itself never makes it controlling. A program\nmay take that terminal after exec: bash does in this shape, dash does\nnot. If it does, closing the last master can hang up its session.\nDo not infer the running program's terminal state from the spawn map.\nA server that requires a controlling terminal forks, calls\n`lead_session` and `std.term.open_controlling` in the child, then execs\n(`std.term.Pty` says the order).\n\nRows, in `start_job`'s order: `not_found` for an empty argv (decided\nhere, on every host); `invalid` for a map the builders could not make\nwell-formed (a child descriptor outside `0..255`) and a `defaults` bit\noutside the meanings, before the host; `unsupported` on windows, which\nhas no sessions of this kind; `io` for a closed or forged file in the\nmap; then the program's `not_found`, `denied` and `io`, with the\nhost's number in `os_error()`. Never traps, and a row starts nothing.\nA started child MUST be waited for, as `start`'s.\n\nCapability `Exec`; refused at comptime (D33). The checked machine\nspawns through its own path, its child taking the same first step.\nlupin 0.1.61 answers the shape rows and refuses a well-formed spawn by\nname (Rust's standard library has no stable new-session spawn).\nDelegates to `os_spawn_session`.\n\n```wolf-doc-example\nvar c = process.command(\"wolf-sc81-no-such-program-here\")\nprocess.close_fd(mut c, 300)\nvar row = \"started\"\nvar ch = process.start_session(c, 0) else |e| {\n    row = \"{e}\"\n    process.Child { slot: 0 - 1 }\n}\nrow == \"invalid\"\n(process.wait(take ch) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 830,
          "tier": "core"
        },
        {
          "name": "pid",
          "kind": "fn",
          "signature": "pub fn pid(ch: Child) -> int ! {io}",
          "doc": "The child's operating-system process id (`io` once it is reaped).",
          "source": "std/process/process.lu",
          "line": 843,
          "tier": "core"
        },
        {
          "name": "wait_status",
          "kind": "fn",
          "signature": "pub fn wait_status(take ch: Child) -> int ! {io}",
          "doc": "**s219 (`[os.proc.status]`): wait, and say how it ended.** The exit\ncode (0..255), or `-N` for a child ended by signal N — the number a\nshell reports as `128 + N` (`killed_by` reads it). Reaps, as `wait`.",
          "source": "std/process/process.lu",
          "line": 850,
          "tier": "core"
        },
        {
          "name": "killed_by",
          "kind": "fn",
          "signature": "pub fn killed_by(status: int) -> int",
          "doc": "The signal number a `wait_status` names, or 0 for an exit.",
          "source": "std/process/process.lu",
          "line": 855,
          "tier": "core"
        },
        {
          "name": "Status",
          "kind": "struct",
          "signature": "pub struct Status { value: int, }",
          "doc": "How a child ended or stopped, as one of three kinds that never meet\n(`[os.proc.poll]`, `[os.proc.status]`): an EXIT with its code\n(0..255), an END BY SIGNAL `N` (the builtins' `-N`), or a STOP by\nsignal `N` (the builtins' `256 + N`). A stop is never an exit: a\nstopped child has not ended, and a caller that read `256 + N` as a\ncode would report a job as finished while it waits to be continued.\n\nThe field is the one `int` the builtins answer, so nothing is lost\nand nothing can disagree with itself; read it through `is_exited`,\n`is_signalled` and `is_stopped`, and `exit_code`, `signal_of` and\n`stopped_by`. `N` is this host's signal number (`signal.number`\ngives a meaning's): `SIGSTOP` is 19 on linux and 17 on macOS. A value\nno host answers — 256, or 512 and above, which ruling #84 R4 keeps\nfree for a continue — is of no kind: all three predicates are false.",
          "source": "std/process/process.lu",
          "line": 876,
          "tier": "core"
        },
        {
          "name": "status_from",
          "kind": "fn",
          "signature": "pub fn status_from(value: int) -> Status",
          "doc": "The `Status` a status number reads as: `wait_status`'s answer, or the\nsecond half of `os_wait_poll`'s. Pure and comptime-safe; any `int` is\naccepted (see `Status` on a value of no kind).\n\n```wolf-doc-example\nprocess.is_exited(process.status_from(3)) == true\nprocess.is_signalled(process.status_from(-9)) == true\nprocess.is_stopped(process.status_from(275)) == true\n```",
          "source": "std/process/process.lu",
          "line": 889,
          "tier": "core"
        },
        {
          "name": "is_exited",
          "kind": "fn",
          "signature": "pub fn is_exited(s: Status) -> bool",
          "doc": "Whether `s` is an exit (0..255). Pure.\n\n```wolf-doc-example\nprocess.is_exited(process.status_from(0)) == true\nprocess.is_exited(process.status_from(275)) == false\n```",
          "source": "std/process/process.lu",
          "line": 899,
          "tier": "core"
        },
        {
          "name": "is_signalled",
          "kind": "fn",
          "signature": "pub fn is_signalled(s: Status) -> bool",
          "doc": "Whether `s` is an end by a signal (`-N`). Pure.\n\n```wolf-doc-example\nprocess.is_signalled(process.status_from(-15)) == true\nprocess.is_signalled(process.status_from(15)) == false\n```",
          "source": "std/process/process.lu",
          "line": 909,
          "tier": "core"
        },
        {
          "name": "is_stopped",
          "kind": "fn",
          "signature": "pub fn is_stopped(s: Status) -> bool",
          "doc": "Whether `s` is a stop (`256 + N`): the child is alive and waits to be\ncontinued. Pure.\n\n```wolf-doc-example\nprocess.is_stopped(process.status_from(256 + 19)) == true\nprocess.is_stopped(process.status_from(19)) == false\nprocess.is_stopped(process.status_from(512)) == false\n```",
          "source": "std/process/process.lu",
          "line": 921,
          "tier": "core"
        },
        {
          "name": "exit_code",
          "kind": "fn",
          "signature": "pub fn exit_code(s: Status) -> int ! {none}",
          "doc": "The exit code of an exit; `none` for an end by signal, a stop, or a\nvalue of no kind. Pure.\n\n```wolf-doc-example\n(process.exit_code(process.status_from(7)) else -1) == 7\n(process.exit_code(process.status_from(256 + 7)) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 932,
          "tier": "core"
        },
        {
          "name": "signal_of",
          "kind": "fn",
          "signature": "pub fn signal_of(s: Status) -> int ! {none}",
          "doc": "The host signal number that ENDED the child; `none` for an exit, a\nstop, or a value of no kind. Pure.\n\n```wolf-doc-example\n(process.signal_of(process.status_from(-9)) else 0) == 9\n(process.signal_of(process.status_from(256 + 9)) else 0) == 0\n```",
          "source": "std/process/process.lu",
          "line": 946,
          "tier": "core"
        },
        {
          "name": "stopped_by",
          "kind": "fn",
          "signature": "pub fn stopped_by(s: Status) -> int ! {none}",
          "doc": "The host signal number that STOPPED the child; `none` for an exit, an\nend, or a value of no kind. Pure.\n\n```wolf-doc-example\n(process.stopped_by(process.status_from(256 + 20)) else 0) == 20\n(process.stopped_by(process.status_from(-20)) else 0) == 0\n```",
          "source": "std/process/process.lu",
          "line": 960,
          "tier": "core"
        },
        {
          "name": "shell_code",
          "kind": "fn",
          "signature": "pub fn shell_code(s: Status) -> int",
          "doc": "What a POSIX shell reports for `s` as `$?`: the exit code, or\n`128 + N` for an end by signal `N` and for a stop by `N` alike (XCU\n2.8.2; a stopped job's `$?` is dash's `128 + N`). A value of no kind\nanswers itself. Pure.\n\n```wolf-doc-example\nprocess.shell_code(process.status_from(1)) == 1\nprocess.shell_code(process.status_from(-9)) == 137\nprocess.shell_code(process.status_from(256 + 20)) == 148\n```",
          "source": "std/process/process.lu",
          "line": 977,
          "tier": "core"
        },
        {
          "name": "Change",
          "kind": "struct",
          "signature": "pub struct Change { changed: bool, child: Child, status: Status, live: int, }",
          "doc": "What one `poll` found. When `changed` is true, `child` is the child\nthat ended or stopped and `status` says which (`Status`); when it is\nfalse, nothing changed since the last look, `live` is the number of\nchildren still running or stopped — 0 when none is left — and\n`child` and `status` name nothing (`slot` -1, a value of no kind).\nA change carries no count: `live` is -1 beside it, and the next poll\nthat finds nothing gives the count again.\n\nAn ended child is REAPED by the poll that reports it and its handle\nclosed: `child` (and any `Child` the caller kept for it) answers `io`\nfrom then on, exactly as after `wait`. A stopped child stays: its\n`Child` is live, and the caller continues it (`signal.send_group` or\n`signal.send` with `signal.continued()`) or ends it. Compare\n`change.child.slot` with a kept `Child`'s `slot` to know which job\nit was.",
          "source": "std/process/process.lu",
          "line": 1002,
          "tier": "core"
        },
        {
          "name": "poll",
          "kind": "fn",
          "signature": "pub fn poll() -> Change ! {io}",
          "doc": "Look, without waiting, for a child of this program's that ended or\nstopped since it was last looked at (`[os.proc.poll]`, ruling #84):\nthe first such child in the order they were started, reaped if it\nended. One `waitpid(pid, WNOHANG | WUNTRACED)` per live child and\nnever the host's \"any child\", so a child this program did not start\nthrough `start`, `start_with`, `start_job` or `start_foreground` is\nnever touched. A continue is not reported; each stop is reported\nonce.\n\n**The wait a signal cuts short** is this and `std.signal`, with no new\ncall: listen for `signal.child()` and the meanings the program traps,\n`poll` until `changed` is false, then `signal.wait` (or\n`signal.wait_fd` at a prompt) on that set. `signal.child()` arrives\nfor a stop and for an end, so the wait ends when a child changes or a\ntrapped signal comes, and an idle program makes no context switch.\n\nRows: `io` for a child the host reaped behind the table's back (this\nprogram ignores `signal.child()`), once, its handle closed. Never\ntraps, never blocks — except behind a blocking `wait` or\n`wait_status` on another task, which holds the table until its child\nends (`[os.proc.poll]`'s one lock). windows has no stops: the poll\nanswers ends and `live`. lupin answers `changed` false and `live` 0\nwhile it holds no live child, and refuses by name once it does (it\ncannot see a stop).\n\nCapability `Exec` (it reaps, with `wait_status`); refused at comptime\n(D33). Delegates to `os_wait_poll` (wolf-lang s242).\n\n```wolf-doc-example\nlet c = process.poll() else |_| { process.Change { changed: true, child: process.Child { slot: -1 }, status: process.status_from(512), live: -1 } }\nc.changed == false\nc.live == 0\n```",
          "source": "std/process/process.lu",
          "line": 1042,
          "tier": "core"
        },
        {
          "name": "wait_status_core",
          "kind": "fn",
          "signature": "pub fn wait_status_core(take ch: Child) -> int ! {io}",
          "doc": "**s246 (`[os.proc.status]`, ruling #88 R3 = D): wait, and say how it\nended, a core included.** `wait_status`'s answer — the exit code\n(0..255), or `-N` for an end by signal `N` — except that a child that\ndumped core (the host's `WCOREDUMP`) answers **`-(256 + N)`**, below\nevery end without one. Read it with `status_from_core`, whose `Status`\nevery released accessor reads exactly as it reads `wait_status`'s\nanswer, and `dumped_core`. Reaps, as `wait`.\n\n`wait_status` is unchanged and answers `-N`, core or not, so a program\nthat compares with `-N` reads every host alike: **which ends dump core\nis the host's**. A pattern that pipes cores to a program\n(`systemd-coredump`) dumps one whatever `ulimit -c` says, a file\npattern only where the limit allows, and windows never.\n\nRows: `io` for a forged or reaped handle. Never traps. Capability\n`Exec`; refused at comptime (D33). The checked machine answers it as\nthe runtime does, and so does lupin 0.1.55 (is77, wolf-interp#263:\nan exit and a forged handle measured). Delegates to\n`os_wait_status_core`.\n\n```wolf-doc-example\nvar forged = process.Child { slot: 4242 }\n(process.wait_status_core(take forged) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 1079,
          "tier": "core"
        },
        {
          "name": "status_from_core",
          "kind": "fn",
          "signature": "pub fn status_from_core(value: int) -> Status",
          "doc": "The `Status` a core sibling's answer reads as (`wait_status_core`,\n`poll_core`): `-(256 + N)`, an end by signal `N` that dumped core,\nis the end by `N` (`-N`), so `is_signalled`, `signal_of` and\n`shell_code` answer for it exactly what they answer for the released\nwait's `-N`; every other value reads as `status_from` reads it. Whether\nthere was a core is `dumped_core`'s. Pure and comptime-safe.\n\n```wolf-doc-example\n(process.signal_of(process.status_from_core(-267)) else 0) == 11\nprocess.shell_code(process.status_from_core(-267)) == 139\nprocess.status_from_core(-11).value == -11\nprocess.status_from_core(256 + 19).value == 275\n```",
          "source": "std/process/process.lu",
          "line": 1096,
          "tier": "core"
        },
        {
          "name": "dumped_core",
          "kind": "fn",
          "signature": "pub fn dumped_core(value: int) -> bool",
          "doc": "Whether a core sibling's answer says the host wrote a core: `-(256 +\nN)` for a signal number `N` from 1 to 255, the mirror of a stop's\n`256 + N`. False for every value the released calls answer (an exit,\n`-N`, a stop) and for a value of no kind. Pure and comptime-safe.\n\n```wolf-doc-example\nprocess.dumped_core(-267) == true\nprocess.dumped_core(-11) == false\nprocess.dumped_core(-256) == false\nprocess.dumped_core(256 + 11) == false\n```",
          "source": "std/process/process.lu",
          "line": 1114,
          "tier": "core"
        },
        {
          "name": "CoreChange",
          "kind": "struct",
          "signature": "pub struct CoreChange { change: Change, core: bool, }",
          "doc": "What one `poll_core` found: the `Change` that `poll` would report, its\n`status` read by `status_from_core` (so every released accessor\nanswers as it does for `poll`), and `core`, whether the host wrote a\ncore for the end it reports (`dumped_core`). `core` is false for a\nstop, an exit, an end without a core, and when nothing changed.",
          "source": "std/process/process.lu",
          "line": 1123,
          "tier": "core"
        },
        {
          "name": "poll_core",
          "kind": "fn",
          "signature": "pub fn poll_core() -> CoreChange ! {io}",
          "doc": "**s246 (`[os.proc.poll]`, ruling #88 R3 = D): `poll`, a core\nincluded.** The same look at every child this program started,\nwithout waiting, in the order they were started, with an end that\ndumped core reported as such — what a shell needs to say \"(core\ndumped)\" after a job's words. `poll` is unchanged. A program uses one\nor the other for a child: the poll that reports an end reaps it, so a\nsecond call could not ask afterwards.\n\nRows: `poll`'s (`io` once for a child the host reaped behind the\ntable's back). Never traps, never blocks but behind a blocking `wait`\non another task. Capability `Exec`; refused at comptime (D33). The\nchecked machine answers it as the runtime does. lupin 0.1.55 answers\nthe poll with no child as `poll` does and refuses one with a live\nchild by name, since its host has no stop to report (std's\n`try_wait`; is77, wolf-interp#263). Delegates to `os_wait_poll_core`.\n\n```wolf-doc-example\nlet c = process.poll_core() else |_| { process.CoreChange { change: process.Change { changed: true, child: process.Child { slot: -1 }, status: process.status_from(512), live: -1 }, core: true } }\nc.change.changed == false\nc.change.live == 0\nc.core == false\n```",
          "source": "std/process/process.lu",
          "line": 1150,
          "tier": "core"
        },
        {
          "name": "Group",
          "kind": "struct",
          "signature": "pub struct Group { id: int, }",
          "doc": "A process GROUP: the unit a job is, and what `std.signal`'s\n`send_group` reaches (ruling #79 R1: the type is std's, over the\nbuiltin tier's group ids). A shell starts each job as a group\n(`start_job` with group 0, the later stages of a pipeline joining the\nfirst's), and `kill %1`, `fg`, `bg` and Ctrl-Z act on the whole group:\na job's own children (a script's `sleep`, a `make`'s compilers) are in\nit and outlive a signal to its leader alone.\n\nThe field is the group's id, the host's number: a `Group` from data\n(`process.Group { id: n }`, a `kill -- -N` operand) is legal, and\n`send_group` refuses an id that cannot be a group (1 and below) as\n`invalid` before the host is asked.",
          "source": "std/process/process.lu",
          "line": 1186,
          "tier": "core"
        },
        {
          "name": "group_of",
          "kind": "fn",
          "signature": "pub fn group_of(leader: Child) -> Group ! {io}",
          "doc": "The group `leader` leads: a child started with `start_job` (or\n`start_foreground`) and group 0 leads a new group whose id is its\nprocess id. A child that JOINED a group (a positive `group`) is in the\ngroup its caller named, which the caller already holds as a\n`Group { id: … }`; one started in this process's group is in\n`own_group()`.\n\nRows: `io` once `leader` has been reaped (its id may since be\nanother's). Never traps. Delegates to `os_proc_pid`.\n\n```wolf-doc-example\nlet g = process.group_of(process.Child { slot: 4096 }) else |_| process.Group { id: -1 }\ng.id == -1\n```",
          "source": "std/process/process.lu",
          "line": 1204,
          "tier": "core"
        },
        {
          "name": "own_group",
          "kind": "fn",
          "signature": "pub fn own_group() -> Group ! {unsupported}",
          "doc": "This process's own group — `kill 0`'s, which a send to it reaches\nthis process too (`[os.signal.send.group]`). Rows: `unsupported` on a\nhost without groups (windows). lupin declines by name, so the example\nis prose: `signal.send_group(process.own_group()?, m)` is `kill -m 0`.\n\nCapability `env` (process context, as `term.group`, ruling #70 R8);\nrefused at comptime (D33). Delegates to `os_pgid`.",
          "source": "std/process/process.lu",
          "line": 1215,
          "tier": "core"
        },
        {
          "name": "lead_group",
          "kind": "fn",
          "signature": "pub fn lead_group() -> () ! {denied, invalid, io, unsupported}",
          "doc": "Make THIS process the leader of a new group of its own, whose id is\nits process id (`[os.term.group]`, `setpgid(0, 0)`): what an\ninteractive shell does at start, and what GNU `timeout` does before it\nruns its command so that a send to its own group reaches everything\nthe command started. It acts on the caller only: a child's group is\nset when it starts (`start_job`), never after.\n\nRows: `denied` for a session leader, which may not move (a shell\nstarted as one already leads its group); `unsupported` on windows;\n`io` otherwise. Never traps. lupin declines by name, so the example\nis prose: after `process.lead_group()?`, `process.own_group()?.id` is\nthis process's id.\n\nCapability `Exec` (ruling #79 R6); refused at comptime (D33).\nDelegates to `os_set_pgid(0)`.",
          "source": "std/process/process.lu",
          "line": 1234,
          "tier": "core"
        },
        {
          "name": "join_group",
          "kind": "fn",
          "signature": "pub fn join_group(g: Group) -> () ! {denied, invalid, io, unsupported}",
          "doc": "Move THIS process into group `g` of its own session\n(`[os.term.group]`, `setpgid(0, g)`): what a shell does at exit to go\nback into the group it was started in. Joining the group it is already\nin changes nothing; group 0 is `lead_group`.\n\nRows, in the order they are decided: `invalid` for a negative id or one\nwider than a process id (before the host); `unsupported` on windows;\n`denied` for a session leader, and for a group of another session or\none that does not exist; `io` otherwise. Never traps. lupin answers the\n`invalid` rows and declines a well-formed call by name.\n\nCapability `Exec`; refused at comptime (D33). Delegates to\n`os_set_pgid`.\n\n```wolf-doc-example\nvar refused = false\nprocess.join_group(process.Group { id: -2 }) else |_| { refused = true }\nrefused == true\n```",
          "source": "std/process/process.lu",
          "line": 1257,
          "tier": "core"
        },
        {
          "name": "lead_session",
          "kind": "fn",
          "signature": "pub fn lead_session() -> () ! {denied, io, unsupported}",
          "doc": "**s290 (`[os.term.session]`, sc81): make THIS process the leader of a\nnew session**, and of a new group in it, both ids its process id\n(`own_session()`, `own_group().id` and `std.env.pid()` agree after),\nwith no controlling terminal. The terminal it had stops being its\ncontrolling terminal for every thread at once: its keys, its hangup\nand its background stops reach the process no more, and `/dev/tty`\ndoes not open. Every descriptor, the terminal's mode and a registered\n`term.restore_at_exit` stay.\n\n**Who may call it.** A process that leads a group may not (a session\nleader included): `denied`, and nothing has moved. So the call is made\nwhere the process leads no group: in the child of `fork`, which never\nleads one — the server's order, `fork` then `lead_session` then the\nexec, as `sshd` runs each command — or in a child started in its\nparent's group. A child that must have a terminal of its own opens it\nafter this call (`std.term.open_controlling`).\n\nRows: `unsupported` on windows; `denied` for a group leader (the\nhost's `EPERM`, 1 in `os_error()`); `io` for any other refusal (no host\nwas seen to make one). Never traps. The checked machine moves the\n`wolf` process, the process the program runs as. lupin 0.1.61 refuses\nthe call by name (Rust's standard library has no `setsid`). The example\nis prose, since a call that succeeds moves the process that runs it: in\na fork's child, `process.lead_session()?` and then\n`process.own_session()? == env.pid()`.\n\nCapability `Exec`, with `lead_group`; refused at comptime (D33).\nDelegates to `os_setsid`.",
          "source": "std/process/process.lu",
          "line": 1289,
          "tier": "core"
        },
        {
          "name": "own_session",
          "kind": "fn",
          "signature": "pub fn own_session() -> int ! {unsupported}",
          "doc": "**s290 (`[os.term.session]`, sc81): this process's session id**\n(`getsid(0)`): its own process id when it leads its session, the\nleader's otherwise. A session id is compared, never passed: no call\ntakes one, so it is an `int` (a `Group` is a type because\n`std.signal.send_group` takes one).\n\nRows: `unsupported` on windows. Never traps. The checked machine reads\nthe `wolf` process's session. lupin 0.1.61 refuses the call by name.\n\nCapability `env` (process context, with `own_group`); refused at\ncomptime (D33). Delegates to `os_sid`.\n\n```wolf-doc-example\nlet s = process.own_session() else -1\ns > 0 || s == -1\n```",
          "source": "std/process/process.lu",
          "line": 1309,
          "tier": "core"
        },
        {
          "name": "wait",
          "kind": "fn",
          "signature": "pub fn wait(take ch: Child) -> int ! {signal, io}",
          "doc": "Wait for `ch` to finish and answer its exit code, consuming the handle.\n\nRows: `signal` when the child died without an exit code — killed by\nthis program or by anything else, or crashed — which is an OUTCOME with\nno number rather than a failure to report a number; `io` when the\nhandle is forged, foreign or already reaped. Never traps.\n\n**This blocks until the child finishes.** There is no deadline at this\npin (F-0065): a caller who cannot afford to wait forever looks without\nwaiting instead (`poll`, from wolf 0.2.31), or kills the child from\nanother task.\n\n`take ch` because waiting REAPS: the child is gone from the machine's\ntable afterwards, so a second wait is a use-after-move the compiler\nrejects rather than an `io` row at run time (§14's handle rule).\n\nCapability `Exec`; refused at comptime (D33). Delegates to `os_wait`.\n\n```wolf-doc-example\nvar forged = process.Child { slot: 4242 }\n(process.wait(take forged) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 1335,
          "tier": "core"
        },
        {
          "name": "kill",
          "kind": "fn",
          "signature": "pub fn kill(mut ch: Child) -> () ! {io}",
          "doc": "Kill `ch` — end the child immediately, without reaping it.\n\nRows: `io` when the handle is forged, foreign, already reaped, or names\na child that has already exited (a child that is finished is not yours\nto kill any more). Never traps.\n\n**A killed child still has to be waited for.** This call does not\nconsume the handle, and the `wait` that follows answers the `signal`\nrow rather than a code — that pair is the whole \"stop it\" idiom, and\nskipping the wait leaves a zombie on every unix. The kill is immediate\nand uncatchable by the child: nothing here asks a program to shut down\npolitely, because no builtin sends a gentler signal (F-0065).\n\n`mut ch` because killing changes what the child IS, exactly as\n`std.fs.read` takes `mut` for advancing a position: the handle's fields\ndo not move, the thing it names does (§14).\n\nCapability `Exec`; refused at comptime (D33). Delegates to `os_kill`.\n\n```wolf-doc-example\nvar forged = process.Child { slot: 4242 }\nprocess.kill(mut forged) else |_| { }\n(process.wait(take forged) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 1363,
          "tier": "core"
        },
        {
          "name": "run",
          "kind": "fn",
          "signature": "pub fn run(c: Command) -> int ! {unsupported, invalid, not_found, denied, signal, io}",
          "doc": "Start `c`, wait for it, and answer its exit code.\n\nRows: the union of `start`'s and `wait`'s — `unsupported`, `invalid`,\n`not_found`, `denied`, `signal`, `io`, each meaning exactly what it\nmeans there. Never traps.\n\nThis is the whole operation for the commonest case, where a program\nruns another program and cares only how it ended. It blocks for as long\nas the child runs, it reaps the child (so nothing is left behind), and\nit cannot be interrupted at this pin. It gives you the child's output\nonly through a map: `run` blocks until the child exits, so a child\nthat fills a pipe nobody is reading blocks with it — capture with\n`start`, read the pipe, then `wait`.\n\nCapability `Exec`; refused at comptime (D33). Delegates to `os_spawn`\nand `os_wait`.\n\n```wolf-doc-example\nlet missing = process.command(\"wolf-sc11-no-such-program-here\")\n(process.run(missing) else -1) == -1\n```",
          "source": "std/process/process.lu",
          "line": 1388,
          "tier": "core"
        },
        {
          "name": "is_success",
          "kind": "fn",
          "signature": "pub fn is_success(exit_code: int) -> bool",
          "doc": "Whether `exit_code` means the program succeeded.\n\nTotal: no rows, no traps. Pure and comptime-safe. Zero is success and\neverything else is failure, on every tier-1 host; this function exists\nso that the convention is written down once, in std, instead of as a\n`== 0` in every caller that would then have to be re-read when someone\nwonders whether this platform is the exception. It is not.\n\nThe `signal` row is NOT a code and never reaches here: a child that\ndied without exiting did not succeed and did not fail with a number,\nwhich is exactly why it is a separate outcome (§12).\n\n```wolf-doc-example\nprocess.is_success(0) == true\nprocess.is_success(1) == false\nprocess.is_success(-1) == false\n```",
          "source": "std/process/process.lu",
          "line": 1410,
          "tier": "core"
        },
        {
          "name": "exec",
          "kind": "fn",
          "signature": "pub fn exec(c: Command, env: List[str]) -> () ! {unsupported, invalid, not_found, denied, io}",
          "doc": "Replace THIS program with the one `c` names — an exec, not a spawn.\n\nThe process stays (its id, its parent, its controlling terminal) and\nits program goes: the new one receives `c`'s whole argument vector\n(element 0 is both the program to find and the name it is handed),\n`env` as its ENTIRE environment — `NAME=VALUE` entries, the shape\n`std.env.vars()` answers, so `env.vars()` passed through keeps the\ncurrent environment and an empty list starts from none — and `c`'s\ndescriptor map (`set_fd`, `set_stdin`, …, `close_fd`) applied to this\nprocess's own descriptors. One difference from `start`: a descriptor\nthe map does not name keeps what this process has, so an exec'd\nprogram reads this program's standard input (a child started with\n`start` reads the null device). Every file this program opened and\ndid not map is closed by the exec.\n\nA program name without a `/` is searched along the `PATH` entry of\n`env`, or `/usr/bin:/bin` when `env` has none — the new program's\nsearch path, decided from the call's own arguments, not from this\nprocess's environment.\n\n**On success this function does not return.** A call that returns has\nfailed, and its row says how: `invalid` for an empty vector, an `env`\nentry with no `=` or an empty name, or a map `start` would refuse;\n`unsupported` on a host with no exec (windows), by name; `io` for a map\nnaming a closed file; `not_found` when no program is found; `denied`\nwhen the one found may not be run. A failed exec leaves this process as\nit was, its descriptors included.\n\nCapability `Exec`; refused at comptime (D33). Delegates to `os_exec`\n(wolf-lang s225, `[os.proc.exec]`). lupin serves descriptors 0, 1 and\n2 in the map and refuses any other by name, as it does for `start`.\n\n```wolf-doc-example\nvar refused = false\nlet none = process.from_argv(List[str]())\nprocess.exec(none, List[str]()) else |_| { refused = true }\nrefused == true\n```",
          "source": "std/process/process.lu",
          "line": 1452,
          "tier": "core"
        },
        {
          "name": "set_ids",
          "kind": "fn",
          "signature": "pub fn set_ids(uid: int, gid: int, groups: List[int]) -> () ! {denied, invalid, unsupported, io}",
          "doc": "Make THIS process another user, for good.\n\n**s236 (`[os.proc.ids.set]`).** After it the process is user `uid`,\ngroup `gid`, with exactly the supplementary groups `groups` — its\nreal, effective and saved ids all, in every thread. It is what `su`,\n`login` and a server that has bound its low port do, and it is one\ncall because the three changes have one safe order (the groups, the\ngroup ids, the user ids) that a program must not be able to get\nwrong: the other order leaves the old group and the old groups\nbehind. There is no way back, no \"leave this one\" word, and no\ntemporary form; do what needs the old user first. The numbers come\nfrom the account files: `std.os.users` reads them.\n\n**It returns in one of two states and no other** — every id as\nasked, or every id as it was. A refusal before anything changed is a\nrow; a refusal after a change is put back and read back before it\nis a row; and if that cannot be done, or the ids read back are not\nthe ones asked for, or an old id can still be taken, the process\nENDS (one line on standard error and an abort) rather than run as\npartly one user and partly another.\n\nRows: `invalid` for an id outside `0..=4294967294` or more than\n65536 groups (decided before the host), and for an id the host has\nno mapping for; `denied` for a process that may not change its ids;\n`unsupported` on every host but linux, by name (macOS has no way to\nread a drop back); `io` otherwise. Never traps.\n\nCapability `Exec`; refused at comptime (D33). Delegates to\n`os_set_ids` (wolf-lang s236). lupin answers the `invalid` rows and\ndeclines a well-formed call by name.\n\n```wolf-doc-example\nvar refused = false\nprocess.set_ids(0 - 1, 0, List[int]()) else |_| { refused = true }\nrefused == true\n```",
          "source": "std/process/process.lu",
          "line": 1496,
          "tier": "core"
        },
        {
          "name": "exit",
          "kind": "fn",
          "signature": "pub fn exit(code: int)",
          "doc": "End THIS process immediately with `code`.\n\nNever returns — no `defer` runs, no buffer is flushed by std, and no\nrow can be raised by a call that does not come back. Not a trap: the\nprocess ends with the status the caller asked for, which is the one\nthing a trap cannot do.\n\nOnly the low byte of `code` survives on a unix host: the exit status a\nparent can observe is `code` modulo 256, so `exit(300)` is seen as 44\nand `exit(-1)` as 255. std does not renumber or clamp — a caller that\nwants a portable status writes one in `0..255`, and this sentence is\nwhere that is documented rather than discovered.\n\nCapability `Exec`; refused at comptime (D33) — a comptime program that\ncould end the compiler is the sharpest case of that rule. Delegates to\n`os_exit`, which is the one member of the s40 `exec` family every rung\nexecutes: this function therefore runs under the interpreter too, and the\nonly reason it is dark on the native rung is that lowering refuses the\nwhole MODULE for the process trio beside it.\n\n```wolf-doc-example\nprocess.is_success(0) == true\nprocess.exit(0)\n```",
          "source": "std/process/process.lu",
          "line": 1524,
          "tier": "core"
        },
        {
          "name": "exit_signal",
          "kind": "fn",
          "signature": "pub fn exit_signal(meaning: int) -> () ! {invalid, unsupported}",
          "doc": "**s246 (`[os.signal.exit]`, ruling #88 R2): end THIS process by\n`meaning`'s signal**, so that its parent reads the end as the end by\nthat signal (`-N`: `signal_of`, `$?` `128 + N`) — what a wrapper whose\ncommand died of a signal does to die of the same one (GNU `timeout`,\nwhere `exit(139)` would only imitate SIGSEGV). `meaning` is in the\nSENDING shape: one meaning of `std.signal`'s table, or a host number\n(`signal.host(n)`). On unix the signal is set back to its default\n(the runtime's stack guard and any listen let go of it), unblocked\nand raised on the calling thread; the end is the host's, with a core\nwhere the host writes one. A process the signal does not end — a\nmeaning whose default does nothing (`child()`, `continued()`,\n`urgent()`, `resize()`), or a stop that is later continued — exits\nwith **`128 + N`**, so the call returns only a row.\n\nRows: `invalid` for 0, for anything `signal.send` refuses (two\nmeanings, a bit no release publishes, a host number past\n`signal.last()`), and from wolf 0.2.35 for the C library's own\nnumbers (`signal.host`'s doc: glibc's 32 and 33, which 0.2.33 and\n0.2.34 ended by as exits 160 and 161); then `unsupported` on windows.\nThose are its only returns. As with `exit`, no `defer` runs and std flushes nothing.\n`std.signal.raise` is unchanged (it delivers one listenable meaning).\n\nCapability `Exec`, with `exit`; refused at comptime (D33). The checked\nmachine refuses it by name after the shape (it runs inside the `wolf`\nprocess, which a signal would end); lupin 0.1.55 answers the shape\nrows and refuses a well-formed end by name, since it has no\n`sigaction` and no `raise(3)` (is77, wolf-interp#261). Delegates to\n`os_exit_signal`.\n\n```wolf-doc-example\nvar row = \"ended\"\nprocess.exit_signal(0) else |_| { row = \"refused\" }\nrow == \"refused\"\n```",
          "source": "std/process/process.lu",
          "line": 1562,
          "tier": "core"
        },
        {
          "name": "CoreLimit",
          "kind": "struct",
          "signature": "pub struct CoreLimit { soft: int, hard: int, }",
          "doc": "This process's core limit (`[os.proc.core]`): `soft`, the size in\nbytes past which a dump is cut (0: no core file), and `hard`, the\nceiling the soft may be raised to; **-1 is unlimited** in either.\nA child starts with its parent's (a shell's `ulimit -c`, a container's\n`--ulimit core=…`).",
          "source": "std/process/process.lu",
          "line": 1571,
          "tier": "core"
        },
        {
          "name": "core_limit",
          "kind": "fn",
          "signature": "pub fn core_limit() -> CoreLimit ! {unsupported}",
          "doc": "**s253 (`[os.proc.core]`, wolf 0.2.35): this process's core limit**,\n`getrlimit(RLIMIT_CORE)` as a `CoreLimit`. Read before the program\nsets it, it is the limit the process was born with. The soft is at\nmost the hard, and an unlimited hard admits any soft.\n\nRows: `unsupported` on windows, which keeps no core limit. Never\ntraps. The checked machine reads the `wolf` process's own limit (the\nprocess the program runs as). lupin resolves the call from 0.1.59\n(wolf-interp#277).\n\nCapability `env` (it reads this process's context, with `own_group`);\nrefused at comptime (D33). Delegates to `os_core_limit`.\n\n```wolf-doc-example\nlet l = process.core_limit() else |_| process.CoreLimit { soft: 0, hard: 0 }\nl.hard == 0 - 1 || (l.soft >= 0 && l.soft <= l.hard)\nl.soft >= 0 - 1\n```",
          "source": "std/process/process.lu",
          "line": 1594,
          "tier": "core"
        },
        {
          "name": "set_core_limit",
          "kind": "fn",
          "signature": "pub fn set_core_limit(soft: int, hard: int) -> () ! {denied, invalid, unsupported}",
          "doc": "**s253 (`[os.proc.core]`, wolf 0.2.35): set this process's core\nlimit**, `setrlimit(RLIMIT_CORE)`, for this process and every child it\nstarts after the call. Each of `soft` and `hard` is -1 (unlimited) or\na size in bytes; the soft is at most the hard.\n\nRows, in the order they are decided: `invalid` unless each is -1 or 0\nand up and the soft is at most the hard (an unlimited soft under a\nfinite hard included), before the host; then `unsupported` on windows;\nthen `denied` where the host refuses a raise of the hard limit — a\nprocess may lower its hard limit and, without the privilege for it,\nnever raise it again. Nothing changes on a row. Never traps. The\nchecked machine sets the `wolf` process's own limit. lupin resolves the\ncall from 0.1.59 (wolf-interp#277).\n\nCapability `Exec` (with `exit_signal`); refused at comptime (D33).\nDelegates to `os_set_core_limit`.\n\n```wolf-doc-example\nvar row = \"set\"\nprocess.set_core_limit(5, 4) else |_| { row = \"refused\" }\nrow == \"refused\"\nlet l = process.core_limit() else |_| process.CoreLimit { soft: 0 - 1, hard: 0 - 1 }\nvar same = \"set\"\nprocess.set_core_limit(l.soft, l.hard) else |_| { same = \"refused\" }\nsame == \"set\" || same == \"refused\"\n```",
          "source": "std/process/process.lu",
          "line": 1625,
          "tier": "core"
        },
        {
          "name": "core_off",
          "kind": "fn",
          "signature": "pub fn core_off() -> () ! {unsupported}",
          "doc": "**s253 (`[os.proc.core]`, wolf 0.2.35): this process dumps no core,\nwhatever ends it**, on every host and every core pattern. On linux it\nsets the process's \"dumpable\" attribute to 0\n(`prctl(PR_SET_DUMPABLE, 0)`), the one switch a pattern that pipes\ncores to a program obeys (core(5): the limit is not enforced there),\nand GNU `timeout`'s own call before it ends itself by its command's\nsignal; elsewhere it sets the soft core limit to 0, keeping the hard.\nSo `core_off` then `exit_signal(signal.segment_fault())` is an end by\nthat signal with no core: a parent's `wait_status_core` answers `-11`,\nnot `-(256 + 11)`.\n\nThe attribute is this process's alone: `exec` sets it back, so a child\nit starts dumps as the host says, and no call sets it back here. It\nhas two other effects on linux (PR_SET_DUMPABLE(2const)): the\nprocess's `/proc/<pid>` files become the super-user's, and another\nprocess of the same user can no longer `ptrace` it.\n\nRows: `unsupported` on windows. Never traps. The checked machine sets\nthe `wolf` process's own attribute. lupin resolves the call from 0.1.59\n(wolf-interp#277).\n\nCapability `Exec` (with `exit_signal`); refused at comptime (D33).\nDelegates to `os_core_off`.\n\n```wolf-doc-example\nvar off = \"off\"\nprocess.core_off() else |_| { off = \"unsupported\" }\noff == \"off\" || off == \"unsupported\"\n```",
          "source": "std/process/process.lu",
          "line": 1658,
          "tier": "core"
        },
        {
          "name": "Fork",
          "kind": "struct",
          "signature": "pub struct Fork { pid: int, child: Child, }",
          "doc": "What one `fork` answered, in the process that reads it (s247,\n`[os.proc.fork]`). In the PARENT: `pid`, the child's process id\n(above 0), and `child`, its handle, which `wait`, `wait_status`,\n`wait_status_core`, `poll`, `poll_core`, `pid` and `kill` serve as\nthey serve a started child's. In the CHILD: `pid` 0 and `child`\n`Child { slot: -1 }`, a handle every one of those answers `io` for.\n`is_child` says which side this is.",
          "source": "std/process/process.lu",
          "line": 1669,
          "tier": "core"
        },
        {
          "name": "fork",
          "kind": "fn",
          "signature": "pub fn fork() -> Fork ! {busy, io, unsupported}",
          "doc": "**s247 (`[os.proc.fork]`, rulings #90 and #95): make a child process\nthat runs on from this call**, a copy of this program. The call\nanswers twice: in the parent a `Fork` naming the child, in the child\na `Fork` whose `pid` is 0 (`is_child`). It is what a shell's\nsubshell is — `( … )`, `{ …; } &`, a command substitution, a\npipeline stage the shell runs itself — where `start` runs another\nprogram.\n\nWhat the child is: ONE thread, the caller's, with the program's\nmemory as it was at the call; every descriptor shared, offsets\nincluded (a `pipe` made before the fork carries the child's bytes to\nthe parent); the signal dispositions and the mask kept, nothing\npending, a listen's queue its own; no task, no worker, and no child\nof the parent's (a handle the parent held answers `io` there). The\nchild ends with `exit` or `exit_signal`: a return from the function\nthat forked runs on into the rest of the parent's code.\n\n**The fork's rule is `busy`**, answered before the host is asked:\nfrom a task or a proc handler, while any task is live anywhere in\nthe process (queued, running or parked), and under the deterministic\nscheduler. So only `main`'s thread forks, before its first spawn or\nafter every scope has joined, and no lock another thread holds is\never copied.\n\nRows: `busy` as above; `io` where the host refuses (a process limit,\nmemory), its number in `os_error()`; `unsupported` on windows, which\nhas no fork, and on **the checked machine** on every host (ruling #95\nR4 C), which is the `wolf` process interpreting the program — so a\nprogram with an in-process path takes it there and runs to its end,\nas on windows. Never traps. lupin 0.1.56 refuses the call by name on\nunix (std has no fork) and answers windows' `unsupported` (0.1.55 did\nnot resolve it, wolf-interp#269). The cost, measured upstream: 1,000 forks that end\nat once and are waited for take 0.119 s on kasumi (dash's `x=$(true)`\n0.083 s).\n\nCapability `Exec`; refused at comptime (D33). Delegates to `os_fork`.\n\n```wolf-doc-example\nlet f = process.fork() else |_| process.Fork { pid: 0 - 1, child: process.Child { slot: 0 - 1 } }\nif process.is_child(f) { process.exit(0) }\nvar ch = process.Child { slot: f.child.slot }\nlet st = process.wait_status(take ch) else 0 - 1\n(f.pid > 0 && st == 0) || (f.pid == 0 - 1 && st == 0 - 1)\n```",
          "source": "std/process/process.lu",
          "line": 1718,
          "tier": "core"
        },
        {
          "name": "is_child",
          "kind": "fn",
          "signature": "pub fn is_child(f: Fork) -> bool",
          "doc": "Whether a `fork`'s answer is the CHILD's (`pid` 0). Pure and\ncomptime-safe.\n\n```wolf-doc-example\nprocess.is_child(process.Fork { pid: 0, child: process.Child { slot: 0 - 1 } }) == true\nprocess.is_child(process.Fork { pid: 4242, child: process.Child { slot: 0 } }) == false\n```",
          "source": "std/process/process.lu",
          "line": 1730,
          "tier": "core"
        }
      ]
    },
    {
      "name": "rand",
      "group": "Numerics",
      "tier": "core",
      "doc": "std.rand — a deterministic, explicitly seeded pseudo-random\ngenerator. Stability tier: core.\n\n**There is no entropy in Phase A** (D15: the runtime stays thin, and\ncomptime refuses ambient randomness by design). Every generator here\nis constructed from a seed the caller supplies, and the same seed\ngives the same stream on every implementation and every OS — the\nstream is part of the observable contract and `tests/rand/` pins it\nvalue by value. OS-sourced bytes now live separately in std.os.random,\nwith platform admission and the language's provider-failure trap. That\nsurface neither seeds nor changes this generator; no hidden default.\n\n**The generator is PCG32** (O'Neill's XSH-RR variant over a 64-bit\nLCG): 64 bits of state, a 63-bit odd stream increment, a 32-bit\noutput. It is chosen over a bare xorshift for its output permutation\n— the raw LCG's high bits are good and its low bits are not, and\nPCG's xorshift-then-rotate mixes them — and over anything larger\nbecause 64 bits of state is what `wrapping[u64]` gives us with no\nbit-twiddling the checked tier cannot lower. It is NOT\ncryptographically secure and this header says so once, loudly: a\ncaller needing OS-source unpredictability uses std.os.random's guarded\ninterface, never this PCG stream.\n\n**`Rng` is a struct with free functions, not methods.** The contract\nwrites `Rng.new(seed)`; an `impl` block's methods cannot be called\nacross a module boundary at these pins (F-0029), so the module ships\n`rand.new(seed)` and `rand.next_int(mut r)` — the container-first,\nmode-honest shape §8 already mandates for every other std container.\nThe methods land when cross-module dispatch does.",
      "summary": "std.rand — a deterministic, explicitly seeded pseudo-random generator.",
      "items": [
        {
          "name": "Rng",
          "kind": "struct",
          "signature": "pub struct Rng { state: wrapping[u64], inc: wrapping[u64], }",
          "doc": "A seeded PCG32 generator. Copy it and you copy the position in the\nstream — the value semantics are the whole point of a replayable\ngenerator.",
          "source": "std/rand/rand.lu",
          "line": 39,
          "tier": "core"
        },
        {
          "name": "new",
          "kind": "fn",
          "signature": "pub fn new(seed: int) -> Rng",
          "doc": "A generator seeded with `seed`. Two generators built from the same\nseed produce identical streams, forever, on every implementation.\nTotal: no error row, no traps — every `int` is a legal seed,\nincluding 0 and negative values.\n\nThe stream increment is fixed (PCG's default), so `seed` selects a\nposition in one stream rather than a stream of its own; a\n`new_stream(seed, stream)` constructor is the nursery candidate that\nwould change that.\n\n```wolf-doc-example\nvar a = rand.new(42)\nvar b = rand.new(42)\nrand.next_int(mut a) == rand.next_int(mut b)\n```",
          "source": "std/rand/rand.lu",
          "line": 59,
          "tier": "core"
        },
        {
          "name": "next_int",
          "kind": "fn",
          "signature": "pub fn next_int(mut r: Rng) -> int",
          "doc": "The next 32 bits of the stream, as an `int` in `[0, 4294967296)`.\nNever negative and never above 2^32 - 1: the generator's output word\nis 32 bits wide, and widening it to `int` here (rather than\nproducing a full-range `int`) keeps `below` unbiased with one draw in\nthe common case. Total: no error row, no traps.\n\n```wolf-doc-example\nvar r = rand.new(42)\nrand.next_int(mut r) >= 0\nrand.next_int(mut r) < 4294967296\n```",
          "source": "std/rand/rand.lu",
          "line": 101,
          "tier": "core"
        },
        {
          "name": "below",
          "kind": "fn",
          "signature": "pub fn below(mut r: Rng, n: int) -> int",
          "doc": "A uniform draw from `[0, n)`, without modulo bias — the high draws\nthat would skew the residue are rejected and redrawn, so the number\nof draws is data-dependent but the distribution is exact. Traps\n`assert` when `n <= 0` (an empty range has nothing to draw from — a\ncaller contract violation, §2's trap rule) and when `n` exceeds\n2^32, which this generator's output word cannot cover.\n\n```wolf-doc-example\nvar r = rand.new(7)\nrand.below(mut r, 10) < 10\nrand.below(mut r, 10) >= 0\nrand.below(mut r, 1) == 0\n```",
          "source": "std/rand/rand.lu",
          "line": 125,
          "tier": "core"
        },
        {
          "name": "next_float",
          "kind": "fn",
          "signature": "pub fn next_float(mut r: Rng) -> f64",
          "doc": "A uniform draw from `[0.0, 1.0)` with 52 bits of resolution: the\ndraw fills a mantissa, so every representable multiple of 2^-52 in\nthe interval is equally likely and 1.0 is never returned. Total: no\nerror row, no traps.\n\n```wolf-doc-example\nvar r = rand.new(7)\nrand.next_float(mut r) < 1.0\nrand.next_float(mut r) >= 0.0\n```",
          "source": "std/rand/rand.lu",
          "line": 153,
          "tier": "core"
        },
        {
          "name": "next_bool",
          "kind": "fn",
          "signature": "pub fn next_bool(mut r: Rng) -> bool",
          "doc": "A fair coin, taken from the output word's top bit (the LCG's best\nbit after the output permutation). Total: no error row, no traps.\n\n```wolf-doc-example\nvar r = rand.new(7)\nvar seen = 0\nfor _ in 0..8 { if rand.next_bool(mut r) { seen = seen + 1 } }\nseen > 0\nseen < 8\n```",
          "source": "std/rand/rand.lu",
          "line": 175,
          "tier": "core"
        },
        {
          "name": "shuffle",
          "kind": "fn",
          "signature": "pub fn shuffle(mut r: Rng, mut xs: List[int])",
          "doc": "Shuffles `xs` into a uniformly random permutation (Fisher–Yates,\ndrawing from the front). Total: no error row, no traps; an empty or\none-element list is left alone.\n\nCost note, honestly stated: this is O(n^2) at these pins, not O(n),\nbecause `std.list.swap` rebuilds the list (index assignment executes\non one implementation only — F-0011's surface question). The\nalgorithm is the right one and the constant is the language's to fix.\n\n```wolf-doc-example\nvar r = rand.new(3)\nvar xs = List[int]()\n(mut xs).push(1)\n(mut xs).push(2)\n(mut xs).push(3)\nrand.shuffle(mut r, mut xs)\nxs.len == 3\nxs[0] + xs[1] + xs[2] == 6\n```",
          "source": "std/rand/rand.lu",
          "line": 199,
          "tier": "core"
        },
        {
          "name": "choose",
          "kind": "fn",
          "signature": "pub fn choose(mut r: Rng, xs: List[int]) -> int ! {none}",
          "doc": "A uniformly chosen element of `xs`, or `none` when `xs` is empty.\nNo traps.\n\n```wolf-doc-example\nvar r = rand.new(3)\nvar xs = List[int]()\n(mut xs).push(9)\n(rand.choose(mut r, xs) else 0) == 9\n```",
          "source": "std/rand/rand.lu",
          "line": 218,
          "tier": "core"
        }
      ]
    },
    {
      "name": "range",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.range — operations over the language's `a..b`. Stability tier:\ncore.\n\n**Four functions, all O(1), on the two accessors `[type.range]` gave\nthe type at wolf 0.2.14 (s158, wolf-lang#24; F-0030 CLOSED).** A\n`range[int]` is a nameable type with `start` and `end` as properties,\nand `end` is EXCLUSIVE, always: `a..=b` normalizes at construction to\n`end = b + 1` under `[mem.iter.range]`'s checked arithmetic, so\n`(2..=7).end` is 8 and `r.end - r.start` is the count for both\nspellings (`[type.range.accessor]`). That one exclusive `end` is what\nmakes `contains`, `len` and `clamp_to` writable at all. sc04 reviewed\ntheir signatures and F-0030 recorded them as unwritable for eleven\nsprints, because the only spelling was iteration: O(len) for an O(1)\nquestion, and a hang rather than an answer on\n`0..9223372036854775807`. `is_empty` shipped alone, on the one fact\niteration can decide in O(1), and is now the same comparison as the\nother three.\n\n**A reversed range is a legal, empty value.** `7..3` iterates zero\ntimes — `[mem.iter.range]` steps ascending while `< end` — so\n`is_empty(7..3)` is true, and its raw `end - start` is **-4**,\nmeasured at wolf 0.2.14 on both rungs. `len` therefore answers the\nCOUNT of values a `for` would yield, which is 0 there, and not the\nsigned difference wolf-std#30 spelled: a function named `len` that\nanswers a negative number is the wrong-on-legal-input shape sc03's\nrefusal-over-approximation rule (§9) does not ship. `clamp_to` on an\nempty range has no member to answer with and raises `none` (§2:\nabsence is a row tag, never a sentinel), a row the reviewed signature\ndid not carry; returning `start` — a number the range does not\ncontain — would be the same wrong answer under a different name.\n\n**Lane words, named.** Both compiler rungs run every row here at\n0.2.14. The reference machine (lupin 0.1.36) conforms to `a7f517e` =\nv0.2.12 and has not mirrored `[type.range.accessor]`: `r.start` and\n`r.end` are declined BY NAME at resolve there — \"a range has no\nmember `start`\", F-0030's sentence, a whole-program `unsupported`\nand never a diagnostic — so every test in `tests/range/` is\n`unsupported` on lupin, `is_empty`'s included (it ran there while\nits body was a loop). The examples below are FENCED, under the\nextractor's `mirror-lag` word (`LUPIN_MIRROR_LAG`, wolf-std#37, sc49):\nboth compiler rungs must run each block to `exit(0)`, and the\nreference lane must decline it with exactly that sentence. They were\nprose at sc48 because `doc-examples` accepted a lupin `unsupported`\nonly for capability modules, and a fence would have been a red. The\nrelease that mirrors the clause reds the five lupin test rows\n(deeper than the ledger) AND these four blocks on the same day, and\nthe entry leaves in the commit that flips them.\n\n**A fifth function, `collect`, is `[type.comb.set]`'s** (sc50, wolf-lang\n`4c046f15`): the one combinator whose receiver is a range, and the\none here that reads no accessor. It walks `for x in r`, so lupin\n0.1.36, which resolves lazily, runs it over `range[int]` and\ndeclines `range[char]` itself (\"a range needs integer endpoints\").\nIts int example is fenced for that reason.\n\n`rev()` and `step_by()` remain BLOCKED on the iterator combinator\nsurface (F-0008's successor); the combinator that truncates a sequence\nis named `limit(n)`, never `take(n)` — `take` is the ownership mode\nthat CONSUMES its operand, and a combinator that does not consume\nwould be a false friend at the centre of the ownership story\n(wolf-lang#16, API-CONVENTIONS §10).",
      "summary": "std.range — operations over the language's `a..b`.",
      "items": [
        {
          "name": "is_empty",
          "kind": "fn",
          "signature": "pub fn is_empty(r: range[int]) -> bool",
          "doc": "True when `r` yields no values — `5..5` and `7..3` are empty, `2..7`\nis not. One comparison, `r.start >= r.end`; the body before 0.2.14\nasked the iterator the same question (`for _ in r { return false }`),\nwhich was O(1) too and is why this function shipped eleven sprints\nbefore the other three. Total: no error row, no traps.\n\n```wolf-doc-example\nrange.is_empty(5..5) == true\nrange.is_empty(7..3) == true\nrange.is_empty(2..7) == false\n```",
          "source": "std/range/range.lu",
          "line": 76,
          "tier": "core"
        },
        {
          "name": "contains",
          "kind": "fn",
          "signature": "pub fn contains(r: range[int], x: int) -> bool",
          "doc": "True when `x` is a value `r` yields: `r.start <= x && x < r.end`,\nthe spelling `[type.range.accessor]` gives. O(1) on every input,\n`0..9223372036854775807` included — the range this function refused\nto be written over by iteration. An empty range contains nothing.\nTotal: no error row, no traps.\n\n`end` is exclusive, so `7` is outside `2..7` and inside `2..=7`:\n\n```wolf-doc-example\nrange.contains(2..7, 2) == true\nrange.contains(2..7, 7) == false\nrange.contains(2..=7, 7) == true\n```",
          "source": "std/range/range.lu",
          "line": 93,
          "tier": "core"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(r: range[int]) -> int",
          "doc": "The number of values `r` yields: `r.end - r.start` when `r` is\nnon-empty, `0` when it is not — `len(7..3)` is 0 where the raw\ndifference is -4 (module header), and `len(a..=b)` is `b - a + 1`\nbecause `end` normalized to `b + 1` at construction. No error row.\nTraps `overflow` (checked arithmetic, X3) when the count does not fit\nan `int`, which is exactly a range spanning more than half the\ninteger line — `(0 - 9223372036854775807 - 1)..9223372036854775807`\nyields 2^64 - 1 values and there is no `int` to say so;\n`tests/range/len_overflow_trap.lu` pins the kind.\n\n```wolf-doc-example\nrange.len(2..7) == 5\nrange.len(2..=7) == 6\nrange.len(5..5) == 0\nrange.len(7..3) == 0\n```",
          "source": "std/range/range.lu",
          "line": 113,
          "tier": "core"
        },
        {
          "name": "clamp_to",
          "kind": "fn",
          "signature": "pub fn clamp_to(r: range[int], x: int) -> int ! {none}",
          "doc": "The value of `r` nearest to `x`: `x` itself when `r` contains it,\n`r.start` when `x` lies below, and `r.end - 1` — the last value\nyielded — when `x` is at or above `end`. Rows: `none` when `r` is\nempty, because an empty range has no member to answer with (§2).\nNever traps: `r.end - 1` is computed only under `r.start < r.end`,\nso it cannot underflow.\n\nAn empty range answers with the row, handled here with `else`:\n\n```wolf-doc-example\n(range.clamp_to(2..7, 4) else 0 - 1) == 4\n(range.clamp_to(2..7, 9) else 0 - 1) == 6\n(range.clamp_to(2..7, 0 - 3) else 0 - 1) == 2\n(range.clamp_to(5..5, 1) else 0 - 1) == 0 - 1\n```",
          "source": "std/range/range.lu",
          "line": 135,
          "tier": "core"
        },
        {
          "name": "collect",
          "kind": "fn",
          "signature": "pub fn collect[T](r: range[T]) -> List[T]",
          "doc": "A fresh list holding every value `r` yields, in iteration order: the\nvalues a `for x in r` would see. `2..5` collects `2, 3, 4`; an empty\nor reversed range collects the empty list. One generic function for\nboth element types the clause names (`range[int]`, `range[char]`),\nbecause wolf has no overloading and a `range[int]` signature refuses\na char range with `E0401` (measured). Total: no error row; traps as\nthe range's `for` does (`[mem.iter.range]`), and allocation. A\n`0..9223372036854775807` collect is a list of that length, which no\nhost has, so no test here builds one.\n\n`[type.comb.set]` (wolf-lang `4c046f15`): the method `r.collect()`\nis this call (`std.range` is `range`'s home module,\n`[type.method.home]`). Cost, as the clause states it: one fresh\n`List` of the range's length, plus `push`'s own copy per value.\n\n`r` is a `read` parameter and the values escape in the returned list\n(`[mem.tier0.mode.read]`, wolf-lang#366, in 0.2.15), and that clause\ncounts a TYPE PARAMETER as able to reach shared storage always,\n\"because a generic body is checked once for every instantiation\" — so\n`T` is in scope for the rule even though the two element types a\nrange can have are scalars. No `copy` is spelled: the store is\n`push`'s, wolf-lang#385 ruled option 3 (s167, unreleased) copies a\nnon-`Copy` element by default, and a value that reaches no heap\nstorage is its own copy, so this costs nothing at run time either way\n(`[mem.tier0.move.3]`, wolf-lang#384). `take` is not the spelling\nhere: a value moved out of a `read` parameter is LENT, and a `take`\nof a lent binding is E1014 by the same clause.\n\n```wolf-doc-example\nrange.collect(2..5).len == 3\nrange.collect(2..5)[0] == 2\nrange.collect(1..=3)[2] == 3\nrange.collect(7..3).len == 0\n```",
          "source": "std/range/range.lu",
          "line": 182,
          "tier": "core"
        }
      ]
    },
    {
      "name": "search",
      "group": "Numerics",
      "tier": "core",
      "doc": "std.search — finding things in a sorted `List`, and the reductions\nthat scan an unsorted one. Stability tier: core.\n\n**Sortedness is the caller's contract, not a checked precondition.**\n`binary_search`, `lower_bound`, `upper_bound` and `equal_range` all\nassume `xs` is ascending; on an unsorted list they answer *something*\nrather than trapping, because verifying the precondition costs more\nthan the search does. `std.sort.is_sorted` is the check, and the docs\nsay to call it in a debug path if you cannot prove it.\n\n**Absence is a row, never a sentinel** (§2, §8): a miss raises `none`\nand no function here returns -1. `lower_bound` and `upper_bound` are\nthe total complements — an insertion POSITION always exists, so they\nreturn a plain `int`.\n\n**Monomorphic over `int` at these pins.** The reviewed generic\nsignatures, which land the day `Ord.cmp` dispatches (F-0002):\n\n- `binary_search[T: Ord](xs: List[T], x: T) -> int ! {none}`\n- `binary_search_by[T](xs: List[T], by: fn(T) -> Ordering) -> int ! {none}`\n- `lower_bound[T: Ord](xs: List[T], x: T) -> int`\n- `upper_bound[T: Ord](xs: List[T], x: T) -> int`\n- `equal_range[T: Ord](xs: List[T], x: T) -> (int, int)`\n- `min_of[T: Ord](xs: List[T]) -> T ! {none}`, `max_of` likewise\n- `min_index[T: Ord](xs: List[T]) -> int ! {none}`, `max_index` likewise\n\nThe monomorphic bodies below are those signatures with `T = int`, and\nthey RUN — which is the whole point of shipping them this way rather\nthan shipping generic bodies that only typecheck. `sum` and `product`\nare `int`-only by nature (they are checked integer arithmetic).\n\nLinear `contains` and `index_of` are NOT here: they are `std.list`'s\n(sc02, in `std/x/list_eq` while the `Eq` bound cannot dispatch), and\none concept keeps one name across std (§1).\n\nBLOCKED(c05), named and bodiless: `min_by`, `max_by`, `sum_by`,\n`partition_point` — each takes a closure in every real use.",
      "summary": "std.search — finding things in a sorted `List`, and the reductions that scan an unsorted one.",
      "items": [
        {
          "name": "binary_search",
          "kind": "fn",
          "signature": "pub fn binary_search(xs: List[int], x: int) -> int ! {none}",
          "doc": "The index of some element equal to `x`, or `none` when `xs` holds\nnone. `xs` must be ascending (see the module header). On a run of\nequal elements the index returned is unspecified — `lower_bound` and\n`equal_range` are the functions that promise a position.\n\nO(log n) comparisons. No traps: every index it forms is in range.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(10)\n(mut xs).push(20)\n(mut xs).push(30)\n(search.binary_search(xs, 20) else -1) == 1\n(search.binary_search(xs, 10) else -1) == 0\n(search.binary_search(xs, 25) else -1) == -1\n```",
          "source": "std/search/search.lu",
          "line": 59,
          "tier": "core"
        },
        {
          "name": "binary_search_by",
          "kind": "fn",
          "signature": "pub fn binary_search_by(xs: List[int], by: fn(int) -> cmp.Ordering) -> int ! {none}",
          "doc": "The index of the one element for which `by` answers `Equal`, or\n`none`. `by` is a *probe*: it receives an element and reports how\nthat element compares to the sought value, so the value itself never\ncrosses the boundary.\n\nDoes not execute at these pins: examining an `Ordering` produced\noutside the module that declares it is `unsupported` in both\nimplementations (F-0029). The static ladder is clean and the body is\nthe one that lands. Prose, not a fenced example, for that reason.",
          "source": "std/search/search.lu",
          "line": 88,
          "tier": "core"
        },
        {
          "name": "lower_bound",
          "kind": "fn",
          "signature": "pub fn lower_bound(xs: List[int], x: int) -> int",
          "doc": "The first index at which `x` could be inserted keeping `xs`\nascending — the index of the first element at or above `x`, and\n`len(xs)` when every element is below it. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(1)\n(mut xs).push(2)\n(mut xs).push(2)\n(mut xs).push(5)\nsearch.lower_bound(xs, 2) == 1\nsearch.lower_bound(xs, 0) == 0\nsearch.lower_bound(xs, 9) == 4\n```",
          "source": "std/search/search.lu",
          "line": 121,
          "tier": "core"
        },
        {
          "name": "upper_bound",
          "kind": "fn",
          "signature": "pub fn upper_bound(xs: List[int], x: int) -> int",
          "doc": "The last index at which `x` could be inserted keeping `xs`\nascending — the index of the first element strictly above `x`.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(1)\n(mut xs).push(2)\n(mut xs).push(2)\n(mut xs).push(5)\nsearch.upper_bound(xs, 2) == 3\nsearch.upper_bound(xs, 0) == 0\nsearch.upper_bound(xs, 5) == 4\n```",
          "source": "std/search/search.lu",
          "line": 149,
          "tier": "core"
        },
        {
          "name": "equal_range",
          "kind": "fn",
          "signature": "pub fn equal_range(xs: List[int], x: int) -> (int, int)",
          "doc": "The half-open index range `(first, last)` of the elements equal to\n`x` — `(lower_bound(xs, x), upper_bound(xs, x))`. An empty range\n(`first == last`) means `x` is absent, and its value is the insertion\npoint. Total: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(1)\n(mut xs).push(2)\n(mut xs).push(2)\n(mut xs).push(5)\nlet (lo, hi) = search.equal_range(xs, 2)\nlo == 1\nhi == 3\nsearch.equal_range(xs, 4).0 == search.equal_range(xs, 4).1\n```",
          "source": "std/search/search.lu",
          "line": 179,
          "tier": "core"
        },
        {
          "name": "min_of",
          "kind": "fn",
          "signature": "pub fn min_of(xs: List[int]) -> int ! {none}",
          "doc": "The least element of `xs`, or `none` when `xs` is empty. Linear;\n`xs` need not be sorted. On a tie the FIRST least element's value is\nreturned, which is the same value either way — `min_index` is the\nfunction whose tie rule is observable. No traps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(3)\n(mut xs).push(1)\n(mut xs).push(2)\n(search.min_of(xs) else 0) == 1\n```",
          "source": "std/search/search.lu",
          "line": 195,
          "tier": "core"
        },
        {
          "name": "max_of",
          "kind": "fn",
          "signature": "pub fn max_of(xs: List[int]) -> int ! {none}",
          "doc": "The greatest element of `xs`, or `none` when `xs` is empty. Linear;\n`xs` need not be sorted. No traps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(3)\n(mut xs).push(1)\n(mut xs).push(2)\n(search.max_of(xs) else 0) == 3\n```",
          "source": "std/search/search.lu",
          "line": 222,
          "tier": "core"
        },
        {
          "name": "min_index",
          "kind": "fn",
          "signature": "pub fn min_index(xs: List[int]) -> int ! {none}",
          "doc": "The index of the least element, or `none` when `xs` is empty. Ties go\nto the FIRST — the same stability promise `std.cmp.min` makes. No\ntraps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(3)\n(mut xs).push(1)\n(mut xs).push(1)\n(search.min_index(xs) else -1) == 1\n```",
          "source": "std/search/search.lu",
          "line": 250,
          "tier": "core"
        },
        {
          "name": "max_index",
          "kind": "fn",
          "signature": "pub fn max_index(xs: List[int]) -> int ! {none}",
          "doc": "The index of the greatest element, or `none` when `xs` is empty.\nTies go to the FIRST. No traps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(3)\n(mut xs).push(3)\n(mut xs).push(1)\n(search.max_index(xs) else -1) == 0\n```",
          "source": "std/search/search.lu",
          "line": 276,
          "tier": "core"
        },
        {
          "name": "sum",
          "kind": "fn",
          "signature": "pub fn sum(xs: List[int]) -> int",
          "doc": "The sum of `xs`; 0 for an empty list. Traps `overflow` the moment a\npartial sum leaves `int` — checked arithmetic, X3, and deliberately\nNOT a row: a sum that overflows is a bug in the caller's data model,\nand `std.math.checked_add` is right there for the case where it is\nnot.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(1)\n(mut xs).push(2)\n(mut xs).push(3)\nsearch.sum(xs) == 6\n```",
          "source": "std/search/search.lu",
          "line": 305,
          "tier": "core"
        },
        {
          "name": "product",
          "kind": "fn",
          "signature": "pub fn product(xs: List[int]) -> int",
          "doc": "The product of `xs`; 1 for an empty list. Traps `overflow` on the\nsame terms as `sum`.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(2)\n(mut xs).push(3)\n(mut xs).push(4)\nsearch.product(xs) == 24\n```",
          "source": "std/search/search.lu",
          "line": 323,
          "tier": "core"
        }
      ]
    },
    {
      "name": "set",
      "group": "Containers and regions",
      "tier": "core",
      "doc": "std.set — `Set[T]`, the unordered membership collection. Stability\ntier: core (the API; the implementation is blocked).\n\n**This module has no code yet, and that is the honest state.** A\n`Set[T]` is a std-DEFINED generic data type — no implementation\nprovides a set builtin, and `struct Set[T] { … }` does not parse in\neither implementation at the pins: a generic parameter list on a data\ndeclaration is E0201 in both (s16 delivers generic data types; the\nobservation is filed with F-0011). Writing a concrete `SetInt` here\ninstead would ship the wrong API — callers would migrate twice — so\nthe inventory below is a reviewed CONTRACT, not a stub to be filled\nin by guesswork, and it lands as wolf source in the sprint that\nfollows s16.\n\nReviewed inventory (13), each with its contract, exactly as it will\nland. `Eq` is the membership protocol; `Hash` is F-0011's open\nquestion, same as `Map`'s keys.\n\n```text\nadd[T: Eq](mut s: Set[T], v: T) -> bool\n    Inserts `v`; true when the set grew, false when `v` was present.\n    Total: no error row, no traps beyond allocation.\nremove[T: Eq](mut s: Set[T], v: T) -> bool\n    Removes `v`; true when it was there. No row: absence is the\n    answer, not an error.\nhas[T: Eq](s: Set[T], v: T) -> bool\n    Membership. Total.\nlen[T](s: Set[T]) -> int\n    Number of distinct elements. Total.\nis_empty[T](s: Set[T]) -> bool\n    `len(s) == 0`. Total.\nclear[T](mut s: Set[T])\n    Empties `s`, keeping it usable. Total.\nto_list[T](s: Set[T]) -> List[T]\n    Fresh list of the elements; order UNSPECIFIED (documented, not\n    promised). Allocates (`to_`, §1).\nunion[T: Eq](a: Set[T], b: Set[T]) -> Set[T]\n    Elements in either; a fresh set, both operands read.\nintersect[T: Eq](a: Set[T], b: Set[T]) -> Set[T]\n    Elements in both.\ndifference[T: Eq](a: Set[T], b: Set[T]) -> Set[T]\n    Elements of `a` not in `b` (asymmetric — the name says so).\nsymmetric_difference[T: Eq](a: Set[T], b: Set[T]) -> Set[T]\n    Elements in exactly one of the two.\nis_subset[T: Eq](a: Set[T], b: Set[T]) -> bool\n    Every element of `a` is in `b`; the empty set is a subset of\n    everything, and a set is a subset of itself.\nis_disjoint[T: Eq](a: Set[T], b: Set[T]) -> bool\n    No shared element; two empty sets are disjoint.\n```\n\nNo tests ship for this module: there is nothing to run, and a test\nthat imports an itemless module is E0305 (unused import) in both\nimplementations. The ledger stays honest by having no row to lie in.",
      "summary": "std.set — `Set[T]`, the unordered membership collection.",
      "items": []
    },
    {
      "name": "signal",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.signal — what a signal does to this process, and hearing one as an\nevent. Stability tier: core. The facade over wolf-lang's\n`[os.signal]` family (s114, s188, s219, s232).\n\n**A signal is named by its MEANING, never its number** (`[os.signal.set]`):\n`reload()` is `SIGHUP`, `interrupt()` is the terminal's Ctrl-C, and a\nset is the bitwise OR of meanings — `signal.interrupt() | signal.quit()`.\nThe meanings are functions here, each answering its bit, as they were\nwritten before std carried a constant (sc72's `WAIT_WRITE` is the\nmodule's one, and it is not a meaning). Twenty are LISTENABLE —\nevery signal POSIX names that a program may catch (`reload()` …\n`file_limit()`), the ones a set may hold. Eight more are SEND-ONLY\n(`kill()`, `stop()` and the six fault signals): `send` and `number`\ntake them, and so do `ignore_one`, `reset_one` and\n`std.process.exit_signal` (s246; the two `_one` calls refuse `kill()`\nand `stop()`, which no process can ignore). No set-taking call does.\n\n**A meaning's bit never changes, and a program never writes one**\n(`[os.signal.set.stable]`). Every meaning a release has published\nkeeps its bit forever — it is never reassigned or reused, even if the\nmeaning is retired — and a new meaning takes the lowest bit no release\nhas published. So a set stored by one release means the same to the\nnext, and the only spelling of a meaning that is portable is its NAME:\ncall the function, never write the bit and never a host's signal\nnumber. `number` is the one way from a meaning to the number this\nhost gives it (`USER` is 10 on linux and 30 on macOS), for the places\na number is the interface — `kill -l`, `trap … 13`, `128 + N`.\n\n**Three dispositions, nothing else.** A meaning's signal either does\nwhat the host does by default (`reset`), nothing (`ignore`), or arrives\nas an event (`listen`, then `wait` or `poll`). There is no handler: no\nwolf code ever runs when a signal arrives (`[os.signal.model]`). The\nlast call for a meaning wins. `ignore` and `reset` take a SET of\nlistenable meanings; `ignore_one` and `reset_one` (s246, ruling #88\nR1) take ONE meaning in the sending shape — a send-only one such as\n`segment_fault()`, or a host number `host(n)` — which is how a program\nignores what it is about to send its own group (GNU `timeout -s SEGV`).\n\n**What a child inherits** is what `exec` leaves (`[os.signal.disp]`): an\nignored meaning stays ignored in every child, a listened one is the\ndefault there. That is why a shell LISTENS for `interrupt()` rather than\nignoring it — it survives Ctrl-C and its `sleep` still dies of it — and\nwhy `std.process.start_job` takes the meanings to set back to default in\na child the shell ignores for itself.\n\n**Errors are rows, and one shape rule reads every set** (s232). An\nempty set, or one holding any bit that is not a listenable meaning, is\n`io` from `listen`, `wait`, `wait_fd`, `wait_fds`, `poll`, `ignore`\nand `reset`, and nothing changes; `raise` takes exactly one listenable\nmeaning. On windows only the first four meanings can be listened for —\nthe console sends `terminate()` and `quit()`, and `reload()` and\n`upgrade()` arrive only by this process's own `raise` — so a listen\nfor any of the other sixteen is `io` there, and `ignore`, `reset`,\n`ignored`, `send`, `number`, `wait_fd`, `wait_fds`, `send_group`,\n`send_all`, `text`, `last`, `realtime`, `ignore_one` and `reset_one`\nanswer `unsupported`, `send` to `text`, `wait_fds` and the two `_one`\ncalls after their own shape (`[os.signal.platform]`).\n\n**Groups and host numbers (s241, ruling #79).** `send` reaches one\nprocess; `send_group` reaches every member of a `std.process.Group`\n(a job), and `send_all` every process this one may signal, each by\nits own name so that no miscomputed pid becomes a group or a\nbroadcast. A signal the table gives no meaning (the real-time range,\nlinux `IO` and `PWR`, macOS `INFO`) is sent by its host number,\n`host(n)`, with `last()` and `realtime()` saying which numbers this\nhost has; `text` is a signal's words. The rows are the host's, kept\nrather than evened out (R3).\n\n**Capability: `exec` (I13)** — signal control is process control:\n`listen`, `wait`, `wait_fd`, `wait_fds`, `poll`, `ignore`, `reset`,\n`ignore_one`, `reset_one`, `raise`, `send`, `send_group` and\n`send_all` are tagged `exec` in the sandbox table. `ignored` READS this process's context and is `env` (ruling\n#70 R8, with `os_pgid`); `number`, `last`, `realtime` and `text` read\nthe host's table and charge nothing (ruling #79 R6). All of them are\nrefused at comptime (D33). The meaning functions and `host` reach\nnothing and are comptime-safe.",
      "summary": "std.signal — what a signal does to this process, and hearing one as an event.",
      "items": [
        {
          "name": "reload",
          "kind": "fn",
          "signature": "pub fn reload() -> int",
          "doc": "Re-read configuration (`SIGHUP`).",
          "source": "std/signal/signal.lu",
          "line": 91,
          "tier": "core"
        },
        {
          "name": "terminate",
          "kind": "fn",
          "signature": "pub fn terminate() -> int",
          "doc": "Shut down now (`SIGTERM`).",
          "source": "std/signal/signal.lu",
          "line": 94,
          "tier": "core"
        },
        {
          "name": "quit",
          "kind": "fn",
          "signature": "pub fn quit() -> int",
          "doc": "Shut down after draining (`SIGQUIT`; the terminal's Ctrl-\\).",
          "source": "std/signal/signal.lu",
          "line": 97,
          "tier": "core"
        },
        {
          "name": "upgrade",
          "kind": "fn",
          "signature": "pub fn upgrade() -> int",
          "doc": "Swap in a new binary (`SIGUSR2`).",
          "source": "std/signal/signal.lu",
          "line": 100,
          "tier": "core"
        },
        {
          "name": "interrupt",
          "kind": "fn",
          "signature": "pub fn interrupt() -> int",
          "doc": "The terminal's interrupt character, Ctrl-C (`SIGINT`).",
          "source": "std/signal/signal.lu",
          "line": 103,
          "tier": "core"
        },
        {
          "name": "suspend",
          "kind": "fn",
          "signature": "pub fn suspend() -> int",
          "doc": "The terminal's suspend character, Ctrl-Z (`SIGTSTP`).",
          "source": "std/signal/signal.lu",
          "line": 106,
          "tier": "core"
        },
        {
          "name": "bg_read",
          "kind": "fn",
          "signature": "pub fn bg_read() -> int",
          "doc": "A background process group read the terminal (`SIGTTIN`).",
          "source": "std/signal/signal.lu",
          "line": 109,
          "tier": "core"
        },
        {
          "name": "bg_write",
          "kind": "fn",
          "signature": "pub fn bg_write() -> int",
          "doc": "A background process group wrote to, or set, the terminal (`SIGTTOU`).",
          "source": "std/signal/signal.lu",
          "line": 112,
          "tier": "core"
        },
        {
          "name": "child",
          "kind": "fn",
          "signature": "pub fn child() -> int",
          "doc": "A child stopped or ended (`SIGCHLD`).",
          "source": "std/signal/signal.lu",
          "line": 115,
          "tier": "core"
        },
        {
          "name": "user",
          "kind": "fn",
          "signature": "pub fn user() -> int",
          "doc": "Another program's own signal (`SIGUSR1`; `upgrade()` is `SIGUSR2`).",
          "source": "std/signal/signal.lu",
          "line": 118,
          "tier": "core"
        },
        {
          "name": "alarm",
          "kind": "fn",
          "signature": "pub fn alarm() -> int",
          "doc": "A timer ran out (`SIGALRM`).",
          "source": "std/signal/signal.lu",
          "line": 121,
          "tier": "core"
        },
        {
          "name": "broken_pipe",
          "kind": "fn",
          "signature": "pub fn broken_pipe() -> int",
          "doc": "A write to a pipe or socket nobody reads (`SIGPIPE`). Ignored, the\nwrite is an `io` row instead of this process's end, and every child\nstarts with it ignored too (`[os.signal.disp]`).",
          "source": "std/signal/signal.lu",
          "line": 126,
          "tier": "core"
        },
        {
          "name": "abort",
          "kind": "fn",
          "signature": "pub fn abort() -> int",
          "doc": "The process was asked to abort (`SIGABRT`).",
          "source": "std/signal/signal.lu",
          "line": 129,
          "tier": "core"
        },
        {
          "name": "continued",
          "kind": "fn",
          "signature": "pub fn continued() -> int",
          "doc": "The process was continued after a stop (`SIGCONT`). The table's name\nis `CONTINUE`; `continue` is a keyword, so the function says what\nhappened.",
          "source": "std/signal/signal.lu",
          "line": 134,
          "tier": "core"
        },
        {
          "name": "resize",
          "kind": "fn",
          "signature": "pub fn resize() -> int",
          "doc": "The terminal's window changed size (`SIGWINCH`).",
          "source": "std/signal/signal.lu",
          "line": 137,
          "tier": "core"
        },
        {
          "name": "urgent",
          "kind": "fn",
          "signature": "pub fn urgent() -> int",
          "doc": "Out-of-band data arrived on a socket (`SIGURG`).",
          "source": "std/signal/signal.lu",
          "line": 140,
          "tier": "core"
        },
        {
          "name": "virtual_alarm",
          "kind": "fn",
          "signature": "pub fn virtual_alarm() -> int",
          "doc": "A user-time timer ran out (`SIGVTALRM`).",
          "source": "std/signal/signal.lu",
          "line": 143,
          "tier": "core"
        },
        {
          "name": "profile_alarm",
          "kind": "fn",
          "signature": "pub fn profile_alarm() -> int",
          "doc": "A profiling timer ran out (`SIGPROF`).",
          "source": "std/signal/signal.lu",
          "line": 146,
          "tier": "core"
        },
        {
          "name": "cpu_limit",
          "kind": "fn",
          "signature": "pub fn cpu_limit() -> int",
          "doc": "The CPU-time limit was passed (`SIGXCPU`).",
          "source": "std/signal/signal.lu",
          "line": 149,
          "tier": "core"
        },
        {
          "name": "file_limit",
          "kind": "fn",
          "signature": "pub fn file_limit() -> int",
          "doc": "The file-size limit was passed (`SIGXFSZ`).",
          "source": "std/signal/signal.lu",
          "line": 152,
          "tier": "core"
        },
        {
          "name": "kill",
          "kind": "fn",
          "signature": "pub fn kill() -> int",
          "doc": "End the process now; it cannot be caught or ignored (`SIGKILL`).\nSend-only.",
          "source": "std/signal/signal.lu",
          "line": 161,
          "tier": "core"
        },
        {
          "name": "stop",
          "kind": "fn",
          "signature": "pub fn stop() -> int",
          "doc": "Stop the process; it cannot be caught or ignored (`SIGSTOP`).\nSend-only; `continued()` is what starts it again.",
          "source": "std/signal/signal.lu",
          "line": 165,
          "tier": "core"
        },
        {
          "name": "segment_fault",
          "kind": "fn",
          "signature": "pub fn segment_fault() -> int",
          "doc": "An invalid memory reference (`SIGSEGV`). Send-only.",
          "source": "std/signal/signal.lu",
          "line": 168,
          "tier": "core"
        },
        {
          "name": "bus_error",
          "kind": "fn",
          "signature": "pub fn bus_error() -> int",
          "doc": "An access to an undefined part of a memory object (`SIGBUS`).\nSend-only.",
          "source": "std/signal/signal.lu",
          "line": 172,
          "tier": "core"
        },
        {
          "name": "arithmetic",
          "kind": "fn",
          "signature": "pub fn arithmetic() -> int",
          "doc": "An erroneous arithmetic operation (`SIGFPE`). Send-only.",
          "source": "std/signal/signal.lu",
          "line": 175,
          "tier": "core"
        },
        {
          "name": "illegal",
          "kind": "fn",
          "signature": "pub fn illegal() -> int",
          "doc": "An illegal instruction (`SIGILL`). Send-only.",
          "source": "std/signal/signal.lu",
          "line": 178,
          "tier": "core"
        },
        {
          "name": "breakpoint",
          "kind": "fn",
          "signature": "pub fn breakpoint() -> int",
          "doc": "A trace or breakpoint trap (`SIGTRAP`). Send-only.",
          "source": "std/signal/signal.lu",
          "line": 181,
          "tier": "core"
        },
        {
          "name": "bad_syscall",
          "kind": "fn",
          "signature": "pub fn bad_syscall() -> int",
          "doc": "A bad system call (`SIGSYS`). Send-only.",
          "source": "std/signal/signal.lu",
          "line": 184,
          "tier": "core"
        },
        {
          "name": "listen",
          "kind": "fn",
          "signature": "pub fn listen(set: int) -> () ! {io}",
          "doc": "Hear every meaning in `set` as an event (`os_signal_listen`); ends an\nignore of them.",
          "source": "std/signal/signal.lu",
          "line": 188,
          "tier": "core"
        },
        {
          "name": "wait",
          "kind": "fn",
          "signature": "pub fn wait(set: int) -> int ! {io}",
          "doc": "Park until a meaning in `set` arrives; that meaning.",
          "source": "std/signal/signal.lu",
          "line": 193,
          "tier": "core"
        },
        {
          "name": "wait_fd",
          "kind": "fn",
          "signature": "pub fn wait_fd(f: fs.File, set: int) -> int ! {unsupported, io}",
          "doc": "Wait until the file `f` names has something to read or a meaning in\n`set` is delivered (`[os.signal.wait.fd]`): the meaning, taken off\nthe queue as `wait` takes it, or **0** when `f` is ready — a byte,\nthe end of input or a hang-up — with nothing read, so the read that\nfollows says which. A meaning wins when both are ready; one delivered\nor pending before the call is answered at once. The meanings must be\nlistened for first (`listen`). Any readable descriptor serves: a\nterminal, a pipe, a file (spelling ruled #82, the family's).\n\nThis is the wait an interactive program blocks in instead of a read:\na delivered signal never tears a read, so an editor reading keys\nwould learn of a resize or a `kill` only when the next key came. It\nhas no deadline (`wait_fds`, from wolf 0.2.34, has one and waits on\nseveral files); on a terminal with `canonical` off, `std.term`'s\n`Mode.min` and `Mode.time` time the read that follows.\n\nRows: `io` for a set the shape rule refuses — empty, or holding a\nbit that is not a listenable meaning — before anything else; then\n`unsupported` on windows; then `io` for a closed or forged handle.\nNever traps. lupin answers the shape rows and declines a well-formed\ncall by name (it has no `poll`).\n\nCapability `exec` (signal control, with `wait`); refused at comptime\n(D33). Delegates to `os_signal_wait_fd`. The example is prose, since\na handle comes from `std.fs`: an editor listens for\n`signal.resize()`, then loops on `signal.wait_fd(tty, set)?`,\nredrawing on a meaning and reading a key on 0.",
          "source": "std/signal/signal.lu",
          "line": 224,
          "tier": "core"
        },
        {
          "name": "WAIT_WRITE",
          "kind": "const",
          "signature": "pub const WAIT_WRITE: int = 4611686018427387904",
          "doc": "**s254 (`[os.signal.wait.write]`, wolf 0.2.35): bit 62, the mark of a\n`wait_fds` element that waits for a WRITE.** A file whose `fd` has it\nadded — `fs.File { fd: w.fd + signal.WAIT_WRITE }` — asks whether `w`\ncan take a write now instead of whether it has something to read\n(`poll(2)`'s `POLLOUT`): a pipe with room, a regular file always, and\na pipe whose reader has gone (the write then answers its error). Its\nanswer is the read case's: `ready` is that element's index, the lowest\nready element winning among read and write elements alike, and a\nmeaning still wins. A handle may be listed twice, once each way.\n`wait_fd` takes the mark too. Such a `File` is for the wait alone: no\nother call serves it (`io`).\n\nWhat it is for: a writer that feeds a tool which may never read (a\nclipboard's `xclip`, `wl-copy`, `pbcopy`) sets its pipe's write end\nnon-blocking (`fs.set_nonblock`), writes with `fs.write_some` until\n`busy`, then waits on the end under a deadline and gives up when it\npasses. lupin 0.1.56 answers such an element `io`, a handle it does\nnot hold (wolf-interp#278).\n\n```wolf-doc-example\nsignal.WAIT_WRITE == 4611686018427387904\n```",
          "source": "std/signal/signal.lu",
          "line": 250,
          "tier": "core"
        },
        {
          "name": "Wake",
          "kind": "struct",
          "signature": "pub struct Wake { meaning: int, ready: int, }",
          "doc": "What ended one `wait_fds` (`[os.signal.wait.fds]`): `meaning`, the\nmeaning taken off the queue (0 when none was), and `ready`, the index\nin the list of the LOWEST file with something to read (-1 when none\nwas). Both 0 and -1: the deadline passed.",
          "source": "std/signal/signal.lu",
          "line": 256,
          "tier": "core"
        },
        {
          "name": "wait_fds",
          "kind": "fn",
          "signature": "pub fn wait_fds(files: List[fs.File], set: int, deadline_ms: int) -> Wake ! { invalid, io, unsupported, }",
          "doc": "**s248 (`[os.signal.wait.fds]`, ruling #93 R2 A): one wait over\nseveral files, a set of meanings and a deadline** — what an editor's\nloop is: the terminal, its jobs' pipes and its signals, with a timer\n(the 25 ms that tells a lone ESC from an escape sequence, the 50 ms of\na capability probe). Parks until a meaning in `set` is delivered\n(`Wake { meaning: m, ready: -1 }`, taken as `wait` takes it), or one\nof `files` has something to read — a byte, the end of input, a\nhang-up — (`Wake { meaning: 0, ready: i }`, `i` the lowest such index,\nnothing read), or `deadline_ms` milliseconds pass (`Wake { meaning: 0,\nready: -1 }`). A meaning wins over a ready file, which stays ready for\nthe next wait; among files the earlier wins, so put the one served\nfirst first. `deadline_ms` **0** looks once and never parks, **-1**\nnever passes, any other is measured on the monotonic clock and never\nanswered early. An empty list waits on the set and the deadline alone.\nA meaning delivered or pending before the call is answered at once.\n`wait_fd(f, set)` is this call's one-file case with no deadline.\n\nRows, in the order they are decided: `io` for a set the shape rule\nrefuses (empty, a send-only meaning, a bit that is no meaning); then\n`invalid` for a deadline below -1; then `unsupported` on windows; then\n`io` for a closed or forged handle. Never traps. lupin 0.1.56 answers\nthe shape rows and refuses a well-formed wait by name, since std has no\n`poll` (0.1.55 did not resolve the call, wolf-interp#268).\n\nCapability `exec` (signal control, with `wait_fd`; ruling #97 R5);\nrefused at comptime (D33). Delegates to `os_signal_wait_fds`; a\nprogram that names it makes the signal hub and its wake pipe before\n`main`. The example is prose, since a handle comes from `std.fs`: an\neditor listens for `signal.resize()`, then loops on\n`signal.wait_fds(watched, signal.resize(), 25)?`, redrawing on a\nmeaning, reading the file `ready` names, and ending an escape\nsequence when neither came. From wolf 0.2.35 an element may wait for a\nwrite instead (`WAIT_WRITE`, s254).\n\n**The narrow form** (sc82): it answers the lowest ready file alone, so\na loop that serves what it answers starves the files after a busy one\nunless it rotates the list itself, and it takes no socket. `std.poll`\nis the wide form: an owned waiter over files and sockets that answers\nevery ready entry with its facts AND a meaning, over the runtime's\nreadiness set rather than repeated calls to this narrow wait. This\ncall is unchanged.",
          "source": "std/signal/signal.lu",
          "line": 302,
          "tier": "core"
        },
        {
          "name": "poll",
          "kind": "fn",
          "signature": "pub fn poll(set: int) -> int ! {io}",
          "doc": "The oldest meaning in `set` that has arrived, taken; 0 when none has.\nNever waits (`[os.signal.poll]`).",
          "source": "std/signal/signal.lu",
          "line": 317,
          "tier": "core"
        },
        {
          "name": "ignore",
          "kind": "fn",
          "signature": "pub fn ignore(set: int) -> () ! {unsupported, io}",
          "doc": "Every meaning in `set` does nothing to this process — and to every\nchild it starts (`[os.signal.disp]`).",
          "source": "std/signal/signal.lu",
          "line": 323,
          "tier": "core"
        },
        {
          "name": "reset",
          "kind": "fn",
          "signature": "pub fn reset(set: int) -> () ! {unsupported, io}",
          "doc": "Every meaning in `set` does what the host does by default.",
          "source": "std/signal/signal.lu",
          "line": 328,
          "tier": "core"
        },
        {
          "name": "ignore_one",
          "kind": "fn",
          "signature": "pub fn ignore_one(meaning: int) -> () ! {invalid, io, unsupported}",
          "doc": "**s246 (`[os.signal.disp.one]`, ruling #88 R1): ONE meaning does\nnothing to this process** — and to every child it starts — named in\nthe SENDING shape: one meaning of the table, any of the twenty-eight\nbut `kill()` and `stop()`, or a host number `host(n)` (a real-time\nsignal is `host(realtime()?.first + k)`). This is how a program\nignores a send-only meaning or a signal the table has no meaning for:\nGNU `timeout -s SEGV` and `-s RTMIN` lead a group, ignore what they\nare about to send it, send it and live. `ignore` takes a SET of\nlistenable meanings and is unchanged.\n\nRows, in the order they are decided: `invalid` for 0, for anything\n`send` refuses (two meanings, a bit no release publishes, a host\nnumber past `last()`), for `kill()` and `stop()` by bit or by\nnumber, which no process can ignore, and from wolf 0.2.35 for the C\nlibrary's own numbers (`host`'s doc; 0.2.33 and 0.2.34 answered\nglibc's refusal of 32 and 33 `io`); then `unsupported` on windows;\nthen `io` where the host refuses the number. Nothing changes on a\nrow. Never traps.\n\nA listenable meaning, by its bit or its number, is the set calls'\n(`[os.signal.disp]`): the ignore ends a listen, `ignored` reads it,\nand a child inherits it across `exec`, as for every ignored meaning.\n`segment_fault()` and `bus_error()` stay the runtime's stack guard's:\nunder the ignore a SENT one does nothing, while a real fault is still\nthe runtime's (the stack-overflow report and exit 134). The checked\nmachine refuses those two by name. lupin 0.1.55 answers the shape rows\n(`invalid`) and refuses a well-formed call by name, since it has no\n`sigaction` (is77, wolf-interp#261).\n\nCapability `exec`; refused at comptime (D33). Delegates to\n`os_signal_ignore_one`.\n\n```wolf-doc-example\nvar row = \"ignored\"\nsignal.ignore_one(signal.kill()) else |_| { row = \"refused\" }\nrow == \"refused\"\n```",
          "source": "std/signal/signal.lu",
          "line": 369,
          "tier": "core"
        },
        {
          "name": "reset_one",
          "kind": "fn",
          "signature": "pub fn reset_one(meaning: int) -> () ! {invalid, io, unsupported}",
          "doc": "**s246 (`[os.signal.disp.one]`, ruling #88 R1): ONE meaning does what\nthe host does by default** — the undo of `ignore_one`, in the same\nsending shape (one meaning of the table but `kill()` and `stop()`, or\n`host(n)`). `reset` takes a SET of listenable meanings and is\nunchanged. A child started after it gets the default as `exec` leaves\nit.\n\nRows, in `ignore_one`'s order: `invalid` for 0, anything `send`\nrefuses, `kill()` and `stop()`, and the C library's own numbers (wolf\n0.2.35); `unsupported` on windows; `io` where the host refuses the\nnumber. Never traps. The checked machine\nrefuses `segment_fault()` and `bus_error()` by name; lupin 0.1.55\nanswers the shape rows and refuses a well-formed call by name (is77,\nwolf-interp#261).\n\nCapability `exec`; refused at comptime (D33). Delegates to\n`os_signal_default_one`.\n\n```wolf-doc-example\nvar row = \"reset\"\nsignal.reset_one(signal.terminate() | signal.user()) else |_| { row = \"refused\" }\nrow == \"refused\"\n```",
          "source": "std/signal/signal.lu",
          "line": 396,
          "tier": "core"
        },
        {
          "name": "raise",
          "kind": "fn",
          "signature": "pub fn raise(meaning: int) -> () ! {io}",
          "doc": "Send `meaning` to this process (`os_signal_raise`).",
          "source": "std/signal/signal.lu",
          "line": 401,
          "tier": "core"
        },
        {
          "name": "send",
          "kind": "fn",
          "signature": "pub fn send(pid: int, meaning: int) -> () ! {unsupported, invalid, not_found, denied, io}",
          "doc": "**s232 (`[os.signal.send]`): send `meaning`'s signal to the process\n`pid`** — `kill(2)` for one process. `meaning` is one meaning of the\ntable, a host number (`host(n)`, from wolf 0.2.31: `-n` was `invalid`\nbefore), or 0, which sends nothing and answers the same rows: \"is\nthere such a process, and may I signal it\". A process id names whichever\nprocess holds it NOW (a child already reaped may have passed its id\non); `std.process.kill` on a `Child` has no such hazard. A send to\nthis process's own id is a process-directed `raise`.\n\nRows, in the order they are decided: `invalid` when `pid` is not\nabove 0 or does not fit a process id, or `meaning` is neither 0, nor\nexactly one meaning, nor `host(n)` with `1 <= n <= last()` (nothing\nis sent); `unsupported` on a host with\nno such call (windows, by name); then the target's — `not_found`\nwhen no process has that id, `denied` when this process may not\nsignal it, `io` otherwise. Never traps. lupin answers the shape and\ndeclines the send itself by name (no host call without `unsafe`).\n\nCapability `exec`; refused at comptime (D33). Delegates to\n`os_signal_send`.\n\n```wolf-doc-example\nvar row = \"sent\"\nsignal.send(0, signal.terminate()) else |_| { row = \"refused\" }\nrow == \"refused\"\n```",
          "source": "std/signal/signal.lu",
          "line": 431,
          "tier": "core"
        },
        {
          "name": "send_group",
          "kind": "fn",
          "signature": "pub fn send_group(g: process.Group, meaning: int) -> () ! { unsupported, invalid, not_found, denied, io, }",
          "doc": "**s241 (`[os.signal.send.group]`, ruling #79 R1): send `meaning`'s\nsignal to every member of the process group `g`** that this process\nmay signal — `kill(-pgid)`, what `kill %1`, `fg`, `bg` and `kill --\n-N` do to a job. `meaning` is one meaning of the table, a host number\n(`host(n)`), or 0, which sends nothing and asks the group the same\nquestion. A `STOP` stops every member and a `continued()` continues\nthem; the parent hears each member's stop through `std.process.poll`.\n`kill 0` is `send_group(process.own_group()?, m)`, and it reaches this\nprocess too.\n\nRows, in the order they are decided: `invalid` for a group id not\nabove 1 or wider than a process id — group 1 cannot be named, so a\nmiscomputed id never becomes a broadcast (`send_all` is that, by name)\n— or a `meaning` `send` refuses; `unsupported` on windows; then the\nhost's answer, kept as it is (ruling #79 R3): `not_found` for a group\nwith no member, `denied` when this process may signal none of them,\n`io` otherwise. A group some of whose members may be signalled is ok\nand reaches those only; a group of ended, unreaped members is ok on\nlinux and `denied` on macOS. Never traps. lupin answers the shape and\ndeclines the send itself by name.\n\nCapability `exec`; refused at comptime (D33). Delegates to\n`os_signal_send_group`. The example is prose, since a doc example\nimports only this module: `signal.send_group(process.Group { id: 1 },\nsignal.terminate())` is `invalid`.",
          "source": "std/signal/signal.lu",
          "line": 460,
          "tier": "core"
        },
        {
          "name": "send_all",
          "kind": "fn",
          "signature": "pub fn send_all(meaning: int) -> () ! {unsupported, invalid, not_found, denied, io}",
          "doc": "**s241 (`[os.signal.send.all]`, ruling #79 R1): send `meaning`'s\nsignal to every process this one may signal**, itself excepted —\n`kill(-1)`, XCU `kill -1`. Which processes that is is the host's rule:\nas the super-user every process but this one (and, on linux, its pid\nnamespace's process 1); as another user, that user's processes in any\nsession or group. It has a name of its own so that no miscomputed pid\nor group becomes it.\n\nRows: `invalid` for a `meaning` `send` refuses; `unsupported` on\nwindows; then the host's answer as it is: on linux `ok` when it found\nany other process, even only ones it may not signal, and `not_found`\nwhen it found none; `denied` where a host says so; `io` otherwise.\nNever traps. lupin answers the shape and declines the send by name.\n\nCapability `exec`; refused at comptime (D33). Delegates to\n`os_signal_send_all`.\n\n```wolf-doc-example\nvar row = \"sent\"\nsignal.send_all(signal.terminate() | signal.user()) else |_| { row = \"refused\" }\nrow == \"refused\"\n```",
          "source": "std/signal/signal.lu",
          "line": 492,
          "tier": "core"
        },
        {
          "name": "number",
          "kind": "fn",
          "signature": "pub fn number(meaning: int) -> int ! {invalid, unsupported}",
          "doc": "**s232 (`[os.signal.number]`): the number THIS host gives `meaning`**\n— what `kill -l` prints, what `trap … 13` names and what a shell's\n`128 + N` decodes. It differs between hosts, which is why nothing\nelse in this module takes or answers one.\n\nRows: `invalid` for anything but exactly one meaning of the table;\n`unsupported` on a host that does not number signals (windows).\nNever traps.\n\nCarries no capability (it reads the host's numbering and nothing\nelse), and is refused at comptime all the same: the compiling host's\nnumber is not the running one's (D33). Delegates to\n`os_signal_number`.\n\n```wolf-doc-example\nlet n = signal.number(signal.interrupt()) else |_| 1\nn >= 1\nlet none = signal.number(0) else |_| 0 - 1\nnone == 0 - 1\n```",
          "source": "std/signal/signal.lu",
          "line": 516,
          "tier": "core"
        },
        {
          "name": "last",
          "kind": "fn",
          "signature": "pub fn last() -> int ! {unsupported}",
          "doc": "**s241 (`[os.signal.host]`, ruling #79 R4): this host's last signal\nnumber** — the C library's `SIGRTMAX` on linux (64 under glibc and\nmusl), 31 on macOS. A host number `N` from 1 to this is what `host(N)`\nspells and what `send`, `send_group`, `send_all` and `text` take.\n\nRows: `unsupported` on windows (no signal numbers) and on a host wolf\nhas not measured. Never traps. Uncharged (it reads the host's table,\nas `number`), and refused at comptime all the same. lupin declines by\nname (it does not read the C library's range), so the example is\nprose: `signal.last()?` is 64 on linux.\n\nDelegates to `os_signal_last`.",
          "source": "std/signal/signal.lu",
          "line": 532,
          "tier": "core"
        },
        {
          "name": "Realtime",
          "kind": "struct",
          "signature": "pub struct Realtime { first: int, last: int, }",
          "doc": "The C library's real-time signal range (`[os.signal.host]`): host\nnumbers `first` to `last`, both included, or `first` and `last` both 0\non a host that has none (macOS). glibc's is 34 to 64 and musl's 35 to\n64 on one kernel, which is why a real-time signal is named by its\nnumber here and never by a meaning (`RTMIN+3` is `first + 3`).",
          "source": "std/signal/signal.lu",
          "line": 541,
          "tier": "core"
        },
        {
          "name": "realtime",
          "kind": "fn",
          "signature": "pub fn realtime() -> Realtime ! {unsupported}",
          "doc": "**s241 (`[os.signal.host]`): the real-time range**, as `Realtime`.\n\nRows: `unsupported` on windows and on a host wolf has not measured.\nNever traps. Uncharged; refused at comptime. lupin declines by name,\nso the example is prose: `signal.realtime()?.first` is 34 under glibc.\n\nDelegates to `os_signal_realtime`.",
          "source": "std/signal/signal.lu",
          "line": 553,
          "tier": "core"
        },
        {
          "name": "text",
          "kind": "fn",
          "signature": "pub fn text(meaning: int) -> str ! {invalid, unsupported}",
          "doc": "**s241 (`[os.signal.text]`, ruling #79 R5): the host C library's words\nfor `meaning`'s signal**, or for host signal `N` given `host(N)` —\n`strsignal(3)`, what GNU `kill -t` prints and what a shell says of a\njob a signal ended. Always in the C locale, whatever `LANG` says. The\nwords are the host's BY DESIGN and differ between C libraries: glibc's\n`kill()` is \"Killed\", macOS's \"Killed: 9\" (it appends the number to\nall 28); glibc and musl part on `arithmetic()` and `child()` and on\nevery real-time number.\n\nRows: `invalid` for any meaning `send` refuses (two meanings, a bit\nno release publishes, a host number past `last()`), before the host;\n`unsupported` on windows. **0 answers per version**: `invalid`\nbefore the host at wolf 0.2.32; from wolf 0.2.33 (s246,\nwolf-lang#787) signal 0's words, glibc's \"Unknown signal 0\" and\nmacOS's \"Unknown signal: 0\", and `unsupported` on windows. musl's\nwords for 0 are unmeasured: no release archive targets musl. Never\ntraps. Uncharged; refused at comptime. lupin answers the shape rows\n(`invalid`) and refuses a well-formed call by name, 0 included since\nlupin 0.1.55 (0.1.54 answered 0 `invalid`; is77, wolf-interp#262): a\ntable there would be one C library's.\n\nDelegates to `os_signal_text`.\n\n```wolf-doc-example\nlet t = signal.text(signal.terminate() | signal.user()) else |_| \"invalid\"\nt == \"invalid\"\n```",
          "source": "std/signal/signal.lu",
          "line": 585,
          "tier": "core"
        },
        {
          "name": "host",
          "kind": "fn",
          "signature": "pub fn host(n: int) -> int",
          "doc": "The `meaning` value that names host signal `n` (`[os.signal.host]`,\nruling #79 R4): `-n`, `os_wait_status`'s spelling of \"ended by signal\n`n`\", so a program re-sends what it saw. For the signals the table\ngives no meaning — linux `STKFLT`, `IO`, `PWR` and the real-time range;\nmacOS `EMT`, `IO`, `INFO` — and for a number a user typed (`kill -9`).\nIt makes NO portability promise: `n` is this host's number, and for\nthe real-time range this C library's. Only `send`, `send_group`,\n`send_all`, `text`, `ignore_one`, `reset_one` and\n`std.process.exit_signal` take one (the last three from wolf 0.2.33),\nfor `1 <= n <= last()`; every set-taking call refuses it (a negative\nset fails the one shape rule).\n\n**The C library's own numbers** (`[os.signal.host.reserved]`, wolf\n0.2.35's s253; ruling asked R-sc72-2): on linux, from 32 up to and not\nincluding `realtime()`'s first — glibc's 32 and 33, musl's 32 to 34 —\nare the C library's (its threads' cancellation and set-id signals),\nand wolf gives them no meaning. `ignore_one`, `reset_one` and\n`std.process.exit_signal` refuse `host(n)` of one **`invalid`**, by\nname, before the host, on every machine: a disposition the C library\nowns is not the program's to set, and an end by one was never kept.\nThe sends and `text` take them as before. macOS has no real-time\nsignals and windows no numbers, so neither has such a number.\n\nTotal and pure; nothing is checked until a call takes it — this\nfunction keeps its released signature, and the refusal by name is the\ncalls' (`tests/signal/reserved_rows.lu`).\n\n```wolf-doc-example\nsignal.host(9) == 0 - 9\n```",
          "source": "std/signal/signal.lu",
          "line": 619,
          "tier": "core"
        },
        {
          "name": "ignored",
          "kind": "fn",
          "signature": "pub fn ignored() -> int ! {unsupported}",
          "doc": "**s232 (`[os.signal.ignored]`): the set of listenable meanings this\nprocess ignores NOW.** It changes nothing. Read before the program's\nown first `ignore`, `reset` or `listen`, it is what the process was\nSTARTED ignoring — what a shell's `trap` must leave alone and what\nmakes `nohup` work. A listened meaning is not ignored.\n\nRows: `unsupported` on a host with no dispositions (windows). Never\ntraps. lupin declines by name (no `sigaction` without `unsafe`), so\nthe example is prose: `signal.ignored()? & signal.reload() != 0`\nasks whether this program runs under `nohup`.\n\nCapability `env` (ruling #70 R8); refused at comptime (D33).\nDelegates to `os_signal_ignored`.",
          "source": "std/signal/signal.lu",
          "line": 636,
          "tier": "core"
        }
      ]
    },
    {
      "name": "sort",
      "group": "Numerics",
      "tier": "core",
      "doc": "std.sort — ordering a `List` in place. Stability tier: core.\n\n**One algorithm: bottom-up stable merge sort**, O(n log n) comparisons\nand O(n) scratch, stable by construction (a tie takes from the left\nrun). It is not a hybrid and does not degrade to insertion sort on\nshort runs — the constant-factor work belongs to s44's bench tracks,\nand a second algorithm would need a second stability proof.\n\nThe scratch is a fresh `List` per pass rather than in-place swapping:\nindex assignment (`xs[i] = v`) executes on one implementation only,\nand `std.list.swap` rebuilds the whole list per call (O(n) a swap), so\nthe merge that allocates is the FASTER of the two available shapes as\nwell as the more portable one. Region-scratch placement (`.in(r)`) is\ns37's plumbing, named here, not shipped.\n\n**Monomorphic and generic, and why each is which.** `sort_ints`,\n`sort_floats` and `sort_strs` are the contract's monomorphic\nconveniences and they RUN. `sort` and `sort_by` are the generic\ntargets: `sort[T: Ord]` needs `Ord.cmp` dispatch, which executes in\nneither implementation, and `sort_by`'s `Ordering` result cannot be\nexamined outside the module that declares the enum (F-0029) — so both\nship as bodies that pass the static ladder and are `unsupported` at\nthe run rung, with their tests ledgered honestly. `is_sorted` and\n`is_sorted_by` go the other way and ship monomorphic over `int`: a\npredicate with no running witness proves nothing, and these two are\nthe witnesses `sort_ints`'s tests use.\n\nReversal composes rather than multiplying the API: sort ascending and\ncall `std.list.reverse`, or pass a comparator that swaps its\narguments (`sort_by(mut xs, reverse_cmp)`); there is no `sort_desc`.\n\n**RETURNING TWINS (sc44, wolf-std#23), and the one name that could\nnot be written.** The Wolf Book's §5.2 has promised a chain since\nbs00 — `totals.pairs().sorted_by(…).take(2)` — and every function\nhere was in place and unit-returning, so the page printed a `text`\nfence. Four functions answer the first half: `sorted_by` beside\n`sort_by`, and `sorted_ints`/`sorted_floats`/`sorted_strs` beside the\nthree that run. Each is its in-place twin over a copy, leaves its\nargument alone, and takes the container in the bare read mode (§8:\n`mut` where mutation IS the operation, and here it is not).\n\n**`take` CANNOT BE WRITTEN AND DOES NOT NEED TO BE**, and both halves\nare measurements rather than opinions. `fn take` is `E0008: `take` is\na reserved keyword and cannot be a name; wolf has no raw identifiers`\non BOTH machines — the ownership verb wolf-lang#154 names owns the\nword outright, so the collision is not a style question. And the\nprefix it would have provided is the language's: `xs[..n]` and\n`xs[1..]` (`[mem.list.slice]`) both run on all three lanes at the\nsc44 pins, measured. A std function shadowing a working builtin with\na worse name is the one thing §8's container rule forbids outright.\nSo the chain in std's vocabulary is `sort.sorted_ints(xs)[..2]`, it\nruns today, and the book can stop fencing it as text.\n\n**Bench kernels (D5/D36, report-only).** The three registered\ncandidates for s44's T1 perf suite are `sort_ints` over 1e5 random\nints, `sort_ints` over a sorted run of the same length (the\nadversarial case a merge sort should win), and\n`std.search.binary_search` over 1e6 elements. They are NAMED here\nrather than registered: the s44 registry does not exist yet and this\nrepository cannot write into it, so the closeout carries the handoff.\n\nBLOCKED(c05), named and bodiless: `sort_by_key`, `sort_unstable`,\n`sort_dedup`. The first waits on closures (a key extractor is a\nclosure in every real use); the second waits on a second algorithm\nearning its place; the third belongs to whichever sprint gives\n`std.list.dedup` an `Eq` bound that dispatches.",
      "summary": "std.sort — ordering a `List` in place.",
      "items": [
        {
          "name": "sort",
          "kind": "fn",
          "signature": "pub fn sort[T: cmp.Ord](mut xs: List[T])",
          "doc": "Sorts `xs` ascending in place, stably. Total: no error row, no traps\n(element comparison is `Ord.cmp`, which is total by its own law).\n\nDoes not execute at these pins — `Ord.cmp` dispatch is\n`unsupported` in both implementations (F-0002) — and the running\nwitnesses are `sort_ints`, `sort_floats` and `sort_strs`, which share\nthis merge's shape line for line. Example is prose for the same\nreason: a fenced block must run.",
          "source": "std/sort/sort.lu",
          "line": 80,
          "tier": "core"
        },
        {
          "name": "sort_by",
          "kind": "fn",
          "signature": "pub fn sort_by[T](mut xs: List[T], by: fn(T, T) -> cmp.Ordering)",
          "doc": "Sorts `xs` ascending in place, stably, ordering by `by` rather than\nby `Ord`. `by` must be a total order or the result is merely a\npermutation — std cannot check that and does not pretend to.\n\nThe comparator is a NAMED function today (`sort_by(mut xs, by_age)`);\nclosures arrive with c05 and change no signature here. Does not\nexecute at these pins: an `Ordering` produced by an imported module\ncannot be examined by this one (F-0029, re-measured at 0.2.14 / 0.1.36\nby sc50: no lane). Prose, not a fenced example, for that reason.\n\nThe sort that runs is `std.list.sort_by(mut xs, le)` (sc50): the same\nmode, the same stable bottom-up merge, on all three lanes, taking a\n`bool` relation (`le(a, b)` reads \"a may precede b\") instead of an\n`Ordering`. The comparator's type is the one difference between the\ntwo, and it is stated on both.",
          "source": "std/sort/sort.lu",
          "line": 141,
          "tier": "core"
        },
        {
          "name": "sorted_by",
          "kind": "fn",
          "signature": "pub fn sorted_by[T](xs: List[T], by: fn(T, T) -> cmp.Ordering) -> List[T]",
          "doc": "`sort_by`'s returning twin: a fresh list holding `xs`'s elements in\n`by`'s order, with `xs` untouched. The chain's sort (wolf-std#23).\n`by` must be a total order or the result is merely a permutation.\nTotal: no error row, no traps beyond allocation.\n\nDoes not execute at these pins, for the two reasons its twin carries\nand neither of them new: `Ordering` produced by `std.cmp` cannot be\nexamined by this module (F-0029), and the checked tier answers\n`unsupported — trait dispatch on a non-nominal receiver` at\n`Ord.cmp(src[b], src[a])`. It ships anyway and it ships NOW because\nthe name is what the book promises, and a promised name that does\nnot exist is worse than one that is honestly freight —\n`tests/sort/generic_contract.lu` proves the shape typechecks.\nProse, not a fenced example, for that reason.",
          "source": "std/sort/sort.lu",
          "line": 201,
          "tier": "core"
        },
        {
          "name": "sort_ints",
          "kind": "fn",
          "signature": "pub fn sort_ints(mut xs: List[int])",
          "doc": "Sorts a list of `int` ascending, in place, stably. O(n log n)\ncomparisons, O(n) scratch. Total: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(3)\n(mut xs).push(1)\n(mut xs).push(2)\nsort.sort_ints(mut xs)\nxs[0] == 1\nxs[1] == 2\nxs[2] == 3\n```",
          "source": "std/sort/sort.lu",
          "line": 223,
          "tier": "core"
        },
        {
          "name": "sort_floats",
          "kind": "fn",
          "signature": "pub fn sort_floats(mut xs: List[f64])",
          "doc": "Sorts a list of `f64` ascending, in place, stably, under IEEE\ntotalOrder (see `total_lt`): every NaN lands at the end and `-0.0`\nsorts strictly below `+0.0`. Total: no error row, no traps.\n\n```wolf-doc-example\nvar xs = List[f64]()\n(mut xs).push(2.5)\n(mut xs).push(-1.0)\n(mut xs).push(0.0)\nsort.sort_floats(mut xs)\nxs[0] == -1.0\nxs[1] == 0.0\nxs[2] == 2.5\n```",
          "source": "std/sort/sort.lu",
          "line": 318,
          "tier": "core"
        },
        {
          "name": "sort_strs",
          "kind": "fn",
          "signature": "pub fn sort_strs(mut xs: List[str])",
          "doc": "Sorts a list of `str` ascending, in place, stably, in the language's\nbyte-lexicographic order (`[mem.str.order]`): unsigned byte compare,\nshorter first on a shared prefix, so every multi-byte code point\nsorts above every ASCII one. That is NOT alphabetical order in any\nhuman language and this module does not pretend it is — collation is\na table question (F-0019) and belongs where the tables land.\n\nTotal: no error row, no traps. Runs on the interpreter only at these\npins: `<` on `str` is `unsupported` in wolfc's checked tier and in\nthe native rung's string lowering (F-0018's family).\n\n```wolf-doc-example\nvar xs = List[str]()\n(mut xs).push(\"pear\")\n(mut xs).push(\"apple\")\nsort.sort_strs(mut xs)\nxs[0] == \"apple\"\nxs[1] == \"pear\"\n```",
          "source": "std/sort/sort.lu",
          "line": 383,
          "tier": "core"
        },
        {
          "name": "sorted_ints",
          "kind": "fn",
          "signature": "pub fn sorted_ints(xs: List[int]) -> List[int]",
          "doc": "`sort_ints`'s returning twin: a fresh ascending list, `xs`\nuntouched. Total: no error row, no traps beyond allocation.\n\nThis is the chain the book's §5.2 wants, with the prefix spelled as\nthe language's slice: `sort.sorted_ints(xs)[..2]`.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(3)\n(mut xs).push(1)\n(mut xs).push(2)\nsort.sorted_ints(xs)[0] == 1\nsort.sorted_ints(xs)[..2].len == 2\nxs[0] == 3\n```",
          "source": "std/sort/sort.lu",
          "line": 444,
          "tier": "core"
        },
        {
          "name": "sorted_floats",
          "kind": "fn",
          "signature": "pub fn sorted_floats(xs: List[f64]) -> List[f64]",
          "doc": "`sort_floats`'s returning twin, under the same IEEE totalOrder.\nTotal: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar xs = List[f64]()\n(mut xs).push(2.5)\n(mut xs).push(-1.0)\nsort.sorted_floats(xs)[0] == -1.0\nxs[0] == 2.5\n```",
          "source": "std/sort/sort.lu",
          "line": 463,
          "tier": "core"
        },
        {
          "name": "sorted_strs",
          "kind": "fn",
          "signature": "pub fn sorted_strs(xs: List[str]) -> List[str]",
          "doc": "`sort_strs`'s returning twin, in the language's byte-lexicographic\norder (`[mem.str.order]`). Total: no error row, no traps beyond\nallocation. Runs on the interpreter only at these pins, for its\ntwin's reason: `<` on `str` is `unsupported` in the native rung's\nstring lowering.\n\n```wolf-doc-example\nvar xs = List[str]()\n(mut xs).push(\"pear\")\n(mut xs).push(\"apple\")\nsort.sorted_strs(xs)[0] == \"apple\"\nxs[0] == \"pear\"\n```",
          "source": "std/sort/sort.lu",
          "line": 485,
          "tier": "core"
        },
        {
          "name": "is_sorted",
          "kind": "fn",
          "signature": "pub fn is_sorted(xs: List[int]) -> bool",
          "doc": "True when `xs` is in ascending order (ties allowed). The empty list\nand every one-element list are sorted. Total: no error row, no traps.\n\nMonomorphic over `int` at these pins — see the module header for why\nthe predicates go one way and the sorts the other.\n\n```wolf-doc-example\nvar xs = List[int]()\n(mut xs).push(1)\n(mut xs).push(1)\n(mut xs).push(2)\nsort.is_sorted(xs) == true\n```",
          "source": "std/sort/sort.lu",
          "line": 507,
          "tier": "core"
        },
        {
          "name": "is_sorted_by",
          "kind": "fn",
          "signature": "pub fn is_sorted_by(xs: List[int], by: fn(int, int) -> cmp.Ordering) -> bool",
          "doc": "True when `xs` is in ascending order under `by` (ties allowed).\nTotal: no error row, no traps.\n\nThe comparator answers `std.cmp.Ordering`, so this function's own\nexamination of that answer is a cross-module `Ordering` read and does\nnot execute at these pins (F-0029); the static ladder is clean and\nthe test is ledgered `unsupported` on both lanes. Prose, not a fenced\nexample, for that reason.",
          "source": "std/sort/sort.lu",
          "line": 527,
          "tier": "core"
        }
      ]
    },
    {
      "name": "str",
      "group": "Strings",
      "tier": "core",
      "doc": "std.str — the documented API surface of the language's `str`: an\nimmutable, guaranteed-valid UTF-8 slice, two machine words wide (D24).\nStability tier: core.\n\n**What is the language's and what is std's** (the API-CONVENTIONS §8\nquestion, asked again for strings). The language owns:\n\n- every literal — every string literal is an f-string, `{x}`\n  interpolates, `{{`/`}}` escape, `\"\"\"` dedents by the closing\n  delimiter's column, `r\"…\"` is raw (`[gram.lex.str]`, D26/X9);\n- `s.len` — the length in BYTES, O(1) (D25);\n- `s[a..b]` — zero-copy byte-offset slicing, checked: an out-of-range\n  offset OR an offset inside a code point traps `bounds`\n  (`[conf.trap.set]`), deterministically, in every profile;\n- the relational family — `==`, `!=`, `<`, `<=`, `>`, `>=`, `<=>` are\n  byte-lexicographic over the UTF-8 bytes (`[mem.str.order]`, the\n  ruling this repo's F-0006 asked for);\n- the builtin method set this file delegates to, which is now the whole\n  s37 set: `is_empty`, `get`, `bytes`, `contains`, `starts_with`,\n  `ends_with`, `find`, `rfind`, `count`, `split`, `words`, `each_word`, `words_count`, `lines`,\n  `trim`, `trim_start`, `trim_end`, `lower`, `upper`, `strip_prefix`,\n  `strip_suffix`, `repeat`, `replace`.\n\nEverything else is std's — this file. Functions take the string as\ntheir first parameter with the bare `read` mode, because `str` is\nimmutable and nothing here mutates: the builder is `std.strbuf`.\n\n**NO CHAR INDEXING, and no negative indices** (D25). There is no\n`s[i]`: a byte offset is the one honest currency, so `find` returns\noffsets and `char_offsets` yields them. To reach the first code point,\nslice (`s[..n]`) or ask `get` for a range it may refuse. `^n`\nend-relative indexing (`s[..^1]`) is the language's spelling for the\nother end, and it RESOLVES ON ALL THREE LANES as of the sc24 pins\n(lupin 0.1.14, wolf @ a900b8c;\nre-measured at both sc24 wolf acquisitions) — F-0018's last living\nclause, healed:\nevery from-end form slices byte-counted from the end, and one that\nlands inside a code point traps `bounds` like any other split\n(`tests/str/end_relative_slice.lu` and its trap twin hold both\nclaims). The one residue is the RANGE `get` consumes: `s.get(0..^1)`\nruns under lupin and is `unsupported` at resolve on both wolf rungs,\nagainst `[mem.str.get]`'s own sentence that end-relative endpoints\nresolve exactly as in `s[a..b]` (F-0096, filed; re-measured\nverbatim AGAIN at the sc32 pin v0.2.2/8cda3aa, 2026-09-02 —\n\"open-ended or end-relative ranges (slicing)\" at resolve on both\nrungs, `@103..108`, lupin runs. v0.2.2 is a windows native\nbring-up, an LSP navigation trio, the region ledger and its cap,\nD69's comma tightening and four letters, and none of them is the\n`get` lowering; the sc31 reading at v0.2.1/75fd2d0 it replaces was\nbyte-identical; re-measured verbatim AGAIN at the sc34 pin\n0.2.3+dev.31170d1, 2026-09-02 — the first re-probe against a\nMOVING compiler in three sprints, 51 commits including a whole new\nscalar type, and the refusal is the same word at the same phase;\n`tests/str/end_relative_get.lu` is the row that flips at its\nclosure). There is deliberately no std function that papers over\neither spelling.\n\n**THE BOUNDARY PRIMITIVE LANDED, AND THIS MODULE IS WHAT IT BOUGHT.**\nFor five sprints fifteen of this module's functions were reviewed\ncontracts with no bodies, because every position-taking string\nalgorithm needs a way to ask \"is offset k a code-point boundary?\" and\nthe only way to ask was to slice at k — which TRAPS when the answer is\nno, uncatchably (D30, no unwinding). s37 shipped the recoverable slice\n`s.get(a..b) -> str ! {none}` (`[mem.str.get]`) plus `find`/`rfind`/\n`split`/`count`/`ends_with`/`strip_suffix`/`replace` and the byte view\n`s.bytes() -> List[byte]`, and all three lanes execute them (wolfc at\ns37, lupin at 0.1.5, native at #40). Twelve of the fifteen are code\nbelow — THIRTEEN as of sc24: D58 ruled the `char` type\n(`[type.char]`, a Unicode scalar value — ordered, NOT an integer)\nand the sc24 wolf pair executes it, so `to_list_chars` is code at\nlast — on ALL executing lanes as of sc25: lupin 0.1.15 (the is26\nscalar release) runs `chars()` and `char`, and the rows that were\nledgered by lane flipped at that release, as their comments\npromised. The\nsprint's own first measurement is worth a sentence here: the FIRST\nsc24 wolf acquisition (@ e7abf03) carried s120 without s121, spoke\n`chars()` in the v0 `List[int]` currency, and refused `'a'` at lex —\na mid-sprint re-acquisition brought s121, and every claim in this\nheader was re-measured against the binary that will be pinned.\nWhat remains is two:\n\n```text\nchars(s: str) -> List[(int, char)]\n    Code points with their byte offsets. The value half is ruled and\n    executable (D58; `to_list_chars` below); the PAIR still needs a\n    `List` of tuples on the wolf rungs (`List[(int, int)]`\n    re-measured `unsupported` at resolve at BOTH sc24 wolf\n    acquisitions, and AGAIN at the sc27 pin 0a5c1af — s128's tuple\n    work is destructuring/patterns and does not instantiate a tuple\n    LIST; same \"prelude container instantiation\" refusal, dated\n    2026-08-29; re-measured verbatim at the sc28 pin v0.2.0/c88ab64,\n    2026-08-30; re-measured verbatim at the sc30 pin b80d239, the\n    FOURTH consecutive pin, 2026-08-31 — s129/s130 are struct\n    patterns and product match arms, and neither instantiates a\n    tuple list either; re-measured verbatim AGAIN at the sc31 pin\n    v0.2.1/75fd2d0, the FIFTH consecutive pin, 2026-09-01 — r04 is\n    four measured letters, `defer` timing, the `\\u{…}` bound and\n    two region diagnostics, and container instantiation is none of\n    them; and AGAIN at the sc32 pin v0.2.2/8cda3aa, the **SIXTH**\n    consecutive pin, 2026-09-02 — same word verbatim, `@72..90`,\n    lupin runs it. v0.2.2 is the largest span this repo has ever\n    crossed in one bump — a windows native bring-up, an LSP\n    navigation trio, the whole region ledger and cap, D69 and four\n    letters — and not one commit in it lowers a generic container\n    instantiation. Re-measured verbatim at the sc33 pin\n    (the SEVENTH) and AGAIN at the sc34 pin 0.2.3+dev.31170d1,\n    the **EIGHTH** consecutive pin, 2026-09-02 — and the eighth is\n    the one that counts, because the wolf binary moved 51 commits\n    under it (s60b, s134, r06, s135 and D72's whole `byte` type)\n    where sc33's binary had not moved at all. Eight pins is long\n    enough to state the shape plainly: this refusal never moves as\n    a SIDE EFFECT, and it will move the sprint someone lowers\n    generic container instantiation on purpose). `char_offsets` below is the offset\n    half; the\n    day tuple lists land they fuse into this one function.\ngraphemes(s: str) -> List[str]\n    Extended grapheme clusters, as slices of `s`. A std call and never\n    the default unit (D24). Needs segmentation TABLES — a later tier\n    (the #18 ruling put the data in committed generated wolf source\n    when it comes) and not a primitive gap: nothing about this pin's\n    `str` brings it closer, and sc24 deliberately does not start it.\n```\n\n**THE BYTE VIEW IS A VIEW NOW, AND FOUR BODIES HERE ARE WRITTEN AGAINST\nTHAT** (s77 / wolf-lang#80, the sc12 pin). `s.bytes()` is the receiver's\nown pointer and length — bit-identical to the `str` and to every zero-copy\nsubslice `trim`/`split`/`get` already returned. Lowering reads that pair\nwherever the call is CONSUMED, so a byte walk emits no call and no\nallocation; `s[a..b]` and `s.get(a..b)` stopped calling the runtime in\nthe same wave.\n\n**std used TWO of those consuming positions for two sprints because the\nother five cost a lane, and at the sc12 pin the constraint is GONE**\n(F-0071 CLOSED by s88's #85, \"a temporary can be read from\" —\nre-measured shape by shape: `s.bytes()[i]`, `.get(i)`, `.first()`,\n`.last()` and `.count()` all execute on wolfc's checked tier now, where\nevery one of them was `unsupported` at `mem`). The walks below did not\nchange back, and that is a decision rather than an oversight: the\none-pass state machine `code_points` became is SHORTER than the\nrandom-access walk it replaced, and a constraint that forced a better\nalgorithm is not one to undo the day it lifts. What the closure buys is\nthat a future body may index a view without paying a lane for it. The\nrule it was an instance of stands unchanged: a shape that costs a lane\nis not a shape std writes (§14's honesty, applied to an optimization\nrather than to a capability). lupin still has no `first` on a `List`,\nmeasured at this pin, so that one position is still not portable.\n\nWhat changed for this module is four bodies and no signature.\n`char_count`, `char_offsets`, `code_points` and `is_ascii` were written\nin sc09 as `let bs = s.bytes()` plus a walk over `bs`, which was the only\nshape available when the builtin materialized a `List[int]` per call.\nNothing a caller can see moved: same answers, same rows, same lanes, and\n`tests/str/code_point_view.lu` is what says so.\n\n**The boundary of the win is a function boundary**, and it is worth\nstating where a reader will meet it: every position that is NOT\nconsuming — a `let` binding, an argument, a return — materializes\nexactly as before. So `str.bytes(s)` below still allocates (it returns\nthe list), `std.bytes`' functions still take a materialized `List[int]`,\nand a std function cannot pass a view to a helper. The win lives inside\none body today, which is why this sprint's work was rewriting bodies and\nnot signatures.\n\n**THE EMPTY NEEDLE IS RULED, AND STD'S GUARDS ARE GONE** (`[mem.str.empty]`,\nwolf-lang#56, F-0055 CLOSED at the sc11 pin). For three sprints\n`count(\"\")`, `split(\"\")` and `replace(s, \"\", …)` were undefined and the\nthree lanes disagreed — two refused the call as `unsupported`, the native\nruntime answered — so six functions here guarded the empty argument and\ntwo of them TRAPPED, which was std stating a contract the toolchain had\nnot stated. s71 states it: an empty needle counts 0, splits to one whole\npiece, and replaces nothing (identity). Measured on all three lanes at\nthis pin, so `count`, `split` and `replace` simply delegate now, and the\nfunctions std writes itself agree with the ruling by construction:\n`splitn` answers the one whole piece, `rsplit` inherits `split`'s,\n`replacen` is the identity. Nothing in this module traps on an empty\nargument any more. The `find`-defined family (`split_once`,\n`rsplit_once`, `find_all`) inherits `find`'s answer instead, and says so\non itself.\n\n**PADDING LIVES IN `std.fmt`** (§11: the format spec is a spelling and\nstd owns the operations). `pad_left`, `pad_right`, `center`, their\n`_with` fill variants and `with_sign` are `std.fmt`'s, not this\nmodule's — one concept, one name, one home (§1). This module has no\nwidth family and will not grow one; when display width (East Asian\nWidth plus graphemes) becomes computable it arrives under its own name\nin the module that owns the tables.\n\n**THE PARSE FAMILY MOVED (sc05).** `parse_int` and `parse_float` were\nshipped here by sc03 because this is where the boundary-safe probe was\nproven; the sprint that owns PRINTING numbers owns the whole\nnumber↔text boundary, so they now live in `std.fmt` and\n`std.fmt.decimal` beside `to_str_base` and `to_str`, where a reader can\nsee the two directions as inverses and a test can hold them to it. Two\nbehaviours improved in the move: a radix outside 2..36 raises `base`\nrather than `parse`, and `parse_float` is correctly rounded rather\nthan \"honest but approximate\". Nothing in `std.str` calls them, so\nthis module no longer carries a digit table at all.\n\n**The unicode posture, written down** (the sprint's filed decision).\nWhat ships in v1: UTF-8 validity as a type invariant (the language's),\nbyte-offset slicing that refuses to split a code point (the language's),\nand ASCII-true classification named as such (`std.unicode`, over the\n`int` code points `code_points` now produces). What is NOT here and is\na budget decision filed upstream, not a silent gap: category tables,\nfull case mapping, normalization, and grapheme segmentation data. The\nevidence: the implementations' `lower`/`upper` already perform SIMPLE\nUNICODE case mapping (`\"ÉA\".lower()` is `\"éa\"`, observed on every\nlane), which is MORE than the sprint contract promised and means the\ntables are already being carried somewhere — so the decision to make\nis where they live and who pays for them, not whether to start\n(F-0018, with `std.unicode`'s posture).",
      "summary": "std.str — the documented API surface of the language's `str`: an immutable, guaranteed-valid UTF-8 slice, two machine words wide (D24).",
      "items": [
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(s: str) -> int",
          "doc": "The length of `s` in BYTES, O(1) — the honest unit (D25). This is the\ndocumented byte-length test the sprint asks for: a two-byte code point\nhas length 2, and the number of CODE POINTS is a different question\nthat `char_count` answers. Total: no error row, no traps.\n\n```wolf-doc-example\nstr.len(\"wolf\") == 4\nstr.len(\"é\") == 2\nstr.len(\"🐺\") == 4\nstr.len(\"\") == 0\n```",
          "source": "std/str/str.lu",
          "line": 228,
          "tier": "core"
        },
        {
          "name": "is_empty",
          "kind": "fn",
          "signature": "pub fn is_empty(s: str) -> bool",
          "doc": "Whether `s` holds no bytes. Total: no error row, no traps.\n\n```wolf-doc-example\nstr.is_empty(\"\") == true\nstr.is_empty(\"wolf\") == false\n```",
          "source": "std/str/str.lu",
          "line": 238,
          "tier": "core"
        },
        {
          "name": "get",
          "kind": "fn",
          "signature": "pub fn get(s: str, from: int, to: int) -> str ! {none}",
          "doc": "The bytes in `[from, to)` — the RECOVERABLE slice, and the primitive\nthe rest of this module is written over (`[mem.str.get]`, D25's\nanti-landmine form). `none` when the range is out of order, out of\nrange, or would split a code point: the one function that ANSWERS the\nboundary question where `s[from..to]` faults on it. Never traps.\n\nSpelled with two offsets rather than a range because a range value\ncrossing a std function boundary is not something every lane types\n(F-0030); the builtin takes the range and this wrapper builds it.\n\nUse `get` when the offsets are DATA (a caller's input, an offset from\nanother source) and `s[from..to]` when they are yours by construction —\nan offset `find` returned is a boundary and a trap there would be a\nbug, not a fault.\n\n```wolf-doc-example\n(str.get(\"héllo\", 0, 3) else \"?\") == \"hé\"\n(str.get(\"héllo\", 0, 2) else \"?\") == \"?\"\n(str.get(\"héllo\", 1, 2) else \"?\") == \"?\"\n(str.get(\"héllo\", 0, 99) else \"?\") == \"?\"\n(str.get(\"héllo\", 3, 1) else \"?\") == \"?\"\n(str.get(\"héllo\", 0, 0) else \"?\") == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 265,
          "tier": "core"
        },
        {
          "name": "bytes",
          "kind": "fn",
          "signature": "pub fn bytes(s: str) -> List[byte]",
          "doc": "The raw bytes of `s`, in order, as the 0..255 element values §11's\ninterim byte currency uses — `std.bytes` is the module that operates on\nthem and `bytes.from_str` is the same view from that side. Total: no\nerror row, no traps beyond allocation.\n\n**This function allocates and the language's `s.bytes()` no longer\ndoes, and the difference is the whole s77 story.** A byte view is the\nreceiver's own pointer and length, read in place wherever it is\nCONSUMED — `for b in s.bytes()`, `s.bytes()[i]`, `s.bytes().len` and the\nsmall query family — and materialized in every other position, which\nincludes being RETURNED from a function like this one. So this wrapper\nis the honest `to_`-grade copy its name reserves the right to be (§1),\nand the fast path is the language's own spelling inside one body. std's\nown walks (`char_count`, `char_offsets`, `code_points`, `is_ascii`)\nstopped calling this function in sc12 for exactly that reason; a caller\nwho wants the list — to keep it, to pass it to `std.bytes`, to hold it\npast `s` — still wants this.\n\n```wolf-doc-example\nvar n = 0\nfor b in str.bytes(\"hé\") { n = n + b }\nn = n + 0\nn == 468\n```",
          "source": "std/str/str.lu",
          "line": 293,
          "tier": "core"
        },
        {
          "name": "contains",
          "kind": "fn",
          "signature": "pub fn contains(s: str, needle: str) -> bool",
          "doc": "Whether `needle` occurs anywhere in `s`, as a byte sequence. The empty\nneedle occurs in every string, including the empty one. Total: no error\nrow, no traps.\n\n```wolf-doc-example\nstr.contains(\"the wolf runs\", \"wolf\") == true\nstr.contains(\"the wolf runs\", \"moon\") == false\nstr.contains(\"\", \"\") == true\n```",
          "source": "std/str/str.lu",
          "line": 306,
          "tier": "core"
        },
        {
          "name": "find",
          "kind": "fn",
          "signature": "pub fn find(s: str, needle: str) -> int ! {none}",
          "doc": "The byte offset of the FIRST occurrence of `needle` in `s`; `none` when\nit does not occur. The empty needle occurs at 0. Total otherwise: a\nneedle longer than `s` is a miss, not a fault, and no input traps.\n\nThe offset is a code-point boundary of `s` by construction, so slicing\nat it is safe — which is what makes `split_once`, `find_all`,\n`replacen` and `splitn` writable below.\n\n```wolf-doc-example\n(str.find(\"the wolf runs\", \"wolf\") else 0 - 1) == 4\n(str.find(\"the wolf runs\", \"moon\") else 0 - 1) == 0 - 1\n(str.find(\"héllo\", \"l\") else 0 - 1) == 3\n(str.find(\"wolf\", \"\") else 0 - 1) == 0\n```",
          "source": "std/str/str.lu",
          "line": 324,
          "tier": "core"
        },
        {
          "name": "rfind",
          "kind": "fn",
          "signature": "pub fn rfind(s: str, needle: str) -> int ! {none}",
          "doc": "The byte offset of the LAST occurrence of `needle` in `s`; `none` when\nit does not occur. The empty needle occurs at `len(s)` — the end, which\nis what \"last\" means for something that occurs everywhere. Total\notherwise: no traps.\n\n```wolf-doc-example\n(str.rfind(\"a/b/c\", \"/\") else 0 - 1) == 3\n(str.rfind(\"a/b/c\", \"x\") else 0 - 1) == 0 - 1\n(str.rfind(\"héllo\", \"l\") else 0 - 1) == 4\n(str.rfind(\"wolf\", \"\") else 0 - 1) == 4\n```",
          "source": "std/str/str.lu",
          "line": 339,
          "tier": "core"
        },
        {
          "name": "find_all",
          "kind": "fn",
          "signature": "pub fn find_all(s: str, needle: str) -> List[int]",
          "doc": "The byte offsets of every NON-OVERLAPPING occurrence of `needle`, left\nto right — the find-all family's one member, and the plural of `find`\nrather than a new vocabulary. `count(s, needle)` is its length.\n\nThe empty needle yields no offsets, for `count`'s reason — `count` is\nthis function's length and the ruled count of nothing is 0\n(`[mem.str.empty]`). The guard is also what makes the loop terminate:\n`find(\"\")` is 0 at every step, so a body that advanced by the needle's\nlength would not advance at all. Allocates the list. Total: no error\nrow, no traps beyond allocation.\n\n```wolf-doc-example\nvar n = 0\nfor at in str.find_all(\"a,b,c\", \",\") { n = n + at }\nn = n + 0\nn == 4\n```",
          "source": "std/str/str.lu",
          "line": 360,
          "tier": "core"
        },
        {
          "name": "count",
          "kind": "fn",
          "signature": "pub fn count(s: str, needle: str) -> int",
          "doc": "The number of NON-OVERLAPPING occurrences of `needle` in `s`, scanning\nleft to right — `\"aaa\"` contains one `\"aa\"`, not two. The empty needle\ncounts 0, not `len + 1`: a count of nothing is nothing, which was this\nmodule's reviewed contract and is now the language's ruling\n(`[mem.str.empty]`), so the guard std carried for three sprints is gone\nand the delegation says the same thing. Total: no error row, no traps.\n\n```wolf-doc-example\nstr.count(\"a,b,c\", \",\") == 2\nstr.count(\"aaa\", \"aa\") == 1\nstr.count(\"wolf\", \"z\") == 0\nstr.count(\"wolf\", \"\") == 0\n```",
          "source": "std/str/str.lu",
          "line": 395,
          "tier": "core"
        },
        {
          "name": "starts_with",
          "kind": "fn",
          "signature": "pub fn starts_with(s: str, prefix: str) -> bool",
          "doc": "Whether `s` begins with `prefix`. The empty prefix always matches.\nTotal: no error row, no traps.\n\nWhen it answers true, `len(prefix)` is a code-point boundary of `s` —\nthe property sc03 built this module's first bodies on, kept here\nbecause it is still the cheapest way to reason about an offset.\n\n```wolf-doc-example\nstr.starts_with(\"wolf-lang\", \"wolf\") == true\nstr.starts_with(\"wolf-lang\", \"lang\") == false\nstr.starts_with(\"🐺!\", \"🐺\") == true\n```",
          "source": "std/str/str.lu",
          "line": 411,
          "tier": "core"
        },
        {
          "name": "ends_with",
          "kind": "fn",
          "signature": "pub fn ends_with(s: str, suffix: str) -> bool",
          "doc": "Whether `s` ends with `suffix`. The empty suffix always matches.\nTotal: no error row, no traps.\n\n```wolf-doc-example\nstr.ends_with(\"wolf.lu\", \".lu\") == true\nstr.ends_with(\"wolf.lu\", \".rs\") == false\nstr.ends_with(\"a🐺\", \"🐺\") == true\nstr.ends_with(\"wolf\", \"\") == true\n```",
          "source": "std/str/str.lu",
          "line": 424,
          "tier": "core"
        },
        {
          "name": "starts_with_any",
          "kind": "fn",
          "signature": "pub fn starts_with_any(s: str, prefixes: List[str]) -> bool",
          "doc": "Whether `s` begins with ANY of `prefixes` — the set form of\n`starts_with`, for the switch a parser writes over a keyword list. An\nempty list matches nothing; an empty prefix IN the list matches\neverything, exactly as `starts_with` does. Total: no error row, no\ntraps.\n\n```wolf-doc-example\nvar ps = List[str]()\n(mut ps).push(\"http://\")\n(mut ps).push(\"https://\")\nstr.starts_with_any(\"https://wolf.lang\", ps) == true\nstr.starts_with_any(\"ftp://wolf.lang\", ps) == false\n```",
          "source": "std/str/str.lu",
          "line": 441,
          "tier": "core"
        },
        {
          "name": "ends_with_any",
          "kind": "fn",
          "signature": "pub fn ends_with_any(s: str, suffixes: List[str]) -> bool",
          "doc": "Whether `s` ends with ANY of `suffixes` — the set form of `ends_with`,\nfor the extension test a file walker writes. An empty list matches\nnothing. Total: no error row, no traps.\n\n```wolf-doc-example\nvar ss = List[str]()\n(mut ss).push(\".lu\")\n(mut ss).push(\".wolfi\")\nstr.ends_with_any(\"main.wolfi\", ss) == true\nstr.ends_with_any(\"main.rs\", ss) == false\n```",
          "source": "std/str/str.lu",
          "line": 465,
          "tier": "core"
        },
        {
          "name": "strip_prefix",
          "kind": "fn",
          "signature": "pub fn strip_prefix(s: str, prefix: str) -> str ! {none}",
          "doc": "`s` without a leading `prefix`; `none` when `s` does not start with it\n— the absence row rather than `s` unchanged, so the caller can tell the\ntwo apart (§2). Consumed by `else` or `?`. No traps.\n\n```wolf-doc-example\n(str.strip_prefix(\"wolf-lang\", \"wolf-\") else \"?\") == \"lang\"\n(str.strip_prefix(\"wolf-lang\", \"lang\") else \"?\") == \"?\"\n(str.strip_prefix(\"wolf\", \"\") else \"?\") == \"wolf\"\n```",
          "source": "std/str/str.lu",
          "line": 487,
          "tier": "core"
        },
        {
          "name": "strip_suffix",
          "kind": "fn",
          "signature": "pub fn strip_suffix(s: str, suffix: str) -> str ! {none}",
          "doc": "`s` without a trailing `suffix`; `none` when it is not there — the\nabsence row for `strip_prefix`'s reason (§2). Consumed by `else` or\n`?`. No traps.\n\n```wolf-doc-example\n(str.strip_suffix(\"main.lu\", \".lu\") else \"?\") == \"main\"\n(str.strip_suffix(\"main.lu\", \".rs\") else \"?\") == \"?\"\n(str.strip_suffix(\"wolf\", \"\") else \"?\") == \"wolf\"\n```",
          "source": "std/str/str.lu",
          "line": 500,
          "tier": "core"
        },
        {
          "name": "split",
          "kind": "fn",
          "signature": "pub fn split(s: str, sep: str) -> List[str]",
          "doc": "Every piece of `s` between occurrences of `sep`, in order, keeping\nempty pieces: `split(\"a,,b\", \",\")` is three pieces and `split(\"\", \",\")`\nis one empty piece. The pieces are slices of `s`; the list allocates.\n\nAn empty `sep` yields ONE piece — the whole of `s` — which is the\nlanguage's ruling (`[mem.str.empty]`) and not this module's choice:\nthere is no boundary anywhere, so there is nothing to cut. std guarded\nthis with a trap while the three lanes disagreed about it (F-0055,\nclosed at the sc11 pin); the guard is gone and the delegation is the\ncontract. No traps.\n\n```wolf-doc-example\nvar n = 0\nfor p in str.split(\"a,,b\", \",\") { n = n + 1 }\nn = n + 0\nn == 3\nlet whole = str.split(\"a,b\", \"\")\nwhole.len == 1\nwhole[0] == \"a,b\"\n```",
          "source": "std/str/str.lu",
          "line": 524,
          "tier": "core"
        },
        {
          "name": "splitn",
          "kind": "fn",
          "signature": "pub fn splitn(s: str, sep: str, n: int) -> List[str]",
          "doc": "`split` stopping after `n` pieces: at most `n` are produced and the\nLAST one keeps the whole unsplit remainder, separators and all. `n <= 0`\nproduces no pieces at all — the honest reading of \"at most n\" — and\n`n == 1` is the whole string as one piece.\n\nAn empty `sep` yields the whole of `s` as one piece for any `n >= 1`,\nwhich is `split`'s ruled answer truncated to at most `n`\n(`[mem.str.empty]`) — the guard below states it explicitly because this\nbody walks `find` rather than delegating, and `find(\"\")` is 0 forever.\nAllocates the list; the pieces are slices of `s`. No traps.\n\n```wolf-doc-example\nvar n = 0\nfor p in str.splitn(\"a,b,c\", \",\", 2) { n = n + 1 }\nn = n + 0\nn == 2\nlet whole = str.splitn(\"a,b\", \"\", 3)\nwhole.len == 1\nwhole[0] == \"a,b\"\n```",
          "source": "std/str/str.lu",
          "line": 548,
          "tier": "core"
        },
        {
          "name": "rsplit",
          "kind": "fn",
          "signature": "pub fn rsplit(s: str, sep: str) -> List[str]",
          "doc": "`split`'s pieces in REVERSE order — last piece first. The pieces\nthemselves are not reversed and no byte moves: only the list order\ndiffers, so `rsplit(s, sep)` and `split(s, sep)` always have the same\nlength and the same members.\n\nAn empty `sep` yields `split`'s one whole piece, in a list of one, where\norder cannot matter (`[mem.str.empty]`). Allocates the list. No traps.\n\n```wolf-doc-example\nvar first = \"?\"\nfor p in str.rsplit(\"a,b,c\", \",\") { first += p }\nfirst == \"?cba\"\n```",
          "source": "std/str/str.lu",
          "line": 588,
          "tier": "core"
        },
        {
          "name": "split_once",
          "kind": "fn",
          "signature": "pub fn split_once(s: str, sep: str) -> (str, str) ! {none}",
          "doc": "The pieces of `s` before and after the FIRST occurrence of `sep`;\n`none` when `sep` does not occur — the pair is only meaningful\ntogether, so absence is one row and not two empty strings (§2).\n\nThe empty separator occurs at 0 (`find`'s contract), so\n`split_once(s, \"\")` is `(\"\", s)` rather than a trap: unlike `split`\nthere IS a well-defined answer, and this function's only obligation is\nto agree with `find`. Both pieces are slices of `s`. No traps.\n\n```wolf-doc-example\nlet p = str.split_once(\"key=value=more\", \"=\") else (\"?\", \"?\")\np.0 == \"key\"\np.1 == \"value=more\"\nlet q = str.split_once(\"nosep\", \"=\") else (\"?\", \"?\")\nq.0 == \"?\"\n```",
          "source": "std/str/str.lu",
          "line": 616,
          "tier": "core"
        },
        {
          "name": "rsplit_once",
          "kind": "fn",
          "signature": "pub fn rsplit_once(s: str, sep: str) -> (str, str) ! {none}",
          "doc": "`split_once` at the LAST occurrence of `sep`: the pieces before and\nafter it, or `none` when it does not occur. The empty separator occurs\nat `len(s)` (`rfind`'s contract), so `rsplit_once(s, \"\")` is `(s, \"\")`.\nBoth pieces are slices of `s`. No traps.\n\nThis is the extension-and-stem shape: `rsplit_once(\"archive.tar.gz\",\n\".\")` is `(\"archive.tar\", \"gz\")`, where `split_once` would have given\n`(\"archive\", \"tar.gz\")`.\n\n```wolf-doc-example\nlet p = str.rsplit_once(\"archive.tar.gz\", \".\") else (\"?\", \"?\")\np.0 == \"archive.tar\"\np.1 == \"gz\"\nlet q = str.rsplit_once(\"nodot\", \".\") else (\"?\", \"?\")\nq.1 == \"?\"\n```",
          "source": "std/str/str.lu",
          "line": 639,
          "tier": "core"
        },
        {
          "name": "replace",
          "kind": "fn",
          "signature": "pub fn replace(s: str, old: str, new: str) -> str",
          "doc": "A fresh string with every NON-OVERLAPPING occurrence of `old` replaced\nby `new`, left to right, allocated in the ambient region. Scanning\nresumes AFTER each replacement, so `replace(\"aaa\", \"aa\", \"b\")` is\n`\"ba\"` and a `new` that contains `old` does not feed itself.\n\nAn empty `old` replaces NOTHING — the result is `s` — which is the\nlanguage's ruling (`[mem.str.empty]`): an empty pattern occurs\neverywhere and at no width, so inserting `new` at every position would\nbe a different operation with a different name. std trapped here while\nthe lanes disagreed (F-0055, closed at the sc11 pin) and delegates now.\nNo traps.\n\n```wolf-doc-example\nstr.replace(\"a,b,c\", \",\", \";\") == \"a;b;c\"\nstr.replace(\"aaa\", \"aa\", \"b\") == \"ba\"\nstr.replace(\"wolf\", \"z\", \"y\") == \"wolf\"\nstr.replace(\"héllo\", \"l\", \"L\") == \"héLLo\"\nstr.replace(\"a,b\", \"\", \"-\") == \"a,b\"\n```",
          "source": "std/str/str.lu",
          "line": 665,
          "tier": "core"
        },
        {
          "name": "replacen",
          "kind": "fn",
          "signature": "pub fn replacen(s: str, old: str, new: str, n: int) -> str",
          "doc": "`replace` stopping after `n` replacements; the rest of `s` is copied\nunchanged. `n <= 0` replaces nothing and returns `s`.\n\nAn empty `old` is the identity for any `n`, which is `replace`'s ruled\nanswer (`[mem.str.empty]`) — stated as a guard because this body walks\n`find`, and `find(\"\")` is 0 forever. No traps.\n\n```wolf-doc-example\nstr.replacen(\"a,b,c\", \",\", \";\", 1) == \"a;b,c\"\nstr.replacen(\"a,b,c\", \",\", \";\", 9) == \"a;b;c\"\nstr.replacen(\"a,b,c\", \",\", \";\", 0) == \"a,b,c\"\nstr.replacen(\"a,b\", \"\", \"-\", 2) == \"a,b\"\n```",
          "source": "std/str/str.lu",
          "line": 682,
          "tier": "core"
        },
        {
          "name": "lower",
          "kind": "fn",
          "signature": "pub fn lower(s: str) -> str",
          "doc": "`s` with every code point lowercased, freshly allocated in the ambient\nregion. Total: no error row, no traps beyond allocation.\n\nThe mapping is the implementation's, and it is worth stating plainly:\nthe sprint contract planned ASCII-only case mapping here, but every\npinned implementation performs simple Unicode case mapping (`\"ÉA\"`\nlowercases to `\"éa\"`). std delegates rather than reimplement, because\nan in-library mapping would need the case tables nothing carries in\nwolf source yet — so this function's contract is \"the implementation's\nsimple case mapping\", and which mapping std should REQUIRE is the filed\nunicode-tables decision (F-0018). Locale is never a parameter, in core,\never.\n\n```wolf-doc-example\nstr.lower(\"WOLF\") == \"wolf\"\nstr.lower(\"Wolf-Lang\") == \"wolf-lang\"\nstr.lower(\"\") == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 721,
          "tier": "core"
        },
        {
          "name": "upper",
          "kind": "fn",
          "signature": "pub fn upper(s: str) -> str",
          "doc": "`s` with every code point uppercased, freshly allocated in the ambient\nregion. The mapping story is `lower`'s, exactly. Total: no error row,\nno traps beyond allocation.\n\n```wolf-doc-example\nstr.upper(\"wolf\") == \"WOLF\"\nstr.upper(\"Wolf-Lang\") == \"WOLF-LANG\"\nstr.upper(\"\") == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 734,
          "tier": "core"
        },
        {
          "name": "eq_ignore_case",
          "kind": "fn",
          "signature": "pub fn eq_ignore_case(a: str, b: str) -> bool",
          "doc": "Whether `a` and `b` are equal ignoring case, by comparing their\ncase-folded forms. Total: no error row, no traps beyond allocation.\n\nThe sprint contract names this \"ASCII, named honestly\". The honest name\nat this pin drops the ASCII: the folding is `lower`'s, which every\npinned implementation performs over all of Unicode. Callers get\ncase-insensitive comparison as strong as the implementation's `lower` —\nnever weaker, and never locale-sensitive.\n\n```wolf-doc-example\nstr.eq_ignore_case(\"WOLF\", \"wolf\") == true\nstr.eq_ignore_case(\"Wolf\", \"wolves\") == false\nstr.eq_ignore_case(\"\", \"\") == true\n```",
          "source": "std/str/str.lu",
          "line": 752,
          "tier": "core"
        },
        {
          "name": "repeat",
          "kind": "fn",
          "signature": "pub fn repeat(s: str, n: int) -> str",
          "doc": "`s` repeated `n` times, freshly allocated. `n == 0` gives the empty\nstring. A NEGATIVE `n` traps `assert` — the language's own fault, from\nthe builtin, on all three lanes: a repeat count cannot be negative, and\ns71 RULED the KIND (`[mem.str.repeat]`, wolf-lang#57) to be the caller\ncontract violation it is rather than the `bounds` the runtime used to\nreport. std does not guard it, because a trap is the right answer for a\nviolation the caller could have checked (§2) and because a guard would\nhide the one place the implementations agree. Twice re-measured, twice\nchanged: sc03 read `\"\"` from the interpreter, sc09 measured\n`trap(bounds)` on every lane, sc11 measures `trap(assert)` on every lane\n— which is exactly why the claim lives in\n`tests/str/repeat_negative_trap.lu` and not only in this sentence\n(F-0056, closed).\n\n```wolf-doc-example\nstr.repeat(\"ab\", 3) == \"ababab\"\nstr.repeat(\"ab\", 1) == \"ab\"\nstr.repeat(\"ab\", 0) == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 775,
          "tier": "core"
        },
        {
          "name": "trim",
          "kind": "fn",
          "signature": "pub fn trim(s: str) -> str",
          "doc": "`s` with leading and trailing whitespace removed — a slice of `s`, no\ncopy. Whitespace is Unicode `White_Space` (the builtin's set, pinned\ncode point by code point by `tests/str/trim_whitespace_set.lu`). Total:\nno error row, no traps.\n\n```wolf-doc-example\nstr.trim(\"  wolf  \") == \"wolf\"\nstr.trim(\"\\n\\twolf\\r\\n\") == \"wolf\"\nstr.trim(\"   \") == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 789,
          "tier": "core"
        },
        {
          "name": "trim_start",
          "kind": "fn",
          "signature": "pub fn trim_start(s: str) -> str",
          "doc": "`s` with LEADING whitespace removed — a slice of `s`, no copy. Same\nwhitespace set as `trim`, and the equality of the two sets is a test,\nnot a hope (§9). Total: no error row, no traps.\n\nThis body was 95 lines until sc09: a `White_Space` table written as\n`starts_with` probes, because sc03 had no way to scan a string it did\nnot already know the shape of. s37's builtin `trim_start` replaced the\ntable with a delegation, and the whitespace-set test outlived it — what\nit pins now is the BUILTIN's set, which is what it was always really\nchecking.\n\n```wolf-doc-example\nstr.trim_start(\"  wolf  \") == \"wolf  \"\nstr.trim_start(\"wolf\") == \"wolf\"\nstr.trim_start(\"   \") == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 809,
          "tier": "core"
        },
        {
          "name": "trim_end",
          "kind": "fn",
          "signature": "pub fn trim_end(s: str) -> str",
          "doc": "`s` with TRAILING whitespace removed — a slice of `s`, no copy. Same\nwhitespace set as `trim`. Total: no error row, no traps.\n\n```wolf-doc-example\nstr.trim_end(\"  wolf  \") == \"  wolf\"\nstr.trim_end(\"wolf\") == \"wolf\"\nstr.trim_end(\"   \") == \"\"\n```",
          "source": "std/str/str.lu",
          "line": 821,
          "tier": "core"
        },
        {
          "name": "lines",
          "kind": "fn",
          "signature": "pub fn lines(s: str) -> List[str]",
          "doc": "The lines of `s`, in order, each without its terminator. A trailing\nnewline does NOT produce a final empty line, and the empty string has\nno lines at all. `\\r\\n` counts as one terminator and the `\\r` is not\npart of the line. Allocates the list (`to_`-grade allocation, §1);\nthe lines themselves are slices of `s`. Total: no error row, no traps\nbeyond allocation.\n\n```wolf-doc-example\nvar seen = 0\nfor line in str.lines(\"a\\nb\\n\") { seen = seen + 1 }\nseen = seen + 0\nseen == 2\n```",
          "source": "std/str/str.lu",
          "line": 838,
          "tier": "core"
        },
        {
          "name": "words",
          "kind": "fn",
          "signature": "pub fn words(s: str) -> List[str]",
          "doc": "The whitespace-separated words of `s`, in order, dropping empty runs:\nany run of whitespace separates, leading and trailing whitespace\nproduce no empty words, and a string of only whitespace has no words.\nWhitespace is `trim`'s set. Allocates the list; the words are slices of\n`s`. Total: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar seen = 0\nfor word in str.words(\"  the   wolf  \") { seen = seen + 1 }\nseen = seen + 0\nseen == 2\n```",
          "source": "std/str/str.lu",
          "line": 854,
          "tier": "core"
        },
        {
          "name": "each_word",
          "kind": "fn",
          "signature": "pub fn each_word(s: str, f: fn(str) -> ()) -> ()",
          "doc": "Walks the whitespace-separated words of `s` in order and calls `f`\nonce per word, building nothing: the walk is the compiler's own lazy\n`for`-head over the receiver's bytes (`[mem.str.view]`, s84), so\neach word is a zero-copy slice of `s` and no list exists. `words` is\nthis walk with a `List[str]` at the end; when the list itself is not\nwanted, this is the cheaper spelling. Same word rule as `words`:\nwhitespace is `trim`'s set, empty runs separate, no word is empty —\na string of only whitespace calls `f` zero times.\n\nThe example is prose because a doc example can neither define nor\nimport a fn value (F-0085/F-0086; the sc13 convention): with\n`fn shout(w: str) -> () { print(\"{w}\") }` at top level,\n`str.each_word(\"  the wolf  \", shout)` prints `the` then `wolf`.\n`tests/str/each_word_walk.lu` is the measured witness — including\nthe native-lane disassembly proving the walk fuses in std's own\nmodule context (no `__wolf_rt_str_split`, the inline predicate).",
          "source": "std/str/str.lu",
          "line": 874,
          "tier": "core"
        },
        {
          "name": "words_count",
          "kind": "fn",
          "signature": "pub fn words_count(s: str) -> int",
          "doc": "The number of whitespace-separated words in `s` — `words` without\nthe list OR the callback: the same fused walk as `each_word`, folded\nto a count. This fold earns its own name because the callable tier\ncannot express it: a fn value captures nothing (F-0085/F-0086), so\ncounting through `each_word` has nowhere to put the counter. Word\nrule as ever: whitespace is `trim`'s set, no word is empty — a\nwhitespace-only or empty string counts zero.\n\n```wolf-doc-example\nstr.words_count(\"  the   wolf  runs \") == 3\n```",
          "source": "std/str/str.lu",
          "line": 889,
          "tier": "core"
        },
        {
          "name": "join",
          "kind": "fn",
          "signature": "pub fn join(sep: str, parts: List[str]) -> str",
          "doc": "`parts` concatenated with the separator `sep` between consecutive\nitems — the separator is the RECEIVER, as the sprint contract has it,\nwhich is why `sep` comes first. No separator is added before the first\nor after the last part; an empty list joins to the empty string and a\none-item list to that item. Allocates in the ambient region. Total: no\nerror row, no traps beyond allocation.\n\n`join` and `split` are inverses whenever no part contains `sep`:\n`join(sep, split(s, sep)) == s` for every `s` and every non-empty\n`sep`, which `tests/str/split_join_round_trip.lu` holds them to.\n\n```wolf-doc-example\nvar parts = List[str]()\n(mut parts).push(\"the\")\n(mut parts).push(\"wolf\")\nstr.join(\" \", parts) == \"the wolf\"\nstr.join(\"\", parts) == \"thewolf\"\n```",
          "source": "std/str/str.lu",
          "line": 913,
          "tier": "core"
        },
        {
          "name": "char_count",
          "kind": "fn",
          "signature": "pub fn char_count(s: str) -> int",
          "doc": "The number of CODE POINTS in `s` — the count `len` deliberately does\nnot give (§9: a function that counts code points says so in its name).\nO(bytes), and equal to `len(s)` exactly when `s` is ASCII.\n\nCounted by the UTF-8 invariant rather than by decoding: a lead byte is\nanything outside 128..191, so the count is the number of non-\ncontinuation bytes and no arithmetic can overflow. Total: no error row,\nno traps.\n\nThe walk consumes the byte view where it stands (`for b in s.bytes()`)\nrather than binding it first. s77 made that the difference between a\nview and a copy: `bytes()` is the receiver's own pointer and length in\na consuming position, and a `let` binding is what materializes it. The\nbody sc09 wrote bound `bs` and paid a list for every string it counted.\n\n```wolf-doc-example\nstr.char_count(\"wolf\") == 4\nstr.char_count(\"héllo\") == 5\nstr.char_count(\"é🐺\") == 2\nstr.char_count(\"\") == 0\n```",
          "source": "std/str/str.lu",
          "line": 950,
          "tier": "core"
        },
        {
          "name": "char_offsets",
          "kind": "fn",
          "signature": "pub fn char_offsets(s: str) -> List[int]",
          "doc": "The byte offset at which each code point of `s` STARTS, in order — the\noffset half of the blocked `chars()` (see the module header), and every\noffset in it is a boundary `get` will accept. `len(s)` is deliberately\nNOT included: this lists code points, and there is none at the end.\n\nAllocates the OUTPUT list and nothing else. The offset is carried in a\ncounter beside a `for` over the byte view rather than driving an index\nINTO it. That spelling was a lane decision when it was written — indexing\na view was refused by wolfc's checked tier (F-0071, closed at the sc12\npin) — and it is kept now because it is the better body: one pass, one\ncounter, no list. The body sc09 wrote bound `bs` first and copied every\nbyte of `s` before reading one of them.\n\nTotal: no error row, no traps beyond the output list's allocation.\n\n```wolf-doc-example\nvar last = 0 - 1\nfor at in str.char_offsets(\"héllo\") { last = at }\nlast == 5\n```",
          "source": "std/str/str.lu",
          "line": 981,
          "tier": "core"
        },
        {
          "name": "code_points",
          "kind": "fn",
          "signature": "pub fn code_points(s: str) -> List[int]",
          "doc": "The Unicode SCALAR VALUES of `s`'s code points, in order, as `int`s.\nBorn (sc09) as the interim face of the then-blocked `to_list_chars`;\nkept (sc25) as something better: std's own one-pass UTF-8 reading,\nindependent of the builtin `chars()`, which is what lets\n`tests/str/chars_builtin_agree.lu` hold the two readings against\neach other element by element — the `bytes.is_utf8` pattern one tier\nup. A caller that wants `char`s calls `to_list_chars`; a caller that\nwants the numbers (a table index, a range check against a numeric\nspec) takes these and crosses back through `unicode.from_code`, the\none validating door. `std.unicode`'s classifiers take `char` as of\nthe sc25 retype, so this list no longer feeds them directly — that\ncomposition moved to `chars()`.\n\nTotal over every `str`: a `str` is valid UTF-8 by construction (D24), so\nthe decode below has no error path and needs no validation — the\nversion of it that DOES validate is `std.bytes.is_utf8`, over bytes\nnobody promised anything about. Allocates the OUTPUT list and nothing\nelse.\n\n**The decoder is a one-pass state machine now, and that is the shape the\nbyte view asks for.** sc09 wrote it as a random-access walk — bind the\nlist, read `bs[i + 1]`, `bs[i + 2]`, `bs[i + 3]`, advance `i` by the\nwidth — which needed a materialized copy to index into. s77 makes\niteration the free position, so the lead byte now sets a PENDING count\nand each continuation folds six bits into the accumulator. The two forms\nagree byte for byte; this one reads `s`'s own storage and never builds a\nlist to read it from, and it is shorter — which is why it stayed after\nF-0071 (the checked tier's refusal of an indexed view) closed at the\nsc12 pin.\n\nThe continuation count is trusted rather than checked, and that is the\nUTF-8 invariant rather than an oversight: a lead byte in a valid `str`\nis followed by exactly as many continuations as it announces.\n`std.bytes.is_utf8` is where that assumption is checked, because there\nthe bytes are a caller's and not the language's.\n\n```wolf-doc-example\nvar sum = 0\nfor c in str.code_points(\"aé\") { sum = sum + c }\nsum = sum + 0\nsum == 330\n```",
          "source": "std/str/str.lu",
          "line": 1036,
          "tier": "core"
        },
        {
          "name": "to_list_chars",
          "kind": "fn",
          "signature": "pub fn to_list_chars(s: str) -> List[char]",
          "doc": "The code points of `s` as CHARS, in order — the sc03 contract's\n`to_list_chars`, code at last (sc24): a delegation to the language's\n`s.chars()` (`[mem.str.chars]`, s120/s121), which yields the Unicode\nscalar values `List[char]`-typed under D58's ruling — a scalar value,\nordered by scalar value, NOT an integer. `code_points` above is this\nfunction in the pre-D58 `int` currency and the two agree element for\nelement (`unicode.code(c)` is the bridge; the agreement is a test,\n`tests/str/chars_builtin_agree.lu`, held as two independent UTF-8\nreadings — the builtin's and std's own decoder's). Total over every\n`str`: a `str` is valid UTF-8 by construction (D24), so no element\ncan fall outside `char`'s domain — which is exactly why the clause\ncan promise the type. Allocates the output list. No error row, no\ntraps beyond allocation.\n\nLANES, stated honestly (the sc24 rule: a zero-lane surface is zero\nevidence, and a by-lane surface says so): every executing lane runs\nthis as of the sc25 pins — both wolf rungs since s121, and lupin\nsince 0.1.15 (is26, the scalar release), where sc24's tests and\nexample were honestly `unsupported` for one sprint. The doc-example\nwaiver that named that debt died with it, on schedule.\n\n```wolf-doc-example\nlet cs = str.to_list_chars(\"aé🐺\")\ncs.len == 3\nlet e = str.to_list_chars(\"\")\ne.len == 0\n```",
          "source": "std/str/str.lu",
          "line": 1091,
          "tier": "core"
        },
        {
          "name": "is_ascii",
          "kind": "fn",
          "signature": "pub fn is_ascii(s: str) -> bool",
          "doc": "Whether every code point in `s` is ASCII (below U+0080) — the cheap\nquestion a caller asks before treating byte offsets as character\npositions, and the one classification that needs no tables at all.\nThe empty string is ASCII. Total: no error row, no traps.\n\n`is_ascii(s)` is exactly `char_count(s) == len(s)`, and it is a\nfunction rather than that expression because the equality is a fact\nabout UTF-8 the caller should not have to know.\n\nIt is also the cheapest function in this module to get wrong the\nexpensive way: until sc12 it copied every byte of `s` into a list and\nthen returned `false` at the first one above 127. It walks the view now\nand stops there — a `return` out of a `for` over `s.bytes()` runs on all\nthree lanes.\n\n```wolf-doc-example\nstr.is_ascii(\"wolf-lang\") == true\nstr.is_ascii(\"héllo\") == false\nstr.is_ascii(\"\") == true\n```",
          "source": "std/str/str.lu",
          "line": 1115,
          "tier": "core"
        },
        {
          "name": "to_strbuf",
          "kind": "fn",
          "signature": "pub fn to_strbuf(s: str) -> strbuf.StrBuf",
          "doc": "`s` copied into a fresh `std.strbuf.StrBuf` — the allocating\nconversion into the builder (`to_`, §1: it allocates). `strbuf.to_str`\nis the direction back, and since sc75 it copies too, once (the builder\nholds bytes, wolf-std#108). O(len(s)). Total: no error row, no traps\nbeyond allocation.\n\nNo fenced example: asserting about the result needs `std.strbuf`, and\nthe extractor imports exactly the documented module (§4's one-module\nnote), so the worked example lives in\n`tests/str/to_strbuf_round_trip.lu` instead. In prose: after\n`let b = str.to_strbuf(\"wolf\")`, `strbuf.len(b)` is 4 and\n`strbuf.to_str(b)` is `\"wolf\"` — and appending to `b` leaves `s`\nuntouched, because `str` is immutable and this is a copy.",
          "source": "std/str/str.lu",
          "line": 1137,
          "tier": "core"
        }
      ]
    },
    {
      "name": "strbuf",
      "group": "Strings",
      "tier": "core",
      "doc": "std.strbuf — the one string builder (D24). Stability tier: core.\n\n**What is the language's and what is std's.** Nothing here is the\nlanguage's yet: `str` is the language's immutable UTF-8 slice, and D24\npromises `strbuf` as an owned, growable, SSO-backed builder that\nauto-borrows to `str` — compiler-side plumbing (s37 §3) that does not\nexist at this pin. This module is the API surface that plumbing will\nback, written today over the language's growable byte list.\n\n**THE BACKING IS A `List[byte]` (sc75, wolf-std#108).** The bytes of\nthe contents, UTF-8 by construction, in one list that grows by\ndoubling. `push_str` pushes its argument's bytes onto the end, reading\nthem through `s.bytes()`'s view (`[mem.str.view.lend]`: iterated on the\nspot, nothing materialized), so appending n bytes costs O(n) amortized\nwhatever the buffer already holds, and `to_str` validates and copies\nthe contents once. Until sc75 the field was a `str` rebuilt by `+=`:\nevery `push_str` allocated a fresh string and copied the whole\naccumulator into it, and the region kept every copy until it ended, so\na builder was quadratic in time AND in resident memory. #108 measured\nit on wolf 0.2.34: 4 MiB pushed in 64-byte lines took 30 s, 6 MiB\nreached 12.9 GB resident and 8 MiB was killed. The meaning of every\nfunction is unchanged, and so is every signature (R-sc75-1); only the\ncosts moved, and each function's doc states its own. On the region\nledger a pushed builder charges about twice its contents natively (the\ndoubling's abandoned buffers, `[mem.region.account.1]`) and once on\nthe checked machine; `to_str` charges the contents once more.\n\nThe SSO backing D24 names is still compiler-side plumbing, and when it\nlands no caller has to change (F-0019); this file is where the layout\nnote for s41/s43's ABI document will hang.\n\n`StrBuf` is CapCase per API-CONVENTIONS §1 even though the sprint\ncontract writes the constructor as `strbuf()`: a callable type name is\ns37's builtin spelling, and `strbuf.new()` is the module spelling\navailable today. That delta is recorded in the campaign closeout.\n\nTWO OF THE ELEVEN ARE NOT HERE, each for a stated reason — and\n`push(c: char)` LEFT this list at sc24: D58 ruled the type\n(`[type.char]`, the sc24 data pin) and the sc24 wolf pair executes\nit, so the one-line body (`{c}` interpolation, which prints THE\nCHARACTER per `[type.char.interp]`) is code below — on every\nexecuting lane as of sc25: lupin 0.1.15 (is26, the scalar release)\nruns `char`, and the row that sc24 ledgered by lane flipped at that\nrelease as promised. The sc24 history stays worth a sentence: the\nsprint's first wolf acquisition (@ e7abf03) was pre-s121 and refused\nthe type — the mid-sprint re-acquisition is what made this writable,\nand every sentence here was re-measured against the binary pinned.\n\n- `strbuf.in(r)` — the region-explicit constructor (API-CONVENTIONS §5,\n  the s37 `.in(r)` pattern). Placement syntax over a std type is\n  compiler plumbing this pin does not have; the ambient-region\n  constructor below is D10's default and needs no annotation.\n  **RE-PROBED rather than argued at the sc32 pin v0.2.2/8cda3aa\n  (2026-09-02), because for the first time in this residue's life\n  the span MOVED regions for real** — s131 and s132 landed the byte\n  ledger, the creation-time cap and D68's contained fault\n  whole-pipe, so \"regions did not change\" stopped being a sentence a\n  reader should take on trust. The probe is the placement syntax\n  itself, both shapes: `List[int].in(r)` is `unsupported — a\n  std/prelude stub without a signature` at resolve on both wolf\n  rungs AND refused by lupin, and `Buf.in(r) { … }` over a plain\n  struct is `fail(E0201)` at PARSE on all three — the form does not\n  exist in the grammar, which is the honest state of a surface\n  nobody has built. s131/s132 gave regions an ACCOUNTING surface and\n  a BUDGET; they gave them no placement plumbing, and the two are\n  different work. `std.mem.budget` is what this repo consumed from\n  that span instead.\n- `reserve(n)` — API-CONVENTIONS §8's rule (\"no capacity API without a\n  capacity\") kept it out while the buffer was a `str`, which has no\n  capacity to reserve. **sc75: the capacity now exists** — the list\n  under the builder has the language's `reserve(n)` (`[type.list.storage]`)\n  — and §8's builder amendment (R-sc75-1) says what that changes: the\n  rule's reason is gone, the name is not added in the same pass that\n  moves the backing, because the public API stays exactly as it was\n  (a caller adding `reserve` is a later lane's API change, asked as a\n  ruling). The history this bullet carried: UNMOVED at the sc32 pin\n  (2026-09-02): there is no capacity or string-backing commit\n  anywhere in `75fd2d0..8cda3aa` or `0.1.20..0.1.22`. And the\n  question this line carried forward from sc31 is now ANSWERED\n  rather than deferred — the region accounting surface wolf-lang#187\n  asked for landed in this span (both halves: `region_bytes`/\n  `live_region_bytes` from s131, the `cap:` budget and its contained\n  `fault(kind)` from s132/D68), it was consumed at sc32, and it\n  lives in `std.mem.budget`. It bought this module nothing, which is\n  the honest outcome: a ledger tells you what a buffer COST and a\n  cap tells you when to stop, and neither is a capacity you can\n  reserve.\n\nAbsence is spelled `none` where it appears, which is the convention's\nown spelling: F-0003 died at the sc05 pins and the rename landed\ntree-wide at sc06, so nothing here is waiting on it.",
      "summary": "std.strbuf — the one string builder (D24).",
      "items": [
        {
          "name": "StrBuf",
          "kind": "struct",
          "signature": "pub struct StrBuf { bytes: List[byte], }",
          "doc": "The builder: an owned, growable string. The field is the backing\ndescribed in the module header (the contents' UTF-8 bytes) — never\npart of the API.",
          "source": "std/strbuf/strbuf.lu",
          "line": 98,
          "tier": "core"
        },
        {
          "name": "new",
          "kind": "fn",
          "signature": "pub fn new() -> StrBuf",
          "doc": "A fresh empty builder in the ambient region (D10: no region argument,\nno annotation). Total: no error row, no traps.\n\n```wolf-doc-example\nlet b = strbuf.new()\nstrbuf.len(b) == 0\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 109,
          "tier": "core"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(b: StrBuf) -> int",
          "doc": "The length of the buffer's contents in BYTES — the same honest unit as\n`str.len` (D25: byte offsets are the one currency). O(1). Total: no\nerror row, no traps.\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"é\")\nstrbuf.len(b) == 2\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 122,
          "tier": "core"
        },
        {
          "name": "push_str",
          "kind": "fn",
          "signature": "pub fn push_str(mut b: StrBuf, s: str)",
          "doc": "Appends `s` to the end of the buffer. Amortized O(len(s)), whatever\nthe buffer already holds: the bytes are pushed onto the backing list,\nread through `s.bytes()`'s view, so nothing is copied but `s` itself\n(sc75, wolf-std#108; until then O(len(b) + len(s)), the whole\naccumulator copied every call). Total: no error row, no traps beyond\nallocation.\n\nThe `+=` spelling the sprint contract mentions — `b += s` on the\nBUFFER — is not available: the operator-to-method bridge is F-0004's\nopen question, and wolf has no operator overloading, so a `StrBuf`\ncannot be the left side of one. `push_str` is the one spelling std\nwrites. (The sentence that stood here until sc43 went on to say `+`\non `str` \"runs in lupin and is E0409 in wolfc\". That was true when it\nwas written and stopped being true at D62, which this very body\nadopted: `b.s += s` was a `str` `+=` on all three lanes, and sc43's\n`push` was its `char` twin one function down. sc75 retired both\nbodies for the byte list; the operator story above is unchanged.)\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"wolf\")\nstrbuf.push_str(mut b, \"-lang\")\nstrbuf.to_str(b) == \"wolf-lang\"\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 150,
          "tier": "core"
        },
        {
          "name": "push",
          "kind": "fn",
          "signature": "pub fn push(mut b: StrBuf, c: char)",
          "doc": "Appends one code point — the sc03 contract's `push(c)`, code at last\n(sc24), over D58's `char` (`[type.char]`: a Unicode scalar value,\nordered, NOT an integer). The appended bytes are exactly `c`'s UTF-8\nencoding, 1 to 4 of them, computed from the scalar's value by the\nwidth rule `[mem.str.chars]` states (1 byte under 0x80, 2 under\n0x800, 3 under 0x10000, else 4), so the buffer's UTF-8 validity is\npreserved by construction: a non-scalar cannot exist as a `char` at\nall (the D56 cast already trapped it). Amortized O(1) (sc75; until\nthen O(len(b)), the accumulator copied as in `push_str`). Total: no\nerror row, no traps beyond allocation.\n\n**sc75: the body encodes instead of appending a `str`.** Until sc75\nit was `b.s += c`, which `[type.str.concat]` rules to append THE\nCHARACTER; over the byte list the same bytes are pushed directly, so\na push allocates nothing of its own.\n\n**It was an interpolation hole until sc43** — `b.s = \"{b.s}{c}\"` —\nand the hole existed for exactly one reason: `+` refused a `char`,\nso the only way to put one on the end of a `str` was to render it\ninto a new string. wolf-lang#278 admitted a `char` on either side of\n`+` and as the value of `+=` at v0.2.9, and lupin 0.1.31 mirrored it\n(is43, wolf-interp#78). From sc43 to sc75 the two appenders were\nwritten in one idiom, `b.s += s` and `b.s += c`, with\n`[type.str.concat]` carrying the character across; since sc75 each\npushes bytes, `push_str` a `str`'s through its view and this one a\nscalar's by the width rule.\n\nLANES: every executing lane runs this as of the sc25 pins — both\nwolf rungs since s121, lupin since 0.1.15 (is26, the scalar\nrelease; sc24's one-sprint `unsupported` there closed on it). The\nexample keeps its `\"é🐺\".chars()` spelling because the walk is the\nnatural producer here, not as the lex-dodge it was under 0.1.14.\n\n```wolf-doc-example\nvar b = strbuf.new()\nfor c in \"é🐺\".chars() { strbuf.push(mut b, c) }\nstrbuf.to_str(b) == \"é🐺\"\nstrbuf.len(b) == 6\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 195,
          "tier": "core"
        },
        {
          "name": "insert",
          "kind": "fn",
          "signature": "pub fn insert(mut b: StrBuf, off: int, s: str)",
          "doc": "Inserts `s` at byte offset `off`, shifting everything at or after `off`\nto the right. `off == len(b)` appends; `off == 0` prepends.\n\nTraps `bounds` (`[conf.trap.set]`) when `off` is out of range or falls\ninside a code point — the language's own checked slicing (D25), raised\nexactly where a caller would see it. That is the \"checked boundary\" the\ncontract asks for; the recoverable form — an `insert` that raises\nrather than traps — is writable over `str.get` as of s37 (sc09) and is\na `std.strbuf` sprint's to add, under its own name, beside this one.\n\nO(len(b) + len(s)): the contents are read as a `str` once, sliced at\n`off` (where the trap comes from), and the buffer is refilled in its\nown storage (`reset`, `[type.list.reset]`).\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"wolf\")\nstrbuf.insert(mut b, 0, \"the \")\nstrbuf.to_str(b) == \"the wolf\"\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 234,
          "tier": "core"
        },
        {
          "name": "remove",
          "kind": "fn",
          "signature": "pub fn remove(mut b: StrBuf, from: int, to: int)",
          "doc": "Removes the bytes in `[from, to)`, closing the gap. Empty when\n`from == to`.\n\nTraps `bounds` when the range is out of order, out of range, or splits\na code point (D25, as `insert`). The contract writes this as\n`remove(a..b)`; a range is not a value that can cross a function\nboundary at this pin (`fn f(r: Range)` is E0301 in wolfc), so the two\noffsets are spelled as two parameters — the same interim `str.get`\ncarries, flipping together with it.\n\nO(len(b)), as `insert`: the contents read as a `str` once, sliced, and\nthe buffer refilled in its own storage.\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"the wolf\")\nstrbuf.remove(mut b, 0, 4)\nstrbuf.to_str(b) == \"wolf\"\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 263,
          "tier": "core"
        },
        {
          "name": "truncate",
          "kind": "fn",
          "signature": "pub fn truncate(mut b: StrBuf, n: int)",
          "doc": "Shortens the buffer to `n` bytes, dropping everything after. Keeps the\nbuffer usable and is a no-op when `n == len(b)`.\n\nTraps `bounds` when `n` exceeds the length or splits a code point (D25)\n— truncation is exactly a checked slice.\n\nO(len(b) - n) when `n` is a boundary: the bytes past it are popped off\nthe backing list, which keeps its storage. A length that is not a\nboundary — negative, past the end, or on a UTF-8 continuation byte —\nis handed to the language's checked slice of the contents, which\nraises the trap exactly as `s[..n]` does.\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"wolf-lang\")\nstrbuf.truncate(mut b, 4)\nstrbuf.to_str(b) == \"wolf\"\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 290,
          "tier": "core"
        },
        {
          "name": "clear",
          "kind": "fn",
          "signature": "pub fn clear(mut b: StrBuf)",
          "doc": "Empties the buffer, keeping it usable. Total: no error row, no traps.\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"wolf\")\nstrbuf.clear(mut b)\nstrbuf.len(b) == 0\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 315,
          "tier": "core"
        },
        {
          "name": "to_str",
          "kind": "fn",
          "signature": "pub fn to_str(b: StrBuf) -> str",
          "doc": "The buffer's contents as a `str`. A borrow of the buffer's bytes under\nD24's auto-borrow story — `as_`/bare-noun territory in\nAPI-CONVENTIONS §1 rather than an allocating `to_`. The name is the\ncontract's. Over the byte list the value is a COPY, made once:\nO(len(b)), the bytes validated and copied into a fresh `str` in the\nambient region (`str_from_utf8`), and the builder stays usable. Read\nit once, at the end of a build, not once per push. Total: no error\nrow, no traps — the contents are UTF-8 by construction (every append\nis a `str`'s bytes or a scalar's encoding, and every cut is checked at\na code-point boundary), so the decoder's `utf8` row cannot arise; were\nit ever to, `to_str` traps `assert` rather than answer wrong text.\n\n```wolf-doc-example\nvar b = strbuf.new()\nstrbuf.push_str(mut b, \"wolf\")\nstrbuf.to_str(b) == \"wolf\"\n```",
          "source": "std/strbuf/strbuf.lu",
          "line": 336,
          "tier": "core"
        }
      ]
    },
    {
      "name": "term",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.term — the controlling terminal: whose turn it is, and how it reads.\nStability tier: core. The facade over wolf-lang's `[os.term]` (s219).\n\n**Whose turn.** One process group at a time is the terminal's\nFOREGROUND: the group its Ctrl-C, Ctrl-\\ and Ctrl-Z signal and the only\none that may read it. A job-control shell hands the foreground to a job\n(`std.process.start_job` does it in the child, before the job runs) and\ntakes it back with `set_foreground(tty, group())` when the job ends.\nThe setters block `SIGTTOU` for their own duration, so a shell outside\nthe foreground is not stopped for taking its terminal back.\n\n**How it reads.** A `Mode` is the things an interactive program\nchanges: `canonical` (a line at a time, with the terminal's own\nediting), `echo`, `signals` (Ctrl-C, Ctrl-\\ and Ctrl-Z become signals),\n`flow` (Ctrl-S and Ctrl-Q pause and resume output and never reach the\nprogram), `extended` (the host's extended input: literal next, word\nerase, reprint, discard), the three a terminal does not usually have\n(`raw_cr`: a typed carriage return reaches the program as CR, not LF;\n`raw_output`: a written LF reaches the terminal as LF, not CR LF;\n`strip8`: input stripped to seven bits) and, when not canonical, how a\nread waits — `min` bytes, or `time` tenths of a second. Every other\nsetting is left as found, so a mode read and set back restores exactly\nwhat was changed. Save it, change it, put it back\n(`term.set_mode(tty, saved)`); or, since wolf 0.2.34, register the put\nback with the runtime (`restore_at_exit`), which then makes it on\nevery exit the runtime owns, a trap's included.\n\n**`flow` and `extended` before wolf 0.2.30.** The runtime gained the\ntwo bits in wolf 0.2.30 (s234); from then a mode without them turns\nflow control and extended input off. Before it the runtime never\nreports them (`mode` answers both `false`) and refuses a mode that\ncarries them (`invalid`), and a set leaves both as found. A mode read\nand set back is therefore exact on either side; a `Mode` built by hand\nsays what it wants of both.\n\n**`raw_cr`, `raw_output` and `strip8` before wolf 0.2.34.** The\nruntime gained bits 5, 6 and 7 in wolf 0.2.34 (s248, ruling #97 R7),\neach a setting the usual terminal does NOT have, so a 0 in each is\nthe usual setting: `ICRNL` on, `OPOST` on, `ISTRIP` off. From then a\nmode without them writes the usual setting back where the terminal\nhad another (`stty -opost`); before it the runtime never reports them\n(`mode` answers all three `false`), refuses a mode that carries them\n(`invalid`) and leaves the three flags as found. A mode read and set\nback through `mode`, `unpack` and `pack` is exact on either side, and\non a usual terminal every mode `pack` made before them packs the same\nint.\n\n**What a line editor asks of it** (wolf 0.2.30, s234, ruling #73):\nthe window's `size` (and `signal.resize()` when it changes) and the\nkeys the user chose for erase, kill, interrupt and the rest (`chars`)\n— spellings ruled #82. The wait that a key or a signal ends is\n`signal.wait_fd` (ruling #82: the signal family's, and any descriptor\nserves), so an editor blocks there instead of in a read a signal\ncannot tear; since wolf 0.2.34 `signal.wait_fds` waits on the\nterminal, a job's pipes and the signals at once, with a deadline\n(the 25 ms that tells a lone ESC from an escape sequence). Nothing\nhere sets the special characters, and nothing restores the mode when\na program dies of a signal nobody listened for (no code of the\nprocess runs then, the runtime's included).\n\n**Errors are rows.** A handle that is closed, forged or not a terminal\nis `io`; a mode outside the bits is `invalid` (unreachable through\n`Mode`, whose fields are clamped, but for `flow` or `extended` before\nwolf 0.2.30 and the three bits before 0.2.34); every call is\n`unsupported` on windows. lupin answers the shape rows and declines\nevery call that reaches the terminal by name; from lupin 0.1.56 its\nshape takes bits 5–7 (0.1.55 refused them `invalid`, wolf-interp#268)\nand `os_term_restore_at_exit` answers its shape and `io` rows.\n\n**A terminal for a program this one runs** (sc81, wolf 0.2.39's s292:\n`[os.term.pty]`, `[os.term.size.set]`, `[os.term.attr]`). `open_pty`\nmakes a pseudo-terminal, a `Pty`: what the program on its `slave`\nwrites is read from its `master`, and what is written to the master is\nthe terminal's input, taken by its line discipline. `pty_name` is the\nslave's name, `set_size` sets the window's size with RFC 4254's pixel\nfields (the foreground group hears `signal.resize()` when any of the\nfour changes), and `attr` and `set_attr` read and set one setting by\nits RFC 4254 opcode, as an SSH client sends them. A child takes the\nslave as its controlling terminal with `open_controlling`, after\n`std.process.lead_session`; `Pty` says the whole order, which is an\nssh server's answer to a `pty-req`. The master is an `fs.File`:\n`signal.wait_fds` waits on it, `fs.set_nonblock` and `fs.write_some`\nwrite to it without blocking, and `fs.read_chunk` reads it.\n\n**Capability:** `foreground`, `mode`, `set_mode`, `restore_at_exit`,\n`size`, `chars`, `pty_name`, `set_size`, `attr` and `set_attr` are `io`\n(they act on a descriptor the program holds, as `io.is_terminal`);\n`set_foreground`, `open_pty` (with `process.pipe`: a pty is made to run\na program on) and `open_controlling` (it changes the process's\nterminal) are `exec`, and `group` `env` (process context).\n`pack`, `unpack`, `raw`, `raw_bytes`, `chars_from` and\n`char_disabled` are pure, comptime-safe.",
      "summary": "std.term — the controlling terminal: whose turn it is, and how it reads.",
      "items": [
        {
          "name": "Mode",
          "kind": "struct",
          "signature": "pub struct Mode { canonical: bool, echo: bool, signals: bool, flow: bool, extended: bool, raw_cr: bool, raw_output: bool, strip8: bool, min: int, time: int, }",
          "doc": "The terminal's mode, unpacked (`[os.term.mode]`). `raw_cr`,\n`raw_output` and `strip8` (wolf 0.2.34) are each `false` on a usual\nterminal: a typed Enter reads as LF, a written LF reaches the screen\nas CR LF, and input keeps its eighth bit.",
          "source": "std/term/term.lu",
          "line": 102,
          "tier": "core"
        },
        {
          "name": "pack",
          "kind": "fn",
          "signature": "pub fn pack(m: Mode) -> int",
          "doc": "The packed int the builtin reads: canonical=1, echo=2, signals=4,\nflow=8, extended=16, raw_cr=32, raw_output=64, strip8=128, `min` in\nbits 8..15, `time` in bits 16..23 (`[os.term.mode]`).\n`pack(unpack(v)) == v` for every mode the runtime reports, and a\n`Mode` whose three new fields are `false` packs the int it packed\nbefore wolf 0.2.34.",
          "source": "std/term/term.lu",
          "line": 131,
          "tier": "core"
        },
        {
          "name": "unpack",
          "kind": "fn",
          "signature": "pub fn unpack(v: int) -> Mode",
          "doc": "The `Mode` a packed int names.",
          "source": "std/term/term.lu",
          "line": 161,
          "tier": "core"
        },
        {
          "name": "mode",
          "kind": "fn",
          "signature": "pub fn mode(tty: fs.File) -> Mode ! {unsupported, io}",
          "doc": "The terminal's mode now.",
          "source": "std/term/term.lu",
          "line": 177,
          "tier": "core"
        },
        {
          "name": "set_mode",
          "kind": "fn",
          "signature": "pub fn set_mode(tty: fs.File, m: Mode) -> () ! {unsupported, invalid, io}",
          "doc": "Set the terminal's mode (output already written drains first; input\nalready typed is kept).",
          "source": "std/term/term.lu",
          "line": 183,
          "tier": "core"
        },
        {
          "name": "raw",
          "kind": "fn",
          "signature": "pub fn raw(m: Mode) -> Mode",
          "doc": "`m` with input a key at a time: not canonical, no echo, no flow\ncontrol and no extended input, one byte per read, no timer, so Ctrl-S,\nCtrl-Q, Ctrl-V and Ctrl-O arrive as keys, as `cfmakeraw(3)` leaves\nthem. `signals` is kept, so Ctrl-C still interrupts (ruling #81:\n`raw` clears `flow` and `extended`). Before wolf 0.2.30 the runtime\ncannot clear the two, so there they stay as found. `raw_cr`,\n`raw_output` and `strip8` are kept as `m` has them, so `raw` sets on\nevery terminal what it set before wolf 0.2.34: Enter still reads as\nLF and a written LF still reaches the screen as CR LF on a usual one\n(`raw_bytes` turns both off).",
          "source": "std/term/term.lu",
          "line": 197,
          "tier": "core"
        },
        {
          "name": "raw_bytes",
          "kind": "fn",
          "signature": "pub fn raw_bytes(m: Mode) -> Mode",
          "doc": "`raw(m)` with every byte passed through untranslated, both ways:\n`raw_cr` and `raw_output` on and `strip8` off, so a typed Enter reads\nas CR (13), not LF (10, Ctrl-J's byte), a written LF reaches the\nterminal alone, and input keeps its eighth bit. That is an editor's\nraw mode, as C yew sets it (`cfmakeraw(3)`'s set as far as a `Mode`\nreaches it; `signals` is kept, as `raw` keeps it, and an editor that\nwants Ctrl-C as a key clears it). A program in this mode writes CR LF\nwhere it means a new line. Pure and comptime-safe (sc69, ruling #97\nR7: wolf 0.2.34's bits 5–7).\n\n```wolf-doc-example\nlet cooked = term.unpack(1 + 2 + 4 + 8 + 16)\nlet r = term.raw_bytes(cooked)\nr.raw_cr == true && r.raw_output == true && r.strip8 == false\nterm.pack(r) == 4 + 32 + 64 + 256\nterm.pack(term.raw(cooked)) == 4 + 256\n```",
          "source": "std/term/term.lu",
          "line": 229,
          "tier": "core"
        },
        {
          "name": "restore_at_exit",
          "kind": "fn",
          "signature": "pub fn restore_at_exit(tty: fs.File, m: Mode, bytes: List[byte]) -> () ! { invalid, io, unsupported, }",
          "doc": "**s248 (`[os.term.restore]`, ruling #93 R1 C): put the terminal back\non every exit the runtime owns.** Registers, for this process, a\nrestore of `tty`: when the process ends — a return from `main`,\n`process.exit`, an error from `main`, a trap (after its report), the\nstack guard's report, `process.exit_signal` (before its raise), the\ndeath of the proc root — the runtime sets `m` exactly as `set_mode`\nsets it and then writes `bytes` to the terminal (an editor's\nalternate-screen leave and cursor show). The restore runs in the\nruntime, never in a handler of the program's. One registration a\nprocess: the last call wins, and each restore runs once. The runtime\nholds its own duplicate of the descriptor from the call, so a `tty`\nthe program closes first still restores, and the bytes are copied at\nthe call. Register the mode to come back to (the one `mode` read\nbefore the program changed it); registering first and changing the\nmode after is the usual order.\n\n**What it does not cover:** a death by a signal nobody listened for —\n`KILL`, a `TERM` or `HUP` under the default, a fault outside the stack\nguard — runs no code of the process, so nothing is restored (listen\nfor `terminate()`, `reload()` and `quit()` and end through `exit`);\n`process.exec` replaces the image and the registration with it; a\nchild a `process.fork` makes restores nothing.\n\nRows: `invalid` for a mode outside the bits (unreachable through\n`Mode`); then `unsupported` on windows; then `io` for a handle that is\nclosed, forged or not a terminal, or a duplicate the host will not\nmake (ruling #97 R1). Never traps. The checked machine restores on\nits own end, whatever the verdict (R8); lupin 0.1.56 answers the shape\nand `io` rows and refuses a well-formed registration by name (0.1.55\ndid not resolve the call, wolf-interp#268).\n\nCapability `io` (uncharged, as `set_mode`; ruling #97 R5); refused at\ncomptime. Delegates to `os_term_restore_at_exit`. The example is\nprose, since a handle comes from `std.fs`: an editor reads `saved =\nterm.mode(tty)?`, registers `term.restore_at_exit(tty, saved,\nleave)?` with the bytes that leave its alternate screen, then sets\n`term.raw_bytes(saved)`; a trap no longer leaves the shell raw.",
          "source": "std/term/term.lu",
          "line": 282,
          "tier": "core"
        },
        {
          "name": "foreground",
          "kind": "fn",
          "signature": "pub fn foreground(tty: fs.File) -> int ! {unsupported, io}",
          "doc": "The terminal's foreground process group.",
          "source": "std/term/term.lu",
          "line": 291,
          "tier": "core"
        },
        {
          "name": "set_foreground",
          "kind": "fn",
          "signature": "pub fn set_foreground(tty: fs.File, group_id: int) -> () ! {unsupported, io}",
          "doc": "Make `group_id` the terminal's foreground process group.",
          "source": "std/term/term.lu",
          "line": 296,
          "tier": "core"
        },
        {
          "name": "group",
          "kind": "fn",
          "signature": "pub fn group() -> int ! {unsupported}",
          "doc": "This process's own process group.",
          "source": "std/term/term.lu",
          "line": 301,
          "tier": "core"
        },
        {
          "name": "Size",
          "kind": "struct",
          "signature": "pub struct Size { rows: int, columns: int, }",
          "doc": "The terminal's window size (`[os.term.size]`): `rows` lines of\n`columns` cells each.",
          "source": "std/term/term.lu",
          "line": 307,
          "tier": "core"
        },
        {
          "name": "size",
          "kind": "fn",
          "signature": "pub fn size(tty: fs.File) -> Size ! {unsupported, io}",
          "doc": "The window's size as the terminal holds it: what the emulator last\ntold it, or what `stty rows … cols …` set (`TIOCGWINSZ`).\n\nA size the terminal was never told is 0 (a pseudo-terminal nobody\nsized): fall back on `COLUMNS` or 80, as without the call. When the\nwindow changes, the foreground group hears `signal.resize()`, and the\nnext call answers the new size.\n\nRows: `io` for a handle that is closed, forged or not a terminal;\n`unsupported` on windows. Never traps. lupin declines by name (it has\nno `ioctl`), so the example is prose: `term.size(tty)?.columns` is the\nwidth an editor lays a line out in.\n\nCapability `io` (uncharged, as `mode`). Delegates to `os_term_size`.\nSpelling ruled #82 (`Size`'s named fields over the builtin's pair).",
          "source": "std/term/term.lu",
          "line": 327,
          "tier": "core"
        },
        {
          "name": "set_size",
          "kind": "fn",
          "signature": "pub fn set_size(tty: fs.File, s: Size, xpixels: int, ypixels: int) -> () ! { invalid, io, unsupported, }",
          "doc": "**s292 (`[os.term.size.set]`, sc81): set the window's size** of the\nterminal `tty` names, as an emulator or `stty rows … cols …` does: `s`\nis the rows and the columns `size` reads back, on either end of a\npseudo-terminal, and `xpixels` and `ypixels` the window's width and\nheight in pixels, RFC 4254's two other fields (0 when the client does\nnot know). The pixels are written at every call, so a server cannot\ndrop what a client sent: a change of the pixels alone signals too.\n\nWhen any of the four changes, the host sends `signal.resize()` to the\nterminal's foreground group (the program on a pty's slave), and the\nsame four again send nothing. An ssh server calls this on the master\nfor the `pty-req` and for each `window-change`.\n\nRows, in the order they are decided: `invalid` for any of the four\noutside `0..65535`, before the handle is read; `unsupported` on\nwindows; `io` for a handle that is closed, forged or not a terminal.\nNever traps. lupin 0.1.61 answers the shape and handle rows and\nrefuses a set on a terminal by name.\n\nCapability `io` (uncharged, as `set_mode`); refused at comptime.\nDelegates to `os_term_set_size`. The example is prose, since a handle\ncomes from `std.fs`: a `window-change` of 120 columns, 40 rows, 960 by\n640 pixels is `term.set_size(p.master, term.Size { rows: 40, columns:\n120 }, 960, 640)?`, and `term.size(p.slave)?.columns` is 120 after.",
          "source": "std/term/term.lu",
          "line": 356,
          "tier": "core"
        },
        {
          "name": "Pty",
          "kind": "struct",
          "signature": "pub struct Pty { master: fs.File, slave: fs.File, }",
          "doc": "A pseudo-terminal (`[os.term.pty]`): two `std.fs` files, the\n`master`, which the program that made it keeps, and a `slave`, the\nterminal another program runs on. Bytes written to the master are the\nterminal's input, taken by its line discipline (echo, editing, the\nsignal characters); what the program writes to the slave is read from\nthe master. Both are close-on-exec: neither reaches a child except\nthrough a descriptor map.\n\n**Who closes what, in the order a server follows** (an ssh server's\nanswer to a `pty-req`, which `std.process.fork` and the calls here\nmake together):\n\n1. `let p = term.open_pty()?` and `let name = term.pty_name(p.master)?`.\n2. `term.set_size(p.master, …)` and `term.set_attr(p.master, op, v)`\n   for each mode the client sent (an op the host lacks is\n   `unsupported`; pass over it).\n3. `let f = process.fork()?`. **In the child:**\n   `process.lead_session()?`, then `var tty = term.open_controlling(name)?`,\n   then the program with `tty` on 0, 1 and 2 (`process.set_stdin`,\n   `set_stdout`, `set_stderr`) by `process.exec`. The child keeps the\n   slave it inherited until its own open (macOS puts a terminal's size\n   and settings back when its slave is opened while no descriptor of it\n   is open); the exec closes the inherited master and slave, being\n   close-on-exec.\n4. **In the parent:** `fs.close(take p.slave)?` after the fork, then\n   relay the master: `signal.wait_fds` waits on it, `fs.set_nonblock`\n   with `fs.write_some` writes what it takes, `fs.read_chunk` reads what\n   is there; `set_size` at each window change; `fs.close(take\n   p.master)` at the end, which hangs the terminal up for the program.\n\n**The end, read on the master.** Once every descriptor of the slave is\nclosed (the program and everything it started have ended), a read of\nthe master answers `io` on linux (the host's `EIO`, 5 in `os_error()`)\nand `eof` on macOS; either ends the relay. After the master's last\nclose the slave's name is gone.",
          "source": "std/term/term.lu",
          "line": 399,
          "tier": "core"
        },
        {
          "name": "open_pty",
          "kind": "fn",
          "signature": "pub fn open_pty() -> Pty ! {io, unsupported}",
          "doc": "**s292 (`[os.term.pty]`, sc81): a new pseudo-terminal**, its master and\na slave, both close-on-exec; the slave granted and unlocked, and\nneither end this process's controlling terminal, whatever it leads.\n\nRows: `unsupported` on windows, by name; `io` for a host that cannot\nmake one (no `/dev/ptmx`, none free, the descriptor limit), with the\nhost's number in `os_error()`, and nothing left open. Never traps.\nThe checked machine opens the pair in the `wolf` process. lupin 0.1.61\nrefuses the call by name (Rust's standard library has no\n`posix_openpt`), so the example is prose: `let p = term.open_pty()?`,\nthen `term.pty_name(p.master)?` is `/dev/pts/N` on linux.\n\nCapability `exec` (with `process.pipe`: a pty is made to run a program\non); refused at comptime. Delegates to `os_term_open_pty`.",
          "source": "std/term/term.lu",
          "line": 418,
          "tier": "core"
        },
        {
          "name": "pty_name",
          "kind": "fn",
          "signature": "pub fn pty_name(master: fs.File) -> str ! {io, unsupported}",
          "doc": "**s292 (`[os.term.pty]`, sc81): the slave's name** for the master\n`master` names: `/dev/pts/N` on linux and PAX, `/dev/ttysN` on macOS.\nA child opens it by this name to take it as its controlling terminal\n(`open_controlling`).\n\nRows: `unsupported` on windows; `io` for a handle that is closed,\nforged or not a master (a file, a slave, another terminal). Never\ntraps. lupin 0.1.61 answers a closed or forged handle's `io` and\nrefuses the rest by name.\n\nCapability `io` (uncharged, with `mode`); refused at comptime.\nDelegates to `os_term_pty_name`. The example is prose, since a handle\ncomes from `std.fs` or `open_pty`: `term.pty_name(p.master)?` names the\nslave, and `term.pty_name(p.slave)` is `io`.",
          "source": "std/term/term.lu",
          "line": 437,
          "tier": "core"
        },
        {
          "name": "attr",
          "kind": "fn",
          "signature": "pub fn attr(tty: fs.File, op: int) -> int ! {invalid, io, unsupported}",
          "doc": "**s292 (`[os.term.attr]`, sc81): one setting of the terminal `tty`\nnames, by its RFC 4254 section 8 opcode** (with RFC 8160's 42, IUTF8):\na special character, 1 to 18, as its byte or -1 for disabled (as\n`chars` reads it); a flag (30 to 42 input, 50 to 62 local, 70 to 75\noutput, 92 and 93 control) as 0 or 1; the character size, 90 CS7 and 91\nCS8, 1 for the size the terminal has; the speeds, 128 input and 129\noutput, in bits per second. The opcode is the published number an SSH\nclient sends, and it is the vocabulary here.\n\nRows, in the order they are decided: `invalid` for an opcode outside\nthe vocabulary (0, 19..29, 43..49, 63..69, 76..89, 94..127, 130 and up,\na negative); `unsupported` on windows, for an op the host's terminal\ndriver lacks (linux 11, 15 and 17; macOS 15, 16, 37, 52 and 71) and for\na speed the runtime's table does not name; `io` for a handle that is\nclosed, forged or not a terminal. Never traps. lupin 0.1.61 answers\nevery row decided before a terminal is reached and refuses the rest by\nname.\n\nCapability `io` (uncharged, as `mode`); refused at comptime. Delegates\nto `os_term_attr`. The example is prose, since a handle comes from\n`std.fs` or `open_pty`: `term.attr(p.slave, 53)?` is 1 while the\nterminal echoes, and `term.attr(p.slave, 19)` is `invalid` on every\nhost.",
          "source": "std/term/term.lu",
          "line": 464,
          "tier": "core"
        },
        {
          "name": "set_attr",
          "kind": "fn",
          "signature": "pub fn set_attr(tty: fs.File, op: int, value: int) -> () ! {invalid, io, unsupported}",
          "doc": "**s292 (`[os.term.attr]`, sc81): set one setting of the terminal `tty`\nnames, by its RFC 4254 opcode**, every other field as found (output\nalready written drains first, as `set_mode`). `value` is in the op's\nrange (`attr` names them): a character -1..255 (a byte equal to the\nhost's disabled value disables it too), a flag 0 or 1, a size 0 or 1\n(1 selects it; 0 leaves the size as found, since a client sends both),\na speed in bits per second from the runtime's table (0, 50, 75, 110,\n134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400,\n57600, 115200, 230400). The setting is read back after the set, so an\nanswer of `()` means the terminal holds what was asked.\n\nRows, in the order they are decided: `invalid` for an opcode outside\nthe vocabulary or a value outside its op's range; `unsupported` on\nwindows, for an op the host lacks, for a speed not in the table, and\nfor a set the host did not keep (linux's pseudo-terminal keeps neither\nCS7 nor PARENB; macOS keeps a set PENDIN), with every other field as it\nwas; `io` for a handle that is closed, forged or not a terminal, and\nfor any other refusal of the host's. Never traps. A server applying a\nclient's modes passes over `unsupported`, as `sshd` does. lupin 0.1.61\nanswers every row decided before a terminal is reached and refuses the\nrest by name.\n\nCapability `io` (uncharged, as `set_mode`); refused at comptime.\nDelegates to `os_term_set_attr`. The example is prose, since a handle\ncomes from `std.fs` or `open_pty`: a client's `ECHO 0` is\n`term.set_attr(p.master, 53, 0)?`, and `term.set_attr(p.master, 53, 2)`\nis `invalid` on every host.",
          "source": "std/term/term.lu",
          "line": 495,
          "tier": "core"
        },
        {
          "name": "open_controlling",
          "kind": "fn",
          "signature": "pub fn open_controlling(name: str) -> fs.File ! {denied, io, not_found, unsupported}",
          "doc": "**sc81: open the terminal `name` as THIS process's controlling\nterminal** — the step a pty's program takes in its own session, after\n`std.process.lead_session`, so that the terminal's interrupt, quit and\nsuspend keys, its hangup and `signal.resize()` reach it and `/dev/tty`\nopens (`[os.term.pty]`, `[os.term.session]`). The answer is the\nterminal, open for reading and writing, to be placed on 0, 1 and 2\nfor the program's exec; it is this process's controlling terminal, with\nthis process's group its foreground.\n\nIt is the open the runtime makes without `O_NOCTTY`: a session leader\nwith no controlling terminal that opens a terminal no session holds\ntakes it. The call checks that it did, because nothing else would say\nso: an open made before `lead_session`, or from a process that leads\nnone, or of a terminal another session holds, gives a terminal that is\nnot the controlling one, and a program on it gets no job control and no\nkeys' signals.\n\nRows, in the order they are decided: `unsupported` on windows, before\nthe name is looked at; `not_found` for a name that does not exist;\n`io` for one that is not a character device, without opening it (so\nnothing is created); `denied` for an open the host refuses; `io` for\none that is not a terminal, or did not become this process's\ncontrolling terminal with its group in the foreground — the file is\nclosed then, and the terminal is not held. Never traps. The checked\nmachine opens in the `wolf` process. lupin 0.1.61 refuses the call by\nname (at `os_pgid`).\n\nCapability `exec` (it changes the process's terminal, as\n`set_foreground`); refused at comptime. Delegates to `fs_stat`,\n`fs_open_mode` (mode 3), `os_isatty`, `os_term_foreground` and\n`os_pgid`. The example is prose, since the call that succeeds takes a\nterminal: in a fork's child, `process.lead_session()?`, then\n`var tty = term.open_controlling(name)?` and `term.foreground(tty)? ==\nterm.group()?`.",
          "source": "std/term/term.lu",
          "line": 533,
          "tier": "core"
        },
        {
          "name": "Chars",
          "kind": "struct",
          "signature": "pub struct Chars { erase: int, kill: int, interrupt: int, quit: int, suspend: int, end_of_file: int, word_erase: int, literal_next: int, start: int, stop: int, reprint: int, discard: int, }",
          "doc": "The terminal's special characters (`[os.term.chars]`): the byte the\nuser chose for each (`stty erase ^H`), or `char_disabled()` for one\nthat is disabled (`stty intr undef`). `word_erase`, `literal_next`,\n`reprint` and `discard` are not POSIX's; both hosts have them, and\nthey act only with `Mode.extended` on.",
          "source": "std/term/term.lu",
          "line": 563,
          "tier": "core"
        },
        {
          "name": "char_disabled",
          "kind": "fn",
          "signature": "pub fn char_disabled() -> int",
          "doc": "The word `Chars` holds for a character that is disabled: -1, the\nbuiltin's own (`[os.term.chars]`; the host's disabled value never\nreaches the program). Total and pure.\n\n```wolf-doc-example\nterm.char_disabled() == 0 - 1\n```",
          "source": "std/term/term.lu",
          "line": 585,
          "tier": "core"
        },
        {
          "name": "chars_from",
          "kind": "fn",
          "signature": "pub fn chars_from(v: List[int]) -> Chars",
          "doc": "The `Chars` a list in `[os.term.chars]`'s order names: erase, kill,\ninterrupt, quit, suspend, end of file, word erase, literal next,\nstart, stop, reprint, discard. An entry the list does not reach is\n`char_disabled()`; entries past the twelfth are not read (the\nbuiltin's list grows only at its end). Total and pure.\n\n```wolf-doc-example\nvar v = List[int]()\n(mut v).push(127)\n(mut v).push(21)\n(mut v).push(3)\nlet c = term.chars_from(v)\nc.erase == 127 && c.interrupt == 3 && c.discard == term.char_disabled()\n```",
          "source": "std/term/term.lu",
          "line": 614,
          "tier": "core"
        },
        {
          "name": "chars",
          "kind": "fn",
          "signature": "pub fn chars(tty: fs.File) -> Chars ! {unsupported, io}",
          "doc": "The terminal's special characters now. A line editor that turns\n`canonical` and `signals` off reads these first, so erase, kill,\ninterrupt and end of file keep the keys the user set. Nothing here\nsets them (`stty` does).\n\nRows: `io` for a handle that is closed, forged or not a terminal;\n`unsupported` on windows. Never traps. lupin declines by name (it has\nno `tcgetattr`); the example is prose: `term.chars(tty)?.erase` is\nthe key that deletes a character.\n\nCapability `io` (uncharged, as `mode`). Delegates to `os_term_chars`.\nSpelling ruled #82 (`Chars`' named fields, with `chars_from` and\n`char_disabled`).",
          "source": "std/term/term.lu",
          "line": 644,
          "tier": "core"
        }
      ]
    },
    {
      "name": "testing",
      "group": "Foundations and ordering",
      "tier": "core",
      "doc": "std.testing — the assertion vocabulary, and the conventions that hold\nuntil `wolf test` exists (s39). Stability tier: core.\n\n**`assert(cond)` and `assert(cond, msg)` are INTRINSICS, not functions\nhere.** One name in both tiers — comptime witness (s16) and runtime\nuser trap (`[conf.trap.map]`: `assert`) — silent and effect-free when\nsatisfied, trapping at the call's span when not. This module\ndeliberately defines nothing called `assert`: a module item shadows\nthe intrinsic module-wide (file boundaries create no scopes) and there\nis no arity overloading, so a helper named `assert` would sever every\nfunction here from the trap it raises.\n\nThe two-argument form WORKS at these pins and the sc01 interim is\nretired with this sprint. It landed broken — `assert(1 == 1, \"msg\")`\ntrapped even when the condition held (F-0020) — so sc01 through sc05\nwrote `if !cond { testing.fail(msg) }` everywhere. That spelling is no\nlonger required: `assert(cond, msg)` is the msg-carrying assertion,\n`msg` is evaluated only on the failing path, and both implementations\nagree. The old spelling still works and the existing tests were not\nchurned to change it.\n\n**A trap ends the process, so trap-testing is the RIG's job** (D30: no\nunwinding, no `catch`, no `recover` — this track will not be the one\nto bend it). The convention that follows, binding for every sc sprint\nand restated in API-CONVENTIONS §13:\n\n- Happy-path assertions GROUP into one entry file per theme. Grouping\n  is safe only because none of them trap when the code is right.\n- Every trap expectation is its OWN entry file, with\n  `check: run(exit=trap(kind))` naming the kind. One trap ends the\n  program, so a second expectation in the same file would never run.\n- Error-row expectations assert through `else |Tag(p)|`, tag AND\n  payload — the binding in `else |e|` is the tag itself and has no\n  members (`std.errors`' test is the worked example).\n- Table tests are a `List` of tuples plus a loop, until closures (c05).\n- Golden output rides the directive's `stdout=` hash; fixtures are\n  shared, never inlined twice.\n\n`cargo xtask std-test --lint-conventions` checks the mechanical half\nof that list, so it is a gate rather than a wish.\n\n**What executes, and what is freight.** Five of the twelve functions\nbelow are monomorphic and run: `fail`, `unreachable`, `todo`,\n`assert_near`, `assert_ulps`. The comparison family — `assert_eq`,\n`assert_ne`, `assert_lt`, `assert_le`, `assert_gt`, `assert_ge`,\n`assert_contains` — is generic over `cmp.Eq`/`cmp.Ord`, and NO\nimplementation executes trait dispatch at these pins (F-0002,\nF-0004): the bodies typecheck against their bounds through wolfc's mem\nrung and run nowhere. That is stated per function rather than hidden,\nand it is the single largest reason this module is smaller in practice\nthan it looks: at these pins the assertion a test actually writes is\n`assert(a == b, \"…\")` on concrete types, and these helpers are the\nnames that become useful the day dispatch lands.\n\n**The thirteenth is in the nursery.** `assert_starts_with` lives in\n`std/x/testing_text`, and the measurement that put it there is worth\nrecording: a builtin `str` method ANYWHERE in this module makes every\nimporter of `std.testing` `unsupported` at resolve under wolfc\n(F-0018's resolve-level half). One helper would have cost the whole\nassertion floor its compiler lane — `fail`, `unreachable` and `todo`\nrun there today — so it waits outside the facade and graduates in\nverbatim when `str` methods resolve.\n\n**Rendering stops at the relation.** No helper renders the values it\ncompared: a generic renderer needs `Show` (F-0033) and the s38\ndispatch hook. `assert_eq` says which side of the relation broke and\nnothing else — a diff that lies about types would be worse than a\nsentence that admits it cannot show them.",
      "summary": "std.testing — the assertion vocabulary, and the conventions that hold until `wolf test` exists (s39).",
      "items": [
        {
          "name": "fail",
          "kind": "fn",
          "signature": "pub fn fail(msg: str)",
          "doc": "Unconditional failure: prints `msg` on one line, then traps `assert`\n(`[conf.trap.map]`). Never returns normally.\n\nExample (prose — a trapping call cannot sit in a boolean example):\n`testing.fail(\"unreached branch\")` prints\n`FAILED: unreached branch` and traps `assert`.",
          "source": "std/testing/testing.lu",
          "line": 81,
          "tier": "core"
        },
        {
          "name": "unreachable",
          "kind": "fn",
          "signature": "pub fn unreachable()",
          "doc": "Marks code that must never execute; reaching it is the bug. Traps\n`assert` via `fail`. Never returns normally.",
          "source": "std/testing/testing.lu",
          "line": 88,
          "tier": "core"
        },
        {
          "name": "todo",
          "kind": "fn",
          "signature": "pub fn todo(msg: str)",
          "doc": "Marks unfinished code: reaching it traps `assert` via `fail`, naming\n`msg` as what remains to build. Never returns normally.",
          "source": "std/testing/testing.lu",
          "line": 94,
          "tier": "core"
        },
        {
          "name": "assert_eq",
          "kind": "fn",
          "signature": "pub fn assert_eq[T: cmp.Eq](a: T, b: T)",
          "doc": "Asserts `a` equals `b` under `cmp.Eq`; a miss prints one line and\ntraps `assert`. Values are not rendered (`Show`, F-0033).\n\nBLOCKED from executing: trait dispatch runs in no implementation at\nthese pins (F-0002 / F-0004), so this body's evidence is its static\nladder. Write `assert(a == b, \"…\")` on concrete types meanwhile.",
          "source": "std/testing/testing.lu",
          "line": 104,
          "tier": "core"
        },
        {
          "name": "assert_ne",
          "kind": "fn",
          "signature": "pub fn assert_ne[T: cmp.Eq](a: T, b: T)",
          "doc": "Asserts `a` differs from `b` under `cmp.Eq`; equality prints one line\nand traps `assert`. Values are not rendered (`Show`, F-0033).\n\nBLOCKED from executing, as `assert_eq` (F-0002 / F-0004).",
          "source": "std/testing/testing.lu",
          "line": 112,
          "tier": "core"
        },
        {
          "name": "assert_lt",
          "kind": "fn",
          "signature": "pub fn assert_lt[T: cmp.Ord](a: T, b: T)",
          "doc": "Asserts `a < b` under `cmp.Ord`. A miss prints one line and traps\n`assert`.\n\nBLOCKED from executing (F-0002 / F-0004), and doubly so for a reason\nworth knowing: the verdict comes back as a `cmp.Ordering`, and an\nenum's values cross a module boundary while nothing that INSPECTS them\ndoes (F-0029) — so even with dispatch, reading this result outside\n`std.cmp` needs that filing closed too.",
          "source": "std/testing/testing.lu",
          "line": 124,
          "tier": "core"
        },
        {
          "name": "assert_le",
          "kind": "fn",
          "signature": "pub fn assert_le[T: cmp.Ord](a: T, b: T)",
          "doc": "Asserts `a <= b` under `cmp.Ord`. A miss prints one line and traps\n`assert`. BLOCKED from executing exactly as `assert_lt`.",
          "source": "std/testing/testing.lu",
          "line": 131,
          "tier": "core"
        },
        {
          "name": "assert_gt",
          "kind": "fn",
          "signature": "pub fn assert_gt[T: cmp.Ord](a: T, b: T)",
          "doc": "Asserts `a > b` under `cmp.Ord`. A miss prints one line and traps\n`assert`. BLOCKED from executing exactly as `assert_lt`.",
          "source": "std/testing/testing.lu",
          "line": 138,
          "tier": "core"
        },
        {
          "name": "assert_ge",
          "kind": "fn",
          "signature": "pub fn assert_ge[T: cmp.Ord](a: T, b: T)",
          "doc": "Asserts `a >= b` under `cmp.Ord`. A miss prints one line and traps\n`assert`. BLOCKED from executing exactly as `assert_lt`.",
          "source": "std/testing/testing.lu",
          "line": 145,
          "tier": "core"
        },
        {
          "name": "assert_contains",
          "kind": "fn",
          "signature": "pub fn assert_contains[T: cmp.Eq](xs: List[T], x: T)",
          "doc": "Asserts `xs` contains an element equal to `x` under `cmp.Eq`. A miss\nprints one line and traps `assert`.\n\nBLOCKED from executing (F-0002 / F-0004): the same bound, the same\ndispatch. The list is read once and iterated once, so the body is\nclean under the mem tier either way.",
          "source": "std/testing/testing.lu",
          "line": 156,
          "tier": "core"
        },
        {
          "name": "assert_near",
          "kind": "fn",
          "signature": "pub fn assert_near(a: f64, b: f64, eps: f64)",
          "doc": "Asserts `a` and `b` are within `eps` of each other — the absolute\ntolerance form, for a magnitude the test already knows.\n\nNaN never passes: every comparison against NaN is false, so\n`assert_near(nan, nan, 1.0)` traps. That is deliberate — a test\ncomparing two NaNs wants `float.is_nan` on each, and a tolerance says\nnothing about a value that has no magnitude. `+inf` against `+inf`\npasses, since their difference is not taken until they differ.\n\n`eps` is used as written; a negative `eps` can never be satisfied and\nis not diagnosed (the caller's arithmetic, not this function's).\n\nTraps `assert` on a miss, after one line. Executes on every lane that\nhas `f64` at all (lupin and the native rung; the checked tier refuses\nfloat literals, F-0026).",
          "source": "std/testing/testing.lu",
          "line": 181,
          "tier": "core"
        },
        {
          "name": "assert_ulps",
          "kind": "fn",
          "signature": "pub fn assert_ulps(a: f64, b: f64, n: int)",
          "doc": "Asserts `a` and `b` are at most `n` representable steps apart — the\nRELATIVE tolerance a float test actually wants, in the currency\n`std.math.float` documents its accuracy in (sc04's ulp harness).\n\nThe distance is counted over IEEE totalOrder keys, so it is exact at\nevery magnitude including across zero (`-0.0` and `+0.0` are one step\napart, not zero: they are distinct bit patterns, which is what a bit\ndistance measures) and it never traps on overflow.\n\nNaN matches NaN and nothing else: two NaNs of any payload pass at any\n`n`, a NaN against a number never passes. Infinities are ordinary\nkeys — `f_max` and `+inf` are one step apart.\n\nTraps `assert` on a miss, after one line. Executes on lupin and the\nnative rung.",
          "source": "std/testing/testing.lu",
          "line": 210,
          "tier": "core"
        }
      ]
    },
    {
      "name": "time",
      "group": "The os tier",
      "tier": "core",
      "doc": "std.time — monotonic instants, signed durations, and one wall-clock\nrendering, local civil time and calendar formatting. Stability tier: core.\n`local.lu` documents the Fs/Env zone reader and pure Local arithmetic.\n\n**Capability: `Clock` (I13).** Every function that reads a clock or\nsleeps is tagged `Clock` in the toolchain's sandbox table and is\ncategorically refused at comptime (D33), for the reason X12 gives:\n*determinism — two identical builds must not observe different times*.\nThe refusal is `E0701` and `tests/time/comptime_refuses.lu` holds it,\none level down at the builtin, because a `comptime fn` cannot call\nacross a module boundary at this pin (F-0051).\n\nSeven of this module's functions reach the clock (`now`,\n`monotonic_ns`, `unix_ms`, `sleep`, `elapsed`, `now_iso8601`,\n`unix_iso8601`); the other eighteen\nare PURE and comptime-safe — arithmetic over two one-field structs and\none calendar rendering. §14 says to state the exception explicitly,\nbecause in a capability module the pure function is the surprising\none, so every doc below says which it is.\n\n**The two clocks are different clocks and the types say so.** `now()`\nreads a MONOTONIC counter from an arbitrary process-local anchor: its\nvalues compare and subtract, and they are never dates. `unix_ms()`\nreads the WALL clock — milliseconds since 1970-01-01T00:00:00Z — which\ncan jump backwards when the host adjusts it, and is the only reading\nwith a calendar meaning. So `to_iso8601` takes an `int` of wall\nmilliseconds and there is deliberately no way to render an `Instant`:\nrendering a monotonic counter as a date is the mistake this split\nexists to make unspellable.\n\n**`Instant` and `Duration` are the facade over an `int` ABI.** The\nbuiltin tier is three calls that speak in bare milliseconds\n(`time_now_ms`, `time_unix_ms`, `time_sleep_ms`); wrapping them in two\none-field structs is the whole point of the module, because it is what\nturns unit confusion into a compile error — `sleep(millis(2))` and\n`sleep(seconds(2))` cannot be mistyped for each other, and\n`elapsed(t)` cannot be added to a count of bytes.\n\nA `Duration` is a SIGNED millisecond count. `between(a, b)` where `b`\nprecedes `a` is negative rather than clamped or trapped: the reversal\nis the caller's information, not this module's to discard.\n\n**Neither struct has a private field, because this pin has none**\n(sc07's `fs.File` lesson): a caller can write `time.Instant { ms: 0 }`\nand read `t.ms` directly. Nothing here traps on a forged value — a\nnonsense `Instant` produces a nonsense `Duration`, which is arithmetic\nand not a fault. Read the millisecond count through `as_millis`\nanyway; the field is the representation and the function is the API.\n\n**ISO formatting is render-only and UTC-only —\nthe ISO renderer is independent of the local-time reader.**\n`to_iso8601` writes exactly `YYYY-MM-DDTHH:MM:SS.sssZ`: the RFC 3339\nprofile of ISO 8601, always three fractional digits, always the `Z`\nzone. What this module does NOT have, deliberately:\n\n- **no parsing.** Text to time is the inverse direction and it needs\n  an error taxonomy (which field was wrong, at which offset) that the\n  payload conventions of §12 can express and no caller can yet branch\n  on. `parse_iso8601` is a reviewed contract below.\n- **local time is separate.** `local`, `local_in`, `offset_at`, `Local`,\n  `to_unix` and `format` are in this module's `local.lu`; they read the\n  host's TZif database, not compiler-carried tables. The ISO renderer\n  remains pure UTC arithmetic and never reads that database.\n- **no calendar arithmetic.** \"One month later\" is a policy, not a\n  function; days, hours, minutes and seconds are exact and are all\n  this module adds.\n- **no leap seconds.** Unix milliseconds do not count them and neither\n  does this rendering; a UTC minute here is always 60 seconds long.\n\nYears outside `0..9999` are a documented deviation rather than a\nrefusal: they render with their own digit count and a leading `-` when\nnegative, which is not ISO 8601's expanded-year form (that form needs\nan agreed digit width between writer and reader, and there is nobody\nto agree with here). Inside `0..9999` — every timestamp a program is\nlikely to hold — the output is exactly RFC 3339.\n\n**The lanes are unequal and the reason is the builtin tier.** The\nchecked tier and the native rung both execute `time_*`; lupin 0.1.6\nhas no time builtins at all, so it refuses them at resolve. It\nresolves module bodies LAZILY, so a program that touches only the pure\nmembers runs there too — which is why `tests/time/duration_algebra.lu`\nand `tests/time/iso8601_render.lu` have three lanes and\n`tests/time/monotonic.lu` has two.\n\nReviewed contracts, blocked or unscheduled, landing verbatim when they\nare not:\n\n```text\nparse_iso8601(s: str) -> int ! {parse}\n    The inverse of `to_iso8601`: wall milliseconds from an RFC 3339\n    text with a `Z` zone. Writable at these pins over `str.get` and\n    `fmt.parse_int` — unwritten rather than unwritable, and waiting\n    on the payload question: a caller wants to know WHICH field was\n    malformed and at which offset, which is a `Parse(ParseErr)`\n    payload (§12) that no `else` handler can destructure while\n    `E0806` stands (F-0043's unmoved half).\ndeadline(d: Duration) -> Deadline / with_timeout(...)\n    A bound on how long an operation may take. Blocked at the tier\n    below: no builtin arms a deadline anywhere in the toolchain\n    (F-0049 for sockets; the same hole for everything else), and\n    there is no `select` to race a timer against work. std ships no\n    deadline type rather than one that cannot expire.\nunix_ns()\n    The WALL clock at nanoseconds. The builtin ABI is milliseconds\n    for that clock and a library cannot invent precision it was not\n    given; a `_ns` face over a `_ms` source would report a\n    thousand-fold lie. (`monotonic_ns()`, reviewed here beside it,\n    landed verbatim at sc69 over wolf 0.2.34's `os_clock_ns`.)\n```\n\nstd.time — local civil time and C-locale calendar formatting.\nStability tier: core.\n\n`local`, `local_in` and `offset_at` read the host zone database:\ncapabilities `Fs` and `Env`, refused at comptime (D33) for determinism\nand confinement. A file read is the capability, not calendar arithmetic.\n`to_unix` and `format` are pure, comptime-safe (cross-module CTFE is\nstill F-0051); they observe neither a clock, a file nor the environment.\n\nRFC 8536 TZif v1/v2/v3 (64-bit table when present) and explicit POSIX\nTZ strings are read in wolf. No database is bundled in the library.\n`$TZDIR` or `/usr/share/zoneinfo` supplies named files; `$TZ`, a colon\npath or an absolute path selects one. Unset `$TZ` reads `/etc/localtime`;\nempty `$TZ` is UTC. Unreadable or malformed selections report `zone`\nor `io`, never a silent change of zone. With leap records (the `right/`\ntree), the integer input is UNIX leap time (RFC 8536 section 2), as\nwith the host date command; otherwise it is POSIX UNIX time. No implicit\nconversion between those two timestamp scales is performed.\n\nBare database names contain only ASCII letters, digits, `_ . + -`\nand `/`; a complete POSIX rule is parsed before this restriction.\nMalformed bare names answer `zone` before any file I/O. Colon and\nabsolute paths (including drive-absolute paths) use the host's path\nsyntax and retain the `io` row for file failures.\n\nThe Gregorian arithmetic and POSIX/TZif design are ported from the\nmaintainer's aspen `src/clock/clock.lu`, commit 476edee3bb0ddbf2afef0681ec74fdd211d4d3da,\nlines 19–405, 407–666; validation and rows are std's. RFC 8536 §§3.1–3.3\nand POSIX TZ/strftime specify the input. No foreign implementation's\nsource was read. Lord Howe's DST is 1800 seconds: no one-hour correction\nis applied to a transition. DST strings require explicit change rules;\nno host's undocumented default US rule is guessed here.\n\n`Local.offset_s` is seconds EAST of UTC. `to_unix` trusts it: the two\noccurrences of an overlap retain their distinct offsets and round-trip.\nA caller-created nonexistent gap time is interpreted at the supplied\noffset, not normalized or assigned an arbitrary earlier/later rule.\n`nanos` is 0 for a seconds input and is ignored by `to_unix`/`format`.\n`local`/`local_in` apply leap corrections; `offset_at` returns only the\nUT offset. `Local.leap_correction_s` retains the net correction so\n`to_unix` and format `%s` invert even a leap second. Literal-created\nordinary locals must set it to zero. No locale state or timezone cache;\neach lookup reads anew.",
      "summary": "std.time — monotonic instants, signed durations, and one wall-clock rendering, local civil time and calendar formatting.",
      "items": [
        {
          "name": "Instant",
          "kind": "struct",
          "signature": "pub struct Instant { ms: int, }",
          "doc": "A reading of the MONOTONIC clock, in milliseconds from an arbitrary\nprocess-local anchor.\n\nTwo `Instant`s compare and subtract; a single one means nothing on its\nown and is never a date. The anchor is not the epoch, is not shared\nbetween processes, and may differ between two runs of the same\nprogram — that is what makes the clock monotonic, and it is why\n`to_iso8601` takes wall milliseconds instead of one of these.",
          "source": "std/time/time.lu",
          "line": 121,
          "tier": "core"
        },
        {
          "name": "Duration",
          "kind": "struct",
          "signature": "pub struct Duration { ms: int, }",
          "doc": "A signed span of time, in milliseconds.\n\nNegative is legal and meaningful: `between(a, b)` with `b` before `a`\nis negative rather than clamped, because the reversal is information\nthe caller asked for.",
          "source": "std/time/time.lu",
          "line": 130,
          "tier": "core"
        },
        {
          "name": "now",
          "kind": "fn",
          "signature": "pub fn now() -> Instant",
          "doc": "The current reading of the monotonic clock.\n\nTotal: no rows, no traps. Successive calls are non-decreasing within\none process; the value has no meaning outside comparison and\nsubtraction (see the module header's two-clocks note).\n\nCapability `Clock`; refused at comptime (D33). Delegates to\n`time_now_ms`.\n\n```wolf-doc-example\nlet a = time.now()\nlet b = time.now()\ntime.as_millis(time.between(a, b)) >= 0\n```",
          "source": "std/time/time.lu",
          "line": 148,
          "tier": "core"
        },
        {
          "name": "monotonic_ns",
          "kind": "fn",
          "signature": "pub fn monotonic_ns() -> int",
          "doc": "**s248 (`[os.clock.ns]`): the monotonic clock in NANOSECONDS**, from\nthe anchor `now` reads (`time_now_ms`'s): `monotonic_ns() / 1000000`\nread after a `now()` is never smaller than its `ms`. A value is a\nduration to compare and subtract, never a timestamp; it never goes\nbackwards and saturates at the largest int, 292 years from the\nanchor. What a latency gate needs (a keypress to its paint, at most 5\nms): an interval of 100 us that `now` reads as 0 reads here as about\n100,000. The host's finest monotonic clock (`CLOCK_MONOTONIC`, the\nmach clock, `QueryPerformanceCounter`).\n\nTotal: no rows, no traps. Capability `Clock`; refused at comptime\n(D33), charged nothing in a manifest. lupin serves it from 0.1.56\n(0.1.55 did not resolve the call, wolf-interp#268). Delegates to\n`os_clock_ns`.\n\n```wolf-doc-example\nlet t = time.now()\nlet a = time.monotonic_ns()\nlet b = time.monotonic_ns()\nb >= a && a / 1000000 >= t.ms\n```",
          "source": "std/time/time.lu",
          "line": 173,
          "tier": "core"
        },
        {
          "name": "unix_ms",
          "kind": "fn",
          "signature": "pub fn unix_ms() -> int",
          "doc": "The current wall clock, in milliseconds since 1970-01-01T00:00:00Z.\n\nTotal: no rows, no traps. Unlike `now`, this reading has a calendar\nmeaning and can move BACKWARDS when the host adjusts its clock, so it\nis the wrong thing to measure an elapsed interval with. Use `now` and\n`elapsed` for durations and this for timestamps.\n\nCapability `Clock`; refused at comptime (D33). Delegates to\n`time_unix_ms`.\n\n```wolf-doc-example\ntime.unix_ms() > 1577836800000\n```",
          "source": "std/time/time.lu",
          "line": 190,
          "tier": "core"
        },
        {
          "name": "sleep",
          "kind": "fn",
          "signature": "pub fn sleep(d: Duration)",
          "doc": "Block the calling thread for `d`.\n\nA non-positive `d` returns immediately. The sleep is a FLOOR, not a\npromise: the host may wake the thread later than asked and never\nearlier, so a program that must not overshoot measures with `elapsed`\nrather than trusting the argument.\n\nTotal: no rows, no traps. **This blocks the whole thread**, and as of the\nsc11 pin that sentence has teeth on every lane: s73 lowers tasks, channels\nand procs natively, so a wolf program can now have several tasks on all\nthree rungs — and `time_sleep_ms` still parks the OS thread rather than the\ntask, so sleeping inside one task stops the others that share its thread.\nThere is no task-aware sleep at this tier. The s35 reactor has the parking\nstory and reaches std when its builtin tier does; until then, a program\nthat must not stall its peers waits on a channel instead of sleeping.\n\nCapability `Clock`; refused at comptime (D33). Delegates to\n`time_sleep_ms`.\n\n```wolf-doc-example\nlet before = time.now()\ntime.sleep(time.millis(2))\ntime.as_millis(time.elapsed(before)) >= 2\n```",
          "source": "std/time/time.lu",
          "line": 218,
          "tier": "core"
        },
        {
          "name": "elapsed",
          "kind": "fn",
          "signature": "pub fn elapsed(since: Instant) -> Duration",
          "doc": "How long ago `since` was read, on the monotonic clock.\n\n`elapsed(t)` is `between(t, now())`. Never negative in practice,\nbecause the clock it reads is monotonic — but it is not clamped, so a\nforged `Instant` from the future answers a negative `Duration` rather\nthan a lie.\n\nTotal: no rows, no traps.\n\nCapability `Clock`; refused at comptime (D33). Delegates to\n`time_now_ms`.\n\n```wolf-doc-example\nlet start = time.now()\ntime.as_millis(time.elapsed(start)) >= 0\n```",
          "source": "std/time/time.lu",
          "line": 241,
          "tier": "core"
        },
        {
          "name": "now_iso8601",
          "kind": "fn",
          "signature": "pub fn now_iso8601() -> str",
          "doc": "The wall clock, rendered — `to_iso8601(unix_ms())`.\n\nTotal: no rows, no traps. The one function here that turns a clock\nreading straight into text, and the only correct way to timestamp a\nlog line: `to_iso8601(as_millis(elapsed(t)))` would render a duration\nas a date, which the types cannot stop because both are `int` at the\nboundary and this doc is where that is said.\n\nCapability `Clock`; refused at comptime (D33). Delegates to\n`time_unix_ms`.\n\n```wolf-doc-example\ntime.now_iso8601().len == 24\ntime.now_iso8601().ends_with(\"Z\") == true\n```",
          "source": "std/time/time.lu",
          "line": 260,
          "tier": "core"
        },
        {
          "name": "millis",
          "kind": "fn",
          "signature": "pub fn millis(n: int) -> Duration",
          "doc": "A `Duration` of `n` milliseconds. Pure and comptime-safe.\n\n```wolf-doc-example\ntime.as_millis(time.millis(250)) == 250\ntime.as_millis(time.millis(-1)) == -1\n```",
          "source": "std/time/time.lu",
          "line": 270,
          "tier": "core"
        },
        {
          "name": "seconds",
          "kind": "fn",
          "signature": "pub fn seconds(n: int) -> Duration",
          "doc": "A `Duration` of `n` seconds. Pure and comptime-safe.\n\nTraps `overflow` (X3, checked arithmetic in every profile) when\n`n * 1000` leaves `int` — a span that long is a bug in the caller's\ndata model, not an outcome to hand back as a row (§10's trap-versus-\nraise rule).\n\n```wolf-doc-example\ntime.as_millis(time.seconds(3)) == 3000\n```",
          "source": "std/time/time.lu",
          "line": 284,
          "tier": "core"
        },
        {
          "name": "minutes",
          "kind": "fn",
          "signature": "pub fn minutes(n: int) -> Duration",
          "doc": "A `Duration` of `n` minutes. Pure and comptime-safe; the overflow\nposture is `seconds`'.\n\n```wolf-doc-example\ntime.as_millis(time.minutes(2)) == 120000\n```",
          "source": "std/time/time.lu",
          "line": 294,
          "tier": "core"
        },
        {
          "name": "hours",
          "kind": "fn",
          "signature": "pub fn hours(n: int) -> Duration",
          "doc": "A `Duration` of `n` hours. Pure and comptime-safe; the overflow\nposture is `seconds`'.\n\n```wolf-doc-example\ntime.as_millis(time.hours(1)) == 3600000\n```",
          "source": "std/time/time.lu",
          "line": 304,
          "tier": "core"
        },
        {
          "name": "as_millis",
          "kind": "fn",
          "signature": "pub fn as_millis(d: Duration) -> int",
          "doc": "The millisecond count `d` names. Pure and comptime-safe.\n\nThe exact representation, signed, with nothing rounded — the `as_`\nform because it borrows and allocates nothing (§1).\n\n```wolf-doc-example\ntime.as_millis(time.seconds(2)) == 2000\n```",
          "source": "std/time/time.lu",
          "line": 316,
          "tier": "core"
        },
        {
          "name": "as_seconds",
          "kind": "fn",
          "signature": "pub fn as_seconds(d: Duration) -> int",
          "doc": "`d` in whole seconds, truncated TOWARD ZERO. Pure and comptime-safe.\n\nTruncation rather than rounding, and toward zero rather than down, so\nthat `as_seconds(d)` and `as_seconds(negate(d))` are mirror images:\n1999ms is 1 second and -1999ms is -1.\n\n```wolf-doc-example\ntime.as_seconds(time.millis(1999)) == 1\ntime.as_seconds(time.millis(-1999)) == -1\ntime.as_seconds(time.hours(1)) == 3600\n```",
          "source": "std/time/time.lu",
          "line": 331,
          "tier": "core"
        },
        {
          "name": "as_minutes",
          "kind": "fn",
          "signature": "pub fn as_minutes(d: Duration) -> int",
          "doc": "`d` in whole minutes, truncated toward zero. Pure and comptime-safe.\n\n```wolf-doc-example\ntime.as_minutes(time.seconds(119)) == 1\n```",
          "source": "std/time/time.lu",
          "line": 340,
          "tier": "core"
        },
        {
          "name": "as_hours",
          "kind": "fn",
          "signature": "pub fn as_hours(d: Duration) -> int",
          "doc": "`d` in whole hours, truncated toward zero. Pure and comptime-safe.\n\n```wolf-doc-example\ntime.as_hours(time.minutes(59)) == 0\ntime.as_hours(time.minutes(60)) == 1\n```",
          "source": "std/time/time.lu",
          "line": 350,
          "tier": "core"
        },
        {
          "name": "between",
          "kind": "fn",
          "signature": "pub fn between(earlier: Instant, later: Instant) -> Duration",
          "doc": "The span from `earlier` to `later`, signed. Pure and comptime-safe.\n\nNegative when the arguments are the other way round, per the module\nheader. Traps `overflow` (X3) when the two instants are further apart\nthan `int` can express, which cannot happen to two readings of one\nprocess's clock.\n\n```wolf-doc-example\nlet a = time.Instant { ms: 10 }\nlet b = time.Instant { ms: 25 }\ntime.as_millis(time.between(a, b)) == 15\ntime.as_millis(time.between(b, a)) == -15\n```",
          "source": "std/time/time.lu",
          "line": 367,
          "tier": "core"
        },
        {
          "name": "add",
          "kind": "fn",
          "signature": "pub fn add(t: Instant, d: Duration) -> Instant",
          "doc": "`t` advanced by `d` (which may be negative). Pure and comptime-safe.\n\nTraps `overflow` (X3) when the result leaves `int`.\n\n```wolf-doc-example\nlet t = time.Instant { ms: 100 }\nlet u = time.add(t, time.millis(50))\ntime.as_millis(time.between(t, u)) == 50\n```",
          "source": "std/time/time.lu",
          "line": 380,
          "tier": "core"
        },
        {
          "name": "is_before",
          "kind": "fn",
          "signature": "pub fn is_before(a: Instant, b: Instant) -> bool",
          "doc": "Whether `a` is strictly before `b` on the monotonic clock. Pure and\ncomptime-safe.\n\n```wolf-doc-example\nlet a = time.Instant { ms: 1 }\nlet b = time.Instant { ms: 2 }\ntime.is_before(a, b) == true\ntime.is_before(b, a) == false\ntime.is_before(a, a) == false\n```",
          "source": "std/time/time.lu",
          "line": 394,
          "tier": "core"
        },
        {
          "name": "is_after",
          "kind": "fn",
          "signature": "pub fn is_after(a: Instant, b: Instant) -> bool",
          "doc": "Whether `a` is strictly after `b`. Pure and comptime-safe.\n\n```wolf-doc-example\nlet a = time.Instant { ms: 3 }\nlet b = time.Instant { ms: 2 }\ntime.is_after(a, b) == true\ntime.is_after(b, b) == false\n```",
          "source": "std/time/time.lu",
          "line": 406,
          "tier": "core"
        },
        {
          "name": "plus",
          "kind": "fn",
          "signature": "pub fn plus(a: Duration, b: Duration) -> Duration",
          "doc": "`a + b`. Pure and comptime-safe; traps `overflow` (X3) on a sum\noutside `int`.\n\n```wolf-doc-example\ntime.as_millis(time.plus(time.seconds(1), time.millis(500))) == 1500\n```",
          "source": "std/time/time.lu",
          "line": 416,
          "tier": "core"
        },
        {
          "name": "minus",
          "kind": "fn",
          "signature": "pub fn minus(a: Duration, b: Duration) -> Duration",
          "doc": "`a - b`. Pure and comptime-safe; traps `overflow` (X3) on a\ndifference outside `int`.\n\n```wolf-doc-example\ntime.as_millis(time.minus(time.seconds(1), time.millis(250))) == 750\n```",
          "source": "std/time/time.lu",
          "line": 426,
          "tier": "core"
        },
        {
          "name": "negate",
          "kind": "fn",
          "signature": "pub fn negate(d: Duration) -> Duration",
          "doc": "`d` with its sign flipped. Pure and comptime-safe.\n\nTraps `overflow` (X3) on the one input that has no negation: the most\nnegative `int`.\n\n```wolf-doc-example\ntime.as_millis(time.negate(time.millis(5))) == -5\ntime.as_millis(time.negate(time.millis(-5))) == 5\n```",
          "source": "std/time/time.lu",
          "line": 439,
          "tier": "core"
        },
        {
          "name": "is_zero",
          "kind": "fn",
          "signature": "pub fn is_zero(d: Duration) -> bool",
          "doc": "Whether `d` is the zero span. Pure and comptime-safe.\n\n```wolf-doc-example\ntime.is_zero(time.millis(0)) == true\ntime.is_zero(time.millis(1)) == false\n```",
          "source": "std/time/time.lu",
          "line": 449,
          "tier": "core"
        },
        {
          "name": "is_negative",
          "kind": "fn",
          "signature": "pub fn is_negative(d: Duration) -> bool",
          "doc": "Whether `d` runs backwards. Pure and comptime-safe.\n\n```wolf-doc-example\ntime.is_negative(time.millis(-1)) == true\ntime.is_negative(time.millis(0)) == false\n```",
          "source": "std/time/time.lu",
          "line": 459,
          "tier": "core"
        },
        {
          "name": "to_iso8601",
          "kind": "fn",
          "signature": "pub fn to_iso8601(unix_millis: int) -> str",
          "doc": "`unix_millis` rendered as `YYYY-MM-DDTHH:MM:SS.sssZ` — the RFC 3339\nprofile of ISO 8601, in UTC, with exactly three fractional digits.\n\n**Pure and comptime-safe**: it reads no clock, so the same argument\nalways gives the same text on every host, and this is the function a\ntest pins. The argument is WALL milliseconds — `unix_ms()`, or a\ntimestamp a program received as data — never an `Instant` (the module\nheader explains why there is no way to render one).\n\nTotal: no rows, no traps, defined for every `int`. Negative arguments\nare pre-1970 dates and render correctly (`-1` is\n`1969-12-31T23:59:59.999Z`); the proleptic Gregorian calendar runs\nbackwards without a switchover, which is what every other\nimplementation of this format does. Years outside `0..9999` render\nwith their own digit count and a leading `-` when negative — a\ndocumented deviation from ISO 8601's expanded-year form, per the\nmodule header.\n\nNo leap seconds: a minute here is always 60 seconds, as Unix time\nitself defines it.\n\n```wolf-doc-example\ntime.to_iso8601(0) == \"1970-01-01T00:00:00.000Z\"\ntime.to_iso8601(1000) == \"1970-01-01T00:00:01.000Z\"\ntime.to_iso8601(86399999) == \"1970-01-01T23:59:59.999Z\"\ntime.to_iso8601(-1) == \"1969-12-31T23:59:59.999Z\"\ntime.to_iso8601(1577836800000) == \"2020-01-01T00:00:00.000Z\"\ntime.to_iso8601(951782400000) == \"2000-02-29T00:00:00.000Z\"\n```",
          "source": "std/time/time.lu",
          "line": 492,
          "tier": "core"
        },
        {
          "name": "unix_iso8601",
          "kind": "fn",
          "signature": "pub fn unix_iso8601() -> str",
          "doc": "`unix_ms()` rendered — see `to_iso8601`, which does the work.\n\nCapability `Clock`; refused at comptime (D33). Delegates to\n`time_unix_ms`. Kept beside `now_iso8601` because the two read\ndifferent clocks in every other language and the same one here: this\nis the honest name, and `now_iso8601` is the one a caller reaches for.\n\n```wolf-doc-example\ntime.unix_iso8601().starts_with(\"2\") == true\n```",
          "source": "std/time/time.lu",
          "line": 521,
          "tier": "core"
        },
        {
          "name": "Local",
          "kind": "struct",
          "signature": "pub struct Local { year: int, month: int, day: int, hour: int, minute: int, second: int, nanos: int, offset_s: int, leap_correction_s: int, is_dst: bool, abbrev: str, }",
          "doc": "Local Gregorian calendar fields; `offset_s` is seconds east of UTC,\n`nanos` 0..999999999, `is_dst` the zone's seasonal flag and `abbrev`\nits designation. A seconds lookup sets nanos to zero. Pure data;\ncallers may construct it, and `to_unix` trusts the explicit offset\nand correction. `leap_correction_s` is the net seconds removed from\nthe civil representation: cumulative LEAPCORR minus one at a positive\noccurrence (whose second field is incremented, normally to 60).\nIt is zero for ordinary zones and must be zero in ordinary literals.",
          "source": "std/time/local.lu",
          "line": 715,
          "tier": "core"
        },
        {
          "name": "local",
          "kind": "fn",
          "signature": "pub fn local(unix_s: int) -> Local ! {zone, io}",
          "doc": "Local time at timestamp `unix_s`, from `$TZ` or `/etc/localtime`.\nThe scale is POSIX UNIX time without leap records, UNIX leap time\nwith them; see the module contract.\nAn empty setting is UTC. Rows: `zone` for missing or invalid zone\ndata; `io` for a refused/failed host access or\nunreadable environment value. Capability `Fs`/`Env`, refused at\ncomptime (D33, determinism and confinement). Arithmetic overflow traps\n`overflow` (X3) for an extreme second plus offset outside int.\n\n```wolf-doc-example\nenv_set(\"TZ\", \"UTC0\")?\ntime.local(0)?.nanos == 0\n```",
          "source": "std/time/local.lu",
          "line": 764,
          "tier": "core"
        },
        {
          "name": "local_in",
          "kind": "fn",
          "signature": "pub fn local_in(zone: str, unix_s: int) -> Local ! {zone, io}",
          "doc": "Local time at `unix_s`: POSIX UNIX time without leap records, UNIX\nleap time with them (the same integer interpretation as host date).\nA named zone, an absolute path, `:path` (relative paths\nuse forward slashes), or an explicit POSIX TZ string. Named files use\n`$TZDIR` or `/usr/share/zoneinfo`; an empty zone is UTC. Rows: `zone`\nfor missing/malformed data, a malformed TZ rule, or a bare database\nname outside ASCII letters, digits, `_ . + -` and `/`. Complete bare\nPOSIX rules are parsed first. Colon/absolute paths are explicit host\nfile operations; drive-absolute paths are recognized before name\nvalidation. `io` reports host access failure. Capability `Fs`/`Env`, refused at comptime (D33, determinism and\nconfinement). Extreme arithmetic traps `overflow` (X3).\n\n```wolf-doc-example\nlet l = time.local_in(\"UTC0\", 0)?\nl.year == 1970\nl.offset_s == 0\n```",
          "source": "std/time/local.lu",
          "line": 794,
          "tier": "core"
        },
        {
          "name": "offset_at",
          "kind": "fn",
          "signature": "pub fn offset_at(zone: str, unix_s: int) -> int ! {zone, io}",
          "doc": "Seconds east of UT in force in `zone` at timestamp `unix_s`.\nDoes not include the leap correction; see `local_in` for civil fields.\nLeap-aware files interpret the input as UNIX leap time.\nRows: `zone` for missing/malformed zone data; `io` for host access\nfailure. Same zone spellings as `local_in`. Capability `Fs`/`Env`,\nrefused at comptime (D33, determinism and confinement); extreme\nPOSIX-rule arithmetic traps `overflow` (X3).\n\n```wolf-doc-example\ntime.offset_at(\"<+0530>-5:30\", 0)? == 19800\n```",
          "source": "std/time/local.lu",
          "line": 809,
          "tier": "core"
        },
        {
          "name": "to_unix",
          "kind": "fn",
          "signature": "pub fn to_unix(l: Local) -> int",
          "doc": "Timestamp of calendar fields at their EXPLICIT `offset_s` and\n`leap_correction_s`: UNIX leap time for leap-aware locals, POSIX UNIX\ntime otherwise. Like the explicit offset, a caller editing civil\nfields supplies the correction appropriate to the intended instant;\nuse zero for literal-created locals from ordinary zones.\nPure, comptime-safe. Nanos are ignored, not rounded. Both occurrences\nin a DST fold invert exactly. A caller-created gap is interpreted at\nits supplied offset, not normalized. `is_dst`/`abbrev` are descriptive\nand do not override the offset. Traps `assert` for invalid calendar\nfields and `overflow` when checked arithmetic leaves int (X3).\n\n```wolf-doc-example\nlet l = time.Local { year: 1970, month: 1, day: 1, hour: 1, minute: 0, second: 0, nanos: 0, offset_s: 3600, leap_correction_s: 0, is_dst: false, abbrev: \"X\" }\ntime.to_unix(l) == 0\n```",
          "source": "std/time/local.lu",
          "line": 843,
          "tier": "core"
        },
        {
          "name": "format",
          "kind": "fn",
          "signature": "pub fn format(l: Local, fmt: str) -> str ! {format}",
          "doc": "C-locale POSIX calendar formatting, pure and comptime-safe.\nConversions: `%Y %m %d %H %M %S %e %b %B %a %A %j %Z %z %p %I %y\n%C %u %w %F %T %D %R %s %n %t %%` and C-locale `%c %x %X`.\n`%-` removes padding, `%_` selects spaces, `%0` selects zeros; the\nlast flag wins. Decimal widths count bytes (§11) and are bounded at\n4096 to refuse an unbounded allocation. Numeric padding preserves a\nsign. `%z` truncates offset seconds to minutes, as POSIX specifies;\n`%s` uses `to_unix`'s explicit offset. Nanos are not rendered.\nRows: `format` for unknown/incomplete conversions, widths above 4096,\nor invalid calendar fields. Checked arithmetic can trap `overflow`\n(X3) for extreme forged fields/offsets. No locale or host access.\n\n```wolf-doc-example\nlet l = time.Local { year: 2024, month: 2, day: 3, hour: 13, minute: 4, second: 5, nanos: 0, offset_s: 19800, leap_correction_s: 0, is_dst: false, abbrev: \"IST\" }\ntime.format(l, \"%F %T %z\")? == \"2024-02-03 13:04:05 +0530\"\ntime.format(l, \"%-d|%_d|%0e\")? == \"3| 3|03\"\n```",
          "source": "std/time/local.lu",
          "line": 966,
          "tier": "core"
        }
      ]
    },
    {
      "name": "unicode",
      "group": "Strings",
      "tier": "core",
      "doc": "std.unicode — the posture module: what wolf promises about Unicode in\nv1, spelled as functions where it can be and as a filing where it\ncannot. Stability tier: core.\n\n**The posture, in one paragraph.** v1 ships three things and no more:\nUTF-8 validity as a type invariant (`str` is valid UTF-8 by\nconstruction, D24 — the language's, not this module's), byte-offset\nslicing that refuses to split a code point (D25, also the language's),\nand the ASCII-true classification below, named so that no caller can\nmistake it for Unicode-true classification. NOT in v1: general category\ntables, case mapping and folding, normalization (NFC/NFD/NFKC/NFKD),\nand grapheme segmentation data. Those are a BUDGET decision — table\nsize, generation, and the maintenance cost of tracking Unicode\nreleases — filed upstream (F-0018) with the recommendation that they\nland in penumbra or `std/x` rather than core, so that a core that must\nbe welded to the compiler does not carry megabytes of derived data.\nReport 07's nursery clock applies to whichever nursery takes them.\n\n**THE CURRENCY IS `char` NOW (sc25), AND THE INT INTERIM IS GONE.**\nFrom sc03 to sc24 this module spelled a code point as an `int`\nbecause no pinned binary had a `char`; D58 ruled the type at the\nsc24 data pin (`[type.char]`: a Unicode scalar value, `0..=0x10FFFF`\nminus the surrogate gap, ordered by scalar value, NOT an integer)\nand the sc24 wolf pair executed it — but lupin 0.1.14 did not\n(`'` refused at lex; the interpreter's char tier was is26, running\nconcurrently), so sc24 shipped only `code` and recorded the reviewed\nchar-typed signatures per function rather than trading the module's\nexecuting interpreter lane for them. lupin 0.1.15 — the is26 scalar\nrelease — closed that gap, and this is the recorded flip, at the\nsprint it was owed to: every signature below is char-typed, the flip\ncost no lane (re-measured on both executing lanes at the sc25 pins;\nthe native column keeps its recorded values under the nomad-1\nposture, the s121 surface having been verified on both wolf rungs at\nsc24), and the reviewed-final-signature notes retired into the\nsignatures themselves.\n\n**D58's rule is this module's law: no arithmetic on the scalar,\nanywhere.** `code` and `from_code` bracket the ONLY two places in\nstd where a number and a code point trade places — `c as int` (total\nby `[type.char.cast]`) and the validated `n as char` (every trap row\nof the raw cast is a `none` here, so the cast can never trap). The\npredicates COMPARE `c` against `char` literals under\n`[type.char.order]` — they never compute, and no helper that does\nwill ever sit beside them. `utf8_len` is TOTAL now: its `{none}` row\nexisted only because the interim's `int` could hold a non-scalar,\nand a non-scalar cannot exist as a `char` at all.\n\nAbsence is spelled `none`, which is the convention's own spelling and\nno longer an interim: F-0003 died at the sc05 pins and the rename\nlanded tree-wide at sc06. This header described the interim for six\nsprints after it was gone.",
      "summary": "std.unicode — the posture module: what wolf promises about Unicode in v1, spelled as functions where it can be and as a filing where it cannot.",
      "items": [
        {
          "name": "from_code",
          "kind": "fn",
          "signature": "pub fn from_code(n: int) -> char ! {none}",
          "doc": "`n` as a Unicode scalar value; `none` when `n` is not one — negative,\nabove U+10FFFF, or in the surrogate range U+D800..U+DFFF, which UTF-8\nmay never encode. This is the validating constructor: the one place in\nstd a number becomes a code point, and the recoverable face of the\nD56 cast — `int as char` TRAPS `overflow` on exactly the shapes this\nfunction answers `none` for (`[type.char.cast]`), so the cast in the\nbody runs only on values it has already admitted and can never trap.\n\n```wolf-doc-example\n(unicode.from_code(65) else '?') == 'A'\n(unicode.from_code(233) else '?') == 'é'\n(unicode.from_code(128058) else '?') == '🐺'\n(unicode.from_code(1114111) else '?') == '\\u{10FFFF}'\n(unicode.from_code(1114112) else '?') == '?'\n(unicode.from_code(0 - 1) else '?') == '?'\n(unicode.from_code(55296) else '?') == '?'\n(unicode.from_code(57343) else '?') == '?'\n```",
          "source": "std/unicode/unicode.lu",
          "line": 80,
          "tier": "core"
        },
        {
          "name": "code",
          "kind": "fn",
          "signature": "pub fn code(c: char) -> int",
          "doc": "The Unicode scalar value of `c`, as an `int` — the sc03 contract's\n`char.code`, code since sc24. The body is `c as int`, which\n`[type.char.cast]` rules TOTAL: every `char` is a scalar value by\nconstruction (D58 — the surrogate gap and the range cap are enforced\nwhere a number tries to become a `char`, not here), so this\nprojection has no row and can never trap. With `from_code` it\nbrackets the only two places in std where a number and a code point\ntrade places; the predicates below compare, they never compute.\n\n```wolf-doc-example\nvar total = 0\nfor c in \"Aé\".chars() { total = total + unicode.code(c) }\ntotal == 298\nunicode.code('A') == 65\nunicode.code('🐺') == 128058\n```",
          "source": "std/unicode/unicode.lu",
          "line": 111,
          "tier": "core"
        },
        {
          "name": "utf8_len",
          "kind": "fn",
          "signature": "pub fn utf8_len(c: char) -> int",
          "doc": "The number of bytes `c` occupies in UTF-8 — 1, 2, 3 or 4. TOTAL now\n(sc25): the `{none}` row the int interim carried existed only because\nan `int` can hold a non-scalar, and a non-scalar cannot exist as a\n`char` (D58). The class boundaries are compared as `char` literals\nunder the scalar order (`[type.char.order]`) — never computed.\n\n```wolf-doc-example\nunicode.utf8_len('A') == 1\nunicode.utf8_len('\\u{7F}') == 1\nunicode.utf8_len('é') == 2\nunicode.utf8_len('\\u{7FF}') == 2\nunicode.utf8_len('中') == 3\nunicode.utf8_len('\\u{FFFF}') == 3\nunicode.utf8_len('🐺') == 4\nunicode.utf8_len('\\u{10FFFF}') == 4\n```",
          "source": "std/unicode/unicode.lu",
          "line": 131,
          "tier": "core"
        },
        {
          "name": "is_ascii",
          "kind": "fn",
          "signature": "pub fn is_ascii(c: char) -> bool",
          "doc": "Whether `c` is an ASCII character, U+0000..U+007F. Total, and one\ncomparison now: the negative guard the int interim carried has no\nvalue to guard against — a `char` below `'\\0'` does not exist.\n\n```wolf-doc-example\nunicode.is_ascii('A') == true\nunicode.is_ascii('\\0') == true\nunicode.is_ascii('\\u{7F}') == true\nunicode.is_ascii('\\u{80}') == false\nunicode.is_ascii('é') == false\nunicode.is_ascii('🐺') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 156,
          "tier": "core"
        },
        {
          "name": "is_ascii_alpha",
          "kind": "fn",
          "signature": "pub fn is_ascii_alpha(c: char) -> bool",
          "doc": "Whether `c` is an ASCII letter, `A`..`Z` or `a`..`z`. ASCII-true, as\nthe name says: a Unicode letter outside ASCII answers false, and\nunicode-true classification is the filed table decision. Total.\n\n```wolf-doc-example\nunicode.is_ascii_alpha('A') == true\nunicode.is_ascii_alpha('z') == true\nunicode.is_ascii_alpha('0') == false\nunicode.is_ascii_alpha('é') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 170,
          "tier": "core"
        },
        {
          "name": "is_ascii_digit",
          "kind": "fn",
          "signature": "pub fn is_ascii_digit(c: char) -> bool",
          "doc": "Whether `c` is an ASCII decimal digit, `0`..`9`. Total.\n\n```wolf-doc-example\nunicode.is_ascii_digit('0') == true\nunicode.is_ascii_digit('9') == true\nunicode.is_ascii_digit('/') == false\nunicode.is_ascii_digit('A') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 182,
          "tier": "core"
        },
        {
          "name": "is_ascii_alnum",
          "kind": "fn",
          "signature": "pub fn is_ascii_alnum(c: char) -> bool",
          "doc": "Whether `c` is an ASCII letter or digit. Total.\n\n```wolf-doc-example\nunicode.is_ascii_alnum('A') == true\nunicode.is_ascii_alnum('0') == true\nunicode.is_ascii_alnum('_') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 196,
          "tier": "core"
        },
        {
          "name": "is_ascii_space",
          "kind": "fn",
          "signature": "pub fn is_ascii_space(c: char) -> bool",
          "doc": "Whether `c` is ASCII whitespace: tab (`'\\t'`), line feed (`'\\n'`),\nvertical tab (U+000B), form feed (U+000C), carriage return (`'\\r'`)\nor space. Total.\n\nThis is deliberately NARROWER than the whitespace `std.str.trim` and\n`std.str.words` use, which is Unicode `White_Space` (the builtin's set,\npinned by a test there). The names are the difference: `is_ascii_space`\npromises ASCII and delivers ASCII.\n\n```wolf-doc-example\nunicode.is_ascii_space(' ') == true\nunicode.is_ascii_space('\\t') == true\nunicode.is_ascii_space('\\r') == true\nunicode.is_ascii_space('A') == false\nunicode.is_ascii_space('\\u{A0}') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 216,
          "tier": "core"
        },
        {
          "name": "is_ascii_upper",
          "kind": "fn",
          "signature": "pub fn is_ascii_upper(c: char) -> bool",
          "doc": "Whether `c` is an ASCII uppercase letter, `A`..`Z`. Total.\n\n```wolf-doc-example\nunicode.is_ascii_upper('A') == true\nunicode.is_ascii_upper('Z') == true\nunicode.is_ascii_upper('a') == false\nunicode.is_ascii_upper('É') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 234,
          "tier": "core"
        },
        {
          "name": "is_ascii_lower",
          "kind": "fn",
          "signature": "pub fn is_ascii_lower(c: char) -> bool",
          "doc": "Whether `c` is an ASCII lowercase letter, `a`..`z`. Total.\n\n```wolf-doc-example\nunicode.is_ascii_lower('a') == true\nunicode.is_ascii_lower('z') == true\nunicode.is_ascii_lower('A') == false\nunicode.is_ascii_lower('é') == false\n```",
          "source": "std/unicode/unicode.lu",
          "line": 249,
          "tier": "core"
        }
      ]
    },
    {
      "name": "x",
      "group": "Nursery",
      "tier": "x",
      "doc": "Namespace for the modules listed below.",
      "summary": "Namespace for the modules listed below.",
      "items": []
    },
    {
      "name": "x.crypto",
      "group": "Nursery",
      "tier": "x",
      "doc": "Namespace for the modules listed below.",
      "summary": "Namespace for the modules listed below.",
      "items": []
    },
    {
      "name": "x.crypto.chacha20",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.chacha20 — ChaCha20, Poly1305 and the\nAEAD_CHACHA20_POLY1305 construction (RFC 8439). Stability tier: x —\nthe D53 crypto ladder's second rung (campaign stdc-crypto, sprint\nsc17). This is the cipher that needs no tables: add-rotate-xor on\npublic data-flow, no S-boxes, no secret-indexed loads. These are source-\nlevel obligations, not a fixed-time certification of generated code or\nruntime operations. Backend and runtime review at exact pins is separate.\nAES-GCM (that rung owes a D-question on\nhardware intrinsics vs bitslicing vs c28-verified masking; named in\nthe sc17 contract, not smuggled here).\n\n**The nursery banner (D31).** `std.x.crypto.chacha20` is not\n`std.crypto`: its path, names and behaviour may change or vanish in\none sprint; no other std module may depend on it (it may depend on\nthe facade, and does: `std.bytes` for shared equality); its\nreason and graduation trigger live in `std/x/README.md`. Poly1305\nlives IN this module rather than beside it because a nursery\nresident may not depend on another resident — the graduation move\nsplits them.\n\n**Implemented from the RFC 8439 DOCUMENT, not ported.** Every\nconstant and every round below cites its section of RFC 8439 (June\n2018), fetched into the planning repo's `refs/specs/rfc8439.txt`.\nThe vectors (the RFC's complete set — §2.3.2, §2.4.2, §2.5.2,\n§2.6.2, §2.8.2, A.1–A.5 — plus the full Wycheproof\n`chacha20_poly1305_test.json`) catch transcription errors; the\ndocument is the authority.\n\n**The ChaCha word currency is `wrapping[u64]`, masked to 32 bits**\n(the sha2 discipline, chosen when F-0089 kept the narrowing\n`int as wrapping[u32]` off the native rung; that refusal CLOSED at\nthe sc18 pin — s111 / wolf-lang#131 — and the respell is sha2's\nrecorded follow-on, shared by this module, never a bump side-effect).\nEvery value entering a round is 32-bit-clean and every sum or\nrotation is masked before it is stored. Unlike SHA-2, ChaCha20 is\nLITTLE-endian at state load and keystream serialization (§2.3) —\nthe `word32_le`/`push_word32_le` helpers are this module's own,\nnot sha2's big-endian pair.\n\n**Poly1305 is CHECKED `int` arithmetic, all the way down** — the\nsc17 probe delta's finding. Five 26-bit limbs in 64-bit\naccumulators, carries spelled as literal shifts and masks (`>> 26`,\n`& 67108863`) on limbs the bound proof keeps non-negative, where\nthey are the same numbers `/` and `%` were; the §2.5 clamp as masks;\nand the final conditional subtraction as an arithmetic select. Until\nsc84 the carries were `/`/`%`, because a plain-`int` shift or mask\ncost the checked lane (F-0026); every lane runs them since wolf\n0.2.31, and a default build compiled each `/`/`%` to a hardware\ndivide of the one-time key and the accumulator (wolf-std#151). The\nbound proof lives on `absorb`; because X3's checked arithmetic traps\non any overflow, a violated bound would be a trap the vectors catch,\nnot a silent wrap. No `wrapping[T]` appears anywhere in the MAC.\n\n**Lanes, measured at the sc18 pin (wolf 21b129e)**: ALL THREE run\nevery body. The checked tier's F-0091 operator refusal that kept\nany path reaching the ChaCha core dark from sc17's first commit\nclosed with s111 (wolf-lang#130) — \"the next pin bump flips sha2\nand this module in one motion\", and it did: all 19 dark chacha20\nrows flipped `unsupported` -> `run` at the bump, the full\nWycheproof parts included (the checked tier's resource budgets that\nkeep sha2's biggest files dark are not reached by 32-vector AEAD\nparts, measured at the bump). The sc17 nuance stands as history:\nthe refusal was DYNAMIC — per executed path — which is why\nPoly1305's checked-int arithmetic was three-lane a sprint before\nthe rest of the module.\n\n**Byte sequences are `List[byte]` (sc35), AND THE INGESTION GUARD\nIS GONE.** The currency was `List[int]` with a documented 0..255\nelement contract (§11's interim, F-0035) and a `require_byte` that\ntrapped `assert` on every element breaking it; D72/s135's `byte` and\ns136's byte-typed builtins (wolf-lang#231) moved that contract into\nthe type, so the guard was unreachable code and is deleted. What it\ndefended is unchanged: a `List[byte]` cannot carry a value a\nwrapping cast would silently key or digest. `to_hex` is this module's own\nhex rendering so its tests and doc examples import exactly one\nmodule (the sha2 precedent); `std.hex.encode` is the facade\nspelling.\n\n**Nonces are the CALLER's** — `seal`/`open` take an explicit\n96-bit nonce and this module provides NO random-nonce surface (no\nentropy story exists yet; the D-question lives with the rung that\nneeds it). Reusing a nonce under one key forfeits both\nconfidentiality and integrity (§4); `seal`'s doc states the\ncontract.\n\n**Error rows**: exactly one, `open`'s `{tag}` — a forged, modified\nor truncated box is the DATA's failure, so it raises (§2's rule).\nEverything else is total over its documented domain; key/nonce\nlength misuse is a caller contract violation that traps `assert`\n(the sc16 spelling); a non-byte element is a TYPE error since sc35\nand never reaches a trap.\n\n**Constant-time obligations (D53's retrofit clause).** c28's\ncompiler-enforced tier does not exist yet; until it does, every\n`pub` fn below carries a `ct:` line. The honest summary: the\ncipher and the MAC branch and index on PUBLIC quantities only\n(lengths, block counts, fixed offsets) — **and the one recorded\nexception is RETIRED (sc35).** The 0..255 ingestion guard compared\nevery input element, key bytes included, and this header promised\n\"it leaves with F-0035's real byte type\". The type arrived and it\nleft, so there is no value-dependent branch anywhere on the cipher\nor MAC path at source level. Generated instructions and runtime\noperations are separate review obligations, not certified here. The\ntag comparison delegates to `bytes.is_equal_fixed_work`; `to_hex`\nis NOT constant-time and says so.\n\n**No division (sc84, wolf-std#151).** Neither the cipher nor the MAC\ndivides: Poly1305's carries, clamp, limb seams and tag words are\nshifts and masks, and so are the stream's block positions. At wolf\n0.2.39 the default build compiled 76 hardware divides into\n`poly1305`, `absorb` and `push_tag_word`, on the one-time key and the\naccumulator. `cargo xtask codegen` builds this module's default and\nrelease objects on the host target and fails on any integer division\ninstruction in them, and runs the RFC 8439 rows in the release tier.\nIt is not a timing measurement (no latency was measured on any CPU),\nit says nothing about the interpreters, and the compiler that makes\nthe objects is not audited; a target the gate is not run on is not\ncovered by it.",
      "summary": "std.x.crypto.chacha20 — ChaCha20, Poly1305 and the AEAD_CHACHA20_POLY1305 construction (RFC 8439).",
      "items": [
        {
          "name": "block",
          "kind": "fn",
          "signature": "pub fn block(key: List[byte], counter: int, nonce: List[byte]) -> List[byte]",
          "doc": "The ChaCha20 block function (RFC 8439 §2.3): 64 keystream bytes\nfor one (key, counter, nonce) triple. Traps `assert` on a key that\nis not 32 bytes, a nonce that is not 12, or a counter outside\n0..2^32-1; total otherwise (sc35: a non-byte element is a type\nerror).\nct: fixed source-level schedule — the rounds are add-rotate-xor\non 32-bit words with literal rotation amounts; every branch is a\nfixed loop bound and every index is a fixed offset or a loop\ncounter, so no branch and no memory address depends on a secret,\nand since sc35 there is no recorded exception left.\n\n```wolf-doc-example\nlet key = \"wolf sc17: a 32-byte chacha key!\".bytes()\nlet nonce = \"twelve bytes\".bytes()\nchacha20.block(key, 1, nonce).len == 64\nchacha20.to_hex(chacha20.block(key, 1, nonce))[0..8] == \"4f0949f3\"\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 391,
          "tier": "x"
        },
        {
          "name": "stream_xor",
          "kind": "fn",
          "signature": "pub fn stream_xor( key: List[byte], counter: int, nonce: List[byte], data: List[byte], ) -> List[byte]",
          "doc": "The ChaCha20 stream cipher (RFC 8439 §2.4): XORs `data` with the\nkeystream starting at block `counter`; its own inverse, so one\nfunction is both directions. Traps `assert` on the block-function\ncontract violations, and on a message long enough that the 32-bit\nblock counter would wrap — §2.4's note: the cipher is defined for\nat most 2^32 blocks from the starting counter (with counter 1\nthat is ~256 GiB, theoretical; the guard is one comparison).\nct: as `block` — the per-byte XOR touches every element\nunconditionally, the keystream index is `pos % 64` (public), and\nblock boundaries depend on the LENGTH alone.\n\n```wolf-doc-example\nlet key = \"wolf sc17: a 32-byte chacha key!\".bytes()\nlet nonce = \"twelve bytes\".bytes()\nlet ct = chacha20.stream_xor(key, 1, nonce, \"attack at dawn\".bytes())\nchacha20.to_hex(ct) == \"2e7d3d92e359096f5c4660bbeed3\"\nchacha20.to_hex(chacha20.stream_xor(key, 1, nonce, ct)) == \"61747461636b206174206461776e\"\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 414,
          "tier": "x"
        },
        {
          "name": "poly1305",
          "kind": "fn",
          "signature": "pub fn poly1305(key: List[byte], msg: List[byte]) -> List[byte]",
          "doc": "The Poly1305 one-time authenticator (RFC 8439 §2.5): a 16-byte tag\nover `msg` under a 32-byte one-time key (r || s). The r half is\nclamped with §2.5's exact mask `0x0ffffffc0ffffffc0ffffffc0fffffff`\n— spelled byte-wise as arithmetic, and applied BEFORE the limb\nsplit, so no unclamped bit ever enters the schedule. Traps `assert`\non a key that is not 32 bytes; total otherwise (sc35). THE KEY IS ONE-TIME (§2.5): authenticating two messages\nunder one r,s pair forfeits the MAC; the AEAD below derives a fresh\nkey per nonce.\nct: the limb schedule is fixed and data-independent — every block\nruns the same adds, multiplies and shift-and-mask carries; block\nboundaries depend on the LENGTH alone; the final conditional\nsubtraction of p is an arithmetic select, not a branch — with no\nrecorded exception left since sc35.\n\n```wolf-doc-example\nlet key = \"wolf sc17: a 32-byte chacha key!\".bytes()\nlet mac = chacha20.poly1305(key, \"a message worth authenticating\".bytes())\nmac.len == 16\nchacha20.to_hex(mac) == \"79a8154cdb15d6e6de56665337a5908c\"\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 543,
          "tier": "x"
        },
        {
          "name": "poly_key",
          "kind": "fn",
          "signature": "pub fn poly_key(key: List[byte], nonce: List[byte]) -> List[byte]",
          "doc": "The per-nonce Poly1305 key (RFC 8439 §2.6): the first 32 bytes of\nthe ChaCha20 block at counter ZERO — which is why the AEAD's\nencryption starts at counter one. Traps `assert` on the ChaCha\ninput contract; total otherwise.\nct: as `block`.\n\n```wolf-doc-example\nlet key = \"wolf sc17: a 32-byte chacha key!\".bytes()\nchacha20.poly_key(key, \"twelve bytes\".bytes()).len == 32\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 698,
          "tier": "x"
        },
        {
          "name": "seal",
          "kind": "fn",
          "signature": "pub fn seal( key: List[byte], nonce: List[byte], aad: List[byte], plaintext: List[byte], ) -> List[byte]",
          "doc": "AEAD_CHACHA20_POLY1305 seal (RFC 8439 §2.8): encrypts `plaintext`\nunder (key, nonce) with the ciphertext starting at block counter 1,\nauthenticates aad and ciphertext per the §2.8 transcript under the\n§2.6 per-nonce Poly1305 key, and returns ciphertext || 16-byte tag\nas one sequence. Traps `assert` on the ChaCha input contract; total\notherwise (sc35).\nTHE NONCE IS THE CALLER'S CONTRACT: this module has no entropy\nsurface and never generates one. A nonce must be UNIQUE per key —\nreuse hands an attacker the XOR of the plaintexts and the Poly1305\nkey (§4 of the RFC), which forfeits both confidentiality and\nintegrity. Counters and LFSRs are both acceptable per the RFC;\nwhatever the scheme, it is the caller's.\nct: the composition of `block`, `stream_xor` and `poly1305`'s\nobligations — public-length control flow only.\n\n```wolf-doc-example\nlet key = \"wolf sc17: a 32-byte chacha key!\".bytes()\nlet nonce = \"twelve bytes\".bytes()\nlet boxed = chacha20.seal(key, nonce, \"hdr\".bytes(), \"attack at dawn\".bytes())\nboxed.len == 30\nchacha20.to_hex(boxed) == \"2e7d3d92e359096f5c4660bbeed3c6e125ca300df002b2a92947a5deded4\"\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 761,
          "tier": "x"
        },
        {
          "name": "open",
          "kind": "fn",
          "signature": "pub fn open( key: List[byte], nonce: List[byte], aad: List[byte], boxed: List[byte], ) -> List[byte] ! {tag}",
          "doc": "AEAD_CHACHA20_POLY1305 open (RFC 8439 §2.8): verifies the tag over\nthe §2.8 transcript, and ONLY on success decrypts and returns the\nplaintext. A box that is too short to carry a tag, or whose tag\ndoes not match, raises `tag` — the DATA failed, not the caller\n(§2's rule) — and NO PLAINTEXT IS COMPUTED on that path: the error\nrow is the entire result, so a forged box can never leak a byte.\nTraps `assert` only on the caller's own inputs (key/nonce lengths).\nct: `bytes.is_equal_fixed_work` accumulates every tag-byte difference\nbefore the final test: no early exit at source level. Unequal public\nlengths are rejected structurally. Neither this fold nor the cipher's\nfixed-looking source certifies instruction latency, runtime behavior or\nconstant time on any tier; inspect generated default/release code at\nthe exact compiler/runtime pins separately. Vector tests establish\noutputs and rejection, not absence of timing or memory side channels.\n\n```wolf-doc-example\nlet key = \"wolf sc17: a 32-byte chacha key!\".bytes()\nlet nonce = \"twelve bytes\".bytes()\nlet boxed = chacha20.seal(key, nonce, \"hdr\".bytes(), \"attack at dawn\".bytes())\nlet back = chacha20.open(key, nonce, \"hdr\".bytes(), boxed) else List[byte]()\nchacha20.to_hex(back) == \"61747461636b206174206461776e\"\nlet short = chacha20.open(key, nonce, \"hdr\".bytes(), \"not16\".bytes()) else List[byte]()\nshort.len == 0\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 804,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "`b` as lowercase hexadecimal, two digits per byte — this module's\nown rendering so its tests and examples import exactly one module\n(the sha2 precedent); `std.hex.encode` is the facade spelling.\n**Total** — the non-byte element it used to trap on is a type error\nsince sc35.\nct: NOT constant-time — the alphabet slice is indexed by each\nbyte's VALUE, a secret-dependent memory index. Render public\nvalues with it; a constant-time encoder is c28-tier work.\n\n```wolf-doc-example\nchacha20.to_hex(\"abc\".bytes()) == \"616263\"\nchacha20.to_hex(List[byte]()) == \"\"\n```",
          "source": "std/x/crypto/chacha20/chacha20.lu",
          "line": 851,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.curve25519",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.curve25519 — X25519 key exchange (RFC 7748) and\nEd25519 signatures (RFC 8032) over the shared field 2^255 - 19.\nStability tier: x — the D53 crypto ladder's THIRD rung (campaign\nstdc-crypto, sprint sc18). Chosen before Weierstrass P-256 because\nboth curves share one field, are specified in implementation-grade\ndetail in their RFCs. X25519's source-level Montgomery ladder swap\nis arithmetic selection, with no secret-indexed tables. Source shape\nis not a fixed-time certification of generated code or runtime calls;\nreview the exact backend/runtime pins separately. Ed25519 signing has\nthe secret-bit branch documented below. P-256's hardened ladder is a named D-question\nfor the rung that proves ACME demands it; the pinned local test CA\nspeaks Ed25519.\n\n**The nursery banner (D31).** `std.x.crypto.curve25519` is not\n`std.crypto`: its path, names and behaviour may change or vanish in\none sprint; no other std module may depend on it. Its reason and\ngraduation trigger live in `std/x/README.md`. Ed25519's SHA-512 is\n`std.x.crypto.sha2`'s, called through the module boundary — a\nresident MAY depend on the facade, and sha2 is a sibling resident,\nso the dependency is a resident-on-resident one that the graduation\nmove must resolve (named in the register): until `std.crypto` exists\nthe two ride together.\n\n**The field is 255-bit, in ten checked-`int` limbs of ~25.5 bits**\n(the sc18 probe delta's verdict). The naive 51-bit x 5 packing\noverflows: one 51x51 product is 102 bits, past every wolf integer\ntype, and a multiply column sums five of them times up to 38 — so\nRFC 7748's own reference uses 25/26-bit limbs and so does this. The\nten limbs alternate 26 and 25 bits; a carried limb is < 2^26, one\nproduct < 2^52, and the heaviest multiply column measures 2^58.96 —\n16.4x under int_max (2^63 - 1), which X3's checked arithmetic\nenforces at every operation (a violated bound is a trap the vectors\ncatch, never a silent wrap). The carry discipline: every add, sub,\nmultiply and squaring ends in a two-pass `fe_carry` that folds the\n2^255 overflow back times 19 and leaves each limb in range, so\nevery value entering a multiply is carried. NO `wrapping[T]`\nanywhere in the field — it is all checked `int`, three-lane at the\nsc18 pin.\n\n**The scalar field mod L** (the group order,\n2^252 + 27742317777372353535851937790883648493) rides as ten 26-bit\n`int` limbs with its own Barrett-free reduction (fold the top limbs\ntimes C = L - 2^252, MSB-down, then two conditional subtractions);\nEd25519's `s = r + k*a mod L` and the SHA-512 hash reductions use\nit. Same checked-`int` discipline, same bound proof (the heaviest\nsigned column measures 2^52.8).\n\n**X25519's ladder is the Montgomery ladder with an ARITHMETIC\ncswap** (`fe_cswap`) — the secret scalar bit enters only as a\nmultiplier, never a branch, and that function is c28's cswap\nVERIFICATION TARGET (D53), marked in its header. Clamping is RFC\n7748 s5 verbatim. A zero shared secret (small-order public key)\nraises the `zero` row: RFC 8446 s7.4.2 requires a TLS 1.3 endpoint\nto abort rather than use it, and Wycheproof's `ZeroSharedSecret`\ncases are answered that way.\n\n**Ed25519 SIGNING is deterministic** (RFC 8032 s5.1.6): the nonce\nis SHA-512(prefix || message) reduced mod L, where prefix is the\nsecond half of the secret's hash — NO entropy is drawn, and the\nentropy D-question stays parked with the rung that needs it.\n**VERIFY is cofactorless** (RFC 8032 s5.1.7's group equation\n[S]B = R + [k]A, no multiply-by-8), with S < L enforced strictly and\ndecompression's sign bit per s5.1.3 — the choices Wycheproof's\nmalleability cases decide, pinned here. Like the RFC, `verify`\naccepts an A or R of small order ([8]P is the identity).\n**`verify_strict`** (sc77) is `verify` plus the refusal of both, for\na caller whose policy must refuse small-order keys and commitments;\na mixed-order point is a named follow-on (it needs [L]P).\n\n**Constant-time (D53's retrofit clause).** SIGNING handles the\nsecret scalar; its ladder-free scalar multiplication (`sc_mul_base`,\na fixed double-and-add over the SECRET nonce/scalar) and `fe_cswap`\ncarry the ct: obligations. VERIFY is PUBLIC-DATA — a verification\nkey and a signature are public, so `verify`, `verify_strict` and\ntheir point arithmetic have no secret to protect and say so. **The\none recorded ct exception — the 0..255 ingestion guard, which\nbranched on every input byte — is RETIRED (sc35)**; `to_hex` is not\nconstant-time and says so. c28's tier does not exist yet; every\n`pub` fn carries a `ct:` line until it does.\n\n**Byte sequences are `List[byte]` (sc35).** They were `List[int]`\nwith a documented 0..255 element contract (F-0035) that this module\nenforced with a `require_byte` on every ingested element; D72/s135's\n`byte` and s136's byte-typed builtins (wolf-lang#231) make that the\nTYPE's contract, so the guard is deleted and `verify`'s two\nrange-checking loops with it — a scalar, a u-coordinate, a key, a\nsignature and a message are all `List[byte]` and cannot carry a\nnon-byte. `to_hex` is this module's own rendering (the\nsha2/chacha20 precedent), `std.hex.encode` the facade spelling.\n\n**No division (sc84, wolf-std#151).** Nothing in this module divides.\nAt wolf 0.2.39 the x86-64 release ladder compiled its scalar-bit\nextraction (`kb / pow2(t % 8) % 2`) to a hardware `div` of the secret\nscalar byte on each of its 255 steps, and every default build divided\nthe field's limbs in `fe_carry`, `fe_freeze` and `fe_tobytes`, the\nclamp, the ladder, and signing's scalar reduction. The scalar bit is\nnow a shift of the byte by its public position on a `wrapping[u64]`\nword (`scalar_bit`); the field's carries and byte seams are literal\nshifts and masks on limbs the bound proofs keep non-negative, where\nthey equal `/` and `%`; signing's signed carries are floor shifts\n(`[type.int.shift]`). `cargo xtask codegen` builds this module's\ndefault and release objects on the host target and fails on any\ninteger division instruction in them, and runs the RFC 7748 rows, the\n1000-iteration chain among them, and RFC 8032 §7.1 in the release\ntier. What it does not change: Ed25519 signing still gates the add of\nits double-and-add on each secret bit (a branch; the fixed-sequence\nversion is a named follow-on), and `to_hex` indexes by value.\nIt is not a timing measurement (no latency was measured on any CPU),\nit says nothing about the interpreters, and the compiler that makes\nthe objects is not audited; a target the gate is not run on is not\ncovered by it.",
      "summary": "std.x.crypto.curve25519 — X25519 key exchange (RFC 7748) and Ed25519 signatures (RFC 8032) over the shared field 2^255 - 19.",
      "items": [
        {
          "name": "x25519",
          "kind": "fn",
          "signature": "pub fn x25519(scalar: List[byte], u_bytes: List[byte]) -> List[byte] ! {zero}",
          "doc": "X25519 (RFC 7748 s5): the Diffie-Hellman scalar multiplication on\nCurve25519. `scalar` and `u_bytes` are 32-byte little-endian\nsequences; the scalar is clamped per s5 and the u-coordinate's top\nbit masked. Returns the 32-byte shared secret UNLESS it is all-zero,\nin which case it raises `zero`: a zero output means the public key\nwas a small-order point, and RFC 8446 s7.4.2 requires a TLS 1.3\nendpoint to ABORT rather than proceed with a shared secret it knows\nthe peer can predict. Wycheproof's `ZeroSharedSecret` cases are\nexactly this, and this row is how the module answers them.\nTraps `assert` on a scalar or u-coordinate that is not 32 bytes (a\ncaller contract violation); a non-byte element is a type error since\nsc35.\nct: the ladder and cswap have fixed source-level schedules (see\ntheir headers). The shared secret is CONFIDENTIAL, including at the\nzero check; its bytes are OR-folded without a per-byte branch. Only\nthe final zero/nonzero verdict is disclosed. This is not a fixed-time\ncertification of compiled code or of any interpreter/runtime tier.\nDo not log or hex-render a real shared secret; examples use test keys.\n\nDiffie-Hellman — two parties reach the same shared secret. This\nexample imports one module (§4), so it builds keys from strings; the\nRFC 7748 §5.2/§6.1 byte vectors live in the test files.\n\n```wolf-doc-example\nlet a = \"alice's own 32-byte x25519 key!!\".bytes()\nlet b = \"bob's different 32-byte x25519 k\".bytes()\nlet dh_a = curve25519.x25519(a, curve25519.x25519_base(b)) else List[byte]()\nlet dh_b = curve25519.x25519(b, curve25519.x25519_base(a)) else List[byte]()\ncurve25519.to_hex(dh_a) == curve25519.to_hex(dh_b)\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 952,
          "tier": "x"
        },
        {
          "name": "x25519_base",
          "kind": "fn",
          "signature": "pub fn x25519_base(scalar: List[byte]) -> List[byte]",
          "doc": "X25519 against the standard base point u = 9 (RFC 7748 s6.1's key\ngeneration: the public key for a private `scalar`). A base-point\nmultiplication never yields the zero secret, so this one is total\nover its byte contract.\nct: as `x25519`.\n\n```wolf-doc-example\nlet sk = \"a 32-byte curve25519 secret key!\".bytes()\ncurve25519.x25519_base(sk).len == 32\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 988,
          "tier": "x"
        },
        {
          "name": "public",
          "kind": "fn",
          "signature": "pub fn public(secret: List[byte]) -> List[byte]",
          "doc": "The Ed25519 public key for a 32-byte secret (RFC 8032 §5.1.5):\nA = [a]B compressed, where a is the clamped scalar. Traps `assert`\non a secret that is not 32 bytes (sc35: a non-byte element is a type\nerror).\nct: SECRET scalar `a` drives the double-and-add — the bit test is\nthe recorded ct obligation (module header); the derived public key\nis public.\n\n```wolf-doc-example\nlet sk = \"a 32-byte ed25519 secret key !!!\".bytes()\ncurve25519.public(sk).len == 32\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 1480,
          "tier": "x"
        },
        {
          "name": "sign",
          "kind": "fn",
          "signature": "pub fn sign(secret: List[byte], message: List[byte]) -> List[byte]",
          "doc": "Ed25519 signature over `message` under a 32-byte secret (RFC 8032\n§5.1.6). Deterministic: the nonce r = SHA-512(prefix || message)\nmod L draws NO entropy (the entropy D-question stays parked). Returns\nthe 64-byte R || s. Traps `assert` on a secret that is not 32 bytes\n(sc35: a non-byte element is a type error); the message is arbitrary\nbytes.\nct: THE SECRET PATH. The secret drives SHA-512, the clamped scalar,\ntwo base multiplications and `sc_muladd`; the double-and-add's\nbit-gated add is the recorded ct obligation c28 will verify (the\nhonest constant-time scalarmul is a named follow-on; the scalar\nreduction's sign-correction branch left with its division in sc84).\nNo randomness, so no nonce-reuse hazard exists.\n\n```wolf-doc-example\nlet sk = \"a 32-byte ed25519 secret key !!!\".bytes()\nlet msg = \"sign me\".bytes()\nlet sig = curve25519.sign(sk, msg)\nsig.len == 64\ncurve25519.verify(curve25519.public(sk), msg, sig)\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 1506,
          "tier": "x"
        },
        {
          "name": "verify",
          "kind": "fn",
          "signature": "pub fn verify(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool",
          "doc": "Verify an Ed25519 signature (RFC 8032 §5.1.7), COFACTORLESS: the\ngroup equation [S]B = R + [k]A holds with no multiply-by-8, S is\nrejected unless S < L (strict — the malleability check Wycheproof's\ncases patrol), and both A and R must decompress canonically. Returns\ntrue iff the signature is valid; a wrong length, a non-canonical\nencoding, S >= L, or a failed equation all answer false — no trap,\nbecause a signature and a key are the CALLER'S data to check, not a\ncontract they promised (§2's rule: verify answers a bool, it does\nnot trap on a bad signature).\n**Small-order points are accepted**, as RFC 8032 allows: nothing here\nrefuses an A or R whose [8]P is the identity. With A = the encoded\nidentity (`01` then 31 zero bytes) and R || S = that identity then 32\nzero bytes, this answers true for every message. A caller whose\npolicy must refuse small-order keys and commitments calls\n`verify_strict`, which checks everything this function checks and\nthat as well; on honestly generated keys and signatures the two\nagree.\nct: VERIFY IS PUBLIC DATA — the key, the signature and the message\nare all public, so the branches here protect no secret and this\nfunction carries no constant-time obligation (stated in the module\nheader).\n\n```wolf-doc-example\nlet sk = \"a 32-byte ed25519 secret key !!!\".bytes()\nlet msg = \"verify me\".bytes()\nlet sig = curve25519.sign(sk, msg)\ncurve25519.verify(curve25519.public(sk), msg, sig)\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 1547,
          "tier": "x"
        },
        {
          "name": "verify_strict",
          "kind": "fn",
          "signature": "pub fn verify_strict(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool",
          "doc": "Verify an Ed25519 signature STRICTLY: everything `verify` checks\n(the lengths, S < L, canonical decompression of A and R, and RFC 8032\n§5.1.7's cofactorless equation [S]B = R + [k]A), and also false when\nthe public key A or the commitment R has small order, meaning [8]A or\n[8]R is the identity. Those are the eight points of the cofactor\nsubgroup. RFC 8032 accepts them, and `verify` does too: with A = the\nencoded identity (`01` then 31 zero bytes) and R || S = that identity\nthen 32 zero bytes, `verify` answers true for every message. Call\nthis function when a policy must refuse small-order keys and\ncommitments. No honestly generated key or signature has small order,\nso the two functions agree on every one of them. A mixed-order A or R\n(a prime-order point plus a nonzero small-order one) is NOT refused:\nthat needs [L]P, a further scalar multiplication per point\n(`docs/sc77-the-strict-verify.md` measures it). Returns true iff the\nsignature is valid under these rules, and never traps on the caller's\ndata (§2's rule, as for `verify`).\nct: VERIFY IS PUBLIC DATA — the key, the signature and the message\nare all public, so the branches here, the small-order tests included,\nprotect no secret and this function carries no constant-time\nobligation (stated in the module header).\n\n```wolf-doc-example\nvar pk = List[byte]()\n(mut pk).push(1 as byte)\nfor i in 0..31 { (mut pk).push(0 as byte) }\nvar sig = List[byte]()\n(mut sig).push(1 as byte)\nfor i in 0..63 { (mut sig).push(0 as byte) }\ncurve25519.verify(pk, \"any message\".bytes(), sig) == true\ncurve25519.verify_strict(pk, \"any message\".bytes(), sig) == false\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 1605,
          "tier": "x"
        },
        {
          "name": "field_self_test",
          "kind": "fn",
          "signature": "pub fn field_self_test() -> bool",
          "doc": "The field's algebraic identities, checked ALONE (RFC 7748 §5's\narithmetic, before any ladder observes it). Returns true iff every\none holds: additive inverse, commutativity and associativity of\nmultiply, the distributive law, squaring as self-multiply, the\nFermat inverse (a·a⁻¹ = 1), the a24 constant multiply, and the\nbyte round trip (decode∘encode is the identity on a canonical\nvalue). Total, three-lane.\nct: a test predicate over public constants; no secret.\n\n```wolf-doc-example\ncurve25519.field_self_test()\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 1686,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "`b` as lowercase hexadecimal, two digits per byte — this module's\nown rendering so its tests and examples import exactly one module\n(the sha2/chacha20 precedent); `std.hex.encode` is the facade\nspelling. **Total** — the non-byte element it used to trap on is a\ntype error since sc35.\nct: NOT constant-time — the alphabet slice is indexed by each byte's\nVALUE. Render only public keys, signatures or LABELLED test vectors.\nPrivate scalars and shared secrets remain confidential after computation;\nnever log them. This renderer offers no fixed-time guarantee.\n\n```wolf-doc-example\ncurve25519.to_hex(\"abc\".bytes()) == \"616263\"\ncurve25519.to_hex(List[byte]()) == \"\"\n```",
          "source": "std/x/crypto/curve25519/curve25519.lu",
          "line": 1757,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.p256",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.p256 — the NIST P-256 curve (secp256r1) and ECDSA\nsignatures: FIPS 186-5 (ECDSA), SEC1 v2 (point encodings and\nvalidation), NIST SP 800-186 (the domain parameters), RFC 6979\n(deterministic nonces). Stability tier: x — the D53 crypto ladder's\nWeierstrass rung (campaign stdc-crypto, sprint sc23), the curve\nreal-world certificate authorities issue: sc22's `unsupported_alg`\nanswer for an ECDSA-P256 certificate becomes a real verification.\n\n**The nursery banner (D31).** `std.x.crypto.p256` is not\n`std.crypto`: its path, names and behaviour may change or vanish in\none sprint; no other std module may depend on it. Its reason and\ngraduation trigger live in `std/x/README.md`. ECDSA's SHA-256 and\nRFC 6979's HMAC are `std.x.crypto.sha2`'s, called through the\nmodule boundary — a resident-on-resident edge the graduation move\nmust resolve (named in the register beside curve25519's).\n\n## The design ruling: table-free constant-time scalar multiplication\n\nP-256 is a short Weierstrass curve, and the FAST implementations use\nsecret-indexed table lookups — a cache-timing surface no vector set\ncan see. The human-approved ruling (the sc23 contract): this module\nmultiplies with a TABLE-FREE ladder — 256 fixed iterations of one\ncomplete doubling, one complete addition and one ARITHMETIC point\nselection (`fe_select`: the secret bit enters only as a multiplier,\nnever a branch, never an index) — over the COMPLETE addition\nformulas of Renes–Costello–Batina (eprint 2015/1060, the a = -3\nspecialization), which are total: identity, doubling and inverse\ninputs take the same code path as a generic addition, so no\nexceptional-case branch exists for a timing channel to read.\n`scalar_mul` is c28's VERIFICATION TARGET for this module (marked in\nits header): slower than a windowed table, and provably\nconstant-time by construction in portable wolf — c28's ct tier then\nVERIFIES the property instead of compensating for a table. The\nmasked-table and hardware-intrinsic fast paths are named residue\n(their own D-question when a measured performance need appears).\n\n## The field: 16 checked-`int` limbs of 16 bits, Solinas reduction\n\np = 2^256 - 2^224 + 2^192 + 2^96 - 1 (SP 800-186 §3.2.1.3, a\nSolinas prime). The fast reduction is the identity\n2^256 ≡ 2^224 - 2^192 - 2^96 + 1 (mod p): product limb k (k >= 16)\nre-enters at k-16 (+), k-10 (-), k-4 (-), k-2 (+). Sixteen bits is\nthe ONE uniform limb width that fits wolf's int story both ways\n(the sc18 bound-proof discipline, stated before the field was\nwritten): a 16x16 schoolbook column is at most 16 products < 2^32,\nso a column is < 2^36 (measured 2^35.4 over the fuzz corpus), and\n96/192/224/256 are all multiples of 16, so the fold is limb-aligned\n(32-bit limbs overflow a column at 2^68; 24-bit limbs misalign\n2^224). The carry tail adds the constant 2^32·p — which dominates\nany signed fold output, so no intermediate is ever negative-beyond-\nbound — then runs four carry passes folding the 2^256 overflow back\nthrough the identity; the largest value anywhere is the limb-15\nconstant addition at 2^48.0 (measured), 32768x under int_max, and\nX3's checked arithmetic enforces the whole proof at every operation:\na violated bound is a trap the vectors catch, never a silent wrap.\nNO `wrapping[T]` anywhere; no bitwise-on-int (F-0026's spelling).\nEvery algorithm here was fuzzed limb-for-limb against a big-integer\nreference before this file was written (3000 random + adversarial\nfield cases, 60 point-formula rounds incl. the complete-formula edge\ncases, the RFC 6979 vectors end-to-end).\n\n## The scalar field mod n: Montgomery, because n is not Solinas\n\nn (the group order) has an irregular low half, so mod-n arithmetic\nis Montgomery multiplication in base 2^16 (CIOS): fixed schedule,\nno division, no data-dependent trip counts. Inversions mod n and\nmod p are Fermat powers to FIXED PUBLIC exponents (n-2, p-2) — the\nper-bit branch reads a compiled-in constant, never data.\n\n## ECDSA: verify is public, sign is the secret path\n\nVERIFY (FIPS 186-5 §6.4.2) handles only public data — a public key,\na message, a signature — so it carries no constant-time obligation\n(the sc18 rule, stated per fn). The on-curve check of SEC1 §3.2.2\nis MANDATORY on every ingested point: an attacker-supplied point\noff the curve is the invalid-curve attack class, rejected by name\n(`invalid_curve`, `check_point`) and answered `false` by `verify`.\nSIGN (§6.4.1) is the secret path: the nonce and the scalar\nmultiplication are its obligations, enumerated for c28 in the fn\nheaders. **Nonces are RFC 6979 deterministic** — derived from the\nkey and message through HMAC-SHA-256, drawing NO entropy. The\nruling's lean, taken, and justified: nonce REUSE (or bias) leaks\nthe private key outright, deterministic derivation removes the\nhazard class entirely, it needs no os capability (this module stays\npure and comptime-refusable only through its sha2 delegate), and it\nis byte-for-byte testable (RFC 6979 A.2.5 pins k, r and s). s118's\n`os_random` is the sanctioned entropy source when a consumer needs\nrandomized signatures; that variant is named residue, not built.\n\n## ct: obligations, enumerated (c28's checklist for this module)\n\n- `scalar_mul` — THE target: fixed 256 iterations, complete\n  formulas, arithmetic selection; the secret bit is a multiplier.\n- `fe_select` — the selection itself (sc18's `fe_cswap` class).\n- the RFC 6979 HMAC chain — fixed-schedule digest work (sha2's).\n- recorded exceptions, all shared with the ladder's precedent —\n  **and one of them RETIRED at sc35**: the 0..255 ingestion guard\n  branched per input byte (F-0035's class) and is gone with the byte\n  type; `floordiv`'s sign correction (sc18's note); the 6979\n  candidate-acceptance compare (`bytes_geq_n`) — the RFC's own\n  rejection sampling, at most one extra HMAC round per 2^32 keys.\n- VERIFY and everything it calls: public data, no obligation.\n\n**Byte sequences are `List[byte]` (sc35).** They were `List[int]`\nwith a documented 0..255 element contract (F-0035) that this module\npoliced with `require_byte` at every door; D72/s135's `byte` and\ns136's byte-typed builtins (wolf-lang#231) make it the TYPE's, so\nthe guard is deleted and `verify`'s two range-checking loops with\nit. All multi-byte values are BIG-endian (SEC1/FIPS convention —\nunlike curve25519's little-endian RFCs). `to_hex` is this module's\nown rendering (the ladder precedent).",
      "summary": "std.x.crypto.p256 — the NIST P-256 curve (secp256r1) and ECDSA signatures: FIPS 186-5 (ECDSA), SEC1 v2 (point encodings and validation), NIST SP 800-186 (the domain parameters), RFC 6979 (deterministic nonces).",
      "items": [
        {
          "name": "public_key",
          "kind": "fn",
          "signature": "pub fn public_key(d: List[byte]) -> List[byte]",
          "doc": "The ECDSA public key for a 32-byte big-endian private key `d` in\n[1, n): the uncompressed SEC1 encoding of [d]G (0x04 || X || Y).\nTraps `assert` on a private key that is not 32 bytes, carries a\nzero, or >= n (a caller contract violation:\nFIPS 186-5 §6.2.1 requires d in [1, n-1]). ct: SECRET scalar `d`\ndrives the table-free ladder (`scalar_mul`, c28's target); the\nderived public key is public.\n\nExample (native lane — a scalar multiplication is a table-free\nladder past lupin's step budget, so this is prose not a fenced\nblock; the pinned witnesses are `rfc6979_p256.lu` and\n`sign_verify_smoke.lu`): `p256.public_key(d)` returns 65 bytes for a\n32-byte private key `d` in [1, n).",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2221,
          "tier": "x"
        },
        {
          "name": "sign",
          "kind": "fn",
          "signature": "pub fn sign(d: List[byte], message: List[byte]) -> List[byte]",
          "doc": "An ECDSA signature over `message` under the 32-byte big-endian\nprivate key `d`, as the 64-byte fixed-width r || s (each 32 bytes,\nbig-endian — the JOSE / IEEE P1363 form; DER is `signature_der`).\nThe message is hashed with SHA-256 (ES256). The nonce is RFC 6979\nDETERMINISTIC — derived from `d` and the message, drawing NO entropy\n(the design ruling: no nonce-reuse hazard, no os capability, byte-\nexact testable). Retries the RFC 6979 candidate on the ~2^-256\nevents r = 0 or s = 0. Traps `assert` on a bad private key (see\n`public_key`); the message is arbitrary bytes.\nct: THE SECRET PATH. `d` and the nonce drive the RFC 6979 HMAC\nchain, `scalar_mul` (c28's target) and the mod-n arithmetic; the\nenumerated obligations are the ladder, `fe_select`, and the noted\nexceptions in the module header. No randomness, so no reuse hazard.\n\nExample (native lane, prose — the sign path is a table-free ladder\npast lupin's step budget; pinned byte-exact in `rfc6979_p256.lu`):\n`p256.sign(d, msg)` returns a 64-byte r || s that\n`p256.verify(p256.public_key(d), msg, sig)` accepts.",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2277,
          "tier": "x"
        },
        {
          "name": "verify",
          "kind": "fn",
          "signature": "pub fn verify(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool",
          "doc": "Verify an ECDSA signature (FIPS 186-5 §6.4.2) over `message` given a\n65-byte uncompressed SEC1 public key and the 64-byte r || s\nsignature. Returns true iff valid. Answers FALSE — never a trap —\nfor a wrong-length key or signature, a public\nkey that fails the SEC1 §3.2.2 on-curve check (the invalid-curve\nrejection), r or s outside [1, n), or a failed verification\nequation: a signature and a key are the CALLER'S data to check, not\na contract they promised (§2's rule). The message is hashed with\nSHA-256 (ES256).\nct: VERIFY IS PUBLIC DATA — the key, signature and message are all\npublic, so no branch here protects a secret and this function\ncarries no constant-time obligation (the sc18 rule).\n\nExample (native lane, prose — a verify is two table-free ladders\npast lupin's step budget; pinned by the CAVP/Wycheproof suites and\n`sign_verify_smoke.lu`): `p256.verify(p256.public_key(d), msg,\np256.sign(d, msg))` is true; a flipped signature byte is false.",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2375,
          "tier": "x"
        },
        {
          "name": "verify_der",
          "kind": "fn",
          "signature": "pub fn verify_der(pubkey: List[byte], message: List[byte], der: List[byte]) -> bool",
          "doc": "Verify an ECDSA signature supplied in DER form (SEQUENCE{INTEGER r,\nINTEGER s}) — the encoding X.509 certificates and TLS carry, and\nexactly what sc22's chain validator hands this module. Strict DER:\na malformed encoding answers FALSE (never a trap), by the same rule\nas `verify`. ct: public data.\n\nExample (native lane, prose — a verify is two table-free ladders\npast lupin's step budget; the strict-DER rejections are pinned\nthree-lane in `der_codec.lu`): `p256.verify_der(pk, msg,\np256.signature_der(p256.sign(d, msg)))` is true, and a malformed\nDER signature is false, never a trap.",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2582,
          "tier": "x"
        },
        {
          "name": "signature_der",
          "kind": "fn",
          "signature": "pub fn signature_der(sig: List[byte]) -> List[byte]",
          "doc": "Encode a 64-byte r || s signature as strict DER (SEQUENCE{INTEGER r,\nINTEGER s}) — the form for an X.509/TLS consumer. Each half becomes\na minimal nonnegative INTEGER (a leading 0x00 added when the high\nbit is set). Traps `assert` on a signature that is not 64 bytes.\nct: public data.",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2595,
          "tier": "x"
        },
        {
          "name": "field_self_test",
          "kind": "fn",
          "signature": "pub fn field_self_test() -> bool",
          "doc": "The FIELD's algebraic identities plus the cheap curve laws, checked\nALONE before any ECDSA path observes them (the field-first\ndiscipline): additive inverse, multiply commutativity /\nassociativity, distributivity, squaring as self-multiply, the\nFermat inverse (a·a⁻¹ = 1), the byte round trip, that G is on the\ncurve (SEC1 §3.2.2), and that the COMPLETE addition and doubling\nagree on [2]G. No 256-iteration scalar multiplication, so this fits\nthe checked tier's step budget — THREE-LANE (the group-order check\nthat needs a full ladder is in `self_test`). Returns true iff every\nidentity holds. ct: a test predicate over public constants.\n\n```wolf-doc-example\np256.field_self_test()\n```",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2700,
          "tier": "x"
        },
        {
          "name": "self_test",
          "kind": "fn",
          "signature": "pub fn self_test() -> bool",
          "doc": "The full self-test: `field_self_test` plus the GROUP-ORDER check\nthat [n-1]G + G is the identity (so [n]G = O, n the group order) —\na full table-free ladder, so this exceeds the checked tier's step\nbudget and lupin's evaluation budget (native + `slow`, the ladder\nprecedent). Returns true iff every identity and the group law hold.\nct: a test predicate over public constants; no secret.",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2742,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "`b` as lowercase hexadecimal, two digits per byte. **Total** — the\nnon-byte element it used to trap on is a type error since sc35.\nct: NOT constant-time (the alphabet\nslice is indexed by each byte's value) — renders public values only;\na constant-time encoder is c28-tier work.\n\n```wolf-doc-example\np256.to_hex(\"abc\".bytes()) == \"616263\"\np256.to_hex(List[byte]()) == \"\"\n```",
          "source": "std/x/crypto/p256/p256.lu",
          "line": 2778,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.p384",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.p384 — ECDSA signature VERIFICATION over the NIST P-384\ncurve (secp384r1): FIPS 186-5 §6.4.2 (ECDSA verify), SEC 1 v2 (point\nencodings, §2.3.4, and public-key validation, §3.2.2), SP 800-186\n§3.2.1.4 (the domain parameters). Stability tier: x — the D53 crypto\nladder's second Weierstrass rung (sprint sc79, wolf-std#101): the\ncurve most public-PKI intermediates and many roots carry, and TLS\n1.3's `ecdsa_secp384r1_sha384`.\n\n**The nursery banner (D31).** `std.x.crypto.p384` is not\n`std.crypto`: its path, names and behaviour may change or vanish in\none sprint; no other std module may depend on it. Its reason and\ngraduation trigger live in `std/x/README.md`. SHA-384 is\n`std.x.crypto.sha2`'s, through the module boundary — a\nresident-on-resident edge the graduation move must resolve.\n\n**Verify only.** No signing, no key generation, no ECDH: nothing in\nthis module ever holds a private scalar. The surface mirrors\n`std.x.crypto.p256`'s verify half — `verify` over the raw r || s\nform, `verify_der` over the DER form X.509 and TLS carry — plus\n`verify_digest_der`, which takes a digest of any length so an X.509\nsignature under ecdsa-with-SHA256 or -SHA512 by a P-384 key verifies\nthrough FIPS 186-5's bits2int.\n\n## Public-key work: no constant-time obligation\n\nA public key, a message and a signature are all public, so no branch\nhere protects a secret (the sc18 verify-is-public rule): the joint\nscalar multiplication branches on the bits of u1 and u2, the point\nformulas take their exceptional-case branches openly, and the\ncomparisons exit early. That is why this module is NOT p256's\ntable-free ladder: it is the verify-only shape, and a signing rung\nwould need its own constant-time design.\n\n## The arithmetic\n\nField elements mod p and scalars mod n are sixteen little-endian\nlimbs of 24 bits in checked `int`s, multiplied by Montgomery's method\n(CIOS, R = 2^384): every product is under 2^48 and every accumulator\nunder 2^50, which X3's checked arithmetic enforces at each operation.\np ≡ −1 mod 2^24, so the field's Montgomery quotient constant is 1;\nboth constants are derived at run time by the same Newton iteration.\nR² mod p and R² mod n are built by doubling and squaring (L = 384 =\n3·2^7). Points are Jacobian (X : Y : Z) with the a = −3 doubling and\nthe general addition, each exceptional case (an input at infinity,\nP + P, P + (−P)) decided explicitly; verification is Shamir's joint\ndouble-and-add for u1·G + u2·Q over the 384 bits, and the final\nx-coordinate test compares X with r·Z² (and (r + n)·Z² when r + n < p)\ninstead of inverting Z. s⁻¹ mod n is a Fermat power to the fixed\npublic exponent n − 2.\n\n## Refusals\n\nEvery verifier answers FALSE, never a trap, for: a public key that is\nnot the 97-byte uncompressed SEC 1 encoding (0x04 || X || Y), a\ncoordinate ≥ p, a point off the curve (the invalid-curve class, SEC 1\n§3.2.2); r or s outside [1, n); a DER signature that is not exactly\n`SEQUENCE { INTEGER r, INTEGER s }` in strict X.690 DER (one short\nlength octet each, minimal non-negative INTEGERs, nothing trailing);\na raw signature that is not 96 bytes; and the point at infinity as\nthe result. Byte sequences are `List[byte]`, big-endian (SEC 1).\n`to_hex` is this module's own rendering (the ladder precedent).",
      "summary": "std.x.crypto.p384 — ECDSA signature VERIFICATION over the NIST P-384 curve (secp384r1): FIPS 186-5 §6.4.2 (ECDSA verify), SEC 1 v2 (point encodings, §2.3.4, and public-key validation, §3.2.2), SP 800-186 §3.2.1.4 (the domain parameters).",
      "items": [
        {
          "name": "verify_digest_der",
          "kind": "fn",
          "signature": "pub fn verify_digest_der(pubkey: List[byte], digest: List[byte], der: List[byte]) -> bool",
          "doc": "Verify an ECDSA P-384 signature (FIPS 186-5 §6.4.2) given as a\nprecomputed digest of any length (bits2int takes its leftmost 384\nbits; a shorter digest is used whole) and a strict-DER signature.\nThis is the X.509 path for ecdsa-with-SHA256 and -SHA512 under a\nP-384 key. False — never a trap — for every refusal in the module\nheader.\nct: VERIFY IS PUBLIC DATA — no branch here protects a secret.\n\nExample (native lane, prose — a verify is a 384-bit joint scalar\nmultiplication, past the interpreter's step budget): every case of\nthe vendored Wycheproof SHA-256 and SHA-512 P-384 files is a row\nunder `tests/x/crypto/p384/`.",
          "source": "std/x/crypto/p384/p384.lu",
          "line": 774,
          "tier": "x"
        },
        {
          "name": "verify_der",
          "kind": "fn",
          "signature": "pub fn verify_der(pubkey: List[byte], message: List[byte], der: List[byte]) -> bool",
          "doc": "Verify an ECDSA P-384 signature with SHA-384 (TLS 1.3's\n`ecdsa_secp384r1_sha384`, X.509's ecdsa-with-SHA384) over `message`,\nthe signature in the DER form X.509 and TLS carry. False — never a\ntrap — for every refusal in the module header.\nct: VERIFY IS PUBLIC DATA.\n\nExample (native lane, prose): every case of the vendored Wycheproof\n`ecdsa_secp384r1_sha384` file is a row under `tests/x/crypto/p384/`;\nthe early refusals (bad keys, bad DER, r or s out of range) are\nthree-lane in `verify_reject_early.lu`.",
          "source": "std/x/crypto/p384/p384.lu",
          "line": 797,
          "tier": "x"
        },
        {
          "name": "verify",
          "kind": "fn",
          "signature": "pub fn verify(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool",
          "doc": "Verify an ECDSA P-384 signature with SHA-384 over `message`, the\nsignature as the raw 96-byte r || s (IEEE P1363) form. False — never\na trap — for a signature that is not 96 bytes and every refusal in\nthe module header.\nct: VERIFY IS PUBLIC DATA.\n\nExample (native lane, prose): every case of the vendored Wycheproof\n`ecdsa_secp384r1_sha384_p1363` file is a row under\n`tests/x/crypto/p384/`.",
          "source": "std/x/crypto/p384/p384.lu",
          "line": 819,
          "tier": "x"
        },
        {
          "name": "self_test",
          "kind": "fn",
          "signature": "pub fn self_test() -> bool",
          "doc": "The group self-test: G is on the curve and [n]G is the point at\ninfinity, through the module's own point arithmetic. Total.\nct: public constants only.\n\nExample (native lane, prose): `p384.self_test()` is true;\n`tests/x/crypto/p384/self_test.lu` runs it.",
          "source": "std/x/crypto/p384/p384.lu",
          "line": 837,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "Lowercase hex of a byte list. ct: public data (a rendering\nconvenience only).\n\n```wolf-doc-example\np384.to_hex(\"abc\".bytes()) == \"616263\"\np384.to_hex(List[byte]()) == \"\"\n```",
          "source": "std/x/crypto/p384/p384.lu",
          "line": 858,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.passwd",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.passwd — password hashing in crypt(5)'s `$7$` form:\nscrypt (RFC 7914) behind the string a shadow(5) line stores. The\nmodule name is `passwd` (sprint sc80 chose it: the layer a `passwd`,\n`login`, `su` or `sudo` calls). Stability tier: x — the D53 crypto\nladder's memory-hard rung, the hash under PAX's passwords.\n\n**The nursery banner (D31).** `std.x.crypto.passwd` is not\n`std.crypto`: its path, names and behaviour may change or vanish in\none sprint; no other std module may depend on it; its reason and\ngraduation trigger live in `std/x/README.md`. scrypt is\n`std.x.crypto.scrypt`'s through the module boundary, a\nresident-on-resident edge the graduation move must resolve.\n\n**The surface.** `gen_salt(random)` makes a salt string from octets\nthe caller read from the OS random source (getrandom(2), or\n`/dev/urandom`): never a fixed salt, and a short or all-zero buffer\nis refused. `cost(n_log2, r, p)` checks scrypt's three parameters.\n`hash(password, salt, cost)` returns the exact `$7$` string.\n`verify(password, stored)` answers whether `password` hashes to\n`stored`, comparing the derived key in constant time, and refuses by\nname a string it cannot check. `parse(stored)` is the parser both\nuse, and `encode` is its inverse.\n\n**The string.** crypt(5) gives `$7$`'s shape as\n`\\$7\\$[./A-Za-z0-9]{11,97}\\$[./A-Za-z0-9]{43}` and nothing of its\ninner encoding. That encoding was learned from Ubuntu 24.04's crypt\n(libxcrypt 4.4.36) run as a black box, and is held to it by sc80's\ninterop rows. After `$7$` come: one character, log2 N; five, r; five,\np; then the salt characters; then `$` and 43 characters of the\n32-octet derived key. The alphabet is crypt's\n`./0-9A-Za-z` (value 0 to 63, in that order). r and p are 30-bit\nnumbers, six bits a character, least significant first. The key is\nwritten three octets to four characters, the first octet in the low\nbits and the low six bits first; its last two octets take three\ncharacters, so the 43rd carries four bits and is canonical only below\n16. **The salt characters ARE scrypt's salt octets** (they are not\ndecoded first): scrypt(password, salt-string, N, r, p, 32).\n\n**What is refused, by name** (lowercase marks): `empty` (an empty\nfield, which shadow(5) reads as \"no password\"), `locked` (a field\nstarting `!` or `*`), `unsupported` (another crypt(5) method:\n`$y$`, `$gy$`, `$2a$`/`$2b$`/`$2x$`/`$2y$`, `$6$`, `$5$`, `$sha1$`,\n`$md5`, `$1$`, `$3$`, any other `$id$` or `$id,` prefix, BSDi's `_`\nform and the 13-to-178-character DES forms), `malformed` (any other\nshape, and a `$7$` setting with no `$` before a hash), `bad_n` (log2\nN not a character of the alphabet, below 1, or not below 16·r),\n`bad_rp` (r or p not five characters of the alphabet, below 1, or\nr·p at least 2^30), `bad_salt` (a character outside the alphabet, or\nmore than 86), `bad_hash` (not 43 characters of the alphabet, or a\nnon-canonical last character), `over_cap` (scrypt's working memory\nover the cap) and `bad_random` (`gen_salt`'s input). None of them\ntraps.\n\n**The cap.** `verify` holds a stored string's cost to `default_cap()`:\n`scrypt.memory(18, 32, 1, 32)`, a little over 1 GiB, the largest cost\nUbuntu's `crypt_gensalt` writes (`mkpasswd -R 11`). `verify_capped`\ntakes a caller's own. `hash` uses `default_cap()` too, so every\nstring it makes verifies under the default.\n\n**A named difference.** crypt(3) reads the password as a C string and\nstops at a zero octet; `hash` and `verify` hash every octet of the\n`List[byte]` they are given. A password containing a zero octet\ntherefore hashes differently here than under crypt(3).\n\n**What is and is not constant-time** (D53's retrofit clause; c28\ndoes not exist yet, so these are recorded, not verified):\n- `verify`'s comparison of the derived key with the stored one is\n  constant-time over the 32 octets: it ORs every octet's XOR into one\n  accumulator and tests it once, with no early exit.\n- scrypt itself is NOT: ROMix indexes V by secret state, by design\n  (`std.x.crypto.scrypt`'s header).\n- The parser, the base-64 alphabet and `encode` branch and index on\n  the stored string's characters. The string is what shadow(5)\n  stores, and the salt and cost are public parts of it; the stored\n  key is decoded with value-indexed lookups, which a local observer\n  with a cache side channel could in principle see.\n- `gen_salt` indexes the alphabet by the random octets' values. A\n  salt is public once stored.\n- Every path's control flow depends on the password's length\n  (HMAC's key path, `std.x.crypto.sha2`), never on its octets.",
      "summary": "std.x.crypto.passwd — password hashing in crypt(5)'s `$7$` form: scrypt (RFC 7914) behind the string a shadow(5) line stores.",
      "items": [
        {
          "name": "Cost",
          "kind": "struct",
          "signature": "pub struct Cost { n_log2: int, r: int, p: int, }",
          "doc": "scrypt's three cost parameters, as a `$7$` string carries them: N =\n2^`n_log2`, block size `r`, parallelization `p`. Make one with\n`cost`, which checks them; a hand-edited one that breaks the checks\nis refused by `hash` with the same names.",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 90,
          "tier": "x"
        },
        {
          "name": "Hashed",
          "kind": "struct",
          "signature": "pub struct Hashed { cost: Cost, salt: str, digest: List[byte], }",
          "doc": "A parsed `$7$` string: its cost, its salt characters (scrypt's salt\noctets) and the 32-octet derived key it stores.",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 98,
          "tier": "x"
        },
        {
          "name": "cost",
          "kind": "fn",
          "signature": "pub fn cost(n_log2: int, r: int, p: int) -> Cost ! {bad_n, bad_rp}",
          "doc": "The cost N = 2^`n_log2`, r, p, checked as a `$7$` string must carry\nit. Rows: `bad_rp` when r or p is below 1 or r·p is at least 2^30\n(five characters hold 30 bits, and RFC 7914 §2's bound on p); `bad_n`\nwhen `n_log2` is below 1, above 63 (one character), or not below\n16·r (RFC 7914 §2: N < 2^(128·r/8)). Never traps.\nct: public parameters only.\n\n```wolf-doc-example\nlet c = passwd.cost(14, 8, 1)?\nc.n_log2 == 14 && c.r == 8 && c.p == 1\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 115,
          "tier": "x"
        },
        {
          "name": "default_cap",
          "kind": "fn",
          "signature": "pub fn default_cap() -> int",
          "doc": "The working-memory ceiling `verify` and `hash` hold a cost to:\n`scrypt.memory(18, 32, 1, 32)` octets (N = 2^18, r = 32, p = 1, the\nlargest cost Ubuntu's `crypt_gensalt` writes). Total.\nct: a constant.\n\n```wolf-doc-example\npasswd.default_cap() > 1073741824\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 145,
          "tier": "x"
        },
        {
          "name": "gen_salt",
          "kind": "fn",
          "signature": "pub fn gen_salt(random: List[byte]) -> str ! {bad_random}",
          "doc": "A salt string from `random`, octets the caller read from the OS\nrandom source (getrandom(2) or `/dev/urandom`; std draws no entropy\nof its own): the octets in crypt's base-64, so 16 octets make the 22\ncharacters Ubuntu's `crypt_gensalt` writes and 64 make the 86 a `$7$`\nstring holds at most. Rows: `bad_random` when `random` is shorter\nthan 16 octets (crypt(5)'s 128 recommended bits), longer than 64, or\nall zero (an unfilled buffer, never a draw). Never traps.\nct: NOT constant-time — the alphabet is indexed by the octets'\nvalues. A salt is public once it is stored.\n\n```wolf-doc-example\npasswd.gen_salt(\"0123456789abcdef\".bytes())? == \"k2XAnEHBqQ1Ct2aMXFKNa/\"\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 317,
          "tier": "x"
        },
        {
          "name": "encode",
          "kind": "fn",
          "signature": "pub fn encode(h: Hashed) -> str",
          "doc": "The `$7$` string for `h`: `$7$`, log2 N, r and p, the salt, `$`, the\n43-character key. The inverse of `parse` on every string `parse`\naccepts. Traps `assert` when `h` was not made by `parse` or `hash`\n(a digest that is not 32 octets, or a cost outside one character and\nthirty bits): the caller could have checked.\nct: NOT constant-time — the alphabet is indexed by the key's octets.\n\n```wolf-doc-example\nlet line = \"$7$C6..../....yb/XZj1NCg1rb/5RytWq5/$N8T0E6rYyvGsPmqhviAsRS2f9A6wYzomUd6ouVMA/S2\"\npasswd.encode(passwd.parse(line)?) == line\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 351,
          "tier": "x"
        },
        {
          "name": "parse",
          "kind": "fn",
          "signature": "pub fn parse(stored: str) -> Hashed ! { empty, locked, unsupported, malformed, bad_n, bad_rp, bad_salt, bad_hash, }",
          "doc": "Parses a stored crypt(5) field as a `$7$` string. Rows, in this\norder: `empty` (no characters), `locked` (a leading `!` or `*`,\nshadow(5)'s marks), `unsupported` (another method's form: a `$id$` or\n`$id,` prefix other than `$7$`, BSDi's 20-character `_` form, or the\n13-to-178-character DES forms), `malformed` (any other shape, a\n`$7$` string too short to hold its eleven parameter characters, or\none with no `$` before a hash), then `bad_n`, `bad_rp`, `bad_salt`\nand `bad_hash` as the module header defines them. Never traps.\nct: branches on the string's characters (see the module header).\n\n```wolf-doc-example\nlet h = passwd.parse(\"$7$C6..../....yb/XZj1NCg1rb/5RytWq5/$N8T0E6rYyvGsPmqhviAsRS2f9A6wYzomUd6ouVMA/S2\")?\nh.cost.n_log2 == 14 && h.cost.r == 8 && h.cost.p == 1\nh.salt == \"yb/XZj1NCg1rb/5RytWq5/\" && h.digest.len == 32\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 399,
          "tier": "x"
        },
        {
          "name": "hash",
          "kind": "fn",
          "signature": "pub fn hash(password: List[byte], salt: str, c: Cost) -> str ! {bad_n, bad_rp, bad_salt, over_cap}",
          "doc": "The `$7$` string for `password` under `salt` and `c`: scrypt(password,\nsalt, 2^n_log2, r, p, 32) behind the parameters, exactly as Ubuntu's\ncrypt writes it for the same setting. `salt` is a string of 0 to 86\nalphabet characters, normally `gen_salt`'s. Rows: `bad_salt` (a\ncharacter outside the alphabet, or more than 86), `bad_n` and\n`bad_rp` (a `Cost` edited past `cost`'s checks), `over_cap` (the cost\nneeds more than `default_cap()`). Never traps.\nct: see the module header — the derived key's encoding indexes the\nalphabet by value; scrypt indexes V by secret state.\n\n```wolf-doc-example\nlet c = passwd.cost(4, 1, 1)?\nlet line = passwd.hash(\"pleaseletmein\".bytes(), \"SodiumChloride\", c)?\nline == \"$7$2/..../....SodiumChloride$vqI1uzLxlCqAVSFu53sXGjHrKfJFlaQ0Qh2wdmJ4QP/\"\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 515,
          "tier": "x"
        },
        {
          "name": "verify_capped",
          "kind": "fn",
          "signature": "pub fn verify_capped(password: List[byte], stored: str, cap: int) -> bool ! { empty, locked, unsupported, malformed, bad_n, bad_rp, bad_salt, bad_hash, over_cap, }",
          "doc": "`verify` with the caller's own memory ceiling: whether `password`\nhashes to `stored` when scrypt's working memory for the stored cost\nis at most `cap` octets. Rows: every `parse` row, then `over_cap`.\nA wrong password is `false`, never a row. Never traps.\nct: the key comparison is constant-time (the module header).\n\n```wolf-doc-example\nlet line = passwd.hash(\"pleaseletmein\".bytes(), \"SodiumChloride\", passwd.cost(4, 1, 1)?)?\npasswd.verify_capped(\"pleaseletmein\".bytes(), line, 65536)? == true\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 555,
          "tier": "x"
        },
        {
          "name": "verify",
          "kind": "fn",
          "signature": "pub fn verify(password: List[byte], stored: str) -> bool ! { empty, locked, unsupported, malformed, bad_n, bad_rp, bad_salt, bad_hash, over_cap, }",
          "doc": "Whether `password` hashes to `stored`, a crypt(5) field: the stored\n`$7$` string's own cost and salt are used, and the derived key is\ncompared with the stored one in constant time. The cost is held to\n`default_cap()`. Rows: `empty`, `locked`, `unsupported`, `malformed`,\n`bad_n`, `bad_rp`, `bad_salt`, `bad_hash` (`parse`'s), and `over_cap`\n(a stored cost over the cap). A wrong password is `false`, never a\nrow. Never traps.\nct: the key comparison is constant-time (the module header).\n\n```wolf-doc-example\nlet line = passwd.hash(\"pleaseletmein\".bytes(), \"SodiumChloride\", passwd.cost(4, 1, 1)?)?\npasswd.verify(\"pleaseletmein\".bytes(), line)? == true\nvar wrong = \"pleaseletmein\".bytes()\nwrong[0] = 0 as byte\npasswd.verify(wrong, line)? == false\n```",
          "source": "std/x/crypto/passwd/passwd.lu",
          "line": 590,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.rsa",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.rsa — RSA signature VERIFICATION (RFC 8017, PKCS #1\nv2.2): RSASSA-PKCS1-v1_5 (§8.2.2) and RSASSA-PSS with MGF1 (§8.1.2,\n§9.1.2, B.2.1), over SHA-256, SHA-384 and SHA-512. Stability tier: x\n— the D53 crypto ladder's RSA rung (sprint sc79, wolf-std#101), the\nalgorithm most of the public PKI still signs with: X.509 certificate\nsignatures (PKCS#1 v1.5 and PSS) and TLS 1.3's `rsa_pss_rsae_*`\nCertificateVerify.\n\n**The nursery banner (D31).** `std.x.crypto.rsa` is not `std.crypto`:\nits path, names and behaviour may change or vanish in one sprint; no\nother std module may depend on it. Its reason and graduation trigger\nlive in `std/x/README.md`. The digests are `std.x.crypto.sha2`'s,\ncalled through the module boundary — a resident-on-resident edge the\ngraduation move must resolve (named beside curve25519's and p256's).\n\n**Verify only.** No signing, no key generation, no encryption or\ndecryption: nothing in this module ever holds a private key.\n\n## Public-key work: no constant-time obligation\n\nEvery input here is public — a public key, a message, a signature —\nso no branch or memory access protects a secret, and this module\ncarries no constant-time obligation (the sc18 verify-is-public rule).\nThe modular exponentiation branches on the exponent's bits and the\ncomparisons exit early; both are public. It is stated here, and on\neach `pub` fn, so that a later signing rung cannot inherit this\nbignum by assumption: signing needs its own constant-time design.\n\n## The key policy (refusals by name)\n\n`public_key` and `parse_public_key` refuse, each by its own tag:\n`small_modulus` (n under 2048 bits), `large_modulus` (n over 4096\nbits: the bignum is sized for 2048–4096, and the bound keeps a\nhostile key from buying unbounded work), `bad_modulus` (an even n),\n`bad_exponent` (e even, e < 3, e ≥ n, or e ≥ 2^256 — RFC 8017 §3.1's\nrange with FIPS 186-5's upper bound), and, for the DER form, `der`\n(an RSAPublicKey that is not strict X.690 DER: indefinite or\nnon-minimal lengths, a negative or non-minimal INTEGER, trailing\nbytes). The verifiers re-check the policy on every call, because\nthis pin has no private fields and a `PublicKey` can be forged: a key\noutside the policy verifies nothing.\n\n## The two schemes, exactly as RFC 8017 writes them\n\n`verify_pkcs1` is RSASSA-PKCS1-V1_5-VERIFY: RSAVP1, then the\nENCODE-AND-COMPARE of §8.2.2 steps 3–4 — the expected encoding\n`0x00 0x01 PS 0x00 T` is built from the message and compared octet\nfor octet, with `T` the DER DigestInfo whose algorithm parameters\nare NULL (§9.2 Note 1). No ASN.1 is parsed out of a signature, so\nthe BER-padding and garbage-in-DigestInfo forgery classes have\nnothing to hide in; a DigestInfo without the NULL is rejected.\n`verify_pss` is RSASSA-PSS-VERIFY with emBits = modBits − 1, MGF1\nover the message hash, and the salt length the caller names (TLS\n1.3's `rsa_pss_rsae_*` require the digest length, RFC 8446 §4.2.3).\n\n## The bignum\n\nLittle-endian limbs of 24 bits in checked `int`s, so every product\nis under 2^48 and every accumulator under 2^50 (X3's checked\narithmetic enforces the bound at each operation). Multiplication is\nMontgomery's (CIOS, R = 2^(24k) for k limbs); R² mod n is built by\ndoubling 2^(L+t) mod n, where L = 24k = t·2^s with t odd, and then\nsquaring it s times in the Montgomery domain. The exponentiation is\nleft-to-right square-and-multiply over e's bits: 19 Montgomery\nmultiplications for e = 65537.\n\nByte sequences are `List[byte]`, big-endian (RFC 8017's I2OSP and\nOS2IP). `to_hex` is this module's own rendering (the ladder\nprecedent).",
      "summary": "std.x.crypto.rsa — RSA signature VERIFICATION (RFC 8017, PKCS #1 v2.2): RSASSA-PKCS1-v1_5 (§8.2.2) and RSASSA-PSS with MGF1 (§8.1.2, §9.1.2, B.2.1), over SHA-256, SHA-384 and SHA-512.",
      "items": [
        {
          "name": "PublicKey",
          "kind": "struct",
          "signature": "pub struct PublicKey { modulus: List[byte], exponent: List[byte], bits: int, }",
          "doc": "An RSA public key (RFC 8017 §3.1): the modulus n and the public\nexponent e as minimal big-endian bytes, and n's length in bits. Made\nby `public_key` or `parse_public_key`, which enforce the policy in\nthe module header; every verifier checks it again, so a forged key\nanswers false rather than trapping.\nct: public data.",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 85,
          "tier": "x"
        },
        {
          "name": "hash_sha256",
          "kind": "fn",
          "signature": "pub fn hash_sha256() -> int",
          "doc": "The SHA-256 selector for `verify_pkcs1` and `verify_pss`: its digest\nsize in bits. ct: public.\n\n```wolf-doc-example\nrsa.hash_sha256() == 256\n```",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 97,
          "tier": "x"
        },
        {
          "name": "hash_sha384",
          "kind": "fn",
          "signature": "pub fn hash_sha384() -> int",
          "doc": "The SHA-384 selector. ct: public.\n\n```wolf-doc-example\nrsa.hash_sha384() == 384\n```",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 106,
          "tier": "x"
        },
        {
          "name": "hash_sha512",
          "kind": "fn",
          "signature": "pub fn hash_sha512() -> int",
          "doc": "The SHA-512 selector. ct: public.\n\n```wolf-doc-example\nrsa.hash_sha512() == 512\n```",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 115,
          "tier": "x"
        },
        {
          "name": "public_key",
          "kind": "fn",
          "signature": "pub fn public_key(modulus: List[byte], exponent: List[byte]) -> PublicKey ! { small_modulus, large_modulus, bad_modulus, bad_exponent, }",
          "doc": "An RSA public key from its modulus and exponent as big-endian bytes\n(leading zero octets allowed and dropped), under the module's policy.\n\nRows: `small_modulus` — n is under 2048 bits; `large_modulus` — n is\nover 4096 bits; `bad_modulus` — n is even; `bad_exponent` — e is\neven, below 3, at least n, or at least 2^256. Never traps.\nct: public data.\n\nExample (prose — a fenced example cannot carry a 2048-bit modulus on\none line): `rsa.public_key(n, e)` answers the key for a 2048-bit odd\nn and e = 65537, and `small_modulus` for a 1024-bit n;\n`tests/x/crypto/rsa/key_policy_rows.lu` holds every refusal.",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 194,
          "tier": "x"
        },
        {
          "name": "parse_public_key",
          "kind": "fn",
          "signature": "pub fn parse_public_key(der_bytes: List[byte]) -> PublicKey ! { der, small_modulus, large_modulus, bad_modulus, bad_exponent, }",
          "doc": "An RSA public key from its DER `RSAPublicKey` (RFC 8017 A.1.1:\n`SEQUENCE { modulus INTEGER, publicExponent INTEGER }`) — the\ncontent of an X.509 rsaEncryption SubjectPublicKeyInfo's BIT STRING.\n\nRows: `der` — not exactly one strict-DER SEQUENCE of two non-negative\nminimal INTEGERs; then `public_key`'s four refusals. Never traps.\nct: public data.",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 310,
          "tier": "x"
        },
        {
          "name": "verify_pkcs1",
          "kind": "fn",
          "signature": "pub fn verify_pkcs1(key: PublicKey, hash: int, message: List[byte], sig: List[byte]) -> bool",
          "doc": "RSASSA-PKCS1-V1_5-VERIFY (RFC 8017 §8.2.2): true iff `sig` is the\nsignature of `message` under `key` with the selected hash. The\nexpected encoding `0x00 0x01 PS 0x00 T` (T the DER DigestInfo with\nNULL parameters, PS at least eight 0xFF octets) is built and compared\nwhole with RSAVP1's output (steps 3–4), so nothing in the signature\nis parsed. False — never a trap — for a key outside the module's\npolicy, a signature that is not exactly k octets, a signature\nrepresentative ≥ n, or any octet that differs.\n\nTraps `assert` only when `hash` is not one of the `hash_*` selectors\n(the caller's constant, not data).\nct: VERIFY IS PUBLIC DATA — no branch here protects a secret.\n\nExample (prose — a 2048-bit key does not fit a fenced example line):\nevery case of the nine vendored Wycheproof RSASSA-PKCS1-v1_5 files is\na row under `tests/x/crypto/rsa/`, decided again by `rsa_check.py`.",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 791,
          "tier": "x"
        },
        {
          "name": "verify_pss",
          "kind": "fn",
          "signature": "pub fn verify_pss( key: PublicKey, hash: int, message: List[byte], sig: List[byte], salt_len: int, ) -> bool",
          "doc": "RSASSA-PSS-VERIFY (RFC 8017 §8.1.2, EMSA-PSS §9.1.2): true iff `sig`\nis a PSS signature of `message` under `key`, with MGF1 over the\nselected hash and a salt of exactly `salt_len` octets. emBits is\nmodBits − 1, so for a modulus whose length is 1 mod 8 the encoded\nmessage is k − 1 octets and RSAVP1's leading octet must be zero.\nFalse — never a trap — for a key outside the policy, a signature\nthat is not k octets, a representative ≥ n, or an inconsistent\nencoding.\n\nTLS 1.3's `rsa_pss_rsae_sha256/384/512` pass the digest length as\n`salt_len` (RFC 8446 §4.2.3). Traps `assert` when `hash` is not a\n`hash_*` selector or `salt_len` is negative (the caller's constants).\nct: VERIFY IS PUBLIC DATA.\n\nExample (prose, as for `verify_pkcs1`): every case of the eight\nvendored Wycheproof RSASSA-PSS files is a row under\n`tests/x/crypto/rsa/`.",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 852,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "Lowercase hex of a byte list. ct: public data (a rendering\nconvenience only).\n\n```wolf-doc-example\nrsa.to_hex(\"abc\".bytes()) == \"616263\"\nrsa.to_hex(List[byte]()) == \"\"\n```",
          "source": "std/x/crypto/rsa/rsa.lu",
          "line": 894,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.scrypt",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.scrypt — the scrypt password-based key derivation\nfunction (RFC 7914) and PBKDF2-HMAC-SHA-256 (RFC 8018 §5.2).\nStability tier: x — the D53 crypto ladder's memory-hard rung (sprint\nsc80, the hash under PAX's passwords).\n\n**The nursery banner (D31).** `std.x.crypto.scrypt` is not\n`std.crypto`: its path, names and behaviour may change or vanish in\none sprint; no other std module may depend on it; its reason and\ngraduation trigger live in `std/x/README.md`. HMAC-SHA-256 is\n`std.x.crypto.sha2`'s through the module boundary, a\nresident-on-resident edge the graduation move must resolve (beside\np256's, rsa's and curve25519's).\n\n**Implemented from the RFC 7914 DOCUMENT, not ported.** Salsa20/8\nCore is §3's word specification, scryptBlockMix §4, scryptROMix §5\nand scrypt §6; PBKDF2 is RFC 8018 §5.2 with RFC 2104's HMAC (FIPS\n180-4's SHA-256, `sha2.hmac256`). The texts are vendored at\n`vendor/vectors/rfc/rfc7914.txt`, `rfc8018.txt` and `rfc2104.txt`.\nEvery vector RFC 7914 prints (§8–§13) is a row under\n`tests/x/crypto/scrypt/`; the document is the authority.\n\n**The word currency is `wrapping[u32]`, four octets an element.**\nSalsa's adds and rotations are the type's own (no masks), and a\n`List[wrapping[u32]]` strides by four octets, so V costs exactly\nRFC 7914's 128·r·N octets. Octet strings cross the API as\n`List[byte]`, little-endian per word (§3: \"without endianness\nconversion\", and the vectors are little-endian words).\n\n**The inner loops allocate nothing.** A callee's allocation lives in\nthe caller's ambient region until that region dies, so a BlockMix\nthat built a list per call would hold 2·N·128·r octets of garbage by\nthe end of ROMix. BlockMix and ROMix therefore work in place over\nfour buffers made once per scrypt call (X, Y, T and V), and every\nHMAC that PBKDF2 iterates runs inside its own `region` block, so the\nc = 80000 vector holds a constant footprint. ROMix's V lives in a\nregion of its own and is gone before the final PBKDF2 runs.\n\n**Memory and the cap.** `memory(n_log2, r, p, dk_len)` is the\noctets `scrypt` allocates at its peak, 128·r·(N + 2p + 2) plus the\nkey's `dk_len` octets and a fixed 16 KiB for T and the HMAC states,\nand `scrypt` refuses `over_cap`\nbefore allocating anything when that exceeds the caller's cap\n(RFC 7914 §14: \"systems should protect against a denial-of-service\nattack resulting from attackers presenting unreasonably large\nparameters\"). The caller's own password and salt, and one transient\ncopy of the salt, are not counted. `romix` alone is uncapped: it is\nthe primitive, and `scrypt` is the guarded entry; PBKDF2 likewise\nallocates the `dk_len` octets its caller asks for.\n\n**Refusals, by name** (lowercase marks, API-CONVENTIONS §12): `bad_n`\n(log2 N below 1, or N not below 2^(16·r), RFC 7914 §2; `romix`'s N\nnot a power of two above 1), `bad_rp` (r or p below 1, or r·p at\nleast 2^30, which is §2's p ≤ ((2^32 − 1)·32)/(128·r) in integers),\n`over_cap`, `bad_dk_len` (below 1, or above (2^32 − 1)·32) and\nPBKDF2's `bad_count` (an iteration count below 1). A wrong-length\nblock handed to `salsa20_8`, `blockmix` or `romix` traps `assert`: the\ncaller could have checked (§2's trap rule).\n\n**Constant-time obligations (D53's retrofit clause; c28 does not\nexist yet, so these are recorded, not verified).** Salsa20/8 and\nBlockMix are add-rotate-xor over words with indices that depend on r\nand the loop counters only: no secret-dependent branch or index.\n**ROMix is NOT constant-time, by design:** its second loop reads\nV[Integerify(X) mod N], a memory index computed from secret state.\nThat access pattern is scrypt's memory-hardness (RFC 7914 §5), and a\ncache-timing observer can learn it; Argon2id's data-independent\nfirst pass is the answer to that, and is a named follow-on. PBKDF2\ninherits `sha2.hmac256`'s obligations (control flow depends on the\npassword's LENGTH only). The parameter checks branch on public\nparameters. `to_hex` indexes an alphabet by value and is for public\ndata.",
      "summary": "std.x.crypto.scrypt — the scrypt password-based key derivation function (RFC 7914) and PBKDF2-HMAC-SHA-256 (RFC 8018 §5.2).",
      "items": [
        {
          "name": "salsa20_8",
          "kind": "fn",
          "signature": "pub fn salsa20_8(input: List[byte]) -> List[byte]",
          "doc": "Salsa20/8 Core (RFC 7914 §3) of one 64-octet block: sixteen\nlittle-endian words in, sixteen out. Traps `assert` unless\n`input.len == 64` (the caller could have checked).\nct: as the core — no secret-dependent branch or index.\n\n```wolf-doc-example\nlet out = scrypt.salsa20_8(\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\".bytes())\nout.len == 64\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 245,
          "tier": "x"
        },
        {
          "name": "blockmix",
          "kind": "fn",
          "signature": "pub fn blockmix(b: List[byte], r: int) -> List[byte]",
          "doc": "scryptBlockMix (RFC 7914 §4) of `b`, 2·r 64-octet blocks, with\nSalsa20/8 as H. Traps `assert` unless `r >= 1` and\n`b.len == 128 * r`.\nct: indices depend on r only; see `salsa20_8`.\n\n```wolf-doc-example\nscrypt.blockmix(\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\".bytes(), 1).len == 128\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 323,
          "tier": "x"
        },
        {
          "name": "romix",
          "kind": "fn",
          "signature": "pub fn romix(b: List[byte], r: int, n: int) -> List[byte] ! {bad_n}",
          "doc": "scryptROMix (RFC 7914 §5) of one 128·r-octet block with cost `n`.\nRows: `bad_n` when `n` is not a power of two above 1, or not below\n2^(16·r) (§5's \"less than 2^(128 * r / 8)\"). Traps `assert` unless\n`r >= 1` and `b.len == 128 * r`. **Uncapped:** it allocates\n128·r·n octets for V; `scrypt` is the entry that refuses a cap.\nct: NOT constant-time — V is indexed by Integerify(X) (the module\nheader).\n\n```wolf-doc-example\nlet out = scrypt.romix(\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\".bytes(), 1, 16)?\nout.len == 128\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 432,
          "tier": "x"
        },
        {
          "name": "pbkdf2_hmac_sha256",
          "kind": "fn",
          "signature": "pub fn pbkdf2_hmac_sha256( password: List[byte], salt: List[byte], c: int, dk_len: int, ) -> List[byte] ! {bad_count, bad_dk_len}",
          "doc": "PBKDF2-HMAC-SHA-256 (RFC 8018 §5.2): `dk_len` octets derived from\n`password` and `salt` with `c` iterations. Rows: `bad_count` when\n`c < 1`; `bad_dk_len` when `dk_len < 1` or `dk_len > (2^32 − 1)·32`\n(step 1's \"derived key too long\"). Never traps.\nct: `sha2.hmac256`'s obligations — control flow depends on the\npassword's length, `c` and `dk_len` (public), never on a secret\noctet.\n\n```wolf-doc-example\nlet dk = scrypt.pbkdf2_hmac_sha256(\"passwd\".bytes(), \"salt\".bytes(), 1, 64)?\nscrypt.to_hex(dk)[0..16] == \"55ac046e56e3089f\"\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 536,
          "tier": "x"
        },
        {
          "name": "memory",
          "kind": "fn",
          "signature": "pub fn memory(n_log2: int, r: int, p: int, dk_len: int) -> int",
          "doc": "The octets `scrypt` allocates at its peak for these parameters:\n128·r·(N + 2p + 2) — V, B, the final PBKDF2's copy of B and the two\nscratch blocks X and Y — plus the `dk_len` octets of the key it\nreturns and a fixed 16 KiB for Salsa's T and the HMAC states. The\ncaller's own password and salt are not counted. Saturates at the int\nceiling (so log2 N of 63 and up answer the ceiling). Traps `assert`\nunless `n_log2 >= 0`, `r >= 1`, `p >= 1` and `dk_len >= 0`: the\ndomain is the caller's to check (`scrypt` checks before it calls\nthis).\nct: public parameters only.\n\n```wolf-doc-example\nscrypt.memory(14, 8, 1, 32) == 128 * 8 * (16384 + 4) + 32 + 16384\nscrypt.memory(70, 8, 1, 32) == 9223372036854775807\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 592,
          "tier": "x"
        },
        {
          "name": "scrypt",
          "kind": "fn",
          "signature": "pub fn scrypt( password: List[byte], salt: List[byte], n_log2: int, r: int, p: int, dk_len: int, cap: int, ) -> List[byte] ! {bad_n, bad_rp, over_cap, bad_dk_len}",
          "doc": "scrypt (RFC 7914 §6): `dk_len` octets derived from `password` and\n`salt` with N = 2^`n_log2`, block size `r` and parallelization `p`,\nrefusing before it allocates anything when\n`memory(n_log2, r, p, dk_len)` exceeds `cap` octets. Step 1: B = PBKDF2-HMAC-SHA256(P, S, 1,\np·128·r); step 2: each B[i] = scryptROMix(r, B[i], N), in order;\nstep 3: DK = PBKDF2-HMAC-SHA256(P, B, 1, dkLen).\n\nRows, checked in this order: `bad_rp` (r or p below 1, or r·p at\nleast 2^30), `bad_n` (log2 N below 1, or N not below 2^(16·r)),\n`bad_dk_len` (below 1, or above (2^32 − 1)·32), `over_cap` (the\nworking memory over `cap`). Never traps.\nct: NOT constant-time — ROMix indexes V by secret state (the module\nheader); the parameter checks branch on public parameters only.\n\n```wolf-doc-example\nlet dk = scrypt.scrypt(List[byte](), List[byte](), 4, 1, 1, 64, scrypt.memory(4, 1, 1, 64))?\nscrypt.to_hex(dk)[0..16] == \"77d6576238657b20\"\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 630,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "Lowercase hex of `b`, this module's own so that its tests and doc\nexamples import exactly one module (sha2's precedent).\nct: NOT constant-time — indexes an alphabet by each octet's value.\nRender public values with it.\n\n```wolf-doc-example\nscrypt.to_hex(\"ab\".bytes()) == \"6162\"\n```",
          "source": "std/x/crypto/scrypt/scrypt.lu",
          "line": 692,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.crypto.sha2",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.crypto.sha2 — SHA-256, SHA-384 and SHA-512 (FIPS 180-4), HMAC\n(FIPS 198-1 / RFC 2104) and HKDF (RFC 5869). Stability tier: x — the\nD53 crypto ladder's first rung (campaign stdc-crypto, sprint sc16).\n\n**The nursery banner (D31).** `std.x.crypto.sha2` is not `std.crypto`:\nits path, names and behaviour may change or vanish in one sprint; no\nother std module may depend on it (it may depend on the facade, and\ndoes: nothing — the module is self-contained on purpose); its reason\nand graduation trigger live in `std/x/README.md`. HMAC and HKDF live\nIN this module rather than beside it because a nursery resident may\nnot depend on another resident — the graduation move splits them.\n\n**Implemented from the FIPS 180-4 DOCUMENT, not ported.** Every\nconstant block and every schedule below cites its section of\nNIST FIPS 180-4 (August 2015), fetched into the planning repo's\n`refs/specs/fips-180-4.pdf`. The vectors (NIST CAVP byte-oriented\nsets, RFC 4231, RFC 5869, Wycheproof v1) catch transcription errors;\nthe document is the authority.\n\n**The word currency is `wrapping[u64]`, for both cores.** SHA-256's\n32-bit words are carried in the low half of a `wrapping[u64]` and\nmasked after every add and rotation — the spelling sc16 chose when\nthe native rung refused the narrowing `int as wrapping[u32]`\n(F-0089, CLOSED at the sc18 pin: s111 / wolf-lang#131 lowers it).\nThe mask discipline stands as written: every value entering a round\nis 32-bit-clean, and every sum or rotation is masked before it is\nstored. SHA-512's words are the full `wrapping[u64]` and need none.\nRespelling the 256 core over `wrapping[u32]` is the recorded\nfollow-on, not this sprint's edit (the sc18 bump ruling: the diff\nrewrites the storage layer, so it is a deliberate change with the\n1210-vector gate around it, never a bump side-effect).\n\n**Schedule words and round constants are stored as `int`.** A 32-bit\nword always fits an `int`. A 64-bit word does NOT (`as int` is a\nCHECKED conversion everywhere — a value with the top bit set traps\n`overflow`, measured at these pins), so every 64-bit table in this\nmodule is a PAIR of `List[int]` — high and low 32-bit halves — split\nby `push_word_halves` from the verbatim FIPS literal and recombined\nat the use site. `List[wrapping[u64]]` would spell it directly; the\nnative refusal that forced the pairing (F-0090) CLOSED at the sc18\npin (s111 / wolf-lang#132), and the direct spelling is the same\nrecorded follow-on as the 256 core's respell — the paired halves\nstay until a sprint retires them deliberately.\n\n**Lanes, measured at the sc18 pin (wolf 21b129e)**: ALL THREE run\nthe cores now. The checked tier's F-0091 operator refusal — the\nmodule's dark lane from sc16, \"this operator in checked execution\"\non every wrapping shift/bitwise op — closed with s111\n(wolf-lang#130), and 18 sha2 rows flipped `unsupported` -> `run` at\nthe bump. What remains dark there is CAPACITY, not semantics: the\nlong-message, Monte Carlo and full-Wycheproof files exhaust the\nchecked tier's step/shadow-memory budgets (\"step budget exhausted\" /\n\"shadow-memory budget exhausted\", measured per file at the bump), so\nthose nine rows keep `unsupported` with the mechanism named in the\nledger. Long-vector and Monte Carlo tests additionally record the\ninterpreter lane as `slow` (the sc16 ledger word): semantically\nin-lane, skipped at the rig's per-test ceiling, re-measured at pin\nbumps (is20's fix is merged upstream, unreleased — the flip waits on\nthe lupin release that carries it).\n\n**Byte sequences are `List[byte]` (sc35), AND THE INGESTION GUARD IS\nGONE.** For eleven sprints the currency was `List[int]` with a\ndocumented 0..255 element contract (§11's interim, F-0035) and a\n`require_byte` that trapped `assert` on every element that broke it.\nD72/s135's `byte` and s136's byte-typed builtins (wolf-lang#231) make\nthat contract the TYPE's, so the guard was unreachable code and it has\nbeen deleted rather than left standing as decoration. What the guard\ndefended is unchanged and is now enforced one layer down: a\n`List[byte]` cannot hold 300 or -1, so no wrapping cast can digest a\nvalue the caller never meant. `to_hex` is this module's own hex\nrendering so that its tests and doc examples import exactly one module\n(the `std.bytes.from_str` precedent); `std.hex.encode` is the facade\nspelling of the same operation.\n\n**Constant-time obligations (D53's retrofit clause).** c28's\ncompiler-enforced tier does not exist yet; until it does, every `pub`\nfn below carries a `ct:` line stating its obligation class, so the\nclaims are auditable now and verifiable later. The honest summary:\nthe digest cores branch and index on PUBLIC quantities only (byte\ncounts, round numbers) — **and the one recorded exception is RETIRED\n(sc35).** The 0..255 ingestion guard compared every input element,\nwhich is exactly the kind of value-dependent branch c28 will flag, and\nthis header promised \"it leaves with F-0035's real byte type\". The\ntype arrived and it left: `update256`/`update512` now absorb their\nelements with no comparison at all, so the digest path has NO\nvalue-dependent branch left. `to_hex` is still NOT constant-time (it\nindexes an alphabet by the byte's value) and says so. HMAC's key path\nbranches on the key's LENGTH alone, never on key bytes. These are\nsource-level obligations, not a fixed-time certification of generated\ninstructions, runtime operations or any execution tier. Review the\nexact compiler/backend/runtime pins separately; vectors prove outputs,\nnot absence of timing, cache, allocation or residual-copy leakage.\n\n**No division (sc84, wolf-std#151).** Nothing in this module divides:\nthe HKDF block counter and `to_hex`'s nibbles are masks and shifts.\n`cargo xtask codegen` builds this module's default and release objects\non the host target and fails on any integer division instruction in\nthem, with curve25519, chacha20 and bech32 beside it.\nIt is not a timing measurement (no latency was measured on any CPU),\nit says nothing about the interpreters, and the compiler that makes\nthe objects is not audited; a target the gate is not run on is not\ncovered by it.\n\nNo error rows anywhere in this module: every function is total over\nits documented domain, and since sc35 there is exactly ONE failure\nmode left — an out-of-range HKDF length, a caller contract violation\nthat traps `assert`. The other one (a non-byte element) is a type\nerror now, caught before the program runs.",
      "summary": "std.x.crypto.sha2 — SHA-256, SHA-384 and SHA-512 (FIPS 180-4), HMAC (FIPS 198-1 / RFC 2104) and HKDF (RFC 5869).",
      "items": [
        {
          "name": "Sha256",
          "kind": "struct",
          "signature": "pub struct Sha256 { h0: wrapping[u64], h1: wrapping[u64], h2: wrapping[u64], h3: wrapping[u64], h4: wrapping[u64], h5: wrapping[u64], h6: wrapping[u64], h7: wrapping[u64], buf: List[byte], total: int, k: List[int], w: List[int], }",
          "doc": "An in-progress SHA-256 computation. The fields are the interim\nbacking (F-0035's byte currency, and 32-bit words in `wrapping[u64]`\nhalves per the header) — never part of the API. A caller can forge\none; a forged state produces a wrong digest, never a trap, because\nevery field value is arithmetically valid.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 396,
          "tier": "x"
        },
        {
          "name": "new256",
          "kind": "fn",
          "signature": "pub fn new256() -> Sha256",
          "doc": "A fresh SHA-256 state — FIPS 180-4 §5.3.3's initial hash value (\"the\nfirst thirty-two bits of the fractional parts of the square roots of\nthe first eight prime numbers\"). Total: no rows, no traps.\nct: no secret is present yet; construction is input-independent.\n\n```wolf-doc-example\nvar st = sha2.new256()\nsha2.update256(mut st, \"abc\".bytes())\nsha2.to_hex(sha2.final256(take st)) == \"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 421,
          "tier": "x"
        },
        {
          "name": "update256",
          "kind": "fn",
          "signature": "pub fn update256(mut st: Sha256, data: List[byte])",
          "doc": "Absorbs `data` into the running SHA-256 computation. Bytes are\nbuffered until a 512-bit block is full, then compressed; calling\n`update256` in any chunking produces the digest one call would (held\nby `tests/x/crypto/sha2/incremental_chunking.lu`). **Total** — the\n0..255 element contract is the TYPE's since sc35, so the ingestion\nguard that used to trap here is gone.\nct: branches and indexes on byte COUNTS only, never on byte values,\nwith no exception left to record.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 533,
          "tier": "x"
        },
        {
          "name": "final256",
          "kind": "fn",
          "signature": "pub fn final256(take st: Sha256) -> List[byte]",
          "doc": "Pads (FIPS 180-4 §5.1.1: one `0x80` byte, zeros to 56 mod 64, the\nmessage length in BITS as a big-endian 64-bit word) and returns the\n32 digest bytes, big-endian per word (§6.2.2 step 4, §3.1). Consumes\nthe state — a finished computation cannot be updated again, and the\nmode system is what enforces it (`take`, the builders' `finish`\nprecedent). Total for every state `new256`/`update256` can produce.\nct: padding branches on the buffered LENGTH (public); the length\nword is public by definition.\n\n```wolf-doc-example\nvar st = sha2.new256()\nsha2.update256(mut st, List[byte]())\nsha2.to_hex(sha2.final256(take st)) == \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 557,
          "tier": "x"
        },
        {
          "name": "sum256",
          "kind": "fn",
          "signature": "pub fn sum256(msg: List[byte]) -> List[byte]",
          "doc": "The SHA-256 digest of `msg`, one shot: `new256` + `update256` +\n`final256`. 32 bytes out. **Total** (sc35: `List[byte]` cannot carry\nan element outside 0..255, so there is nothing left to trap on).\nct: as the incremental trio — public-count branching only.\n\n```wolf-doc-example\nsha2.to_hex(sha2.sum256(\"abc\".bytes())) == \"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad\"\nsha2.sum256(\"abc\".bytes()).len == 32\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 593,
          "tier": "x"
        },
        {
          "name": "Sha512",
          "kind": "struct",
          "signature": "pub struct Sha512 { h0: wrapping[u64], h1: wrapping[u64], h2: wrapping[u64], h3: wrapping[u64], h4: wrapping[u64], h5: wrapping[u64], h6: wrapping[u64], h7: wrapping[u64], buf: List[byte], total: int, khi: List[int], klo: List[int], whi: List[int], wlo: List[int], }",
          "doc": "An in-progress SHA-512 computation. Same field posture as `Sha256`;\nthe schedule constants ride as high/low halves (`khi`/`klo`) per the\nmodule header's storage rule.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 606,
          "tier": "x"
        },
        {
          "name": "new512",
          "kind": "fn",
          "signature": "pub fn new512() -> Sha512",
          "doc": "A fresh SHA-512 state — FIPS 180-4 §5.3.5's initial hash value (\"the\nfirst sixty-four bits of the fractional parts of the square roots of\nthe first eight prime numbers\"). Total: no rows, no traps.\nct: no secret is present yet; construction is input-independent.\n\n```wolf-doc-example\nvar st = sha2.new512()\nsha2.update512(mut st, \"abc\".bytes())\nsha2.final512(take st).len == 64\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 633,
          "tier": "x"
        },
        {
          "name": "update512",
          "kind": "fn",
          "signature": "pub fn update512(mut st: Sha512, data: List[byte])",
          "doc": "Absorbs `data` into the running SHA-512 computation; 1024-bit\nblocks. Any chunking produces one digest. **Total** (sc35).\nct: as `update256` — public-count branching only, with no exception\nleft to record.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 732,
          "tier": "x"
        },
        {
          "name": "final512",
          "kind": "fn",
          "signature": "pub fn final512(take st: Sha512) -> List[byte]",
          "doc": "Pads (FIPS 180-4 §5.1.2: one `0x80`, zeros to 112 mod 128, the bit\nlength as a big-endian 128-bit word — the high word is the byte\ncount's top three bits, exact for every representable length) and\nreturns the 64 digest bytes. Consumes the state (`take`). Total.\nct: padding branches on the buffered LENGTH (public).\n\n```wolf-doc-example\nvar st = sha2.new512()\nsha2.update512(mut st, List[byte]())\nsha2.to_hex(sha2.final512(take st)) == \"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 753,
          "tier": "x"
        },
        {
          "name": "sum512",
          "kind": "fn",
          "signature": "pub fn sum512(msg: List[byte]) -> List[byte]",
          "doc": "The SHA-512 digest of `msg`, one shot. 64 bytes out. **Total** (sc35).\nct: as the incremental trio.\n\n```wolf-doc-example\nsha2.to_hex(sha2.sum512(\"abc\".bytes())) == \"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 789,
          "tier": "x"
        },
        {
          "name": "Sha384",
          "kind": "struct",
          "signature": "pub struct Sha384 { st: Sha512, }",
          "doc": "An in-progress SHA-384 computation: a `Sha512` core under §5.3.4's\ninitial value. Its own type so that a 384 stream cannot be finished\nas a 512 one (or the reverse) — the digests would silently differ in\nmore than length. `update384` passes `mut st.st` straight through:\nthe F-0092 refusal that made sc16 copy the core out and back (a\n`mut` field path off a `mut` parameter refused natively) closed at\nthe sc18 pin (s111 / wolf-lang#133, the shape re-probed on all\nthree lanes at 21b129e), and the copy dance retired with it.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 808,
          "tier": "x"
        },
        {
          "name": "new384",
          "kind": "fn",
          "signature": "pub fn new384() -> Sha384",
          "doc": "A fresh SHA-384 state — FIPS 180-4 §5.3.4's initial hash value (\"the\nsquare roots of the ninth through sixteenth prime numbers\"). Total.\nct: no secret is present yet; construction is input-independent.\n\n```wolf-doc-example\nvar st = sha2.new384()\nsha2.update384(mut st, \"abc\".bytes())\nsha2.final384(take st).len == 48\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 821,
          "tier": "x"
        },
        {
          "name": "update384",
          "kind": "fn",
          "signature": "pub fn update384(mut st: Sha384, data: List[byte])",
          "doc": "Absorbs `data` into the running SHA-384 computation. **Total** (sc35).\nct: as `update512`.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 844,
          "tier": "x"
        },
        {
          "name": "final384",
          "kind": "fn",
          "signature": "pub fn final384(take st: Sha384) -> List[byte]",
          "doc": "Pads exactly as SHA-512 and returns the LEFT-MOST 48 digest bytes\n(FIPS 180-4 §6.5 step 3 / §7 truncation). Consumes the state. Total.\nct: as `final512`.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 851,
          "tier": "x"
        },
        {
          "name": "sum384",
          "kind": "fn",
          "signature": "pub fn sum384(msg: List[byte]) -> List[byte]",
          "doc": "The SHA-384 digest of `msg`, one shot. 48 bytes out. **Total** (sc35).\nct: as the incremental trio.\n\n```wolf-doc-example\nsha2.to_hex(sha2.sum384(\"abc\".bytes())) == \"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 863,
          "tier": "x"
        },
        {
          "name": "hmac256",
          "kind": "fn",
          "signature": "pub fn hmac256(key: List[byte], msg: List[byte]) -> List[byte]",
          "doc": "HMAC-SHA-256 (FIPS 198-1; RFC 2104). Any key length; keys longer\nthan the 64-byte block are reduced by one SHA-256 first (FIPS 198-1\n§4 step 2). 32 bytes out. **Total** (sc35: a non-byte element is a\ntype error now, not a trap).\nct: see `xor_pad` — key-length-dependent control flow only; no\nbranch or index reads a key byte, and since sc35 the module has no\nrecorded exception at all.\n\n```wolf-doc-example\nsha2.to_hex(sha2.hmac256(\"key\".bytes(), \"The quick brown fox jumps over the lazy dog\".bytes())) == \"f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 917,
          "tier": "x"
        },
        {
          "name": "hmac384",
          "kind": "fn",
          "signature": "pub fn hmac384(key: List[byte], msg: List[byte]) -> List[byte]",
          "doc": "HMAC-SHA-384 (FIPS 198-1; RFC 2104). The block is SHA-384's 128\nbytes. 48 bytes out. **Total** (sc35).\nct: as `hmac256`.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 937,
          "tier": "x"
        },
        {
          "name": "hmac512",
          "kind": "fn",
          "signature": "pub fn hmac512(key: List[byte], msg: List[byte]) -> List[byte]",
          "doc": "HMAC-SHA-512 (FIPS 198-1; RFC 2104). The block is SHA-512's 128\nbytes. 64 bytes out. **Total** (sc35).\nct: as `hmac256`.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 957,
          "tier": "x"
        },
        {
          "name": "hkdf256_extract",
          "kind": "fn",
          "signature": "pub fn hkdf256_extract(salt: List[byte], ikm: List[byte]) -> List[byte]",
          "doc": "HKDF-Extract over HMAC-SHA-256 (RFC 5869 §2.2). An absent salt is\nspelled as the empty list — the RFC's \"if not provided, ... a string\nof HashLen zeros\" is HMAC's own zero-padding of an empty key, so the\nspellings agree by construction. 32-byte PRK out.\nct: HMAC's obligations, unchanged.\n\n```wolf-doc-example\nsha2.hkdf256_extract(List[byte](), \"secret\".bytes()).len == 32\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 989,
          "tier": "x"
        },
        {
          "name": "hkdf256_expand",
          "kind": "fn",
          "signature": "pub fn hkdf256_expand(prk: List[byte], info: List[byte], n: int) -> List[byte]",
          "doc": "HKDF-Expand over HMAC-SHA-256 (RFC 5869 §2.3). Traps `assert` when\n`n` is negative or exceeds 255 * 32 (the RFC's hard cap: the counter\nis one byte) — the length is the caller's parameter, not data (§2's\ntrap rule). `n == 0` yields empty output. `prk` is a pseudorandom key of at\nleast HashLen octets (32 for SHA-256), normally Extract's output;\nthis module cannot inspect entropy. The selected extract-then-expand\npath always supplies exactly 32 bytes.\nct: the T(i) chain's shape depends on `n` and `info.len` (public);\nno branch reads a byte of `prk` or the running T.\n\n```wolf-doc-example\nlet prk = sha2.hkdf256_extract(\"salt\".bytes(), \"ikm\".bytes())\nsha2.hkdf256_expand(prk, \"info\".bytes(), 42).len == 42\nsha2.hkdf256_expand(prk, \"info\".bytes(), 0).len == 0\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1008,
          "tier": "x"
        },
        {
          "name": "hkdf256",
          "kind": "fn",
          "signature": "pub fn hkdf256(salt: List[byte], ikm: List[byte], info: List[byte], n: int) -> List[byte]",
          "doc": "HKDF over HMAC-SHA-256, extract-then-expand in one call (RFC 5869\n§2). Traps as `hkdf256_expand` on an out-of-range `n`.\nct: the composition of the two halves' obligations.\n\n```wolf-doc-example\nsha2.hkdf256(\"salt\".bytes(), \"ikm\".bytes(), \"info\".bytes(), 16).len == 16\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1063,
          "tier": "x"
        },
        {
          "name": "hkdf384_extract",
          "kind": "fn",
          "signature": "pub fn hkdf384_extract(salt: List[byte], ikm: List[byte]) -> List[byte]",
          "doc": "HKDF-Extract over HMAC-SHA-384 (RFC 5869 §2.2). 48-byte PRK out.\nct: HMAC's obligations, unchanged.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1070,
          "tier": "x"
        },
        {
          "name": "hkdf384_expand",
          "kind": "fn",
          "signature": "pub fn hkdf384_expand(prk: List[byte], info: List[byte], n: int) -> List[byte]",
          "doc": "HKDF-Expand over HMAC-SHA-384 (RFC 5869 §2.3); the cap is 255 * 48.\nTraps and totality as `hkdf256_expand`.\nct: as `hkdf256_expand`.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1077,
          "tier": "x"
        },
        {
          "name": "hkdf384",
          "kind": "fn",
          "signature": "pub fn hkdf384(salt: List[byte], ikm: List[byte], info: List[byte], n: int) -> List[byte]",
          "doc": "HKDF over HMAC-SHA-384, extract-then-expand in one call.\nct: the composition of the two halves' obligations.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1109,
          "tier": "x"
        },
        {
          "name": "hkdf512_extract",
          "kind": "fn",
          "signature": "pub fn hkdf512_extract(salt: List[byte], ikm: List[byte]) -> List[byte]",
          "doc": "HKDF-Extract over HMAC-SHA-512 (RFC 5869 §2.2). 64-byte PRK out.\nct: HMAC's obligations, unchanged.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1116,
          "tier": "x"
        },
        {
          "name": "hkdf512_expand",
          "kind": "fn",
          "signature": "pub fn hkdf512_expand(prk: List[byte], info: List[byte], n: int) -> List[byte]",
          "doc": "HKDF-Expand over HMAC-SHA-512 (RFC 5869 §2.3); the cap is 255 * 64.\nTraps and totality as `hkdf256_expand`.\nct: as `hkdf256_expand`.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1123,
          "tier": "x"
        },
        {
          "name": "hkdf512",
          "kind": "fn",
          "signature": "pub fn hkdf512(salt: List[byte], ikm: List[byte], info: List[byte], n: int) -> List[byte]",
          "doc": "HKDF over HMAC-SHA-512, extract-then-expand in one call.\nct: the composition of the two halves' obligations.",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1155,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "`b` as lowercase hexadecimal, two digits per byte — this module's\nown rendering so its tests and examples import exactly one module\n(the `std.bytes.from_str` precedent); `std.hex.encode` is the facade\nspelling. **Total** — the slice's own `assert` on a non-byte element\nis unreachable since sc35, and was already unreachable in practice\nbecause no digest this module returns could contain one.\nct: NOT constant-time — the alphabet slice is indexed by each byte's\nVALUE, a secret-dependent memory index. Render public values with\nit; a constant-time encoder is c28-tier work.\n\n```wolf-doc-example\nsha2.to_hex(sha2.sum256(\"abc\".bytes()))[0..8] == \"ba7816bf\"\nsha2.to_hex(List[byte]()) == \"\"\n```",
          "source": "std/x/crypto/sha2/sha2.lu",
          "line": 1178,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.deque_int",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.deque_int — the running prototype behind `std.deque`'s reviewed\ncontract: a double-ended queue at ONE concrete element type, because\n`struct Deque[T]` does not parse until s16 delivers generic data\ntypes. Stability tier: x (nursery, D31 clock — this module graduates\ninto `std.deque` with `int` replaced by `T`, or it is deleted, at the\nstdc01 closeout).\n\nWhat it proves, executing under BOTH implementations: the\nrepresentation (one `List[int]` plus a head index — no second buffer),\nthe amortization story, the front-to-back order `to_list` promises,\nand that every one of `std.deque`'s ten operations is expressible over\nthe language's `List` surface alone.\n\nWhat it deliberately does not do: reclaim the space in front of\n`head`. A pop_front advances the head; the storage before it is\nreleased the next time the queue is rebuilt (`push_front`, `pop_back`,\n`clear`), or wholesale when the region dies (D10). A generic version\nwould want a compaction rule; that is a decision for the graduating\nsprint, recorded here rather than guessed.\n\nAbsence is spelled `none`, the convention's own spelling as of sc06\n(F-0003 is dead; \"pending\" was stale prose for six sprints). Every\nlength read goes through `count` because std.list's single-read rule\nrequired it when these bodies were written; that rule died at the sc11\npin (s72's D40, F-0005 and F-0014 closed) and the shape is kept because\nit is correct, not because it is required.",
      "summary": "std.x.deque_int — the running prototype behind `std.deque`'s reviewed contract: a double-ended queue at ONE concrete element type, because `struct Deque[T]` does not parse until s16 delivers generic data types.",
      "items": [
        {
          "name": "DequeInt",
          "kind": "struct",
          "signature": "pub struct DequeInt { items: List[int], head: int, }",
          "doc": "The queue: elements `items[head .. items.len]`, front first.",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 31,
          "tier": "x"
        },
        {
          "name": "new",
          "kind": "fn",
          "signature": "pub fn new() -> DequeInt",
          "doc": "A fresh empty queue. Total: no error row, no traps.\n\n```wolf-doc-example\nlet d = deque_int.new()\ndeque_int.len(d) == 0\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 53,
          "tier": "x"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(d: DequeInt) -> int",
          "doc": "The number of elements. Total: no error row, no traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 1)\ndeque_int.len(d) == 1\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 64,
          "tier": "x"
        },
        {
          "name": "is_empty",
          "kind": "fn",
          "signature": "pub fn is_empty(d: DequeInt) -> bool",
          "doc": "Whether the queue holds no elements. Total: no error row, no traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.is_empty(d) == true\ndeque_int.push_front(mut d, 1)\ndeque_int.is_empty(d) == false\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 76,
          "tier": "x"
        },
        {
          "name": "push_back",
          "kind": "fn",
          "signature": "pub fn push_back(mut d: DequeInt, v: int)",
          "doc": "Appends `v` at the back. Amortized constant time. Total: no error row,\nno traps beyond allocation.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 1)\ndeque_int.push_back(mut d, 2)\n(deque_int.back(d) else 0) == 2\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 89,
          "tier": "x"
        },
        {
          "name": "push_front",
          "kind": "fn",
          "signature": "pub fn push_front(mut d: DequeInt, v: int)",
          "doc": "Prepends `v` at the front. Rebuilds the buffer (this representation\npays for `push_front`, which is the trade the prototype records).\nTotal: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 2)\ndeque_int.push_front(mut d, 1)\n(deque_int.front(d) else 0) == 1\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 103,
          "tier": "x"
        },
        {
          "name": "front",
          "kind": "fn",
          "signature": "pub fn front(d: DequeInt) -> int ! {none}",
          "doc": "The front element, left in place; `none` when empty. No traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 5)\n(deque_int.front(d) else 0) == 5\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 123,
          "tier": "x"
        },
        {
          "name": "back",
          "kind": "fn",
          "signature": "pub fn back(d: DequeInt) -> int ! {none}",
          "doc": "The back element, left in place; `none` when empty. No traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 5)\ndeque_int.push_back(mut d, 6)\n(deque_int.back(d) else 0) == 6\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 138,
          "tier": "x"
        },
        {
          "name": "pop_front",
          "kind": "fn",
          "signature": "pub fn pop_front(mut d: DequeInt) -> int ! {none}",
          "doc": "Removes and returns the front element; `none` when empty. Constant\ntime: the head advances and no element moves. No traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 1)\ndeque_int.push_back(mut d, 2)\n(deque_int.pop_front(mut d) else 0) == 1\n(deque_int.pop_front(mut d) else 0) == 2\n(deque_int.pop_front(mut d) else 0 - 1) == 0 - 1\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 156,
          "tier": "x"
        },
        {
          "name": "pop_back",
          "kind": "fn",
          "signature": "pub fn pop_back(mut d: DequeInt) -> int ! {none}",
          "doc": "Removes and returns the back element; `none` when empty. Rebuilds the\nbuffer (see the module header on compaction). No traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 1)\ndeque_int.push_back(mut d, 2)\n(deque_int.pop_back(mut d) else 0) == 2\ndeque_int.len(d) == 1\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 175,
          "tier": "x"
        },
        {
          "name": "clear",
          "kind": "fn",
          "signature": "pub fn clear(mut d: DequeInt)",
          "doc": "Empties the queue, keeping it usable, and releases the buffer. Total:\nno error row, no traps.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 1)\ndeque_int.clear(mut d)\ndeque_int.is_empty(d) == true\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 201,
          "tier": "x"
        },
        {
          "name": "to_list",
          "kind": "fn",
          "signature": "pub fn to_list(d: DequeInt) -> List[int]",
          "doc": "A fresh list of the elements, FRONT to BACK — the one order this type\npromises. Total: no error row, no traps beyond allocation.\n\n```wolf-doc-example\nvar d = deque_int.new()\ndeque_int.push_back(mut d, 1)\ndeque_int.push_front(mut d, 0)\nvar first = 0 - 1\nfor x in deque_int.to_list(d) { first = first + 1 }\nfirst == 1\n```",
          "source": "std/x/deque_int/deque_int.lu",
          "line": 217,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.jose",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.jose — the JOSE envelope ACME needs, over sc18's Ed25519:\nJWS signing/verification with EdDSA (RFC 7515 + RFC 8037), the\nEd25519 public JWK and its RFC 7638 thumbprint (RFC 7517 + 7638),\nand the ACME request envelope (RFC 8555 §6.2). Stability tier: x —\nthe D53 crypto ladder's FOURTH rung (campaign stdc-crypto, sprint\nsc19). This rung is PLUMBING, not new crypto: every signature is\nsc18's `std.x.crypto.curve25519.sign`/`verify`, every digest is\nsc16's `std.x.crypto.sha2.sum256`, and the base64url is sc05's\n`std.base64.url_encode`/`url_decode`. The human chose ACME over\nAES-GCM breadth: the pinned local test CA speaks Ed25519, so there\nis NO P-256 here (that stays a named D-question for the breadth\nrung).\n\n**The nursery banner (D31).** `std.x.jose` is not `std.jose`: its\npath, names and behaviour may change or vanish in one sprint; no\nother std module may depend on it. Its reason and graduation trigger\nlive in `std/x/README.md`. It depends on TWO sibling residents —\n`std.x.crypto.curve25519` (the signature) and `std.x.crypto.sha2`\n(the thumbprint digest) — plus the facade (`std.base64`, `std.bytes`,\n`std.str`); a resident MAY depend on the facade, and the two\nresident-on-resident edges are ones the graduation move to `std.jose`\n/`std.crypto` must resolve, named in the register beside curve25519's\nown sha2 edge.\n\n## The three byte-exact rules this module lives or dies on\n\n1. **base64url is NOT base64** (RFC 4648 §5, not §4): the alphabet\n   ends `-_`, never `+/`, and JOSE carries NO padding. A base64\n   -standard reuse silently corrupts every signature and every\n   thumbprint, because the signing input and the hash input are the\n   *encoded* text. This module calls `std.base64.url_encode` (no pad)\n   and `std.base64.url_decode` (padding tolerated on the way in, the\n   §5 sentence) EXCLUSIVELY; `encode`/`decode` (the §4 padded pair)\n   never appear. The negatives in `tests/x/jose/base64url_jose.lu`\n   pin the alphabet and the no-pad rule.\n\n2. **The signing input is over the BASE64URL STRINGS, not the raw\n   bytes** (RFC 7515 §5.1): the message Ed25519 signs is the ASCII\n   octets of `BASE64URL(protected) || '.' || BASE64URL(payload)`.\n   The classic JWS bug is signing the decoded payload; `signing_input`\n   builds the encoded form and `jws_sign_compact` signs *its* bytes.\n   RFC 8037 A.4's vector — signature `hgyY0il_…M0KAg` over the\n   signing input `eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc`\n   — is the pin.\n\n3. **The JWK thumbprint is byte-exact, canonical, no-whitespace**\n   (RFC 7638 §3): SHA-256 over the required members in LEXICOGRAPHIC\n   order with no spaces and no newlines. For an OKP Ed25519 key the\n   required members are `crv`, `kty`, `x`, in that order, so the hash\n   input is exactly `{\"crv\":\"Ed25519\",\"kty\":\"OKP\",\"x\":\"<x>\"}`. This\n   module BUILDS that string directly (string interpolation) rather\n   than routing through `std.json`'s writer, for two measured reasons:\n   (a) `std.json` carries an enum and a `Map` that darken the compiler\n   lanes (F-0012/F-0029), and the thumbprint must stay on every lane\n   the digest reaches; (b) the three OKP member VALUES are a fixed\n   ASCII pair (`Ed25519`, `OKP`) and a base64url string, none of\n   which contains a character JSON escapes, so direct construction is\n   byte-identical to what any conforming writer emits. RFC 7638's own\n   RSA example and RFC 8037 A.3's OKP thumbprint\n   (`kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k`) are the pins.\n\n## EdDSA is deterministic; the ACME `nonce` is a different thing\nEd25519 signing (RFC 8032 §5.1.6, sc18) derives its per-signature\nnonce from the key and message by hashing — there is NO entropy input\nand NO randomness on this module's path. The ACME `nonce` header\nfield (RFC 8555 §6.4) is an anti-replay token the SERVER issues and\nthe client echoes; it is protocol state, not signature entropy. The\ntwo never touch. This module has no entropy story and needs none.\n\n## ct: posture\nSigning touches the secret account key, so `jws_sign_compact`,\n`jws_flattened` and `acme_body` inherit sc18's `curve25519.sign` ct\npath verbatim (the recorded scalarmul-bit-gate and `floordiv`\nsign-correction obligations c28 verifies; no NEW secret handling is\nadded here — the key flows straight into `sign`). Everything else is\nPUBLIC-DATA framing: the protected header, the payload, the JWK, the\nthumbprint and every base64url string are public by construction (a\nJWS is transmitted in the clear), and `jws_verify_compact` is public\non all three operands exactly as `curve25519.verify` is. So the ct\nsurface of this rung is precisely sc18's signing surface and nothing\nmore; the JOSE framing carries no timing obligation.\n\n## THE ws06 SEAM (RFC 8555 §6.2) — FROZEN for the `cert auto` track\nThis sprint builds the ENVELOPE and its serialization, NOT the ACME\nprotocol state machine (newNonce/newAccount/newOrder/challenge/\nfinalize over the network is wws's ws06). The seam ws06 consumes is\nexactly this, and it does not move:\n\n  - ws06 OWNS: the HTTPS conversation, fetching `Replay-Nonce`, the\n    directory, the order/authorization/challenge/finalize flow, and\n    the account-key lifecycle.\n  - sc19 OWNS: given a secret key and the header fields, produce the\n    signed request BODY. Two calls:\n      1. build the protected header — `acme_protected_jwk(pubkey,\n         nonce, url)` for the newAccount request (the key is inlined\n         as a `jwk`), or `acme_protected_kid(kid, nonce, url)` for\n         every request thereafter (the account URL is the `kid`);\n      2. sign and serialize — `acme_body(secret, protected, payload)`\n         returns the flattened-JWS JSON `{\"protected\":…,\"payload\":…,\n         \"signature\":…}` that is the POST body. A POST-as-GET carries\n         an EMPTY payload (`List[byte]()`), whose base64url is `\"\"`,\n         per RFC 8555 §6.3.\n  - The account binding uses `jwk_thumbprint(pubkey)` (RFC 7638),\n    which ws06 places wherever the server's challenge demands it.\n\nws06 supplies bytes and strings; sc19 returns a spec-shaped body.\nNeither reaches into the other. The fixture in\n`tests/x/jose/acme_envelope.lu` is the frozen shape ws06 asserts\nagainst.",
      "summary": "std.x.jose — the JOSE envelope ACME needs, over sc18's Ed25519: JWS signing/verification with EdDSA (RFC 7515 + RFC 8037), the Ed25519 public JWK and its RFC 7638 thumbprint (RFC 7517 + 7638), and the ACME request envelope (RFC 8555 §6.2).",
      "items": [
        {
          "name": "signing_input",
          "kind": "fn",
          "signature": "pub fn signing_input(protected: str, payload: List[byte]) -> str",
          "doc": "The JWS Signing Input (RFC 7515 §5.1): `BASE64URL(UTF8(protected)) ||\n'.' || BASE64URL(payload)`. This is the octet string Ed25519 signs —\nover the ENCODED text, never the raw bytes (§2's classic-bug note).\n`protected` is the header JSON (its UTF-8 is encoded); `payload` is\nalready a byte sequence and is encoded as-is.\n\n```wolf-doc-example\nlet payload = \"Example of Ed25519 signing\".bytes()\njose.signing_input(\"{{\\\"alg\\\":\\\"EdDSA\\\"}}\", payload) == \"eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc\"\n```",
          "source": "std/x/jose/jose.lu",
          "line": 195,
          "tier": "x"
        },
        {
          "name": "jws_sign_compact",
          "kind": "fn",
          "signature": "pub fn jws_sign_compact(secret: List[byte], protected: str, payload: List[byte]) -> str",
          "doc": "A JWS in Compact Serialization (RFC 7515 §7.1) with EdDSA (RFC 8037):\n`BASE64URL(protected) || '.' || BASE64URL(payload) || '.' ||\nBASE64URL(signature)`, the signature being Ed25519 over the signing\ninput's ASCII bytes. `secret` is the 32-byte Ed25519 secret key;\n`protected` is the protected-header JSON (for a plain EdDSA JWS,\n`{\"alg\":\"EdDSA\"}`); `payload` is the message bytes.\n\nDeterministic: the same key, header and payload always yield the same\ncompact string (Ed25519 has no nonce input). Traps only where\n`curve25519.sign` does (a secret key that is not 32 bytes is a caller\ncontract violation there).\n\n```wolf-doc-example\nlet sk = \"a 32-byte ed25519 secret key !!!\".bytes()\nlet jws = jose.jws_sign_compact(sk, \"{{\\\"alg\\\":\\\"EdDSA\\\"}}\", \"hi\".bytes())\njws.starts_with(\"eyJhbGciOiJFZERTQSJ9.aGk.\")\n```",
          "source": "std/x/jose/jose.lu",
          "line": 218,
          "tier": "x"
        },
        {
          "name": "jws_verify_compact",
          "kind": "fn",
          "signature": "pub fn jws_verify_compact(pubkey: List[byte], compact: str) -> bool",
          "doc": "Verify a compact JWS against an Ed25519 public key. `true` iff the\nstring is three base64url segments joined by `.` whose last segment\nis a valid Ed25519 signature over the first two joined by `.`.\n\nPublic data on every operand (a JWS travels in the clear), so this is\na BOOL and never traps on a bad token — a wrong segment count, a\nsegment that is not base64url, a wrong-length key or signature, and a\nforged signature all answer `false`, exactly as `curve25519.verify`\nanswers its own rejection cases (§2's rule: verify decides, it does\nnot trap). It does NOT parse the header's `alg`: this module signs\nand verifies EdDSA-over-Ed25519 ONLY, so there is no algorithm agility\nto confuse — a token signed under any other algorithm simply fails the\nEd25519 check.\n\n```wolf-doc-example\njose.jws_verify_compact(\"x\".bytes(), \"not.a.jws\") == false\njose.jws_verify_compact(\"x\".bytes(), \"onlyonepart\") == false\n```",
          "source": "std/x/jose/jose.lu",
          "line": 243,
          "tier": "x"
        },
        {
          "name": "jws_flattened",
          "kind": "fn",
          "signature": "pub fn jws_flattened(secret: List[byte], protected: str, payload: List[byte]) -> str",
          "doc": "A JWS in Flattened JSON Serialization (RFC 7515 §7.2.2) with EdDSA:\nthe object `{\"protected\":\"…\",\"payload\":\"…\",\"signature\":\"…\"}`, each\nvalue a base64url string. This is the shape ACME's request body takes\n(RFC 8555 §6.2); `acme_body` is the ACME-named door to it. The three\nvalues are base64url and so need no JSON escaping.\n\n```wolf-doc-example\nlet sk = \"a 32-byte ed25519 secret key !!!\".bytes()\nlet flat = jose.jws_flattened(sk, \"{{\\\"alg\\\":\\\"EdDSA\\\"}}\", \"hi\".bytes())\nflat.starts_with(\"{{\\\"protected\\\":\\\"eyJhbGciOiJFZERTQSJ9\\\",\\\"payload\\\":\\\"aGk\\\",\\\"signature\\\":\\\"\")\nflat.ends_with(\"\\\"}}\")\n```",
          "source": "std/x/jose/jose.lu",
          "line": 267,
          "tier": "x"
        },
        {
          "name": "jwk_ed25519_public",
          "kind": "fn",
          "signature": "pub fn jwk_ed25519_public(pubkey: List[byte]) -> str",
          "doc": "The Ed25519 public key as an OKP JWK (RFC 8037 §2, RFC 7517):\n`{\"kty\":\"OKP\",\"crv\":\"Ed25519\",\"x\":\"<BASE64URL(pubkey)>\"}` — the member\norder of RFC 8037 A.2's own example. `pubkey` is the 32-byte Ed25519\npublic key (`curve25519.public`'s output). This is the `jwk` ACME\ninlines in a newAccount request; its member order is free (a JWK is\nread by name), so it is NOT the canonical thumbprint form — use\n`jwk_thumbprint_input` for that.\n\n```wolf-doc-example\nlet pk = \"a 32-byte ed25519 public key !!!\".bytes()\njose.jwk_ed25519_public(pk) == \"{{\\\"kty\\\":\\\"OKP\\\",\\\"crv\\\":\\\"Ed25519\\\",\\\"x\\\":\\\"YSAzMi1ieXRlIGVkMjU1MTkgcHVibGljIGtleSAhISE\\\"}}\"\n```",
          "source": "std/x/jose/jose.lu",
          "line": 288,
          "tier": "x"
        },
        {
          "name": "jwk_thumbprint_input",
          "kind": "fn",
          "signature": "pub fn jwk_thumbprint_input(pubkey: List[byte]) -> str",
          "doc": "The canonical thumbprint hash input (RFC 7638 §3) for an OKP Ed25519\nkey: the required members `crv`, `kty`, `x` in lexicographic order,\nno whitespace — `{\"crv\":\"Ed25519\",\"kty\":\"OKP\",\"x\":\"<x>\"}`. This is\nexactly the string RFC 8037 A.3 hashes; it is exposed so a test can\npin it byte-for-byte, and it is what `jwk_thumbprint` digests.\n\n```wolf-doc-example\nlet pk = \"a 32-byte ed25519 public key !!!\".bytes()\njose.jwk_thumbprint_input(pk) == \"{{\\\"crv\\\":\\\"Ed25519\\\",\\\"kty\\\":\\\"OKP\\\",\\\"x\\\":\\\"YSAzMi1ieXRlIGVkMjU1MTkgcHVibGljIGtleSAhISE\\\"}}\"\n```",
          "source": "std/x/jose/jose.lu",
          "line": 303,
          "tier": "x"
        },
        {
          "name": "jwk_thumbprint",
          "kind": "fn",
          "signature": "pub fn jwk_thumbprint(pubkey: List[byte]) -> str",
          "doc": "The RFC 7638 JWK Thumbprint of an OKP Ed25519 key: base64url (no pad)\nof SHA-256 over `jwk_thumbprint_input(pubkey)`. This is the account\nidentifier ACME binds a key to; RFC 8037 A.3's own vector is\n`kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k`.\n\n```wolf-doc-example\nlet pk = \"a 32-byte ed25519 public key !!!\".bytes()\njose.jwk_thumbprint(pk).len == 43\n```",
          "source": "std/x/jose/jose.lu",
          "line": 317,
          "tier": "x"
        },
        {
          "name": "acme_protected_jwk",
          "kind": "fn",
          "signature": "pub fn acme_protected_jwk(pubkey: List[byte], nonce: str, url: str) -> str",
          "doc": "The ACME protected header for a request that INLINES the account key\n(RFC 8555 §6.2, the newAccount case): `{\"alg\":\"EdDSA\",\"jwk\":<jwk>,\n\"nonce\":\"<nonce>\",\"url\":\"<url>\"}`. `pubkey` is the 32-byte Ed25519\npublic key; `nonce` is the server's `Replay-Nonce`; `url` is the\nrequest target. The embedded `jwk` is the canonical OKP form (member\norder is free, so the canonical one is reused for determinism);\n`nonce` and `url` are JSON-escaped so an unusual field cannot break\nthe frame.\n\n```wolf-doc-example\nlet pk = \"a 32-byte ed25519 public key !!!\".bytes()\njose.acme_protected_jwk(pk, \"aXk6\", \"https://acme.test/new-account\") == \"{{\\\"alg\\\":\\\"EdDSA\\\",\\\"jwk\\\":{{\\\"crv\\\":\\\"Ed25519\\\",\\\"kty\\\":\\\"OKP\\\",\\\"x\\\":\\\"YSAzMi1ieXRlIGVkMjU1MTkgcHVibGljIGtleSAhISE\\\"}},\\\"nonce\\\":\\\"aXk6\\\",\\\"url\\\":\\\"https://acme.test/new-account\\\"}}\"\n```",
          "source": "std/x/jose/jose.lu",
          "line": 336,
          "tier": "x"
        },
        {
          "name": "acme_protected_kid",
          "kind": "fn",
          "signature": "pub fn acme_protected_kid(kid: str, nonce: str, url: str) -> str",
          "doc": "The ACME protected header for a request that names the account by URL\n(RFC 8555 §6.2, every request after newAccount):\n`{\"alg\":\"EdDSA\",\"kid\":\"<kid>\",\"nonce\":\"<nonce>\",\"url\":\"<url>\"}`. `kid`\nis the account URL the server returned; `nonce` and `url` as above.\nAll three are JSON-escaped.\n\n```wolf-doc-example\njose.acme_protected_kid(\"https://acme.test/acct/1\", \"aXk6\", \"https://acme.test/new-order\") == \"{{\\\"alg\\\":\\\"EdDSA\\\",\\\"kid\\\":\\\"https://acme.test/acct/1\\\",\\\"nonce\\\":\\\"aXk6\\\",\\\"url\\\":\\\"https://acme.test/new-order\\\"}}\"\n```",
          "source": "std/x/jose/jose.lu",
          "line": 352,
          "tier": "x"
        },
        {
          "name": "acme_body",
          "kind": "fn",
          "signature": "pub fn acme_body(secret: List[byte], protected: str, payload: List[byte]) -> str",
          "doc": "The signed ACME request body (RFC 8555 §6.2): the flattened-JSON JWS\nover `protected` and `payload`, signed with the account key. This is\n`jws_flattened` under its ACME name — the door ws06 calls after\nbuilding the header with `acme_protected_jwk`/`acme_protected_kid`. A\nPOST-as-GET (RFC 8555 §6.3) passes an EMPTY `payload` (`List[byte]()`),\nwhose base64url is the empty string.\n\n```wolf-doc-example\nlet sk = \"a 32-byte ed25519 secret key !!!\".bytes()\nlet header = jose.acme_protected_kid(\"https://acme.test/acct/1\", \"aXk6\", \"https://acme.test/new-order\")\nlet body = jose.acme_body(sk, header, List[byte]())\nbody.contains(\"\\\"payload\\\":\\\"\\\"\")\n```",
          "source": "std/x/jose/jose.lu",
          "line": 372,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.json",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.json — JSON as a QUERY, over the s40 kernel builtins: is this\ntext valid, what is at this path, what kind is it, how many children\ndoes it have, and give it to me as the wolf type I expect.\nStability tier: **x (nursery, D31)**.\n\n## The nursery banner (D31) — read this before you depend on it\n\n**`std.x.*` is not `std.*`.** A module under `x` is a RESIDENT rather\nthan a facade member — its path, its names, its rows and its behaviour\nmay change or disappear in a single sprint, and no other std module may\ndepend on one. `std/x/README.md` is the register: every resident is\nlisted there with the measured reason it is not in the facade and the\nnamed trigger that graduates it.\n\n**The graduation clock.** At every campaign closeout each resident is\nreviewed and one of three things happens, recorded in that closeout:\nit GRADUATES (it moves under `std.`, and because the path *is* the\nAPI, the move is the release note), it is DELETED (the reviewed\ncontract in its header is what survives), or it is EXTENDED by one\ncampaign with a written reason. Nothing sits in `x` unexamined.\n\n**This module's clock** starts at the stdc02 closeout, which is this\ncampaign's. Its named triggers are below.\n\n## Why the first tenant is json\n\nD31 said the nursery's first tenant would be a json module, and s40\nbuilt the kernel for it — but the reason it is a resident rather than\na member is measured, not decreed, and it is two reasons:\n\n1. **Unequal lanes — and the count MOVED at sc15.** `json_valid`/\n   `json_get`/`json_type`/`json_len` were the checked tier's alone\n   from s40 until this sprint's pin. s107 crossed the family natively\n   (`wolf_rt::json`, a hand mirror of `wolf_mem::json` — the locked\n   crate graph forbids reuse — with the two copies pinned upstream by\n   the driver's json_parity test), so BOTH compiler rungs execute\n   every function here now. lupin still declines the surface by\n   design (\"rather than risk a second, guessed RFC 8259 reading\")\n   while wolf-interp's own reading lands (is18, concurrent with this\n   sprint); its column flips on a pin bump, never on an edit here.\n   The graduation trigger was the native mirror plus the\n   interpreter's own — the same two-consumer shape every builtin tier\n   goes through. The first clause FIRED at this pin; the second is in\n   flight, and the register records both.\n2. **This is a query surface, not the API json will end up with.** A\n   dotted path is a small language and it cannot express what the\n   document can hold: a key containing `.` is unreachable at this tier\n   (documented upstream and here), there is no way to enumerate an\n   object's keys, and every read re-parses the whole text. The API a\n   program eventually wants is `std.json`'s DOM — one parse, a value\n   you navigate — and that module has been complete in both\n   directions since sc14 (see the sibling note below). What THIS\n   module grew at sc15 is the compiled lanes' counterpart: the `Node`\n   half below, a navigable handle over the same four kernels, because\n   `std.json`'s `Value` is an enum only the interpreter executes\n   (F-0029) and the kernels now execute everywhere else. Whether a\n   query face lives on beside the DOM or is deleted in favour of it\n   is still a closeout's decision, and this is where it is written\n   down.\n\n## `std.x.json` and `std.json` are two modules, and what separates\n## them MOVED at this pin\n\nFor five sprints module identity was the LAST path segment (F-0034),\nso `use std.json` beside `use std.x.json` was `E0306` on both\ncompiler rungs (F-0058's import half). **s108 probe-closed that**\n(wolf-lang#29): identity is the FULL path now, and the pair\nRESOLVES on all three lanes — the leaf-name clash is only a binding\nclash, and `use std.x.json as xj` names the second binding, exactly\nas the E0306 suggestion says. Measured at these pins, both\ndirections: what stops a co-importing program today is the LANES,\nnot the names — it dies at the first `std.json` body on the compiler\nrungs (\"methods on generic std data\") and at the first `json_*`\nunder lupin. So every test and doc example here still imports\nexactly one module, and the two halves still compose at the TEXT\nlevel: `text_of` of a container is a document `std.json.parse`\nreads, and `stringify` writes a document `root` reads.\n\nThey divide the work the way their lanes do. `std.json` owns the DOM —\na `Value` enum you build, NAVIGATE and serialize. Navigation arrived\nthere at sc13: F-0037 (an enum returned through an error row takes the\nmiss path on every call) closed at lupin 0.1.10 and `json.get`/`at`\nship, so the sentence this paragraph carried for three sprints —\n\"the DOM cannot be walked\" — is retired; `parse` arrived at sc14 and\nthe DOM is complete in both directions. This module owns the read\ndirection — text in, wolf values out — and cannot build anything,\nbecause the kernel is queries only. The lanes divide the same way the\nwork does: `std.json`'s `Value` executes on the interpreter alone\n(F-0029), while everything here executes exactly where the kernels do\n— both compiler rungs at this sprint's pin, lupin pending is18.\n\n**Which means the graduation question this module's clock asks gets\nsharper rather than easier.** The register says `x.json` either\ngraduates as the streaming QUERY face beside `std.json`'s DOM or is\ndeleted in favour of it; the DOM answered `parse` at sc14, and at\nsc15 this module answered back with the `Node` half, so the question\nis symmetric now: two complete read surfaces, one per lane family.\nNothing about the banner, the clock or the trigger changes here —\nthis is a note for whoever holds the closeout, written where they\nwill be standing.\n\n## The tier this delegates to\n\n**Capability-free.** The `json_*` builtins are the one pure builtin\nfamily: no I13 capability, no sandbox category, nothing reached. A\npackage that uses only this module and the language declares no\ncapability at all. The comptime engine still refuses them — there is\nno json evaluator in the D33 allowlist at v0, which is a design\ndecision and not a capability question.\n\n**And that refusal is the one thing in this repository that cannot be\nheld as a test.** `tests/{net,time,env}/comptime_refuses.lu` each pin\ntheir tier's D33 rejection as `fail(E0701)` with the sandbox table's\nown sentence (\"reaches the clock, which comptime code can never\ntouch\"). A `comptime fn` calling `json_valid` answers a bare\n`unsupported` at resolve — no code, no reason string, nothing in the\nrecord's `diagnostics` — so there is no directive to write it against\nand a package author learns nothing about why. Filed as F-0060; there\nis deliberately no `comptime_refuses.lu` here rather than a file\nasserting something weaker than the truth.\n\n**Paths are dotted segments.** `\"\"` is the root; a segment of digits\nindexes an array; anything else keys an object. `\"users.0.name\"` is\nthe second element's `name`. The node's KIND is what decides — on an\nobject every segment is a key, digits included, so a member spelled\n`\"0\"` is reachable (measured; `dom_navigation.lu` pins it) — which is\nalso why the DOM half's `member`/`element` can be typed at all. Build\na path with `child`/`child_index` rather than by hand. **A key containing `.` is unreachable** — the\ntier says so and so does this module; it is not a bug to work around\nhere, it is the ceiling of a dotted path, and it is one of the reasons\nthe DOM is where json is going.\n\n**The rows are the toolchain's, verbatim** (§14's rule, and this\nmodule adds no translation layer): `parse` for any RFC 8259 violation\nin the DOCUMENT, `missing` for a path that addresses nothing, `kind`\nfor a node of the wrong kind for the operation. Two tags are this\nmodule's own and they are marked as such below: `kind` is reused for\n\"the node is a number and you asked for an integer\", and `overflow`\n(§10's mark) for a number outside the wolf type you asked for.\nNothing here traps — a document is data, and every failure a document\ncan cause is a row.\n\n**Numbers keep their source spelling in the kernel** and this module\nis where they become wolf values: `int_at` reads an integer exactly,\nso a 64-bit id survives — `std.json`'s number posture, arrived at\nfrom the other direction. The `f64` half is a contract below and the\nreason is measured, not principled.\n\n**A repeated key is last-wins, one member per key** (wolf-lang\n`[os.json.dup]`, rulings B22 and #61, wolf-lang#124; it retires\nF-0088). A JSON object is a map: `len` counts names, not occurrences. An\nobject holds one member per name, at the position where the name\nfirst appears, with the value of its LAST occurrence: `get` on\n`{\"a\": 1, \"a\": 2}` at `\"a\"` is `2` and `len` of that object is 1,\nwhich is what `std.json.parse` (a `Map` assignment) answers for the\nsame text, so the two read surfaces now agree. A path walks through\nthe last container a repeated name holds, and `text_of` a nested\nobject carries the name once; the root's text is the document's own,\nrepeats included. The kernels answered FIRST-wins and counted every\nrepeat through wolf 0.2.26 / lupin 0.1.49;\n`tests/x/json/dom_typed_reads.lu` holds the ruled reading.\n\n**Every read re-parses the document.** `get` on a ten-megabyte text is\na ten-megabyte parse, and ten reads are ten parses. That is the\nkernel's shape, not a defect this module can hide, and it is the\nsecond-loudest argument for the DOM. Read a subtree once with `get`\n(which hands back a valid JSON text) and query THAT, if the shape of\nyour data allows it. **The `Node` half below does not change the\ncost**: a `Node` is an ADDRESS — a document and a path — not a\nmaterialization, so each accessor is one more parse. What it buys is\nchecked construction: a `Node` this module handed out addresses a\nnode that existed, in a document that parsed, with the misses raised\nwhere the navigation happened rather than at every later read.\n\nReviewed contracts, blocked at the tier below:\n\n```text\nfloat_at(doc: str, path: str) -> f64 ! {parse, missing, kind, overflow}\n    The number at `path` as `f64`, widening an integer node, with\n    `std.fmt.decimal.parse_float`'s correct rounding. WRITTEN, and\n    withdrawn before it shipped, for a reason that is arithmetic\n    rather than design: `parse_float` is `unsupported` on BOTH\n    compiler rungs (\"arithmetic outside integers\" at the mem tier —\n    F-0026's f64 ceiling, one body deep), and the checked tier is\n    this module's ONLY executing lane. So the function would have\n    had zero lanes and zero evidence: no test could run it, no doc\n    example could be fenced, and §14's doc-truth floor (\"at least\n    one lane reaches exit(0)\") would have been missed on every one.\n    A std function nobody can run is a claim, not code. It lands the\n    day either compiler rung executes `parse_float`, with this\n    signature and a four-line body; `get` plus the caller's own\n    conversion is the spelling until then.\nkeys(doc: str, path: str) -> List[str] ! {parse, missing, kind}\n    An object's member names. No builtin enumerates them — `json_len`\n    counts members and nothing names them — so an object can be\n    counted and not walked, which is the sharpest hole in the query\n    tier. **This is sc15's NAMED STOP**: the `Node` half below\n    inherits the hole whole (`keys_of` is the same contract over a\n    handle), s107 added no enumeration kernel, and the ask is written\n    rather than worked around — `json_keys(doc, path) -> List[str]\n    ! {parse, missing, kind}`, the `fs_read_dir` shape one tier over\n    (F-0087, filed upstream). Blocked, not unwritten.\nitems(doc: str, path: str) -> List[str] ! {parse, missing, kind}\n    An array's elements as sub-documents. Writable TODAY over\n    `json_len` plus `child_index` plus `get` in a loop, and left out\n    deliberately: it would parse the document once per element, which\n    is quadratic in a shape programs reach for constantly, hidden\n    behind one call. sc15's `element` reads ONE element per call, so\n    the walk a caller writes — `len_of` plus `element` in a loop —\n    costs the same and shows the cost at the call site. A\n    list-returning `items` still waits for a cursor in the tier.\nparse(doc: str) -> Value   ·   stringify(v: Value) -> str\n    The DOM directions, both `std.json`'s. `stringify` shipped at\n    sc05, `get`/`at` at sc13 and `parse` at sc14 — that DOM is\n    complete. At sc15 THIS module grew its own `Node` face beside the\n    query functions: the compiled lanes' DOM, over the kernels, with\n    `root` as its entry point (not `parse` — see `root`'s doc for the\n    F-0036 reason).\n```",
      "summary": "std.x.json — JSON as a QUERY, over the s40 kernel builtins: is this text valid, what is at this path, what kind is it, how many children does it have, and give it to me as the wolf type I expect.",
      "items": [
        {
          "name": "is_valid",
          "kind": "fn",
          "signature": "pub fn is_valid(doc: str) -> bool",
          "doc": "Whether `doc` is one well-formed RFC 8259 text.\n\nTotal: no rows, no traps — the one function here that answers for\nevery input, which is what makes it the guard the others are written\nbehind. Strict: no comments, no trailing commas, no bare identifiers,\nexactly one value with only insignificant whitespace around it, and\ncontainer nesting limited (the kernel's limit is 128, and exceeding it\nis invalidity rather than a stack fault).\n\nCapability-free; refused at comptime (D33 — no json evaluator, not a\ncapability). Delegates to `json_valid`.\n\n```wolf-doc-example\njson.is_valid(\"[1, 2, 3]\") == true\njson.is_valid(\"{{\\\"a\\\": 1}}\") == true\njson.is_valid(\"[1,]\") == false\njson.is_valid(\"{{\") == false\njson.is_valid(\"\") == false\n```",
          "source": "std/x/json/json.lu",
          "line": 244,
          "tier": "x"
        },
        {
          "name": "get",
          "kind": "fn",
          "signature": "pub fn get(doc: str, path: str) -> str ! {parse, missing}",
          "doc": "The node at `path`, rendered as text.\n\nA string node comes back DECODED (escapes resolved, so `\"a\\nb\"` is two\nlines and not four characters); a number keeps its source spelling\nexactly, so nothing is rounded on the way out; `true`, `false` and\n`null` spell themselves; an object or array comes back as JSON text —\n**a valid document in its own right**, which is what makes\n`get(get(doc, \"a\"), \"b\")` work and is the cheapest way to query a\nsubtree twice.\n\nRows: `parse` when `doc` is not valid JSON, `missing` when nothing is\nat `path`. Never traps.\n\nBare `get` is the checked-access spelling and this one can miss (§1).\n\nCapability-free; refused at comptime (D33). Delegates to `json_get`.\n\n```wolf-doc-example\n(json.get(\"{{\\\"a\\\": 1}}\", \"a\") else \"?\") == \"1\"\n(json.get(\"[10, 20]\", \"1\") else \"?\") == \"20\"\n(json.get(\"{{\\\"s\\\": \\\"hi\\\"}}\", \"s\") else \"?\") == \"hi\"\n(json.get(\"{{\\\"a\\\": {{\\\"b\\\": 2}}}}\", \"a.b\") else \"?\") == \"2\"\n(json.get(\"{{\\\"a\\\": 1}}\", \"b\") else \"?\") == \"?\"\n(json.get(\"{{\", \"a\") else \"?\") == \"?\"\n```",
          "source": "std/x/json/json.lu",
          "line": 273,
          "tier": "x"
        },
        {
          "name": "type_name",
          "kind": "fn",
          "signature": "pub fn type_name(doc: str, path: str) -> str ! {parse, missing}",
          "doc": "The kind of the node at `path` — one of `\"object\"`, `\"array\"`,\n`\"str\"`, `\"num\"`, `\"bool\"`, `\"null\"`.\n\nRows: `parse`, `missing`. Never traps.\n\nSpelled `type_name` and not `kind` for the reason `std.json` learned\nthe hard way: a function and a row tag with the same name in one\nmodule make the tag resolve to the FUNCTION at the raise site,\nsilently (F-0036). The names here are the kernel's own vocabulary\n(`\"str\"` and `\"num\"`, not RFC 8259's \"string\" and \"number\"), adopted\nverbatim per §14 rather than prettified into a second dialect.\n\nCapability-free; refused at comptime (D33). Delegates to `json_type`.\n\n```wolf-doc-example\n(json.type_name(\"{{\\\"a\\\": [1]}}\", \"a\") else \"?\") == \"array\"\n(json.type_name(\"{{\\\"a\\\": [1]}}\", \"a.0\") else \"?\") == \"num\"\n(json.type_name(\"{{\\\"a\\\": \\\"x\\\"}}\", \"a\") else \"?\") == \"str\"\n(json.type_name(\"{{\\\"a\\\": null}}\", \"a\") else \"?\") == \"null\"\n(json.type_name(\"{{\\\"a\\\": true}}\", \"a\") else \"?\") == \"bool\"\n(json.type_name(\"{{\\\"a\\\": {{}}}}\", \"a\") else \"?\") == \"object\"\n```",
          "source": "std/x/json/json.lu",
          "line": 299,
          "tier": "x"
        },
        {
          "name": "len",
          "kind": "fn",
          "signature": "pub fn len(doc: str, path: str) -> int ! {parse, missing, kind}",
          "doc": "How many elements an array has, or members an object has, at `path`.\nA name an object repeats is one member (ruling #61: `len` counts\nnames).\n\nRows: `parse`, `missing`, and `kind` for a scalar — a number has no\nlength, and answering 1 or 0 would be a guess about which question was\nasked. Never traps.\n\nNot a string length: `len` of a `\"str\"` node is `kind`, and the length\nof the text it holds is `std.str.len` of what `get` returns (§1: one\nconcept, one home).\n\nCapability-free; refused at comptime (D33). Delegates to `json_len`.\n\n```wolf-doc-example\n(json.len(\"[1, 2, 3]\", \"\") else -1) == 3\n(json.len(\"{{\\\"a\\\": 1, \\\"b\\\": 2}}\", \"\") else -1) == 2\n(json.len(\"[[1, 2]]\", \"0\") else -1) == 2\n(json.len(\"[]\", \"\") else -1) == 0\n(json.len(\"[1]\", \"0\") else -1) == -1\n```",
          "source": "std/x/json/json.lu",
          "line": 324,
          "tier": "x"
        },
        {
          "name": "has",
          "kind": "fn",
          "signature": "pub fn has(doc: str, path: str) -> bool ! {parse}",
          "doc": "Whether `doc` has a node at `path`.\n\nRows: `parse` when the document is not valid JSON — a question about a\npath has no honest answer when the text is not a document, and `false`\nwould say \"no such field\" about a file that is not JSON at all.\nNever traps.\n\n`has` rather than `contains` for a keyed lookup (§8's vocabulary).\n\nCapability-free; refused at comptime (D33). Delegates to `json_valid`\nand `json_get`.\n\n```wolf-doc-example\n(json.has(\"{{\\\"a\\\": 1}}\", \"a\") else false) == true\n(json.has(\"{{\\\"a\\\": 1}}\", \"b\") else false) == false\n(json.has(\"{{\\\"a\\\": null}}\", \"a\") else false) == true\n(json.has(\"[1, 2]\", \"1\") else false) == true\n(json.has(\"[1, 2]\", \"9\") else false) == false\n(json.has(\"nope\", \"a\") else true) == true\n```",
          "source": "std/x/json/json.lu",
          "line": 348,
          "tier": "x"
        },
        {
          "name": "str_at",
          "kind": "fn",
          "signature": "pub fn str_at(doc: str, path: str) -> str ! {parse, missing, kind}",
          "doc": "The text of the string node at `path`, decoded.\n\nRows: `parse`, `missing`, and `kind` when the node is not a string.\nNo coercion: `str_at` of a number is a miss and not `\"42\"`, because a\nreader that guesses across JSON's types is a reader that loses the\ndocument's own information. `get` is the function that renders any\nnode as text.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\n(json.str_at(\"{{\\\"a\\\": \\\"wolf\\\"}}\", \"a\") else \"?\") == \"wolf\"\n(json.str_at(\"{{\\\"a\\\": \\\"line\\\\nbreak\\\"}}\", \"a\") else \"?\") == \"line\\nbreak\"\n(json.str_at(\"{{\\\"a\\\": 1}}\", \"a\") else \"?\") == \"?\"\n```",
          "source": "std/x/json/json.lu",
          "line": 371,
          "tier": "x"
        },
        {
          "name": "bool_at",
          "kind": "fn",
          "signature": "pub fn bool_at(doc: str, path: str) -> bool ! {parse, missing, kind}",
          "doc": "The boolean at `path`.\n\nRows: `parse`, `missing`, `kind` for every non-boolean node. No\ncoercion: `0`, `\"\"` and `null` are all `kind`.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\n(json.bool_at(\"{{\\\"a\\\": true}}\", \"a\") else false) == true\n(json.bool_at(\"{{\\\"a\\\": false}}\", \"a\") else true) == false\n(json.bool_at(\"{{\\\"a\\\": 0}}\", \"a\") else false) == false\n```",
          "source": "std/x/json/json.lu",
          "line": 391,
          "tier": "x"
        },
        {
          "name": "is_null_at",
          "kind": "fn",
          "signature": "pub fn is_null_at(doc: str, path: str) -> bool ! {parse, missing}",
          "doc": "Whether the node at `path` is JSON `null`.\n\nRows: `parse`, `missing`. A predicate rather than a coercion, because\n\"is this null\" has a yes-or-no answer for every node that EXISTS —\nwhile an absent node is a different question, and it is `missing`.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\n(json.is_null_at(\"{{\\\"a\\\": null}}\", \"a\") else false) == true\n(json.is_null_at(\"{{\\\"a\\\": 0}}\", \"a\") else true) == false\n(json.is_null_at(\"{{\\\"a\\\": null}}\", \"b\") else true) == true\n```",
          "source": "std/x/json/json.lu",
          "line": 413,
          "tier": "x"
        },
        {
          "name": "int_at",
          "kind": "fn",
          "signature": "pub fn int_at(doc: str, path: str) -> int ! {parse, missing, kind, overflow}",
          "doc": "The integer at `path`, exactly.\n\nRows: `parse`, `missing`; `kind` when the node is not a number OR is a\nnumber that is not an integer (`1.5`, `1e3` and `1.0` are all `kind` —\nthe document wrote a non-integer and this function will not round\none); `overflow` (§10's mark) when the integer is outside `int`.\n\n**`overflow` is a row and not a trap, and that is the whole reason\nthis function does its own range check** rather than delegating\nstraight to `std.fmt.parse_int`, which traps on an out-of-range value\n(correctly: to `fmt` the text is a caller's argument). Here the digits\ncame out of a DOCUMENT — data, which §10 says raises where a caller's\nmistake traps — so a 20-digit id in someone's JSON is an outcome this\nfunction reports, never a process this function ends.\n\nExactness is the point: an id beyond 2^53 survives `int_at` and would\nnot survive `float_at`. That is the same number posture `std.json`\ntakes from the writing side.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\n(json.int_at(\"{{\\\"a\\\": 42}}\", \"a\") else -1) == 42\n(json.int_at(\"{{\\\"a\\\": -7}}\", \"a\") else 0) == -7\n(json.int_at(\"{{\\\"a\\\": 9007199254740993}}\", \"a\") else 0) == 9007199254740993\n(json.int_at(\"{{\\\"a\\\": 1.5}}\", \"a\") else -1) == -1\n(json.int_at(\"{{\\\"a\\\": \\\"7\\\"}}\", \"a\") else -1) == -1\n(json.int_at(\"{{\\\"a\\\": 99999999999999999999}}\", \"a\") else -1) == -1\n```",
          "source": "std/x/json/json.lu",
          "line": 447,
          "tier": "x"
        },
        {
          "name": "child",
          "kind": "fn",
          "signature": "pub fn child(path: str, segment: str) -> str",
          "doc": "`path` extended by one object key.\n\nTotal: no rows, no traps, and PURE — the only member of this module\nthat reaches no builtin, so it is the only one a comptime program\ncould use. An empty `path` is the root, so `child(\"\", \"a\")` is `\"a\"`.\n\nA `segment` containing `.` produces a path that addresses something\nelse, and this function does not pretend otherwise: there is no\nescape in the dotted-path language to hide behind (the module header's\nceiling). Keys with dots need the DOM.\n\n```wolf-doc-example\njson.child(\"\", \"users\") == \"users\"\njson.child(\"users\", \"0\") == \"users.0\"\njson.child(\"a.b\", \"c\") == \"a.b.c\"\n```",
          "source": "std/x/json/json.lu",
          "line": 472,
          "tier": "x"
        },
        {
          "name": "child_index",
          "kind": "fn",
          "signature": "pub fn child_index(path: str, i: int) -> str",
          "doc": "`path` extended by one array index.\n\nTotal: no rows, no traps, and PURE — comptime-safe. A negative index\nis not rejected here: it produces a path that addresses nothing, which\nis the `missing` row at the query, and one refusal in the right place\nbeats two in the wrong one.\n\n```wolf-doc-example\njson.child_index(\"\", 0) == \"0\"\njson.child_index(\"users\", 2) == \"users.2\"\njson.child_index(\"a.0\", 1) == \"a.0.1\"\n```",
          "source": "std/x/json/json.lu",
          "line": 491,
          "tier": "x"
        },
        {
          "name": "Node",
          "kind": "struct",
          "signature": "pub struct Node { doc: str, path: str, }",
          "doc": "One location in one well-formed document — the DOM half's handle\n(sc15). A `Node` is an ADDRESS, not a materialization: a document and\na dotted path into it, both plain `str`, so the value crosses every\nlane a struct crosses and costs nothing to copy but the text it\nalready shares.\n\n**What a `Node` promises.** Every `Node` this module hands out —\nfrom `root`, `node`, `member` or `element` — addressed an existing\nnode in a document that parsed, at the moment it was built; the\ndocument is an immutable `str`, so that stays true. The misses are\ntherefore raised where the NAVIGATION happens, and a later read of a\nmodule-built `Node` cannot miss on `parse` or `missing`.\n\n**What a forged one does.** The fields are open — this tier buys no\nprivacy (the `std.time` posture) — so a caller can assemble a `Node`\nout of any two strings. A forged `Node` produces ROWS and never a\ntrap: every accessor's `parse` and `missing` tags stay on the\nsignature because a forged argument can reach them, and the docs\nbelow say which callers can.\n\n**The ceiling travels with the path.** A `Node` is a dotted path, so\na key containing `.` is as unreachable through `member` as through\n`child`, and for the same reason: there is no escape in the path\nlanguage to hide behind. Keys with dots need `std.json`'s DOM.",
          "source": "std/x/json/json.lu",
          "line": 519,
          "tier": "x"
        },
        {
          "name": "root",
          "kind": "fn",
          "signature": "pub fn root(doc: str) -> Node ! {parse}",
          "doc": "The root node of a well-formed document.\n\nThe DOM half's entry point: one validation, then a handle every later\nnavigation and read composes from. Rows: `parse` when `doc` is not\nRFC 8259 — the only miss a root can have, since the root of a valid\ndocument always exists (`missing` is not on the signature because no\nargument can reach it).\n\n**Spelled `root` and not `parse`, and the reason is F-0036's\nsymmetric rule (sc14): a new `pub fn` is checked against its module's\nTAGS.** This module raises the kernel's `parse` tag throughout — `has`\nraises it by name, `root` itself does — and a tag that shares a name\nwith anything in scope resolves to that thing silently. A `pub fn\nparse` here would capture every one of those raise sites, including\nits own body's. `std.json` hit the same collision from the other side\nand renamed its TAG (`syntax`); here the tag is the toolchain's\nverbatim and cannot move, so the FUNCTION yields the name.\n\nCapability-free; refused at comptime (D33). Delegates to `json_valid`.\n\n```wolf-doc-example\nlet r = json.root(\"{{\\\"a\\\": 1}}\")?\n(json.type_of(r) else \"?\") == \"object\"\nlet scalar = json.root(\"  42  \")?\n(json.int_of(scalar) else -1) == 42\n```",
          "source": "std/x/json/json.lu",
          "line": 550,
          "tier": "x"
        },
        {
          "name": "node",
          "kind": "fn",
          "signature": "pub fn node(doc: str, path: str) -> Node ! {parse, missing}",
          "doc": "The node at `path` — the bridge between the two halves: a dotted path\nbuilt with `child`/`child_index` (or received as data) becomes a\nhandle the DOM half reads.\n\nRows: `parse` when `doc` is not RFC 8259, `missing` when the path\naddresses nothing. Never traps.\n\nCapability-free; refused at comptime (D33). Delegates to `json_type`.\n\n```wolf-doc-example\nlet n = json.node(\"{{\\\"a\\\": {{\\\"b\\\": 2}}}}\", \"a.b\")?\n(json.int_of(n) else -1) == 2\nlet whole = json.node(\"[10, 20]\", \"\")?\n(json.len_of(whole) else -1) == 2\n```",
          "source": "std/x/json/json.lu",
          "line": 572,
          "tier": "x"
        },
        {
          "name": "member",
          "kind": "fn",
          "signature": "pub fn member(n: Node, key: str) -> Node ! {parse, missing, kind}",
          "doc": "The member node at `key` of an object node.\n\nRows: `kind` when `n` is not an object — `member` is the TYPED\nnavigation, so asking an array or a scalar for a member is a wrong\nkind and not a silent miss; `missing` when the object has no entry at\n`key`; `parse` and `missing` also cover a forged `n` (see `Node`).\nNever traps.\n\nThe predicate spelling is the query half's `has` (§1: a question with\na boolean answer keeps its predicate): `has(n.doc, child(n.path,\nkey))` answers without building the handle a caller does not want.\n\nA `key` containing `.` addresses along the dots — the path ceiling,\nstated on `Node` and held as a test, not worked around here.\n\nCapability-free; refused at comptime (D33). Delegates to `json_type`.\n\n```wolf-doc-example\nlet r = json.root(\"{{\\\"pack\\\": [{{\\\"name\\\": \\\"lupin\\\"}}]}}\")?\nlet pack = json.member(r, \"pack\")?\nlet leader = json.element(pack, 0)?\nlet name = json.member(leader, \"name\")?\n(json.str_of(name) else \"?\") == \"lupin\"\n```",
          "source": "std/x/json/json.lu",
          "line": 601,
          "tier": "x"
        },
        {
          "name": "element",
          "kind": "fn",
          "signature": "pub fn element(n: Node, i: int) -> Node ! {parse, missing, kind}",
          "doc": "The element node at index `i` of an array node.\n\nRows: `kind` when `n` is not an array — an object with a member\nspelled `\"0\"` is reached by `member`, never by `element`, so the two\nnavigations cannot be confused; `missing` when `i` is outside the\narray (a negative `i` is the same miss and not a from-the-end read —\n`at`'s rule in `std.json`, held here too); `parse` and `missing` also\ncover a forged `n`. Never traps: the index came out of a walk over a\nDOCUMENT, and §10 says data raises where a caller's mistake traps.\n\nThe traversal this module has is `len_of` plus `element` in a loop —\none parse per element, the kernel's cost at the call site where the\ncaller can see it. There is no iterator surface here and none is\ncoming at this tier (ruled territory).\n\nCapability-free; refused at comptime (D33). Delegates to `json_type`.\n\n```wolf-doc-example\nlet r = json.root(\"[10, 20, 30]\")?\nlet second = json.element(r, 1)?\n(json.int_of(second) else -1) == 20\n```",
          "source": "std/x/json/json.lu",
          "line": 633,
          "tier": "x"
        },
        {
          "name": "type_of",
          "kind": "fn",
          "signature": "pub fn type_of(n: Node) -> str ! {parse, missing}",
          "doc": "The kind of the node — one of `\"object\"`, `\"array\"`, `\"str\"`,\n`\"num\"`, `\"bool\"`, `\"null\"`; the kernel's vocabulary, verbatim, and\n`type_name`'s answer over a handle.\n\nRows: `parse`, `missing` — unreachable for a module-built `Node`,\nhonest for a forged one. Never traps.\n\nCapability-free; refused at comptime (D33). Delegates to `json_type`.\n\n```wolf-doc-example\nlet r = json.root(\"{{\\\"a\\\": [1]}}\")?\n(json.type_of(r) else \"?\") == \"object\"\nlet a = json.member(r, \"a\")?\n(json.type_of(a) else \"?\") == \"array\"\n```",
          "source": "std/x/json/json.lu",
          "line": 658,
          "tier": "x"
        },
        {
          "name": "text_of",
          "kind": "fn",
          "signature": "pub fn text_of(n: Node) -> str ! {parse, missing}",
          "doc": "The node rendered as text — `get`'s answer over a handle: a string\nnode comes back DECODED, a number keeps its source spelling, `true`,\n`false` and `null` spell themselves, and a container comes back as\nJSON text, **a valid document in its own right**. That last case is\nhow this half composes with `std.json`: `text_of` of a container is a\ntext its `parse` reads, exactly as its `stringify` writes a text\n`root` reads (in prose because one program cannot import both — the\ntwo modules share a leaf name, F-0058).\n\nA nested container may be re-rendered compactly rather than sliced\nfrom the source (the kernel's documented shape); it is the same\ndocument either way.\n\nRows: `parse`, `missing` — forged-`Node` tags, as on `type_of`.\nNever traps.\n\nCapability-free; refused at comptime (D33). Delegates to `json_get`.\n\n```wolf-doc-example\nlet r = json.root(\"{{\\\"a\\\": [1, 2]}}\")?\nlet a = json.member(r, \"a\")?\n(json.text_of(a) else \"?\") == \"[1,2]\"\nlet t = json.text_of(a) else \"?\"\nlet sub = json.root(t)?\n(json.len_of(sub) else -1) == 2\n```",
          "source": "std/x/json/json.lu",
          "line": 688,
          "tier": "x"
        },
        {
          "name": "len_of",
          "kind": "fn",
          "signature": "pub fn len_of(n: Node) -> int ! {parse, missing, kind}",
          "doc": "How many elements an array node has, or members an object node has.\nA name an object repeats is one member (ruling #61).\n\nRows: `kind` for a scalar — a number has no length, and answering 0\nor 1 would be a guess about which question was asked (`len`'s rule,\nover a handle); `parse`, `missing` for a forged `Node`. Never traps.\n\nCapability-free; refused at comptime (D33). Delegates to `json_len`.\n\n```wolf-doc-example\nlet r = json.root(\"[1, 2, 3]\")?\n(json.len_of(r) else -1) == 3\nlet empty = json.root(\"{{}}\")?\n(json.len_of(empty) else -1) == 0\nlet scalar = json.root(\"42\")?\n(json.len_of(scalar) else -1) == -1\n```",
          "source": "std/x/json/json.lu",
          "line": 709,
          "tier": "x"
        },
        {
          "name": "str_of",
          "kind": "fn",
          "signature": "pub fn str_of(n: Node) -> str ! {parse, missing, kind}",
          "doc": "The text of a string node, decoded.\n\nRows: `kind` when the node is not a string — no coercion, ever:\n`str_of` of a number is a miss and not `\"42\"`, because a reader that\nguesses across JSON's types loses the document's own information\n(`str_at`'s rule, over a handle); `parse`, `missing` for a forged\n`Node`. Never traps. `text_of` is the function that renders ANY node.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\nlet n = json.node(\"{{\\\"s\\\": \\\"line\\\\nbreak\\\"}}\", \"s\")?\n(json.str_of(n) else \"?\") == \"line\\nbreak\"\nlet wrong = json.node(\"{{\\\"s\\\": 1}}\", \"s\")?\n(json.str_of(wrong) else \"?\") == \"?\"\n```",
          "source": "std/x/json/json.lu",
          "line": 729,
          "tier": "x"
        },
        {
          "name": "bool_of",
          "kind": "fn",
          "signature": "pub fn bool_of(n: Node) -> bool ! {parse, missing, kind}",
          "doc": "The boolean a bool node holds.\n\nRows: `kind` for every non-boolean node — `0`, `\"\"` and `null` are\nall `kind`, no coercion (`bool_at`'s rule, over a handle); `parse`,\n`missing` for a forged `Node`. Never traps.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\nlet n = json.node(\"{{\\\"on\\\": true}}\", \"on\")?\n(json.bool_of(n) else false) == true\nlet off = json.node(\"{{\\\"on\\\": false}}\", \"on\")?\n(json.bool_of(off) else true) == false\nlet zero = json.node(\"{{\\\"on\\\": 0}}\", \"on\")?\n(json.bool_of(zero) else false) == false\n```",
          "source": "std/x/json/json.lu",
          "line": 749,
          "tier": "x"
        },
        {
          "name": "int_of",
          "kind": "fn",
          "signature": "pub fn int_of(n: Node) -> int ! {parse, missing, kind, overflow}",
          "doc": "The integer a number node holds, exactly.\n\nRows: `kind` when the node is not a number OR is a number that is not\nan integer (`1.5`, `1e3` and `1.0` are all `kind` — the document\nwrote a non-integer and this function will not round one); `overflow`\n(§10's mark) when the integer is outside `int` — a row and not a\ntrap, because the digits came out of a DOCUMENT; `parse`, `missing`\nfor a forged `Node`. Exactness is the point: an id beyond 2^53\nsurvives `int_of`. All of it is `int_at`'s contract, over a handle.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\nlet n = json.node(\"{{\\\"id\\\": 9007199254740993}}\", \"id\")?\n(json.int_of(n) else 0) == 9007199254740993\nlet fraction = json.node(\"[1.5]\", \"0\")?\n(json.int_of(fraction) else -1) == -1\n```",
          "source": "std/x/json/json.lu",
          "line": 771,
          "tier": "x"
        },
        {
          "name": "is_null",
          "kind": "fn",
          "signature": "pub fn is_null(n: Node) -> bool ! {parse, missing}",
          "doc": "Whether the node is JSON `null`.\n\nA predicate over a node that EXISTS, so it answers for every node —\nwhich is why it is not `kind`-rowed: \"is this null\" has a yes-or-no\nanswer whatever the kind (`is_null_at`'s rule, over a handle). Rows:\n`parse`, `missing` for a forged `Node`. Never traps.\n\nCapability-free; refused at comptime (D33).\n\n```wolf-doc-example\nlet n = json.node(\"{{\\\"a\\\": null}}\", \"a\")?\n(json.is_null(n) else false) == true\nlet zero = json.node(\"{{\\\"a\\\": 0}}\", \"a\")?\n(json.is_null(zero) else true) == false\n```",
          "source": "std/x/json/json.lu",
          "line": 790,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.list_eq",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.list_eq — the six element-comparing `std.list` functions,\nparked outside the facade. Stability tier: x (nursery, D31 clock:\nthey graduate INTO `std.list` verbatim, or are deleted, at the\nstdc01 closeout).\n\nWhy they are here and not in `std.list`, in one sentence: comparing\nelements needs `cmp.Eq`, importing `std.cmp` drags its trait and enum\nitems into every importer, and wolfc's checked tier answers\n`unsupported — module items in checked execution` for those items —\nwhich would flip EVERY std.list test's wolfc row from `run` to\n`unsupported` (F-0012). Budgeting a module by its worst body is house\ndoctrine (sc01), so the six wait here where the cost is contained.\n\nThe second blocker is the older one: neither implementation EXECUTES\ntrait dispatch, so every test in `tests/x/list_eq/` is ledgered\n`unsupported`/`unsupported` (F-0002, F-0004). The bodies still earn\ntheir keep — they typecheck through wolfc's mem rung with the bound\nsatisfied, which is the evidence that the signatures are writable at\nall.\n\nAbsence is spelled `none`, which is the convention's own spelling as of\nsc06 — F-0003 is dead and \"pending\" was stale prose for six sprints\nafter the rename. The bodies read through the local `len`/`at` helpers\nbecause std.list's single-read rule required it when they were written;\nthat rule died at the sc11 pin (s72's D40, F-0005 and F-0014 closed),\nand the shape survives as correct-and-not-worth-churning rather than as\nlaw.",
      "summary": "std.x.list_eq — the six element-comparing `std.list` functions, parked outside the facade.",
      "items": [
        {
          "name": "contains",
          "kind": "fn",
          "signature": "pub fn contains[T: cmp.Eq](xs: List[T], v: T) -> bool",
          "doc": "Whether any element of `xs` equals `v` under `Eq`. Total: no error\nrow, no traps.\n\nProse, not a fenced example (§4): neither implementation executes\ntrait dispatch at the current pins, so a runnable example would be a\ndoc bug. `contains(xs, 2)` is `true` for the list `[1, 2]`, and\n`false` for `[1, 3]` — the equality is `Eq.eq`'s, never `==`'s\n(F-0004 keeps the operator bridge a filing, not an assumption).",
          "source": "std/x/list_eq/list_eq.lu",
          "line": 51,
          "tier": "x"
        },
        {
          "name": "index_of",
          "kind": "fn",
          "signature": "pub fn index_of[T: cmp.Eq](xs: List[T], v: T) -> int ! {none}",
          "doc": "The index of the first element equal to `v` under `Eq`; `none` when\nno element matches. No traps.\n\nProse, not a fenced example (§4, trait dispatch — F-0002): for\n`[5, 6, 5]`, `index_of(xs, 5)` is `0` and `index_of(xs, 9)` raises\n`none`.",
          "source": "std/x/list_eq/list_eq.lu",
          "line": 66,
          "tier": "x"
        },
        {
          "name": "last_index_of",
          "kind": "fn",
          "signature": "pub fn last_index_of[T: cmp.Eq](xs: List[T], v: T) -> int ! {none}",
          "doc": "The index of the LAST element equal to `v` under `Eq`; `none` when no\nelement matches. No traps.\n\nProse, not a fenced example (§4, trait dispatch — F-0002): for\n`[5, 6, 5]`, `last_index_of(xs, 5)` is `2`.",
          "source": "std/x/list_eq/list_eq.lu",
          "line": 83,
          "tier": "x"
        },
        {
          "name": "dedup",
          "kind": "fn",
          "signature": "pub fn dedup[T: cmp.Eq](mut xs: List[T])",
          "doc": "Collapses runs of CONSECUTIVE equal elements (under `Eq`) to one,\nin place — the sorted-input companion, not a set builder. Total: no\nerror row, no traps.\n\nProse, not a fenced example (§4, trait dispatch — F-0002):\n`[1, 1, 2, 1]` dedups to `[1, 2, 1]`; sort first if you want\nuniqueness.",
          "source": "std/x/list_eq/list_eq.lu",
          "line": 102,
          "tier": "x"
        },
        {
          "name": "starts_with",
          "kind": "fn",
          "signature": "pub fn starts_with[T: cmp.Eq](xs: List[T], prefix: List[T]) -> bool",
          "doc": "Whether `xs` begins with every element of `prefix`, in order, under\n`Eq`; an empty `prefix` is always a prefix. Total: no error row, no\ntraps.\n\nProse, not a fenced example (§4, trait dispatch — F-0002): `[1, 2, 3]`\nstarts with `[1, 2]` and does not start with `[2]`.",
          "source": "std/x/list_eq/list_eq.lu",
          "line": 127,
          "tier": "x"
        },
        {
          "name": "ends_with",
          "kind": "fn",
          "signature": "pub fn ends_with[T: cmp.Eq](xs: List[T], suffix: List[T]) -> bool",
          "doc": "Whether `xs` ends with every element of `suffix`, in order, under\n`Eq`; an empty `suffix` is always a suffix. Total: no error row, no\ntraps.\n\nProse, not a fenced example (§4, trait dispatch — F-0002): `[1, 2, 3]`\nends with `[2, 3]` and does not end with `[3, 2]`.",
          "source": "std/x/list_eq/list_eq.lu",
          "line": 149,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.option_expect",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.option_expect — `std.option`'s assert-on-absence helper, parked\noutside the facade for one missing type. Stability tier: x (nursery,\nD31 clock: it graduates INTO `std.option` verbatim, or is deleted, at\nthe stdc02 closeout).\n\nWhy it is here and not in `std.option`: the handler traps, so it\nproduces no value — but wolfc types an `else |_| { … }` block by its\nlast expression, `assert(false)` is `()`, and the block must produce\n`T` (`E0401: this is (), but the else fallback must produce T`). A\nMONOMORPHIC helper works around it with an unreachable dummy after the\ntrap; a generic one has no `T` to conjure, and conjuring one is\nprecisely what a bottom type (`never`, `!`) exists for. wolf does not\nspell one and D30's no-unwinding makes divergence ordinary rather than\nexceptional, so the gap is filed rather than papered over (F-0040).\nlupin accepts the diverging handler and executes it, which is where\nthe evidence below comes from.\n\nOne rejected body poisons a module for every importer, so the cost of\nkeeping this beside `or`/`to_list`/`exists`/`is_none` would be their\nstatic ladder. It moves back on the pin that gives the language a\nbottom type or gives `else` a diverging-handler rule.",
      "summary": "std.x.option_expect — `std.option`'s assert-on-absence helper, parked outside the facade for one missing type.",
      "items": [
        {
          "name": "expect",
          "kind": "fn",
          "signature": "pub fn expect[T](v: T ! {none}, msg: str) -> T",
          "doc": "`v`'s value, or a trap carrying `msg` when `v` is absent — the\nassertion form of absence handling, for a miss the caller has already\nruled out by construction.\n\nRows: consumes `none`.\nTraps `assert` (`[conf.trap.map]`) on the miss, after printing one\n`FAILED: {msg}` line, exactly as `testing.fail` does. It never returns\nnormally on a miss: a trap ends the process (D30, no unwinding), which\nis why this is the wrong tool for data-driven absence and the right\none for an invariant.\n\nExample (prose — a row value has no literal, F-0038; runnable in\n`tests/x/option_expect/expect_trap.lu`):\n`option_expect.expect(find(5), \"5 is positive\")` is `5`;\n`option_expect.expect(find(0), \"0 is positive\")` prints\n`FAILED: 0 is positive` and traps `assert`.",
          "source": "std/x/option_expect/option_expect.lu",
          "line": 41,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.option_flatten",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.option_flatten — `std.option`'s sixth helper, parked outside the\nfacade for one grammar fact. Stability tier: x (nursery, D31 clock: it\ngraduates INTO `std.option` verbatim, or is deleted, at the stdc02\ncloseout).\n\nWhy it is here and not in `std.option`, in one sentence: `flatten` is\nthe only helper whose type nests a row inside a row\n(`T ! {none} ! {none}`), wolfc's grammar admits exactly one `!` per\ntype in every position and calls the nested form `fail(E0201)` at\nparse, and one rejected body poisons a module for every importer —\nso keeping it beside the other five would cost them their clean static\nladder (F-0039). lupin parses and executes the nested row, which is\nhow the body below was written and tested.\n\nNothing else is different: this is the reviewed signature from\n`std.option`'s header, with the same contract, the same tag, and the\nsame one-executing-lane story. It moves back on the pin that makes\nwolfc's `type` production right-recursive, in that pin's own commit.",
      "summary": "std.x.option_flatten — `std.option`'s sixth helper, parked outside the facade for one grammar fact.",
      "items": [
        {
          "name": "flatten",
          "kind": "fn",
          "signature": "pub fn flatten[T](v: T ! {none} ! {none}) -> T ! {none}",
          "doc": "One layer of absence removed: a doubly-absent value is absent, and an\ninner miss is absent too. The two misses are indistinguishable by\nconstruction — `none` carries no payload (§2), so there is nothing to\ntell an outer miss from an inner one, and a caller who needs to know\nwants two named tags rather than nesting.\n\nRows: raises `none` when either layer is absent.\nTotal otherwise: no traps.\n\nExample (prose — a row value has no literal, F-0038; runnable in\n`tests/x/option_flatten/flatten_propagate.lu`): with\n`fn nest(x: int) -> int ! {none} ! {none}`,\n`option_flatten.flatten(nest(16)) else 0 - 1` is `4` and\n`option_flatten.flatten(nest(6)) else 0 - 1` is `-1`.",
          "source": "std/x/option_flatten/option_flatten.lu",
          "line": 36,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.testing_text",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.testing_text — the string assertion, parked outside the facade\nbecause of what it costs there. Stability tier: x (nursery, D31 clock:\nit graduates INTO `std.testing` verbatim, or is deleted, at the stdc02\ncloseout).\n\nThe measurement, made in this sprint and worth keeping: a builtin\n`str` method anywhere in an imported module makes every importer\n`unsupported` at RESOLVE under wolfc (F-0018's resolve-level half,\nmapped in F-0026). `assert_starts_with` needs exactly one such call,\nand `std.testing` is imported by every trap test in the tree — so\nkeeping it in the facade would have taken `fail`, `unreachable` and\n`todo` off the compiler lane they run on today, to buy one assertion\nthat runs on lupin either way.\n\nIts siblings do not exist yet, and the reason is now the SAME as this\nmodule's own: `assert_ends_with` and a substring assertion need\n`ends_with`/`find`, which exist and execute as of s37 (sc09 spends\nthem in `std.str`) — so what keeps all three out of the facade is\npurely the resolve-level half above, not the primitive. This module\ngains them and then dissolves into `std.testing` when a builtin `str`\nmethod stops costing every importer its wolfc lane.\n\nIt delegates the failure line to `std.testing.fail` rather than\nprinting its own: one concept, one name (§1), and the nursery may\ndepend on the facade even though the facade may not depend on it.",
      "summary": "std.x.testing_text — the string assertion, parked outside the facade because of what it costs there.",
      "items": [
        {
          "name": "assert_starts_with",
          "kind": "fn",
          "signature": "pub fn assert_starts_with(s: str, p: str)",
          "doc": "Asserts `s` begins with `p`; a miss prints one line and traps\n`assert` (`[conf.trap.map]`). Never returns normally on a miss.\n\n`starts_with` is the one boundary-safe string probe (sc03): it is\ntotal over arbitrary UTF-8 and cannot trap `bounds`, which is why this\nis the only string assertion std can offer honestly today.\n\nExample (prose — a trapping call cannot sit in a boolean example):\n`testing_text.assert_starts_with(\"wolf\", \"wo\")` is silent;\n`testing_text.assert_starts_with(\"wolf\", \"x\")` prints\n`FAILED: assert_starts_with: prefix not found` and traps `assert`.",
          "source": "std/x/testing_text/testing_text.lu",
          "line": 42,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.tls",
      "group": "Nursery",
      "tier": "x",
      "doc": "Namespace for the modules listed below.",
      "summary": "Namespace for the modules listed below.",
      "items": []
    },
    {
      "name": "x.tls.cert",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.tls.cert — X.509 v3 certificate parsing and path validation\n(RFC 5280 over X.690 DER, RFC 9525 names). Stability tier: x — the\nTHIRD rung of the stdc-tls campaign (sprint sc22), the rung that\nmakes sc21's opaque Certificate bytes MEAN something: sc21 carries\nthe DER and builds the §4.4.3 signed octets; this module parses the\ncertificate, checks each signature with its issuer's key, and\nvalidates a path to a caller-supplied root set (sc79) or one trust\nanchor, against a hostname and a SUPPLIED time.\n\n**The nursery banner (D31).** `std.x.tls.cert` is not `std.tls`: its\npath, names and behaviour may change or vanish in one sprint; no\nother std module may depend on it. Its reason and graduation trigger\nlive in `std/x/README.md`. It depends on FIVE sibling residents —\n`std.x.crypto.curve25519` (Ed25519), `std.x.crypto.p256` (ECDSA\nP-256, sc23), `std.x.crypto.p384` (ECDSA P-384, sc79),\n`std.x.crypto.rsa` (RSASSA-PKCS1-v1_5 and RSASSA-PSS, sc79) and\n`std.x.crypto.sha2` (the digests P-384 verifies over) —\nresident-on-resident edges the graduation move to\n`std.tls`/`std.crypto` must resolve, named in the register beside\nthe record/handshake/jose edges.\n\n**Built from the DOCUMENTS, not ported.** ITU-T X.690 (the DER\nencoding rules — §8.1 TLV structure and lengths, §8.3 INTEGER\nminimality, §8.19 OID subidentifiers, §10 the definite-form and\nminimal-length rules, §11.1 BOOLEAN, §11.5 DEFAULT-value absence,\n§11.6 SET-OF ordering) and RFC 5280 (the X.509/PKIX profile — §4.1\nthe certificate structure, §4.1.2.2 serial numbers, §4.1.2.5 the\nUTCTime/GeneralizedTime split and the 2-digit-year window, §4.2 the\nextension rules, §6.1 path validation) plus RFC 8410 (Ed25519\nAlgorithmIdentifier: NO parameters, §3). Section numbers are cited\nat the rejection sites they license.\n\n## The robustness contract (the sprint's flagship)\n\nEvery length read from the input is VALIDATED against the remaining\nwindow before a single content byte is touched: a length that claims\nmore bytes than remain, an indefinite length (X.690 §10.1 forbids it\nin DER), a non-minimal length encoding, a reserved length octet —\neach is a clean, named `der` rejection, never an out-of-bounds read\nand never a trap. wolf's checked arithmetic (X3) and region memory\nmake the overrun STRUCTURALLY impossible; the decoder's job on top\nof that is to turn \"impossible\" into \"rejected\", because a server\ncannot abort on a bad input. The decoder is grammar-directed (it\nwalks exactly the X.509 productions, and carries anything it does\nnot model as opaque bytes), so there is NO unbounded recursion for a\nnesting bomb to exhaust: a deeply nested structure inside an unknown\nextension is never walked at all.\n\n## The scope line (honest about the crypto ladder)\n\nSignature VALIDATION (sc79's table, `verify_signed_by`): Ed25519\n(RFC 8410); ecdsa-with-SHA256 under a P-256 key; ecdsa-with-SHA256,\n-SHA384 and -SHA512 under a P-384 key (RFC 5758, the curve named in\nthe key's parameters, RFC 5480); sha256/384/512WithRSAEncryption\n(RFC 8017 PKCS#1 v1.5) and RSASSA-PSS (RFC 4055 parameters: SHA-256,\n-384 or -512, MGF1 over the same hash, the stated salt length) under\nan rsaEncryption key of 2048 to 4096 bits. Every other pairing PARSES\nstructurally (the hardening win is algorithm-independent) and\nvalidation answers the named `unsupported_alg` — NEVER a silent\naccept: SHA-1 and MD5 signatures, P-521, Ed448, a P-256 key under a\ndigest other than SHA-256, an RSASSA-PSS (id-RSASSA-PSS) key, an RSA\nmodulus over 4096 bits. An RSA key under 2048 bits, or with an\nexponent outside the rsa module's range, is `weak_key`, wherever it\nsits in a path.\n\nPath validation (RFC 5280 §6.1, this subset): validity at the\nsupplied time, basicConstraints cA and pathLenConstraint, keyUsage\nkeyCertSign on issuers and digitalSignature on the leaf (RFC 8446\n§4.4.2.2), extendedKeyUsage serverAuth (or anyExtendedKeyUsage) on\nthe leaf and on every issuer that carries the extension, unknown\ncritical extensions refused by name, `dNSName` SAN matching per RFC\n9525 with a wildcard only as the whole left-most label (`san_matches`).\nNAMED LIMITS (deliberately not half-built): nameConstraints are\nREFUSED by name (`name_constraints`) wherever they appear, never\nevaluated; revocation (CRL/OCSP) is not consulted; the policy\nmachinery (§4.2.1.4, §6.1's policy tree) is not implemented, so a\nCRITICAL policy extension is `unknown_critical`; the CN fallback for\nhostnames is not implemented (SAN is the only source); non-dNSName\nSAN forms (IP, URI, email) are carried, not matched; names chain by\nexact DER bytes, not by RFC 5280 §7.1's caseIgnoreMatch.\n## ct: certificates are PUBLIC data\n\nEverything this module touches — the DER, the names, the validity\ndates, the public keys, the signatures — is public wire material.\nNo secret is present anywhere in this module, so no function here\ncarries a constant-time obligation (unlike the handshake's secrets\nor sc18's signing scalar; the sc18 rule: VERIFY is public data).\nEvery `pub` fn states `ct: public data` so the posture is explicit\nrather than inferred. The 0..255 ingestion guard is the recorded\nvalue-dependent branch shared with the whole ladder (F-0035's real\nbyte type retires it); it runs on public bytes here.\n\n## Time is a SUPPLIED argument, never the wall clock\n\nValidity checking takes `now` as an argument in the compact form\n`yyyymmddhhmmss` (UTC, the `timestamp` helper builds it). Certificate\ntimes decode to the same form, so the comparison is plain integer\norder and every test is deterministic — nothing in this module reads\na clock (it is capability-free: pure, comptime-refused only by its\ndelegate curve25519 when a validation reaches a signature).\n\n## The seams: `validate_path` (sc79) and `validate_chain` (ws05, frozen in shape)\n\n`validate_path(chain, hostname, roots, now) -> Cert ! {...}` is the\npublic-PKI seam `std.x.tls.client` consumes: `chain` is the peer's\ncertificate chain as CONCATENATED DER, leaf first (the `cert_data`\nentries of sc21's Certificate message, joined — DER is\nself-delimiting, `cert_end` finds each boundary), the rest in any\norder; `roots` is the caller's trust store as concatenated DER (a\ndistribution's bundle converted to DER is the intended input; an\nentry this profile cannot parse is skipped); `now` is the supplied\nvalidation time. The path is built depth-first with backtracking,\nroots before the peer's intermediates at every step, bounded at\neight certificates and sixteen link attempts.\n`validate_chain(chain, hostname, anchor, now)` is the sc22 seam\nwolf-wws ws05 consumes, unchanged in shape: the same validation with\na root set of exactly one anchor. The answer is the parsed LEAF\n(subject, SAN, validity, SPKI — the fields ws05 reads) or a NAMED\nrejection: `der` (malformed encoding), `unsupported_alg`,\n`bad_signature`, `expired`, `not_yet_valid`, `name_mismatch`,\n`not_ca`, `issuer_mismatch`, `unknown_critical`, and since sc79\n`weak_key`, `bad_usage` and `name_constraints`. sc22 owns\ncertificate meaning; sc21 owns the handshake flow that carries the\nbytes; ws05 owns the socket conversation. `std/x/README.md` records\nboth seams.\n\nByte sequences are `List[byte]` with the 0..255 element contract\n(§11's interim, F-0035), the whole ladder's convention. Chain\nvalidation is iterative (no recursion, no per-chain allocation\nbeyond the parsed certificates); a root that ends a path is validated\nlike any chain certificate (validity, basicConstraints, keyUsage,\nextendedKeyUsage, key policy) — a deliberately STRICTER reading than\nRFC 5280 §6.1.1(d)'s anchor-as-input, stated here because every root\na modern store carries meets the profile, and an expired or\nnon-CA root is better refused than trusted.",
      "summary": "std.x.tls.cert — X.509 v3 certificate parsing and path validation (RFC 5280 over X.690 DER, RFC 9525 names).",
      "items": [
        {
          "name": "Cert",
          "kind": "struct",
          "signature": "pub struct Cert { version: int, serial: List[byte], sig_alg: str, issuer: List[byte], issuer_cn: str, subject: List[byte], subject_cn: str, not_before: int, not_after: int, spki_alg: str, spki_key: List[byte], has_bc: bool, is_ca: bool, path_len: int, key_usage: int, has_san: bool, san: List[str], crit_unknown: str, tbs: List[byte], sig: List[byte], sig_params: List[byte], spki_curve: str, has_eku: bool, eku: List[str], has_name_constraints: bool, }",
          "doc": "A parsed X.509 certificate — the fields wolf-wws ws05 reads, plus\nthe raw material validation needs (`tbs` is the exact DER of the\nTBSCertificate, the octets the signature is over; `issuer`/`subject`\nare the raw Name encodings, the chaining currency). Times are\ncompact `yyyymmddhhmmss` UTC ints. `path_len` and `key_usage` are\n-1 when their extensions are absent; `crit_unknown` is the first\nunrecognized CRITICAL extnID (\"\" when none — validation rejects a\nnon-empty one by name, RFC 5280 §4.2's rule). sc79 adds:\n`sig_params` (the raw parameters TLV of the signature algorithm,\nread for RSASSA-PSS), `spki_curve` (an EC key's named-curve OID, \"\"\notherwise), `has_eku`/`eku` (the extendedKeyUsage purposes, dotted)\nand `has_name_constraints` (refused by name in validation). This pin has no\nprivate fields, so a forged Cert is constructible; every consumer\nhere treats the fields as data and answers with rows, never traps.\nct: public data throughout — a certificate carries no secret.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1150,
          "tier": "x"
        },
        {
          "name": "parse",
          "kind": "fn",
          "signature": "pub fn parse(bytes: List[byte]) -> Cert ! {der}",
          "doc": "Parse ONE DER certificate occupying the whole of `bytes` (RFC 5280\n§4.1 over X.690 DER; trailing bytes reject). Structural validation\nonly — signatures, dates and names are DECODED here and JUDGED in\n`validate_chain`, so a certificate signed with an algorithm outside\nthe ladder still parses (the split the header states). Every\nmalformed, truncated or non-DER encoding is the named `der`\nrejection — no input reads out of bounds and none traps (the\nrobustness contract; the conformance suite in `tests/x/tls/cert/`\npins each clause). Rejections enforced here include: every length\nclass (indefinite, non-minimal, overrun, reserved), INTEGER and\nBOOLEAN minimality, OID subidentifier form, the version field\n(present must be v3; v1's DEFAULT must be absent, X.690 §11.5; v2\nrejects), serial positivity and the 20-octet cap (§4.1.2.2), the\n§4.1.2.3 TBS/outer algorithm equality, the §4.1.2.5 time rules\n(2-digit window, mandatory seconds and Z, the 2049/2050 split),\nDN SET-OF order (X.690 §11.6), CN string types (§4.1.2.4),\nSPKI form (zero unused bits; RFC 8410's no-params, 32-byte Ed25519\nkey), the §4.1.2.8 unique-ID prohibition, and the §4.2 extension\nrules (non-empty, no duplicates, DEFAULT-FALSE absence,\nbasicConstraints/keyUsage/subjectAltName inner form).\nct: public data; no secret is present.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1199,
          "tier": "x"
        },
        {
          "name": "cert_end",
          "kind": "fn",
          "signature": "pub fn cert_end(chain: List[byte], offset: int) -> int ! {der}",
          "doc": "The end offset (exclusive) of the DER certificate starting at\n`offset` in `chain` — the boundary walker for CONCATENATED DER\n(sc21's certificate_list entries, joined). Validates the outer TLV\nheader only; `parse` validates the body. Truncation and every\nmalformed length reject `der`.\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1356,
          "tier": "x"
        },
        {
          "name": "oid_ed25519",
          "kind": "fn",
          "signature": "pub fn oid_ed25519() -> str",
          "doc": "The Ed25519 algorithm OID (RFC 8410), the key and the signature\nalgorithm at once. Zero-argument functions stand in for `const`s\n(F-0025).\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1377,
          "tier": "x"
        },
        {
          "name": "oid_ecdsa_sha256",
          "kind": "fn",
          "signature": "pub fn oid_ecdsa_sha256() -> str",
          "doc": "The ecdsa-with-SHA256 signature algorithm OID (X9.62 / RFC 5480 —\nthe ES256 certificate signature). ct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1383,
          "tier": "x"
        },
        {
          "name": "oid_ec_public_key",
          "kind": "fn",
          "signature": "pub fn oid_ec_public_key() -> str",
          "doc": "The id-ecPublicKey OID (X9.62 — an EC subjectPublicKey). The curve\nitself rides in the SPKI parameters (RFC 5480's namedCurve, decoded\ninto `Cert.spki_curve`): P-256 and P-384 validate, and each curve's\non-curve check refuses a key that is not its point; any other curve\nis `unsupported_alg`. ct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1392,
          "tier": "x"
        },
        {
          "name": "alg_name",
          "kind": "fn",
          "signature": "pub fn alg_name(dotted: str) -> str",
          "doc": "Classify a dotted algorithm OID: \"ed25519\" (1.3.101.112),\n\"rsa\" (the PKCS#1 arc — signature algorithms and rsaEncryption),\n\"ecdsa\" (the X9.62 arc — ECDSA signatures and id-ecPublicKey),\n\"ed448\" (1.3.101.113), else \"unknown\". Classification is for\nREPORTING; validation reads the exact OIDs (`verify_signed_by`'s\ntable) and answers `unsupported_alg` for every pairing outside it.\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1403,
          "tier": "x"
        },
        {
          "name": "ku_digital_signature",
          "kind": "fn",
          "signature": "pub fn ku_digital_signature() -> int",
          "doc": "KeyUsage bit weight: digitalSignature (bit 0).\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1421,
          "tier": "x"
        },
        {
          "name": "ku_key_cert_sign",
          "kind": "fn",
          "signature": "pub fn ku_key_cert_sign() -> int",
          "doc": "KeyUsage bit weight: keyCertSign (bit 5) — the bit an issuing CA's\nkeyUsage must assert (§4.2.1.3).\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1428,
          "tier": "x"
        },
        {
          "name": "host_matches",
          "kind": "fn",
          "signature": "pub fn host_matches(pattern: str, host: str) -> bool",
          "doc": "Exact, case-insensitive DNS name match (DNS names compare\ncase-insensitively; both sides are lowered). NO wildcard support — a\n`*.` pattern here never matches a hostname, which fails CLOSED. Kept\nexact because callers outside certificate validation read it (a\nserver choosing its certificate by SNI); certificate validation\nmatches SAN entries with `san_matches` (RFC 9525) since sc79.\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1439,
          "tier": "x"
        },
        {
          "name": "timestamp",
          "kind": "fn",
          "signature": "pub fn timestamp(y: int, mo: int, d: int, h: int, mi: int, s: int) -> int",
          "doc": "Build the compact `yyyymmddhhmmss` timestamp `validate_chain` and\nthe Cert fields speak (UTC). Caller-contract violations trap\n`assert` (X3's posture: the caller could have checked the ranges);\ncertificate DATA with bad ranges rejects `der` in the parser\ninstead — §10's trap-where-the-caller-broke-it rule.\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1455,
          "tier": "x"
        },
        {
          "name": "oid_rsa_encryption",
          "kind": "fn",
          "signature": "pub fn oid_rsa_encryption() -> str",
          "doc": "The rsaEncryption key OID (RFC 8017 A.1; RFC 3279 §2.3.1): an RSA\nsubjectPublicKey whose BIT STRING holds the DER RSAPublicKey.\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1479,
          "tier": "x"
        },
        {
          "name": "oid_secp256r1",
          "kind": "fn",
          "signature": "pub fn oid_secp256r1() -> str",
          "doc": "The prime256v1 (P-256) named-curve OID (RFC 5480 §2.1.1.1).\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1485,
          "tier": "x"
        },
        {
          "name": "oid_secp384r1",
          "kind": "fn",
          "signature": "pub fn oid_secp384r1() -> str",
          "doc": "The secp384r1 (P-384) named-curve OID (RFC 5480 §2.1.1.1).\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1491,
          "tier": "x"
        },
        {
          "name": "oid_server_auth",
          "kind": "fn",
          "signature": "pub fn oid_server_auth() -> str",
          "doc": "The id-kp-serverAuth key purpose (RFC 5280 §4.2.1.12): the\nextendedKeyUsage value a TLS server's certificate must allow.\nct: public data.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1498,
          "tier": "x"
        },
        {
          "name": "verify_signed_by",
          "kind": "fn",
          "signature": "pub fn verify_signed_by(child: Cert, issuer: Cert) -> int ! { der, unsupported_alg, bad_signature, weak_key, }",
          "doc": "Verify `child`'s signature over its TBSCertificate bytes with\n`issuer`'s key. The table (sc79):\n\n- Ed25519 (RFC 8410) under an Ed25519 key — `curve25519.verify`;\n- ecdsa-with-SHA256 under a P-256 key — `p256.verify_der`;\n- ecdsa-with-SHA256, -SHA384 or -SHA512 under a P-384 key —\n  `p384.verify_digest_der` (bits2int over the digest);\n- sha256/384/512WithRSAEncryption under an rsaEncryption key —\n  `rsa.verify_pkcs1`;\n- RSASSA-PSS (RFC 4055) under an rsaEncryption key, the hash, MGF1\n  and salt length from the signature's own parameters —\n  `rsa.verify_pss`.\n\n`unsupported_alg` for every other pairing — the NAMED honest\nrejection, never a silent accept: SHA-1 signatures, P-256 with a\ndigest other than SHA-256, P-521, Ed448, an RSASSA-PSS key, a\nsignature algorithm whose key type does not match the issuer's.\n`bad_signature` when the verification itself fails (each verifier\nalso answers false for a malformed key point or signature encoding).\n`weak_key` and `der` from the issuer's RSA key (`rsa_key`), `der` and\n`unsupported_alg` from malformed or unsupported PSS parameters.\nReturns 1 on success (the accept_finished shape).\nct: public data — a VERIFY handles no secret (the sc18 rule); the\nverifiers' own ct: lines govern their internals.",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1680,
          "tier": "x"
        },
        {
          "name": "san_matches",
          "kind": "fn",
          "signature": "pub fn san_matches(pattern: str, host: str) -> bool",
          "doc": "RFC 9525 §6.3 dNSName matching (DNS names compare case-insensitively;\nboth sides are lowered). A pattern without `*` matches exactly. A\nwildcard matches only as the COMPLETE left-most label of a pattern\nwith at least two labels after it (`*.example.com`): it stands for\nexactly one non-empty label of the host. Every other `*` (a partial\nlabel `w*.example.com`, a wildcard below the left-most label, a bare\n`*` or `*.com`) matches nothing — the rule fails CLOSED.\nct: public data.\n\n```wolf-doc-example\ncert.san_matches(\"*.example.com\", \"www.example.com\") == true\ncert.san_matches(\"*.example.com\", \"a.b.example.com\") == false\ncert.san_matches(\"*.example.com\", \"example.com\") == false\ncert.san_matches(\"w*.example.com\", \"www.example.com\") == false\ncert.san_matches(\"Example.COM\", \"example.com\") == true\n```",
          "source": "std/x/tls/cert/cert.lu",
          "line": 1874,
          "tier": "x"
        },
        {
          "name": "validate_path",
          "kind": "fn",
          "signature": "pub fn validate_path(chain: List[byte], hostname: str, roots: List[byte], now: int) -> Cert ! { der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }",
          "doc": "PATH VALIDATION against a root set (sc79, RFC 5280 §6.1 in the subset\nthe module header names): build a path from the peer's leaf to one of\nthe caller's roots and validate it at the SUPPLIED time, returning\nthe parsed LEAF.\n\n`chain` is the peer's certificates as concatenated DER, LEAF FIRST\n(the TLS Certificate message's entries joined); the rest may arrive\nin any order and may include certificates the path does not use.\n`roots` is the caller's trust store as concatenated DER (a\ndistribution's bundle converted to DER is the intended input); a\nroot this profile cannot parse is skipped. `now` is\n`timestamp(...)`-shaped UTC. No clock is read and no file is opened.\n\nThe leaf first: `der` (any certificate of `chain` malformed), then\n`unknown_critical`, `not_yet_valid`, `expired`, `name_mismatch`\n(RFC 9525 against its SAN), `bad_usage` (keyUsage without\ndigitalSignature, extendedKeyUsage without serverAuth),\n`name_constraints`, and its key (`weak_key` for an RSA key under\n2048 bits). Then the path, depth-first with backtracking: at each\nstep the roots whose subject is the current certificate's issuer are\ntried before the peer's other certificates, each candidate judged by\n`link` (validity, `not_ca`, `bad_usage`, `name_constraints`,\n`weak_key`, then the signature: `bad_signature`, `unsupported_alg`).\nA root that links ends the path. Bounds: at most eight certificates\nin a path and sixteen link attempts in all. When no path exists the\nanswer is the FIRST link refusal met, or `issuer_mismatch` when no\ncandidate ever carried the right name. Revocation (CRL/OCSP) is NAMED\nRESIDUE: nothing here consults revocation state.\nct: public data throughout (certificates carry no secret).",
          "source": "std/x/tls/cert/cert.lu",
          "line": 2083,
          "tier": "x"
        },
        {
          "name": "validate_chain",
          "kind": "fn",
          "signature": "pub fn validate_chain(chain: List[byte], hostname: str, anchor: List[byte], now: int) -> Cert ! { der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }",
          "doc": "THE ws05 SEAM (frozen in shape since sc22): validate the peer's\nchain against ONE trust anchor — `validate_path` with a root set of\nexactly `anchor`, so it builds, judges and refuses exactly as that\nfunction does (sc79 widened what it accepts: RSA, RSA-PSS and P-384\nsignatures, RFC 9525 wildcards; and what it refuses by name:\n`weak_key`, `bad_usage`, `name_constraints`). A malformed `anchor`\nis `der`, as it always was.\nct: public data throughout (certificates carry no secret).",
          "source": "std/x/tls/cert/cert.lu",
          "line": 2191,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "Lowercase hex of a byte list. ct: public data (and a rendering\nconvenience only, never a secret-handling path).",
          "source": "std/x/tls/cert/cert.lu",
          "line": 2218,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.tls.client",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.tls.client — the TLS 1.3 CLIENT (RFC 8446, one profile) over\nthe library's own proven halves. Stability tier: x — the FOURTH rung\nof the stdc-tls campaign (sprint sc29), and the rung that turns the\nstack AROUND: sc20's record layer, sc21's handshake machinery and\nsc22/sc23's chain validation were all built and vectored from the\nverifier's side, which IS the client's side — this module is the\nstate machine that drives them against a live socket. A wolf program\ndials loopback TCP, shakes TLS 1.3 with the std server half,\nverifies the chain + CertificateVerify + Finished, exchanges\napplication data, and closes.\n\n**The nursery banner (D31).** `std.x.tls.client` is not `std.tls`:\nits path, names and behaviour may change or vanish in one sprint; no\nother std module may depend on it. Its reason and graduation trigger\nlive in `std/x/README.md`. It depends on SEVEN sibling residents —\n`std.x.tls.record` (seal/open + the key-schedule primitives),\n`std.x.tls.handshake` (messages, transcript, schedule, Finished,\nthe §4.1 state machine), `std.x.tls.cert` (path validation),\n`std.x.crypto.curve25519` (X25519 + Ed25519 verify),\n`std.x.crypto.p256` (ECDSA-P256 verify), `std.x.crypto.p384`\n(ECDSA-P384 verify, sc79) and `std.x.crypto.rsa` (RSASSA-PSS verify,\nsc79) — plus the `std.net` FACADE\n(a resident may depend on the facade). The resident-on-resident\nedges are named in the register beside the earlier rungs' own.\n\n## The one profile (the contract's scope line)\n\nTLS 1.3 only, TLS_CHACHA20_POLY1305_SHA256 (0x1303 — the suite the\nserver half speaks), X25519 the only group, SNI + the RFC 8446\nminimum extensions. signature_algorithms offers the six schemes this\nclient verifies (`signature_schemes`). CertificateVerify VERIFIES —\nsee below. NAMED NON-TARGETS: OS truststore reading (the trust\nanchors are CALLER-SUPPLIED — a distribution's bundle converted to\nconcatenated DER is the intended input, and std opens no file for\nit), session resumption/0-RTT, the rsa_pss_pss_* and rsa_pkcs1_*\nCertificateVerify schemes and P-521 (named `unsupported_alg`, never\na silent accept), signature_algorithms_cert (not sent),\nTLS 1.2 (a downgrade-shaped ServerHello is a named refusal),\nHelloRetryRequest (one key share is offered and a server that\ncannot take it is a named refusal, not a second flight).\n\n## The CertificateVerify RETIREMENT (sc21's posture ends here)\n\nsc21 built the §4.4.3 signed octets and verified NOTHING (no\nverifier existed for the trace's schemes). That posture RETIRES for\ntwo schemes at sc29: **ed25519 (0x0807)** verifies via sc18's\n`curve25519.verify` and **ecdsa_secp256r1_sha256 (0x0403)** verifies\nvia sc23's `p256.verify_der` — both against the validated leaf's\nSPKI over the exact §4.4.3 content. sc79 adds the public PKI's:\n**ecdsa_secp384r1_sha384 (0x0503)** via `p384.verify_der` and\n**rsa_pss_rsae_sha256/384/512 (0x0804..0x0806)** via\n`rsa.verify_pss` (MGF1 over the same hash, salt = digest length,\nRFC 8446 §4.2.3); every other scheme remains the named\n`unsupported_alg` (the sc22 honesty split, unchanged), and a weak\nRSA leaf key is `weak_key`. NOTHING about a peer is trusted before\npath + CertificateVerify + Finished all pass. The path is\n`cert.validate_path` from the leaf to one of the caller's roots\n(sc79; the anchor-at-a-time search it replaces validated the whole\nchain once per root).\n\n## The API shape: the caller owns the dial, the module owns the\nstate machine — in TWO PHASES\n\n`begin(take sock, …) -> Pending` writes the ClientHello and returns\nWITHOUT reading; `complete(take p) -> Client` reads the server\nflight, verifies everything, sends the client Finished. Two phases\nrather than one blocking `connect` is a deliberate, recorded choice\n(the contract's single-threaded-reality question): every operation\nat this tier blocks the whole process (std.net's posture), so an\nIN-PROCESS client+server witness needs the client to yield between\nits first write and its first read — between `begin` and `complete`\nthe test's server half reads the ClientHello and writes its whole\nflight into the loopback buffer, and nothing ever blocks (the\ndial-first discipline generalized to strict alternation with\nkernel-buffered flights). A two-process shape (`std.process` exists)\nwas the alternative and costs a spawned binary no lane can build\nhere; phase separation costs one extra call and keeps the witness\nsingle-file and three-lane-shaped. A real program against a real\nserver just calls the two in a row.\n\nEntropy is the CALLER'S: `begin` takes the 32-byte ClientHello\nrandom and the 32-byte X25519 private scalar as arguments (no\nentropy source exists in std — the rand/os_random D-question lives\nwith the crypto ladder, and deterministic tests are the point).\n\n## Rows (each battery refusal is a NAMED tag, never a hang)\n\nTransport: `closed`, `timeout` (arm `net.set_deadline` on the socket\nBEFORE `begin` — a deadline is per-fd host state and survives the\nhandoff; this module arms none itself), `io`. Record layer:\n`bad_record_mac` (a tampered/forged record — AEAD reject, zero\nplaintext exposed), `decode_error` (malformed framing/messages).\nNegotiation: `illegal_parameter` (wrong version/compression/group\nshapes), `downgrade` (the §4.1.3 sentinel randoms, or a ServerHello\nwhose supported_versions is absent or not 0x0304 — TLS 1.2 shapes\nrefuse by THIS name), `handshake_failure` (the suite is not 0x1303,\nor the peer alerted mid-handshake), `unexpected_message` (§4.1\nflow violations — reordered/duplicated/illegal flights, via sc21's\n`hs_step`). Keys: `zero` (the all-zero X25519 shared secret, sc18's\nrow, RFC 8446 §7.4.2). Identity: `cert.validate_path`'s twelve rows\nverbatim (`der`, `unsupported_alg`, `bad_signature`, `expired`,\n`not_yet_valid`, `name_mismatch`, `not_ca`, `issuer_mismatch`,\n`unknown_critical`, and since sc79 `weak_key`, `bad_usage`,\n`name_constraints`) plus `bad_signature`/`unsupported_alg`/`weak_key`\nagain from CertificateVerify, and `decrypt_error` (a wrong Finished,\n§4.4.4 — sc21's tag). Application data: `invalid` on `write` for a\nnon-byte element (the net byte tier's tag, §14).\n\n## Naming the row (sc31, wolf-std#3 — the first consumer's ask)\n\nTwenty named rows are twenty ACTIONS for a caller that routes on\nthem, and twenty ARMS for a caller that only wants to say which one\nkilled the handshake. lobo's proxy and ACME doors wanted the\nsecond, and paid twice: the full `else |e| match e { … }` written\nout at both call sites (module dependency law forbids sharing it),\nand a DEAD `Client` forged in every arm, because a\n`Client`-yielding handler's arms must produce a `Client`. Neither\ncost is the row vocabulary's fault and neither had to be the\ncaller's.\n\n`named` and `row_name` at the bottom of this module are the answer,\nand they are ONE match with two faces. `named` coarsens this\nmodule's whole vocabulary into the single payload-carrying tag\n`Row(str)` whose payload is the refusing row's own NAME: the value\nrides through untouched on success, so nothing is ever forged, and\na consumer writes one arm. `row_name` is the marking face — the\nword, or `\"ok\"` — for a caller that wants to print rather than\ncontinue. API-CONVENTIONS §12 is what licenses the shape:\ncoarsening is a NAMED call the caller writes (`errors.coarsen` is\nthe exemplar), never something a std signature does silently, and\nwhat the caller gives up is visible in its own source.\n\n**The call-site spelling is BIND, THEN NAME**, and it is a measured\nlane fact, not taste: the checked tier refuses a raising call\npassed straight into a row-typed parameter — \"control flow in an\nargument\" at `mem` — while lupin and the native rung both run it.\nThat is the same limit `std.option`'s six helpers have worn since\nsc06 (`tests/option/or_else_default.lu` is `wolfc = unsupported`\nfor exactly this), so\n\n```text\n    let judged = client.check_negotiation(view)   // bind first\n    let word = client.row_name(judged)            // then name\n```\n\nkeeps every naming site three-lane, where `row_name(check_negotiation(view))`\nwould cost the checked lane. Probed on all three lanes before a\nline of this was written.\n\n## Lanes (re-measured at the sc31 pin; the sc29 note is superseded)\n\nThe socket-bearing functions (`begin`/`complete`/`read`/`write`/\n`close`) ride `net.read_bytes`/`net.write_bytes`, and ALL THREE\nlanes reach them now: sc29 wrote this paragraph while lupin 0.1.18\ncould not resolve the byte tier (F-0102) and every loopback\nwitness's lupin column was an honest `unsupported`; **0.1.19 paid\nF-0102 and the flagship RAN** — the full in-process handshake\n(client + server halves: four X25519 ladders, Ed25519 sign +\nverifies, the AEAD flight) evaluates INSIDE lupin's 50M step\nbudget. The one dark lane is wolfc's checked tier, whose step\nbudget the same program measurably exhausts. The pure half — the\nflight parsers, the negotiation checks,\n`verify_certificate_verify`, the naming pair below, the constants —\nruns on all three lanes (lupin resolves lazily, the sc10 pure-half\ndiscipline), and the RFC 8448 client-perspective vector test is\nthree-lane. The ledger records the measured verdict per file, the\nsc25 per-rig honesty.\n\n**A handshake costs SECONDS, not milliseconds, at unoptimized\ntiers** — the lane note wolf-std#3 asked for, after the first\nconsumer measured what this header had left to assumption. lobo's\nwsm04 doors measured ONE full client handshake against an OpenSSL\nserver half at **~3.6s** on an M-series host at the NATIVE tier\nwith `WOLF_MIDEND=0` (wolf-lang#146 keeps the mid-end off its\nrelease builds): four X25519 ladders plus the Ed25519 verifies\ndominate, and none of it is I/O. This repo's own in-process\nflagship — which is TWO halves in one program — measures 18.9s\nunder lupin, idle. A consumer arming a sub-5s deadline around a\ndial is therefore on a knife edge: lobo widened its ACME\ntransaction deadline from 5s to 15s and said why. Measure the rig\nyou deploy on; do not assume milliseconds because the thing is a\nnetwork protocol.\n\n## Why `Client` holds an `int` fd and not a `net.Socket`\n\nF-0092: the native rung refuses `f(mut param.field)` — a `mut` field\npath whose base is itself a `mut` parameter — so `net.read_bytes(mut\nc.sock, …)` inside `read(mut c: Client)` would cost the native lane.\nThe portable spelling: hold the descriptor (an `int` field read is a\ncopy), rebuild the one-field `net.Socket` wrapper at each call (a\ndocumented-legal construction, the sc08 forge rule), and let\n`close(take c)` consume the `Client` so staleness stays a static\nuse-after-move exactly as the facade's own closers arrange.\n\n## ct: (D53's retrofit clause)\n\nEverything this module PARSES is public wire material (the server\nflight, certificates, signatures — the sc18 verify-is-public rule);\nbranches on it protect no secret. The key schedule, Finished and\nthe record AEAD carry SECRETS through sc20/sc21/sc16/sc18's own\n`ct:` lines; this module adds no secret-dependent branch of its own\n— the Finished compare is sc21's `ct_eq`\n(accumulate-then-single-check), and the traffic keys live in\n`Client` fields this pin cannot make private (a forged `Client` is\nordinary code; every consumer answers rows, never traps). The\n0..255 ingestion guards are the ladder's recorded ct exception\n(F-0035).",
      "summary": "std.x.tls.client — the TLS 1.3 CLIENT (RFC 8446, one profile) over the library's own proven halves.",
      "items": [
        {
          "name": "suite_chacha20_sha256",
          "kind": "fn",
          "signature": "pub fn suite_chacha20_sha256() -> int",
          "doc": "TLS_CHACHA20_POLY1305_SHA256 (0x1303) — the ONE cipher suite this\nprofile offers and accepts (RFC 8446 §9.1 MTI; the suite sc17/sc20\nbuilt). ct: public.\n\n```wolf-doc-example\nclient.suite_chacha20_sha256() == 4867\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 231,
          "tier": "x"
        },
        {
          "name": "scheme_ed25519",
          "kind": "fn",
          "signature": "pub fn scheme_ed25519() -> int",
          "doc": "SignatureScheme ed25519 (0x0807) — first-class: CertificateVerify\nVERIFIES under it (sc18's verifier). ct: public.\n\n```wolf-doc-example\nclient.scheme_ed25519() == 2055\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 241,
          "tier": "x"
        },
        {
          "name": "scheme_ecdsa_p256_sha256",
          "kind": "fn",
          "signature": "pub fn scheme_ecdsa_p256_sha256() -> int",
          "doc": "SignatureScheme ecdsa_secp256r1_sha256 (0x0403) — verifies via\nsc23's `p256.verify_der` (the sc21 \"verify nothing\" posture retired\nfor this scheme too). ct: public.\n\n```wolf-doc-example\nclient.scheme_ecdsa_p256_sha256() == 1027\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 252,
          "tier": "x"
        },
        {
          "name": "scheme_ecdsa_p384_sha384",
          "kind": "fn",
          "signature": "pub fn scheme_ecdsa_p384_sha384() -> int",
          "doc": "SignatureScheme ecdsa_secp384r1_sha384 (0x0503) — verifies via\nsc79's `p384.verify_der` against a P-384 leaf key. ct: public.\n\n```wolf-doc-example\nclient.scheme_ecdsa_p384_sha384() == 1283\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 262,
          "tier": "x"
        },
        {
          "name": "scheme_rsa_pss_sha256",
          "kind": "fn",
          "signature": "pub fn scheme_rsa_pss_sha256() -> int",
          "doc": "SignatureScheme rsa_pss_rsae_sha256 (0x0804) — RFC 8446 §9.1's MTI\nRSA scheme; verifies since sc79 via `rsa.verify_pss` (SHA-256, MGF1\nover SHA-256, a 32-byte salt) against an rsaEncryption leaf key.\nct: public.\n\n```wolf-doc-example\nclient.scheme_rsa_pss_sha256() == 2052\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 274,
          "tier": "x"
        },
        {
          "name": "scheme_rsa_pss_sha384",
          "kind": "fn",
          "signature": "pub fn scheme_rsa_pss_sha384() -> int",
          "doc": "SignatureScheme rsa_pss_rsae_sha384 (0x0805) — `rsa.verify_pss`\nwith SHA-384 and a 48-byte salt. ct: public.\n\n```wolf-doc-example\nclient.scheme_rsa_pss_sha384() == 2053\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 284,
          "tier": "x"
        },
        {
          "name": "scheme_rsa_pss_sha512",
          "kind": "fn",
          "signature": "pub fn scheme_rsa_pss_sha512() -> int",
          "doc": "SignatureScheme rsa_pss_rsae_sha512 (0x0806) — `rsa.verify_pss`\nwith SHA-512 and a 64-byte salt. ct: public.\n\n```wolf-doc-example\nclient.scheme_rsa_pss_sha512() == 2054\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 294,
          "tier": "x"
        },
        {
          "name": "signature_schemes",
          "kind": "fn",
          "signature": "pub fn signature_schemes() -> List[int]",
          "doc": "The signature_algorithms this client offers (RFC 8446 §4.2.3), in\npreference order: ed25519, ecdsa_secp256r1_sha256,\necdsa_secp384r1_sha384, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384,\nrsa_pss_rsae_sha512 — every scheme `verify_certificate_verify` can\njudge, and nothing else (rsa_pss_pss_*, rsa_pkcs1_* and the SHA-1\nschemes are not offered). The list also governs the certificate\nsignatures (no signature_algorithms_cert is sent, §4.2.3), and\n`cert.validate_path` additionally accepts sha256/384/512WithRSA\ncertificate signatures, which a server may present regardless\n(§4.4.2.2). ct: public.\n\n```wolf-doc-example\nlet offered = client.signature_schemes()\noffered.len == 6\noffered[0] == client.scheme_ed25519()\noffered[5] == client.scheme_rsa_pss_sha512()\n```",
          "source": "std/x/tls/client/client.lu",
          "line": 315,
          "tier": "x"
        },
        {
          "name": "ServerHelloView",
          "kind": "struct",
          "signature": "pub struct ServerHelloView { legacy_version: int, random: List[byte], session_echo: List[byte], cipher_suite: int, compression: int, selected_version: int, key_share_group: int, server_share: List[byte], hello_retry: bool, }",
          "doc": "A parsed ServerHello — the fields the client judges. `server_share`\nis the raw key_exchange bytes of the (single) key_share entry;\n`selected_version`/`key_share_group` are -1 when their extensions\nare absent; `hello_retry` is the §4.1.3 HelloRetryRequest sentinel\nrandom. ct: public wire material.",
          "source": "std/x/tls/client/client.lu",
          "line": 426,
          "tier": "x"
        },
        {
          "name": "parse_server_hello",
          "kind": "fn",
          "signature": "pub fn parse_server_hello(msg: List[byte]) -> ServerHelloView ! {decode_error}",
          "doc": "Parse a complete ServerHello wire message (4-byte handshake header\nincluded) into its view (§4.1.3). STRUCTURE only — trailing bytes,\ntruncation, a vector that overruns its container are each\n`decode_error`; whether the fields are ACCEPTABLE is\n`check_negotiation`'s question. Unknown extensions are skipped (a\nclient MUST ignore unrecognized extensions).\nct: public wire material.\n\nExample: prose — a fenced example cannot carry a realistic\nServerHello under §4's one-module rule;\n`tests/x/tls/client/rfc8448_parse_vectors.lu` parses RFC 8448's own\nServerHello and asserts every extracted field byte-for-byte.",
          "source": "std/x/tls/client/client.lu",
          "line": 507,
          "tier": "x"
        },
        {
          "name": "check_negotiation",
          "kind": "fn",
          "signature": "pub fn check_negotiation(v: ServerHelloView) -> int ! { downgrade, handshake_failure, illegal_parameter, unexpected_message, }",
          "doc": "Judge a parsed ServerHello against THIS profile (§4.1.3's checks,\neach a named refusal): `downgrade` — the sentinel randoms, an\nabsent supported_versions, or a selected_version that is not\n0x0304 (a TLS 1.2-shaped answer refuses by THIS name, RFC 8446\n§4.1.3's downgrade protection); `unexpected_message` — the\nHelloRetryRequest sentinel (one key share is offered, a second\nflight is outside the profile); `illegal_parameter` — a\nlegacy_version that is not 0x0303, a nonzero compression method, a\nkey_share group that is not x25519(29) or a share that is not 32\nbytes; `handshake_failure` — a cipher suite other than 0x1303.\nAnswers the negotiated suite (public data in, public data out).\nct: public.",
          "source": "std/x/tls/client/client.lu",
          "line": 592,
          "tier": "x"
        },
        {
          "name": "check_encrypted_extensions",
          "kind": "fn",
          "signature": "pub fn check_encrypted_extensions(msg: List[byte]) -> int ! {decode_error}",
          "doc": "Validate an EncryptedExtensions wire message's structure (§4.3.1):\nheader, one uint16-prefixed extensions vector filling the body,\neach extension well-formed. Contents are not judged (nothing in\nthis profile turns on them). ct: public.",
          "source": "std/x/tls/client/client.lu",
          "line": 632,
          "tier": "x"
        },
        {
          "name": "certificate_chain_of",
          "kind": "fn",
          "signature": "pub fn certificate_chain_of(msg: List[byte]) -> List[byte] ! {decode_error}",
          "doc": "The peer's certificate chain out of a Certificate wire message\n(§4.4.2): the CertificateEntry `cert_data` blobs CONCATENATED, leaf\nfirst — exactly `cert.validate_chain`'s `chain` currency. Per-entry\nextensions are skipped; an empty certificate_list is `decode_error`\n(a server must certify itself). ct: public.\n\nExample: prose (§4's one-module rule) —\n`tests/x/tls/client/rfc8448_parse_vectors.lu` extracts RFC 8448's\n432-octet certificate and asserts the bytes verbatim.",
          "source": "std/x/tls/client/client.lu",
          "line": 670,
          "tier": "x"
        },
        {
          "name": "CertVerifyView",
          "kind": "struct",
          "signature": "pub struct CertVerifyView { scheme: int, sig: List[byte], }",
          "doc": "A parsed CertificateVerify: the SignatureScheme and the raw\nsignature bytes. ct: public wire material.",
          "source": "std/x/tls/client/client.lu",
          "line": 711,
          "tier": "x"
        },
        {
          "name": "certificate_verify_of",
          "kind": "fn",
          "signature": "pub fn certificate_verify_of(msg: List[byte]) -> CertVerifyView ! {decode_error}",
          "doc": "Parse a CertificateVerify wire message (§4.4.3): scheme (uint16) +\nuint16-prefixed signature filling the body. ct: public.",
          "source": "std/x/tls/client/client.lu",
          "line": 718,
          "tier": "x"
        },
        {
          "name": "finished_of",
          "kind": "fn",
          "signature": "pub fn finished_of(msg: List[byte]) -> List[byte] ! {decode_error}",
          "doc": "The verify_data out of a Finished wire message (§4.4.4): the body,\nwhich for this profile's SHA-256 must be exactly 32 bytes.\nct: public (the MAC is wire material; judging it is\n`handshake.accept_finished`'s job).",
          "source": "std/x/tls/client/client.lu",
          "line": 742,
          "tier": "x"
        },
        {
          "name": "verify_certificate_verify",
          "kind": "fn",
          "signature": "pub fn verify_certificate_verify( spki_alg: str, spki_key: List[byte], scheme: int, sig: List[byte], transcript_hash: List[byte], ) -> int ! {unsupported_alg, bad_signature, weak_key}",
          "doc": "Verify a server CertificateVerify signature (§4.4.3) against the\nvalidated leaf's SPKI: `spki_alg`/`spki_key` are the leaf's\n(`cert.Cert`'s fields), `transcript_hash` is the running hash\nTHROUGH Certificate (CertificateVerify itself excluded), `scheme`/\n`sig` are the wire message's. The signed content is sc21's §4.4.3\noctets (64 spaces + \"TLS 1.3, server CertificateVerify\" + 0x00 +\nthe hash), built here via `handshake.certificate_verify_content`.\n\nDispatch, each answer named (RFC 8446 §4.2.3 binds each scheme to\nits key type, and for ECDSA to its curve):\n**ed25519 (0x0807)** — an Ed25519 key, sc18's `curve25519.verify`;\n**ecdsa_secp256r1_sha256 (0x0403)** — an EC key, sc23's\n`p256.verify_der` (a key that is not a P-256 point fails it);\n**ecdsa_secp384r1_sha384 (0x0503)** — an EC key of 97 bytes, sc79's\n`p384.verify_der`; **rsa_pss_rsae_sha256/384/512 (0x0804..0x0806)**\n— an rsaEncryption key, sc79's `rsa.verify_pss` with MGF1 over the\nsame hash and a salt of the digest's length. The signature is the\nwire's bytes verbatim (DER for ECDSA). A recognized scheme over the\nWRONG key type, a malformed RSA key, or a failed verification is\n`bad_signature` (that key cannot have produced it); an RSA key the\nrsa module's policy refuses as weak (a modulus under 2048 bits, a bad\nexponent) is `weak_key`; a modulus over 4096 bits and every\nunrecognized scheme (rsa_pss_pss_*, rsa_pkcs1_*, SHA-1, ed448) are\nthe named `unsupported_alg` — never a silent accept. Answers 1 on\nsuccess so the miss is a row, not a bool a caller can forget (§2).\n\nct: public data throughout (a signature, a public key and a\ntranscript hash are wire material — the sc18 verify-is-public\nrule). The ECDSA paths are native-only by their verifiers' lane\nnotes; the Ed25519 path is three-lane.",
          "source": "std/x/tls/client/client.lu",
          "line": 794,
          "tier": "x"
        },
        {
          "name": "Pending",
          "kind": "struct",
          "signature": "pub struct Pending { fd: int, scalar: List[byte], hostname: str, anchors: List[byte], now: int, transcript: List[byte], }",
          "doc": "The state between `begin` and `complete`: the ClientHello is on the\nwire, nothing has been read. This pin has no private fields; the\nscalar it carries is exactly as secret as the caller's own copy.",
          "source": "std/x/tls/client/client.lu",
          "line": 966,
          "tier": "x"
        },
        {
          "name": "begin",
          "kind": "fn",
          "signature": "pub fn begin( take sock: net.Socket, hostname: str, anchors: List[byte], now: int, client_random: List[byte], key_seed: List[byte], ) -> Pending ! {closed, io}",
          "doc": "PHASE ONE: take ownership of a connected socket (the CALLER dialed\n— `net.connect` is the caller's line), build and send the\nClientHello, return without reading.\n\n`hostname` rides SNI and is the name the chain must certify;\n`anchors` is the caller-supplied root store (concatenated DER, one\nor more roots — a distribution's bundle converted to DER is the\nintended input; NO OS truststore is read); `now` is the compact\n`cert.timestamp(...)` UTC time\nthe chain is judged at (supplied, never the wall clock — sc22's\ndeterminism rule). `client_random` (32 bytes) and `key_seed` (the\n32-byte X25519 private scalar) are the CALLER'S entropy; both are\ncontract arguments (a wrong length or a non-byte element traps —\nthe caller could have checked).\n\nThe ClientHello this profile sends: 0x1303 alone, SNI, groups\n[x25519], signature_algorithms `signature_schemes()` (ed25519,\necdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, rsa_pss_rsae_sha256,\nrsa_pss_rsae_sha384, rsa_pss_rsae_sha512), supported_versions\n[0x0304], one X25519 key share. Rows: the transport's (`closed`,\n`io`).\n\nTo bound the WHOLE handshake, arm `net.set_deadline` on the socket\nBEFORE calling this — the budget is per-fd host state and survives\nthe handoff; every read `complete` makes then answers `timeout`\ninstead of hanging on a stalled peer.\n\nct: the scalar is SECRET — it is stored, not branched on; the\nderivation is sc18's ladder (its ct: line holds). Everything else\nhere is public message building.",
          "source": "std/x/tls/client/client.lu",
          "line": 1005,
          "tier": "x"
        },
        {
          "name": "Client",
          "kind": "struct",
          "signature": "pub struct Client { fd: int, write_key: List[byte], write_iv: List[byte], write_seq: int, read_key: List[byte], read_iv: List[byte], read_seq: int, }",
          "doc": "An established TLS 1.3 connection: the application-traffic keys and\nsequence numbers over the caller's socket. Produced by `complete`;\nconsumed by `close`. This pin has no private fields (the header's\nct: note); a forged `Client` misbehaves as rows, never traps.",
          "source": "std/x/tls/client/client.lu",
          "line": 1045,
          "tier": "x"
        },
        {
          "name": "complete",
          "kind": "fn",
          "signature": "pub fn complete(take p: Pending) -> Client ! { closed, timeout, io, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }",
          "doc": "PHASE TWO: read the server flight, verify EVERYTHING, send the\nclient Finished, answer the established `Client`.\n\nThe flow (§4.1, driven through sc21's `hs_step` so a reordered or\nduplicated flight is the named `unexpected_message`, never a wrong\nstate): ServerHello (parsed + judged — `downgrade`,\n`handshake_failure`, `illegal_parameter`, `unexpected_message` for\na HelloRetryRequest), the key schedule's client side (sc21 over\nsc20/sc16, with sc18's X25519 — the all-zero shared secret is the\n`zero` row), then the encrypted flight opened record by record\n(sc20's `open`: a forged/tampered record is `bad_record_mac` with\nzero plaintext exposed; handshake messages may span or share\nrecords — the client reassembles): EncryptedExtensions\n(structure-checked), Certificate (chain extracted, a path built and\nvalidated by `cert.validate_path` to one of the caller's roots —\ntwelve named rejections),\nCertificateVerify (VERIFIED — see `verify_certificate_verify`),\nserver Finished (sc21's `accept_finished` — a wrong MAC is\n`decrypt_error` with nothing derived onward). Then the client\nFinished goes out under the handshake keys, the application\ntraffic secrets derive, and the `Client` is the answer.\n\nA ChangeCipherSpec record (middlebox compatibility, §5) is ignored\nwherever it appears, per the RFC. An alert mid-handshake is\n`handshake_failure` (the peer refused; its own named refusal is in\nITS log). A stalled peer is a hang unless a deadline was armed\n(`begin`'s note) — with one, every read here answers `timeout`.\n\nct: the schedule and Finished carry secrets through sc20/sc21's own\npaths; every branch here is on public wire material.",
          "source": "std/x/tls/client/client.lu",
          "line": 1085,
          "tier": "x"
        },
        {
          "name": "read",
          "kind": "fn",
          "signature": "pub fn read(mut c: Client) -> List[byte] ! { closed, timeout, bad_record_mac, decode_error, unexpected_message, io, }",
          "doc": "One record's application data, deprotected. Post-handshake\nHANDSHAKE messages (a NewSessionTicket) are skipped, per the RFC; a\nclose_notify (or any alert) answers the `closed` row — the outcome\nthat ends a read loop, exactly `net.read`'s convention.\n\nRows: `closed` (the peer finished — TLS close_notify or TCP eof),\n`timeout` (an armed deadline), `bad_record_mac` (a tampered or\nforged record — nothing exposed), `decode_error` (malformed\nframing), `unexpected_message` (a plaintext record where sealed\nones must ride), `io`. Never traps on wire data.\nct: the AEAD open carries the read key through sc20/sc17.",
          "source": "std/x/tls/client/client.lu",
          "line": 1299,
          "tier": "x"
        },
        {
          "name": "write",
          "kind": "fn",
          "signature": "pub fn write(mut c: Client, data: List[byte]) -> () ! {closed, invalid, io}",
          "doc": "Seal `data` as one application-data record and send it.\n\nRows: `invalid` — DECLARED AND UNREACHABLE FROM TYPED CODE since\nsc35. It named an element of `data` outside 0..255, checked before\nany sealing (the caller's data answers a row, §10; the byte tier's\nown tag, §14); a `List[byte]` cannot hold one, so the check is gone\nand the row stays in the vocabulary — the posture wolf-lang#231 took\nfor the two byte-write builtins, adopted verbatim (§14): the row is\nstill what an FFI caller's wrong-width list earns, and removing the\ntag would be a vocabulary change this rename is not.\n`closed`, `io` — the transport's. The record sequence advances only\non success.\nct: the seal carries the write key through sc20/sc17.",
          "source": "std/x/tls/client/client.lu",
          "line": 1361,
          "tier": "x"
        },
        {
          "name": "close",
          "kind": "fn",
          "signature": "pub fn close(take c: Client) -> () ! {io}",
          "doc": "Close the connection, consuming the `Client`: a close_notify alert\ngoes out under the write keys (best-effort — a peer that already\nvanished does not un-close the socket), then the socket closes.\n`take` for the facade's reason: every later use is a static\nuse-after-move.\n\nRows: `io` — the socket close's. Never traps.\nct: the final seal carries the write key; nothing else is secret.",
          "source": "std/x/tls/client/client.lu",
          "line": 1382,
          "tier": "x"
        },
        {
          "name": "named",
          "kind": "fn",
          "signature": "pub fn named[T]( v: T ! { closed, timeout, io, invalid, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }, ) -> T ! {Row(str)}",
          "doc": "The value of `v`, or the NAME of the row that refused it, coarsened\ninto the single payload-carrying tag `Row(str)` — ONE handler arm at\nthe consumer instead of this module's twenty-three.\n\nThis is API-CONVENTIONS §12's coarsening rule at the protocol tier,\nand `errors.coarsen` is its shape: the widening is a NAMED call the\ncaller writes, never something a std signature does silently, and\nwhat the caller gives up (the ability to branch on twenty rows) is\nvisible in its own source. What it buys is the two costs the first\nconsumer measured (wolf-std#3): the twenty-arm `else |e| match e`\nevery logger had to write, and the DEAD `Client` those arms had to\nforge because a `Client`-yielding handler must produce a `Client`.\nNeither survives here — the value rides through untouched on\nsuccess, and the failure path never needs one.\n\nThe payload is the tag's own NAME, the word this module's header\nand `docs/error-taxonomy.md` already use — `\"expired\"`,\n`\"name_mismatch\"`, `\"handshake_failure\"`. §12 forbids a payload\nthat carries a rendered SENTENCE (it would force the caller to\naccept this library's wording and make the position unrecoverable);\na row name is neither. It is the tag's identity, it is the finest\ninformation the row carries, and it is exactly the token an\noperator greps for. The names are stable: a rename here is a\nbreaking change to this surface and is spelled as one.\n\nThe parameter is the module's WHOLE vocabulary — `complete`'s\ntwenty-three rows (twenty until sc79 added `weak_key`, `bad_usage`\nand `name_constraints`) plus `write`'s `invalid` — so any raising\ncall in this module (and `cert.validate_path`'s twelve, which this\nmodule re-exports verbatim) rides in by width subtyping. `std.option`'s\n`or`/`exists` are the house shape for a row in parameter position.\n\nRows: `Row(str)` and nothing else. Total: no traps of its own.\n\nExample (prose — a row value has no literal, F-0038; the runnable\nforms are `tests/x/tls/client/row_naming.lu` and the negative\nbattery): `client.named(client.complete(take p))` is the `Client`\nwhen the handshake succeeds, and `else |Row(name)|` binds\n`\"expired\"` when the chain was.",
          "source": "std/x/tls/client/client.lu",
          "line": 1443,
          "tier": "x"
        },
        {
          "name": "row_name",
          "kind": "fn",
          "signature": "pub fn row_name[T]( v: T ! { closed, timeout, io, invalid, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }, ) -> str",
          "doc": "The NAME of the row that refused `v`, or `\"ok\"` when `v` carries a\nvalue — the marking form, for a caller that wants the WORD and not\nthe value.\n\nAnswering CONSUMES `v` exactly as `option.exists` consumes its\nargument: a caller that needs the value back reaches for `named`\ninstead of asking first and calling again. `\"ok\"` is reserved — no\nrow in this module is named `ok` — so `row_name(v) == \"ok\"` is the\nsuccess test.\n\nRows: none, and no traps. Thin over `named` by design: one match\nlives in this module and both faces read it.\n\nExample (prose, F-0038; runnable in\n`tests/x/tls/client/row_naming.lu`):\n`client.row_name(client.check_negotiation(view))` is\n`\"handshake_failure\"` for a ServerHello that selected a suite this\nprofile does not offer, and `\"ok\"` for one that negotiates.",
          "source": "std/x/tls/client/client.lu",
          "line": 1566,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.tls.handshake",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.tls.handshake — the TLS 1.3 handshake (RFC 8446 §4 + §4.4 +\n§7.1). Stability tier: x — the SECOND rung of the stdc-tls campaign\n(sprint sc21), built on sc20's record layer (the FROZEN \"given keys ->\nrecords\" seam) and the D53 crypto ladder: sc18's X25519 for the key\nexchange, sc16's SHA-256/HMAC/HKDF for the transcript hash and the key\nschedule. This module owns the MESSAGE FLOW, the TRANSCRIPT HASH, the\nfull KEY SCHEDULE (early -> handshake -> master), FINISHED, and the\nhandshake STATE MACHINE; sc20 owns the record framing beneath it. It\nis testable in isolation against RFC 8448's published trace, the\nsc16-before-everything discipline.\n\n**The nursery banner (D31).** `std.x.tls.handshake` is not\n`std.tls`: its path, names and behaviour may change or vanish in one\nsprint; no other std module may depend on it. Its reason and\ngraduation trigger live in `std/x/README.md`. It depends on THREE\nsibling residents — `std.x.tls.record` (the key-schedule primitives\nand the seam it produces keys for), `std.x.crypto.sha2` (SHA-256 +\nHMAC for the transcript and Finished) and `std.x.crypto.curve25519`\n(X25519 for the (EC)DHE shared secret) — resident-on-resident edges\nthe graduation move to `std.tls`/`std.crypto` must resolve, named in\nthe register beside record's and jose's own edges.\n\n**Built from the RFC DOCUMENTS, not ported.** RFC 8446 (August 2018)\n§4 (the handshake messages + extensions), §4.1 (the client/server\nflows), §4.4.1 (the transcript hash), §4.4.3 (the CertificateVerify\nsignature content), §4.4.4 (Finished), §7.1 (the key schedule). RFC\n8448 (January 2019) §3 (Simple 1-RTT Handshake) is the vector spine:\nevery handshake message, every intermediate transcript hash, every\nsecret, both Finished MACs — asserted byte-for-byte in\n`tests/x/tls/handshake/`.\n\n## The three byte-exact rules this module lives or dies on\n\n1. **The transcript hash is over the exact WIRE bytes of each\n   handshake message, INCLUDING the 4-byte handshake header\n   (`msg_type || uint24 length`), concatenated in order** (§4.4.1) —\n   NOT the 5-byte record header (that is sc20's layer, never hashed).\n   A single off-by-one in what is hashed and every secret downstream\n   is wrong; RFC 8448 catches it at the first Derive-Secret. This\n   module's `transcript_add`/`transcript_hash` accumulate exactly the\n   message bytes the builders emit.\n\n2. **key_share carries raw X25519 point bytes** (§4.2.8, sc18) — the\n   32-byte public key on the wire, and the (EC)DHE shared secret is\n   `curve25519.x25519(private, peer_public)`, feeding the handshake\n   extract as IKM. A wrong endianness or a non-canonical point fails\n   the trace; the all-zero shared secret is rejected (sc18's {zero}\n   row, RFC 8446 §7.4.2).\n\n3. **Finished is HMAC-SHA256(finished_key, Transcript-Hash)** (§4.4.4)\n   where `finished_key = HKDF-Expand-Label(BaseKey, \"finished\", \"\",\n   Hash.length)` (sc20's `record.finished_key`) and the transcript is\n   the running hash THROUGH the message before Finished (the server's\n   over CH..CertificateVerify, the client's over CH..server Finished).\n   The verify compares constant-time-shaped (`ct_eq`); a mismatch is\n   the caller's alert, no key material exposed.\n\n**Certificate is OPAQUE here (§4.4.2).** This sprint hashes and\ncarries the Certificate message; it does NOT parse the ASN.1/X.509\ninside (that is sc22). `certificate` frames the message structure\n(certificate_request_context + a certificate_list of opaque\nCertificateEntry cert_data) around a DER blob it never inspects.\n\n**CertificateVerify: signature content BUILT, signature NOT verified\nhere.** `certificate_verify` frames the message (SignatureScheme +\nopaque signature) and `certificate_verify_content` builds the §4.4.3\nsigned octets (64 `0x20` bytes + the context string + `0x00` +\nTranscript-Hash) so sc22 can verify. The actual signature check is\nDEFERRED to sc22: RFC 8448's trace signs with rsa_pss_rsae_sha256\n(0x0804), and no RSA-PSS (nor the P-256 ECDSA the client-auth trace\nuses) exists in the D53 crypto ladder yet — only Ed25519/X25519. So\nNOTHING about peer identity is trusted at this rung; deriving the\nright keys and verifying Finished against RFC 8448 is the deliverable.\n\n**Do not rebuild the record framing.** sc20 owns seal/open and the\nkey derivation (`record.extract`/`derive_secret`/`traffic_key`/\n`traffic_iv`/`finished_key`); this module produces the transcript\nhashes and shared secret those functions take as inputs, drives the\nflow, and hands sc20 the traffic keys. Byte sequences are\n`List[byte]` (sc35 — the 0..255 element contract is the TYPE's now,\nF-0035 discharged), the sha2/chacha20/record convention.\n\n**The ws05-consumable seam (FROZEN).** A completed handshake yields a\n`HandshakeResult`: the negotiated `cipher_suite`, the four traffic\nsecrets (client/server handshake+application), the exporter and\nresumption master secrets — the negotiated params + secrets wolf-wws\nws05 hands to sc20's record layer (`record.traffic_key`/`traffic_iv`\nturn each secret into an AEAD key/iv) to serve and consume TLS. sc21\nowns transcript hashes, the key schedule and the flow; ws05 owns the\nsocket conversation; sc20 owns the record AEAD. The seam is frozen at\nsc21; `std/x/README.md` records it. (OpenSSL s_client/s_server interop\nis ws05's differential, not built here — RFC 8448 is this oracle.)\n\n**Constant-time obligations (D53's retrofit clause).** c28's\ncompiler-enforced `#[consttime]` does not exist yet; until it does,\nevery `pub` fn carries a `ct:` line. The honest summary: the message\nserialization, the transcript hash and the state machine branch and\nindex only on PUBLIC quantities (message bytes, lengths, message\ntypes) — no secret is present. The key schedule and Finished handle\nSECRETS (the traffic secrets, the finished_key, the shared secret) and\ncarry them through sc20's `record.*`, sc16's HMAC/HKDF and sc18's\nX25519, whose own `ct:` lines hold the wrapping-not-checked posture;\nthis module adds no secret-dependent branch of its own. `ct_eq` is the\nFinished compare — accumulate-then-single-check, no early exit, a c28\ntarget (the sc17 `open`-tag discipline). The 0..255 ingestion guards\nare the recorded value-dependent branch shared with the ladder\n(F-0035's real byte type retires them).",
      "summary": "std.x.tls.handshake — the TLS 1.3 handshake (RFC 8446 §4 + §4.4 + §7.1).",
      "items": [
        {
          "name": "concat",
          "kind": "fn",
          "signature": "pub fn concat(a: List[byte], b: List[byte]) -> List[byte]",
          "doc": "`a` followed by `b` — the byte-sequence concatenation the callers and\nthe transcript build on.\nct: public structure only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 184,
          "tier": "x"
        },
        {
          "name": "hs_client_hello",
          "kind": "fn",
          "signature": "pub fn hs_client_hello() -> int",
          "doc": "HandshakeType `client_hello` (1). Zero-argument functions stand in\nfor `const`s (F-0025).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 204,
          "tier": "x"
        },
        {
          "name": "hs_server_hello",
          "kind": "fn",
          "signature": "pub fn hs_server_hello() -> int",
          "doc": "HandshakeType `server_hello` (2).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 207,
          "tier": "x"
        },
        {
          "name": "hs_encrypted_extensions",
          "kind": "fn",
          "signature": "pub fn hs_encrypted_extensions() -> int",
          "doc": "HandshakeType `encrypted_extensions` (8).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 210,
          "tier": "x"
        },
        {
          "name": "hs_certificate",
          "kind": "fn",
          "signature": "pub fn hs_certificate() -> int",
          "doc": "HandshakeType `certificate` (11).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 213,
          "tier": "x"
        },
        {
          "name": "hs_certificate_verify",
          "kind": "fn",
          "signature": "pub fn hs_certificate_verify() -> int",
          "doc": "HandshakeType `certificate_verify` (15).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 216,
          "tier": "x"
        },
        {
          "name": "hs_finished",
          "kind": "fn",
          "signature": "pub fn hs_finished() -> int",
          "doc": "HandshakeType `finished` (20).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 219,
          "tier": "x"
        },
        {
          "name": "handshake",
          "kind": "fn",
          "signature": "pub fn handshake(msg_type: int, body: List[byte]) -> List[byte]",
          "doc": "Frame a handshake message: `msg_type` byte, a big-endian `uint24`\nlength of `body`, then `body` (§4). This is the exact wire message\nthe transcript hashes (header included).\nct: public structure only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 225,
          "tier": "x"
        },
        {
          "name": "ext",
          "kind": "fn",
          "signature": "pub fn ext(extension_type: int, data: List[byte]) -> List[byte]",
          "doc": "One Extension: `extension_type` (uint16) then a uint16-length-prefixed\n`extension_data`.\nct: public structure only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 244,
          "tier": "x"
        },
        {
          "name": "ext_server_name",
          "kind": "fn",
          "signature": "pub fn ext_server_name(host: str) -> List[byte]",
          "doc": "server_name (0), a single host_name (§3 of RFC 6066): a\nServerNameList of one ServerName `{ NameType host_name(0), HostName\nopaque<1..2^16-1> }`.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 254,
          "tier": "x"
        },
        {
          "name": "ext_server_name_ack",
          "kind": "fn",
          "signature": "pub fn ext_server_name_ack() -> List[byte]",
          "doc": "server_name (0) as the server's empty acknowledgement in\nEncryptedExtensions (§4.2.10): the extension_data is empty.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 263,
          "tier": "x"
        },
        {
          "name": "ext_renegotiation_info_empty",
          "kind": "fn",
          "signature": "pub fn ext_renegotiation_info_empty() -> List[byte]",
          "doc": "renegotiation_info (0xff01) with an empty renegotiated_connection\n(RFC 5746): a single zero length byte. TLS 1.3 carries it inertly.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 269,
          "tier": "x"
        },
        {
          "name": "ext_supported_groups",
          "kind": "fn",
          "signature": "pub fn ext_supported_groups(groups: List[int]) -> List[byte]",
          "doc": "supported_groups (0x000a, §4.2.7): a NamedGroupList, each group a\nbig-endian uint16, uint16-length-prefixed.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 275,
          "tier": "x"
        },
        {
          "name": "ext_session_ticket_empty",
          "kind": "fn",
          "signature": "pub fn ext_session_ticket_empty() -> List[byte]",
          "doc": "session_ticket (0x0023, RFC 5077) with an empty ticket.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 284,
          "tier": "x"
        },
        {
          "name": "ext_key_share_client_x25519",
          "kind": "fn",
          "signature": "pub fn ext_key_share_client_x25519(pubkey: List[byte]) -> List[byte]",
          "doc": "key_share (0x0033, §4.2.8) for a ClientHello: a KeyShareClientHello =\na uint16-length-prefixed vector of one KeyShareEntry `{ NamedGroup\nx25519(0x001d), key_exchange opaque<1..2^16-1> = the 32 point bytes\n}`.\nct: the point bytes are public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 293,
          "tier": "x"
        },
        {
          "name": "ext_key_share_server_x25519",
          "kind": "fn",
          "signature": "pub fn ext_key_share_server_x25519(pubkey: List[byte]) -> List[byte]",
          "doc": "key_share (0x0033, §4.2.8) for a ServerHello: a KeyShareServerHello =\na single KeyShareEntry (NO client_shares vector wrapper).\nct: the point bytes are public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 303,
          "tier": "x"
        },
        {
          "name": "ext_supported_versions_client",
          "kind": "fn",
          "signature": "pub fn ext_supported_versions_client() -> List[byte]",
          "doc": "supported_versions (0x002b, §4.2.1) for a ClientHello: a\nuint8-length-prefixed list of ProtocolVersions, here the single\nTLS 1.3 (0x0304).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 313,
          "tier": "x"
        },
        {
          "name": "ext_supported_versions_server",
          "kind": "fn",
          "signature": "pub fn ext_supported_versions_server() -> List[byte]",
          "doc": "supported_versions (0x002b, §4.2.1) for a ServerHello: the single\nselected_version (0x0304), NOT length-prefixed.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 319,
          "tier": "x"
        },
        {
          "name": "ext_signature_algorithms",
          "kind": "fn",
          "signature": "pub fn ext_signature_algorithms(schemes: List[int]) -> List[byte]",
          "doc": "signature_algorithms (0x000d, §4.2.3): a SignatureSchemeList, each\nscheme a big-endian uint16, uint16-length-prefixed.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 325,
          "tier": "x"
        },
        {
          "name": "ext_psk_key_exchange_modes",
          "kind": "fn",
          "signature": "pub fn ext_psk_key_exchange_modes(modes: List[byte]) -> List[byte]",
          "doc": "psk_key_exchange_modes (0x002d, §4.2.9): a uint8-length-prefixed list\nof PskKeyExchangeMode bytes (0x01 = psk_dhe_ke).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 335,
          "tier": "x"
        },
        {
          "name": "ext_record_size_limit",
          "kind": "fn",
          "signature": "pub fn ext_record_size_limit(limit: int) -> List[byte]",
          "doc": "record_size_limit (0x001c, RFC 8449): a single big-endian uint16.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 340,
          "tier": "x"
        },
        {
          "name": "client_hello",
          "kind": "fn",
          "signature": "pub fn client_hello( random: List[byte], session_id: List[byte], cipher_suites: List[byte], extensions: List[byte], ) -> List[byte]",
          "doc": "ClientHello (§4.1.2): legacy_version 0x0303, a 32-byte random, an\nopaque legacy_session_id<0..32>, a CipherSuite vector<2..2^16-2>\n(raw suite bytes, uint16-length-prefixed here), the single null\nlegacy_compression_method, and the extensions vector<8..2^16-1>.\n`cipher_suites` and `extensions` are the concatenated inner bytes.\nct: every field is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 357,
          "tier": "x"
        },
        {
          "name": "server_hello",
          "kind": "fn",
          "signature": "pub fn server_hello( random: List[byte], session_id: List[byte], cipher_suite: int, extensions: List[byte], ) -> List[byte]",
          "doc": "ServerHello (§4.1.3): legacy_version 0x0303, a 32-byte random, the\nechoed opaque legacy_session_id_echo<0..32>, the selected\n`cipher_suite` (uint16), the null legacy_compression_method, and the\nextensions vector<6..2^16-1>.\nct: every field is public (the server random is not a secret).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 379,
          "tier": "x"
        },
        {
          "name": "encrypted_extensions",
          "kind": "fn",
          "signature": "pub fn encrypted_extensions(extensions: List[byte]) -> List[byte]",
          "doc": "EncryptedExtensions (§4.3.1): the extensions vector<0..2^16-1>.\n`extensions` is the concatenated inner bytes.\nct: public structure only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 399,
          "tier": "x"
        },
        {
          "name": "certificate",
          "kind": "fn",
          "signature": "pub fn certificate(context: List[byte], cert_der: List[byte]) -> List[byte]",
          "doc": "Certificate (§4.4.2) — OPAQUE cert bytes here (no ASN.1 parse): a\ncertificate_request_context<0..255> then a certificate_list<0..2^24-1>\nof one CertificateEntry `{ cert_data opaque<1..2^24-1> = the DER blob,\nextensions Extension<0..2^16-1> = empty }`. `cert_der` is carried\nverbatim and never inspected (X.509 is sc22).\nct: public structure; the DER is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 409,
          "tier": "x"
        },
        {
          "name": "certificate_verify",
          "kind": "fn",
          "signature": "pub fn certificate_verify(algorithm: int, signature: List[byte]) -> List[byte]",
          "doc": "CertificateVerify (§4.4.3): the SignatureScheme `algorithm` (uint16)\nand the opaque `signature`<0..2^16-1>. The signature is CARRIED, not\nverified here (see the module header — RSA-PSS/ECDSA verification is\nsc22); `certificate_verify_content` builds the octets it is over.\nct: public structure; the signature is public wire material.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 424,
          "tier": "x"
        },
        {
          "name": "certificate_verify_content",
          "kind": "fn",
          "signature": "pub fn certificate_verify_content(context: str, transcript_hash: List[byte]) -> List[byte]",
          "doc": "The octet string a CertificateVerify signature is computed over\n(§4.4.3): 64 `0x20` (space) octets, then the ASCII `context` string\n(\"TLS 1.3, server CertificateVerify\" or \"...client...\"), then a single\n`0x00` separator, then the Transcript-Hash up to but not including the\nCertificateVerify. Built here for sc22 to verify against a real\npublic key; this rung does NOT verify the signature.\nct: public content (transcript hash is public).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 438,
          "tier": "x"
        },
        {
          "name": "finished_message",
          "kind": "fn",
          "signature": "pub fn finished_message(verify_data: List[byte]) -> List[byte]",
          "doc": "Finished (§4.4.4): the verify_data (an HMAC-SHA256 output, 32 bytes)\nframed as a handshake message. Use `finished_verify_data` to compute\nthe verify_data.\nct: the verify_data is derived from a secret via HMAC; the framing is\npublic.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 456,
          "tier": "x"
        },
        {
          "name": "transcript_new",
          "kind": "fn",
          "signature": "pub fn transcript_new() -> List[byte]",
          "doc": "A fresh, empty transcript.\nct: no secret.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 471,
          "tier": "x"
        },
        {
          "name": "transcript_add",
          "kind": "fn",
          "signature": "pub fn transcript_add(mut acc: List[byte], msg: List[byte])",
          "doc": "Append one handshake message's exact wire bytes (header included) to\nthe running transcript, in order (§4.4.1).\nct: public message bytes only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 478,
          "tier": "x"
        },
        {
          "name": "transcript_hash",
          "kind": "fn",
          "signature": "pub fn transcript_hash(acc: List[byte]) -> List[byte]",
          "doc": "The Transcript-Hash: SHA-256 of the accumulated handshake messages\n(§4.4.1). Feeds Derive-Secret (sc20's `record.derive_secret`) and\nFinished.\nct: hashes public message bytes; the digest is public context.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 486,
          "tier": "x"
        },
        {
          "name": "ecdhe_shared",
          "kind": "fn",
          "signature": "pub fn ecdhe_shared(private: List[byte], peer_public: List[byte]) -> List[byte] ! {zero}",
          "doc": "The (EC)DHE shared secret for the handshake extract (§7.4.2): the\nX25519 of your `private` scalar against the peer's `peer_public` point\n(sc18). Both parties reach the same value; the all-zero result is\nrejected (RFC 8446 §7.4.2 / sc18's {zero} row).\nct: `private` is a secret scalar carried through curve25519's ladder\n(its `ct:` line holds the branch-free posture); the reject-on-zero is\non the public output.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 540,
          "tier": "x"
        },
        {
          "name": "early_secret",
          "kind": "fn",
          "signature": "pub fn early_secret() -> List[byte]",
          "doc": "The early secret (§7.1): HKDF-Extract(0, 0) for the no-PSK handshake —\nsalt and IKM both 32 zero bytes.\nct: carried through record/sha2 HKDF.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 549,
          "tier": "x"
        },
        {
          "name": "handshake_secret",
          "kind": "fn",
          "signature": "pub fn handshake_secret(early: List[byte], dh: List[byte]) -> List[byte]",
          "doc": "The handshake secret (§7.1): HKDF-Extract with salt\nDerive-Secret(early, \"derived\", \"\") and IKM the (EC)DHE shared secret.\n`empty_hash` is SHA-256 of the empty string, the \"derived\" context.\nct: `early`/`dh` are secret, carried through record/sha2.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 557,
          "tier": "x"
        },
        {
          "name": "master_secret",
          "kind": "fn",
          "signature": "pub fn master_secret(hs: List[byte]) -> List[byte]",
          "doc": "The master secret (§7.1): HKDF-Extract with salt\nDerive-Secret(handshake, \"derived\", \"\") and IKM 32 zero bytes.\nct: `hs` is secret, carried through record/sha2.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 565,
          "tier": "x"
        },
        {
          "name": "client_handshake_traffic",
          "kind": "fn",
          "signature": "pub fn client_handshake_traffic(hs: List[byte], th_ch_sh: List[byte]) -> List[byte]",
          "doc": "client_handshake_traffic_secret (§7.1): Derive-Secret(handshake,\n\"c hs traffic\", Transcript-Hash(ClientHello..ServerHello)).\nct: `hs` is secret; the transcript hash is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 573,
          "tier": "x"
        },
        {
          "name": "server_handshake_traffic",
          "kind": "fn",
          "signature": "pub fn server_handshake_traffic(hs: List[byte], th_ch_sh: List[byte]) -> List[byte]",
          "doc": "server_handshake_traffic_secret (§7.1): Derive-Secret(handshake,\n\"s hs traffic\", Transcript-Hash(ClientHello..ServerHello)).\nct: `hs` is secret; the transcript hash is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 580,
          "tier": "x"
        },
        {
          "name": "client_application_traffic",
          "kind": "fn",
          "signature": "pub fn client_application_traffic(master: List[byte], th_sfin: List[byte]) -> List[byte]",
          "doc": "client_application_traffic_secret_0 (§7.1): Derive-Secret(master,\n\"c ap traffic\", Transcript-Hash(ClientHello..server Finished)).\nct: `master` is secret; the transcript hash is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 587,
          "tier": "x"
        },
        {
          "name": "server_application_traffic",
          "kind": "fn",
          "signature": "pub fn server_application_traffic(master: List[byte], th_sfin: List[byte]) -> List[byte]",
          "doc": "server_application_traffic_secret_0 (§7.1): Derive-Secret(master,\n\"s ap traffic\", Transcript-Hash(ClientHello..server Finished)).\nct: `master` is secret; the transcript hash is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 594,
          "tier": "x"
        },
        {
          "name": "exporter_master",
          "kind": "fn",
          "signature": "pub fn exporter_master(master: List[byte], th_sfin: List[byte]) -> List[byte]",
          "doc": "exporter_master_secret (§7.1): Derive-Secret(master, \"exp master\",\nTranscript-Hash(ClientHello..server Finished)).\nct: `master` is secret; the transcript hash is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 601,
          "tier": "x"
        },
        {
          "name": "resumption_master",
          "kind": "fn",
          "signature": "pub fn resumption_master(master: List[byte], th_cfin: List[byte]) -> List[byte]",
          "doc": "resumption_master_secret (§7.1): Derive-Secret(master, \"res master\",\nTranscript-Hash(ClientHello..client Finished)).\nct: `master` is secret; the transcript hash is public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 608,
          "tier": "x"
        },
        {
          "name": "finished_verify_data",
          "kind": "fn",
          "signature": "pub fn finished_verify_data(base_secret: List[byte], transcript_hash: List[byte]) -> List[byte]",
          "doc": "The Finished verify_data (§4.4.4): HMAC-SHA256(finished_key,\nTranscript-Hash), where finished_key = HKDF-Expand-Label(base_secret,\n\"finished\", \"\", 32) (sc20's `record.finished_key`). `base_secret` is\nthe sender's handshake traffic secret (the server's for the server\nFinished, the client's for the client Finished). `transcript_hash` is\nthe running hash THROUGH the message before this Finished.\nct: `base_secret` is secret, carried through record/sha2 HMAC.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 623,
          "tier": "x"
        },
        {
          "name": "finished_for",
          "kind": "fn",
          "signature": "pub fn finished_for(base_secret: List[byte], transcript_hash: List[byte]) -> List[byte]",
          "doc": "The complete Finished handshake message for a sender: frame the\nverify_data computed from `base_secret` over `transcript_hash`.\nct: as `finished_verify_data`.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 631,
          "tier": "x"
        },
        {
          "name": "ct_eq",
          "kind": "fn",
          "signature": "pub fn ct_eq(a: List[byte], b: List[byte]) -> bool",
          "doc": "Constant-time-shaped byte equality (§4.4.4's compare, sc17's tag\ndiscipline): fold every position's difference into an accumulator and\ntest ONCE at the end — no early exit on the first mismatch, no\nsecret-dependent branch. Unequal lengths answer false without reading\n(a public, structural fact).\nct: THE compare — accumulate-then-single-check, a c28 verification\ntarget. Loop bound and indices are public (the 32-byte digest length);\nthe per-byte XOR touches secret-derived MAC bytes without branching.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 643,
          "tier": "x"
        },
        {
          "name": "verify_finished",
          "kind": "fn",
          "signature": "pub fn verify_finished( base_secret: List[byte], transcript_hash: List[byte], received: List[byte], ) -> bool",
          "doc": "Verify a peer's Finished (§4.4.4): recompute the expected verify_data\nfrom `base_secret` (the peer's handshake traffic secret) over\n`transcript_hash` and compare it constant-time-shaped to `received`.\nA false answer is the caller's `decrypt_error`/handshake-abort alert;\nno key material is exposed on the miss (the recompute leaks nothing the\npeer did not already send).\nct: recompute is `finished_verify_data`; compare is `ct_eq`.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 665,
          "tier": "x"
        },
        {
          "name": "accept_finished",
          "kind": "fn",
          "signature": "pub fn accept_finished( base_secret: List[byte], transcript_hash: List[byte], received: List[byte], ) -> int ! {decrypt_error}",
          "doc": "Accept a peer's Finished or raise the handshake-abort alert (§4.4.4 +\n§6.2): return 1 when the constant-time compare holds, otherwise the\n`decrypt_error` row — a wrong Finished aborts the handshake with the\nnamed alert and NO key material exposed (the recompute reveals nothing\nthe peer did not already send; nothing derived-onward is returned on\nthe miss). The state machine and the record layer continue their\nsmuggling/confusion discipline through this named reject.\nct: as `verify_finished`.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 681,
          "tier": "x"
        },
        {
          "name": "role_client",
          "kind": "fn",
          "signature": "pub fn role_client() -> int",
          "doc": "The client role (0) — sends ClientHello, then receives the server's\nflight (ServerHello, EncryptedExtensions, Certificate,\nCertificateVerify, Finished), then sends its own Finished.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 704,
          "tier": "x"
        },
        {
          "name": "role_server",
          "kind": "fn",
          "signature": "pub fn role_server() -> int",
          "doc": "The server role (1) — receives ClientHello, sends its flight, then\nreceives the client's Finished.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 708,
          "tier": "x"
        },
        {
          "name": "hs_expected",
          "kind": "fn",
          "signature": "pub fn hs_expected(role: int, stage: int) -> int",
          "doc": "The handshake message type the given `role` legally receives at\n`stage`, or -1 when the flow expects no further message (the flight is\ncomplete). §4.1's ordered flows.\nct: public role/stage only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 714,
          "tier": "x"
        },
        {
          "name": "hs_step",
          "kind": "fn",
          "signature": "pub fn hs_step(role: int, stage: int, msg_type: int) -> int ! {unexpected_message}",
          "doc": "Drive one received message through the state machine (§4.1): if\n`msg_type` is the message the flow expects next for `role` at `stage`,\nreturn the next stage; otherwise raise `unexpected_message` (§6.2) —\nthe reordered/dropped/illegal-message reject, by name. `stage` starts\nat 0 (the client after sending ClientHello / the server before\nreceiving it).\nct: branches on public message type and stage only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 735,
          "tier": "x"
        },
        {
          "name": "hs_client_flight_complete",
          "kind": "fn",
          "signature": "pub fn hs_client_flight_complete(stage: int) -> bool",
          "doc": "Whether the client has received the full server flight (its own\nFinished is next to SEND): stage 5 after ServerHello..server Finished.\nct: public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 749,
          "tier": "x"
        },
        {
          "name": "hs_server_complete",
          "kind": "fn",
          "signature": "pub fn hs_server_complete(stage: int) -> bool",
          "doc": "Whether the server has received the client's Finished — the handshake\nis complete: stage 2 after ClientHello and client Finished.\nct: public.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 756,
          "tier": "x"
        },
        {
          "name": "HandshakeResult",
          "kind": "struct",
          "signature": "pub struct HandshakeResult { cipher_suite: int, client_handshake_secret: List[byte], server_handshake_secret: List[byte], client_application_secret: List[byte], server_application_secret: List[byte], exporter_master_secret: List[byte], resumption_master_secret: List[byte], }",
          "doc": "The negotiated result of a completed handshake (the ws05 seam): the\nselected `cipher_suite`, the client/server handshake and application\ntraffic secrets, and the exporter/resumption master secrets. sc20's\n`record.traffic_key(secret, key_len)` and `record.traffic_iv(secret)`\nturn each traffic secret into the AEAD key/iv the record layer seals\nand opens under.\nct: the secrets are carried; this is a value container only.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 774,
          "tier": "x"
        },
        {
          "name": "handshake_result",
          "kind": "fn",
          "signature": "pub fn handshake_result( cipher_suite: int, client_handshake_secret: List[byte], server_handshake_secret: List[byte], client_application_secret: List[byte], server_application_secret: List[byte], exporter_master_secret: List[byte], resumption_master_secret: List[byte], ) -> HandshakeResult",
          "doc": "Build the frozen ws05 result (the constructor — a module-qualified\nstruct literal `handshake.HandshakeResult { }` does not parse across\nthe module boundary, E0201, so the seam is a function exactly as\n`sha2.new256` is). Called once a handshake completes; `cipher_suite`\nis the negotiated suite, the six secrets are this module's schedule\noutputs. ws05 hands the result to sc20's record layer.\nct: a value container; the secrets are carried, no branch on them.",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 791,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "Lowercase hex of a byte list. ct: NOT constant-time (a rendering\nconvenience for tests and vectors, never a secret-handling path).",
          "source": "std/x/tls/handshake/handshake.lu",
          "line": 819,
          "tier": "x"
        }
      ]
    },
    {
      "name": "x.tls.record",
      "group": "Nursery",
      "tier": "x",
      "doc": "std.x.tls.record — the TLS 1.3 record layer and its key-schedule\nprimitives (RFC 8446 §5 + §7.1/§7.3). Stability tier: x — the FIRST\nrung of the stdc-tls campaign (sprint sc20), the protocol the whole\nD53 crypto ladder was built for. This module is the RECORD LAYER and\nthe KEY SCHEDULE PRIMITIVES, nothing above them: no ClientHello, no\ncertificate, no state machine — the handshake (sc21) produces the\nsecrets, this rung derives keys from them and frames records under\nthem. It is testable in isolation against RFC 8448's published\ntraces, exactly the sc16-before-everything discipline.\n\n**The nursery banner (D31).** `std.x.tls.record` is not\n`std.tls`: its path, names and behaviour may change or vanish in one\nsprint; no other std module may depend on it. Its reason and\ngraduation trigger live in `std/x/README.md`. It depends on TWO\nsibling residents — `std.x.crypto.sha2` (HKDF-SHA-256, the key\nschedule) and `std.x.crypto.chacha20` (AEAD_CHACHA20_POLY1305, the\nrecord AEAD) — plus no facade at all. Those two resident-on-resident\nedges are ones the graduation move to `std.tls`/`std.crypto` must\nresolve, named in the register beside jose's own sha2/curve25519\nedges (the sc19 precedent — a resident MAY depend on a sibling\nresident, the edge is recorded, not forbidden).\n\n**Built from the RFC DOCUMENTS, not ported.** RFC 8446 (August 2018)\n§7.1 (HKDF-Expand-Label, Derive-Secret), §7.3 (traffic key\ncalculation), §5.2 (TLSCiphertext framing), §5.3 (the per-record\nnonce) and §5.4 (record padding). RFC 8448 (January 2019) §3 is the\nvector spine: the trace publishes every intermediate secret, traffic\nkey, IV and the `info` (HkdfLabel) bytes themselves — asserted\nbyte-for-byte in `tests/x/tls/record/`.\n\n## The four byte-exact rules this module lives or dies on\n\n1. **HkdfLabel is byte-exact** (§7.1). The label prefix is the six\n   bytes `\"tls13 \"` — INCLUDING the trailing space (`74 6c 73 31 33\n   20`), NOT `\"TLS 1.3, \"`. The structure is `uint16 length`, then a\n   one-byte-prefixed `opaque label = \"tls13 \" + Label`, then a\n   one-byte-prefixed `opaque context`, all big-endian. One wrong\n   length byte and every downstream key is wrong; `hkdf_label`'s\n   output is asserted against RFC 8448's published `info` dumps.\n\n2. **The nonce is IV XOR seq, right-aligned** (§5.3) — NOT `IV ||\n   seq` and NOT `seq || IV`. The 64-bit sequence number is encoded\n   big-endian and left-padded with zeros to the IV length (12), then\n   XORed with the static write IV. `record_nonce` builds exactly that\n   field; a wrong nonce fails every AEAD in RFC 8448's trace.\n\n3. **The AEAD additional-data is the record HEADER** (§5.2), not\n   empty: `opaque_type(23) || legacy_record_version(0x0303) ||\n   length`, the five bytes on the wire ahead of the ciphertext.\n   `additional_data` builds it and `seal`/`open` pass it; sealing\n   without it, or with the wrong length, fails the trace.\n\n4. **Padding removal scans from the END for the content-type**\n   (§5.4): the deprotected inner plaintext is `content ||\n   content_type || zero-padding`, and the real content-type is the\n   LAST non-zero octet. An all-zero inner has no content-type and is\n   a malformed record (§5.4's `unexpected_message`), raised as the\n   `unexpected` row.\n\n**The AEAD is ChaCha20-Poly1305, the MTI** (RFC 8446 §9.1). RFC\n8448's own records are AES-128-GCM (a rung with its own D-question,\nout of this sprint), so the key-schedule/nonce/AAD framing is\nasserted against RFC 8448 byte-for-byte and the record AEAD\nseal/open byte-match uses ChaCha20-Poly1305 fixtures derived from RFC\n8448's real traffic secrets by an independent reference (the sc17\ndiscipline; F-0094 records the AES-GCM/ChaCha reconciliation).\n\n**Byte sequences are `List[byte]` (sc35)**, the sha2/chacha20\nconvention: the 0..255 element contract (§11's interim, F-0035) is\nthe TYPE's now, so this module's `require_byte` — its recorded ct\nexception, a comparison pair on every ingested element — is deleted\nrather than left as decoration.\n\n**Error rows.** `open` raises `{tag, short, unexpected}`: a forged,\nmodified or truncated box is the DATA's failure (`tag`, sc17's\nverify-before-expose — zero plaintext leaves on this path); a record\ntoo short to hold a header, a tag and one content-type octet is\n`short`; a deprotected inner with no non-zero octet is `unexpected`\n(§5.4). Everything else is total over its documented domain; length\nmisuse is a caller-contract violation that traps\n`assert`.\n\n**The sc21-consumable seam (FROZEN).** The handshake sprint gets:\n(a) the key schedule — `extract`, `expand_label`, `derive_secret`,\n`traffic_key`, `traffic_iv`, `finished_key` — to turn its computed\nsecrets into AEAD keys; and (b) the framing — `seal`/`open` over\n`(key, iv, seq, ...)` — to protect and deprotect records. sc21\nproduces the secrets (transcript hashes over real handshake\nmessages); this module never computes a transcript, it takes the\ncontext bytes as an argument. The seam is: GIVEN keys -> sealed/\nopened records. It is frozen at sc20; `std/x/README.md` records it.\n\n**Constant-time obligations (D53's retrofit clause).** c28's\ncompiler-enforced `#[consttime]` does not exist yet; until it does,\nevery `pub` fn carries a `ct:` line. The honest summary: the key\nschedule handles SECRETS (traffic secrets, keys, IVs) and branches/\nindexes only on PUBLIC quantities (label bytes, lengths, the public\nsequence number) — the secret flows through sha2's HKDF and chacha20's\nAEAD, whose own `ct:` lines carry the wrapping-not-checked posture.\n`record_nonce` does wrapping-not-checked arithmetic on the write IV\n(a secret) with the public sequence number and is branch-free.\n`open`'s padding scan reads the DEPROTECTED length (§5.4) — a\nvalue-dependent loop bound c28 must model; it is marked below. **The\n0..255 ingestion guards were the other recorded value-dependent\nbranch, shared with sha2/chacha20, and F-0035's real byte type\nRETIRED them at sc35 — exactly as this note said it would.**",
      "summary": "std.x.tls.record — the TLS 1.3 record layer and its key-schedule primitives (RFC 8446 §5 + §7.1/§7.3).",
      "items": [
        {
          "name": "hkdf_label",
          "kind": "fn",
          "signature": "pub fn hkdf_label(length: int, label: str, context: List[byte]) -> List[byte]",
          "doc": "The `HkdfLabel` structure encoded to bytes (§7.1): `uint16 length`\nbig-endian, then the one-byte-length-prefixed `\"tls13 \" + label`,\nthen the one-byte-length-prefixed `context`. This is the exact\n`info` fed to HKDF-Expand — RFC 8448 §3 publishes it as the `info`\ndumps, asserted byte-for-byte.\nct: public structure only (label and context are public; the length\nprefixes are public) — no secret touched here.",
          "source": "std/x/tls/record/record.lu",
          "line": 164,
          "tier": "x"
        },
        {
          "name": "expand_label",
          "kind": "fn",
          "signature": "pub fn expand_label( secret: List[byte], label: str, context: List[byte], length: int, ) -> List[byte]",
          "doc": "HKDF-Expand-Label (§7.1): expand `secret` under the structured\n`HkdfLabel` to `length` bytes. The digest is SHA-256 (the\nTLS_*_SHA256 suites); `std.x.crypto.sha2.hkdf256_expand` is the\nHKDF-Expand.\nct: `secret` is the PRK, carried through sha2's HKDF (its `ct:` line\nholds the wrapping-not-checked posture); the label/context/length\nthat select `HkdfLabel` are public.",
          "source": "std/x/tls/record/record.lu",
          "line": 196,
          "tier": "x"
        },
        {
          "name": "derive_secret",
          "kind": "fn",
          "signature": "pub fn derive_secret(secret: List[byte], label: str, transcript: List[byte]) -> List[byte]",
          "doc": "Derive-Secret (§7.1): HKDF-Expand-Label with the transcript hash as\ncontext and the digest length (32) as output. `transcript` is\n`Transcript-Hash(Messages)` — this module never computes a\ntranscript (that is sc21's job over real handshake messages); the\ncaller supplies the 32-byte hash, or `sha2.sum256([])` for the empty\ntranscript the \"derived\"/\"finished\" steps use.\nct: as `expand_label` — `secret` is carried through HKDF; the\ntranscript hash is public.",
          "source": "std/x/tls/record/record.lu",
          "line": 214,
          "tier": "x"
        },
        {
          "name": "extract",
          "kind": "fn",
          "signature": "pub fn extract(salt: List[byte], ikm: List[byte]) -> List[byte]",
          "doc": "HKDF-Extract (RFC 5869 §2.2) — the key schedule's extract step, a\nthin name over sc16's HKDF so a test can build RFC 8448's whole chain\nthrough this module alone. `salt` is the previous stage's \"derived\"\nsecret (or `Hash.length` zeros for the first extract); `ikm` is the\n(EC)DHE shared secret (or zeros where there is no input keying\nmaterial).\nct: `salt`/`ikm` are secret; carried through sha2's HMAC.",
          "source": "std/x/tls/record/record.lu",
          "line": 225,
          "tier": "x"
        },
        {
          "name": "traffic_key",
          "kind": "fn",
          "signature": "pub fn traffic_key(secret: List[byte], key_len: int) -> List[byte]",
          "doc": "The `[sender]_write_key` (§7.3): expand the traffic secret under the\n`\"key\"` label to the AEAD's key length (32 for ChaCha20-Poly1305, 16\nfor AES-128-GCM — the caller states which, since it knows the suite).\nThe context is empty.\nct: `secret` is the traffic secret; carried through HKDF.",
          "source": "std/x/tls/record/record.lu",
          "line": 247,
          "tier": "x"
        },
        {
          "name": "traffic_iv",
          "kind": "fn",
          "signature": "pub fn traffic_iv(secret: List[byte]) -> List[byte]",
          "doc": "The `[sender]_write_iv` (§7.3): expand the traffic secret under the\n`\"iv\"` label to the 12-byte IV length. The context is empty.\nct: `secret` is the traffic secret; carried through HKDF.",
          "source": "std/x/tls/record/record.lu",
          "line": 254,
          "tier": "x"
        },
        {
          "name": "finished_key",
          "kind": "fn",
          "signature": "pub fn finished_key(secret: List[byte]) -> List[byte]",
          "doc": "The Finished MAC key (§4.4.4): `HKDF-Expand-Label(Secret,\n\"finished\", \"\", Hash.length)`. Not used by the record layer itself,\nbut part of the same §7.1 vocabulary and published by RFC 8448 §3, so\nthe seam carries it for sc21's Finished computation.\nct: `secret` is the traffic secret; carried through HKDF.",
          "source": "std/x/tls/record/record.lu",
          "line": 263,
          "tier": "x"
        },
        {
          "name": "record_nonce",
          "kind": "fn",
          "signature": "pub fn record_nonce(iv: List[byte], seq: int) -> List[byte]",
          "doc": "The per-record nonce (§5.3): `iv XOR pad_left(seq, iv_length)`. `iv`\nis the static `[sender]_write_iv` (12 bytes). `seq` is the record\nsequence number (0 for the first record under a key, incrementing).\nct: branch-free over the public sequence number; the wrapping XOR\ntouches the secret write IV (wrapping-not-checked, marked for c28).",
          "source": "std/x/tls/record/record.lu",
          "line": 307,
          "tier": "x"
        },
        {
          "name": "content_type_application_data",
          "kind": "fn",
          "signature": "pub fn content_type_application_data() -> int",
          "doc": "ContentType `application_data` (23) — the OUTER opaque_type of every\nTLSCiphertext (§5.2; the real content type hides inside the\nencryption). Zero-argument functions stand in for `const`s (F-0025).",
          "source": "std/x/tls/record/record.lu",
          "line": 337,
          "tier": "x"
        },
        {
          "name": "content_type_handshake",
          "kind": "fn",
          "signature": "pub fn content_type_handshake() -> int",
          "doc": "ContentType `handshake` (22) — a common INNER content type (the\nEncryptedExtensions/Certificate/Finished flight).",
          "source": "std/x/tls/record/record.lu",
          "line": 343,
          "tier": "x"
        },
        {
          "name": "content_type_alert",
          "kind": "fn",
          "signature": "pub fn content_type_alert() -> int",
          "doc": "ContentType `alert` (21) — an inner content type a record open may\nhave to surface.",
          "source": "std/x/tls/record/record.lu",
          "line": 349,
          "tier": "x"
        },
        {
          "name": "record_header",
          "kind": "fn",
          "signature": "pub fn record_header(length: int) -> List[byte]",
          "doc": "The five-byte TLSCiphertext header for an encrypted record of\n`length` bytes: `17 03 03 <length big-endian uint16>` (§5.2). The\nlegacy_record_version is 0x0303 (\"TLS 1.2\") on every 1.3 record.\nct: public lengths only.",
          "source": "std/x/tls/record/record.lu",
          "line": 357,
          "tier": "x"
        },
        {
          "name": "additional_data",
          "kind": "fn",
          "signature": "pub fn additional_data(cipher_len: int) -> List[byte]",
          "doc": "The AEAD additional-data for a record whose ciphertext (including the\n16-byte tag) is `cipher_len` bytes: the record header (§5.2). This is\nexactly `record_header(cipher_len)`, named for the role.\nct: public lengths only.",
          "source": "std/x/tls/record/record.lu",
          "line": 373,
          "tier": "x"
        },
        {
          "name": "inner_plaintext",
          "kind": "fn",
          "signature": "pub fn inner_plaintext(content: List[byte], content_type: int, pad: int) -> List[byte]",
          "doc": "The TLSInnerPlaintext (§5.2): `content || ContentType content_type ||\nzeros[pad]`. The real content type is appended after the content, and\n`pad` zero octets follow (§5.4's length hiding). `pad` may be 0.\nct: public structure; `content` is plaintext the caller owns.",
          "source": "std/x/tls/record/record.lu",
          "line": 387,
          "tier": "x"
        },
        {
          "name": "seal",
          "kind": "fn",
          "signature": "pub fn seal( key: List[byte], iv: List[byte], seq: int, content_type: int, content: List[byte], pad: int, ) -> List[byte]",
          "doc": "Seal a record (§5.2): build the TLSInnerPlaintext (`content ||\ncontent_type || pad zeros`), AEAD-seal it under the per-record nonce\nwith the record header as additional-data, and frame it as a\nTLSCiphertext (`header || ciphertext || tag`). The returned bytes are\nthe complete record on the wire. `key` is the AEAD key, `iv` the\nstatic write IV, `seq` the record sequence number.\nct: the AEAD is chacha20's (its `ct:` line carries); this function\nadds only public framing and the nonce (see `record_nonce`).",
          "source": "std/x/tls/record/record.lu",
          "line": 416,
          "tier": "x"
        },
        {
          "name": "open",
          "kind": "fn",
          "signature": "pub fn open(key: List[byte], iv: List[byte], seq: int, record: List[byte]) -> List[byte] ! { tag, short, unexpected, }",
          "doc": "Open a record (§5.2/§5.4): verify the tag BEFORE exposing any\nplaintext (sc17's discipline — a `tag` failure returns with ZERO\nplaintext), then strip the padding by scanning from the end for the\ncontent-type octet, and return the deprotected inner plaintext\n(`content || content_type`, padding removed). Use `content_of` and\n`content_type_of` on the result. `record` is the complete wire\nrecord (header included); `key`/`iv`/`seq` as for `seal`.\n\nRows: `short` — the record cannot hold a header, a tag and one\ncontent-type octet; `tag` — the AEAD rejected the box (forged,\nmodified or truncated), no plaintext exposed; `unexpected` — the\ndeprotected inner is all zeros, with no content-type octet (§5.4's\n`unexpected_message`).\nct: the tag verification is chacha20's (marked as c28's first target\nthere). The padding scan below reads the DEPROTECTED length — a\nvalue-dependent loop bound c28 must model (§5.4 notes it as a\nconstant-time hazard).",
          "source": "std/x/tls/record/record.lu",
          "line": 463,
          "tier": "x"
        },
        {
          "name": "content_type_of",
          "kind": "fn",
          "signature": "pub fn content_type_of(inner: List[byte]) -> int",
          "doc": "The inner content type recovered by `open`: the last octet of the\ndeprotected inner plaintext (§5.4).\nct: reads a public position of already-authenticated plaintext.",
          "source": "std/x/tls/record/record.lu",
          "line": 520,
          "tier": "x"
        },
        {
          "name": "content_of",
          "kind": "fn",
          "signature": "pub fn content_of(inner: List[byte]) -> List[byte]",
          "doc": "The inner content recovered by `open`: the deprotected inner\nplaintext with its trailing content-type octet removed (§5.4).\nct: reads public positions of already-authenticated plaintext.",
          "source": "std/x/tls/record/record.lu",
          "line": 529,
          "tier": "x"
        },
        {
          "name": "to_hex",
          "kind": "fn",
          "signature": "pub fn to_hex(b: List[byte]) -> str",
          "doc": "Lowercase hex of a byte list. ct: NOT constant-time (a rendering\nconvenience for tests and vectors, never a secret-handling path).",
          "source": "std/x/tls/record/record.lu",
          "line": 551,
          "tier": "x"
        }
      ]
    }
  ]
}
