Documentation
¶
Overview ¶
Package drafts turns malformed order-draft JSON (for example model output wrapped in code fences or using single quotes) into a strictly validated, reviewable candidate. It performs no networking, signing or persistence. A candidate is not an intent: it must still go through `orders prepare`, which produces the digest a submission is bound to.
Repair is syntax only. It is never applied to backend responses, signed actions, MCP frames, credentials, journal records or migration input.
Index ¶
Constants ¶
const ( MaxBytes = 16 << 10 MaxDepth = 4 )
Limits on draft input.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
Repaired bool `json:"repaired"`
JSON string `json:"json"`
Order Order `json:"order"`
// PrepareArgs is the equivalent `oku orders prepare` argument list. It is
// informational; nothing is prepared.
PrepareArgs []string `json:"prepare_args"`
Input map[string]any `json:"input"`
}
Candidate is the review result.
type Dec ¶
type Dec string
Dec is a decimal taken verbatim from a JSON string or number literal, never through float64.
func (*Dec) UnmarshalJSON ¶
UnmarshalJSON accepts "1.5" or 1.5 and keeps the exact text.
type Order ¶
type Order struct {
Market string `json:"market"`
Side string `json:"side"`
Type string `json:"type"`
Size Dec `json:"size"`
Price Dec `json:"price,omitempty"`
TIF string `json:"tif,omitempty"`
SlippageBps int `json:"slippage_bps,omitempty"`
ReduceOnly bool `json:"reduce_only,omitempty"`
}
Order is the strict order-draft schema. Financial values are strings so no float conversion ever happens.