nolo-cli 0.108.0-alpha.1 → 0.108.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/README.md +1 -1
- package/{_executeModel-GTYLDSJW.js → _executeModel-RVAKYU4J.js} +128 -83
- package/action-RHUT4OHH.js +23 -0
- package/{addContentAction-MB2HHMDZ.js → addContentAction-BQ3LJLUW.js} +19 -13
- package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-B6X7BXR4.js} +24 -20
- package/{agentDeleteCommand-OWYHN6D6.js → agentDeleteCommand-T5MDAOE7.js} +154 -67
- package/{agentEmailCommands-C6J2KUL2.js → agentEmailCommands-UWBQSKLI.js} +125 -104
- package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
- package/agentListCommands-2Q456VYS.js +800 -0
- package/{agentMachineCommands-UDEXV472.js → agentMachineCommands-FPJJ4DCF.js} +54 -57
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-7PCGR77I.js} +97 -2
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-7GCDM4BK.js} +7 -7
- package/agentRecordCommands-3JGDR4NN.js +149 -0
- package/agentRunCommand-3NQOP3SD.js +179 -0
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-2CDZNHXV.js} +10 -2
- package/{agentRuntimeLocal-KCMC2TBD.js → agentRuntimeLocal-SQUDRZWE.js} +42 -46
- package/{agentSlice-TNH7BSUC.js → agentSlice-R4W6MCEW.js} +22 -16
- package/{appDeleteCommands-JEPA3EWE.js → appDeleteCommands-CLLYGEBC.js} +55 -55
- package/{appDeployCommands-UTB76XFM.js → appDeployCommands-HY2NBNDQ.js} +64 -59
- package/{appDeployStatusCommands-LGHF2SBD.js → appDeployStatusCommands-SGO5GEXH.js} +53 -52
- package/{appGetCommands-PX2BFHOB.js → appGetCommands-ZPYK2N5D.js} +53 -52
- package/{appListCommands-BSMPTWKC.js → appListCommands-O2BHIMKS.js} +54 -55
- package/{authCommand-YW42YZA4.js → authCommand-GUIREPHK.js} +213 -72
- package/{authCommands-RGOGCPP6.js → authCommands-K3BDSTJ4.js} +10 -7
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-MUOUTRNJ.js} +13 -10
- package/{chromeCommands-FZYAU75D.js → chromeCommands-Z2WRJB7O.js} +290 -38
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-YWYXZTIR.js} +157 -23
- package/{chunk-RRPWH4LX.js → chunk-26UZ2Y4Z.js} +26 -31
- package/{chunk-2F7RJC6L.js → chunk-2C47W7IJ.js} +1 -1
- package/{chunk-VLTIYV3X.js → chunk-2ECUZDEL.js} +37 -11
- package/{chunk-ALXHV7NK.js → chunk-2GGXHQIW.js} +43 -4
- package/{chunk-AHAHBQMU.js → chunk-2OMUAIKR.js} +2 -2
- package/{chunk-DHDMC6FO.js → chunk-3CZM6HGQ.js} +53 -23
- package/{chunk-BNGW5ASC.js → chunk-3LI5UCTU.js} +23 -3
- package/{chunk-FDTR4QJ6.js → chunk-3MZAGMYY.js} +48 -1
- package/chunk-3PVYUPXK.js +40 -0
- package/chunk-3SK3J3IF.js +929 -0
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-V7E4PXQD.js → chunk-4MSYSHZD.js} +15 -7
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-MP64VFGD.js → chunk-4XEYAFLY.js} +60 -18
- package/chunk-4YRTZIVN.js +871 -0
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-N7J63Q6C.js → chunk-56GBUMO5.js} +10 -1
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-XT35TTFG.js → chunk-5WLADF62.js} +90 -36
- package/chunk-5XN3OSCT.js +164 -0
- package/chunk-6CCAXGFK.js +1712 -0
- package/{chunk-42V6BK2E.js → chunk-6MXDOUMH.js} +18 -36
- package/{chunk-QOKAKDPE.js → chunk-6Q7UTJKR.js} +6 -94
- package/{chunk-J4MOO56S.js → chunk-6VRWNU5J.js} +10 -2
- package/{chunk-GEPUP7OO.js → chunk-726TCFLQ.js} +5 -5
- package/chunk-7DPNBQSV.js +9 -0
- package/chunk-7YVPCIEN.js +1858 -0
- package/{chunk-AEOE4Z6Q.js → chunk-A337PRRR.js} +41 -17
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-ABQYVJBJ.js → chunk-AIZE5TDM.js} +3 -3
- package/{chunk-GPCZ7UXG.js → chunk-ALKCVCA5.js} +4 -4
- package/{chunk-5UTFL4QJ.js → chunk-APO5TOXO.js} +1 -1
- package/{chunk-E4MARS3Q.js → chunk-AU7AXHUL.js} +1 -1
- package/{chunk-PBA4UJBK.js → chunk-BFYDNHYW.js} +12 -12
- package/{chunk-QTGQ2LTL.js → chunk-BIAETTOB.js} +5 -9
- package/{chunk-OIVSQH2O.js → chunk-CGEK73JN.js} +311 -12
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/chunk-DGDGNYI5.js +593 -0
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-PVZT43MU.js → chunk-EXR4XCFE.js} +17 -15
- package/chunk-EYLGAEB4.js +784 -0
- package/{chunk-3BMYXEUW.js → chunk-F2UJW3EK.js} +1 -1
- package/{chunk-P5EVSOPA.js → chunk-FWY6BHIJ.js} +363 -248
- package/{chunk-4MK3I7Y4.js → chunk-G23MQWLJ.js} +7 -128
- package/chunk-G6OOUQWJ.js +417 -0
- package/{chunk-WV42OMV7.js → chunk-GHZ2H2HJ.js} +11 -15
- package/chunk-GMZLP5DV.js +82 -0
- package/chunk-I42VC5KR.js +15 -0
- package/{chunk-GO3Z72MT.js → chunk-IFALJPEX.js} +71 -99
- package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
- package/{chunk-UKWGR5SS.js → chunk-IJERIUXS.js} +242 -1146
- package/chunk-IRG4OKY6.js +843 -0
- package/{chunk-TYYSADX4.js → chunk-IUTHWIZQ.js} +269 -141
- package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
- package/chunk-JJM3WS6W.js +132 -0
- package/{chunk-R7RHOSZU.js → chunk-KN6MKCS5.js} +1733 -465
- package/{chunk-SH43IESU.js → chunk-KQ7DAEZ7.js} +202 -32
- package/{chunk-6OZ36FXI.js → chunk-KY6GPQ7O.js} +36 -12
- package/{chunk-MRIHM22T.js → chunk-LAVSW2C2.js} +77 -144
- package/{chunk-NA35QHCF.js → chunk-LNEKN523.js} +10 -7
- package/chunk-LWLNLZC5.js +265 -0
- package/{chunk-I3TQJXQ7.js → chunk-MHD5JBSS.js} +131 -10
- package/{chunk-KQ4ONNQD.js → chunk-MW533QT3.js} +190 -8
- package/{chunk-62CATUYY.js → chunk-NLEJWKF5.js} +10532 -9444
- package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-NN4UUYGB.js} +18 -4
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/chunk-OKARGYFT.js +15 -0
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-53HEEOTT.js → chunk-OYBAT7RT.js} +113 -17
- package/chunk-P3SFAHIL.js +134 -0
- package/{chunk-7U6P3PHS.js → chunk-P6KLYCL3.js} +310 -95
- package/{chunk-XD2MJFUG.js → chunk-PBGO5AFD.js} +1 -1
- package/{chunk-EYAQT56M.js → chunk-PFEK4SA2.js} +13 -10
- package/{chunk-Z77CRGTW.js → chunk-PHHFVGOJ.js} +1 -1
- package/{chunk-3VNWWVKB.js → chunk-PJNFNEJE.js} +114 -28
- package/{chunk-RRM7AJ3M.js → chunk-PS6XSDHW.js} +35 -30
- package/{chunk-HVURBGF3.js → chunk-PWRS2SU2.js} +27 -9
- package/chunk-QFEW2ULV.js +42 -0
- package/chunk-QH2QSBGP.js +7546 -0
- package/{chunk-IIVGDG4I.js → chunk-QLQ573SU.js} +124 -77
- package/chunk-QQ56R7KS.js +88 -0
- package/chunk-QYPE3TS3.js +43 -0
- package/{chunk-VMFTFOWF.js → chunk-RLRYVSCD.js} +31 -14
- package/{chunk-VRTTFDBM.js → chunk-RNNWTMKT.js} +56 -63
- package/chunk-ROXFUKKL.js +13941 -0
- package/{chunk-DUK4OQNO.js → chunk-RRPT5CGT.js} +124 -703
- package/{chunk-JRQFUXY7.js → chunk-RRQQAG7W.js} +93 -24
- package/chunk-SJ3QFSQS.js +1147 -0
- package/chunk-SP4WCECG.js +95 -0
- package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-UZGQNTVW.js → chunk-TSBCYK5F.js} +10 -8
- package/chunk-TY3TIUJK.js +89 -0
- package/chunk-U4STABYN.js +81 -0
- package/chunk-UEILX4EV.js +15 -0
- package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
- package/{chunk-EEGDMATE.js → chunk-UPFOOGHU.js} +90 -79
- package/{chunk-7S4YWN7P.js → chunk-V2UPLOXT.js} +4 -4
- package/{chunk-PQFHGD77.js → chunk-V5DCOM6G.js} +185 -16
- package/{chunk-LS2ZANRJ.js → chunk-V6WXGTUJ.js} +1 -1
- package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
- package/{chunk-DVINR3PL.js → chunk-VEA7H5FG.js} +3 -3
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-EADNWBAZ.js → chunk-VP3BINY7.js} +13 -0
- package/{chunk-HKNXJGEC.js → chunk-VSPO4S33.js} +47 -192
- package/{chunk-ETI2NYVF.js → chunk-W2N3ZC4P.js} +7 -7
- package/{chunk-EOARMOVD.js → chunk-W4S6OTSC.js} +6 -3
- package/{chunk-6Z7MY3V7.js → chunk-WCQNEMXG.js} +3 -3
- package/chunk-WJZOQR2J.js +151 -0
- package/{chunk-L7OXGGBN.js → chunk-WVES4PHL.js} +69 -57
- package/{chunk-BFDFRLLQ.js → chunk-WW2USJ3C.js} +3 -3
- package/{chunk-QWL5QZGU.js → chunk-X2VPXJZC.js} +20 -11
- package/chunk-X5BIY654.js +29 -0
- package/{chunk-Q554LLSI.js → chunk-XETG4RIX.js} +5 -5
- package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
- package/{chunk-JEDZAO7L.js → chunk-YBNHPX4S.js} +257 -37
- package/{chunk-JPGCXHNM.js → chunk-YLMMECCH.js} +1 -1
- package/{chunk-CSC3CU4K.js → chunk-YSZQSZR2.js} +61 -11
- package/{chunk-6D6VBVEW.js → chunk-YVTZMLXZ.js} +96 -25
- package/{chunk-AG2AZ6GX.js → chunk-YZZLKXCQ.js} +1449 -1094
- package/chunk-ZRAU6T47.js +56 -0
- package/{chunk-ONXOABJR.js → chunk-ZWQUWF6W.js} +36 -1
- package/{cliExecutor-HG3S345O.js → cliExecutor-AWYR3T33.js} +1 -1
- package/commandRegistry-C25O2ARU.js +839 -0
- package/contentThunks-UWODFKX6.js +83 -0
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-JFKTYS2D.js} +2 -2
- package/{createAgentAutomationAction-OBH7GPW5.js → createAgentAutomationAction-SA4IA4CR.js} +51 -43
- package/createDialogAction-EDK5IMRG.js +75 -0
- package/{createPageAction-JJ7UUTWC.js → createPageAction-VYVF5EIZ.js} +60 -51
- package/{chunk-BVGTK7MR.js → cursorProvider-YGGNMVWX.js} +2751 -10185
- package/{dbSlice-A6C6H32X.js → dbSlice-JQFBMJ55.js} +18 -12
- package/{deleteFile-YG6QMJLU.js → deleteFile-6JWDDRVP.js} +9 -5
- package/dialogCommands-K734RXEQ.js +108 -0
- package/{dialogSlice-6Z2BPC3T.js → dialogSlice-EEDP6PJ3.js} +66 -41
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-WRG2JLGM.js → docCreateCommands-N3KPGP4A.js} +51 -53
- package/{docDeleteCommands-SHWJIBJS.js → docDeleteCommands-4CR4TXZ7.js} +53 -54
- package/{docReadCommands-WJN3WT6O.js → docReadCommands-62XK57VS.js} +50 -52
- package/{docStore-7WUS6XXX.js → docStore-RB7YBD4Y.js} +24 -15
- package/{docUpdateCommands-IE32IL6O.js → docUpdateCommands-DRAAWIDC.js} +51 -53
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-LM6OMMQQ.js} +5 -4
- package/{getPricing-LUSEABA6.js → getPricing-XDF4OLTC.js} +6 -6
- package/handleSendMessageAction-TYDPIC6O.js +1849 -0
- package/index.js +91 -884
- package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-BOETO2TD.js} +2 -2
- package/localRuntimeAdapter-VYB2QTU3.js +239 -0
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-YSE6NH7B.js} +12 -9
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-7FBKDEQY.js} +1 -1
- package/{machineCommands-KSN4COGR.js → machineCommands-IQRRLSYP.js} +493 -151
- package/machineWsRunDispatch-LIMM5CYE.js +164 -0
- package/{memberThunks-P2ECUJ56.js → memberThunks-Y3Q7GZTG.js} +24 -17
- package/{models-T3SG6MJ5.js → models-6V4ZCHEE.js} +2 -2
- package/node_modules/abstract-level/CHANGELOG.md +150 -0
- package/node_modules/abstract-level/LICENSE +21 -0
- package/node_modules/abstract-level/README.md +1957 -0
- package/node_modules/abstract-level/UPGRADING.md +669 -0
- package/node_modules/abstract-level/abstract-chained-batch.js +397 -0
- package/node_modules/abstract-level/abstract-iterator.js +404 -0
- package/node_modules/abstract-level/abstract-level.js +1127 -0
- package/node_modules/abstract-level/abstract-snapshot.js +84 -0
- package/node_modules/abstract-level/index.d.ts +52 -0
- package/node_modules/abstract-level/index.js +9 -0
- package/node_modules/abstract-level/lib/abstract-sublevel-iterator.js +141 -0
- package/node_modules/abstract-level/lib/abstract-sublevel.js +290 -0
- package/node_modules/abstract-level/lib/common.js +33 -0
- package/node_modules/abstract-level/lib/default-chained-batch.js +29 -0
- package/node_modules/abstract-level/lib/default-kv-iterator.js +74 -0
- package/node_modules/abstract-level/lib/deferred-iterator.js +110 -0
- package/node_modules/abstract-level/lib/deferred-queue.js +84 -0
- package/node_modules/abstract-level/lib/errors.js +21 -0
- package/node_modules/abstract-level/lib/event-monitor.js +30 -0
- package/node_modules/abstract-level/lib/hooks.js +78 -0
- package/node_modules/abstract-level/lib/prefixes.js +21 -0
- package/node_modules/abstract-level/lib/prewrite-batch.js +96 -0
- package/node_modules/abstract-level/lib/range-options.js +26 -0
- package/node_modules/abstract-level/package.json +66 -0
- package/node_modules/abstract-level/test/async-iterator-test.js +132 -0
- package/node_modules/abstract-level/test/batch-test.js +214 -0
- package/node_modules/abstract-level/test/chained-batch-test.js +315 -0
- package/node_modules/abstract-level/test/clear-range-test.js +262 -0
- package/node_modules/abstract-level/test/clear-test.js +110 -0
- package/node_modules/abstract-level/test/common.js +90 -0
- package/node_modules/abstract-level/test/deferred-open-test.js +209 -0
- package/node_modules/abstract-level/test/del-test.js +65 -0
- package/node_modules/abstract-level/test/encoding-buffer-test.js +336 -0
- package/node_modules/abstract-level/test/encoding-custom-test.js +92 -0
- package/node_modules/abstract-level/test/encoding-decode-error-test.js +85 -0
- package/node_modules/abstract-level/test/encoding-json-test.js +75 -0
- package/node_modules/abstract-level/test/encoding-test.js +130 -0
- package/node_modules/abstract-level/test/events/write.js +132 -0
- package/node_modules/abstract-level/test/factory-test.js +36 -0
- package/node_modules/abstract-level/test/get-many-test.js +157 -0
- package/node_modules/abstract-level/test/get-sync-test.js +61 -0
- package/node_modules/abstract-level/test/get-test.js +83 -0
- package/node_modules/abstract-level/test/has-many-test.js +144 -0
- package/node_modules/abstract-level/test/has-test.js +81 -0
- package/node_modules/abstract-level/test/hooks/newsub.js +57 -0
- package/node_modules/abstract-level/test/hooks/postopen.js +229 -0
- package/node_modules/abstract-level/test/hooks/prewrite.js +816 -0
- package/node_modules/abstract-level/test/hooks/shared.js +38 -0
- package/node_modules/abstract-level/test/index.js +86 -0
- package/node_modules/abstract-level/test/iterator-explicit-snapshot-test.js +393 -0
- package/node_modules/abstract-level/test/iterator-no-snapshot-test.js +49 -0
- package/node_modules/abstract-level/test/iterator-range-test.js +277 -0
- package/node_modules/abstract-level/test/iterator-seek-test.js +335 -0
- package/node_modules/abstract-level/test/iterator-snapshot-test.js +56 -0
- package/node_modules/abstract-level/test/iterator-test.js +621 -0
- package/node_modules/abstract-level/test/manifest-test.js +21 -0
- package/node_modules/abstract-level/test/open-create-if-missing-test.js +39 -0
- package/node_modules/abstract-level/test/open-error-if-exists-test.js +25 -0
- package/node_modules/abstract-level/test/open-test.js +263 -0
- package/node_modules/abstract-level/test/put-get-del-test.js +97 -0
- package/node_modules/abstract-level/test/put-test.js +70 -0
- package/node_modules/abstract-level/test/self/abstract-iterator-test.js +182 -0
- package/node_modules/abstract-level/test/self/async-iterator-test.js +242 -0
- package/node_modules/abstract-level/test/self/attach-resource-test.js +74 -0
- package/node_modules/abstract-level/test/self/defer-test.js +140 -0
- package/node_modules/abstract-level/test/self/deferred-iterator-test.js +314 -0
- package/node_modules/abstract-level/test/self/deferred-operations-test.js +86 -0
- package/node_modules/abstract-level/test/self/deferred-queue-test.js +93 -0
- package/node_modules/abstract-level/test/self/encoding-test.js +391 -0
- package/node_modules/abstract-level/test/self/errors-test.js +11 -0
- package/node_modules/abstract-level/test/self/iterator-test.js +1050 -0
- package/node_modules/abstract-level/test/self/sublevel-test.js +1039 -0
- package/node_modules/abstract-level/test/self.js +905 -0
- package/node_modules/abstract-level/test/sublevel-test.js +209 -0
- package/node_modules/abstract-level/test/traits/closed.js +42 -0
- package/node_modules/abstract-level/test/traits/index.js +4 -0
- package/node_modules/abstract-level/test/traits/open.js +62 -0
- package/node_modules/abstract-level/test/util.js +275 -0
- package/node_modules/abstract-level/types/abstract-chained-batch.d.ts +124 -0
- package/node_modules/abstract-level/types/abstract-iterator.d.ts +241 -0
- package/node_modules/abstract-level/types/abstract-level.d.ts +636 -0
- package/node_modules/abstract-level/types/abstract-snapshot.d.ts +30 -0
- package/node_modules/abstract-level/types/abstract-sublevel.d.ts +76 -0
- package/node_modules/abstract-level/types/interfaces.d.ts +43 -0
- package/node_modules/base64-js/LICENSE +21 -0
- package/node_modules/base64-js/README.md +34 -0
- package/node_modules/base64-js/base64js.min.js +1 -0
- package/node_modules/base64-js/index.d.ts +3 -0
- package/node_modules/base64-js/index.js +150 -0
- package/node_modules/base64-js/package.json +47 -0
- package/node_modules/browser-level/CHANGELOG.md +44 -0
- package/node_modules/browser-level/LICENSE +21 -0
- package/node_modules/browser-level/README.md +124 -0
- package/node_modules/browser-level/UPGRADING.md +143 -0
- package/node_modules/browser-level/index.d.ts +108 -0
- package/node_modules/browser-level/index.js +323 -0
- package/node_modules/browser-level/iterator.js +239 -0
- package/node_modules/browser-level/package.json +48 -0
- package/node_modules/browser-level/util/clear.js +38 -0
- package/node_modules/browser-level/util/deserialize.js +17 -0
- package/node_modules/browser-level/util/key-range.js +20 -0
- package/node_modules/buffer/AUTHORS.md +73 -0
- package/node_modules/buffer/LICENSE +21 -0
- package/node_modules/buffer/README.md +410 -0
- package/node_modules/buffer/index.d.ts +194 -0
- package/node_modules/buffer/index.js +2106 -0
- package/node_modules/buffer/package.json +93 -0
- package/node_modules/classic-level/CHANGELOG.md +115 -0
- package/node_modules/classic-level/LICENSE +21 -0
- package/node_modules/classic-level/README.md +274 -0
- package/node_modules/classic-level/UPGRADING.md +131 -0
- package/node_modules/classic-level/binding.cc +2652 -0
- package/node_modules/classic-level/binding.gyp +71 -0
- package/node_modules/classic-level/binding.js +1 -0
- package/node_modules/classic-level/chained-batch.js +35 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/LICENSE +27 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/Makefile +424 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/build_detect_platform +256 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/autocompact_test.cc +118 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.cc +88 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.h +34 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c.cc +595 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c_test.c +390 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/corruption_test.cc +374 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_bench.cc +1020 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.cc +1568 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.h +212 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.cc +317 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.h +28 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_test.cc +2158 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.cc +140 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.h +230 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat_test.cc +112 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dumpfile.cc +225 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/fault_injection_test.cc +554 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.cc +144 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.h +85 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename_test.cc +123 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/leveldbutil.cc +64 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_format.h +35 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.cc +284 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.h +113 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_test.cc +591 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.cc +112 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.h +54 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.cc +145 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.h +89 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/recovery_test.cc +324 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/repair.cc +461 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist.h +384 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist_test.cc +378 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/snapshot.h +67 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.cc +127 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.h +61 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.cc +266 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.h +107 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit_test.cc +46 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.cc +1535 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.h +399 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set_test.cc +179 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch.cc +147 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_internal.h +50 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_test.cc +120 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.cc +398 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.h +20 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv_test.cc +241 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/c.h +290 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/cache.h +110 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/comparator.h +63 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/db.h +164 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/dumpfile.h +25 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/env.h +351 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/filter_policy.h +70 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/iterator.h +100 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/options.h +213 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/slice.h +109 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/status.h +112 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table.h +85 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table_builder.h +92 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/value_sink.h +26 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/write_batch.h +64 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue178_test.cc +92 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue200_test.cc +59 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/atomic_pointer.h +242 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port.h +21 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_example.h +141 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.cc +53 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.h +156 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix_sse.cc +129 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/thread_annotations.h +60 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/win/stdint.h +24 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.cc +268 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.h +44 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.cc +109 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.h +57 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.cc +111 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.h +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block_test.cc +128 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.cc +144 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.h +108 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator.cc +67 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator_wrapper.h +66 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.cc +197 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.h +26 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table.cc +285 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_builder.cc +270 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_test.cc +876 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.cc +182 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.h +34 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.cc +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.h +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena_test.cc +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom.cc +95 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom_test.cc +162 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache.cc +405 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache_test.cc +226 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.cc +194 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.h +104 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding_test.cc +196 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/comparator.cc +81 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.cc +350 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.h +45 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c_test.cc +72 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env.cc +100 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix.cc +695 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test.cc +66 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test_helper.h +28 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_test.cc +106 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/filter_policy.cc +11 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.cc +52 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.h +19 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash_test.cc +54 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.cc +139 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.h +42 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.cc +72 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.h +43 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/mutexlock.h +41 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/options.cc +30 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/posix_logger.h +98 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/random.h +64 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/status.cc +75 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.cc +77 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.h +138 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.cc +51 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.h +63 -0
- package/node_modules/classic-level/deps/leveldb/leveldb.gyp +282 -0
- package/node_modules/classic-level/deps/leveldb/patches/001-value-sink.patch +164 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/atomic_pointer_win.h +48 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/env_win.cc +692 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.cc +36 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h +157 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h.bak +153 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/stdint-msvc2008.h +247 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar.h +45 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar_posix.cc +139 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/win_logger.cc +79 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/win_logger.h +28 -0
- package/node_modules/classic-level/deps/snappy/freebsd/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/freebsd/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/linux/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/linux/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/mac/config.h +137 -0
- package/node_modules/classic-level/deps/snappy/mac/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/openbsd/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/openbsd/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/snappy/COPYING +54 -0
- package/node_modules/classic-level/deps/snappy/snappy/cmake/SnappyConfig.cmake +1 -0
- package/node_modules/classic-level/deps/snappy/snappy/cmake/config.h.in +62 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-c.cc +90 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-c.h +138 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-internal.h +224 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.cc +104 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.h +182 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.cc +42 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.h +561 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-public.h.in +94 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-test.cc +612 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-test.h +573 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy.cc +1515 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy.h +203 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy_unittest.cc +1410 -0
- package/node_modules/classic-level/deps/snappy/snappy.gyp +119 -0
- package/node_modules/classic-level/deps/snappy/solaris/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/solaris/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/win32/config.h +29 -0
- package/node_modules/classic-level/deps/snappy/win32/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/index.d.ts +343 -0
- package/node_modules/classic-level/index.js +311 -0
- package/node_modules/classic-level/iterator.js +122 -0
- package/node_modules/classic-level/package.json +70 -0
- package/node_modules/classic-level/prebuilds/android-arm/classic-level.armv7.node +0 -0
- package/node_modules/classic-level/prebuilds/android-arm64/classic-level.armv8.node +0 -0
- package/node_modules/classic-level/prebuilds/darwin-x64+arm64/classic-level.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-arm/classic-level.armv6.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-arm/classic-level.armv7.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-arm64/classic-level.armv8.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-x64/classic-level.musl.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-x64/classic-level.node +0 -0
- package/node_modules/classic-level/prebuilds/win32-ia32/classic-level.node +0 -0
- package/node_modules/classic-level/prebuilds/win32-x64/classic-level.node +0 -0
- package/node_modules/ieee754/LICENSE +11 -0
- package/node_modules/ieee754/README.md +51 -0
- package/node_modules/ieee754/index.d.ts +10 -0
- package/node_modules/ieee754/index.js +85 -0
- package/node_modules/ieee754/package.json +52 -0
- package/node_modules/is-buffer/LICENSE +21 -0
- package/node_modules/is-buffer/README.md +54 -0
- package/node_modules/is-buffer/index.d.ts +2 -0
- package/node_modules/is-buffer/index.js +11 -0
- package/node_modules/is-buffer/package.json +65 -0
- package/node_modules/level/CHANGELOG.md +532 -0
- package/node_modules/level/LICENSE +21 -0
- package/node_modules/level/README.md +107 -0
- package/node_modules/level/UPGRADING.md +413 -0
- package/node_modules/level/browser.js +1 -0
- package/node_modules/level/index.d.ts +75 -0
- package/node_modules/level/index.js +1 -0
- package/node_modules/level/package.json +62 -0
- package/node_modules/level-supports/CHANGELOG.md +140 -0
- package/node_modules/level-supports/LICENSE +21 -0
- package/node_modules/level-supports/README.md +276 -0
- package/node_modules/level-supports/index.d.ts +137 -0
- package/node_modules/level-supports/index.js +26 -0
- package/node_modules/level-supports/package.json +46 -0
- package/node_modules/level-supports/test/cloneable.js +26 -0
- package/node_modules/level-supports/test/index.js +24 -0
- package/node_modules/level-supports/test/self.js +86 -0
- package/node_modules/level-supports/test/shape.js +23 -0
- package/node_modules/level-transcoder/CHANGELOG.md +15 -0
- package/node_modules/level-transcoder/LICENSE +21 -0
- package/node_modules/level-transcoder/README.md +214 -0
- package/node_modules/level-transcoder/UPGRADING.md +13 -0
- package/node_modules/level-transcoder/index.d.ts +27 -0
- package/node_modules/level-transcoder/index.js +158 -0
- package/node_modules/level-transcoder/lib/encoding.d.ts +158 -0
- package/node_modules/level-transcoder/lib/encoding.js +105 -0
- package/node_modules/level-transcoder/lib/encodings.d.ts +9 -0
- package/node_modules/level-transcoder/lib/encodings.js +135 -0
- package/node_modules/level-transcoder/lib/formats.d.ts +13 -0
- package/node_modules/level-transcoder/lib/formats.js +111 -0
- package/node_modules/level-transcoder/lib/text-endec.d.ts +6 -0
- package/node_modules/level-transcoder/lib/text-endec.js +19 -0
- package/node_modules/level-transcoder/package.json +46 -0
- package/node_modules/maybe-combine-errors/LICENSE.md +21 -0
- package/node_modules/maybe-combine-errors/README.md +94 -0
- package/node_modules/maybe-combine-errors/index.js +60 -0
- package/node_modules/maybe-combine-errors/package.json +33 -0
- package/node_modules/module-error/CHANGELOG.md +23 -0
- package/node_modules/module-error/LICENSE +21 -0
- package/node_modules/module-error/README.md +89 -0
- package/node_modules/module-error/index.d.ts +18 -0
- package/node_modules/module-error/index.js +22 -0
- package/node_modules/module-error/package.json +36 -0
- package/node_modules/napi-macros/LICENSE +21 -0
- package/node_modules/napi-macros/README.md +277 -0
- package/node_modules/napi-macros/index.js +1 -0
- package/node_modules/napi-macros/napi-macros.h +255 -0
- package/node_modules/napi-macros/package.json +22 -0
- package/node_modules/node-gyp-build/LICENSE +21 -0
- package/node_modules/node-gyp-build/README.md +58 -0
- package/node_modules/node-gyp-build/SECURITY.md +5 -0
- package/node_modules/node-gyp-build/bin.js +84 -0
- package/node_modules/node-gyp-build/build-test.js +19 -0
- package/node_modules/node-gyp-build/index.js +6 -0
- package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/node_modules/node-gyp-build/optional.js +7 -0
- package/node_modules/node-gyp-build/package.json +43 -0
- package/oauthTokenStore-PADKLNOC.js +23 -0
- package/package.json +6 -3
- package/processSpawn-SOAV3FEV.js +11 -0
- package/profileConfig-ZGOFORWV.js +43 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-HIPK67DU.js} +9 -9
- package/{providerRegistry-757OWH3O.js → providerRegistry-AI4U2FNM.js} +13 -9
- package/{read-COE3ZYR6.js → read-RNUQ7F34.js} +11 -7
- package/{readDocTool-5USN4A6V.js → readDocTool-6WIZHE6O.js} +5 -3
- package/{readlineWorkspace-HO62DKCG.js → readlineWorkspace-P3I7ZJUP.js} +6948 -3879
- package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-EFQ4O2IQ.js} +27 -26
- package/{runAgentClientLoop-JLRJIF3F.js → runAgentClientLoop-AYNL3KMJ.js} +150 -90
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-5CIWJEZ3.js} +36 -8
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/setDialogExtraReferencesAction-MXAH2KPV.js +37 -0
- package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-7OPVNK4M.js} +28 -27
- package/{chunk-GP5LKBUZ.js → settingThunks-GHVLHABJ.js} +240 -945
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-QC35EQY4.js} +3 -3
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-5GLCWZPO.js → spaceCommands-WZCLRGBO.js} +56 -55
- package/{streamAgentChatTurn-DZ3PP7ZH.js → streamAgentChatTurn-O5T3B4B3.js} +325 -1557
- package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-4PANDG3L.js} +24 -20
- package/{tableCommands-O6NWHFKV.js → tableCommands-U3QDY4L6.js} +19 -17
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-54CXTU7C.js} +5 -4
- package/tools-UMU2DYQX.js +122 -0
- package/{tuiSummaryLlmCaller-OHHFTHMG.js → tuiSummaryLlmCaller-ISODIW2O.js} +15 -29
- package/{updateCommands-2M74UL7P.js → updateCommands-NQXAGFM7.js} +3 -3
- package/{updateDialogTitleAction-VWZT4J6J.js → updateDialogTitleAction-TIS2SETN.js} +101 -57
- package/action-P4TNFGAD.js +0 -31
- package/agentListCommands-B2V4YAC4.js +0 -410
- package/agentRecordCommands-XBVDEYVC.js +0 -128
- package/agentRunCommand-V6RTNFRH.js +0 -156
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-XMFWRG3P.js +0 -186
- package/chunk-ACTMNVHM.js +0 -93
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- package/chunk-N4G4PKQ6.js +0 -23
- package/chunk-PUOC4YRO.js +0 -394
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-QQWJUHSL.js +0 -34
- package/chunk-S7Z2HMCN.js +0 -25
- package/chunk-TWQWYIMJ.js +0 -21409
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/contentThunks-3Z6NAUW6.js +0 -73
- package/createDialogAction-7XW3RX2A.js +0 -65
- package/dialogCommands-H7FPUYUQ.js +0 -99
- package/handleSendMessageAction-GUBOMCGM.js +0 -633
- package/machineWsRunDispatch-AAG6PDBY.js +0 -144
- package/setDialogExtraReferencesAction-WX5VTY6O.js +0 -30
- package/settingSlice-P4ZW7K5X.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-XA4ZWLH4.js +0 -110
- package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
- package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findPotentialSecrets
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VJVNU77E.js";
|
|
4
4
|
import {
|
|
5
5
|
buildLocalRunEnv,
|
|
6
6
|
isFullstackCodingAgentRef,
|
|
@@ -9,15 +9,34 @@ import {
|
|
|
9
9
|
resolveRawAgentInput,
|
|
10
10
|
resolveServerUrl,
|
|
11
11
|
writeUsage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4MSYSHZD.js";
|
|
13
|
+
import {
|
|
14
|
+
getReadableCliDb
|
|
15
|
+
} from "./chunk-V6WXGTUJ.js";
|
|
16
|
+
import {
|
|
17
|
+
_appendEntityBatch,
|
|
18
|
+
_appendEvidenceBatch,
|
|
19
|
+
_appendRelationBatch,
|
|
20
|
+
_appendRetiredStateBatch,
|
|
21
|
+
_appendStateBatch,
|
|
22
|
+
getMemoryEntityVNext,
|
|
23
|
+
getMemoryEvidenceVNext,
|
|
24
|
+
getMemoryEvidenceVNextStrict,
|
|
25
|
+
getMemoryStateVNext,
|
|
26
|
+
listMemoryStatesForEntityVNext,
|
|
27
|
+
loadMemoryVNextCatalog,
|
|
28
|
+
putMemoryEvidenceVNext
|
|
29
|
+
} from "./chunk-TY3TIUJK.js";
|
|
30
|
+
import {
|
|
31
|
+
readDbRecord,
|
|
32
|
+
resolveAgentRecordFromHybridStore
|
|
33
|
+
} from "./chunk-A337PRRR.js";
|
|
13
34
|
import {
|
|
14
35
|
resolveMachineId
|
|
15
36
|
} from "./chunk-ESHYE7WU.js";
|
|
16
37
|
import {
|
|
17
|
-
agentRunCardLabels,
|
|
18
38
|
createCliLocalRuntimeAdapter,
|
|
19
39
|
detectCurrentMachineId,
|
|
20
|
-
getCliLocale,
|
|
21
40
|
isBuiltinNoloAgentRef,
|
|
22
41
|
isCliProviderAgentConfig,
|
|
23
42
|
isLiveAgentRunObservation,
|
|
@@ -27,179 +46,303 @@ import {
|
|
|
27
46
|
resolveAuthToken as resolveAuthToken2,
|
|
28
47
|
resolveBoundMachineId,
|
|
29
48
|
resolveFileWriteGateEnabled,
|
|
30
|
-
resolveLocalUserId
|
|
31
|
-
|
|
32
|
-
toolLabel
|
|
33
|
-
} from "./chunk-BVGTK7MR.js";
|
|
34
|
-
import {
|
|
35
|
-
createRunActivityTracker,
|
|
36
|
-
popSingleQueueMessage,
|
|
37
|
-
readRunRecord,
|
|
38
|
-
resolveRunQueuePath,
|
|
39
|
-
settleRunTerminalAuthoritatively,
|
|
40
|
-
spawnLocalBackgroundRun
|
|
41
|
-
} from "./chunk-I3TQJXQ7.js";
|
|
49
|
+
resolveLocalUserId
|
|
50
|
+
} from "./chunk-QH2QSBGP.js";
|
|
42
51
|
import {
|
|
43
52
|
clearCredentialAvailability,
|
|
44
53
|
readCredentialEntry,
|
|
45
|
-
recordCredentialProbe
|
|
46
|
-
|
|
47
|
-
} from "./chunk-42V6BK2E.js";
|
|
48
|
-
import {
|
|
49
|
-
getReadableCliDb
|
|
50
|
-
} from "./chunk-LS2ZANRJ.js";
|
|
54
|
+
recordCredentialProbe
|
|
55
|
+
} from "./chunk-6MXDOUMH.js";
|
|
51
56
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
agentRunCardLabels,
|
|
58
|
+
getCliLocale,
|
|
59
|
+
t,
|
|
60
|
+
toolLabel,
|
|
61
|
+
toolLabelVariants
|
|
62
|
+
} from "./chunk-6CCAXGFK.js";
|
|
55
63
|
import {
|
|
56
64
|
isLocalCliAgentKey
|
|
57
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-NBTY7YJF.js";
|
|
58
66
|
import {
|
|
59
67
|
CliProviderQuotaError
|
|
60
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-4XEYAFLY.js";
|
|
69
|
+
import {
|
|
70
|
+
extractGoogleValidationLink
|
|
71
|
+
} from "./chunk-BMQ2MJUK.js";
|
|
61
72
|
import {
|
|
62
73
|
applyModelLayerOverride,
|
|
63
74
|
buildModelLayerOverride
|
|
64
75
|
} from "./chunk-LTRXGFMS.js";
|
|
65
|
-
import {
|
|
66
|
-
formatAgentListCard
|
|
67
|
-
} from "./chunk-AG2AZ6GX.js";
|
|
68
76
|
import {
|
|
69
77
|
isTransientFetchError
|
|
70
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-APO5TOXO.js";
|
|
79
|
+
import {
|
|
80
|
+
parseUiCard,
|
|
81
|
+
uiCardFallback
|
|
82
|
+
} from "./chunk-DGDGNYI5.js";
|
|
71
83
|
import {
|
|
72
84
|
isGatewayHttpStatus
|
|
73
85
|
} from "./chunk-NF64D32W.js";
|
|
74
86
|
import {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
formatNotFoundRunCard,
|
|
78
|
-
formatStartRunCard,
|
|
79
|
-
formatStatusRunCard,
|
|
80
|
-
formatStopRunCard,
|
|
81
|
-
isAgentRunTerminalStatus
|
|
82
|
-
} from "./chunk-3VNWWVKB.js";
|
|
83
|
-
import {
|
|
84
|
-
extractGoogleValidationLink
|
|
85
|
-
} from "./chunk-BMQ2MJUK.js";
|
|
87
|
+
parsePositiveFiniteNumberOrFallback
|
|
88
|
+
} from "./chunk-XPWGOTBQ.js";
|
|
86
89
|
import {
|
|
87
90
|
buildMemorySubjectsForAgent,
|
|
88
91
|
chooseMemoryOwners,
|
|
89
92
|
loadMemoryCandidatesFromDb,
|
|
90
93
|
resolveAgentMemoryPolicy
|
|
91
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-26UZ2Y4Z.js";
|
|
92
95
|
import {
|
|
93
96
|
API_REPORTED_COST_MULTIPLIER,
|
|
94
97
|
parseUiAskChoiceContent
|
|
95
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-ROXFUKKL.js";
|
|
96
99
|
import {
|
|
97
100
|
isOAuthApiKeyRef
|
|
98
|
-
} from "./chunk-
|
|
99
|
-
import {
|
|
100
|
-
isCliAuthorityBrokerProtocolError,
|
|
101
|
-
isCliAuthorityBrokerTimeoutError,
|
|
102
|
-
isCliAuthorityBrokerUnavailableError
|
|
103
|
-
} from "./chunk-TRV2MIDW.js";
|
|
104
|
-
import {
|
|
105
|
-
getDefaultCliLocalRuntimeDb
|
|
106
|
-
} from "./chunk-2F7RJC6L.js";
|
|
107
|
-
import {
|
|
108
|
-
buildSkillDiscoveryContextLayer
|
|
109
|
-
} from "./chunk-E4MARS3Q.js";
|
|
101
|
+
} from "./chunk-UKZX3NHN.js";
|
|
110
102
|
import {
|
|
111
103
|
parseExternalSkillMarkdown,
|
|
112
104
|
parseSkillDocProtocol
|
|
113
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-XETG4RIX.js";
|
|
114
106
|
import {
|
|
115
107
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
116
108
|
LOCAL_TURN_ABORTED_CODE,
|
|
117
109
|
readActionGate
|
|
118
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-NLEJWKF5.js";
|
|
119
111
|
import {
|
|
120
112
|
resolveAgentRuntimeConfigFromRecord
|
|
121
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-G23MQWLJ.js";
|
|
122
114
|
import {
|
|
123
115
|
createThinkParserState,
|
|
124
116
|
flushThinkParser,
|
|
125
117
|
processThinkChunk
|
|
126
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-56GBUMO5.js";
|
|
127
119
|
import {
|
|
120
|
+
ATTACHMENT_PART_TYPE,
|
|
121
|
+
ATTACHMENT_PART_VERSION,
|
|
122
|
+
describeAttachmentForModel,
|
|
123
|
+
normalizeAttachmentPart
|
|
124
|
+
} from "./chunk-WJZOQR2J.js";
|
|
125
|
+
import {
|
|
126
|
+
PROBE_INTERVAL_MS,
|
|
128
127
|
QUOTA_ERROR_PATTERNS,
|
|
129
128
|
isQuotaExhaustedError,
|
|
130
129
|
isQuotaLimited403Body,
|
|
131
130
|
mergeAvailabilityDeadline,
|
|
132
|
-
resolveCooldownGate
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
isAntigravityOAuthAgent
|
|
136
|
-
} from "./chunk-UZGQNTVW.js";
|
|
131
|
+
resolveCooldownGate,
|
|
132
|
+
resolveCredentialKeyWithFallback
|
|
133
|
+
} from "./chunk-3MZAGMYY.js";
|
|
137
134
|
import {
|
|
138
|
-
|
|
139
|
-
} from "./chunk-
|
|
135
|
+
normalizeUsage
|
|
136
|
+
} from "./chunk-VSPO4S33.js";
|
|
140
137
|
import {
|
|
141
138
|
DEFAULT_CONTEXT_WINDOW,
|
|
142
|
-
getModelContextWindow
|
|
143
|
-
|
|
144
|
-
} from "./chunk-HKNXJGEC.js";
|
|
139
|
+
getModelContextWindow
|
|
140
|
+
} from "./chunk-FWY6BHIJ.js";
|
|
145
141
|
import {
|
|
146
142
|
clipCompactText
|
|
147
|
-
} from "./chunk-
|
|
148
|
-
import {
|
|
149
|
-
findModelConfig
|
|
150
|
-
} from "./chunk-OIVSQH2O.js";
|
|
143
|
+
} from "./chunk-5MMAK75Q.js";
|
|
151
144
|
import {
|
|
152
145
|
compactWhitespace
|
|
153
146
|
} from "./chunk-DWLEOOGR.js";
|
|
147
|
+
import {
|
|
148
|
+
BUILTIN_NOLO_AGENT_KEY,
|
|
149
|
+
BUILTIN_NOLO_AGENT_NAME,
|
|
150
|
+
builtinAgentCatalogEntryById,
|
|
151
|
+
parseBuiltinPlatformAgentId
|
|
152
|
+
} from "./chunk-3LI5UCTU.js";
|
|
153
|
+
import {
|
|
154
|
+
parsePublicAgentId
|
|
155
|
+
} from "./chunk-M2EJHDJP.js";
|
|
156
|
+
import {
|
|
157
|
+
createMemoryKey,
|
|
158
|
+
ulid
|
|
159
|
+
} from "./chunk-RLRYVSCD.js";
|
|
160
|
+
import {
|
|
161
|
+
isAntigravityOAuthAgent
|
|
162
|
+
} from "./chunk-TSBCYK5F.js";
|
|
163
|
+
import {
|
|
164
|
+
createRunActivityTracker,
|
|
165
|
+
getRunResultHeaderMeta,
|
|
166
|
+
popSingleQueueMessage,
|
|
167
|
+
readRunRecord,
|
|
168
|
+
recordRunResultHeaderMeta,
|
|
169
|
+
resolveResultServerMeta,
|
|
170
|
+
resolveRunQueuePath,
|
|
171
|
+
serverOriginForDialog,
|
|
172
|
+
settleRunTerminalAuthoritatively,
|
|
173
|
+
spawnLocalBackgroundRun
|
|
174
|
+
} from "./chunk-MHD5JBSS.js";
|
|
175
|
+
import {
|
|
176
|
+
formatAgentListCard,
|
|
177
|
+
formatFinishedRunCard,
|
|
178
|
+
formatListRunsCard,
|
|
179
|
+
formatNotFoundRunCard,
|
|
180
|
+
formatStartRunCard,
|
|
181
|
+
formatStatusRunCard,
|
|
182
|
+
formatStopRunCard,
|
|
183
|
+
isAgentRunTerminalStatus
|
|
184
|
+
} from "./chunk-PJNFNEJE.js";
|
|
185
|
+
import {
|
|
186
|
+
resolveClientVersion
|
|
187
|
+
} from "./chunk-KY6GPQ7O.js";
|
|
188
|
+
import {
|
|
189
|
+
findModelConfig
|
|
190
|
+
} from "./chunk-CGEK73JN.js";
|
|
191
|
+
import {
|
|
192
|
+
asTrimmedString
|
|
193
|
+
} from "./chunk-3EUW3WEO.js";
|
|
194
|
+
import {
|
|
195
|
+
isCliAuthorityBrokerProtocolError,
|
|
196
|
+
isCliAuthorityBrokerTimeoutError,
|
|
197
|
+
isCliAuthorityBrokerUnavailableError
|
|
198
|
+
} from "./chunk-EXAJ6DCR.js";
|
|
154
199
|
import {
|
|
155
200
|
toErrorMessage
|
|
156
201
|
} from "./chunk-HNMXYYJR.js";
|
|
157
202
|
import {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
buildMemoryUseGuidanceLayer,
|
|
161
|
-
partitionScopedBlocks,
|
|
162
|
-
renderTurnContextBlocksWithScope
|
|
163
|
-
} from "./chunk-DVINR3PL.js";
|
|
203
|
+
getDefaultCliLocalRuntimeDb
|
|
204
|
+
} from "./chunk-2C47W7IJ.js";
|
|
164
205
|
import {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
} from "./chunk-
|
|
206
|
+
getLogger,
|
|
207
|
+
normalizeError
|
|
208
|
+
} from "./chunk-EYLGAEB4.js";
|
|
168
209
|
import {
|
|
169
210
|
resolveAuthToken
|
|
170
211
|
} from "./chunk-A7GB5UGH.js";
|
|
212
|
+
import {
|
|
213
|
+
asOptionalTrimmedString
|
|
214
|
+
} from "./chunk-G3SUCT4W.js";
|
|
215
|
+
import {
|
|
216
|
+
readPipeText,
|
|
217
|
+
spawnProcess
|
|
218
|
+
} from "./chunk-Y6ROFCZO.js";
|
|
171
219
|
import {
|
|
172
220
|
CLIENT_VERSION_TOO_OLD_CODE,
|
|
173
221
|
NOLO_CLIENT_VERSION_HEADER,
|
|
174
222
|
buildClientVersionUpgradeMessage
|
|
175
|
-
} from "./chunk-
|
|
176
|
-
import {
|
|
177
|
-
parsePositiveFiniteNumberOrFallback
|
|
178
|
-
} from "./chunk-Y5GCAMGP.js";
|
|
179
|
-
import {
|
|
180
|
-
createMemoryKey,
|
|
181
|
-
ulid
|
|
182
|
-
} from "./chunk-VMFTFOWF.js";
|
|
223
|
+
} from "./chunk-SZC4REES.js";
|
|
183
224
|
import {
|
|
184
225
|
asTrimmedLowercaseString
|
|
185
226
|
} from "./chunk-QSJ3HFEF.js";
|
|
186
227
|
import {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
builtinAgentCatalogEntryById
|
|
190
|
-
} from "./chunk-BNGW5ASC.js";
|
|
191
|
-
import {
|
|
192
|
-
parsePublicAgentId
|
|
193
|
-
} from "./chunk-M2EJHDJP.js";
|
|
194
|
-
import {
|
|
195
|
-
isLevelNotFoundError
|
|
196
|
-
} from "./chunk-OW765XBU.js";
|
|
197
|
-
import {
|
|
198
|
-
asTrimmedString
|
|
199
|
-
} from "./chunk-3EUW3WEO.js";
|
|
228
|
+
buildSkillDiscoveryContextLayer
|
|
229
|
+
} from "./chunk-AU7AXHUL.js";
|
|
200
230
|
import {
|
|
201
|
-
|
|
202
|
-
|
|
231
|
+
buildAgentsMdLayer,
|
|
232
|
+
buildMemoryOverlayLayer,
|
|
233
|
+
buildMemoryUseGuidanceLayer,
|
|
234
|
+
partitionScopedBlocks,
|
|
235
|
+
renderTurnContextBlocksWithScope
|
|
236
|
+
} from "./chunk-VEA7H5FG.js";
|
|
237
|
+
|
|
238
|
+
// packages/cli/tui/localAttachmentParts.ts
|
|
239
|
+
import { statSync } from "node:fs";
|
|
240
|
+
import path from "node:path";
|
|
241
|
+
var EXT_MIME = {
|
|
242
|
+
jpg: "image/jpeg",
|
|
243
|
+
jpeg: "image/jpeg",
|
|
244
|
+
png: "image/png",
|
|
245
|
+
gif: "image/gif",
|
|
246
|
+
webp: "image/webp",
|
|
247
|
+
bmp: "image/bmp",
|
|
248
|
+
tif: "image/tiff",
|
|
249
|
+
tiff: "image/tiff",
|
|
250
|
+
heic: "image/heic",
|
|
251
|
+
heif: "image/heif",
|
|
252
|
+
svg: "image/svg+xml",
|
|
253
|
+
mp3: "audio/mpeg",
|
|
254
|
+
m4a: "audio/mp4",
|
|
255
|
+
wav: "audio/wav",
|
|
256
|
+
ogg: "audio/ogg",
|
|
257
|
+
oga: "audio/ogg",
|
|
258
|
+
opus: "audio/opus",
|
|
259
|
+
flac: "audio/flac",
|
|
260
|
+
aac: "audio/aac",
|
|
261
|
+
amr: "audio/amr",
|
|
262
|
+
wma: "audio/x-ms-wma",
|
|
263
|
+
mp4: "video/mp4",
|
|
264
|
+
m4v: "video/x-m4v",
|
|
265
|
+
mov: "video/quicktime",
|
|
266
|
+
mkv: "video/x-matroska",
|
|
267
|
+
webm: "video/webm",
|
|
268
|
+
avi: "video/x-msvideo",
|
|
269
|
+
wmv: "video/x-ms-wmv",
|
|
270
|
+
mpg: "video/mpeg",
|
|
271
|
+
mpeg: "video/mpeg",
|
|
272
|
+
"3gp": "video/3gpp",
|
|
273
|
+
flv: "video/x-flv",
|
|
274
|
+
pdf: "application/pdf",
|
|
275
|
+
txt: "text/plain",
|
|
276
|
+
md: "text/markdown",
|
|
277
|
+
json: "application/json",
|
|
278
|
+
csv: "text/csv",
|
|
279
|
+
zip: "application/zip",
|
|
280
|
+
apk: "application/vnd.android.package-archive"
|
|
281
|
+
};
|
|
282
|
+
var mimeTypeForLocalPath = (filePath) => {
|
|
283
|
+
const ext = path.extname(filePath).slice(1).toLowerCase();
|
|
284
|
+
return EXT_MIME[ext] ?? "application/octet-stream";
|
|
285
|
+
};
|
|
286
|
+
var defaultStatSize = (filePath) => {
|
|
287
|
+
try {
|
|
288
|
+
const stat = statSync(filePath);
|
|
289
|
+
return stat.isFile() ? stat.size : null;
|
|
290
|
+
} catch {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
var buildLocalAttachments = (input) => {
|
|
295
|
+
const machineId = typeof input.machineId === "string" ? input.machineId.trim() : "";
|
|
296
|
+
const workspaceRoot = typeof input.workspaceRoot === "string" ? input.workspaceRoot.trim() : "";
|
|
297
|
+
const statSize = input.statSize ?? defaultStatSize;
|
|
298
|
+
const mimeTypeOf = input.mimeTypeOf ?? mimeTypeForLocalPath;
|
|
299
|
+
const parts = [];
|
|
300
|
+
const skipped = [];
|
|
301
|
+
const seen = /* @__PURE__ */ new Set();
|
|
302
|
+
for (const raw of input.paths) {
|
|
303
|
+
const filePath = typeof raw === "string" ? raw.trim() : "";
|
|
304
|
+
if (!filePath || seen.has(filePath)) continue;
|
|
305
|
+
seen.add(filePath);
|
|
306
|
+
if (!machineId) {
|
|
307
|
+
skipped.push({ path: filePath, reason: "machine-unbound" });
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const size = statSize(filePath);
|
|
311
|
+
if (size === null || !Number.isFinite(size) || size < 0) {
|
|
312
|
+
skipped.push({ path: filePath, reason: "unreadable" });
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
const normalized = normalizeAttachmentPart({
|
|
316
|
+
type: ATTACHMENT_PART_TYPE,
|
|
317
|
+
v: ATTACHMENT_PART_VERSION,
|
|
318
|
+
source: {
|
|
319
|
+
kind: "local-file",
|
|
320
|
+
path: filePath,
|
|
321
|
+
machineId,
|
|
322
|
+
...workspaceRoot ? { workspaceRoot } : {}
|
|
323
|
+
},
|
|
324
|
+
name: path.basename(filePath),
|
|
325
|
+
mimeType: mimeTypeOf(filePath),
|
|
326
|
+
size
|
|
327
|
+
});
|
|
328
|
+
if (normalized.status !== "valid") {
|
|
329
|
+
skipped.push({ path: filePath, reason: "invalid-part" });
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
parts.push(normalized.attachment);
|
|
333
|
+
}
|
|
334
|
+
const cardText = parts.map((part) => describeAttachmentForModel(part)).join("\n");
|
|
335
|
+
return { parts, skipped, cardText };
|
|
336
|
+
};
|
|
337
|
+
var appendAttachmentCard = (message, cardText) => {
|
|
338
|
+
if (!cardText) return message;
|
|
339
|
+
return message.trim() ? `${message}
|
|
340
|
+
|
|
341
|
+
${cardText}` : cardText;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// packages/chat/messages/attachmentWriteRollout.ts
|
|
345
|
+
var ENABLE_REMOTE_ATTACHMENT_PART_WRITES = false;
|
|
203
346
|
|
|
204
347
|
// packages/cli/client/tokenUsage.ts
|
|
205
348
|
var PLATFORM_CREDIT_UNIT = "credits";
|
|
@@ -211,7 +354,9 @@ function resolveEffectiveModel(opts) {
|
|
|
211
354
|
if (isUsableModelId(opts.model)) return opts.model;
|
|
212
355
|
const agentKey = opts.agentKey?.trim();
|
|
213
356
|
if (!agentKey) return void 0;
|
|
214
|
-
return builtinAgentCatalogEntryById(
|
|
357
|
+
return builtinAgentCatalogEntryById(
|
|
358
|
+
parseBuiltinPlatformAgentId(agentKey) ?? parsePublicAgentId(agentKey)
|
|
359
|
+
)?.model;
|
|
215
360
|
}
|
|
216
361
|
function resolveAgentModelIdentity(opts) {
|
|
217
362
|
const model = resolveEffectiveModel(opts);
|
|
@@ -1008,11 +1153,17 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
1008
1153
|
activeStyles.push(value);
|
|
1009
1154
|
}
|
|
1010
1155
|
};
|
|
1156
|
+
let lastContentTokenIndex = -1;
|
|
1157
|
+
for (let i = tokens.length - 1; i >= 0; i -= 1) {
|
|
1158
|
+
if (tokens[i].kind !== "sgr") {
|
|
1159
|
+
lastContentTokenIndex = i;
|
|
1160
|
+
break;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
let plainCharIndexAtStart = 0;
|
|
1011
1164
|
let start = 0;
|
|
1012
1165
|
while (start < tokens.length) {
|
|
1013
|
-
if (
|
|
1014
|
-
if (rows.length > 0) break;
|
|
1015
|
-
}
|
|
1166
|
+
if (start > lastContentTokenIndex && rows.length > 0) break;
|
|
1016
1167
|
const openingStyles = [...activeStyles];
|
|
1017
1168
|
const isContinuation = rows.length > 0;
|
|
1018
1169
|
const currentPrefixWidth = isContinuation ? visibleWidth(hangingIndent) : prefixWidth;
|
|
@@ -1060,13 +1211,7 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
1060
1211
|
let segSourceEnd = lineSourceStart;
|
|
1061
1212
|
let foundFirst = false;
|
|
1062
1213
|
const rowMapping = [];
|
|
1063
|
-
let plainCharIndex =
|
|
1064
|
-
for (let i = 0; i < start; i++) {
|
|
1065
|
-
const tok = tokens[i];
|
|
1066
|
-
if (tok.kind === "char" && tok.charIndex >= prefixCharCount) {
|
|
1067
|
-
plainCharIndex += tok.value.length;
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1214
|
+
let plainCharIndex = plainCharIndexAtStart;
|
|
1070
1215
|
for (let i = start; i < segmentEnd; i++) {
|
|
1071
1216
|
const tok = tokens[i];
|
|
1072
1217
|
if (tok.kind === "char" && tok.charIndex >= prefixCharCount) {
|
|
@@ -1103,6 +1248,7 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
1103
1248
|
if (start >= tokens.length && rawLineLength !== void 0) {
|
|
1104
1249
|
segSourceEnd = lineSourceStart + rawLineLength;
|
|
1105
1250
|
}
|
|
1251
|
+
plainCharIndexAtStart = plainCharIndex;
|
|
1106
1252
|
rows.push({
|
|
1107
1253
|
rendered: rowRendered,
|
|
1108
1254
|
sourceStart: segSourceStart,
|
|
@@ -8206,7 +8352,12 @@ function emitPlainGap(text, keywords, info, accent, warning, reset) {
|
|
|
8206
8352
|
var UNORDERED_LIST_RE = /^(\s*)([-*+])\s+(.+)$/;
|
|
8207
8353
|
var ORDERED_LIST_RE = /^(\s*)(\d+)\.\s+(.+)$/;
|
|
8208
8354
|
var TASK_LIST_RE = /^(\s*)([-*+])\s+\[([ xX])\]\s+(.+)$/;
|
|
8355
|
+
var THEMATIC_BREAK_PATTERN = "(?:(-[ \\t]*){3,}|(\\*[ \\t]*){3,}|(_[ \\t]*){3,})";
|
|
8356
|
+
var THEMATIC_BREAK_RE = new RegExp(`^[ ]{0,3}${THEMATIC_BREAK_PATTERN}$`);
|
|
8209
8357
|
function normalizeListLine(line) {
|
|
8358
|
+
if (THEMATIC_BREAK_RE.test(line)) {
|
|
8359
|
+
return line;
|
|
8360
|
+
}
|
|
8210
8361
|
const task = line.match(TASK_LIST_RE);
|
|
8211
8362
|
if (task) {
|
|
8212
8363
|
const checked = task[3] === "x" || task[3] === "X";
|
|
@@ -8222,12 +8373,99 @@ function normalizeListLine(line) {
|
|
|
8222
8373
|
}
|
|
8223
8374
|
return line;
|
|
8224
8375
|
}
|
|
8376
|
+
var TOOL_TREE_HEADER_RE = /^•\s+(.+?)\s+\((\d+)\)$/;
|
|
8377
|
+
var TOOL_TREE_LEAF_RE = /^([├└]──\s+)(.*?)\s{2}(✓|✗|!)(?:\s+(.*))?$/;
|
|
8378
|
+
var TOOL_SINGLE_RE = /^▸\s+(.+?)(?:\s+·\s+(.*?))?(?:\s{2}(✓|✗|!)(?:\s+(.*))?)$/;
|
|
8379
|
+
function plainToolLine(line) {
|
|
8380
|
+
return stripAnsi2(line);
|
|
8381
|
+
}
|
|
8382
|
+
var TOOL_TREE_GROUP_LABELS = new Set(
|
|
8383
|
+
["execShell", "readFile", "fetchWebpage", "exa_search"].flatMap(toolLabelVariants)
|
|
8384
|
+
);
|
|
8385
|
+
function isKnownToolGroupLabel(label) {
|
|
8386
|
+
return TOOL_TREE_GROUP_LABELS.has(label);
|
|
8387
|
+
}
|
|
8388
|
+
function toolTreeHeaderMatch(line) {
|
|
8389
|
+
const match = plainToolLine(line).match(TOOL_TREE_HEADER_RE);
|
|
8390
|
+
return match && isKnownToolGroupLabel(match[1]) ? match : null;
|
|
8391
|
+
}
|
|
8392
|
+
function isToolTreeHeaderLine(line) {
|
|
8393
|
+
return toolTreeHeaderMatch(line) !== null;
|
|
8394
|
+
}
|
|
8395
|
+
function isToolTreeLeafLine(line) {
|
|
8396
|
+
return TOOL_TREE_LEAF_RE.test(plainToolLine(line));
|
|
8397
|
+
}
|
|
8398
|
+
function isToolSingleLine(line) {
|
|
8399
|
+
return TOOL_SINGLE_RE.test(plainToolLine(line));
|
|
8400
|
+
}
|
|
8401
|
+
function isToolGroupBoundary(cur, next) {
|
|
8402
|
+
return isToolTreeLeafLine(cur) && isToolTreeHeaderLine(next);
|
|
8403
|
+
}
|
|
8404
|
+
function statusColorSeq(marker, brightness) {
|
|
8405
|
+
if (marker === "\u2713") return colorSeq("success", brightness);
|
|
8406
|
+
if (marker === "\u2717") return colorSeq("danger", brightness);
|
|
8407
|
+
return colorSeq("warning", brightness);
|
|
8408
|
+
}
|
|
8409
|
+
function styleTuiToolLine(line, brightness) {
|
|
8410
|
+
const plain = plainToolLine(line);
|
|
8411
|
+
const chrome = colorSeq("chrome", brightness);
|
|
8412
|
+
const muted = colorSeq("muted", brightness);
|
|
8413
|
+
const header = toolTreeHeaderMatch(plain);
|
|
8414
|
+
if (header) {
|
|
8415
|
+
return `${chrome}\u2022${STYLE.reset} ${STYLE.bold}${muted}${header[1]}${STYLE.reset} ${chrome}${STYLE.dim}(${header[2]})${STYLE.reset}`;
|
|
8416
|
+
}
|
|
8417
|
+
const leaf = plain.match(TOOL_TREE_LEAF_RE);
|
|
8418
|
+
if (leaf) {
|
|
8419
|
+
const [, connector, detail, marker, statusDetail] = leaf;
|
|
8420
|
+
let rendered = `${chrome}${connector}${STYLE.reset}${chrome}${detail}${STYLE.reset}`;
|
|
8421
|
+
rendered += ` ${statusColorSeq(marker, brightness)}${marker}${STYLE.reset}`;
|
|
8422
|
+
if (statusDetail) {
|
|
8423
|
+
const metaSeq = marker === "\u2713" ? chrome : statusColorSeq(marker, brightness);
|
|
8424
|
+
rendered += ` ${metaSeq}${STYLE.dim}${statusDetail}${STYLE.reset}`;
|
|
8425
|
+
}
|
|
8426
|
+
return rendered;
|
|
8427
|
+
}
|
|
8428
|
+
const single = plain.match(TOOL_SINGLE_RE);
|
|
8429
|
+
if (single) {
|
|
8430
|
+
const [, label, detail, marker, statusDetail] = single;
|
|
8431
|
+
let rendered = `${chrome}\u25B8${STYLE.reset} ${STYLE.bold}${muted}${label}${STYLE.reset}`;
|
|
8432
|
+
if (detail) rendered += ` ${chrome}\xB7 ${detail}${STYLE.reset}`;
|
|
8433
|
+
rendered += ` ${statusColorSeq(marker, brightness)}${marker}${STYLE.reset}`;
|
|
8434
|
+
if (statusDetail) {
|
|
8435
|
+
const metaSeq = marker === "\u2713" ? chrome : statusColorSeq(marker, brightness);
|
|
8436
|
+
rendered += ` ${metaSeq}${STYLE.dim}${statusDetail}${STYLE.reset}`;
|
|
8437
|
+
}
|
|
8438
|
+
return rendered;
|
|
8439
|
+
}
|
|
8440
|
+
return null;
|
|
8441
|
+
}
|
|
8225
8442
|
function isPolishListLikeLine(line) {
|
|
8226
|
-
return LIST_LIKE_RE_FOR_GUARD.test(normalizeListLine(line));
|
|
8443
|
+
return LIST_LIKE_RE_FOR_GUARD.test(normalizeListLine(plainToolLine(line)));
|
|
8444
|
+
}
|
|
8445
|
+
var LIST_LIKE_RE_FOR_GUARD = /^\s*(?:•|◦|☐|☑|\d+\.)\s|^\s*[\u2460-\u2473]|^\s*[├└]──\s|^\s*▸\s/;
|
|
8446
|
+
function isPolishFenceInteriorLine(line) {
|
|
8447
|
+
return /^\x00F\d+\x00$/.test(line);
|
|
8448
|
+
}
|
|
8449
|
+
function polishHeadingLevel(line) {
|
|
8450
|
+
const match = stripAnsi2(line).match(/^(#{1,6})\s/);
|
|
8451
|
+
return match ? match[1].length : null;
|
|
8452
|
+
}
|
|
8453
|
+
function isPolishHeadingLine(line) {
|
|
8454
|
+
return polishHeadingLevel(line) !== null;
|
|
8455
|
+
}
|
|
8456
|
+
function isPolishIntroLine(line) {
|
|
8457
|
+
const plain = stripAnsi2(line).trimEnd();
|
|
8458
|
+
return plain.endsWith("\uFF1A") || plain.endsWith(":");
|
|
8227
8459
|
}
|
|
8228
|
-
var LIST_LIKE_RE_FOR_GUARD = /^\s*(?:•|☐|☑|\d+\.)\s|^\s*[\u2460-\u2473]|^\s*[├└]──\s/;
|
|
8229
8460
|
function polishBreathInsertsBlankBetween(cur, next) {
|
|
8230
8461
|
if (cur === "" || next === "") return false;
|
|
8462
|
+
if (isPolishFenceInteriorLine(cur) || isPolishFenceInteriorLine(next)) {
|
|
8463
|
+
return false;
|
|
8464
|
+
}
|
|
8465
|
+
if (isPolishIntroLine(cur) && isPolishListLikeLine(next)) return false;
|
|
8466
|
+
if (isPolishHeadingLine(cur) || isPolishHeadingLine(next)) return false;
|
|
8467
|
+
if (isCodeFenceLine(cur) !== isCodeFenceLine(next)) return true;
|
|
8468
|
+
if (isToolGroupBoundary(cur, next)) return true;
|
|
8231
8469
|
return isPolishListLikeLine(cur) !== isPolishListLikeLine(next);
|
|
8232
8470
|
}
|
|
8233
8471
|
function convertMarkdownTablesForTerminal(text) {
|
|
@@ -8296,17 +8534,15 @@ function polishAssistantStructure(text, options = {}) {
|
|
|
8296
8534
|
}
|
|
8297
8535
|
return line;
|
|
8298
8536
|
});
|
|
8299
|
-
const afterHeading = maskedLines.join("\n").replace(/([^\n])\n(#{1,
|
|
8300
|
-
const LIST_LIKE = /^\s*(?:•|☐|☑|\d+\.)\s|^\s*[\u2460-\u2473]|^\s*[├└]──\s/;
|
|
8537
|
+
const afterHeading = maskedLines.join("\n").replace(/([^\n])\n(#{1,6} )/g, "$1\n\n$2").replace(/^(#{1,2} .+)\n(?!\n)/gm, "$1\n\n").replace(new RegExp(`([^\\n])\\n([ ]{0,3}${THEMATIC_BREAK_PATTERN})$`, "gm"), "$1\n\n$2").replace(new RegExp(`^([ ]{0,3}${THEMATIC_BREAK_PATTERN})\\n(?!\\n)`, "gm"), "$1\n\n").replace(/\n{3,}/g, "\n\n");
|
|
8301
8538
|
const headingLines = afterHeading.split("\n");
|
|
8302
8539
|
const breathed = [];
|
|
8303
8540
|
for (let i = 0; i < headingLines.length; i++) {
|
|
8304
8541
|
breathed.push(headingLines[i]);
|
|
8305
8542
|
const cur = headingLines[i];
|
|
8306
8543
|
const next = headingLines[i + 1];
|
|
8307
|
-
if (
|
|
8308
|
-
if (
|
|
8309
|
-
breathed.push("");
|
|
8544
|
+
if (next === void 0) continue;
|
|
8545
|
+
if (polishBreathInsertsBlankBetween(cur, next)) breathed.push("");
|
|
8310
8546
|
}
|
|
8311
8547
|
const polishedMasked = breathed.join("\n");
|
|
8312
8548
|
const polished = polishedMasked.replace(
|
|
@@ -8316,17 +8552,23 @@ function polishAssistantStructure(text, options = {}) {
|
|
|
8316
8552
|
return options.trimEdges === false ? polished : polished.trim();
|
|
8317
8553
|
}
|
|
8318
8554
|
function styleRichMarkdownLine(line, brightness) {
|
|
8319
|
-
const
|
|
8555
|
+
const toolLine = styleTuiToolLine(line, brightness);
|
|
8556
|
+
if (toolLine !== null) return toolLine;
|
|
8557
|
+
const heading = line.match(/^(#{1,6})\s+(.+)$/);
|
|
8320
8558
|
if (heading) {
|
|
8321
8559
|
const level = heading[1].length;
|
|
8322
8560
|
const title = heading[2];
|
|
8561
|
+
const styledTitle = styleInlineMarkdown(title, brightness);
|
|
8323
8562
|
if (level === 1) {
|
|
8324
|
-
return `${STYLE.bold}
|
|
8563
|
+
return `${STYLE.bold}${colorSeq("accent", brightness)}${styledTitle}${STYLE.reset}`;
|
|
8325
8564
|
}
|
|
8326
8565
|
if (level === 2) {
|
|
8327
|
-
return `${STYLE.bold}${colorSeq("warning", brightness)}${
|
|
8566
|
+
return `${STYLE.bold}${colorSeq("warning", brightness)}${styledTitle}${STYLE.reset}`;
|
|
8567
|
+
}
|
|
8568
|
+
if (level === 3) {
|
|
8569
|
+
return `${STYLE.bold}${colorSeq("info", brightness)}${styledTitle}${STYLE.reset}`;
|
|
8328
8570
|
}
|
|
8329
|
-
return `${STYLE.bold}${colorSeq("
|
|
8571
|
+
return `${STYLE.bold}${colorSeq("muted", brightness)}${styledTitle}${STYLE.reset}`;
|
|
8330
8572
|
}
|
|
8331
8573
|
if (line.startsWith("\u8FDB\u5165 nolo-plan")) {
|
|
8332
8574
|
return `${colorSeq("chrome", brightness)}${STYLE.dim}${line}${STYLE.reset}`;
|
|
@@ -8335,15 +8577,19 @@ function styleRichMarkdownLine(line, brightness) {
|
|
|
8335
8577
|
if (blockquote) {
|
|
8336
8578
|
const border = colorSeq("chrome", brightness);
|
|
8337
8579
|
const content = blockquote[1];
|
|
8338
|
-
|
|
8580
|
+
const styled = styleInlineMarkdown(content, brightness);
|
|
8581
|
+
return `${border}\u2502${STYLE.reset} ${STYLE.dim}${styled}${STYLE.reset}`;
|
|
8339
8582
|
}
|
|
8340
|
-
if (
|
|
8341
|
-
return `${colorSeq("chrome", brightness)}${"\u2500".repeat(
|
|
8583
|
+
if (THEMATIC_BREAK_RE.test(line)) {
|
|
8584
|
+
return `${colorSeq("chrome", brightness)}${STYLE.dim}${"\u2500".repeat(36)}${STYLE.reset}`;
|
|
8342
8585
|
}
|
|
8343
8586
|
const bullet = line.match(/^(\s*)(•)\s(.+)$/);
|
|
8344
8587
|
if (bullet) {
|
|
8588
|
+
const indent = bullet[1];
|
|
8345
8589
|
const styled = styleInlineMarkdown(bullet[3], brightness);
|
|
8346
|
-
|
|
8590
|
+
const marker = indent.length >= 2 ? "\u25E6" : "\u2022";
|
|
8591
|
+
const markerColor = indent.length >= 2 ? colorSeq("chrome", brightness) : colorSeq("accent", brightness);
|
|
8592
|
+
return `${indent}${markerColor}${marker}${STYLE.reset} ${styled}`;
|
|
8347
8593
|
}
|
|
8348
8594
|
const ordered = line.match(/^(\s*)(\d+\.)\s(.+)$/);
|
|
8349
8595
|
if (ordered) {
|
|
@@ -8467,16 +8713,28 @@ function emitFormattedAssistantBlock(write, text, trailingNewline = false) {
|
|
|
8467
8713
|
}
|
|
8468
8714
|
function classifyStreamLine(line) {
|
|
8469
8715
|
if (line === "") return "blank";
|
|
8470
|
-
|
|
8716
|
+
const plain = plainToolLine(line);
|
|
8717
|
+
if (isToolTreeHeaderLine(plain)) return "tool-header";
|
|
8718
|
+
if (isToolTreeLeafLine(plain)) return "tool-leaf";
|
|
8719
|
+
if (isToolSingleLine(plain)) return "tool";
|
|
8720
|
+
if (TASK_LIST_RE.test(plain) || UNORDERED_LIST_RE.test(plain) || ORDERED_LIST_RE.test(plain) || /^\s*(?:•|◦|☐|☑)\s/.test(plain) || /^\s*[\u2460-\u2473]/.test(plain)) {
|
|
8471
8721
|
return "list";
|
|
8472
8722
|
}
|
|
8723
|
+
if (isPolishListLikeLine(plain)) return "list";
|
|
8724
|
+
if (polishHeadingLevel(plain) !== null) return "heading";
|
|
8473
8725
|
return "prose";
|
|
8474
8726
|
}
|
|
8475
|
-
function
|
|
8727
|
+
function isStreamListLike(kind) {
|
|
8728
|
+
return kind === "list" || kind === "tool-header" || kind === "tool-leaf" || kind === "tool";
|
|
8729
|
+
}
|
|
8730
|
+
function needsListProseBreath(prev, next, prevLine = "") {
|
|
8476
8731
|
if (prev === null || prev === "blank" || next === "blank") return false;
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8732
|
+
if (next === "heading") return true;
|
|
8733
|
+
if (prev === "heading") return (polishHeadingLevel(prevLine) ?? 7) <= 2;
|
|
8734
|
+
if (prev === "fence" !== (next === "fence")) return true;
|
|
8735
|
+
if (isStreamListLike(next) && isPolishIntroLine(prevLine)) return false;
|
|
8736
|
+
if (prev === "tool-leaf" && next === "tool-header") return true;
|
|
8737
|
+
return isStreamListLike(prev) !== isStreamListLike(next);
|
|
8480
8738
|
}
|
|
8481
8739
|
function createRenderAwareStreamWriter(args) {
|
|
8482
8740
|
const brightness = resolveTuiBrightness();
|
|
@@ -8486,9 +8744,16 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8486
8744
|
let inMermaid = false;
|
|
8487
8745
|
let mermaidBody = [];
|
|
8488
8746
|
let lastKind = null;
|
|
8747
|
+
let lastLine = "";
|
|
8748
|
+
let pendingBlankRow = false;
|
|
8489
8749
|
const PARTIAL_FLUSH_THRESHOLD = 48;
|
|
8490
8750
|
const emitBreathIfNeeded = (nextKind) => {
|
|
8491
|
-
if (
|
|
8751
|
+
if (pendingBlankRow) {
|
|
8752
|
+
args.write("\n");
|
|
8753
|
+
pendingBlankRow = false;
|
|
8754
|
+
lastKind = "blank";
|
|
8755
|
+
}
|
|
8756
|
+
if (needsListProseBreath(lastKind, nextKind, lastLine)) args.write("\n");
|
|
8492
8757
|
};
|
|
8493
8758
|
const flushPartialProse = () => {
|
|
8494
8759
|
if (inFence || buffer.length < PARTIAL_FLUSH_THRESHOLD) return;
|
|
@@ -8506,6 +8771,7 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8506
8771
|
emitBreathIfNeeded("prose");
|
|
8507
8772
|
emitFormattedAssistantBlock(args.write, prefix, false);
|
|
8508
8773
|
lastKind = "prose";
|
|
8774
|
+
lastLine = prefix;
|
|
8509
8775
|
buffer = prefix.length === buffer.length ? "" : buffer.slice(prefix.length);
|
|
8510
8776
|
};
|
|
8511
8777
|
const flushCompleteBlocks = () => {
|
|
@@ -8521,10 +8787,11 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8521
8787
|
inMermaid = false;
|
|
8522
8788
|
inFence = false;
|
|
8523
8789
|
fenceLang = "unknown";
|
|
8524
|
-
emitBreathIfNeeded("
|
|
8790
|
+
emitBreathIfNeeded("fence");
|
|
8525
8791
|
args.write(`${STYLE.dim}${firstLine}${STYLE.reset}
|
|
8526
8792
|
`);
|
|
8527
|
-
lastKind = "
|
|
8793
|
+
lastKind = "fence";
|
|
8794
|
+
lastLine = firstLine;
|
|
8528
8795
|
buffer = lines.slice(1).join("\n");
|
|
8529
8796
|
continue;
|
|
8530
8797
|
}
|
|
@@ -8540,10 +8807,11 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8540
8807
|
}
|
|
8541
8808
|
inFence = true;
|
|
8542
8809
|
}
|
|
8543
|
-
emitBreathIfNeeded("
|
|
8810
|
+
emitBreathIfNeeded("fence");
|
|
8544
8811
|
args.write(`${STYLE.dim}${firstLine}${STYLE.reset}
|
|
8545
8812
|
`);
|
|
8546
|
-
lastKind = "
|
|
8813
|
+
lastKind = "fence";
|
|
8814
|
+
lastLine = firstLine;
|
|
8547
8815
|
buffer = lines.slice(1).join("\n");
|
|
8548
8816
|
continue;
|
|
8549
8817
|
}
|
|
@@ -8555,7 +8823,8 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8555
8823
|
if (inFence) {
|
|
8556
8824
|
args.write(`${highlightCodeLine(firstLine, fenceLang, brightness)}
|
|
8557
8825
|
`);
|
|
8558
|
-
lastKind = "
|
|
8826
|
+
lastKind = "fence";
|
|
8827
|
+
lastLine = firstLine;
|
|
8559
8828
|
buffer = lines.slice(1).join("\n");
|
|
8560
8829
|
continue;
|
|
8561
8830
|
}
|
|
@@ -8568,6 +8837,7 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8568
8837
|
const inner = trimmedFirst.slice(2, trimmedFirst.length - 2);
|
|
8569
8838
|
args.write(renderMathBlock(inner) + "\n");
|
|
8570
8839
|
lastKind = "other";
|
|
8840
|
+
lastLine = trimmedFirst;
|
|
8571
8841
|
buffer = lines.slice(1).join("\n");
|
|
8572
8842
|
continue;
|
|
8573
8843
|
}
|
|
@@ -8594,6 +8864,7 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8594
8864
|
if (lastInner) innerParts.push(lastInner);
|
|
8595
8865
|
args.write(renderMathBlock(innerParts.join("\n")) + "\n");
|
|
8596
8866
|
lastKind = "other";
|
|
8867
|
+
lastLine = trimmedFirst;
|
|
8597
8868
|
buffer = lines.slice(closeIndex + 1).join("\n");
|
|
8598
8869
|
continue;
|
|
8599
8870
|
}
|
|
@@ -8614,14 +8885,23 @@ function createRenderAwareStreamWriter(args) {
|
|
|
8614
8885
|
true
|
|
8615
8886
|
);
|
|
8616
8887
|
lastKind = "list";
|
|
8888
|
+
lastLine = lines[end - 1] ?? firstLine;
|
|
8617
8889
|
buffer = lines.slice(end).join("\n");
|
|
8618
8890
|
continue;
|
|
8619
8891
|
}
|
|
8620
8892
|
}
|
|
8621
8893
|
const kind = classifyStreamLine(firstLine);
|
|
8894
|
+
if (kind === "blank") {
|
|
8895
|
+
if (lastKind !== null && lastKind !== "blank") pendingBlankRow = true;
|
|
8896
|
+
lastKind = "blank";
|
|
8897
|
+
lastLine = "";
|
|
8898
|
+
buffer = lines.slice(1).join("\n");
|
|
8899
|
+
continue;
|
|
8900
|
+
}
|
|
8622
8901
|
emitBreathIfNeeded(kind);
|
|
8623
8902
|
emitFormattedAssistantBlock(args.write, firstLine, true);
|
|
8624
8903
|
lastKind = kind;
|
|
8904
|
+
lastLine = firstLine;
|
|
8625
8905
|
buffer = lines.slice(1).join("\n");
|
|
8626
8906
|
}
|
|
8627
8907
|
};
|
|
@@ -8667,6 +8947,34 @@ function redactSecrets(text) {
|
|
|
8667
8947
|
);
|
|
8668
8948
|
}
|
|
8669
8949
|
|
|
8950
|
+
// packages/cli/tui/askTextSanitize.ts
|
|
8951
|
+
var ASK_SECRET_PLACEHOLDER = "\u27E8redacted\u27E9";
|
|
8952
|
+
var C0_C1_CONTROL_REGEX = /[\x00-\x1f\x7f-\x9f]/g;
|
|
8953
|
+
var NORMAL_GIST_SECRET_PATTERNS = [
|
|
8954
|
+
/\bbearer\s+[A-Za-z0-9._~+/=-]{8,}/i,
|
|
8955
|
+
/\bsk-(?:ant-)?(?:api)?[0-9a-zA-Z-]{10,}/,
|
|
8956
|
+
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{10,}/,
|
|
8957
|
+
/\bxox[baprs]-[A-Za-z0-9-]{10,}/
|
|
8958
|
+
];
|
|
8959
|
+
function withholdIfSecretLike(gist) {
|
|
8960
|
+
if (!gist) return "";
|
|
8961
|
+
if (findPotentialSecrets(gist).length > 0) return "";
|
|
8962
|
+
if (NORMAL_GIST_SECRET_PATTERNS.some((pattern) => pattern.test(gist))) return "";
|
|
8963
|
+
return gist;
|
|
8964
|
+
}
|
|
8965
|
+
function toText(value) {
|
|
8966
|
+
return typeof value === "string" ? value : String(value ?? "");
|
|
8967
|
+
}
|
|
8968
|
+
function cleanAskText(value) {
|
|
8969
|
+
return stripAnsi2(toText(value)).replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").replace(C0_C1_CONTROL_REGEX, "").replace(/\s+/g, " ").trim();
|
|
8970
|
+
}
|
|
8971
|
+
function safeAskText(value, max) {
|
|
8972
|
+
const cleaned = redactSecrets(cleanAskText(value));
|
|
8973
|
+
if (!cleaned) return "";
|
|
8974
|
+
const guarded = withholdIfSecretLike(cleaned) || ASK_SECRET_PLACEHOLDER;
|
|
8975
|
+
return max === void 0 ? guarded : clipCompactText(guarded, max, "\u2026");
|
|
8976
|
+
}
|
|
8977
|
+
|
|
8670
8978
|
// node_modules/diff/libesm/diff/base.js
|
|
8671
8979
|
var Diff = class {
|
|
8672
8980
|
diff(oldStr, newStr, options = {}) {
|
|
@@ -8767,16 +9075,16 @@ var Diff = class {
|
|
|
8767
9075
|
}
|
|
8768
9076
|
}
|
|
8769
9077
|
}
|
|
8770
|
-
addToPath(
|
|
8771
|
-
const last =
|
|
9078
|
+
addToPath(path2, added, removed, oldPosInc, options) {
|
|
9079
|
+
const last = path2.lastComponent;
|
|
8772
9080
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
8773
9081
|
return {
|
|
8774
|
-
oldPos:
|
|
9082
|
+
oldPos: path2.oldPos + oldPosInc,
|
|
8775
9083
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
8776
9084
|
};
|
|
8777
9085
|
} else {
|
|
8778
9086
|
return {
|
|
8779
|
-
oldPos:
|
|
9087
|
+
oldPos: path2.oldPos + oldPosInc,
|
|
8780
9088
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
8781
9089
|
};
|
|
8782
9090
|
}
|
|
@@ -8921,14 +9229,14 @@ function tokenize(value, options) {
|
|
|
8921
9229
|
import { homedir as osHomedir } from "node:os";
|
|
8922
9230
|
|
|
8923
9231
|
// packages/core/foldHomePath.ts
|
|
8924
|
-
function foldHomePath(
|
|
8925
|
-
if (!
|
|
9232
|
+
function foldHomePath(path2, home) {
|
|
9233
|
+
if (!path2) return path2;
|
|
8926
9234
|
if (home) {
|
|
8927
9235
|
const cleanHome = home.endsWith("/") ? home.slice(0, -1) : home;
|
|
8928
|
-
if (
|
|
8929
|
-
if (
|
|
9236
|
+
if (path2 === cleanHome) return "~";
|
|
9237
|
+
if (path2.startsWith(cleanHome + "/")) return `~${path2.slice(cleanHome.length)}`;
|
|
8930
9238
|
}
|
|
8931
|
-
return
|
|
9239
|
+
return path2.replace(/^(\/Users\/[^/]+|\/home\/[^/]+)(\/|$)/, "~$2");
|
|
8932
9240
|
}
|
|
8933
9241
|
|
|
8934
9242
|
// packages/cli/client/formatReadPathTree.ts
|
|
@@ -8955,10 +9263,10 @@ function clipPathAware(value, max = 72) {
|
|
|
8955
9263
|
if (filenameOnly.length <= max) return filenameOnly;
|
|
8956
9264
|
return clipCompactText(value, max, "\u2026");
|
|
8957
9265
|
}
|
|
8958
|
-
function formatHomePath(
|
|
8959
|
-
if (!
|
|
9266
|
+
function formatHomePath(path2, customHomedir) {
|
|
9267
|
+
if (!path2) return "";
|
|
8960
9268
|
const home = customHomedir || (typeof process !== "undefined" ? process.env?.HOME : void 0) || (typeof osHomedir === "function" ? osHomedir() : "");
|
|
8961
|
-
return foldHomePath(
|
|
9269
|
+
return foldHomePath(path2, home);
|
|
8962
9270
|
}
|
|
8963
9271
|
function formatReadItemPath(rawPath, metadata, customHomedir) {
|
|
8964
9272
|
const inputPath = rawPath || (typeof metadata?.path === "string" ? metadata.path : void 0) || (typeof metadata?.filePath === "string" ? metadata.filePath : void 0) || "file";
|
|
@@ -8978,10 +9286,10 @@ function formatReadItemPath(rawPath, metadata, customHomedir) {
|
|
|
8978
9286
|
const clippedPath = clipPathAware(formattedPath, 72);
|
|
8979
9287
|
return `${clippedPath}${rangePart}`;
|
|
8980
9288
|
}
|
|
8981
|
-
function formatSearchItemQuery(query,
|
|
9289
|
+
function formatSearchItemQuery(query, path2, customHomedir) {
|
|
8982
9290
|
let text = (query || "").trim();
|
|
8983
|
-
if (
|
|
8984
|
-
const formattedPath = formatHomePath(
|
|
9291
|
+
if (path2) {
|
|
9292
|
+
const formattedPath = formatHomePath(path2, customHomedir);
|
|
8985
9293
|
if (formattedPath) {
|
|
8986
9294
|
text = text ? `${text} in ${formattedPath}` : formattedPath;
|
|
8987
9295
|
}
|
|
@@ -9037,7 +9345,7 @@ function parseUiAskChoiceForCli(event) {
|
|
|
9037
9345
|
label: String(parsed.selected.label ?? "").trim(),
|
|
9038
9346
|
userMessage: String(parsed.selected.userMessage ?? "").trim()
|
|
9039
9347
|
} : void 0;
|
|
9040
|
-
const answers = Array.isArray(parsed.answers) ? parsed.answers : void 0;
|
|
9348
|
+
const answers = Array.isArray(parsed.answers) ? parsed.answers.filter((a) => Boolean(a && typeof a === "object")) : void 0;
|
|
9041
9349
|
const cancelled = Boolean(parsed.cancelled);
|
|
9042
9350
|
const resolved = Boolean(
|
|
9043
9351
|
event.metadata?.resolved || selected || cancelled || answers && answers.length > 0
|
|
@@ -9058,7 +9366,7 @@ function formatUiAskChoiceBlock(event, colorEnabled) {
|
|
|
9058
9366
|
if (!parsed) return null;
|
|
9059
9367
|
const lines = [];
|
|
9060
9368
|
lines.push("");
|
|
9061
|
-
const questionText = parsed.question
|
|
9369
|
+
const questionText = safeAskText(parsed.question, 200);
|
|
9062
9370
|
if (colorEnabled) {
|
|
9063
9371
|
lines.push(`${themeText("\u2753 ", "info", true)}${styleCliText(questionText, "cyan", true)}`);
|
|
9064
9372
|
} else {
|
|
@@ -9073,7 +9381,8 @@ function formatUiAskChoiceBlock(event, colorEnabled) {
|
|
|
9073
9381
|
return `${lines.join("\n")}
|
|
9074
9382
|
`;
|
|
9075
9383
|
}
|
|
9076
|
-
const
|
|
9384
|
+
const rawSelected = parsed.selected?.label || parsed.selected?.userMessage;
|
|
9385
|
+
const selectedLabel = rawSelected ? safeAskText(rawSelected, 160) : parsed.answers ? parsed.answers.map((a) => safeAskText(a.userMessage, 160)).filter(Boolean).join(", ") : "";
|
|
9077
9386
|
const marker = t("askChoiceHistorySelected");
|
|
9078
9387
|
const displayLabel = selectedLabel || "\u2014";
|
|
9079
9388
|
if (colorEnabled) {
|
|
@@ -9086,8 +9395,9 @@ function formatUiAskChoiceBlock(event, colorEnabled) {
|
|
|
9086
9395
|
if (parsed.answers && parsed.answers.length > 1) {
|
|
9087
9396
|
for (const answer of parsed.answers) {
|
|
9088
9397
|
if (!answer.userMessage) continue;
|
|
9398
|
+
const answerText = safeAskText(answer.userMessage, 160);
|
|
9089
9399
|
lines.push(
|
|
9090
|
-
colorEnabled ? ` ${themeText("\xB7", "chrome", true)} ${
|
|
9400
|
+
colorEnabled ? ` ${themeText("\xB7", "chrome", true)} ${answerText}` : ` \xB7 ${answerText}`
|
|
9091
9401
|
);
|
|
9092
9402
|
}
|
|
9093
9403
|
}
|
|
@@ -9096,7 +9406,7 @@ function formatUiAskChoiceBlock(event, colorEnabled) {
|
|
|
9096
9406
|
}
|
|
9097
9407
|
parsed.choices.forEach((choice, i) => {
|
|
9098
9408
|
const num = String(i + 1);
|
|
9099
|
-
const label = choice.label;
|
|
9409
|
+
const label = safeAskText(choice.label, 160);
|
|
9100
9410
|
if (colorEnabled) {
|
|
9101
9411
|
lines.push(
|
|
9102
9412
|
` ${themeText(num + ".", "chrome", true)} ${label}`
|
|
@@ -9112,6 +9422,87 @@ function formatUiAskChoiceBlock(event, colorEnabled) {
|
|
|
9112
9422
|
lines.push(` ${hint}`);
|
|
9113
9423
|
}
|
|
9114
9424
|
return `${lines.join("\n")}
|
|
9425
|
+
`;
|
|
9426
|
+
}
|
|
9427
|
+
function formatShowInteractionBlock(event, colorEnabled) {
|
|
9428
|
+
const label = toolLabel(event.toolName || "show_interaction");
|
|
9429
|
+
let parsedPayload;
|
|
9430
|
+
if (typeof event.content === "string") {
|
|
9431
|
+
try {
|
|
9432
|
+
parsedPayload = JSON.parse(event.content);
|
|
9433
|
+
} catch {
|
|
9434
|
+
const metadata = event.metadata ?? {};
|
|
9435
|
+
const rawMetaError = metadata.error ?? metadata.errorMessage;
|
|
9436
|
+
const rawMessage = event.message?.trim();
|
|
9437
|
+
const rawContent = event.content.trim();
|
|
9438
|
+
let reason = "";
|
|
9439
|
+
if (typeof rawMetaError === "string" && rawMetaError.trim()) {
|
|
9440
|
+
reason = rawMetaError.trim();
|
|
9441
|
+
} else if (rawMessage) {
|
|
9442
|
+
reason = rawMessage;
|
|
9443
|
+
} else if (/^\[工具\s*"[^"]+"\s*执行失败:\s*[^\]]+\]$/.test(rawContent)) {
|
|
9444
|
+
reason = rawContent;
|
|
9445
|
+
}
|
|
9446
|
+
const detail = reason ? clip(redactSecrets(cleanUserText(reason)), 96) : "invalid card payload";
|
|
9447
|
+
return formatToolTraceLine(`\u25B8 ${label} \u2717 ${detail}`, colorEnabled, "error");
|
|
9448
|
+
}
|
|
9449
|
+
} else if (event.content && typeof event.content === "object") {
|
|
9450
|
+
parsedPayload = event.content;
|
|
9451
|
+
} else {
|
|
9452
|
+
const metadata = event.metadata ?? {};
|
|
9453
|
+
const rawMetaError = metadata.error ?? metadata.errorMessage;
|
|
9454
|
+
const reason = typeof rawMetaError === "string" && rawMetaError.trim() || event.message?.trim() || "";
|
|
9455
|
+
const detail = reason ? clip(redactSecrets(cleanUserText(reason)), 96) : "invalid card payload";
|
|
9456
|
+
return formatToolTraceLine(`\u25B8 ${label} \u2717 ${detail}`, colorEnabled, "error");
|
|
9457
|
+
}
|
|
9458
|
+
if (parsedPayload && typeof parsedPayload === "object" && parsedPayload.error) {
|
|
9459
|
+
const detail = typeof parsedPayload.detail === "string" && parsedPayload.detail.trim() ? clip(redactSecrets(cleanUserText(parsedPayload.detail)), 96) : "card error";
|
|
9460
|
+
return formatToolTraceLine(`\u25B8 ${label} \u2717 ${detail}`, colorEnabled, "error");
|
|
9461
|
+
}
|
|
9462
|
+
const rawCard = parsedPayload && typeof parsedPayload === "object" && (parsedPayload.type === "show_interaction" || parsedPayload.card !== void 0) ? parsedPayload.card : parsedPayload;
|
|
9463
|
+
const parsedCard = parseUiCard(rawCard);
|
|
9464
|
+
if (!parsedCard.ok) {
|
|
9465
|
+
const errorText = clip(redactSecrets(cleanUserText(parsedCard.error)), 96);
|
|
9466
|
+
return formatToolTraceLine(`\u25B8 ${label} \u2717 ${errorText}`, colorEnabled, "error");
|
|
9467
|
+
}
|
|
9468
|
+
const fallback = uiCardFallback(parsedCard.value);
|
|
9469
|
+
const maxLines = 12;
|
|
9470
|
+
const maxDisplayWidth = 400;
|
|
9471
|
+
const rawLines = fallback.split("\n");
|
|
9472
|
+
const clippedLines = [];
|
|
9473
|
+
let currentWidth = 0;
|
|
9474
|
+
let wasClipped = false;
|
|
9475
|
+
for (let i = 0; i < rawLines.length; i++) {
|
|
9476
|
+
if (clippedLines.length >= maxLines) {
|
|
9477
|
+
wasClipped = true;
|
|
9478
|
+
break;
|
|
9479
|
+
}
|
|
9480
|
+
const cleanLine = redactSecrets(cleanUserText(rawLines[i]));
|
|
9481
|
+
const lineWidth = displayWidth(cleanLine);
|
|
9482
|
+
const separatorWidth = clippedLines.length > 0 ? 1 : 0;
|
|
9483
|
+
if (currentWidth + lineWidth + separatorWidth > maxDisplayWidth) {
|
|
9484
|
+
const remainingWidth = maxDisplayWidth - currentWidth - separatorWidth;
|
|
9485
|
+
if (remainingWidth > 0) {
|
|
9486
|
+
clippedLines.push(truncateByDisplayWidth(cleanLine, remainingWidth));
|
|
9487
|
+
}
|
|
9488
|
+
wasClipped = true;
|
|
9489
|
+
break;
|
|
9490
|
+
}
|
|
9491
|
+
clippedLines.push(cleanLine);
|
|
9492
|
+
currentWidth += lineWidth + separatorWidth;
|
|
9493
|
+
}
|
|
9494
|
+
if (clippedLines.length === 0 && rawLines.length > 0 && maxDisplayWidth > 0) {
|
|
9495
|
+
const cleanLine = redactSecrets(cleanUserText(rawLines[0]));
|
|
9496
|
+
clippedLines.push(truncateByDisplayWidth(cleanLine, maxDisplayWidth));
|
|
9497
|
+
wasClipped = true;
|
|
9498
|
+
}
|
|
9499
|
+
if (wasClipped) {
|
|
9500
|
+
clippedLines.push("\u2026");
|
|
9501
|
+
}
|
|
9502
|
+
const cleanLines = clippedLines.map((l) => colorEnabled ? themeText(l, "muted", true) : l);
|
|
9503
|
+
return `
|
|
9504
|
+
${cleanLines.join("\n")}
|
|
9505
|
+
|
|
9115
9506
|
`;
|
|
9116
9507
|
}
|
|
9117
9508
|
function formatToolTraceLine(text, colorEnabled, accent = "none") {
|
|
@@ -9134,6 +9525,7 @@ function renderRunCard(snapshot, opts) {
|
|
|
9134
9525
|
...snapshot,
|
|
9135
9526
|
agentName: snapshot.agentName ? cleanUserText(snapshot.agentName) : snapshot.agentName,
|
|
9136
9527
|
taskPreview: snapshot.taskPreview ? cleanUserText(snapshot.taskPreview) : snapshot.taskPreview,
|
|
9528
|
+
title: snapshot.title ? cleanUserText(snapshot.title) : snapshot.title,
|
|
9137
9529
|
lastAssistantText: snapshot.lastAssistantText ? cleanUserText(snapshot.lastAssistantText) : snapshot.lastAssistantText,
|
|
9138
9530
|
lastToolNames: snapshot.lastToolNames?.map(cleanUserText)
|
|
9139
9531
|
} : snapshot;
|
|
@@ -9144,6 +9536,7 @@ function renderRunCard(snapshot, opts) {
|
|
|
9144
9536
|
} : { errorMessage: source.errorMessage, logLines: source.logLines };
|
|
9145
9537
|
const body = isAgentRunTerminalStatus(snapshot.status) ? formatFinishedRunCard(name, snapshot.status, {
|
|
9146
9538
|
runId: snapshot.runId,
|
|
9539
|
+
...snapshot.title ? { title: snapshot.title } : {},
|
|
9147
9540
|
toolCallCount: source.toolCallCount,
|
|
9148
9541
|
lastToolNames: source.lastToolNames,
|
|
9149
9542
|
lastAssistantText: source.lastAssistantText,
|
|
@@ -9153,6 +9546,7 @@ function renderRunCard(snapshot, opts) {
|
|
|
9153
9546
|
labels
|
|
9154
9547
|
}) : formatStatusRunCard(name, snapshot.status, {
|
|
9155
9548
|
runId: snapshot.runId,
|
|
9549
|
+
...snapshot.title ? { title: snapshot.title } : {},
|
|
9156
9550
|
toolCallCount: source.toolCallCount,
|
|
9157
9551
|
lastToolNames: source.lastToolNames,
|
|
9158
9552
|
lastAssistantText: source.lastAssistantText,
|
|
@@ -9173,7 +9567,10 @@ function recoverOrchestrationCard(event, toolName, opts) {
|
|
|
9173
9567
|
try {
|
|
9174
9568
|
const parsed = JSON.parse(trimmed);
|
|
9175
9569
|
const agents = Array.isArray(parsed.agents) ? parsed.agents : [];
|
|
9176
|
-
|
|
9570
|
+
const card = formatAgentListCard(agents);
|
|
9571
|
+
const lines = card.split("\n");
|
|
9572
|
+
lines[0] = t("agentsListLabel", String(agents.length));
|
|
9573
|
+
return lines.join("\n");
|
|
9177
9574
|
} catch {
|
|
9178
9575
|
return null;
|
|
9179
9576
|
}
|
|
@@ -9197,9 +9594,11 @@ function recoverOrchestrationCard(event, toolName, opts) {
|
|
|
9197
9594
|
if (kind === "start") {
|
|
9198
9595
|
const name = safe ? cleanUserText(snapshot.agentName ?? "agent") : snapshot.agentName ?? "agent";
|
|
9199
9596
|
const task = snapshot.taskPreview ? safe ? cleanUserText(snapshot.taskPreview) : snapshot.taskPreview : snapshot.taskPreview;
|
|
9597
|
+
const title = snapshot.title ? safe ? cleanUserText(snapshot.title) : snapshot.title : snapshot.title;
|
|
9200
9598
|
return formatStartRunCard(name, snapshot.status, {
|
|
9201
9599
|
task,
|
|
9202
9600
|
runId: snapshot.runId,
|
|
9601
|
+
...title ? { title } : {},
|
|
9203
9602
|
labels
|
|
9204
9603
|
});
|
|
9205
9604
|
}
|
|
@@ -9297,8 +9696,8 @@ function commandFullGist(command, max) {
|
|
|
9297
9696
|
if (!oneLine) return "";
|
|
9298
9697
|
return truncateByDisplayWidth(redactSecrets(oneLine), max);
|
|
9299
9698
|
}
|
|
9300
|
-
function pathBasenameGist(
|
|
9301
|
-
const segments =
|
|
9699
|
+
function pathBasenameGist(path2) {
|
|
9700
|
+
const segments = path2.split(/[\\/]/).filter((segment) => segment.length > 0);
|
|
9302
9701
|
const base = segments.pop();
|
|
9303
9702
|
return base ? gistClip(base) : "";
|
|
9304
9703
|
}
|
|
@@ -9426,12 +9825,36 @@ function buildHighlightedEditLine(line, lang, brightness, env) {
|
|
|
9426
9825
|
const highlightedBody = highlightCodeLine(body, lang, brightness);
|
|
9427
9826
|
return `${coloredPrefix}${highlightedBody}`;
|
|
9428
9827
|
}
|
|
9828
|
+
var MEMORY_TOOL_GIST_MAX = 64;
|
|
9829
|
+
function memoryToolGist(toolName, metadata) {
|
|
9830
|
+
const body = (value) => {
|
|
9831
|
+
if (typeof value !== "string" || !value) return "";
|
|
9832
|
+
return clipCompactText(redactSecrets(value), MEMORY_TOOL_GIST_MAX, "\u2026");
|
|
9833
|
+
};
|
|
9834
|
+
if (toolName === "rememberMemory") {
|
|
9835
|
+
const content = body(metadata.content);
|
|
9836
|
+
return content ? `+ ${content}` : "";
|
|
9837
|
+
}
|
|
9838
|
+
if (toolName === "queryMemory") {
|
|
9839
|
+
const query = body(metadata.query);
|
|
9840
|
+
return query ? `? ${query}` : "";
|
|
9841
|
+
}
|
|
9842
|
+
if (toolName === "deleteMemory") {
|
|
9843
|
+
const reason = body(metadata.reason);
|
|
9844
|
+
if (reason) return `- ${reason}`;
|
|
9845
|
+
const keyword = body(metadata.contentKeyword);
|
|
9846
|
+
if (keyword) return `- ${keyword}`;
|
|
9847
|
+
const idsCount = typeof metadata.idsCount === "number" ? metadata.idsCount : 0;
|
|
9848
|
+
if (idsCount > 0) return `- ${t("memoryDeleteRequestedCount", String(idsCount))}`;
|
|
9849
|
+
}
|
|
9850
|
+
return "";
|
|
9851
|
+
}
|
|
9429
9852
|
function normalToolGistRaw(event) {
|
|
9430
9853
|
const metadata = event.metadata ?? {};
|
|
9431
9854
|
const toolName = event.toolName || "";
|
|
9432
9855
|
if (toolName === "readFile") {
|
|
9433
|
-
const
|
|
9434
|
-
if (
|
|
9856
|
+
const path3 = typeof metadata.path === "string" ? metadata.path : typeof metadata.filePath === "string" ? metadata.filePath : "";
|
|
9857
|
+
if (path3) return gistClip(formatReadItemPath(path3, metadata), 52);
|
|
9435
9858
|
}
|
|
9436
9859
|
if (toolName === "fetchWebpage") {
|
|
9437
9860
|
const url = typeof metadata.url === "string" ? metadata.url : "";
|
|
@@ -9439,8 +9862,8 @@ function normalToolGistRaw(event) {
|
|
|
9439
9862
|
}
|
|
9440
9863
|
if (toolName === "exa_search") {
|
|
9441
9864
|
const query2 = typeof metadata.query === "string" ? metadata.query : typeof metadata.pattern === "string" ? metadata.pattern : "";
|
|
9442
|
-
const
|
|
9443
|
-
if (query2 ||
|
|
9865
|
+
const path3 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
9866
|
+
if (query2 || path3) return formatSearchItemQuery(query2, path3);
|
|
9444
9867
|
}
|
|
9445
9868
|
if (isRunToolName(toolName)) {
|
|
9446
9869
|
const command2 = typeof metadata.command === "string" ? metadata.command : "";
|
|
@@ -9448,28 +9871,16 @@ function normalToolGistRaw(event) {
|
|
|
9448
9871
|
return commandFullGist(command2, normalRunGistMaxWidth());
|
|
9449
9872
|
}
|
|
9450
9873
|
}
|
|
9451
|
-
const
|
|
9452
|
-
if (
|
|
9874
|
+
const memoryGist = memoryToolGist(toolName, metadata);
|
|
9875
|
+
if (memoryGist) return memoryGist;
|
|
9876
|
+
const path2 = typeof metadata.path === "string" ? metadata.path : "";
|
|
9877
|
+
if (path2) return pathBasenameGist(path2);
|
|
9453
9878
|
const command = typeof metadata.command === "string" ? metadata.command : "";
|
|
9454
9879
|
if (command) return commandFullGist(command, normalRunGistMaxWidth());
|
|
9455
9880
|
const query = typeof metadata.query === "string" ? metadata.query : "";
|
|
9456
9881
|
if (query) return clipCompactText(query, 64, "\u2026");
|
|
9457
|
-
const remembered = event.toolName === "rememberMemory" && typeof metadata.content === "string" ? metadata.content : "";
|
|
9458
|
-
if (remembered) return clipCompactText(redactSecrets(remembered), 64, "\u2026");
|
|
9459
9882
|
return "";
|
|
9460
9883
|
}
|
|
9461
|
-
var NORMAL_GIST_SECRET_PATTERNS = [
|
|
9462
|
-
/\bbearer\s+[A-Za-z0-9._~+/=-]{8,}/i,
|
|
9463
|
-
/\bsk-(?:ant-)?(?:api)?[0-9a-zA-Z-]{10,}/,
|
|
9464
|
-
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{10,}/,
|
|
9465
|
-
/\bxox[baprs]-[A-Za-z0-9-]{10,}/
|
|
9466
|
-
];
|
|
9467
|
-
function withholdIfSecretLike(gist) {
|
|
9468
|
-
if (!gist) return "";
|
|
9469
|
-
if (findPotentialSecrets(gist).length > 0) return "";
|
|
9470
|
-
if (NORMAL_GIST_SECRET_PATTERNS.some((pattern) => pattern.test(gist))) return "";
|
|
9471
|
-
return gist;
|
|
9472
|
-
}
|
|
9473
9884
|
function normalToolGist(event) {
|
|
9474
9885
|
return withholdIfSecretLike(normalToolGistRaw(event));
|
|
9475
9886
|
}
|
|
@@ -9481,8 +9892,6 @@ function formatNormalToolDuration(elapsedMs) {
|
|
|
9481
9892
|
function formatNormalToolLine(event, pending, colorEnabled) {
|
|
9482
9893
|
if (event.type === "tool-call") return "";
|
|
9483
9894
|
const toolName = event.toolName || pending?.toolName || "tool";
|
|
9484
|
-
const todoBlock = formatTodoListForCli(event, colorEnabled);
|
|
9485
|
-
if (todoBlock) return todoBlock;
|
|
9486
9895
|
if (event.type === "tool-result" && (event.toolName === "ask_user" || event.metadata?.uiAskChoice)) {
|
|
9487
9896
|
const block = formatUiAskChoiceBlock(event, colorEnabled);
|
|
9488
9897
|
if (block) return block;
|
|
@@ -9493,6 +9902,9 @@ function formatNormalToolLine(event, pending, colorEnabled) {
|
|
|
9493
9902
|
if (event.type === "tool-result" && toolName === "loadSkill") {
|
|
9494
9903
|
return formatLoadSkillBlock(event, colorEnabled, { safe: true }) ?? "";
|
|
9495
9904
|
}
|
|
9905
|
+
if (event.type === "tool-result" && toolName === "show_interaction") {
|
|
9906
|
+
return formatShowInteractionBlock(event, colorEnabled);
|
|
9907
|
+
}
|
|
9496
9908
|
const label = toolLabel(toolName);
|
|
9497
9909
|
if (readActionGate(event.metadata?.actionGate)) {
|
|
9498
9910
|
return formatToolTraceLine(`\u25B8 ${label} ! ${t("toolNeedsAction")}`, colorEnabled, "error");
|
|
@@ -9545,39 +9957,6 @@ function resolveLoadSkillName(event) {
|
|
|
9545
9957
|
if (match?.[1]) return match[1];
|
|
9546
9958
|
return argName || "skill";
|
|
9547
9959
|
}
|
|
9548
|
-
function formatTodoListForCli(event, colorEnabled) {
|
|
9549
|
-
if (event.type !== "tool-result" || event.toolName !== "setTodoList") {
|
|
9550
|
-
return void 0;
|
|
9551
|
-
}
|
|
9552
|
-
let raw = event.metadata?.displayData;
|
|
9553
|
-
let parsed = typeof raw === "object" && raw !== null;
|
|
9554
|
-
if (typeof raw === "string") {
|
|
9555
|
-
try {
|
|
9556
|
-
raw = JSON.parse(raw);
|
|
9557
|
-
parsed = true;
|
|
9558
|
-
} catch {
|
|
9559
|
-
raw = void 0;
|
|
9560
|
-
}
|
|
9561
|
-
}
|
|
9562
|
-
if (!parsed && typeof event.content === "string") {
|
|
9563
|
-
try {
|
|
9564
|
-
raw = JSON.parse(event.content);
|
|
9565
|
-
parsed = true;
|
|
9566
|
-
} catch {
|
|
9567
|
-
raw = void 0;
|
|
9568
|
-
}
|
|
9569
|
-
}
|
|
9570
|
-
const todos = Array.isArray(raw?.todos) ? raw.todos : void 0;
|
|
9571
|
-
if (!todos) return void 0;
|
|
9572
|
-
if (todos.length === 0) return "\u2611 Todo\n (empty)\n";
|
|
9573
|
-
const lines = todos.map((todo) => {
|
|
9574
|
-
const status = todo?.status === "done" ? "\u2713" : todo?.status === "in_progress" ? "\u25D0" : "\u25CB";
|
|
9575
|
-
const title = typeof todo?.title === "string" ? todo.title : "Untitled task";
|
|
9576
|
-
return ` ${status} ${title}`;
|
|
9577
|
-
});
|
|
9578
|
-
const text = [`\u2611 Todo (${todos.length})`, ...lines].join("\n") + "\n";
|
|
9579
|
-
return colorEnabled ? themeText(text, "chrome") : text;
|
|
9580
|
-
}
|
|
9581
9960
|
function formatLoadSkillBlock(event, colorEnabled, opts) {
|
|
9582
9961
|
if (event.type !== "tool-result" || event.toolName !== "loadSkill") return null;
|
|
9583
9962
|
const skillName = resolveLoadSkillName(event);
|
|
@@ -9834,6 +10213,7 @@ ${this.text}
|
|
|
9834
10213
|
// packages/cli/client/agentRunOutput.ts
|
|
9835
10214
|
var IDENTITY_LABEL_SEPARATOR = " > ";
|
|
9836
10215
|
var THINKING_PREVIEW_BUFFER_LIMIT = 512;
|
|
10216
|
+
var TUI_PROGRESS_BUFFER_LIMIT = 1200;
|
|
9837
10217
|
function appendThinkingPreview(current, chunk, limit = THINKING_PREVIEW_BUFFER_LIMIT) {
|
|
9838
10218
|
if (limit <= 0) return "";
|
|
9839
10219
|
const combined = current + chunk;
|
|
@@ -9895,6 +10275,14 @@ function formatToolJsonEvent(event) {
|
|
|
9895
10275
|
})}
|
|
9896
10276
|
`;
|
|
9897
10277
|
}
|
|
10278
|
+
function shouldPromoteTuiNarration(text) {
|
|
10279
|
+
if (text.length >= TUI_PROGRESS_BUFFER_LIMIT) return true;
|
|
10280
|
+
return /(^|\n)\s*(?:#{1,3}\s|```|[-*+]\s|\d+[.)]\s)/.test(text);
|
|
10281
|
+
}
|
|
10282
|
+
function narrationActivityLabel(text) {
|
|
10283
|
+
const oneLine = stripAnsi2(text).replace(/[`*_#>]/g, "").replace(/\s+/g, " ").trim();
|
|
10284
|
+
return truncateThinkingHint(oneLine, 60);
|
|
10285
|
+
}
|
|
9898
10286
|
function createCliTurnOutput(params) {
|
|
9899
10287
|
const { options } = params;
|
|
9900
10288
|
const workingLabel = params.workingLabel ?? `${options.agentName} -> working`;
|
|
@@ -9903,14 +10291,36 @@ function createCliTurnOutput(params) {
|
|
|
9903
10291
|
tuiTrees: options.output.tuiTrees === true
|
|
9904
10292
|
});
|
|
9905
10293
|
const eventMode = resolveAgentEventMode(options);
|
|
9906
|
-
const
|
|
10294
|
+
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
10295
|
+
const showThinking = !assistantLabelManaged && options.showThinking !== false;
|
|
10296
|
+
const hidesRoutineTuiToolDetail = (event) => {
|
|
10297
|
+
if (!assistantLabelManaged || event.toolName !== "editFile") return false;
|
|
10298
|
+
if (event.type === "tool-error") return false;
|
|
10299
|
+
if (readActionGate(event.metadata?.actionGate)) return false;
|
|
10300
|
+
if (event.metadata?.timedOut || event.metadata?.failed || event.metadata?.error) return false;
|
|
10301
|
+
if (typeof event.metadata?.exitCode === "number" && event.metadata.exitCode !== 0) return false;
|
|
10302
|
+
return true;
|
|
10303
|
+
};
|
|
9907
10304
|
let streamedAssistantText = false;
|
|
9908
10305
|
let everStreamedAnyText = false;
|
|
9909
10306
|
let printedAssistantLabel = false;
|
|
9910
10307
|
let thinkState = createThinkParserState();
|
|
9911
10308
|
let thinkingFirstAt = null;
|
|
9912
10309
|
let thinkingPreview = "";
|
|
10310
|
+
let tuiThinkingReported = false;
|
|
10311
|
+
const clearTuiThinkingLabel = () => {
|
|
10312
|
+
if (!tuiThinkingReported) return;
|
|
10313
|
+
tuiThinkingReported = false;
|
|
10314
|
+
options.activityReporter?.(null);
|
|
10315
|
+
};
|
|
9913
10316
|
const markThinkingDelta = (chunk) => {
|
|
10317
|
+
if (assistantLabelManaged) {
|
|
10318
|
+
if (!tuiThinkingReported && !streamedAssistantText) {
|
|
10319
|
+
tuiThinkingReported = true;
|
|
10320
|
+
options.activityReporter?.(t("thinkingActive"));
|
|
10321
|
+
}
|
|
10322
|
+
return;
|
|
10323
|
+
}
|
|
9914
10324
|
if (!showThinking) return;
|
|
9915
10325
|
if (streamedAssistantText) return;
|
|
9916
10326
|
if (thinkingFirstAt === null) {
|
|
@@ -9928,6 +10338,7 @@ function createCliTurnOutput(params) {
|
|
|
9928
10338
|
options.activityReporter?.(label);
|
|
9929
10339
|
};
|
|
9930
10340
|
const endThinkingPhase = () => {
|
|
10341
|
+
clearTuiThinkingLabel();
|
|
9931
10342
|
if (thinkingFirstAt === null) return;
|
|
9932
10343
|
const seconds = Math.max(0, Math.round((Date.now() - thinkingFirstAt) / 1e3));
|
|
9933
10344
|
thinkingFirstAt = null;
|
|
@@ -9940,7 +10351,6 @@ function createCliTurnOutput(params) {
|
|
|
9940
10351
|
}
|
|
9941
10352
|
};
|
|
9942
10353
|
let compactionEvent = null;
|
|
9943
|
-
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
9944
10354
|
const writeToolOutput = (chunk) => {
|
|
9945
10355
|
if (!chunk) return;
|
|
9946
10356
|
if (typeof options.output.writeToolBlock === "function") {
|
|
@@ -9952,9 +10362,25 @@ function createCliTurnOutput(params) {
|
|
|
9952
10362
|
const renderWriter = createRenderAwareStreamWriter({
|
|
9953
10363
|
write: (chunk) => options.output.write(chunk)
|
|
9954
10364
|
});
|
|
10365
|
+
let pendingTuiNarration = "";
|
|
10366
|
+
let tuiNarrationPromoted = false;
|
|
10367
|
+
const flushPendingTuiNarration = () => {
|
|
10368
|
+
if (!pendingTuiNarration) return;
|
|
10369
|
+
formatToolEvent.reset?.();
|
|
10370
|
+
renderWriter.push(pendingTuiNarration);
|
|
10371
|
+
pendingTuiNarration = "";
|
|
10372
|
+
tuiNarrationPromoted = true;
|
|
10373
|
+
streamedAssistantText = true;
|
|
10374
|
+
options.activityReporter?.(null);
|
|
10375
|
+
};
|
|
10376
|
+
const dropPendingTuiProgress = () => {
|
|
10377
|
+
pendingTuiNarration = "";
|
|
10378
|
+
tuiNarrationPromoted = false;
|
|
10379
|
+
options.activityReporter?.(null);
|
|
10380
|
+
};
|
|
9955
10381
|
const writeVisibleAssistantChunk = (chunk) => {
|
|
9956
10382
|
if (!chunk) return;
|
|
9957
|
-
formatToolEvent.reset?.();
|
|
10383
|
+
if (!assistantLabelManaged) formatToolEvent.reset?.();
|
|
9958
10384
|
const parsed = processThinkChunk(chunk, thinkState);
|
|
9959
10385
|
thinkState = parsed.state;
|
|
9960
10386
|
if (!parsed.content && !parsed.reasoning) return;
|
|
@@ -9970,8 +10396,23 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9970
10396
|
}
|
|
9971
10397
|
printedAssistantLabel = true;
|
|
9972
10398
|
}
|
|
9973
|
-
streamedAssistantText = true;
|
|
9974
10399
|
everStreamedAnyText = true;
|
|
10400
|
+
if (assistantLabelManaged) {
|
|
10401
|
+
if (tuiNarrationPromoted) {
|
|
10402
|
+
renderWriter.push(parsed.content);
|
|
10403
|
+
streamedAssistantText = true;
|
|
10404
|
+
return;
|
|
10405
|
+
}
|
|
10406
|
+
pendingTuiNarration += parsed.content;
|
|
10407
|
+
if (shouldPromoteTuiNarration(pendingTuiNarration)) {
|
|
10408
|
+
flushPendingTuiNarration();
|
|
10409
|
+
} else {
|
|
10410
|
+
const label = narrationActivityLabel(pendingTuiNarration);
|
|
10411
|
+
if (label) options.activityReporter?.(label);
|
|
10412
|
+
}
|
|
10413
|
+
return;
|
|
10414
|
+
}
|
|
10415
|
+
streamedAssistantText = true;
|
|
9975
10416
|
renderWriter.push(parsed.content);
|
|
9976
10417
|
};
|
|
9977
10418
|
const handleToolEvent = (event) => {
|
|
@@ -9987,13 +10428,19 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9987
10428
|
return;
|
|
9988
10429
|
}
|
|
9989
10430
|
if (event.type === "tool-call") {
|
|
10431
|
+
if (assistantLabelManaged && pendingTuiNarration) {
|
|
10432
|
+
dropPendingTuiProgress();
|
|
10433
|
+
}
|
|
9990
10434
|
renderWriter.flush();
|
|
9991
|
-
|
|
10435
|
+
if (!hidesRoutineTuiToolDetail(event)) {
|
|
10436
|
+
formatToolEvent(event);
|
|
10437
|
+
}
|
|
9992
10438
|
endThinkingPhase();
|
|
9993
10439
|
if (streamedAssistantText) {
|
|
9994
10440
|
options.output.write("\n");
|
|
9995
10441
|
streamedAssistantText = false;
|
|
9996
10442
|
}
|
|
10443
|
+
if (assistantLabelManaged) tuiNarrationPromoted = false;
|
|
9997
10444
|
const activeLabel = formatConservativeActiveToolLabel(event);
|
|
9998
10445
|
spinner.show(activeLabel);
|
|
9999
10446
|
options.activityReporter?.(activeLabel);
|
|
@@ -10005,6 +10452,9 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10005
10452
|
}
|
|
10006
10453
|
spinner.stop();
|
|
10007
10454
|
options.activityReporter?.(null);
|
|
10455
|
+
if (hidesRoutineTuiToolDetail(event)) {
|
|
10456
|
+
return;
|
|
10457
|
+
}
|
|
10008
10458
|
if (isLiveAgentRunObservation(event, parsedRunEvent)) {
|
|
10009
10459
|
formatToolEvent.consume?.(event);
|
|
10010
10460
|
return;
|
|
@@ -10017,6 +10467,26 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10017
10467
|
return {
|
|
10018
10468
|
spinner,
|
|
10019
10469
|
eventMode,
|
|
10470
|
+
/**
|
|
10471
|
+
* Terminal cleanup for abort/error paths that never reach `finish()`.
|
|
10472
|
+
*
|
|
10473
|
+
* A user abort discards the transient TUI progress buffer: the user stopped
|
|
10474
|
+
* on purpose and the dock already showed that text as activity. A genuine
|
|
10475
|
+
* failure must not swallow prose that never got the chance to be *proven*
|
|
10476
|
+
* durable (only a following tool call proves "progress"), so it promotes the
|
|
10477
|
+
* pending buffer and flushes what was already promoted — otherwise a short
|
|
10478
|
+
* final answer followed by a transport error disappears from the transcript.
|
|
10479
|
+
*/
|
|
10480
|
+
cancel(cleanup) {
|
|
10481
|
+
if (assistantLabelManaged && cleanup?.preservePendingNarration) {
|
|
10482
|
+
flushPendingTuiNarration();
|
|
10483
|
+
if (streamedAssistantText) {
|
|
10484
|
+
renderWriter.flush();
|
|
10485
|
+
options.output.write("\n");
|
|
10486
|
+
}
|
|
10487
|
+
}
|
|
10488
|
+
dropPendingTuiProgress();
|
|
10489
|
+
},
|
|
10020
10490
|
pushText(chunk) {
|
|
10021
10491
|
writeVisibleAssistantChunk(chunk);
|
|
10022
10492
|
},
|
|
@@ -10024,10 +10494,6 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10024
10494
|
markThinkingDelta(chunk);
|
|
10025
10495
|
},
|
|
10026
10496
|
handleToolEvent,
|
|
10027
|
-
/** 记录一条 compaction 观测事件(TUI 在 turn 结束时渲染一行 dim 摘要)。
|
|
10028
|
-
* 一轮内可能来多条(轮开始 + 每个 round),按显著性保留最高者:
|
|
10029
|
-
* 失败 > 新生成摘要 > 投影复用 > 跳过,避免末尾的例行跳过事件
|
|
10030
|
-
* 覆盖掉中途真正发生的压缩。 */
|
|
10031
10497
|
recordCompaction(event) {
|
|
10032
10498
|
const significance = (e) => e.failed ? 4 : e.summaryGenerated ? 3 : e.compressed ? 2 : 1;
|
|
10033
10499
|
if (!compactionEvent || significance(event) >= significance(compactionEvent)) {
|
|
@@ -10039,12 +10505,28 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10039
10505
|
spinner.show(activeLabel);
|
|
10040
10506
|
options.activityReporter?.(activeLabel);
|
|
10041
10507
|
},
|
|
10508
|
+
/**
|
|
10509
|
+
* Pre-delta turn phase label (ctx-overflow-feedback batch 3).
|
|
10510
|
+
*
|
|
10511
|
+
* localLoop 在首个 provider delta 之前依次发出 turn-phase 事件
|
|
10512
|
+
* (validating-context → compacting → waiting-provider);此前 CLI 只有
|
|
10513
|
+
* llm-start 才进入明确 working 状态,压缩期间 spinner 停在通用
|
|
10514
|
+
* working 文案上,用户无法区分「卡在检查上下文 / 压缩 / 等模型」。
|
|
10515
|
+
* 两个显示面(bare CLI 的 spinner 与 TUI 的 dock activityReporter)与
|
|
10516
|
+
* showWorking 走同一条投影,保证两端文案不漂移。
|
|
10517
|
+
*/
|
|
10518
|
+
showPhase(phase) {
|
|
10519
|
+
const label = phase === "validating-context" ? t("contextChecking") : phase === "compacting" ? t("contextCompacting") : t("waitingForModel");
|
|
10520
|
+
spinner.show(label);
|
|
10521
|
+
options.activityReporter?.(label);
|
|
10522
|
+
},
|
|
10042
10523
|
finish(fallbackContent) {
|
|
10043
10524
|
const flushedThink = flushThinkParser(thinkState);
|
|
10044
10525
|
thinkState = flushedThink.state;
|
|
10045
10526
|
if (flushedThink.content) {
|
|
10046
10527
|
writeVisibleAssistantChunk(flushedThink.content);
|
|
10047
10528
|
}
|
|
10529
|
+
if (assistantLabelManaged) flushPendingTuiNarration();
|
|
10048
10530
|
endThinkingPhase();
|
|
10049
10531
|
spinner.stop();
|
|
10050
10532
|
options.activityReporter?.(null);
|
|
@@ -10119,6 +10601,12 @@ var describeClientVersionTooOldFailure = (message, rawError) => {
|
|
|
10119
10601
|
};
|
|
10120
10602
|
|
|
10121
10603
|
// packages/cli/client/agentRunStream.ts
|
|
10604
|
+
function isMalformedFunctionCallFailure(message) {
|
|
10605
|
+
return message.includes("MALFORMED_FUNCTION_CALL");
|
|
10606
|
+
}
|
|
10607
|
+
function shouldAppendStreamRawErrorDetail(env) {
|
|
10608
|
+
return env?.NOLO_DEBUG === "1" || env?.NOLO_CLI_DEBUG_DETAIL === "1";
|
|
10609
|
+
}
|
|
10122
10610
|
async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
10123
10611
|
const reader = res.body?.getReader();
|
|
10124
10612
|
if (!reader) {
|
|
@@ -10149,6 +10637,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10149
10637
|
let content = "";
|
|
10150
10638
|
let dialogId;
|
|
10151
10639
|
let usage;
|
|
10640
|
+
let sawDone = false;
|
|
10152
10641
|
const handlePayload = (payload) => {
|
|
10153
10642
|
if (typeof payload?.dialogId === "string" && payload.dialogId.trim()) {
|
|
10154
10643
|
dialogId = payload.dialogId;
|
|
@@ -10161,6 +10650,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10161
10650
|
}
|
|
10162
10651
|
if (payload?.type === "done") {
|
|
10163
10652
|
usage = payload.usage;
|
|
10653
|
+
sawDone = true;
|
|
10164
10654
|
return;
|
|
10165
10655
|
}
|
|
10166
10656
|
if (payload?.type === "dialog" || payload?.type === "status") {
|
|
@@ -10214,6 +10704,9 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10214
10704
|
}
|
|
10215
10705
|
} catch (error) {
|
|
10216
10706
|
turnOutput.spinner.stop();
|
|
10707
|
+
turnOutput.cancel({
|
|
10708
|
+
preservePendingNarration: !options.abortSignal?.aborted
|
|
10709
|
+
});
|
|
10217
10710
|
if (options.abortSignal?.aborted) {
|
|
10218
10711
|
return {
|
|
10219
10712
|
exitCode: 0,
|
|
@@ -10222,15 +10715,18 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10222
10715
|
};
|
|
10223
10716
|
}
|
|
10224
10717
|
const message = toErrorMessage(error);
|
|
10718
|
+
const malformedToolCall = isMalformedFunctionCallFailure(message);
|
|
10719
|
+
const rawDetail = shouldAppendStreamRawErrorDetail(options.env) ? t("agentRunStream.rawErrorDetail", message) : null;
|
|
10225
10720
|
if (dialogId) {
|
|
10226
|
-
|
|
10227
|
-
`
|
|
10228
|
-
|
|
10229
|
-
`
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
);
|
|
10721
|
+
if (malformedToolCall) {
|
|
10722
|
+
options.output.write(`
|
|
10723
|
+
${t("agentRunStream.malformedToolCallRejected", dialogId)}
|
|
10724
|
+
`);
|
|
10725
|
+
if (rawDetail) options.output.write(rawDetail);
|
|
10726
|
+
return { exitCode: 0, dialogId, streamInterrupted: true };
|
|
10727
|
+
}
|
|
10728
|
+
options.output.write(t("agentRunStream.interruptedAfterDialog", dialogId, message));
|
|
10729
|
+
options.output.write(t("agentRunStream.mayStillFinishOnServer"));
|
|
10234
10730
|
return { exitCode: 0, dialogId, streamInterrupted: true };
|
|
10235
10731
|
}
|
|
10236
10732
|
if (isClientVersionTooOldFailure(message, error)) {
|
|
@@ -10238,11 +10734,25 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10238
10734
|
${describeClientVersionTooOldFailure(message, error)}`);
|
|
10239
10735
|
return { exitCode: 1 };
|
|
10240
10736
|
}
|
|
10241
|
-
|
|
10242
|
-
|
|
10737
|
+
if (malformedToolCall) {
|
|
10738
|
+
options.output.write(`
|
|
10739
|
+
${t("agentRunStream.malformedToolCallRejectedNoDialog")}
|
|
10243
10740
|
`);
|
|
10741
|
+
if (rawDetail) options.output.write(rawDetail);
|
|
10742
|
+
return { exitCode: 1 };
|
|
10743
|
+
}
|
|
10744
|
+
options.output.write(t("agentRunStream.failed", message));
|
|
10244
10745
|
return { exitCode: 1 };
|
|
10245
10746
|
}
|
|
10747
|
+
if (options.abortSignal?.aborted && !sawDone) {
|
|
10748
|
+
turnOutput.spinner.stop();
|
|
10749
|
+
turnOutput.cancel();
|
|
10750
|
+
return {
|
|
10751
|
+
exitCode: 0,
|
|
10752
|
+
...dialogId ? { dialogId } : {},
|
|
10753
|
+
streamInterrupted: true
|
|
10754
|
+
};
|
|
10755
|
+
}
|
|
10246
10756
|
turnOutput.finish(content);
|
|
10247
10757
|
const usageText = formatUsage(usage, dialogId);
|
|
10248
10758
|
if (usageText && shouldShowUsage(options.env))
|
|
@@ -10252,6 +10762,9 @@ ${describeClientVersionTooOldFailure(message, error)}`);
|
|
|
10252
10762
|
return {
|
|
10253
10763
|
exitCode: 0,
|
|
10254
10764
|
...dialogId ? { dialogId } : {},
|
|
10765
|
+
// 结论载体与 local / 非流式 HTTP 路径同契约:流式分支已经把 assistant
|
|
10766
|
+
// 正文累加在 content 里,不随行则 server 流式 run 的结算也拿不到结论。
|
|
10767
|
+
...content ? { finalText: content } : {},
|
|
10255
10768
|
turnTokens: buildTurnTokenUsage(usage, options.agentKey),
|
|
10256
10769
|
...turnCredits !== void 0 ? { turnCredits } : {}
|
|
10257
10770
|
};
|
|
@@ -10459,7 +10972,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
10459
10972
|
// packages/cli/client/agentRun.ts
|
|
10460
10973
|
import { ulid as ulid2 } from "ulid";
|
|
10461
10974
|
async function loadRunLocalAgentTurn() {
|
|
10462
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
10975
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-SQUDRZWE.js");
|
|
10463
10976
|
return runLocalAgentTurn;
|
|
10464
10977
|
}
|
|
10465
10978
|
var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
|
|
@@ -10557,6 +11070,13 @@ function buildDefaultLocalRuntimeAdapter(options) {
|
|
|
10557
11070
|
fetchImpl: options.fetchImpl,
|
|
10558
11071
|
cwd: options.localRuntimeCwd,
|
|
10559
11072
|
output: options.output,
|
|
11073
|
+
// TUI 显式注入的真实会话身份;缺省时 adapter 内仍回退 parentDialogId。
|
|
11074
|
+
...options.originSession ? { originSession: options.originSession } : {},
|
|
11075
|
+
// 分享 OAuth agent 的 shell 会话授权(块 D):仅 owner-required 场景生效。
|
|
11076
|
+
...options.shellGrant ? { shellGrant: options.shellGrant } : {},
|
|
11077
|
+
// 运行位置展示(块 D):TUI 消费 projectToolExecutionLocation 渲染工具实际
|
|
11078
|
+
// 执行设备/工作区;非 owner-required 场景 adapter 不回调。
|
|
11079
|
+
...options.onToolExecutionLocation ? { onToolExecutionLocation: options.onToolExecutionLocation } : {},
|
|
10560
11080
|
...options.confirmDestructiveAction ? { confirmDestructiveAction: options.confirmDestructiveAction } : {},
|
|
10561
11081
|
...options.requestUserChoice ? { requestUserChoice: options.requestUserChoice } : {},
|
|
10562
11082
|
...options.pastedTextStore?.items.size ? { pastedTextStore: options.pastedTextStore } : {},
|
|
@@ -10594,7 +11114,7 @@ function wrapLoadAgentConfigWithModelOverride(adapter, targetAgentKey, override)
|
|
|
10594
11114
|
}
|
|
10595
11115
|
};
|
|
10596
11116
|
}
|
|
10597
|
-
var
|
|
11117
|
+
var oauthChannelSkipReportedAgentKeys = /* @__PURE__ */ new Set();
|
|
10598
11118
|
function resolveOAuthChannelOwnerSkip(agentConfig, options) {
|
|
10599
11119
|
if (!agentConfig) return null;
|
|
10600
11120
|
const apiKeyRef = typeof agentConfig.apiKeyRef === "string" ? agentConfig.apiKeyRef : void 0;
|
|
@@ -10606,8 +11126,12 @@ function resolveOAuthChannelOwnerSkip(agentConfig, options) {
|
|
|
10606
11126
|
if (!ownerUserId) return null;
|
|
10607
11127
|
const localUserId = resolveLocalUserId(options.env);
|
|
10608
11128
|
if (ownerUserId === localUserId) return null;
|
|
10609
|
-
return
|
|
10610
|
-
|
|
11129
|
+
return t(
|
|
11130
|
+
"agentRun.oauthChannelOwnerSkip",
|
|
11131
|
+
options.agentKey,
|
|
11132
|
+
ownerUserId,
|
|
11133
|
+
localUserId
|
|
11134
|
+
) + "\n";
|
|
10611
11135
|
}
|
|
10612
11136
|
async function shouldSkipAutoLocalForServerPlatformTools(options) {
|
|
10613
11137
|
if (isBuiltinNoloAgentRef(options.agentKey)) return false;
|
|
@@ -10623,13 +11147,13 @@ async function shouldSkipAutoLocalForServerPlatformTools(options) {
|
|
|
10623
11147
|
}
|
|
10624
11148
|
const oauthChannelOwnerSkip = resolveOAuthChannelOwnerSkip(agentConfig, options);
|
|
10625
11149
|
if (oauthChannelOwnerSkip) {
|
|
10626
|
-
if (!options.output || typeof options.output !== "object" || !
|
|
11150
|
+
if (!options.output || typeof options.output !== "object" || !oauthChannelSkipReportedAgentKeys.has(options.agentKey)) {
|
|
10627
11151
|
if (options.output && typeof options.output === "object") {
|
|
10628
|
-
|
|
11152
|
+
oauthChannelSkipReportedAgentKeys.add(options.agentKey);
|
|
10629
11153
|
}
|
|
10630
11154
|
options.output.write(oauthChannelOwnerSkip);
|
|
10631
11155
|
}
|
|
10632
|
-
return
|
|
11156
|
+
return false;
|
|
10633
11157
|
}
|
|
10634
11158
|
if (options.localRuntimeCwd) {
|
|
10635
11159
|
return false;
|
|
@@ -10668,14 +11192,15 @@ async function shouldSkipAutoLocalForServerPlatformTools(options) {
|
|
|
10668
11192
|
);
|
|
10669
11193
|
return true;
|
|
10670
11194
|
}
|
|
10671
|
-
function buildUserInputContent(message, imageUrls = []) {
|
|
10672
|
-
if (imageUrls.length === 0) return message;
|
|
11195
|
+
function buildUserInputContent(message, imageUrls = [], attachmentParts = []) {
|
|
11196
|
+
if (imageUrls.length === 0 && attachmentParts.length === 0) return message;
|
|
10673
11197
|
return [
|
|
10674
11198
|
...message.trim() ? [{ type: "text", text: message }] : [],
|
|
10675
11199
|
...imageUrls.map((url) => ({
|
|
10676
11200
|
type: "image_url",
|
|
10677
11201
|
image_url: { url }
|
|
10678
|
-
}))
|
|
11202
|
+
})),
|
|
11203
|
+
...attachmentParts
|
|
10679
11204
|
];
|
|
10680
11205
|
}
|
|
10681
11206
|
function buildSubjectRefs(options) {
|
|
@@ -10720,8 +11245,8 @@ function isMissingLocalAgentConfigError(error, agentRef) {
|
|
|
10720
11245
|
error && typeof error === "object" && "code" in error && error.code === LOCAL_AGENT_CONFIG_MISSING_CODE && error.agentRef === agentRef
|
|
10721
11246
|
);
|
|
10722
11247
|
}
|
|
10723
|
-
var PROVIDER_HTTP_FAILED_RE = /(.+?)
|
|
10724
|
-
var PLATFORM_TRANSPORT_RE = /\
|
|
11248
|
+
var PROVIDER_HTTP_FAILED_RE = /(.+?)(?:\s+provider|\s+proxy) failed:\s*HTTP\s+(\d+)\b/i;
|
|
11249
|
+
var PLATFORM_TRANSPORT_RE = /\b(?:platform provider failed|owner-required proxy failed)\b/i;
|
|
10725
11250
|
var EXTRA_RATE_LIMIT_TEXT_RE = /\brate[\s_-]?limit(?:ed|ing|s)?\b|\bresource[_\s-]?exhausted\b|\bmax_concurrent_reached\b/i;
|
|
10726
11251
|
function looksLikeRateLimitedText(message) {
|
|
10727
11252
|
return EXTRA_RATE_LIMIT_TEXT_RE.test(message) || QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(message));
|
|
@@ -10779,36 +11304,52 @@ function classifyLocalRunError(message) {
|
|
|
10779
11304
|
}
|
|
10780
11305
|
return { kind: "generic" };
|
|
10781
11306
|
}
|
|
10782
|
-
var HISTORY_REPLAY_REJECTION_RE = /
|
|
11307
|
+
var HISTORY_REPLAY_REJECTION_RE = /invalid\s+tool\s+call\s+arguments?/i;
|
|
11308
|
+
var REASONING_REPLAY_CONTRACT_RE = /reasoning_content[^.]*must be passed back/i;
|
|
10783
11309
|
var RUN_UNAVAILABLE_PREFIX = "[nolo] auto runtime: local run unavailable";
|
|
10784
11310
|
var NO_FALLBACK = "Not falling back to server.";
|
|
10785
11311
|
var SERVER_FALLBACK_HINT = "or use --server to run on the server explicitly.";
|
|
10786
11312
|
function buildAuthFailure(ctx) {
|
|
10787
11313
|
const platformNoToken = ctx.where === "server chat proxy" && isAuthNoTokenBody(ctx.message);
|
|
10788
|
-
|
|
11314
|
+
if (platformNoToken) {
|
|
11315
|
+
const guidance = `
|
|
11316
|
+
This turn did not run: you are not logged in to Nolo and no local model credential is available.
|
|
11317
|
+
\xB7 Use the Nolo platform: /login (or run \`nolo login\` after exiting the TUI)
|
|
11318
|
+
\xB7 Use your own subscription: nolo auth antigravity | claude | chatgpt | xai
|
|
11319
|
+
\xB7 No login at all: nolo run "<task>" (runs on local Codex)`;
|
|
11320
|
+
const detail = process.env.NOLO_DEBUG === "1" || process.env.NOLO_CLI_DEBUG_DETAIL === "1" ? `
|
|
11321
|
+
Detail: ${ctx.message}` : `
|
|
11322
|
+
Detail: platform returned AUTH_NO_TOKEN (no authentication token provided)`;
|
|
11323
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}, no token was sent).${guidance}${detail} ${NO_FALLBACK} ${SERVER_FALLBACK_HINT}
|
|
11324
|
+
`;
|
|
11325
|
+
}
|
|
11326
|
+
const fix = ctx.where === "server chat proxy" ? `Check the agent's provider/api-key settings on nolo.chat` : `Fix the local credential/config and retry`;
|
|
10789
11327
|
const { url: validationUrl, text: validationText } = extractGoogleValidationLink(ctx.message);
|
|
10790
11328
|
const validationLabel = validationText || "Verify your account";
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
${formatCliHyperlink(
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
11329
|
+
if (validationUrl) {
|
|
11330
|
+
const linkLine = `
|
|
11331
|
+
${formatCliHyperlink(validationUrl, validationLabel)}`;
|
|
11332
|
+
const rawLine = resolveCliHyperlinkEnabled() ? `
|
|
11333
|
+
\u70B9\u4E0D\u4E86\u5C31\u590D\u5236\u8FD9\u884C: ${validationUrl}` : "";
|
|
11334
|
+
const verifyHint = `
|
|
11335
|
+
\u24D8 \u60F3\u4E00\u952E\u6253\u5F00\uFF1F\u8DD1 \`nolo auth antigravity --verify\` \u2014\u2014 \u5B83\u4F1A\u7528\u672C\u5730\u51ED\u8BC1\u62FF\u5230\u5F53\u524D\u9A8C\u8BC1\u94FE\u63A5\u5E76\u76F4\u63A5\u62C9\u8D77\u6D4F\u89C8\u5668\u3002`;
|
|
11336
|
+
const retryLine = `
|
|
11337
|
+
\u9A8C\u8BC1\u5B8C\u6210\u540E\u76F4\u63A5\u91CD\u8BD5\u521A\u624D\u7684\u547D\u4EE4\u5373\u53EF\uFF0Ctoken \u4E0D\u7528\u91CD\u65B0\u767B\u5F55\u3002`;
|
|
11338
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}: Google requires a one-time account verification \u2014 your credential is fine).
|
|
11339
|
+
Open this link in a browser signed into ${ctx.credentialAccountId ? `\`${ctx.credentialAccountId}\`` : "the Google account behind this credential"}:${linkLine}${rawLine}${verifyHint}${retryLine}
|
|
11340
|
+
Detail: ${ctx.message} ${NO_FALLBACK} Use --server to run on the server explicitly.
|
|
11341
|
+
`;
|
|
11342
|
+
}
|
|
11343
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}, auth rejected). Detail: ${ctx.message} ${NO_FALLBACK} ${fix}, ${SERVER_FALLBACK_HINT}.
|
|
10804
11344
|
`;
|
|
10805
11345
|
}
|
|
10806
11346
|
function isAuthNoTokenBody(message) {
|
|
10807
11347
|
return /"authCode"\s*:\s*"AUTH_NO_TOKEN"/i.test(message) || /no authentication token provided/i.test(message);
|
|
10808
11348
|
}
|
|
10809
11349
|
function buildRejectedPayloadFailure(ctx) {
|
|
10810
|
-
const
|
|
10811
|
-
const
|
|
11350
|
+
const looksLikeReasoningReplay = REASONING_REPLAY_CONTRACT_RE.test(ctx.message);
|
|
11351
|
+
const looksLikeHistoryReplay = !looksLikeReasoningReplay && HISTORY_REPLAY_REJECTION_RE.test(ctx.message);
|
|
11352
|
+
const cause = looksLikeReasoningReplay ? ` This is a thinking-mode replay contract violation: the history contains an assistant tool-call turn without reasoning_content, but this model requires every such turn to pass reasoning back to the API. The upstream may not have returned reasoning for that turn, or the history came from a different model.` : looksLikeHistoryReplay ? ` This usually happens when the dialog history contains tool_calls or reasoning produced by a different model/provider (e.g. after /switch); the new provider rejects that history. Start a fresh dialog, or clean the offending history.` : "";
|
|
10812
11353
|
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}, the provider rejected the request body \u2014 this is NOT a local credential/config issue). Detail: ${ctx.message}${cause} ${NO_FALLBACK} Use --server to run on the server explicitly, or start a fresh dialog.
|
|
10813
11354
|
`;
|
|
10814
11355
|
}
|
|
@@ -10818,7 +11359,7 @@ function extractRateLimitResetHint(message) {
|
|
|
10818
11359
|
return match ? match[0].trim() : void 0;
|
|
10819
11360
|
}
|
|
10820
11361
|
function buildRateLimitFailure(ctx) {
|
|
10821
|
-
const cooldownNote = ctx.cooldownUntil ? ` \u5DF2\
|
|
11362
|
+
const cooldownNote = ctx.cooldownUntil ? ` \u5DF2\u6682\u505C\u8BE5\u51ED\u8BC1\u7684\u6D3E\u53D1\uFF0C\u672C\u5730\u51B7\u5374\u6700\u665A ${ctx.cooldownUntil} \u5230\u671F\uFF08\u4E0D\u4EE3\u8868\u4E0A\u6E38\u989D\u5EA6\u5C4A\u65F6\u4E00\u5B9A\u6062\u590D\uFF09\uFF1B\u51B7\u5374\u671F\u95F4\u518D\u6B21\u6D3E\u53D1\u65F6\uFF0C\u7EA6\u6BCF ${Math.round(PROBE_INTERVAL_MS / 6e4)} \u5206\u949F\u653E\u884C\u4E00\u6B21\u8BD5\u63A2\u8BF7\u6C42\uFF0C\u6210\u529F\u5373\u6062\u590D\u3002\u82E5\u5DF2\u5145\u503C\u6216\u91CD\u7F6E\u989D\u5EA6\uFF0C\u53EF\u8FD0\u884C \`nolo auth cooldown\` \u67E5\u770B\u88AB\u6682\u505C\u7684\u51ED\u8BC1\u540D\uFF0C\u518D\u7528 \`nolo auth cooldown --clear <\u51ED\u8BC1\u540D>\` \u7ACB\u5373\u6062\u590D\u3002` : "";
|
|
10822
11363
|
const headline = ctx.statusInferred ? `${ctx.where} hit an upstream rate-limit/quota error` : `${ctx.where} returned HTTP ${ctx.status}, rate limited`;
|
|
10823
11364
|
const cause = ctx.quotaExhausted ? "The upstream quota/balance for this agent is exhausted \u2014 NOT a local credential/config issue" : "This agent is being throttled by the upstream provider \u2014 NOT a local credential/config issue";
|
|
10824
11365
|
const reset = extractRateLimitResetHint(ctx.message);
|
|
@@ -10835,6 +11376,17 @@ function buildUpstreamFailure(ctx) {
|
|
|
10835
11376
|
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}). Detail: ${ctx.message} ${NO_FALLBACK} ${fix}, ${SERVER_FALLBACK_HINT}.
|
|
10836
11377
|
`;
|
|
10837
11378
|
}
|
|
11379
|
+
function formatLocalTurnFailureLine(error) {
|
|
11380
|
+
const message = toErrorMessage(error);
|
|
11381
|
+
if (error?.code === "LLM_REQUEST_TIMEOUT") {
|
|
11382
|
+
const msMatch = /after (\d+)ms/.exec(message);
|
|
11383
|
+
const deadline = msMatch && Number.isFinite(Number(msMatch[1])) ? formatElapsed(Math.round(Number(msMatch[1]) / 1e3)) : "the configured window";
|
|
11384
|
+
return `[nolo] ${t("llmRequestTimedOut", deadline)}
|
|
11385
|
+
`;
|
|
11386
|
+
}
|
|
11387
|
+
return `[nolo] Local agent run failed: ${message}
|
|
11388
|
+
`;
|
|
11389
|
+
}
|
|
10838
11390
|
var FAILURE_BUILDERS = {
|
|
10839
11391
|
auth: buildAuthFailure,
|
|
10840
11392
|
"rejected-payload": buildRejectedPayloadFailure,
|
|
@@ -10843,6 +11395,7 @@ var FAILURE_BUILDERS = {
|
|
|
10843
11395
|
upstream: buildUpstreamFailure
|
|
10844
11396
|
};
|
|
10845
11397
|
function describeLocalRunFailure(message, rawError) {
|
|
11398
|
+
const credentialAccountId = rawError && typeof rawError === "object" && typeof rawError.credentialAccountId === "string" ? rawError.credentialAccountId.trim() || void 0 : void 0;
|
|
10846
11399
|
if (rawError && typeof rawError === "object" && "code" in rawError && rawError.code === "PLATFORM_STREAM_INTERRUPTED") {
|
|
10847
11400
|
return "[nolo] The platform LLM stream was interrupted before the turn completed. Your conversation was preserved. Send another message to continue.\n";
|
|
10848
11401
|
}
|
|
@@ -10891,6 +11444,10 @@ function describeLocalRunFailure(message, rawError) {
|
|
|
10891
11444
|
}
|
|
10892
11445
|
if (/CLI authority broker could not attach or take ownership/i.test(message)) {
|
|
10893
11446
|
const cleaned = stripDebugNoise(message);
|
|
11447
|
+
if (/EADDRINUSE/i.test(message)) {
|
|
11448
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${cleaned}). ${NO_FALLBACK} Use --server to run on the server explicitly.
|
|
11449
|
+
`;
|
|
11450
|
+
}
|
|
10894
11451
|
return `${RUN_UNAVAILABLE_PREFIX} (${cleaned}). ${NO_FALLBACK} The local runtime could not attach to an existing broker or take database ownership. Check running broker processes holding the local authority store or retry, ${SERVER_FALLBACK_HINT}.
|
|
10895
11452
|
`;
|
|
10896
11453
|
}
|
|
@@ -10906,6 +11463,10 @@ function describeLocalRunFailure(message, rawError) {
|
|
|
10906
11463
|
}
|
|
10907
11464
|
const cls = classifyLocalRunError(message);
|
|
10908
11465
|
if (cls.kind === "generic") {
|
|
11466
|
+
if (/owner-required route not acknowledged/i.test(message)) {
|
|
11467
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${message}). ${NO_FALLBACK} The server returned a successful response but did not acknowledge the owner route. Check server version or proxy configuration, ${SERVER_FALLBACK_HINT}.
|
|
11468
|
+
`;
|
|
11469
|
+
}
|
|
10909
11470
|
if (isTransientFetchError(message)) {
|
|
10910
11471
|
return `${RUN_UNAVAILABLE_PREFIX} (${message}). ${NO_FALLBACK} The upstream connection dropped mid-request (transient network/gateway issue \u2014 not a local credential or config problem). Send again (or say "continue") to retry in the same conversation.
|
|
10911
11472
|
`;
|
|
@@ -10920,7 +11481,8 @@ function describeLocalRunFailure(message, rawError) {
|
|
|
10920
11481
|
status: cls.status,
|
|
10921
11482
|
...cls.statusInferred ? { statusInferred: true } : {},
|
|
10922
11483
|
...cls.quotaExhausted ? { quotaExhausted: true } : {},
|
|
10923
|
-
...cooldownUntil ? { cooldownUntil } : {}
|
|
11484
|
+
...cooldownUntil ? { cooldownUntil } : {},
|
|
11485
|
+
...credentialAccountId ? { credentialAccountId } : {}
|
|
10924
11486
|
};
|
|
10925
11487
|
return FAILURE_BUILDERS[cls.kind](ctx);
|
|
10926
11488
|
}
|
|
@@ -11133,15 +11695,24 @@ ${options.agentName} > (no text response)
|
|
|
11133
11695
|
const turnCredits = platformCreditsFromUsage(
|
|
11134
11696
|
data?.usage
|
|
11135
11697
|
);
|
|
11136
|
-
|
|
11698
|
+
const serverResult = {
|
|
11137
11699
|
exitCode: 0,
|
|
11138
11700
|
...typeof data?.dialogId === "string" && data.dialogId ? { dialogId: data.dialogId } : {},
|
|
11701
|
+
// 结论载体与 local 路径同契约(server 模式 / 本地配置缺失时的兜底通道):
|
|
11702
|
+
// 结算点只认 result.finalText,HTTP 派发不给就等于这批 run 没有结论载体,
|
|
11703
|
+
// status 里既无 lastAssistantText 也无 resultFile。content 已在上面算好。
|
|
11704
|
+
...content ? { finalText: content } : {},
|
|
11139
11705
|
turnTokens: buildTurnTokenUsage(
|
|
11140
11706
|
data?.usage,
|
|
11141
11707
|
typeof data?.model === "string" ? data.model : options.agentKey
|
|
11142
11708
|
),
|
|
11143
11709
|
...turnCredits !== void 0 ? { turnCredits } : {}
|
|
11144
11710
|
};
|
|
11711
|
+
recordRunResultHeaderMeta(serverResult, {
|
|
11712
|
+
model: typeof data?.model === "string" ? data.model : void 0,
|
|
11713
|
+
dialogServer: serverOriginForDialog(options.serverUrl)
|
|
11714
|
+
});
|
|
11715
|
+
return serverResult;
|
|
11145
11716
|
}
|
|
11146
11717
|
async function runInjectedLocalAgentTurn(options) {
|
|
11147
11718
|
return runLocalAgentTurnForCli(options, { reportFailure: true });
|
|
@@ -11200,21 +11771,37 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11200
11771
|
});
|
|
11201
11772
|
turnOutput.spinner.start();
|
|
11202
11773
|
try {
|
|
11774
|
+
const localAttachmentPaths = (options.localAttachmentPaths ?? []).filter(
|
|
11775
|
+
(p) => typeof p === "string" && p.trim().length > 0
|
|
11776
|
+
);
|
|
11777
|
+
const { cardText: localAttachmentCard, parts: localAttachmentParts } = buildLocalAttachments({
|
|
11778
|
+
paths: localAttachmentPaths,
|
|
11779
|
+
machineId: localAttachmentPaths.length > 0 ? await resolveCurrentMachineId(options) : void 0,
|
|
11780
|
+
...options.localRuntimeCwd ? { workspaceRoot: options.localRuntimeCwd } : {}
|
|
11781
|
+
});
|
|
11782
|
+
const messageForLocal = appendAttachmentCard(options.message, localAttachmentCard);
|
|
11783
|
+
const durableAttachmentParts = ENABLE_REMOTE_ATTACHMENT_PART_WRITES ? localAttachmentParts : [];
|
|
11784
|
+
const hasDurableAttachments = durableAttachmentParts.length > 0;
|
|
11203
11785
|
const runLocalAgentTurn = await loadRunLocalAgentTurn();
|
|
11204
11786
|
const result = await runLocalAgentTurn({
|
|
11205
11787
|
adapter,
|
|
11206
11788
|
agentRef: options.agentKey,
|
|
11207
11789
|
userLanguage: options.userLanguage ?? options.env.NOLO_LANG ?? null,
|
|
11208
|
-
input: buildUserInputContent(
|
|
11209
|
-
...expandedMessage !== options.message ? {
|
|
11210
|
-
persistedInput: buildUserInputContent(
|
|
11790
|
+
input: buildUserInputContent(messageForLocal, options.imageUrls),
|
|
11791
|
+
...expandedMessage !== options.message || localAttachmentCard !== "" ? {
|
|
11792
|
+
persistedInput: hasDurableAttachments ? buildUserInputContent(
|
|
11211
11793
|
expandedMessage,
|
|
11794
|
+
options.imageUrls,
|
|
11795
|
+
durableAttachmentParts
|
|
11796
|
+
) : buildUserInputContent(
|
|
11797
|
+
appendAttachmentCard(expandedMessage, localAttachmentCard),
|
|
11212
11798
|
options.imageUrls
|
|
11213
11799
|
),
|
|
11214
|
-
persistedInputReference: buildUserInputContent(
|
|
11800
|
+
persistedInputReference: hasDurableAttachments ? buildUserInputContent(
|
|
11215
11801
|
options.message,
|
|
11216
|
-
options.imageUrls
|
|
11217
|
-
|
|
11802
|
+
options.imageUrls,
|
|
11803
|
+
durableAttachmentParts
|
|
11804
|
+
) : buildUserInputContent(messageForLocal, options.imageUrls)
|
|
11218
11805
|
} : {},
|
|
11219
11806
|
...options.pastedTextStore ? {
|
|
11220
11807
|
contextReferenceResolver: (reference) => canResolveCollapsedPasteReference(options.pastedTextStore, reference)
|
|
@@ -11237,6 +11824,18 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11237
11824
|
if (event.kind === "llm-start") {
|
|
11238
11825
|
turnOutput.showWorking();
|
|
11239
11826
|
}
|
|
11827
|
+
if (event.kind === "turn-phase") {
|
|
11828
|
+
turnOutput.showPhase(event.phase);
|
|
11829
|
+
}
|
|
11830
|
+
if (event.kind === "compaction-start") {
|
|
11831
|
+
turnOutput.showPhase("compacting");
|
|
11832
|
+
}
|
|
11833
|
+
if (event.kind === "compaction-end" || // 压缩失败(timeout/provider-error)时 localLoop 按失败原子性语义
|
|
11834
|
+
// 带着裁剪后的历史继续本轮,切回等待模型文案;aborted 时 turn 随即
|
|
11835
|
+
// 结束,不再切文案(终态由 abort 路径收尾)。
|
|
11836
|
+
event.kind === "compaction-failed" && event.reason !== "aborted") {
|
|
11837
|
+
turnOutput.showPhase("waiting-provider");
|
|
11838
|
+
}
|
|
11240
11839
|
if (event.kind === "image-downgraded") {
|
|
11241
11840
|
options.output.write(
|
|
11242
11841
|
"[nolo] \u5F53\u524D agent \u88AB\u914D\u7F6E\u4E3A\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u56FE\u7247\u5DF2\u7528\u5360\u4F4D\u6587\u672C\u66FF\u4EE3\u3002\u8BF7\u68C0\u67E5\u6A21\u578B\u7684\u56FE\u7247\u80FD\u529B\u914D\u7F6E\uFF0C\u6216\u7528 /switch \u9009\u62E9\u652F\u6301\u56FE\u7247\u7684 agent \u540E\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002\n"
|
|
@@ -11266,9 +11865,10 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11266
11865
|
});
|
|
11267
11866
|
turnOutput.finish(result.content);
|
|
11268
11867
|
const turnCredits = sumPlatformCredits(result.usageRecords);
|
|
11269
|
-
|
|
11868
|
+
const turnResult = {
|
|
11270
11869
|
exitCode: 0,
|
|
11271
11870
|
dialogId: result.dialogId,
|
|
11871
|
+
...typeof result.content === "string" && result.content.trim() ? { finalText: result.content } : {},
|
|
11272
11872
|
title: result.title,
|
|
11273
11873
|
...result.titlePatchPromise ? { titlePatchPromise: result.titlePatchPromise } : {},
|
|
11274
11874
|
...pickEmptyAssistantFlags(result),
|
|
@@ -11280,8 +11880,22 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11280
11880
|
...turnCredits !== void 0 ? { turnCredits } : {},
|
|
11281
11881
|
...result.usageRecords?.length ? { usageRecords: result.usageRecords } : {}
|
|
11282
11882
|
};
|
|
11883
|
+
const serverMeta = resolveResultServerMeta({
|
|
11884
|
+
env: options.env ?? {},
|
|
11885
|
+
userId: resolveLocalUserId(options.env ?? {}),
|
|
11886
|
+
hasSubjectRefs: (buildSubjectRefs(options)?.length ?? 0) > 0
|
|
11887
|
+
});
|
|
11888
|
+
recordRunResultHeaderMeta(turnResult, {
|
|
11889
|
+
model: result.model,
|
|
11890
|
+
dialogServer: serverMeta.server,
|
|
11891
|
+
serverSync: serverMeta.serverSync
|
|
11892
|
+
});
|
|
11893
|
+
return turnResult;
|
|
11283
11894
|
} catch (error) {
|
|
11284
11895
|
turnOutput.spinner.stop();
|
|
11896
|
+
turnOutput.cancel({
|
|
11897
|
+
preservePendingNarration: error?.code !== LOCAL_TURN_ABORTED_CODE && !options.abortSignal?.aborted
|
|
11898
|
+
});
|
|
11285
11899
|
const savedDialogId = error?.dialogId;
|
|
11286
11900
|
const abortedUsageRecords = error?.usageRecords;
|
|
11287
11901
|
const abortedTurnCredits = sumPlatformCredits(abortedUsageRecords);
|
|
@@ -11305,13 +11919,15 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11305
11919
|
error.cooldownUntil = cooldownUntil;
|
|
11306
11920
|
}
|
|
11307
11921
|
if (settings.reportFailure) {
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11922
|
+
const failureLine = formatLocalTurnFailureLine(error);
|
|
11923
|
+
if (typeof options.output.writeErr === "function") {
|
|
11924
|
+
options.output.writeErr(failureLine);
|
|
11925
|
+
} else {
|
|
11926
|
+
options.output.write(failureLine);
|
|
11927
|
+
}
|
|
11312
11928
|
if (cooldownUntil) {
|
|
11313
11929
|
options.output.write(
|
|
11314
|
-
`[nolo] \u5DF2\
|
|
11930
|
+
`[nolo] \u5DF2\u6682\u505C\u8BE5\u51ED\u8BC1\u7684\u6D3E\u53D1\uFF0C\u672C\u5730\u51B7\u5374\u6700\u665A ${cooldownUntil} \u5230\u671F\uFF08\u4E0D\u4EE3\u8868\u4E0A\u6E38\u989D\u5EA6\u5C4A\u65F6\u4E00\u5B9A\u6062\u590D\uFF09\uFF1B\u51B7\u5374\u671F\u95F4\u518D\u6B21\u6D3E\u53D1\u65F6\uFF0C\u7EA6\u6BCF ${Math.round(PROBE_INTERVAL_MS / 6e4)} \u5206\u949F\u653E\u884C\u4E00\u6B21\u8BD5\u63A2\u8BF7\u6C42\uFF0C\u6210\u529F\u5373\u6062\u590D\u3002\u82E5\u5DF2\u5145\u503C\u6216\u91CD\u7F6E\u989D\u5EA6\uFF0C\u53EF\u8FD0\u884C \`nolo auth cooldown\` \u67E5\u770B\u88AB\u6682\u505C\u7684\u51ED\u8BC1\u540D\uFF0C\u518D\u7528 \`nolo auth cooldown --clear <\u51ED\u8BC1\u540D>\` \u7ACB\u5373\u6062\u590D\u3002
|
|
11315
11931
|
`
|
|
11316
11932
|
);
|
|
11317
11933
|
}
|
|
@@ -11371,7 +11987,7 @@ Dispatch aborted before reaching the server. Pick another agent via listAgents,
|
|
|
11371
11987
|
return { exitCode: 1 };
|
|
11372
11988
|
}
|
|
11373
11989
|
function foldLocalResultForTui(localResult) {
|
|
11374
|
-
|
|
11990
|
+
const folded = {
|
|
11375
11991
|
exitCode: localResult.exitCode,
|
|
11376
11992
|
...localResult.dialogId ? { dialogId: localResult.dialogId } : {},
|
|
11377
11993
|
title: localResult.title,
|
|
@@ -11388,8 +12004,17 @@ function foldLocalResultForTui(localResult) {
|
|
|
11388
12004
|
// 漏过 turnCredits(fix/tui-session-credits),usageRecords 是同坑位新字段。
|
|
11389
12005
|
...localResult.usageRecords?.length ? { usageRecords: localResult.usageRecords } : {},
|
|
11390
12006
|
...localResult.streamInterrupted ? { streamInterrupted: localResult.streamInterrupted } : {},
|
|
11391
|
-
...localResult.pendingToolName ? { pendingToolName: localResult.pendingToolName } : {}
|
|
12007
|
+
...localResult.pendingToolName ? { pendingToolName: localResult.pendingToolName } : {},
|
|
12008
|
+
// 结论正文必须随行:auto→local 是本函数的唯一出口(runAgentTurn 的两处
|
|
12009
|
+
// 成功分支都 return foldLocalResultForTui(...)),漏掉它 = 默认派发路径
|
|
12010
|
+
// 上 finalText 永远到不了结算点 → agentRunCommand 的 settleRunTerminal-
|
|
12011
|
+
// Authoritatively 拿不到 lastAssistantText → `.result.md` 不写、status 无
|
|
12012
|
+
// resultFile,编排者只能去啃带 ANSI 的 .log(同坑位历史:turnCredits)。
|
|
12013
|
+
...localResult.finalText ? { finalText: localResult.finalText } : {}
|
|
11392
12014
|
};
|
|
12015
|
+
const headerMeta = getRunResultHeaderMeta(localResult);
|
|
12016
|
+
recordRunResultHeaderMeta(folded, headerMeta);
|
|
12017
|
+
return folded;
|
|
11393
12018
|
}
|
|
11394
12019
|
async function runAgentTurn(options) {
|
|
11395
12020
|
const authToken = resolveAuthToken2(options.env);
|
|
@@ -11459,23 +12084,204 @@ async function runAgentTurn(options) {
|
|
|
11459
12084
|
return httpResult;
|
|
11460
12085
|
}
|
|
11461
12086
|
|
|
12087
|
+
// packages/cli/client/terminalProgramStatus.ts
|
|
12088
|
+
var TERMINAL_PROGRAM_STATUS_APP = "nolo";
|
|
12089
|
+
var KNOWN_STATES = /* @__PURE__ */ new Set([
|
|
12090
|
+
"idle",
|
|
12091
|
+
"working",
|
|
12092
|
+
"blocked",
|
|
12093
|
+
"done",
|
|
12094
|
+
"error"
|
|
12095
|
+
]);
|
|
12096
|
+
var KNOWN_KINDS = /* @__PURE__ */ new Set([
|
|
12097
|
+
"permission",
|
|
12098
|
+
"question",
|
|
12099
|
+
"auth"
|
|
12100
|
+
]);
|
|
12101
|
+
function encodeTerminalProgramStatus(report) {
|
|
12102
|
+
const state2 = report?.state;
|
|
12103
|
+
if (typeof state2 !== "string" || !KNOWN_STATES.has(state2)) return null;
|
|
12104
|
+
const pairs = [`state=${state2}`, `app=${TERMINAL_PROGRAM_STATUS_APP}`];
|
|
12105
|
+
if (state2 === "blocked" && typeof report.kind === "string" && KNOWN_KINDS.has(report.kind)) {
|
|
12106
|
+
pairs.push(`kind=${report.kind}`);
|
|
12107
|
+
}
|
|
12108
|
+
return `\x1B]7501;${pairs.join(":")}\x1B\\`;
|
|
12109
|
+
}
|
|
12110
|
+
function emitTerminalProgramStatus(output, report) {
|
|
12111
|
+
if (!output || typeof output.write !== "function") return false;
|
|
12112
|
+
if (output.isTTY !== true) return false;
|
|
12113
|
+
const sequence2 = encodeTerminalProgramStatus(report);
|
|
12114
|
+
if (sequence2 === null) return false;
|
|
12115
|
+
try {
|
|
12116
|
+
output.write(sequence2);
|
|
12117
|
+
return true;
|
|
12118
|
+
} catch {
|
|
12119
|
+
return false;
|
|
12120
|
+
}
|
|
12121
|
+
}
|
|
12122
|
+
|
|
12123
|
+
// packages/cli/client/terminalRunStatus.ts
|
|
12124
|
+
var FAILED_EMPTY_ASSISTANT_REASONS = /* @__PURE__ */ new Set([
|
|
12125
|
+
"length_truncated",
|
|
12126
|
+
"stream_truncated",
|
|
12127
|
+
"repetition_loop",
|
|
12128
|
+
"stagnant_tool_calls"
|
|
12129
|
+
]);
|
|
12130
|
+
var isRunResultStalledOrTruncated = (result) => !result.emptyAssistantOutputUsable && FAILED_EMPTY_ASSISTANT_REASONS.has(result.emptyAssistantFallbackReason ?? "");
|
|
12131
|
+
function resolveTerminalProgramStatusState(input) {
|
|
12132
|
+
if (input.interrupted) return "idle";
|
|
12133
|
+
if (input.stalledOrTruncated || input.exitCode !== 0) return "error";
|
|
12134
|
+
return "done";
|
|
12135
|
+
}
|
|
12136
|
+
|
|
12137
|
+
// packages/cli/client/oneShotTerminalStatus.ts
|
|
12138
|
+
function resolveOneShotTerminalState(result) {
|
|
12139
|
+
return resolveTerminalProgramStatusState({
|
|
12140
|
+
exitCode: result.exitCode,
|
|
12141
|
+
interrupted: result.streamInterrupted,
|
|
12142
|
+
stalledOrTruncated: result.stalledOrTruncated
|
|
12143
|
+
});
|
|
12144
|
+
}
|
|
12145
|
+
function createOneShotTerminalStatus(output) {
|
|
12146
|
+
let last;
|
|
12147
|
+
let terminal = false;
|
|
12148
|
+
const report = (state2) => {
|
|
12149
|
+
if (!output || terminal || last === state2) return;
|
|
12150
|
+
last = state2;
|
|
12151
|
+
if (state2 === "done" || state2 === "error") terminal = true;
|
|
12152
|
+
emitTerminalProgramStatus(output, { state: state2 });
|
|
12153
|
+
};
|
|
12154
|
+
return {
|
|
12155
|
+
working: () => report("working"),
|
|
12156
|
+
settle: (result) => report(resolveOneShotTerminalState(result)),
|
|
12157
|
+
fail: () => report("error")
|
|
12158
|
+
};
|
|
12159
|
+
}
|
|
12160
|
+
|
|
11462
12161
|
// packages/cli/agentRunCommand.ts
|
|
11463
12162
|
import * as nodeFs from "node:fs";
|
|
11464
12163
|
|
|
11465
12164
|
// packages/cli/client/autoModelRouter.ts
|
|
11466
12165
|
var CLI_AUTO_ROUTE_AGENT_KEY = BUILTIN_NOLO_AGENT_KEY;
|
|
11467
12166
|
|
|
11468
|
-
// packages/agent-runtime/
|
|
12167
|
+
// packages/agent-runtime/hostEnvironment.ts
|
|
11469
12168
|
import { existsSync, readFileSync } from "node:fs";
|
|
12169
|
+
import os from "node:os";
|
|
12170
|
+
function parseLinuxOsRelease(content) {
|
|
12171
|
+
let prettyName;
|
|
12172
|
+
let name;
|
|
12173
|
+
let version;
|
|
12174
|
+
for (const line of content.split("\n")) {
|
|
12175
|
+
const trimmed = line.trim();
|
|
12176
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
12177
|
+
const eqIdx = trimmed.indexOf("=");
|
|
12178
|
+
if (eqIdx === -1) continue;
|
|
12179
|
+
const key = trimmed.slice(0, eqIdx).trim();
|
|
12180
|
+
let val = trimmed.slice(eqIdx + 1).trim();
|
|
12181
|
+
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
12182
|
+
val = val.slice(1, -1);
|
|
12183
|
+
}
|
|
12184
|
+
if (key === "PRETTY_NAME") {
|
|
12185
|
+
prettyName = val;
|
|
12186
|
+
} else if (key === "NAME") {
|
|
12187
|
+
name = val;
|
|
12188
|
+
} else if (key === "VERSION") {
|
|
12189
|
+
version = val;
|
|
12190
|
+
}
|
|
12191
|
+
}
|
|
12192
|
+
if (prettyName) return prettyName;
|
|
12193
|
+
if (name && version) return `${name} ${version}`;
|
|
12194
|
+
return name;
|
|
12195
|
+
}
|
|
12196
|
+
function probeHostEnvironment(options) {
|
|
12197
|
+
const platform = options?.platform ?? process.platform;
|
|
12198
|
+
const arch = options?.arch ?? os.arch();
|
|
12199
|
+
const release = options?.release ?? os.release();
|
|
12200
|
+
const env = options?.env ?? process.env;
|
|
12201
|
+
let osName = `${platform} ${release}`;
|
|
12202
|
+
if (platform === "linux") {
|
|
12203
|
+
let osReleaseText = options?.osReleaseContent;
|
|
12204
|
+
if (osReleaseText === void 0) {
|
|
12205
|
+
try {
|
|
12206
|
+
if (existsSync("/etc/os-release")) {
|
|
12207
|
+
osReleaseText = readFileSync("/etc/os-release", "utf8");
|
|
12208
|
+
} else if (existsSync("/usr/lib/os-release")) {
|
|
12209
|
+
osReleaseText = readFileSync("/usr/lib/os-release", "utf8");
|
|
12210
|
+
}
|
|
12211
|
+
} catch {
|
|
12212
|
+
}
|
|
12213
|
+
}
|
|
12214
|
+
if (osReleaseText) {
|
|
12215
|
+
const parsed = parseLinuxOsRelease(osReleaseText);
|
|
12216
|
+
if (parsed) {
|
|
12217
|
+
osName = parsed;
|
|
12218
|
+
} else {
|
|
12219
|
+
osName = `Linux ${release}`;
|
|
12220
|
+
}
|
|
12221
|
+
} else {
|
|
12222
|
+
osName = `Linux ${release}`;
|
|
12223
|
+
}
|
|
12224
|
+
} else if (platform === "darwin") {
|
|
12225
|
+
osName = `macOS (${release})`;
|
|
12226
|
+
} else if (platform === "win32") {
|
|
12227
|
+
osName = `Windows (${release})`;
|
|
12228
|
+
}
|
|
12229
|
+
const desktop = env.XDG_CURRENT_DESKTOP || env.XDG_SESSION_DESKTOP || env.DESKTOP_SESSION || void 0;
|
|
12230
|
+
const sessionType = env.XDG_SESSION_TYPE || void 0;
|
|
12231
|
+
const shell = env.SHELL || (platform === "win32" ? env.COMSPEC || "PowerShell" : void 0);
|
|
12232
|
+
return {
|
|
12233
|
+
platform,
|
|
12234
|
+
osName,
|
|
12235
|
+
arch,
|
|
12236
|
+
desktop,
|
|
12237
|
+
sessionType,
|
|
12238
|
+
shell
|
|
12239
|
+
};
|
|
12240
|
+
}
|
|
12241
|
+
function formatHostEnvironmentContent(details) {
|
|
12242
|
+
const lines = ["--- \u5BBF\u4E3B\u73AF\u5883\uFF08Host Environment\uFF09---"];
|
|
12243
|
+
lines.push(`\u64CD\u4F5C\u7CFB\u7EDF: ${details.osName} (${details.arch})`);
|
|
12244
|
+
if (details.desktop || details.sessionType) {
|
|
12245
|
+
const desktopParts = [];
|
|
12246
|
+
if (details.desktop) desktopParts.push(details.desktop);
|
|
12247
|
+
if (details.sessionType) desktopParts.push(details.sessionType);
|
|
12248
|
+
lines.push(`\u684C\u9762\u73AF\u5883: ${desktopParts.join(" / ")}`);
|
|
12249
|
+
}
|
|
12250
|
+
if (details.shell) {
|
|
12251
|
+
lines.push(`\u9ED8\u8BA4 Shell: ${details.shell}`);
|
|
12252
|
+
}
|
|
12253
|
+
return lines.join("\n");
|
|
12254
|
+
}
|
|
12255
|
+
var cachedLayer = null;
|
|
12256
|
+
function buildHostEnvironmentLayer(options) {
|
|
12257
|
+
if (!options && cachedLayer) {
|
|
12258
|
+
return cachedLayer;
|
|
12259
|
+
}
|
|
12260
|
+
const details = probeHostEnvironment(options);
|
|
12261
|
+
const content = formatHostEnvironmentContent(details);
|
|
12262
|
+
const layer = {
|
|
12263
|
+
id: "host-environment",
|
|
12264
|
+
owner: "runtime",
|
|
12265
|
+
cacheScope: "session",
|
|
12266
|
+
content
|
|
12267
|
+
};
|
|
12268
|
+
if (!options) {
|
|
12269
|
+
cachedLayer = layer;
|
|
12270
|
+
}
|
|
12271
|
+
return layer;
|
|
12272
|
+
}
|
|
12273
|
+
|
|
12274
|
+
// packages/agent-runtime/agentsMd.ts
|
|
12275
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
11470
12276
|
import { join } from "node:path";
|
|
11471
12277
|
var AGENTS_MD_MAX_BYTES = 8192;
|
|
11472
12278
|
var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
|
|
11473
12279
|
function readAgentsMdLayerFromDisk(cwd) {
|
|
11474
12280
|
for (const name of AGENTS_MD_CANDIDATES) {
|
|
11475
12281
|
const filePath = join(cwd, name);
|
|
11476
|
-
if (!
|
|
12282
|
+
if (!existsSync2(filePath)) continue;
|
|
11477
12283
|
try {
|
|
11478
|
-
let content =
|
|
12284
|
+
let content = readFileSync2(filePath, "utf8").trim();
|
|
11479
12285
|
if (!content) continue;
|
|
11480
12286
|
if (Buffer.byteLength(content, "utf8") > AGENTS_MD_MAX_BYTES) {
|
|
11481
12287
|
content = Buffer.from(content, "utf8").subarray(0, AGENTS_MD_MAX_BYTES).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
|
|
@@ -11545,14 +12351,14 @@ function runDoDCommands(commands, cwd, deps = {}) {
|
|
|
11545
12351
|
}
|
|
11546
12352
|
|
|
11547
12353
|
// packages/cli/agentRunPrompts.ts
|
|
11548
|
-
import { existsSync as
|
|
12354
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync, statSync as statSync2 } from "node:fs";
|
|
11549
12355
|
import { dirname, extname, isAbsolute, join as join2, relative as relativePath, resolve, sep } from "node:path";
|
|
11550
12356
|
function workflowRefToCandidatePath(cwd, ref) {
|
|
11551
12357
|
const normalized = ref.trim();
|
|
11552
12358
|
if (!normalized) return "";
|
|
11553
12359
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
11554
12360
|
const directPath = resolve(cwd, normalized);
|
|
11555
|
-
if (
|
|
12361
|
+
if (existsSync3(directPath)) return directPath;
|
|
11556
12362
|
}
|
|
11557
12363
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
11558
12364
|
return resolve(cwd, "docs", "workflows", `${fileName}.md`);
|
|
@@ -11565,21 +12371,21 @@ function skillRefToCandidatePath(cwd, ref) {
|
|
|
11565
12371
|
if (!normalized) return "";
|
|
11566
12372
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
11567
12373
|
const directPath = resolve(cwd, normalized);
|
|
11568
|
-
if (
|
|
12374
|
+
if (existsSync3(directPath)) return directPath;
|
|
11569
12375
|
}
|
|
11570
12376
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
11571
12377
|
for (const dir of SKILL_SEARCH_DIRS) {
|
|
11572
12378
|
const skillMdPath = resolve(cwd, dir, fileName, "SKILL.md");
|
|
11573
|
-
if (
|
|
12379
|
+
if (existsSync3(skillMdPath)) return skillMdPath;
|
|
11574
12380
|
}
|
|
11575
12381
|
return resolve(cwd, ".agents", "skills", fileName, "SKILL.md");
|
|
11576
12382
|
}
|
|
11577
12383
|
async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
11578
|
-
const
|
|
11579
|
-
if (!
|
|
12384
|
+
const path2 = workflowRefToCandidatePath(cwd, ref);
|
|
12385
|
+
if (!path2 || !existsSync3(path2)) {
|
|
11580
12386
|
throw new Error(`Workflow reference not found: ${ref}`);
|
|
11581
12387
|
}
|
|
11582
|
-
const markdown =
|
|
12388
|
+
const markdown = readFileSync3(path2, "utf8");
|
|
11583
12389
|
const parsed = parseSkillDocProtocol(markdown);
|
|
11584
12390
|
return {
|
|
11585
12391
|
ref,
|
|
@@ -11596,8 +12402,8 @@ function inlineRelativeRefs(body, skillDir) {
|
|
|
11596
12402
|
const absPath = resolve(skillDir, cleaned);
|
|
11597
12403
|
const relative = relativePath(normalizedSkillDir, absPath);
|
|
11598
12404
|
if (relative.startsWith("..") || isAbsolute(relative)) return match;
|
|
11599
|
-
if (!
|
|
11600
|
-
const refContent =
|
|
12405
|
+
if (!existsSync3(absPath) || !absPath.endsWith(".md")) return match;
|
|
12406
|
+
const refContent = readFileSync3(absPath, "utf8");
|
|
11601
12407
|
return `
|
|
11602
12408
|
|
|
11603
12409
|
### ${label}
|
|
@@ -11609,7 +12415,7 @@ ${refContent}
|
|
|
11609
12415
|
}
|
|
11610
12416
|
function listSkillScripts(skillDir) {
|
|
11611
12417
|
const scriptsDir = join2(skillDir, "scripts");
|
|
11612
|
-
if (!
|
|
12418
|
+
if (!existsSync3(scriptsDir) || !statSync2(scriptsDir).isDirectory()) return null;
|
|
11613
12419
|
const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
|
|
11614
12420
|
if (entries.length === 0) return null;
|
|
11615
12421
|
return [
|
|
@@ -11635,13 +12441,13 @@ async function resolveSkillReference(ref, options = {}) {
|
|
|
11635
12441
|
markdown = String(contentText);
|
|
11636
12442
|
} else {
|
|
11637
12443
|
const cwd = options.cwd ?? process.cwd();
|
|
11638
|
-
const
|
|
11639
|
-
if (!
|
|
12444
|
+
const path2 = skillRefToCandidatePath(cwd, ref);
|
|
12445
|
+
if (!path2 || !existsSync3(path2)) {
|
|
11640
12446
|
throw new Error(`Skill reference not found: ${ref}`);
|
|
11641
12447
|
}
|
|
11642
|
-
markdown =
|
|
11643
|
-
filePath =
|
|
11644
|
-
skillDir = dirname(
|
|
12448
|
+
markdown = readFileSync3(path2, "utf8");
|
|
12449
|
+
filePath = path2;
|
|
12450
|
+
skillDir = dirname(path2);
|
|
11645
12451
|
}
|
|
11646
12452
|
const parsed = parseSkillDocProtocol(markdown);
|
|
11647
12453
|
const name = parsed.meta?.skillConfig?.name;
|
|
@@ -11744,12 +12550,12 @@ function prependSubjectDialogMarker(message, subjectDialogKey) {
|
|
|
11744
12550
|
function normalizeCliImageInput(input) {
|
|
11745
12551
|
if (/^(https?:|data:|file:)/i.test(input)) return input;
|
|
11746
12552
|
const absolutePath = resolve(input);
|
|
11747
|
-
if (!
|
|
11748
|
-
const base64 =
|
|
12553
|
+
if (!existsSync3(absolutePath)) return input;
|
|
12554
|
+
const base64 = readFileSync3(absolutePath).toString("base64");
|
|
11749
12555
|
return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
|
|
11750
12556
|
}
|
|
11751
|
-
function imageMimeTypeForPath(
|
|
11752
|
-
switch (extname(
|
|
12557
|
+
function imageMimeTypeForPath(path2) {
|
|
12558
|
+
switch (extname(path2).toLowerCase()) {
|
|
11753
12559
|
case ".jpg":
|
|
11754
12560
|
case ".jpeg":
|
|
11755
12561
|
return "image/jpeg";
|
|
@@ -12171,8 +12977,8 @@ var scoreMemoryItem = (item, query, nowMs = Date.now(), context) => {
|
|
|
12171
12977
|
const confidence = item.confidence ?? 0;
|
|
12172
12978
|
const typeFit = typeFitScore(item);
|
|
12173
12979
|
const understanding = understandingScore(item);
|
|
12174
|
-
const
|
|
12175
|
-
return 0.25 * queryMatch + 0.2 * identifierMatch + 0.2 *
|
|
12980
|
+
const path2 = pathScore(item, context);
|
|
12981
|
+
return 0.25 * queryMatch + 0.2 * identifierMatch + 0.2 * path2 + 0.09 * retrieval + // weak retrieval signal, NOT successful-use reinforcement
|
|
12176
12982
|
0.16 * createdRecency + 0.06 * importance + 0.03 * confidence + 0.02 * typeFit + 0.01 * understanding;
|
|
12177
12983
|
};
|
|
12178
12984
|
var rankMemoryCandidates = (items, query, context) => {
|
|
@@ -12188,70 +12994,52 @@ var rankMemoryCandidates = (items, query, context) => {
|
|
|
12188
12994
|
});
|
|
12189
12995
|
};
|
|
12190
12996
|
|
|
12191
|
-
// packages/ai/memory/vnext/
|
|
12192
|
-
var
|
|
12193
|
-
var
|
|
12194
|
-
var
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
var relationKey = (ownerId, id) => `mem2-r-${enc(ownerId)}-${enc(id)}`;
|
|
12201
|
-
var relationFromIndexKey = (ownerId, from, relationId) => `mem2-rf-${enc(ownerId)}-${enc(from)}-${enc(relationId)}`;
|
|
12202
|
-
var relationToIndexKey = (ownerId, to, relationId) => `mem2-rt-${enc(ownerId)}-${enc(to)}-${enc(relationId)}`;
|
|
12203
|
-
var readIndexed = async (db, prefix) => {
|
|
12204
|
-
const refs = [];
|
|
12205
|
-
for await (const [, value] of db.iterator({ ...rangeOf(prefix), reverse: false })) {
|
|
12206
|
-
if (typeof value?.key === "string") refs.push(value.key);
|
|
12207
|
-
}
|
|
12208
|
-
const rows = await Promise.all(refs.map((key) => db.get(key).catch(() => null)));
|
|
12209
|
-
return rows.filter((row) => !!row);
|
|
12997
|
+
// packages/ai/memory/vnext/detachedThrottle.ts
|
|
12998
|
+
var DEFAULT_DETACHED_MEMORY_COOLDOWN_MS = 10 * 60 * 1e3;
|
|
12999
|
+
var MAX_COOLDOWN_KEYS = 512;
|
|
13000
|
+
var readMsEnv = (raw, fallback, allowZero) => {
|
|
13001
|
+
if (raw === void 0 || raw.trim() === "") return fallback;
|
|
13002
|
+
const parsed = Number(raw);
|
|
13003
|
+
if (!Number.isFinite(parsed) || parsed < 0) return fallback;
|
|
13004
|
+
if (parsed === 0 && !allowZero) return fallback;
|
|
13005
|
+
return parsed;
|
|
12210
13006
|
};
|
|
12211
|
-
var
|
|
12212
|
-
|
|
12213
|
-
const
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
};
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
};
|
|
12247
|
-
var _appendRetiredStateBatch = (batch, state2) => {
|
|
12248
|
-
batch.put(stateKey(state2.ownerId, state2.id), state2);
|
|
12249
|
-
};
|
|
12250
|
-
var _appendRelationBatch = (batch, relation) => {
|
|
12251
|
-
const key = relationKey(relation.ownerId, relation.id);
|
|
12252
|
-
batch.put(key, relation);
|
|
12253
|
-
batch.put(relationFromIndexKey(relation.ownerId, relation.from, relation.id), { key });
|
|
12254
|
-
batch.put(relationToIndexKey(relation.ownerId, relation.to, relation.id), { key });
|
|
13007
|
+
var createDetachedThrottle = (input) => {
|
|
13008
|
+
let inFlight2 = false;
|
|
13009
|
+
const lastStartedAt = /* @__PURE__ */ new Map();
|
|
13010
|
+
const resolveCooldownMs = (env = typeof process !== "undefined" ? process.env : {}) => readMsEnv(env[input.cooldownEnvKey], input.defaultCooldownMs, true);
|
|
13011
|
+
const rememberStart = (key, clockMs) => {
|
|
13012
|
+
lastStartedAt.delete(key);
|
|
13013
|
+
lastStartedAt.set(key, clockMs);
|
|
13014
|
+
while (lastStartedAt.size > MAX_COOLDOWN_KEYS) {
|
|
13015
|
+
lastStartedAt.delete(lastStartedAt.keys().next().value);
|
|
13016
|
+
}
|
|
13017
|
+
};
|
|
13018
|
+
return {
|
|
13019
|
+
name: input.name,
|
|
13020
|
+
defaultCooldownMs: input.defaultCooldownMs,
|
|
13021
|
+
cooldownEnvKey: input.cooldownEnvKey,
|
|
13022
|
+
resolveCooldownMs,
|
|
13023
|
+
tryAcquire(key, clockMs, cooldownMs) {
|
|
13024
|
+
if (inFlight2) return "busy";
|
|
13025
|
+
const interval = cooldownMs ?? resolveCooldownMs();
|
|
13026
|
+
const lastStarted = lastStartedAt.get(key);
|
|
13027
|
+
if (interval > 0 && lastStarted !== void 0 && clockMs - lastStarted < interval) {
|
|
13028
|
+
return "cooldown";
|
|
13029
|
+
}
|
|
13030
|
+
inFlight2 = true;
|
|
13031
|
+
rememberStart(key, clockMs);
|
|
13032
|
+
return "run";
|
|
13033
|
+
},
|
|
13034
|
+
release() {
|
|
13035
|
+
inFlight2 = false;
|
|
13036
|
+
},
|
|
13037
|
+
isInFlight: () => inFlight2,
|
|
13038
|
+
reset() {
|
|
13039
|
+
inFlight2 = false;
|
|
13040
|
+
lastStartedAt.clear();
|
|
13041
|
+
}
|
|
13042
|
+
};
|
|
12255
13043
|
};
|
|
12256
13044
|
|
|
12257
13045
|
// packages/ai/memory/vnext/recall.ts
|
|
@@ -12283,14 +13071,6 @@ var parseSelection = (raw) => {
|
|
|
12283
13071
|
reason: obj.reason
|
|
12284
13072
|
};
|
|
12285
13073
|
};
|
|
12286
|
-
var buildCatalog = async (db, ownerId) => {
|
|
12287
|
-
const entities = await listMemoryEntitiesVNext(db, ownerId);
|
|
12288
|
-
const states = [];
|
|
12289
|
-
for (const entity of entities) {
|
|
12290
|
-
states.push(...await listMemoryStatesForEntityVNext(db, ownerId, entity.id));
|
|
12291
|
-
}
|
|
12292
|
-
return { entities, states };
|
|
12293
|
-
};
|
|
12294
13074
|
var catalogText = (entities, states) => JSON.stringify(
|
|
12295
13075
|
{
|
|
12296
13076
|
entities: entities.map((entity) => ({
|
|
@@ -12316,7 +13096,7 @@ var catalogText = (entities, states) => JSON.stringify(
|
|
|
12316
13096
|
);
|
|
12317
13097
|
var createMemoryVNextRecall = (input) => async (query) => {
|
|
12318
13098
|
const startedAt = performance.now();
|
|
12319
|
-
const { entities, states } = await
|
|
13099
|
+
const { entities, states } = await loadMemoryVNextCatalog(input.db, input.ownerId);
|
|
12320
13100
|
if (entities.length === 0 && states.length === 0) {
|
|
12321
13101
|
return {
|
|
12322
13102
|
query,
|
|
@@ -12422,6 +13202,20 @@ var buildLegacyMemoryEvidence = (item) => {
|
|
|
12422
13202
|
// packages/ai/memory/vnext/shadowRead.ts
|
|
12423
13203
|
var SHADOW_TIMEOUT_MS = 2e4;
|
|
12424
13204
|
var ERROR_MESSAGE_MAX = 120;
|
|
13205
|
+
var MEMORY_VNEXT_SHADOW_READ_COOLDOWN_ENV = "NOLO_MEMORY_VNEXT_SHADOW_READ_COOLDOWN_MS";
|
|
13206
|
+
var DEFAULT_SHADOW_READ_COOLDOWN_MS = DEFAULT_DETACHED_MEMORY_COOLDOWN_MS;
|
|
13207
|
+
var shadowReadThrottle = createDetachedThrottle({
|
|
13208
|
+
name: "shadow_read",
|
|
13209
|
+
defaultCooldownMs: DEFAULT_SHADOW_READ_COOLDOWN_MS,
|
|
13210
|
+
cooldownEnvKey: MEMORY_VNEXT_SHADOW_READ_COOLDOWN_ENV
|
|
13211
|
+
});
|
|
13212
|
+
var resolveShadowReadCooldownMs = (env) => shadowReadThrottle.resolveCooldownMs(env);
|
|
13213
|
+
var shadowReadThrottleKey = (owners) => owners.map(
|
|
13214
|
+
(owner) => resolveLegacyMemoryPrincipal({
|
|
13215
|
+
ownerType: owner.ownerType,
|
|
13216
|
+
ownerId: owner.ownerId
|
|
13217
|
+
}).principalId
|
|
13218
|
+
).sort().join("");
|
|
12425
13219
|
var normalizeTextKey = (text) => text.trim().replace(/\s+/g, " ").toLowerCase();
|
|
12426
13220
|
var legacyItemKeys = (item) => {
|
|
12427
13221
|
const keys = [normalizeTextKey(item.content ?? "")];
|
|
@@ -12458,14 +13252,35 @@ var withTimeout = async (promise, timeoutMs, label) => {
|
|
|
12458
13252
|
};
|
|
12459
13253
|
var runMemoryVNextShadowRead = async (input) => {
|
|
12460
13254
|
const now = input.ctx.now ?? (() => performance.now());
|
|
12461
|
-
const defaultEmit = (
|
|
13255
|
+
const defaultEmit = (observation) => {
|
|
12462
13256
|
const payload = {
|
|
12463
13257
|
event: "memory_vnext_shadow_read",
|
|
12464
|
-
...
|
|
13258
|
+
...observation
|
|
12465
13259
|
};
|
|
12466
13260
|
console.info("[memory] vnext shadow read", payload);
|
|
12467
13261
|
};
|
|
12468
13262
|
const emit = input.emit ?? defaultEmit;
|
|
13263
|
+
const throttle = shadowReadThrottle.tryAcquire(
|
|
13264
|
+
shadowReadThrottleKey(input.ctx.owners),
|
|
13265
|
+
now(),
|
|
13266
|
+
input.ctx.cooldownMs ?? resolveShadowReadCooldownMs()
|
|
13267
|
+
);
|
|
13268
|
+
if (throttle !== "run") {
|
|
13269
|
+
const skippedObservation = {
|
|
13270
|
+
legacyHitCount: input.legacyItems.length,
|
|
13271
|
+
vnextHitCount: 0,
|
|
13272
|
+
overlapCount: null,
|
|
13273
|
+
legacyOnlyCount: null,
|
|
13274
|
+
vnextOnlyCount: null,
|
|
13275
|
+
legacyLatencyMs: input.legacyLatencyMs,
|
|
13276
|
+
vnextLatencyMs: 0,
|
|
13277
|
+
legacyContextChars: input.legacyContextChars,
|
|
13278
|
+
vnextContextChars: 0,
|
|
13279
|
+
skipped: throttle === "busy" ? "skipped_busy" : "skipped_cooldown"
|
|
13280
|
+
};
|
|
13281
|
+
emit(skippedObservation);
|
|
13282
|
+
return skippedObservation;
|
|
13283
|
+
}
|
|
12469
13284
|
const legacyKeys = new Set(
|
|
12470
13285
|
input.legacyItems.flatMap((item) => legacyItemKeys(item))
|
|
12471
13286
|
);
|
|
@@ -12502,31 +13317,35 @@ var runMemoryVNextShadowRead = async (input) => {
|
|
|
12502
13317
|
} catch (error) {
|
|
12503
13318
|
vnextError = shortError(error);
|
|
12504
13319
|
}
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
13320
|
+
try {
|
|
13321
|
+
const vnextLatencyMs = Math.round((now() - vnextStartedAt) * 10) / 10;
|
|
13322
|
+
let overlapCount = null;
|
|
13323
|
+
let legacyOnlyCount = null;
|
|
13324
|
+
let vnextOnlyCount = null;
|
|
13325
|
+
if (!vnextError) {
|
|
13326
|
+
let overlap = 0;
|
|
13327
|
+
for (const key of vnextKeys) if (legacyKeys.has(key)) overlap += 1;
|
|
13328
|
+
overlapCount = overlap;
|
|
13329
|
+
legacyOnlyCount = Math.max(0, legacyKeys.size - overlap);
|
|
13330
|
+
vnextOnlyCount = Math.max(0, vnextKeys.size - overlap);
|
|
13331
|
+
}
|
|
13332
|
+
const observation = {
|
|
13333
|
+
legacyHitCount: input.legacyItems.length,
|
|
13334
|
+
vnextHitCount,
|
|
13335
|
+
overlapCount,
|
|
13336
|
+
legacyOnlyCount,
|
|
13337
|
+
vnextOnlyCount,
|
|
13338
|
+
legacyLatencyMs: input.legacyLatencyMs,
|
|
13339
|
+
vnextLatencyMs,
|
|
13340
|
+
legacyContextChars: input.legacyContextChars,
|
|
13341
|
+
vnextContextChars: vnextChars,
|
|
13342
|
+
...vnextError ? { vnextError } : {}
|
|
13343
|
+
};
|
|
13344
|
+
emit(observation);
|
|
13345
|
+
return observation;
|
|
13346
|
+
} finally {
|
|
13347
|
+
shadowReadThrottle.release();
|
|
13348
|
+
}
|
|
12530
13349
|
};
|
|
12531
13350
|
var isMemoryVNextShadowReadEnabled = (env = typeof process !== "undefined" ? process.env : {}) => env.NOLO_MEMORY_VNEXT_SHADOW_READ === "1" || env.NOLO_MEMORY_VNEXT_SHADOW_READ === "true";
|
|
12532
13351
|
|
|
@@ -13186,15 +14005,100 @@ var shortError2 = (error) => {
|
|
|
13186
14005
|
const message = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
13187
14006
|
return message.length > ERROR_MESSAGE_MAX2 ? `${message.slice(0, ERROR_MESSAGE_MAX2)}\u2026` : message;
|
|
13188
14007
|
};
|
|
14008
|
+
var DEFAULT_LAZY_PROMOTION_COOLDOWN_MS = DEFAULT_DETACHED_MEMORY_COOLDOWN_MS;
|
|
14009
|
+
var DEFAULT_LAZY_PROMOTION_TIMEOUT_MS = 2e4;
|
|
14010
|
+
var MEMORY_VNEXT_LAZY_PROMOTION_COOLDOWN_ENV = "NOLO_MEMORY_VNEXT_LAZY_PROMOTION_COOLDOWN_MS";
|
|
14011
|
+
var MEMORY_VNEXT_LAZY_PROMOTION_TIMEOUT_ENV = "NOLO_MEMORY_VNEXT_LAZY_PROMOTION_TIMEOUT_MS";
|
|
14012
|
+
var promotionThrottle = createDetachedThrottle({
|
|
14013
|
+
name: "lazy_promotion",
|
|
14014
|
+
defaultCooldownMs: DEFAULT_LAZY_PROMOTION_COOLDOWN_MS,
|
|
14015
|
+
cooldownEnvKey: MEMORY_VNEXT_LAZY_PROMOTION_COOLDOWN_ENV
|
|
14016
|
+
});
|
|
14017
|
+
var resolveLazyPromotionTimeoutMs = (env = typeof process !== "undefined" ? process.env : {}) => readMsEnv(
|
|
14018
|
+
env[MEMORY_VNEXT_LAZY_PROMOTION_TIMEOUT_ENV],
|
|
14019
|
+
DEFAULT_LAZY_PROMOTION_TIMEOUT_MS,
|
|
14020
|
+
false
|
|
14021
|
+
);
|
|
14022
|
+
var withTimeout2 = async (promise, timeoutMs, label) => {
|
|
14023
|
+
let timer;
|
|
14024
|
+
const timeout = new Promise((_, reject) => {
|
|
14025
|
+
timer = setTimeout(() => reject(new Error(label)), timeoutMs);
|
|
14026
|
+
});
|
|
14027
|
+
try {
|
|
14028
|
+
return await Promise.race([promise, timeout]);
|
|
14029
|
+
} finally {
|
|
14030
|
+
if (timer) clearTimeout(timer);
|
|
14031
|
+
}
|
|
14032
|
+
};
|
|
13189
14033
|
var loadExistingContext = async (db, ownerId) => {
|
|
13190
|
-
const entities = await
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
14034
|
+
const { entities, states } = await loadMemoryVNextCatalog(db, ownerId);
|
|
14035
|
+
return { entityIds: entities.map((entity) => entity.id), states };
|
|
14036
|
+
};
|
|
14037
|
+
var currentStatesCitingEvidence = (states, evidenceId) => states.filter((state2) => !state2.retiredAt && (state2.evidenceIds ?? []).includes(evidenceId));
|
|
14038
|
+
var isEvidenceCoveredByCurrentStates = (states, evidenceId) => currentStatesCitingEvidence(states, evidenceId).length > 0;
|
|
14039
|
+
var memoryVNextContextFingerprint = (existing) => {
|
|
14040
|
+
const states = existing.states ?? [];
|
|
14041
|
+
const entityIds = existing.entityIds ?? [];
|
|
14042
|
+
const canonical = [
|
|
14043
|
+
...entityIds.map((id) => `e\0${id}`),
|
|
14044
|
+
...states.map((state2) => `s\0${state2.id}\0${state2.updatedAt}\0${state2.retiredAt ?? ""}`)
|
|
14045
|
+
].sort().join("");
|
|
14046
|
+
let hash = 2166136261;
|
|
14047
|
+
for (let i = 0; i < canonical.length; i++) {
|
|
14048
|
+
hash ^= canonical.charCodeAt(i);
|
|
14049
|
+
hash = Math.imul(hash, 16777619);
|
|
14050
|
+
}
|
|
14051
|
+
return `${entityIds.length}.${states.length}:${(hash >>> 0).toString(16)}`;
|
|
14052
|
+
};
|
|
14053
|
+
var MAX_NOOP_SUPPRESSIONS = 512;
|
|
14054
|
+
var noOpSuppressions = /* @__PURE__ */ new Map();
|
|
14055
|
+
var suppressionKey = (ownerId, evidenceId) => `${ownerId}\0${evidenceId}`;
|
|
14056
|
+
var recordNoOpSuppression = (ownerId, evidenceId, fingerprint) => {
|
|
14057
|
+
const key = suppressionKey(ownerId, evidenceId);
|
|
14058
|
+
noOpSuppressions.delete(key);
|
|
14059
|
+
noOpSuppressions.set(key, fingerprint);
|
|
14060
|
+
while (noOpSuppressions.size > MAX_NOOP_SUPPRESSIONS) {
|
|
14061
|
+
noOpSuppressions.delete(noOpSuppressions.keys().next().value);
|
|
14062
|
+
}
|
|
14063
|
+
};
|
|
14064
|
+
var noOpHistory = (ownerId, evidenceId, fingerprint) => {
|
|
14065
|
+
const recorded = noOpSuppressions.get(suppressionKey(ownerId, evidenceId));
|
|
14066
|
+
if (recorded === void 0) return "fresh";
|
|
14067
|
+
return recorded === fingerprint ? "suppressed" : "stale";
|
|
14068
|
+
};
|
|
14069
|
+
var pickFirstUncoveredLazyPromotionItem = async (db, selected) => {
|
|
14070
|
+
const contextByOwner = /* @__PURE__ */ new Map();
|
|
14071
|
+
const contextFor = (ownerId) => {
|
|
14072
|
+
let pending = contextByOwner.get(ownerId);
|
|
14073
|
+
if (!pending) {
|
|
14074
|
+
pending = loadExistingContext(db, ownerId).then((existing) => ({
|
|
14075
|
+
states: existing.states ?? [],
|
|
14076
|
+
fingerprint: memoryVNextContextFingerprint(existing)
|
|
14077
|
+
}));
|
|
14078
|
+
contextByOwner.set(ownerId, pending);
|
|
14079
|
+
}
|
|
14080
|
+
return pending;
|
|
13197
14081
|
};
|
|
14082
|
+
let skippedCoveredCount = 0;
|
|
14083
|
+
let skippedNoOpCount = 0;
|
|
14084
|
+
let firstStale = null;
|
|
14085
|
+
for (const [selectedIndex, item] of selected.entries()) {
|
|
14086
|
+
const evidence = buildLegacyMemoryEvidence(item);
|
|
14087
|
+
const context = await contextFor(evidence.ownerId);
|
|
14088
|
+
if (isEvidenceCoveredByCurrentStates(context.states, evidence.id)) {
|
|
14089
|
+
skippedCoveredCount++;
|
|
14090
|
+
continue;
|
|
14091
|
+
}
|
|
14092
|
+
const history = noOpHistory(evidence.ownerId, evidence.id, context.fingerprint);
|
|
14093
|
+
if (history === "fresh") {
|
|
14094
|
+
return { item, selectedIndex, skippedCoveredCount, skippedNoOpCount };
|
|
14095
|
+
}
|
|
14096
|
+
if (history === "stale" && !firstStale) {
|
|
14097
|
+
firstStale = { item, selectedIndex, skippedCoveredCount, skippedNoOpCount };
|
|
14098
|
+
}
|
|
14099
|
+
skippedNoOpCount++;
|
|
14100
|
+
}
|
|
14101
|
+
return firstStale;
|
|
13198
14102
|
};
|
|
13199
14103
|
var withoutImportedEvidence = (mutation, importedEvidenceId) => ({
|
|
13200
14104
|
...mutation,
|
|
@@ -13210,6 +14114,11 @@ var runMemoryVNextLazyPromotion = async (input) => {
|
|
|
13210
14114
|
}));
|
|
13211
14115
|
const finish = (partial) => {
|
|
13212
14116
|
const observation = {
|
|
14117
|
+
legacyItemId: input.item.id,
|
|
14118
|
+
evidenceId: deterministicEvidence.id,
|
|
14119
|
+
...input.selectedIndex === void 0 ? {} : { selectedIndex: input.selectedIndex },
|
|
14120
|
+
...input.skippedCoveredCount === void 0 ? {} : { skippedCoveredCount: input.skippedCoveredCount },
|
|
14121
|
+
...input.skippedNoOpCount === void 0 ? {} : { skippedNoOpCount: input.skippedNoOpCount },
|
|
13213
14122
|
...partial,
|
|
13214
14123
|
latencyMs: Math.round((clock() - startedAt) * 10) / 10
|
|
13215
14124
|
};
|
|
@@ -13224,6 +14133,17 @@ var runMemoryVNextLazyPromotion = async (input) => {
|
|
|
13224
14133
|
if (inFlight.has(flightKey)) {
|
|
13225
14134
|
return finish({ status: "in_flight" });
|
|
13226
14135
|
}
|
|
14136
|
+
const throttle = promotionThrottle.tryAcquire(
|
|
14137
|
+
deterministicEvidence.ownerId,
|
|
14138
|
+
clock(),
|
|
14139
|
+
input.cooldownMs
|
|
14140
|
+
);
|
|
14141
|
+
if (throttle === "busy") {
|
|
14142
|
+
return finish({ status: "skipped_busy" });
|
|
14143
|
+
}
|
|
14144
|
+
if (throttle === "cooldown") {
|
|
14145
|
+
return finish({ status: "skipped_cooldown" });
|
|
14146
|
+
}
|
|
13227
14147
|
inFlight.add(flightKey);
|
|
13228
14148
|
try {
|
|
13229
14149
|
const evidenceResult = await applyLegacyMemoryEvidence(input.db, input.item);
|
|
@@ -13232,22 +14152,33 @@ var runMemoryVNextLazyPromotion = async (input) => {
|
|
|
13232
14152
|
}
|
|
13233
14153
|
const evidence = evidenceResult.evidence;
|
|
13234
14154
|
const existing = await loadExistingContext(input.db, evidence.ownerId);
|
|
13235
|
-
const alreadyCovered = (
|
|
13236
|
-
|
|
14155
|
+
const alreadyCovered = isEvidenceCoveredByCurrentStates(
|
|
14156
|
+
existing.states ?? [],
|
|
14157
|
+
evidence.id
|
|
13237
14158
|
);
|
|
13238
14159
|
if (alreadyCovered) {
|
|
13239
14160
|
return finish({ status: "already_covered" });
|
|
13240
14161
|
}
|
|
13241
|
-
const
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
14162
|
+
const timeoutMs = input.timeoutMs ?? resolveLazyPromotionTimeoutMs();
|
|
14163
|
+
const interpreted = await withTimeout2(
|
|
14164
|
+
runLegacyMemoryMigrationShadow({
|
|
14165
|
+
item: input.item,
|
|
14166
|
+
provider: input.provider,
|
|
14167
|
+
existing,
|
|
14168
|
+
timeoutMs,
|
|
14169
|
+
...input.now === void 0 ? {} : { now: input.now },
|
|
14170
|
+
...input.nextId ? { nextId: input.nextId } : {}
|
|
14171
|
+
}),
|
|
14172
|
+
timeoutMs,
|
|
14173
|
+
`memory vnext lazy promotion interpreter timed out after ${timeoutMs}ms`
|
|
14174
|
+
);
|
|
13249
14175
|
const semanticMutation = withoutImportedEvidence(interpreted.mutation, evidence.id);
|
|
13250
14176
|
if (!hasWrites(semanticMutation)) {
|
|
14177
|
+
recordNoOpSuppression(
|
|
14178
|
+
evidence.ownerId,
|
|
14179
|
+
evidence.id,
|
|
14180
|
+
memoryVNextContextFingerprint(existing)
|
|
14181
|
+
);
|
|
13251
14182
|
return finish({ status: "no_op", action: semanticMutation.action });
|
|
13252
14183
|
}
|
|
13253
14184
|
await applyMemoryInterpreterMutation(input.db, evidence.ownerId, semanticMutation);
|
|
@@ -13256,10 +14187,184 @@ var runMemoryVNextLazyPromotion = async (input) => {
|
|
|
13256
14187
|
return finish({ status: "error", error: shortError2(error) });
|
|
13257
14188
|
} finally {
|
|
13258
14189
|
inFlight.delete(flightKey);
|
|
14190
|
+
promotionThrottle.release();
|
|
13259
14191
|
}
|
|
13260
14192
|
};
|
|
13261
14193
|
var isMemoryVNextLazyPromotionEnabled = (env = typeof process !== "undefined" ? process.env : {}) => env.NOLO_MEMORY_VNEXT_LAZY_PROMOTION === "1" || env.NOLO_MEMORY_VNEXT_LAZY_PROMOTION === "true";
|
|
13262
14194
|
|
|
14195
|
+
// packages/ai/memory/vnext/pureReadGate.ts
|
|
14196
|
+
var isMemoryVNextPureReadEnabled = (env = typeof process !== "undefined" ? process.env : {}) => env.NOLO_MEMORY_VNEXT_PURE_READ === "1" || env.NOLO_MEMORY_VNEXT_PURE_READ === "true";
|
|
14197
|
+
|
|
14198
|
+
// packages/ai/memory/vnext/localRecall.ts
|
|
14199
|
+
var MIN_SHARED_TOKENS = 2;
|
|
14200
|
+
var MAX_LOCAL_RECALL_STATES = 8;
|
|
14201
|
+
var SAFE_TECHNICAL_SYNONYMS = {
|
|
14202
|
+
pr: ["\u5BA1\u67E5", "\u4EE3\u7801\u5BA1\u67E5", "diff"],
|
|
14203
|
+
diff: ["\u5BA1\u67E5", "\u4EE3\u7801\u5BA1\u67E5"],
|
|
14204
|
+
review: ["\u5BA1\u67E5", "\u4EE3\u7801\u5BA1\u67E5"],
|
|
14205
|
+
deploy: ["\u90E8\u7F72", "\u53D1\u7248"],
|
|
14206
|
+
release: ["\u53D1\u7248", "\u53D1\u5E03"],
|
|
14207
|
+
desktop: ["\u684C\u9762", "\u684C\u9762\u7AEF"]
|
|
14208
|
+
};
|
|
14209
|
+
var distinctTokens = (text) => new Set(tokenize2(text).filter((token) => token.length >= 2));
|
|
14210
|
+
var recallMemoryVNextLocal = (input) => {
|
|
14211
|
+
const rawTokens = distinctTokens(input.query);
|
|
14212
|
+
if (rawTokens.size === 0) return [];
|
|
14213
|
+
const queryTokens = new Set(rawTokens);
|
|
14214
|
+
for (const token of rawTokens) {
|
|
14215
|
+
const syns = SAFE_TECHNICAL_SYNONYMS[token.toLowerCase()];
|
|
14216
|
+
if (syns) {
|
|
14217
|
+
for (const syn of syns) {
|
|
14218
|
+
for (const t2 of distinctTokens(syn)) queryTokens.add(t2);
|
|
14219
|
+
}
|
|
14220
|
+
}
|
|
14221
|
+
}
|
|
14222
|
+
const entityById = new Map(input.entities.map((entity) => [entity.id, entity]));
|
|
14223
|
+
const hits = [];
|
|
14224
|
+
for (const state2 of input.states) {
|
|
14225
|
+
if (state2.retiredAt || !state2.text.trim()) continue;
|
|
14226
|
+
const entity = entityById.get(state2.entityId);
|
|
14227
|
+
const haystack = distinctTokens(
|
|
14228
|
+
[state2.facet, state2.text, entity?.name ?? "", ...entity?.aliases ?? []].join(" ")
|
|
14229
|
+
);
|
|
14230
|
+
let sharedTokens = 0;
|
|
14231
|
+
for (const token of queryTokens) if (haystack.has(token)) sharedTokens++;
|
|
14232
|
+
if (sharedTokens >= MIN_SHARED_TOKENS) hits.push({ state: state2, sharedTokens });
|
|
14233
|
+
}
|
|
14234
|
+
return hits.sort((a, b) => b.sharedTokens - a.sharedTokens || a.state.id.localeCompare(b.state.id)).slice(0, input.limit ?? MAX_LOCAL_RECALL_STATES);
|
|
14235
|
+
};
|
|
14236
|
+
|
|
14237
|
+
// packages/ai/memory/vnext/pureVNextRuntime.ts
|
|
14238
|
+
var buildSynthesizedStateItem = (state2, entity, ownerType, ownerId) => ({
|
|
14239
|
+
id: `vnext-state-${state2.id}`,
|
|
14240
|
+
ownerType,
|
|
14241
|
+
ownerId,
|
|
14242
|
+
visibility: "private",
|
|
14243
|
+
subjectType: "user",
|
|
14244
|
+
subjectId: ownerId,
|
|
14245
|
+
kind: "semantic",
|
|
14246
|
+
content: state2.text.trim(),
|
|
14247
|
+
createdAt: state2.createdAt,
|
|
14248
|
+
lastActivatedAt: state2.createdAt,
|
|
14249
|
+
activationCount: 1,
|
|
14250
|
+
importance: 0.9,
|
|
14251
|
+
confidence: 0.9,
|
|
14252
|
+
resident: state2.facet === "preference" || state2.facet === "style"
|
|
14253
|
+
});
|
|
14254
|
+
async function resolvePureVNextRuntime(input) {
|
|
14255
|
+
const { db, owners, userInput } = input;
|
|
14256
|
+
if (owners.length === 0 || !userInput.trim()) {
|
|
14257
|
+
return { selectedItems: [], promptBlock: null, recalledStateCount: 0 };
|
|
14258
|
+
}
|
|
14259
|
+
const ownerIds = owners.map((o) => `${o.ownerType}:${encodeURIComponent(o.ownerId)}`);
|
|
14260
|
+
const catalogs = await Promise.all(
|
|
14261
|
+
ownerIds.map((ownerId) => loadMemoryVNextCatalog(db, ownerId))
|
|
14262
|
+
);
|
|
14263
|
+
const selectedItems = [];
|
|
14264
|
+
const seenStateKeys = /* @__PURE__ */ new Set();
|
|
14265
|
+
for (let i = 0; i < owners.length; i++) {
|
|
14266
|
+
const owner = owners[i];
|
|
14267
|
+
const catalog = catalogs[i];
|
|
14268
|
+
const currentStates = catalog.states.filter((s) => !s.retiredAt && s.text.trim());
|
|
14269
|
+
const hits = recallMemoryVNextLocal({
|
|
14270
|
+
query: userInput,
|
|
14271
|
+
entities: catalog.entities,
|
|
14272
|
+
states: currentStates
|
|
14273
|
+
});
|
|
14274
|
+
const entityById = new Map(catalog.entities.map((e) => [e.id, e]));
|
|
14275
|
+
for (const hit of hits) {
|
|
14276
|
+
const stateKey = `${hit.state.ownerId}\0${hit.state.id}`;
|
|
14277
|
+
if (seenStateKeys.has(stateKey)) continue;
|
|
14278
|
+
seenStateKeys.add(stateKey);
|
|
14279
|
+
selectedItems.push(
|
|
14280
|
+
buildSynthesizedStateItem(hit.state, entityById.get(hit.state.entityId), owner.ownerType, owner.ownerId)
|
|
14281
|
+
);
|
|
14282
|
+
}
|
|
14283
|
+
}
|
|
14284
|
+
const promptBlock = selectedItems.length === 0 ? null : buildMemoryOverlay(selectedItems, {
|
|
14285
|
+
maxTokens: input.maxTokens ?? DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET
|
|
14286
|
+
});
|
|
14287
|
+
return {
|
|
14288
|
+
selectedItems,
|
|
14289
|
+
promptBlock,
|
|
14290
|
+
recalledStateCount: selectedItems.length
|
|
14291
|
+
};
|
|
14292
|
+
}
|
|
14293
|
+
|
|
14294
|
+
// packages/ai/memory/vnext/primaryRead.ts
|
|
14295
|
+
var MEMORY_VNEXT_PRIMARY_READ_TIMEOUT_MS = 300;
|
|
14296
|
+
var isMemoryVNextPrimaryReadEnabled = (env = typeof process !== "undefined" ? process.env : {}) => env.NOLO_MEMORY_VNEXT_PRIMARY_READ === "1" || env.NOLO_MEMORY_VNEXT_PRIMARY_READ === "true";
|
|
14297
|
+
var buildSynthesizedStateItem2 = (state2, entity, ownerType, ownerId) => ({
|
|
14298
|
+
id: `vnext-state-${state2.id}`,
|
|
14299
|
+
ownerType,
|
|
14300
|
+
ownerId,
|
|
14301
|
+
visibility: "private",
|
|
14302
|
+
subjectType: "user",
|
|
14303
|
+
subjectId: ownerId,
|
|
14304
|
+
kind: "semantic",
|
|
14305
|
+
content: state2.text.trim(),
|
|
14306
|
+
createdAt: state2.createdAt,
|
|
14307
|
+
importance: 0.9,
|
|
14308
|
+
confidence: 0.9,
|
|
14309
|
+
// Flag resident preferences so they flow into overlay's resident section.
|
|
14310
|
+
resident: state2.facet === "preference" || state2.facet === "style",
|
|
14311
|
+
lastActivatedAt: state2.createdAt,
|
|
14312
|
+
activationCount: 1
|
|
14313
|
+
});
|
|
14314
|
+
var resolveMemoryVNextM4Selection = async (input) => {
|
|
14315
|
+
const { db, owners, query, selected } = input;
|
|
14316
|
+
const ownerIds = owners.map((o) => `${o.ownerType}:${encodeURIComponent(o.ownerId)}`);
|
|
14317
|
+
const catalogs = new Map(
|
|
14318
|
+
await Promise.all(
|
|
14319
|
+
ownerIds.map(async (ownerId) => [
|
|
14320
|
+
ownerId,
|
|
14321
|
+
await loadMemoryVNextCatalog(db, ownerId)
|
|
14322
|
+
])
|
|
14323
|
+
)
|
|
14324
|
+
);
|
|
14325
|
+
const recalledStates = [];
|
|
14326
|
+
const recalledStateIds = /* @__PURE__ */ new Set();
|
|
14327
|
+
for (const owner of owners) {
|
|
14328
|
+
const principalId = `${owner.ownerType}:${encodeURIComponent(owner.ownerId)}`;
|
|
14329
|
+
const catalog = catalogs.get(principalId);
|
|
14330
|
+
if (!catalog) continue;
|
|
14331
|
+
const currentStates = catalog.states.filter((s) => !s.retiredAt && s.text.trim());
|
|
14332
|
+
const hits = recallMemoryVNextLocal({
|
|
14333
|
+
query,
|
|
14334
|
+
entities: catalog.entities,
|
|
14335
|
+
states: currentStates
|
|
14336
|
+
});
|
|
14337
|
+
const entityById = new Map(catalog.entities.map((e) => [e.id, e]));
|
|
14338
|
+
for (const hit of hits) {
|
|
14339
|
+
if (recalledStateIds.has(hit.state.id)) continue;
|
|
14340
|
+
recalledStateIds.add(hit.state.id);
|
|
14341
|
+
recalledStates.push(
|
|
14342
|
+
buildSynthesizedStateItem2(hit.state, entityById.get(hit.state.entityId), owner.ownerType, owner.ownerId)
|
|
14343
|
+
);
|
|
14344
|
+
}
|
|
14345
|
+
}
|
|
14346
|
+
const uncoveredLegacy = [];
|
|
14347
|
+
let coveredSuppressedCount = 0;
|
|
14348
|
+
for (const item of selected) {
|
|
14349
|
+
const evidence = buildLegacyMemoryEvidence(item);
|
|
14350
|
+
const catalog = catalogs.get(evidence.ownerId);
|
|
14351
|
+
const states = catalog?.states ?? [];
|
|
14352
|
+
const covering = currentStatesCitingEvidence(states, evidence.id);
|
|
14353
|
+
if (covering.length > 0) {
|
|
14354
|
+
coveredSuppressedCount++;
|
|
14355
|
+
} else {
|
|
14356
|
+
uncoveredLegacy.push(item);
|
|
14357
|
+
}
|
|
14358
|
+
}
|
|
14359
|
+
const renderItems = [...recalledStates, ...uncoveredLegacy];
|
|
14360
|
+
return {
|
|
14361
|
+
renderItems,
|
|
14362
|
+
recalledStateCount: recalledStates.length,
|
|
14363
|
+
uncoveredLegacyCount: uncoveredLegacy.length,
|
|
14364
|
+
coveredSuppressedCount
|
|
14365
|
+
};
|
|
14366
|
+
};
|
|
14367
|
+
|
|
13263
14368
|
// packages/ai/memory/runtime.ts
|
|
13264
14369
|
var COLD_STORAGE_CONFIDENCE = 0.3;
|
|
13265
14370
|
var MEMORY_OVERLAY_TOKEN_BUDGET = DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET;
|
|
@@ -13382,6 +14487,18 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
13382
14487
|
if (owners.length === 0) {
|
|
13383
14488
|
return { selectedItems: [], promptBlock: null };
|
|
13384
14489
|
}
|
|
14490
|
+
if (isMemoryVNextPureReadEnabled()) {
|
|
14491
|
+
const pure = await resolvePureVNextRuntime({
|
|
14492
|
+
db: input.db,
|
|
14493
|
+
owners,
|
|
14494
|
+
userInput: input.userInput,
|
|
14495
|
+
maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET
|
|
14496
|
+
});
|
|
14497
|
+
return {
|
|
14498
|
+
selectedItems: pure.selectedItems,
|
|
14499
|
+
promptBlock: pure.promptBlock
|
|
14500
|
+
};
|
|
14501
|
+
}
|
|
13385
14502
|
const policy = resolveAgentMemoryPolicy({ agentKey: input.agentKey });
|
|
13386
14503
|
const legacyStartedAt = performance.now();
|
|
13387
14504
|
const candidates = await loadMemoryCandidatesFromDb(input.db, {
|
|
@@ -13411,10 +14528,62 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
13411
14528
|
);
|
|
13412
14529
|
const selected = [...residentItems, ...ranked];
|
|
13413
14530
|
const legacyLatencyMs = Math.round((performance.now() - legacyStartedAt) * 10) / 10;
|
|
13414
|
-
const
|
|
13415
|
-
|
|
14531
|
+
const renderOverlay = (items) => items.length === 0 ? null : buildMemoryOverlay(items, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET });
|
|
14532
|
+
let promptBlock = renderOverlay(selected);
|
|
14533
|
+
const primaryRead = isMemoryVNextPrimaryReadEnabled();
|
|
14534
|
+
let allCoveredByVNext = false;
|
|
14535
|
+
if (primaryRead) {
|
|
14536
|
+
const emitPrimary = (observation) => {
|
|
14537
|
+
try {
|
|
14538
|
+
(input.primaryReadEmit ?? ((o) => console.info("[memory] vnext primary read", { event: "memory_vnext_primary_read", ...o })))(observation);
|
|
14539
|
+
} catch {
|
|
14540
|
+
}
|
|
14541
|
+
};
|
|
14542
|
+
const base = { legacyHitCount: selected.length, legacyLatencyMs };
|
|
14543
|
+
const vnextStartedAt = performance.now();
|
|
14544
|
+
const vnextLatency = () => Math.round((performance.now() - vnextStartedAt) * 10) / 10;
|
|
14545
|
+
if (selected.length === 0) {
|
|
14546
|
+
emitPrimary({ ...base, source: "none" });
|
|
14547
|
+
} else {
|
|
14548
|
+
try {
|
|
14549
|
+
let timer;
|
|
14550
|
+
const m4 = await Promise.race([
|
|
14551
|
+
resolveMemoryVNextM4Selection({ db: input.db, owners, query: input.userInput, selected }),
|
|
14552
|
+
new Promise((_, reject) => {
|
|
14553
|
+
timer = setTimeout(
|
|
14554
|
+
() => reject(Object.assign(new Error("timeout"), { name: "TimeoutError" })),
|
|
14555
|
+
MEMORY_VNEXT_PRIMARY_READ_TIMEOUT_MS
|
|
14556
|
+
);
|
|
14557
|
+
})
|
|
14558
|
+
]).finally(() => clearTimeout(timer));
|
|
14559
|
+
promptBlock = renderOverlay(m4.renderItems);
|
|
14560
|
+
allCoveredByVNext = m4.uncoveredLegacyCount === 0 && m4.recalledStateCount > 0;
|
|
14561
|
+
const source = m4.recalledStateCount > 0 ? m4.uncoveredLegacyCount === 0 ? "vnext" : "hybrid" : m4.uncoveredLegacyCount > 0 ? "legacy_fallback" : "none";
|
|
14562
|
+
emitPrimary({
|
|
14563
|
+
...base,
|
|
14564
|
+
source,
|
|
14565
|
+
uncoveredLegacyCount: m4.uncoveredLegacyCount,
|
|
14566
|
+
coveredSuppressedCount: m4.coveredSuppressedCount,
|
|
14567
|
+
recalledStateCount: m4.recalledStateCount,
|
|
14568
|
+
vnextLatencyMs: vnextLatency(),
|
|
14569
|
+
contextChars: promptBlock?.length ?? 0,
|
|
14570
|
+
...source === "legacy_fallback" ? { fallbackReason: "no_vnext_context" } : {}
|
|
14571
|
+
});
|
|
14572
|
+
} catch (error) {
|
|
14573
|
+
emitPrimary({
|
|
14574
|
+
...base,
|
|
14575
|
+
source: "legacy_fallback",
|
|
14576
|
+
vnextLatencyMs: vnextLatency(),
|
|
14577
|
+
contextChars: promptBlock?.length ?? 0,
|
|
14578
|
+
fallbackReason: "vnext_error",
|
|
14579
|
+
error: error instanceof Error ? error.name : "UnknownError"
|
|
14580
|
+
});
|
|
14581
|
+
}
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
const shadowEnabled = !primaryRead && input.vNextShadowProvider != null && isMemoryVNextShadowReadEnabled();
|
|
13416
14585
|
if (shadowEnabled) {
|
|
13417
|
-
|
|
14586
|
+
void runMemoryVNextShadowRead({
|
|
13418
14587
|
ctx: {
|
|
13419
14588
|
db: input.db,
|
|
13420
14589
|
owners,
|
|
@@ -13424,17 +14593,28 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
13424
14593
|
legacyItems: selected,
|
|
13425
14594
|
legacyLatencyMs,
|
|
13426
14595
|
legacyContextChars: promptBlock?.length ?? 0
|
|
14596
|
+
}).catch(() => {
|
|
13427
14597
|
});
|
|
13428
14598
|
}
|
|
13429
|
-
const promotionCandidate = selected[0];
|
|
13430
14599
|
const lazyPromotionEnabled = input.vNextShadowProvider != null && isMemoryVNextLazyPromotionEnabled();
|
|
13431
|
-
if (lazyPromotionEnabled &&
|
|
13432
|
-
void
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
14600
|
+
if (lazyPromotionEnabled && selected.length > 0 && !allCoveredByVNext) {
|
|
14601
|
+
void (async () => {
|
|
14602
|
+
const promotionPick = await pickFirstUncoveredLazyPromotionItem(
|
|
14603
|
+
input.db,
|
|
14604
|
+
selected
|
|
14605
|
+
);
|
|
14606
|
+
if (promotionPick) {
|
|
14607
|
+
await runMemoryVNextLazyPromotion({
|
|
14608
|
+
db: input.db,
|
|
14609
|
+
item: promotionPick.item,
|
|
14610
|
+
selectedIndex: promotionPick.selectedIndex,
|
|
14611
|
+
skippedCoveredCount: promotionPick.skippedCoveredCount,
|
|
14612
|
+
skippedNoOpCount: promotionPick.skippedNoOpCount,
|
|
14613
|
+
provider: input.vNextShadowProvider,
|
|
14614
|
+
...input.lazyPromotionEmit ? { emit: input.lazyPromotionEmit } : {}
|
|
14615
|
+
});
|
|
14616
|
+
}
|
|
14617
|
+
})().catch(() => {
|
|
13438
14618
|
});
|
|
13439
14619
|
}
|
|
13440
14620
|
if (selected.length === 0) {
|
|
@@ -13448,6 +14628,52 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
13448
14628
|
};
|
|
13449
14629
|
|
|
13450
14630
|
// packages/cli/memoryRecall.ts
|
|
14631
|
+
var logger = getLogger("cli.memoryRecall");
|
|
14632
|
+
var DEDUP_WINDOW_MS = 5 * 60 * 1e3;
|
|
14633
|
+
var DEDUP_MAX_KEYS = 100;
|
|
14634
|
+
var dedupMap = /* @__PURE__ */ new Map();
|
|
14635
|
+
function evictDedupIfNeeded() {
|
|
14636
|
+
if (dedupMap.size < DEDUP_MAX_KEYS) return;
|
|
14637
|
+
let oldestKey = null;
|
|
14638
|
+
let oldestTs = Infinity;
|
|
14639
|
+
for (const [k, v] of dedupMap) {
|
|
14640
|
+
if (v.lastLog < oldestTs) {
|
|
14641
|
+
oldestTs = v.lastLog;
|
|
14642
|
+
oldestKey = k;
|
|
14643
|
+
}
|
|
14644
|
+
}
|
|
14645
|
+
if (oldestKey !== null) dedupMap.delete(oldestKey);
|
|
14646
|
+
}
|
|
14647
|
+
function logDeduped(level, fingerprint, message, error) {
|
|
14648
|
+
const now = Date.now();
|
|
14649
|
+
const entry = dedupMap.get(fingerprint);
|
|
14650
|
+
if (!entry) {
|
|
14651
|
+
evictDedupIfNeeded();
|
|
14652
|
+
dedupMap.set(fingerprint, { count: 1, suppressed: 0, lastLog: now });
|
|
14653
|
+
if (error !== void 0) logger[level](message, error);
|
|
14654
|
+
else logger[level](message);
|
|
14655
|
+
return;
|
|
14656
|
+
}
|
|
14657
|
+
entry.count += 1;
|
|
14658
|
+
if (now - entry.lastLog >= DEDUP_WINDOW_MS) {
|
|
14659
|
+
const suppressed = entry.suppressed;
|
|
14660
|
+
const summary = `${message} (deduplicated: ${entry.count} occurrences, ${suppressed} suppressed over ${Math.round((now - entry.lastLog) / 1e3)}s)`;
|
|
14661
|
+
if (error !== void 0) logger[level](summary, error);
|
|
14662
|
+
else logger[level](summary);
|
|
14663
|
+
entry.count = 1;
|
|
14664
|
+
entry.suppressed = 0;
|
|
14665
|
+
entry.lastLog = now;
|
|
14666
|
+
} else {
|
|
14667
|
+
entry.suppressed += 1;
|
|
14668
|
+
}
|
|
14669
|
+
}
|
|
14670
|
+
function fingerprintFor(kind, detail) {
|
|
14671
|
+
const d = detail === void 0 ? "" : sanitizeFp(String(detail));
|
|
14672
|
+
return `mem-${kind}:${d}`;
|
|
14673
|
+
}
|
|
14674
|
+
function sanitizeFp(s) {
|
|
14675
|
+
return s.replace(/\s+/g, " ").slice(0, 80);
|
|
14676
|
+
}
|
|
13451
14677
|
var queryRemoteMemory = async (serverUrl, authToken, agentKey, userInput, spaceId) => {
|
|
13452
14678
|
try {
|
|
13453
14679
|
const response = await fetch(`${serverUrl}/api/memory/query`, {
|
|
@@ -13464,10 +14690,10 @@ var queryRemoteMemory = async (serverUrl, authToken, agentKey, userInput, spaceI
|
|
|
13464
14690
|
signal: AbortSignal.timeout(5e3)
|
|
13465
14691
|
});
|
|
13466
14692
|
if (!response.ok) {
|
|
13467
|
-
|
|
13468
|
-
"
|
|
13469
|
-
response.status,
|
|
13470
|
-
|
|
14693
|
+
logDeduped(
|
|
14694
|
+
"warn",
|
|
14695
|
+
fingerprintFor("remote-nonok", response.status),
|
|
14696
|
+
`remote query returned non-ok status ${response.status} \u2014 falling back to local`
|
|
13471
14697
|
);
|
|
13472
14698
|
return null;
|
|
13473
14699
|
}
|
|
@@ -13475,7 +14701,12 @@ var queryRemoteMemory = async (serverUrl, authToken, agentKey, userInput, spaceI
|
|
|
13475
14701
|
const block = typeof payload?.promptBlock === "string" ? payload.promptBlock.trim() : "";
|
|
13476
14702
|
return block || null;
|
|
13477
14703
|
} catch (error) {
|
|
13478
|
-
|
|
14704
|
+
logDeduped(
|
|
14705
|
+
"info",
|
|
14706
|
+
fingerprintFor("remote-failed", error instanceof Error ? error.name : void 0),
|
|
14707
|
+
"remote query failed, falling back to local",
|
|
14708
|
+
normalizeError(error)
|
|
14709
|
+
);
|
|
13479
14710
|
return null;
|
|
13480
14711
|
}
|
|
13481
14712
|
};
|
|
@@ -13511,7 +14742,12 @@ var resolveCliMemory = async (input) => {
|
|
|
13511
14742
|
input.spaceId
|
|
13512
14743
|
);
|
|
13513
14744
|
} catch (error) {
|
|
13514
|
-
|
|
14745
|
+
logDeduped(
|
|
14746
|
+
"warn",
|
|
14747
|
+
fingerprintFor("local-failed", error instanceof Error ? error.name : void 0),
|
|
14748
|
+
"local recall failed, omitting memory layer",
|
|
14749
|
+
normalizeError(error)
|
|
14750
|
+
);
|
|
13515
14751
|
return null;
|
|
13516
14752
|
}
|
|
13517
14753
|
};
|
|
@@ -13535,13 +14771,6 @@ function resolveRunOutcome(input) {
|
|
|
13535
14771
|
}
|
|
13536
14772
|
}
|
|
13537
14773
|
}
|
|
13538
|
-
var FAILED_EMPTY_ASSISTANT_REASONS = /* @__PURE__ */ new Set([
|
|
13539
|
-
"length_truncated",
|
|
13540
|
-
"stream_truncated",
|
|
13541
|
-
"repetition_loop",
|
|
13542
|
-
"stagnant_tool_calls"
|
|
13543
|
-
]);
|
|
13544
|
-
var isRunResultStalledOrTruncated = (result) => !result.emptyAssistantOutputUsable && FAILED_EMPTY_ASSISTANT_REASONS.has(result.emptyAssistantFallbackReason ?? "");
|
|
13545
14774
|
var resolveRunSettlementNote = (result) => {
|
|
13546
14775
|
const reason = result.emptyAssistantFallbackReason;
|
|
13547
14776
|
if (!reason || !FAILED_EMPTY_ASSISTANT_REASONS.has(reason)) return {};
|
|
@@ -13566,7 +14795,10 @@ async function resolveAgentRunAgentKey(args) {
|
|
|
13566
14795
|
}
|
|
13567
14796
|
async function runAgentRunCommand(args, deps) {
|
|
13568
14797
|
const env = deps.env ?? process.env;
|
|
13569
|
-
const output = deps.output ??
|
|
14798
|
+
const output = deps.output ?? {
|
|
14799
|
+
write: (chunk) => process.stdout.write(chunk),
|
|
14800
|
+
writeErr: (chunk) => process.stderr.write(chunk)
|
|
14801
|
+
};
|
|
13570
14802
|
if (args.includes("--help") || args.includes("-h")) {
|
|
13571
14803
|
writeUsage(output, deps.commandPath);
|
|
13572
14804
|
return 0;
|
|
@@ -13608,7 +14840,19 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13608
14840
|
const watchdogFailure = armStallWatchdog || armTimeoutWatchdog ? new Promise((_, reject) => {
|
|
13609
14841
|
rejectOnWatchdogFailure = reject;
|
|
13610
14842
|
}) : void 0;
|
|
13611
|
-
const
|
|
14843
|
+
const terminalStatus = createOneShotTerminalStatus(
|
|
14844
|
+
parsed.eventsMode || parsed.background || hasRegistry ? null : deps.output ? deps.output : {
|
|
14845
|
+
write: (chunk) => process.stdout.write(chunk),
|
|
14846
|
+
isTTY: process.stdout.isTTY === true
|
|
14847
|
+
}
|
|
14848
|
+
);
|
|
14849
|
+
const raceWithWatchdog = (work) => {
|
|
14850
|
+
const raced = watchdogFailure ? Promise.race([work, watchdogFailure]) : work;
|
|
14851
|
+
return raced.catch((error) => {
|
|
14852
|
+
terminalStatus.fail();
|
|
14853
|
+
throw error;
|
|
14854
|
+
});
|
|
14855
|
+
};
|
|
13612
14856
|
const exitFromWatchdog = (code) => {
|
|
13613
14857
|
try {
|
|
13614
14858
|
processExit(code);
|
|
@@ -13653,6 +14897,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13653
14897
|
const note = `stalled: no progress for ${stallTimeoutMs}ms`;
|
|
13654
14898
|
output.write(`[nolo] local run ${note}
|
|
13655
14899
|
`);
|
|
14900
|
+
terminalStatus.fail();
|
|
13656
14901
|
const outcome = resolveRunOutcome({ kind: "stall" });
|
|
13657
14902
|
const currentActivity = activityTracker?.getActivity();
|
|
13658
14903
|
await finalizeWatchdogOutcome(outcome, note, {
|
|
@@ -13671,6 +14916,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13671
14916
|
const note = `timed out after ${parsed.timeoutMs}ms`;
|
|
13672
14917
|
output.write(`[nolo] local run ${note}
|
|
13673
14918
|
`);
|
|
14919
|
+
terminalStatus.fail();
|
|
13674
14920
|
const outcome = resolveRunOutcome({ kind: "timeout" });
|
|
13675
14921
|
await finalizeWatchdogOutcome(outcome, note);
|
|
13676
14922
|
rejectOnWatchdogFailure?.(new Error(`[nolo] local run ${note}`));
|
|
@@ -13716,13 +14962,12 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13716
14962
|
}
|
|
13717
14963
|
if (hasExplicitAgent && !modelOverride) {
|
|
13718
14964
|
output.write(
|
|
13719
|
-
"
|
|
14965
|
+
t("agentRun.autoRouteOverrideFailed")
|
|
13720
14966
|
);
|
|
13721
14967
|
} else {
|
|
13722
14968
|
effectiveAgentKey = CLI_AUTO_ROUTE_AGENT_KEY;
|
|
13723
14969
|
if (modelOverride) {
|
|
13724
|
-
output.write(
|
|
13725
|
-
`);
|
|
14970
|
+
output.write(t("agentRun.autoRouteModelOverride", agentKey));
|
|
13726
14971
|
}
|
|
13727
14972
|
}
|
|
13728
14973
|
}
|
|
@@ -13834,6 +15079,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13834
15079
|
if (agentsMdLayer) scopedLayers.push(agentsMdLayer);
|
|
13835
15080
|
skillContentBlocks.push(...buildSkillContextBlocks(skillReferences));
|
|
13836
15081
|
scopedLayers.push(buildSkillDiscoveryContextLayer(cliCwd));
|
|
15082
|
+
scopedLayers.push(buildHostEnvironmentLayer());
|
|
13837
15083
|
if (!deps.memoryRecallDisabled) {
|
|
13838
15084
|
try {
|
|
13839
15085
|
memoryPromptBlock = await resolveCliMemory({
|
|
@@ -13862,6 +15108,14 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13862
15108
|
);
|
|
13863
15109
|
extraContextBlocks.push(...contextBlockScopes.map((block) => block.content));
|
|
13864
15110
|
}
|
|
15111
|
+
const runRecordParentDialogId = !parsed.parentDialogId && typeof childRunId === "string" && childRunId.length > 0 ? asOptionalTrimmedString(
|
|
15112
|
+
(deps.readRunRecord ?? readRunRecord)(childRunId, {
|
|
15113
|
+
env,
|
|
15114
|
+
homedir: deps.homedir,
|
|
15115
|
+
fs: deps.fs
|
|
15116
|
+
})?.parentDialogId
|
|
15117
|
+
) : void 0;
|
|
15118
|
+
const effectiveParentDialogId = parsed.parentDialogId ?? runRecordParentDialogId;
|
|
13865
15119
|
const formatTurnMessage = (msg) => prependWorkflowReferencePrompt(
|
|
13866
15120
|
prependSubjectDialogMarker(
|
|
13867
15121
|
prependFeatureWorktreeInstruction(
|
|
@@ -13888,7 +15142,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13888
15142
|
...parsed.spaceId ? { spaceId: parsed.spaceId } : {},
|
|
13889
15143
|
...parsed.category ? { category: parsed.category } : {},
|
|
13890
15144
|
...parsed.inheritedFromDialogKey ? { inheritedFromDialogKey: parsed.inheritedFromDialogKey } : {},
|
|
13891
|
-
...
|
|
15145
|
+
...effectiveParentDialogId ? { parentDialogId: effectiveParentDialogId } : {},
|
|
13892
15146
|
...parsed.parentWakeOnTerminal ? { parentWakeOnTerminal: true } : {},
|
|
13893
15147
|
...parsed.subjectDialogKey ? { subjectDialogKey: parsed.subjectDialogKey } : {},
|
|
13894
15148
|
...parsed.subjectRefs?.length ? { subjectRefs: parsed.subjectRefs } : {},
|
|
@@ -13904,6 +15158,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13904
15158
|
...parsed.taskEvidence ? { taskEvidence: parsed.taskEvidence } : {},
|
|
13905
15159
|
...contextBlockScopes.length > 0 ? { contextBlockScopes } : extraContextBlocks.length > 0 ? { extraContextBlocks } : {}
|
|
13906
15160
|
});
|
|
15161
|
+
terminalStatus.working();
|
|
13907
15162
|
let result = await raceWithWatchdog(
|
|
13908
15163
|
runner({
|
|
13909
15164
|
...buildRunOptions(effectiveAgentKey),
|
|
@@ -13997,6 +15252,11 @@ async function runAgentRunCommand(args, deps) {
|
|
|
13997
15252
|
);
|
|
13998
15253
|
}
|
|
13999
15254
|
}
|
|
15255
|
+
terminalStatus.settle({
|
|
15256
|
+
exitCode: result.exitCode,
|
|
15257
|
+
streamInterrupted: result.streamInterrupted,
|
|
15258
|
+
stalledOrTruncated: isRunResultStalledOrTruncated(result)
|
|
15259
|
+
});
|
|
14000
15260
|
if (result.dialogId) {
|
|
14001
15261
|
if (parsed.background) {
|
|
14002
15262
|
output.write(`
|
|
@@ -14081,6 +15341,9 @@ async function runAgentRunCommand(args, deps) {
|
|
|
14081
15341
|
...runCreditsTotal !== void 0 ? { credits: runCreditsTotal } : {},
|
|
14082
15342
|
...failureReason ? { failureReason } : {},
|
|
14083
15343
|
...toolCallCount !== void 0 ? { toolCallCount } : {},
|
|
15344
|
+
...result.finalText ? { lastAssistantText: result.finalText } : {},
|
|
15345
|
+
// 仅用于 .result.md 头(front matter):旁路读取,不改 result 形状。
|
|
15346
|
+
...getRunResultHeaderMeta(result),
|
|
14084
15347
|
...truncationNote
|
|
14085
15348
|
},
|
|
14086
15349
|
{
|
|
@@ -14108,12 +15371,6 @@ function isBalanceExhaustedError(error) {
|
|
|
14108
15371
|
}
|
|
14109
15372
|
|
|
14110
15373
|
export {
|
|
14111
|
-
resolveAgentModelIdentity,
|
|
14112
|
-
resolveAgentContextWindow,
|
|
14113
|
-
platformCreditsFromUsage,
|
|
14114
|
-
formatCreditsChip,
|
|
14115
|
-
formatTokenCount,
|
|
14116
|
-
renderTokenStatus,
|
|
14117
15374
|
resolveCliColorEnabled,
|
|
14118
15375
|
dimCliText,
|
|
14119
15376
|
ANSI_ESCAPE_REGEX,
|
|
@@ -14153,7 +15410,14 @@ export {
|
|
|
14153
15410
|
polishBreathInsertsBlankBetween,
|
|
14154
15411
|
formatAssistantDisplay,
|
|
14155
15412
|
redactSecrets,
|
|
15413
|
+
safeAskText,
|
|
14156
15414
|
TUI_TREE_MARKER,
|
|
15415
|
+
resolveAgentModelIdentity,
|
|
15416
|
+
resolveAgentContextWindow,
|
|
15417
|
+
platformCreditsFromUsage,
|
|
15418
|
+
formatCreditsChip,
|
|
15419
|
+
formatTokenCount,
|
|
15420
|
+
renderTokenStatus,
|
|
14157
15421
|
COLLAPSED_PASTE_PLACEHOLDER_RE,
|
|
14158
15422
|
shouldCollapsePaste,
|
|
14159
15423
|
createCollapsedPasteStore,
|
|
@@ -14164,17 +15428,21 @@ export {
|
|
|
14164
15428
|
releaseCollapsedPasteReferences,
|
|
14165
15429
|
expandRangeToCollapsedPasteChips,
|
|
14166
15430
|
findCollapsedPasteSpanAt,
|
|
15431
|
+
emitTerminalProgramStatus,
|
|
14167
15432
|
runAgentTurn,
|
|
14168
|
-
readAgentsMdLayerFromDisk,
|
|
14169
15433
|
resolveWorkflowReference,
|
|
14170
15434
|
resolveSkillReference,
|
|
14171
15435
|
buildSkillContextBlocks,
|
|
14172
15436
|
prependSubjectDialogMarker,
|
|
14173
15437
|
normalizeCliImageInput,
|
|
14174
|
-
|
|
15438
|
+
buildHostEnvironmentLayer,
|
|
15439
|
+
readAgentsMdLayerFromDisk,
|
|
14175
15440
|
resolveCliMemory,
|
|
14176
|
-
|
|
15441
|
+
FAILED_EMPTY_ASSISTANT_REASONS,
|
|
14177
15442
|
isRunResultStalledOrTruncated,
|
|
15443
|
+
resolveTerminalProgramStatusState,
|
|
15444
|
+
inspectLocalRunWorkspace,
|
|
15445
|
+
resolveRunOutcome,
|
|
14178
15446
|
resolveRunSettlementNote,
|
|
14179
15447
|
runAgentRunCommand,
|
|
14180
15448
|
isBalanceExhaustedError
|