Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/__tests__/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { describe, expect, it } from "bun:test"
import { readFileSync } from "node:fs"
import { join } from "node:path"
import plugin from "../index.js"
import type { RequestContext } from "../types.js"

const packageVersion = JSON.parse(readFileSync(join(import.meta.dir, "..", "..", "package.json"), "utf8")).version

const opencodePrompt = `You are powered by the model named claude-haiku-4-5. The exact model ID is anthropic/claude-haiku-4-5
Here is some useful information about the environment you are running in:
<env>
Expand All @@ -10,6 +14,10 @@ Here is some useful information about the environment you are running in:
</env>`

describe("opencode-scrub adapter boundary", () => {
it("reports the shipped package version", () => {
expect(plugin.version).toBe(packageVersion)
})

it("includes LiteLLM's passthrough classification and scrubs OpenCode content", () => {
expect(plugin.adapters).toContain("passthrough")
const ctx: RequestContext = { adapter: "passthrough", systemContext: opencodePrompt, metadata: {} }
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type { Transform, RequestContext } from "./types.js"
import packageMetadata from "../package.json" with { type: "json" }
import { scrubOpencodeFingerprints } from "./scrub.js"

export type { Transform, RequestContext } from "./types.js"
Expand All @@ -19,7 +20,7 @@ const PASSTHROUGH_OPENCODE_MARKER =

const plugin: Transform = {
name: "opencode-scrub",
version: "0.1.0",
version: packageMetadata.version,
description: "Strip opencode-identifying fingerprints from the system prompt before it reaches Claude",
adapters: ["opencode", "passthrough"],

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": [
"ES2022"
Expand Down
Loading