mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 14:52:09 +03:00
feat(mitm): add remaining targets (cursor/zed/claudeCode/openCode/trae) (F3)
Declarative MitmTarget descriptors for the remaining agent identities: - cursor: api2.cursor.sh, OpenAI Chat Completions - zed: api.zed.dev, OpenAI Chat Completions - claude-code: api.anthropic.com, Anthropic Messages format - open-code: opencode.ai, OpenAI Chat Completions - trae: viability=investigating, host trae.invalid placeholder All entries point at lazy dynamic imports of their respective handlers in src/mitm/handlers/<id>.ts (F3 handlers commit).
This commit is contained in:
37
src/mitm/targets/claudeCode.ts
Normal file
37
src/mitm/targets/claudeCode.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Claude Code (Anthropic CLI) — MITM target descriptor.
|
||||
*
|
||||
* Hosts: `api.anthropic.com`.
|
||||
* Format: Anthropic Messages API on `/v1/messages`.
|
||||
*
|
||||
* NOTE: shares the host `api.anthropic.com` with the Kiro target. The DNS-routing
|
||||
* tutorial therefore is opt-in: the user explicitly enables interception when
|
||||
* they want Claude Code traffic captured.
|
||||
*/
|
||||
import type { MitmTarget } from "../types";
|
||||
|
||||
export const CLAUDE_CODE_TARGET: MitmTarget = {
|
||||
id: "claude-code",
|
||||
name: "Claude Code",
|
||||
icon: "terminal",
|
||||
color: "#D97706",
|
||||
hosts: ["api.anthropic.com"],
|
||||
port: 443,
|
||||
endpointPatterns: ["/v1/messages"],
|
||||
defaultModels: [
|
||||
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", alias: "claude-sonnet-4.5" },
|
||||
{ id: "claude-opus-4.5", name: "Claude Opus 4.5", alias: "claude-opus-4.5" },
|
||||
],
|
||||
setupTutorial: {
|
||||
steps: [
|
||||
"Install Claude Code (Anthropic CLI)",
|
||||
"Install OmniRoute's root certificate",
|
||||
"Enable DNS routing for Claude Code",
|
||||
"Run `claude` — requests are now proxied via OmniRoute",
|
||||
],
|
||||
detection: { command: "which claude", platform: "all" },
|
||||
},
|
||||
handler: () =>
|
||||
import("../handlers/claudeCode").then((m) => ({ default: m.ClaudeCodeHandler })),
|
||||
riskNoticeKey: "providers.riskNotice.oauth",
|
||||
};
|
||||
33
src/mitm/targets/cursor.ts
Normal file
33
src/mitm/targets/cursor.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Cursor IDE — MITM target descriptor.
|
||||
*
|
||||
* Hosts: `api2.cursor.sh` (chat backend).
|
||||
* Format: OpenAI-compatible Chat Completions on `/v1/chat/completions`.
|
||||
*/
|
||||
import type { MitmTarget } from "../types";
|
||||
|
||||
export const CURSOR_TARGET: MitmTarget = {
|
||||
id: "cursor",
|
||||
name: "Cursor IDE",
|
||||
icon: "edit_note",
|
||||
color: "#0EA5E9",
|
||||
hosts: ["api2.cursor.sh"],
|
||||
port: 443,
|
||||
endpointPatterns: ["/v1/chat/completions"],
|
||||
defaultModels: [
|
||||
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", alias: "claude-sonnet-4.5" },
|
||||
{ id: "gpt-4o", name: "GPT-4o", alias: "gpt-4o" },
|
||||
],
|
||||
setupTutorial: {
|
||||
steps: [
|
||||
"Install OmniRoute's root certificate",
|
||||
"Enable DNS routing for Cursor",
|
||||
"Restart Cursor IDE",
|
||||
"Done — Cursor traffic now routes through OmniRoute",
|
||||
],
|
||||
detection: { command: "which cursor", platform: "all" },
|
||||
},
|
||||
handler: () =>
|
||||
import("../handlers/cursor").then((m) => ({ default: m.CursorHandler })),
|
||||
riskNoticeKey: "providers.riskNotice.oauth",
|
||||
};
|
||||
34
src/mitm/targets/openCode.ts
Normal file
34
src/mitm/targets/openCode.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* OpenCode — MITM target descriptor.
|
||||
*
|
||||
* Hosts: `opencode.ai`.
|
||||
* Format: OpenAI-compatible Chat Completions on `/v1/chat/completions`.
|
||||
*/
|
||||
import type { MitmTarget } from "../types";
|
||||
|
||||
export const OPEN_CODE_TARGET: MitmTarget = {
|
||||
id: "open-code",
|
||||
name: "OpenCode",
|
||||
icon: "code",
|
||||
color: "#22D3EE",
|
||||
hosts: ["opencode.ai"],
|
||||
port: 443,
|
||||
endpointPatterns: ["/v1/chat/completions"],
|
||||
defaultModels: [
|
||||
{ id: "gpt-4o", name: "GPT-4o", alias: "gpt-4o" },
|
||||
{ id: "claude-3.5-sonnet", name: "Claude 3.5 Sonnet", alias: "claude-3.5-sonnet" },
|
||||
],
|
||||
setupTutorial: {
|
||||
steps: [
|
||||
"Install the OpenCode CLI/IDE",
|
||||
"Install OmniRoute's root certificate",
|
||||
"Enable DNS routing for OpenCode",
|
||||
"Restart OpenCode",
|
||||
"Done — OpenCode traffic now routes through OmniRoute",
|
||||
],
|
||||
detection: { command: "which opencode", platform: "all" },
|
||||
},
|
||||
handler: () =>
|
||||
import("../handlers/openCode").then((m) => ({ default: m.OpenCodeHandler })),
|
||||
riskNoticeKey: "providers.riskNotice.oauth",
|
||||
};
|
||||
32
src/mitm/targets/trae.ts
Normal file
32
src/mitm/targets/trae.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Trae — MITM target descriptor (stub).
|
||||
*
|
||||
* Viability is still under investigation (see plan 11 §5). The hostname
|
||||
* `trae.invalid` is a deliberate non-routable placeholder so the target is
|
||||
* registered (UI can list it as "investigating") without ever matching real
|
||||
* traffic. The concrete host list will be filled in once we confirm the
|
||||
* upstream API surface.
|
||||
*/
|
||||
import type { MitmTarget } from "../types";
|
||||
|
||||
export const TRAE_TARGET: MitmTarget = {
|
||||
id: "trae",
|
||||
name: "Trae",
|
||||
icon: "construction",
|
||||
color: "#94A3B8",
|
||||
hosts: ["trae.invalid"],
|
||||
port: 443,
|
||||
endpointPatterns: [],
|
||||
defaultModels: [],
|
||||
setupTutorial: {
|
||||
steps: [
|
||||
"Trae integration is under investigation",
|
||||
"Setup steps will be published once the upstream API is confirmed",
|
||||
],
|
||||
detection: { command: "which trae", platform: "all" },
|
||||
},
|
||||
handler: () =>
|
||||
import("../handlers/trae").then((m) => ({ default: m.TraeHandler })),
|
||||
riskNoticeKey: "providers.riskNotice.investigating",
|
||||
viability: "investigating",
|
||||
};
|
||||
32
src/mitm/targets/zed.ts
Normal file
32
src/mitm/targets/zed.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Zed IDE — MITM target descriptor.
|
||||
*
|
||||
* Hosts: `api.zed.dev`.
|
||||
* Format: OpenAI-compatible Chat Completions on `/v1/chat/completions`.
|
||||
*/
|
||||
import type { MitmTarget } from "../types";
|
||||
|
||||
export const ZED_TARGET: MitmTarget = {
|
||||
id: "zed",
|
||||
name: "Zed",
|
||||
icon: "bolt",
|
||||
color: "#EF4444",
|
||||
hosts: ["api.zed.dev"],
|
||||
port: 443,
|
||||
endpointPatterns: ["/v1/chat/completions"],
|
||||
defaultModels: [
|
||||
{ id: "claude-3.5-sonnet", name: "Claude 3.5 Sonnet", alias: "claude-3.5-sonnet" },
|
||||
{ id: "gpt-4o", name: "GPT-4o", alias: "gpt-4o" },
|
||||
],
|
||||
setupTutorial: {
|
||||
steps: [
|
||||
"Install OmniRoute's root certificate",
|
||||
"Enable DNS routing for Zed",
|
||||
"Restart Zed",
|
||||
"Done — Zed traffic now routes through OmniRoute",
|
||||
],
|
||||
detection: { command: "which zed", platform: "all" },
|
||||
},
|
||||
handler: () => import("../handlers/zed").then((m) => ({ default: m.ZedHandler })),
|
||||
riskNoticeKey: "providers.riskNotice.oauth",
|
||||
};
|
||||
Reference in New Issue
Block a user