on main help sign in
feat: launch hyper beta (#2768)
a14feb3Andrey Nering
internal/agent/hyper/provider.go−14
@@ -10,7 +10,6 @@ import (
10 "log/slog"
10 "log/slog"
11 "net/http"
11 "net/http"
12 "os"
12 "os"
13− "strconv"
14 "sync"
13 "sync"
15 "time"
14 "time"
16
15
@@ -22,19 +21,6 @@ import (
22//go:embed provider.json
21//go:embed provider.json
23var embedded []byte
22var embedded []byte
24
23
25−// Enabled returns true if hyper is enabled.
26−var Enabled = sync.OnceValue(func() bool {
27− b, _ := strconv.ParseBool(
28− cmp.Or(
29− os.Getenv("HYPER"),
30− os.Getenv("HYPERCRUSH"),
31− os.Getenv("HYPER_ENABLE"),
32− os.Getenv("HYPER_ENABLED"),
33− ),
34− )
35− return b
36−})
37−
38// Embedded returns the embedded Hyper provider.
24// Embedded returns the embedded Hyper provider.
39var Embedded = sync.OnceValue(func() catwalk.Provider {
25var Embedded = sync.OnceValue(func() catwalk.Provider {
40 var provider catwalk.Provider
26 var provider catwalk.Provider
internal/cmd/login.go−4
@@ -9,7 +9,6 @@ import (
9
9
10 "charm.land/lipgloss/v2"
10 "charm.land/lipgloss/v2"
11 "github.com/atotto/clipboard"
11 "github.com/atotto/clipboard"
12− hyperp "github.com/charmbracelet/crush/internal/agent/hyper"
13 "github.com/charmbracelet/crush/internal/client"
12 "github.com/charmbracelet/crush/internal/client"
14 "github.com/charmbracelet/crush/internal/config"
13 "github.com/charmbracelet/crush/internal/config"
15 "github.com/charmbracelet/crush/internal/oauth"
14 "github.com/charmbracelet/crush/internal/oauth"
@@ -70,9 +69,6 @@ crush login copilot
70}
69}
71
70
72func loginHyper(c *client.Client, wsID string) error {
71func loginHyper(c *client.Client, wsID string) error {
73− if !hyperp.Enabled() {
74− return fmt.Errorf("hyper not enabled")
75− }
76 ctx := getLoginContext()
72 ctx := getLoginContext()
77
73
78 resp, err := hyper.InitiateDeviceAuth(ctx)
74 resp, err := hyper.InitiateDeviceAuth(ctx)
internal/config/provider.go+1−4
@@ -91,9 +91,6 @@ func UpdateProviders(pathOrURL string) error {
91
91
92// UpdateHyper updates the Hyper provider information from a specified URL.
92// UpdateHyper updates the Hyper provider information from a specified URL.
93func UpdateHyper(pathOrURL string) error {
93func UpdateHyper(pathOrURL string) error {
94− if !hyper.Enabled() {
95− return fmt.Errorf("hyper not enabled")
96− }
97 var provider catwalk.Provider
94 var provider catwalk.Provider
98 pathOrURL = cmp.Or(pathOrURL, hyper.BaseURL())
95 pathOrURL = cmp.Or(pathOrURL, hyper.BaseURL())
99
96
@@ -169,7 +166,7 @@ func Providers(cfg *Config) ([]catwalk.Provider, error) {
169 })
166 })
170
167
171 wg.Go(func() {
168 wg.Go(func() {
172− if customProvidersOnly || !hyper.Enabled() {
169+ if customProvidersOnly {
173 return
170 return
174 }
171 }
175 path := cachePathFor("hyper")
172 path := cachePathFor("hyper")