Repository navigation
Features agente mcp a2a - #207
Conversation
Add stdio-based MCP server support to OmniRoute CLI, enabling AI agents in VS Code, Cursor, Claude Desktop, and Copilot to interact with OmniRoute tools (health, combos, quota, routing). Update help text, gitignore vscode-extension subproject, and include MCP/A2A strategy report.
Register 8 new advanced MCP tools (simulate_route, set_budget_guard, set_resilience_profile, test_combo, get_provider_metrics, best_combo_for_task, explain_route, get_session_snapshot) with their handler implementations. Add A2A smart routing skill that routes prompts through the OmniRoute pipeline with routing explanation, cost envelope, and resilience trace metadata.
- Add unit tests for 8 MCP advanced tool handlers (Phase 3) - Migrate test files from JavaScript to TypeScript (.ts/.tsx) - Restructure file paths from app/ to src/app/ across all tests - Refactor route assertions into reusable assertRouteMethods helper - Add tests for new API routes (compliance, audit-log, evals/[suiteId]) - Update barrel export tests to use consolidated assertion pattern
Introduce `normalizeQuotaResponse` and `normalizeCombosResponse` helpers to handle varying API response shapes (array vs wrapped object) consistently across MCP server and advanced tools. Add optional `meta` field to checkQuotaOutput schema and update sourceEndpoints to reflect current API routes.
…sion Introduce full AI orchestration ecosystem: - MCP Server with 16 tools, scoped auth, and audit logging - A2A v0.3 server with JSON-RPC 2.0, SSE streaming, and task manager - Auto-Combo engine with 6-factor scoring and self-healing - VS Code extension with smart dispatch and budget tracking - Harden CI pipeline: add static checks, remove continue-on-error - Add translator schema validation tests - Update .gitignore and CHANGELOG for release checklist
- Add type annotations to all providerModels helper functions - Introduce LegacyProvider interface in providerRegistry - Refactor translator system to use self-registering module pattern with bootstrapTranslatorRegistry() and per-file imports - Simplify translator/index.ts by delegating to modular translators - Remove hardcoded Gemini OAuth client secret for security
Implement Agent-to-Agent (A2A) JSON-RPC 2.0 endpoint with smart routing and quota management skills, SSE streaming, and task lifecycle management. - Add /a2a route with message/send, message/stream, tasks/get, tasks/cancel - Add /.well-known/agent.json agent card endpoint - Introduce Zod-based request validation schemas for all v1 API routes - Extract shared getUnifiedModelsResponse to reduce duplication across /models, /v1/models, and /a2a model listing - Refactor chat, embeddings, moderations, and models routes to use centralized validation and error handling - Add A2A task manager, routing logger, and streaming utilities
…hemas Eliminate `any` usage across the codebase by introducing proper generics, typed interfaces (StatementLike, DbLike, PromptRow, etc.), and helper conversion functions (toNumber, toString, parseVariables). Add comprehensive Zod validation schemas for API endpoint inputs to enforce runtime type safety alongside compile-time checks.
- Add HTTP error pages (400, 401, 403, 408, 429, 500, 502, 503) - Add maintenance, offline, and system status pages - Harden db/core.ts, db/apiKeys.ts, db/cliToolState.ts, db/backup.ts - Strengthen compliance/index.ts audit logging - Improve container.ts DI registrations - Fix dataPaths.ts and tokenHealthCheck.ts
…d pages - Replace all `as any` casts in MCP advancedTools with typed helpers (toRecord, toString, toNumber) - Harden open-sse services: rateLimitManager, sessionManager, usage, roleNormalizer, signatureCache, comboMetrics - Improve responseSanitizer and responseTranslator type safety - Remove deprecated openai-responses request translator - Add dashboard pages: /a2a, /mcp, /auto-combo with live data - Improve error/loading/not-found pages with consistent design - Add root loading.tsx and typecheck tsconfig variants - Add check-t11-any-budget.mjs audit script
…and stream handling, and update various handlers and translators.
…mits (#198) - Issue #199: proxy_ prefix on tool names is now automatically disabled when routing to non-Claude backends (Gemini, Compatible, etc.). Prevents tool name mismatches in OpenCode, Cursor, and other clients. - Issue #198: Added customRpm/customTpm support per provider connection. Users can configure custom rate limits via connection settings, overriding the default auto-learned limits from response headers.
… bug Extracted validateBody, isValidationFailure, and loginSchema from the 935-line schemas.ts barrel file into a dedicated helpers.ts module. Updated 70 API route files to import directly from helpers.ts. Root cause: webpack on certain environments fails to resolve exports from the bottom of large barrel files (schemas.ts), causing '(0, O.Jb) is not a function' errors in production builds. Fix: Split validation helpers into a small dedicated module (helpers.ts) so webpack can correctly resolve all exports regardless of file size. - TypeScript compiles with 0 errors - All API routes updated to import from helpers.ts - schemas.ts re-exports from helpers.ts for backward compatibility
There was a problem hiding this comment.
Pull request overview
Introduces MCP/A2A-facing capabilities and tightens API reliability by standardizing request validation and error handling across many routes, plus adds new testing tooling and status pages.
Changes:
- Added Zod-based request validation to many API routes via shared
validateBodyhelpers and per-route schemas. - Added new endpoints/pages (agent discovery card, auto-combo API, OpenClaw auto-order integration, HTTP error pages).
- Expanded CI/testing automation (route-validation check, docs sync check, Playwright/Vitest orchestration) and bumped package version.
Reviewed changes
Copilot reviewed 210 out of 328 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/api/v1/messages/count_tokens/route.ts | Adds schema validation for request body |
| src/app/api/v1/images/generations/route.ts | Adds schema validation; removes manual checks |
| src/app/api/v1/embeddings/route.ts | Adds schema validation; removes manual checks |
| src/app/api/v1/chat/completions/route.ts | Changes guard failure handling to 503 |
| src/app/api/v1/audio/speech/route.ts | Adds schema validation for request body |
| src/app/api/usage/budget/route.ts | Adds schema validation; sanitizes 500 errors |
| src/app/api/usage/analytics/route.ts | Hardens connection mapping typing/parsing |
| src/app/api/translator/send/route.ts | Adds validation; hardens baseUrl extraction |
| src/app/api/translator/save/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/translator/detect/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/sync/cloud/route.ts | Adds schema validation for sync action |
| src/app/api/settings/thinking-budget/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/settings/system-prompt/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/settings/route.ts | Switches to validation helpers; sanitizes 500 errors |
| src/app/api/settings/require-login/route.ts | Adds validation; improves JSON error shape |
| src/app/api/settings/model-aliases/route.ts | Adds validation to PUT/POST/DELETE |
| src/app/api/settings/ip-filter/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/settings/combo-defaults/route.ts | Adds validation; simplifies update flow |
| src/app/api/settings/background-degradation/route.ts | Adds validation for config + reset action |
| src/app/api/resilience/route.ts | Adds validation; improves typing/error handling |
| src/app/api/rate-limits/route.ts | Adds validation; hardens connection typing |
| src/app/api/providers/validate/route.ts | Adds validation; improves JSON error shape |
| src/app/api/providers/test-batch/route.ts | Adds validation; improves JSON error shape |
| src/app/api/providers/route.ts | Uses validation helpers for create-provider |
| src/app/api/providers/[id]/test/route.ts | Guards invalid provider; uses sanitized provider |
| src/app/api/providers/[id]/route.ts | Adds validation for provider updates |
| src/app/api/provider-nodes/validate/route.ts | Adds validation; improves JSON error shape |
| src/app/api/provider-nodes/route.ts | Adds validation; removes manual checks |
| src/app/api/provider-nodes/[id]/route.ts | Adds validation; hardens connection updates |
| src/app/api/provider-models/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/provider-metrics/route.ts | Improves typing/number parsing robustness |
| src/app/api/pricing/route.ts | Adds validation; removes manual structure checks |
| src/app/api/pricing/models/route.ts | Hardens types for custom model catalog merge |
| src/app/api/policies/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/oauth/kiro/social-exchange/route.ts | Adds validation; improves JSON error shape |
| src/app/api/oauth/kiro/import/route.ts | Adds validation; improves JSON error shape |
| src/app/api/oauth/cursor/import/route.ts | Adds validation; improves JSON error shape |
| src/app/api/monitoring/health/route.ts | Sanitizes 500 error payloads |
| src/app/api/models/route.ts | Adds validation; improves JSON error shape |
| src/app/api/models/availability/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/models/alias/route.ts | Adds validation for authenticated alias updates |
| src/app/api/keys/route.ts | Uses validation helpers; hardens key masking |
| src/app/api/keys/[id]/route.ts | Adds validation; extends payload with noLog |
| src/app/api/fallback/chains/route.ts | Adds validation; sanitizes 500 errors |
| src/app/api/evals/route.ts | Adds validation; improves JSON error shape |
| src/app/api/db-backups/route.ts | Adds validation; improves JSON error shape |
| src/app/api/combos/test/route.ts | Adds validation; improves JSON error shape |
| src/app/api/combos/route.ts | Uses validation helpers for create-combo |
| src/app/api/combos/auto/route.ts | Adds new auto-combo API (in-memory) |
| src/app/api/combos/[id]/route.ts | Adds validation for combo updates |
| src/app/api/cloud/models/alias/route.ts | Adds validation; improves JSON error shape |
| src/app/api/cloud/model/resolve/route.ts | Adds validation; hardens resolved alias typing |
| src/app/api/cloud/credentials/update/route.ts | Adds validation; hardens connectionId typing |
| src/app/api/cloud/auth/route.ts | Hardens masking to handle non-string values |
| src/app/api/cli-tools/openclaw/auto-order/route.ts | Adds OpenClaw auto-order integration endpoint |
| src/app/api/cli-tools/openclaw-settings/route.ts | Adds validation for CLI tool config |
| src/app/api/cli-tools/kilo-settings/route.ts | Adds validation for CLI tool config |
| src/app/api/cli-tools/guide-settings/[toolId]/route.ts | Adds validation for guide settings save |
| src/app/api/cli-tools/droid-settings/route.ts | Adds validation for CLI tool config |
| src/app/api/cli-tools/codex-settings/route.ts | Adds validation for CLI tool config |
| src/app/api/cli-tools/codex-profiles/route.ts | Adds validation for profile actions |
| src/app/api/cli-tools/cline-settings/route.ts | Adds validation for CLI tool config |
| src/app/api/cli-tools/claude-settings/route.ts | Adds validation for env payload |
| src/app/api/cli-tools/backups/route.ts | Adds validation for backup mutations |
| src/app/api/cli-tools/antigravity-mitm/route.ts | Adds validation for MITM start/stop |
| src/app/api/cli-tools/antigravity-mitm/alias/route.ts | Adds validation for MITM alias updates |
| src/app/api/auth/login/route.ts | Refactors validation usage; sanitizes errors |
| src/app/503/page.tsx | Adds 503 error page |
| src/app/502/page.tsx | Adds 502 error page |
| src/app/500/page.tsx | Adds 500 error page |
| src/app/429/page.tsx | Adds 429 error page |
| src/app/408/page.tsx | Adds 408 error page |
| src/app/403/page.tsx | Adds 403 error page |
| src/app/401/page.tsx | Adds 401 error page |
| src/app/400/page.tsx | Adds 400 error page |
| src/app/.well-known/agent.json/route.ts | Adds A2A agent card discovery endpoint |
| src/app/(dashboard)/dashboard/usage/components/EvalsTab.tsx | Fixes HeroSection prop usage |
| src/app/(dashboard)/dashboard/settings/loading.tsx | Improves loading skeleton + a11y attrs |
| src/app/(dashboard)/dashboard/settings/error.tsx | Improves error UI + a11y; avoids leaking prod errors |
| src/app/(dashboard)/dashboard/settings/components/ModelAliasesTab.tsx | Improves typing and minor formatting |
| src/app/(dashboard)/dashboard/providers/loading.tsx | Improves loading skeleton + a11y attrs |
| src/app/(dashboard)/dashboard/providers/error.tsx | Improves error UI + a11y; avoids leaking prod errors |
| src/app/(dashboard)/dashboard/cli-tools/components/DefaultToolCard.tsx | Safer default args for translations |
| src/app/(dashboard)/dashboard/analytics/loading.tsx | Improves loading skeleton + a11y attrs |
| scripts/runtime-env.mjs | Adds env color sanitization helper |
| scripts/run-playwright-tests.mjs | Adds Playwright runner wrapper |
| scripts/run-next-playwright.mjs | Adds Next webserver wrapper for e2e |
| scripts/run-ecosystem-tests.mjs | Adds ecosystem test orchestration runner |
| scripts/check-route-validation.mjs | Adds CI check for validateBody usage |
| scripts/check-docs-sync.mjs | Adds CI check for version sync |
| playwright.config.ts | Adjusts webServer orchestration and parallelism |
| package.json | Bumps version; adds tooling/scripts/deps |
| open-sse/utils/usageTracking.ts | Clarifies docs language |
| open-sse/utils/tlsClient.ts | Improves typing + header normalization |
| open-sse/utils/streamHandler.ts | Improves typing + safer error handling |
| open-sse/utils/requestLogger.ts | Clarifies docs language |
| open-sse/utils/proxyFetch.ts | Improves typing + dispatcher-safe fetch |
| open-sse/utils/ollamaTransform.ts | Improves typing for tool-call accumulation |
| open-sse/utils/networkProxy.ts | Tightens JSDoc return type |
| open-sse/utils/logger.ts | Replaces any with unknown record |
| open-sse/utils/error.ts | Tightens types; avoids retryAfter string formatting issues |
| open-sse/utils/comfyuiClient.ts | Adds robust JSON parsing/typing checks |
| open-sse/utils/bypassHandler.ts | Clarifies docs language |
| open-sse/translator/response/openai-to-claude.ts | Switches to new translator registry import |
| open-sse/translator/response/openai-to-antigravity.ts | Switches registry import; adds typings |
| open-sse/translator/response/openai-responses.ts | Switches registry import; tightens typing |
| open-sse/translator/response/kiro-to-openai.ts | Switches registry import; tightens typing |
| open-sse/translator/response/gemini-to-openai.ts | Switches registry import; tightens typing |
| open-sse/translator/response/gemini-to-claude.ts | Switches to new translator registry import |
| open-sse/translator/response/cursor-to-openai.ts | Switches to new translator registry import |
| open-sse/translator/response/claude-to-openai.ts | Switches registry import; adds typings |
| open-sse/translator/request/openai-to-kiro.ts | Switches registry import; adds typings |
| open-sse/translator/request/openai-to-gemini.ts | Switches registry import; adds typings |
| open-sse/translator/request/openai-to-cursor.ts | Switches registry import; adds typings |
| open-sse/translator/request/gemini-to-openai.ts | Switches registry import; adds typings |
| open-sse/translator/request/claude-to-openai.ts | Switches registry import; normalizes tool_choice |
| open-sse/translator/request/claude-to-gemini.ts | Switches registry import; adds typings |
| open-sse/translator/request/antigravity-to-openai.ts | Switches registry import; adds typings |
| open-sse/translator/registry.ts | Adds explicit translator registry module |
| open-sse/translator/helpers/responsesApiHelper.ts | Clarifies comment for tool-call flushing |
| open-sse/translator/helpers/openaiHelper.ts | Normalizes Claude tool_choice required mapping |
| open-sse/translator/helpers/geminiHelper.ts | Tightens types for schema merging |
| open-sse/translator/bootstrap.ts | Adds explicit translator bootstrap module |
| open-sse/services/wildcardRouter.ts | Tightens docs type + wording |
| open-sse/services/tokenRefresh.ts | Tightens types for circuit breaker + logger |
| open-sse/services/thinkingBudget.ts | Clarifies docs language |
| open-sse/services/signatureCache.ts | Tightens types + model-family parsing |
| open-sse/services/rateLimitSemaphore.ts | Adds typed error.code field |
| open-sse/services/provider.ts | Tightens buildProviderUrl option typing |
| open-sse/services/contextManager.ts | Tightens option typing + formatting |
| open-sse/services/comboMetrics.ts | Adds explicit metric types and signatures |
| open-sse/services/comboConfig.ts | Tightens provider override typing |
| open-sse/services/combo.ts | Clarifies docs/comments |
| open-sse/services/backgroundTaskDetector.ts | Tightens types; safer message extraction |
| open-sse/services/autoCombo/persistence.ts | Adds persistence for auto-combo learning |
| open-sse/services/autoCombo/modePacks.ts | Adds predefined scoring weight packs |
| open-sse/services/autoCombo/index.ts | Adds barrel exports for autoCombo module |
| open-sse/services/accountSelector.ts | Tightens strategy state typing |
| open-sse/services/accountFallback.ts | Safer .unref usage; tightens typing |
| open-sse/mcp-server/scopeEnforcement.ts | Adds MCP tool scope evaluation helpers |
| open-sse/mcp-server/schemas/index.ts | Adds MCP/A2A schema barrel export |
| open-sse/mcp-server/schemas/audit.ts | Adds audit types + hashing/summarization |
| open-sse/mcp-server/index.ts | Adds MCP server barrel export |
| open-sse/mcp-server/tests/a2aLifecycle.test.ts | Adds A2A task lifecycle regression tests |
| open-sse/handlers/sseParser.ts | Replaces any with unknown record |
| open-sse/handlers/responsesHandler.ts | Removes as any cast at call site |
| open-sse/handlers/rerank.ts | Tightens JSDoc return type |
| open-sse/handlers/moderations.ts | Tightens JSDoc return type |
| open-sse/handlers/imageGeneration.ts | Replaces any with unknown; formatting |
| open-sse/handlers/embeddings.ts | Replaces any with unknown for upstream body |
| open-sse/handlers/chatCore.ts | Adjusts translation flow; respects noLog flag |
| open-sse/handlers/audioTranscription.ts | Tightens typing; safer file name handling |
| open-sse/handlers/audioSpeech.ts | Tightens JSDoc return type; formatting |
| open-sse/executors/iflow.ts | Tightens credential/body typing |
| open-sse/executors/default.ts | Clarifies comment language |
| open-sse/executors/cursor.ts | Tightens typing; safer URL/header handling |
| open-sse/executors/antigravity.ts | Clarifies comment language |
| open-sse/config/registryUtils.ts | Clarifies comment language |
| open-sse/config/providerRegistry.ts | Removes hardcoded secrets; tightens typing |
| open-sse/config/providerModels.ts | Adds TS types for registry model helpers |
| open-sse/config/imageRegistry.ts | Clarifies comment language |
| open-sse/config/codexInstructions.ts | Doc wording tweaks |
| docs/openapi.yaml | Updates API version field |
| docs/TROUBLESHOOTING.md | Updates troubleshooting guidance and storage docs |
| docs/RELEASE_CHECKLIST.md | Adds release checklist doc |
| .github/workflows/ci.yml | Adds new checks/typechecks to CI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| export async function POST(req: NextRequest) { | ||
| try { | ||
| const body = await req.json(); | ||
| const { id, name, candidatePool, weights, modePack, budgetCap, explorationRate } = body; | ||
|
|
||
| if (!id || !name) { | ||
| return NextResponse.json({ error: "id and name required" }, { status: 400 }); | ||
| } | ||
|
|
||
| const config: AutoComboConfig = { | ||
| id, | ||
| name, | ||
| type: "auto", | ||
| candidatePool: candidatePool || [], | ||
| weights: weights || DEFAULT_WEIGHTS, | ||
| modePack, | ||
| budgetCap, | ||
| explorationRate: explorationRate ?? 0.05, | ||
| }; | ||
| autoCombos.set(id, config); | ||
|
|
||
| return NextResponse.json(config, { status: 201 }); | ||
| } catch (err) { | ||
| return NextResponse.json({ error: String(err) }, { status: 500 }); | ||
| } | ||
| } |
There was a problem hiding this comment.
This new route uses req.json() but does not call validateBody(...), which will cause the newly added scripts/check-route-validation.mjs CI check to fail. Also, malformed JSON currently returns a 500 with String(err) (leaks error details and uses the wrong status code); it should return a structured 400 like the other validated routes. Add a request schema + validateBody (and a JSON parse 400 path) to align with the rest of the API and to satisfy the new validation guard.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| } catch (error) { | ||
| console.error("[SECURITY] Prompt injection guard failed:", error); | ||
| return new Response( | ||
| JSON.stringify({ | ||
| error: { | ||
| message: "Security validation temporarily unavailable", | ||
| type: "security_guard_unavailable", | ||
| code: "SECURITY_002", | ||
| }, | ||
| }), | ||
| { status: 503, headers: { "Content-Type": "application/json" } } | ||
| ); | ||
| } |
There was a problem hiding this comment.
This newly introduced early-return response does not include the CORS headers used elsewhere in the API routes (many other handlers merge ...CORS_HEADERS). If browser clients hit this path, they may get blocked by CORS even though the server returned JSON. Include the standard CORS headers on this 503 response (or route through the shared error helper used by the other endpoints).
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Code Review SummaryStatus: No New Issues Found | Recommendation: Merge OverviewThis PR is primarily a documentation and localization update with no actual code changes to TypeScript/JavaScript source files.
Files Changed (25 files with actual content changes)
Key Changes
Notes
Files Reviewed (25 files with changes)
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces major enhancements to OmniRoute, focusing on agent integration through MCP and A2A protocols, improved code quality, and enhanced documentation. These changes transform OmniRoute into a more agent-controllable platform, offering better orchestration and management capabilities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant new features, including the MCP server, A2A protocol support, and an Auto-Combo engine, which represents a major step forward for the project. The extensive refactoring to improve type safety across the codebase by eliminating any types and introducing Zod for validation is a commendable effort that will greatly improve maintainability and robustness.
I've identified a couple of issues: a potential memory leak in the mergeAbortSignals helper and an unsafe type guard in the new MCP server. These are detailed in the specific comments.
Overall, this is a very impressive and well-executed set of changes.
Note: Security Review did not run due to the size of the PR.
| function mergeAbortSignals(primary: AbortSignal, secondary: AbortSignal): AbortSignal { | ||
| const controller = new AbortController(); | ||
|
|
||
| const abortBoth = () => { | ||
| if (!controller.signal.aborted) { | ||
| controller.abort(); | ||
| } | ||
| }; | ||
|
|
||
| if (primary.aborted || secondary.aborted) { | ||
| abortBoth(); | ||
| return controller.signal; | ||
| } | ||
|
|
||
| primary.addEventListener("abort", abortBoth, { once: true }); | ||
| secondary.addEventListener("abort", abortBoth, { once: true }); | ||
| return controller.signal; | ||
| } |
There was a problem hiding this comment.
This mergeAbortSignals implementation has a memory leak. The event listeners added to primary and secondary signals are not removed if the fetch operation completes successfully without any of the signals being aborted. The { once: true } option only removes a listener after it has been invoked. If a listener is never invoked, it's never removed.
A better implementation would be to ensure listeners are removed when one of them fires. Here is a safer implementation that cleans up both listeners when one of them aborts, preventing a leak if one signal fires but the other doesn't.
function mergeAbortSignals(primary: AbortSignal, secondary: AbortSignal): AbortSignal {
const controller = new AbortController();
const onAbort = () => {
controller.abort();
// Clean up listeners to prevent memory leaks
primary.removeEventListener("abort", onAbort);
secondary.removeEventListener("abort", onAbort);
};
if (primary.aborted || secondary.aborted) {
onAbort();
return controller.signal;
}
primary.addEventListener("abort", onAbort);
secondary.addEventListener("abort", onAbort);
return controller.signal;
}Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@diegosouzapw I've opened a new pull request, #208, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@diegosouzapw I've opened a new pull request, #209, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@diegosouzapw I've opened a new pull request, #210, to work on those changes. Once the pull request is ready, I'll request review from you. |
…ate READMEs, and add E2E tests.
… strategy guides and advanced settings, and introduce E2E tests for the combos flow.
…updating i18n messages and e2e tests.
- Renamed sidebar 'Endpoint' to 'Endpoints', removed standalone MCP/A2A entries - Created tabbed layout with SegmentedControl: Endpoint Proxy | MCP | A2A | API Endpoints - Added inline ServiceToggle (online/offline status) for MCP and A2A tabs - Created ApiEndpointsTab placeholder with Coming Soon badge - Updated i18n in en.json and pt.json with new endpoints namespace
… Endpoints consolidation - Rewrote AGENTS.md with v2.0.0 architecture (MCP, A2A, Auto-Combo, Endpoints tabs) - Updated CHANGELOG unreleased section with Endpoints consolidation details - Updated README references from Endpoint to Endpoints (screenshots, playbook, quickstart) - Applied endpoints sidebar/header/namespace i18n to all 28 remaining language files
- Added mcpEnabled/a2aEnabled boolean fields to updateSettingsSchema - Rewrote ServiceToggle as clickable on/off switch with status indicator - Toggle persists state via PATCH /api/settings - Both services default to disabled (OFF)
- Created settingsSchemas.ts with updateSettingsSchema to avoid webpack tree-shaking the schema from the 908-line schemas.ts barrel file - Updated settings/route.ts import to use new dedicated file - Fixed focusRingColor lint error in ServiceToggle
- Created httpTransport.ts with singleton MCP server and WebStandard Streamable HTTP transport running inside Next.js process - Added /api/mcp/sse route (GET+POST) for SSE transport - Added /api/mcp/stream route (GET+POST+DELETE) for Streamable HTTP - Added mcpTransport enum to settingsSchemas (stdio|sse|streamable-http) - Updated /api/mcp/status to report HTTP transport state - Added TransportSelector UI with mode buttons and connection URL display - Routes guard against disabled MCP or wrong transport mode
…P), service toggles, endpoints consolidation - MCP multi-transport: stdio, SSE (/api/mcp/sse), Streamable HTTP (/api/mcp/stream) - Service enable/disable toggles with settings persistence (default: OFF) - Consolidated Endpoints page with tabbed navigation - Transport selector UI with connection URLs and Copy button - Webpack barrel-file fix for settingsSchemas
No description provided.