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:
parent
d3e3371a77
commit
ea1d604b72
@ -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
|
// #given
|
||||||
const hook = createContextInjectorMessagesTransformHook(collector)
|
const hook = createContextInjectorMessagesTransformHook(collector)
|
||||||
const sessionID = "ses_transform1"
|
const sessionID = "ses_transform1"
|
||||||
@ -228,9 +228,12 @@ describe("createContextInjectorMessagesTransformHook", () => {
|
|||||||
// #when
|
// #when
|
||||||
await hook["experimental.chat.messages.transform"]!({}, output)
|
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.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 () => {
|
it("does nothing when no pending context", async () => {
|
||||||
|
|||||||
@ -34,7 +34,6 @@ import {
|
|||||||
} from "./hooks";
|
} from "./hooks";
|
||||||
import {
|
import {
|
||||||
contextCollector,
|
contextCollector,
|
||||||
createContextInjectorHook,
|
|
||||||
createContextInjectorMessagesTransformHook,
|
createContextInjectorMessagesTransformHook,
|
||||||
} from "./features/context-injector";
|
} from "./features/context-injector";
|
||||||
import { applyAgentVariant, resolveAgentVariant } from "./shared/agent-variant";
|
import { applyAgentVariant, resolveAgentVariant } from "./shared/agent-variant";
|
||||||
@ -163,7 +162,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
const keywordDetector = isHookEnabled("keyword-detector")
|
const keywordDetector = isHookEnabled("keyword-detector")
|
||||||
? createKeywordDetectorHook(ctx, contextCollector)
|
? createKeywordDetectorHook(ctx, contextCollector)
|
||||||
: null;
|
: null;
|
||||||
const contextInjector = createContextInjectorHook(contextCollector);
|
|
||||||
const contextInjectorMessagesTransform =
|
const contextInjectorMessagesTransform =
|
||||||
createContextInjectorMessagesTransformHook(contextCollector);
|
createContextInjectorMessagesTransformHook(contextCollector);
|
||||||
const agentUsageReminder = isHookEnabled("agent-usage-reminder")
|
const agentUsageReminder = isHookEnabled("agent-usage-reminder")
|
||||||
@ -327,7 +325,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
|
|
||||||
await keywordDetector?.["chat.message"]?.(input, output);
|
await keywordDetector?.["chat.message"]?.(input, output);
|
||||||
await claudeCodeHooks["chat.message"]?.(input, output);
|
await claudeCodeHooks["chat.message"]?.(input, output);
|
||||||
await contextInjector["chat.message"]?.(input, output);
|
|
||||||
await autoSlashCommand?.["chat.message"]?.(input, output);
|
await autoSlashCommand?.["chat.message"]?.(input, output);
|
||||||
await startWork?.["chat.message"]?.(input, output);
|
await startWork?.["chat.message"]?.(input, output);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user