nolo-cli 0.212.0-alpha.1 → 0.222.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/{_executeModel-KE6MBNUJ.js → _executeModel-4GGQQHOB.js} +111 -82
- package/{accountResolver-4LKIHEKL.js → accountResolver-EK2S4PWF.js} +6 -6
- package/{action-DF5UYSJF.js → action-CK64LS6S.js} +12 -11
- package/{addContentAction-N2YC5IL3.js → addContentAction-GDHDOF4U.js} +18 -17
- package/{addDialogAgentAction-3NKVQCEC.js → addDialogAgentAction-CAKRU3ZT.js} +21 -20
- package/{agentDeleteCommand-NWK7VU4N.js → agentDeleteCommand-BPV2XZL7.js} +128 -119
- package/{agentEmailCommands-UZ4DHEX2.js → agentEmailCommands-EJOS75YL.js} +132 -124
- package/{agentFavoriteCommands-EDK743YA.js → agentFavoriteCommands-2LKGKSUD.js} +7 -8
- package/{agentGrantCommands-RQWK2TEV.js → agentGrantCommands-QQV4N4JW.js} +5 -5
- package/{agentListCommands-HE7L2A6L.js → agentListCommands-HIZODBF3.js} +196 -124
- package/{agentMachineCommands-6TE4MBMP.js → agentMachineCommands-ZMQ2CY7Y.js} +62 -53
- package/{agentProviderCommands-Q5O33MED.js → agentProviderCommands-WKJOAWBP.js} +5 -5
- package/{agentPullCommand-6EM3URVK.js → agentPullCommand-XN6ZPBUW.js} +7 -7
- package/agentRecordCommands-OMXVDLDX.js +176 -0
- package/agentRunCommand-CB34YWMV.js +206 -0
- package/{agentRunControl-OI3LOENH.js → agentRunControl-JNONH3RP.js} +30 -15
- package/{agentRuntimeLocal-HL526DNQ.js → agentRuntimeLocal-QZPFWMLG.js} +52 -45
- package/{agentSlice-TMYP2UEA.js → agentSlice-RD2CDU7T.js} +20 -19
- package/{appDeleteCommands-ZERW4AXY.js → appDeleteCommands-QCCFDIEQ.js} +61 -52
- package/{appDeployCommands-DUWSMYHL.js → appDeployCommands-V2T7TNMQ.js} +61 -52
- package/{appDeployStatusCommands-N2KIE4BF.js → appDeployStatusCommands-6PGH7ZCG.js} +61 -52
- package/{appGetCommands-YVR4NPVY.js → appGetCommands-3L7WWJA6.js} +61 -52
- package/{appListCommands-JS6HOHZS.js → appListCommands-ENJCK4PO.js} +61 -52
- package/{authCommand-FE2C3ZUM.js → authCommand-6V47SYGK.js} +29 -28
- package/{authCommands-HV3EAU3V.js → authCommands-GAJ3NIXO.js} +14 -13
- package/{builtinSkillRegistry-3YOIGEF6.js → builtinSkillRegistry-2ECA42FC.js} +11 -13
- package/{chromeCommands-REEAH4SX.js → chromeCommands-G5UDKVSV.js} +3 -3
- package/{chromeOpsCommands-HEN5AX2J.js → chromeOpsCommands-YKX2QX3A.js} +20 -10
- package/{chunk-DM6UMOEL.js → chunk-27PCUMJI.js} +2 -2
- package/chunk-2CI3ZFWD.js +97 -0
- package/{chunk-HIRC32DV.js → chunk-2GJKRKI6.js} +543 -29
- package/{chunk-SM3NSZJV.js → chunk-2UCBGYO4.js} +20 -1
- package/{chunk-PYRUW7XN.js → chunk-2VUZSVAS.js} +136 -54
- package/chunk-2YGBI2XB.js +30 -0
- package/chunk-2ZKFCIJJ.js +13 -0
- package/{chunk-CJRONOYL.js → chunk-34J5K2YA.js} +19 -75
- package/{chunk-LOEO7LRC.js → chunk-3IK6ILVW.js} +4 -1
- package/{chunk-CTPXME7U.js → chunk-3LMUPOHG.js} +29 -6
- package/chunk-44X52WOJ.js +1621 -0
- package/{chunk-6VLJ6YA7.js → chunk-4DESLZTK.js} +9 -9
- package/{chunk-MYOH447Z.js → chunk-4JVNURX4.js} +1 -1
- package/chunk-5CHGAKRT.js +364 -0
- package/{chunk-YDH3FDFQ.js → chunk-5FUN7EG4.js} +1 -1
- package/{chunk-LKDF3ATR.js → chunk-5RKUPJYL.js} +1 -1
- package/{chunk-ZC3CMUKU.js → chunk-6OVNSQHN.js} +84 -2
- package/{chunk-IF45XG7K.js → chunk-6WU5572L.js} +40 -24
- package/{chunk-OHNELDTO.js → chunk-7EEZJ6BS.js} +11 -152
- package/{chunk-Y6ORVLSS.js → chunk-7ET2U67U.js} +1 -1
- package/{chunk-G7MLNNEX.js → chunk-7JLY4WYF.js} +5 -5
- package/{chunk-P5L7CXOC.js → chunk-7Z6EW7AH.js} +3 -2
- package/{chunk-IIQ6JGRI.js → chunk-AD5EWDFD.js} +2 -2
- package/{chunk-WXYLV624.js → chunk-AIHYNKGV.js} +4 -4
- package/{chunk-HPFCI4SK.js → chunk-AK5O76CC.js} +3 -3
- package/{chunk-Y63ZSOR6.js → chunk-AL3TYDIF.js} +1 -1
- package/{chunk-PJNFNEJE.js → chunk-AMEOV5VZ.js} +59 -13
- package/chunk-AN74ON4G.js +675 -0
- package/{chunk-HRMJUN5J.js → chunk-AQZ6BMRK.js} +1 -1
- package/{chunk-CQ46IRNN.js → chunk-B4GOW4MT.js} +445 -201
- package/{chunk-4KB6WQUL.js → chunk-BGP2EDFG.js} +1 -1
- package/{chunk-NBTY7YJF.js → chunk-BR3GT6MR.js} +1 -0
- package/{chunk-7RFNTILS.js → chunk-BUDVRYES.js} +2 -2
- package/{chunk-D2MDMY2M.js → chunk-BV3FLP2L.js} +47 -1
- package/{chunk-25JZEIXN.js → chunk-C4VAR65S.js} +92 -150
- package/{chunk-AVTVGMDY.js → chunk-C4WTX5TU.js} +2 -2
- package/{chunk-ZL5RAEEB.js → chunk-CIRB724Q.js} +1 -1
- package/{chunk-F6UUQOG6.js → chunk-CKT6QUE2.js} +4 -4
- package/{chunk-M6RL5JCD.js → chunk-CMZ3Z5PT.js} +14 -14
- package/{secretCommands-4QS3HCA2.js → chunk-D726I5AZ.js} +191 -16
- package/{chunk-INSBKSBB.js → chunk-DNKTQ3IN.js} +4 -4
- package/chunk-DVQH4BTR.js +1137 -0
- package/{chunk-SOHTHFV2.js → chunk-DWX2HEVC.js} +91 -132
- package/{chunk-NOMIGOST.js → chunk-EIAI3PPH.js} +116 -124
- package/chunk-EUCFKKDM.js +247 -0
- package/chunk-EWQ3HGNZ.js +90 -0
- package/{chunk-RPQXPZZF.js → chunk-F3GRJO4Z.js} +908 -13
- package/{chunk-GSQNH63I.js → chunk-FIYSMXHY.js} +3 -19
- package/{chunk-KSTEXKL6.js → chunk-FJ23FZXF.js} +76 -31
- package/{chunk-INN4LTAJ.js → chunk-FJK526XH.js} +2 -2
- package/chunk-FS2XP5D7.js +142 -0
- package/{chunk-QT6PKHYJ.js → chunk-FYF2TONJ.js} +5 -5
- package/{chunk-OXME3PEE.js → chunk-GBWGPTA7.js} +2 -1
- package/{chunk-RU4SD66C.js → chunk-GYVCJABP.js} +30 -254
- package/{chunk-YUXQAVRD.js → chunk-HOCHUZQ7.js} +257 -90
- package/{chunk-Y2WUYX4I.js → chunk-HXER7YJF.js} +4 -4
- package/chunk-HYIETXA6.js +99 -0
- package/{chunk-H2TJUNCH.js → chunk-I4EADJ4P.js} +6 -6
- package/{chunk-TCZHTTUU.js → chunk-I7WBYGBP.js} +8 -8
- package/{chunk-5RYBGBQH.js → chunk-IILMY4W4.js} +14 -9
- package/chunk-JA3ICVJY.js +271 -0
- package/{chunk-ZRSNONOB.js → chunk-JWXITTQB.js} +8 -3
- package/{chunk-JNKSDZFS.js → chunk-KEN3N2TN.js} +310 -66
- package/{chunk-LEC5ALIN.js → chunk-KEPOVMF4.js} +1 -1
- package/{chunk-UHJGXRJ4.js → chunk-KQSYAIZR.js} +3 -3
- package/{chunk-4VJAC32I.js → chunk-L5I543VB.js} +3 -2
- package/chunk-LKA64WH4.js +227 -0
- package/{chunk-6OQUPIQF.js → chunk-LVL6GFCM.js} +4 -4
- package/{chunk-UTV2AYEG.js → chunk-MAIITKBT.js} +2 -2
- package/chunk-MBG66ZBH.js +226 -0
- package/{chunk-YUA6OAH5.js → chunk-MDLS23JK.js} +2 -2
- package/{chunk-VL5KOY2C.js → chunk-MK2Q7ZJD.js} +67 -5
- package/{chunk-B7NJ3T4A.js → chunk-MS4NZNKI.js} +10 -10
- package/{chunk-3AKFVZ2I.js → chunk-MYHNBEXD.js} +3 -3
- package/{chunk-VZKUKCA6.js → chunk-MZLE5HQ3.js} +3673 -241
- package/{chunk-AZMYUSVF.js → chunk-N5Z2V73W.js} +1 -1
- package/chunk-NIZ2BXFD.js +526 -0
- package/{chunk-YPD3VJZW.js → chunk-NWP2OYOX.js} +20 -20
- package/{chunk-3FOQHGHN.js → chunk-O6J3OTOP.js} +4 -4
- package/{chunk-3RQVYR4B.js → chunk-OB6DVWPF.js} +197 -65
- package/{chunk-YWSEPJ7C.js → chunk-OBWT45ZU.js} +3 -3
- package/{chunk-5AQR3DGV.js → chunk-ODJ7BVSI.js} +80 -11
- package/{chunk-XJWWBO34.js → chunk-OJKUU3LP.js} +5 -7
- package/{chunk-GNDJKC4B.js → chunk-ON37YXGX.js} +29 -29
- package/{chunk-D5RCRX4A.js → chunk-P5ZJRTCH.js} +9415 -5169
- package/{chunk-6XIE5ZGI.js → chunk-PDCV7P5W.js} +1 -1
- package/{chunk-EZFQ6XRV.js → chunk-PJCIP64Z.js} +861 -59
- package/{chunk-GPO7FCEZ.js → chunk-PJVKMGPZ.js} +1222 -1719
- package/{chunk-CKAHAVMK.js → chunk-PPJYZRSQ.js} +40 -26
- package/chunk-QHEN7NZ7.js +46 -0
- package/{chunk-4KH4J3G5.js → chunk-QNWG52I4.js} +19 -7
- package/{chunk-YGILMZ7N.js → chunk-QVBXJNZ2.js} +1 -1
- package/chunk-RDH5CQ4T.js +1382 -0
- package/{chunk-C6KNNXWU.js → chunk-RGQ4UUWZ.js} +25 -2
- package/{chunk-OWYYDMGJ.js → chunk-S2NTVGA2.js} +4 -2
- package/{chunk-KC4XDTT3.js → chunk-SOF4OWDM.js} +6 -4
- package/{chunk-IAPCBNEE.js → chunk-SQYIK6HO.js} +1 -1
- package/{chunk-22CIEBYO.js → chunk-SVT62ULE.js} +50 -48
- package/{chunk-KIM6CLW5.js → chunk-SY3C4SQ7.js} +42 -15
- package/{chunk-JY5NGFFH.js → chunk-SYTHYBMI.js} +5 -5
- package/{chunk-6NSSLV67.js → chunk-T6DXNI6Z.js} +52 -50
- package/chunk-TLE77UJ5.js +230 -0
- package/{chunk-4VNS5WPM.js → chunk-U67V476Y.js} +1 -8
- package/{chunk-F7CI2ZC5.js → chunk-UAIHKQIA.js} +2 -1
- package/{chunk-MMNYUVLW.js → chunk-UB3D4TRQ.js} +11 -77
- package/{chunk-WPORQFYN.js → chunk-UVLYNWIE.js} +2 -2
- package/{chunk-YOIW77S2.js → chunk-UYOICCYG.js} +29 -19
- package/{chunk-4I7ERB7F.js → chunk-VREDDN25.js} +1 -1
- package/{chunk-JIT6FSXJ.js → chunk-WAE3GFCJ.js} +3 -3
- package/{chunk-IJXYFTV7.js → chunk-WI67URFP.js} +20 -20
- package/{chunk-7OCO4TDT.js → chunk-WJVYAO6P.js} +1 -1
- package/{chunk-T43B7LB2.js → chunk-WKGQSYTB.js} +1 -1
- package/{chunk-YJMRHHGY.js → chunk-WUUH4LWZ.js} +60 -30
- package/{chunk-PDGKOTO7.js → chunk-X7UF53VA.js} +33 -22
- package/{chunk-TY3TIUJK.js → chunk-XI2BWJM5.js} +65 -0
- package/{chunk-OOF4UPC5.js → chunk-XWVCYUUU.js} +16 -159
- package/{chunk-J5JTMQIA.js → chunk-YFLVRVYK.js} +1 -1
- package/{chunk-EYLGAEB4.js → chunk-YGMBIXCF.js} +132 -0
- package/chunk-YL3EFYL3.js +199 -0
- package/{chunk-MMA3LZ3W.js → chunk-YNIYE47Z.js} +1 -1
- package/{chunk-W4S457LU.js → chunk-YU4ZPWVF.js} +41 -5
- package/{chunk-NJR3WKVP.js → chunk-YWWDC3O7.js} +281 -159
- package/chunk-YZMNK53S.js +68 -0
- package/{chunk-FHU44LN3.js → chunk-Z2PITYZN.js} +2179 -552
- package/{chunk-FY7F4Q6X.js → chunk-Z4PCXPUE.js} +2 -2
- package/{cliAgentConfigHelpers-WJBZQTLW.js → cliAgentConfigHelpers-TKYL43MT.js} +15 -16
- package/{cliAuthorityBrokerClient-PM3U6Q6J.js → cliAuthorityBrokerClient-XHH7MH2P.js} +1 -1
- package/{cliAuthorityStoreDriver-TKLXNNTG.js → cliAuthorityStoreDriver-6FE3BJNB.js} +1 -1
- package/{cliEnvHelpers-BVYTMUPJ.js → cliEnvHelpers-VPSJ4XWC.js} +3 -3
- package/{cliExecutor-BWBF2MTI.js → cliExecutor-4MAX3PZL.js} +2 -2
- package/cliLocalAgentRecordReader-MHHD4T7R.js +90 -0
- package/{commandRegistry-VVMTPFAX.js → commandRegistry-5DA5UP7S.js} +106 -98
- package/{contentThunks-N52O67MI.js → contentThunks-5GUQ7FWJ.js} +47 -43
- package/{cooldownCommands-YXLWOXWR.js → cooldownCommands-X7P5M2V5.js} +5 -4
- package/{createAgentAutomationAction-ZC57YRSV.js → createAgentAutomationAction-UCLTHQRI.js} +51 -49
- package/{createDialogAction-VQW5WDYX.js → createDialogAction-UPN774AF.js} +46 -48
- package/{createPageAction-M5VDA7SC.js → createPageAction-JRQ2TA4O.js} +50 -48
- package/{cursorProvider-YGGNMVWX.js → cursorProvider-2RACMEMF.js} +1 -1
- package/{db-HUCI5R4G.js → db-CS4ZJQKV.js} +1 -1
- package/{dbSlice-HP7G4LX3.js → dbSlice-WNON7TOL.js} +17 -16
- package/{deleteFile-7VQGLK2V.js → deleteFile-Q3YDB4ML.js} +9 -9
- package/{desktopFolderProjects-SFY5EZS3.js → desktopFolderProjects-4POAMVJN.js} +2 -2
- package/{dialogCommands-JHMR2N2Y.js → dialogCommands-VRI7VCXH.js} +64 -57
- package/dialogNotifyCommand-6TMCX4D2.js +36 -0
- package/{dialogSlice-GRSVGDTF.js → dialogSlice-LFNVUSAN.js} +42 -40
- package/{dialogUsageCommand-7KCPYGHG.js → dialogUsageCommand-HTVPR2CX.js} +11 -10
- package/{docCreateCommands-F2K3UPSQ.js → docCreateCommands-AMPXMOX3.js} +61 -54
- package/{docDeleteCommands-XGXB5RFT.js → docDeleteCommands-I5WFAEHP.js} +63 -57
- package/{docReadCommands-7HWZZV6J.js → docReadCommands-X53ELNIE.js} +61 -54
- package/{docStore-KNZK6Y2G.js → docStore-2VAWVLWH.js} +21 -20
- package/{docUpdateCommands-OZZ7NQII.js → docUpdateCommands-6QPNDC7M.js} +64 -57
- package/{fetchMessages-M3QU7ZCQ.js → fetchMessages-TQEUZD7H.js} +8 -7
- package/{getPricing-2MNMXEVG.js → getPricing-MB2GBXOK.js} +6 -6
- package/{handleSendMessageAction-SHIH74GJ.js → handleSendMessageAction-AAJOHXOB.js} +193 -301
- package/{hostCredentialCreate-X64WK4JD.js → hostCredentialCreate-GLMJ22M6.js} +123 -114
- package/index.js +29 -29
- package/{keys-BEGDOTRL.js → keys-RWF7UCB4.js} +5 -4
- package/legacyMigration-TF4SYJCZ.js +19 -0
- package/{lib-5KKIBFIT.js → lib-OT5OTXRU.js} +7087 -6664
- package/{localDialogRead-XRLAH4CZ.js → localDialogRead-SVTPA5GY.js} +3 -3
- package/{localFirstLog-DHNOY2NA.js → localFirstLog-OIETGK66.js} +1 -1
- package/localRecall-2J6QPOK2.js +15 -0
- package/{localRuntimeAdapter-A7K3ABA6.js → localRuntimeAdapter-BMP57P42.js} +119 -110
- package/{localRuntimeAuthority-OYH4AE4G.js → localRuntimeAuthority-IBJAT62G.js} +1 -1
- package/{localRuntimeDb-VBIMCWUC.js → localRuntimeDb-N7KHDXS2.js} +2 -2
- package/{machineCommands-DE3MR7CJ.js → machineCommands-3MLIAK5Q.js} +128 -119
- package/{machineInfo-UKPTZO5Y.js → machineInfo-LWHTEBHJ.js} +1 -1
- package/machineWsRunDispatch-FKIGROQF.js +191 -0
- package/{memberThunks-7WJAY5V6.js → memberThunks-ZGLZ36PK.js} +29 -28
- package/{memoryCommands-ASCE5STX.js → memoryCommands-5WC3T66U.js} +4 -4
- package/models-ULVWLSQ6.js +9 -0
- package/{oauthTokenStore-OEERZFUC.js → oauthTokenStore-RUYNYALS.js} +1 -1
- package/{offlineMarxistsAgentCommand-2QTHJCHV.js → offlineMarxistsAgentCommand-4IC3Y4C6.js} +4 -4
- package/overlay-THLKYIWY.js +11 -0
- package/package.json +2 -2
- package/{pdf-U6KSUEZZ.js → pdf-KE3QI2V7.js} +1 -1
- package/{processSpawn-ZU5QFM43.js → processSpawn-6GEO77KV.js} +1 -1
- package/{profileConfig-KN3N2BLF.js → profileConfig-KOWK4HOG.js} +1 -1
- package/{projectArchive-GGL5HLMD.js → projectArchive-HK63GMF4.js} +52 -50
- package/{providerPresetApply-YXGV6NXB.js → providerPresetApply-OIFQ73LH.js} +19 -12
- package/{providerRegistry-S6UL6UNA.js → providerRegistry-KZ3SDZ3D.js} +10 -10
- package/{read-4VZQODSN.js → read-MRQHJMJ2.js} +10 -10
- package/{readDocTool-AVD32RUJ.js → readDocTool-4BGTXTXA.js} +2 -2
- package/{readlineWorkspace-XKYKNL2I.js → readlineWorkspace-AKAHSCNY.js} +6505 -4634
- package/{removeDialogAgentAction-FKL4BYMR.js → removeDialogAgentAction-B6H7DXFM.js} +23 -22
- package/{runAgentClientLoop-V7E2WBVM.js → runAgentClientLoop-UVAWGEON.js} +81 -79
- package/{runtimeDoctorCommands-QAI3MBKQ.js → runtimeDoctorCommands-FW6XKDUG.js} +12 -12
- package/{runtimeModeArgs-2Y7BALTO.js → runtimeModeArgs-X7DL7PUN.js} +1 -1
- package/secretCommands-LJXOOYA7.js +24 -0
- package/{setDialogExtraReferencesAction-TLIOLWWI.js → setDialogExtraReferencesAction-EVCY3TRW.js} +22 -21
- package/{setPrimaryDialogAgentAction-2OLWRFYR.js → setPrimaryDialogAgentAction-KPFVPHCJ.js} +23 -22
- package/{settingThunks-UGBPCNYF.js → settingThunks-ENOAK2WV.js} +97 -88
- package/{skillDiscovery-XKHROSH2.js → skillDiscovery-B5V23AXP.js} +4 -4
- package/{skillSummaryMarker-42HKSXYY.js → skillSummaryMarker-62UW7HI7.js} +1 -1
- package/{slateToRenderMarkdown-Y5IYN73U.js → slateToRenderMarkdown-R3X74MCX.js} +1 -1
- package/{slateUtils-NGV2NMKM.js → slateUtils-ESQAJ6RN.js} +1 -1
- package/{spaceCommands-4KSLKVNF.js → spaceCommands-DTTNAS2L.js} +61 -53
- package/store-JRVN62NM.js +46 -0
- package/{streamAgentChatTurn-7FR7X2NU.js → streamAgentChatTurn-R5UY25VB.js} +875 -618
- package/{switchDialogAgentAction-UZSAG2N5.js → switchDialogAgentAction-SZ44XDRY.js} +21 -20
- package/{tableCommands-MP6VFSVT.js → tableCommands-HITDSLHS.js} +10 -10
- package/tombstones-FQQMEDOW.js +32 -0
- package/{toolApiClient-HGNO53TC.js → toolApiClient-OGQEBQVX.js} +4 -4
- package/{tools-ZLKCC25W.js → tools-HWFG6GMJ.js} +75 -74
- package/tuiSummaryLlmCaller-HQQZAMYF.js +44 -0
- package/{updateCommands-4744PL3P.js → updateCommands-RJVCRSBP.js} +10 -8
- package/{updateDialogTitleAction-U53ZT7PJ.js → updateDialogTitleAction-KNPOAMVS.js} +48 -46
- package/{usageCommand-F4IPVMIZ.js → usageCommand-FWZCB7AM.js} +11 -10
- package/{usageRebuildCommand-HAW2AD5N.js → usageRebuildCommand-SP2BLNJU.js} +12 -11
- package/userDataMerge-HT2ZVHBJ.js +13 -0
- package/{windowsSelfUpdate-XSQVF2GK.js → windowsSelfUpdate-KERHIAB4.js} +3 -3
- package/{workloadLifecycle-4BEQHMSD.js → workloadLifecycle-DYNEYHV5.js} +7 -6
- package/agentRecordCommands-L3QQ7HZ4.js +0 -167
- package/agentRunCommand-2IFGQHCO.js +0 -196
- package/chunk-3CGG2PAL.js +0 -594
- package/chunk-5XBUWM6I.js +0 -89
- package/chunk-BFM34N54.js +0 -842
- package/chunk-CJEIOP3E.js +0 -0
- package/chunk-CZM5YTZ7.js +0 -977
- package/chunk-EYUBHHFB.js +0 -636
- package/chunk-JTDORD5P.js +0 -415
- package/chunk-NRFKLKRU.js +0 -339
- package/chunk-VPAZOH2D.js +0 -115
- package/chunk-WJZOQR2J.js +0 -151
- package/chunk-ZCWRMUWT.js +0 -89
- package/dist-M676ULYG.js +0 -7314
- package/machineWsRunDispatch-R26P5V36.js +0 -182
- package/models-PJBE6JDV.js +0 -9
- package/tuiSummaryLlmCaller-WC54MVGP.js +0 -160
- package/{chunk-WACI5I6V.js → chunk-2THCNKE4.js} +3 -3
- package/{chunk-2QHFH3DR.js → chunk-47ITIXO7.js} +6 -6
- package/{chunk-GOO6G4PY.js → chunk-CKG3PRZ7.js} +0 -0
- package/{chunk-OQHIVPG4.js → chunk-SNBZZPYH.js} +3 -3
- package/{chunk-AETZ7AD6.js → chunk-W6RFEDN4.js} +3 -3
package/chunk-CZM5YTZ7.js
DELETED
|
@@ -1,977 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ALL_MODELS
|
|
3
|
-
} from "./chunk-T43B7LB2.js";
|
|
4
|
-
import {
|
|
5
|
-
estimateTokenCount
|
|
6
|
-
} from "./chunk-PSCNXBYA.js";
|
|
7
|
-
import {
|
|
8
|
-
MODEL_LOOKUP_MAP
|
|
9
|
-
} from "./chunk-SM3NSZJV.js";
|
|
10
|
-
import {
|
|
11
|
-
isPlatformManagedProvider,
|
|
12
|
-
resolvePlatformEffectiveModel
|
|
13
|
-
} from "./chunk-GOO6G4PY.js";
|
|
14
|
-
|
|
15
|
-
// packages/core/chat/messageContentSerialize.ts
|
|
16
|
-
var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
|
|
17
|
-
if (typeof content === "string") {
|
|
18
|
-
return content.trim() || null;
|
|
19
|
-
}
|
|
20
|
-
if (Array.isArray(content)) {
|
|
21
|
-
const fragments = [];
|
|
22
|
-
for (const part of content) {
|
|
23
|
-
if (!part || typeof part !== "object") continue;
|
|
24
|
-
if (part.type === "text" && typeof part.text === "string") {
|
|
25
|
-
const text = part.text.trim();
|
|
26
|
-
if (text) fragments.push(text);
|
|
27
|
-
} else if (part.type === "image_url") {
|
|
28
|
-
fragments.push(imagePlaceholder);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const joined = fragments.join("\n").trim();
|
|
32
|
-
return joined || null;
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// packages/core/sha256.ts
|
|
38
|
-
import SHA256 from "crypto-js/sha256.js";
|
|
39
|
-
function sha256Hex(text) {
|
|
40
|
-
return SHA256(text).toString();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// packages/ai/context/retention.ts
|
|
44
|
-
var SAFE_BUFFER_RATIO = 0.95;
|
|
45
|
-
var CACHE_FIRST_RETENTION_STRENGTH = 0.95;
|
|
46
|
-
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
47
|
-
var planContextUsage = (params) => {
|
|
48
|
-
const { contextWindow, summaryTokens, recentLoad } = params;
|
|
49
|
-
const safeWindowLimit = Math.floor(contextWindow * SAFE_BUFFER_RATIO);
|
|
50
|
-
const iq = CACHE_FIRST_RETENTION_STRENGTH;
|
|
51
|
-
const isLargeWindow = contextWindow >= 512e3;
|
|
52
|
-
const isSmallWindow = contextWindow <= 64e3;
|
|
53
|
-
let baseHistoryRatio;
|
|
54
|
-
if (isLargeWindow) {
|
|
55
|
-
baseHistoryRatio = 0.8 + 0.2 * iq;
|
|
56
|
-
} else if (isSmallWindow) {
|
|
57
|
-
baseHistoryRatio = 0.35 + 0.3 * iq;
|
|
58
|
-
} else {
|
|
59
|
-
baseHistoryRatio = 0.55 + 0.3 * iq;
|
|
60
|
-
}
|
|
61
|
-
let historyRatio = baseHistoryRatio;
|
|
62
|
-
switch (recentLoad) {
|
|
63
|
-
case "light": {
|
|
64
|
-
const maxRatio = isLargeWindow ? 1 : isSmallWindow ? 0.75 : 0.85;
|
|
65
|
-
historyRatio = clamp(historyRatio * 1.05, 0.3, maxRatio);
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
case "heavy": {
|
|
69
|
-
const maxRatio = isLargeWindow ? 0.98 : isSmallWindow ? 0.7 : 0.8;
|
|
70
|
-
const multiplier = isLargeWindow ? 0.98 : isSmallWindow ? 0.9 : 0.9;
|
|
71
|
-
historyRatio = clamp(historyRatio * multiplier, 0.3, maxRatio);
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
case "medium":
|
|
75
|
-
default: {
|
|
76
|
-
const maxRatio = isLargeWindow ? 1 : isSmallWindow ? 0.75 : 0.85;
|
|
77
|
-
historyRatio = clamp(historyRatio, 0.3, maxRatio);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const historyBudget = Math.max(
|
|
82
|
-
0,
|
|
83
|
-
Math.floor(safeWindowLimit * historyRatio)
|
|
84
|
-
);
|
|
85
|
-
const minRawRatio = isSmallWindow ? 0.5 : isLargeWindow ? 0.2 : 0.3;
|
|
86
|
-
const rawMessageBudget = Math.max(
|
|
87
|
-
Math.floor(historyBudget * minRawRatio),
|
|
88
|
-
historyBudget - summaryTokens,
|
|
89
|
-
0
|
|
90
|
-
);
|
|
91
|
-
let minTailTokens;
|
|
92
|
-
if (recentLoad === "light") {
|
|
93
|
-
minTailTokens = Math.min(
|
|
94
|
-
Math.floor(safeWindowLimit * 0.3),
|
|
95
|
-
8e3
|
|
96
|
-
);
|
|
97
|
-
} else if (recentLoad === "heavy") {
|
|
98
|
-
minTailTokens = Math.max(
|
|
99
|
-
Math.floor(safeWindowLimit * 0.25),
|
|
100
|
-
16e3
|
|
101
|
-
);
|
|
102
|
-
} else {
|
|
103
|
-
minTailTokens = Math.floor(safeWindowLimit * 0.2);
|
|
104
|
-
}
|
|
105
|
-
return { historyBudget, rawMessageBudget, minTailTokens };
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// packages/ai/context/toolOutputCap.ts
|
|
109
|
-
var TOOL_OUTPUT_CAP_WINDOW_RATIO = 0.12;
|
|
110
|
-
var TOOL_OUTPUT_CAP_MIN_TOKENS = 4e3;
|
|
111
|
-
var TOOL_OUTPUT_CAP_MAX_TOKENS = 5e4;
|
|
112
|
-
var COMPRESSION_TRIGGER_RATIO_MAX = 0.78;
|
|
113
|
-
var COMPRESSION_TRIGGER_RATIO_MIN = 0.5;
|
|
114
|
-
var ROUND_OVERHEAD_WINDOW_RATIO = 0.08;
|
|
115
|
-
var ROUND_OVERHEAD_MIN_TOKENS = 4e3;
|
|
116
|
-
var ROUND_OVERHEAD_MAX_TOKENS = 24e3;
|
|
117
|
-
var clamp2 = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
118
|
-
var capToolOutputTokens = (contextWindow) => clamp2(
|
|
119
|
-
Math.floor(contextWindow * TOOL_OUTPUT_CAP_WINDOW_RATIO),
|
|
120
|
-
TOOL_OUTPUT_CAP_MIN_TOKENS,
|
|
121
|
-
TOOL_OUTPUT_CAP_MAX_TOKENS
|
|
122
|
-
);
|
|
123
|
-
var resolveCompressionTriggerRatio = (contextWindow) => {
|
|
124
|
-
if (typeof contextWindow !== "number" || !Number.isFinite(contextWindow) || contextWindow <= 0) {
|
|
125
|
-
return COMPRESSION_TRIGGER_RATIO_MAX;
|
|
126
|
-
}
|
|
127
|
-
const headroom = capToolOutputTokens(contextWindow) + clamp2(
|
|
128
|
-
Math.floor(contextWindow * ROUND_OVERHEAD_WINDOW_RATIO),
|
|
129
|
-
ROUND_OVERHEAD_MIN_TOKENS,
|
|
130
|
-
ROUND_OVERHEAD_MAX_TOKENS
|
|
131
|
-
);
|
|
132
|
-
return clamp2(
|
|
133
|
-
1 - headroom / contextWindow,
|
|
134
|
-
COMPRESSION_TRIGGER_RATIO_MIN,
|
|
135
|
-
COMPRESSION_TRIGGER_RATIO_MAX
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
var truncateToolOutputForContext = (text, contextWindow) => {
|
|
139
|
-
if (!text) return text;
|
|
140
|
-
const capTokens = capToolOutputTokens(contextWindow);
|
|
141
|
-
if (estimateTokenCount(text) <= capTokens) return text;
|
|
142
|
-
const build = (keepChars) => {
|
|
143
|
-
const headChars = Math.floor(keepChars * 0.6);
|
|
144
|
-
const tailChars = keepChars - headChars;
|
|
145
|
-
const omittedTokens = estimateTokenCount(
|
|
146
|
-
text.slice(headChars, text.length - tailChars)
|
|
147
|
-
);
|
|
148
|
-
return text.slice(0, headChars) + `
|
|
149
|
-
...[tool output truncated: ~${omittedTokens} tokens omitted]...
|
|
150
|
-
` + text.slice(text.length - tailChars);
|
|
151
|
-
};
|
|
152
|
-
let lo = 0;
|
|
153
|
-
let hi = text.length;
|
|
154
|
-
while (lo < hi) {
|
|
155
|
-
const mid = Math.ceil((lo + hi) / 2);
|
|
156
|
-
if (estimateTokenCount(build(mid)) <= capTokens) lo = mid;
|
|
157
|
-
else hi = mid - 1;
|
|
158
|
-
}
|
|
159
|
-
return build(lo);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// packages/ai/context/planCompression.ts
|
|
163
|
-
var MIN_COMPRESS_COUNT = 5;
|
|
164
|
-
var ACTIVE_SUMMARY_TAIL_KEEP_COUNT = 2;
|
|
165
|
-
var COMPACTION_RETENTION_CUSHION_RATIO = 0.18;
|
|
166
|
-
var MIN_TRIGGER_PENDING_COUNT = MIN_COMPRESS_COUNT + ACTIVE_SUMMARY_TAIL_KEEP_COUNT;
|
|
167
|
-
var getMessageTokenCount = (msg) => {
|
|
168
|
-
const content = serializeMessageContent(msg.content) || "";
|
|
169
|
-
let tokens = estimateTokenCount(content);
|
|
170
|
-
if (Array.isArray(msg.tool_calls)) {
|
|
171
|
-
for (const call of msg.tool_calls) {
|
|
172
|
-
const fn = call?.function;
|
|
173
|
-
if (fn?.name) tokens += estimateTokenCount(fn.name);
|
|
174
|
-
const args = fn?.arguments;
|
|
175
|
-
if (args) {
|
|
176
|
-
tokens += estimateTokenCount(
|
|
177
|
-
typeof args === "string" ? args : JSON.stringify(args)
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return tokens;
|
|
183
|
-
};
|
|
184
|
-
var hasOpenEndedToolCall = (msg) => !!msg && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
|
|
185
|
-
var classifyConversationLoad = (msgs) => {
|
|
186
|
-
const N = 20;
|
|
187
|
-
if (!Array.isArray(msgs) || msgs.length === 0) return "light";
|
|
188
|
-
const tail = msgs.slice(-N);
|
|
189
|
-
const tokenSamples = tail.map(getMessageTokenCount);
|
|
190
|
-
if (tokenSamples.length === 0) return "light";
|
|
191
|
-
const sum = tokenSamples.reduce((acc, v) => acc + v, 0);
|
|
192
|
-
const avg = sum / tokenSamples.length;
|
|
193
|
-
const sorted = [...tokenSamples].sort((a, b) => a - b);
|
|
194
|
-
const p95 = sorted[Math.floor((sorted.length - 1) * 0.95)];
|
|
195
|
-
if (p95 < 200 && avg < 120) {
|
|
196
|
-
return "light";
|
|
197
|
-
}
|
|
198
|
-
if (p95 > 2e3 || avg > 1200) {
|
|
199
|
-
return "heavy";
|
|
200
|
-
}
|
|
201
|
-
return "medium";
|
|
202
|
-
};
|
|
203
|
-
var normalizeContextUsageRatio = (value) => {
|
|
204
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
205
|
-
const ratio = value > 1 ? value / 100 : value;
|
|
206
|
-
return ratio >= 0 && ratio <= 1 ? ratio : void 0;
|
|
207
|
-
};
|
|
208
|
-
var emptyPlan = (startIndex, diagnostics) => ({
|
|
209
|
-
shouldCompress: false,
|
|
210
|
-
compressCount: 0,
|
|
211
|
-
msgsToCompress: [],
|
|
212
|
-
msgsToKeep: [],
|
|
213
|
-
newSummarizedBeforeId: void 0,
|
|
214
|
-
startIndex,
|
|
215
|
-
...diagnostics ? { diagnostics } : {}
|
|
216
|
-
});
|
|
217
|
-
function findPendingMessages(allMsgs, summarizedBeforeId) {
|
|
218
|
-
let startIndex = 0;
|
|
219
|
-
if (summarizedBeforeId) {
|
|
220
|
-
const found = allMsgs.findIndex((m) => m.id === summarizedBeforeId);
|
|
221
|
-
if (found !== -1) startIndex = found + 1;
|
|
222
|
-
}
|
|
223
|
-
return { pendingMsgs: allMsgs.slice(startIndex), startIndex };
|
|
224
|
-
}
|
|
225
|
-
function shouldTriggerCompaction(args) {
|
|
226
|
-
const {
|
|
227
|
-
pendingMsgCount,
|
|
228
|
-
totalUsed,
|
|
229
|
-
historyBudget,
|
|
230
|
-
triggerRatio,
|
|
231
|
-
force,
|
|
232
|
-
reason,
|
|
233
|
-
realContextUsagePercent,
|
|
234
|
-
coldResume,
|
|
235
|
-
lastMsg
|
|
236
|
-
} = args;
|
|
237
|
-
const usageRatio = normalizeContextUsageRatio(realContextUsagePercent);
|
|
238
|
-
const triggeredByRealUsage = usageRatio !== void 0 && usageRatio >= triggerRatio;
|
|
239
|
-
const triggeredByEstimate = usageRatio === void 0 && totalUsed >= historyBudget;
|
|
240
|
-
const shouldRunActiveSummary = force && reason === "manual" && (pendingMsgCount < MIN_TRIGGER_PENDING_COUNT || !hasOpenEndedToolCall(lastMsg));
|
|
241
|
-
const triggeredByColdResume = coldResume === true && pendingMsgCount >= MIN_TRIGGER_PENDING_COUNT;
|
|
242
|
-
return {
|
|
243
|
-
trigger: triggeredByRealUsage || triggeredByEstimate || shouldRunActiveSummary || triggeredByColdResume,
|
|
244
|
-
triggeredByRealUsage,
|
|
245
|
-
shouldRunActiveSummary,
|
|
246
|
-
triggeredByColdResume
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function calculateCompressCount(pendingMsgs, rawMessageBudget, opts) {
|
|
250
|
-
const { keepTailCount, totalUsed, historyBudget } = opts;
|
|
251
|
-
if (keepTailCount && totalUsed < historyBudget) {
|
|
252
|
-
return Math.max(0, pendingMsgs.length - ACTIVE_SUMMARY_TAIL_KEEP_COUNT);
|
|
253
|
-
}
|
|
254
|
-
let tokensToKeep = 0;
|
|
255
|
-
let keepCount = 0;
|
|
256
|
-
for (let i = pendingMsgs.length - 1; i >= 0; i--) {
|
|
257
|
-
const t = getMessageTokenCount(pendingMsgs[i]);
|
|
258
|
-
if (tokensToKeep + t > rawMessageBudget) break;
|
|
259
|
-
tokensToKeep += t;
|
|
260
|
-
keepCount++;
|
|
261
|
-
}
|
|
262
|
-
return pendingMsgs.length - keepCount;
|
|
263
|
-
}
|
|
264
|
-
function resolveEffectiveCompactionBudgets(args) {
|
|
265
|
-
const {
|
|
266
|
-
contextWindow,
|
|
267
|
-
triggerRatio,
|
|
268
|
-
historyBudget,
|
|
269
|
-
rawMessageBudget,
|
|
270
|
-
summaryTokens,
|
|
271
|
-
cushionRatio = COMPACTION_RETENTION_CUSHION_RATIO
|
|
272
|
-
} = args;
|
|
273
|
-
const maxRetainedRatio = Math.max(
|
|
274
|
-
0.2,
|
|
275
|
-
Number((triggerRatio - cushionRatio).toFixed(4))
|
|
276
|
-
);
|
|
277
|
-
const maxRetainedHistoryBudget = Math.floor(contextWindow * maxRetainedRatio);
|
|
278
|
-
const effectiveHistoryBudget = Math.min(historyBudget, maxRetainedHistoryBudget);
|
|
279
|
-
const effectiveRawMessageBudget = Math.min(
|
|
280
|
-
rawMessageBudget,
|
|
281
|
-
Math.max(0, effectiveHistoryBudget - summaryTokens)
|
|
282
|
-
);
|
|
283
|
-
return {
|
|
284
|
-
effectiveHistoryBudget,
|
|
285
|
-
effectiveRawMessageBudget,
|
|
286
|
-
maxRetainedRatio
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
function guardToolChainBoundary(pendingMsgs, compressCount) {
|
|
290
|
-
let count = compressCount;
|
|
291
|
-
while (count < pendingMsgs.length && pendingMsgs[count].role === "tool") {
|
|
292
|
-
count++;
|
|
293
|
-
}
|
|
294
|
-
while (count > 0 && hasOpenEndedToolCall(pendingMsgs[count - 1])) {
|
|
295
|
-
if (count < pendingMsgs.length && pendingMsgs[count].role === "tool") {
|
|
296
|
-
count++;
|
|
297
|
-
} else {
|
|
298
|
-
count--;
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return count;
|
|
303
|
-
}
|
|
304
|
-
function planCompression(input) {
|
|
305
|
-
const {
|
|
306
|
-
allMsgs,
|
|
307
|
-
summarizedBeforeId,
|
|
308
|
-
summary,
|
|
309
|
-
contextWindow,
|
|
310
|
-
force = false,
|
|
311
|
-
reason,
|
|
312
|
-
realContextUsagePercent,
|
|
313
|
-
coldResume
|
|
314
|
-
} = input;
|
|
315
|
-
const { pendingMsgs, startIndex } = findPendingMessages(allMsgs, summarizedBeforeId);
|
|
316
|
-
if (pendingMsgs.length === 0) {
|
|
317
|
-
return emptyPlan(startIndex, {
|
|
318
|
-
pendingMsgCount: 0,
|
|
319
|
-
totalUsed: estimateTokenCount(summary || ""),
|
|
320
|
-
historyBudget: 0,
|
|
321
|
-
triggerRatio: resolveCompressionTriggerRatio(contextWindow),
|
|
322
|
-
realUsageRatio: normalizeContextUsageRatio(realContextUsagePercent),
|
|
323
|
-
triggeredByRealUsage: false,
|
|
324
|
-
triggeredByEstimate: false,
|
|
325
|
-
triggeredByColdResume: false,
|
|
326
|
-
shouldRunActiveSummary: false,
|
|
327
|
-
emptyReason: "no-pending"
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
const summaryTokens = estimateTokenCount(summary || "");
|
|
331
|
-
const pendingTokens = pendingMsgs.reduce((sum, msg) => sum + getMessageTokenCount(msg), 0);
|
|
332
|
-
const totalUsed = summaryTokens + pendingTokens;
|
|
333
|
-
const adjustedSummaryTokens = Math.max(summaryTokens, 1e3);
|
|
334
|
-
const recentLoad = classifyConversationLoad(pendingMsgs);
|
|
335
|
-
const { historyBudget, rawMessageBudget } = planContextUsage({
|
|
336
|
-
contextWindow,
|
|
337
|
-
summaryTokens: adjustedSummaryTokens,
|
|
338
|
-
recentLoad
|
|
339
|
-
});
|
|
340
|
-
const triggerRatio = resolveCompressionTriggerRatio(contextWindow);
|
|
341
|
-
const {
|
|
342
|
-
trigger,
|
|
343
|
-
triggeredByRealUsage,
|
|
344
|
-
shouldRunActiveSummary,
|
|
345
|
-
triggeredByColdResume
|
|
346
|
-
} = shouldTriggerCompaction({
|
|
347
|
-
pendingMsgCount: pendingMsgs.length,
|
|
348
|
-
totalUsed,
|
|
349
|
-
historyBudget,
|
|
350
|
-
triggerRatio,
|
|
351
|
-
force,
|
|
352
|
-
reason,
|
|
353
|
-
realContextUsagePercent,
|
|
354
|
-
coldResume,
|
|
355
|
-
lastMsg: pendingMsgs[pendingMsgs.length - 1]
|
|
356
|
-
});
|
|
357
|
-
const diagnostics = {
|
|
358
|
-
pendingMsgCount: pendingMsgs.length,
|
|
359
|
-
totalUsed,
|
|
360
|
-
historyBudget,
|
|
361
|
-
triggerRatio,
|
|
362
|
-
realUsageRatio: normalizeContextUsageRatio(realContextUsagePercent),
|
|
363
|
-
triggeredByRealUsage,
|
|
364
|
-
triggeredByEstimate: normalizeContextUsageRatio(realContextUsagePercent) === void 0 && totalUsed >= historyBudget,
|
|
365
|
-
triggeredByColdResume,
|
|
366
|
-
shouldRunActiveSummary
|
|
367
|
-
};
|
|
368
|
-
if (!trigger) {
|
|
369
|
-
return emptyPlan(startIndex, {
|
|
370
|
-
...diagnostics,
|
|
371
|
-
emptyReason: "not-triggered"
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
const { effectiveHistoryBudget, effectiveRawMessageBudget } = resolveEffectiveCompactionBudgets({
|
|
375
|
-
contextWindow,
|
|
376
|
-
triggerRatio,
|
|
377
|
-
historyBudget,
|
|
378
|
-
rawMessageBudget,
|
|
379
|
-
summaryTokens
|
|
380
|
-
});
|
|
381
|
-
let compressCount = calculateCompressCount(
|
|
382
|
-
pendingMsgs,
|
|
383
|
-
effectiveRawMessageBudget,
|
|
384
|
-
{
|
|
385
|
-
keepTailCount: shouldRunActiveSummary || triggeredByRealUsage || triggeredByColdResume,
|
|
386
|
-
totalUsed,
|
|
387
|
-
historyBudget: effectiveHistoryBudget
|
|
388
|
-
}
|
|
389
|
-
);
|
|
390
|
-
compressCount = guardToolChainBoundary(pendingMsgs, compressCount);
|
|
391
|
-
const allowSmallPrefix = reason !== "task_completed" && (shouldRunActiveSummary || triggeredByRealUsage || diagnostics.triggeredByEstimate);
|
|
392
|
-
if (allowSmallPrefix && (compressCount < MIN_COMPRESS_COUNT || pendingMsgs.length < MIN_TRIGGER_PENDING_COUNT)) {
|
|
393
|
-
let safeLimit = pendingMsgs.length - 1;
|
|
394
|
-
for (let i = pendingMsgs.length - 1; i >= 0; i--) {
|
|
395
|
-
if (pendingMsgs[i].role === "user") {
|
|
396
|
-
safeLimit = i;
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
compressCount = Math.min(compressCount, safeLimit);
|
|
401
|
-
while (compressCount > 0 && (pendingMsgs[compressCount]?.role === "tool" || hasOpenEndedToolCall(pendingMsgs[compressCount - 1]))) {
|
|
402
|
-
compressCount--;
|
|
403
|
-
}
|
|
404
|
-
if (compressCount === 0) {
|
|
405
|
-
return emptyPlan(startIndex, {
|
|
406
|
-
...diagnostics,
|
|
407
|
-
compressCount,
|
|
408
|
-
emptyReason: "no-safe-prefix"
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
const compressibleTokens = pendingMsgs.slice(0, compressCount).reduce((sum, msg) => sum + getMessageTokenCount(msg), 0);
|
|
413
|
-
if (compressCount < MIN_COMPRESS_COUNT && !(allowSmallPrefix && compressibleTokens >= 1e3)) {
|
|
414
|
-
return emptyPlan(startIndex, {
|
|
415
|
-
...diagnostics,
|
|
416
|
-
compressCount,
|
|
417
|
-
emptyReason: "below-min-compress-count"
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
const msgsToCompress = pendingMsgs.slice(0, compressCount);
|
|
421
|
-
const msgsToKeep = pendingMsgs.slice(compressCount);
|
|
422
|
-
const newSummarizedBeforeId = msgsToCompress[msgsToCompress.length - 1].id;
|
|
423
|
-
return {
|
|
424
|
-
shouldCompress: true,
|
|
425
|
-
compressCount,
|
|
426
|
-
msgsToCompress,
|
|
427
|
-
msgsToKeep,
|
|
428
|
-
newSummarizedBeforeId,
|
|
429
|
-
startIndex,
|
|
430
|
-
diagnostics: { ...diagnostics, compressCount }
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// packages/ai/context/compactionShared.ts
|
|
435
|
-
var COMPACTION_SUMMARY_SCHEMA_VERSION = 2;
|
|
436
|
-
var COMPACTION_SUMMARY_SYSTEM_PROMPT = `\u4F60\u662F\u5BF9\u8BDD\u4E0A\u4E0B\u6587\u538B\u7F29\u5668\u3002\u6839\u636E\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\u548C\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF0C\u8F93\u51FA\u53EF\u66FF\u4EE3\u539F\u59CB\u6D88\u606F\u7684\u4E8B\u5B9E\u6027\u8981\u70B9\uFF0C\u4F9B\u540E\u7EED\u5BF9\u8BDD\u76F4\u63A5\u4F7F\u7528\u3002
|
|
437
|
-
|
|
438
|
-
\u4E25\u683C\u53EA\u8F93\u51FA\u4E0B\u9762\u4E09\u90E8\u5206\uFF0C\u6807\u9898\u5FC5\u987B\u5B8C\u5168\u4E00\u81F4\uFF1A
|
|
439
|
-
\u5173\u952E\u4E8B\u5B9E\u6863\u6848
|
|
440
|
-
- ...
|
|
441
|
-
\u5BF9\u8BDD\u8FDB\u5C55\u4E0E\u5F85\u529E
|
|
442
|
-
- ...
|
|
443
|
-
\u6587\u4EF6\u64CD\u4F5C\u6E05\u5355
|
|
444
|
-
- ...
|
|
445
|
-
|
|
446
|
-
\u8981\u6C42\uFF1A
|
|
447
|
-
1) \u4F7F\u7528\u5BF9\u8BDD\u4E3B\u8BED\u8A00\uFF1B\u6DF7\u5408\u8BED\u8A00\u65F6\u4F18\u5148\u7528\u6237\u4E3B\u8981\u8BED\u8A00\uFF1B\u4E13\u6709\u540D\u8BCD\u3001\u6587\u4EF6\u8DEF\u5F84\u3001\u6807\u8BC6\u7B26\u3001\u547D\u4EE4\u4FDD\u7559\u539F\u6587\uFF0C\u4E0D\u8981\u7FFB\u8BD1\u6216\u8F6C\u8FF0\u3002
|
|
448
|
-
2) \u5173\u952E\u4E8B\u5B9E\u6863\u6848\u7684**\u524D\u4E24\u9879\u56FA\u5B9A\u662F**\uFF1A
|
|
449
|
-
- \u300C\u539F\u59CB\u76EE\u6807\u300D\uFF1A\u8FD9\u6BB5\u5BF9\u8BDD**\u6700\u521D**\u7684\u610F\u56FE\u4E0E\u539F\u8BDD\uFF08\u5C3D\u91CF\u4FDD\u7559\u4ED6\u7684\u539F\u8BDD\u4E0E\u7528\u8BCD\uFF0C\u4E0D\u8981\u6539\u5199\u6210\u4EFB\u52A1\u6E05\u5355\uFF09\u3002
|
|
450
|
-
"\u6700\u521D"\u6307\u5F00\u5BF9\u8BDD\u90A3\u4E00\u523B\u2014\u2014\u4E0D\u5F97\u7528\u5BF9\u8BDD\u540E\u6765\u7684\u67D0\u53E5\u7528\u6237\u8BDD\uFF08\u5982\u4E34\u7761\u59D4\u6258\u3001\u4E2D\u671F\u8F6C\u8FF0\uFF09\u66FF\u4EE3\u6700\u521D\u76EE\u6807\uFF1B
|
|
451
|
-
\u6700\u521D\u539F\u8BDD\u4E0D\u5728\u672C\u6B21\u538B\u7F29\u8303\u56F4\u5185\u65F6\uFF0C\u6309\u300C\u8F93\u5165\u672A\u8986\u76D6\u300D\u5199"\u8F93\u5165\u4E2D\u672A\u89C1"\uFF0C\u518D\u4F9D\u636E\u5BF9\u8BDD\u5185\u6700\u65E9\u53EF\u8003\u7684\u590D\u8FF0\u5E76\u6CE8\u660E\u3002
|
|
452
|
-
\u589E\u91CF\u66F4\u65B0\u65F6\u6CBF\u7528\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\u91CC\u5DF2\u6709\u7684\u300C\u539F\u59CB\u76EE\u6807\u300D\uFF0C\u4E0D\u8981\u88AB\u65B0\u589E\u5BF9\u8BDD\u6539\u5199\u2014\u2014\u5B83\u662F\u7A33\u5B9A\u5B57\u6BB5\uFF1B
|
|
453
|
-
\u4EC5\u5F53\u65B0\u5BF9\u8BDD\u660E\u786E\u8868\u660E\u539F\u6587\u6709\u4E8B\u5B9E\u6027\u9519\u8BEF\u65F6\u624D\u4FEE\u6B63\uFF0C\u5E76\u5728\u300C\u76EE\u6807\u6F14\u5316\u300D\u91CC\u6CE8\u660E\u3002
|
|
454
|
-
- \u300C\u76EE\u6807\u6F14\u5316\u300D\uFF1A\u82E5\u4E2D\u9014\u8F6C\u5411\uFF0C\u5199\u6E05\u8F6C\u5411\u4E86\u4EC0\u4E48\u3001\u56E0\u4E3A\u4EC0\u4E48\uFF1B\u6CA1\u6709\u8F6C\u5411\u5C31\u5199\u300C\u65E0\u8F6C\u5411\u300D\u6216\u7701\u7565\u8FD9\u4E00\u9879\uFF0C\u4E0D\u8981\u786C\u51D1\u3002
|
|
455
|
-
\u88AB\u540E\u7EED\u5DE5\u4F5C\u53D6\u4EE3\u7684\u662F"\u65B9\u6848"\uFF0C\u4E0D\u662F"\u7528\u6237\u7684\u521D\u59CB\u610F\u56FE"\u2014\u2014\u521D\u59CB\u610F\u56FE\u4E0D\u5F97\u7701\u7565\u3002
|
|
456
|
-
\u5176\u540E\u624D\u662F\uFF1A\u7528\u6237\u504F\u597D\u3001\u7EA6\u675F\u3001\u6280\u672F\u6808\u3001\u786E\u5B9A\u7684\u6587\u4EF6\u8DEF\u5F84\u3001\u6838\u5FC3\u51B3\u7B56\u3001\u672A\u5B8C\u6210\u5F85\u529E\u3002\u4FDD\u7559\u786E\u5207\u503C\uFF08\u7AEF\u53E3\u53F7\u3001\u7248\u672C\u53F7\u3001\u8DEF\u5F84\u3001\u53D8\u91CF\u540D\u3001\u9519\u8BEF\u4FE1\u606F\u539F\u6587\uFF09\uFF0C\u4E0D\u8981\u6982\u62EC\u6210"\u67D0\u4E2A\u7AEF\u53E3"\u6216"\u67D0\u4E2A\u6587\u4EF6"\u6216"\u67D0\u62A5\u9519"\u3002
|
|
457
|
-
\u5173\u952E\u4E8B\u5B9E\u6863\u6848\u8FD8\u5FC5\u987B\u5305\u542B\u4EE5\u4E0B\u4E09\u9879\uFF08\u53EF\u63A5\u5728\u56FA\u5B9A\u4E24\u9879\u4E4B\u540E\uFF0C\u7F3A\u4FE1\u606F\u65F6\u5982\u5B9E\u5199\u660E\uFF0C\u4E0D\u5F97\u7701\u7565\uFF09\uFF1A
|
|
458
|
-
- \u300C\u5DF2\u8BC1\u4F2A\u7684\u5047\u8BBE\u300D\uFF1A\u88AB\u8BC1\u636E\u5426\u51B3\u6216\u51B3\u5B9A\u4E0D\u91C7\u7528\u7684\u7ED3\u8BBA\u5355\u5217\uFF0C\u6CE8\u660E"\u5DF2\u8BC1\u4F2A/\u4E0D\u91C7\u7528"\u53CA\u4F9D\u636E\uFF0C\u9632\u6B62\u7EED\u4F5C\u628A\u5B83\u5F53\u4E8B\u5B9E\u91CD\u542F\u3002
|
|
459
|
-
- \u300C\u5361\u70B9\u4E0E\u9700\u7528\u6237\u51B3\u5B9A\u300D\uFF1A\u963B\u585E\u9879\u5361\u5728\u54EA\u3001\u9700\u8981\u7528\u6237\u63D0\u4F9B\u4EC0\u4E48\uFF08\u6388\u6743 / \u51ED\u636E / \u51B3\u5B9A\uFF09\uFF0C\u5199\u6E05\u695A\uFF0C\u4E0D\u5F97\u542B\u7CCA\u3002
|
|
460
|
-
- \u300C\u8F93\u5165\u672A\u8986\u76D6\u300D\uFF1A\u538B\u7F29\u8303\u56F4\u5185\u67E5\u4E0D\u5230\u7684\u5173\u952E\u4FE1\u606F\uFF08\u5982\u521D\u59CB\u539F\u8BDD\u3001\u6307\u5B9A id\uFF09\uFF0C\u5FC5\u987B\u5199"\u8F93\u5165\u4E2D\u672A\u89C1"\uFF0C\u7981\u6B62\u8111\u8865\u3002
|
|
461
|
-
3) \u5BF9\u8BDD\u8FDB\u5C55\u4E0E\u5F85\u529E\u4EE5\u7B2C\u4E00\u4EBA\u79F0\u7EED\u4F5C\u7B14\u8BB0\u7684\u53E3\u543B\u5199\uFF08"\u6211\u505A\u4E86\u2026""\u7528\u6237\u8981\u6C42\u2026""\u4E0B\u4E00\u6B65\u6211\u9700\u8981\u2026"\uFF09\uFF0C\u4E0D\u8981\u5199\u6210\u7B2C\u4E09\u65B9\u89C2\u5BDF\u62A5\u544A\u3002\u5148\u6781\u7B80\u6982\u62EC\u65E7\u4E0A\u4E0B\u6587\uFF0C\u518D\u66F4\u8BE6\u7EC6\u8BB0\u5F55\u6700\u8FD1\u8FDB\u5C55\u3001\u7ED3\u8BBA\u3001\u5206\u6B67\u4E0E\u4E0B\u4E00\u6B65\u3002\u5BF9\u4E8E\u58F0\u79F0\u5DF2\u5B8C\u6210\u4F46\u5C1A\u672A\u9A8C\u8BC1\u7684\u5DE5\u4F5C\uFF08\u5982\u5DE5\u5177\u8C03\u7528\u8FD4\u56DE\u6210\u529F\u4F46\u7ED3\u679C\u672A\u4EBA\u5DE5\u786E\u8BA4\uFF09\uFF0C\u660E\u786E\u6807\u6CE8"\uFF08\u5F85\u9A8C\u8BC1\uFF09"\u2014\u2014\u4E0D\u8981\u9ED8\u8BA4\u4FE1\u4EFB\u5DE5\u5177\u8FD4\u56DE\u503C\u3002
|
|
462
|
-
4) \u6587\u4EF6\u64CD\u4F5C\u6E05\u5355\uFF1A\u5217\u51FA\u672C\u6B21\u538B\u7F29\u8303\u56F4\u5185\u8BFB\u53D6\u3001\u5199\u5165\u3001\u7F16\u8F91\u8FC7\u7684\u6587\u4EF6\u8DEF\u5F84\u53CA\u64CD\u4F5C\u7C7B\u578B\uFF08\u5982: - \u8BFB\u53D6: path/to/file\uFF1B\u82E5\u672A\u6D89\u53CA\u6587\u4EF6\u64CD\u4F5C\u5199"\u65E0"\uFF09\u3002
|
|
463
|
-
5) \u5FFD\u7565\u5BD2\u6684\u3001\u91CD\u590D\u5C1D\u8BD5\u548C\u65E0\u4EF7\u503C\u5E9F\u8BDD\uFF1B**\u5DF2\u653E\u5F03\u7684\u65B9\u6848/\u5C1D\u8BD5**\u53EF\u4EE5\u7701\u7565\uFF0C\u4F46\u7528\u6237\u5F53\u521D\u7684\u610F\u56FE\u4E0E\u7406\u7531\u4E0D\u53EF\u7701\u7565\uFF08\u89C1\u7B2C 2 \u6761\uFF09\u3002
|
|
464
|
-
6) \u4E0D\u8981\u7F16\u9020\u672A\u51FA\u73B0\u7684\u4FE1\u606F\uFF1B\u4E0D\u8981\u5F00\u573A\u767D\u3001\u7ED3\u675F\u8BED\u3001markdown \u4EE3\u7801\u5757\u6216\u989D\u5916\u7AE0\u8282\uFF1B\u4E0D\u8981\u8C03\u7528\u4EFB\u4F55\u5DE5\u5177\u3002`;
|
|
465
|
-
function formatMessageContentFallback(msg) {
|
|
466
|
-
const content = serializeMessageContent(msg.content);
|
|
467
|
-
if (content) return content;
|
|
468
|
-
if (Array.isArray(msg.tool_calls)) {
|
|
469
|
-
return `[tool_calls:${msg.tool_calls.map((c) => c.function?.name).filter(Boolean).join(",")}]`;
|
|
470
|
-
}
|
|
471
|
-
return "[\u975E\u6587\u672C\u5185\u5BB9]";
|
|
472
|
-
}
|
|
473
|
-
function buildCompactionUserContent(args) {
|
|
474
|
-
const parts = [`\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\uFF1A
|
|
475
|
-
${args.previousSummary || "(\u65E0)"}`];
|
|
476
|
-
if (args.fileOpsText !== void 0) {
|
|
477
|
-
parts.push(`\u3010\u6587\u4EF6\u64CD\u4F5C\u6E05\u5355\u3011\uFF1A
|
|
478
|
-
${args.fileOpsText || "\u65E0"}`);
|
|
479
|
-
}
|
|
480
|
-
parts.push(`\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF1A
|
|
481
|
-
${args.messagesText}`);
|
|
482
|
-
return parts.join("\n\n").trim();
|
|
483
|
-
}
|
|
484
|
-
function extractFileOperationsFromCalls(calls, resolveCanonicalName) {
|
|
485
|
-
const result = [];
|
|
486
|
-
const seen = /* @__PURE__ */ new Set();
|
|
487
|
-
const fileOperationByTool = {
|
|
488
|
-
readFile: "read",
|
|
489
|
-
writeFile: "write",
|
|
490
|
-
editFile: "edit"
|
|
491
|
-
};
|
|
492
|
-
for (const call of calls) {
|
|
493
|
-
const rawName = call.function?.name || call.name || "";
|
|
494
|
-
if (!rawName) continue;
|
|
495
|
-
const canonicalName = resolveCanonicalName(rawName);
|
|
496
|
-
const opType = fileOperationByTool[canonicalName];
|
|
497
|
-
if (!opType) continue;
|
|
498
|
-
let rawArgs = call.function?.arguments;
|
|
499
|
-
let parsedArgs = null;
|
|
500
|
-
if (typeof rawArgs === "string") {
|
|
501
|
-
try {
|
|
502
|
-
parsedArgs = JSON.parse(rawArgs);
|
|
503
|
-
} catch {
|
|
504
|
-
}
|
|
505
|
-
} else if (typeof rawArgs === "object" && rawArgs !== null) {
|
|
506
|
-
parsedArgs = rawArgs;
|
|
507
|
-
}
|
|
508
|
-
const path = parsedArgs?.path ?? parsedArgs?.filePath ?? parsedArgs?.file;
|
|
509
|
-
if (typeof path === "string" && path.trim()) {
|
|
510
|
-
const key = `${opType}:${path.trim()}`;
|
|
511
|
-
if (!seen.has(key)) {
|
|
512
|
-
seen.add(key);
|
|
513
|
-
result.push({ type: opType, path: path.trim() });
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return result;
|
|
518
|
-
}
|
|
519
|
-
function formatFileOperationsFromMessages(msgs, resolveCanonicalName) {
|
|
520
|
-
const allOps = [];
|
|
521
|
-
for (const msg of msgs) {
|
|
522
|
-
if (!Array.isArray(msg.tool_calls)) continue;
|
|
523
|
-
allOps.push(
|
|
524
|
-
...extractFileOperationsFromCalls(msg.tool_calls, resolveCanonicalName)
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
if (allOps.length === 0) return "\u65E0";
|
|
528
|
-
const typeLabelMap = {
|
|
529
|
-
read: "\u8BFB\u53D6",
|
|
530
|
-
write: "\u5199\u5165",
|
|
531
|
-
edit: "\u7F16\u8F91"
|
|
532
|
-
};
|
|
533
|
-
return allOps.map((op) => `- ${typeLabelMap[op.type]}: ${op.path}`).join("\n");
|
|
534
|
-
}
|
|
535
|
-
var TOOL_RESULT_TRUNCATE_CHARS = 4e3;
|
|
536
|
-
var SUMMARY_INPUT_MAX_TOKENS = 3e4;
|
|
537
|
-
function computeSummaryInputTokenCap(contextWindow) {
|
|
538
|
-
const halfWindow = typeof contextWindow === "number" && Number.isFinite(contextWindow) && contextWindow > 0 ? Math.floor(contextWindow * 0.5) : SUMMARY_INPUT_MAX_TOKENS;
|
|
539
|
-
return Math.max(1, Math.min(SUMMARY_INPUT_MAX_TOKENS, halfWindow));
|
|
540
|
-
}
|
|
541
|
-
function capTextToTokenBudget(text, maxTokens) {
|
|
542
|
-
const marker = `
|
|
543
|
-
|
|
544
|
-
[... summary input capped to ${maxTokens} tokens ...]`;
|
|
545
|
-
const markerTokens = estimateTokenCount(marker);
|
|
546
|
-
const budget = Math.max(0, maxTokens - markerTokens);
|
|
547
|
-
if (estimateTokenCount(text) <= budget) return text;
|
|
548
|
-
let lo = 0;
|
|
549
|
-
let hi = text.length;
|
|
550
|
-
while (lo < hi) {
|
|
551
|
-
const mid = lo + hi + 1 >> 1;
|
|
552
|
-
if (estimateTokenCount(text.slice(0, mid)) <= budget) lo = mid;
|
|
553
|
-
else hi = mid - 1;
|
|
554
|
-
}
|
|
555
|
-
return `${text.slice(0, lo)}${marker}`;
|
|
556
|
-
}
|
|
557
|
-
function capSummaryInputToTokenBudget(items, maxTotalTokens) {
|
|
558
|
-
if (items.length === 0) return "";
|
|
559
|
-
const sepTokens = estimateTokenCount("\n");
|
|
560
|
-
const kept = [];
|
|
561
|
-
let used = 0;
|
|
562
|
-
for (let i = items.length - 1; i >= 0; i -= 1) {
|
|
563
|
-
const t = estimateTokenCount(items[i]);
|
|
564
|
-
const sep = kept.length > 0 ? sepTokens : 0;
|
|
565
|
-
if (kept.length > 0 && used + sep + t > maxTotalTokens) break;
|
|
566
|
-
used += sep + t;
|
|
567
|
-
kept.push(items[i]);
|
|
568
|
-
}
|
|
569
|
-
kept.reverse();
|
|
570
|
-
const result = kept.join("\n");
|
|
571
|
-
return estimateTokenCount(result) > maxTotalTokens ? capTextToTokenBudget(result, maxTotalTokens) : result;
|
|
572
|
-
}
|
|
573
|
-
var EVIDENCE_LINE_PATTERNS = [
|
|
574
|
-
// commit sha:必须带 git 语境(commit/sha/HEAD/merge/push 输出 a..b)且含字母+数字
|
|
575
|
-
/\b(?:commit|sha|HEAD|merge|revert|cherry-pick)\b[^\n]{0,24}\b(?=[0-9a-f]*[a-f])(?=[0-9a-f]*\d)[0-9a-f]{7,40}\b/i,
|
|
576
|
-
/\b(?=[0-9a-f]*[a-f])(?=[0-9a-f]*\d)[0-9a-f]{7,40}\.\.(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}\b/,
|
|
577
|
-
// 测试结论:带计数的 pass/fail,或 bun/jest 风格的 (pass)/(fail) 行首
|
|
578
|
-
/\b\d+\s+(?:pass|passed|fail|failed|tests?)\b/i,
|
|
579
|
-
/^\s*\((?:pass|fail)\)/i,
|
|
580
|
-
/^\s*(?:FAIL|PASS|ERROR)\b[:\s]/,
|
|
581
|
-
// 退出码 / HTTP 状态:必须带键名
|
|
582
|
-
/\bexit(?:\s*code|Code|_code)?\s*[=:]\s*\d+/i,
|
|
583
|
-
/\bHTTP\/[\d.]+\s+[1-5]\d{2}\b/,
|
|
584
|
-
/\b(?:status|statusCode|http_code|code)\s*[=:]\s*[1-5]\d{2}\b/i,
|
|
585
|
-
// 错误:行首的 XxxError:/Exception:,或 error: 前缀;超时带 timeout 关键结构
|
|
586
|
-
/^\s*(?:Uncaught\s+)?[A-Z]\w*(?:Error|Exception)\b\s*:/,
|
|
587
|
-
/^\s*(?:error|fatal|panic)\s*:/i,
|
|
588
|
-
/\bTimeout\s+\d+\s*ms\s+exceeded\b/i,
|
|
589
|
-
// 堆栈帧
|
|
590
|
-
/^\s*at\s+\S+.*:\d+(?::\d+)?\)?\s*$/
|
|
591
|
-
];
|
|
592
|
-
function isEvidenceLine(line) {
|
|
593
|
-
if (!line) return false;
|
|
594
|
-
return EVIDENCE_LINE_PATTERNS.some((re) => re.test(line));
|
|
595
|
-
}
|
|
596
|
-
function selectEvidenceLines(lines) {
|
|
597
|
-
return lines.filter(isEvidenceLine);
|
|
598
|
-
}
|
|
599
|
-
var HEAD_SHARE = 0.4;
|
|
600
|
-
var TAIL_SHARE = 0.4;
|
|
601
|
-
function evidenceTruncateBudget(maxChars) {
|
|
602
|
-
const markerReserve = 96;
|
|
603
|
-
const usable = Math.max(0, maxChars - markerReserve);
|
|
604
|
-
const headCap = Math.floor(usable * HEAD_SHARE);
|
|
605
|
-
const tailCap = Math.floor(usable * TAIL_SHARE);
|
|
606
|
-
return {
|
|
607
|
-
markerReserve,
|
|
608
|
-
headCap,
|
|
609
|
-
tailCap,
|
|
610
|
-
evidenceCap: Math.max(0, usable - headCap - tailCap)
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
function takeHeadLines(lines, cap) {
|
|
614
|
-
let text = "";
|
|
615
|
-
let consumed = 0;
|
|
616
|
-
for (const line of lines) {
|
|
617
|
-
const candidate = consumed === 0 ? line : `${text}
|
|
618
|
-
${line}`;
|
|
619
|
-
if (candidate.length > cap) {
|
|
620
|
-
if (consumed === 0 && cap > 0) {
|
|
621
|
-
return { text: line.slice(0, cap), consumed: 1 };
|
|
622
|
-
}
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
text = candidate;
|
|
626
|
-
consumed += 1;
|
|
627
|
-
}
|
|
628
|
-
return { text, consumed };
|
|
629
|
-
}
|
|
630
|
-
function takeTailLines(lines, cap) {
|
|
631
|
-
if (cap <= 0 || lines.length === 0) return { text: "", consumed: 0 };
|
|
632
|
-
let text = "";
|
|
633
|
-
let consumed = 0;
|
|
634
|
-
for (let i = lines.length - 1; i >= 0; i -= 1) {
|
|
635
|
-
const candidate = consumed === 0 ? lines[i] : `${lines[i]}
|
|
636
|
-
${text}`;
|
|
637
|
-
if (candidate.length > cap) {
|
|
638
|
-
if (consumed === 0) return { text: lines[i].slice(-cap), consumed: 1 };
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
text = candidate;
|
|
642
|
-
consumed += 1;
|
|
643
|
-
}
|
|
644
|
-
return { text, consumed };
|
|
645
|
-
}
|
|
646
|
-
function shrinkToFit(head, evidence, tail, makeMarker, maxChars) {
|
|
647
|
-
const joinBody = () => head.concat(evidence, tail).join("\n");
|
|
648
|
-
let marker = makeMarker(joinBody().length);
|
|
649
|
-
while (joinBody().length + marker.length > maxChars) {
|
|
650
|
-
if (evidence.length > 0) evidence.pop();
|
|
651
|
-
else if (tail.length > 0) tail.pop();
|
|
652
|
-
else if (head.length > 0) head.pop();
|
|
653
|
-
else break;
|
|
654
|
-
marker = makeMarker(joinBody().length);
|
|
655
|
-
}
|
|
656
|
-
const result = joinBody() + marker;
|
|
657
|
-
return result.length > maxChars ? result.slice(0, maxChars) : result;
|
|
658
|
-
}
|
|
659
|
-
function truncateContentForSummary(role, content, maxChars = TOOL_RESULT_TRUNCATE_CHARS) {
|
|
660
|
-
if (role !== "tool" || content.length <= maxChars) return content;
|
|
661
|
-
const lines = content.split("\n");
|
|
662
|
-
const budget = evidenceTruncateBudget(maxChars);
|
|
663
|
-
const head = takeHeadLines(lines, budget.headCap);
|
|
664
|
-
const tail = takeTailLines(
|
|
665
|
-
lines.slice(0, lines.length - head.consumed),
|
|
666
|
-
budget.tailCap
|
|
667
|
-
);
|
|
668
|
-
const middle = lines.slice(head.consumed, lines.length - tail.consumed);
|
|
669
|
-
const evidence = selectEvidenceLines(middle);
|
|
670
|
-
if (evidence.length === 0) {
|
|
671
|
-
return `${content.slice(0, maxChars)}
|
|
672
|
-
|
|
673
|
-
[... ${content.length - maxChars} chars truncated ...]`;
|
|
674
|
-
}
|
|
675
|
-
const headLines = head.text ? head.text.split("\n") : [];
|
|
676
|
-
const tailLines = tail.text ? tail.text.split("\n") : [];
|
|
677
|
-
const evidenceLines = [];
|
|
678
|
-
let evidenceUsed = 0;
|
|
679
|
-
for (const line of evidence) {
|
|
680
|
-
if (evidenceUsed + line.length > budget.evidenceCap) break;
|
|
681
|
-
evidenceLines.push(line);
|
|
682
|
-
evidenceUsed += line.length;
|
|
683
|
-
}
|
|
684
|
-
const marker = (bodyChars) => {
|
|
685
|
-
const note = evidenceLines.length > 0 ? `
|
|
686
|
-
[... \u5DF2\u4FDD\u7559 ${evidenceLines.length} \u6761\u8BC1\u636E\u884C ...]` : "";
|
|
687
|
-
return `
|
|
688
|
-
|
|
689
|
-
[... ${content.length - bodyChars} chars truncated ...]${note}`;
|
|
690
|
-
};
|
|
691
|
-
return shrinkToFit(headLines, evidenceLines, tailLines, marker, maxChars);
|
|
692
|
-
}
|
|
693
|
-
function formatMessagesForSummaryWithTruncation(msgs, maxToolResultChars = TOOL_RESULT_TRUNCATE_CHARS, maxTotalTokens) {
|
|
694
|
-
const items = msgs.map((msg) => {
|
|
695
|
-
const rawContent = serializeMessageContent(msg.content) || "";
|
|
696
|
-
const truncated = truncateContentForSummary(
|
|
697
|
-
msg.role,
|
|
698
|
-
rawContent,
|
|
699
|
-
maxToolResultChars
|
|
700
|
-
);
|
|
701
|
-
const text = truncated || formatMessageContentFallback(msg);
|
|
702
|
-
return `${msg.role}: ${text}`;
|
|
703
|
-
});
|
|
704
|
-
if (typeof maxTotalTokens === "number" && Number.isFinite(maxTotalTokens) && maxTotalTokens > 0) {
|
|
705
|
-
return capSummaryInputToTokenBudget(items, maxTotalTokens);
|
|
706
|
-
}
|
|
707
|
-
return items.join("\n");
|
|
708
|
-
}
|
|
709
|
-
function buildCompactionMetrics(args) {
|
|
710
|
-
const {
|
|
711
|
-
reason,
|
|
712
|
-
previousSummary,
|
|
713
|
-
msgsToCompress,
|
|
714
|
-
msgsToKeep,
|
|
715
|
-
newSummary,
|
|
716
|
-
summaryUsage,
|
|
717
|
-
estimateTokens,
|
|
718
|
-
estimateMessageTokens
|
|
719
|
-
} = args;
|
|
720
|
-
return {
|
|
721
|
-
reason,
|
|
722
|
-
previousSummaryTokens: estimateTokens(previousSummary || ""),
|
|
723
|
-
compressedTokens: msgsToCompress.reduce((s, m) => s + estimateMessageTokens(m), 0),
|
|
724
|
-
retainedTokens: msgsToKeep.reduce((s, m) => s + estimateMessageTokens(m), 0),
|
|
725
|
-
newSummaryTokens: estimateTokens(newSummary || ""),
|
|
726
|
-
compressedCount: msgsToCompress.length,
|
|
727
|
-
retainedCount: msgsToKeep.length,
|
|
728
|
-
summaryUsage,
|
|
729
|
-
hadPreviousSummary: previousSummary.trim().length > 0
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
function buildCompactionMetricsFromPlan(args) {
|
|
733
|
-
return buildCompactionMetrics({
|
|
734
|
-
reason: args.reason,
|
|
735
|
-
previousSummary: args.previousSummary,
|
|
736
|
-
msgsToCompress: args.plan.msgsToCompress,
|
|
737
|
-
msgsToKeep: args.plan.msgsToKeep,
|
|
738
|
-
newSummary: args.newSummary,
|
|
739
|
-
summaryUsage: args.summaryUsage,
|
|
740
|
-
estimateTokens: estimateTokenCount,
|
|
741
|
-
estimateMessageTokens: getMessageTokenCount
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
function formatCompactionMetricsLog(metrics) {
|
|
745
|
-
const totalBefore = metrics.previousSummaryTokens + metrics.compressedTokens;
|
|
746
|
-
const totalAfter = metrics.newSummaryTokens + metrics.retainedTokens;
|
|
747
|
-
const ratio = totalBefore > 0 ? (totalAfter / totalBefore).toFixed(2) : "N/A";
|
|
748
|
-
const llmInfo = metrics.summaryUsage ? `, summary_llm_in=${metrics.summaryUsage.input_tokens ?? "?"} out=${metrics.summaryUsage.output_tokens ?? "?"}` : "";
|
|
749
|
-
return `[Compaction] reason=${metrics.reason} compressed=${metrics.compressedCount}->${metrics.retainedCount} msgs, tokens=${totalBefore}->${totalAfter} (ratio=${ratio})${llmInfo}`;
|
|
750
|
-
}
|
|
751
|
-
function computeSummarySourceMetadata(messagesWithIds, summarizedBeforeId) {
|
|
752
|
-
if (!summarizedBeforeId) return void 0;
|
|
753
|
-
const found = messagesWithIds.findIndex((m) => m.id === summarizedBeforeId);
|
|
754
|
-
if (found === -1) return void 0;
|
|
755
|
-
const slice = messagesWithIds.slice(0, found + 1).map((m, index) => ({
|
|
756
|
-
id: `local-${index}`,
|
|
757
|
-
role: m.role,
|
|
758
|
-
content: m.content ?? "",
|
|
759
|
-
...Array.isArray(m.tool_calls) ? { tool_calls: m.tool_calls } : {}
|
|
760
|
-
}));
|
|
761
|
-
const sourceHash = sha256Hex(JSON.stringify(slice));
|
|
762
|
-
return {
|
|
763
|
-
sourceHash,
|
|
764
|
-
sourceCount: found + 1,
|
|
765
|
-
schemaVersion: COMPACTION_SUMMARY_SCHEMA_VERSION
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// packages/ai/llm/getModelContextWindow.ts
|
|
770
|
-
var DEFAULT_CONTEXT_WINDOW = 256e3;
|
|
771
|
-
var QWEN_3_6_CONTEXT_WINDOW = 262144;
|
|
772
|
-
var GLM_5_2_CONTEXT_WINDOW = 1e6;
|
|
773
|
-
var GPT_6_1_SOL_CONTEXT_WINDOW = 5e5;
|
|
774
|
-
var GPT_6_1_SOL_PATTERN = /(^|\/)gpt-6\.1[- ]sol(?![a-z])/;
|
|
775
|
-
var GPT_6_1_PINNED_PATTERN = /(^|\/)gpt-6\.1[- ](sol|terra)(?![a-z0-9])/;
|
|
776
|
-
var GPT_272K_PINNED_PATTERN = /(^|\/)(gpt-6[- ](astra|luna|sol)|gpt-5\.6[- ](sol|terra|luna))(?![a-z0-9])/;
|
|
777
|
-
var GPT_272K_CONTEXT_WINDOW = 272e3;
|
|
778
|
-
function channelPinnedContextWindow(normalizedName) {
|
|
779
|
-
if (GPT_6_1_PINNED_PATTERN.test(normalizedName)) return GPT_6_1_SOL_CONTEXT_WINDOW;
|
|
780
|
-
if (GPT_272K_PINNED_PATTERN.test(normalizedName)) return GPT_272K_CONTEXT_WINDOW;
|
|
781
|
-
return void 0;
|
|
782
|
-
}
|
|
783
|
-
var ANTIGRAVITY_EFFORT_SUFFIXES = [
|
|
784
|
-
"-tiered",
|
|
785
|
-
"-extra-low",
|
|
786
|
-
"-low",
|
|
787
|
-
"-medium",
|
|
788
|
-
"-high"
|
|
789
|
-
];
|
|
790
|
-
function stripEffortSuffix(model) {
|
|
791
|
-
for (const suffix of ANTIGRAVITY_EFFORT_SUFFIXES) {
|
|
792
|
-
if (model.endsWith(suffix) && model.length > suffix.length) {
|
|
793
|
-
return model.slice(0, -suffix.length);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
return model;
|
|
797
|
-
}
|
|
798
|
-
function stripPreviewSuffix(model) {
|
|
799
|
-
const suffix = "-preview";
|
|
800
|
-
if (model.endsWith(suffix) && model.length > suffix.length) {
|
|
801
|
-
return model.slice(0, -suffix.length);
|
|
802
|
-
}
|
|
803
|
-
return model;
|
|
804
|
-
}
|
|
805
|
-
function stripModelTag(model) {
|
|
806
|
-
const colonIndex = model.indexOf(":");
|
|
807
|
-
if (colonIndex > 0) {
|
|
808
|
-
return model.slice(0, colonIndex);
|
|
809
|
-
}
|
|
810
|
-
return model;
|
|
811
|
-
}
|
|
812
|
-
var fullModelMap = null;
|
|
813
|
-
var getFullModelMap = () => {
|
|
814
|
-
if (!fullModelMap) {
|
|
815
|
-
fullModelMap = /* @__PURE__ */ new Map();
|
|
816
|
-
for (const [provider, models] of Object.entries(MODEL_LOOKUP_MAP)) {
|
|
817
|
-
for (const model of models) {
|
|
818
|
-
const entry = { ...model, provider };
|
|
819
|
-
fullModelMap.set(model.name, entry);
|
|
820
|
-
if (model.displayName) {
|
|
821
|
-
fullModelMap.set(model.displayName.toLowerCase(), entry);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
return fullModelMap;
|
|
827
|
-
};
|
|
828
|
-
var legacyModelMap = null;
|
|
829
|
-
var getLegacyModelMap = () => {
|
|
830
|
-
if (!legacyModelMap) {
|
|
831
|
-
legacyModelMap = /* @__PURE__ */ new Map();
|
|
832
|
-
for (const model of ALL_MODELS) {
|
|
833
|
-
legacyModelMap.set(model.name, model);
|
|
834
|
-
if (model.displayName) {
|
|
835
|
-
legacyModelMap.set(model.displayName.toLowerCase(), model);
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
return legacyModelMap;
|
|
840
|
-
};
|
|
841
|
-
function fuzzyContextWindow(normalizedName) {
|
|
842
|
-
const bareModelName = (normalizedName.includes("/") ? normalizedName.slice(normalizedName.lastIndexOf("/") + 1) : normalizedName).replace(/:.*$/, "");
|
|
843
|
-
if (normalizedName.includes("qwen-long") || normalizedName.includes("qwen3-long")) return 10485760;
|
|
844
|
-
if (normalizedName.includes("qwen-coder") || normalizedName.includes("qwen3-coder")) return 1048576;
|
|
845
|
-
if (normalizedName.includes("qwen3.8") || normalizedName.includes("qwen3p8")) return 1e6;
|
|
846
|
-
if (normalizedName.includes("minimax-m3") || normalizedName.includes("minimax_m3")) return 1e6;
|
|
847
|
-
if (bareModelName === "mimo-v2.6-pro" || normalizedName === "mimo v2.6 pro") return 1048576;
|
|
848
|
-
if (normalizedName.includes("glm-5.3") || normalizedName.includes("glm5.3")) return 105e4;
|
|
849
|
-
if (normalizedName.includes("glm-5.2") || normalizedName.includes("glm5.2")) return GLM_5_2_CONTEXT_WINDOW;
|
|
850
|
-
if (normalizedName.includes("deepseek")) return 1e6;
|
|
851
|
-
if (GPT_6_1_SOL_PATTERN.test(normalizedName)) return GPT_6_1_SOL_CONTEXT_WINDOW;
|
|
852
|
-
const channelPinned = channelPinnedContextWindow(normalizedName);
|
|
853
|
-
if (channelPinned !== void 0) return channelPinned;
|
|
854
|
-
if (normalizedName.includes("gpt-5") || normalizedName.includes("gpt-4.1")) return 1047576;
|
|
855
|
-
if (normalizedName.startsWith("cursor-grok-4.5")) return 1e6;
|
|
856
|
-
if (normalizedName.includes("claude-4.6")) return 1e6;
|
|
857
|
-
if (normalizedName.includes("gemini-3.1")) return 1e6;
|
|
858
|
-
if (normalizedName.includes("gemini")) return 1048576;
|
|
859
|
-
if (normalizedName.includes("qwen3.6") || normalizedName.includes("qwen3p6")) return QWEN_3_6_CONTEXT_WINDOW;
|
|
860
|
-
if (normalizedName.includes("qwen3.7") || normalizedName.includes("qwen3p7")) return 262144;
|
|
861
|
-
if (normalizedName.includes("minimax-m2") || normalizedName.includes("minimax_m2")) return 262144;
|
|
862
|
-
if (normalizedName.includes("mistral-large-4")) {
|
|
863
|
-
const rest = normalizedName.slice(
|
|
864
|
-
normalizedName.indexOf("mistral-large-4") + "mistral-large-4".length
|
|
865
|
-
);
|
|
866
|
-
if (rest === "" || /^[-:_@/\s]/.test(rest)) return 524288;
|
|
867
|
-
}
|
|
868
|
-
if (normalizedName.includes("mistral-vibe-cli") || normalizedName.includes("mistral-medium-3.5") || normalizedName.includes("mistral-medium-3-5") || normalizedName.includes("mistral-medium-latest") || normalizedName.includes("mistral-medium-2604") || normalizedName.includes("mistral-large-latest") || normalizedName.includes("mistral-large-2512") || normalizedName.includes("mistral-small-latest") || normalizedName.includes("mistral-small-2603") || normalizedName.includes("magistral-medium-latest") || normalizedName.includes("magistral-small-latest") || // 展示名(TUI 传 displayName 的路径;Mistral 不在 MODEL_LOOKUP_MAP,无法走精确表):
|
|
869
|
-
normalizedName.includes("mistral vibe cli") || normalizedName.includes("mistral medium 3.5") || normalizedName.includes("mistral large (latest)")) {
|
|
870
|
-
return 262144;
|
|
871
|
-
}
|
|
872
|
-
if (bareModelName === "mistral-medium" || bareModelName === "mistral-medium-3") return 262144;
|
|
873
|
-
if (normalizedName.includes("mistral-embed") || normalizedName.includes("codestral-embed")) return 8192;
|
|
874
|
-
if (normalizedName.includes("mistral-ocr")) return 16384;
|
|
875
|
-
if (normalizedName.includes("mistral-moderation")) return 131072;
|
|
876
|
-
if (normalizedName.includes("codestral") || normalizedName.includes("mistral-code")) return 256e3;
|
|
877
|
-
if (normalizedName.includes("claude")) return 2e5;
|
|
878
|
-
if (normalizedName.includes("llama3.1") || normalizedName.includes("llama-3.1") || normalizedName.includes("llama3.2") || normalizedName.includes("llama-3.2") || normalizedName.includes("llama3.3") || normalizedName.includes("llama-3.3") || normalizedName.includes("qwen2.5") || normalizedName.includes("qwen-2.5") || normalizedName.includes("mistral-nemo") || normalizedName.includes("phi3.5") || normalizedName.includes("phi-3.5") || normalizedName.includes("phi4") || normalizedName.includes("phi-4")) {
|
|
879
|
-
return 131072;
|
|
880
|
-
}
|
|
881
|
-
if (normalizedName.includes("qwen2") || normalizedName.includes("qwen-2") || normalizedName.includes("mistral") || normalizedName.includes("mixtral")) {
|
|
882
|
-
return 32768;
|
|
883
|
-
}
|
|
884
|
-
if (normalizedName.includes("codellama") || normalizedName.includes("starcoder") || normalizedName.includes("phi3") || normalizedName.includes("phi-3")) {
|
|
885
|
-
return 16384;
|
|
886
|
-
}
|
|
887
|
-
if (normalizedName.includes("llama3") || normalizedName.includes("llama-3") || normalizedName.includes("gemma2") || normalizedName.includes("gemma-2") || normalizedName.includes("gemma")) {
|
|
888
|
-
return 8192;
|
|
889
|
-
}
|
|
890
|
-
if (normalizedName.includes("llama2") || normalizedName.includes("llama-2") || normalizedName.includes("llama")) {
|
|
891
|
-
return 4096;
|
|
892
|
-
}
|
|
893
|
-
return void 0;
|
|
894
|
-
}
|
|
895
|
-
var findModelContextWindow = (modelName, provider) => {
|
|
896
|
-
if (!modelName) return void 0;
|
|
897
|
-
const onPlatformChannel = isPlatformManagedProvider(provider, modelName);
|
|
898
|
-
const normalizedName = modelName.toLowerCase();
|
|
899
|
-
const map = getFullModelMap();
|
|
900
|
-
const rawCandidates = [modelName, normalizedName];
|
|
901
|
-
const strippedTag = stripModelTag(modelName);
|
|
902
|
-
if (strippedTag !== modelName) {
|
|
903
|
-
rawCandidates.push(strippedTag, strippedTag.toLowerCase());
|
|
904
|
-
}
|
|
905
|
-
const candidates = [];
|
|
906
|
-
for (const base of rawCandidates) {
|
|
907
|
-
candidates.push(base);
|
|
908
|
-
const strippedEffort = stripEffortSuffix(base);
|
|
909
|
-
if (strippedEffort !== base) {
|
|
910
|
-
candidates.push(strippedEffort, strippedEffort.toLowerCase());
|
|
911
|
-
}
|
|
912
|
-
const strippedPreview = stripPreviewSuffix(base);
|
|
913
|
-
if (strippedPreview !== base) {
|
|
914
|
-
candidates.push(strippedPreview, strippedPreview.toLowerCase());
|
|
915
|
-
}
|
|
916
|
-
if (strippedEffort !== base) {
|
|
917
|
-
const strippedBoth = stripPreviewSuffix(strippedEffort);
|
|
918
|
-
if (strippedBoth !== strippedEffort) {
|
|
919
|
-
candidates.push(strippedBoth, strippedBoth.toLowerCase());
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
for (const candidate of candidates) {
|
|
924
|
-
const model = map.get(candidate);
|
|
925
|
-
if (model?.contextWindow) {
|
|
926
|
-
if (!onPlatformChannel && (channelPinnedContextWindow(model.name.toLowerCase()) !== void 0 || channelPinnedContextWindow(candidate.toLowerCase()) !== void 0)) {
|
|
927
|
-
continue;
|
|
928
|
-
}
|
|
929
|
-
return typeof model.contextWindow === "number" ? model.contextWindow : void 0;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
if (onPlatformChannel) {
|
|
933
|
-
const effective = resolvePlatformEffectiveModel(normalizedName);
|
|
934
|
-
if (effective && effective !== normalizedName) {
|
|
935
|
-
const aliased = map.get(effective);
|
|
936
|
-
if (aliased?.contextWindow) {
|
|
937
|
-
return typeof aliased.contextWindow === "number" ? aliased.contextWindow : void 0;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
if (!onPlatformChannel) {
|
|
942
|
-
for (const candidate of candidates) {
|
|
943
|
-
const pinned = channelPinnedContextWindow(candidate.toLowerCase());
|
|
944
|
-
if (pinned !== void 0) return pinned;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
return fuzzyContextWindow(normalizedName);
|
|
948
|
-
};
|
|
949
|
-
var getModelContextWindow = (modelName, provider) => findModelContextWindow(modelName, provider) ?? DEFAULT_CONTEXT_WINDOW;
|
|
950
|
-
var getModelInfo = (modelName) => {
|
|
951
|
-
if (!modelName) return null;
|
|
952
|
-
const map = getLegacyModelMap();
|
|
953
|
-
return map.get(modelName) || map.get(modelName.toLowerCase()) || null;
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
export {
|
|
957
|
-
planContextUsage,
|
|
958
|
-
DEFAULT_CONTEXT_WINDOW,
|
|
959
|
-
findModelContextWindow,
|
|
960
|
-
getModelContextWindow,
|
|
961
|
-
getModelInfo,
|
|
962
|
-
sha256Hex,
|
|
963
|
-
serializeMessageContent,
|
|
964
|
-
resolveCompressionTriggerRatio,
|
|
965
|
-
truncateToolOutputForContext,
|
|
966
|
-
planCompression,
|
|
967
|
-
COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
968
|
-
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
969
|
-
buildCompactionUserContent,
|
|
970
|
-
formatFileOperationsFromMessages,
|
|
971
|
-
TOOL_RESULT_TRUNCATE_CHARS,
|
|
972
|
-
computeSummaryInputTokenCap,
|
|
973
|
-
formatMessagesForSummaryWithTruncation,
|
|
974
|
-
buildCompactionMetricsFromPlan,
|
|
975
|
-
formatCompactionMetricsLog,
|
|
976
|
-
computeSummarySourceMetadata
|
|
977
|
-
};
|