Cohere.Surface (Cohere v0.1.0)

Copy Markdown View Source

The public function surface of a module, and a stable hash over it.

A context's surface is its ontology-relevant API: the governed verbs the rest of the system (and any agent) is supposed to call. Intent cards bind to a surface hash; when the surface moves, the card is drifted until a human or agent re-reviews it.

Summary

Functions

Parses a surface line back into {function, arity} tuples.

Sorted list of {function, arity} for the module's public surface.

12-hex-char hash of a surface, stable across runs and machines.

Renders a surface as a stable, single-line string: "create/2 list/1".

Functions

from_line(line)

@spec from_line(String.t()) :: [{atom(), non_neg_integer()}]

Parses a surface line back into {function, arity} tuples.

functions(module)

@spec functions(module()) :: [{atom(), non_neg_integer()}]

Sorted list of {function, arity} for the module's public surface.

Filters compiler/framework-generated functions (__*__, child_spec/1) and — for modules declaring GenServer/Supervisor behaviours — the OTP callbacks, so the surface reflects authored API, not machinery.

hash(functions)

@spec hash([{atom(), non_neg_integer()}]) :: String.t()

12-hex-char hash of a surface, stable across runs and machines.

to_line(functions)

@spec to_line([{atom(), non_neg_integer()}]) :: String.t()

Renders a surface as a stable, single-line string: "create/2 list/1".