Documentation Index
Fetch the complete documentation index at: https://docs.bitfield.so/llms.txt
Use this file to discover all available pages before exploring further.
Runtime Kit
Send a request.
Use sendRequestToBitfieldTarget(...) when app code needs to ask a named Bitfield target to do work.
What this is
A target is a public callable door. Your app sends a payload to the door. Runtime Kit gets the payload to the thing behind the door. Your app receives reply bytes.The mental model
Your app should not care how the work is performed. It should care about the public target name and the payload it sends.If a user clicks a search button, your app can callproduct.search. The package behind that target can change later. Your button can stay the same as long as the target contract stays the same.That is the value: app code calls the door, not the implementation behind the door.How it works technically
Send JSON-like data
Send text
Send bytes
payload is already a Uint8Array, Runtime Kit sends those bytes.Understand payload encoding
| Payload value | Public behavior |
|---|---|
Uint8Array | Sent as bytes. |
string | Encoded as text bytes. |
object, array, number, boolean, or null | Serialized as JSON bytes. |
| omitted payload | Sent as empty bytes. |
Decode the reply
The reply is always bytes because targets are not forced into one format.Uint8Array:Cancel a request
Use anAbortController when the user leaves a screen, changes a search query, or cancels work.Handle errors
Wrap user-triggered requests so the UI can recover.Before / after
| Before | After |
|---|---|
| Button imports the feature implementation directly. | Button calls a named target. |
| Replacing the feature requires rewiring app imports. | Replacing the package keeps the target name stable. |
| App code knows implementation details. | App code knows payload and reply shape. |
| AI has to understand private execution code. | AI sends a request to a public door. |
Common mistakes
Using target names as storage addressesproduct.search is a callable target name. It is not a storage path.Parsing every reply the same wayThe reply is bytes. Decode according to the target contract. Do not assume every target returns JSON unless that target says it does.Calling private implementation code directlyIf a component imports the thing behind the target, the target boundary has been bypassed.Forgetting cancellationSearch boxes, typeahead, and long tasks should use an abort signal so stale work can stop.Quick reference
Ceiling you have not hit yet
- Replace work behind a target: Keep
targetstable while swapping package implementation. - Use binary replies: Return bytes for image, audio, packed table, or model output workflows.
- Run local-first actions: Let a device ask local targets for work even when the network is not part of the path.
- Give AI a stable command surface: Let an AI agent call named targets instead of editing implementation wiring.