mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 20:03:33 +00:00
Fix tests for sessionManager/modelRegistry on context
- compaction-hooks-example.test.ts: get sessionManager/modelRegistry from ctx - compaction-hooks.test.ts: - Pass sessionManager/modelRegistry to HookRunner constructor - Remove setSessionFile call - Update tests to use session.sessionManager instead of event.sessionManager
This commit is contained in:
parent
29fec7848e
commit
5fee9005b7
4 changed files with 18 additions and 11 deletions
|
|
@ -9,11 +9,13 @@ describe("Documentation example", () => {
|
|||
it("custom compaction example should type-check correctly", () => {
|
||||
// This is the example from hooks.md - verify it compiles
|
||||
const exampleHook = (pi: HookAPI) => {
|
||||
pi.on("session", async (event, _ctx) => {
|
||||
pi.on("session", async (event, ctx) => {
|
||||
if (event.reason !== "before_compact") return;
|
||||
|
||||
// After narrowing, these should all be accessible
|
||||
const { preparation, previousCompactions, sessionManager, modelRegistry, model } = event;
|
||||
// sessionManager and modelRegistry come from ctx, not event
|
||||
const { preparation, previousCompactions, model } = event;
|
||||
const { sessionManager, modelRegistry } = ctx;
|
||||
const { messagesToSummarize, messagesToKeep, tokensBefore, firstKeptEntryId, cutPoint } = preparation;
|
||||
|
||||
// Get previous summary from most recent compaction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue