mirror of
https://github.com/theniceboy/.config.git
synced 2026-07-16 22:01:21 +08:00
agent tracker + tmux updates
This commit is contained in:
parent
ba2c8ef54e
commit
75403c927f
5 changed files with 67 additions and 17 deletions
|
|
@ -15,14 +15,14 @@
|
|||
"help": "?",
|
||||
"focus_ai": "M-a",
|
||||
"focus_git": "M-g",
|
||||
"focus_dashboard": "M-s",
|
||||
"focus_run": "M-r"
|
||||
},
|
||||
"devices": [
|
||||
"web-server",
|
||||
"ipm",
|
||||
"opm",
|
||||
"macos"
|
||||
"macos",
|
||||
"ipp"
|
||||
],
|
||||
"status_right": {
|
||||
"cpu": false,
|
||||
|
|
|
|||
|
|
@ -1339,15 +1339,24 @@ func activeAgentWindowID(record *agentRecord) string {
|
|||
return windowID
|
||||
}
|
||||
|
||||
func launchAgentLayout(record *agentRecord) error {
|
||||
func launchAgentLayout(record *agentRecord) (err error) {
|
||||
previousWindowID := currentTmuxWindowID()
|
||||
cleanupWindow := false
|
||||
windowID := ""
|
||||
windowID, sessionID, sessionName, attachAfter, err := createWindow(record.Name, record.RepoCopyPath, record.LaunchWindowID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := runTmux("select-window", "-t", windowID); err != nil {
|
||||
return err
|
||||
}
|
||||
cleanupWindow = true
|
||||
defer func() {
|
||||
if err == nil || !cleanupWindow || strings.TrimSpace(windowID) == "" {
|
||||
return
|
||||
}
|
||||
_ = runTmux("kill-window", "-t", windowID)
|
||||
if strings.TrimSpace(previousWindowID) != "" {
|
||||
_ = runTmux("select-window", "-t", previousWindowID)
|
||||
}
|
||||
}()
|
||||
topPane, err := currentPane(windowID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -1400,12 +1409,20 @@ func launchAgentLayout(record *agentRecord) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if attachAfter && canAttachTmux() {
|
||||
if err := runTmux("attach-session", "-t", sessionID); err != nil {
|
||||
return err
|
||||
}
|
||||
cleanupWindow = false
|
||||
return nil
|
||||
}
|
||||
if err := runTmux("select-window", "-t", windowID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := runTmux("select-pane", "-t", aiPane); err != nil {
|
||||
return err
|
||||
}
|
||||
if attachAfter && canAttachTmux() {
|
||||
return runTmux("attach-session", "-t", sessionID)
|
||||
}
|
||||
cleanupWindow = false
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue