chore: rename coder -> primary

This commit is contained in:
adamdottv
2025-05-12 14:32:27 -05:00
parent c9b90dd184
commit 36e5ae804e
18 changed files with 56 additions and 55 deletions

View File

@@ -124,7 +124,7 @@ func (m *editorCmp) Init() tea.Cmd {
}
func (m *editorCmp) send() tea.Cmd {
if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
if m.app.PrimaryAgent.IsSessionBusy(m.session.ID) {
status.Warn("Agent is working, please wait...")
return nil
}
@@ -189,7 +189,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
if key.Matches(msg, editorMaps.OpenEditor) {
if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
if m.app.PrimaryAgent.IsSessionBusy(m.session.ID) {
status.Warn("Agent is working, please wait...")
return m, nil
}

View File

@@ -170,7 +170,7 @@ func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (m *messagesCmp) IsAgentWorking() bool {
return m.app.CoderAgent.IsSessionBusy(m.session.ID)
return m.app.PrimaryAgent.IsSessionBusy(m.session.ID)
}
func formatTimeDifference(unixTime1, unixTime2 int64) string {
@@ -376,7 +376,7 @@ func (m *messagesCmp) help() string {
text := ""
if m.app.CoderAgent.IsBusy() {
if m.app.PrimaryAgent.IsBusy() {
text += lipgloss.JoinHorizontal(
lipgloss.Left,
baseStyle.Foreground(t.TextMuted()).Bold(true).Render("press "),

View File

@@ -140,7 +140,7 @@ func formatTokensAndCost(tokens int64, contextWindow int64, cost float64) string
func (m statusCmp) View() string {
t := theme.CurrentTheme()
modelID := config.Get().Agents[config.AgentCoder].Model
modelID := config.Get().Agents[config.AgentPrimary].Model
model := models.SupportedModels[modelID]
// Initialize the help widget
@@ -283,7 +283,7 @@ func (m statusCmp) model() string {
cfg := config.Get()
coder, ok := cfg.Agents[config.AgentCoder]
coder, ok := cfg.Agents[config.AgentPrimary]
if !ok {
return "Unknown"
}

View File

@@ -283,7 +283,7 @@ func (m *modelDialogCmp) setupModels() {
func GetSelectedModel(cfg *config.Config) models.Model {
agentCfg := cfg.Agents[config.AgentCoder]
agentCfg := cfg.Agents[config.AgentPrimary]
selectedModelId := agentCfg.Model
return models.SupportedModels[selectedModelId]
}
@@ -325,7 +325,7 @@ func findProviderIndex(providers []models.ModelProvider, provider models.ModelPr
func (m *modelDialogCmp) setupModelsForProvider(provider models.ModelProvider) {
cfg := config.Get()
agentCfg := cfg.Agents[config.AgentCoder]
agentCfg := cfg.Agents[config.AgentPrimary]
selectedModelId := agentCfg.Model
m.provider = provider

View File

@@ -67,7 +67,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case dialog.CommandRunCustomMsg:
// Check if the agent is busy before executing custom commands
if p.app.CoderAgent.IsBusy() {
if p.app.PrimaryAgent.IsBusy() {
status.Warn("Agent is busy, please wait before executing a command...")
return p, nil
}
@@ -92,7 +92,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// Run compaction in background
go func(sessionID string) {
err := p.app.CoderAgent.CompactSession(context.Background(), sessionID)
err := p.app.PrimaryAgent.CompactSession(context.Background(), sessionID)
if err != nil {
status.Error(fmt.Sprintf("Compaction failed: %v", err))
} else {
@@ -113,7 +113,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if p.session.ID != "" {
// Cancel the current session's generation process
// This allows users to interrupt long-running operations
p.app.CoderAgent.Cancel(p.session.ID)
p.app.PrimaryAgent.Cancel(p.session.ID)
return p, nil
}
case key.Matches(msg, keyMap.ToggleTools):
@@ -158,7 +158,7 @@ func (p *chatPage) sendMessage(text string, attachments []message.Attachment) te
cmds = append(cmds, util.CmdHandler(chat.SessionSelectedMsg(newSession)))
}
_, err := p.app.CoderAgent.Run(context.Background(), p.session.ID, text, attachments...)
_, err := p.app.PrimaryAgent.Run(context.Background(), p.session.ID, text, attachments...)
if err != nil {
status.Error(err.Error())
return nil

View File

@@ -266,7 +266,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case dialog.ModelSelectedMsg:
a.showModelDialog = false
model, err := a.app.CoderAgent.Update(config.AgentCoder, msg.Model.ID)
model, err := a.app.PrimaryAgent.Update(config.AgentPrimary, msg.Model.ID)
if err != nil {
status.Error(err.Error())
return a, nil
@@ -460,7 +460,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.showHelp = !a.showHelp
return a, nil
case key.Matches(msg, helpEsc):
if a.app.CoderAgent.IsBusy() {
if a.app.PrimaryAgent.IsBusy() {
if a.showQuit {
return a, nil
}
@@ -574,7 +574,7 @@ func (a *appModel) RegisterCommand(cmd dialog.Command) {
func (a *appModel) moveToPage(pageID page.PageID) tea.Cmd {
// Allow navigating to logs page even when agent is busy
if a.app.CoderAgent.IsBusy() && pageID != page.LogsPage {
if a.app.PrimaryAgent.IsBusy() && pageID != page.LogsPage {
// Don't move to other pages if the agent is busy
status.Warn("Agent is busy, please wait...")
return nil
@@ -641,7 +641,7 @@ func (a appModel) View() string {
}
if !a.app.CoderAgent.IsBusy() {
if !a.app.PrimaryAgent.IsBusy() {
a.status.SetHelpWidgetMsg("ctrl+? help")
} else {
a.status.SetHelpWidgetMsg("? help")
@@ -658,7 +658,7 @@ func (a appModel) View() string {
if a.currentPage == page.LogsPage {
bindings = append(bindings, logsKeyReturnKey)
}
if !a.app.CoderAgent.IsBusy() {
if !a.app.PrimaryAgent.IsBusy() {
bindings = append(bindings, helpEsc)
}
a.help.SetBindings(bindings)