feat(desktop): push publish tasks via AMQP topic dispatch WebSocket

Introduce a desktop.task.dispatch topic exchange with per-client routing
keys. Tenant-api publishes a task_available frame keyed by target client
ID when a publish job is created; every instance binds its own transient
queue and forwards to the matching WebSocket (/api/desktop/dispatch) it
owns. Desktop-client now prefers this push channel and only falls back
to HTTP /lease polling when the socket is down. Also drop admin-web
monitoring-plugin remnants and scope the publish modal account list to
publish platforms.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 19:46:59 +08:00
parent 7abac1e9c4
commit 9fa091c150
20 changed files with 1083 additions and 177 deletions
+8 -2
View File
@@ -45,8 +45,9 @@ type App struct {
VectorStore retrieval.VectorStore
ObjectStorage objectstorage.Client
AuditLogs *auditlog.AsyncWriter
GenerationStreams *stream.GenerationHub
GenerationStreams *stream.GenerationHub
DesktopTaskStreams *stream.DesktopTaskHub
DesktopDispatch *stream.DesktopDispatchHub
Cache cache.Cache
KolProfiles repository.KolProfileRepository
KolPackages repository.KolPackageRepository
@@ -111,6 +112,10 @@ func New(configPath string) (*App, error) {
auditLogs := auditlog.NewAsyncWriter(pool, logger)
generationStreams := stream.NewGenerationHub(mqClient)
desktopTaskStreams := stream.NewDesktopTaskHub(mqClient)
desktopDispatchBindings := []string{
cfg.RabbitMQ.DesktopDispatchPublishPrefix + ".*",
}
desktopDispatch := stream.NewDesktopDispatchHub(mqClient, logger, desktopDispatchBindings)
appCache := cache.New(cfg.Cache.Driver, rdb)
kolProfiles := repository.NewKolProfileRepository(pool)
kolPackages := repository.NewKolPackageRepository(pool)
@@ -170,8 +175,9 @@ func New(configPath string) (*App, error) {
VectorStore: vectorStore,
ObjectStorage: objectStorageClient,
AuditLogs: auditLogs,
GenerationStreams: generationStreams,
GenerationStreams: generationStreams,
DesktopTaskStreams: desktopTaskStreams,
DesktopDispatch: desktopDispatch,
Cache: appCache,
KolProfiles: kolProfiles,
KolPackages: kolPackages,