()
| 64 | } |
| 65 | |
| 66 | export function createSessionState(): SessionState { |
| 67 | return { |
| 68 | sessionId: null, |
| 69 | isSubAgent: false, |
| 70 | manualMode: false, |
| 71 | compressPermission: undefined, |
| 72 | pendingManualTrigger: null, |
| 73 | prune: { |
| 74 | tools: new Map<string, number>(), |
| 75 | messages: createPruneMessagesState(), |
| 76 | }, |
| 77 | nudges: { |
| 78 | contextLimitAnchors: new Set<string>(), |
| 79 | turnNudgeAnchors: new Set<string>(), |
| 80 | iterationNudgeAnchors: new Set<string>(), |
| 81 | }, |
| 82 | stats: { |
| 83 | pruneTokenCounter: 0, |
| 84 | totalPruneTokens: 0, |
| 85 | }, |
| 86 | compressionTiming: { |
| 87 | startsByCallId: new Map<string, number>(), |
| 88 | pendingByCallId: new Map(), |
| 89 | }, |
| 90 | toolParameters: new Map<string, ToolParameterEntry>(), |
| 91 | subAgentResultCache: new Map<string, string>(), |
| 92 | toolIdList: [], |
| 93 | messageIds: { |
| 94 | byRawId: new Map<string, string>(), |
| 95 | byRef: new Map<string, string>(), |
| 96 | nextRef: 1, |
| 97 | }, |
| 98 | lastCompaction: 0, |
| 99 | currentTurn: 0, |
| 100 | modelContextLimit: undefined, |
| 101 | systemPromptTokens: undefined, |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | export function resetSessionState(state: SessionState): void { |
| 106 | state.sessionId = null |
no test coverage detected