Skip to content

Commit be8e5fe

Browse files
committed
refactor: rename internal/gateway/client -> internal/cloudclient
The package is the hosted Cloud API side-channel client (websearch/webfetch/ advisor/BYOK over /v1/*), not a gateway runtime. Reserve internal/gateway/ for the real self-hostable gateway. Updates the two importers (provider/byok.go, provider/wire.go) and the guard-test path assertion; no behavior change, no new dependencies.
1 parent d4b87f6 commit be8e5fe

7 files changed

Lines changed: 20 additions & 20 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package client
1+
package cloudclient
22

33
// BYOK key management — the /v1/byok surface. Plain JSON calls (not
44
// turn-shaped): list is read-only metadata, put/delete/validate are explicit
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// Package client is the CLI's HTTP client for the memcode gateway's
1+
// Package cloudclient is the CLI's HTTP client for the memcode gateway's
22
// SIDE-CHANNEL surfaces: /v1/advisor, /v1/websearch, /v1/webfetch, and the
33
// /v1/byok key-management routes. The TURN wire lives elsewhere — the shared
44
// providers/memcode transport (OpenAI-compat + the memcode extensions). Every
55
// call here rides requestWithRetry (Cloud Run cold-start 5xx / 429 / transient
66
// net errors), with SetRetryNotify surfacing "⊙ retrying…" in the TUI.
7-
package client
7+
package cloudclient
88

99
import (
1010
"bytes"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package client
1+
package cloudclient
22

33
// The side-channel retry contract: every advisor/websearch/byok call rides
44
// requestWithRetry — a Cloud Run cold-start 5xx retries (with the notify
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package client
1+
package cloudclient
22

33
import (
44
"context"

‎internal/guard/guard_test.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ func TestCatalogIsStdlibOnly(t *testing.T) {
6767
// chrome), the transport layer is leaking upward.
6868
func TestSideChannelClientStaysThin(t *testing.T) {
6969
allowed := map[string]bool{
70-
modulePrefix + "/internal/gateway/client": true,
71-
modulePrefix + "/internal/wire": true,
72-
modulePrefix + "/catalog": true,
70+
modulePrefix + "/internal/cloudclient": true,
71+
modulePrefix + "/internal/wire": true,
72+
modulePrefix + "/catalog": true,
7373
}
74-
for _, p := range deps(t, modulePrefix+"/internal/gateway/client") {
74+
for _, p := range deps(t, modulePrefix+"/internal/cloudclient") {
7575
if isStdlib(p) || allowed[p] {
7676
continue
7777
}
78-
t.Errorf("internal/gateway/client must stay thin (stdlib + wire/catalog), but depends on %q", p)
78+
t.Errorf("internal/cloudclient must stay thin (stdlib + wire/catalog), but depends on %q", p)
7979
}
8080
}
8181

‎internal/provider/byok.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ import (
99
"context"
1010
"os"
1111

12-
"github.com/memcode-ai/memcode/internal/gateway/client"
12+
"github.com/memcode-ai/memcode/internal/cloudclient"
1313
)
1414

15-
func byokClient() (*client.Client, error) {
15+
func byokClient() (*cloudclient.Client, error) {
1616
if os.Getenv(EnvAPIToken) == "" {
1717
return nil, ErrNotLoggedIn
1818
}
19-
return client.New(APIURL(), os.Getenv(EnvAPIToken)), nil
19+
return cloudclient.New(APIURL(), os.Getenv(EnvAPIToken)), nil
2020
}
2121

2222
// ByokList fetches the provider roster + the user's masked key rows.
23-
func ByokList(ctx context.Context) (client.ByokKeys, error) {
23+
func ByokList(ctx context.Context) (cloudclient.ByokKeys, error) {
2424
c, err := byokClient()
2525
if err != nil {
26-
return client.ByokKeys{}, err
26+
return cloudclient.ByokKeys{}, err
2727
}
2828
return c.ByokList(ctx)
2929
}
3030

3131
// ByokPut stores/replaces the user's key for a provider (gateway live-probes
3232
// it first). The caller is responsible for redacting the key from any UI/log
3333
// surfaces BEFORE calling.
34-
func ByokPut(ctx context.Context, providerID, key string) (client.ByokPutResult, error) {
34+
func ByokPut(ctx context.Context, providerID, key string) (cloudclient.ByokPutResult, error) {
3535
c, err := byokClient()
3636
if err != nil {
37-
return client.ByokPutResult{}, err
37+
return cloudclient.ByokPutResult{}, err
3838
}
3939
return c.ByokPut(ctx, providerID, key)
4040
}

‎internal/provider/wire.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
"fmt"
1616
"time"
1717

18+
"github.com/memcode-ai/memcode/internal/cloudclient"
1819
"github.com/memcode-ai/memcode/internal/doctrine"
19-
"github.com/memcode-ai/memcode/internal/gateway/client"
2020
compat "github.com/memcode-ai/memcode/internal/providers/compat"
2121
memcodeprov "github.com/memcode-ai/memcode/internal/providers/memcode"
2222
"github.com/memcode-ai/memcode/internal/wire"
@@ -49,7 +49,7 @@ type turnTransport interface {
4949
// already degrade on error).
5050
type conn struct {
5151
turn turnTransport
52-
side *client.Client
52+
side *cloudclient.Client
5353
ep *Endpoint // non-nil = arbitrary-endpoint mode (no memcode backend)
5454
}
5555

@@ -63,7 +63,7 @@ func dial(url, token string) *conn {
6363
Token: token,
6464
Compose: composeDoctrine,
6565
}),
66-
side: client.New(url, token),
66+
side: cloudclient.New(url, token),
6767
}
6868
}
6969

0 commit comments

Comments
 (0)