feat: add ssh-connection-string option for container SSH access
Add internal -ssh-connection-string flag to pass SSH hostname from dockerimg
to sketch container, allowing the UI to display the correct SSH connection
string based on SSH Theater configuration rather than generating it locally.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s1872f10f74da5f9bk
diff --git a/loop/agent.go b/loop/agent.go
index 6282705..25c3807 100644
--- a/loop/agent.go
+++ b/loop/agent.go
@@ -115,6 +115,9 @@
// SessionID returns the unique session identifier.
SessionID() string
+ // SSHConnectionString returns the SSH connection string for the container.
+ SSHConnectionString() string
+
// DetectGitChanges checks for new git commits and pushes them if found
DetectGitChanges(ctx context.Context) error
@@ -678,6 +681,11 @@
return a.config.SessionID
}
+// SSHConnectionString returns the SSH connection string for the container.
+func (a *Agent) SSHConnectionString() string {
+ return a.config.SSHConnectionString
+}
+
// OutsideOS returns the operating system of the outside system.
func (a *Agent) OutsideOS() string {
return a.outsideOS
@@ -997,6 +1005,8 @@
BranchPrefix string
// LinkToGitHub enables GitHub branch linking in UI
LinkToGitHub bool
+ // SSH connection string for connecting to the container
+ SSHConnectionString string
// Skaband client for session history (optional)
SkabandClient *skabandclient.SkabandClient
}
diff --git a/loop/server/loophttp.go b/loop/server/loophttp.go
index 6c2debc..609b546 100644
--- a/loop/server/loophttp.go
+++ b/loop/server/loophttp.go
@@ -95,9 +95,10 @@
InsideOS string `json:"inside_os,omitempty"`
OutsideWorkingDir string `json:"outside_working_dir,omitempty"`
InsideWorkingDir string `json:"inside_working_dir,omitempty"`
- TodoContent string `json:"todo_content,omitempty"` // Contains todo list JSON data
- SkabandAddr string `json:"skaband_addr,omitempty"` // URL of the skaband server
- LinkToGitHub bool `json:"link_to_github,omitempty"` // Enable GitHub branch linking in UI
+ TodoContent string `json:"todo_content,omitempty"` // Contains todo list JSON data
+ SkabandAddr string `json:"skaband_addr,omitempty"` // URL of the skaband server
+ LinkToGitHub bool `json:"link_to_github,omitempty"` // Enable GitHub branch linking in UI
+ SSHConnectionString string `json:"ssh_connection_string,omitempty"` // SSH connection string for container
}
type InitRequest struct {
@@ -1308,6 +1309,7 @@
TodoContent: s.agent.CurrentTodoContent(),
SkabandAddr: s.agent.SkabandAddr(),
LinkToGitHub: s.agent.LinkToGitHub(),
+ SSHConnectionString: s.agent.SSHConnectionString(),
}
}
diff --git a/loop/server/loophttp_test.go b/loop/server/loophttp_test.go
index 5d054fc..531f961 100644
--- a/loop/server/loophttp_test.go
+++ b/loop/server/loophttp_test.go
@@ -229,6 +229,7 @@
func (m *mockAgent) Diff(commit *string) (string, error) { return "", nil }
func (m *mockAgent) OS() string { return "linux" }
func (m *mockAgent) SessionID() string { return m.sessionID }
+func (m *mockAgent) SSHConnectionString() string { return "sketch-" + m.sessionID }
func (m *mockAgent) BranchPrefix() string { return m.branchPrefix }
func (m *mockAgent) CurrentTodoContent() string { return "" } // Mock returns empty for simplicity
func (m *mockAgent) OutstandingLLMCallCount() int { return 0 }