Skip to content

Commit 90889d0

Browse files
committed
refactor: simplify compress notification summary and rename header wrapper
- Rename `addCompressedBlockHeader` to `wrapCompressedSummary` to better reflect it wraps with both header and footer. - Pass `injected.expandedSummary` directly to `sendCompressNotification` instead of the wrapped summary, avoiding unnecessary header manipulation for the notification display.
1 parent 0752119 commit 90889d0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/tools/compress-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export function allocateBlockId(summaries: CompressSummary[]): number {
509509
return max + 1
510510
}
511511

512-
export function addCompressedBlockHeader(blockId: number, summary: string): string {
512+
export function wrapCompressedSummary(blockId: number, summary: string): string {
513513
const header = formatCompressedBlockHeader(blockId)
514514
const footer = formatCompressedBlockFooter(blockId)
515515
const body = summary.trim()

lib/tools/compress.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ToolContext } from "./types"
33
import { COMPRESS_TOOL_SPEC } from "../prompts"
44
import { ensureSessionInitialized } from "../state"
55
import {
6-
addCompressedBlockHeader,
6+
wrapCompressedSummary,
77
allocateBlockId,
88
applyCompressionState,
99
buildSearchContext,
@@ -102,7 +102,7 @@ export function createCompressTool(ctx: ToolContext): ReturnType<typeof tool> {
102102
)
103103

104104
const blockId = allocateBlockId(ctx.state.compressSummaries)
105-
const storedSummary = addCompressedBlockHeader(blockId, injected.expandedSummary)
105+
const storedSummary = wrapCompressedSummary(blockId, injected.expandedSummary)
106106
const summaryTokens = countSummaryTokens(storedSummary)
107107

108108
const applied = applyCompressionState(
@@ -129,7 +129,7 @@ export function createCompressTool(ctx: ToolContext): ReturnType<typeof tool> {
129129
range.toolIds,
130130
applied.messageIds,
131131
compressArgs.topic,
132-
storedSummary,
132+
injected.expandedSummary,
133133
summaryTokens,
134134
totalSessionTokens,
135135
applied.compressedTokens,

0 commit comments

Comments
 (0)