Skip to content

Commit 066f6c3

Browse files
rustybretclaude
andcommitted
local: plugin init, reasoning_content stripping, debug logging, pvrdrxtd submodule
- Strip reasoning_content/reasoning_details from messages for providers that don't support interleaved reasoning (e.g. Cerebras) - Add plugin.init() calls in Agent.state and Command layer so plugins load before skills/commands are built - Add LLM param debug logging for model introspection - Add pvrdrxtd submodule and .gitignore entries for local paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c449d3d commit 066f6c3

7 files changed

Lines changed: 41 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ UPCOMING_CHANGELOG.md
3030
logs/
3131
*.bun-build
3232
tsconfig.tsbuildinfo
33+
34+
/.opencode/plugins
35+
/.sisyphus/run-continuation
36+
/.teams/runtime

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "submodules/pvrdrxtd"]
2+
path = submodules/pvrdrxtd
3+
url = https://github.com/rustybret/pvrdrxtd.git

packages/opencode/src/agent/agent.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export const layer = Layer.effect(
8888

8989
const state = yield* InstanceState.make<State>(
9090
Effect.fn("Agent.state")(function* (ctx) {
91+
yield* plugin.init()
9192
const cfg = yield* config.get()
9293
const skillDirs = yield* skill.dirs()
9394
const whitelistedDirs = [
@@ -322,9 +323,7 @@ export const layer = Layer.effect(
322323
)
323324
}
324325

325-
const get = Effect.fnUntraced(function* (agent: string) {
326-
return agents[agent]
327-
})
326+
const get = (agent: string) => Effect.succeed(agents[agent])
328327

329328
const list = Effect.fnUntraced(function* () {
330329
const cfg = yield* config.get()

packages/opencode/src/command/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { InstanceContext } from "@/project/instance-context"
55
import { SessionID, MessageID } from "@/session/schema"
66
import { Effect, Layer, Context, Schema } from "effect"
77
import { Config } from "@/config/config"
8+
import { Plugin } from "@/plugin"
89
import { MCP } from "../mcp"
910
import { Skill } from "../skill"
1011
import PROMPT_INITIALIZE from "./template/initialize.txt"
@@ -66,10 +67,12 @@ export const layer = Layer.effect(
6667
Service,
6768
Effect.gen(function* () {
6869
const config = yield* Config.Service
70+
const plugin = yield* Plugin.Service
6971
const mcp = yield* MCP.Service
7072
const skill = yield* Skill.Service
7173

7274
const init = Effect.fn("Command.state")(function* (ctx: InstanceContext) {
75+
yield* plugin.init()
7376
const cfg = yield* config.get()
7477
const bridge = yield* EffectBridge.make()
7578
const commands: Record<string, Info> = {}
@@ -173,6 +176,7 @@ export const layer = Layer.effect(
173176
)
174177

175178
export const defaultLayer = layer.pipe(
179+
Layer.provide(Plugin.defaultLayer),
176180
Layer.provide(Config.defaultLayer),
177181
Layer.provide(MCP.defaultLayer),
178182
Layer.provide(Skill.defaultLayer),

packages/opencode/src/provider/transform.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ function normalizeMessages(
119119
})
120120
}
121121
return msg
122+
default:
123+
return msg
122124
}
123125
})
124126

@@ -334,7 +336,20 @@ function normalizeMessages(
334336
})
335337
}
336338

337-
return msgs
339+
// Strip reasoning_content / reasoning_details from messages when the provider
340+
// does not support interleaved reasoning. Otherwise providers like Cerebras
341+
// reject the request with "property 'messages.N.assistant.reasoning_content' is unsupported".
342+
return msgs.map((msg) => {
343+
if (msg.role !== "assistant" || !msg.providerOptions?.openaiCompatible) return msg
344+
const { reasoning_content: _rc, reasoning_details: _rd, ...rest } = msg.providerOptions.openaiCompatible
345+
return {
346+
...msg,
347+
providerOptions: {
348+
...msg.providerOptions,
349+
openaiCompatible: rest,
350+
},
351+
}
352+
})
338353
}
339354

340355
function applyCaching(msgs: ModelMessage[], model: Provider.Model): ModelMessage[] {

packages/opencode/src/session/llm.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,17 @@ const live: Layer.Layer<
327327
})
328328
: undefined
329329

330+
l.info("params", {
331+
temperature: params.temperature,
332+
topP: params.topP,
333+
topK: params.topK,
334+
maxOutputTokens: params.maxOutputTokens,
335+
variant: input.user.model.variant,
336+
providerOptions: ProviderTransform.providerOptions(input.model, params.options),
337+
limit: input.model.limit,
338+
capabilities: input.model.capabilities,
339+
})
340+
330341
const opencodeProjectID = input.model.providerID.startsWith("opencode")
331342
? (yield* InstanceState.context).project.id
332343
: undefined

submodules/pvrdrxtd

Submodule pvrdrxtd added at 53daaa1

0 commit comments

Comments
 (0)