@@ -19,6 +19,7 @@ import (
1919 "github.com/mudler/LocalAI/core/services/jobs"
2020 mcpRemote "github.com/mudler/LocalAI/core/services/mcp"
2121 "github.com/mudler/LocalAI/core/services/messaging"
22+ "github.com/mudler/LocalAI/pkg/sanitize"
2223 "github.com/mudler/cogito"
2324 "github.com/mudler/cogito/clients"
2425 "github.com/mudler/xlog"
@@ -53,7 +54,7 @@ type AgentWorkerCMD struct {
5354}
5455
5556func (cmd * AgentWorkerCMD ) Run (ctx * cliContext.Context ) error {
56- xlog .Info ("Starting agent worker" , "nats" , cmd .NatsURL , "register_to" , cmd .RegisterTo )
57+ xlog .Info ("Starting agent worker" , "nats" , sanitize . URL ( cmd .NatsURL ) , "register_to" , cmd .RegisterTo )
5758
5859 // Resolve API URL
5960 apiURL := cmp .Or (cmd .APIURL , strings .TrimRight (cmd .RegisterTo , "/" ))
@@ -118,11 +119,12 @@ func (cmd *AgentWorkerCMD) Run(ctx *cliContext.Context) error {
118119 // Create and start the NATS dispatcher.
119120 // No ConfigProvider or SkillStore needed — config and skills arrive in the job payload.
120121 dispatcher := agents .NewNATSDispatcher (
121- & natsClientAdapter { natsClient } ,
122+ natsClient ,
122123 eventBridge ,
123124 nil , // no ConfigProvider: config comes in the enriched NATS payload
124125 apiURL , cmd .APIToken ,
125126 cmd .Subject , cmd .Queue ,
127+ 0 , // no concurrency limit (CLI worker)
126128 )
127129
128130 if err := dispatcher .Start (shutdownCtx ); err != nil {
@@ -273,21 +275,6 @@ func sendMCPDiscoveryReply(reply func([]byte), servers []mcpRemote.MCPServerInfo
273275 reply (data )
274276}
275277
276- // natsClientAdapter wraps messaging.Client to satisfy agents.NATSClient.
277- // The concrete Client.QueueSubscribe returns *nats.Subscription; this adapter
278- // widens it to messaging.Subscription so it matches the interface.
279- type natsClientAdapter struct {
280- client * messaging.Client
281- }
282-
283- func (a * natsClientAdapter ) Publish (subject string , data any ) error {
284- return a .client .Publish (subject , data )
285- }
286-
287- func (a * natsClientAdapter ) QueueSubscribe (subject , queue string , handler func (data []byte )) (messaging.Subscription , error ) {
288- return a .client .QueueSubscribe (subject , queue , handler )
289- }
290-
291278// handleMCPCIJob processes an MCP CI job on the agent worker.
292279// The agent worker can create MCP sessions (has docker) and call the LocalAI API for inference.
293280func handleMCPCIJob (shutdownCtx context.Context , data []byte , apiURL , apiToken string , natsClient * messaging.Client ) {
0 commit comments