From 33890d3b526ecf4100bb6eb3d2dc8f8176cfa124 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 27 Nov 2026 20:00:48 +1100 Subject: [PATCH] fix(connector): declare operator settings in Describe The contract has carried a settings list since the schema was added, but the SDK never filled it, so a host received an empty declaration: every setting an operator entered was refused as one the extension doesn't declare, and a connector that needs any setting could not start at all. Host, Telegram and Semaphore now declare the keys they already read. --- connectors/host/host.go | 7 ++++++- connectors/semaphore/semaphore.go | 11 ++++++++++- connectors/telegram/telegram.go | 4 ++++ sdk/connector/connector.go | 3 +++ sdk/connector/server.go | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/connectors/host/host.go b/connectors/host/host.go index ee5baf1..2d240ad 100644 --- a/connectors/host/host.go +++ b/connectors/host/host.go @@ -95,7 +95,12 @@ func newHost(cfg connector.Config) (*host, error) { } func (h *host) Describe() connector.Description { - return connector.Description{Actions: h.actionTypes(), Lookups: []*connectorv1.LookupType{ + return connector.Description{ + Settings: []*connectorv1.Setting{{ + Key: "hosts", Label: "Hosts", Required: true, Type: connectorv1.SettingType_SETTING_TYPE_TEXT, + Description: "The hosts it reaches, as JSON, each with its pinned host key and allowed paths.", + }}, + Actions: h.actionTypes(), Lookups: []*connectorv1.LookupType{ { Name: "filesystem_usage", Description: "Size, used and available bytes and inode use of the filesystem holding a path on a host.", diff --git a/connectors/semaphore/semaphore.go b/connectors/semaphore/semaphore.go index c8e3515..200defd 100644 --- a/connectors/semaphore/semaphore.go +++ b/connectors/semaphore/semaphore.go @@ -162,7 +162,16 @@ func (s *semaphore) effect(t Template) *connectorv1.Effect { } func (s *semaphore) Describe() connector.Description { - var d connector.Description + d := connector.Description{ + Settings: []*connectorv1.Setting{{ + Key: "base_url", Label: "Base URL", Required: true, Type: connectorv1.SettingType_SETTING_TYPE_STRING, + }, { + Key: "project_id", Label: "Project", Required: true, Type: connectorv1.SettingType_SETTING_TYPE_NUMBER, + }, { + Key: "templates", Label: "Templates", Required: true, Type: connectorv1.SettingType_SETTING_TYPE_TEXT, + Description: "The job templates it may launch, as JSON.", + }}, + } for _, name := range slices.Sorted(maps.Keys(s.templates)) { t := s.templates[name] d.Actions = append(d.Actions, &connectorv1.ActionType{ diff --git a/connectors/telegram/telegram.go b/connectors/telegram/telegram.go index 9c78e45..1747f64 100644 --- a/connectors/telegram/telegram.go +++ b/connectors/telegram/telegram.go @@ -83,6 +83,10 @@ var ( func (t *telegram) Describe() connector.Description { return connector.Description{ + Settings: []*connectorv1.Setting{{ + Key: "user_ids", Label: "User IDs", Required: true, Type: connectorv1.SettingType_SETTING_TYPE_LIST, + Description: "Telegram user IDs that may answer, separated by commas.", + }}, Deliveries: []*connectorv1.DeliveryType{{ Name: "message", Description: "A message to every allowed user's private chat.", InputSchema: messageSchema, }, { diff --git a/sdk/connector/connector.go b/sdk/connector/connector.go index bd23ee5..0589993 100644 --- a/sdk/connector/connector.go +++ b/sdk/connector/connector.go @@ -28,6 +28,9 @@ type Description struct { Actions []*connectorv1.ActionType Lookups []*connectorv1.LookupType Deliveries []*connectorv1.DeliveryType + // Settings are the operator values the connector reads, which the host + // renders as a form and refuses anything outside. + Settings []*connectorv1.Setting } // NoPrivilegedEffects declares a lookup or action that changes no privileges diff --git a/sdk/connector/server.go b/sdk/connector/server.go index 28008f5..2314642 100644 --- a/sdk/connector/server.go +++ b/sdk/connector/server.go @@ -46,7 +46,7 @@ func (s *server) Describe(context.Context, *connectorv1.DescribeRequest) (*conne _, links := c.(Linker) return &connectorv1.DescribeResponse{ Contract: Contract, Events: d.Events, Actions: d.Actions, Lookups: d.Lookups, - Deliveries: d.Deliveries, Listens: listens, LinksAccounts: links, + Deliveries: d.Deliveries, Settings: d.Settings, Listens: listens, LinksAccounts: links, }, nil }