nolo-cli 0.225.0-alpha.1 → 0.225.0
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/{_executeModel-L5VHAXSU.js → _executeModel-UCWDB72C.js} +79 -73
- package/{action-CK64LS6S.js → action-24MZYW2B.js} +11 -8
- package/{addContentAction-EQXMFNPR.js → addContentAction-HEMCSSHT.js} +14 -13
- package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-SQYDOXHA.js} +15 -14
- package/{agentDeleteCommand-4WC7INCX.js → agentDeleteCommand-P7O3ACNJ.js} +131 -124
- package/{agentEmailCommands-3XFR6WY7.js → agentEmailCommands-A5BRSYWK.js} +134 -123
- package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-7LOP3HUD.js} +5 -5
- package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-L6O2HVJI.js} +5 -5
- package/{agentListCommands-BBCP5XYW.js → agentListCommands-LDRCOOMO.js} +112 -496
- package/{agentMachineCommands-YZDCOLQL.js → agentMachineCommands-AYL53KJV.js} +65 -58
- package/{agentProviderCommands-7BSJH7TO.js → agentProviderCommands-N5EA3ED2.js} +6 -6
- package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-QQQZSC6S.js} +6 -6
- package/agentRecordCommands-FICBZ57C.js +188 -0
- package/{agentRunCommand-NHYBV4G5.js → agentRunCommand-CTXQGDUM.js} +135 -120
- package/{agentRunControl-7A2FOXIJ.js → agentRunControl-CO6BASZF.js} +20 -14
- package/{agentRuntimeLocal-GSTYFEX4.js → agentRuntimeLocal-5YN4D5WT.js} +48 -41
- package/{agentSlice-O6IGTM3Y.js → agentSlice-DJ5D4DU4.js} +18 -17
- package/{appDeleteCommands-L7HL4AWF.js → appDeleteCommands-B4E7N7M2.js} +58 -51
- package/{appDeployCommands-SGSUNFZR.js → appDeployCommands-E4DTXRRM.js} +58 -51
- package/{appDeployStatusCommands-AAA3XD54.js → appDeployStatusCommands-FCNHYHZM.js} +58 -51
- package/{appGetCommands-LN72GAOA.js → appGetCommands-4DXSQHUZ.js} +58 -51
- package/{appListCommands-IJQQ3VND.js → appListCommands-2NN5E4F6.js} +58 -51
- package/{authCommand-7JXW54U4.js → authCommand-47DR6GZT.js} +33 -28
- package/{authCommands-YDNAIDEY.js → authCommands-ZZ3L5IFM.js} +16 -11
- package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-AYWYQVA4.js} +5 -5
- package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-VZWAY2KR.js} +6 -6
- package/{chunk-YDBMZ7FV.js → chunk-24GVXSWK.js} +3 -3
- package/{chunk-JCK3EFZS.js → chunk-25OCZXSX.js} +63 -32
- package/{chunk-P2ZLUIW2.js → chunk-2BSLGODA.js} +350 -25
- package/chunk-2SXN7LAY.js +15 -0
- package/{chunk-N5PQJKCY.js → chunk-2XMKW2OY.js} +13 -12
- package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
- package/{chunk-UKS7D2NL.js → chunk-3NFWMSTA.js} +111 -26
- package/{chunk-TZEP5J4A.js → chunk-3V6JT6WN.js} +2935 -1412
- package/{chunk-SBVTHMEG.js → chunk-4FE3IWRE.js} +1 -1
- package/{chunk-4JVNURX4.js → chunk-4YFC3DWW.js} +68 -16
- package/chunk-4ZCTKB27.js +31 -0
- package/chunk-53W5BXLN.js +340 -0
- package/{chunk-JWXITTQB.js → chunk-5HUO7SEX.js} +9 -107
- package/{chunk-VFBVA3U2.js → chunk-5TJE4QCL.js} +131 -40
- package/{chunk-YXMBJ7UH.js → chunk-6BGJHJRN.js} +21 -21
- package/chunk-6D25V6CB.js +133 -0
- package/chunk-6RSNVJGO.js +279 -0
- package/{chunk-IZIN2UNJ.js → chunk-6X3CS6NJ.js} +203 -24
- package/{chunk-XZGQ6ZCV.js → chunk-6XBOPKUH.js} +27 -90
- package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
- package/{chunk-62HXNQVV.js → chunk-776CXKMX.js} +1 -1
- package/chunk-7NIBQ4HY.js +138 -0
- package/{chunk-7Z6EW7AH.js → chunk-7OTNBI77.js} +13 -6
- package/{chunk-HOK3ILHA.js → chunk-7Q7MKJZN.js} +590 -330
- package/{chunk-KZU52OJ5.js → chunk-7U2TFUWW.js} +6 -6
- package/{chunk-IUD7YR3B.js → chunk-B72AFRR2.js} +15 -15
- package/{chunk-4HFTBHBF.js → chunk-BDERPCJW.js} +8 -8
- package/chunk-BEM6LPD2.js +734 -0
- package/chunk-BIDSIRTS.js +307 -0
- package/{chunk-6J4TTPS2.js → chunk-BIJTI5SX.js} +5 -5
- package/chunk-BWW6WRX6.js +1438 -0
- package/{chunk-AGP3YSEC.js → chunk-C3GOEQJF.js} +46 -1
- package/chunk-C5A54QS7.js +108 -0
- package/{chunk-MOMR7NMG.js → chunk-C646JEUV.js} +2 -2
- package/{chunk-YI5CDUJD.js → chunk-CT6GT2BG.js} +9 -9
- package/{chunk-PVZY6P3S.js → chunk-CZLSTOVM.js} +2 -2
- package/{chunk-LJSNEV7M.js → chunk-DGUUOHBF.js} +8 -8
- package/{chunk-C4WTX5TU.js → chunk-DIBQXNGW.js} +2 -2
- package/{chunk-YFLVRVYK.js → chunk-DLT2DN4M.js} +1 -1
- package/{chunk-K44HIUBX.js → chunk-DLTMAXLF.js} +13 -13
- package/chunk-DVYAFH2Q.js +103 -0
- package/{chunk-SOG7OEXX.js → chunk-DWWUVRB5.js} +1 -1
- package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
- package/{chunk-GNHMRBYZ.js → chunk-EBKHA63G.js} +106 -14
- package/{chunk-KC4SCKXO.js → chunk-EIFSCI4C.js} +990 -1370
- package/{chunk-F3YK7KIU.js → chunk-EW37CXCQ.js} +4 -4
- package/{chunk-M3JEW6N6.js → chunk-F26GAEH3.js} +10 -0
- package/{chunk-2VUZSVAS.js → chunk-F3FQPVHE.js} +57 -20
- package/{chunk-ZRAARRA3.js → chunk-FCAMGBLY.js} +1399 -2978
- package/{chunk-AK5O76CC.js → chunk-FPMPWNVQ.js} +3 -3
- package/{chunk-WQEMD4Z4.js → chunk-FSIEHQNH.js} +420 -120
- package/{chunk-FNDSBM4J.js → chunk-FXX6VFMV.js} +571 -348
- package/{chunk-7XS4W5KP.js → chunk-G6OPRPXH.js} +128 -149
- package/{chunk-PMDVQBGA.js → chunk-GAHJLSDO.js} +14 -7
- package/{chunk-2TIQO6TC.js → chunk-GCVFX6ZL.js} +206 -308
- package/{chunk-P25E3CKY.js → chunk-H6CHPU6M.js} +4 -4
- package/chunk-HNWZJI4N.js +33394 -0
- package/{chunk-S2NTVGA2.js → chunk-I2OYPD3Y.js} +1 -1
- package/{chunk-KNIIRXHF.js → chunk-IPRPYKBP.js} +46 -8
- package/{chunk-C4VAR65S.js → chunk-IUXBKS5L.js} +200 -120
- package/{chunk-JVRQ6YVK.js → chunk-JBWXPACD.js} +1 -1
- package/{chunk-Z6USB65D.js → chunk-KGIIZXPL.js} +347 -14
- package/chunk-KK3FCYZM.js +647 -0
- package/{chunk-GBZ4YKEO.js → chunk-KOIDLCAQ.js} +8 -8
- package/{chunk-2ZKFCIJJ.js → chunk-LCQJH7KN.js} +1 -1
- package/{chunk-N5Z2V73W.js → chunk-LELADM5Q.js} +1 -1
- package/{chunk-4NA3YTBC.js → chunk-LMFMV5UC.js} +8 -8
- package/{chunk-XN23AUVU.js → chunk-LMZRXDWG.js} +8 -5
- package/{chunk-EWPDMS4N.js → chunk-LN4ZVSO7.js} +30 -15
- package/{chunk-GOAPXKQU.js → chunk-LT3DMEIB.js} +4 -4
- package/{chunk-GGKNJ42M.js → chunk-LYDEFPQP.js} +18 -108
- package/{chunk-FTQWYWUI.js → chunk-MDVP5TLI.js} +1 -1
- package/{chunk-EOWLBDY6.js → chunk-MM73SP4K.js} +1 -1
- package/chunk-MVOZ22RZ.js +26 -0
- package/{chunk-3QFLXA24.js → chunk-N6EN3HK3.js} +3 -3
- package/{chunk-D726I5AZ.js → chunk-NBB2EBQD.js} +2 -2
- package/{chunk-DISQCYPE.js → chunk-NL7J2J5Z.js} +6 -6
- package/{chunk-JM5C4EUA.js → chunk-NQQL2DKF.js} +6 -6
- package/{chunk-LS2MGTUS.js → chunk-NWWQY2J5.js} +15 -15
- package/{chunk-TXGQ4O5S.js → chunk-OATIWAKN.js} +20 -174
- package/{chunk-KYH7XW3K.js → chunk-OJRTTERA.js} +77 -2
- package/{chunk-VV7TXWOC.js → chunk-OYHJ4TW7.js} +6 -6
- package/{chunk-EUCFKKDM.js → chunk-PVFYPUIM.js} +40 -10
- package/{chunk-2VA6TU4I.js → chunk-QES2NCVM.js} +17 -14
- package/{chunk-WG2LFJYB.js → chunk-QGMIUVBT.js} +39 -30
- package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
- package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
- package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
- package/{chunk-AMEOV5VZ.js → chunk-S25VJYXV.js} +41 -35
- package/chunk-SR4FE5VD.js +9 -0
- package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
- package/{chunk-GVGOEMNV.js → chunk-T444ENEC.js} +3 -3
- package/{chunk-67BE44IS.js → chunk-TE2XH4KH.js} +1 -1
- package/{chunk-5RKUPJYL.js → chunk-TFGGNRT6.js} +11 -3
- package/{chunk-ZH6MUQEO.js → chunk-TTEBPPUV.js} +1 -1
- package/{chunk-QVBXJNZ2.js → chunk-TUSTONB3.js} +1 -1
- package/{chunk-AVHRSJUH.js → chunk-TXFYIWAW.js} +32 -25
- package/{chunk-KOXKKHFE.js → chunk-TXQVH72L.js} +9 -4
- package/{chunk-OBSEKCVK.js → chunk-U4VSBDO5.js} +88 -0
- package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
- package/{chunk-KDAGMRDA.js → chunk-UAHUJ4HH.js} +100 -32
- package/{chunk-BGGHA5DV.js → chunk-UAOFSUG7.js} +1 -1
- package/{chunk-CKT6QUE2.js → chunk-UHW6SCVK.js} +1 -1
- package/chunk-UKSKCDBG.js +62 -0
- package/{chunk-KEN3N2TN.js → chunk-VMJVAJ6W.js} +13 -10
- package/{chunk-SOF4OWDM.js → chunk-VS276URX.js} +0 -2
- package/chunk-WDWZPASX.js +29 -0
- package/chunk-WFGNWWJI.js +326 -0
- package/{chunk-UYOICCYG.js → chunk-WHO3LYDW.js} +64 -89
- package/{chunk-UJKTI5PG.js → chunk-WRKMXMU7.js} +2 -1
- package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
- package/{chunk-QLFCTYRH.js → chunk-X37RQEA3.js} +17 -10
- package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
- package/chunk-X7IA2B7R.js +166 -0
- package/{chunk-GIABSSWQ.js → chunk-XAFOLWLU.js} +4 -4
- package/{chunk-45LZIYXB.js → chunk-XNEDFWT4.js} +2 -2
- package/{chunk-EOJZGQAE.js → chunk-Y5RN44VH.js} +103 -100
- package/{chunk-OB6DVWPF.js → chunk-YFRJAE3R.js} +319 -95
- package/{chunk-L5I543VB.js → chunk-YGDYYFRX.js} +20 -24
- package/{chunk-3KNEE64G.js → chunk-YMCSR7PA.js} +14 -14
- package/chunk-YUZ2DAIH.js +34 -0
- package/chunk-Z6YTCDU4.js +24 -0
- package/{chunk-XQBIZRGW.js → chunk-ZBQ5UGYY.js} +3 -3
- package/{chunk-VREDDN25.js → chunk-ZQUCJBS4.js} +14 -9
- package/{chunk-UEKXWO7A.js → chunk-ZT3DYK5T.js} +15 -4
- package/{chunk-LM2PS3YS.js → chunk-ZTLTDUV6.js} +24 -11
- package/{chunk-KN3HEZIQ.js → chunk-ZVOL2MAJ.js} +1 -1
- package/{cliAgentConfigHelpers-KICKKNYQ.js → cliAgentConfigHelpers-RFR7ZCSK.js} +12 -12
- package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
- package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-CNMP3RDX.js} +1 -1
- package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
- package/{cliLocalAgentRecordReader-6FXGFBI3.js → cliLocalAgentRecordReader-AJ4UKHKT.js} +51 -45
- package/{commandRegistry-HJDPQSQ4.js → commandRegistry-IHWZVV4G.js} +98 -94
- package/{contentThunks-I6OR5ENG.js → contentThunks-YQRCBDKF.js} +38 -35
- package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-W67DE765.js} +4 -4
- package/{createAgentAutomationAction-7BCCTWO5.js → createAgentAutomationAction-ERSDNR4R.js} +38 -35
- package/{createDialogAction-CU27KSCJ.js → createDialogAction-QXC7JZPE.js} +39 -37
- package/{createPageAction-CWRTEYVA.js → createPageAction-RLZ7776F.js} +40 -37
- package/{db-CS4ZJQKV.js → db-6NRZLEW2.js} +10 -7
- package/{dbSlice-ZJPDIFER.js → dbSlice-7M2ESEUO.js} +13 -12
- package/{deleteFile-Q3YDB4ML.js → deleteFile-WO6WSSNK.js} +10 -7
- package/{dialogCommands-OPTRZWTE.js → dialogCommands-UIRO4QNN.js} +62 -56
- package/dialogMessageRecord-OAV77LT7.js +7 -0
- package/{dialogNotifyCommand-77B57PL6.js → dialogNotifyCommand-VDUFYBZV.js} +14 -14
- package/{dialogSlice-XODSLDHY.js → dialogSlice-A4U3C76D.js} +36 -33
- package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-SEC6UZWM.js} +3 -3
- package/{docCreateCommands-36WS33BK.js → docCreateCommands-MHPYTJWR.js} +56 -49
- package/{docDeleteCommands-C4CS4XLF.js → docDeleteCommands-VYULMBAQ.js} +58 -51
- package/{docReadCommands-QZMSFMPN.js → docReadCommands-FV3GGZ7V.js} +56 -49
- package/{docStore-TVN4SNVE.js → docStore-AWWI72FA.js} +15 -14
- package/{docUpdateCommands-BYI64HVV.js → docUpdateCommands-JNS3HX7F.js} +56 -49
- package/fetchMessages-TQEUZD7H.js +2 -2
- package/{getPricing-VNGFM4PN.js → getPricing-U5AR7ZHS.js} +5 -5
- package/{handleSendMessageAction-NSEMVHWX.js → handleSendMessageAction-WDJOUDNV.js} +68 -63
- package/{hostCredentialCreate-WBZY7DZB.js → hostCredentialCreate-H3FF2SAO.js} +123 -111
- package/index.js +56 -18
- package/keys-RWF7UCB4.js +2 -2
- package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
- package/{localDialogRead-SVTPA5GY.js → localDialogRead-3T2KMCRC.js} +1 -1
- package/{localRuntimeAdapter-OAIWERFA.js → localRuntimeAdapter-JAQQXZJP.js} +126 -113
- package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-7DKIT7UH.js} +4 -2
- package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
- package/{machineCommands-OI37ZUQ4.js → machineCommands-WYOFNB5I.js} +146 -120
- package/{machineWsRunDispatch-73HKPV6D.js → machineWsRunDispatch-Y7UIAZNM.js} +118 -107
- package/markdownToSlate-KIYM7B3P.js +8 -0
- package/mcpLocalAuthorizeCommand-SCYEFLRK.js +106 -0
- package/{memberThunks-JRYNONYV.js → memberThunks-DIITWU4M.js} +22 -17
- package/{memoryCommands-5WC3T66U.js → memoryCommands-BC6REPQB.js} +4 -4
- package/{models-H5NNZRLH.js → models-CINY5UZR.js} +2 -2
- package/{overlay-THLKYIWY.js → overlay-JA3SPVUS.js} +7 -3
- package/package.json +1 -1
- package/{projectArchive-GVEARCOG.js → projectArchive-IZJXBW5N.js} +43 -40
- package/{providerPresetApply-J3WMRPD2.js → providerPresetApply-2QWXPJXZ.js} +6 -6
- package/{providerRegistry-KJGB5XWS.js → providerRegistry-W4LCKK6V.js} +6 -6
- package/{read-Q7GOHGNP.js → read-OBLJNMA2.js} +9 -8
- package/{readDocTool-Z5OQ6422.js → readDocTool-QQZ4DAER.js} +1 -1
- package/{readlineWorkspace-5DWUGNSU.js → readlineWorkspace-WF3SWZGR.js} +7055 -5248
- package/rememberExplicit-CPAPONSI.js +15 -0
- package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-HC3SOY3G.js} +17 -16
- package/{runAgentClientLoop-RDXIPF34.js → runAgentClientLoop-Z7V6TA3O.js} +97 -72
- package/{runtimeDoctorCommands-UXKXYBW6.js → runtimeDoctorCommands-KX6YLPWV.js} +17 -17
- package/{secretCommands-LJXOOYA7.js → secretCommands-STRAX275.js} +4 -4
- package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-DDZUQPY6.js} +16 -15
- package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-EB67OMAJ.js} +17 -16
- package/{settingThunks-AXTBX3Q5.js → settingThunks-TN6GFASU.js} +181 -62
- package/{skillDiscovery-B5V23AXP.js → skillDiscovery-MDDKPTW3.js} +4 -3
- package/{spaceCommands-GUKMDRWN.js → spaceCommands-HBYQUVJI.js} +61 -54
- package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
- package/{streamAgentChatTurn-XEYQZPDJ.js → streamAgentChatTurn-CM7QQXOS.js} +178 -173
- package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-XY5TKQQE.js} +15 -14
- package/{tableCommands-HITDSLHS.js → tableCommands-MXFL3JIT.js} +13 -10
- package/{toolApiClient-OGQEBQVX.js → toolApiClient-53YMJ2G6.js} +8 -6
- package/{tools-6DFTHCFX.js → tools-AT6H73LD.js} +66 -62
- package/tuiRestart-272SAYSK.js +41 -0
- package/{tuiSummaryLlmCaller-7WLUKNP2.js → tuiSummaryLlmCaller-K2OVRVHG.js} +20 -19
- package/{updateCommands-RJVCRSBP.js → updateCommands-O3BOVVVN.js} +8 -6
- package/{updateDialogTitleAction-AMSBV2H7.js → updateDialogTitleAction-PGY4UPLH.js} +38 -35
- package/{usageCommand-YPJ2ZI2F.js → usageCommand-SCF3ROV2.js} +4 -4
- package/{usageRebuildCommand-FERQO74C.js → usageRebuildCommand-K5WPIBA5.js} +5 -5
- package/webapi-24RZDIIQ.js +2488 -0
- package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-WJDUZLEO.js} +2 -2
- package/workContext-Y3ADAPZU.js +14 -0
- package/workContextAccess-UZHDLBUR.js +11 -0
- package/workContextWriteNotice-YCSSMHN4.js +7 -0
- package/agentRecordCommands-KLYKI4Z7.js +0 -177
- package/chunk-2THCNKE4.js +0 -147
- package/chunk-2WZXXAQD.js +0 -57
- package/chunk-5ZMIIR23.js +0 -265
- package/chunk-652XYZGP.js +0 -352
- package/chunk-BJF2MHJ3.js +0 -118
- package/chunk-KEPOVMF4.js +0 -91
- package/chunk-QZI44GWV.js +0 -776
- package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
- package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
- package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
- package/{chunk-47ITIXO7.js → chunk-USGHJSGO.js} +3 -3
- package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
- package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +3 -3
- package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_appendEntityBatch,
|
|
3
|
+
_appendEvidenceBatch,
|
|
4
|
+
_appendRelationBatch,
|
|
5
|
+
_appendRetiredStateBatch,
|
|
6
|
+
_appendStateBatch,
|
|
7
|
+
getMemoryEntityVNext,
|
|
8
|
+
getMemoryEvidenceVNext,
|
|
9
|
+
getMemoryEvidenceVNextStrict,
|
|
10
|
+
getMemoryStateVNext,
|
|
11
|
+
listMemoryStatesForEntityVNext
|
|
12
|
+
} from "./chunk-324FWHUA.js";
|
|
13
|
+
|
|
14
|
+
// packages/ai/memory/vnext/applyMutation.ts
|
|
15
|
+
async function validateMutation(db, ownerId, mutation) {
|
|
16
|
+
const pending = {
|
|
17
|
+
evidenceIds: /* @__PURE__ */ new Set(),
|
|
18
|
+
entityIds: /* @__PURE__ */ new Set(),
|
|
19
|
+
stateIds: /* @__PURE__ */ new Set(),
|
|
20
|
+
relationIds: /* @__PURE__ */ new Set()
|
|
21
|
+
};
|
|
22
|
+
for (const ev of mutation.evidence ?? []) {
|
|
23
|
+
if (!ev.id || typeof ev.id !== "string") {
|
|
24
|
+
throw new Error("evidence id must be a non-empty string");
|
|
25
|
+
}
|
|
26
|
+
if (pending.evidenceIds.has(ev.id)) {
|
|
27
|
+
throw new Error(`duplicate evidence id in mutation: ${ev.id}`);
|
|
28
|
+
}
|
|
29
|
+
pending.evidenceIds.add(ev.id);
|
|
30
|
+
}
|
|
31
|
+
for (const ent of mutation.entities ?? []) {
|
|
32
|
+
if (!ent.id || typeof ent.id !== "string") {
|
|
33
|
+
throw new Error("entity id must be a non-empty string");
|
|
34
|
+
}
|
|
35
|
+
if (pending.entityIds.has(ent.id)) {
|
|
36
|
+
throw new Error(`duplicate entity id in mutation: ${ent.id}`);
|
|
37
|
+
}
|
|
38
|
+
pending.entityIds.add(ent.id);
|
|
39
|
+
}
|
|
40
|
+
for (const st of mutation.states ?? []) {
|
|
41
|
+
if (!st.id || typeof st.id !== "string") {
|
|
42
|
+
throw new Error("state id must be a non-empty string");
|
|
43
|
+
}
|
|
44
|
+
if (pending.stateIds.has(st.id)) {
|
|
45
|
+
throw new Error(`duplicate state id in mutation: ${st.id}`);
|
|
46
|
+
}
|
|
47
|
+
pending.stateIds.add(st.id);
|
|
48
|
+
}
|
|
49
|
+
for (const rel of mutation.relations ?? []) {
|
|
50
|
+
if (!rel.id || typeof rel.id !== "string") {
|
|
51
|
+
throw new Error("relation id must be a non-empty string");
|
|
52
|
+
}
|
|
53
|
+
if (pending.relationIds.has(rel.id)) {
|
|
54
|
+
throw new Error(`duplicate relation id in mutation: ${rel.id}`);
|
|
55
|
+
}
|
|
56
|
+
pending.relationIds.add(rel.id);
|
|
57
|
+
}
|
|
58
|
+
const supersededIds = /* @__PURE__ */ new Set();
|
|
59
|
+
for (const sid of mutation.supersededStateIds ?? []) {
|
|
60
|
+
if (supersededIds.has(sid)) {
|
|
61
|
+
throw new Error(`duplicate supersededStateId in mutation: ${sid}`);
|
|
62
|
+
}
|
|
63
|
+
supersededIds.add(sid);
|
|
64
|
+
}
|
|
65
|
+
for (const ev of mutation.evidence ?? []) {
|
|
66
|
+
if (ev.ownerId !== ownerId) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`evidence ${ev.id} has ownerId ${ev.ownerId}, expected ${ownerId}`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const ent of mutation.entities ?? []) {
|
|
73
|
+
if (ent.ownerId !== ownerId) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`entity ${ent.id} has ownerId ${ent.ownerId}, expected ${ownerId}`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (const st of mutation.states ?? []) {
|
|
80
|
+
if (st.ownerId !== ownerId) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`state ${st.id} has ownerId ${st.ownerId}, expected ${ownerId}`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const rel of mutation.relations ?? []) {
|
|
87
|
+
if (rel.ownerId !== ownerId) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`relation ${rel.id} has ownerId ${rel.ownerId}, expected ${ownerId}`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const st of mutation.states ?? []) {
|
|
94
|
+
if (supersededIds.has(st.id)) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
`state ${st.id} appears in both states and supersededStateIds; a record cannot be created and retired in the same mutation`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const facetSlots = /* @__PURE__ */ new Set();
|
|
101
|
+
for (const st of mutation.states ?? []) {
|
|
102
|
+
const slot = `${st.entityId} ${st.facet}`;
|
|
103
|
+
if (facetSlots.has(slot)) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
`mutation writes parallel current states for entity ${st.entityId} facet ${st.facet}`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
facetSlots.add(slot);
|
|
109
|
+
}
|
|
110
|
+
for (const ev of mutation.evidence ?? []) {
|
|
111
|
+
const existing = await getMemoryEvidenceVNext(db, ownerId, ev.id);
|
|
112
|
+
if (existing) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
`evidence ${ev.id} already exists (owner ${ownerId}); use a unique id`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const ent of mutation.entities ?? []) {
|
|
119
|
+
const existing = await getMemoryEntityVNext(db, ownerId, ent.id);
|
|
120
|
+
if (existing) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
`entity ${ent.id} already exists (owner ${ownerId}); use a unique id`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const st of mutation.states ?? []) {
|
|
127
|
+
if (!pending.entityIds.has(st.entityId)) {
|
|
128
|
+
const entity = await getMemoryEntityVNext(db, ownerId, st.entityId);
|
|
129
|
+
if (!entity) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`memory state ${st.id} references missing entity ${st.entityId} (owner ${ownerId})`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const evidenceId of st.evidenceIds) {
|
|
136
|
+
if (!pending.evidenceIds.has(evidenceId)) {
|
|
137
|
+
const ev = await getMemoryEvidenceVNext(db, ownerId, evidenceId);
|
|
138
|
+
if (!ev) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`memory state ${st.id} references missing evidence ${evidenceId} (owner ${ownerId})`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const existing = await getMemoryStateVNext(db, ownerId, st.id);
|
|
146
|
+
if (existing) {
|
|
147
|
+
if (existing.retiredAt) {
|
|
148
|
+
throw new Error(
|
|
149
|
+
`cannot update retired memory state ${st.id} (owner ${ownerId})`
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
if (existing.entityId !== st.entityId || existing.facet !== st.facet) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`state ${st.id} already exists with different entity/facet (${existing.entityId}/${existing.facet} vs ${st.entityId}/${st.facet}); use supersede instead`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (!existing) {
|
|
159
|
+
const existingStates = await listMemoryStatesForEntityVNext(db, ownerId, st.entityId);
|
|
160
|
+
for (const es of existingStates) {
|
|
161
|
+
if (es.facet === st.facet && !es.retiredAt) {
|
|
162
|
+
if (!supersededIds.has(es.id)) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
`entity ${st.entityId} facet ${st.facet} already has current state ${es.id}; supersede it or use a different facet`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
for (const sid of mutation.supersededStateIds ?? []) {
|
|
172
|
+
const existing = await getMemoryStateVNext(db, ownerId, sid);
|
|
173
|
+
if (!existing) {
|
|
174
|
+
throw new Error(
|
|
175
|
+
`cannot supersede missing memory state: ${sid} (owner ${ownerId})`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
if (existing.retiredAt) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
`cannot supersede already retired memory state: ${sid} (owner ${ownerId})`
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
const replacement = (mutation.states ?? []).find(
|
|
184
|
+
(st) => st.entityId === existing.entityId && st.facet === existing.facet
|
|
185
|
+
);
|
|
186
|
+
if (!replacement) {
|
|
187
|
+
throw new Error(
|
|
188
|
+
`superseded state ${sid} (entity ${existing.entityId} facet ${existing.facet}) has no replacement in this mutation`
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const rel of mutation.relations ?? []) {
|
|
193
|
+
for (const [side, ref] of [
|
|
194
|
+
["from", rel.from],
|
|
195
|
+
["to", rel.to]
|
|
196
|
+
]) {
|
|
197
|
+
if (pending.entityIds.has(ref) || pending.stateIds.has(ref) || pending.evidenceIds.has(ref)) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const resolved = await getMemoryEntityVNext(db, ownerId, ref) ?? await getMemoryStateVNext(db, ownerId, ref) ?? await getMemoryEvidenceVNext(db, ownerId, ref);
|
|
201
|
+
if (!resolved) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
`memory relation ${rel.id} references missing ${side} ${ref} (owner ${ownerId})`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
var applyMutationWithoutCoordination = async (db, ownerId, mutation) => {
|
|
210
|
+
await validateMutation(db, ownerId, mutation);
|
|
211
|
+
const completion = mutation.nativeCaptureCompletion;
|
|
212
|
+
if (completion) {
|
|
213
|
+
const prior = await getMemoryEvidenceVNextStrict(db, ownerId, completion.id);
|
|
214
|
+
const withoutOutcome = (ev) => ({
|
|
215
|
+
...ev,
|
|
216
|
+
nativeCapture: ev.nativeCapture && { ...ev.nativeCapture, outcome: void 0 }
|
|
217
|
+
});
|
|
218
|
+
if (!prior?.nativeCapture || prior.nativeCapture.outcome || completion.ownerId !== ownerId || !["applied", "no_op"].includes(completion.nativeCapture?.outcome ?? "") || completion.nativeCapture?.outcome === "applied" && (["no_op", "ambiguous"].includes(mutation.action) || !mutation.states?.length || mutation.states.some((st) => !st.evidenceIds.includes(completion.id))) || completion.nativeCapture?.outcome === "no_op" && (mutation.action !== "no_op" || !!(mutation.entities?.length || mutation.states?.length || mutation.relations?.length || mutation.evidence?.length || mutation.supersededStateIds?.length)) || JSON.stringify(withoutOutcome(prior)) !== JSON.stringify(withoutOutcome(completion)) || mutation.evidence?.some((ev) => ev.id === completion.id)) {
|
|
219
|
+
throw new Error("invalid native capture completion");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const batch = db.batch();
|
|
223
|
+
if (completion) _appendEvidenceBatch(batch, completion);
|
|
224
|
+
for (const ev of mutation.evidence ?? []) {
|
|
225
|
+
_appendEvidenceBatch(batch, ev);
|
|
226
|
+
}
|
|
227
|
+
for (const ent of mutation.entities ?? []) {
|
|
228
|
+
_appendEntityBatch(batch, ent);
|
|
229
|
+
}
|
|
230
|
+
for (const st of mutation.states ?? []) {
|
|
231
|
+
_appendStateBatch(batch, st);
|
|
232
|
+
}
|
|
233
|
+
for (const sid of mutation.supersededStateIds ?? []) {
|
|
234
|
+
const existing = await getMemoryStateVNext(db, ownerId, sid);
|
|
235
|
+
if (!existing) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
`cannot supersede missing memory state: ${sid} (owner ${ownerId})`
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
const replacement = (mutation.states ?? []).find(
|
|
241
|
+
(st) => st.entityId === existing.entityId && st.facet === existing.facet
|
|
242
|
+
);
|
|
243
|
+
const retired = {
|
|
244
|
+
...existing,
|
|
245
|
+
retiredAt: replacement?.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
246
|
+
};
|
|
247
|
+
_appendRetiredStateBatch(batch, retired);
|
|
248
|
+
}
|
|
249
|
+
for (const rel of mutation.relations ?? []) {
|
|
250
|
+
_appendRelationBatch(batch, rel);
|
|
251
|
+
}
|
|
252
|
+
await batch.write();
|
|
253
|
+
};
|
|
254
|
+
var pendingByDb = /* @__PURE__ */ new WeakMap();
|
|
255
|
+
var applyMemoryInterpreterMutation = async (db, ownerId, mutation) => {
|
|
256
|
+
let owners = pendingByDb.get(db);
|
|
257
|
+
if (!owners) {
|
|
258
|
+
owners = /* @__PURE__ */ new Map();
|
|
259
|
+
pendingByDb.set(db, owners);
|
|
260
|
+
}
|
|
261
|
+
const previous = owners.get(ownerId) ?? Promise.resolve();
|
|
262
|
+
const operation = previous.then(async () => {
|
|
263
|
+
const resolved = typeof mutation === "function" ? await mutation() : mutation;
|
|
264
|
+
await applyMutationWithoutCoordination(db, ownerId, resolved);
|
|
265
|
+
});
|
|
266
|
+
const settled = operation.then(() => {
|
|
267
|
+
}, () => {
|
|
268
|
+
});
|
|
269
|
+
owners.set(ownerId, settled);
|
|
270
|
+
try {
|
|
271
|
+
await operation;
|
|
272
|
+
} finally {
|
|
273
|
+
if (owners.get(ownerId) === settled) owners.delete(ownerId);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export {
|
|
278
|
+
applyMemoryInterpreterMutation
|
|
279
|
+
};
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeTimingMs
|
|
3
3
|
} from "./chunk-H57T64RA.js";
|
|
4
|
+
import {
|
|
5
|
+
sha256Hex
|
|
6
|
+
} from "./chunk-SR4FE5VD.js";
|
|
4
7
|
import {
|
|
5
8
|
isAbortError
|
|
6
9
|
} from "./chunk-7DPNBQSV.js";
|
|
7
10
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
estimateTokenCount
|
|
12
|
+
} from "./chunk-PSCNXBYA.js";
|
|
10
13
|
import {
|
|
11
14
|
asTrimmedNonEmptyStringArray
|
|
12
15
|
} from "./chunk-I42VC5KR.js";
|
|
13
16
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
ALL_MODELS
|
|
18
|
+
} from "./chunk-776CXKMX.js";
|
|
16
19
|
import {
|
|
17
20
|
MODEL_LOOKUP_MAP
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
|
|
21
|
-
isPlatformManagedProvider,
|
|
22
|
-
resolvePlatformEffectiveModel
|
|
23
|
-
} from "./chunk-OBSEKCVK.js";
|
|
21
|
+
} from "./chunk-OJRTTERA.js";
|
|
24
22
|
import {
|
|
25
23
|
asOptionalFiniteNumber
|
|
26
24
|
} from "./chunk-WWC7I6TA.js";
|
|
27
25
|
import {
|
|
28
26
|
asOptionalTrimmedString
|
|
29
27
|
} from "./chunk-G3SUCT4W.js";
|
|
28
|
+
import {
|
|
29
|
+
PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
|
|
30
|
+
isPlatformManagedProvider,
|
|
31
|
+
resolvePlatformEffectiveModel
|
|
32
|
+
} from "./chunk-U4VSBDO5.js";
|
|
30
33
|
|
|
31
34
|
// packages/core/chat/messageContentSerialize.ts
|
|
32
35
|
var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
|
|
@@ -321,12 +324,6 @@ async function runSummaryWithContract(args) {
|
|
|
321
324
|
return execute("current");
|
|
322
325
|
}
|
|
323
326
|
|
|
324
|
-
// packages/core/sha256.ts
|
|
325
|
-
import SHA256 from "crypto-js/sha256.js";
|
|
326
|
-
function sha256Hex(text) {
|
|
327
|
-
return SHA256(text).toString();
|
|
328
|
-
}
|
|
329
|
-
|
|
330
327
|
// packages/ai/context/toolOutputCap.ts
|
|
331
328
|
var TOOL_OUTPUT_CAP_WINDOW_RATIO = 0.12;
|
|
332
329
|
var TOOL_OUTPUT_CAP_MIN_TOKENS = 4e3;
|
|
@@ -1145,6 +1142,185 @@ function computeSummarySourceMetadata(messagesWithIds, summarizedBeforeId) {
|
|
|
1145
1142
|
schemaVersion: COMPACTION_SUMMARY_SCHEMA_VERSION
|
|
1146
1143
|
};
|
|
1147
1144
|
}
|
|
1145
|
+
function buildSummarySourceDiagnostics(messages, anchor) {
|
|
1146
|
+
const end = anchor ? messages.findIndex((message) => message.id === anchor) : -1;
|
|
1147
|
+
if (end < 0) return [];
|
|
1148
|
+
const width = Math.max(1, Math.ceil((end + 1) / 64));
|
|
1149
|
+
const sorted = (value) => {
|
|
1150
|
+
if (Array.isArray(value)) return value.map(sorted);
|
|
1151
|
+
if (value && typeof value === "object") return Object.fromEntries(
|
|
1152
|
+
Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, child]) => [key, sorted(child)])
|
|
1153
|
+
);
|
|
1154
|
+
return value;
|
|
1155
|
+
};
|
|
1156
|
+
const rows = [];
|
|
1157
|
+
for (let start = 0; start <= end; start += width) {
|
|
1158
|
+
const group = messages.slice(start, Math.min(end + 1, start + width));
|
|
1159
|
+
const content = group.map((message) => ({
|
|
1160
|
+
role: message.role,
|
|
1161
|
+
content: message.content ?? "",
|
|
1162
|
+
...Array.isArray(message.tool_calls) ? { tool_calls: message.tool_calls } : {}
|
|
1163
|
+
}));
|
|
1164
|
+
rows.push({
|
|
1165
|
+
start,
|
|
1166
|
+
count: group.length,
|
|
1167
|
+
idHash: sha256Hex(JSON.stringify(group.map((message) => message.id ?? null))).slice(0, 16),
|
|
1168
|
+
messageHash: sha256Hex(JSON.stringify(content)).slice(0, 16),
|
|
1169
|
+
canonicalHash: sha256Hex(JSON.stringify(sorted(content))).slice(0, 16)
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
return rows;
|
|
1173
|
+
}
|
|
1174
|
+
var MAX_SUMMARY_SOURCE_SEGMENTS = 16;
|
|
1175
|
+
function buildSummarySourceSegments(messages, anchor) {
|
|
1176
|
+
if (!anchor) return [];
|
|
1177
|
+
let end = messages.findIndex((message) => message.id === anchor);
|
|
1178
|
+
if (end === -1) {
|
|
1179
|
+
const legacy = /^local-(0|[1-9]\d*)$/.exec(anchor);
|
|
1180
|
+
if (legacy) {
|
|
1181
|
+
const index = Number(legacy[1]);
|
|
1182
|
+
if (Number.isSafeInteger(index) && index < messages.length) {
|
|
1183
|
+
end = index;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
if (end < 0) return [];
|
|
1188
|
+
const totalCount = end + 1;
|
|
1189
|
+
const width = Math.max(1, Math.ceil(totalCount / MAX_SUMMARY_SOURCE_SEGMENTS));
|
|
1190
|
+
const segments = [];
|
|
1191
|
+
for (let start = 0; start < totalCount; start += width) {
|
|
1192
|
+
const segEnd = Math.min(end, start + width - 1);
|
|
1193
|
+
const group = messages.slice(start, segEnd + 1);
|
|
1194
|
+
const roleCounts = /* @__PURE__ */ new Map();
|
|
1195
|
+
for (const message of group) {
|
|
1196
|
+
const role = typeof message.role === "string" && message.role ? message.role : "unknown";
|
|
1197
|
+
roleCounts.set(role, (roleCounts.get(role) ?? 0) + 1);
|
|
1198
|
+
}
|
|
1199
|
+
const roles = Array.from(roleCounts.entries()).map(([role, count]) => `${role}:${count}`).join(",");
|
|
1200
|
+
const canonical = group.map((message, offset) => ({
|
|
1201
|
+
id: `local-${start + offset}`,
|
|
1202
|
+
role: message.role,
|
|
1203
|
+
content: message.content ?? "",
|
|
1204
|
+
...Array.isArray(message.tool_calls) ? { tool_calls: message.tool_calls } : {}
|
|
1205
|
+
}));
|
|
1206
|
+
const hash = sha256Hex(JSON.stringify(canonical)).slice(0, 16);
|
|
1207
|
+
segments.push({
|
|
1208
|
+
start,
|
|
1209
|
+
end: segEnd,
|
|
1210
|
+
count: group.length,
|
|
1211
|
+
roles,
|
|
1212
|
+
hash
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
return segments;
|
|
1216
|
+
}
|
|
1217
|
+
function diffSummarySourceSegments(savedSegments, currentSegments) {
|
|
1218
|
+
const saved = Array.isArray(savedSegments) ? savedSegments : [];
|
|
1219
|
+
const current = Array.isArray(currentSegments) ? currentSegments : [];
|
|
1220
|
+
const savedTotalCount = saved.reduce(
|
|
1221
|
+
(sum, seg) => sum + (typeof seg?.count === "number" && Number.isFinite(seg.count) ? seg.count : 0),
|
|
1222
|
+
0
|
|
1223
|
+
);
|
|
1224
|
+
const currentTotalCount = current.reduce(
|
|
1225
|
+
(sum, seg) => sum + (typeof seg?.count === "number" && Number.isFinite(seg.count) ? seg.count : 0),
|
|
1226
|
+
0
|
|
1227
|
+
);
|
|
1228
|
+
if (saved.length === 0) {
|
|
1229
|
+
return {
|
|
1230
|
+
matched: false,
|
|
1231
|
+
reason: "legacy_no_segments",
|
|
1232
|
+
firstMismatchIndex: null,
|
|
1233
|
+
savedSegmentCount: 0,
|
|
1234
|
+
currentSegmentCount: current.length,
|
|
1235
|
+
savedTotalCount: 0,
|
|
1236
|
+
currentTotalCount,
|
|
1237
|
+
savedSegment: null,
|
|
1238
|
+
currentSegment: null
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
if (current.length === 0) {
|
|
1242
|
+
return {
|
|
1243
|
+
matched: false,
|
|
1244
|
+
reason: "anchor_missing",
|
|
1245
|
+
firstMismatchIndex: null,
|
|
1246
|
+
savedSegmentCount: saved.length,
|
|
1247
|
+
currentSegmentCount: 0,
|
|
1248
|
+
savedTotalCount,
|
|
1249
|
+
currentTotalCount: 0,
|
|
1250
|
+
savedSegment: saved[0] ?? null,
|
|
1251
|
+
currentSegment: null
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
const minLen = Math.min(saved.length, current.length);
|
|
1255
|
+
let firstDiff = null;
|
|
1256
|
+
for (let i = 0; i < minLen; i++) {
|
|
1257
|
+
const s = saved[i];
|
|
1258
|
+
const c = current[i];
|
|
1259
|
+
if (!s || !c || s.start !== c.start || s.end !== c.end || s.count !== c.count || s.roles !== c.roles || s.hash !== c.hash) {
|
|
1260
|
+
firstDiff = i;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
if (savedTotalCount !== currentTotalCount || saved.length !== current.length) {
|
|
1265
|
+
const idx = firstDiff ?? minLen;
|
|
1266
|
+
return {
|
|
1267
|
+
matched: false,
|
|
1268
|
+
reason: "count_changed",
|
|
1269
|
+
firstMismatchIndex: idx,
|
|
1270
|
+
savedSegmentCount: saved.length,
|
|
1271
|
+
currentSegmentCount: current.length,
|
|
1272
|
+
savedTotalCount,
|
|
1273
|
+
currentTotalCount,
|
|
1274
|
+
savedSegment: saved[idx] ?? null,
|
|
1275
|
+
currentSegment: current[idx] ?? null
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
if (firstDiff !== null) {
|
|
1279
|
+
const s = saved[firstDiff] ?? null;
|
|
1280
|
+
const c = current[firstDiff] ?? null;
|
|
1281
|
+
const boundsChanged = !s || !c || s.start !== c.start || s.end !== c.end || s.count !== c.count;
|
|
1282
|
+
return {
|
|
1283
|
+
matched: false,
|
|
1284
|
+
reason: boundsChanged ? "count_changed" : "segment_hash_changed",
|
|
1285
|
+
firstMismatchIndex: firstDiff,
|
|
1286
|
+
savedSegmentCount: saved.length,
|
|
1287
|
+
currentSegmentCount: current.length,
|
|
1288
|
+
savedTotalCount,
|
|
1289
|
+
currentTotalCount,
|
|
1290
|
+
savedSegment: s,
|
|
1291
|
+
currentSegment: c
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
return {
|
|
1295
|
+
matched: true,
|
|
1296
|
+
reason: "matched",
|
|
1297
|
+
firstMismatchIndex: null,
|
|
1298
|
+
savedSegmentCount: saved.length,
|
|
1299
|
+
currentSegmentCount: current.length,
|
|
1300
|
+
savedTotalCount,
|
|
1301
|
+
currentTotalCount,
|
|
1302
|
+
savedSegment: null,
|
|
1303
|
+
currentSegment: null
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
function sanitizeSummarySourceSegments(raw) {
|
|
1307
|
+
if (!Array.isArray(raw) || raw.length === 0) return void 0;
|
|
1308
|
+
const sanitized = [];
|
|
1309
|
+
for (const item of raw.slice(0, MAX_SUMMARY_SOURCE_SEGMENTS)) {
|
|
1310
|
+
if (!item || typeof item !== "object") continue;
|
|
1311
|
+
const candidate = item;
|
|
1312
|
+
const start = candidate.start;
|
|
1313
|
+
const end = candidate.end;
|
|
1314
|
+
const count = candidate.count;
|
|
1315
|
+
const roles = candidate.roles;
|
|
1316
|
+
const hash = candidate.hash;
|
|
1317
|
+
if (typeof start !== "number" || !Number.isSafeInteger(start) || start < 0 || typeof end !== "number" || !Number.isSafeInteger(end) || end < start || typeof count !== "number" || !Number.isSafeInteger(count) || count < 1 || typeof roles !== "string" || roles.length === 0 || roles.length > 128 || /[\r\n\0]/.test(roles) || typeof hash !== "string" || !/^[0-9a-f]{16}$/.test(hash)) {
|
|
1318
|
+
continue;
|
|
1319
|
+
}
|
|
1320
|
+
sanitized.push({ start, end, count, roles, hash });
|
|
1321
|
+
}
|
|
1322
|
+
return sanitized.length > 0 ? sanitized : void 0;
|
|
1323
|
+
}
|
|
1148
1324
|
|
|
1149
1325
|
// packages/ai/llm/getModelContextWindow.ts
|
|
1150
1326
|
var DEFAULT_CONTEXT_WINDOW = 256e3;
|
|
@@ -1152,7 +1328,7 @@ var QWEN_3_6_CONTEXT_WINDOW = 262144;
|
|
|
1152
1328
|
var GLM_5_2_CONTEXT_WINDOW = 1e6;
|
|
1153
1329
|
var GPT_6_1_SOL_CONTEXT_WINDOW = 5e5;
|
|
1154
1330
|
var GPT_6_1_SOL_PATTERN = /(^|\/)gpt-6\.1[- ]sol(?![a-z])/;
|
|
1155
|
-
var GPT_6_1_PINNED_PATTERN = /(^|\/)gpt-6\.1[- ](sol|terra)(?![a-z0-9])/;
|
|
1331
|
+
var GPT_6_1_PINNED_PATTERN = /(^|\/)gpt-(?:6\.1[- ](sol|terra)|6\.2[- ](sol|astra))(?![a-z0-9])/;
|
|
1156
1332
|
var GPT_272K_PINNED_PATTERN = /(^|\/)(gpt-6[- ](astra|luna|sol)|gpt-5\.6[- ](sol|terra|luna))(?![a-z0-9])/;
|
|
1157
1333
|
var GPT_272K_CONTEXT_WINDOW = 272e3;
|
|
1158
1334
|
function channelPinnedContextWindow(normalizedName) {
|
|
@@ -1351,6 +1527,11 @@ var getModelInfo = (modelName) => {
|
|
|
1351
1527
|
};
|
|
1352
1528
|
|
|
1353
1529
|
export {
|
|
1530
|
+
DEFAULT_CONTEXT_WINDOW,
|
|
1531
|
+
findCodexOAuthPinnedContextWindow,
|
|
1532
|
+
findModelContextWindow,
|
|
1533
|
+
getModelContextWindow,
|
|
1534
|
+
getModelInfo,
|
|
1354
1535
|
readCacheReadInputTokens,
|
|
1355
1536
|
readCacheReadInputTokensOrNull,
|
|
1356
1537
|
readCacheCreationInputTokens,
|
|
@@ -1361,22 +1542,20 @@ export {
|
|
|
1361
1542
|
getMessageTokenCount,
|
|
1362
1543
|
resolveEffectiveCompactionBudgets,
|
|
1363
1544
|
planCompression,
|
|
1364
|
-
DEFAULT_CONTEXT_WINDOW,
|
|
1365
|
-
findCodexOAuthPinnedContextWindow,
|
|
1366
|
-
findModelContextWindow,
|
|
1367
|
-
getModelContextWindow,
|
|
1368
|
-
getModelInfo,
|
|
1369
1545
|
createSummaryBudget,
|
|
1370
1546
|
classifySummaryError,
|
|
1371
1547
|
isTruncatedCompletion,
|
|
1372
1548
|
summaryCompletionTokens,
|
|
1373
1549
|
selectSummaryRoute,
|
|
1374
1550
|
runSummaryWithContract,
|
|
1375
|
-
sha256Hex,
|
|
1376
1551
|
COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
1377
1552
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
1378
1553
|
buildBoundedCompactionRequest,
|
|
1379
1554
|
buildCompactionMetricsFromPlan,
|
|
1380
1555
|
formatCompactionMetricsLog,
|
|
1381
|
-
computeSummarySourceMetadata
|
|
1556
|
+
computeSummarySourceMetadata,
|
|
1557
|
+
buildSummarySourceDiagnostics,
|
|
1558
|
+
buildSummarySourceSegments,
|
|
1559
|
+
diffSummarySourceSegments,
|
|
1560
|
+
sanitizeSummarySourceSegments
|
|
1382
1561
|
};
|