eleven / ocho Public

server: default the connect broker URL + fix stale bot run help (#329)

- loadConnectConfig defaults LCHAT_CONNECT_BROKER_URL to the shared broker
  (https://connect.elevenmessenger.com), matching the Node runtime which
  defaults it inline. Instances set only their per-instance _TOKEN, so without
  this a Go sidecar's connect-OAuth exchange fails where the Node one worked.
- 'lchat bot run' help said 'deterministic command floor'; it now does
  model + recipes + connected-services, so describe that.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell ab3fab5d0c57bf9eed9ccfd11ae466440746151a parent e0f40ae
3 files changed, +30 −2
  • botcmd.go +2 −1
  • internal/bot/connect.go +11 −1
  • internal/bot/connect_test.go +17 −0
diff --git a/botcmd.go b/botcmd.go
index 1e1cb79..013f470 100644
--- a/botcmd.go
+++ b/botcmd.go
@@ -23,7 +23,8 @@ func runBotCmd(args []string) {
commands:
provision claim an agent invite and write the bot's session file
announce post new changelog entries to the bot's threads (the Announcer)
- run connect live and answer DMs/@mentions (deterministic command floor)`)
+ run run the live sidecar: connect each identity and follow its recipe
+ (command floor + model + connected-services; the standard trio zero-config)`)
os.Exit(2)
}
switch args[0] {
diff --git a/internal/bot/connect.go b/internal/bot/connect.go
index 27dfedb..4007348 100644
--- a/internal/bot/connect.go
+++ b/internal/bot/connect.go
@@ -27,9 +27,19 @@ type connectConfig struct {
dnsimple *dnsimpleClient
}
+// defaultBrokerURL is the shared connect broker; an instance sets only its
+// per-instance LCHAT_CONNECT_BROKER_TOKEN, so the URL defaults here (matching
+// the Node runtime, which defaults it inline). Override with
+// LCHAT_CONNECT_BROKER_URL for a self-hosted broker.
+const defaultBrokerURL = "https://connect.elevenmessenger.com"
+
func loadConnectConfig() *connectConfig {
+ brokerURL := os.Getenv("LCHAT_CONNECT_BROKER_URL")
+ if brokerURL == "" {
+ brokerURL = defaultBrokerURL
+ }
return &connectConfig{
- brokerURL: os.Getenv("LCHAT_CONNECT_BROKER_URL"),
+ brokerURL: brokerURL,
brokerToken: os.Getenv("LCHAT_CONNECT_BROKER_TOKEN"),
dnsimple: newDNSimpleClient(os.Getenv("LCHAT_DNSIMPLE_BASE")),
}
diff --git a/internal/bot/connect_test.go b/internal/bot/connect_test.go
new file mode 100644
index 0000000..26c3fa3
--- /dev/null
+++ b/internal/bot/connect_test.go
@@ -0,0 +1,17 @@
+package bot
+
+import "testing"
+
+func TestConnectBrokerURLDefault(t *testing.T) {
+ // Unset → the shared broker default (matches the Node runtime, which
+ // defaults it inline; an instance sets only its per-instance token).
+ t.Setenv("LCHAT_CONNECT_BROKER_URL", "")
+ if got := loadConnectConfig().brokerURL; got != defaultBrokerURL {
+ t.Errorf("default broker URL: got %q, want %q", got, defaultBrokerURL)
+ }
+ // A self-hosted broker overrides.
+ t.Setenv("LCHAT_CONNECT_BROKER_URL", "https://connect.example.com")
+ if got := loadConnectConfig().brokerURL; got != "https://connect.example.com" {
+ t.Errorf("override broker URL: got %q", got)
+ }
+}