(args, toolCtx)
| 61 | description: runtimePrompts.compressRange + RANGE_FORMAT_EXTENSION, |
| 62 | args: buildSchema(), |
| 63 | async execute(args, toolCtx) { |
| 64 | const input = args as CompressRangeToolArgs |
| 65 | validateArgs(input) |
| 66 | const callId = |
| 67 | typeof (toolCtx as unknown as { callID?: unknown }).callID === "string" |
| 68 | ? (toolCtx as unknown as { callID: string }).callID |
| 69 | : undefined |
| 70 | |
| 71 | const { rawMessages, searchContext } = await prepareSession( |
| 72 | ctx, |
| 73 | toolCtx, |
| 74 | `Compress Range: ${input.topic}`, |
| 75 | ) |
| 76 | const resolvedPlans = resolveRanges(input, searchContext, ctx.state) |
| 77 | validateNonOverlapping(resolvedPlans) |
| 78 | |
| 79 | const notifications: NotificationEntry[] = [] |
| 80 | const preparedPlans: Array<{ |
| 81 | entry: (typeof resolvedPlans)[number]["entry"] |
| 82 | selection: (typeof resolvedPlans)[number]["selection"] |
| 83 | anchorMessageId: string |
| 84 | finalSummary: string |
| 85 | consumedBlockIds: number[] |
| 86 | }> = [] |
| 87 | let totalCompressedMessages = 0 |
| 88 | |
| 89 | for (const plan of resolvedPlans) { |
| 90 | const parsedPlaceholders = parseBlockPlaceholders(plan.entry.summary) |
| 91 | const missingBlockIds = validateSummaryPlaceholders( |
| 92 | parsedPlaceholders, |
| 93 | plan.selection.requiredBlockIds, |
| 94 | plan.selection.startReference, |
| 95 | plan.selection.endReference, |
| 96 | searchContext.summaryByBlockId, |
| 97 | ) |
| 98 | |
| 99 | const injected = injectBlockPlaceholders( |
| 100 | plan.entry.summary, |
| 101 | parsedPlaceholders, |
| 102 | searchContext.summaryByBlockId, |
| 103 | plan.selection.startReference, |
| 104 | plan.selection.endReference, |
| 105 | ) |
| 106 | |
| 107 | const summaryWithUsers = appendProtectedUserMessages( |
| 108 | injected.expandedSummary, |
| 109 | plan.selection, |
| 110 | searchContext, |
| 111 | ctx.state, |
| 112 | ctx.config.compress.protectUserMessages, |
| 113 | ) |
| 114 | |
| 115 | const summaryWithPromptInfo = appendProtectedPromptInfo( |
| 116 | summaryWithUsers, |
| 117 | plan.selection, |
| 118 | searchContext, |
| 119 | ctx.state, |
| 120 | ctx.config.compress.protectTags, |
nothing calls this directly
no test coverage detected