fix(background-agent): ignore metadata stream output

This commit is contained in:
YeonGyu-Kim
2026-05-21 16:12:53 +09:00
parent 282010f97d
commit dbfde0b056
2 changed files with 47 additions and 4 deletions
@@ -0,0 +1,41 @@
import { describe, expect, test } from "bun:test"
import {
hasOutputSignalFromPart,
resolveSessionNextPartInfo,
} from "./session-stream-activity"
describe("session.next stream activity", () => {
test("#given text delta event #when resolving part info #then it counts as output activity", () => {
// given
const timestamp = "2026-05-21T03:00:00.000Z"
// when
const partInfo = resolveSessionNextPartInfo("session.next.text.delta", {
sessionID: "ses-active",
timestamp,
})
// then
expect(partInfo?.type).toBe("text")
expect(partInfo?.field).toBe("text")
expect(partInfo?.activityTime).toEqual(new Date(timestamp))
expect(hasOutputSignalFromPart(partInfo, "ses-active")).toBe(true)
})
test("#given metadata stream event #when resolving part info #then it refreshes activity without counting as output", () => {
// given
const timestamp = "2026-05-21T03:00:00.000Z"
// when
const partInfo = resolveSessionNextPartInfo("session.next.compaction.started", {
sessionID: "ses-active",
timestamp,
})
// then
expect(partInfo?.type).toBeUndefined()
expect(partInfo?.field).toBeUndefined()
expect(partInfo?.activityTime).toEqual(new Date(timestamp))
expect(hasOutputSignalFromPart(partInfo, "ses-active")).toBe(false)
})
})