Skip to content

Commit 1915ee2

Browse files
authored
Merge pull request #137 from Opencode-DCP/feature/system-prompt-transform
Add system prompt transformation hook
2 parents 83e4703 + ca1f35f commit 1915ee2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Plugin } from "@opencode-ai/plugin"
22
import { getConfig } from "./lib/config"
33
import { Logger } from "./lib/logger"
4+
import { loadPrompt } from "./lib/prompt"
45
import { createSessionState } from "./lib/state"
56
import { createPruneTool } from "./lib/strategies"
67
import { createChatMessageTransformHandler, createEventHandler } from "./lib/hooks"
@@ -27,6 +28,10 @@ const plugin: Plugin = (async (ctx) => {
2728
})
2829

2930
return {
31+
"experimental.chat.system.transform": async (_input: unknown, output: { system: string[] }) => {
32+
const syntheticPrompt = loadPrompt("synthetic")
33+
output.system.push(syntheticPrompt)
34+
},
3035
"experimental.chat.messages.transform": createChatMessageTransformHandler(
3136
ctx.client,
3237
state,

lib/messages/prune.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const prune = (
9292
messages: WithParts[]
9393
): void => {
9494
pruneToolOutputs(state, logger, messages)
95+
// more prune methods coming here
9596
}
9697

9798
const pruneToolOutputs = (

0 commit comments

Comments
 (0)