Skip to content

Commit a430cc3

Browse files
committed
refactor: rename agent mode to runner mode
Rename "agent" terminology to "runner" throughout the codebase to better reflect its purpose. Backward compatibility is maintained by mapping the `sling agent` CLI command to `sling runner` and falling back to the `SLING_AGENT_ID` environment variable if `SLING_RUNNER_ID` is not set.
1 parent 51d23ce commit a430cc3

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

cmd/sling/sling_cli.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,16 @@ func cliInit(done chan struct{}) int {
579579
flaggy.AttachSubcommand(cli.Sc, 1)
580580
}
581581

582-
// patch 'sling mcp' into 'sling serve mcp' for backwards compatibility
583-
if len(os.Args) >= 2 && os.Args[1] == "mcp" {
582+
// patch subcommands for backwards compatibility
583+
switch {
584+
// 'sling mcp' into 'sling serve mcp'
585+
case len(os.Args) >= 2 && os.Args[1] == "mcp":
584586
os.Args = append([]string{os.Args[0], "serve"}, os.Args[1:]...)
587+
// 'sling agent' into 'sling runner'
588+
case len(os.Args) == 2 && os.Args[1] == "agent":
589+
os.Args = []string{os.Args[0], "runner"}
590+
case len(os.Args) > 2 && os.Args[1] == "agent":
591+
os.Args = append([]string{os.Args[0], "runner"}, os.Args[2:]...)
585592
}
586593

587594
flaggy.ShowHelpOnUnexpectedDisable()

core/dbio/api/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,9 @@ func (a *AuthenticatorOAuth2) Authenticate(ctx context.Context, state *APIStateA
460460
g.Warn("Stored refresh token invalid, falling back to authentication")
461461
}
462462

463-
// if agent mode and not client_credentials, use frontend to auth.
463+
// if agent/runner mode and not client_credentials, use frontend to auth.
464464
// client_credentials doesn't need browser
465-
if env.IsAgentMode && a.Flow != OAuthFlowClientCredentials {
465+
if env.IsRunnerMode && a.Flow != OAuthFlowClientCredentials {
466466
if storedTok != nil {
467467
return g.Error("Stored refresh token is invalid. Need to re-authenticate. Please use the 'Connections' panel in the Platform UI.")
468468
}

core/env/env.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ var (
3939
Executable = ""
4040
IsThreadChild = cast.ToBool(os.Getenv("SLING_THREAD_CHILD"))
4141
ExecID = g.Getenv("SLING_EXEC_ID", NewExecID())
42-
AgentID = os.Getenv("SLING_AGENT_ID")
43-
IsAgentMode = AgentID != ""
42+
RunnerID = g.Getenv("SLING_RUNNER_ID", os.Getenv("SLING_AGENT_ID"))
43+
IsRunnerMode = RunnerID != ""
4444

4545
// File logging
4646
debugLogFile *os.File

core/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var TelProps = g.M(
2222
func init() {
2323
// dev build version is in format => 1.2.2.dev/2024-08-20
2424
parts := strings.Split(Version, "/")
25-
if len(parts) != 2 || os.Getenv("SLING_AGENT_ID") != "" || os.Getenv("SLING_AGENT_KEY") != "" {
25+
if len(parts) != 2 || os.Getenv("SLING_AGENT_ID") != "" || os.Getenv("SLING_AGENT_KEY") != "" || os.Getenv("SLING_RUNNER_ID") != "" || os.Getenv("SLING_RUNNER_KEY") != "" {
2626
return
2727
}
2828

0 commit comments

Comments
 (0)