nolo-cli 0.224.0-alpha.2 → 0.224.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/{_executeModel-4WBUORCW.js → _executeModel-5NA4USGG.js} +77 -71
- package/{action-CK64LS6S.js → action-X75O3XPH.js} +11 -8
- package/{addContentAction-EQXMFNPR.js → addContentAction-GVC77QSN.js} +14 -13
- package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-KKDVAMW3.js} +15 -14
- package/{agentDeleteCommand-BB6KU5AO.js → agentDeleteCommand-2RFGKFAB.js} +127 -119
- package/{agentEmailCommands-KMHPL6OH.js → agentEmailCommands-GQCQKKOR.js} +126 -114
- package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-7LOP3HUD.js} +5 -5
- package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-L6O2HVJI.js} +5 -5
- package/{agentListCommands-5UNM7CGG.js → agentListCommands-HSGLDPDQ.js} +110 -495
- package/{agentMachineCommands-OC5D4YZW.js → agentMachineCommands-BISF6PVV.js} +63 -57
- package/{agentProviderCommands-ZCH37KAL.js → agentProviderCommands-O3Q25PKU.js} +6 -6
- package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-G6U2LHMW.js} +6 -6
- package/agentRecordCommands-AOXPGYAJ.js +189 -0
- package/{agentRunCommand-M22Y3D5U.js → agentRunCommand-AFAIP7U7.js} +129 -115
- package/{agentRunControl-QDFW5P2T.js → agentRunControl-VBL7UFSG.js} +20 -14
- package/{agentRuntimeLocal-SD7U2EGY.js → agentRuntimeLocal-T7BX2WGL.js} +47 -41
- package/{agentSlice-AJPMMBOP.js → agentSlice-XJNKE3PG.js} +18 -17
- package/{appDeleteCommands-NE3NQQJL.js → appDeleteCommands-LURUSPY7.js} +56 -50
- package/{appDeployCommands-2BAHY522.js → appDeployCommands-SMEW4AK2.js} +56 -50
- package/{appDeployStatusCommands-JTW6LZNC.js → appDeployStatusCommands-VYPJTBJK.js} +56 -50
- package/{appGetCommands-WKFEJO6A.js → appGetCommands-N4NI5GGJ.js} +56 -50
- package/{appListCommands-HNAZZLFX.js → appListCommands-5C6ONN3Z.js} +56 -50
- package/{authCommand-VQP625QS.js → authCommand-4CVBDADE.js} +29 -28
- package/{authCommands-PAKU3CJZ.js → authCommands-EHU2BHOX.js} +12 -11
- package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-AYWYQVA4.js} +4 -4
- package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-CSDG2HYN.js} +6 -6
- package/{chunk-OOF7XDZF.js → chunk-2574ANSV.js} +6 -6
- package/chunk-2SXN7LAY.js +15 -0
- package/{chunk-OGHP3CTL.js → chunk-2X7WFDT6.js} +1 -1
- package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
- package/{chunk-D726I5AZ.js → chunk-3EMIEC27.js} +2 -2
- package/{chunk-XUJZYUIM.js → chunk-3FBAVU2Y.js} +24 -22
- package/{chunk-YL3EFYL3.js → chunk-4D4QD7FT.js} +3 -1
- package/{chunk-5RKUPJYL.js → chunk-4FIO2S7Z.js} +11 -3
- package/{chunk-EK7PGVPY.js → chunk-4IQVE43Z.js} +63 -32
- package/{chunk-6NKA6RKF.js → chunk-4Q6HQORG.js} +8 -8
- package/{chunk-P2ZLUIW2.js → chunk-4X5AVCM7.js} +94 -4
- package/chunk-4ZCTKB27.js +31 -0
- package/{chunk-JWXITTQB.js → chunk-5HUO7SEX.js} +9 -107
- package/{chunk-4A2JIXR2.js → chunk-5QZSEQSK.js} +1 -1
- package/chunk-5ZUOVCKT.js +32 -0
- package/{chunk-TRWT3EE3.js → chunk-62HXNQVV.js} +1 -1
- package/{chunk-JC5XLWZK.js → chunk-6CKUO32A.js} +27 -15
- package/chunk-6D25V6CB.js +133 -0
- package/chunk-6WOLPIPY.js +379 -0
- package/{chunk-KOXKKHFE.js → chunk-6WZVM33D.js} +9 -4
- package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
- package/{chunk-ULK35M44.js → chunk-7AJRJGSQ.js} +1049 -2860
- package/chunk-7NIBQ4HY.js +138 -0
- package/{chunk-7Z6EW7AH.js → chunk-7TTMMOKH.js} +13 -6
- package/{chunk-ZLOSGVCQ.js → chunk-A3LUWRQK.js} +15 -15
- package/{chunk-C4WTX5TU.js → chunk-A5EVA6HU.js} +2 -2
- package/{chunk-ZLNHUFOF.js → chunk-A74QP4FI.js} +2613 -1297
- package/{chunk-ME4XUFTD.js → chunk-AEQMKYZN.js} +15 -15
- package/{chunk-6E2NWYT4.js → chunk-AH5R7BYW.js} +22 -176
- package/{chunk-H7R3365N.js → chunk-ANJRDS6U.js} +8 -5
- package/{chunk-YFLVRVYK.js → chunk-AVJDELEA.js} +1 -1
- package/{chunk-GIABSSWQ.js → chunk-B5SV4H3J.js} +4 -4
- package/{chunk-S7RA7A4X.js → chunk-B7DE5XJW.js} +387 -347
- package/chunk-BEM6LPD2.js +734 -0
- package/{chunk-SRL56PI2.js → chunk-BGGAY6OK.js} +46 -8
- package/{chunk-BKJSRO66.js → chunk-BGGV6B5O.js} +555 -328
- package/{chunk-BGGHA5DV.js → chunk-BIABIPGW.js} +1 -1
- package/chunk-BIDSIRTS.js +307 -0
- package/{chunk-6D7NVU66.js → chunk-BXSMFPTG.js} +17 -14
- package/{chunk-Q6HOUF4O.js → chunk-CBUZ6DKA.js} +3 -3
- package/{chunk-LE6LGAJE.js → chunk-CD3RU7XL.js} +17 -2
- package/{chunk-GVGOEMNV.js → chunk-CKZPMJNU.js} +3 -3
- package/{chunk-HJAGA3GR.js → chunk-CVJRVBJL.js} +3 -3
- package/chunk-D374I563.js +62 -0
- package/{chunk-XWGDCWXY.js → chunk-DNZ4JJ7C.js} +9 -9
- package/chunk-DVYAFH2Q.js +103 -0
- package/{chunk-PYIMOZSX.js → chunk-DXW5WDHZ.js} +4 -4
- package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
- package/{chunk-KPAFQHRT.js → chunk-E5KJOZWY.js} +4 -4
- package/{chunk-GNHMRBYZ.js → chunk-EBKHA63G.js} +106 -14
- package/{chunk-PFJNLBRU.js → chunk-EEOOBRA7.js} +6 -6
- package/{chunk-M3JEW6N6.js → chunk-F26GAEH3.js} +10 -0
- package/{chunk-QLFCTYRH.js → chunk-F3XI6WQP.js} +17 -10
- package/{chunk-AFHOCBSP.js → chunk-F6YWDVIB.js} +1 -1
- package/{chunk-SJYK3LLP.js → chunk-FFYE5ATM.js} +6 -6
- package/{chunk-QG3USDTD.js → chunk-FZKA3XFA.js} +21 -21
- package/{chunk-C4VAR65S.js → chunk-G22P367E.js} +153 -117
- package/{chunk-WOIURUUV.js → chunk-GDUC4VS2.js} +12 -12
- package/{chunk-2VUZSVAS.js → chunk-GXXY2NL3.js} +22 -20
- package/{chunk-IWH5SOU4.js → chunk-H7ZYKHAZ.js} +38 -18
- package/{chunk-G2EJ7NL4.js → chunk-HBRDSQ3M.js} +2 -2
- package/{chunk-EGXPAWLG.js → chunk-HCNOO374.js} +1 -1
- package/{chunk-DJSTBAOU.js → chunk-HOM6LTEW.js} +4 -4
- package/{chunk-S2NTVGA2.js → chunk-I2OYPD3Y.js} +1 -1
- package/{chunk-RXJ26SQW.js → chunk-IJTXNLQE.js} +13 -13
- package/{chunk-UYOICCYG.js → chunk-IUMS6F53.js} +59 -88
- package/{chunk-MOMR7NMG.js → chunk-IUTUWIKE.js} +2 -2
- package/{chunk-JVRQ6YVK.js → chunk-JBWXPACD.js} +1 -1
- package/{chunk-SASHAZ67.js → chunk-KZPEGO6D.js} +13 -2
- package/{chunk-HCJFGH6Y.js → chunk-L32W3PRP.js} +46 -16
- package/{chunk-GGKNJ42M.js → chunk-LYDEFPQP.js} +18 -108
- package/{chunk-K5FNYHZC.js → chunk-MECDGHLK.js} +420 -120
- package/{chunk-EOWLBDY6.js → chunk-MM73SP4K.js} +1 -1
- package/{chunk-J6T25AJ6.js → chunk-MYOSN6BT.js} +82 -18
- package/{chunk-Q7WP5RPC.js → chunk-MYPKBJJO.js} +5 -5
- package/{chunk-6RQFZCKH.js → chunk-N2JROHD3.js} +4 -4
- package/{chunk-VREDDN25.js → chunk-O6IPRAVV.js} +14 -9
- package/{chunk-VALBGPM6.js → chunk-OBSEKCVK.js} +17 -20
- package/{chunk-AMEOV5VZ.js → chunk-OOJNQK6V.js} +33 -33
- package/{chunk-PPJYZRSQ.js → chunk-OX6GNNVT.js} +6 -1
- package/{chunk-5R63B62U.js → chunk-P3IZUMIC.js} +8 -8
- package/{chunk-FRSBYNWI.js → chunk-PGKA77TZ.js} +52 -217
- package/{chunk-H5LWB3D3.js → chunk-PRMEU7BT.js} +347 -14
- package/{chunk-2ZKFCIJJ.js → chunk-PROOOQZ3.js} +1 -1
- package/{chunk-EUCFKKDM.js → chunk-PVFYPUIM.js} +40 -10
- package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
- package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
- package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
- package/chunk-RETQOQ4D.js +33394 -0
- package/{chunk-AVHRSJUH.js → chunk-RM4UMFY4.js} +32 -25
- package/{chunk-2OLYKYNY.js → chunk-RTHFJZ6M.js} +8 -8
- package/{chunk-OB6DVWPF.js → chunk-S2MHR4PU.js} +164 -4
- package/{chunk-IWQAOW2X.js → chunk-SRCCSTIM.js} +8 -8
- package/{chunk-PVZY6P3S.js → chunk-T6VROBY7.js} +2 -2
- package/{chunk-2KTUDBG7.js → chunk-TEMLHVGX.js} +1 -1
- package/{chunk-TVFRV3UQ.js → chunk-TRHJ4NJB.js} +673 -1279
- package/{chunk-QVBXJNZ2.js → chunk-TUSTONB3.js} +1 -1
- package/{chunk-UMRI2IRY.js → chunk-TWTJV35S.js} +6 -6
- package/{chunk-5OZC7R7Y.js → chunk-U3G7RRXJ.js} +13 -12
- package/{chunk-CXDPIPZ4.js → chunk-UFC4J7OY.js} +3 -3
- package/{chunk-CKT6QUE2.js → chunk-UHW6SCVK.js} +1 -1
- package/{chunk-AGP3YSEC.js → chunk-ULLHVDTZ.js} +48 -3
- package/{chunk-SYQR7FQS.js → chunk-VM72HKW2.js} +97 -29
- package/{chunk-KEN3N2TN.js → chunk-VMJVAJ6W.js} +13 -10
- package/{chunk-53X6PS42.js → chunk-VREG6ANQ.js} +103 -100
- package/{chunk-SOF4OWDM.js → chunk-VS276URX.js} +0 -2
- package/{chunk-SH3IKNCG.js → chunk-VSRISJXZ.js} +15 -8
- package/chunk-WDWZPASX.js +29 -0
- package/chunk-WFGNWWJI.js +326 -0
- package/{chunk-UJKTI5PG.js → chunk-WRKMXMU7.js} +2 -1
- package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
- package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
- package/chunk-X7IA2B7R.js +166 -0
- package/{chunk-5ZMIIR23.js → chunk-XBAEM4RI.js} +7 -0
- package/{chunk-4JVNURX4.js → chunk-XS5A3EKX.js} +1 -23
- package/{chunk-N5Z2V73W.js → chunk-Y2MF4DCJ.js} +1 -1
- package/{chunk-EVYGYDPG.js → chunk-Y5OWZQMJ.js} +39 -30
- package/{chunk-AK5O76CC.js → chunk-YGCOJNFZ.js} +3 -3
- package/{chunk-L5I543VB.js → chunk-YGDYYFRX.js} +20 -24
- package/{chunk-OK4MZRJ6.js → chunk-Z2WZAE4P.js} +128 -149
- package/chunk-Z6YTCDU4.js +24 -0
- package/chunk-ZEKUFJLW.js +1438 -0
- package/{chunk-KN3HEZIQ.js → chunk-ZVOL2MAJ.js} +1 -1
- package/{cliAgentConfigHelpers-PO3MVDME.js → cliAgentConfigHelpers-U5OAVAKQ.js} +12 -12
- package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-S42VMGB6.js} +1 -1
- package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-CNMP3RDX.js} +1 -1
- package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
- package/{cliLocalAgentRecordReader-Z7CH4K4R.js → cliLocalAgentRecordReader-HVZAQCUD.js} +49 -44
- package/{commandRegistry-3JVE76K2.js → commandRegistry-TME7INFU.js} +98 -94
- package/{contentThunks-SRKUHSBR.js → contentThunks-U6OC4R2N.js} +37 -35
- package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-U7XSRVJP.js} +4 -4
- package/{createAgentAutomationAction-B4BQV46J.js → createAgentAutomationAction-IP4LFN3W.js} +37 -35
- package/{createDialogAction-IONSKZIX.js → createDialogAction-IAGQJ3LH.js} +38 -37
- package/{createPageAction-K75KBQOO.js → createPageAction-AZ3UIFKA.js} +38 -36
- package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
- package/{dbSlice-ZJPDIFER.js → dbSlice-DKKMJJYY.js} +13 -12
- package/{deleteFile-Q3YDB4ML.js → deleteFile-TQSONMVU.js} +11 -8
- package/{dialogCommands-6KQEBHSG.js → dialogCommands-PCDRMBWG.js} +60 -55
- package/dialogMessageRecord-OAV77LT7.js +7 -0
- package/{dialogNotifyCommand-WIZFFEY3.js → dialogNotifyCommand-O35MWMOS.js} +13 -13
- package/{dialogSlice-GPALSBQM.js → dialogSlice-QAKYN4DE.js} +35 -33
- package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-2SSLTXKO.js} +3 -3
- package/{docCreateCommands-XZOLWBRC.js → docCreateCommands-CFQFZOAD.js} +54 -48
- package/{docDeleteCommands-ZSO4LGWE.js → docDeleteCommands-5CPNTIIS.js} +56 -50
- package/{docReadCommands-TTMXCDER.js → docReadCommands-XQILYSAJ.js} +54 -48
- package/{docStore-O43KOHIX.js → docStore-GIVRT7TQ.js} +15 -14
- package/{docUpdateCommands-PRG6WOXL.js → docUpdateCommands-VETKSUDD.js} +54 -48
- package/fetchMessages-TQEUZD7H.js +1 -1
- package/{getPricing-YH3VMSVU.js → getPricing-LF5C4XSI.js} +5 -5
- package/{handleSendMessageAction-I2GHUSHZ.js → handleSendMessageAction-HKIW4ZNO.js} +70 -66
- package/{hostCredentialCreate-V775SKCE.js → hostCredentialCreate-6VDJFNDO.js} +118 -105
- package/index.js +56 -18
- package/keys-RWF7UCB4.js +1 -1
- package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
- package/{localDialogRead-SVTPA5GY.js → localDialogRead-AV2VKKPG.js} +1 -1
- package/{localRecall-2J6QPOK2.js → localRecall-BDYKXB46.js} +3 -1
- package/{localRuntimeAdapter-SAMUDW5S.js → localRuntimeAdapter-BQ4F5PZV.js} +120 -108
- package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-WCNA4A3G.js} +4 -2
- package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-CRNIBOOM.js} +1 -1
- package/{machineCommands-ZXZWGMFE.js → machineCommands-K6XIGOAD.js} +142 -115
- package/{machineWsRunDispatch-3ZEI4BEC.js → machineWsRunDispatch-4OO7Z6UM.js} +114 -102
- package/mcpLocalAuthorizeCommand-ZP6ESAGE.js +106 -0
- package/{memberThunks-JRYNONYV.js → memberThunks-PBJPZ2JU.js} +22 -17
- package/{memoryCommands-5WC3T66U.js → memoryCommands-BC6REPQB.js} +4 -4
- package/{models-CXINDUJA.js → models-H5NNZRLH.js} +2 -2
- package/{overlay-THLKYIWY.js → overlay-JA3SPVUS.js} +7 -3
- package/package.json +1 -1
- package/{projectArchive-V7EYBAX6.js → projectArchive-G7AOQPRW.js} +43 -41
- package/{providerPresetApply-SHT2SUVB.js → providerPresetApply-OPBCAONX.js} +6 -6
- package/{providerRegistry-TA7EGCVZ.js → providerRegistry-J2HCVTHE.js} +6 -6
- package/{read-Q7GOHGNP.js → read-JEGPITEW.js} +10 -9
- package/{readDocTool-Z5OQ6422.js → readDocTool-TE3XIU4Y.js} +1 -1
- package/{readlineWorkspace-S4VRNWYG.js → readlineWorkspace-SOW5QUGZ.js} +4412 -4279
- package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-CX3OAH4Y.js} +17 -16
- package/{runAgentClientLoop-MQLOUDF5.js → runAgentClientLoop-HQJPDFGQ.js} +95 -70
- package/{runtimeDoctorCommands-I47JN4HS.js → runtimeDoctorCommands-GUH2YGMH.js} +17 -17
- package/{secretCommands-LJXOOYA7.js → secretCommands-NJXFVHZU.js} +4 -4
- package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-CGM67EEQ.js} +16 -15
- package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-3ABWPPXR.js} +17 -16
- package/{settingThunks-AXTBX3Q5.js → settingThunks-AY76OHYX.js} +181 -62
- package/{skillDiscovery-B5V23AXP.js → skillDiscovery-MDDKPTW3.js} +4 -3
- package/{spaceCommands-IB6FKWIC.js → spaceCommands-G63QGYQO.js} +59 -53
- package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
- package/{streamAgentChatTurn-GMNIKJVL.js → streamAgentChatTurn-E3XH2KFD.js} +160 -155
- package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-G6EZRKCQ.js} +15 -14
- package/{tableCommands-HITDSLHS.js → tableCommands-JI75ZHDI.js} +14 -11
- package/{toolApiClient-OGQEBQVX.js → toolApiClient-62UUPDUA.js} +3 -5
- package/{tools-MWIF3S4T.js → tools-7RSX22FT.js} +64 -59
- package/tuiRestart-KAAA7TND.js +41 -0
- package/{tuiSummaryLlmCaller-7LWYTHLM.js → tuiSummaryLlmCaller-BVNHMWLR.js} +19 -19
- package/{updateCommands-RJVCRSBP.js → updateCommands-ASK5XYPH.js} +8 -6
- package/{updateDialogTitleAction-ZXHMZFSX.js → updateDialogTitleAction-SEWV252V.js} +37 -35
- package/{usageCommand-RVKHEPLU.js → usageCommand-JVT5J3DC.js} +3 -3
- package/{usageRebuildCommand-GRAFOZF2.js → usageRebuildCommand-IZYYUTEW.js} +4 -4
- package/webapi-24RZDIIQ.js +2488 -0
- package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-BSDIS2J5.js} +2 -2
- package/workContext-MM3P5GP5.js +13 -0
- package/workContextAccess-UZHDLBUR.js +11 -0
- package/workContextWriteNotice-YCSSMHN4.js +7 -0
- package/agentRecordCommands-S2IVVEES.js +0 -177
- package/chunk-2THCNKE4.js +0 -147
- package/chunk-2WZXXAQD.js +0 -57
- package/chunk-652XYZGP.js +0 -352
- package/chunk-BJF2MHJ3.js +0 -118
- package/chunk-KEPOVMF4.js +0 -91
- package/chunk-OXKUPBAQ.js +0 -776
- package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
- package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
- package/{chunk-47ITIXO7.js → chunk-USGHJSGO.js} +3 -3
- package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +3 -3
- package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-YIZ7KLUP.js} +3 -3
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
chooseMemoryOwners,
|
|
3
|
-
loadMemoryCandidatesFromDb
|
|
4
|
-
} from "./chunk-BJF2MHJ3.js";
|
|
5
1
|
import {
|
|
6
2
|
addContentToSpace
|
|
7
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FZKA3XFA.js";
|
|
8
4
|
import {
|
|
9
|
-
prepareAndPersistMessage
|
|
10
|
-
|
|
11
|
-
uiAskChoiceFunctionSchema
|
|
12
|
-
} from "./chunk-S7RA7A4X.js";
|
|
5
|
+
prepareAndPersistMessage
|
|
6
|
+
} from "./chunk-B7DE5XJW.js";
|
|
13
7
|
import {
|
|
14
8
|
require_format
|
|
15
9
|
} from "./chunk-BUDVRYES.js";
|
|
@@ -22,29 +16,34 @@ import {
|
|
|
22
16
|
removeCachedEntity,
|
|
23
17
|
upsertSSREntity,
|
|
24
18
|
write
|
|
25
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RM4UMFY4.js";
|
|
26
20
|
import {
|
|
27
21
|
isDevelopment
|
|
28
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ULLHVDTZ.js";
|
|
29
23
|
import {
|
|
30
24
|
selectIdentityUserId
|
|
31
25
|
} from "./chunk-PXYBUFDB.js";
|
|
32
26
|
import {
|
|
33
27
|
extractCustomId
|
|
34
28
|
} from "./chunk-M2EJHDJP.js";
|
|
29
|
+
import {
|
|
30
|
+
createMemoryKey,
|
|
31
|
+
memoryOwnerRange,
|
|
32
|
+
memorySubjectKindRange
|
|
33
|
+
} from "./chunk-SYTHYBMI.js";
|
|
35
34
|
import {
|
|
36
35
|
createDialogKey,
|
|
37
36
|
dialogMessageRange
|
|
38
37
|
} from "./chunk-OJKUU3LP.js";
|
|
38
|
+
import {
|
|
39
|
+
asOptionalPositiveFiniteNumber
|
|
40
|
+
} from "./chunk-U6VC4MU4.js";
|
|
39
41
|
import {
|
|
40
42
|
asTrimmedString
|
|
41
43
|
} from "./chunk-3EUW3WEO.js";
|
|
42
44
|
import {
|
|
43
45
|
isRecord
|
|
44
46
|
} from "./chunk-KUG52IAP.js";
|
|
45
|
-
import {
|
|
46
|
-
asOptionalPositiveFiniteNumber
|
|
47
|
-
} from "./chunk-U6VC4MU4.js";
|
|
48
47
|
import {
|
|
49
48
|
asOptionalTrimmedString
|
|
50
49
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -56,6 +55,226 @@ import {
|
|
|
56
55
|
var import_format = __toESM(require_format());
|
|
57
56
|
var import_formatISO = __toESM(require_formatISO());
|
|
58
57
|
|
|
58
|
+
// packages/ai/tools/uiAskChoiceTool.ts
|
|
59
|
+
var uiAskChoiceFunctionSchema = {
|
|
60
|
+
name: "ask_user",
|
|
61
|
+
description: "\u8BA9\u7528\u6237\u5728\u4E00\u7EC4\u9009\u9879\u4E4B\u95F4\u505A\u9009\u62E9\uFF08\u5355\u9009\u6216\u591A\u9009\uFF09\u7684\u901A\u7528\u201C\u51FA\u9009\u9879\u201D\u5DE5\u5177\uFF08\u9700\u6C42\u6A21\u7CCA\u3001\u5206\u652F\u51B3\u7B56\u3001\u95EE\u5377\u7B49\uFF09\u3002\u672C\u5DE5\u5177\u7528\u4E8E\u7EAF\u63D0\u95EE\u3001\u7B49\u5F85\u7528\u6237\u56DE\u7B54\u7684\u573A\u666F\uFF08blocking:false \u65F6\u4E0D\u6682\u505C\u7B49\u5F85\uFF09\uFF1B\u82E5\u9700\u8981\u540C\u65F6\u5C55\u793A\u7ED3\u6784\u5316\u5BF9\u6BD4/\u6307\u6807\u5E76\u8BA9\u7528\u6237\u5728\u540C\u4E00\u5757\u91CC\u9009\u62E9\uFF0C\u8D70 show_interaction\u3002\u8C03\u7528\u524D\u987B\u5148\u5728\u666E\u901A\u56DE\u590D\u6587\u672C\u91CC\u89E3\u91CA\u80CC\u666F\u4E0E\u6743\u8861\uFF08\u5148\u89E3\u91CA\uFF0C\u518D\u8C03\u7528\uFF09\u3002\u591A\u95EE\u9898\u4F20 questions\uFF0C\u5355\u95EE\u9898\u4F20 question+choices\u3002\u754C\u9762\u9ED8\u8BA4\u63D0\u4F9B\u201C\u5176\u4ED6\u201D\u81EA\u7531\u8F93\u5165\u884C\uFF08\u53EF\u7528 allowOther:false \u5173\u95ED\uFF09\uFF0C\u7528\u6237\u8F93\u5165\u7684\u6587\u5B57\u4F1A\u968F\u7B54\u6848\u56DE\u4F20\uFF1B\u4E0D\u8981\u81EA\u5EFA\u201C\u5176\u4ED6/\u81EA\u5DF1\u5199\u201D\u4E4B\u7C7B\u7684\u9009\u9879\u2014\u2014\u70B9\u51FB\u666E\u901A\u9009\u9879\u53EA\u56DE\u4F20\u8BE5\u9009\u9879\u6587\u6848\uFF0C\u7528\u6237\u65E0\u5904\u586B\u5199\u3002",
|
|
62
|
+
parameters: {
|
|
63
|
+
type: "object",
|
|
64
|
+
properties: {
|
|
65
|
+
question: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description: "\u5C55\u793A\u7ED9\u7528\u6237\u7684\u95EE\u9898\u6587\u6848\uFF08\u5355\u95EE\u9898\u6A21\u5F0F\uFF09\u3002\u4E0E questions \u4E8C\u9009\u4E00\u3002"
|
|
68
|
+
},
|
|
69
|
+
choices: {
|
|
70
|
+
type: "array",
|
|
71
|
+
description: "\u5907\u9009\u9879\u5217\u8868\uFF0C\u6E32\u67D3\u4E3A\u6309\u94AE\u4F9B\u7528\u6237\u70B9\u51FB\u3002",
|
|
72
|
+
items: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
id: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "\u9009\u9879\u6807\u8BC6\u3002"
|
|
78
|
+
},
|
|
79
|
+
label: {
|
|
80
|
+
type: "string",
|
|
81
|
+
description: "\u6309\u94AE\u6587\u5B57\uFF0C\u5982\u201C\u751F\u6210\u672C\u5468\u5468\u62A5\u201D\u3002"
|
|
82
|
+
},
|
|
83
|
+
detail: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "\u7B80\u77ED\u8865\u5145\uFF08\u5EFA\u8BAE\u4E00\u53E5\u8BDD\uFF09\uFF0C\u957F\u89E3\u91CA\u5199\u8FDB\u8C03\u7528\u524D\u7684\u56DE\u590D\u6587\u672C\u3002"
|
|
86
|
+
},
|
|
87
|
+
userMessage: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "\u70B9\u51FB\u540E\u4F5C\u4E3A\u4E0B\u4E00\u6761 user \u6D88\u606F\u53D1\u9001\u7684\u6587\u6848\uFF08\u7559\u7A7A\u9ED8\u8BA4\u7528 label\uFF09\u3002"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
required: ["id", "label"]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
questions: {
|
|
96
|
+
type: "array",
|
|
97
|
+
description: "\u591A\u95EE\u9898\u6A21\u5F0F\uFF08\u591A tab \u6E32\u67D3\uFF0C\u4E0E question+choices \u4E8C\u9009\u4E00\uFF09\u3002",
|
|
98
|
+
items: {
|
|
99
|
+
type: "object",
|
|
100
|
+
properties: {
|
|
101
|
+
id: {
|
|
102
|
+
type: "string",
|
|
103
|
+
description: "\u95EE\u9898\u6807\u8BC6\u3002"
|
|
104
|
+
},
|
|
105
|
+
header: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "\u591A\u95EE\u9898 tab \u680F\u663E\u793A\u7684\u77ED\u6807\u7B7E\uFF08\u226412 \u5B57\u7B26\uFF0C\u5982\u201C\u683C\u5F0F/\u8BED\u8A00/\u8303\u56F4\u201D\uFF09\uFF0C\u7F3A\u7701\u7528 Qn\u3002"
|
|
108
|
+
},
|
|
109
|
+
question: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "\u95EE\u9898\u6587\u6848\u3002"
|
|
112
|
+
},
|
|
113
|
+
choices: {
|
|
114
|
+
type: "array",
|
|
115
|
+
description: "\u8BE5\u95EE\u9898\u7684\u5907\u9009\u9879\u3002",
|
|
116
|
+
items: {
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
id: { type: "string" },
|
|
120
|
+
label: { type: "string" },
|
|
121
|
+
detail: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "\u7B80\u77ED\u8865\u5145\uFF08\u5EFA\u8BAE\u4E00\u53E5\u8BDD\uFF09\uFF0C\u957F\u89E3\u91CA\u5199\u8FDB\u8C03\u7528\u524D\u7684\u56DE\u590D\u6587\u672C\u3002"
|
|
124
|
+
},
|
|
125
|
+
userMessage: { type: "string" }
|
|
126
|
+
},
|
|
127
|
+
required: ["id", "label"]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
multiSelect: {
|
|
131
|
+
type: "boolean",
|
|
132
|
+
description: "\u5141\u8BB8\u591A\u9009\uFF0C\u9ED8\u8BA4 false\u3002"
|
|
133
|
+
},
|
|
134
|
+
allowOther: {
|
|
135
|
+
type: "boolean",
|
|
136
|
+
description: "\u663E\u793A\u201C\u5176\u4ED6\u201D\u81EA\u7531\u8F93\u5165\u884C\uFF0C\u9ED8\u8BA4 true\u3002"
|
|
137
|
+
},
|
|
138
|
+
required: {
|
|
139
|
+
type: "boolean",
|
|
140
|
+
description: "\u662F\u5426\u5FC5\u987B\u56DE\u7B54\u624D\u80FD\u63D0\u4EA4\uFF0C\u9ED8\u8BA4 true\u3002"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
required: ["id", "question", "choices"]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
blocking: {
|
|
147
|
+
type: "boolean",
|
|
148
|
+
description: "\u662F\u5426\u7B49\u5F85\u7528\u6237\u9009\u62E9\u540E\u518D\u7EE7\u7EED\u6D41\u7A0B\uFF0C\u9ED8\u8BA4 true\u3002"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
required: []
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
function validateChoiceList(choices, scopeLabel) {
|
|
155
|
+
const seenChoiceIds = /* @__PURE__ */ new Set();
|
|
156
|
+
for (let index = 0; index < choices.length; index += 1) {
|
|
157
|
+
const entry = choices[index];
|
|
158
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
159
|
+
return `${scopeLabel}.choices[${index}] \u5FC5\u987B\u662F\u5BF9\u8C61\u3002`;
|
|
160
|
+
}
|
|
161
|
+
const choice = entry;
|
|
162
|
+
if (typeof choice.label !== "string" || !choice.label.trim()) {
|
|
163
|
+
return `${scopeLabel}.choices[${index}].label \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\u3002`;
|
|
164
|
+
}
|
|
165
|
+
if (choice.id !== void 0 && typeof choice.id !== "string") {
|
|
166
|
+
return `${scopeLabel}.choices[${index}].id \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u3002`;
|
|
167
|
+
}
|
|
168
|
+
const choiceId = typeof choice.id === "string" ? choice.id.trim() : "";
|
|
169
|
+
if (choiceId && seenChoiceIds.has(choiceId)) {
|
|
170
|
+
return `${scopeLabel} \u5185\u7684\u9009\u9879 id "${choiceId}" \u91CD\u590D\u3002`;
|
|
171
|
+
}
|
|
172
|
+
if (choiceId) seenChoiceIds.add(choiceId);
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function validateAskChoiceInput(raw) {
|
|
177
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
178
|
+
return "ask_user \u9700\u8981\u4E00\u4E2A\u5BF9\u8C61\u53C2\u6570\u3002";
|
|
179
|
+
}
|
|
180
|
+
const args = raw;
|
|
181
|
+
if (args.blocking !== void 0 && typeof args.blocking !== "boolean") {
|
|
182
|
+
return "ask_user \u7684 blocking \u5FC5\u987B\u662F\u5E03\u5C14\u503C\u3002";
|
|
183
|
+
}
|
|
184
|
+
const rawQuestions = args.questions;
|
|
185
|
+
if (rawQuestions !== void 0 && !Array.isArray(rawQuestions)) {
|
|
186
|
+
return "ask_user \u7684 questions \u5FC5\u987B\u662F\u6570\u7EC4\u3002";
|
|
187
|
+
}
|
|
188
|
+
const questions = rawQuestions;
|
|
189
|
+
if (questions && questions.length > 0) {
|
|
190
|
+
const seenQuestionIds = /* @__PURE__ */ new Set();
|
|
191
|
+
for (let index = 0; index < questions.length; index += 1) {
|
|
192
|
+
const entry = questions[index];
|
|
193
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
194
|
+
return `questions[${index}] \u5FC5\u987B\u662F\u5BF9\u8C61\u3002`;
|
|
195
|
+
}
|
|
196
|
+
const question = entry;
|
|
197
|
+
if (question.id !== void 0 && typeof question.id !== "string") {
|
|
198
|
+
return `questions[${index}].id \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u3002`;
|
|
199
|
+
}
|
|
200
|
+
const questionId = typeof question.id === "string" ? question.id.trim() : "";
|
|
201
|
+
if (questionId && seenQuestionIds.has(questionId)) {
|
|
202
|
+
return `\u95EE\u9898 id "${questionId}" \u91CD\u590D\u3002`;
|
|
203
|
+
}
|
|
204
|
+
if (questionId) seenQuestionIds.add(questionId);
|
|
205
|
+
if (typeof question.question !== "string" || !question.question.trim()) {
|
|
206
|
+
return `questions[${index}].question \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\u3002`;
|
|
207
|
+
}
|
|
208
|
+
for (const flag of ["multiSelect", "allowOther", "required"]) {
|
|
209
|
+
if (question[flag] !== void 0 && typeof question[flag] !== "boolean") {
|
|
210
|
+
return `questions[${index}].${flag} \u5FC5\u987B\u662F\u5E03\u5C14\u503C\u3002`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const choices = question.choices;
|
|
214
|
+
if (!Array.isArray(choices)) {
|
|
215
|
+
return `questions[${index}].choices \u5FC5\u987B\u662F\u6570\u7EC4\u3002`;
|
|
216
|
+
}
|
|
217
|
+
const choiceError = validateChoiceList(choices, `questions[${index}]`);
|
|
218
|
+
if (choiceError) return choiceError;
|
|
219
|
+
if (choices.length === 0 && question.allowOther === false) {
|
|
220
|
+
return `questions[${index}] \u6CA1\u6709\u4EFB\u4F55\u9009\u9879\u4E14 allowOther \u4E3A false\uFF0C\u7528\u6237\u65E0\u6CD5\u4F5C\u7B54\u3002`;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
if (typeof args.question !== "string" || !args.question.trim()) {
|
|
226
|
+
return "ask_user \u9700\u8981 question\uFF08\u975E\u7A7A\u5B57\u7B26\u4E32\uFF09\u4E0E choices\u3002";
|
|
227
|
+
}
|
|
228
|
+
if (!Array.isArray(args.choices) || args.choices.length === 0) {
|
|
229
|
+
return "ask_user \u9700\u8981 question\uFF08\u975E\u7A7A\u5B57\u7B26\u4E32\uFF09\u4E0E choices\u3002";
|
|
230
|
+
}
|
|
231
|
+
return validateChoiceList(args.choices, "ask_user");
|
|
232
|
+
}
|
|
233
|
+
async function uiAskChoiceFunc(args, _thunkApi) {
|
|
234
|
+
const invalid = validateAskChoiceInput(args);
|
|
235
|
+
if (invalid) throw new Error(invalid);
|
|
236
|
+
const blocking = args?.blocking !== false;
|
|
237
|
+
if (Array.isArray(args?.questions) && args.questions.length > 0) {
|
|
238
|
+
const firstQ = args.questions[0];
|
|
239
|
+
return {
|
|
240
|
+
rawData: {
|
|
241
|
+
type: "ask_user",
|
|
242
|
+
question: firstQ?.question ?? "",
|
|
243
|
+
choices: firstQ?.choices ?? [],
|
|
244
|
+
blocking,
|
|
245
|
+
questions: args.questions
|
|
246
|
+
},
|
|
247
|
+
displayData: args.questions.map((q) => q.question).join(" / ")
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
const question = String(args?.question ?? "").trim();
|
|
251
|
+
const choices = Array.isArray(args?.choices) ? args.choices : [];
|
|
252
|
+
if (!question || choices.length === 0) {
|
|
253
|
+
throw new Error("ask_user \u9700\u8981 question+choices \u6216 questions\u3002");
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
rawData: {
|
|
257
|
+
type: "ask_user",
|
|
258
|
+
question,
|
|
259
|
+
choices,
|
|
260
|
+
blocking
|
|
261
|
+
},
|
|
262
|
+
displayData: question
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function parseUiAskChoiceContent(rawContent) {
|
|
266
|
+
const parsed = typeof rawContent === "string" ? (() => {
|
|
267
|
+
try {
|
|
268
|
+
return JSON.parse(rawContent);
|
|
269
|
+
} catch {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
})() : rawContent;
|
|
273
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
274
|
+
if (parsed.type !== "ask_user") return null;
|
|
275
|
+
return parsed;
|
|
276
|
+
}
|
|
277
|
+
|
|
59
278
|
// packages/ai/memory/policy.ts
|
|
60
279
|
function isPublicAgentKey(agentKey) {
|
|
61
280
|
return typeof agentKey === "string" && /^agent-pub-/i.test(agentKey.trim());
|
|
@@ -261,6 +480,113 @@ var mergeGreetingWithRelationshipRecap = (input) => {
|
|
|
261
480
|
\u5982\u679C\u4F60\u8FD8\u60F3\u63A5\u7740\u90A3\u4E2A\u70B9\u7EE7\u7EED\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4ECE\u90A3\u91CC\u5F80\u4E0B\u8D70\uFF1B\u5982\u679C\u60F3\u6362\u4E2A\u65B9\u5411\u4E5F\u53EF\u4EE5\u3002`;
|
|
262
481
|
};
|
|
263
482
|
|
|
483
|
+
// packages/ai/memory/queryShared.ts
|
|
484
|
+
var chooseMemoryOwners = (input) => {
|
|
485
|
+
const owners = [];
|
|
486
|
+
if (input.userId) {
|
|
487
|
+
owners.push({ ownerType: "user", ownerId: input.userId });
|
|
488
|
+
}
|
|
489
|
+
if (input.spaceId) {
|
|
490
|
+
owners.push({ ownerType: "space", ownerId: input.spaceId });
|
|
491
|
+
}
|
|
492
|
+
return owners;
|
|
493
|
+
};
|
|
494
|
+
var loadOwnerItemsFromDb = async (db, owner, limit) => {
|
|
495
|
+
const range = memoryOwnerRange(owner.ownerType, owner.ownerId);
|
|
496
|
+
const refs = [];
|
|
497
|
+
for await (const [, value] of db.iterator({
|
|
498
|
+
gte: range.start,
|
|
499
|
+
lte: range.end,
|
|
500
|
+
reverse: true
|
|
501
|
+
})) {
|
|
502
|
+
refs.push(value ?? {});
|
|
503
|
+
if (refs.length >= limit) break;
|
|
504
|
+
}
|
|
505
|
+
const items = await Promise.all(
|
|
506
|
+
refs.map(
|
|
507
|
+
(ref) => typeof ref?.memoryId === "string" ? db.get(createMemoryKey(owner.ownerType, owner.ownerId, ref.memoryId)).catch(() => null) : Promise.resolve(null)
|
|
508
|
+
)
|
|
509
|
+
);
|
|
510
|
+
return items.filter((item) => !!item);
|
|
511
|
+
};
|
|
512
|
+
var loadSubjectKindItemsFromDb = async (db, subject, kind, limit) => {
|
|
513
|
+
const range = memorySubjectKindRange(subject.subjectType, subject.subjectId, kind);
|
|
514
|
+
const refs = [];
|
|
515
|
+
for await (const [, value] of db.iterator({
|
|
516
|
+
gte: range.start,
|
|
517
|
+
lte: range.end,
|
|
518
|
+
reverse: true
|
|
519
|
+
})) {
|
|
520
|
+
refs.push(value ?? {});
|
|
521
|
+
if (refs.length >= limit) break;
|
|
522
|
+
}
|
|
523
|
+
const items = await Promise.all(
|
|
524
|
+
refs.map(
|
|
525
|
+
(ref) => typeof ref?.memoryKey === "string" ? db.get(ref.memoryKey).catch(() => null) : Promise.resolve(null)
|
|
526
|
+
)
|
|
527
|
+
);
|
|
528
|
+
return items.filter((item) => !!item);
|
|
529
|
+
};
|
|
530
|
+
var loadMemoryCandidatesFromDb = async (db, input) => {
|
|
531
|
+
const kinds = input.kinds ?? ["episodic", "semantic", "procedural"];
|
|
532
|
+
const ownerLimit = input.ownerLimit ?? 12;
|
|
533
|
+
const ownerFallback = input.ownerFallback ?? "onSubjectMiss";
|
|
534
|
+
const reserve = Math.max(0, input.corroboratedProceduralReserve ?? 0);
|
|
535
|
+
const ownerKeySet = new Set(
|
|
536
|
+
input.owners.filter((owner) => owner.ownerId).map((owner) => `${owner.ownerType}:${owner.ownerId}`)
|
|
537
|
+
);
|
|
538
|
+
const subjects = input.subjects.filter(
|
|
539
|
+
(subject) => !!subject.subjectId
|
|
540
|
+
);
|
|
541
|
+
const subjectResults = subjects.length > 0 ? await Promise.all(
|
|
542
|
+
subjects.flatMap(
|
|
543
|
+
(subject) => kinds.map(
|
|
544
|
+
(kind) => loadSubjectKindItemsFromDb(db, subject, kind, ownerLimit)
|
|
545
|
+
)
|
|
546
|
+
)
|
|
547
|
+
) : [];
|
|
548
|
+
const subjectHitCount = subjectResults.reduce((sum, items) => sum + items.length, 0);
|
|
549
|
+
const shouldLoadOwnerFallback = ownerFallback !== "never" && (subjects.length === 0 || subjectHitCount === 0 || ownerFallback === "always");
|
|
550
|
+
const results = shouldLoadOwnerFallback ? await Promise.all(
|
|
551
|
+
[
|
|
552
|
+
...subjectResults,
|
|
553
|
+
...input.owners.map((owner) => loadOwnerItemsFromDb(db, owner, ownerLimit))
|
|
554
|
+
]
|
|
555
|
+
) : subjectResults;
|
|
556
|
+
if (reserve > 0 && kinds.includes("procedural")) {
|
|
557
|
+
const probeLimit = ownerLimit * 2;
|
|
558
|
+
const reserveResults = await Promise.all(
|
|
559
|
+
subjects.map(
|
|
560
|
+
(subject) => loadSubjectKindItemsFromDb(db, subject, "procedural", probeLimit)
|
|
561
|
+
)
|
|
562
|
+
);
|
|
563
|
+
const corroborated = reserveResults.flat().filter((item) => item && item.recurrenceEvidence).sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, reserve);
|
|
564
|
+
for (const item of corroborated) {
|
|
565
|
+
results.push([item]);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
const kindSet = new Set(kinds);
|
|
569
|
+
const seen = /* @__PURE__ */ new Set();
|
|
570
|
+
const merged = [];
|
|
571
|
+
for (const items of results) {
|
|
572
|
+
for (const item of items) {
|
|
573
|
+
if (seen.has(item.id)) continue;
|
|
574
|
+
if (!kindSet.has(item.kind)) continue;
|
|
575
|
+
if (ownerKeySet.size > 0 && !ownerKeySet.has(`${item.ownerType}:${item.ownerId}`)) {
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
if (!shouldLoadOwnerFallback && subjects.length > 0 && !subjects.some(
|
|
579
|
+
(subject) => subject.subjectType === item.subjectType && subject.subjectId === item.subjectId
|
|
580
|
+
)) {
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
seen.add(item.id);
|
|
584
|
+
merged.push(item);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return merged;
|
|
588
|
+
};
|
|
589
|
+
|
|
264
590
|
// packages/ai/memory/understandingGreeting.ts
|
|
265
591
|
var UNDERSTANDING_TAG = "understanding-memory";
|
|
266
592
|
var facetPriority = {
|
|
@@ -744,8 +1070,15 @@ var createDialogAction = async (args, thunkApi) => {
|
|
|
744
1070
|
};
|
|
745
1071
|
|
|
746
1072
|
export {
|
|
1073
|
+
uiAskChoiceFunctionSchema,
|
|
1074
|
+
validateAskChoiceInput,
|
|
1075
|
+
uiAskChoiceFunc,
|
|
1076
|
+
parseUiAskChoiceContent,
|
|
747
1077
|
resolveAgentMemoryPolicy,
|
|
748
1078
|
buildMemorySubjectsForAgent,
|
|
1079
|
+
chooseMemoryOwners,
|
|
1080
|
+
loadOwnerItemsFromDb,
|
|
1081
|
+
loadMemoryCandidatesFromDb,
|
|
749
1082
|
isLocalOwnerDialogAgents,
|
|
750
1083
|
createDialogAction
|
|
751
1084
|
};
|
|
@@ -30,6 +30,7 @@ var estimateTokens = (text) => {
|
|
|
30
30
|
}
|
|
31
31
|
return Math.ceil(cjk * 1.5 + ascii / 4);
|
|
32
32
|
};
|
|
33
|
+
var estimateMemoryBlockTokens = estimateTokens;
|
|
33
34
|
var OVERLAY_HEADER_LINES = [
|
|
34
35
|
"--- Memory (\u76F8\u5173\u65F6\u53C2\u8003\uFF0C\u7528\u6237\u8F93\u5165\u4F18\u5148) ---",
|
|
35
36
|
""
|
|
@@ -40,6 +41,13 @@ var KIND_PRIORITY = {
|
|
|
40
41
|
procedural: 1,
|
|
41
42
|
episodic: 2
|
|
42
43
|
};
|
|
44
|
+
var emptyMemoryInjectionObservation = () => ({
|
|
45
|
+
vnextInjectedLines: 0,
|
|
46
|
+
legacyUncoveredInjectedLines: 0,
|
|
47
|
+
unattributedInjectedLines: 0,
|
|
48
|
+
totalInjectedLines: 0,
|
|
49
|
+
empty: true
|
|
50
|
+
});
|
|
43
51
|
var FACET_DISPLAY = {
|
|
44
52
|
unfinished: { label: "\u8FD8\u6CA1\u5B9A\u4E0B", strip: "\u8FD8\u6CA1\u51B3\u5B9A" },
|
|
45
53
|
tension: { label: "\u5728\u6743\u8861", strip: "\u5728\u6743\u8861" },
|
|
@@ -100,7 +108,7 @@ var truncateLineToTokens = (lineText, budgetTokens) => {
|
|
|
100
108
|
if (cut <= 2) return null;
|
|
101
109
|
return `${lineText.slice(0, cut).trimEnd()}${TRUNCATED_SUFFIX}`;
|
|
102
110
|
};
|
|
103
|
-
var fitLinesToBudget = (allLines, remainingBudget) => {
|
|
111
|
+
var fitLinesToBudget = (allLines, remainingBudget, onKept) => {
|
|
104
112
|
let usedTokens = 0;
|
|
105
113
|
const keptByKind = {};
|
|
106
114
|
let truncatedCount = 0;
|
|
@@ -118,6 +126,7 @@ var fitLinesToBudget = (allLines, remainingBudget) => {
|
|
|
118
126
|
if (candidate.lineTokens <= remaining) {
|
|
119
127
|
usedTokens += candidate.lineTokens;
|
|
120
128
|
pushLine(candidate.kind, candidate.lineText);
|
|
129
|
+
onKept(candidate);
|
|
121
130
|
continue;
|
|
122
131
|
}
|
|
123
132
|
const truncated = truncateLineToTokens(candidate.lineText, remaining);
|
|
@@ -127,6 +136,7 @@ var fitLinesToBudget = (allLines, remainingBudget) => {
|
|
|
127
136
|
}
|
|
128
137
|
usedTokens += estimateTokens(truncated);
|
|
129
138
|
pushLine(candidate.kind, truncated);
|
|
139
|
+
onKept(candidate);
|
|
130
140
|
truncatedCount += 1;
|
|
131
141
|
}
|
|
132
142
|
return { keptByKind, truncatedCount, droppedCount };
|
|
@@ -141,7 +151,7 @@ var EMPTY_RESIDENT_FIT = {
|
|
|
141
151
|
truncatedCount: 0,
|
|
142
152
|
droppedCount: 0
|
|
143
153
|
};
|
|
144
|
-
var fitResidentLines = (lines, remainingBudget) => {
|
|
154
|
+
var fitResidentLines = (lines, remainingBudget, onKept) => {
|
|
145
155
|
let usedTokens = 0;
|
|
146
156
|
const keptLines = [];
|
|
147
157
|
let truncatedCount = 0;
|
|
@@ -155,6 +165,7 @@ var fitResidentLines = (lines, remainingBudget) => {
|
|
|
155
165
|
if (candidate.lineTokens <= remaining) {
|
|
156
166
|
usedTokens += candidate.lineTokens;
|
|
157
167
|
keptLines.push(candidate.lineText);
|
|
168
|
+
onKept(candidate);
|
|
158
169
|
continue;
|
|
159
170
|
}
|
|
160
171
|
const truncated = truncateLineToTokens(candidate.lineText, remaining);
|
|
@@ -164,6 +175,7 @@ var fitResidentLines = (lines, remainingBudget) => {
|
|
|
164
175
|
}
|
|
165
176
|
usedTokens += estimateTokens(truncated);
|
|
166
177
|
keptLines.push(truncated);
|
|
178
|
+
onKept(candidate);
|
|
167
179
|
truncatedCount += 1;
|
|
168
180
|
}
|
|
169
181
|
return { keptLines, truncatedCount, droppedCount };
|
|
@@ -186,7 +198,22 @@ var buildBudgetFooter = (fit, residentFit) => {
|
|
|
186
198
|
return [`\uFF08${notices.join("\u3001")}\uFF1B\u9700\u8981\u5B8C\u6574\u5185\u5BB9\u6216\u66F4\u591A\u76F8\u5173\u8BB0\u5FC6\u65F6\u7528 queryMemory \u68C0\u7D22\uFF09`];
|
|
187
199
|
};
|
|
188
200
|
var buildMemoryOverlay = (items, options) => {
|
|
189
|
-
|
|
201
|
+
const injection = emptyMemoryInjectionObservation();
|
|
202
|
+
const onKept = (line) => {
|
|
203
|
+
injection.totalInjectedLines++;
|
|
204
|
+
injection.empty = false;
|
|
205
|
+
if (line.source === "vnext") injection.vnextInjectedLines++;
|
|
206
|
+
else if (line.source === "legacy-uncovered") injection.legacyUncoveredInjectedLines++;
|
|
207
|
+
else injection.unattributedInjectedLines++;
|
|
208
|
+
};
|
|
209
|
+
const finish = (prompt) => {
|
|
210
|
+
try {
|
|
211
|
+
options?.injectionEmit?.(injection);
|
|
212
|
+
} catch {
|
|
213
|
+
}
|
|
214
|
+
return prompt;
|
|
215
|
+
};
|
|
216
|
+
if (items.length === 0) return finish(null);
|
|
190
217
|
const maxTokens = options?.maxTokens ?? DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET;
|
|
191
218
|
const perKindLimit = options?.perKindLimit ?? 3;
|
|
192
219
|
const residentMaxTokens = options?.residentMaxTokens ?? RESIDENT_MEMORY_OVERLAY_TOKEN_BUDGET;
|
|
@@ -195,9 +222,10 @@ var buildMemoryOverlay = (items, options) => {
|
|
|
195
222
|
const residentFit = residentItems.length === 0 ? EMPTY_RESIDENT_FIT : fitResidentLines(
|
|
196
223
|
residentItems.map((item) => {
|
|
197
224
|
const lineText = `- ${isInferredMemory(item) ? "\uFF08\u63A8\u65AD\uFF09" : ""}${normalizeDisplayContent(item)}`;
|
|
198
|
-
return { kind: item.kind, lineText, lineTokens: estimateTokens(lineText) };
|
|
225
|
+
return { kind: item.kind, lineText, lineTokens: estimateTokens(lineText), source: options?.sources?.get(item) };
|
|
199
226
|
}),
|
|
200
|
-
residentMaxTokens - estimateTokens(RESIDENT_SECTION_HEADER)
|
|
227
|
+
residentMaxTokens - estimateTokens(RESIDENT_SECTION_HEADER),
|
|
228
|
+
onKept
|
|
201
229
|
);
|
|
202
230
|
const byKind = {
|
|
203
231
|
episodic: [],
|
|
@@ -214,10 +242,10 @@ var buildMemoryOverlay = (items, options) => {
|
|
|
214
242
|
const allLines = Object.entries(byKind).filter(([, list]) => list.length > 0).flatMap(
|
|
215
243
|
([kind, list]) => pickWithinKind(list, perKindLimit).map((item) => {
|
|
216
244
|
const lineText = `- ${isInferredMemory(item) ? "\uFF08\u63A8\u65AD\uFF09" : ""}${normalizeDisplayContent(item)}`;
|
|
217
|
-
return { kind, lineText, lineTokens: estimateTokens(lineText) };
|
|
245
|
+
return { kind, lineText, lineTokens: estimateTokens(lineText), source: options?.sources?.get(item) };
|
|
218
246
|
})
|
|
219
247
|
).sort((a, b) => (KIND_PRIORITY[a.kind] ?? 99) - (KIND_PRIORITY[b.kind] ?? 99));
|
|
220
|
-
retrievalFit = fitLinesToBudget(allLines, remainingBudget);
|
|
248
|
+
retrievalFit = fitLinesToBudget(allLines, remainingBudget, onKept);
|
|
221
249
|
const kindOrder = ["semantic", "procedural", "episodic"];
|
|
222
250
|
retrievalSections = kindOrder.filter(
|
|
223
251
|
(kind) => retrievalFit.keptByKind[kind] && retrievalFit.keptByKind[kind].length > 0
|
|
@@ -230,17 +258,19 @@ var buildMemoryOverlay = (items, options) => {
|
|
|
230
258
|
...retrievalSections
|
|
231
259
|
];
|
|
232
260
|
if (sections.length === 0) {
|
|
233
|
-
return OVERLAY_HEADER_LINES.join("\n");
|
|
261
|
+
return finish(OVERLAY_HEADER_LINES.join("\n"));
|
|
234
262
|
}
|
|
235
|
-
return [
|
|
263
|
+
return finish([
|
|
236
264
|
...OVERLAY_HEADER_LINES,
|
|
237
265
|
...sections,
|
|
238
266
|
...buildBudgetFooter(retrievalFit, residentFit)
|
|
239
|
-
].join("\n");
|
|
267
|
+
].join("\n"));
|
|
240
268
|
};
|
|
241
269
|
|
|
242
270
|
export {
|
|
243
271
|
EXPLICIT_REMEMBER_PREFIX_REGEX,
|
|
272
|
+
estimateMemoryBlockTokens,
|
|
273
|
+
emptyMemoryInjectionObservation,
|
|
244
274
|
DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET,
|
|
245
275
|
RESIDENT_MEMORY_OVERLAY_TOKEN_BUDGET,
|
|
246
276
|
buildMemoryOverlay
|
|
@@ -79,14 +79,17 @@ function mergeWindow(into, win) {
|
|
|
79
79
|
existing.source = win.source;
|
|
80
80
|
}
|
|
81
81
|
function parseQuotaWindowScope(scope) {
|
|
82
|
-
const matched = /^(gemini|3p)-(.+)$/.exec(scope);
|
|
82
|
+
const matched = /^(gemini|3p|hydrogen|argon)-(.+)$/.exec(scope);
|
|
83
83
|
return matched ? { family: matched[1], period: matched[2] } : { period: scope };
|
|
84
84
|
}
|
|
85
85
|
function resolveQuotaWindowFamily(model) {
|
|
86
86
|
if (typeof model !== "string" || !model.trim()) return void 0;
|
|
87
|
+
if (/(?:^|[/-])gemini-[^/]*hydrogen(?:-|$)/i.test(model)) return "hydrogen";
|
|
88
|
+
if (/(?:^|[/-])gemini-[^/]*argon(?:-|$)/i.test(model)) return "argon";
|
|
87
89
|
return /gemini/i.test(model) ? "gemini" : "3p";
|
|
88
90
|
}
|
|
89
|
-
function isQuotaWindowRelevantToFamily(scope, family) {
|
|
91
|
+
function isQuotaWindowRelevantToFamily(scope, family, source) {
|
|
92
|
+
if (scope === "gemini-5h" && source?.endsWith(":fetchAvailableModels")) return false;
|
|
90
93
|
if (typeof scope !== "string") return true;
|
|
91
94
|
const scopeFamily = parseQuotaWindowScope(scope).family;
|
|
92
95
|
return scopeFamily === void 0 || family === void 0 || scopeFamily === family;
|
|
@@ -95,7 +98,7 @@ function selectQuotaWindowsForModel(quota, now, model) {
|
|
|
95
98
|
if (!quota || !Array.isArray(quota.windows)) return [];
|
|
96
99
|
const family = resolveQuotaWindowFamily(model);
|
|
97
100
|
return quota.windows.filter(
|
|
98
|
-
(window) => !isQuotaWindowExpired(window, now) && isQuotaWindowRelevantToFamily(window?.scope, family)
|
|
101
|
+
(window) => !isQuotaWindowExpired(window, now) && isQuotaWindowRelevantToFamily(window?.scope, family, window?.source)
|
|
99
102
|
);
|
|
100
103
|
}
|
|
101
104
|
function isQuotaWindowExpired(window, now) {
|
|
@@ -373,7 +376,7 @@ function shouldClearCooldownFromQuota(entry, quota, now, options) {
|
|
|
373
376
|
if (!quota || !(quota.observedAt > entry.markedAt)) return false;
|
|
374
377
|
const family = resolveQuotaWindowFamily(options?.model);
|
|
375
378
|
const relevantWindows = quota.windows.filter(
|
|
376
|
-
(window) => isQuotaWindowRelevantToFamily(window.scope, family)
|
|
379
|
+
(window) => isQuotaWindowRelevantToFamily(window.scope, family, window.source)
|
|
377
380
|
);
|
|
378
381
|
const subscriptionWindows = relevantWindows.filter(isSubscriptionPeriodWindow);
|
|
379
382
|
if (subscriptionWindows.length === 0) return false;
|
|
@@ -409,7 +412,7 @@ function resolveAgentAvailability(agent, now = Date.now()) {
|
|
|
409
412
|
const hasObservedAt = Boolean(quota) && typeof quota?.observedAt === "number" && Number.isFinite(quota.observedAt);
|
|
410
413
|
const family = resolveQuotaWindowFamily(agent?.model);
|
|
411
414
|
const relevantWindows = (quota?.windows ?? []).filter(
|
|
412
|
-
(window) => isQuotaWindowRelevantToFamily(window?.scope, family)
|
|
415
|
+
(window) => isQuotaWindowRelevantToFamily(window?.scope, family, window?.source)
|
|
413
416
|
);
|
|
414
417
|
const hasWindows = relevantWindows.length > 0;
|
|
415
418
|
const hasValidQuota = isAdmissible && hasWindows;
|
|
@@ -647,6 +650,7 @@ function resolveCredentialCandidateKeys(key) {
|
|
|
647
650
|
if (!key) return [];
|
|
648
651
|
const trimmed = key.trim();
|
|
649
652
|
if (!trimmed) return [];
|
|
653
|
+
if (/\|quota:(?:gemini|3p|hydrogen|argon)$/.test(trimmed)) return [trimmed];
|
|
650
654
|
const candidates = [trimmed];
|
|
651
655
|
const atIndex = trimmed.lastIndexOf("@");
|
|
652
656
|
if (atIndex > 0) {
|
|
@@ -677,7 +681,21 @@ function resolveCredentialKey(agent) {
|
|
|
677
681
|
function resolveCredentialKeyWithFallback(agent) {
|
|
678
682
|
if (isPublicOrSystemAgentRecord(agent)) return void 0;
|
|
679
683
|
const byRef = resolveCredentialKey(agent);
|
|
680
|
-
if (byRef)
|
|
684
|
+
if (byRef) {
|
|
685
|
+
const ref = byRef.split("@")[0]?.trim().toLowerCase();
|
|
686
|
+
const provider = agent?.provider;
|
|
687
|
+
let cloudCode = false;
|
|
688
|
+
try {
|
|
689
|
+
const host = new URL(String(agent?.customProviderUrl ?? "")).hostname;
|
|
690
|
+
cloudCode = /^(?:daily-|daily-sandbox-)?cloudcode-pa\.googleapis\.com$/.test(host);
|
|
691
|
+
} catch {
|
|
692
|
+
}
|
|
693
|
+
if (ref === "antigravity" || ref === "gemini" || provider === "google-antigravity" || cloudCode) {
|
|
694
|
+
const family = resolveQuotaWindowFamily(typeof agent?.model === "string" ? agent.model : void 0);
|
|
695
|
+
if (family) return `${byRef}|quota:${family}`;
|
|
696
|
+
}
|
|
697
|
+
return byRef;
|
|
698
|
+
}
|
|
681
699
|
if (!agent || typeof agent !== "object") return void 0;
|
|
682
700
|
const endpoint = agent.customProviderUrl;
|
|
683
701
|
if (typeof endpoint === "string") {
|