sstore

package
v0.0.0-...-9b1f5a2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

in-memory storage for waveterm server

Index

Constants

View Source
const (
	RemoteField_Alias       = "alias"       // string
	RemoteField_ConnectMode = "connectmode" // string
	RemoteField_SSHKey      = "sshkey"      // string
	RemoteField_SSHPassword = "sshpassword" // string
	RemoteField_Color       = "color"       // string
	RemoteField_ShellPref   = "shellpref"   // string
)
View Source
const (
	ScreenField_AnchorLine   = "anchorline"   // int
	ScreenField_AnchorOffset = "anchoroffset" // int
	ScreenField_SelectedLine = "selectedline" // int
	ScreenField_Focus        = "focustype"    // string
	ScreenField_TabColor     = "tabcolor"     // string
	ScreenField_TabIcon      = "tabicon"      // string
	ScreenField_PTerm        = "pterm"        // string
	ScreenField_Name         = "name"         // string
	ScreenField_ShareName    = "sharename"    // string
)
View Source
const (
	LineTypeCmd    = "cmd"
	LineTypeText   = "text"
	LineTypeOpenAI = "openai"
)
View Source
const (
	LineState_Source   = "prompt:source"
	LineState_File     = "prompt:file"
	LineState_FileUrl  = "wave:fileurl"
	LineState_Min      = "wave:min"
	LineState_Template = "template"
	LineState_Mode     = "mode"
	LineState_Lang     = "lang"
	LineState_Minimap  = "minimap"
)
View Source
const (
	MainViewSession     = "session"
	MainViewBookmarks   = "bookmarks"
	MainViewHistory     = "history"
	MainViewConnections = "connections"
	MainViewSettings    = "clientsettings"
)
View Source
const (
	CmdStatusRunning  = "running"
	CmdStatusDetached = "detached"
	CmdStatusError    = "error"
	CmdStatusDone     = "done"
	CmdStatusHangup   = "hangup"
	CmdStatusUnknown  = "unknown" // used for history items where we don't have a status
)
View Source
const (
	OpenAIRoleSystem    = "system"
	OpenAIRoleUser      = "user"
	OpenAIRoleAssistant = "assistant"
)
View Source
const (
	RemoteAuthTypeNone        = "none"
	RemoteAuthTypePassword    = "password"
	RemoteAuthTypeKey         = "key"
	RemoteAuthTypeKeyPassword = "key+password"
)
View Source
const (
	SSHConfigSrcTypeManual = "waveterm-manual"
	SSHConfigSrcTypeImport = "sshconfig-import"
)
View Source
const (
	ShareModeLocal = "local"
	ShareModeWeb   = "web"
)

TODO: move to webshare package once sstore code is more modular

View Source
const (
	ConnectModeStartup = "startup"
	ConnectModeAuto    = "auto"
	ConnectModeManual  = "manual"
)
View Source
const (
	RemoteTypeSsh    = "ssh"
	RemoteTypeOpenAI = "openai"
)
View Source
const (
	ScreenFocusInput = "input"
	ScreenFocusCmd   = "cmd"
)
View Source
const (
	CmdStoreTypeSession = "session"
	CmdStoreTypeScreen  = "screen"
)
View Source
const (
	UpdateType_ScreenNew          = "screen:new"
	UpdateType_ScreenDel          = "screen:del"
	UpdateType_ScreenSelectedLine = "screen:selectedline"
	UpdateType_ScreenName         = "screen:sharename"
	UpdateType_LineNew            = "line:new"
	UpdateType_LineDel            = "line:del"
	UpdateType_LineRenderer       = "line:renderer"
	UpdateType_LineContentHeight  = "line:contentheight"
	UpdateType_LineState          = "line:state"
	UpdateType_CmdStatus          = "cmd:status"
	UpdateType_CmdTermOpts        = "cmd:termopts"
	UpdateType_CmdExitCode        = "cmd:exitcode"
	UpdateType_CmdDurationMs      = "cmd:durationms"
	UpdateType_CmdRtnState        = "cmd:rtnstate"
	UpdateType_PtyPos             = "pty:pos"
)
View Source
const (
	RemoteStatus_Connected    = "connected"
	RemoteStatus_Connecting   = "connecting"
	RemoteStatus_Disconnected = "disconnected"
	RemoteStatus_Error        = "error"
)
View Source
const APITokenSentinel = "--apitoken--"
View Source
const CmdLineSpecialMigration = 20
View Source
const (
	CmdRendererOpenAI = "openai"
)
View Source
const CmdScreenSpecialMigration = 13
View Source
const DBFileName = "waveterm.db"
View Source
const DBFileNameBackup = "backup.waveterm.db"
View Source
const DBWALFileName = "waveterm.db-wal"
View Source
const DBWALFileNameBackup = "backup.waveterm.db-wal"
View Source
const DefaultCwd = "~"
View Source
const DefaultSessionName = "default"
View Source
const DefaultSudoTimeout = 5
View Source
const (
	LayoutFull = "full"
)
View Source
const LineNoHeight = -1
View Source
const LocalRemoteAlias = "local"
View Source
const MaxLineStateSize = 4 * 1024 // 4k for now, can raise if needed
View Source
const MaxMigration = 31
View Source
const MaxWebShareLineCount = 50
View Source
const MaxWebShareScreenCount = 3
View Source
const MigratePrimaryScreenVersion = 9
View Source
const MigrationChunkSize = 10
View Source
const RISpecialMigration = 30
View Source
const ShellTypePref_Detect = "detect"

defined here and not in packet.go since this value should never be passed to waveshell (it should always get resolved prior to sending a run packet)

Variables

View Source
var MemLock *sync.Mutex = &sync.Mutex{}

global lock for all memory operations memory ops are very fast, so this is not a bottleneck

View Source
var ScreenMemStore map[string]*ScreenMemState = make(map[string]*ScreenMemState) // map of screenid -> ScreenMemState
View Source
var WebScreenPtyPosDelIntent = make(map[string]bool) // map[screenid + ":" + lineid] -> bool
View Source
var WebScreenPtyPosLock = &sync.Mutex{}

Functions

func AddInfoMsgUpdateError

func AddInfoMsgUpdateError(update *scbus.ModelUpdatePacketType, errStr string)

only sets InfoError if InfoError is not already set

func AddLineUpdate

func AddLineUpdate(update *scbus.ModelUpdatePacketType, newLine *LineType, newCmd *CmdType)

func AddScreenUpdate

func AddScreenUpdate(update *scbus.ModelUpdatePacketType, newScreen *ScreenType)

func AppendToCmdPtyBlob

func AppendToCmdPtyBlob(ctx context.Context, screenId string, lineId string, data []byte, pos int64) (*scbus.PtyDataUpdatePacketType, error)

func ArchiveScreen

func ArchiveScreen(ctx context.Context, sessionId string, screenId string) (scbus.UpdatePacket, error)

func ArchiveScreenLines

func ArchiveScreenLines(ctx context.Context, screenId string) (*scbus.ModelUpdatePacketType, error)

func ArchiveSession

func ArchiveSession(ctx context.Context, sessionId string) (*scbus.ModelUpdatePacketType, error)

func ClearCmdPtyFile

func ClearCmdPtyFile(ctx context.Context, screenId string, lineId string) error

func CloseDB

func CloseDB()

func CountScreenLines

func CountScreenLines(ctx context.Context, screenId string) (int, error)

func CountScreenUpdates

func CountScreenUpdates(ctx context.Context) (int, error)

func CountScreenWebShares

func CountScreenWebShares(ctx context.Context) (int, error)

func CreateCmdPtyFile

func CreateCmdPtyFile(ctx context.Context, screenId string, lineId string, maxSize int64) error

func DeleteLinesByIds

func DeleteLinesByIds(ctx context.Context, screenId string, lineIds []string) error

func DeletePtyOutFile

func DeletePtyOutFile(ctx context.Context, screenId string, lineId string) error

func DeleteScreen

func DeleteScreen(ctx context.Context, screenId string, sessionDel bool, update *scbus.ModelUpdatePacketType) (*scbus.ModelUpdatePacketType, error)

if sessionDel is passed, we do *not* delete the screen directory (session delete will handle that)

func DeleteScreenDir

func DeleteScreenDir(ctx context.Context, screenId string) error

func DeleteScreenLines

func DeleteScreenLines(ctx context.Context, screenId string) (*scbus.ModelUpdatePacketType, error)

func DeleteSession

func DeleteSession(ctx context.Context, sessionId string) (scbus.UpdatePacket, error)

func DeleteWebPtyPos

func DeleteWebPtyPos(ctx context.Context, screenId string, lineId string) error

func EnsureLocalRemote

func EnsureLocalRemote(ctx context.Context) error

func FeStateFromShellState

func FeStateFromShellState(state *packet.ShellState) map[string]string

func FindLineIdByArg

func FindLineIdByArg(ctx context.Context, screenId string, lineArg string) (string, error)

special "E" returns last unarchived line, "EA" returns last line (even if archived)

func FullSessionDiskSize

func FullSessionDiskSize() (map[string]SessionDiskSizeType, error)

func GetActiveSessionId

func GetActiveSessionId(ctx context.Context) (string, error)

func GetAllImportedRemotes

func GetAllImportedRemotes(ctx context.Context) (map[string]*RemoteType, error)

func GetCurStateDiffFromPtr

func GetCurStateDiffFromPtr(ctx context.Context, ssPtr *packet.ShellStatePtr) (*packet.ShellStateDiff, error)

func GetDB

func GetDB(ctx context.Context) (*sqlx.DB, error)

func GetDBBackupName

func GetDBBackupName() string

func GetDBName

func GetDBName() string

func GetDBVersion

func GetDBVersion(ctx context.Context) (int, error)

func GetDBWALBackupName

func GetDBWALBackupName() string

func GetDBWALName

func GetDBWALName() string

func GetFirstSessionId

func GetFirstSessionId(ctx context.Context) (string, error)

does not include archived, finds lowest sessionidx (for resetting active session)

func GetFullState

func GetFullState(ctx context.Context, ssPtr packet.ShellStatePtr) (*packet.ShellState, error)

returns error when not found

func GetLineCmdByLineId

func GetLineCmdByLineId(ctx context.Context, screenId string, lineId string) (*LineType, *CmdType, error)

func GetRemoteActiveShells

func GetRemoteActiveShells(ctx context.Context, remoteId string) ([]string, error)

func GetRemoteState

func GetRemoteState(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType) (*packet.ShellState, *packet.ShellStatePtr, error)

func GetRemoteStatePtr

func GetRemoteStatePtr(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType) (*packet.ShellStatePtr, error)

func GetScreenSelectedLineId

func GetScreenSelectedLineId(ctx context.Context, screenId string) (string, error)

func GetSessionCount

func GetSessionCount(ctx context.Context) (int, error)

counts non-archived sessions

func GetStateBase

func GetStateBase(ctx context.Context, baseHash string) (*packet.ShellState, error)

func GetStateBaseVersion

func GetStateBaseVersion(ctx context.Context, baseHash string) (string, error)

func GetStateDiff

func GetStateDiff(ctx context.Context, diffHash string) (*packet.ShellStateDiff, error)

func GetWebPtyPos

func GetWebPtyPos(ctx context.Context, screenId string, lineId string) (int64, error)

func GoDeleteScreenDirs

func GoDeleteScreenDirs(screenIds ...string)

func HangupAllRunningCmds

func HangupAllRunningCmds(ctx context.Context) error

func IncrementNumRunningCmds

func IncrementNumRunningCmds(screenId string, delta int)

func IncrementNumRunningCmds_Update

func IncrementNumRunningCmds_Update(update *scbus.ModelUpdatePacketType, screenId string, delta int)

func InfoMsgUpdate

func InfoMsgUpdate(infoMsgFmt string, args ...interface{}) *scbus.ModelUpdatePacketType

func InsertLine

func InsertLine(ctx context.Context, line *LineType, cmd *CmdType) error

func InsertScreen

func InsertScreen(ctx context.Context, sessionId string, origScreenName string, opts ScreenCreateOpts, activate bool) (*scbus.ModelUpdatePacketType, error)

func InsertSessionWithName

func InsertSessionWithName(ctx context.Context, sessionName string, activate bool) (*scbus.ModelUpdatePacketType, string, string, error)

returns (update, newSessionId, newScreenId, error) if sessionName == "", it will be generated

func IsValidConnectMode

func IsValidConnectMode(mode string) bool

func MakeMigrate

func MakeMigrate() (*migrate.Migrate, error)

func MaybeInsertPtyPosUpdate

func MaybeInsertPtyPosUpdate(ctx context.Context, screenId string, lineId string) error

func MigrateCommandOpts

func MigrateCommandOpts(opts []string) error

func MigrateDown

func MigrateDown() error

func MigrateGoto

func MigrateGoto(n uint) error

func MigratePrintVersion

func MigratePrintVersion() error

func MigrateUp

func MigrateUp(targetVersion uint) error

func MigrateUpStep

func MigrateUpStep(m *migrate.Migrate, newVersion uint) error

func MigrateVersion

func MigrateVersion(m *migrate.Migrate) (uint, bool, error)

returns curVersion, dirty, error

func NotifyUpdateWriter

func NotifyUpdateWriter()

func NumScreens

func NumScreens(ctx context.Context) (int, error)

func NumSessions

func NumSessions(ctx context.Context) (int, error)

func ReIndexSessions

func ReIndexSessions(ctx context.Context, sessionId string, newIndex int) error

func ReInitFocus

func ReInitFocus(ctx context.Context) error

func ReadFullPtyOutFile

func ReadFullPtyOutFile(ctx context.Context, screenId string, lineId string) (int64, []byte, error)

returns (real-offset, data, err)

func ReadPtyOutFile

func ReadPtyOutFile(ctx context.Context, screenId string, lineId string, offset int64, maxSize int64) (int64, []byte, error)

returns (real-offset, data, err)

func RemoveScreenUpdate

func RemoveScreenUpdate(ctx context.Context, updateId int64) error

func RemoveScreenUpdates

func RemoveScreenUpdates(ctx context.Context, updateIds []int64) error

func ResetStatusIndicator

func ResetStatusIndicator(screenId string) error

Resets the in-memory status indicator for the given screenId to StatusIndicatorLevel_None and pushes the new value to the FE

func ResetStatusIndicator_Update

func ResetStatusIndicator_Update(update *scbus.ModelUpdatePacketType, screenId string) error

Resets the in-memory status indicator for the given screenId to StatusIndicatorLevel_None and adds it to the ModelUpdate

func RunMigration13

func RunMigration13() error

func RunMigration20

func RunMigration20() error

func RunMigration30

func RunMigration30() error

we're going to mark any invalid basestate versions as "invalid" so we can give a better error message for the FE and prompt a reset

func ScreenMemAddCmdInfoChatMessage

func ScreenMemAddCmdInfoChatMessage(screenId string, msg *packet.OpenAICmdInfoChatMessage)

func ScreenMemClearCmdInfoChat

func ScreenMemClearCmdInfoChat(screenId string)

func ScreenMemGetCmdInfoMessageCount

func ScreenMemGetCmdInfoMessageCount(screenId string) int

func ScreenMemIncrementNumRunningCommands

func ScreenMemIncrementNumRunningCommands(screenId string, delta int) int

func ScreenMemInitCmdInfoChat

func ScreenMemInitCmdInfoChat(screenId string)

func ScreenMemSetCmdInputText

func ScreenMemSetCmdInputText(screenId string, sp utilfn.StrWithPos, seqNum int)

func ScreenMemSetIndicatorLevel

func ScreenMemSetIndicatorLevel(screenId string, level StatusIndicatorLevel)

Set the indicator to the given level, regardless of the current indicator level.

func ScreenMemUpdateCmdInfoChatMessage

func ScreenMemUpdateCmdInfoChatMessage(screenId string, messageID int, msg *packet.OpenAICmdInfoChatMessage) error

func ScreenUpdateViewOpts

func ScreenUpdateViewOpts(ctx context.Context, screenId string, viewOpts ScreenViewOptsType) error

func ScreenWebShareStart

func ScreenWebShareStart(ctx context.Context, screenId string, shareOpts ScreenWebShareOpts) error

func ScreenWebShareStop

func ScreenWebShareStop(ctx context.Context, screenId string) error

func SetActiveSessionId

func SetActiveSessionId(ctx context.Context, sessionId string) error

func SetClientOpts

func SetClientOpts(ctx context.Context, clientOpts ClientOptsType) error

func SetLineArchivedById

func SetLineArchivedById(ctx context.Context, screenId string, lineId string, archived bool) error

func SetReleaseInfo

func SetReleaseInfo(ctx context.Context, releaseInfo ReleaseInfoType) error

func SetScreenIdx

func SetScreenIdx(ctx context.Context, sessionId string, screenId string, newScreenIdx int) error

newScreenIdx is 1-indexed

func SetScreenName

func SetScreenName(ctx context.Context, sessionId string, screenId string, name string) error

func SetSessionName

func SetSessionName(ctx context.Context, sessionId string, name string) error

func SetStatusIndicatorLevel

func SetStatusIndicatorLevel(ctx context.Context, screenId string, level StatusIndicatorLevel, force bool) error

Sets the in-memory status indicator for the given screenId to the given value and pushes the new value to the FE

func SetStatusIndicatorLevel_Update

func SetStatusIndicatorLevel_Update(ctx context.Context, update *scbus.ModelUpdatePacketType, screenId string, level StatusIndicatorLevel, force bool) error

Sets the in-memory status indicator for the given screenId to the given value and adds it to the ModelUpdate. By default, the active screen will be ignored when updating status. To force a status update for the active screen, set force=true.

func SetWebPtyPos

func SetWebPtyPos(ctx context.Context, screenId string, lineId string, ptyPos int64) error

func SetWinSize

func SetWinSize(ctx context.Context, winSize ClientWinSizeType) error

func StatCmdPtyFile

func StatCmdPtyFile(ctx context.Context, screenId string, lineId string) (*cirfile.Stat, error)

func StoreStateBase

func StoreStateBase(ctx context.Context, state *packet.ShellState) error

func StoreStateDiff

func StoreStateDiff(ctx context.Context, diff *packet.ShellStateDiff) error

func SwitchScreenById

func SwitchScreenById(ctx context.Context, sessionId string, screenId string) (*scbus.ModelUpdatePacketType, error)

func TryMigrateUp

func TryMigrateUp() error

func UnArchiveScreen

func UnArchiveScreen(ctx context.Context, sessionId string, screenId string) error

func UnArchiveSession

func UnArchiveSession(ctx context.Context, sessionId string, activate bool) (*scbus.ModelUpdatePacketType, error)

func UpdateClientFeOpts

func UpdateClientFeOpts(ctx context.Context, feOpts FeOptsType) error

func UpdateClientOpenAIOpts

func UpdateClientOpenAIOpts(ctx context.Context, aiOpts OpenAIOptsType) error

func UpdateCmdDoneInfo

func UpdateCmdDoneInfo(ctx context.Context, update *scbus.ModelUpdatePacketType, ck base.CommandKey, donePk CmdDoneDataValues, status string) error

func UpdateCmdForRestart

func UpdateCmdForRestart(ctx context.Context, ck base.CommandKey, ts int64, cmdPid int, remotePid int, termOpts *TermOpts) error

func UpdateCmdRtnState

func UpdateCmdRtnState(ctx context.Context, ck base.CommandKey, statePtr packet.ShellStatePtr) error

func UpdateCmdStartInfo

func UpdateCmdStartInfo(ctx context.Context, ck base.CommandKey, cmdPid int, waveshellPid int) error

func UpdateCmdTermOpts

func UpdateCmdTermOpts(ctx context.Context, screenId string, lineId string, termOpts TermOpts) error

func UpdateCurRemote

func UpdateCurRemote(ctx context.Context, screenId string, remotePtr RemotePtrType) error

func UpdateLineHeight

func UpdateLineHeight(ctx context.Context, screenId string, lineId string, heightVal int) error

func UpdateLineRenderer

func UpdateLineRenderer(ctx context.Context, screenId string, lineId string, renderer string) error

func UpdateLineStar

func UpdateLineStar(ctx context.Context, screenId string, lineId string, starVal int) error

func UpdateLineState

func UpdateLineState(ctx context.Context, screenId string, lineId string, lineState map[string]any) error

func UpdateRemoteStateVars

func UpdateRemoteStateVars(ctx context.Context, remoteId string, stateVars map[string]string) error

func UpdateWithAddNewOpenAICmdInfoPacket

func UpdateWithAddNewOpenAICmdInfoPacket(ctx context.Context, screenId string, pk *packet.OpenAICmdInfoChatMessage) *scbus.ModelUpdatePacketType

func UpdateWithClearOpenAICmdInfo

func UpdateWithClearOpenAICmdInfo(screenId string) *scbus.ModelUpdatePacketType

func UpdateWithCurrentOpenAICmdInfoChat

func UpdateWithCurrentOpenAICmdInfoChat(screenId string, update *scbus.ModelUpdatePacketType) *scbus.ModelUpdatePacketType

func UpdateWithUpdateOpenAICmdInfoPacket

func UpdateWithUpdateOpenAICmdInfoPacket(ctx context.Context, screenId string, messageID int, pk *packet.OpenAICmdInfoChatMessage) (*scbus.ModelUpdatePacketType, error)

func UpdateWriterCheckMoreData

func UpdateWriterCheckMoreData()

func UpsertRemote

func UpsertRemote(ctx context.Context, r *RemoteType) error

func WithTx

func WithTx(ctx context.Context, fn func(tx *TxWrap) error) error

func WithTxRtn

func WithTxRtn[RT any](ctx context.Context, fn func(tx *TxWrap) (RT, error)) (RT, error)

func WithTxRtn3

func WithTxRtn3[RT1 any, RT2 any](ctx context.Context, fn func(tx *TxWrap) (RT1, RT2, error)) (RT1, RT2, error)

Types

type ActiveSessionIdUpdate

type ActiveSessionIdUpdate string

func (ActiveSessionIdUpdate) GetType

func (ActiveSessionIdUpdate) GetType() string

type AlertMessageType

type AlertMessageType struct {
	Title    string `json:"title,omitempty"`
	Message  string `json:"message"`
	Confirm  bool   `json:"confirm,omitempty"`
	Markdown bool   `json:"markdown,omitempty"`
}

func (AlertMessageType) GetType

func (AlertMessageType) GetType() string

type ClearInfoUpdate

type ClearInfoUpdate bool

func (ClearInfoUpdate) GetType

func (ClearInfoUpdate) GetType() string

type ClientData

type ClientData struct {
	ClientId            string            `json:"clientid"`
	UserId              string            `json:"userid"`
	UserPrivateKeyBytes []byte            `json:"-"`
	UserPublicKeyBytes  []byte            `json:"-"`
	UserPrivateKey      *ecdsa.PrivateKey `json:"-" dbmap:"-"`
	UserPublicKey       *ecdsa.PublicKey  `json:"-" dbmap:"-"`
	ActiveSessionId     string            `json:"activesessionid"`
	WinSize             ClientWinSizeType `json:"winsize"`
	ClientOpts          ClientOptsType    `json:"clientopts"`
	FeOpts              FeOptsType        `json:"feopts"`
	CmdStoreType        string            `json:"cmdstoretype"`
	DBVersion           int               `json:"dbversion" dbmap:"-"`
	OpenAIOpts          *OpenAIOptsType   `json:"openaiopts,omitempty" dbmap:"openaiopts"`
	ReleaseInfo         ReleaseInfoType   `json:"releaseinfo"`
}

func EnsureClientData

func EnsureClientData(ctx context.Context) (*ClientData, error)

func (*ClientData) Clean

func (cdata *ClientData) Clean() *ClientData

func (ClientData) GetType

func (ClientData) GetType() string

func (ClientData) UseDBMap

func (ClientData) UseDBMap()

type ClientOptsType

type ClientOptsType struct {
	NoTelemetry           bool              `json:"notelemetry,omitempty"`
	NoReleaseCheck        bool              `json:"noreleasecheck,omitempty"`
	AcceptedTos           int64             `json:"acceptedtos,omitempty"`
	ConfirmFlags          map[string]bool   `json:"confirmflags,omitempty"`
	MainSidebar           *SidebarValueType `json:"mainsidebar,omitempty"`
	RightSidebar          *SidebarValueType `json:"rightsidebar,omitempty"`
	GlobalShortcut        string            `json:"globalshortcut,omitempty"`
	GlobalShortcutEnabled bool              `json:"globalshortcutenabled,omitempty"`
	WebGL                 bool              `json:"webgl,omitempty"`
}

type ClientWinSizeType

type ClientWinSizeType struct {
	Width      int  `json:"width"`
	Height     int  `json:"height"`
	Top        int  `json:"top"`
	Left       int  `json:"left"`
	FullScreen bool `json:"fullscreen,omitempty"`
}

type CmdDoneDataValues

type CmdDoneDataValues struct {
	Ts         int64
	ExitCode   int
	DurationMs int64
}

type CmdLineUpdate

type CmdLineUpdate utilfn.StrWithPos

func (CmdLineUpdate) GetType

func (CmdLineUpdate) GetType() string

type CmdPtr

type CmdPtr struct {
	ScreenId string
	LineId   string
}

type CmdType

type CmdType struct {
	ScreenId     string               `json:"screenid"`
	LineId       string               `json:"lineid"`
	Remote       RemotePtrType        `json:"remote"`
	CmdStr       string               `json:"cmdstr"`
	RawCmdStr    string               `json:"rawcmdstr"`
	FeState      map[string]string    `json:"festate"`
	StatePtr     packet.ShellStatePtr `json:"state"`
	TermOpts     TermOpts             `json:"termopts"`
	OrigTermOpts TermOpts             `json:"origtermopts"`
	Status       string               `json:"status"`
	CmdPid       int                  `json:"cmdpid"`
	RemotePid    int                  `json:"remotepid"`
	RestartTs    int64                `json:"restartts,omitempty"`
	DoneTs       int64                `json:"donets"`
	ExitCode     int                  `json:"exitcode"`
	DurationMs   int                  `json:"durationms"`
	RunOut       []packet.PacketType  `json:"runout,omitempty"`
	RtnState     bool                 `json:"rtnstate,omitempty"`
	RtnStatePtr  packet.ShellStatePtr `json:"rtnstateptr,omitempty"`
	Remove       bool                 `json:"remove,omitempty"`    // not persisted to DB
	Restarted    bool                 `json:"restarted,omitempty"` // not persisted to DB
}

func GetCmdByScreenId

func GetCmdByScreenId(ctx context.Context, screenId string, lineId string) (*CmdType, error)

func GetRunningScreenCmds

func GetRunningScreenCmds(ctx context.Context, screenId string) ([]*CmdType, error)

func (*CmdType) FromMap

func (cmd *CmdType) FromMap(m map[string]interface{}) bool

func (CmdType) GetType

func (CmdType) GetType() string

func (*CmdType) IsRunning

func (cmd *CmdType) IsRunning() bool

func (*CmdType) ToMap

func (cmd *CmdType) ToMap() map[string]interface{}

type ConnectUpdate

type ConnectUpdate struct {
	Sessions                 []*SessionType                  `json:"sessions,omitempty"`
	Screens                  []*ScreenType                   `json:"screens,omitempty"`
	Remotes                  []*RemoteRuntimeState           `json:"remotes,omitempty"`
	ScreenStatusIndicators   []*ScreenStatusIndicatorType    `json:"screenstatusindicators,omitempty"`
	ScreenNumRunningCommands []*ScreenNumRunningCommandsType `json:"screennumrunningcommands,omitempty"`
	ActiveSessionId          string                          `json:"activesessionid,omitempty"`
	TermThemes               *configstore.ConfigReturn       `json:"termthemes,omitempty"`
}

func GetConnectUpdate

func GetConnectUpdate(ctx context.Context) (*ConnectUpdate, error)

Get all sessions and screens, including remotes

func (ConnectUpdate) GetType

func (ConnectUpdate) GetType() string

type FeOptsType

type FeOptsType struct {
	TermFontSize         int               `json:"termfontsize,omitempty"`
	TermFontFamily       string            `json:"termfontfamily,omitempty"`
	Theme                string            `json:"theme,omitempty"`
	TermThemeSettings    map[string]string `json:"termthemesettings"`
	SudoPwStore          string            `json:"sudopwstore,omitempty"`
	SudoPwTimeoutMs      int               `json:"sudopwtimeoutms,omitempty"`
	SudoPwTimeout        int               `json:"sudopwtimeout,omitempty"`
	NoSudoPwClearOnSleep bool              `json:"nosudopwclearonsleep,omitempty"`
}

type FeStateType

type FeStateType map[string]string

type InfoMsgType

type InfoMsgType struct {
	InfoTitle     string   `json:"infotitle"`
	InfoError     string   `json:"infoerror,omitempty"`
	InfoErrorCode string   `json:"infoerrorcode,omitempty"`
	InfoMsg       string   `json:"infomsg,omitempty"`
	InfoMsgHtml   bool     `json:"infomsghtml,omitempty"`
	WebShareLink  bool     `json:"websharelink,omitempty"`
	InfoComps     []string `json:"infocomps,omitempty"`
	InfoCompsMore bool     `json:"infocompssmore,omitempty"`
	InfoLines     []string `json:"infolines,omitempty"`
	TimeoutMs     int64    `json:"timeoutms,omitempty"`
}

func (InfoMsgType) GetType

func (InfoMsgType) GetType() string

type InteractiveUpdate

type InteractiveUpdate bool

func (InteractiveUpdate) GetType

func (InteractiveUpdate) GetType() string

type LayoutType

type LayoutType struct {
	Type   string `json:"type"`
	Parent string `json:"parent,omitempty"`
	ZIndex int64  `json:"zindex,omitempty"`
	Float  bool   `json:"float,omitempty"`
	Top    string `json:"top,omitempty"`
	Bottom string `json:"bottom,omitempty"`
	Left   string `json:"left,omitempty"`
	Right  string `json:"right,omitempty"`
	Width  string `json:"width,omitempty"`
	Height string `json:"height,omitempty"`
}

func (*LayoutType) Scan

func (l *LayoutType) Scan(val interface{}) error

func (LayoutType) Value

func (l LayoutType) Value() (driver.Value, error)

type LineType

type LineType struct {
	ScreenId      string         `json:"screenid"`
	UserId        string         `json:"userid"`
	LineId        string         `json:"lineid"`
	Ts            int64          `json:"ts"`
	LineNum       int64          `json:"linenum"`
	LineNumTemp   bool           `json:"linenumtemp,omitempty"`
	LineLocal     bool           `json:"linelocal"`
	LineType      string         `json:"linetype"`
	LineState     map[string]any `json:"linestate"`
	Renderer      string         `json:"renderer,omitempty"`
	Text          string         `json:"text,omitempty"`
	Ephemeral     bool           `json:"ephemeral,omitempty"`
	ContentHeight int64          `json:"contentheight,omitempty"`
	Star          bool           `json:"star,omitempty"`
	Archived      bool           `json:"archived,omitempty"`
	Remove        bool           `json:"remove,omitempty"`
}

func AddCmdLine

func AddCmdLine(ctx context.Context, screenId string, userId string, cmd *CmdType, renderer string, lineState map[string]any) (*LineType, error)

func AddCommentLine

func AddCommentLine(ctx context.Context, screenId string, userId string, commentText string) (*LineType, error)

func AddOpenAILine

func AddOpenAILine(ctx context.Context, screenId string, userId string, cmd *CmdType) (*LineType, error)

func GetLineById

func GetLineById(ctx context.Context, screenId string, lineId string) (*LineType, error)

can return nil, nil if line is not found

func (LineType) UseDBMap

func (LineType) UseDBMap()

type LineUpdate

type LineUpdate struct {
	Line LineType `json:"line"`
	Cmd  CmdType  `json:"cmd,omitempty"`
}

func (LineUpdate) GetType

func (LineUpdate) GetType() string

type OpenAIChoiceType

type OpenAIChoiceType struct {
	Text         string `json:"text"`
	Index        int    `json:"index"`
	FinishReason string `json:"finish_reason"`
}

type OpenAICmdInfoChatStore

type OpenAICmdInfoChatStore struct {
	MessageCount int                                `json:"messagecount"`
	Messages     []*packet.OpenAICmdInfoChatMessage `json:"messages"`
}

func ScreenMemDeepCopyCmdInfoChatStore

func ScreenMemDeepCopyCmdInfoChatStore(store *OpenAICmdInfoChatStore) *OpenAICmdInfoChatStore

func ScreenMemGetCmdInfoChat

func ScreenMemGetCmdInfoChat(screenId string) *OpenAICmdInfoChatStore

type OpenAICmdInfoChatUpdate

type OpenAICmdInfoChatUpdate []*packet.OpenAICmdInfoChatMessage

func (OpenAICmdInfoChatUpdate) GetType

func (OpenAICmdInfoChatUpdate) GetType() string

type OpenAIOptsType

type OpenAIOptsType struct {
	Model      string `json:"model"`
	APIToken   string `json:"apitoken"`
	BaseURL    string `json:"baseurl,omitempty"`
	MaxTokens  int    `json:"maxtokens,omitempty"`
	MaxChoices int    `json:"maxchoices,omitempty"`
	Timeout    int    `json:"timeout,omitempty"`
}

type OpenAIResponse

type OpenAIResponse struct {
	Model   string             `json:"model"`
	Created int64              `json:"created"`
	Usage   *OpenAIUsage       `json:"usage,omitempty"`
	Choices []OpenAIChoiceType `json:"choices,omitempty"`
}

type OpenAIUsage

type OpenAIUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

type PowerMonitorEventType

type PowerMonitorEventType struct {
	Status string `json:"status"`
}

type ReleaseInfoType

type ReleaseInfoType struct {
	LatestVersion string `json:"latestversion,omitempty"`
}

type RemoteEditType

type RemoteEditType struct {
	RemoteEdit  bool   `json:"remoteedit"`
	RemoteId    string `json:"remoteid,omitempty"`
	ErrorStr    string `json:"errorstr,omitempty"`
	InfoStr     string `json:"infostr,omitempty"`
	KeyStr      string `json:"keystr,omitempty"`
	HasPassword bool   `json:"haspassword,omitempty"`
}

type RemoteInstance

type RemoteInstance struct {
	RIId             string            `json:"riid"`
	Name             string            `json:"name"`
	SessionId        string            `json:"sessionid"`
	ScreenId         string            `json:"screenid"`
	RemoteOwnerId    string            `json:"remoteownerid"`
	RemoteId         string            `json:"remoteid"`
	FeState          map[string]string `json:"festate"`
	ShellType        string            `json:"shelltype"`
	StateBaseHash    string            `json:"-"`
	StateDiffHashArr []string          `json:"-"`

	// only for updates
	Remove bool `json:"remove,omitempty"`
}

func GetRIsForScreen

func GetRIsForScreen(ctx context.Context, sessionId string, screenId string) ([]*RemoteInstance, error)

func GetRemoteInstance

func GetRemoteInstance(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType) (*RemoteInstance, error)

func ScreenReset

func ScreenReset(ctx context.Context, screenId string) ([]*RemoteInstance, error)

returns riids of deleted RIs

func UpdateRemoteState

func UpdateRemoteState(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType, feState FeStateType, stateBase *packet.ShellState, stateDiff *packet.ShellStateDiff) (*RemoteInstance, error)

func (*RemoteInstance) FromMap

func (ri *RemoteInstance) FromMap(m map[string]interface{}) bool

func (*RemoteInstance) ToMap

func (ri *RemoteInstance) ToMap() map[string]interface{}

type RemoteOptsType

type RemoteOptsType struct {
	Color string `json:"color"`
}

type RemotePtrType

type RemotePtrType = scpacket.RemotePtrType

type RemoteRuntimeState

type RemoteRuntimeState struct {
	RemoteType            string            `json:"remotetype"`
	RemoteId              string            `json:"remoteid"`
	RemoteAlias           string            `json:"remotealias,omitempty"`
	RemoteCanonicalName   string            `json:"remotecanonicalname"`
	RemoteVars            map[string]string `json:"remotevars"`
	Status                string            `json:"status"`
	ConnectTimeout        int               `json:"connecttimeout,omitempty"`
	CountdownActive       bool              `json:"countdownactive"`
	ErrorStr              string            `json:"errorstr,omitempty"`
	InstallStatus         string            `json:"installstatus"`
	InstallErrorStr       string            `json:"installerrorstr,omitempty"`
	NeedsWaveshellUpgrade bool              `json:"needswaveshellupgrade,omitempty"`
	NoInitPk              bool              `json:"noinitpk,omitempty"`
	AuthType              string            `json:"authtype,omitempty"`
	ConnectMode           string            `json:"connectmode"`
	AutoInstall           bool              `json:"autoinstall"`
	Archived              bool              `json:"archived,omitempty"`
	RemoteIdx             int64             `json:"remoteidx"`
	SSHConfigSrc          string            `json:"sshconfigsrc"`
	UName                 string            `json:"uname"`
	WaveshellVersion      string            `json:"waveshellversion"`
	WaitingForPassword    bool              `json:"waitingforpassword,omitempty"`
	Local                 bool              `json:"local,omitempty"`
	IsSudo                bool              `json:"issudo,omitempty"`
	RemoteOpts            *RemoteOptsType   `json:"remoteopts,omitempty"`
	CanComplete           bool              `json:"cancomplete,omitempty"`
	ShellPref             string            `json:"shellpref,omitempty"`
	DefaultShellType      string            `json:"defaultshelltype,omitempty"`
}

func (RemoteRuntimeState) ExpandHomeDir

func (state RemoteRuntimeState) ExpandHomeDir(pathStr string) (string, error)

func (RemoteRuntimeState) GetBaseDisplayName

func (state RemoteRuntimeState) GetBaseDisplayName() string

func (RemoteRuntimeState) GetDisplayName

func (state RemoteRuntimeState) GetDisplayName(rptr *RemotePtrType) string

func (RemoteRuntimeState) GetType

func (RemoteRuntimeState) GetType() string

func (RemoteRuntimeState) IsConnected

func (state RemoteRuntimeState) IsConnected() bool

type RemoteType

type RemoteType struct {
	RemoteId            string          `json:"remoteid"`
	RemoteType          string          `json:"remotetype"`
	RemoteAlias         string          `json:"remotealias"`
	RemoteCanonicalName string          `json:"remotecanonicalname"`
	RemoteOpts          *RemoteOptsType `json:"remoteopts"`
	LastConnectTs       int64           `json:"lastconnectts"`
	RemoteIdx           int64           `json:"remoteidx"`
	Archived            bool            `json:"archived"`

	// SSH fields
	Local        bool              `json:"local"`
	RemoteUser   string            `json:"remoteuser"`
	RemoteHost   string            `json:"remotehost"`
	ConnectMode  string            `json:"connectmode"`
	AutoInstall  bool              `json:"autoinstall"`
	SSHOpts      *SSHOpts          `json:"sshopts"`
	StateVars    map[string]string `json:"statevars"`
	SSHConfigSrc string            `json:"sshconfigsrc"`
	ShellPref    string            `json:"shellpref"` // bash, zsh, or detect

	// OpenAI fields (unused)
	OpenAIOpts *OpenAIOptsType `json:"openaiopts,omitempty"`
}

func GetAllRemotes

func GetAllRemotes(ctx context.Context) ([]*RemoteType, error)

func GetLocalRemote

func GetLocalRemote(ctx context.Context) (*RemoteType, error)

func GetRemoteByAlias

func GetRemoteByAlias(ctx context.Context, alias string) (*RemoteType, error)

func GetRemoteByCanonicalName

func GetRemoteByCanonicalName(ctx context.Context, cname string) (*RemoteType, error)

func GetRemoteById

func GetRemoteById(ctx context.Context, remoteId string) (*RemoteType, error)

func UpdateRemote

func UpdateRemote(ctx context.Context, remoteId string, editMap map[string]interface{}) (*RemoteType, error)

editMap: alias, connectmode, autoinstall, sshkey, color, sshpassword (from constants) note that all validation should have already happened outside of this function

func (*RemoteType) FromMap

func (r *RemoteType) FromMap(m map[string]interface{}) bool

func (*RemoteType) GetName

func (r *RemoteType) GetName() string

func (*RemoteType) IsLocal

func (r *RemoteType) IsLocal() bool

func (*RemoteType) IsSudo

func (r *RemoteType) IsSudo() bool

func (*RemoteType) ToMap

func (r *RemoteType) ToMap() map[string]interface{}

type RemoteViewType

type RemoteViewType struct {
	RemoteShowAll bool            `json:"remoteshowall,omitempty"`
	PtyRemoteId   string          `json:"ptyremoteid,omitempty"`
	RemoteEdit    *RemoteEditType `json:"remoteedit,omitempty"`
}

func (RemoteViewType) GetType

func (RemoteViewType) GetType() string

type ResolveItem

type ResolveItem struct {
	Name   string
	Num    int
	Id     string
	Hidden bool
}

func GetLineResolveItems

func GetLineResolveItems(ctx context.Context, screenId string) ([]ResolveItem, error)

type SSHOpts

type SSHOpts struct {
	Local       bool   `json:"local,omitempty"`
	IsSudo      bool   `json:"issudo,omitempty"`
	SSHHost     string `json:"sshhost"`
	SSHUser     string `json:"sshuser"`
	SSHOptsStr  string `json:"sshopts,omitempty"`
	SSHIdentity string `json:"sshidentity,omitempty"`
	SSHPort     int    `json:"sshport,omitempty"`
	SSHPassword string `json:"sshpassword,omitempty"`
}

func (SSHOpts) GetAuthType

func (opts SSHOpts) GetAuthType() string

type ScreenAnchorType

type ScreenAnchorType struct {
	AnchorLine   int `json:"anchorline,omitempty"`
	AnchorOffset int `json:"anchoroffset,omitempty"`
}

type ScreenCreateOpts

type ScreenCreateOpts struct {
	BaseScreenId string
	CopyRemote   bool
	CopyCwd      bool
	CopyEnv      bool
	RtnScreenId  *string
}

func (ScreenCreateOpts) HasCopy

func (sco ScreenCreateOpts) HasCopy() bool

type ScreenLinesType

type ScreenLinesType struct {
	ScreenId string      `json:"screenid"`
	Lines    []*LineType `json:"lines" dbmap:"-"`
	Cmds     []*CmdType  `json:"cmds" dbmap:"-"`
}

func GetScreenLinesById

func GetScreenLinesById(ctx context.Context, screenId string) (*ScreenLinesType, error)

func (ScreenLinesType) GetType

func (ScreenLinesType) GetType() string

func (ScreenLinesType) UseDBMap

func (ScreenLinesType) UseDBMap()

type ScreenMemState

type ScreenMemState struct {
	NumRunningCommands int                     `json:"numrunningcommands,omitempty"`
	StatusIndicator    StatusIndicatorLevel    `json:"statusindicator,omitempty"`
	CmdInputText       utilfn.StrWithPos       `json:"cmdinputtext,omitempty"`
	CmdInputSeqNum     int                     `json:"cmdinputseqnum,omitempty"`
	AICmdInfoChat      *OpenAICmdInfoChatStore `json:"aicmdinfochat,omitempty"`
}

func GetScreenMemState

func GetScreenMemState(screenId string) *ScreenMemState

safe because we return a copy

type ScreenNumRunningCommandsType

type ScreenNumRunningCommandsType struct {
	ScreenId string `json:"screenid"`
	Num      int    `json:"num"`
}

func (ScreenNumRunningCommandsType) GetType

type ScreenOptsType

type ScreenOptsType struct {
	TabColor string `json:"tabcolor,omitempty"`
	TabIcon  string `json:"tabicon,omitempty"`
	PTerm    string `json:"pterm,omitempty"`
}

type ScreenSidebarOptsType

type ScreenSidebarOptsType struct {
	Open  bool   `json:"open,omitempty"`
	Width string `json:"width,omitempty"`

	// this used to be more complicated (sections with types).  simplified for this release
	SidebarLineId string `json:"sidebarlineid,omitempty"`
}

type ScreenStatusIndicatorType

type ScreenStatusIndicatorType struct {
	ScreenId string               `json:"screenid"`
	Status   StatusIndicatorLevel `json:"status"`
}

func (ScreenStatusIndicatorType) GetType

type ScreenTombstoneType

type ScreenTombstoneType struct {
	ScreenId   string         `json:"screenid"`
	SessionId  string         `json:"sessionid"`
	Name       string         `json:"name"`
	DeletedTs  int64          `json:"deletedts"`
	ScreenOpts ScreenOptsType `json:"screenopts"`
}

func (ScreenTombstoneType) GetType

func (ScreenTombstoneType) GetType() string

func (ScreenTombstoneType) UseDBMap

func (ScreenTombstoneType) UseDBMap()

type ScreenType

type ScreenType struct {
	SessionId      string              `json:"sessionid"`
	ScreenId       string              `json:"screenid"`
	Name           string              `json:"name"`
	ScreenIdx      int64               `json:"screenidx"`
	ScreenOpts     ScreenOptsType      `json:"screenopts"`
	ScreenViewOpts ScreenViewOptsType  `json:"screenviewopts"`
	OwnerId        string              `json:"ownerid"`
	ShareMode      string              `json:"sharemode"`
	WebShareOpts   *ScreenWebShareOpts `json:"webshareopts,omitempty"`
	CurRemote      RemotePtrType       `json:"curremote"`
	NextLineNum    int64               `json:"nextlinenum"`
	SelectedLine   int64               `json:"selectedline"`
	Anchor         ScreenAnchorType    `json:"anchor"`
	FocusType      string              `json:"focustype"`
	Archived       bool                `json:"archived,omitempty"`
	ArchivedTs     int64               `json:"archivedts,omitempty"`

	// only for updates
	Remove bool `json:"remove,omitempty"`
}

func FixupScreenSelectedLine

func FixupScreenSelectedLine(ctx context.Context, screenId string) (*ScreenType, error)

returns updated screen (only if updated)

func GetScreenById

func GetScreenById(ctx context.Context, screenId string) (*ScreenType, error)

func GetSessionScreens

func GetSessionScreens(ctx context.Context, sessionId string) ([]*ScreenType, error)

includes archived screens

func HangupCmd

func HangupCmd(ctx context.Context, ck base.CommandKey) (*ScreenType, error)

TODO send update

func HangupRunningCmdsByRemoteId

func HangupRunningCmdsByRemoteId(ctx context.Context, remoteId string) ([]*ScreenType, error)

TODO send update

func UpdateScreen

func UpdateScreen(ctx context.Context, screenId string, editMap map[string]interface{}) (*ScreenType, error)

func UpdateScreenFocusForDoneCmd

func UpdateScreenFocusForDoneCmd(ctx context.Context, screenId string, lineId string) (*ScreenType, error)

func (*ScreenType) FromMap

func (s *ScreenType) FromMap(m map[string]interface{}) bool

func (ScreenType) GetType

func (ScreenType) GetType() string

func (*ScreenType) ToMap

func (s *ScreenType) ToMap() map[string]interface{}

type ScreenUpdateType

type ScreenUpdateType struct {
	UpdateId   int64  `json:"updateid"`
	ScreenId   string `json:"screenid"`
	LineId     string `json:"lineid"`
	UpdateType string `json:"updatetype"`
	UpdateTs   int64  `json:"updatets"`
}

func GetScreenUpdates

func GetScreenUpdates(ctx context.Context, maxNum int) ([]*ScreenUpdateType, error)

func (ScreenUpdateType) UseDBMap

func (ScreenUpdateType) UseDBMap()

type ScreenViewOptsType

type ScreenViewOptsType struct {
	Sidebar *ScreenSidebarOptsType `json:"sidebar,omitempty"`
}

type ScreenWebShareOpts

type ScreenWebShareOpts struct {
	ShareName string `json:"sharename"`
	ViewKey   string `json:"viewkey"`
}

type SessionDiskSizeType

type SessionDiskSizeType struct {
	NumFiles   int
	TotalSize  int64
	ErrorCount int
	Location   string
}

func SessionDiskSize

func SessionDiskSize(sessionId string) (SessionDiskSizeType, error)

type SessionStatsType

type SessionStatsType struct {
	SessionId          string              `json:"sessionid"`
	NumScreens         int                 `json:"numscreens"`
	NumArchivedScreens int                 `json:"numarchivedscreens"`
	NumLines           int                 `json:"numlines"`
	NumCmds            int                 `json:"numcmds"`
	DiskStats          SessionDiskSizeType `json:"diskstats"`
}

func GetSessionStats

func GetSessionStats(ctx context.Context, sessionId string) (*SessionStatsType, error)

type SessionTombstoneType

type SessionTombstoneType struct {
	SessionId string `json:"sessionid"`
	Name      string `json:"name"`
	DeletedTs int64  `json:"deletedts"`
}

func (SessionTombstoneType) GetType

func (SessionTombstoneType) GetType() string

func (SessionTombstoneType) UseDBMap

func (SessionTombstoneType) UseDBMap()

type SessionType

type SessionType struct {
	SessionId      string            `json:"sessionid"`
	Name           string            `json:"name"`
	SessionIdx     int64             `json:"sessionidx"`
	ActiveScreenId string            `json:"activescreenid"`
	ShareMode      string            `json:"sharemode"`
	NotifyNum      int64             `json:"notifynum"`
	Archived       bool              `json:"archived,omitempty"`
	ArchivedTs     int64             `json:"archivedts,omitempty"`
	Remotes        []*RemoteInstance `json:"remotes"`

	// only for updates
	Remove bool `json:"remove,omitempty"`
}

func GetAllSessions

func GetAllSessions(ctx context.Context) ([]*SessionType, error)

Gets all sessions, including archived

func GetBareSessionById

func GetBareSessionById(ctx context.Context, sessionId string) (*SessionType, error)

func GetBareSessions

func GetBareSessions(ctx context.Context) ([]*SessionType, error)

includes archived sessions

func GetSessionById

func GetSessionById(ctx context.Context, id string) (*SessionType, error)

func GetSessionByName

func GetSessionByName(ctx context.Context, name string) (*SessionType, error)

func MakeSessionUpdateForRemote

func MakeSessionUpdateForRemote(sessionId string, ri *RemoteInstance) SessionType

func (SessionType) GetType

func (SessionType) GetType() string

type SidebarValueType

type SidebarValueType struct {
	Collapsed bool `json:"collapsed"`
	Width     int  `json:"width"`
}

type SingleConnDBGetter

type SingleConnDBGetter struct {
	SingleConnLock *sync.Mutex
}

func (*SingleConnDBGetter) GetDB

func (dbg *SingleConnDBGetter) GetDB(ctx context.Context) (*sqlx.DB, error)

func (*SingleConnDBGetter) ReleaseDB

func (dbg *SingleConnDBGetter) ReleaseDB(db *sqlx.DB)

type StateBase

type StateBase struct {
	BaseHash string
	Version  string
	Ts       int64
	Data     []byte
}

type StateDiff

type StateDiff struct {
	DiffHash    string
	Ts          int64
	BaseHash    string
	DiffHashArr []string
	Data        []byte
}

func (*StateDiff) FromMap

func (sd *StateDiff) FromMap(m map[string]interface{}) bool

func (*StateDiff) ToMap

func (sd *StateDiff) ToMap() map[string]interface{}

type StatusIndicatorLevel

type StatusIndicatorLevel int
const (
	StatusIndicatorLevel_None StatusIndicatorLevel = iota
	StatusIndicatorLevel_Output
	StatusIndicatorLevel_Success
	StatusIndicatorLevel_Error
)

func ScreenMemCombineIndicatorLevels

func ScreenMemCombineIndicatorLevels(screenId string, level StatusIndicatorLevel) StatusIndicatorLevel

If the new indicator level is higher than the current indicator, update the current indicator. Returns the new indicator level.

type TermOpts

type TermOpts struct {
	Rows       int64 `json:"rows"`
	Cols       int64 `json:"cols"`
	FlexRows   bool  `json:"flexrows,omitempty"`
	MaxPtySize int64 `json:"maxptysize,omitempty"`
}

func (*TermOpts) Scan

func (opts *TermOpts) Scan(val interface{}) error

func (TermOpts) Value

func (opts TermOpts) Value() (driver.Value, error)

type TxWrap

type TxWrap = txwrap.TxWrap

Jump to

Keyboard shortcuts

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