Skip to content

Commit cb655a5

Browse files
authored
Adding a session-sharing-url param (#46)
1 parent 8dbc3a8 commit cb655a5

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

internal/worker/worker.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ type Config struct {
3737
// IdleOnComplete is passed to the oz CLI's --idle-on-complete flag for every task.
3838
// Empty string means use the oz CLI default (45m). Use "0s" to disable idle.
3939
IdleOnComplete string
40+
// SessionSharingServerURL, when non-empty, is forwarded to the oz CLI via --session-sharing-server-url.
41+
SessionSharingServerURL string
4042

4143
// Backend-specific configs. Only the one matching BackendType should be set.
4244
Docker *DockerBackendConfig
@@ -376,8 +378,11 @@ func (w *Worker) prepareTaskParams(assignment *types.TaskAssignmentMessage) *Tas
376378
baseArgs = common.AugmentArgsForTask(task, baseArgs, common.TaskAugmentOptions{
377379
IdleOnComplete: w.config.IdleOnComplete,
378380
})
381+
if w.config.SessionSharingServerURL != "" {
382+
baseArgs = append(baseArgs, "--session-sharing-server-url", w.config.SessionSharingServerURL)
383+
}
379384

380-
// Build a unified sidecar list: the Warp agent sidecar (mounted at /agent, where
385+
// Build a unified sidecar list:
381386
// entrypoint.sh lives) comes first, followed by any additional sidecars.
382387
var sidecars []types.SidecarMount
383388
if assignment.SidecarImage != "" {

main.go

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ import (
2020
)
2121

2222
var CLI struct {
23-
ConfigFile string `help:"Path to YAML config file" type:"path"`
24-
Backend string `help:"Backend type (docker, direct, or kubernetes)" enum:"docker,direct,kubernetes," default:""`
25-
APIKey string `help:"API key for authentication" env:"WARP_API_KEY" required:""`
26-
WorkerID string `help:"Worker host identifier (required via flag or config file)"`
27-
WebSocketURL string `default:"wss://oz.warp.dev/api/v1/selfhosted/worker/ws" hidden:""`
28-
ServerRootURL string `default:"https://app.warp.dev" hidden:""`
29-
LogLevel string `help:"Log level (debug, info, warn, error)" default:"info" enum:"debug,info,warn,error"`
30-
TargetDir string `help:"Run all tasks in this directory instead of creating per-task workspaces (direct backend only)"`
31-
NoCleanup bool `help:"Do not remove containers after execution (for debugging)"`
32-
Volumes []string `help:"Volume mounts for task containers (format: HOST_PATH:CONTAINER_PATH or HOST_PATH:CONTAINER_PATH:MODE)" short:"v"`
33-
Env []string `help:"Environment variables for task containers (format: KEY=VALUE or KEY to pass through from host)" short:"e"`
34-
MaxConcurrentTasks int `help:"Maximum number of tasks to run concurrently (0 for unlimited)" default:"0"`
35-
IdleOnComplete string `help:"How long to keep the oz agent alive after a task completes, for follow-ups (e.g. 45m, 10m, 0s). Defaults to 45m when not set."`
23+
ConfigFile string `help:"Path to YAML config file" type:"path"`
24+
Backend string `help:"Backend type (docker, direct, or kubernetes)" enum:"docker,direct,kubernetes," default:""`
25+
APIKey string `help:"API key for authentication" env:"WARP_API_KEY" required:""`
26+
WorkerID string `help:"Worker host identifier (required via flag or config file)"`
27+
WebSocketURL string `default:"wss://oz.warp.dev/api/v1/selfhosted/worker/ws" hidden:""`
28+
ServerRootURL string `default:"https://app.warp.dev" hidden:""`
29+
LogLevel string `help:"Log level (debug, info, warn, error)" default:"info" enum:"debug,info,warn,error"`
30+
TargetDir string `help:"Run all tasks in this directory instead of creating per-task workspaces (direct backend only)"`
31+
NoCleanup bool `help:"Do not remove containers after execution (for debugging)"`
32+
Volumes []string `help:"Volume mounts for task containers (format: HOST_PATH:CONTAINER_PATH or HOST_PATH:CONTAINER_PATH:MODE)" short:"v"`
33+
Env []string `help:"Environment variables for task containers (format: KEY=VALUE or KEY to pass through from host)" short:"e"`
34+
MaxConcurrentTasks int `help:"Maximum number of tasks to run concurrently (0 for unlimited)" default:"0"`
35+
IdleOnComplete string `help:"How long to keep the oz agent alive after a task completes, for follow-ups (e.g. 45m, 10m, 0s). Defaults to 45m when not set."`
36+
SessionSharingServerURL string `help:"Session sharing server WebSocket URL to pass through to the oz CLI (e.g. ws://127.0.0.1:8081)" hidden:""`
3637
}
3738

3839
func main() {
@@ -139,14 +140,15 @@ func mergeConfig(fileConfig *config.FileConfig) (worker.Config, error) {
139140
}
140141

141142
wc := worker.Config{
142-
APIKey: CLI.APIKey,
143-
WorkerID: workerID,
144-
WebSocketURL: CLI.WebSocketURL,
145-
ServerRootURL: CLI.ServerRootURL,
146-
LogLevel: CLI.LogLevel,
147-
BackendType: backendType,
148-
MaxConcurrentTasks: maxConcurrentTasks,
149-
IdleOnComplete: idleOnComplete,
143+
APIKey: CLI.APIKey,
144+
WorkerID: workerID,
145+
WebSocketURL: CLI.WebSocketURL,
146+
ServerRootURL: CLI.ServerRootURL,
147+
LogLevel: CLI.LogLevel,
148+
BackendType: backendType,
149+
MaxConcurrentTasks: maxConcurrentTasks,
150+
IdleOnComplete: idleOnComplete,
151+
SessionSharingServerURL: CLI.SessionSharingServerURL,
150152
}
151153

152154
switch backendType {

0 commit comments

Comments
 (0)