Skip to main content

Module value

Module value 

Source

Structs§

Agent
An agent: system prompt + tools + config for autonomous loops.
Conversation
A conversation: immutable history + provider config.
Env
A Sema environment: a chain of scopes with bindings.
ImageAttachment
A base64-encoded image attachment.
Lambda
A user-defined lambda.
Macro
A macro definition.
Message
A single message in a conversation.
NativeFn
Prompt
A prompt: a structured list of messages.
Record
A record: tagged product type created by define-record-type.
Thunk
A lazy promise: delay/force with memoization.
ToolDefinition
A tool definition for LLM function calling.
Value
The core Value type for all Sema data. NaN-boxed: stored as 8 bytes. Floats stored directly, everything else encoded in quiet-NaN payload space.

Enums§

Role
A message role in a conversation.
ValueView
A view of a NaN-boxed Value for pattern matching. Returned by Value::view(). Heap types hold Rc (refcount bumped).

Constants§

NAN_INT_SIGN_BIT
Sign bit within the 45-bit payload (bit 44) — for sign-extending small ints.
NAN_INT_SMALL_PATTERN
The expected upper bits for a small int value: BOX_MASK | (TAG_INT_SMALL << 45).
NAN_PAYLOAD_BITS
Number of payload bits in NaN-boxed values (45).
NAN_PAYLOAD_MASK
Public payload mask (45 bits).
NAN_TAG_MASK
Tag + box combined mask: upper 19 bits (sign + exponent + quiet + 6-bit tag).
TAG_NATIVE_FN

Functions§

compare_spurs
Compare two Spurs by their resolved string content (lexicographic).
intern
Intern a string, returning a Spur key.
interner_stats
Return interner statistics: (count, estimated_memory_bytes).
pretty_print
Pretty-print a value with line breaks and indentation when the compact representation exceeds max_width columns. Small values that fit in one line are returned in the normal compact format.
resolve
Resolve a Spur key back to a String.
with_resolved
Resolve a Spur and call f with the &str, avoiding allocation.

Type Aliases§

NativeFnInner
A native function callable from Sema.