Expand description
Standard library builtins for the Harn VM.
Every builtin is declared with the #[harn_builtin] proc-macro
(crate::stdlib::macros::harn_builtin). Each annotation emits a sibling
static <FN>_DEF: VmBuiltinDef carrying the signature, aliases, handler,
and metadata, and registers it into the workspace-global
macros::ALL_BUILTIN_DEFS distributed slice at link time. The CLI / LSP /
lint / serve / dap binaries call force_link to defeat rlib dead-code
stripping (linkme issue #36) so every static lands in the slice. Modules
still expose a register_<module>_builtins(vm) helper for ordered eager
registration (e.g. so clock::timestamp can override process::timestamp).
register_vm_stdlib calls those helpers in order and then installs the
aggregated signatures into the parser registry.
See CONTRIBUTING.md (“Adding a stdlib builtin”) for the full template.
Modules§
- agent_
state - asset_
paths - Re-export of
harn_modules::asset_pathsplus a VM-side convenience that anchors the project-root walk at the currently-executing source file (viaVM_SOURCE_DIR) and falls back to the existing source-relative resolver when the path is not an@-prefixed asset reference. - host
- http_
response - HTTP response codec primitives for
.harnHTTP handlers. - long_
running - macros
- Support module referenced by
#[harn_builtin]-emitted code. - process
- secret_
scan - template
- Prompt-template engine for
.harn.promptassets and therender/render_promptbuiltins. - token_
redaction std/oauth/redaction(OA-06) — OAuth token redaction stdlib.- tracing
- workflow_
messages
Structs§
- Harness
Builtin Migration - Complete migration recipe for a removed ambient builtin.
Enums§
- Harness
Builtin Argument Migration - How an ambient builtin’s arguments map onto its typed Harness replacement.
Functions§
- all_
builtin_ defs - Aggregate of every
#[harn_builtin]-emittedVmBuiltinDefin the stdlib. - all_
builtin_ manifest - Driver-facing immutable manifest for parser, IR, policy, and docs.
- builtin_
for_ harness_ path - Resolve the registry name behind a public
harness.<capability>.<method>path. - builtin_
manifest_ entry - Resolve a source/runtime builtin contract without rescanning the manifest.
- capability_
method_ manifest_ entry - Resolve the contract for one typed Harness method without allocation.
- force_
link - Force-link entry point: a
pub fnthat touchesALL_BUILTIN_DEFSso the linker keeps every#[harn_builtin]-emitted static. Drivers (harn-cli,harn-lsp, etc.) call this once at startup. Doing nothing at runtime is fine — the side effect is purely a link-time signal. - harness_
method_ for_ builtin - Resolve the typed Harness method that replaced an ambient builtin name.
- harness_
migration_ for_ builtin - Resolve an ambient builtin to its canonical typed Harness call shape.
- install_
shared_ pool_ registry - Install the process-lifetime shared pool registry. Idempotent: calling it more than once is harmless (subsequent calls are no-ops and keep the first registry). Intended to be called once by a long-lived server embedder at startup, before serving requests.
- recorded_
effect_ builtin_ manifest_ entry - Resolve only builtin contracts that can emit runtime effect receipts.
- register_
agent_ stdlib - Register agent builtins (requires network access and async runtime).
- register_
all_ macro_ builtins - Register every
#[harn_builtin]-emitted def on the given VM. Drivers that build the full stdlib viaregister_vm_stdlibget this for free — each module’sregister_*_builtinswalks itsMODULE_BUILTINSslice. This helper is exposed for embedders / tests that want a one-call entry. - register_
core_ stdlib - Register core builtins: pure/deterministic, no I/O.
- register_
io_ stdlib - Register I/O builtins (requires OS access).
- register_
vm_ stdlib - Register all standard builtins on a VM (core + io + agent). Also installs the macro-emitted signature slice into the parser registry (idempotent under repeat calls with the same slice pointer).
- reset_
stdlib_ state - Reset thread-local stdlib state. Call between test runs.
- stdlib_
builtin_ metadata - Return discoverable metadata for registered stdlib builtins.
- stdlib_
builtin_ names - Return the canonical list of all stdlib builtin names. Used by harn-lint and harn-lsp to avoid hardcoded duplicate lists.