Documentation
¶
Overview ¶
Package tui also owns the analysis pane.
The prompt is assembled by internal/prompt through the same path the ai subcommand uses, from the snapshot this frame was drawn with. The dashboard therefore owns only the presentation and the cancel key, and what the model reads can never drift from what the screen shows.
Package tui also owns the screen shown before the dashboard exists.
Building the dashboard means dialling Binance, which on a filtered or slow network can take tens of seconds: proxy discovery, a mirror sweep and one patient retry. That used to happen before the first frame, so a new user saw a bare prompt with at most one line of log and no way to tell waiting from hanging. The wait now happens on screen, with a spinner, the live link log and a retry key.
Package tui is the full screen dashboard. The body reuses the same renderers as the one-shot commands, so the screen and the pipe output cannot drift.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunBoot ¶ added in v0.2.0
func RunBoot(ctx context.Context, o BootOptions) error
RunBoot shows the connecting screen and hands the terminal to the dashboard once the link is up. A failed link stays on screen with a retry key; if the user quits from there the error is returned so a non-interactive caller still sees the diagnosis and a non-zero exit.
Types ¶
type AIChunk ¶ added in v0.2.0
AIChunk is one piece of a streaming answer. A non-nil Err ends the stream.
type BootOptions ¶ added in v0.2.0
type BootOptions struct {
Render render.Opts
Version string
// Connect dials the link, starts the engine and returns the dashboard
// options. It runs off the UI goroutine. note reports progress and is safe
// to call from any goroutine; every line lands in the boot log.
Connect func(ctx context.Context, note func(level, format string, args ...any)) (Options, error)
}
BootOptions configures the connecting screen.
type HistoryReader ¶
type HistoryReader interface {
Samples(market, symbol string, since, until time.Time) ([]store.Sample, error)
FundingEvents(symbol string, since, until time.Time) ([]store.FundingEvent, error)
}
HistoryReader is the slice of the store the history view needs.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the bubbletea model, exported so teatest can drive it.
type Options ¶
type Options struct {
Engine *engine.Engine
Config *config.Config
Notifier *alerts.Notifier
Evaluator *alerts.Evaluator
Render render.Opts
Version string
// Transport returns the current link label, refreshed on every frame.
Transport func() string
// Save persists the configuration after an in-app edit.
Save func() error
// Exec runs one CLI command line and returns its captured output. The ":"
// prompt uses it, which is why the help only documents one syntax.
Exec func(line string) string
// History is optional; without it the H view explains how to record data.
History HistoryReader
// AskLang shows the first-run language picker before anything else. The CLI
// sets it when the config file has no language recorded and --lang was not
// passed, which is what "first run" means in practice.
AskLang bool
// AIPresets lists the analysis presets for the A picker, reread on every
// open so a new prompt file needs no restart.
AIPresets func() []AIPreset
// AI opens a streaming analysis run. Nil disables the pane, which is what
// happens when no model is configured.
AI func(ctx context.Context, preset, symbol string) (<-chan AIChunk, error)
// ShowGuide runs the walkthrough once, right after the banner clears. The CLI
// sets it while general.guide_seen is still false.
ShowGuide bool
// SwitchMarket rebinds the data layer to another venue and persists the
// choice. It blocks on a link reprobe, so the model calls it off the update
// loop. Nil hides the M key.
SwitchMarket func(ctx context.Context, kind string) error
}
Options wires the dashboard to the engine and to the CLI, which owns config persistence and the command line evaluator.