Skip to main content

Module natives

Module natives 

Source
Expand description

Canonical host-fn registry for the 32 server commands.

Each domain owns a submodule that mirrors the server::command::* shape and holds one file per server command. Commands register their host fn through a per-domain register entry point; the top-level register_all aggregates every domain so a wasmtime [Linker] gains the full canonical surface in one call.

Subsequent commits fill each domain. This commit lays down the directory shape so per-command commits stay focused on one server command at a time.

Modules§

account
Account-domain natives. Wraps server::command::{CreateAccount, ListAccounts, ListAccountsForManage, GetAccountForManage, SetAccountTag, GetAccount, GetAccountCommodities, GetBalance, GetBalances, MergeAccounts} as nomiscript-callable host fns.
catch_each
(catch-each items var body) host native — Tier 2’s iteration- bounded error recovery (ADR-0025).
chart
report-chart-render: the chart of a report form’s values, behind the report-chart prelude function that gives it keyword arguments.
commodity
Commodity-domain natives. Wraps server::command::{GetCommodity, CreateCommodity, ListCommodities}.
config
Config-domain natives. Wraps server::command::{GetConfig, GetVersion, GetBuildDate, SetConfig}.
date
format-date: an RFC 3339 instant printed in the user’s zone.
env_io
Host output channel for the eval-mode module.
forms
The s-expression adapters of the client forms: payload decoding, the native encoders and registration over crate::forms.
meta
Diagnostic / session-introspection natives.
raise
Script-raise host native: the boundary bridge for in-guest raises.
report
Report-domain natives. Wraps server::command::{ActivityReport, CategoryBreakdown}.
script_store
Script storage natives. Wraps server::command::script::{DeleteScript, RunScriptOnAccount}; not render-safe, so never linked into the render surface.
split
Split-domain natives. Wraps server::command::ListSplits.
ssh_key
SSH-key-domain natives. Wraps server::command::{ListSshKeys, RemoveSshKey, UserHasSshKey}. Keys are added through the ssh-key-add form, never a native.
tag
Tag-domain natives. Wraps server::command::tag::{DeleteTag, ListTags}; list-tags is render-safe, delete-tag is not.
template
Render-only draft natives.
template_store
Template storage natives. Wraps server::command::template::DeleteTemplate; not render-safe, so it is never linked into the render surface.
transaction
Transaction-domain natives. Wraps server::command::{CreateTransaction, ListTransactions, GetTransaction, UpdateTransaction, DeleteTransaction}.

Constants§

RENDER_NATIVE_ALLOWLIST
The only non-draft natives a template may call: read-only financial lookups, pure value conversion, and the session-user-id accessor. Every entry is verified read-only — no mutator, no config/secret reader, no auth surface. convert-commodity only reads the prices table (verified: it issues SELECT … prices …, never a write).

Functions§

all_compiler_specs
all_registered_commands
link
Aggregator: registers every domain’s host fns on linker in one call. Bound to SessionData now that meta natives consult ScriptCtx (user_id) — generic-T register fns from the empty per-domain modules still satisfy this concrete type because they don’t touch the Store data.
link_render
Links ONLY the render-safe host fns onto linker: infra, the allowlisted read fns, and the draft natives. The dual gate is FULL here — a dangerous native is blocked at both levels. First, the config, user, and ssh_key modules are never registered at all (the secret/credential/auth surface has nothing to bind to). Second, the account/commodity/report/split/tag/transaction mutators and the unlisted reads are excluded by linking each module’s register_readonly variant, which holds only allowlisted natives (pinned by a test), so those imports are never bound either. So even a hypothetical compiler-spec leak finds no linked target. env.log is bound as a silent no-op (the import must resolve, but template output is discarded).
render_compiler_specs
Compiler specs the render surface exposes: the allowlisted subset of all_compiler_specs. Filtering the single canonical registry (rather than hand-maintaining a parallel list) keeps the render surface in lock-step with the org source — a renamed native drops out automatically rather than silently mismatching the linker.