Merge pull request 'chore: Go 1.26 modernization' (#1) from chore/go-1.26-modernization into main
This commit is contained in:
commit
172c1cc724
4 changed files with 10 additions and 10 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package agent
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -8,9 +9,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
agentic "forge.lthn.ai/core/go-agentic"
|
||||
"forge.lthn.ai/core/go-scm/agentci"
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go/pkg/config"
|
||||
)
|
||||
|
||||
|
|
@ -299,7 +300,7 @@ func agentSetupCmd() *cli.Command {
|
|||
// Find the setup script relative to the binary or in known locations.
|
||||
scriptPath := findSetupScript()
|
||||
if scriptPath == "" {
|
||||
return fmt.Errorf("agent-setup.sh not found — expected in scripts/ directory")
|
||||
return errors.New("agent-setup.sh not found — expected in scripts/ directory")
|
||||
}
|
||||
|
||||
fmt.Printf("Setting up %s on %s...\n", name, ac.Host)
|
||||
|
|
|
|||
|
|
@ -35,10 +35,7 @@ func executeWithRateLimit(ctx context.Context, model, prompt string, runner func
|
|||
success, exitCode, runErr := runner()
|
||||
|
||||
// Record usage with conservative output estimate (actual tokens unknown from shell runner).
|
||||
outputEst := estTokens / 10
|
||||
if outputEst < 50 {
|
||||
outputEst = 50
|
||||
}
|
||||
outputEst := max(estTokens/10, 50)
|
||||
rl.RecordUsage(model, estTokens, outputEst)
|
||||
|
||||
if err := rl.Persist(); err != nil {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package agent
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
|
||||
|
|
@ -123,7 +124,7 @@ func SaveAgent(cfg *config.Config, name string, ac AgentConfig) error {
|
|||
func RemoveAgent(cfg *config.Config, name string) error {
|
||||
var agents map[string]AgentConfig
|
||||
if err := cfg.Get("agentci.agents", &agents); err != nil {
|
||||
return fmt.Errorf("agentci.RemoveAgent: no agents configured")
|
||||
return errors.New("agentci.RemoveAgent: no agents configured")
|
||||
}
|
||||
if _, ok := agents[name]; !ok {
|
||||
return fmt.Errorf("agentci.RemoveAgent: agent %q not found", name)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package jobrunner
|
|||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"iter"
|
||||
"os"
|
||||
|
|
@ -54,7 +55,7 @@ type Journal struct {
|
|||
// NewJournal creates a new Journal rooted at baseDir.
|
||||
func NewJournal(baseDir string) (*Journal, error) {
|
||||
if baseDir == "" {
|
||||
return nil, fmt.Errorf("journal.NewJournal: base directory is required")
|
||||
return nil, errors.New("journal.NewJournal: base directory is required")
|
||||
}
|
||||
return &Journal{baseDir: baseDir}, nil
|
||||
}
|
||||
|
|
@ -121,10 +122,10 @@ func (j *Journal) ReadEntries(path string) iter.Seq2[JournalEntry, error] {
|
|||
// Append writes a journal entry for the given signal and result.
|
||||
func (j *Journal) Append(signal *PipelineSignal, result *ActionResult) error {
|
||||
if signal == nil {
|
||||
return fmt.Errorf("journal.Append: signal is required")
|
||||
return errors.New("journal.Append: signal is required")
|
||||
}
|
||||
if result == nil {
|
||||
return fmt.Errorf("journal.Append: result is required")
|
||||
return errors.New("journal.Append: result is required")
|
||||
}
|
||||
|
||||
entry := JournalEntry{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue