Internal
Implementation details explicitly marked Internal by their source. They remain available to browse here, but are not intended as entry points for code written in a Field box.
20 source file(s), 156 public symbol(s), 55 of them carrying KDoc. Everything below is the documentation that lives beside the code — the same text the completion documentation panel shows in the editor. A blank summary means the declaration has no KDoc yet, not that this page dropped it.
extensions.kt
Box actions: named commands a box registers in its actions map, which resync gathers from the
box and its ancestors and sends to the UI.
An Action carries a short description, a detail line, optional HTML or JavaScript
documentation, and a target callback that receives the boxes it was invoked on. action builds
one with the callback as a trailing lambda.
src/jvmMain/kotlin/afield/app/commands/extensions.kt — read the source
Top-level functions
| Declaration | Summary |
|---|---|
fun action(desc : String = "", detail: String, docHtml: String = "", docJs: String = "", payload : (List<Box>) -> Unit) |
Builds an Action with payload as its target. |
Top-level values
| Declaration | Summary |
|---|---|
val Box.actions: MutableMap<String, Action> |
This box's actions by key; reading it marks the box for resync so the UI picks up changes. |
Action
A named command shown for a box; target runs with the boxes it was invoked on.
| Declaration | Summary |
|---|---|
val desc: String |
|
val detail: String |
|
val docHtml: String |
|
val docJs: String |
|
val target: (List<Box>) -> Unit |
FieldBrowserHosts.kt
src/jvmMain/kotlin/afield/app/server/FieldBrowserHosts.kt — read the source
binding.kt
Binds a property or one-argument function to a source of values with the < operator:
::speed < { mouseX } or ::speed < sequenceOf(1.0, 2.0, 3.0).
The callable reference must be bound to a receiver implementing BoundContext; the binding is
stored there under the callable's name, replacing any earlier one. Each BoundContext.bindNow
pulls the next value from every source, type-checks it against the property or parameter type,
and applies it only when it differs from the last value applied. A sequence that runs out removes
its binding; clear() on the reference removes it by hand.
Nothing in src/ implements BoundContext or calls bindNow yet, so this is the mechanism
without a host.
src/jvmMain/kotlin/afield/document/properties/binding.kt — read the source
Top-level functions
| Declaration | Summary |
|---|---|
fun boundReceiverForCallable(k: Any): Any? |
Binds a property or one-argument function to a source of values with the < operator: ::speed < { mouseX } or ::speed < sequenceOf(1.0, 2.0, 3.0). |
operator fun <A, B> KFunction1<A, B>.compareTo(other: Sequence<A>): Int+1 overload · also () -> A |
|
operator fun <T> KMutableProperty0<T>.compareTo(other: Sequence<T>): Int+1 overload · also () -> T |
|
fun KFunction1<*, *>.clear(): Boolean |
|
fun KMutableProperty0<*>.clear(): Boolean |
BoundContext
| Declaration | Summary |
|---|---|
val bindings: MutableMap<String, BoundBinding> |
|
val previousValues: MutableMap<String, Any?> |
|
fun bindNow() |
|
fun clearBinding(name: String): Boolean |
BoundNext
| Declaration | Summary |
|---|---|
data class Value(val value: Any?) : BoundNext |
|
object Done : BoundNext |
BoundSource
| Declaration | Summary |
|---|---|
fun next(): BoundNext |
FunctionSource
class FunctionSource(private val fn: () -> Any?) : BoundSource
| Declaration | Summary |
|---|---|
override fun next(): BoundNext |
SequenceSource
class SequenceSource(private val iterator: Iterator<Any?>) : BoundSource
| Declaration | Summary |
|---|---|
override fun next(): BoundNext |
BoundBinding
| Declaration | Summary |
|---|---|
val source: BoundSource |
|
val check: (Any?) -> Any? |
|
val apply: (Any?) -> Unit |
ManifoldNative.kt
The FFM binding to libmanifoldc that Solid and Section are built on, plus the small public enums they take.
Box code needs only ManifoldLibrary, to ask whether the native library is installed, and the
option enums BooleanOp, JoinType and FillRule; the native entry points themselves are internal.
src/jvmMain/kotlin/afield/geometry/solid/manifold/ManifoldNative.kt — read the source
Used in: Solids that cannot fail: Manifold in Field
ManifoldLibrary
Where libmanifoldc is, and what to do when it is not there.
| Declaration | Summary |
|---|---|
val fileName: String |
libmanifoldc.dylib / .so / manifoldc.dll, chosen for the platform actually running. |
val searchedPaths: List<Path> |
Every path resolvedPath tries, in order — quoted in the "not installed" error. |
val resolvedPath: Path? |
The first path that exists, or null. |
val isAvailable: Boolean |
true when Solid and Section will work. Cheap enough to branch on in a box. |
val reportedVersion: String? |
The upstream version, read off the .dylib/.so filename that the SO-versioned symlink points at — libmanifoldc.3.5.2.dylib reports 3.5.2. |
val HOW_TO_INSTALL: String |
What to tell someone who has not got it, in the package manager they are likely to have. |
fun describe(): String |
One line for a box or a smoke test to print: what was found, or why not. |
ManifoldStatus
enum class ManifoldStatus(val code: Int)
ManifoldError, the status a Solid carries when an operation could not produce a valid solid.
Constants: NO_ERROR, NON_FINITE_VERTEX, NOT_MANIFOLD, VERTEX_INDEX_OUT_OF_BOUNDS, PROPERTIES_WRONG_LENGTH, MISSING_POSITION_PROPERTIES, MERGE_VECTORS_DIFFERENT_LENGTHS, MERGE_INDEX_OUT_OF_BOUNDS, TRANSFORM_WRONG_LENGTH, RUN_INDEX_WRONG_LENGTH, FACE_ID_WRONG_LENGTH, INVALID_CONSTRUCTION, RESULT_TOO_LARGE, INVALID_TANGENTS, CANCELLED.
| Declaration | Summary |
|---|---|
val isError: Boolean |
true for everything except NO_ERROR. |
BooleanOp
enum class BooleanOp(internal val code: Int)
ManifoldOpType, the operation Solid.batchBoolean and Section.batchBoolean apply.
Constants: UNION, DIFFERENCE, INTERSECTION.
JoinType
enum class JoinType(internal val code: Int)
ManifoldJoinType — how Section.offset treats a convex corner.
Constants: SQUARE, ROUND, MITER, BEVEL.
FillRule
enum class FillRule(internal val code: Int)
ManifoldFillRule — how a set of contours decides what is inside, when they overlap or nest.
Constants: EVEN_ODD, NON_ZERO, POSITIVE, NEGATIVE.
RayHit
One intersection from Solid.raycast.
GestureReplayMain.kt
A command-line entry point that replays a recorded pen gesture through a brush and writes the painted PNG, so an agent can try a gesture without a browser.
GestureReplayMain reads a GestureReplayRequest (raw samples, or keyframe lanes in
GestureReplayLanes) and prints a GestureReplayReport as JSON.
src/jvmMain/kotlin/afield/graphics/paint/GestureReplayMain.kt — read the source
GestureReplayMain
The gesture -> brush replay for an agent, without a browser: a take (or its keyframe lanes) in a JSON file, a painted PNG out. field_backdoor.py --command 'run-jvm-main afield.graphics.paint.GestureReplayMain --arg <request.json>', or the MCP tool field_paint_gesture.
| Declaration | Summary |
|---|---|
fun main(args: Array<String>) |
|
fun run(req: GestureReplayRequest): GestureReplayReport |
GestureReplayRequest
What GestureReplayMain reads. Ranges and into as in PaintCanvas.gesture; into is [x, y, w, h].
GestureReplayLanes
Keyframe lanes as the keyframe editor stores them.
| Declaration | Summary |
|---|---|
val x: List<Keyframe>, val y: List<Keyframe> |
|
val pressure: List<Keyframe>? |
GestureReplayReport
What GestureReplayMain prints.
PaintNative.kt
The bindings to the native field-paint library: PaintLibrary finds the library file, and
the internal FFM layer under PaintCanvas calls into it.
src/jvmMain/kotlin/afield/graphics/paint/PaintNative.kt — read the source
PaintLibrary
Where native/field-paint is. Searched in order: -Dafield.paint.library, AFIELD_PAINT_LIBRARY, then build/field-paint/release in the working directory.
| Declaration | Summary |
|---|---|
val fileName: String |
|
val searchedPaths: List<Path> |
|
val resolvedPath: Path? |
Not cached: building it during a live session is picked up by the next box run. |
val isAvailable: Boolean |
|
const val HOW_TO_BUILD |
|
fun describe(): String |
OpenDlssNrDiagnostics.kt
src/jvmMain/kotlin/afield/graphics/render/neural/OpenDlssNrDiagnostics.kt — read the source
OpenDlssNrNative.kt
src/jvmMain/kotlin/afield/graphics/render/neural/OpenDlssNrNative.kt — read the source
OpenDlssNrTemporalSmoke.kt
src/jvmMain/kotlin/afield/graphics/render/neural/OpenDlssNrTemporalSmoke.kt — read the source
SyphonNative.kt
The locator and foreign-function bindings for native/field-syphon, the optional macOS library
under SyphonServer and SyphonClient.
The library is searched for in order: the afield.syphon.library system property, the
AFIELD_SYPHON_LIBRARY environment variable, then build/field-syphon in the working directory.
src/jvmMain/kotlin/afield/io/syphon/SyphonNative.kt — read the source
SyphonLibrary
Locates libfield_syphon.dylib and reports whether it is available.
| Declaration | Summary |
|---|---|
val isMac: Boolean |
|
const val fileName |
|
val searchedPaths: List<Path> |
|
val resolvedPath: Path? |
Not cached: building it during a live session is picked up by the next box run. |
val isAvailable: Boolean |
|
val probePath: Path? |
The cross-process test peer built next to the library (field_syphon_probe). |
const val HOW_TO_BUILD |
|
fun describe(): String |
FfmCeresBackend.kt
The Ceres solver backend that calls the native ken_ceres_jvm wrapper through the Java
foreign-function API (java.lang.foreign), with no JNI glue.
FfmCeresBackend loads the library, binds its ken_ceres_* entry points as downcall handles and
reports FfmCeresBackend.abiVersion; FfmCeresBackend.compile turns a seed PointCloud and a
CeresProgram into a reusable compiled solver whose input, output and prior buffers are allocated
once in a shared arena and reused across solves. CeresNativeLibrary says where the library is
expected and how to build it.
src/jvmMain/kotlin/afield/math/optimization/ceres/FfmCeresBackend.kt — read the source
FfmCeresBackend
A CeresSolverBackend backed by the native library at libraryPath, by default CeresNativeLibrary.defaultPath. Construction fails with UnsatisfiedLinkError when an expected symbol is missing, and with IllegalArgumentException when the library reports an ABI version other than the one Field needs.
| Declaration | Summary |
|---|---|
val abiVersion: String |
The ken_ceres_jvm_abi_v* string the loaded library reports. |
override fun compile(seedPoints: PointCloud, program: CeresProgram): CompiledCeresSolver |
CeresNativeLibrary
Where to find the native wrapper.
| Declaration | Summary |
|---|---|
val defaultPath: Path |
|
val HOW_TO_BUILD: String |
What to tell someone whose defaultPath is not there, in the shell they are actually in. |
PairedHeadsetInput.kt
src/jvmMain/kotlin/afield/media/browser/PairedHeadsetInput.kt — read the source
WiVRnEvdev.kt
src/jvmMain/kotlin/afield/media/browser/WiVRnEvdev.kt — read the source
WiVRnKeyboardMap.kt
src/jvmMain/kotlin/afield/media/browser/WiVRnKeyboardMap.kt — read the source
NgxNative.kt
src/jvmMain/kotlin/afield/media/reconstruction/NgxNative.kt — read the source
ReconstructionCapture.kt
src/jvmMain/kotlin/afield/media/reconstruction/ReconstructionCapture.kt — read the source
actors.kt
Typed messages between boxes: a box registers a handler with onMessage, and other code delivers
to it with send (fire-and-forget) or sendAndAwait (suspend for a reply).
Messages are queued per box and delivered on the next RunLoop frame. Handlers run as coroutines
on the RunLoop's dispatcher, so one can call MessageScope.frame to wait a frame or
MessageScope.reply to answer. A box with no handler for a payload type passes it to its
ancestors. go launches a suspendable block owned by a box, so stopping the box cancels it and
its errors appear in the box's editor.
onMessage<String> { reply(payload.length) }
go { println(thisBox.sendAndAwait<String, Int>("hello")) }
src/jvmMain/kotlin/afield/runtime/execution/actors.kt — read the source
Used in: A Terminal in a Box
Top-level functions
| Declaration | Summary |
|---|---|
inline fun <reified T : Any> Box.onMessage(noinline handler: suspend MessageScope<T>.() -> Unit) |
Register a typed, suspendable message handler on this box. |
fun <T : Any> Box.onMessage(type: KClass<T>, handler: suspend MessageScope<T>.() -> Unit) |
|
fun <T : Any> Box.send(payload: T) |
Enqueue payload for delivery to this box on the next RunLoop frame. The sender is inferred from Box.context (may be null if called outside a box execution context). |
fun Box.go(block: suspend CoroutineScope.() -> Unit) |
Launch a suspendable block on the RunLoop's Framer dispatcher, owned by this box. Stopping the box cancels the block; uncaught errors appear in the editor. |
suspend fun delay(ms: Number) |
Wait ms milliseconds inside go { } (or any coroutine) without holding the runloop. |
suspend fun <T : Any, R> Box.sendAndAwait(payload: T): SendResult<R> |
Send payload and suspend until the handler finishes (or is not found). |
Envelope
Envelope wrapping a user payload with sender/receiver metadata.
| Declaration | Summary |
|---|---|
val payload: T |
|
val from: Box? |
|
val to: Box |
|
val time: Long |
MessageScope
Receiver for suspend message handlers. Provides frame to suspend until the next RunLoop tick and reply to send a value back to a waiting sendAndAwait caller.
| Declaration | Summary |
|---|---|
val payload: T |
|
val from: Box? |
|
val to: Box |
|
val time: Long |
|
suspend fun frame() |
Suspend until the next RunLoop frame. Because the handler coroutine is dispatched on Runloop.runLoop.main (the afield.runtime.lifecycle.Framer), calling kotlinx.coroutines.yield parks it until the Framer is pumped again. |
fun reply(value: Any?) |
Provide a return value to a sendAndAwait caller. If the message was sent with plain send, this is a no-op. Can be called at most once; subsequent calls are ignored. |
SendResult
sealed class SendResult<out T>
| Declaration | Summary |
|---|---|
data class Ok<T>(val value: T?) : SendResult<T>() |
Handler ran to completion. value is whatever MessageScope.reply provided (null if reply was never called). |
data object NoHandler : SendResult<Nothing>() |
No handler was found for this message type on the target box or any of its ancestors. |
data class Error(val exception: Throwable) : SendResult<Nothing>() |
The handler threw an exception. |
inline fun <R> map(transform: (T?) -> R): SendResult<R> |
Transform the value if Ok, otherwise pass through the failure unchanged. |
fun getOrNull(): T? |
Return the value if Ok, otherwise null. |
inline fun getOrElse(default: () -> @UnsafeVariance T?): T? |
Return the value if Ok, otherwise default. |
inline fun onOk(action: (T?) -> Unit): SendResult<T> |
Run action if Ok, return this for chaining. |
inline fun onFailure(action: (SendResult<@UnsafeVariance T>) -> Unit): SendResult<T> |
Run action if not Ok, return this for chaining. |
scratch.kt
src/jvmMain/kotlin/afield/runtime/lifecycle/scratch.kt — read the source
Used in: Running code in a box, Why does this value resolve here?
Top-level values
| Declaration | Summary |
|---|---|
val Box.once |
Once
Property-delegate namespace bound to one Box; normally reached as box.once.
Onceing
Returns a lazy initializer for the generated property named by property.
| Declaration | Summary |
|---|---|
operator fun getValue(f: Once, property: KProperty<*>): (() -> T) -> T |
SourceBackedBlock.kt
A callable block that keeps the Kotlin source it was written as, and can be rebuilt from that source after it has been saved.
The sourceBlock macro makes a SourceBackedBlock holding both a live lambda and its source. A
block restored from storage has only the source and rebuilds itself by evaluating it on its box's
engine. Doing that while the same box's code is running would run that code again, so it is
refused with SourceBackedBlockSelfBoxReentry or SourceBackedBlockDuringOwnBody, each of whose
messages says where to invoke the block instead.
src/jvmMain/kotlin/afield/study/source/SourceBackedBlock.kt — read the source
Top-level functions
| Declaration | Summary |
|---|---|
fun <T> sourceBackedBlock(boxId: String, source: String): SourceBackedBlock<T> |
|
fun sourceBackedBlockBox(boxId: String): Box? |
SourceBackedBlockSelfBoxReentry
Thrown when a rehydrating SourceBackedBlock would be evaluated in a box whose body is already running — the failure that was 327 nested body runs and 355 seconds before it was guarded.
SourceBackedBlockDuringOwnBody
A saved expression asked to hydrate on its own box's engine while that box's body is running. Evaluating it there would run the body again, so it is an error, raised before anything runs twice. A SourceBackedBlock no longer raises it (it hydrates on a side engine instead); the @{...} route of rewriteKotlin still does.
SourceBackedBlock
A callable block that keeps the Kotlin source used to create it.
| Declaration | Summary |
|---|---|
val boxId: String |
|
val source: String |
|
override fun invoke(): T |
|
override fun toString(): String |
PrettyStrings.kt
src/jvmMain/kotlin/afield/ui/output/PrettyStrings.kt — read the source