feat(gns2): integrate HybridGiteaClient into PollingSupervisor

- PollingSupervisor now uses HybridGiteaClient (MCP primary, REST fallback)
- Added mcpUrl to PipelineConfig
- Supervisor calls initialize() to detect MCP vs REST mode automatically

Refs: Milestone #67, Issue #107
This commit is contained in:
NW
2026-05-08 22:35:21 +01:00
parent 06fb0421ef
commit f5966db155

View File

@@ -8,6 +8,7 @@ import {
logAgentPerformance,
detectRepository
} from "./gitea-client"
import { HybridGiteaClient } from "./mcp-gitea-client"
export interface PipelineConfig {
giteaToken?: string
@@ -32,16 +33,20 @@ export interface PipelineResult {
}
export class PollingSupervisor {
private client: GiteaClient
private client: HybridGiteaClient
private efficiencyThreshold: number
private autoLog: boolean
private initialized: boolean = false
private pollInterval: number
constructor(config: PipelineConfig = {}) {
this.client = new GiteaClient({
token: config.giteaToken,
apiUrl: config.giteaApiUrl,
// Use Hybrid client: MCP first, REST fallback
this.client = new HybridGiteaClient({
mcpUrl: config.mcpUrl, // NEW: MCP server URL
restConfig: {
token: config.giteaToken,
apiUrl: config.giteaApiUrl,
}
})
this.efficiencyThreshold = config.efficiencyThreshold ?? 7
this.autoLog = config.autoLog ?? true
@@ -52,7 +57,9 @@ export class PollingSupervisor {
if (this.initialized) return
const { owner, repo } = await detectRepository()
// Hybrid client handles both MCP and REST
this.client.setRepository(owner, repo)
await this.client.initialize() // Initialize MCP with fallback
this.initialized = true
}