chore(index): remove contextInjector chat.message hook call
- Remove createContextInjectorHook from imports - Remove contextInjector variable declaration - Remove contextInjector["chat.message"] call - Keep contextInjectorMessagesTransform for synthetic part injection - Update test: prepend → synthetic part insertion verification
This commit is contained in:
@@ -208,7 +208,7 @@ describe("createContextInjectorMessagesTransformHook", () => {
|
||||
],
|
||||
})
|
||||
|
||||
it("prepends context to last user message", async () => {
|
||||
it("inserts synthetic part before text part in last user message", async () => {
|
||||
// #given
|
||||
const hook = createContextInjectorMessagesTransformHook(collector)
|
||||
const sessionID = "ses_transform1"
|
||||
@@ -228,9 +228,12 @@ describe("createContextInjectorMessagesTransformHook", () => {
|
||||
// #when
|
||||
await hook["experimental.chat.messages.transform"]!({}, output)
|
||||
|
||||
// #then
|
||||
// #then - synthetic part inserted before original text part
|
||||
expect(output.messages.length).toBe(3)
|
||||
expect(output.messages[2].parts[0].text).toBe("Ultrawork context\n\n---\n\nSecond message")
|
||||
expect(output.messages[2].parts.length).toBe(2)
|
||||
expect(output.messages[2].parts[0].text).toBe("Ultrawork context")
|
||||
expect(output.messages[2].parts[0].synthetic).toBe(true)
|
||||
expect(output.messages[2].parts[1].text).toBe("Second message")
|
||||
})
|
||||
|
||||
it("does nothing when no pending context", async () => {
|
||||
|
||||
@@ -34,7 +34,6 @@ import {
|
||||
} from "./hooks";
|
||||
import {
|
||||
contextCollector,
|
||||
createContextInjectorHook,
|
||||
createContextInjectorMessagesTransformHook,
|
||||
} from "./features/context-injector";
|
||||
import { applyAgentVariant, resolveAgentVariant } from "./shared/agent-variant";
|
||||
@@ -163,7 +162,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
const keywordDetector = isHookEnabled("keyword-detector")
|
||||
? createKeywordDetectorHook(ctx, contextCollector)
|
||||
: null;
|
||||
const contextInjector = createContextInjectorHook(contextCollector);
|
||||
const contextInjectorMessagesTransform =
|
||||
createContextInjectorMessagesTransformHook(contextCollector);
|
||||
const agentUsageReminder = isHookEnabled("agent-usage-reminder")
|
||||
@@ -327,7 +325,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
|
||||
await keywordDetector?.["chat.message"]?.(input, output);
|
||||
await claudeCodeHooks["chat.message"]?.(input, output);
|
||||
await contextInjector["chat.message"]?.(input, output);
|
||||
await autoSlashCommand?.["chat.message"]?.(input, output);
|
||||
await startWork?.["chat.message"]?.(input, output);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user