devin-proxy 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,53 +1,86 @@
1
- # devin-proxy
2
-
3
- An **OpenAI-compatible local proxy** that serves the Devin/Cascade backend's SWE-2 / SWE-2.1 lanes through the [`devin-engine`](../devin-engine) guarded-retry pipeline — a drop-in `OPENAI_BASE_URL` for any client that speaks `/v1/chat/completions`.
4
-
5
- TypeScript port of the Python `devin-proxy`. Sits on [`devin-core`](../devin-core) (wire + auth + catalog) and [`devin-engine`](../devin-engine) (guard, override, retry, sanitize, resolve).
6
-
7
- ## Run
8
-
9
- ```bash
10
- bun install
11
- bun src/cli.ts serve # 127.0.0.1:8390
12
- # or, after build:
13
- node dist/cli.js serve --port 8390
14
- ```
15
-
16
- Credentials come from `DEVIN_PROXY_API_KEY` or the Devin CLI's `credentials.toml` (`windsurf_api_key`). `devin-proxy login` runs the PKCE browser flow and writes it.
17
-
18
- ## Client
19
-
20
- ```python
21
- from openai import OpenAI
22
- c = OpenAI(base_url="http://127.0.0.1:8391/v1", api_key="unused")
23
- c.chat.completions.create(model="swe-2", messages=[...])
24
- ```
25
-
26
- Point `ANTHROPIC_BASE_URL`/`OPENAI_BASE_URL`, Cursor, aider, continue.dev, Cline — anything OpenAI-shaped — at it.
27
-
28
- ## Endpoints
29
-
30
- | Route | What |
31
- | --- | --- |
32
- | `POST /v1/chat/completions` | OpenAI chat, `stream: true`→SSE, `stream:false`→unary |
33
- | `GET /v1/models`, `/models` | allowed lanes + `swe-2`/`swe-2-flash`/`swe-2.1` aliases; `free_until`, `credits_per_run`, `free_tier` when `--allow-paid` |
34
- | `GET /health` | backend, override file, catalog count, promo windows |
35
-
36
- ## Models
37
-
38
- `model` resolves by family + `reasoning_effort`:
39
-
40
- - `swe-2` → `swe-2-{medium,high,max}` (default `high`)
41
- - `swe-2-flash` → `swe-2-flash-{medium,high,max}`
42
- - `swe-2.1` → `swe-2-1-{low,medium,high,xhigh,max}` — free promo until **2026-12-09**
43
- - `reasoning_effort` picks the tier inside whichever family the id selected, clamping to the nearest defined level.
44
-
45
- `*-lightning` lanes are never routed — they bill fast-mode credits. `allow_paid` opens the full live catalog; every non-SWE uid bills credits.
46
-
47
- ## Settings
48
-
49
- Env `DEVIN_PROXY_*`, `~/.devin-proxy/settings.toml` `[devin_proxy]`, or flags. Notables: `ALLOW_PAID`, `ALLOWED_MODELS` (CSV), `GUARD_CHARS`, `GUARD_FULL`, `MAX_RETRIES`, `EMIT_REASONING`, `MAX_INPUT_TOKENS`, `SYSTEM_FILE` (`es`/`english`/`spanish` picks a bundled override).
50
-
51
- ## What the engine does per request
52
-
53
- Sanitize history → inject the system override → resolve model → stream upstream → hold the first N chars behind a multilingual refusal guard → on a refusal, resample inside the same downstream stream with an escalated frame (invisible to the client) → translate tool calls back to OpenAI shape. See [devin-engine](../devin-engine).
1
+ # devin-proxy
2
+
3
+ An **OpenAI-compatible local proxy** that serves the Devin/Cascade backend's SWE-2 / SWE-2.1 lanes through the [`devin-engine`](../devin-engine) guarded-retry pipeline — a drop-in `OPENAI_BASE_URL` for any client that speaks `/v1/chat/completions`.
4
+
5
+ TypeScript port of the Python `devin-proxy`. Sits on [`devin-core`](../devin-core) (wire + auth + catalog) and [`devin-engine`](../devin-engine) (guard, override, retry, sanitize, resolve).
6
+
7
+ ## Modes
8
+
9
+ - **`normal`** (default) — vanilla passthrough: history sanitize + model
10
+ resolve, then a single upstream attempt streamed back. No system
11
+ override, no refusal guard, no retry frames.
12
+ - **`uncensored`** — the full guarded-retry pipeline described below:
13
+ override injection, refusal guard, escalated resampling.
14
+
15
+ Enable it any of these ways:
16
+
17
+ ```bash
18
+ devin-proxy serve --mode uncensored
19
+ DEVIN_PROXY_MODE=uncensored devin-proxy serve
20
+ # ~/.devin-proxy/settings.toml
21
+ [devin_proxy]
22
+ mode = "uncensored"
23
+ ```
24
+
25
+
26
+ ## Run
27
+
28
+ ```bash
29
+ bun install
30
+ bun src/cli.ts serve # 127.0.0.1:8390
31
+ # or, after build:
32
+ node dist/cli.js serve --port 8390
33
+ ```
34
+
35
+ Credentials come from `DEVIN_PROXY_API_KEY` or the Devin CLI's `credentials.toml` (`windsurf_api_key`). `devin-proxy login` runs the PKCE browser flow and writes it.
36
+
37
+ ## Client
38
+
39
+ ```python
40
+ from openai import OpenAI
41
+ c = OpenAI(base_url="http://127.0.0.1:8391/v1", api_key="unused")
42
+ c.chat.completions.create(model="swe-2", messages=[...])
43
+ ```
44
+
45
+ Point `ANTHROPIC_BASE_URL`/`OPENAI_BASE_URL`, Cursor, aider, continue.dev, Cline — anything OpenAI-shaped — at it.
46
+
47
+ ## Endpoints
48
+
49
+ | Route | What |
50
+ | --- | --- |
51
+ | `POST /v1/chat/completions` | OpenAI chat, `stream: true`→SSE, `stream:false`→unary |
52
+ | `GET /v1/models`, `/models` | allowed lanes + `swe-2`/`swe-2-flash`/`swe-2.1` aliases; `free_until`, `credits_per_run`, `free_tier` when `--allow-paid` |
53
+ | `GET /health` | backend, override file, catalog count, promo windows |
54
+
55
+ ## Models
56
+
57
+ `model` resolves by family + `reasoning_effort`:
58
+
59
+ - `swe-2` → `swe-2-{medium,high,max}` (default `high`)
60
+ - `swe-2-flash` → `swe-2-flash-{medium,high,max}`
61
+ - `swe-2.1` → `swe-2-1-{low,medium,high,xhigh,max}` — free promo until **2026-12-09**
62
+ - `reasoning_effort` picks the tier inside whichever family the id selected, clamping to the nearest defined level.
63
+
64
+ `*-lightning` lanes are never routed — they bill fast-mode credits. `allow_paid` opens the full live catalog; every non-SWE uid bills credits.
65
+
66
+ ## Settings
67
+
68
+ Env `DEVIN_PROXY_*`, `~/.devin-proxy/settings.toml` `[devin_proxy]`, or flags. Notables: `MODE` (`normal`/`uncensored`), `ALLOW_PAID`, `ALLOWED_MODELS` (CSV), `GUARD_CHARS`, `GUARD_FULL`, `MAX_RETRIES`, `EMIT_REASONING`, `MAX_INPUT_TOKENS`, `SYSTEM_FILE` (`es`/`english`/`spanish` picks a bundled override).
69
+
70
+ ## What the engine does per request
71
+
72
+ In `uncensored` mode: sanitize history → inject the system override → resolve model → stream upstream → hold the first N chars behind a multilingual refusal guard → on a refusal, resample inside the same downstream stream with an escalated frame (invisible to the client) → translate tool calls back to OpenAI shape. See [devin-engine](../devin-engine).
73
+
74
+ ## Ecosystem
75
+
76
+ | Package | Role |
77
+ | --- | --- |
78
+ | `devin-core` | wire + auth + catalog |
79
+ | `devin-engine` | guarded-retry pipeline — the Engine this proxy wraps |
80
+ | **`devin-proxy`** (this) | standalone OpenAI-compatible proxy |
81
+ | `devin-proxy-py` | Python original — reference |
82
+ | `opencode-devin` | OpenCode v2 plugin |
83
+ | `claude-devin` | Claude-compatible surface |
84
+
85
+ Publish: `git tag v* && git push --tags` — OIDC Trusted Publishing
86
+ workflow, no token.
package/dist/cli.js CHANGED
@@ -7,10 +7,11 @@
7
7
  */
8
8
  import { loadSettings } from "./config.js";
9
9
  import { serve } from "./server.js";
10
+ const PKG_VERSION = "0.2.0";
10
11
  const USAGE = `devin-proxy — OpenAI-compatible proxy over the Devin backend
11
12
 
12
13
  Usage:
13
- devin-proxy serve [--host H] [--port P] [--backend URL]
14
+ devin-proxy serve [--host H] [--port P] [--backend URL] [--mode normal|uncensored]
14
15
  devin-proxy login [--api-key TOKEN] # PKCE browser flow, or write token
15
16
  devin-proxy version
16
17
  `;
@@ -22,8 +23,7 @@ async function main(argv) {
22
23
  return i >= 0 ? args[i + 1] : undefined;
23
24
  };
24
25
  if (cmd === "version" || cmd === "--version" || cmd === "-V") {
25
- const { version } = await import("../package.json", { with: { type: "json" } }).catch(() => ({ version: "0.1.0" }));
26
- console.log(version);
26
+ console.log(PKG_VERSION);
27
27
  return 0;
28
28
  }
29
29
  if (cmd === "help" || cmd === "--help" || cmd === "-h") {
@@ -57,6 +57,7 @@ async function main(argv) {
57
57
  ...(flag("host") ? { host: flag("host") } : {}),
58
58
  ...(flag("port") ? { port: parseInt(flag("port"), 10) } : {}),
59
59
  ...(flag("backend") ? { backend: flag("backend") } : {}),
60
+ ...(flag("mode") ? { mode: flag("mode") === "uncensored" ? "uncensored" : "normal" } : {}),
60
61
  });
61
62
  await serve(settings);
62
63
  // Block forever — the server keeps the event loop alive; exiting main
package/dist/config.d.ts CHANGED
@@ -13,6 +13,10 @@ export interface Settings {
13
13
  port: number;
14
14
  backend: string;
15
15
  clientVersion: string;
16
+ /** "normal" = vanilla passthrough (default). "uncensored" = override +
17
+ * refusal guard + retry pipeline. Toggle via DEVIN_PROXY_MODE,
18
+ * settings.toml `mode`, or `--mode`. */
19
+ mode: "normal" | "uncensored";
16
20
  emitReasoning: boolean;
17
21
  stripIncomingReasoning: boolean;
18
22
  guardChars: number;
package/dist/config.js CHANGED
@@ -69,6 +69,7 @@ const DEFAULTS = {
69
69
  port: 8390,
70
70
  backend: "https://server.codeium.com",
71
71
  clientVersion: "auto",
72
+ mode: "normal",
72
73
  emitReasoning: false,
73
74
  stripIncomingReasoning: true,
74
75
  guardChars: 300,
@@ -107,6 +108,7 @@ export function loadSettings(overrides = {}) {
107
108
  pick("port", "PORT", (v) => parseInt(v, 10));
108
109
  pick("backend", "BACKEND", (v) => v.replace(/\/+$/, ""));
109
110
  pick("clientVersion", "CLIENT_VERSION", (v) => v);
111
+ pick("mode", "MODE", (v) => (v.toLowerCase() === "uncensored" ? "uncensored" : "normal"));
110
112
  pick("emitReasoning", "EMIT_REASONING", (v) => v === "true" || v === "1");
111
113
  pick("stripIncomingReasoning", "STRIP_INCOMING_REASONING", (v) => v !== "false" && v !== "0");
112
114
  pick("guardChars", "GUARD_CHARS", (v) => parseInt(v, 10));
package/dist/server.js CHANGED
@@ -102,6 +102,7 @@ export function buildApp(settings, auth, engine, override) {
102
102
  };
103
103
  const healthHandler = () => ({
104
104
  status: "ok",
105
+ mode: settings.mode,
105
106
  backend: settings.backend,
106
107
  override_file: override.path,
107
108
  override_chars: override.load().length,
@@ -271,6 +272,7 @@ export async function serve(settings) {
271
272
  const override = new OverridePrompt(resolveSystemFile(settings.systemFile));
272
273
  const engineSettings = {
273
274
  backend: settings.backend,
275
+ mode: settings.mode,
274
276
  guardChars: settings.guardChars,
275
277
  guardFull: settings.guardFull,
276
278
  maxRetries: settings.maxRetries,
@@ -306,7 +308,9 @@ export async function serve(settings) {
306
308
  app.server.listen(settings.port, settings.host, resolve);
307
309
  });
308
310
  log(`listening on ${settings.host}:${settings.port} -> ${settings.backend} ` +
309
- `(allowed=${settings.allowedModels.join(",")}${settings.allowPaid ? "+paid" : ""}) override=${override.load().length}c`);
311
+ `mode=${settings.mode} ` +
312
+ `(allowed=${settings.allowedModels.join(",")}${settings.allowPaid ? "+paid" : ""})` +
313
+ (settings.mode === "uncensored" ? ` override=${override.load().length}c` : ""));
310
314
  try {
311
315
  auth.apiKey();
312
316
  log(`devin credentials ok (${auth.credentials})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devin-proxy",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "OpenAI-compatible local proxy over the Devin/Cascade backend — SWE-2/SWE-2.1 lanes through the guarded-retry devin-engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "devin-core": "^0.0.3",
46
- "devin-engine": "^0.0.3"
46
+ "devin-engine": "^0.0.4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/bun": "^1.4.4",