Skip to main content

Constructor

ModelConfig
required
AI model configuration. The agent cannot run without a provider and API key.
string
default:"http://localhost:7777"
URL of the running Rust sidecar. Change this if you’ve configured a non-default port or are connecting to a remote sidecar over a tunnel.
number
default:"10000"
HTTP request timeout in milliseconds. Does not apply to SSE streams (those reconnect automatically).
PolicyConfig
In-memory guardrails for the AI agent — tip caps, retry limits, escalation controls. All keys are optional; omitted keys fall back to built-in defaults. The constructor throws SinkerPolicyError if the policy has hard contradictions.
See the Policy reference for full documentation, validation rules, and the relationship to sinker.policy.json.
The constructor immediately opens a persistent SSE connection to /internal/events. All sinker.on() handlers receive events from this single connection.

Methods

sinker.enqueue()

Enqueue a pre-signed transaction and return a Transaction handle.
string
required
Base64-encoded wire transaction bytes. The transaction must be fully signed before enqueueing — Sinker never handles keypairs.
'normal' | 'high' | 'critical'
default:"'normal'"
Scheduling hint used by the agent when selecting which transactions to bundle first.
Returns: Promise<Transaction> Example:

sinker.enqueueBatch()

Enqueue multiple transactions in parallel. Useful for batching up to 4 txs into a single Jito bundle.
Array<{ txBytes: string; priority?: TxPriority }>
required
Array of transactions to enqueue. Each is assigned an independent tx_id.
Returns: Promise<Transaction[]>

sinker.submit()

Manually trigger a bundle submission. Normally the AI agent calls this automatically — use this only when you’re running without the agent (or in bypass mode) and need direct control over tip and timing.
number
required
Tip amount in lamports. Use sinker.getTip() to get live percentile values.
string[]
required
One or more tx_id values from pending transactions. Get them via sinker.getPending().
string
Human-readable rationale string. Written to the lifecycle entry’s ai_decision_trace.
Returns: Promise<SubmitResult>
string
Bundle identifier assigned by Jito (or a synthetic ID on error/fault).
number
Slot at which the bundle was submitted.
boolean
Present and true when the submission was intercepted by the fault injector.

sinker.getMode() / sinker.setMode()

Read or flip the agent’s decision tier at runtime — no restart. cortex reasons on every submission (the default); reflex runs the deterministic fast-path and escalates to the LLM only on exceptions. See AI Agent → Two-tier router.
Returns: Promise<ModeState>{ supervised: boolean, decision_mode: 'reflex' | 'cortex' }

sinker.getTip()

Latest tip floor percentiles from the Jito oracle (refreshed every 10 seconds).
Returns: Promise<TipFloor>

sinker.getSlot()

Current slot and the validator identity scheduled to lead it.
Returns: Promise<ChainState>

sinker.getLifecycle()

Full lifecycle log for all bundle submissions in this sidecar session.
Returns: Promise<LifecycleLog>

sinker.getPending()

Current pending transaction queue snapshot.
Returns: Promise<PendingTxQueue>

sinker.on()

Subscribe to a specific SSE event type. See Events for the full list.
Returns: this (chainable)

sinker.off()

Remove a previously registered handler.

sinker.validatePolicy()

Check the current policy for contradictions and dangerous values without throwing. Returns { errors, warnings, valid }.
Returns: PolicyValidationResult See the Policy reference for the full list of checks.

sinker.destroy()

Disconnect the SSE stream and free resources. Call this when you’re done with the instance.

Properties

sinker.model

The ModelConfig passed at construction. Read-only.

sinker.policy

The fully resolved policy — all defaults filled in. Read-only.
Type: ResolvedPolicy — all 8 fields present, no optionals.

sinker.debug

Access to the DebugClient for fault injection.