GitHub #821 reported two dashboard behaviours degrading in the extracted UI
process because webui.Server.Cfg is nil there. Half of it was already closed:
19062a7 ("take configuration off the dashboard server", on main since
2026-09-12) moved the daemon's ConfigView renderer off webui.Server, gave
ConfigView a chat section carrying show_tool_calls, the operator name and a
channel flag, and pointed chatShowToolCalls and handleSetup at the projection.
The chat page and the checklist do read published values now.
The channel flag was still wrong. It was derived from telegram and the webhook
gateway only, while the daemon's own channel status manager lists three
front-ends and counts the inbound mail gateway as one. An email-only
deployment therefore read as configured on /api/channels and unconfigured on
the setup checklist at the same time, and the checklist told the operator to
connect a channel they already had.
Fix at the producer: config.ChatConfig gains FrontEnds, the single definition
of "this front-end is configured", enumerating telegram, email and the webhook
gateway. Both the published projection (ChannelConfigured) and the daemon's
channel descriptors (status.NewManager) now derive from it, so the two surfaces
cannot drift apart again. A front-end added to [chat] is counted by both or
neither. Whitespace-only values are not configured: an env var name of " "
resolves to nothing and " " cannot be listened on.
The setup checklist stays. It renders each step as a title, a detail and a done
mark with no control behind it, so it answers "what is this deployment
missing?" rather than promising to fix it; the process that cannot apply setup
never offered to. Removing it would delete the one surface that distinguishes a
fresh deployment from a finished one, and the values it reads already cross the
boundary in ConfigView at no cost to the daemon. The write path stays descoped
for Phase 3 (docs/prds/ui-service-boundary.md, /api/config (write) row): the
checklist reports configuration, it does not change it.
docs/prds/ui-service-boundary.md records that judgement and corrects the
"Real-process evidence" paragraph, which claimed the channel flag covered every
chat channel.
63 lines
2.3 KiB
Go
63 lines
2.3 KiB
Go
package config
|
|
|
|
import "strings"
|
|
|
|
// ChatFrontEnd is one conversational front-end [chat] can enable.
|
|
//
|
|
// It carries the answer to "is this front-end configured", and nothing else:
|
|
// which process starts it, whether it can be reloaded, and what an operator
|
|
// reads about it are channel-lifecycle facts that belong to the daemon, not to
|
|
// configuration. ID is the stable identifier every surface keys on (the
|
|
// dashboard's channel list, the channel reload route).
|
|
type ChatFrontEnd struct {
|
|
ID string
|
|
Name string
|
|
Configured bool
|
|
}
|
|
|
|
// FrontEnds reports every conversational front-end this configuration enables,
|
|
// in the order the dashboard lists them.
|
|
//
|
|
// This is the single definition of "a chat channel is configured". It exists
|
|
// because that question used to be answered twice from the same config and the
|
|
// two answers drifted: the daemon's channel status manager counted the inbound
|
|
// mail gateway, and the dashboard projection published for the extracted UI
|
|
// process did not, so an email-only deployment read as configured on
|
|
// /api/channels and unconfigured on the setup checklist at the same time
|
|
// (GitHub #821). Front-ends are enumerated once here so a front-end added to
|
|
// [chat] cannot be counted by one surface and missed by the other.
|
|
//
|
|
// A whitespace-only value is not configured on any front-end: an env var name
|
|
// of " " resolves to nothing, and an address of " " cannot be listened on.
|
|
func (c ChatConfig) FrontEnds() []ChatFrontEnd {
|
|
return []ChatFrontEnd{
|
|
{
|
|
ID: "telegram",
|
|
Name: "Telegram",
|
|
Configured: c.Telegram.Token != (SecretRef{}) || strings.TrimSpace(c.Telegram.TokenEnv) != "",
|
|
},
|
|
{
|
|
ID: "email",
|
|
Name: "Email",
|
|
Configured: strings.TrimSpace(c.Email.ListenAddr) != "",
|
|
},
|
|
{
|
|
ID: "webhook",
|
|
Name: "Webhook gateway",
|
|
Configured: strings.TrimSpace(c.WebhookAddr) != "",
|
|
},
|
|
}
|
|
}
|
|
|
|
// AnyFrontEndConfigured reports whether at least one conversational front-end
|
|
// has credentials. The setup checklist asks this as a yes/no question; every
|
|
// other consumer wants the per-front-end detail FrontEnds returns.
|
|
func (c ChatConfig) AnyFrontEndConfigured() bool {
|
|
for _, frontEnd := range c.FrontEnds() {
|
|
if frontEnd.Configured {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|