nolo-cli 0.108.0-alpha.2 → 0.108.1
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-BY3P5LBB.js → _executeModel-T7PIVJIW.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-66KXCSRR.js → agentDeleteCommand-VIDCZAFG.js} +154 -68
- package/{agentEmailCommands-63UTONDK.js → agentEmailCommands-PCHDY4ZP.js} +125 -105
- package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
- package/agentListCommands-QNUAN3YH.js +800 -0
- package/{agentMachineCommands-Z6RGPZSG.js → agentMachineCommands-C2TMTQNU.js} +54 -58
- package/{agentProviderCommands-X3UNW77C.js → agentProviderCommands-7PCGR77I.js} +97 -2
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-7GCDM4BK.js} +7 -7
- package/agentRecordCommands-T4XAUFF5.js +149 -0
- package/agentRunCommand-T3AW43I6.js +179 -0
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-2CDZNHXV.js} +10 -2
- package/{agentRuntimeLocal-E67CTV45.js → agentRuntimeLocal-SQUDRZWE.js} +41 -46
- package/{agentSlice-DG5TIQHE.js → agentSlice-HBGFNXUG.js} +22 -16
- package/{appDeleteCommands-Z36CLGUK.js → appDeleteCommands-CLLYGEBC.js} +55 -56
- package/{appDeployCommands-ECMUWG6S.js → appDeployCommands-HY2NBNDQ.js} +64 -60
- package/{appDeployStatusCommands-CL24TDMA.js → appDeployStatusCommands-SGO5GEXH.js} +53 -53
- package/{appGetCommands-ITHGOYGJ.js → appGetCommands-ZPYK2N5D.js} +53 -53
- package/{appListCommands-EEOSI6RC.js → appListCommands-O2BHIMKS.js} +54 -56
- package/{authCommand-HGP2XTKC.js → authCommand-GUIREPHK.js} +132 -83
- 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-2F7RJC6L.js → chunk-2C47W7IJ.js} +1 -1
- package/chunk-2DRYS3G3.js +13941 -0
- package/{chunk-VLTIYV3X.js → chunk-2ECUZDEL.js} +37 -11
- package/{chunk-LPIYPEME.js → chunk-2FY3GHBV.js} +1449 -1094
- 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-FV3JEYR3.js → chunk-3SK3J3IF.js} +69 -10
- 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-KZJP33ZK.js → chunk-5WLADF62.js} +90 -36
- package/chunk-5XN3OSCT.js +164 -0
- package/{chunk-T3GEOSRJ.js → chunk-5YJWHTKD.js} +69 -57
- 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-IQPFGYO3.js → chunk-726TCFLQ.js} +5 -5
- package/{chunk-CW67PN7L.js → chunk-7B3BVGU3.js} +61 -11
- package/chunk-7DPNBQSV.js +9 -0
- package/{chunk-LWKP7AWH.js → chunk-A337PRRR.js} +41 -17
- package/chunk-AGIM7IMJ.js +147 -0
- package/chunk-AI7XJMMQ.js +1858 -0
- package/{chunk-ABQYVJBJ.js → chunk-AIZE5TDM.js} +3 -3
- package/{chunk-LJ5VW2UJ.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-DOTZ5GTO.js → chunk-AWYWIWTU.js} +310 -95
- package/chunk-B77W7P7J.js +95 -0
- 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-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/chunk-EYLGAEB4.js +784 -0
- package/{chunk-3BMYXEUW.js → chunk-F2UJW3EK.js} +1 -1
- package/{chunk-RVE4DCV3.js → chunk-FBLRSLZH.js} +26 -31
- 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-I42VC5KR.js +15 -0
- package/{chunk-H4AHY5BU.js → chunk-IFALJPEX.js} +69 -20
- package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
- package/{chunk-UKWGR5SS.js → chunk-IJERIUXS.js} +242 -1146
- package/chunk-IN5UVHHP.js +843 -0
- package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
- package/{chunk-SYXOBWOC.js → chunk-JGLKZGGZ.js} +124 -703
- package/chunk-JJM3WS6W.js +132 -0
- package/{chunk-TR22GEUU.js → chunk-JKDL7BRF.js} +20 -11
- package/chunk-JONVI6DK.js +593 -0
- package/{chunk-SH43IESU.js → chunk-KQ7DAEZ7.js} +202 -32
- package/chunk-KWEDNOZZ.js +7546 -0
- package/{chunk-6OZ36FXI.js → chunk-KY6GPQ7O.js} +36 -12
- package/{chunk-RZGLXO2B.js → chunk-L5YKEQLD.js} +1715 -451
- package/{chunk-MRIHM22T.js → chunk-LAVSW2C2.js} +77 -144
- package/{chunk-HSSRGGXJ.js → chunk-LNEKN523.js} +10 -7
- package/chunk-LWLNLZC5.js +265 -0
- package/{chunk-YTLRHRH3.js → chunk-MDOZSLDE.js} +17 -15
- package/{chunk-I3TQJXQ7.js → chunk-MHD5JBSS.js} +131 -10
- package/{chunk-QU7KDSZX.js → chunk-MW533QT3.js} +190 -8
- package/{chunk-4NNTATRH.js → chunk-NLEJWKF5.js} +10394 -8549
- 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-Z5625XML.js → chunk-OYBAT7RT.js} +113 -17
- package/chunk-P3SFAHIL.js +134 -0
- 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-HVURBGF3.js → chunk-PWRS2SU2.js} +27 -9
- package/chunk-QFEW2ULV.js +42 -0
- package/{chunk-IIVGDG4I.js → chunk-QLQ573SU.js} +124 -77
- package/chunk-QQ56R7KS.js +88 -0
- package/{chunk-PWBDVI4R.js → chunk-QRFI5NHO.js} +269 -141
- 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-JRQFUXY7.js → chunk-RRQQAG7W.js} +93 -24
- package/chunk-SJ3QFSQS.js +1147 -0
- package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-GNCCNNZD.js → chunk-TSBCYK5F.js} +7 -7
- package/chunk-TY3TIUJK.js +89 -0
- package/chunk-U4STABYN.js +81 -0
- package/chunk-UEILX4EV.js +15 -0
- package/{chunk-AODJ7WSF.js → chunk-UIYVU3S4.js} +90 -79
- package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
- package/{chunk-7S4YWN7P.js → chunk-V2UPLOXT.js} +4 -4
- 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-PHXD6JTX.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-BFDFRLLQ.js → chunk-WW2USJ3C.js} +3 -3
- 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-2OASQKU2.js → chunk-XRXYRHE5.js} +187 -16
- package/{chunk-JEDZAO7L.js → chunk-YBNHPX4S.js} +257 -37
- package/{chunk-JPGCXHNM.js → chunk-YLMMECCH.js} +1 -1
- package/{chunk-6D6VBVEW.js → chunk-YVTZMLXZ.js} +96 -25
- package/{chunk-G4VIHCGJ.js → chunk-ZR5RAAVI.js} +35 -30
- 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-3XWUYELA.js +839 -0
- package/contentThunks-ALRPUDRE.js +83 -0
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-JFKTYS2D.js} +2 -2
- package/{createAgentAutomationAction-7HX7KBES.js → createAgentAutomationAction-XXRXCDFJ.js} +51 -43
- package/createDialogAction-FVSAW7WZ.js +75 -0
- package/{createPageAction-QWNMGO3O.js → createPageAction-RT6DPYP5.js} +60 -51
- package/{chunk-UDIIVXKA.js → cursorProvider-YGGNMVWX.js} +2822 -10269
- 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-P2K47T3P.js → dialogSlice-GFCT74GI.js} +66 -41
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-43JKQEIH.js → docCreateCommands-N3KPGP4A.js} +51 -54
- package/{docDeleteCommands-RL6D46XE.js → docDeleteCommands-4CR4TXZ7.js} +53 -55
- package/{docReadCommands-TOEUEQDG.js → docReadCommands-62XK57VS.js} +50 -53
- package/{docStore-3AHKTJRI.js → docStore-Z7KBPFXX.js} +24 -15
- package/{docUpdateCommands-FWU5G2XB.js → docUpdateCommands-DRAAWIDC.js} +51 -54
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-LM6OMMQQ.js} +5 -4
- package/{getPricing-LUSEABA6.js → getPricing-XDF4OLTC.js} +6 -6
- package/handleSendMessageAction-NRKUSHK2.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-S6UEEOSA.js +239 -0
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-YSE6NH7B.js} +12 -9
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-7FBKDEQY.js} +1 -1
- package/{machineCommands-TTKK4F7C.js → machineCommands-IQYHOOVH.js} +493 -152
- package/machineWsRunDispatch-3ZUMZUGP.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-XI3WUPTI.js → providerPresetApply-HIPK67DU.js} +9 -9
- package/{providerRegistry-KEPWWGXD.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-KIMUDPPV.js → readlineWorkspace-BCDVMOR5.js} +6947 -3879
- package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-EFQ4O2IQ.js} +27 -26
- package/{runAgentClientLoop-AN4WIRPQ.js → runAgentClientLoop-5RBD3DE6.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-NA4JMIGT.js → spaceCommands-WZCLRGBO.js} +56 -56
- package/{streamAgentChatTurn-3TYTHZPJ.js → streamAgentChatTurn-YJTEHUH7.js} +371 -1556
- 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-ZT4GXXDQ.js +122 -0
- package/{tuiSummaryLlmCaller-UFGFOIIW.js → tuiSummaryLlmCaller-ISODIW2O.js} +14 -29
- package/{updateCommands-2M74UL7P.js → updateCommands-NQXAGFM7.js} +3 -3
- package/{updateDialogTitleAction-RDHNT265.js → updateDialogTitleAction-2PQTFUUV.js} +101 -57
- package/action-P4TNFGAD.js +0 -31
- package/agentListCommands-NXCOTTZL.js +0 -411
- package/agentRecordCommands-JP54ZWND.js +0 -129
- package/agentRunCommand-RMQWWSHF.js +0 -157
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-DKLWTT3G.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-P3GYTNDF.js +0 -34
- package/chunk-PUOC4YRO.js +0 -394
- package/chunk-S7Z2HMCN.js +0 -25
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/chunk-YWIEQS6H.js +0 -21409
- package/contentThunks-JHK6X2KU.js +0 -73
- package/createDialogAction-VUUUZL54.js +0 -65
- package/dialogCommands-EN7TYD3I.js +0 -100
- package/handleSendMessageAction-ID5IKXUE.js +0 -633
- package/machineWsRunDispatch-RX64L3ET.js +0 -145
- package/setDialogExtraReferencesAction-WX5VTY6O.js +0 -30
- package/settingSlice-P4ZW7K5X.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-34SEJSLQ.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,102 +1,96 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyModelLayerOverride
|
|
3
3
|
} from "./chunk-LTRXGFMS.js";
|
|
4
|
-
import {
|
|
5
|
-
buildStaticUserPolicyContext,
|
|
6
|
-
resolveSpaceContextPreloadPlan
|
|
7
|
-
} from "./chunk-XD2MJFUG.js";
|
|
8
4
|
import {
|
|
9
5
|
buildCliPrompt
|
|
10
6
|
} from "./chunk-ATNTHIZI.js";
|
|
7
|
+
import {
|
|
8
|
+
applyImageConfigRuntimeOverride,
|
|
9
|
+
buildDynamicContexts,
|
|
10
|
+
buildForegroundTurnAdmissionFetchInit,
|
|
11
|
+
buildStaticContexts,
|
|
12
|
+
compressOldToolResults,
|
|
13
|
+
consumeAgentRunStream,
|
|
14
|
+
mergeAgentToolsWithRuntime,
|
|
15
|
+
mergeContexts,
|
|
16
|
+
projectDesktopToolUiContent,
|
|
17
|
+
resolveImageGenerationStreamingState,
|
|
18
|
+
resolveTurnToolContext,
|
|
19
|
+
trimMessagesWithSummary,
|
|
20
|
+
validateAccessAndBalance
|
|
21
|
+
} from "./chunk-AI7XJMMQ.js";
|
|
22
|
+
import "./chunk-PBGO5AFD.js";
|
|
11
23
|
import {
|
|
12
24
|
filterAndCleanMessages,
|
|
13
25
|
handleToolCalls,
|
|
14
|
-
parseApiError,
|
|
15
26
|
persistToolMessages,
|
|
16
27
|
readStreamChunk,
|
|
17
28
|
sendOpenAICompletionsRequest,
|
|
18
29
|
updateTotalUsage
|
|
19
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QRFI5NHO.js";
|
|
20
31
|
import "./chunk-JEXVIMYZ.js";
|
|
21
32
|
import {
|
|
22
33
|
prepareTools
|
|
23
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-5YJWHTKD.js";
|
|
24
35
|
import {
|
|
25
36
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
26
37
|
buildInvalidToolCallSelfHealResult,
|
|
27
|
-
fetchReferenceContents,
|
|
28
38
|
generateRequestBody,
|
|
29
39
|
isResponsesConversationStateRejection,
|
|
30
|
-
mergeReferences,
|
|
31
40
|
parseToolCallArguments,
|
|
32
41
|
performFetchRequest,
|
|
33
|
-
performServerProxyFetchWithRetry,
|
|
34
42
|
resolveAgentCallPlan,
|
|
35
43
|
resolveClientWire,
|
|
36
|
-
resolveReferenceAssets,
|
|
37
|
-
resolveToolsFromKeys,
|
|
38
44
|
sanitizeOutboundResponsesInput,
|
|
39
45
|
selectResponsesConversationState,
|
|
40
46
|
updateResponsesConversationState
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
47
|
+
} from "./chunk-JGLKZGGZ.js";
|
|
48
|
+
import "./chunk-W4S6OTSC.js";
|
|
43
49
|
import "./chunk-HS7MLR74.js";
|
|
50
|
+
import "./chunk-2FY3GHBV.js";
|
|
51
|
+
import {
|
|
52
|
+
isOwnedAgentRecord,
|
|
53
|
+
resolveBillingSource
|
|
54
|
+
} from "./chunk-XRXYRHE5.js";
|
|
55
|
+
import "./chunk-APO5TOXO.js";
|
|
56
|
+
import "./chunk-OXME3PEE.js";
|
|
57
|
+
import "./chunk-WCQNEMXG.js";
|
|
58
|
+
import {
|
|
59
|
+
isContextOverflowText,
|
|
60
|
+
parseApiError,
|
|
61
|
+
performServerProxyFetchWithRetry
|
|
62
|
+
} from "./chunk-IN5UVHHP.js";
|
|
44
63
|
import {
|
|
45
64
|
createSSEParser,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} from "./chunk-LPIYPEME.js";
|
|
50
|
-
import "./chunk-5UTFL4QJ.js";
|
|
65
|
+
selectMaxExecutionTime,
|
|
66
|
+
waitForAbortableDelay
|
|
67
|
+
} from "./chunk-JONVI6DK.js";
|
|
51
68
|
import "./chunk-NF64D32W.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
58
|
-
import {
|
|
59
|
-
getFinalPrice,
|
|
60
|
-
getModelPricing,
|
|
61
|
-
getPrices,
|
|
62
|
-
hasExplicitAgentPricing
|
|
63
|
-
} from "./chunk-EYAQT56M.js";
|
|
69
|
+
import "./chunk-XPWGOTBQ.js";
|
|
70
|
+
import "./chunk-5XN3OSCT.js";
|
|
71
|
+
import "./chunk-2ECUZDEL.js";
|
|
72
|
+
import "./chunk-BIAETTOB.js";
|
|
73
|
+
import "./chunk-6VRWNU5J.js";
|
|
74
|
+
import "./chunk-PFEK4SA2.js";
|
|
64
75
|
import {
|
|
65
76
|
getPublicImageAgentDefaultProfile,
|
|
66
77
|
getPublicImageAgentMode
|
|
67
78
|
} from "./chunk-VIDPVFP3.js";
|
|
68
|
-
import
|
|
69
|
-
|
|
70
|
-
} from "./chunk-VLTIYV3X.js";
|
|
71
|
-
import "./chunk-QTGQ2LTL.js";
|
|
72
|
-
import {
|
|
73
|
-
waitForAbortableDelay
|
|
74
|
-
} from "./chunk-N4G4PKQ6.js";
|
|
75
|
-
import "./chunk-FZGV4FGK.js";
|
|
76
|
-
import {
|
|
77
|
-
extractCategorizedMentions
|
|
78
|
-
} from "./chunk-MEYIRKDN.js";
|
|
79
|
+
import "./chunk-NUHHBEJC.js";
|
|
80
|
+
import "./chunk-AGIM7IMJ.js";
|
|
79
81
|
import "./chunk-63W5N6P3.js";
|
|
80
82
|
import "./chunk-VF4K2QE6.js";
|
|
83
|
+
import "./chunk-JKDL7BRF.js";
|
|
84
|
+
import "./chunk-FBLRSLZH.js";
|
|
85
|
+
import "./chunk-BFYDNHYW.js";
|
|
86
|
+
import "./chunk-AWYWIWTU.js";
|
|
81
87
|
import {
|
|
82
|
-
|
|
83
|
-
} from "./chunk-TR22GEUU.js";
|
|
84
|
-
import "./chunk-RVE4DCV3.js";
|
|
85
|
-
import {
|
|
86
|
-
getTableState
|
|
87
|
-
} from "./chunk-DOTZ5GTO.js";
|
|
88
|
-
import {
|
|
89
|
-
getCurrentSpaceId,
|
|
90
|
-
getCurrentSpaceIdRaw,
|
|
91
|
-
getViewMode
|
|
88
|
+
getCurrentSpaceId
|
|
92
89
|
} from "./chunk-ZJ7UHBJS.js";
|
|
93
90
|
import {
|
|
94
|
-
PERSONALIZATION_DIALOG_CATEGORY,
|
|
95
91
|
addToolMessage,
|
|
96
92
|
addUserMessage,
|
|
97
|
-
buildPersonalizationDialogPolicyContext,
|
|
98
93
|
estimateMissingUsage,
|
|
99
|
-
extractReferenceKeysFromMessage,
|
|
100
94
|
finalizeTransientMessageOnError,
|
|
101
95
|
messageStreamEnd,
|
|
102
96
|
messageStreaming,
|
|
@@ -106,177 +100,167 @@ import {
|
|
|
106
100
|
selectAllMsgs,
|
|
107
101
|
selectCurrentDialogConfig,
|
|
108
102
|
selectDialogConfigByKey,
|
|
109
|
-
shouldBlockForGptPro,
|
|
110
103
|
updateTokens,
|
|
111
104
|
updateToolMessage
|
|
112
|
-
} from "./chunk-
|
|
113
|
-
import "./chunk-
|
|
114
|
-
import
|
|
115
|
-
|
|
105
|
+
} from "./chunk-2DRYS3G3.js";
|
|
106
|
+
import "./chunk-523DITKR.js";
|
|
107
|
+
import {
|
|
108
|
+
isOAuthApiKeyRef
|
|
109
|
+
} from "./chunk-UKZX3NHN.js";
|
|
110
|
+
import "./chunk-F2UJW3EK.js";
|
|
111
|
+
import "./chunk-BYXBJQAS.js";
|
|
112
|
+
import "./chunk-QYPE3TS3.js";
|
|
113
|
+
import "./chunk-MDOZSLDE.js";
|
|
116
114
|
import "./chunk-AGGIDPCZ.js";
|
|
117
|
-
import "./chunk-YTLRHRH3.js";
|
|
118
115
|
import {
|
|
119
116
|
createCliChatTurnStream,
|
|
120
117
|
getCliChatSession,
|
|
121
118
|
startCliChatSession
|
|
122
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-WW2USJ3C.js";
|
|
123
120
|
import "./chunk-5RGU3J7P.js";
|
|
124
121
|
import {
|
|
125
122
|
addActiveController,
|
|
123
|
+
claimDialogTurnPhase,
|
|
124
|
+
clearDialogTurnPhase,
|
|
126
125
|
clearPendingUserInputQueue,
|
|
127
126
|
dequeueUserInput,
|
|
128
127
|
removeActiveController,
|
|
129
128
|
selectActiveControllers,
|
|
130
|
-
selectPendingFiles,
|
|
131
129
|
selectPendingUserInputQueue,
|
|
130
|
+
setDialogTurnPhase,
|
|
132
131
|
tokenUsageLiveUpdate
|
|
133
|
-
} from "./chunk-
|
|
134
|
-
import "./chunk-
|
|
132
|
+
} from "./chunk-VBG7GWWR.js";
|
|
133
|
+
import "./chunk-ZRAU6T47.js";
|
|
134
|
+
import "./chunk-4LCOCOR5.js";
|
|
135
135
|
import "./chunk-YDH3FDFQ.js";
|
|
136
|
-
import "./chunk-JRQFUXY7.js";
|
|
137
136
|
import {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
selectCurrentServer
|
|
138
|
+
} from "./chunk-QFEW2ULV.js";
|
|
139
|
+
import "./chunk-V2UPLOXT.js";
|
|
140
|
+
import "./chunk-2OMUAIKR.js";
|
|
141
|
+
import "./chunk-UAD2WT54.js";
|
|
142
|
+
import {
|
|
143
|
+
patch,
|
|
144
|
+
read,
|
|
145
|
+
selectById,
|
|
146
|
+
write
|
|
147
|
+
} from "./chunk-RNNWTMKT.js";
|
|
148
|
+
import "./chunk-3PVYUPXK.js";
|
|
149
|
+
import "./chunk-GHZ2H2HJ.js";
|
|
150
|
+
import "./chunk-AIZE5TDM.js";
|
|
151
|
+
import {
|
|
152
|
+
selectRuntimeCurrentServer
|
|
153
|
+
} from "./chunk-4YRTZIVN.js";
|
|
154
|
+
import "./chunk-UEILX4EV.js";
|
|
155
|
+
import "./chunk-IJERIUXS.js";
|
|
156
|
+
import {
|
|
157
|
+
getIsDesktopApp
|
|
158
|
+
} from "./chunk-6Q7UTJKR.js";
|
|
159
|
+
import "./chunk-QQ56R7KS.js";
|
|
160
|
+
import "./chunk-OW765XBU.js";
|
|
161
|
+
import {
|
|
162
|
+
selectIdentityToken,
|
|
163
|
+
selectIdentityUser,
|
|
164
|
+
selectIdentityUserId
|
|
165
|
+
} from "./chunk-SEJ5OS6F.js";
|
|
166
|
+
import "./chunk-D2MDMY2M.js";
|
|
167
|
+
import "./chunk-RRQQAG7W.js";
|
|
168
|
+
import "./chunk-3CZM6HGQ.js";
|
|
169
|
+
import "./chunk-IXH3HKY2.js";
|
|
170
|
+
import "./chunk-XETG4RIX.js";
|
|
171
|
+
import "./chunk-OKARGYFT.js";
|
|
149
172
|
import {
|
|
150
173
|
assertDesktopAgentRuntimeTurnBodyHasNoRawSecrets,
|
|
151
174
|
buildDesktopAgentRuntimeAgentConfigSnapshot,
|
|
152
175
|
buildDesktopAgentRuntimeDialogHistorySnapshot,
|
|
153
|
-
projectToolMessageContent,
|
|
154
176
|
resolveAgentContextWindow,
|
|
155
177
|
stripImagePartsForTextOnlyAgent
|
|
156
|
-
} from "./chunk-
|
|
157
|
-
import "./chunk-CQ3WA2NE.js";
|
|
178
|
+
} from "./chunk-G23MQWLJ.js";
|
|
158
179
|
import "./chunk-5ZUL4CUO.js";
|
|
159
|
-
import "./chunk-
|
|
160
|
-
import
|
|
180
|
+
import "./chunk-JJM3WS6W.js";
|
|
181
|
+
import {
|
|
182
|
+
projectUserPartForModel
|
|
183
|
+
} from "./chunk-G6OOUQWJ.js";
|
|
184
|
+
import "./chunk-56GBUMO5.js";
|
|
185
|
+
import "./chunk-WJZOQR2J.js";
|
|
186
|
+
import "./chunk-LAVSW2C2.js";
|
|
161
187
|
import {
|
|
162
188
|
extractImagePartsFromResponseOutput,
|
|
163
189
|
extractTextFromResponseOutput,
|
|
164
190
|
toResponsesTools
|
|
165
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-SJ3QFSQS.js";
|
|
166
192
|
import {
|
|
167
193
|
resolveRuntimeToolSurfaceForAgent
|
|
168
|
-
} from "./chunk-
|
|
169
|
-
import "./chunk-
|
|
170
|
-
import "./chunk-
|
|
171
|
-
import "./chunk-6OZ36FXI.js";
|
|
194
|
+
} from "./chunk-QLQ573SU.js";
|
|
195
|
+
import "./chunk-3MZAGMYY.js";
|
|
196
|
+
import "./chunk-VSPO4S33.js";
|
|
172
197
|
import {
|
|
173
|
-
getModelContextWindow,
|
|
174
198
|
getModelInfo
|
|
175
|
-
} from "./chunk-
|
|
176
|
-
import
|
|
177
|
-
planContextUsage
|
|
178
|
-
} from "./chunk-P5EVSOPA.js";
|
|
179
|
-
import {
|
|
180
|
-
estimateTokenCount
|
|
181
|
-
} from "./chunk-PSCNXBYA.js";
|
|
182
|
-
import {
|
|
183
|
-
isOpenAiResponsesModel
|
|
184
|
-
} from "./chunk-GQBOR3G6.js";
|
|
185
|
-
import "./chunk-BYXBJQAS.js";
|
|
186
|
-
import {
|
|
187
|
-
getApiEndpoint,
|
|
188
|
-
getModelConfig,
|
|
189
|
-
getProviderByModelName
|
|
190
|
-
} from "./chunk-OIVSQH2O.js";
|
|
199
|
+
} from "./chunk-FWY6BHIJ.js";
|
|
200
|
+
import "./chunk-5MMAK75Q.js";
|
|
191
201
|
import "./chunk-DWLEOOGR.js";
|
|
192
|
-
import "./chunk-
|
|
193
|
-
import "./chunk-ONXOABJR.js";
|
|
194
|
-
import "./chunk-W7XHHYWM.js";
|
|
195
|
-
import {
|
|
196
|
-
toErrorMessage
|
|
197
|
-
} from "./chunk-HNMXYYJR.js";
|
|
198
|
-
import {
|
|
199
|
-
buildLinkedSpacesSection,
|
|
200
|
-
buildSpaceContextLayer
|
|
201
|
-
} from "./chunk-DVINR3PL.js";
|
|
202
|
-
import "./chunk-2GRGFCF6.js";
|
|
203
|
-
import {
|
|
204
|
-
canonicalizeToolNames,
|
|
205
|
-
prioritizeToolNames
|
|
206
|
-
} from "./chunk-O6OSWFZQ.js";
|
|
207
|
-
import "./chunk-7S4YWN7P.js";
|
|
208
|
-
import "./chunk-ACTMNVHM.js";
|
|
209
|
-
import "./chunk-Q67DOFOO.js";
|
|
210
|
-
import "./chunk-PBA4UJBK.js";
|
|
211
|
-
import {
|
|
212
|
-
selectAiRecentContentLimit,
|
|
213
|
-
selectCurrentServer,
|
|
214
|
-
selectGlobalPrompt,
|
|
215
|
-
selectKnowledgeCaptureLevel,
|
|
216
|
-
selectMaxExecutionTime,
|
|
217
|
-
selectSpaceContextLevel,
|
|
218
|
-
selectUserTonePreset
|
|
219
|
-
} from "./chunk-GP5LKBUZ.js";
|
|
220
|
-
import "./chunk-Y5GCAMGP.js";
|
|
221
|
-
import "./chunk-QDSINZM3.js";
|
|
202
|
+
import "./chunk-PWRS2SU2.js";
|
|
222
203
|
import {
|
|
223
204
|
asRecordOrEmpty
|
|
224
205
|
} from "./chunk-KX6YBIHG.js";
|
|
225
|
-
import "./chunk-AHAHBQMU.js";
|
|
226
|
-
import "./chunk-UAD2WT54.js";
|
|
227
206
|
import {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
} from "./chunk-VRTTFDBM.js";
|
|
233
|
-
import {
|
|
234
|
-
asNonEmptyStringArray,
|
|
235
|
-
createDialogMessageKeyAndId,
|
|
236
|
-
dialogMessageKey,
|
|
237
|
-
metaKey
|
|
238
|
-
} from "./chunk-VMFTFOWF.js";
|
|
239
|
-
import {
|
|
240
|
-
asOptionalFiniteNumber
|
|
241
|
-
} from "./chunk-WWC7I6TA.js";
|
|
242
|
-
import "./chunk-ABQYVJBJ.js";
|
|
243
|
-
import "./chunk-QSJ3HFEF.js";
|
|
244
|
-
import "./chunk-WV42OMV7.js";
|
|
207
|
+
isAbortError
|
|
208
|
+
} from "./chunk-7DPNBQSV.js";
|
|
209
|
+
import "./chunk-IHPDK6UD.js";
|
|
210
|
+
import "./chunk-LWLNLZC5.js";
|
|
245
211
|
import {
|
|
246
212
|
isSystemBuiltinTrustedAgentKey
|
|
247
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-3LI5UCTU.js";
|
|
248
214
|
import {
|
|
249
215
|
extractCustomId
|
|
250
216
|
} from "./chunk-M2EJHDJP.js";
|
|
251
217
|
import {
|
|
252
|
-
|
|
253
|
-
|
|
218
|
+
createDialogMessageKeyAndId,
|
|
219
|
+
dialogMessageKey
|
|
220
|
+
} from "./chunk-RLRYVSCD.js";
|
|
221
|
+
import "./chunk-I42VC5KR.js";
|
|
222
|
+
import "./chunk-U6VC4MU4.js";
|
|
223
|
+
import "./chunk-MW533QT3.js";
|
|
254
224
|
import {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
import "./chunk-
|
|
225
|
+
isAntigravityOAuthAgent
|
|
226
|
+
} from "./chunk-TSBCYK5F.js";
|
|
227
|
+
import "./chunk-WWC7I6TA.js";
|
|
228
|
+
import "./chunk-PJNFNEJE.js";
|
|
259
229
|
import {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
} from "./chunk-
|
|
266
|
-
import
|
|
230
|
+
estimateTokenCount
|
|
231
|
+
} from "./chunk-PSCNXBYA.js";
|
|
232
|
+
import "./chunk-KY6GPQ7O.js";
|
|
233
|
+
import {
|
|
234
|
+
isOpenAiResponsesModel
|
|
235
|
+
} from "./chunk-NN4UUYGB.js";
|
|
236
|
+
import {
|
|
237
|
+
getApiEndpoint
|
|
238
|
+
} from "./chunk-CGEK73JN.js";
|
|
239
|
+
import "./chunk-W7XHHYWM.js";
|
|
267
240
|
import {
|
|
268
241
|
isRecord
|
|
269
242
|
} from "./chunk-KUG52IAP.js";
|
|
270
243
|
import {
|
|
271
244
|
asTrimmedString
|
|
272
245
|
} from "./chunk-3EUW3WEO.js";
|
|
273
|
-
import
|
|
246
|
+
import {
|
|
247
|
+
toErrorMessage
|
|
248
|
+
} from "./chunk-HNMXYYJR.js";
|
|
274
249
|
import "./chunk-LCBAMY2M.js";
|
|
275
250
|
import "./chunk-4SN6J65J.js";
|
|
276
251
|
import "./chunk-CF7PE763.js";
|
|
277
252
|
import {
|
|
278
253
|
asOptionalTrimmedString
|
|
279
254
|
} from "./chunk-G3SUCT4W.js";
|
|
255
|
+
import "./chunk-P3SFAHIL.js";
|
|
256
|
+
import "./chunk-SZC4REES.js";
|
|
257
|
+
import {
|
|
258
|
+
asTrimmedLowercaseString
|
|
259
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
260
|
+
import "./chunk-ZWQUWF6W.js";
|
|
261
|
+
import "./chunk-KHCLMKZZ.js";
|
|
262
|
+
import "./chunk-VEA7H5FG.js";
|
|
263
|
+
import "./chunk-4VJAC32I.js";
|
|
280
264
|
import "./chunk-4VNS5WPM.js";
|
|
281
265
|
|
|
282
266
|
// packages/ai/agent/isVoiceModel.ts
|
|
@@ -296,108 +280,6 @@ function isLiveAudioOnlyAgent(agent) {
|
|
|
296
280
|
return isVoiceModel(agent.model, agent.provider);
|
|
297
281
|
}
|
|
298
282
|
|
|
299
|
-
// packages/ai/agent/projectDesktopToolUiContent.ts
|
|
300
|
-
var DESKTOP_TOOL_UI_CONTENT_MAX_CHARS = 48e3;
|
|
301
|
-
function clipUiText(value, max = DESKTOP_TOOL_UI_CONTENT_MAX_CHARS) {
|
|
302
|
-
if (value.length <= max) return value;
|
|
303
|
-
return `${value.slice(0, Math.max(0, max - 20))}
|
|
304
|
-
\u2026[truncated for UI]`;
|
|
305
|
-
}
|
|
306
|
-
function tryParseJsonRecord(text) {
|
|
307
|
-
const trimmed = text.trim();
|
|
308
|
-
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
|
|
309
|
-
try {
|
|
310
|
-
const parsed = JSON.parse(trimmed);
|
|
311
|
-
return isRecord(parsed) ? parsed : null;
|
|
312
|
-
} catch {
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function parseShellToolTextContent(content) {
|
|
317
|
-
const text = content ?? "";
|
|
318
|
-
if (!text.trim()) return { stdout: "", stderr: "" };
|
|
319
|
-
const exitMatch = text.match(/(?:^|\n)exitCode:\s*(-?\d+)\s*$/);
|
|
320
|
-
const exitCode = exitMatch ? Number(exitMatch[1]) : void 0;
|
|
321
|
-
const body = (exitMatch ? text.slice(0, exitMatch.index) : text).replace(
|
|
322
|
-
/\s+$/,
|
|
323
|
-
""
|
|
324
|
-
);
|
|
325
|
-
let stdout = "";
|
|
326
|
-
let stderr = "";
|
|
327
|
-
if (body.startsWith("stdout:\n") || body.includes("\nstdout:\n")) {
|
|
328
|
-
const afterStdout = body.replace(/^[\s\S]*?stdout:\n/, "");
|
|
329
|
-
if (afterStdout.includes("\n\nstderr:\n")) {
|
|
330
|
-
const [out, err] = afterStdout.split("\n\nstderr:\n");
|
|
331
|
-
stdout = out ?? "";
|
|
332
|
-
stderr = err ?? "";
|
|
333
|
-
} else if (afterStdout.startsWith("stderr:\n")) {
|
|
334
|
-
stderr = afterStdout.slice("stderr:\n".length);
|
|
335
|
-
} else {
|
|
336
|
-
stdout = afterStdout;
|
|
337
|
-
}
|
|
338
|
-
} else if (body.startsWith("stderr:\n") || body.includes("\nstderr:\n")) {
|
|
339
|
-
stderr = body.replace(/^[\s\S]*?stderr:\n/, "");
|
|
340
|
-
} else {
|
|
341
|
-
stdout = body;
|
|
342
|
-
}
|
|
343
|
-
return {
|
|
344
|
-
stdout,
|
|
345
|
-
stderr,
|
|
346
|
-
...typeof exitCode === "number" && Number.isFinite(exitCode) ? { exitCode } : {}
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
function resolveShellCommand(metadata, argumentsPreview) {
|
|
350
|
-
return asOptionalTrimmedString(metadata.command) || asOptionalTrimmedString(metadata.cmd) || asOptionalTrimmedString(argumentsPreview) || "";
|
|
351
|
-
}
|
|
352
|
-
function projectDesktopToolUiContent(args) {
|
|
353
|
-
const toolName = asOptionalTrimmedString(args.toolName) || "tool";
|
|
354
|
-
const metadata = isRecord(args.metadata) ? args.metadata : {};
|
|
355
|
-
const rawContent = typeof args.content === "string" ? args.content : typeof args.summary === "string" ? args.summary : typeof args.message === "string" ? args.message : "";
|
|
356
|
-
if (toolName === "setTodoList") {
|
|
357
|
-
const existing = tryParseJsonRecord(rawContent);
|
|
358
|
-
if (existing && Array.isArray(existing.todos)) {
|
|
359
|
-
return clipUiText(JSON.stringify({ todos: existing.todos }));
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (toolName === "execShell") {
|
|
363
|
-
const existing = tryParseJsonRecord(rawContent);
|
|
364
|
-
if (existing && (typeof existing.stdout === "string" || typeof existing.command === "string" || typeof existing.stderr === "string")) {
|
|
365
|
-
const command2 = asOptionalTrimmedString(existing.command) || resolveShellCommand(metadata, args.argumentsPreview);
|
|
366
|
-
return JSON.stringify({
|
|
367
|
-
...existing,
|
|
368
|
-
command: command2,
|
|
369
|
-
cwd: asOptionalTrimmedString(existing.cwd) || asOptionalTrimmedString(metadata.cwd) || null,
|
|
370
|
-
exitCode: asOptionalFiniteNumber(existing.exitCode) ?? asOptionalFiniteNumber(metadata.exitCode)
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
const parsed = parseShellToolTextContent(rawContent);
|
|
374
|
-
const command = resolveShellCommand(metadata, args.argumentsPreview);
|
|
375
|
-
return JSON.stringify({
|
|
376
|
-
command,
|
|
377
|
-
cwd: asOptionalTrimmedString(metadata.cwd) || null,
|
|
378
|
-
stdout: clipUiText(parsed.stdout),
|
|
379
|
-
stderr: clipUiText(parsed.stderr),
|
|
380
|
-
exitCode: asOptionalFiniteNumber(metadata.exitCode) ?? parsed.exitCode,
|
|
381
|
-
timedOut: metadata.timedOut === true,
|
|
382
|
-
blocked: metadata.blocked === true
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
if (toolName === "readFile" || toolName === "read_file") {
|
|
386
|
-
const filePath = asOptionalTrimmedString(metadata.path) || asOptionalTrimmedString(metadata.filePath) || asOptionalTrimmedString(metadata.file_path) || asOptionalTrimmedString(args.argumentsPreview) || "";
|
|
387
|
-
const body = typeof args.content === "string" && args.content || typeof args.summary === "string" && args.summary || typeof args.message === "string" && args.message || "";
|
|
388
|
-
return JSON.stringify({
|
|
389
|
-
filePath,
|
|
390
|
-
content: clipUiText(body),
|
|
391
|
-
...asOptionalFiniteNumber(metadata.startLine) != null ? { startLine: asOptionalFiniteNumber(metadata.startLine) } : {},
|
|
392
|
-
...asOptionalFiniteNumber(metadata.endLine) != null ? { endLine: asOptionalFiniteNumber(metadata.endLine) } : {},
|
|
393
|
-
...asOptionalFiniteNumber(metadata.totalLines) != null ? { totalLines: asOptionalFiniteNumber(metadata.totalLines) } : {},
|
|
394
|
-
...metadata.truncated === true ? { truncated: true } : {}
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
const preferred = typeof args.content === "string" && args.content || typeof args.summary === "string" && args.summary || typeof args.message === "string" && args.message || "";
|
|
398
|
-
return clipUiText(preferred);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
283
|
// packages/ai/agent/desktopTurnSegments.ts
|
|
402
284
|
function attachToolCallIdToSegment(segments, callId) {
|
|
403
285
|
if (!segments || segments.length === 0) return;
|
|
@@ -459,107 +341,6 @@ function runChatQueueTurnEnd(payload) {
|
|
|
459
341
|
};
|
|
460
342
|
}
|
|
461
343
|
|
|
462
|
-
// packages/ai/agent/getFullChatContextKeys.ts
|
|
463
|
-
var difference = (arrA, arrB) => {
|
|
464
|
-
if (!arrA.length) return [];
|
|
465
|
-
if (!arrB.length) return [...arrA];
|
|
466
|
-
const exclude = new Set(arrB);
|
|
467
|
-
return arrA.filter((item) => !exclude.has(item));
|
|
468
|
-
};
|
|
469
|
-
var getFullChatContextKeys = async (state, dispatch, agentConfig, userInput, dialogConfig) => {
|
|
470
|
-
const msgs = selectAllMsgs(
|
|
471
|
-
state,
|
|
472
|
-
dialogConfig?.dbKey ? extractCustomId(dialogConfig.dbKey) : dialogConfig?.id
|
|
473
|
-
);
|
|
474
|
-
const botInstructionKeys = /* @__PURE__ */ new Set();
|
|
475
|
-
const botKnowledgeKeys = /* @__PURE__ */ new Set();
|
|
476
|
-
if (Array.isArray(agentConfig.references)) {
|
|
477
|
-
for (const ref of agentConfig.references) {
|
|
478
|
-
if (!ref?.dbKey) continue;
|
|
479
|
-
if (ref.type === "instruction") {
|
|
480
|
-
botInstructionKeys.add(ref.dbKey);
|
|
481
|
-
} else {
|
|
482
|
-
botKnowledgeKeys.add(ref.dbKey);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
const currentInputKeys = /* @__PURE__ */ new Set();
|
|
487
|
-
if (Array.isArray(userInput)) {
|
|
488
|
-
for (const part of userInput) {
|
|
489
|
-
if (part?.pageKey) currentInputKeys.add(part.pageKey);
|
|
490
|
-
if (part?.dialogKey) currentInputKeys.add(part.dialogKey);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
const historyKeys = /* @__PURE__ */ new Set();
|
|
494
|
-
const savedKeys = dialogConfig?.referenceKeys;
|
|
495
|
-
if (Array.isArray(savedKeys)) {
|
|
496
|
-
savedKeys.forEach((k) => historyKeys.add(k));
|
|
497
|
-
}
|
|
498
|
-
const scanContentParts = (msg) => {
|
|
499
|
-
if (!msg) return;
|
|
500
|
-
for (const key of extractReferenceKeysFromMessage(msg)) {
|
|
501
|
-
historyKeys.add(key);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
if (msgs && msgs.length > 0) {
|
|
505
|
-
const summarizedBeforeId = dialogConfig?.summarizedBeforeId;
|
|
506
|
-
if (!summarizedBeforeId) {
|
|
507
|
-
for (const msg of msgs) scanContentParts(msg);
|
|
508
|
-
} else {
|
|
509
|
-
let foundMarker = false;
|
|
510
|
-
let startScan = false;
|
|
511
|
-
for (const msg of msgs) {
|
|
512
|
-
if (!startScan) {
|
|
513
|
-
if (msg.id === summarizedBeforeId) {
|
|
514
|
-
foundMarker = true;
|
|
515
|
-
startScan = true;
|
|
516
|
-
}
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
scanContentParts(msg);
|
|
520
|
-
}
|
|
521
|
-
if (!foundMarker) {
|
|
522
|
-
console.warn(`[getFullChatContextKeys] marker ${summarizedBeforeId} not found, scanning all`);
|
|
523
|
-
for (const msg of msgs) scanContentParts(msg);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
return {
|
|
528
|
-
botInstructionKeys,
|
|
529
|
-
currentInputKeys,
|
|
530
|
-
historyKeys,
|
|
531
|
-
botKnowledgeKeys
|
|
532
|
-
};
|
|
533
|
-
};
|
|
534
|
-
var deduplicateContextKeys = (keys) => {
|
|
535
|
-
const {
|
|
536
|
-
botInstructionKeys,
|
|
537
|
-
currentInputKeys,
|
|
538
|
-
historyKeys,
|
|
539
|
-
botKnowledgeKeys
|
|
540
|
-
} = keys;
|
|
541
|
-
const finalBotInstructionKeys = Array.from(botInstructionKeys);
|
|
542
|
-
const finalCurrentInputKeys = difference(
|
|
543
|
-
Array.from(currentInputKeys),
|
|
544
|
-
finalBotInstructionKeys
|
|
545
|
-
);
|
|
546
|
-
const finalHistoryKeys = difference(Array.from(historyKeys), [
|
|
547
|
-
...finalBotInstructionKeys,
|
|
548
|
-
...finalCurrentInputKeys
|
|
549
|
-
]);
|
|
550
|
-
const finalBotKnowledgeKeys = difference(Array.from(botKnowledgeKeys), [
|
|
551
|
-
...finalBotInstructionKeys,
|
|
552
|
-
...finalCurrentInputKeys,
|
|
553
|
-
...finalHistoryKeys
|
|
554
|
-
]);
|
|
555
|
-
return {
|
|
556
|
-
botInstructionsContext: finalBotInstructionKeys,
|
|
557
|
-
currentInputContext: finalCurrentInputKeys,
|
|
558
|
-
historyContext: finalHistoryKeys,
|
|
559
|
-
botKnowledgeContext: finalBotKnowledgeKeys
|
|
560
|
-
};
|
|
561
|
-
};
|
|
562
|
-
|
|
563
344
|
// packages/ai/chat/streamRetry.ts
|
|
564
345
|
var MAX_INITIAL_STREAM_RETRIES = 3;
|
|
565
346
|
var DEFAULT_INITIAL_STREAM_RETRY_AFTER_MS = 1500;
|
|
@@ -856,6 +637,7 @@ var sendOpenAIResponseRequest = async ({
|
|
|
856
637
|
const toolMessage = {
|
|
857
638
|
id: runningToolMessageId,
|
|
858
639
|
dbKey: runningToolDbKey,
|
|
640
|
+
dialogId,
|
|
859
641
|
role: "tool",
|
|
860
642
|
content: selfHealContent,
|
|
861
643
|
toolCallId: callId,
|
|
@@ -1336,1010 +1118,93 @@ function applyQuickChatModelOverride(base, override) {
|
|
|
1336
1118
|
);
|
|
1337
1119
|
}
|
|
1338
1120
|
|
|
1339
|
-
// packages/
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
const part = typeof metadata.part === "string" ? metadata.part : editingTarget.title ?? selectedNodeId;
|
|
1346
|
-
const nodeType = typeof metadata.type === "string" ? metadata.type : "(\u672A\u77E5\u7C7B\u578B)";
|
|
1347
|
-
const path = Array.isArray(metadata.path) ? metadata.path.filter((item) => typeof item === "string") : [];
|
|
1348
|
-
const props = asRecordOrEmpty(metadata.props);
|
|
1349
|
-
const style = asRecordOrEmpty(metadata.style);
|
|
1350
|
-
return [
|
|
1351
|
-
"\u5F53\u524D\u7F16\u8F91\u76EE\u6807\uFF1ACanvas Tree \u4E2D\u7684\u4E00\u4E2A\u9009\u4E2D\u8282\u70B9\u3002",
|
|
1352
|
-
`- \u8282\u70B9 ID: ${selectedNodeId}`,
|
|
1353
|
-
`- part: ${part}`,
|
|
1354
|
-
`- \u8282\u70B9\u7C7B\u578B: ${nodeType}`,
|
|
1355
|
-
...path.length ? [`- \u8282\u70B9\u8DEF\u5F84: ${path.join(" > ")}`] : [],
|
|
1356
|
-
"",
|
|
1357
|
-
"\u5F53\u524D\u8282\u70B9 props:",
|
|
1358
|
-
JSON.stringify(props, null, 2),
|
|
1359
|
-
"",
|
|
1360
|
-
"\u5F53\u524D\u8282\u70B9 style:",
|
|
1361
|
-
JSON.stringify(style, null, 2),
|
|
1362
|
-
"",
|
|
1363
|
-
"\u3010\u7ED9 AI \u7684\u64CD\u4F5C\u6307\u5357 / \u975E\u7528\u6237\u539F\u8BDD\u3011",
|
|
1364
|
-
`1. \u5982\u679C\u7528\u6237\u8981\u6C42\u4FEE\u6539\u5F53\u524D\u6A21\u5757\uFF0C\u53EA\u8F93\u51FA updateNode\uFF0C\u76EE\u6807 id \u5FC5\u987B\u662F ${selectedNodeId}\u3002`,
|
|
1365
|
-
"2. \u4E0D\u8981\u91CD\u5EFA root/shell\uFF0C\u4E0D\u8981\u91CD\u65B0 append \u5DF2\u5B58\u5728\u7684\u5927\u5757\u5185\u5BB9\u3002",
|
|
1366
|
-
"3. \u9664\u975E\u7528\u6237\u660E\u786E\u8981\u6C42\u65B0\u589E\u5B50\u6A21\u5757\uFF0C\u5426\u5219\u4E0D\u8981 appendNode\u3002",
|
|
1367
|
-
"4. \u56DE\u590D\u4ECD\u5FC5\u987B\u9075\u5B88 Canvas Tree MVP \u534F\u8BAE\uFF1A\u53EA\u8F93\u51FA canvas_snapshot NDJSON\uFF0C\u4E0D\u8981\u8F93\u51FA\u89E3\u91CA\u6216\u6E90\u7801\u3002"
|
|
1368
|
-
].join("\n");
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
// packages/ai/agent/buildEditingContext.ts
|
|
1372
|
-
var buildAppConstraintPacks = (args) => {
|
|
1373
|
-
const imports = new Set(args.externalImports);
|
|
1374
|
-
const fileSet = new Set(args.fileNames);
|
|
1375
|
-
const packs = [
|
|
1376
|
-
{
|
|
1377
|
-
id: "repair-loop",
|
|
1378
|
-
title: "\u9884\u68C0\u4E0E\u5B9A\u70B9\u4FEE\u590D",
|
|
1379
|
-
rules: [
|
|
1380
|
-
"\u6BCF\u6B21\u6539\u5B8C\u4EE3\u7801\u540E\uFF0C\u5148\u8C03\u7528 appPreflight\uFF0C\u53EA\u6709\u9884\u68C0\u901A\u8FC7\u540E\u518D\u8C03\u7528 appDeploy\u3002",
|
|
1381
|
-
"\u5982\u679C preflight / deploy \u5931\u8D25\uFF0C\u4F18\u5148\u6839\u636E\u8FD4\u56DE\u7684 issues \u505A\u5B9A\u70B9\u4FEE\u590D\uFF0C\u7136\u540E\u91CD\u65B0 preflight\uFF1B\u4E0D\u8981\u65E0\u5173\u91CD\u5199\u6574\u9875\u5E94\u7528\u3002",
|
|
1382
|
-
"\u5982\u679C\u5DE5\u5177\u7ED3\u679C\u91CC\u5E26\u6709 repairPlan\uFF0C\u9ED8\u8BA4\u7ACB\u5373\u6267\u884C repairPlan \u4E2D\u7684\u5C40\u90E8\u4FEE\u590D\u6B65\u9AA4\uFF0C\u4E0D\u8981\u5148\u505C\u4E0B\u6765\u95EE\u7528\u6237\u3002",
|
|
1383
|
-
"\u5982\u679C\u5DE5\u5177\u7ED3\u679C\u660E\u786E\u8BF4\u660E\u662F HTML / \u975E JSON \u54CD\u5E94\u3001transport failure \u6216 retryable=false\uFF0C\u505C\u6B62\u81EA\u52A8 deploy \u91CD\u8BD5\uFF1B\u8FD9\u8BF4\u660E\u5F53\u524D\u662F\u5E73\u53F0\u901A\u9053\u5F02\u5E38\uFF0C\u4E0D\u662F\u4EE3\u7801\u95EE\u9898\u3002"
|
|
1384
|
-
]
|
|
1385
|
-
},
|
|
1386
|
-
{
|
|
1387
|
-
id: "design-system",
|
|
1388
|
-
title: "\u8BBE\u8BA1\u7CFB\u7EDF\u4E0E\u5C0F\u6539\u52A8\u7EA6\u675F",
|
|
1389
|
-
rules: [
|
|
1390
|
-
"\u5148\u68C0\u67E5\u5F53\u524D\u5E94\u7528\u662F\u5426\u5DF2\u7ECF\u6709 theme / tokens / designSystem / \u5171\u4EAB\u6837\u5F0F\u5E38\u91CF\uFF1B\u5982\u679C\u5DF2\u6709\uFF0C\u4F18\u5148\u6CBF\u7528\u8FD9\u5957\u8BBE\u8BA1\u7CFB\u7EDF\uFF0C\u4E0D\u8981\u5E73\u884C\u518D\u9020\u4E00\u5957\u3002",
|
|
1391
|
-
"\u5982\u679C\u5F53\u524D\u5E94\u7528\u8FD8\u6CA1\u6709\u8BBE\u8BA1\u7CFB\u7EDF\uFF0C\u800C\u7528\u6237\u9700\u6C42\u6D89\u53CA UI / \u6837\u5F0F / \u65B0\u9875\u9762\uFF0C\u4F18\u5148\u8865\u4E00\u5C42\u6700\u5C0F\u5171\u4EAB token\uFF08colors\u3001typography\u3001spacing\u3001radius\u3001shadow\uFF09\uFF0C\u518D\u8BA9\u7EC4\u4EF6\u6D88\u8D39\u8FD9\u4E9B token\u3002",
|
|
1392
|
-
"\u5982\u679C\u5F53\u524D\u5E94\u7528\u662F\u65E7\u5199\u6CD5\uFF1A\u89C6\u89C9\u503C\u6563\u843D\u5728\u591A\u4E2A\u7EC4\u4EF6\u7684\u786C\u7F16\u7801 style / \u5E38\u91CF\u91CC\uFF0C\u800C\u672C\u6B21\u9700\u6C42\u53EA\u662F\u8C03\u5B57\u4F53\u3001\u989C\u8272\u3001\u95F4\u8DDD\u3001\u5706\u89D2\u3001\u9634\u5F71\uFF0C\u9ED8\u8BA4\u6267\u884C\u4E00\u6B21\u6700\u5C0F token \u8FC1\u79FB\uFF0C\u518D\u5728 token \u5C42\u5B8C\u6210\u8C03\u6574\uFF1B\u4E0D\u8981\u7EE7\u7EED\u628A\u65B0\u6570\u5B57\u6563\u843D\u5199\u56DE\u591A\u4E2A\u4F4D\u7F6E\u3002",
|
|
1393
|
-
"\u5F53\u7528\u6237\u53EA\u662F\u60F3\u8C03\u5B57\u4F53\u5927\u5C0F\u3001\u5B57\u91CD\u3001\u989C\u8272\u3001\u5706\u89D2\u3001\u9634\u5F71\u3001\u95F4\u8DDD\u7B49\u89C6\u89C9\u53C2\u6570\u65F6\uFF0C\u4F18\u5148\u4FEE\u6539 token \u6216\u547D\u4E2D\u7684\u5C40\u90E8\u7EC4\u4EF6\uFF0C\u4E0D\u8981\u987A\u624B\u91CD\u5199\u6574\u4E2A\u9875\u9762\u7ED3\u6784\u3002",
|
|
1394
|
-
"\u9664\u975E\u7528\u6237\u660E\u786E\u8981\u6C42\u6574\u4F53\u6539\u7248\u6216\u91CD\u505A\u98CE\u683C\uFF0C\u5426\u5219\u4E0D\u8981\u8FDE\u5E26\u4FEE\u6539\u5E03\u5C40\u3001\u7EC4\u4EF6\u6811\u3001\u6587\u6848\u3001\u6570\u636E\u6D41\u3001\u8DEF\u7531\u6216\u672A\u547D\u4E2D\u7684\u9875\u9762\u3002",
|
|
1395
|
-
"\u5982\u679C\u53EA\u662F\u5C0F\u6539\u4E00\u5904\uFF0C\u5C3D\u91CF\u628A\u53D8\u66F4\u6536\u655B\u5728\u5C11\u6570\u6587\u4EF6\uFF0C\u5E76\u4FDD\u6301\u672A\u547D\u4E2D\u6587\u4EF6\u7684\u7ED3\u6784\u4E0E\u547D\u540D\u7A33\u5B9A\u3002"
|
|
1396
|
-
]
|
|
1397
|
-
}
|
|
1398
|
-
];
|
|
1399
|
-
if (args.framework === "react-spa" || fileSet.has("main.tsx") || fileSet.has("App.tsx")) {
|
|
1400
|
-
packs.push({
|
|
1401
|
-
id: "react-spa-core",
|
|
1402
|
-
title: "React SPA \u5F62\u6001\u4FDD\u6301",
|
|
1403
|
-
rules: [
|
|
1404
|
-
'\u7EE7\u7EED\u6CBF\u7528 framework: "react-spa" + files\uFF0C\u4E0D\u8981\u9000\u56DE\u5355\u6587\u4EF6 Worker\u3002',
|
|
1405
|
-
"\u4FDD\u7559\u7A33\u5B9A\u5165\u53E3\u7ED3\u6784\uFF0C\u4F18\u5148\u7EF4\u62A4 main.tsx + App.tsx\uFF0C\u518D\u5C40\u90E8\u4FEE\u6539\u7EC4\u4EF6\u6587\u4EF6\u3002"
|
|
1406
|
-
]
|
|
1407
|
-
});
|
|
1408
|
-
}
|
|
1409
|
-
if (imports.has("react-icons/lu")) {
|
|
1410
|
-
packs.push({
|
|
1411
|
-
id: "react-icons-lu",
|
|
1412
|
-
title: "Lucide \u56FE\u6807\u5B89\u5168\u89C4\u5219",
|
|
1413
|
-
rules: [
|
|
1414
|
-
"\u53EA\u80FD\u4F7F\u7528 react-icons/lu \u4E2D\u771F\u5B9E\u5B58\u5728\u7684\u56FE\u6807\u540D\uFF0C\u4E0D\u8981\u731C\u6D4B\u53D8\u4F53\u540D\u3002",
|
|
1415
|
-
"\u5982\u679C\u4E0D\u786E\u5B9A\u56FE\u6807\u540D\uFF0C\u4F18\u5148\u4F7F\u7528 LuCircle\u3001LuCheck\u3001LuX\u3001LuInfo\u3001LuArrowRight \u8FD9\u7C7B\u57FA\u7840\u56FE\u6807\u3002"
|
|
1416
|
-
]
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
if (imports.has("leaflet") || imports.has("react-leaflet")) {
|
|
1420
|
-
packs.push({
|
|
1421
|
-
id: "leaflet",
|
|
1422
|
-
title: "Leaflet \u5730\u56FE\u7EA6\u675F",
|
|
1423
|
-
rules: [
|
|
1424
|
-
"\u4E0D\u8981\u624B\u52A8 import leaflet.css\uFF1B\u5E73\u53F0\u4F1A\u81EA\u52A8\u6CE8\u5165 Leaflet \u6837\u5F0F\u3002",
|
|
1425
|
-
"\u4FEE\u6539\u5730\u56FE\u65F6\u4F18\u5148\u4FDD\u7559\u73B0\u6709\u5750\u6807\u3001\u7F29\u653E\u548C\u56FE\u5C42\u7ED3\u6784\uFF0C\u53EA\u505A\u5FC5\u8981\u7684\u4EA4\u4E92\u6216\u89C6\u89C9\u8C03\u6574\u3002"
|
|
1426
|
-
]
|
|
1427
|
-
});
|
|
1428
|
-
}
|
|
1429
|
-
if (imports.has("@xyflow/react")) {
|
|
1430
|
-
packs.push({
|
|
1431
|
-
id: "xyflow",
|
|
1432
|
-
title: "Flow \u56FE\u7F16\u8F91\u7EA6\u675F",
|
|
1433
|
-
rules: [
|
|
1434
|
-
"\u4E0D\u8981\u65B0\u589E\u5916\u90E8 CSS import\uFF1B\u9700\u8981\u6837\u5F0F\u65F6\u76F4\u63A5\u8865\u6700\u5C0F\u5FC5\u8981\u5185\u8054\u6837\u5F0F\u6216\u7EC4\u4EF6\u5185 style \u6807\u7B7E\u3002",
|
|
1435
|
-
"\u4F18\u5148\u590D\u7528\u73B0\u6709\u8282\u70B9/\u8FB9\u6570\u636E\u7ED3\u6784\uFF0C\u907F\u514D\u91CD\u5199\u6574\u5957 flow \u753B\u5E03\u3002"
|
|
1436
|
-
]
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
if (imports.has("echarts") || imports.has("echarts-for-react")) {
|
|
1440
|
-
packs.push({
|
|
1441
|
-
id: "echarts",
|
|
1442
|
-
title: "\u56FE\u8868\u6539\u52A8\u7EA6\u675F",
|
|
1443
|
-
rules: [
|
|
1444
|
-
"\u4F18\u5148\u5C40\u90E8\u4FEE\u6539 option \u914D\u7F6E\u3001\u6570\u636E\u6620\u5C04\u548C\u7EC4\u4EF6 props\uFF0C\u4E0D\u8981\u91CD\u5199\u6574\u4E2A\u56FE\u8868\u9875\u9762\u3002",
|
|
1445
|
-
"\u54CD\u5E94\u5F0F\u5E03\u5C40\u4F18\u5148\u9760\u5BB9\u5668\u5C3A\u5BF8\u548C\u73B0\u6709\u7EC4\u4EF6\u7ED3\u6784\u8C03\u6574\uFF0C\u4E0D\u8981\u989D\u5916\u5F15\u5165 CSS \u6587\u4EF6\u3002"
|
|
1446
|
-
]
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
if (imports.has("docx") || imports.has("xlsx")) {
|
|
1450
|
-
packs.push({
|
|
1451
|
-
id: "file-processing",
|
|
1452
|
-
title: "\u6587\u6863/\u8868\u683C\u5904\u7406\u7EA6\u675F",
|
|
1453
|
-
rules: [
|
|
1454
|
-
"\u4E0D\u8981\u628A\u5927\u578B\u6570\u636E\u6216\u6A21\u677F\u5185\u5BB9\u76F4\u63A5\u5185\u5D4C\u8FDB\u4EE3\u7801\u5E38\u91CF\uFF1B\u4F18\u5148\u4FDD\u7559\u8FD0\u884C\u65F6\u52A0\u8F7D\u65B9\u5F0F\u3002",
|
|
1455
|
-
"\u4FEE\u6539\u5BFC\u5165\u5BFC\u51FA\u903B\u8F91\u65F6\uFF0C\u4F18\u5148\u6CBF\u7528\u73B0\u6709\u6587\u4EF6\u5904\u7406\u94FE\u8DEF\u548C\u6570\u636E\u7ED3\u6784\u3002"
|
|
1456
|
-
]
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
return packs;
|
|
1460
|
-
};
|
|
1461
|
-
var formatAppConstraintPacks = (packs) => {
|
|
1462
|
-
if (packs.length === 0) return [];
|
|
1463
|
-
return [
|
|
1464
|
-
"",
|
|
1465
|
-
"\u5F53\u524D\u6FC0\u6D3B\u7EA6\u675F\u5305\uFF08\u6309\u5F53\u524D\u5E94\u7528\u4F9D\u8D56/\u5F62\u6001\u52A8\u6001\u6CE8\u5165\uFF09\uFF1A",
|
|
1466
|
-
...packs.flatMap((pack) => [
|
|
1467
|
-
`- ${pack.title}\uFF08${pack.id}\uFF09`,
|
|
1468
|
-
...pack.rules.map((rule) => ` - ${rule}`)
|
|
1469
|
-
])
|
|
1470
|
-
];
|
|
1471
|
-
};
|
|
1472
|
-
function resolveEditingTargetTableIdentity(editingTarget) {
|
|
1473
|
-
if (!editingTarget || editingTarget.kind !== "table") return null;
|
|
1474
|
-
const metadata = editingTarget.metadata;
|
|
1475
|
-
const tenantId = typeof editingTarget.tenantId === "string" && editingTarget.tenantId || typeof metadata?.tenantId === "string" && metadata.tenantId || void 0;
|
|
1476
|
-
const tableId = typeof editingTarget.tableId === "string" && editingTarget.tableId || typeof metadata?.tableId === "string" && metadata.tableId || void 0;
|
|
1477
|
-
if (!tenantId || !tableId) return null;
|
|
1478
|
-
return { tenantId, tableId };
|
|
1479
|
-
}
|
|
1480
|
-
var buildEditingContextSummary = (state, runtimeOptions) => {
|
|
1481
|
-
const targetKind = runtimeOptions?.editingTarget?.kind;
|
|
1482
|
-
if (targetKind === "table") {
|
|
1483
|
-
const editingTarget = runtimeOptions?.editingTarget;
|
|
1484
|
-
const targetIdentity = resolveEditingTargetTableIdentity(editingTarget);
|
|
1485
|
-
if (!targetIdentity) return null;
|
|
1486
|
-
const { tenantId, tableId } = targetIdentity;
|
|
1487
|
-
const targetDbKey = metaKey(tenantId, tableId);
|
|
1488
|
-
const dbEntities = state?.db?.entities;
|
|
1489
|
-
const metaFromDb = dbEntities?.[targetDbKey];
|
|
1490
|
-
const stateTable = state?.table;
|
|
1491
|
-
const metaFromStateTable = stateTable?.currentTable?.tableId === tableId || stateTable?.currentTable?.dbKey === targetDbKey ? stateTable.currentTable : null;
|
|
1492
|
-
const uiTableState = getTableState();
|
|
1493
|
-
const metaFromUiCache = uiTableState.currentTable?.tenantId === tenantId && uiTableState.currentTable?.tableId === tableId ? uiTableState.currentTable : null;
|
|
1494
|
-
const table = metaFromDb ?? metaFromStateTable ?? metaFromUiCache ?? {
|
|
1495
|
-
tenantId,
|
|
1496
|
-
tableId,
|
|
1497
|
-
displayName: editingTarget?.title ?? tableId,
|
|
1498
|
-
description: editingTarget?.summary ?? "",
|
|
1499
|
-
columns: Array.isArray(editingTarget?.metadata?.columns) ? editingTarget?.metadata?.columns : Array.isArray(editingTarget?.metadata?.columnNames) ? (editingTarget?.metadata?.columnNames).map((name) => ({ name, label: name })) : []
|
|
1500
|
-
};
|
|
1501
|
-
let rows = [];
|
|
1502
|
-
if (metaFromUiCache && Array.isArray(uiTableState.rows)) {
|
|
1503
|
-
rows = uiTableState.rows;
|
|
1504
|
-
} else if (metaFromStateTable && Array.isArray(stateTable?.rows)) {
|
|
1505
|
-
rows = stateTable.rows;
|
|
1506
|
-
} else if (dbEntities) {
|
|
1507
|
-
rows = Object.values(dbEntities).filter(
|
|
1508
|
-
(entity) => entity?.type === "table_row" /* TABLE_ROW */ && entity?.tenantId === tenantId && entity?.tableId === tableId && !entity?.deletedAt
|
|
1509
|
-
);
|
|
1510
|
-
}
|
|
1511
|
-
const metadata = editingTarget?.metadata;
|
|
1512
|
-
const focusContext = metadata && typeof metadata === "object" ? metadata.focusContext : null;
|
|
1513
|
-
if (!table) return null;
|
|
1514
|
-
const columns = Array.isArray(table.columns) ? table.columns : [];
|
|
1515
|
-
const columnSummaries = columns.length ? columns.map((c) => {
|
|
1516
|
-
const displayName = c.label || c.name;
|
|
1517
|
-
const type = c.type || "text";
|
|
1518
|
-
const requiredFlag = c.required ? "\u5FC5\u586B" : "\u53EF\u9009";
|
|
1519
|
-
const primaryFlag = c.isPrimary ? "\uFF0C\u4E3B\u5B57\u6BB5" : "";
|
|
1520
|
-
const optionsStr = Array.isArray(c.options) && c.options.length ? `\uFF0C\u53EF\u9009\u503C\uFF1A${c.options.join(" | ")}` : "";
|
|
1521
|
-
const descStr = c.description ? `\u3002\u8BF4\u660E\uFF1A${c.description}` : "";
|
|
1522
|
-
return `- ${c.name}\uFF08\u663E\u793A\u540D\uFF1A${displayName}\uFF0C\u7C7B\u578B\uFF1A${type}\uFF0C${requiredFlag}${primaryFlag}${optionsStr}${descStr}\uFF09`;
|
|
1523
|
-
}) : ["- (\u5F53\u524D\u8868\u5C1A\u672A\u5B9A\u4E49\u5B57\u6BB5)"];
|
|
1524
|
-
const sampleRows = Array.isArray(rows) ? rows.slice(0, 20) : [];
|
|
1525
|
-
const rowsPreview = sampleRows.length ? JSON.stringify(sampleRows, null, 2) : "(\u5F53\u524D\u8868\u6682\u65E0\u884C\u6570\u636E)";
|
|
1526
|
-
const tableTitle = table.displayName ?? table.tableId ?? "(\u672A\u547D\u540D\u8868)";
|
|
1527
|
-
const tableDesc = table.description ? `\u7528\u9014\u8BF4\u660E\uFF1A${table.description}` : "(\u6682\u65E0\u7528\u9014\u8BF4\u660E)";
|
|
1528
|
-
const tableTagsLine = Array.isArray(table.tags) && table.tags.length ? `- \u5173\u952E\u8BCD\u6807\u7B7E: ${table.tags.join(", ")}` : null;
|
|
1529
|
-
return [
|
|
1530
|
-
"\u5F53\u524D\u7F16\u8F91\u76EE\u6807\uFF1A\u4E00\u5F20\u6570\u636E\u8868\uFF08Editing Table\uFF09\u3002",
|
|
1531
|
-
`- \u8868 ID: ${table.tableId}`,
|
|
1532
|
-
`- \u663E\u793A\u540D\u79F0: ${tableTitle}`,
|
|
1533
|
-
`- ${tableDesc}`,
|
|
1534
|
-
...tableTagsLine ? [tableTagsLine] : [],
|
|
1535
|
-
...focusContext && typeof focusContext === "object" && "columnName" in focusContext ? [
|
|
1536
|
-
"",
|
|
1537
|
-
"\u5F53\u524D\u7126\u70B9\uFF08Focus Context\uFF09\uFF1A",
|
|
1538
|
-
`- \u5F53\u524D\u5355\u5143\u683C\u5217: ${String(focusContext.columnName ?? "(\u672A\u77E5\u5217)")}`,
|
|
1539
|
-
...focusContext.rowTitle ? [`- \u5F53\u524D\u884C\u6807\u9898: ${String(focusContext.rowTitle)}`] : [],
|
|
1540
|
-
...focusContext.rowIndex !== null && focusContext.rowIndex !== void 0 ? [`- \u5F53\u524D\u884C\u53F7: ${Number(focusContext.rowIndex) + 1}`] : [],
|
|
1541
|
-
...focusContext.cellPreview ? [`- \u5F53\u524D\u5355\u5143\u683C\u5185\u5BB9\u9884\u89C8: ${String(focusContext.cellPreview)}`] : []
|
|
1542
|
-
] : [],
|
|
1543
|
-
"",
|
|
1544
|
-
"\u5B57\u6BB5\u5B9A\u4E49\uFF08Field Schema\uFF09\uFF1A",
|
|
1545
|
-
...columnSummaries,
|
|
1546
|
-
"",
|
|
1547
|
-
"\u3010\u7ED9 AI \u7684\u64CD\u4F5C\u6307\u5357 / \u975E\u7528\u6237\u539F\u8BDD\u3011",
|
|
1548
|
-
"\u5F53\u7528\u6237\u5E0C\u671B\u5728\u5F53\u524D\u8868\u4E2D\u201C\u65B0\u589E\u4E00\u884C / \u65B0\u589E\u8BB0\u5F55 / \u63D2\u5165\u4E00\u6761 / \u5E2E\u6211\u8BB0\u4E00\u6761 xxx\u201D\u65F6\uFF1A",
|
|
1549
|
-
"1. \u5FC5\u987B\u8C03\u7528\u5DE5\u5177 addTableRow\uFF08\u800C\u4E0D\u662F\u53EA\u5728\u56DE\u7B54\u4E2D\u53E3\u5934\u63CF\u8FF0\u8981\u65B0\u589E\u7684\u6570\u636E\uFF09\u3002",
|
|
1550
|
-
"2. \u8C03\u7528 addTableRow \u65F6\uFF1A",
|
|
1551
|
-
" - \u4F7F\u7528\u53C2\u6570 values\uFF08\u4E00\u4E2A\u5BF9\u8C61\uFF09\uFF0C\u5176\u4E2D\u6BCF\u4E2A key \u5FC5\u987B\u662F\u4E0A\u9762\u5B57\u6BB5\u540D\u4E4B\u4E00\uFF08name\uFF0C\u800C\u4E0D\u662F label\uFF09\u3002",
|
|
1552
|
-
' - \u4F8B\u5982\uFF1A{"values":{"title":"\u4FEE Bug #123","status":"todo","note":"\u9AD8\u4F18\u5148\u7EA7"}}\u3002',
|
|
1553
|
-
" - \u5C3D\u91CF\u4ECE\u7528\u6237\u7684\u81EA\u7136\u8BED\u8A00\u4E2D\u63A8\u65AD\u5E76\u586B\u6EE1\u6240\u6709\u76F8\u5173\u5B57\u6BB5\uFF1B\u5BF9\u4E8E\u5FC5\u586B\u5B57\u6BB5\uFF08required=true\uFF09\u5C24\u5176\u8981\u6CE8\u610F\u3002",
|
|
1554
|
-
' - \u7528\u6237\u6CA1\u6709\u63D0\u5230\u7684\u5B57\u6BB5\uFF0C\u53EF\u4EE5\u4F7F\u7528\u7A7A\u5B57\u7B26\u4E32 "" \u6216 null \u4F5C\u4E3A\u5360\u4F4D\u3002',
|
|
1555
|
-
" - \u7EDD\u4E0D\u8981\u4F20\u5165\u7A7A\u5BF9\u8C61 {} \u4F5C\u4E3A values\u3002",
|
|
1556
|
-
"",
|
|
1557
|
-
"\u4EE5\u4E0B\u662F\u90E8\u5206\u793A\u4F8B\u884C\uFF08\u6700\u591A 20 \u884C\uFF0C\u7528\u4E8E\u5E2E\u52A9\u4F60\u7406\u89E3\u5217\u542B\u4E49\uFF0C\u8BF7\u907F\u514D\u5728\u56DE\u7B54\u4E2D\u5B8C\u6574\u7C98\u8D34\u6574\u8868\uFF09\uFF1A",
|
|
1558
|
-
rowsPreview
|
|
1559
|
-
].join("\n");
|
|
1560
|
-
}
|
|
1561
|
-
if (targetKind === "page" || targetKind === "article") {
|
|
1562
|
-
const page = getDocState();
|
|
1563
|
-
const metadata = runtimeOptions?.editingTarget?.metadata;
|
|
1564
|
-
const focusContext = metadata && typeof metadata === "object" ? metadata.focusContext : null;
|
|
1565
|
-
if (!page) return null;
|
|
1566
|
-
const title = page.title ?? "(\u672A\u547D\u540D\u9875\u9762)";
|
|
1567
|
-
return [
|
|
1568
|
-
"\u5F53\u524D\u7F16\u8F91\u76EE\u6807\uFF1A\u4E00\u4E2A\u9875\u9762 / \u6587\u7AE0\uFF08Editing Document\uFF09\u3002",
|
|
1569
|
-
`- \u6807\u9898: ${title}`,
|
|
1570
|
-
...focusContext && typeof focusContext === "object" && "anchorPath" in focusContext ? [
|
|
1571
|
-
"",
|
|
1572
|
-
"\u5F53\u524D\u7126\u70B9\uFF08Focus Context\uFF09\uFF1A",
|
|
1573
|
-
`- \u5149\u6807\u662F\u5426\u6298\u53E0: ${Boolean(focusContext.isCollapsed) ? "\u662F" : "\u5426"}`,
|
|
1574
|
-
...focusContext.blockType ? [`- \u5F53\u524D\u5757\u7C7B\u578B: ${String(focusContext.blockType)}`] : [],
|
|
1575
|
-
...focusContext.selectedText ? [`- \u5F53\u524D\u9009\u4E2D\u6587\u672C: ${String(focusContext.selectedText)}`] : [],
|
|
1576
|
-
...focusContext.anchorPath?.length ? [`- \u5F53\u524D\u951A\u70B9\u8DEF\u5F84: ${focusContext.anchorPath.join(" > ")}`] : []
|
|
1577
|
-
] : [],
|
|
1578
|
-
"",
|
|
1579
|
-
"\u5982\u679C\u7528\u6237\u8981\u6C42\u4F60\u5BF9\u8FD9\u7BC7\u6587\u7AE0\u8FDB\u884C\u4FEE\u6539\u6216\u4F18\u5316\uFF0C\u8BF7\u5728\u56DE\u7B54\u4E2D\u660E\u786E\u6307\u51FA\u4FEE\u6539\u65B9\u5411\u3002",
|
|
1580
|
-
"\u5982\u679C\u5B58\u5728\u5F53\u524D\u9009\u533A\u6216\u5149\u6807\u4E0A\u4E0B\u6587\uFF0C\u4F18\u5148\u56F4\u7ED5\u8BE5\u5C40\u90E8\u4F4D\u7F6E\u505A\u5B9A\u70B9\u6539\u5199\uFF0C\u800C\u4E0D\u662F\u6CDB\u6CDB\u91CD\u5199\u6574\u7BC7\u6587\u6863\u3002"
|
|
1581
|
-
].join("\n");
|
|
1582
|
-
}
|
|
1583
|
-
if (targetKind === "app") {
|
|
1584
|
-
const editingTarget = runtimeOptions?.editingTarget;
|
|
1585
|
-
const metadata = editingTarget?.metadata;
|
|
1586
|
-
const appId = editingTarget?.key ?? "(\u672A\u77E5 appId)";
|
|
1587
|
-
const title = editingTarget?.title ?? "(\u672A\u547D\u540D\u5E94\u7528)";
|
|
1588
|
-
const framework = typeof metadata?.framework === "string" ? metadata.framework : "worker";
|
|
1589
|
-
const appUrl = typeof metadata?.appUrl === "string" ? metadata.appUrl : null;
|
|
1590
|
-
const fileNames = Array.isArray(metadata?.fileNames) ? metadata.fileNames.filter((name) => typeof name === "string") : [];
|
|
1591
|
-
const externalImports = Array.isArray(metadata?.externalImports) ? metadata.externalImports.filter(
|
|
1592
|
-
(name) => typeof name === "string"
|
|
1593
|
-
) : [];
|
|
1594
|
-
const sourceSummary = asOptionalTrimmedString(editingTarget?.summary) ?? null;
|
|
1595
|
-
const selectedNode = metadata && typeof metadata === "object" && metadata.selectedNode && typeof metadata.selectedNode === "object" ? metadata.selectedNode : null;
|
|
1596
|
-
const constraintPacks = buildAppConstraintPacks({
|
|
1597
|
-
framework,
|
|
1598
|
-
fileNames,
|
|
1599
|
-
externalImports
|
|
1600
|
-
});
|
|
1601
|
-
if (selectedNode && typeof selectedNode.cssPath === "string") {
|
|
1602
|
-
const tagName = typeof selectedNode.tagName === "string" && selectedNode.tagName ? selectedNode.tagName : "\u5143\u7D20";
|
|
1603
|
-
const cssPath = String(selectedNode.cssPath);
|
|
1604
|
-
const outerHTMLSnippet = typeof selectedNode.outerHTMLSnippet === "string" ? selectedNode.outerHTMLSnippet : "";
|
|
1605
|
-
const textSnippet = typeof selectedNode.textSnippet === "string" ? selectedNode.textSnippet : "";
|
|
1606
|
-
const noloLoc = typeof selectedNode.noloLoc === "string" ? selectedNode.noloLoc : "";
|
|
1607
|
-
constraintPacks.push({
|
|
1608
|
-
id: "selected-node",
|
|
1609
|
-
title: "\u7528\u6237\u9009\u4E2D\u8282\u70B9\uFF08\u5B9A\u70B9\u4FEE\u6539\uFF09",
|
|
1610
|
-
rules: [
|
|
1611
|
-
`\u7528\u6237\u5DF2\u5728\u9884\u89C8\u4E2D\u7CBE\u51C6\u9009\u4E2D\u4E00\u4E2A\u5143\u7D20\uFF1A<${tagName}> \uFF0CCSS \u8DEF\u5F84\uFF1A${cssPath}${noloLoc ? `\uFF0C\u6E90\u7801\u4F4D\u7F6E\uFF1A${noloLoc}` : ""}\u3002\u672C\u8F6E\u4FEE\u6539\u5FC5\u987B\u4EE5\u8FD9\u4E2A\u5143\u7D20\u4E3A\u4E2D\u5FC3\u3002`,
|
|
1612
|
-
`\u9009\u4E2D\u5143\u7D20\u7684 HTML \u7247\u6BB5\uFF08\u53EF\u80FD\u622A\u65AD\uFF09\uFF1A${outerHTMLSnippet}${textSnippet ? `\uFF1B\u53EF\u89C1\u6587\u672C\uFF1A${textSnippet}` : ""}\u3002\u5148\u5728\u6E90\u7801\u6587\u4EF6\u4E2D\u5B9A\u4F4D\u5230\u751F\u6210\u8FD9\u6BB5 HTML \u7684\u4EE3\u7801\uFF0C\u518D\u52A8\u624B\u3002`,
|
|
1613
|
-
"\u4FEE\u6539\u6536\u655B\u5728\u8BE5\u5143\u7D20\u53CA\u5176\u76F4\u63A5\u6837\u5F0F\u6765\u6E90\uFF08\u547D\u4E2D\u7684\u7EC4\u4EF6/\u7C7B/design token\uFF09\uFF1B\u8C03\u89C6\u89C9\u53C2\u6570\u4F18\u5148\u6539 token \u6216\u5C40\u90E8\u7EC4\u4EF6\u3002",
|
|
1614
|
-
"\u7981\u6B62\u91CD\u5199\u672A\u547D\u4E2D\u7684\u9875\u9762\u7ED3\u6784\u3001\u5E03\u5C40\u3001\u6587\u6848\u3001\u6570\u636E\u6D41\u6216\u5176\u4ED6\u7EC4\u4EF6\uFF1B\u4FDD\u6301\u672A\u547D\u4E2D\u6587\u4EF6\u4E0D\u53D8\u3002",
|
|
1615
|
-
"\u5982\u679C\u6309 CSS \u8DEF\u5F84\u548C HTML \u7247\u6BB5\u5728\u6E90\u7801\u4E2D\u627E\u4E0D\u5230\u5BF9\u5E94\u4F4D\u7F6E\uFF0C\u5148\u5411\u7528\u6237\u8BF4\u660E\u5E76\u8BF7\u7528\u6237\u91CD\u65B0\u9009\u62E9\uFF0C\u4E0D\u8981\u51ED\u731C\u6D4B\u5927\u8303\u56F4\u6539\u52A8\u3002"
|
|
1616
|
-
]
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
|
-
return [
|
|
1620
|
-
"\u5F53\u524D\u7F16\u8F91\u76EE\u6807\uFF1A\u4E00\u4E2A Web \u5E94\u7528\uFF08Editing App\uFF09\u3002",
|
|
1621
|
-
`- \u5E94\u7528 ID: ${appId}`,
|
|
1622
|
-
`- \u540D\u79F0: ${title}`,
|
|
1623
|
-
`- \u6280\u672F\u5F62\u6001: ${framework}`,
|
|
1624
|
-
...appUrl ? [`- \u5F53\u524D\u8BBF\u95EE\u5730\u5740: ${appUrl}`] : [],
|
|
1625
|
-
...fileNames.length ? [`- \u5F53\u524D\u6E90\u7801\u6587\u4EF6: ${fileNames.join(", ")}`] : ["- \u5F53\u524D\u6E90\u7801\u6587\u4EF6: (\u672A\u63D0\u4F9B\u591A\u6587\u4EF6\u6E05\u5355\uFF1B\u53EF\u80FD\u662F\u5355\u6587\u4EF6\u6E90\u7801\uFF0C\u4E5F\u53EF\u80FD\u53EA\u5269\u90E8\u7F72\u4EA7\u7269)"],
|
|
1626
|
-
...externalImports.length ? [`- \u5F53\u524D\u4F9D\u8D56\u767D\u540D\u5355\u547D\u4E2D: ${externalImports.join(", ")}`] : [],
|
|
1627
|
-
...sourceSummary ? ["", sourceSummary] : [],
|
|
1628
|
-
"",
|
|
1629
|
-
"\u3010\u7ED9 AI \u7684\u64CD\u4F5C\u6307\u5357 / \u975E\u7528\u6237\u539F\u8BDD\u3011",
|
|
1630
|
-
"1. \u7528\u6237\u8981\u6C42\u4FEE\u6539\u5F53\u524D\u5E94\u7528\u65F6\uFF0C\u5148\u8C03\u7528 appRead \u83B7\u53D6\u5F53\u524D\u4EE3\u7801/\u6587\u4EF6\uFF0C\u518D\u57FA\u4E8E\u73B0\u6709\u5B9E\u73B0\u4FEE\u6539\u3002",
|
|
1631
|
-
"1b. \u5982\u679C appFileList / appFileSearch / appFileRead \u8FD4\u56DE 409\uFF08APP_WORKSPACE_MISSING / \u6E90\u7801\u5DE5\u4F5C\u533A\u7F3A\u5931\uFF09\u6216 400\uFF08UNSUPPORTED_APP_FRAMEWORK / \u4E0D\u662F Nolo React SSR\uFF09\uFF0C**\u7ACB\u5373\u505C\u6B62\u4FEE\u6539\uFF0C\u4E0D\u8981\u81EA\u5DF1\u7F16\u5360\u4F4D\u4EE3\u7801\u6216\u964D\u7EA7 framework \u53BB appDeploy**\u3002\u5148\u8C03\u7528 appVersionList(appId) \u67E5\u770B\u5386\u53F2\u7248\u672C\uFF0C\u9009\u4E00\u4E2A\u6700\u8FD1\u7684\u5B8C\u6574\u7248\u672C\u7528 appVersionRestore(appId, versionId) \u6062\u590D\uFF0C\u6062\u590D\u540E\u6E90\u7801\u5DE5\u4F5C\u533A\u4F1A\u91CD\u5EFA\uFF0C\u518D\u7EE7\u7EED\u4FEE\u6539\u3002\u5982\u679C\u6CA1\u6709\u5386\u53F2\u7248\u672C\uFF0C\u518D\u5411\u7528\u6237\u8BF4\u660E\u60C5\u51B5\u3002\u7EDD\u4E0D\u53EF\u4EE5\u7528 `fetch(appUrl)`\u3001\u7A7A\u4EE3\u7801\u3001\u5360\u4F4D\u4EE3\u7801\u53BB appDeploy\u2014\u2014\u90A3\u4F1A\u8986\u76D6\u73B0\u6709\u5E94\u7528\u5BFC\u81F4\u6570\u636E\u4E22\u5931\u3002",
|
|
1632
|
-
"2. \u5982\u679C appRead \u8FD4\u56DE workspaceRef/sourceFiles/sourceOmitted\uFF0C\u4E0D\u8981\u6574\u7AD9\u91CD\u5199\uFF1B\u4F7F\u7528 App Builder \u7684\u53D7\u9650 workspace \u6587\u4EF6\u5DE5\u5177\uFF1AappFileList=globFiles\u3001appFileSearch=codeSearch\u3001appFileRead=readFile\u3001appFileReplace=editFile\u3001appFileWrite=writeFile\u3002\u5148\u5B9A\u4F4D\u6587\u4EF6\u4E0E\u547D\u4E2D\u884C\uFF0C\u5927\u6587\u4EF6\u53EA\u8BFB\u53D6\u5FC5\u8981\u884C\u8303\u56F4\uFF1B\u6587\u5B57\u3001\u6837\u5F0F\u3001token\u3001\u5C40\u90E8\u903B\u8F91\u7B49\u5C0F\u6539\u52A8\u5FC5\u987B\u4F18\u5148\u7528 appFileReplace \u7CBE\u786E\u66FF\u6362\u552F\u4E00\u7247\u6BB5\uFF0C\u53EA\u6709\u65B0\u5EFA\u6587\u4EF6\u6216\u786E\u5B9E\u9700\u8981\u6574\u6587\u4EF6\u91CD\u5199\u65F6\u624D\u7528 appFileWrite\u3002",
|
|
1633
|
-
"3. \u5148\u8BC6\u522B\u5F53\u524D\u5E94\u7528\u662F\u5426\u5DF2\u6709 theme / tokens / design system\uFF1B\u5DF2\u6709\u5C31\u4F18\u5148\u6539\u8FD9\u5C42\uFF0C\u6CA1\u6709\u518D\u8865\u4E00\u5C42\u6700\u5C0F\u5171\u4EAB token\uFF0C\u518D\u57FA\u4E8E token \u8C03\u6574\u7EC4\u4EF6\u3002",
|
|
1634
|
-
"4. \u5982\u679C\u5F53\u524D\u5E94\u7528\u8FD8\u662F\u65E7\u5199\u6CD5\uFF1A\u89C6\u89C9\u503C\u6563\u843D\u5728\u7EC4\u4EF6\u786C\u7F16\u7801 style \u91CC\uFF0C\u800C\u7528\u6237\u53EA\u662F\u505A\u5B57\u4F53/\u989C\u8272/\u95F4\u8DDD\u7B49\u89C6\u89C9\u5FAE\u8C03\uFF0C\u9ED8\u8BA4\u5148\u628A\u547D\u4E2D\u7684\u89C6\u89C9\u503C\u62BD\u5230\u6700\u5C0F token \u5C42\uFF0C\u518D\u5B8C\u6210\u672C\u6B21\u4FEE\u6539\uFF1B\u9664\u975E\u7528\u6237\u660E\u786E\u8981\u6C42\u4E0D\u8981\u91CD\u6784\u3002",
|
|
1635
|
-
`5. \u91CD\u65B0\u90E8\u7F72\u5F53\u524D\u5E94\u7528\u65F6\uFF0CappDeploy \u5FC5\u987B\u7EE7\u7EED\u4F20\u540C\u4E00\u4E2A appId\uFF08${appId}\uFF09\uFF0C\u907F\u514D\u521B\u5EFA\u65B0\u5E94\u7528\u3002`,
|
|
1636
|
-
framework === "nolo-react" ? "6. \u5F53\u524D\u5E94\u7528\u662F Nolo React SSR\uFF0C\u4FEE\u6539\u65F6\u4F18\u5148\u4F7F\u7528\u53D7\u9650 app workspace \u6587\u4EF6\u5DE5\u5177\u64CD\u4F5C\u6E90\u7801\u5DE5\u4F5C\u533A\uFF0C\u7136\u540E appPreflight/appDeploy\uFF1B\u4E0D\u8981\u9000\u56DE react-spa \u6216\u5355\u6587\u4EF6 Worker\u3002" : framework === "react-spa" ? '6. \u5F53\u524D\u5E94\u7528\u662F React SPA\uFF0C\u4FEE\u6539\u65F6\u7EE7\u7EED\u6CBF\u7528 framework: "react-spa" + files\uFF0C\u4E0D\u8981\u9000\u56DE\u5355\u6587\u4EF6 Worker\u3002' : "6. \u5F53\u524D\u5E94\u7528\u76EE\u524D\u662F Worker \u5F62\u6001\uFF1B\u5982\u679C\u9700\u6C42\u53D8\u6210\u590D\u6742\u4EA4\u4E92\u6216\u56FE\u8868\uFF0C\u53EF\u4EE5\u8BC4\u4F30\u5347\u7EA7\u4E3A React SPA\u3002",
|
|
1637
|
-
...fileNames.length ? [] : [
|
|
1638
|
-
"7. \u5F53\u524D\u6CA1\u6709\u6E90\u7801\u6587\u4EF6\u6E05\u5355\u65F6\uFF0C\u5FC5\u987B\u5148\u7528 appRead \u5224\u65AD\u8BFB\u5230\u7684\u662F\u53EF\u7EF4\u62A4\u6E90\u7801\u8FD8\u662F\u90E8\u7F72\u4EA7\u7269 / \u6253\u5305 bundle\u3002",
|
|
1639
|
-
"8. \u5982\u679C appRead \u8FD4\u56DE\u7684\u662F HTML \u58F3\u3001importmap\u3001\u538B\u7F29 bundle \u6216\u660E\u663E\u4E0D\u662F\u539F\u59CB\u6E90\u7801\u6587\u4EF6\uFF0C\u7981\u6B62\u5728\u672A\u544A\u77E5\u7528\u6237\u98CE\u9669\u7684\u60C5\u51B5\u4E0B\u6574\u7AD9\u91CD\u5199\uFF1B\u5E94\u5148\u8BF4\u660E\u201C\u5F53\u524D\u7F3A\u5C11\u539F\u59CB\u6E90\u7801\u5FEB\u7167\uFF0C\u7EE7\u7EED\u4FEE\u6539\u66F4\u50CF\u6574\u4F53\u91CD\u5EFA\u201D\uFF0C\u7B49\u7528\u6237\u786E\u8BA4\u540E\u518D\u7EE7\u7EED\u3002"
|
|
1640
|
-
],
|
|
1641
|
-
"9. \u5982\u679C\u7528\u6237\u53EA\u662F\u8981\u8C03\u5B57\u4F53\u5927\u5C0F\u3001\u914D\u8272\u3001\u5706\u89D2\u3001\u9634\u5F71\u3001\u7559\u767D\u7B49\u89C6\u89C9\u7EC6\u8282\uFF0C\u9ED8\u8BA4\u4F18\u5148\u6539\u8BBE\u8BA1 token \u6216\u547D\u4E2D\u7684\u5C40\u90E8\u7EC4\u4EF6\uFF1B\u5BF9\u65E7\u5199\u6CD5\u5E94\u7528\u5219\u4F18\u5148\u505A\u6700\u5C0F token \u8FC1\u79FB\uFF0C\u4E0D\u8981\u53EA\u6539\u6563\u843D\u786C\u7F16\u7801\u3002",
|
|
1642
|
-
"10. \u6BCF\u6B21\u4FEE\u6539\u5B8C\u6210\u540E\uFF0C\u5148 appPreflight\uFF0C\u518D appDeploy\uFF1B\u5982\u679C\u5931\u8D25\uFF0C\u6309\u8FD4\u56DE issues \u5B9A\u70B9\u4FEE\u590D\u3002",
|
|
1643
|
-
"11. \u56DE\u590D\u7528\u6237\u65F6\u4F18\u5148\u8BF4\u660E\u505A\u4E86\u4EC0\u4E48\u53D8\u5316\u3001\u73B0\u5728\u5E94\u7528\u53EF\u4EE5\u600E\u4E48\u7528\uFF0C\u800C\u4E0D\u662F\u76F4\u63A5\u5806\u4EE3\u7801\u3002",
|
|
1644
|
-
...formatAppConstraintPacks(constraintPacks)
|
|
1645
|
-
].join("\n");
|
|
1646
|
-
}
|
|
1647
|
-
if (targetKind === "local_preview") {
|
|
1648
|
-
const metadata = runtimeOptions?.editingTarget?.metadata;
|
|
1649
|
-
const selectedNode = metadata && typeof metadata === "object" && metadata.selectedNode && typeof metadata.selectedNode === "object" ? metadata.selectedNode : null;
|
|
1650
|
-
if (!selectedNode) return null;
|
|
1651
|
-
const readString = (key) => typeof selectedNode[key] === "string" ? selectedNode[key] : "";
|
|
1652
|
-
const tagName = readString("tagName") || "\u5143\u7D20";
|
|
1653
|
-
const cssPath = readString("cssPath");
|
|
1654
|
-
const noloLoc = readString("noloLoc");
|
|
1655
|
-
const textSnippet = readString("textSnippet");
|
|
1656
|
-
const outerHTMLSnippet = readString("outerHTMLSnippet");
|
|
1657
|
-
return [
|
|
1658
|
-
"\u5F53\u524D\u7F16\u8F91\u76EE\u6807\uFF1A\u672C\u5730\u5DE5\u4F5C\u533A\u91CC\u6B63\u5728\u9884\u89C8\u7684\u7F51\u9875\uFF08Local Preview\uFF09\u3002",
|
|
1659
|
-
`\u7528\u6237\u5728\u9884\u89C8\u4E2D\u9009\u4E2D\u4E86\u4E00\u4E2A\u5143\u7D20\uFF1A<${tagName}>\uFF0CCSS \u8DEF\u5F84\uFF1A${cssPath}${noloLoc ? `\uFF0C\u6E90\u7801\u4F4D\u7F6E\uFF1A${noloLoc}` : ""}\u3002`,
|
|
1660
|
-
`\u9009\u4E2D\u5143\u7D20\u7684 HTML \u7247\u6BB5\uFF08\u53EF\u80FD\u622A\u65AD\uFF09\uFF1A${outerHTMLSnippet}${textSnippet ? `\uFF1B\u53EF\u89C1\u6587\u672C\uFF1A${textSnippet}` : ""}\u3002`,
|
|
1661
|
-
"",
|
|
1662
|
-
"\u3010\u7ED9 AI \u7684\u64CD\u4F5C\u6307\u5357 / \u975E\u7528\u6237\u539F\u8BDD\u3011",
|
|
1663
|
-
"1. \u672C\u8F6E\u4FEE\u6539\u5FC5\u987B\u4EE5\u8FD9\u4E2A\u5143\u7D20\u4E3A\u4E2D\u5FC3\uFF1B\u5148\u5728\u672C\u5730\u5DE5\u4F5C\u533A\u6E90\u7801\u4E2D\u5B9A\u4F4D\u5230\u751F\u6210\u8FD9\u6BB5 HTML \u7684\u4EE3\u7801\uFF0C\u518D\u52A8\u624B\u3002",
|
|
1664
|
-
noloLoc ? "2. \u5DF2\u7ED9\u51FA\u6E90\u7801\u4F4D\u7F6E\uFF0C\u76F4\u63A5\u8BFB\u8BE5\u6587\u4EF6\u7684\u5BF9\u5E94\u884C\u8303\u56F4\u786E\u8BA4\uFF0C\u4E0D\u8981\u5168\u5C40\u641C\u7D22\u3002" : "2. \u6CA1\u6709\u6E90\u7801\u4F4D\u7F6E\u65F6\uFF0C\u7528 CSS \u8DEF\u5F84\u91CC\u7684\u7C7B\u540D\u3001\u53EF\u89C1\u6587\u672C\u6216 HTML \u7247\u6BB5\u641C\u7D22\u5DE5\u4F5C\u533A\u5B9A\u4F4D\uFF0C\u4E0D\u8981\u51ED\u731C\u6D4B\u6539\u52A8\u3002",
|
|
1665
|
-
"3. \u4FEE\u6539\u6536\u655B\u5728\u8BE5\u5143\u7D20\u53CA\u5176\u76F4\u63A5\u6837\u5F0F\u6765\u6E90\uFF08\u547D\u4E2D\u7684\u7EC4\u4EF6/\u7C7B/design token\uFF09\uFF1B\u4FDD\u6301\u672A\u547D\u4E2D\u7684\u6587\u4EF6\u4E0D\u53D8\u3002",
|
|
1666
|
-
"4. \u5982\u679C\u5B9A\u4F4D\u7ED3\u679C\u843D\u5728 node_modules \u6216\u6765\u81EA\u63A5\u53E3\u6570\u636E\uFF0C\u5148\u544A\u8BC9\u7528\u6237\u5B9E\u9645\u60C5\u51B5\uFF0C\u518D\u63D0\u51FA\u53EF\u884C\u7684\u6539\u6CD5\uFF0C\u4E0D\u8981\u786C\u6539\u3002",
|
|
1667
|
-
"5. \u5982\u679C\u6309 CSS \u8DEF\u5F84\u548C HTML \u7247\u6BB5\u627E\u4E0D\u5230\u5BF9\u5E94\u4F4D\u7F6E\uFF0C\u5148\u5411\u7528\u6237\u8BF4\u660E\u5E76\u8BF7\u5176\u91CD\u65B0\u9009\u62E9\u3002"
|
|
1668
|
-
].join("\n");
|
|
1669
|
-
}
|
|
1670
|
-
if (targetKind === "image" || targetKind === "file") {
|
|
1671
|
-
const editingTarget = runtimeOptions?.editingTarget;
|
|
1672
|
-
const metadata = editingTarget?.metadata;
|
|
1673
|
-
const title = editingTarget?.title ?? "(\u672A\u547D\u540D\u5BF9\u8C61)";
|
|
1674
|
-
const objectKey = editingTarget?.key ?? "(\u672A\u77E5 key)";
|
|
1675
|
-
const fileId = typeof metadata?.fileId === "string" ? metadata.fileId : null;
|
|
1676
|
-
const url = typeof metadata?.url === "string" ? metadata.url : null;
|
|
1677
|
-
const size = typeof metadata?.size === "number" ? metadata.size : null;
|
|
1678
|
-
return [
|
|
1679
|
-
`\u5F53\u524D\u7F16\u8F91\u76EE\u6807\uFF1A\u4E00\u4E2A${targetKind === "image" ? "\u56FE\u7247" : "\u6587\u4EF6"}\u5BF9\u8C61\uFF08Editing ${targetKind === "image" ? "Image" : "File"}\uFF09\u3002`,
|
|
1680
|
-
`- \u5BF9\u8C61 key: ${objectKey}`,
|
|
1681
|
-
`- \u6807\u9898: ${title}`,
|
|
1682
|
-
...fileId ? [`- fileId: ${fileId}`] : [],
|
|
1683
|
-
...url ? [`- \u8D44\u6E90\u5730\u5740: ${url}`] : [],
|
|
1684
|
-
...size !== null ? [`- \u6587\u4EF6\u5927\u5C0F: ${size} bytes`] : [],
|
|
1685
|
-
"",
|
|
1686
|
-
"\u3010\u7ED9 AI \u7684\u64CD\u4F5C\u6307\u5357 / \u975E\u7528\u6237\u539F\u8BDD\u3011",
|
|
1687
|
-
targetKind === "image" ? "\u5F53\u524D\u9636\u6BB5\u4F18\u5148\u5E2E\u52A9\u7528\u6237\u7406\u89E3\u56FE\u7247\u5185\u5BB9\u3001\u63D0\u70BC\u91CD\u70B9\u3001\u547D\u540D\u5F52\u7C7B\u548C\u4E0B\u4E00\u6B65\u5904\u7406\u5EFA\u8BAE\u3002\u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5B8C\u6210\u590D\u6742\u56FE\u7247\u7F16\u8F91\u3002" : "\u5F53\u524D\u9636\u6BB5\u4F18\u5148\u5E2E\u52A9\u7528\u6237\u7406\u89E3\u6587\u4EF6\u7528\u9014\u3001\u63D0\u53D6\u5904\u7406\u601D\u8DEF\u3001\u7ED9\u51FA\u6574\u7406\u5EFA\u8BAE\u548C\u4E0B\u4E00\u6B65\u64CD\u4F5C\u5EFA\u8BAE\u3002\u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5B8C\u6574\u89E3\u6790\u6587\u4EF6\u5185\u5BB9\u3002"
|
|
1688
|
-
].join("\n");
|
|
1689
|
-
}
|
|
1690
|
-
if (targetKind === "canvas_node") {
|
|
1691
|
-
return buildCanvasNodeEditingContextSummary(runtimeOptions);
|
|
1692
|
-
}
|
|
1693
|
-
return null;
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
// packages/ai/agent/appWorkingMemory.ts
|
|
1697
|
-
var APP_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
1698
|
-
"appList",
|
|
1699
|
-
"appRead",
|
|
1700
|
-
"appDeploy",
|
|
1701
|
-
"appPreflight",
|
|
1702
|
-
"appDelete"
|
|
1121
|
+
// packages/core/gptProTier.ts
|
|
1122
|
+
var GPT_PRO_REQUIRED_RECHARGE_AMOUNT = 199;
|
|
1123
|
+
var SUPPORTED_TIER_PROVIDERS = /* @__PURE__ */ new Set([
|
|
1124
|
+
"nolo",
|
|
1125
|
+
"openai",
|
|
1126
|
+
"deepinfra"
|
|
1703
1127
|
]);
|
|
1704
|
-
var
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
const lines = [
|
|
1718
|
-
"\u8FD9\u4E9B\u4FE1\u606F\u6765\u81EA\u5F53\u524D\u5BF9\u8BDD\u91CC\u6700\u8FD1\u7684 app \u5DE5\u5177\u8C03\u7528\uFF0C\u4E0D\u4F9D\u8D56\u53F3\u4FA7\u7F16\u8F91\u6001\u3002"
|
|
1719
|
-
];
|
|
1720
|
-
const latestDeployLike = recentRuns.find(
|
|
1721
|
-
(run) => ["appDeploy", "appRead", "appPreflight"].includes(run.toolName)
|
|
1722
|
-
);
|
|
1723
|
-
if (latestDeployLike) {
|
|
1724
|
-
const input = latestDeployLike.input ?? {};
|
|
1725
|
-
const parts = [
|
|
1726
|
-
`- \u6700\u8FD1\u4E00\u6B21\u5173\u952E app \u64CD\u4F5C: ${latestDeployLike.toolName}`,
|
|
1727
|
-
typeof input.appId === "string" ? `appId=${input.appId}` : null,
|
|
1728
|
-
typeof input.name === "string" ? `name=${input.name}` : null,
|
|
1729
|
-
typeof input.framework === "string" ? `framework=${input.framework}` : null
|
|
1730
|
-
].filter(Boolean);
|
|
1731
|
-
lines.push(parts.join("\uFF0C"));
|
|
1732
|
-
}
|
|
1733
|
-
const relatedMessages = recentRuns.map((run) => messageById.get(run.messageId)).filter((msg) => !!msg);
|
|
1734
|
-
const appListMessage = relatedMessages.find((msg) => msg.toolName === "appList");
|
|
1735
|
-
if (appListMessage) {
|
|
1736
|
-
const entries = parseAppListEntries(contentToText(appListMessage.content)).slice(0, 5);
|
|
1737
|
-
if (entries.length > 0) {
|
|
1738
|
-
lines.push("- \u6700\u8FD1\u4E00\u6B21 appList \u7ED3\u679C\uFF1A");
|
|
1739
|
-
lines.push(...entries.map((entry) => ` ${entry}`));
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
const latestReadMessage = relatedMessages.find((msg) => msg.toolName === "appRead");
|
|
1743
|
-
if (latestReadMessage) {
|
|
1744
|
-
const text = contentToText(latestReadMessage.content);
|
|
1745
|
-
const appId = text.match(/- appId:\s*(.+)/)?.[1]?.trim();
|
|
1746
|
-
const url = text.match(/- 访问地址:\s*(.+)/)?.[1]?.trim();
|
|
1747
|
-
if (appId || url) {
|
|
1748
|
-
lines.push(
|
|
1749
|
-
[
|
|
1750
|
-
"- \u6700\u8FD1\u4E00\u6B21 appRead \u771F\u503C:",
|
|
1751
|
-
appId ? `appId=${appId}` : null,
|
|
1752
|
-
url ? `url=${url}` : null
|
|
1753
|
-
].filter(Boolean).join("\uFF0C")
|
|
1754
|
-
);
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
const latestPreflightRun = recentRuns.find((run) => run.toolName === "appPreflight");
|
|
1758
|
-
if (latestPreflightRun) {
|
|
1759
|
-
lines.push(
|
|
1760
|
-
[
|
|
1761
|
-
"- \u6700\u8FD1\u4E00\u6B21 appPreflight:",
|
|
1762
|
-
latestPreflightRun.status === "failed" ? "\u5931\u8D25" : "\u5DF2\u6267\u884C",
|
|
1763
|
-
latestPreflightRun.outputSummary ? `\u6458\u8981=${latestPreflightRun.outputSummary}` : null
|
|
1764
|
-
].filter(Boolean).join("\uFF0C")
|
|
1765
|
-
);
|
|
1766
|
-
}
|
|
1767
|
-
const latestDeployMessage = relatedMessages.find((msg) => msg.toolName === "appDeploy");
|
|
1768
|
-
if (latestDeployMessage) {
|
|
1769
|
-
const text = contentToText(latestDeployMessage.content);
|
|
1770
|
-
const appId = text.match(/- appId:\s*(.+)/)?.[1]?.trim();
|
|
1771
|
-
const url = text.match(/- 访问地址:\s*(.+)/)?.[1]?.trim();
|
|
1772
|
-
if (appId || url) {
|
|
1773
|
-
lines.push(
|
|
1774
|
-
[
|
|
1775
|
-
"- \u6700\u8FD1\u4E00\u6B21 appDeploy \u7ED3\u679C:",
|
|
1776
|
-
appId ? `appId=${appId}` : null,
|
|
1777
|
-
url ? `url=${url}` : null
|
|
1778
|
-
].filter(Boolean).join("\uFF0C")
|
|
1779
|
-
);
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
lines.push(
|
|
1783
|
-
"- \u5982\u679C\u7528\u6237\u8BF4\u201C\u521A\u624D\u90A3\u4E2A app / \u90A3\u4E2A\u7F51\u7AD9\u201D\uFF0C\u4F18\u5148\u628A\u5B83\u7406\u89E3\u4E3A\u4E0A\u9762\u6700\u8FD1\u4E00\u6B21\u88AB\u8BFB\u53D6\u3001\u9884\u68C0\u6216\u90E8\u7F72\u7684\u5E94\u7528\uFF1B\u82E5\u4ECD\u6709\u6B67\u4E49\uFF0C\u518D\u7528 appList \u6216 appRead \u786E\u8BA4\u3002"
|
|
1784
|
-
);
|
|
1785
|
-
return lines.join("\n");
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
|
-
// packages/ai/agent/streamAgentChatTurnUtils.ts
|
|
1789
|
-
var BROWSER_UNAVAILABLE_CORE_TOOLS = {
|
|
1790
|
-
createAgentAutomation: true,
|
|
1791
|
-
notifyUser: true
|
|
1792
|
-
};
|
|
1793
|
-
var getRuntimeCoreTools = () => {
|
|
1794
|
-
if (typeof window === "undefined") {
|
|
1795
|
-
return [...TOOL_PACKS.CORE];
|
|
1796
|
-
}
|
|
1797
|
-
return TOOL_PACKS.CORE.filter(
|
|
1798
|
-
(toolName) => !BROWSER_UNAVAILABLE_CORE_TOOLS[toolName]
|
|
1799
|
-
);
|
|
1800
|
-
};
|
|
1801
|
-
var isInlineVisualArtifactAgent = (agentConfig) => {
|
|
1802
|
-
const tags = Array.isArray(agentConfig.tags) ? agentConfig.tags : [];
|
|
1803
|
-
return tags.some(
|
|
1804
|
-
(tag) => typeof tag === "string" && ["inline-artifact", "streaming-ui"].includes(tag)
|
|
1805
|
-
);
|
|
1806
|
-
};
|
|
1807
|
-
var estimateTokensOfMessage = (msg) => {
|
|
1808
|
-
let content = "";
|
|
1809
|
-
if (typeof msg.content === "string") {
|
|
1810
|
-
content = msg.content;
|
|
1811
|
-
} else if (Array.isArray(msg.content)) {
|
|
1812
|
-
content = msg.content.map((p) => {
|
|
1813
|
-
if (p.type === "text") return p.text || "";
|
|
1814
|
-
if (p.type === "image_url") return "[image]";
|
|
1815
|
-
return "[non-text]";
|
|
1816
|
-
}).join("");
|
|
1817
|
-
} else if (msg.content && typeof msg.content === "object") {
|
|
1818
|
-
content = JSON.stringify(msg.content);
|
|
1819
|
-
}
|
|
1820
|
-
let extraTokens = 0;
|
|
1821
|
-
if (Array.isArray(msg.tool_calls)) {
|
|
1822
|
-
const toolsStr = JSON.stringify(msg.tool_calls);
|
|
1823
|
-
extraTokens = estimateTokenCount(toolsStr);
|
|
1824
|
-
}
|
|
1825
|
-
return estimateTokenCount(content) + extraTokens;
|
|
1826
|
-
};
|
|
1827
|
-
var classifyConversationLoad = (messages) => {
|
|
1828
|
-
const N = 20;
|
|
1829
|
-
if (!Array.isArray(messages) || messages.length === 0) return "light";
|
|
1830
|
-
const tail = messages.slice(-N);
|
|
1831
|
-
const tokenSamples = tail.map(estimateTokensOfMessage);
|
|
1832
|
-
if (tokenSamples.length === 0) return "light";
|
|
1833
|
-
const sum = tokenSamples.reduce((acc, v) => acc + v, 0);
|
|
1834
|
-
const avg = sum / tokenSamples.length;
|
|
1835
|
-
const sorted = [...tokenSamples].sort((a, b) => a - b);
|
|
1836
|
-
const p95 = sorted[Math.floor((sorted.length - 1) * 0.95)];
|
|
1837
|
-
if (p95 < 200 && avg < 120) {
|
|
1838
|
-
return "light";
|
|
1839
|
-
}
|
|
1840
|
-
if (p95 > 2e3 || avg > 1200) {
|
|
1841
|
-
return "heavy";
|
|
1842
|
-
}
|
|
1843
|
-
return "medium";
|
|
1844
|
-
};
|
|
1845
|
-
var compressOldToolResults = (messages) => {
|
|
1846
|
-
return messages.map((msg) => {
|
|
1847
|
-
if (msg.role !== "tool") return msg;
|
|
1848
|
-
const content = typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content);
|
|
1849
|
-
const projected = projectToolMessageContent({
|
|
1850
|
-
content,
|
|
1851
|
-
toolName: msg.name
|
|
1852
|
-
});
|
|
1853
|
-
if (projected === content) return msg;
|
|
1854
|
-
return { ...msg, content: projected };
|
|
1855
|
-
});
|
|
1856
|
-
};
|
|
1857
|
-
var trimMessagesWithSummary = (messages, contextWindow, summaryTokenCount) => {
|
|
1858
|
-
const recentLoad = classifyConversationLoad(messages);
|
|
1859
|
-
const { rawMessageBudget, minTailTokens } = planContextUsage({
|
|
1860
|
-
contextWindow,
|
|
1861
|
-
summaryTokens: summaryTokenCount,
|
|
1862
|
-
recentLoad
|
|
1863
|
-
});
|
|
1864
|
-
if (!Array.isArray(messages) || messages.length === 0) return messages;
|
|
1865
|
-
let totalTokens = 0;
|
|
1866
|
-
let keepCount = 0;
|
|
1867
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1868
|
-
const t = estimateTokensOfMessage(messages[i]);
|
|
1869
|
-
if (totalTokens + t > rawMessageBudget) break;
|
|
1870
|
-
totalTokens += t;
|
|
1871
|
-
keepCount++;
|
|
1872
|
-
}
|
|
1873
|
-
if (keepCount >= messages.length) {
|
|
1874
|
-
return messages;
|
|
1875
|
-
}
|
|
1876
|
-
if (totalTokens < minTailTokens) {
|
|
1877
|
-
const maxBudgetWithSlack = rawMessageBudget * 1.2;
|
|
1878
|
-
for (let i = messages.length - 1 - keepCount; i >= 0; i--) {
|
|
1879
|
-
const t = estimateTokensOfMessage(messages[i]);
|
|
1880
|
-
if (totalTokens + t > maxBudgetWithSlack) break;
|
|
1881
|
-
totalTokens += t;
|
|
1882
|
-
keepCount++;
|
|
1883
|
-
if (totalTokens >= minTailTokens) break;
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
if (keepCount === 0 && messages.length > 0) {
|
|
1887
|
-
keepCount = Math.min(2, messages.length);
|
|
1888
|
-
}
|
|
1889
|
-
let cutIndex = messages.length - keepCount;
|
|
1890
|
-
if (cutIndex < 0) cutIndex = 0;
|
|
1891
|
-
while (cutIndex > 0 && messages[cutIndex]?.role === "tool") {
|
|
1892
|
-
cutIndex--;
|
|
1893
|
-
}
|
|
1894
|
-
return messages.slice(cutIndex);
|
|
1895
|
-
};
|
|
1896
|
-
var createDbSliceTurnContextSource = (dispatch) => ({
|
|
1897
|
-
readRecord: async (dbKey) => {
|
|
1898
|
-
const result = await dispatch(read({ dbKey })).unwrap();
|
|
1899
|
-
return result ?? null;
|
|
1900
|
-
}
|
|
1901
|
-
});
|
|
1902
|
-
var joinMapValues = (map) => Array.from(map.values()).join("");
|
|
1903
|
-
var formatCurrentInputContext = (pendingFiles, currentInputMap) => {
|
|
1904
|
-
if (pendingFiles.length === 0 || currentInputMap.size === 0) {
|
|
1905
|
-
return joinMapValues(currentInputMap);
|
|
1906
|
-
}
|
|
1907
|
-
const relevantPendingFiles = pendingFiles.filter((file) => {
|
|
1908
|
-
const key = file.sourceDialogKey || file.dialogKey || file.pageKey;
|
|
1909
|
-
return key && currentInputMap.has(key);
|
|
1910
|
-
});
|
|
1911
|
-
if (relevantPendingFiles.length === 0) {
|
|
1912
|
-
return joinMapValues(currentInputMap);
|
|
1913
|
-
}
|
|
1914
|
-
const filesByGroup = /* @__PURE__ */ new Map();
|
|
1915
|
-
for (const file of relevantPendingFiles) {
|
|
1916
|
-
const groupKey = file.groupId || file.id;
|
|
1917
|
-
const group = filesByGroup.get(groupKey);
|
|
1918
|
-
if (group) {
|
|
1919
|
-
group.push(file);
|
|
1920
|
-
} else {
|
|
1921
|
-
filesByGroup.set(groupKey, [file]);
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
let sourceCounter = 1;
|
|
1925
|
-
let output = "";
|
|
1926
|
-
filesByGroup.forEach((filesInGroup) => {
|
|
1927
|
-
const isGroup = filesInGroup.length > 1;
|
|
1928
|
-
const sourceName = isGroup ? filesInGroup[0].name.split(" (")[0] : filesInGroup[0].name;
|
|
1929
|
-
output += `--- Source ${sourceCounter}: "${sourceName}" ---
|
|
1930
|
-
`;
|
|
1931
|
-
filesInGroup.forEach((file) => {
|
|
1932
|
-
const key = file.sourceDialogKey || file.dialogKey || file.pageKey;
|
|
1933
|
-
if (!key) return;
|
|
1934
|
-
const content = currentInputMap.get(key);
|
|
1935
|
-
if (!content) return;
|
|
1936
|
-
if (isGroup) {
|
|
1937
|
-
output += `### Document: "${file.name}"
|
|
1938
|
-
${content}
|
|
1939
|
-
`;
|
|
1940
|
-
} else {
|
|
1941
|
-
output += `${content}
|
|
1942
|
-
`;
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
output += `--- End of Source ${sourceCounter} ---
|
|
1946
|
-
|
|
1947
|
-
`;
|
|
1948
|
-
sourceCounter++;
|
|
1949
|
-
});
|
|
1950
|
-
return output;
|
|
1951
|
-
};
|
|
1952
|
-
var validateAccessAndBalance = (agentConfig, state) => {
|
|
1953
|
-
const userBalance = selectIdentityUserBalance(state);
|
|
1954
|
-
const currentUserId = selectIdentityUserId(state);
|
|
1955
|
-
const isCustomApi = agentConfig.apiSource === "custom";
|
|
1956
|
-
const isCliApi = agentConfig.apiSource === "cli";
|
|
1957
|
-
const isDeviceLocalOwner = agentConfig.userId === "local" && !currentUserId;
|
|
1958
|
-
const isOwner = isDeviceLocalOwner || Boolean(currentUserId) && agentConfig.userId === currentUserId;
|
|
1959
|
-
if (!isOwner) {
|
|
1960
|
-
const hasWhitelist = Array.isArray(agentConfig.whitelist) && agentConfig.whitelist.length > 0;
|
|
1961
|
-
if (hasWhitelist) {
|
|
1962
|
-
const isUserInWhitelist = !!currentUserId && agentConfig.whitelist?.includes(currentUserId);
|
|
1963
|
-
if (!isUserInWhitelist) {
|
|
1964
|
-
return "\u60A8\u4E0D\u5728\u8BE5\u5E94\u7528\u7684\u767D\u540D\u5355\u4E2D\uFF0C\u65E0\u6CD5\u4F7F\u7528\u3002";
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
if (isCustomApi || isCliApi) {
|
|
1969
|
-
return null;
|
|
1970
|
-
}
|
|
1971
|
-
const SUBSCRIPTION_OAUTH_REFS = /* @__PURE__ */ new Set([
|
|
1972
|
-
"cursor",
|
|
1973
|
-
"chatgpt",
|
|
1974
|
-
"xai",
|
|
1975
|
-
"antigravity",
|
|
1976
|
-
"claude"
|
|
1977
|
-
]);
|
|
1978
|
-
if (SUBSCRIPTION_OAUTH_REFS.has((agentConfig.apiKeyRef ?? "").trim().toLowerCase())) {
|
|
1979
|
-
return null;
|
|
1128
|
+
var CLAUDE_PREMIUM_RE = /^(?:anthropic\/)?claude-(opus|fable)(?:-\d+(?:[.-]\d+)*(?:-[a-z0-9]+)*)?$/i;
|
|
1129
|
+
var GPT_PRO_RE = /^(?:openai\/)?gpt-[a-z0-9.-]+-pro(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
|
|
1130
|
+
var GPT_SOL_RE = /^(?:openai\/)?gpt-\d+(?:\.\d+)*-sol(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
|
|
1131
|
+
var KIMI_K3_MODELS = /* @__PURE__ */ new Set([
|
|
1132
|
+
"kimi-k3",
|
|
1133
|
+
"moonshotai/kimi-k3"
|
|
1134
|
+
]);
|
|
1135
|
+
function classifyPremiumModel(model) {
|
|
1136
|
+
const normalizedModel = asTrimmedLowercaseString(model);
|
|
1137
|
+
if (!normalizedModel) return void 0;
|
|
1138
|
+
const claudeMatch = CLAUDE_PREMIUM_RE.exec(normalizedModel);
|
|
1139
|
+
if (claudeMatch) {
|
|
1140
|
+
return claudeMatch[1].toLowerCase() === "opus" ? "claude-opus" : "claude-fable";
|
|
1980
1141
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
return null;
|
|
1142
|
+
if (GPT_PRO_RE.test(normalizedModel)) {
|
|
1143
|
+
return "gpt-pro";
|
|
1984
1144
|
}
|
|
1985
|
-
if (
|
|
1986
|
-
|
|
1987
|
-
getSessionSnapshotForState(state)?.activeAccountId
|
|
1988
|
-
);
|
|
1989
|
-
if (!currentUserId || !hasSessionUser) {
|
|
1990
|
-
return "\u8BF7\u767B\u5F55\u540E\u4F7F\u7528\u5E73\u53F0\u6A21\u578B\uFF0C\u6216\u6539\u7528\u672C\u5730\u81EA\u5B9A\u4E49/API/CLI Agent\u3002";
|
|
1991
|
-
}
|
|
1992
|
-
return "\u6B63\u5728\u83B7\u53D6\u7528\u6237\u4F59\u989D\uFF0C\u8BF7\u7A0D\u5019...";
|
|
1145
|
+
if (GPT_SOL_RE.test(normalizedModel)) {
|
|
1146
|
+
return "gpt-sol";
|
|
1993
1147
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
return "\u65E0\u6CD5\u83B7\u53D6\u6A21\u578B\u5B9A\u4EF7\u4FE1\u606F\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
|
|
1148
|
+
if (KIMI_K3_MODELS.has(normalizedModel)) {
|
|
1149
|
+
return "kimi-k3";
|
|
1997
1150
|
}
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1151
|
+
return void 0;
|
|
1152
|
+
}
|
|
1153
|
+
function isGptProModel(provider, model) {
|
|
1154
|
+
const normalizedProvider = asTrimmedLowercaseString(provider);
|
|
1155
|
+
if (!SUPPORTED_TIER_PROVIDERS.has(normalizedProvider)) {
|
|
1156
|
+
return false;
|
|
2002
1157
|
}
|
|
2003
|
-
return
|
|
2004
|
-
}
|
|
2005
|
-
var
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
if (!token || !currentServer || !agentKey) return null;
|
|
2010
|
-
const baseUrl = resolveToolBaseUrl(currentServer);
|
|
2011
|
-
if (!baseUrl) return null;
|
|
2012
|
-
const inputText = typeof userInput === "string" ? userInput : JSON.stringify(userInput ?? "");
|
|
2013
|
-
const spaceId = asOptionalTrimmedString(dialogConfig?.spaceId) ?? (getViewMode() === "all" ? void 0 : asOptionalTrimmedString(getCurrentSpaceIdRaw()));
|
|
2014
|
-
try {
|
|
2015
|
-
const response = await fetch(`${baseUrl}/api/memory/query`, {
|
|
2016
|
-
method: "POST",
|
|
2017
|
-
headers: {
|
|
2018
|
-
"Content-Type": "application/json",
|
|
2019
|
-
Authorization: `Bearer ${token}`
|
|
2020
|
-
},
|
|
2021
|
-
body: JSON.stringify({
|
|
2022
|
-
agentKey,
|
|
2023
|
-
userInput: inputText,
|
|
2024
|
-
...spaceId ? { spaceId } : {}
|
|
2025
|
-
})
|
|
2026
|
-
});
|
|
2027
|
-
if (!response.ok) return null;
|
|
2028
|
-
const payload = await response.json().catch(() => null);
|
|
2029
|
-
return asOptionalTrimmedString(payload?.promptBlock) ?? null;
|
|
2030
|
-
} catch {
|
|
2031
|
-
return null;
|
|
1158
|
+
return classifyPremiumModel(model) !== void 0;
|
|
1159
|
+
}
|
|
1160
|
+
var GPT_PRO_BLOCKED_MESSAGE = `GPT Pro / Kimi K3 \u7B49\u9AD8\u7EA7\u6A21\u578B\u9700\u8981\u5148\u5F00\u901A ${GPT_PRO_REQUIRED_RECHARGE_AMOUNT} \u79EF\u5206\u6863\u4F4D\u3002`;
|
|
1161
|
+
function shouldBlockForGptPro(input) {
|
|
1162
|
+
if (input?.premium !== true || input?.platformPaid !== true) {
|
|
1163
|
+
return { blocked: false };
|
|
2032
1164
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
const keySets = await getFullChatContextKeys(
|
|
2036
|
-
state,
|
|
2037
|
-
dispatch,
|
|
2038
|
-
agentConfig,
|
|
2039
|
-
"",
|
|
2040
|
-
// 静态上下文不需要 userInput
|
|
2041
|
-
void 0
|
|
2042
|
-
// 静态上下文不需要 dialogConfig
|
|
2043
|
-
);
|
|
2044
|
-
const finalKeys = deduplicateContextKeys(keySets);
|
|
2045
|
-
const fetchReferences = (keys) => fetchReferenceContents(keys, dispatch, {
|
|
2046
|
-
format: "simplified_markdown",
|
|
2047
|
-
inlineMentionMeta: true,
|
|
2048
|
-
preloaded: referenceContentCache
|
|
2049
|
-
});
|
|
2050
|
-
const [botInstructionsMap, botKnowledgeMap] = await Promise.all([
|
|
2051
|
-
fetchReferences(finalKeys.botInstructionsContext),
|
|
2052
|
-
fetchReferences(finalKeys.botKnowledgeContext)
|
|
2053
|
-
]);
|
|
2054
|
-
const globalPrompt = selectGlobalPrompt(state);
|
|
2055
|
-
const userTonePreset = selectUserTonePreset(state);
|
|
2056
|
-
const knowledgeCaptureLevel = selectKnowledgeCaptureLevel(state);
|
|
2057
|
-
const spaceContextLevel = selectSpaceContextLevel(state);
|
|
2058
|
-
const userRecentLimit = selectAiRecentContentLimit(state);
|
|
2059
|
-
const contextWindow = getModelContextWindow(agentConfig.model) || 128e3;
|
|
2060
|
-
const preloadPlan = resolveSpaceContextPreloadPlan(spaceContextLevel);
|
|
2061
|
-
const dynamicLimit = Math.floor(contextWindow * preloadPlan.preloadBudgetRatio / 150);
|
|
2062
|
-
const recentLimit = preloadPlan.includeRecentContent ? Math.max(3, Math.min(userRecentLimit, Math.max(3, dynamicLimit))) : 0;
|
|
2063
|
-
const turnContextSource = createDbSliceTurnContextSource(dispatch);
|
|
2064
|
-
let spaceContext = null;
|
|
2065
|
-
if (spaceContextLevel > 1) {
|
|
2066
|
-
const spaceLayer = await buildSpaceContextLayer({
|
|
2067
|
-
source: turnContextSource,
|
|
2068
|
-
spaceId: dialogConfig?.spaceId,
|
|
2069
|
-
recentContentLimit: recentLimit
|
|
2070
|
-
});
|
|
2071
|
-
spaceContext = spaceLayer ? spaceLayer.content.trim() : null;
|
|
1165
|
+
if (asTrimmedLowercaseString(input.gptProStatus) === "active") {
|
|
1166
|
+
return { blocked: false };
|
|
2072
1167
|
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
const linkedSection = await buildLinkedSpacesSection({
|
|
2076
|
-
source: turnContextSource,
|
|
2077
|
-
linkedSpaceIds
|
|
2078
|
-
});
|
|
2079
|
-
if (linkedSection) {
|
|
2080
|
-
spaceContext = (spaceContext ?? "") + `
|
|
1168
|
+
return { blocked: true, message: GPT_PRO_BLOCKED_MESSAGE };
|
|
1169
|
+
}
|
|
2081
1170
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
spaceContext,
|
|
2090
|
-
userGlobalPrompt: globalPrompt,
|
|
2091
|
-
userPolicyContext: [
|
|
2092
|
-
buildStaticUserPolicyContext({
|
|
2093
|
-
agentConfig,
|
|
2094
|
-
settingsRecord: {
|
|
2095
|
-
userTonePreset,
|
|
2096
|
-
knowledgeCaptureLevel,
|
|
2097
|
-
spaceContextLevel,
|
|
2098
|
-
enableReadCurrentSpace: spaceContextLevel > 1
|
|
2099
|
-
}
|
|
2100
|
-
}),
|
|
2101
|
-
dialogPolicyContext
|
|
2102
|
-
].filter(Boolean).join("\n")
|
|
2103
|
-
};
|
|
2104
|
-
};
|
|
2105
|
-
var buildDynamicContexts = async (state, dispatch, agentConfig, userInput, runtimeOptions, referenceContentCache, dialogKey) => {
|
|
2106
|
-
let dialogSummary = null;
|
|
2107
|
-
let dialogConfig;
|
|
2108
|
-
if (dialogKey) {
|
|
2109
|
-
dialogConfig = selectById(state, dialogKey);
|
|
2110
|
-
if (dialogConfig?.summary) {
|
|
2111
|
-
dialogSummary = dialogConfig.summary;
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
const keySets = await getFullChatContextKeys(
|
|
2115
|
-
state,
|
|
2116
|
-
dispatch,
|
|
2117
|
-
agentConfig,
|
|
2118
|
-
userInput,
|
|
2119
|
-
dialogConfig
|
|
2120
|
-
);
|
|
2121
|
-
const finalKeys = deduplicateContextKeys(keySets);
|
|
2122
|
-
const fetchReferences = (keys) => fetchReferenceContents(keys, dispatch, {
|
|
2123
|
-
format: "simplified_markdown",
|
|
2124
|
-
inlineMentionMeta: true,
|
|
2125
|
-
preloaded: referenceContentCache
|
|
2126
|
-
});
|
|
2127
|
-
const [currentInputMap, historyMap] = await Promise.all([
|
|
2128
|
-
fetchReferences(finalKeys.currentInputContext),
|
|
2129
|
-
fetchReferences(finalKeys.historyContext)
|
|
2130
|
-
]);
|
|
2131
|
-
const pendingFiles = selectPendingFiles(state);
|
|
2132
|
-
const formattedCurrentInputContext = formatCurrentInputContext(
|
|
2133
|
-
pendingFiles,
|
|
2134
|
-
currentInputMap
|
|
2135
|
-
);
|
|
2136
|
-
const dialogId = dialogConfig?.id ?? null;
|
|
2137
|
-
const currentDialogMessages = selectAllMsgs(state, dialogId);
|
|
2138
|
-
const currentDialogMessageIds = new Set(currentDialogMessages.map((msg) => msg.id));
|
|
2139
|
-
const currentDialogToolRuns = getAllToolRuns().filter(
|
|
2140
|
-
(run) => currentDialogMessageIds.has(run.messageId)
|
|
2141
|
-
);
|
|
2142
|
-
const editingContext = buildEditingContextSummary(state, runtimeOptions);
|
|
2143
|
-
const appWorkingMemory = buildRecentAppToolMemory(
|
|
2144
|
-
currentDialogMessages,
|
|
2145
|
-
currentDialogToolRuns
|
|
2146
|
-
);
|
|
2147
|
-
const memoryOverlay = await fetchMemoryOverlayContext(
|
|
2148
|
-
state,
|
|
2149
|
-
agentConfig,
|
|
2150
|
-
userInput,
|
|
2151
|
-
dialogConfig
|
|
2152
|
-
);
|
|
2153
|
-
return {
|
|
2154
|
-
currentInputContext: formattedCurrentInputContext.trim() || null,
|
|
2155
|
-
historyContext: joinMapValues(historyMap),
|
|
2156
|
-
editingContext,
|
|
2157
|
-
appWorkingMemory,
|
|
2158
|
-
memoryOverlay,
|
|
2159
|
-
dialogSummary,
|
|
2160
|
-
referenceKeys: dialogConfig?.referenceKeys || []
|
|
2161
|
-
};
|
|
2162
|
-
};
|
|
2163
|
-
var mergeContexts = (staticCtx, dynamicCtx) => ({
|
|
2164
|
-
botInstructionsContext: staticCtx.botInstructionsContext || void 0,
|
|
2165
|
-
botKnowledgeContext: staticCtx.botKnowledgeContext || void 0,
|
|
2166
|
-
spaceContext: staticCtx.spaceContext || void 0,
|
|
2167
|
-
userGlobalPrompt: staticCtx.userGlobalPrompt || void 0,
|
|
2168
|
-
userPolicyContext: staticCtx.userPolicyContext || void 0,
|
|
2169
|
-
currentInputContext: dynamicCtx.currentInputContext,
|
|
2170
|
-
historyContext: dynamicCtx.historyContext || void 0,
|
|
2171
|
-
editingContext: dynamicCtx.editingContext,
|
|
2172
|
-
appWorkingMemory: dynamicCtx.appWorkingMemory,
|
|
2173
|
-
memoryOverlay: dynamicCtx.memoryOverlay,
|
|
2174
|
-
dialogSummary: dynamicCtx.dialogSummary,
|
|
2175
|
-
referenceKeys: dynamicCtx.referenceKeys
|
|
1171
|
+
// packages/ai/agent/platformPaidCall.ts
|
|
1172
|
+
var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
|
|
1173
|
+
var hasOAuthCredentialShape = (agentConfig) => isOAuthApiKeyRef(agentConfig?.apiKeyRef) || isAntigravityOAuthAgent({
|
|
1174
|
+
key: "platform-paid-call-probe",
|
|
1175
|
+
apiKeyRef: agentConfig?.apiKeyRef ?? void 0,
|
|
1176
|
+
provider: agentConfig?.provider ?? void 0,
|
|
1177
|
+
customProviderUrl: agentConfig?.customProviderUrl ?? void 0
|
|
2176
1178
|
});
|
|
2177
|
-
|
|
2178
|
-
const
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
agentConfig.
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
const recommendedSkillHints = [
|
|
2197
|
-
.../* @__PURE__ */ new Set([
|
|
2198
|
-
...asNonEmptyStringArray(agentConfig.recommendedSkillHints),
|
|
2199
|
-
...resolveAgentRecommendedSkillNames(agentConfig)
|
|
2200
|
-
])
|
|
2201
|
-
];
|
|
2202
|
-
const skillPromptPatches = [
|
|
2203
|
-
.../* @__PURE__ */ new Set([
|
|
2204
|
-
...asNonEmptyStringArray(agentConfig.skillPromptPatches),
|
|
2205
|
-
// 能力包的 promptPatch(方法论文档)与 skill reference 的 patch 走同一条
|
|
2206
|
-
// 注入链(buildSkillGuidanceBlock → buildSkillGuidancePromptBlock),
|
|
2207
|
-
// 让「工具 + 配套纪律」作为一个能力包整体注入 system prompt。
|
|
2208
|
-
...expandEnabledPackPromptPatches(effectiveEnabledPacks)
|
|
2209
|
-
])
|
|
2210
|
-
];
|
|
2211
|
-
const webPadded = applyDefaultWebToolPacks({
|
|
2212
|
-
toolNames: baseTools,
|
|
2213
|
-
skipWeb: isInlineVisualArtifactAgent(agentConfig)
|
|
2214
|
-
});
|
|
2215
|
-
const enhancedTools = /* @__PURE__ */ new Set([
|
|
2216
|
-
...webPadded,
|
|
2217
|
-
...isInlineVisualArtifactAgent(agentConfig) ? [] : getRuntimeCoreTools(),
|
|
2218
|
-
...isInlineVisualArtifactAgent(agentConfig) ? [] : requiredSkillTools,
|
|
2219
|
-
...isInlineVisualArtifactAgent(agentConfig) ? [] : canonicalizeToolNames(referencedTools),
|
|
2220
|
-
...isInlineVisualArtifactAgent(agentConfig) ? [] : canonicalizeToolNames(mentionedTools)
|
|
2221
|
-
]);
|
|
2222
|
-
const extraTools = isInlineVisualArtifactAgent(agentConfig) ? [] : canonicalizeToolNames(runtimeOptions?.extraTools ?? []);
|
|
2223
|
-
for (const t of extraTools) {
|
|
2224
|
-
enhancedTools.add(t);
|
|
2225
|
-
}
|
|
2226
|
-
if (!isInlineVisualArtifactAgent(agentConfig)) {
|
|
2227
|
-
const viewMode = state ? getViewMode() : "categories";
|
|
2228
|
-
if (viewMode === "all") {
|
|
2229
|
-
enhancedTools.delete("search_workspace");
|
|
2230
|
-
if (!recommendedSkillHints.includes("search-all-spaces")) {
|
|
2231
|
-
recommendedSkillHints.push("search-all-spaces");
|
|
2232
|
-
}
|
|
2233
|
-
} else {
|
|
2234
|
-
enhancedTools.add("search_workspace");
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
const systemBuiltinSkills = state?.settings?.systemBuiltinSkills;
|
|
2238
|
-
const mountedTools = isInlineVisualArtifactAgent(agentConfig) ? Array.from(enhancedTools) : addDefaultSystemCapabilityTools(Array.from(enhancedTools));
|
|
2239
|
-
const filteredTools = applySystemBuiltinSkillFilter(
|
|
2240
|
-
mountedTools,
|
|
2241
|
-
systemBuiltinSkills
|
|
2242
|
-
);
|
|
2243
|
-
return {
|
|
2244
|
-
...agentConfig,
|
|
2245
|
-
tools: applyDisabledTools(
|
|
2246
|
-
prioritizeToolNames(
|
|
2247
|
-
filteredTools,
|
|
2248
|
-
recommendedSkillTools
|
|
2249
|
-
),
|
|
2250
|
-
agentConfig?.disabledTools
|
|
1179
|
+
function isPlatformPaidAgentCall(probe) {
|
|
1180
|
+
const agentConfig = probe?.agentConfig ?? {};
|
|
1181
|
+
const authKind = asTrimmed(probe?.authKind);
|
|
1182
|
+
if (authKind) return authKind === "platform-key";
|
|
1183
|
+
if (asTrimmed(agentConfig.apiSource) === "cli") return false;
|
|
1184
|
+
return resolveBillingSource({
|
|
1185
|
+
local: agentConfig.local,
|
|
1186
|
+
isLocal: agentConfig.isLocal,
|
|
1187
|
+
cliProvider: agentConfig.cliProvider,
|
|
1188
|
+
apiSource: agentConfig.apiSource,
|
|
1189
|
+
provider: agentConfig.provider,
|
|
1190
|
+
billingSource: agentConfig.billingSource,
|
|
1191
|
+
// 形态证明而非记录自声明(见文件头):自声明 isOAuth 不足以证明 OAuth 通道归属。
|
|
1192
|
+
isOAuth: hasOAuthCredentialShape(agentConfig),
|
|
1193
|
+
apiKeyRef: agentConfig.apiKeyRef,
|
|
1194
|
+
customProviderUrl: agentConfig.customProviderUrl,
|
|
1195
|
+
isOwned: isOwnedAgentRecord(
|
|
1196
|
+
agentConfig,
|
|
1197
|
+
asTrimmed(probe?.callerUserId) || void 0
|
|
2251
1198
|
),
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
};
|
|
2257
|
-
var applyImageConfigRuntimeOverride = (agentConfig, runtimeOptions) => {
|
|
2258
|
-
const override = runtimeOptions?.imageConfigOverride;
|
|
2259
|
-
if (!override) {
|
|
2260
|
-
return agentConfig;
|
|
2261
|
-
}
|
|
2262
|
-
const baseImageConfig = agentConfig.imageConfig ?? {};
|
|
2263
|
-
return {
|
|
2264
|
-
...agentConfig,
|
|
2265
|
-
...override.imageModelOverride ? { model: override.imageModelOverride } : {},
|
|
2266
|
-
imageConfig: {
|
|
2267
|
-
...baseImageConfig,
|
|
2268
|
-
...override
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
};
|
|
2272
|
-
var formatImageWaitHint = (range) => {
|
|
2273
|
-
if (!range || typeof range.min !== "number" || typeof range.max !== "number") {
|
|
2274
|
-
return void 0;
|
|
2275
|
-
}
|
|
2276
|
-
return `\u901A\u5E38\u9700\u8981 ${range.min}-${range.max} \u79D2`;
|
|
2277
|
-
};
|
|
2278
|
-
var resolveAgentImageModelIdentity = (agentConfig) => {
|
|
2279
|
-
let providerKey = (agentConfig.provider || "").toLowerCase();
|
|
2280
|
-
let modelName = agentConfig.model ?? "";
|
|
2281
|
-
if (modelName.includes("/")) {
|
|
2282
|
-
const slash = modelName.indexOf("/");
|
|
2283
|
-
if (!providerKey) providerKey = modelName.slice(0, slash);
|
|
2284
|
-
modelName = modelName.slice(slash + 1);
|
|
2285
|
-
}
|
|
2286
|
-
try {
|
|
2287
|
-
return {
|
|
2288
|
-
providerKey,
|
|
2289
|
-
modelConfig: getModelConfig(providerKey, modelName)
|
|
2290
|
-
};
|
|
2291
|
-
} catch {
|
|
2292
|
-
try {
|
|
2293
|
-
const detected = getProviderByModelName(modelName);
|
|
2294
|
-
if (!detected) {
|
|
2295
|
-
return { providerKey, modelConfig: null };
|
|
2296
|
-
}
|
|
2297
|
-
return {
|
|
2298
|
-
providerKey: detected,
|
|
2299
|
-
modelConfig: getModelConfig(detected, modelName)
|
|
2300
|
-
};
|
|
2301
|
-
} catch {
|
|
2302
|
-
return { providerKey, modelConfig: null };
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
};
|
|
2306
|
-
var EXPLICIT_IMAGE_GENERATION_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
2307
|
-
"openAIGptImage",
|
|
2308
|
-
"openAIGptImageGenerate",
|
|
2309
|
-
"openAIGptImageEdit",
|
|
2310
|
-
"chatgptWebImageGenerate",
|
|
2311
|
-
"geminiFlashImage",
|
|
2312
|
-
"geminiProImagePreview"
|
|
2313
|
-
]);
|
|
2314
|
-
var agentUsesExplicitImageGenerationTool = (agentConfig) => {
|
|
2315
|
-
const toolNames = Array.isArray(agentConfig.tools) ? agentConfig.tools : Array.isArray(agentConfig.toolNames) ? agentConfig.toolNames : [];
|
|
2316
|
-
return toolNames.some(
|
|
2317
|
-
(name) => typeof name === "string" && EXPLICIT_IMAGE_GENERATION_TOOL_NAMES.has(name.trim())
|
|
2318
|
-
);
|
|
2319
|
-
};
|
|
2320
|
-
var resolveImageGenerationStreamingState = (agentConfig, args) => {
|
|
2321
|
-
const { modelConfig } = resolveAgentImageModelIdentity(agentConfig);
|
|
2322
|
-
const hasImageOutput = !!(modelConfig?.hasImageOutput ?? modelConfig?.supportsImageOutput) || agentConfig.imageConfig?.enabled === true || agentUsesExplicitImageGenerationTool(agentConfig);
|
|
2323
|
-
if (!hasImageOutput) {
|
|
2324
|
-
return void 0;
|
|
2325
|
-
}
|
|
2326
|
-
const currentProfile = modelConfig?.imageGenerationProfiles?.find(
|
|
2327
|
-
(profile) => profile.imageModel === modelConfig.name
|
|
2328
|
-
);
|
|
2329
|
-
const usesWebImageTool = agentUsesExplicitImageGenerationTool(agentConfig) && (Array.isArray(agentConfig.tools) ? agentConfig.tools : []).includes("chatgptWebImageGenerate");
|
|
2330
|
-
return {
|
|
2331
|
-
kind: "image_generation",
|
|
2332
|
-
stage: args?.stage ?? args?.previous?.stage ?? "submitted",
|
|
2333
|
-
startedAt: args?.previous?.startedAt ?? Date.now(),
|
|
2334
|
-
waitHint: formatImageWaitHint(modelConfig?.imageGenerationWaitTimeSeconds) ?? (usesWebImageTool ? "\u7F51\u9875\u751F\u56FE\u901A\u5E38\u9700\u8981 30 \u79D2\u5230\u51E0\u5206\u949F\uFF0C\u5207\u6362\u5BF9\u8BDD\u4E0D\u4F1A\u4E2D\u65AD" : "\u901A\u5E38\u9700\u8981\u51E0\u5341\u79D2"),
|
|
2335
|
-
profileLabel: currentProfile?.label
|
|
2336
|
-
};
|
|
2337
|
-
};
|
|
1199
|
+
userId: agentConfig.userId,
|
|
1200
|
+
ownerId: agentConfig.ownerId
|
|
1201
|
+
}) === "platform_credits";
|
|
1202
|
+
}
|
|
2338
1203
|
|
|
2339
1204
|
// packages/ai/agent/persistMessageWithFixedId.ts
|
|
2340
1205
|
async function persistMessageWithFixedId(dispatch, message) {
|
|
2341
1206
|
dispatch(addUserMessage(message));
|
|
2342
|
-
const { controller, ...messageToWrite } = message;
|
|
1207
|
+
const { controller, dialogId: _dialogId, ...messageToWrite } = message;
|
|
2343
1208
|
try {
|
|
2344
1209
|
const writeRequest = dispatch(
|
|
2345
1210
|
write({
|
|
@@ -2418,6 +1283,7 @@ function normalizeDesktopAgentRuntimeTurnError(data) {
|
|
|
2418
1283
|
async function* runDesktopAgentRuntimeTurnStream({
|
|
2419
1284
|
fetchImpl = fetch,
|
|
2420
1285
|
signal,
|
|
1286
|
+
noEventWatchdogMs,
|
|
2421
1287
|
...args
|
|
2422
1288
|
}) {
|
|
2423
1289
|
try {
|
|
@@ -2474,7 +1340,13 @@ async function* runDesktopAgentRuntimeTurnStream({
|
|
|
2474
1340
|
yield { type: "error", error: "The operation was aborted." };
|
|
2475
1341
|
return;
|
|
2476
1342
|
}
|
|
2477
|
-
const { done, value } = await readStreamChunk(reader, {
|
|
1343
|
+
const { done, value } = await readStreamChunk(reader, {
|
|
1344
|
+
signal,
|
|
1345
|
+
...noEventWatchdogMs && noEventWatchdogMs > 0 ? {
|
|
1346
|
+
timeoutMs: noEventWatchdogMs,
|
|
1347
|
+
timeoutErrorMessage: `Desktop turn stream stalled: no event within ${noEventWatchdogMs}ms`
|
|
1348
|
+
} : {}
|
|
1349
|
+
});
|
|
2478
1350
|
if (done) break;
|
|
2479
1351
|
buffer += decoder.decode(value, { stream: true });
|
|
2480
1352
|
const lines = buffer.split("\n");
|
|
@@ -2596,7 +1468,8 @@ var toolMessageWillPersist = (toolMsg) => {
|
|
|
2596
1468
|
if (typeof content === "string") return content.trim().length > 0;
|
|
2597
1469
|
return Array.isArray(content) && content.length > 0;
|
|
2598
1470
|
};
|
|
2599
|
-
var shouldUseDesktopLocalRuntime = (agentConfig) => {
|
|
1471
|
+
var shouldUseDesktopLocalRuntime = (agentConfig, explicitTarget) => {
|
|
1472
|
+
if (explicitTarget?.kind === "machine") return false;
|
|
2600
1473
|
if (!getIsDesktopApp()) return false;
|
|
2601
1474
|
return agentConfig?.apiSource !== "cli";
|
|
2602
1475
|
};
|
|
@@ -2700,104 +1573,6 @@ ${warnings.map((warning) => `- ${warning}`).join("\n")}`;
|
|
|
2700
1573
|
return `${content}${warningBlock}`;
|
|
2701
1574
|
}
|
|
2702
1575
|
|
|
2703
|
-
// packages/ai/agent/streamTurnStreamConsumer.ts
|
|
2704
|
-
async function readAgentRunStreamChunk(reader, signal, isAborted) {
|
|
2705
|
-
if (isAborted() || signal?.aborted) {
|
|
2706
|
-
void reader.cancel().catch(() => {
|
|
2707
|
-
});
|
|
2708
|
-
throw new DOMException("The operation was aborted.", "AbortError");
|
|
2709
|
-
}
|
|
2710
|
-
if (!signal) {
|
|
2711
|
-
return reader.read();
|
|
2712
|
-
}
|
|
2713
|
-
let settled = false;
|
|
2714
|
-
return new Promise((resolve, reject) => {
|
|
2715
|
-
const finish = (cb) => {
|
|
2716
|
-
if (settled) return;
|
|
2717
|
-
settled = true;
|
|
2718
|
-
signal.removeEventListener("abort", onAbort);
|
|
2719
|
-
cb();
|
|
2720
|
-
};
|
|
2721
|
-
const onAbort = () => {
|
|
2722
|
-
void reader.cancel().catch(() => {
|
|
2723
|
-
});
|
|
2724
|
-
finish(
|
|
2725
|
-
() => reject(new DOMException("The operation was aborted.", "AbortError"))
|
|
2726
|
-
);
|
|
2727
|
-
};
|
|
2728
|
-
signal.addEventListener("abort", onAbort);
|
|
2729
|
-
reader.read().then(
|
|
2730
|
-
(result) => finish(() => resolve(result)),
|
|
2731
|
-
(err) => finish(() => reject(err))
|
|
2732
|
-
);
|
|
2733
|
-
});
|
|
2734
|
-
}
|
|
2735
|
-
async function consumeAgentRunStream(handlers) {
|
|
2736
|
-
const {
|
|
2737
|
-
reader,
|
|
2738
|
-
decoder,
|
|
2739
|
-
parseChunk,
|
|
2740
|
-
onPayload,
|
|
2741
|
-
isDoneEvent,
|
|
2742
|
-
isAborted,
|
|
2743
|
-
signal,
|
|
2744
|
-
onAbort
|
|
2745
|
-
} = handlers;
|
|
2746
|
-
let sawDone = false;
|
|
2747
|
-
try {
|
|
2748
|
-
while (true) {
|
|
2749
|
-
let done;
|
|
2750
|
-
let value;
|
|
2751
|
-
try {
|
|
2752
|
-
({ done, value } = await readAgentRunStreamChunk(
|
|
2753
|
-
reader,
|
|
2754
|
-
signal,
|
|
2755
|
-
isAborted
|
|
2756
|
-
));
|
|
2757
|
-
} catch (error) {
|
|
2758
|
-
if (isAbortError(error) || isAborted() || signal?.aborted) {
|
|
2759
|
-
await onAbort();
|
|
2760
|
-
return { outcome: "aborted" };
|
|
2761
|
-
}
|
|
2762
|
-
throw error;
|
|
2763
|
-
}
|
|
2764
|
-
if (isAborted() || signal?.aborted) {
|
|
2765
|
-
await onAbort();
|
|
2766
|
-
return { outcome: "aborted" };
|
|
2767
|
-
}
|
|
2768
|
-
if (done) {
|
|
2769
|
-
return { outcome: "streamEnded", sawDone };
|
|
2770
|
-
}
|
|
2771
|
-
const payloads = parseChunk(
|
|
2772
|
-
decoder.decode(value, { stream: true })
|
|
2773
|
-
);
|
|
2774
|
-
for (const payload of payloads) {
|
|
2775
|
-
if (isAborted() || signal?.aborted) {
|
|
2776
|
-
await onAbort();
|
|
2777
|
-
return { outcome: "aborted" };
|
|
2778
|
-
}
|
|
2779
|
-
const directive = await onPayload(payload);
|
|
2780
|
-
if (directive?.reject !== void 0) {
|
|
2781
|
-
return { outcome: "rejected", message: directive.reject };
|
|
2782
|
-
}
|
|
2783
|
-
if (directive?.abort) {
|
|
2784
|
-
await onAbort();
|
|
2785
|
-
return { outcome: "aborted" };
|
|
2786
|
-
}
|
|
2787
|
-
if (isDoneEvent(payload)) {
|
|
2788
|
-
sawDone = true;
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
} catch (error) {
|
|
2793
|
-
if (isAbortError(error) || isAborted() || signal?.aborted) {
|
|
2794
|
-
await onAbort();
|
|
2795
|
-
return { outcome: "aborted" };
|
|
2796
|
-
}
|
|
2797
|
-
throw error;
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
|
|
2801
1576
|
// packages/ai/chat/wireAdapters/resolveChatWire.ts
|
|
2802
1577
|
function resolveChatWire(agentOrInput) {
|
|
2803
1578
|
if (!agentOrInput) return "completions";
|
|
@@ -2935,11 +1710,7 @@ var finalizeQuickChatAgentTurnFailure = async (dispatch, dialogKey, agentKey, er
|
|
|
2935
1710
|
var normalizeAgentRunUserInput = (userInput) => {
|
|
2936
1711
|
if (typeof userInput === "string") return userInput;
|
|
2937
1712
|
if (!Array.isArray(userInput)) return "";
|
|
2938
|
-
return userInput.
|
|
2939
|
-
if (!part || typeof part !== "object") return false;
|
|
2940
|
-
if (part.type === "text") return typeof part.text === "string";
|
|
2941
|
-
return part.type === "image_url" && typeof part.image_url?.url === "string" && !!part.image_url.url.trim();
|
|
2942
|
-
});
|
|
1713
|
+
return userInput.flatMap((part) => projectUserPartForModel(part));
|
|
2943
1714
|
};
|
|
2944
1715
|
var isSimpleTextInput = (userInput) => {
|
|
2945
1716
|
if (typeof userInput === "string") return true;
|
|
@@ -3048,6 +1819,28 @@ function hasInlineExecutedToolCalls(result) {
|
|
|
3048
1819
|
const output = result?.output;
|
|
3049
1820
|
return Array.isArray(output) && output.some((b) => b?.type === "toolCall" && b?.result != null);
|
|
3050
1821
|
}
|
|
1822
|
+
var COMPACTION_TIMEOUT_PATTERN = /compaction[^\n]{0,40}(timed\s*out|timeout|deadline)|(timed\s*out|timeout|deadline)[^\n]{0,40}compaction|summary[^\n]{0,30}(timed\s*out|timeout)/i;
|
|
1823
|
+
var DESKTOP_SSE_NO_EVENT_WATCHDOG_MS = 20 * 60 * 1e3;
|
|
1824
|
+
function classifyLocalTurnStreamError(errorText) {
|
|
1825
|
+
const text = typeof errorText === "string" ? errorText : "";
|
|
1826
|
+
if (COMPACTION_TIMEOUT_PATTERN.test(text)) {
|
|
1827
|
+
return {
|
|
1828
|
+
kind: "compaction_timeout",
|
|
1829
|
+
retryable: true,
|
|
1830
|
+
summary: "\u5386\u53F2\u538B\u7F29\u8D85\u65F6",
|
|
1831
|
+
actionHint: "\u5386\u53F2\u538B\u7F29\u672A\u80FD\u5728\u65F6\u9650\u5185\u5B8C\u6210\uFF0C\u672C\u56DE\u5408\u5DF2\u505C\u6B62\u3002\u4F60\u7684\u6D88\u606F\u4E0E\u9644\u4EF6\u5747\u5DF2\u4FDD\u7559\uFF1B\u53EF\u91CD\u8BD5\u3001\u5F00\u542F\u65B0\u5BF9\u8BDD\uFF0C\u6216\u5207\u6362\u5230\u66F4\u5927\u7A97\u53E3\u7684\u6A21\u578B\u3002\uFF08\u8D85\u65F6\u540E\u4E0D\u4F1A\u81EA\u52A8\u91CD\u8BD5\u540C\u4E00\u4ED8\u8D39\u8BF7\u6C42\u3002\uFF09"
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
if (isContextOverflowText(text)) {
|
|
1835
|
+
return {
|
|
1836
|
+
kind: "context_overflow",
|
|
1837
|
+
retryable: true,
|
|
1838
|
+
summary: "\u4E0A\u4E0B\u6587\u8FC7\u957F",
|
|
1839
|
+
actionHint: "\u5F53\u524D\u4E0A\u4E0B\u6587\u8D85\u51FA\u6A21\u578B\u7A97\u53E3\u3002\u53EF\u81EA\u52A8\u538B\u7F29\u5E76\u91CD\u8BD5\u3001\u5F00\u542F\u65B0\u5BF9\u8BDD\uFF0C\u6216\u5207\u6362\u5230\u66F4\u5927\u7A97\u53E3\u7684\u6A21\u578B\u3002"
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
return { kind: "generic", retryable: true, summary: "", actionHint: "" };
|
|
1843
|
+
}
|
|
3051
1844
|
function createRemoteToolEventHandlers(opts) {
|
|
3052
1845
|
const { dialogId, dispatch, messageMetadata } = opts;
|
|
3053
1846
|
const activeToolMessages = /* @__PURE__ */ new Map();
|
|
@@ -3103,6 +1896,9 @@ function createRemoteToolEventHandlers(opts) {
|
|
|
3103
1896
|
isStreaming: false,
|
|
3104
1897
|
content: projectedContent,
|
|
3105
1898
|
toolName,
|
|
1899
|
+
// F1: keep server-projected metadata (incl. executionLocation)
|
|
1900
|
+
// on the message so tool rows can render the actual host.
|
|
1901
|
+
...mergedMeta ? { metadata: mergedMeta } : {},
|
|
3106
1902
|
toolPayload: {
|
|
3107
1903
|
...existing.toolPayload ?? {},
|
|
3108
1904
|
toolName,
|
|
@@ -3122,6 +1918,9 @@ function createRemoteToolEventHandlers(opts) {
|
|
|
3122
1918
|
isStreaming: false,
|
|
3123
1919
|
toolName,
|
|
3124
1920
|
toolCallId: callId,
|
|
1921
|
+
// F1: surface executionLocation (and any other server metadata)
|
|
1922
|
+
// even on the no-prior-call fallback path.
|
|
1923
|
+
...mergedMeta ? { metadata: mergedMeta } : {},
|
|
3125
1924
|
toolPayload: {
|
|
3126
1925
|
toolName,
|
|
3127
1926
|
status: resultStatus,
|
|
@@ -3182,6 +1981,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3182
1981
|
thunkApi.signal.addEventListener("abort", onAbort);
|
|
3183
1982
|
let loopKey = null;
|
|
3184
1983
|
let runtimeDialogKey = explicitDialogKey ?? null;
|
|
1984
|
+
let turnPhaseTurnId = null;
|
|
3185
1985
|
let remoteTransientMessageId = null;
|
|
3186
1986
|
let remoteTransientMessageFinalized = false;
|
|
3187
1987
|
let modelRequestStarted = false;
|
|
@@ -3280,18 +2080,29 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3280
2080
|
apiSource: agentConfig.apiSource,
|
|
3281
2081
|
source: agentConfigSource
|
|
3282
2082
|
});
|
|
3283
|
-
const
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
2083
|
+
const identityState = getState();
|
|
2084
|
+
const gptProCheck = shouldBlockForGptPro({
|
|
2085
|
+
premium: isGptProModel(agentConfig.provider, agentConfig.model),
|
|
2086
|
+
platformPaid: isPlatformPaidAgentCall({
|
|
2087
|
+
agentConfig,
|
|
2088
|
+
callerUserId: selectIdentityUserId(identityState)
|
|
2089
|
+
}),
|
|
2090
|
+
gptProStatus: selectIdentityUser(identityState)?.gptProAccess?.status
|
|
2091
|
+
});
|
|
3287
2092
|
if (gptProCheck.blocked) {
|
|
3288
2093
|
return rejectWithValue(gptProCheck.message);
|
|
3289
2094
|
}
|
|
3290
2095
|
const configuredBoundMachineId = asTrimmedString(
|
|
3291
2096
|
agentConfig.runtimeBinding?.machineId
|
|
3292
2097
|
);
|
|
3293
|
-
const
|
|
3294
|
-
|
|
2098
|
+
const currentDialog = selectDialogConfigByKey(state, explicitDialogKey) ?? selectCurrentDialogConfig(state);
|
|
2099
|
+
const explicitTarget = runtimeOptions?.runtimeTarget ?? (currentDialog?.runtimeBinding?.target?.kind === "server" || currentDialog?.runtimeBinding?.target?.kind === "machine" ? currentDialog.runtimeBinding.target : void 0);
|
|
2100
|
+
const boundMachineId = explicitTarget ? explicitTarget.kind === "machine" ? asTrimmedString(explicitTarget.machineId) : null : resolveRemoteBoundMachineId(configuredBoundMachineId);
|
|
2101
|
+
const hasExplicitMachineTarget = explicitTarget?.kind === "machine";
|
|
2102
|
+
if (hasExplicitMachineTarget && !boundMachineId) {
|
|
2103
|
+
return rejectWithValue("\u663E\u5F0F\u9009\u62E9\u7684\u7535\u8111\u76EE\u6807\u7F3A\u5C11 machineId\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6267\u884C\u7535\u8111\u3002");
|
|
2104
|
+
}
|
|
2105
|
+
if (hasExplicitMachineTarget || agentConfig.apiSource === "cli" && !explicitTarget || boundMachineId && !getIsDesktopApp()) {
|
|
3295
2106
|
console.info("[streamAgentChatTurn] Triggered CLI/machine route. apiSource:", agentConfig.apiSource, "boundMachineId:", boundMachineId, "agentKey:", agentKey);
|
|
3296
2107
|
const currentState = getState();
|
|
3297
2108
|
const w2 = typeof globalThis !== "undefined" && globalThis.window ? globalThis.window : null;
|
|
@@ -3326,6 +2137,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3326
2137
|
let accumulated2 = "";
|
|
3327
2138
|
let totalTurnUsage2 = void 0;
|
|
3328
2139
|
const buildMachineAssistantMessage = () => ({
|
|
2140
|
+
dialogId: dialogId2,
|
|
3329
2141
|
id: messageId,
|
|
3330
2142
|
dbKey: msgKey,
|
|
3331
2143
|
role: "assistant",
|
|
@@ -3375,6 +2187,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3375
2187
|
stream: true,
|
|
3376
2188
|
persistDialog: false,
|
|
3377
2189
|
clientDialogId: dialogId2,
|
|
2190
|
+
...explicitTarget ? { runtimeTarget: explicitTarget } : {},
|
|
3378
2191
|
runtimeContext: {
|
|
3379
2192
|
surface: "web",
|
|
3380
2193
|
host: "browser",
|
|
@@ -3600,6 +2413,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3600
2413
|
let cliTurnUsage = null;
|
|
3601
2414
|
const decoder = new TextDecoder();
|
|
3602
2415
|
const buildCliAssistantMessage = () => ({
|
|
2416
|
+
dialogId: dialogId2,
|
|
3603
2417
|
id: messageId,
|
|
3604
2418
|
dbKey: msgKey,
|
|
3605
2419
|
role: "assistant",
|
|
@@ -3722,7 +2536,6 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3722
2536
|
}
|
|
3723
2537
|
return;
|
|
3724
2538
|
}
|
|
3725
|
-
const currentDialog = selectDialogConfigByKey(state, explicitDialogKey) ?? selectCurrentDialogConfig(state);
|
|
3726
2539
|
const activeDialogKey = currentDialog?.dbKey;
|
|
3727
2540
|
const dialogKey = explicitDialogKey || activeDialogKey;
|
|
3728
2541
|
if (!dialogKey) {
|
|
@@ -3734,11 +2547,13 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3734
2547
|
dialogKey,
|
|
3735
2548
|
dialogId
|
|
3736
2549
|
});
|
|
3737
|
-
if (shouldUseDesktopLocalRuntime(agentConfig)) {
|
|
2550
|
+
if (shouldUseDesktopLocalRuntime(agentConfig, explicitTarget)) {
|
|
3738
2551
|
const desktopMessageMetadata = buildMessageMetadata(agentConfig);
|
|
3739
2552
|
const w2 = typeof globalThis !== "undefined" && globalThis.window ? globalThis.window : null;
|
|
3740
2553
|
loopKey = `loop:${dialogId}`;
|
|
3741
2554
|
dispatch(addActiveController({ messageId: loopKey, controller: loopController, dialogKey }));
|
|
2555
|
+
turnPhaseTurnId = `turn-phase:${dialogId}:${Date.now().toString(36)}:${Math.random().toString(36).slice(2, 8)}`;
|
|
2556
|
+
claimDialogTurnPhase({ dialogKey, turnId: turnPhaseTurnId });
|
|
3742
2557
|
let currentContent = "";
|
|
3743
2558
|
const assistantSegments = [];
|
|
3744
2559
|
let assistantMessageKeys = null;
|
|
@@ -3746,6 +2561,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3746
2561
|
let streamError = null;
|
|
3747
2562
|
let reasoningBuffer = "";
|
|
3748
2563
|
const activeToolMessages = /* @__PURE__ */ new Map();
|
|
2564
|
+
let desktopToolExecutionLocation = void 0;
|
|
3749
2565
|
const ensureAssistantMessageKeys = () => {
|
|
3750
2566
|
if (!assistantMessageKeys) {
|
|
3751
2567
|
assistantMessageKeys = createDialogMessageKeyAndId(dialogId);
|
|
@@ -3811,7 +2627,18 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3811
2627
|
workspaceToolsHint: runtimeOptions?.workspaceToolsHint === true,
|
|
3812
2628
|
agentConfigSnapshot: agentConfig,
|
|
3813
2629
|
dialogMessages: selectAllMsgs(getState(), dialogId),
|
|
3814
|
-
signal: loopController.signal
|
|
2630
|
+
signal: loopController.signal,
|
|
2631
|
+
// SSE 传输层兜底(review 修复 4):此前本调用方从不传
|
|
2632
|
+
// noEventWatchdogMs,watchdog 永远关闭——「已有安全网」只是
|
|
2633
|
+
// 错觉,挂起点若在 provider.complete 之外(resolveProvider /
|
|
2634
|
+
// adapter 内部,runtime 没有任何 deadline)就会无限静默。
|
|
2635
|
+
// 量级必须大于 runtime 自己的 idle 窗(默认 10 分钟无新输出
|
|
2636
|
+
// 才放弃,见 localLoop.DEFAULT_LLM_REQUEST_TIMEOUT_MS),
|
|
2637
|
+
// 否则一个健康的慢思考轮次会被客户端提前判死,用户拿到的是
|
|
2638
|
+
// 未分类的 "stream stalled" 而不是 runtime 的
|
|
2639
|
+
// LLM_REQUEST_TIMEOUT 可操作文案。取 2× = 20 分钟:
|
|
2640
|
+
// 只兜「runtime 完全没 deadline」的真悬挂。
|
|
2641
|
+
noEventWatchdogMs: DESKTOP_SSE_NO_EVENT_WATCHDOG_MS
|
|
3815
2642
|
});
|
|
3816
2643
|
for await (const event of eventStream) {
|
|
3817
2644
|
if (loopController.signal.aborted || thunkApi.signal.aborted) {
|
|
@@ -3842,15 +2669,22 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3842
2669
|
isStreaming: true,
|
|
3843
2670
|
toolName: toolEvent.toolName,
|
|
3844
2671
|
toolCallId: callId,
|
|
2672
|
+
// F2: 实际执行位置(服务端/runtime 投影)挂到 tool
|
|
2673
|
+
// 卡片 metadata。优先事件自带 metadata(runtime
|
|
2674
|
+
// 投影层直接注入的同名字段),兜底用 turn 级
|
|
2675
|
+
// execution_location 帧。缺失/不合法时渲染层
|
|
2676
|
+
// projectToolExecutionLocation 收敛为 unknown。
|
|
2677
|
+
metadata: {
|
|
2678
|
+
...isRecord(toolEvent.metadata) ? toolEvent.metadata : {},
|
|
2679
|
+
...desktopToolExecutionLocation !== void 0 && !(isRecord(toolEvent.metadata) && toolEvent.metadata.executionLocation !== void 0) ? { executionLocation: desktopToolExecutionLocation } : {},
|
|
2680
|
+
...toolEvent.argumentsPreview ? { argumentsPreview: toolEvent.argumentsPreview } : {}
|
|
2681
|
+
},
|
|
3845
2682
|
...toolEvent.argumentsPreview ? {
|
|
3846
2683
|
toolPayload: {
|
|
3847
2684
|
input: {
|
|
3848
2685
|
command: toolEvent.argumentsPreview,
|
|
3849
2686
|
cmd: toolEvent.argumentsPreview
|
|
3850
2687
|
}
|
|
3851
|
-
},
|
|
3852
|
-
metadata: {
|
|
3853
|
-
argumentsPreview: toolEvent.argumentsPreview
|
|
3854
2688
|
}
|
|
3855
2689
|
} : {}
|
|
3856
2690
|
};
|
|
@@ -3865,7 +2699,13 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3865
2699
|
const mergedMeta = {
|
|
3866
2700
|
...existingMeta,
|
|
3867
2701
|
...toolEvent.metadata,
|
|
3868
|
-
...isError ? { error: true, message: toolEvent.message } : {}
|
|
2702
|
+
...isError ? { error: true, message: toolEvent.message } : {},
|
|
2703
|
+
// 服务端/runtime 已在事件 metadata 带
|
|
2704
|
+
// executionLocation 时尊重之;tool-call 阶段
|
|
2705
|
+
// 已写入的值由 existingMeta 保留;仅当两边都
|
|
2706
|
+
// 没有且 turn 级 execution_location 帧存在时
|
|
2707
|
+
// 兜底补上,绝不覆盖已有值。
|
|
2708
|
+
...existingMeta.executionLocation === void 0 && (!isRecord(toolEvent.metadata) || toolEvent.metadata.executionLocation === void 0) && desktopToolExecutionLocation !== void 0 ? { executionLocation: desktopToolExecutionLocation } : {}
|
|
3869
2709
|
};
|
|
3870
2710
|
const toolResultMsg = {
|
|
3871
2711
|
...existing,
|
|
@@ -3884,6 +2724,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3884
2724
|
dispatch(messageStreaming(toolResultMsg));
|
|
3885
2725
|
}
|
|
3886
2726
|
}
|
|
2727
|
+
} else if (event.type === "status") {
|
|
2728
|
+
const phase = event.phase === "validating-context" ? "validating" : event.phase;
|
|
2729
|
+
setDialogTurnPhase({ phase, dialogKey, turnId: turnPhaseTurnId ?? void 0 });
|
|
2730
|
+
} else if (event.type === "execution_location") {
|
|
2731
|
+
desktopToolExecutionLocation = event.location;
|
|
3887
2732
|
} else if (event.type === "done") {
|
|
3888
2733
|
streamResult = event.result;
|
|
3889
2734
|
} else if (event.type === "error") {
|
|
@@ -3924,6 +2769,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3924
2769
|
stopToolNameById
|
|
3925
2770
|
);
|
|
3926
2771
|
await persistMessageWithFixedId(dispatch, {
|
|
2772
|
+
dialogId,
|
|
3927
2773
|
id: segment2.messageId,
|
|
3928
2774
|
dbKey: segment2.key,
|
|
3929
2775
|
role: "assistant",
|
|
@@ -3974,6 +2820,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
3974
2820
|
errorToolNameById
|
|
3975
2821
|
);
|
|
3976
2822
|
await persistMessageWithFixedId(dispatch, {
|
|
2823
|
+
dialogId,
|
|
3977
2824
|
id: segment2.messageId,
|
|
3978
2825
|
dbKey: segment2.key,
|
|
3979
2826
|
role: "assistant",
|
|
@@ -4015,8 +2862,12 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
4015
2862
|
setLoopStopReason("error");
|
|
4016
2863
|
};
|
|
4017
2864
|
if (streamError) {
|
|
4018
|
-
|
|
4019
|
-
|
|
2865
|
+
const info = classifyLocalTurnStreamError(streamError);
|
|
2866
|
+
const finalError = info.actionHint ? `${streamError}
|
|
2867
|
+
|
|
2868
|
+
${info.actionHint}` : streamError;
|
|
2869
|
+
await finalizeDesktopTurnOnError(finalError);
|
|
2870
|
+
return rejectWithValue(finalError);
|
|
4020
2871
|
}
|
|
4021
2872
|
if (!streamResult) {
|
|
4022
2873
|
const message = "Local turn stream closed unexpectedly without result";
|
|
@@ -4146,6 +2997,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
4146
2997
|
let accumulated = "";
|
|
4147
2998
|
let totalTurnUsage2 = void 0;
|
|
4148
2999
|
const buildRemoteAssistantMessage = () => ({
|
|
3000
|
+
dialogId,
|
|
4149
3001
|
id: messageId,
|
|
4150
3002
|
dbKey: msgKey,
|
|
4151
3003
|
role: "assistant",
|
|
@@ -4190,6 +3042,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
4190
3042
|
stream: true,
|
|
4191
3043
|
persistDialog: false,
|
|
4192
3044
|
clientDialogId: dialogId,
|
|
3045
|
+
...explicitTarget ? { runtimeTarget: explicitTarget } : {},
|
|
4193
3046
|
runtimeContext: {
|
|
4194
3047
|
surface: "web",
|
|
4195
3048
|
host: "browser",
|
|
@@ -4205,18 +3058,22 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
4205
3058
|
...currentDialog?.spaceId ? { spaceId: currentDialog.spaceId } : {}
|
|
4206
3059
|
});
|
|
4207
3060
|
const remoteRunUrl = `${explicitServerBase.replace(/\/+$/, "")}/api/agent/run`;
|
|
3061
|
+
const remoteRunInit = buildForegroundTurnAdmissionFetchInit({
|
|
3062
|
+
body: remoteRequestBody,
|
|
3063
|
+
headers: {
|
|
3064
|
+
"Content-Type": "application/json",
|
|
3065
|
+
Accept: "text/event-stream",
|
|
3066
|
+
...authHeader ? { Authorization: authHeader } : {}
|
|
3067
|
+
},
|
|
3068
|
+
signal: loopController.signal
|
|
3069
|
+
});
|
|
4208
3070
|
const remoteResponse = await performServerProxyFetchWithRetry({
|
|
4209
|
-
execute: () => fetch(remoteRunUrl,
|
|
4210
|
-
method: "POST",
|
|
4211
|
-
headers: {
|
|
4212
|
-
"Content-Type": "application/json",
|
|
4213
|
-
Accept: "text/event-stream",
|
|
4214
|
-
...authHeader ? { Authorization: authHeader } : {}
|
|
4215
|
-
},
|
|
4216
|
-
body: remoteRequestBody,
|
|
4217
|
-
signal: loopController.signal
|
|
4218
|
-
}),
|
|
3071
|
+
execute: () => fetch(remoteRunUrl, remoteRunInit),
|
|
4219
3072
|
signal: loopController.signal,
|
|
3073
|
+
// A keepalive POST may already have reached the server when
|
|
3074
|
+
// the connection error surfaces; /api/agent/run stream turns
|
|
3075
|
+
// are not idempotent, so never silently re-submit it.
|
|
3076
|
+
retryNetworkErrors: remoteRunInit.keepalive !== true,
|
|
4220
3077
|
logPrefix: "[streamAgentChatTurn.remoteRun]"
|
|
4221
3078
|
});
|
|
4222
3079
|
if (!remoteResponse.ok) {
|
|
@@ -4337,82 +3194,38 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
4337
3194
|
};
|
|
4338
3195
|
}
|
|
4339
3196
|
}
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
);
|
|
3197
|
+
const activeDialogConfig = selectDialogConfigByKey(getState(), explicitDialogKey) ?? selectCurrentDialogConfig(getState()) ?? currentDialog;
|
|
3198
|
+
const turnToolContext = await resolveTurnToolContext({
|
|
3199
|
+
agentConfig,
|
|
3200
|
+
dialogConfig: activeDialogConfig,
|
|
3201
|
+
userInput,
|
|
3202
|
+
state,
|
|
3203
|
+
dispatch,
|
|
3204
|
+
runtimeOptions
|
|
3205
|
+
});
|
|
3206
|
+
const mentionedTools = turnToolContext.mentionedToolNames;
|
|
3207
|
+
const normalizedReferences = turnToolContext.resolvedReferences ?? [];
|
|
3208
|
+
const referenceTools = turnToolContext.referencedTools ?? [];
|
|
3209
|
+
const contextTools = turnToolContext.contextTools ?? [];
|
|
3210
|
+
const attachmentTools = turnToolContext.attachmentToolNames ?? [];
|
|
3211
|
+
const mergedContentCache = turnToolContext.mergedContentCache ?? /* @__PURE__ */ new Map();
|
|
4356
3212
|
logQuickChatPerfStage2(quickChatPerfStartedAt, "stream-agent-references-resolved", {
|
|
4357
|
-
referenceCount: normalizedReferences
|
|
4358
|
-
referencedToolCount: referenceTools
|
|
3213
|
+
referenceCount: normalizedReferences.length,
|
|
3214
|
+
referencedToolCount: referenceTools.length
|
|
4359
3215
|
});
|
|
4360
3216
|
const agentConfigWithReferences = {
|
|
4361
3217
|
...agentConfig,
|
|
4362
3218
|
references: normalizedReferences,
|
|
4363
3219
|
referencedTools: referenceTools,
|
|
4364
|
-
recommendedSkillTools:
|
|
4365
|
-
recommendedSkillHints:
|
|
4366
|
-
skillPromptPatches:
|
|
3220
|
+
recommendedSkillTools: turnToolContext.recommendedSkillTools,
|
|
3221
|
+
recommendedSkillHints: turnToolContext.recommendedSkillHints,
|
|
3222
|
+
skillPromptPatches: turnToolContext.skillPromptPatches
|
|
4367
3223
|
};
|
|
4368
3224
|
const initialRawMsgs = selectAllMsgs(state, dialogId);
|
|
4369
3225
|
const initialHistoryIds = new Set(initialRawMsgs.map((m) => m.id));
|
|
4370
|
-
const keySets = await getFullChatContextKeys(
|
|
4371
|
-
state,
|
|
4372
|
-
dispatch,
|
|
4373
|
-
agentConfigWithReferences,
|
|
4374
|
-
userInput,
|
|
4375
|
-
currentDialog ?? void 0
|
|
4376
|
-
);
|
|
4377
|
-
const finalKeys = deduplicateContextKeys(keySets);
|
|
4378
|
-
const allContextKeys = /* @__PURE__ */ new Set([
|
|
4379
|
-
...finalKeys.botInstructionsContext,
|
|
4380
|
-
...finalKeys.currentInputContext,
|
|
4381
|
-
...finalKeys.historyContext,
|
|
4382
|
-
...finalKeys.botKnowledgeContext
|
|
4383
|
-
]);
|
|
4384
|
-
const {
|
|
4385
|
-
tools: contextTools,
|
|
4386
|
-
contentByKey: contextContentCache,
|
|
4387
|
-
recommendedSkillTools: contextRecommendedSkillTools = [],
|
|
4388
|
-
recommendedSkillHints: contextRecommendedSkillHints = [],
|
|
4389
|
-
skillPromptPatches: contextSkillPromptPatches = []
|
|
4390
|
-
} = await resolveToolsFromKeys(
|
|
4391
|
-
Array.from(allContextKeys),
|
|
4392
|
-
dispatch,
|
|
4393
|
-
referenceContentCache
|
|
4394
|
-
);
|
|
4395
|
-
const mergedContentCache = new Map([
|
|
4396
|
-
...referenceContentCache,
|
|
4397
|
-
...contextContentCache
|
|
4398
|
-
]);
|
|
4399
3226
|
const agentConfigWithTools = mergeAgentToolsWithRuntime(
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
recommendedSkillTools: [
|
|
4403
|
-
...agentConfigWithReferences.recommendedSkillTools ?? [],
|
|
4404
|
-
...contextRecommendedSkillTools
|
|
4405
|
-
],
|
|
4406
|
-
recommendedSkillHints: [
|
|
4407
|
-
...agentConfigWithReferences.recommendedSkillHints ?? [],
|
|
4408
|
-
...contextRecommendedSkillHints
|
|
4409
|
-
],
|
|
4410
|
-
skillPromptPatches: [
|
|
4411
|
-
...agentConfigWithReferences.skillPromptPatches ?? [],
|
|
4412
|
-
...contextSkillPromptPatches
|
|
4413
|
-
]
|
|
4414
|
-
},
|
|
4415
|
-
contextTools,
|
|
3227
|
+
agentConfigWithReferences,
|
|
3228
|
+
[...contextTools, ...attachmentTools],
|
|
4416
3229
|
mentionedTools,
|
|
4417
3230
|
runtimeOptions,
|
|
4418
3231
|
state
|
|
@@ -4982,6 +3795,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
4982
3795
|
error?.message || "An unexpected error occurred in streamAgentChatTurn."
|
|
4983
3796
|
);
|
|
4984
3797
|
} finally {
|
|
3798
|
+
clearDialogTurnPhase({ dialogKey: runtimeDialogKey ?? void 0, turnId: turnPhaseTurnId ?? void 0 });
|
|
4985
3799
|
if (loopKey && runtimeDialogKey) {
|
|
4986
3800
|
dispatch(removeActiveController({ messageId: loopKey, dialogKey: runtimeDialogKey }));
|
|
4987
3801
|
} else if (loopKey) {
|
|
@@ -5001,5 +3815,6 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
5001
3815
|
}
|
|
5002
3816
|
};
|
|
5003
3817
|
export {
|
|
3818
|
+
classifyLocalTurnStreamError,
|
|
5004
3819
|
streamAgentChatTurnHandler
|
|
5005
3820
|
};
|