File tree Expand file tree Collapse file tree 2 files changed +0
-15
lines changed
Expand file tree Collapse file tree 2 files changed +0
-15
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import type { WithParts } from "../state"
22
33/**
44 * Extracts a human-readable key from tool metadata for display purposes.
5- * Used by both deduplication and AI analysis to show what was pruned.
65 */
76export const extractParameterKey = ( tool : string , parameters : any ) : string => {
87 if ( ! parameters ) return ''
@@ -84,18 +83,12 @@ export const getLastUserMessage = (
8483 return null
8584}
8685
87- /**
88- * Finds the current agent from messages by scanning backward for user messages.
89- */
9086export function findCurrentAgent ( messages : WithParts [ ] ) : string | undefined {
9187 const userMsg = getLastUserMessage ( messages )
9288 if ( ! userMsg ) return undefined
9389 return ( userMsg . info as any ) . agent || 'build'
9490}
9591
96- /**
97- * Builds a list of tool call IDs from messages.
98- */
9992export function buildToolIdList ( messages : WithParts [ ] ) : string [ ] {
10093 const toolIds : string [ ] = [ ]
10194 for ( const msg of messages ) {
@@ -110,9 +103,6 @@ export function buildToolIdList(messages: WithParts[]): string[] {
110103 return toolIds
111104}
112105
113- /**
114- * Prunes numeric tool IDs to valid tool call IDs based on the provided tool ID list.
115- */
116106export function getPruneToolIds ( numericToolIds : number [ ] , toolIdList : string [ ] ) : string [ ] {
117107 const pruneToolIds : string [ ] = [ ]
118108 for ( const index of numericToolIds ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { encode } from 'gpt-tokenizer'
33
44/**
55 * Estimates token counts for a batch of texts using gpt-tokenizer.
6- * TODO: ensure we aren't falling back to catch branch
76 */
87function estimateTokensBatch ( texts : string [ ] ) : number [ ] {
98 try {
@@ -15,7 +14,6 @@ function estimateTokensBatch(texts: string[]): number[] {
1514
1615/**
1716 * Calculates approximate tokens saved by pruning the given tool call IDs.
18- * Uses pre-fetched messages to avoid duplicate API calls.
1917 * TODO: Make it count message content that are not tool outputs. Currently it ONLY covers tool outputs and errors
2018 */
2119export const calculateTokensSaved = (
@@ -57,9 +55,6 @@ export function formatTokenCount(tokens: number): string {
5755 return tokens . toString ( ) + ' tokens'
5856}
5957
60- /**
61- * Checks if a session is a subagent session by looking for a parentID.
62- */
6358export async function isSubAgentSession ( client : any , sessionID : string ) : Promise < boolean > {
6459 try {
6560 const result = await client . session . get ( { path : { id : sessionID } } )
You can’t perform that action at this time.
0 commit comments