mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-11 03:13:24 +00:00
* feat(auth): support named chatgpt oauth providers - add provider-scoped ChatGPT OAuth routes and CLI support - persist refresh tokens per provider and reject provider-type collisions - wire provider OAuth setup flows in the dashboard and setup UI Refs #448 * feat(agent): add chatgpt oauth account routing - add agent other_config routing for manual and round-robin selection - reuse routed provider resolution across resolver and pending loaders - add router, parser, and agent advanced dialog coverage for multi-account use Refs #448 * docs(api): describe chatgpt oauth routing - document named-provider ChatGPT OAuth auth routes - describe agent-side account routing and round-robin behavior - update OpenAPI agent config schema and provider type enum Refs #448 * fix(store): add missing agent key context helpers * feat(ui): clarify chatgpt oauth account setup and routing * docs(providers): align chatgpt oauth alias examples * feat(agent): add codex pool activity dashboard * fix(providers): harden codex oauth alias setup * feat(codex-pool): improve routing dashboard UX - redesign the Codex/OpenAI pool page around saved-pool checkpoints and live evidence - add clearer selection, attention, and recent-proof states for pool members - make the lower panels fill the remaining desktop viewport while staying responsive * fix(store): resolve context helper merge duplication * feat(oauth): add codex pool quota and observation APIs - add quota inspection and observation endpoints for ChatGPT Subscription (OAuth) providers - teach codex routing to surface pool activity, observation metadata, and quota-aware readiness - extend tests and HTTP docs/OpenAPI for the new pool monitoring flows * feat(web): add codex pool quota monitor and controls - add provider quota fetching, readiness badges, and live routing evidence on the account pool page - redesign pool setup and activity panels for multi-account management with localized copy updates - keep the live monitor internally scrollable and compact the account cards for better viewport fit * fix(web): clarify pool routing labels - rename the recent request badge from Direct to Selected - restore compact quota bars in the live pool cards * feat(codex-pool): add runtime health dashboard - derive per-provider success and failure health from routed Codex traces - surface routing, quota, and recent request evidence in the pool UI - align provider alias guidance and owner access with the dashboard role model * docs(auth): document tenant scoping and key roles * fix(auth): harden tenant and codex pool access control * fix(providers): align codex pool runtime defaults * feat(ui): tighten codex pool responsive layout * feat(chatgpt-oauth): refine codex pool management UX * feat(chatgpt-oauth): surface quota bars on provider pages - add compact quota bars to Codex provider rows and provider detail - fetch quota only for ready visible provider rows and ready detail aliases - fix managed-member detail visibility and tighten provider locale copy
87 lines
3.7 KiB
Go
87 lines
3.7 KiB
Go
package cmd
|
|
|
|
import (
|
|
"github.com/nextlevelbuilder/goclaw/internal/bus"
|
|
httpapi "github.com/nextlevelbuilder/goclaw/internal/http"
|
|
"github.com/nextlevelbuilder/goclaw/internal/providers"
|
|
"github.com/nextlevelbuilder/goclaw/internal/store"
|
|
"github.com/nextlevelbuilder/goclaw/internal/tools"
|
|
)
|
|
|
|
// wireHTTP creates HTTP handlers (agents + skills + traces + MCP + channel instances + providers + builtin tools + pending messages).
|
|
func wireHTTP(stores *store.Stores, defaultWorkspace, dataDir, bundledSkillsDir string, msgBus *bus.MessageBus, toolsReg *tools.Registry, providerReg *providers.Registry, isOwner func(string) bool, gatewayAddr string, mcpToolLister httpapi.MCPToolLister) (*httpapi.AgentsHandler, *httpapi.SkillsHandler, *httpapi.TracesHandler, *httpapi.MCPHandler, *httpapi.ChannelInstancesHandler, *httpapi.ProvidersHandler, *httpapi.BuiltinToolsHandler, *httpapi.PendingMessagesHandler, *httpapi.TeamEventsHandler, *httpapi.SecureCLIHandler, *httpapi.MCPUserCredentialsHandler) {
|
|
var agentsH *httpapi.AgentsHandler
|
|
var skillsH *httpapi.SkillsHandler
|
|
var tracesH *httpapi.TracesHandler
|
|
var mcpH *httpapi.MCPHandler
|
|
var channelInstancesH *httpapi.ChannelInstancesHandler
|
|
var providersH *httpapi.ProvidersHandler
|
|
var builtinToolsH *httpapi.BuiltinToolsHandler
|
|
var pendingMessagesH *httpapi.PendingMessagesHandler
|
|
var secureCLIH *httpapi.SecureCLIHandler
|
|
|
|
if stores != nil && stores.Agents != nil {
|
|
var summoner *httpapi.AgentSummoner
|
|
if providerReg != nil {
|
|
summoner = httpapi.NewAgentSummoner(stores.Agents, providerReg, msgBus)
|
|
}
|
|
agentsH = httpapi.NewAgentsHandler(stores.Agents, stores.Providers, providerReg, stores.DB, defaultWorkspace, msgBus, summoner, isOwner)
|
|
}
|
|
|
|
if stores != nil && stores.Skills != nil {
|
|
if manageStore, ok := stores.Skills.(store.SkillManageStore); ok {
|
|
dirs := manageStore.Dirs()
|
|
if len(dirs) > 0 {
|
|
skillsH = httpapi.NewSkillsHandler(manageStore, dirs[0], dataDir, bundledSkillsDir, msgBus, stores.SkillTenantCfgs, stores.Tenants)
|
|
}
|
|
}
|
|
}
|
|
|
|
if stores != nil && stores.Tracing != nil {
|
|
tracesH = httpapi.NewTracesHandler(stores.Tracing)
|
|
}
|
|
|
|
if stores != nil && stores.MCP != nil {
|
|
mcpH = httpapi.NewMCPHandler(stores.MCP, msgBus, mcpToolLister)
|
|
}
|
|
var mcpUserCredsH *httpapi.MCPUserCredentialsHandler
|
|
if stores != nil && stores.MCP != nil {
|
|
mcpUserCredsH = httpapi.NewMCPUserCredentialsHandler(stores.MCP, stores.Tenants)
|
|
}
|
|
|
|
if stores != nil && stores.ChannelInstances != nil {
|
|
channelInstancesH = httpapi.NewChannelInstancesHandler(stores.ChannelInstances, stores.Agents, stores.ConfigPermissions, stores.Contacts, stores.Tenants, msgBus)
|
|
}
|
|
|
|
if stores != nil && stores.Providers != nil {
|
|
providersH = httpapi.NewProvidersHandler(stores.Providers, stores.ConfigSecrets, providerReg, gatewayAddr)
|
|
providersH.SetMessageBus(msgBus)
|
|
if stores.SystemConfigs != nil {
|
|
providersH.SetSystemConfigStore(stores.SystemConfigs)
|
|
}
|
|
if stores.MCP != nil {
|
|
providersH.SetMCPServerLookup(buildMCPServerLookup(stores.MCP))
|
|
}
|
|
}
|
|
|
|
var teamEventsH *httpapi.TeamEventsHandler
|
|
|
|
if stores != nil && stores.Teams != nil {
|
|
teamEventsH = httpapi.NewTeamEventsHandler(stores.Teams)
|
|
}
|
|
|
|
if stores != nil && stores.BuiltinTools != nil {
|
|
builtinToolsH = httpapi.NewBuiltinToolsHandler(stores.BuiltinTools, stores.BuiltinToolTenantCfgs, stores.Tenants, msgBus)
|
|
}
|
|
|
|
if stores != nil && stores.PendingMessages != nil {
|
|
pendingMessagesH = httpapi.NewPendingMessagesHandler(stores.PendingMessages, stores.Agents, providerReg)
|
|
}
|
|
|
|
if stores != nil && stores.SecureCLI != nil {
|
|
secureCLIH = httpapi.NewSecureCLIHandler(stores.SecureCLI, msgBus)
|
|
}
|
|
|
|
return agentsH, skillsH, tracesH, mcpH, channelInstancesH, providersH, builtinToolsH, pendingMessagesH, teamEventsH, secureCLIH, mcpUserCredsH
|
|
}
|