Skip to content

Commit ceab930

Browse files
authored
Update livekit-cli to use shared cloudagents client (#710)
* update livekit-cli to use shared cloudagents client * refactor detect project * update release section with clearer instruction * generate dockerignore * bumping up the minor version to match server-sdk-go * increment version to stable server-sdk-go version
1 parent 87eb842 commit ceab930

File tree

13 files changed

+250
-1691
lines changed

13 files changed

+250
-1691
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,17 @@ lk token create --join \
472472
--room "room-%x"
473473
```
474474
475+
# Release
476+
477+
This project shares the same **Major** and **minor** version as [`server-sdk-go`](https://github.com/livekit/server-sdk-go) for compatibility. The `livekit-cli` must always import `server-sdk-go` with matching **major** and **minor** versions. When introducing breaking changes to `server-sdk-go`, increment its **minor** version and update `livekit-cli` to use the new version, releasing a matching CLI version accordingly.
478+
479+
valid | livekit-cli | server-sdk-go | server constraint | explanation
480+
--- | --- | --- | --- | ---
481+
✅ | 2.2.2 | 2.2.0 | >= 2.2.0 | minor/major version match
482+
❌ | 2.3.2 | 2.2.2 | >= 2.2.0 | minor version ahead
483+
❌ | 3.2.2 | 2.2.2 | >= 2.2.0 | major version ahead
484+
❌ | 2.2.2 | 2.3.2 | >= 2.3.0 | minor version behind
485+
475486
<!--BEGIN_REPO_NAV-->
476487
<br/><table>
477488
<thead><tr><th colspan="2">LiveKit Ecosystem</th></tr></thead>

cmd/lk/agent.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/livekit/livekit-cli/v2/pkg/util"
3636
lkproto "github.com/livekit/protocol/livekit"
3737
"github.com/livekit/protocol/logger"
38+
"github.com/livekit/server-sdk-go/v2/pkg/cloudagents"
3839
)
3940

4041
const (
@@ -333,7 +334,7 @@ var (
333334
},
334335
}
335336
subdomainPattern = regexp.MustCompile(`^(?:https?|wss?)://([^.]+)\.`)
336-
agentsClient *agentfs.Client
337+
agentsClient *cloudagents.Client
337338
ignoredSecrets = []string{
338339
"LIVEKIT_API_KEY",
339340
"LIVEKIT_API_SECRET",
@@ -373,7 +374,7 @@ func createAgentClientWithOpts(ctx context.Context, cmd *cli.Command, opts ...lo
373374
}
374375
}
375376

376-
agentsClient, err = agentfs.New(agentfs.WithProject(project.URL, project.APIKey, project.APISecret))
377+
agentsClient, err = cloudagents.New(cloudagents.WithProject(project.URL, project.APIKey, project.APISecret))
377378
if err != nil {
378379
return ctx, err
379380
}
@@ -493,7 +494,7 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
493494
}
494495
var err error
495496
// Recreate the client with the new project
496-
agentsClient, err = agentfs.New(agentfs.WithProject(project.URL, project.APIKey, project.APISecret))
497+
agentsClient, err = cloudagents.New(cloudagents.WithProject(project.URL, project.APIKey, project.APISecret))
497498
if err != nil {
498499
return err
499500
}
@@ -1285,6 +1286,11 @@ func requireDockerfile(ctx context.Context, cmd *cli.Command, workingDir string,
12851286
return err
12861287
}
12871288

1289+
dockerIgnoreExists, err := agentfs.HasDockerIgnore(workingDir)
1290+
if err != nil {
1291+
return err
1292+
}
1293+
12881294
if !dockerfileExists {
12891295
if !cmd.Bool("silent") {
12901296
err := util.Await(
@@ -1309,6 +1315,20 @@ func requireDockerfile(ctx context.Context, cmd *cli.Command, workingDir string,
13091315
}
13101316
}
13111317

1318+
if !dockerIgnoreExists {
1319+
if !cmd.Bool("silent") {
1320+
fmt.Println("Creating .dockerignore...")
1321+
}
1322+
if err := agentfs.CreateDockerIgnoreFile(workingDir, projectType); err != nil {
1323+
return err
1324+
}
1325+
fmt.Println("Created [" + util.Accented(".dockerignore") + "]")
1326+
} else {
1327+
if !cmd.Bool("silent") {
1328+
fmt.Println("Using existing .dockerignore")
1329+
}
1330+
}
1331+
13121332
return nil
13131333
}
13141334

go.mod

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,28 @@ require (
1212
github.com/go-logr/logr v1.4.3
1313
github.com/go-task/task/v3 v3.44.1
1414
github.com/joho/godotenv v1.5.1
15-
github.com/livekit/protocol v1.42.1-0.20251014173106-16ec4db9f66a
16-
github.com/livekit/server-sdk-go/v2 v2.11.4-0.20251009161714-f90dc6f3d8bb
17-
github.com/moby/buildkit v0.23.2
15+
github.com/livekit/protocol v1.42.2-0.20251016024155-8cf58ff15ac6
16+
github.com/livekit/server-sdk-go/v2 v2.12.1
1817
github.com/moby/patternmatcher v0.6.0
18+
github.com/pelletier/go-toml v1.9.5
1919
github.com/pion/rtcp v1.2.15
20-
github.com/pion/rtp v1.8.22
21-
github.com/pion/webrtc/v4 v4.1.5-0.20250828044558-c376d0edf977
20+
github.com/pion/rtp v1.8.23
21+
github.com/pion/webrtc/v4 v4.1.6
2222
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
2323
github.com/pkg/errors v0.9.1
24-
github.com/schollz/progressbar/v3 v3.18.0
2524
github.com/stretchr/testify v1.11.1
2625
github.com/twitchtv/twirp v8.1.3+incompatible
2726
github.com/urfave/cli/v3 v3.4.1
2827
go.uber.org/atomic v1.11.0
2928
golang.org/x/sync v0.17.0
3029
golang.org/x/time v0.12.0
31-
google.golang.org/protobuf v1.36.9
30+
google.golang.org/protobuf v1.36.10
3231
gopkg.in/yaml.v3 v3.0.1
3332
k8s.io/apimachinery v0.33.4
3433
)
3534

3635
require (
37-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.9-20250912141014-52f32327d4b0.1 // indirect
36+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 // indirect
3837
buf.build/go/protovalidate v1.0.0 // indirect
3938
buf.build/go/protoyaml v0.6.0 // indirect
4039
cel.dev/expr v0.24.0 // indirect
@@ -43,7 +42,6 @@ require (
4342
github.com/Microsoft/go-winio v0.6.2 // indirect
4443
github.com/ProtonMail/go-crypto v1.3.0 // indirect
4544
github.com/alecthomas/chroma/v2 v2.19.0 // indirect
46-
github.com/anchore/go-struct-converter v0.0.0-20230627203149-c72ef8859ca9 // indirect
4745
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
4846
github.com/atotto/clipboard v0.1.4 // indirect
4947
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
@@ -63,7 +61,7 @@ require (
6361
github.com/cloudflare/circl v1.6.1 // indirect
6462
github.com/containerd/console v1.0.5 // indirect
6563
github.com/containerd/containerd/api v1.9.0 // indirect
66-
github.com/containerd/containerd/v2 v2.1.3 // indirect
64+
github.com/containerd/containerd/v2 v2.1.4 // indirect
6765
github.com/containerd/continuity v0.4.5 // indirect
6866
github.com/containerd/errdefs v1.0.0 // indirect
6967
github.com/containerd/errdefs/pkg v0.3.0 // indirect
@@ -94,7 +92,6 @@ require (
9492
github.com/go-logr/stdr v1.2.2 // indirect
9593
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
9694
github.com/go-task/template v0.2.0 // indirect
97-
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
9895
github.com/gofrs/flock v0.12.1 // indirect
9996
github.com/gogo/protobuf v1.3.2 // indirect
10097
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
@@ -105,9 +102,7 @@ require (
105102
github.com/google/uuid v1.6.0 // indirect
106103
github.com/gorilla/websocket v1.5.3 // indirect
107104
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect
108-
github.com/hashicorp/errwrap v1.1.0 // indirect
109105
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
110-
github.com/hashicorp/go-multierror v1.1.1 // indirect
111106
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
112107
github.com/in-toto/in-toto-golang v0.9.0 // indirect
113108
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -125,33 +120,32 @@ require (
125120
github.com/mattn/go-isatty v0.0.20 // indirect
126121
github.com/mattn/go-localereader v0.0.1 // indirect
127122
github.com/mattn/go-runewidth v0.0.16 // indirect
128-
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
129123
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
124+
github.com/moby/buildkit v0.25.1 // indirect
130125
github.com/moby/locker v1.0.1 // indirect
131126
github.com/moby/sys/signal v0.7.1 // indirect
132127
github.com/morikuni/aec v1.0.0 // indirect
133128
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
134129
github.com/muesli/cancelreader v0.2.2 // indirect
135130
github.com/muesli/termenv v0.16.0 // indirect
136131
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
137-
github.com/nats-io/nats.go v1.46.0 // indirect
132+
github.com/nats-io/nats.go v1.47.0 // indirect
138133
github.com/nats-io/nkeys v0.4.11 // indirect
139134
github.com/nats-io/nuid v1.0.1 // indirect
140135
github.com/opencontainers/go-digest v1.0.0 // indirect
141136
github.com/opencontainers/image-spec v1.1.1 // indirect
142-
github.com/opencontainers/runc v1.2.3 // indirect
143137
github.com/pion/datachannel v1.5.10 // indirect
144138
github.com/pion/dtls/v3 v3.0.7 // indirect
145139
github.com/pion/ice/v4 v4.0.10 // indirect
146140
github.com/pion/interceptor v0.1.41 // indirect
147141
github.com/pion/logging v0.2.4 // indirect
148142
github.com/pion/mdns/v2 v2.0.7 // indirect
149143
github.com/pion/randutil v0.1.0 // indirect
150-
github.com/pion/sctp v1.8.39 // indirect
144+
github.com/pion/sctp v1.8.40 // indirect
151145
github.com/pion/sdp/v3 v3.0.16 // indirect
152-
github.com/pion/srtp/v3 v3.0.7 // indirect
146+
github.com/pion/srtp/v3 v3.0.8 // indirect
153147
github.com/pion/stun/v3 v3.0.0 // indirect
154-
github.com/pion/transport/v3 v3.0.7 // indirect
148+
github.com/pion/transport/v3 v3.0.8 // indirect
155149
github.com/pion/turn/v4 v4.1.1 // indirect
156150
github.com/pjbgf/sha1cd v0.4.0 // indirect
157151
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
@@ -182,7 +176,7 @@ require (
182176
github.com/zeebo/xxh3 v1.0.2 // indirect
183177
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
184178
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
185-
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 // indirect
179+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 // indirect
186180
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
187181
go.opentelemetry.io/otel v1.37.0 // indirect
188182
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
@@ -193,16 +187,16 @@ require (
193187
go.uber.org/multierr v1.11.0 // indirect
194188
go.uber.org/zap v1.27.0 // indirect
195189
go.uber.org/zap/exp v0.3.0 // indirect
196-
golang.org/x/crypto v0.42.0 // indirect
197-
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
198-
golang.org/x/mod v0.28.0 // indirect
199-
golang.org/x/net v0.44.0 // indirect
200-
golang.org/x/sys v0.36.0 // indirect
201-
golang.org/x/term v0.35.0 // indirect
202-
golang.org/x/text v0.29.0 // indirect
203-
google.golang.org/genproto/googleapis/api v0.0.0-20250922171735-9219d122eba9 // indirect
204-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250922171735-9219d122eba9 // indirect
205-
google.golang.org/grpc v1.75.1 // indirect
190+
golang.org/x/crypto v0.43.0 // indirect
191+
golang.org/x/exp v0.0.0-20251009144603-d2f985daa21b // indirect
192+
golang.org/x/mod v0.29.0 // indirect
193+
golang.org/x/net v0.46.0 // indirect
194+
golang.org/x/sys v0.37.0 // indirect
195+
golang.org/x/term v0.36.0 // indirect
196+
golang.org/x/text v0.30.0 // indirect
197+
google.golang.org/genproto/googleapis/api v0.0.0-20251014184007-4626949a642f // indirect
198+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251014184007-4626949a642f // indirect
199+
google.golang.org/grpc v1.76.0 // indirect
206200
gopkg.in/inf.v0 v0.9.1 // indirect
207201
gopkg.in/warnings.v0 v0.1.2 // indirect
208202
mvdan.cc/sh/v3 v3.12.0 // indirect

0 commit comments

Comments
 (0)