| 8 | import { getCurrentTokenUsage } from "../lib/token-utils" |
| 9 | |
| 10 | function buildConfig(maxContextLimit: number, minContextLimit = 1): PluginConfig { |
| 11 | return { |
| 12 | enabled: true, |
| 13 | debug: false, |
| 14 | pruneNotification: "off", |
| 15 | pruneNotificationType: "chat", |
| 16 | commands: { |
| 17 | enabled: true, |
| 18 | protectedTools: [], |
| 19 | }, |
| 20 | manualMode: { |
| 21 | enabled: false, |
| 22 | automaticStrategies: true, |
| 23 | }, |
| 24 | turnProtection: { |
| 25 | enabled: false, |
| 26 | turns: 4, |
| 27 | }, |
| 28 | experimental: { |
| 29 | allowSubAgents: false, |
| 30 | customPrompts: false, |
| 31 | }, |
| 32 | protectedFilePatterns: [], |
| 33 | compress: { |
| 34 | mode: "message", |
| 35 | permission: "allow", |
| 36 | showCompression: false, |
| 37 | summaryBuffer: true, |
| 38 | maxContextLimit, |
| 39 | minContextLimit, |
| 40 | nudgeFrequency: 5, |
| 41 | iterationNudgeThreshold: 15, |
| 42 | nudgeForce: "soft", |
| 43 | protectedTools: ["task"], |
| 44 | protectTags: false, |
| 45 | protectUserMessages: false, |
| 46 | }, |
| 47 | strategies: { |
| 48 | deduplication: { |
| 49 | enabled: true, |
| 50 | protectedTools: [], |
| 51 | }, |
| 52 | purgeErrors: { |
| 53 | enabled: true, |
| 54 | turns: 4, |
| 55 | protectedTools: [], |
| 56 | }, |
| 57 | }, |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | function textPart(messageID: string, sessionID: string, id: string, text: string) { |
| 62 | return { |