summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin/src
diff options
context:
space:
mode:
authorJoel Hooks <[email protected]>2025-12-22 20:19:14 -0800
committerGitHub <[email protected]>2025-12-22 22:19:14 -0600
commiteab177f5e7ae91bdd7679867b43f77a479aefb74 (patch)
treea793dfd57d07d168b9f434bae1c0fcb2ecb54be5 /packages/plugin/src
parent279dc04b3c2faa634352a3782e313321eef5acc9 (diff)
downloadopencode-eab177f5e7ae91bdd7679867b43f77a479aefb74.tar.gz
opencode-eab177f5e7ae91bdd7679867b43f77a479aefb74.zip
feat(plugin): allow compaction hook to replace prompt entirely (#5907)
Diffstat (limited to 'packages/plugin/src')
-rw-r--r--packages/plugin/src/index.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index 487e6ed3e..fbc0e710c 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -192,10 +192,16 @@ export interface Hooks {
},
) => Promise<void>
/**
- * Called before session compaction starts. Allows plugins to append
- * additional context to the compaction prompt.
+ * Called before session compaction starts. Allows plugins to customize
+ * the compaction prompt.
+ *
+ * - `context`: Additional context strings appended to the default prompt
+ * - `prompt`: If set, replaces the default compaction prompt entirely
*/
- "experimental.session.compacting"?: (input: { sessionID: string }, output: { context: string[] }) => Promise<void>
+ "experimental.session.compacting"?: (
+ input: { sessionID: string },
+ output: { context: string[]; prompt?: string },
+ ) => Promise<void>
"experimental.text.complete"?: (
input: { sessionID: string; messageID: string; partID: string },
output: { text: string },