shell

package
v0.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package shell is the main window's frame: the header band, the feature rail, the sidebar column and the right panel beside the page, each column opening, closing and resizing with the reference's motion, and the window's shortcuts, search, activity centre and knowledge viewer.

Index

Constants

View Source
const (
	HeaderHeight = 48
	RailWidth    = 56
	NavWidth     = 240
	NavMin       = 200
	NavMax       = 320
	MainMin      = 320 // the conversation's least width
	PanelWidth   = 560
	PanelMin     = 360
)

Layout metrics.

View Source
const (
	HeaderButton = 28
	RailButton   = 36
	ButtonGap    = 8
)

The header's and the rail's icon buttons are Kit's IconButton at one size each, 8 DIPs apart. Header contributions (Hooks.PluginHeader) use HeaderButton too.

View Source
const (
	ViewZoomIn    = "view.zoom_in"
	ViewZoomOut   = "view.zoom_out"
	ViewZoomReset = "view.zoom_reset"
)

The view zoom's commands, for the window's keys and the native menu (Do).

View Source
const PrefsFile = "ui-state.json"

PrefsFile is the preferences' file name in the app's user data folder, beside MyGo's window-state.json, which keeps the window's bounds.

View Source
const WindowMinimize = "window.minimize"

WindowMinimize is the Window menu's Minimize: its key enlarges the focused conversation pane in a split, and minimizes the window anywhere else.

Variables

View Source
var CloseFocused = Shortcut{ID: "close", Label: "menu_close_tab", Mods: ui.Cmd, Key: ui.KeyW}

CloseFocused is ⌘W. The reference binds it on the panes that close, not on the window: the right panel and an independent page take it while the focus is inside them (App.pane), a split's pane leaves its split, a conversation standing alone and a Files or Git page close their shown tab first, and anywhere else it does nothing.

View Source
var Motion = ui.Animation{Duration: 180 * time.Millisecond, Ease: ui.CubicBezier(0.2, 0, 0, 1)}

Motion is the columns' open and close: Kit's duration_normal along easing_move. MyGo makes it instant with Reduce Motion.

View Source
var Shortcuts = append(window(settings.Registry),
	Shortcut{ID: "app.settings", Label: "settings", Mods: ui.Cmd, Key: ui.KeyComma},
	Shortcut{ID: "conversation.find", Label: "chat_search", Mods: ui.Cmd, Key: ui.KeyF},
	Shortcut{ID: "conversation.stop", Label: "chat_stop", Mods: ui.Cmd, Key: ui.KeyPeriod},
	Shortcut{ID: "composer.focus", Label: "chat_message_placeholder", Mods: ui.Cmd, Key: ui.KeyL},
	Shortcut{ID: "composer.models", Label: "composer_model_settings", Mods: ui.Cmd | ui.Shift, Key: ui.KeyM},
)

Shortcuts are the reference's window keys, ⌘ standing for Ctrl off macOS: the Shortcuts settings' registry, which the user may rebind (App.binding), then Settings, Find and the conversation's own keys, which are fixed: Stop, Focus the composer and the model controls act on the conversation page only, and the reference lists them in neither the Shortcuts settings nor the menu. The system's shortcuts are not the window's. The panel's resource keys follow (panel.Resources).

Functions

func Accelerator

func Accelerator(mods ui.Modifiers, key ui.Key) string

Accelerator writes a shortcut as MyGo's menus take it: CmdOrCtrl+Alt+N for ⌥⌘N, ui.Cmd being Command on macOS and Ctrl elsewhere.

func ClampNav

func ClampNav(w float32) float32

ClampNav keeps the sidebar's width in 200..320.

func ClampPanel

func ClampPanel(width, w, nav float32) float32

ClampPanel keeps the panel's width in 360 and what leaves the conversation 320.

func HeaderInsets

func HeaderInsets(bar ui.TitleBar) float32

HeaderInsets is the room the header keeps clear at the window's right edge: 12, past the window buttons MyGo reports there (Windows and Linux; none on macOS, whose lights are on the left).

func NoticeAge

func NoticeAge(d time.Duration) (key string, count int)

NoticeAge is a notice's age as the activity centre writes it: an i18n key and its count.

func NoticeHeading

func NoticeHeading(n *viewmodel.Notice, language string) string

NoticeHeading is the heading a package gave its notice, in a language, "" when it gave none: a reminder says Reminder above its own title. System notices keep the application's headings.

func PanelFits

func PanelFits(w, nav, panel float32) bool

PanelFits reports whether the right panel shows beside the main column in a window w wide: the rail, the sidebar and 320 for the conversation leave it its width. A narrow window hides it without closing it.

func SavePrefs

func SavePrefs(dir string, p Prefs) error

SavePrefs writes the preferences in dir, through a temporary file so a crash keeps the last ones.

func SortNotices

func SortNotices(list []*preview.Notice) []*preview.Notice

SortNotices orders notices newest first.

Types

type App

type App struct {
	Data    *viewmodel.Data
	Preview bool
	Hooks   Hooks

	// Theme is the selected theme package's ID; empty is the built-in one.
	Theme   string
	Mode    theme.Mode
	Effects bool // the theme's animated effects
	// Surfaces are the window materials' opacities (Appearance).
	Surfaces theme.Surfaces
	Page     Page
	// NavOpen and NavWidth are the side column's saved choice, shared by the
	// pages that have one (HasNavigation); a page without one hides the
	// column and leaves the choice as it is.
	NavOpen  bool
	NavWidth float32
	// OverviewHidden is the header button's saved choice. A narrow pane
	// uses a popover without changing the wide pane's choice.
	OverviewHidden bool
	// PluginNavigation is the resource navigation supplied by the mounted
	// package page. The Shell owns its position, width and fold toggle.
	PluginNavigation func(*ui.Context)

	// PanelOpen is whether the user wants the right panel; a narrow window
	// hides it without changing this.
	PanelOpen bool
	// PluginDetails draws the details a package page's Workspace supplies
	// to the right column, nil while the page shown offers none. They show
	// until the toggle folds them; the conversation's PanelOpen is its own.
	PluginDetails func(*ui.Context)
	// PluginDetailsHeader draws what those details give the column's
	// header segment: their title, then their own actions.
	PluginDetailsHeader func(*ui.Context)
	PluginDetailsLabel  string
	PanelWidth          float32

	// DiffSplit is the window's diff layout, side by side when set: the
	// button at the end of a diff's footer writes it (kit.DiffSplit), and
	// it is saved with the window's other choices (prefs.go).
	DiffSplit bool
	// ListShare is the share of the height a list takes above its document
	// where a conversation panel is too narrow for both side by side
	// (panel.BindListShare); 0 is the first share. The divider between them
	// writes it, and it is saved as DiffSplit is.
	ListShare float32

	// OnMode, when set, gets the theme mode as it changes, so the window's
	// native material follows the app's appearance.
	OnMode func(theme.Mode)

	Sidebar  *sidebar.State
	Settings *settings.State
	// ProviderUI is installed with the optional model channels page.
	ProviderUI ProviderUI
	Website    string
	Feedback   string
	Messages   *conversation.State

	Panel *panel.State
	// Projects keeps each project's Files and Git state, shared by their
	// pages and the panel's tabs.
	Projects *panel.Projects

	// Host is the device whose monitor HostPage shows;
	// hosts are the host pages' data, made from the dataset as first
	// shown, and their UI state. Metrics is whether the host page's right
	// column shows the metrics summary (layout.panel_open of Page::Host):
	// closed until the user opens it, as the reference's, since the page
	// itself is the monitor.
	Host string

	Metrics bool

	// Welcome is the welcome guide, opened at the first launch
	// (SetPrefs) and from the Help menu in the preview.
	Welcome onboarding.Guide
	// contains filtered or unexported fields
}

App is the window's state.

func New

func New(d *preview.Data, pages ...NativePage) *App

New makes a preview window with the supplied workspace pages.

func NewLive

func NewLive(d *viewmodel.Data, pages ...NativePage) *App

NewLive creates an unseeded live window with the supplied workspace pages.

func NewLiveWithAssembly

func NewLiveWithAssembly(d *viewmodel.Data, assembly Assembly) *App

NewLiveWithAssembly creates an unseeded live window with the supplied page contributions.

func NewWithAssembly

func NewWithAssembly(d *preview.Data, assembly Assembly) *App

NewWithAssembly makes a preview window with the supplied page contributions.

func (*App) ActiveTerminal

func (a *App) ActiveTerminal() string

ActiveTerminal is the main terminal pane the conversation page shows active, "" while a conversation's is or another page shows. Its sidebar row is the selected one, and its right panel works in the terminal's worktree, not the selected conversation's.

func (*App) AllPanelTabs

func (a *App) AllPanelTabs() []panel.Tab

AllPanelTabs are the panel tabs of every pane, the shown one's first.

func (*App) ApplyData

func (a *App) ApplyData(d *viewmodel.Data)

ApplyData replaces a Client projection on the UI thread, retaining local drafts.

func (*App) CancelTerminalClose added in v0.2.3

func (a *App) CancelTerminalClose(id string)

CancelTerminalClose clears a failed close so a later shell exit stays passive.

func (*App) CloseKnowledge

func (a *App) CloseKnowledge()

CloseKnowledge releases a restricted projection, including text held by a callback that still refers to the old page.

func (*App) ClosePage

func (a *App) ClosePage() bool

ClosePage closes the independent page shown, back to the conversation. It reports whether there was one to close.

func (*App) Closing

func (a *App) Closing() bool

Closing reports whether the close prompt shows.

func (*App) Composer

func (a *App) Composer(id string) *composer.State

Composer returns the composer of a conversation, which keeps its draft.

func (*App) ConfirmClose

func (a *App) ConfirmClose(r CloseRequest)

ConfirmClose opens the close prompt. A prompt already showing stays as it is, so repeated close requests ask once.

func (*App) ConversationActiveTab

func (a *App) ConversationActiveTab(id string) panel.Tab

ConversationActiveTab is the tab a conversation's panel shows, on screen or not.

func (*App) ConversationTabs

func (a *App) ConversationTabs(id string) []panel.Tab

ConversationTabs are a conversation's panel tabs, shown or not.

func (*App) Demo

func (a *App) Demo() bool

Demo reports whether the window shows the demo conversations.

func (*App) DemoConversation

func (a *App) DemoConversation(id string) *viewmodel.Conversation

DemoConversation is the demo's conversation of that ID, nil without the demo. Unlike Demo it also answers while the window's own stage is back on the fields: the controller's frame hooks keep what it mounted over a demo conversation (Hooks.DemoConversation) for as long as the demo has it.

func (*App) DemoOn

func (a *App) DemoOn() bool

DemoOn reports whether the demo is on. Unlike Demo it also answers while the window's own stage is back on the fields, as in the controller's frame hooks: what the user does then is still done in the demo.

func (*App) DemoReveal

func (a *App) DemoReveal(id string, index int)

DemoReveal scrolls the demo's transcript of that conversation to the turn at index; nothing without the demo. Like DemoConversation it also answers while the window's own stage is back on the fields, where a package mounted over a demo conversation asks for it.

func (*App) DemoUsage

func (a *App) DemoUsage() *preview.Usage

DemoUsage is the usage the demo counts, which the Usage page reads while the demo shows; nil without the demo. Unlike Demo it also answers while the window's own stage is back on the fields.

func (*App) Do

func (a *App) Do(id string)

Do sends a command of the native menu, a Shortcut's ID or another of the menu's (menu.go), to run in the next frame. Call it on the main thread, where menu items' Click runs, then redraw the window.

func (*App) DropComposer

func (a *App) DropComposer(id string) *composer.State

DropComposer forgets the input state of a draft that is gone and returns it, nil when there was none.

func (*App) DropPanel

func (a *App) DropPanel(id string)

DropPanel forgets a conversation's panel, as when the conversation is deleted or archived. The owner of what its tabs show closes that first.

func (*App) DropPanelTab

func (a *App) DropPanelTab(t panel.Tab)

DropPanelTab takes t out of the panel that has it, shown or not. A Node acknowledgment of an explicit terminal close can also fold its panel.

func (*App) DropWorkspaceTerminal

func (a *App) DropWorkspaceTerminal(id string)

DropWorkspaceTerminal closes only a main terminal's surface and its pane's right panel. Its running process remains in the Node's inventory and can be opened from terminal activity.

func (*App) FeaturePreferences

func (a *App) FeaturePreferences() ([]string, map[string]bool)

FeaturePreferences includes saved choices for destinations this window does not provide, so changing its rail cannot erase those preferences.

func (*App) FocusedConversation

func (a *App) FocusedConversation() string

FocusedConversation is the conversation receiving main-workspace actions, empty while a terminal or another page is focused.

func (*App) ForgetSession added in v0.2.7

func (a *App) ForgetSession(id string)

ForgetSession clears the tab, tab order entry and saved split position when the Node confirms deletion or the window discards a local draft.

func (*App) HasDraft

func (a *App) HasDraft(state *composer.State) bool

HasDraft reports whether the window currently retains the given composer state.

func (*App) HasNavigation

func (a *App) HasNavigation() bool

HasNavigation reports whether the page shown has a side column beside the rail, as the reference's feature_navigation: the sessions on the conversation and on the host and project pages opened from it, the sections on Settings. Activity, Files, Git, Market, the notification center have none. A package page can supply its own resource navigation.

func (*App) HasPanelTab

func (a *App) HasPanelTab(t panel.Tab) bool

HasPanelTab reports whether any conversation's panel has t.

func (*App) HasWorkspaceTerminal

func (a *App) HasWorkspaceTerminal(id string) bool

HasWorkspaceTerminal reports whether the main workspace owns id's surface.

func (*App) KeepWorkspaceTerminal

func (a *App) KeepWorkspaceTerminal(id string)

KeepWorkspaceTerminal keeps an open main terminal's tab, as a double click on its passing tab does.

func (*App) Menu

func (a *App) Menu(lang string, send func(id string)) []*mygo.MenuItem

Menu is the native app menu in lang: App, File, Edit, View, Window and Help, with the reference's items on the keys they have now (syncMenuKeys follows a rebound one), then the rail's features in View. The app's items send their command's ID through send, which the application passes to Do: the menu takes their keys before the window does. The system's items are MyGo's roles under the reference's labels and keys: the menu binds Close Window, Hide, Hide Others, Minimize and Full Screen on cmd (ui.Super), the rest on secondary (ui.Cmd). Minimize is the app's item on cmd: in a focused conversation its key enlarges the pane, elsewhere it minimizes the window (WindowMinimize). Save follows the focused live editor. Logs stays disabled without a live log folder (Hooks.OpenLogs). Help also opens the welcome guide.

func (*App) MountPanel

func (a *App) MountPanel()

MountPanel gives the panel to the active pane: the tabs of the one left are kept for its return, and the active one's come back, or the closed panel of a pane that never opened it. The first pane takes what the window opened before it. A terminal has one tab in the window: the one in the shown panel.

func (*App) MovePanelTab

func (a *App) MovePanelTab(t panel.Tab, id string)

MovePanelTab gives t to conversation id's panel, behind its shown tab: a tab opened for a conversation that is not on screen, as the page its agent opened.

func (*App) NativePageEnabled

func (a *App) NativePageEnabled(p Page) bool

NativePageEnabled reports whether the assembly contributed this page.

func (*App) NativePageUsage

func (a *App) NativePageUsage() protocol.FeatureUse

NativePageUsage returns the counter declared by the current native page.

func (*App) NavShown

func (a *App) NavShown() bool

NavShown reports whether the side column shows: the page has one and the user keeps it open.

func (*App) Navigate

func (a *App) Navigate(p Page)

Navigate shows an available page in the main column.

func (*App) OpenConversation added in v0.2.7

func (a *App) OpenConversation(id string)

OpenConversation opens session id as the user asked for it, from a sidebar row, a link, search, a notification or another page: it shows on the conversation page, in its split group when it is in one, and otherwise has a tab until that is closed. A selection the window falls back to when data changes is no open and adds no tab, so closing the last tab stays closed.

func (*App) OpenHost

func (a *App) OpenHost(id string)

OpenHost opens a device monitor without changing the selected conversation.

func (*App) OpenKnowledge

func (a *App) OpenKnowledge(c *ui.Context, session, link string)

OpenKnowledge opens a knowledge link of a conversation on its Node.

func (*App) OpenProject

func (a *App) OpenProject(project *viewmodel.Project, actions ProjectActions)

func (*App) OpenWorkspaceTerminal

func (a *App) OpenWorkspaceTerminal(id, title string)

OpenWorkspaceTerminal opens or focuses an independent main terminal. It does not add a conversation's right-panel tab or start a terminal process.

func (*App) PanelConversations

func (a *App) PanelConversations() []string

PanelConversations are the conversations that have a panel: the shown one first, then the others in order. A main terminal pane's panel is not a conversation's: it leaves with its pane (DropWorkspaceTerminal).

func (*App) PluginFeature

func (a *App) PluginFeature() string

func (*App) Prefs

func (a *App) Prefs() Prefs

Prefs returns the app's preferences as they are now. They are the window's own: the demo's panels and panes are never saved.

func (*App) ProjectOwner

func (a *App) ProjectOwner() (node, project string, shown bool)

func (*App) Reading

func (a *App) Reading() *Reading

Reading is the live page the viewer shows, nil once it is closed.

func (*App) RenderResource

func (a *App) RenderResource(c *ui.Context, render func(*panel.Project))

RenderResource supplies the shared workspace project or shows the resource's empty state when the active page has no reachable project.

func (*App) ReplaceConversationID

func (a *App) ReplaceConversationID(before, after string)

ReplaceConversationID retains local input state when a draft is created on Node.

func (*App) ResourceCheckpointHistory

func (a *App) ResourceCheckpointHistory() bool

ResourceCheckpointHistory reports whether this view needs checkpoint history.

func (*App) ResourceKind

func (a *App) ResourceKind() panel.Kind

ResourceKind identifies the workspace view used by the current page.

func (*App) ResourceProject

func (a *App) ResourceProject() *viewmodel.Project

ResourceProject is the project named in the Files or Git breadcrumb.

func (*App) ResourceTarget

func (a *App) ResourceTarget() ResourceTarget

ResourceTarget returns the explicit selection when Files or Git is shown. The zero value follows the current conversation.

func (*App) RevealConversationPanel added in v0.2.3

func (a *App) RevealConversationPanel()

RevealConversationPanel shows the active pane's right panel. Explicit open actions call it before changing the mounted panel's tabs.

func (*App) RevealDetails

func (a *App) RevealDetails()

RevealDetails shows the right column again after its toggle folded it.

func (*App) RevealResourceFile

func (a *App) RevealResourceFile() func(string)

RevealResourceFile returns the navigation callback for a file already opened in the shared workspace. Without a Files resource, the action is unavailable.

func (*App) SelectedConversation added in v0.2.7

func (a *App) SelectedConversation() *viewmodel.Conversation

SelectedConversation is the sidebar's selection on the host it was chosen on, as a row or a row's drop chose it, or by its ID alone when none was named: two hosts may list a session of one ID.

func (*App) SetFeaturePreferences

func (a *App) SetFeaturePreferences(order []string, pins map[string]bool)

func (*App) SetHostPorts

func (a *App) SetHostPorts(id string, ports []host.Port)

func (*App) SetHosts

func (a *App) SetHosts(hosts map[string]*host.Host)

func (*App) SetInstallations

func (a *App) SetInstallations(queue *transfers.Queue)

func (*App) SetLocalHost

func (a *App) SetLocalHost(h *host.Host)

SetLocalHost supplies current local overview data without preview metrics.

func (*App) SetPluginFeatures

func (a *App) SetPluginFeatures(features []Feature)

func (*App) SetPluginWorkspace

func (a *App) SetPluginWorkspace(key string, minNavigation, minDetails, defaultDetails float32)

SetPluginWorkspace projects the mounted Workspace's constraints. A default width initializes a Workspace once; subsequent projections preserve drags.

func (*App) SetPrefs

func (a *App) SetPrefs(p Prefs)

SetPrefs applies preferences, as at start-up.

func (*App) SetResourceTarget

func (a *App) SetResourceTarget(target ResourceTarget)

SetResourceTarget selects the workspace shared by Files and Git.

func (*App) SetWelcome

func (a *App) SetWelcome(seen bool)

SetWelcome uses the profile preference, independently of window UI state.

func (*App) ShowKnowledge

func (a *App) ShowKnowledge(r *Reading)

ShowKnowledge opens the viewer on a page read from a Node.

func (*App) ShowSelection

func (a *App) ShowSelection(text string)

ShowSelection presents text captured by the controller's native integration.

func (*App) SyncNativePages

func (a *App) SyncNativePages()

SyncNativePages delivers shared live state to the installed page controllers.

func (*App) SystemShortcuts

func (a *App) SystemShortcuts() map[string]string

SystemShortcuts are the system-wide shortcuts on the keys they have now, by accelerator: their commands go to Do. cmd/sailry-desktop registers them with the system as the app starts.

func (*App) TakePanelTab

func (a *App) TakePanelTab(t panel.Tab)

TakePanelTab takes t out of the panel that has it, shown or not, to show it in the main workspace. A panel it was the only tab of closes, as on an explicit close, rather than staying open with nothing in it.

func (*App) ToggleSettings

func (a *App) ToggleSettings()

ToggleSettings opens Settings, or from Settings goes back to the page it opened over: the rail's button opens and closes it (user decision 2026-11-12).

func (*App) Usage

func (a *App) Usage() Usage

Usage reads the state after a frame.

func (*App) View

func (a *App) View(c *ui.Context)

View builds the window.

func (*App) WorkspaceTerminalIDs

func (a *App) WorkspaceTerminalIDs() []string

WorkspaceTerminalIDs lists the open main terminal surfaces in opening order.

type Assembly

type Assembly struct {
	WorkspacePages []NativePage
	SettingsPages  []settings.NativePage
	ProviderUI     func(*settings.State) ProviderUI
	Locales        []fs.FS
}

Assembly selects the optional pages, services, and translations for each window.

func Assemble

func Assemble(modules ...Module) Assembly

type Choice

type Choice struct {
	ID       string
	Label    string
	Icon     *ui.SVG
	Keywords []string
	Folder   string // the folder it opens, "" for an action
	Selected bool   // what the window shows: a check
	// contains filtered or unexported fields
}

Choice is a row of the search: a label with keywords that match too, a folder it opens, or an action.

type CloseDocument added in v0.2.3

type CloseDocument struct {
	Project *panel.Project
	Name    string
	Digest  [32]byte
}

CloseDocument identifies the draft that a discard confirmation would lose. Each window owns its project editors, even when they show the same file.

type CloseRequest

type CloseRequest struct {
	// Documents are read again before discarding drafts and after saving.
	Documents      func() []CloseDocument
	StopsLocalWork bool
	// Save starts saving every unsaved document; Saving reports whether a
	// save is still under way. A failed save tells its own toast.
	Save    func()
	Saving  func() bool
	Proceed func()
}

CloseRequest asks to close a window or quit the application. With unsaved documents the prompt offers Save all, Discard and Cancel. Otherwise it confirms the quit and warns about any local work that will stop.

type ConversationActions

type ConversationActions interface {
	composer.Actions
	conversation.Actions
}

type ConversationPanel

type ConversationPanel struct {
	Tabs   []panel.Tab `json:"tabs,omitempty"`
	Active panel.Tab   `json:"active"`
	Open   bool        `json:"open,omitempty"`
	// Width is the column's width when the conversation was left, 0 for the
	// window's.
	Width float32 `json:"width,omitempty"`
	// contains filtered or unexported fields
}

ConversationPanel is a pane's panel while another pane is shown, and in the saved window state.

type Feature

type Feature struct {
	ID            string
	Icon          *ui.SVG
	Label         string // i18n key
	Fixed         bool   // always on the rail, never moved (Conversation)
	Last          bool   // always last (Market)
	DefaultPinned bool
}

Feature is a rail entry.

type Group

type Group struct {
	Heading string
	Choices []Choice
}

Group is a section of choices under an optional heading.

func Filter

func Filter(groups []Group, query string) []Group

Filter keeps the choices whose label or a keyword holds the query, ignoring case, and drops groups left empty; the order stays (no score, no limit). An empty query keeps all (Rows::filter).

type Hooks

type Hooks struct {
	HostActions       func(string) host.Actions
	EditHost          func(string)
	WorkspaceProject  func() *panel.Project
	ResourceWorkspace func(ResourceTarget) *panel.Project
	DownloadDialog    func(*ui.Context)
	PackageDialogs    func(*ui.Context)
	// FilePreview draws the preview dialog of a file outside a
	// conversation.
	FilePreview func(*ui.Context)
	BeforeFrame func(*ui.Context)
	AfterFrame  func()
	// DemoChanged runs when Demo mode went on, off or into another
	// language, before the frame's other hooks.
	DemoChanged      func()
	Refresh          func()
	ReadNotice       func(string)
	ReadNotices      func([]string)
	DismissRead      func([]string)
	DismissNotices   func([]string)
	OpenKnowledge    func(c *ui.Context, node string, source Source)
	CaptureSelection func()
	OpenLogs         func()
	Conversation     func(*ui.Context, *viewmodel.Conversation, *composer.State) (*composer.Context, ConversationActions)
	// DemoConversation lets the controller show over a demo conversation
	// what reads nothing but the conversation itself: the statistics
	// package's figures in the composer's context bar. It runs after the
	// demo's composer is prepared and sends the Node nothing of the demo.
	DemoConversation func(*ui.Context, *viewmodel.Conversation, *composer.State)
	RenderChild      func(*ui.Context, string)
	ReadSelection    func(string, string)
	ReaderActive     func(string) bool
	SelectPlugin     func(string) bool
	PluginPage       func(*ui.Context, string)
	PluginHeader     func(*ui.Context)
	PluginTitle      func(*ui.Context) bool
	PluginOverlays   func(*ui.Context)
	// Overview is a conversation's session overview for the header's button.
	Overview func(*ui.Context, *viewmodel.Conversation) *composer.Overview
	// NewConversationDraft opens a fresh unsent conversation in project (nil:
	// without one) for the pane keys' new tab or split, with that location's
	// composer defaults, and selects it as New session does. Unlike New
	// session it never reuses the location's unsent draft. A selection left
	// as it was means none was created.
	NewConversationDraft func(project *viewmodel.Project)
}

Hooks keeps I/O and thread scheduling in the live controller.

type Module

type Module func(*Assembly)

Module registers the contributions it supplies to a desktop assembly.

type NativePage

type NativePage struct {
	Page    Page
	Feature Feature
	Render  func(*ui.Context, *App)
	Usage   protocol.FeatureUse
	// Bind returns a window-local frame callback. visible reports whether this
	// route is active in the live window, including between frames.
	Bind func(app *App, visible func() bool) func()
	// Resource shares a workspace panel tab's project and the shell's layout.
	Resource panel.Kind
	// CheckpointHistory requests older checkpoints for the shown workspace.
	CheckpointHistory bool
	// RenderDetails and BindKeys are optional resource callbacks. The shell
	// calls them with the current workspace project when it is available.
	RenderDetails func(*ui.Context, *App, *panel.Project)
	BindKeys      func(*ui.Context, *panel.Project, ui.Element)
	// ExtensionDetails shares Settings' extension details in the right column.
	ExtensionDetails bool
}

NativePage contributes a window-local rail destination and its content.

type Page

type Page string

Page is the stable ID of a destination in the main column. Native pages can use their own namespaced IDs.

const (
	ConversationPage  Page = "page:conversation"
	SettingsPage      Page = "page:settings"
	FilesPage         Page = "page:files"
	GitPage           Page = "page:git"
	ActivityPage      Page = "page:activity"
	MarketPage        Page = "page:settings_plugins"
	HostPage          Page = "page:host"
	NotificationsPage Page = "page:notifications"
	ProjectPage       Page = "page:project"
	PluginPage        Page = "page:plugin"
)

type PluginWorkspacePrefs

type PluginWorkspacePrefs struct {
	Width  float32 `json:"width"`
	Folded bool    `json:"folded,omitempty"`
}

PluginWorkspacePrefs belong to one workspace, including the core Files and Git pages. Conversation panels and other workspaces keep their own widths and fold choices.

type Prefs

type Prefs struct {
	NavWidth float32 `json:"navWidth"`
	NavOpen  bool    `json:"navOpen"`
	// OverviewHidden hides the activity card in a wide conversation pane.
	OverviewHidden bool        `json:"overviewHidden,omitempty"`
	PanelWidth     float32     `json:"panelWidth"`
	PanelOpen      bool        `json:"panelOpen"`
	PanelTabs      []panel.Tab `json:"panelTabs,omitempty"`
	PanelTab       panel.Tab   `json:"panelTab"`
	// PanelOf is the conversation PanelTabs, PanelTab and PanelOpen belong
	// to, the one shown last; empty in a file from before the panel belonged
	// to conversations, whose tabs the first conversation shown takes.
	PanelOf string `json:"panelOf,omitempty"`
	// Panels are the other conversations' panels (panels.go).
	Panels           map[string]ConversationPanel    `json:"panels,omitempty"`
	PluginWorkspaces map[string]PluginWorkspacePrefs `json:"pluginWorkspaces,omitempty"`
	Collapsed        []string                        `json:"collapsed,omitempty"`
	// SessionOrder is the preview's sidebar order, a session_order value; a
	// profile keeps its own in its preferences.
	SessionOrder string   `json:"sessionOrder,omitempty"`
	Features     []string `json:"features,omitempty"` // the rail's order
	Unpinned     []string `json:"unpinned,omitempty"` // features off the rail
	// WelcomeSeen is whether the welcome guide was dismissed; nil in a file from
	// before it counts as seen, and no file at all as a first launch.
	WelcomeSeen *bool `json:"welcomeSeen,omitempty"`
	// Panes are the split workspace's groups, each a layout tree.
	Panes []*panes.Node `json:"panes,omitempty"`
	// Tabs are the sessions and terminals kept as tabs beside the groups.
	Tabs []panes.Target `json:"tabs,omitempty"`
	// TabOrder is the header tabs' opening order, each by its first target.
	TabOrder []panes.Target `json:"tabOrder,omitempty"`
	// WorkspaceTerminals are independent main terminal surfaces. They hold no
	// process state or conversation ownership.
	WorkspaceTerminals []WorkspaceTerminal `json:"workspaceTerminals,omitempty"`
	// DiffSplit is the window's diff layout: side by side when set, else
	// unified, as before the choice.
	DiffSplit bool `json:"diffSplit,omitempty"`
	// ListShare is the stacked list's share of the height (panel.pair);
	// absent, as in a file from before, is the first share.
	ListShare float32 `json:"listShare,omitempty"`
}

Prefs are the window's UI preferences that come back after a relaunch: the columns' widths and openness, the panel's tabs, the projects closed in the sidebar, and the preview's rail. They are UI state, not user data; the preview's conversations are never written.

The file is one for the preview and every profile. A profile keeps its rail's order and pins in its own preferences (FeaturePreferences), so a live window neither reads Features and Unpinned nor changes them: it writes back the ones it loaded.

func DefaultPrefs

func DefaultPrefs() Prefs

DefaultPrefs are the first launch's.

func LoadPrefs

func LoadPrefs(dir string) Prefs

LoadPrefs reads the preferences in dir, or the defaults when there are none or they do not parse. Widths out of range come back clamped.

type ProjectActions

type ProjectActions struct {
	NewSession     func(*viewmodel.Project)
	VisibleSession func(*viewmodel.Conversation) bool
	OpenSession    func(*viewmodel.Conversation, func(bool))
	Repository     func() ProjectRepository
	Initialize     func(func(bool))
	// NewTerminal opens an independent terminal in the project's worktree.
	NewTerminal func(*viewmodel.Project)
	// Terminals lists the project's running Node terminals, whichever
	// controller started them; OpenTerminal shows one as a main surface.
	Terminals    func() []ProjectTerminal
	OpenTerminal func(id string)
	// Controls draws the controls packages add to the page, after its own.
	Controls func(*ui.Context)
}

type ProjectRepository

type ProjectRepository struct {
	Known, Directory bool
	Branch           string
	Repositories     []string
}

type ProjectTerminal added in v0.2.5

type ProjectTerminal = sidebar.Terminal

ProjectTerminal is a running terminal in one of a project's worktrees, the sidebar's row of it.

type ProviderUI

type ProviderUI interface {
	Picker(c *ui.Context, chosen, back func())
	CloseProviderEditor(nextNode string)
	LoginDialog(*ui.Context)
	ShowProviderAuthorization(node, id string, view *settings.Authorization)
	ProviderAuthorization() *settings.Authorization
	WarnProviderAuthorization(title, text string, proceed, cancel func())
}

ProviderUI is the model channels page's presentation for this window.

type Reading

type Reading struct {
	Node, Collection                  string
	Title, Host, Path, Position, Text string
	First, Last, Pending              bool
	Unavailable                       bool
	Turn                              func(forward bool)
}

Reading is one page of a citation read from its Node. The controller owns it: it replaces the page and the ends as Previous and Next load.

type ResourceTarget

type ResourceTarget struct {
	Node, Project, Worktree string
}

ResourceTarget identifies the independent Files and Git workspace. An empty Worktree selects the project's main worktree.

type Shortcut

type Shortcut = settings.Shortcut

Shortcut is a key of the window: its id, label and default key, as the Shortcuts settings list them.

type Source

type Source struct {
	Collection, Chunk, Revision, Node string
}

Source is a knowledge citation's identity (sailry-knowledge://<collection>/<chunk>?revision=<rev>).

func ParseSource

func ParseSource(link string) (Source, bool)

ParseSource reads a knowledge link, rejecting what the reference rejects: another scheme, a user, password or port, a fragment, more path segments, and query fields other than revision and an optional storage Node.

type Usage

type Usage struct {
	Page Page
	// PluginPage is the rail feature of the package page shown, "" on any
	// other page.
	PluginPage string
	// Search is whether the search palette is open.
	Search bool
	// ModelPicker is whether a composer's model controls are open.
	ModelPicker bool
	// Splits is how many panes were split off since the window opened.
	Splits int
}

Usage is the part of the window's state the anonymous feature counters compare from one frame to the next. It names no session, project or host.

type WorkspaceTerminal

type WorkspaceTerminal struct {
	ID    string `json:"id"`
	Title string `json:"title,omitempty"`
	// contains filtered or unexported fields
}

WorkspaceTerminal is an independent terminal surface in the main workspace. The Node owns its process; this record only keeps its presentation open.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL