opencode-devin 0.2.5 → 0.2.6

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
@@ -72,6 +72,48 @@ Speed and context modifiers are separate families (`devin/claude-opus-5-5-fast`,
72
72
  `devin/glm-5-2-1m`). The per-effort UIDs are still accepted, so an existing
73
73
  `devin/claude-opus-5-5-high` keeps working; they are only hidden from the picker.
74
74
 
75
+ ### Uncensored mode
76
+
77
+ By default (`"normal"`) the plugin streams the model's answer through
78
+ unchanged. Setting `mode` to `"uncensored"` runs every request through the
79
+ [devin-engine](https://www.npmjs.com/package/devin-engine) guarded-retry
80
+ pipeline — the same machinery the standalone
81
+ [devin-proxy](https://www.npmjs.com/package/devin-proxy) serves over HTTP:
82
+
83
+ - an override system prompt tuned for direct, mechanism-level answers,
84
+ - history sanitizing, so earlier refusals do not anchor later turns,
85
+ - a refusal guard that holds back the first characters of every reply and
86
+ transparently resamples — escalating temperature, framing the request as
87
+ continuing work already agreed on — whenever the model opens a refusal.
88
+ Retries are invisible downstream; only the final attempt passes a refusal
89
+ through.
90
+
91
+ ```jsonc
92
+ // opencode.json
93
+ {
94
+ "provider": {
95
+ "devin": {
96
+ "options": {
97
+ "mode": "uncensored" // default "normal"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ All settings are optional:
105
+
106
+ | Option | Default | What it controls |
107
+ | --- | --- | --- |
108
+ | `mode` | `"normal"` | `"uncensored"` enables the pipeline. |
109
+ | `guardChars` | `700` | Head-window size the refusal guard scans before releasing text. |
110
+ | `guardFull` | `false` | Buffer and scan the whole reply instead — catches comply-then-pivot refusals at the cost of streaming. |
111
+ | `maxRetries` | `3` | Resample attempts after the first one. |
112
+ | `overrideFile` | bundled EN | Override prompt: a filesystem path, or `"en"` / `"es"` for the bundled variants. `~/.devin-proxy/override-compact.txt` is picked up too, same as the standalone proxy. |
113
+ | `keepClientSystem` | `false` | Keep OpenCode's own system prompt ahead of the override instead of replacing it. |
114
+
115
+ The engine is imported dynamically: in normal mode it is never loaded.
116
+
75
117
  ## How it works
76
118
 
77
119
  ```mermaid
@@ -49,6 +49,13 @@ export declare function collectEvents(events: AsyncGenerator<ChatEvent>): Promis
49
49
  export interface DevinProviderOptions {
50
50
  apiKey: string;
51
51
  baseURL?: string;
52
+ /** Pipeline mode — see DevinProviderSettings in ../provider.ts. */
53
+ mode?: "normal" | "uncensored";
54
+ guardChars?: number;
55
+ guardFull?: boolean;
56
+ maxRetries?: number;
57
+ overrideFile?: string;
58
+ keepClientSystem?: boolean;
52
59
  }
53
60
  export interface DevinProvider {
54
61
  languageModel(modelId: string): LanguageModelV3;
@@ -516,6 +516,36 @@ function isKnownToCatalog(modelId, catalog) {
516
516
  return undefined;
517
517
  return catalog.entries.some((entry) => entry.modelUid === modelId);
518
518
  }
519
+ /**
520
+ * Stream one request through the devin-engine guarded-retry pipeline.
521
+ *
522
+ * The import is dynamic on purpose: the engine is the compliance layer (the
523
+ * jailbreak), and a user in normal mode should neither load nor execute it —
524
+ * same reason devin-core and devin-engine are separate packages in the first
525
+ * place.
526
+ */
527
+ async function* streamThroughPipeline(options, wire) {
528
+ const { CascadePipeline } = await import("devin-engine");
529
+ const settings = options.pipeline ?? {};
530
+ const pipeline = new CascadePipeline({
531
+ mode: settings.mode ?? "normal",
532
+ guardChars: settings.guardChars,
533
+ guardFull: settings.guardFull,
534
+ maxRetries: settings.maxRetries,
535
+ overrideFile: settings.overrideFile,
536
+ keepClientSystem: settings.keepClientSystem,
537
+ }, options.apiKey, options.apiServerUrl ?? DEFAULT_API_SERVER);
538
+ yield* pipeline.stream({
539
+ modelUid: wire.modelUid,
540
+ messages: wire.messages,
541
+ tools: wire.tools,
542
+ toolChoice: wire.toolChoice,
543
+ maxOutputTokens: wire.maxOutputTokens,
544
+ temperature: wire.temperature,
545
+ topP: wire.topP,
546
+ signal: wire.signal,
547
+ });
548
+ }
519
549
  /**
520
550
  * Add the likely cause to a failure for a model the catalog never listed.
521
551
  *
@@ -541,25 +571,39 @@ function createLanguageModel(options) {
541
571
  // Checked on the UID that is sent: a family id is not a UID of its own.
542
572
  checkModelUsable(resolvedModelId, catalog);
543
573
  const { messages, warnings } = convertPrompt(callOptions.prompt);
544
- return {
545
- resolvedModelId,
546
- warnings,
547
- knownToCatalog: isKnownToCatalog(resolvedModelId, catalog),
548
- events: streamChatEvents({
574
+ const wire = {
575
+ modelUid: resolvedModelId,
576
+ messages,
577
+ tools: convertTools(callOptions.tools),
578
+ toolChoice: callOptions.toolChoice,
579
+ maxOutputTokens: callOptions.maxOutputTokens,
580
+ temperature: callOptions.temperature,
581
+ topP: callOptions.topP,
582
+ signal,
583
+ };
584
+ const pipelineMode = options.pipeline?.mode ?? "normal";
585
+ const events = pipelineMode === "uncensored"
586
+ ? streamThroughPipeline(options, wire)
587
+ : streamChatEvents({
549
588
  apiKey: options.apiKey,
550
589
  apiServerUrl: options.apiServerUrl,
551
- modelUid: resolvedModelId,
552
- messages,
553
- tools: convertTools(callOptions.tools),
554
- toolChoice: callOptions.toolChoice,
590
+ modelUid: wire.modelUid,
591
+ messages: wire.messages,
592
+ tools: wire.tools,
593
+ toolChoice: wire.toolChoice,
555
594
  completionOpts: {
556
- maxOutputTokens: callOptions.maxOutputTokens,
557
- temperature: callOptions.temperature,
558
- topP: callOptions.topP,
595
+ maxOutputTokens: wire.maxOutputTokens,
596
+ temperature: wire.temperature,
597
+ topP: wire.topP,
559
598
  topK: callOptions.topK,
560
599
  },
561
600
  signal,
562
- }),
601
+ });
602
+ return {
603
+ resolvedModelId,
604
+ warnings,
605
+ knownToCatalog: isKnownToCatalog(resolvedModelId, catalog),
606
+ events,
563
607
  };
564
608
  };
565
609
  return {
@@ -669,6 +713,14 @@ export function createDevin(options) {
669
713
  apiKey,
670
714
  apiServerUrl: options.baseURL,
671
715
  loadCatalog,
716
+ pipeline: {
717
+ mode: options.mode,
718
+ guardChars: options.guardChars,
719
+ guardFull: options.guardFull,
720
+ maxRetries: options.maxRetries,
721
+ overrideFile: options.overrideFile,
722
+ keepClientSystem: options.keepClientSystem,
723
+ },
672
724
  });
673
725
  },
674
726
  };
@@ -12,6 +12,23 @@ export interface DevinProviderSettings {
12
12
  readonly apiKey?: string;
13
13
  readonly baseURL?: string;
14
14
  readonly name?: string;
15
+ /**
16
+ * "normal" (default) streams the model's answer through unchanged.
17
+ * "uncensored" runs every request through the devin-engine guarded-retry
18
+ * pipeline: an override system prompt, history sanitizing, and a refusal
19
+ * guard that transparently resamples when the model starts a refusal.
20
+ */
21
+ readonly mode?: "normal" | "uncensored";
22
+ /** Refusal-detection window in chars (devin-engine default: 700). */
23
+ readonly guardChars?: number;
24
+ /** Guard the full response instead of only the head window. */
25
+ readonly guardFull?: boolean;
26
+ /** Resample attempts after the first one (devin-engine default: 3). */
27
+ readonly maxRetries?: number;
28
+ /** Override prompt file: a path, or "en" / "es" for the bundled variants. */
29
+ readonly overrideFile?: string;
30
+ /** Keep the client system prompt ahead of the override. */
31
+ readonly keepClientSystem?: boolean;
15
32
  }
16
33
  export declare function createDevinProvider(options: DevinProviderSettings): {
17
34
  languageModel: (modelID: string) => import("@ai-sdk/provider").LanguageModelV3;
package/dist/provider.js CHANGED
@@ -13,6 +13,12 @@ export function createDevinProvider(options) {
13
13
  const provider = createDevin({
14
14
  apiKey: options.apiKey ?? "",
15
15
  baseURL: options.baseURL,
16
+ mode: options.mode,
17
+ guardChars: options.guardChars,
18
+ guardFull: options.guardFull,
19
+ maxRetries: options.maxRetries,
20
+ overrideFile: options.overrideFile,
21
+ keepClientSystem: options.keepClientSystem,
16
22
  });
17
23
  return {
18
24
  languageModel: (modelID) => provider.languageModel(modelID),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "opencode-devin",
4
- "version": "0.2.5",
4
+ "version": "0.2.6",
5
5
  "description": "OpenCode v2 plugin: connect your Devin subscription to opencode with native /connect login and devin/* models",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -47,7 +47,8 @@
47
47
  "dependencies": {
48
48
  "@ai-sdk/provider": "3.0.8",
49
49
  "@opencode/plugin": "2.4.1",
50
- "devin-core": "^0.0.5"
50
+ "devin-core": "^0.0.5",
51
+ "devin-engine": "^0.0.5"
51
52
  },
52
53
  "devDependencies": {
53
54
  "@types/bun": "1.4.4",