nolo-cli 0.228.0-alpha.2 → 0.228.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/{_executeModel-VYCHHZVT.js → _executeModel-GIFVXKDT.js} +88 -83
- package/{accountResolver-QETKNC7T.js → accountResolver-NGICIMEE.js} +1 -1
- package/{action-GDZDXPMB.js → action-WZTKEF5H.js} +9 -6
- package/{addContentAction-7RO4AMRI.js → addContentAction-MLI6GOBV.js} +14 -13
- package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-ARGQM22H.js} +17 -16
- package/{agentDeleteCommand-QWQKT54A.js → agentDeleteCommand-UF7XVELS.js} +118 -111
- package/{agentEmailCommands-EISMBIRE.js → agentEmailCommands-SFHRPQYC.js} +118 -107
- package/{agentListCommands-4WLG32IW.js → agentListCommands-IXKBP3W5.js} +208 -177
- package/{agentMachineCommands-DC6NKWTU.js → agentMachineCommands-7NX6PWQ6.js} +55 -48
- package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-C5T7C5KZ.js} +2 -2
- package/{agentPullCommand-KHV4EELF.js → agentPullCommand-4EQZYHU4.js} +1 -1
- package/agentRecordCommands-IUNX6XD6.js +188 -0
- package/{agentRunCommand-QM7ETUTX.js → agentRunCommand-LCR4XADM.js} +125 -111
- package/{agentRunControl-MBG4U6SL.js → agentRunControl-RN2P6AOD.js} +11 -9
- package/{agentRuntimeLocal-HOXKWCYO.js → agentRuntimeLocal-LVXPQ7QA.js} +56 -43
- package/{agentSlice-UG76KEBH.js → agentSlice-ZGMOH6TE.js} +15 -14
- package/{appDeleteCommands-WWCC6WA5.js → appDeleteCommands-BESCJOQM.js} +55 -48
- package/{appDeployCommands-AU4IUN33.js → appDeployCommands-LPTR6IOX.js} +55 -48
- package/{appDeployStatusCommands-STUW7WXL.js → appDeployStatusCommands-BZ7KZ5RD.js} +55 -48
- package/{appGetCommands-BGTLIQ4K.js → appGetCommands-EDWGJV4S.js} +55 -48
- package/{appListCommands-CUCPRUXW.js → appListCommands-OPRWYPM6.js} +55 -48
- package/{authCommand-OZ2KTP4Z.js → authCommand-3C3RN4OU.js} +25 -19
- package/{authCommands-55OGQGCR.js → authCommands-ZMVEDCQD.js} +12 -6
- package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-VRCMQ77Q.js} +7 -7
- package/{chromeCommands-G5UDKVSV.js → chromeCommands-O4IIKTBD.js} +384 -7
- package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-NZITLHWO.js} +3 -3
- package/{chunk-VQ5N5GSV.js → chunk-2BKNICGK.js} +4 -4
- package/{chunk-QYB23WUH.js → chunk-2FK2KZSL.js} +1 -1
- package/chunk-2SXN7LAY.js +15 -0
- package/{chunk-3VZLEKV2.js → chunk-3DJJ4CFG.js} +11 -11
- package/{chunk-TSPMLCWI.js → chunk-4IQN6FWY.js} +5 -5
- package/{chunk-XAG3FWBE.js → chunk-4OXPN3WC.js} +6 -6
- package/chunk-4ZCTKB27.js +31 -0
- package/chunk-53W5BXLN.js +340 -0
- package/{chunk-42OKN2LI.js → chunk-5HUO7SEX.js} +9 -107
- package/chunk-6ASGEP5D.js +21 -0
- package/{chunk-MJI3UAXN.js → chunk-6CXQ3YNJ.js} +40 -36
- package/{chunk-G7IUT2V3.js → chunk-6MTVACLN.js} +365 -64
- package/{chunk-ZOHO6MOF.js → chunk-6RSNVJGO.js} +2 -99
- package/{chunk-XSW4EXQV.js → chunk-6TVYUQRM.js} +55 -18
- package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-7Z6EW7AH.js → chunk-6XVPMGXK.js} +97 -11
- package/{chunk-ALAES342.js → chunk-73PZD7JZ.js} +9 -5
- package/{chunk-TCZ2VJZQ.js → chunk-7UVVLYKC.js} +9 -9
- package/{chunk-S6FDXXZV.js → chunk-ADOOL3PG.js} +2 -2
- package/{chunk-OWKNSIXL.js → chunk-AEZBAFC6.js} +334 -77
- package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
- package/{chunk-RG2DGNL6.js → chunk-ARFCL53U.js} +5 -5
- package/{chunk-SRCCSTIM.js → chunk-AS6L5KSD.js} +4 -4
- package/{chunk-WFDNADFX.js → chunk-BAH3BAUZ.js} +8 -8
- package/{chunk-N5Z2V73W.js → chunk-BFKJ2RS3.js} +1 -1
- package/{chunk-F6Z6ZCUV.js → chunk-BVEDT6DM.js} +3 -3
- package/chunk-C5A54QS7.js +108 -0
- package/{chunk-CD3RU7XL.js → chunk-CD2DK5JA.js} +120 -14
- package/{chunk-BP5ZJ6B4.js → chunk-CD64YXRB.js} +1 -1
- package/{chunk-VP3BINY7.js → chunk-CIGCTSBF.js} +31 -1
- package/{chunk-TQEKUOTI.js → chunk-CIUZXD5D.js} +12 -12
- package/{chunk-EVGU5P4U.js → chunk-CO6E7YK6.js} +1 -1
- package/{chunk-VMJVAJ6W.js → chunk-CTIEJRTP.js} +28 -4
- package/{chunk-7JGMNKKG.js → chunk-CTWCZKNS.js} +29 -8
- package/{chunk-YFLVRVYK.js → chunk-D25ONVOH.js} +1 -1
- package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
- package/{chunk-262R3XNN.js → chunk-E5RYFR7E.js} +334 -103
- package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
- package/{chunk-HSSBDZLD.js → chunk-EDT65EUE.js} +6 -6
- package/{chunk-YVFH2MFB.js → chunk-EQZQUQ33.js} +7 -7
- package/{chunk-HBRDSQ3M.js → chunk-ESN4WNWU.js} +3 -2
- package/{chunk-2YGBI2XB.js → chunk-FE7G6DSP.js} +11 -1
- package/{chunk-547ENH5T.js → chunk-FFFKAOJN.js} +4 -4
- package/{chunk-5ZUOVCKT.js → chunk-FGHEF6WI.js} +3 -1
- package/{chunk-GAYNXB6T.js → chunk-FTWAOKFU.js} +756 -333
- package/chunk-GAHJLSDO.js +107 -0
- package/{chunk-2X7WFDT6.js → chunk-GX6DITLQ.js} +1 -1
- package/{chunk-HXB4VDGK.js → chunk-HCCQEMTK.js} +28 -28
- package/{chunk-CMMI3DAT.js → chunk-HZDK56EK.js} +33 -26
- package/{chunk-OTKSESZR.js → chunk-IIOSZAJX.js} +4 -4
- package/chunk-IIRJ4P4I.js +24 -0
- package/{chunk-OJ45MEEI.js → chunk-IJZC2KIJ.js} +1 -1
- package/{chunk-MNEZUL5S.js → chunk-ITBX27W6.js} +92 -31
- package/{chunk-LYD6C7OU.js → chunk-J2VIGDJN.js} +6 -6
- package/{chunk-M3OZRQNH.js → chunk-JEWMQR6J.js} +1 -1
- package/{chunk-6QHKRARD.js → chunk-JFRJEPFI.js} +29 -5
- package/{chunk-S6K5F3KP.js → chunk-JP2BH4NC.js} +1 -1
- package/{chunk-EGHP7KOY.js → chunk-JU7VN4LF.js} +38 -29
- package/{chunk-RTHFJZ6M.js → chunk-K26XPZRB.js} +2 -2
- package/{chunk-ZYKJBRZ3.js → chunk-K7VIXYTZ.js} +1 -3
- package/chunk-KK3FCYZM.js +647 -0
- package/chunk-KLAMJNKQ.js +33394 -0
- package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
- package/chunk-KXOPLLFP.js +190 -0
- package/{chunk-MZG5CETE.js → chunk-KZ5OD2MO.js} +4 -4
- package/{chunk-ILHQ2AXT.js → chunk-KZAT2M2V.js} +14 -8
- package/chunk-LHCGKAFO.js +739 -0
- package/{chunk-HF7BLF3F.js → chunk-LMGFVH65.js} +107 -104
- package/{chunk-QRGDJA4B.js → chunk-LTVEOOZL.js} +19 -6
- package/{chunk-L32W3PRP.js → chunk-MAA42MMV.js} +233 -17
- package/{chunk-ATEKLSLR.js → chunk-MTM4LRVG.js} +14 -9
- package/chunk-MVOZ22RZ.js +26 -0
- package/{chunk-U2HBB7RS.js → chunk-MYYNZG2M.js} +132 -32
- package/{chunk-DBUR22G5.js → chunk-MZVCFV3T.js} +19 -15
- package/{chunk-WCFFRBL5.js → chunk-N74XL3NI.js} +9 -9
- package/{chunk-VS276URX.js → chunk-NEG5LYK5.js} +1 -1
- package/{chunk-RBPUNSG5.js → chunk-OAZP4TSA.js} +18 -108
- package/{chunk-4QYJPWHH.js → chunk-ODBYGVO2.js} +232 -10
- package/{chunk-M4SFKP5L.js → chunk-OHUYN3YU.js} +3 -3
- package/{chunk-HYLRQDEE.js → chunk-OLGFIQN2.js} +6 -6
- package/{chunk-M3JEW6N6.js → chunk-OYUMJMC5.js} +15 -0
- package/chunk-P27E22MA.js +203 -0
- package/{chunk-BIWI5M4E.js → chunk-PBPXXMWZ.js} +1 -1
- package/{chunk-OBSEKCVK.js → chunk-PQ63BDV3.js} +210 -51
- package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
- package/{chunk-XFXFPUO7.js → chunk-QMNVV3YM.js} +10 -37
- package/{chunk-CNMY2XM6.js → chunk-R5NRFXGD.js} +5 -5
- package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
- package/{chunk-4WVJLODK.js → chunk-RHBD22LV.js} +9 -4
- package/{chunk-45CAVC35.js → chunk-RMWDKLBE.js} +1489 -286
- package/{chunk-ZEVQHCLM.js → chunk-RR3MB26M.js} +2 -2
- package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
- package/{chunk-DLXMMTGM.js → chunk-SCMYAGQE.js} +1067 -705
- package/{chunk-YKY4OVOX.js → chunk-SPU3L3OR.js} +17 -170
- package/chunk-SR4FE5VD.js +9 -0
- package/{chunk-DUUDXSLX.js → chunk-SX6AWTNK.js} +28 -4
- package/{chunk-ZH3KXFHS.js → chunk-TMRJGSK2.js} +1 -1
- package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
- package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
- package/{chunk-UAIHKQIA.js → chunk-U6RD332P.js} +18 -2
- package/{chunk-3U44JB3O.js → chunk-UF6J7NXV.js} +1 -1
- package/{chunk-5YMA6DDZ.js → chunk-UHW6SCVK.js} +1 -1
- package/chunk-UOUMPHS5.js +103 -0
- package/{chunk-HHFGE2WF.js → chunk-UPOW5HTG.js} +5 -5
- package/{chunk-DEA37IUY.js → chunk-V4IYI3SB.js} +2 -2
- package/{chunk-XTJKU3Z4.js → chunk-VKCPKCSS.js} +66 -92
- package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
- package/{chunk-OBIC6EG7.js → chunk-VUHKG4KS.js} +3 -3
- package/{chunk-EEOOBRA7.js → chunk-W3HSD32M.js} +13 -6
- package/{chunk-P2ZLUIW2.js → chunk-W6T4FNZP.js} +351 -26
- package/chunk-WDWZPASX.js +29 -0
- package/{chunk-R6Z5S5GA.js → chunk-WQDTSK5U.js} +51 -14
- package/{chunk-X3E6EHJW.js → chunk-X22AUZKL.js} +149 -165
- package/{chunk-4ZGPHFLE.js → chunk-X3OZ655T.js} +2 -2
- package/{chunk-RRDRQOEC.js → chunk-XCA4WHX5.js} +95 -77
- package/{chunk-TI2EPRHE.js → chunk-XJSEST7D.js} +3 -3
- package/{chunk-3QIYD3VM.js → chunk-XNTZD4AE.js} +870 -1068
- package/chunk-XSRSAU3O.js +133 -0
- package/{chunk-7FEP5USX.js → chunk-Y4NPF2UN.js} +3 -3
- package/{chunk-FJSNBZXR.js → chunk-YDRRGVT5.js} +1 -1
- package/{chunk-7BCG67EI.js → chunk-YFW4H6DL.js} +405 -338
- package/{chunk-JQZRSXS5.js → chunk-YGDYYFRX.js} +9 -13
- package/{chunk-4N6G2CKP.js → chunk-YHNUDTU4.js} +49 -3
- package/chunk-YJPK35HB.js +175 -0
- package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
- package/{chunk-FPBJM2BW.js → chunk-Z7KE4K3H.js} +195 -126
- package/{chunk-DGYCDA6W.js → chunk-ZM5AZTQG.js} +20 -13
- package/{chunk-CBUZ6DKA.js → chunk-ZQ6K57FJ.js} +1 -1
- package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-37ZNEY5Y.js} +9 -9
- package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
- package/{cliLocalAgentRecordReader-H3HYQRRR.js → cliLocalAgentRecordReader-MCQVRWBR.js} +58 -47
- package/{commandRegistry-FVYPE2IN.js → commandRegistry-NTH5IAN5.js} +104 -92
- package/{contentThunks-GNFPG32S.js → contentThunks-SPXTX5U2.js} +38 -36
- package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-TIFCHCUN.js} +1 -1
- package/{createAgentAutomationAction-PB4QIFQ4.js → createAgentAutomationAction-KUQKCOXB.js} +38 -36
- package/{createDialogAction-EVTOPY7A.js → createDialogAction-HJN5U3XS.js} +39 -37
- package/{createPageAction-2UYF2IDZ.js → createPageAction-ZAHRDOAU.js} +43 -41
- package/{db-M7FU2GNK.js → db-CMUTP3W5.js} +2 -2
- package/{dbSlice-XRUZOGSU.js → dbSlice-656PMWR2.js} +13 -12
- package/{deleteFile-6URDHYRB.js → deleteFile-ZCQESEEQ.js} +10 -7
- package/{dialogCommands-6SZD4TYP.js → dialogCommands-KZTZLWPZ.js} +60 -54
- package/dialogMessageRecord-OAV77LT7.js +7 -0
- package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-PST75COP.js} +11 -11
- package/{dialogSlice-5EQ2A6LY.js → dialogSlice-BXIERQHO.js} +39 -37
- package/{dialogUsageCommand-W2WCSGKF.js → dialogUsageCommand-6RW2FY6K.js} +5 -5
- package/{docCreateCommands-25E6PGN3.js → docCreateCommands-26HJ5NAY.js} +54 -47
- package/{docDeleteCommands-F7ZVGEHW.js → docDeleteCommands-UAOHH5XK.js} +56 -49
- package/{docReadCommands-JY2E5XEN.js → docReadCommands-4ADG7YE6.js} +54 -47
- package/{docStore-OKKIKLT3.js → docStore-FZ75HWP2.js} +15 -14
- package/{docUpdateCommands-OZ4CUSIQ.js → docUpdateCommands-OGFJZENF.js} +54 -47
- package/fetchMessages-TQEUZD7H.js +1 -1
- package/{getPricing-LF5C4XSI.js → getPricing-FCHYVRJU.js} +4 -4
- package/{handleSendMessageAction-LNT7SZND.js → handleSendMessageAction-KP6GGBFY.js} +82 -78
- package/{hostCredentialCreate-XUU2CSHI.js → hostCredentialCreate-23TX56G7.js} +117 -105
- package/index.js +8 -8
- package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
- package/{localDialogRead-CCOCVGAP.js → localDialogRead-CIOTQM5T.js} +1 -1
- package/{localRuntimeAdapter-IBSTMSX7.js → localRuntimeAdapter-MTUWOYPN.js} +124 -111
- package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-TYHQCTZN.js} +5 -3
- package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-BO7IVWAZ.js} +1 -1
- package/{machineCommands-HSQHDHOT.js → machineCommands-4WJUJQHW.js} +241 -321
- package/{machineWsRunDispatch-L6H7J66T.js → machineWsRunDispatch-V3U4JM67.js} +113 -102
- package/markdownToSlate-KIYM7B3P.js +8 -0
- package/mcpLocalAuthorizeCommand-TI656UWC.js +106 -0
- package/{memberThunks-7Y3OYSJQ.js → memberThunks-JFYC4Z5L.js} +20 -15
- package/{models-H5NNZRLH.js → models-EP7VG6N2.js} +2 -2
- package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
- package/package.json +1 -1
- package/{projectArchive-FQO654Z3.js → projectArchive-NU2Z5HOR.js} +45 -43
- package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-4H7YP5D7.js} +6 -6
- package/{providerRegistry-ZI2KORJ7.js → providerRegistry-F3UPOTIY.js} +6 -6
- package/{read-TYMBGEXO.js → read-BRZHXUJ6.js} +9 -8
- package/{readDocTool-SKQVHBLO.js → readDocTool-N7RVFQEE.js} +1 -1
- package/{readlineWorkspace-7U272DSA.js → readlineWorkspace-T56MRMS5.js} +6423 -3669
- package/rememberExplicit-CPAPONSI.js +15 -0
- package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-J7XU7OUX.js} +19 -18
- package/{runAgentClientLoop-AF4JQIJ7.js → runAgentClientLoop-O2GRCGRZ.js} +96 -76
- package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-RDRJXMXC.js} +8 -8
- package/{secretCommands-KZWBZIYS.js → secretCommands-2FEMRUFM.js} +3 -3
- package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-Q4V2ZZW2.js} +16 -15
- package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-742H5S6T.js} +19 -18
- package/{settingThunks-ZRGWVGZD.js → settingThunks-T4FXSV6M.js} +185 -66
- package/{skillDiscovery-BHHPCUHZ.js → skillDiscovery-MDDKPTW3.js} +4 -3
- package/{spaceCommands-5VNWMDBE.js → spaceCommands-W5TAVFDT.js} +58 -51
- package/{streamAgentChatTurn-YSPEFY4K.js → streamAgentChatTurn-OWDJMU5E.js} +234 -177
- package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-HLDLHRRA.js} +17 -16
- package/{tableCommands-FTAOCBTX.js → tableCommands-44GC4N6J.js} +8 -5
- package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
- package/{tools-M35PTIFB.js → tools-O7SGGVA3.js} +65 -62
- package/{tuiRestart-2IL37YIB.js → tuiRestart-EOGC2BYY.js} +10 -10
- package/{tuiSummaryLlmCaller-W2QN4VAC.js → tuiSummaryLlmCaller-TM5BU73J.js} +16 -15
- package/{updateCommands-CPATDG6J.js → updateCommands-FBYA5WVG.js} +3 -3
- package/{updateDialogTitleAction-IMIRJRQQ.js → updateDialogTitleAction-EXSZGTLL.js} +40 -38
- package/{usageCommand-2BF74MKF.js → usageCommand-L4OFWXEU.js} +2 -2
- package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-7JR33UHS.js} +3 -3
- package/webapi-QVV65DQF.js +2487 -0
- package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-M4V77OUB.js} +2 -2
- package/workContext-Y3ADAPZU.js +14 -0
- package/workContextAccess-VU5I4LKZ.js +11 -0
- package/workContextWriteNotice-YCSSMHN4.js +7 -0
- package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-ZCSQCHG3.js} +2 -2
- package/agentRecordCommands-IZYUVHME.js +0 -177
- package/chunk-5ZMIIR23.js +0 -265
- package/chunk-62HXNQVV.js +0 -134
- package/chunk-TUSTONB3.js +0 -81
- package/chunk-ZXF6D3I6.js +0 -359
- package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
- /package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
recallMemoryVNextLocal
|
|
3
|
+
} from "./chunk-4D4QD7FT.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET,
|
|
6
|
+
buildMemoryOverlay
|
|
7
|
+
} from "./chunk-PVFYPUIM.js";
|
|
8
|
+
import {
|
|
9
|
+
isWorkContextState
|
|
10
|
+
} from "./chunk-C5A54QS7.js";
|
|
11
|
+
import {
|
|
12
|
+
loadMemoryVNextCatalog
|
|
13
|
+
} from "./chunk-324FWHUA.js";
|
|
14
|
+
import {
|
|
15
|
+
createMemoryKey
|
|
16
|
+
} from "./chunk-SYTHYBMI.js";
|
|
17
|
+
|
|
18
|
+
// packages/ai/memory/storeShared.ts
|
|
19
|
+
var retrievalCountOf = (item) => item.activationCount ?? 0;
|
|
20
|
+
var touchMemoryItemsInDb = async (db, items, now = (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
21
|
+
if (items.length === 0) return;
|
|
22
|
+
const batch = db.batch();
|
|
23
|
+
for (const item of items) {
|
|
24
|
+
batch.put(createMemoryKey(item.ownerType, item.ownerId, item.id), {
|
|
25
|
+
...item,
|
|
26
|
+
// retrieval bookkeeping on legacy storage names — see doc comment above
|
|
27
|
+
lastActivatedAt: now,
|
|
28
|
+
activationCount: retrievalCountOf(item) + 1
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
await batch.write();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// packages/ai/memory/remember.ts
|
|
35
|
+
var RESIDENT_MAX_CONTENT_CHARS = 240;
|
|
36
|
+
|
|
37
|
+
// packages/ai/memory/vnext/pureVNextRuntime.ts
|
|
38
|
+
function deriveStateResident(state, ownerType) {
|
|
39
|
+
if (ownerType !== "user") return false;
|
|
40
|
+
if (state.text.trim().length > RESIDENT_MAX_CONTENT_CHARS) return false;
|
|
41
|
+
return state.facet === "preference" || state.facet === "style";
|
|
42
|
+
}
|
|
43
|
+
var buildSynthesizedStateItem = (state, entity, ownerType, ownerId) => ({
|
|
44
|
+
id: `vnext-state-${state.id}`,
|
|
45
|
+
ownerType,
|
|
46
|
+
ownerId,
|
|
47
|
+
visibility: "private",
|
|
48
|
+
subjectType: "user",
|
|
49
|
+
subjectId: ownerId,
|
|
50
|
+
kind: "semantic",
|
|
51
|
+
content: state.text.trim(),
|
|
52
|
+
createdAt: state.createdAt,
|
|
53
|
+
lastActivatedAt: state.createdAt,
|
|
54
|
+
activationCount: 1,
|
|
55
|
+
importance: 0.9,
|
|
56
|
+
confidence: 0.9,
|
|
57
|
+
resident: deriveStateResident(state, ownerType)
|
|
58
|
+
});
|
|
59
|
+
async function resolvePureVNextRuntime(input) {
|
|
60
|
+
const { db, owners, userInput } = input;
|
|
61
|
+
if (owners.length === 0 || !userInput.trim()) {
|
|
62
|
+
return { selectedItems: [], promptBlock: buildMemoryOverlay([], { injectionEmit: input.injectionEmit }), recalledStateCount: 0 };
|
|
63
|
+
}
|
|
64
|
+
const ownerIds = owners.map((o) => `${o.ownerType}:${encodeURIComponent(o.ownerId)}`);
|
|
65
|
+
const catalogs = await Promise.all(
|
|
66
|
+
ownerIds.map((ownerId) => loadMemoryVNextCatalog(db, ownerId))
|
|
67
|
+
);
|
|
68
|
+
const selectedItems = [];
|
|
69
|
+
const seenStateKeys = /* @__PURE__ */ new Set();
|
|
70
|
+
for (let i = 0; i < owners.length; i++) {
|
|
71
|
+
const owner = owners[i];
|
|
72
|
+
const catalog = catalogs[i];
|
|
73
|
+
const currentStates = catalog.states.filter(
|
|
74
|
+
(s) => !s.retiredAt && s.text.trim() && !isWorkContextState(s)
|
|
75
|
+
);
|
|
76
|
+
const hits = recallMemoryVNextLocal({
|
|
77
|
+
query: userInput,
|
|
78
|
+
entities: catalog.entities,
|
|
79
|
+
states: currentStates
|
|
80
|
+
});
|
|
81
|
+
const entityById = new Map(catalog.entities.map((e) => [e.id, e]));
|
|
82
|
+
for (const hit of hits) {
|
|
83
|
+
const stateKey = `${hit.state.ownerId}\0${hit.state.id}`;
|
|
84
|
+
if (seenStateKeys.has(stateKey)) continue;
|
|
85
|
+
seenStateKeys.add(stateKey);
|
|
86
|
+
selectedItems.push(
|
|
87
|
+
buildSynthesizedStateItem(hit.state, entityById.get(hit.state.entityId), owner.ownerType, owner.ownerId)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const promptBlock = buildMemoryOverlay(selectedItems, {
|
|
92
|
+
sources: new Map(selectedItems.map((item) => [item, "vnext"])),
|
|
93
|
+
injectionEmit: input.injectionEmit,
|
|
94
|
+
maxTokens: input.maxTokens ?? DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
selectedItems,
|
|
98
|
+
promptBlock,
|
|
99
|
+
recalledStateCount: selectedItems.length
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
touchMemoryItemsInDb,
|
|
105
|
+
deriveStateResident,
|
|
106
|
+
resolvePureVNextRuntime
|
|
107
|
+
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteDialog,
|
|
3
|
+
runtime_default,
|
|
4
|
+
toast
|
|
5
|
+
} from "./chunk-YFW4H6DL.js";
|
|
1
6
|
import {
|
|
2
7
|
getAllMemberSpaces,
|
|
3
8
|
getCurrentSpaceId,
|
|
4
9
|
getCurrentSpaceIdRaw,
|
|
5
10
|
updateCurrentSpaceIfMatch
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
deleteDialog,
|
|
9
|
-
runtime_default,
|
|
10
|
-
toast
|
|
11
|
-
} from "./chunk-7BCG67EI.js";
|
|
11
|
+
} from "./chunk-FFFKAOJN.js";
|
|
12
12
|
import {
|
|
13
13
|
require_formatISO
|
|
14
14
|
} from "./chunk-UVLYNWIE.js";
|
|
15
|
-
import {
|
|
16
|
-
require_react
|
|
17
|
-
} from "./chunk-5FUN7EG4.js";
|
|
18
15
|
import {
|
|
19
16
|
UNCATEGORIZED_ID,
|
|
20
17
|
addContentAction,
|
|
@@ -26,7 +23,7 @@ import {
|
|
|
26
23
|
patchIndividualContentRecord,
|
|
27
24
|
readContentRecordForSpaceSync,
|
|
28
25
|
syncContentRecordSpaceId
|
|
29
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-V4IYI3SB.js";
|
|
30
27
|
import {
|
|
31
28
|
createSpaceKey,
|
|
32
29
|
normalizeSpaceId
|
|
@@ -39,10 +36,13 @@ import {
|
|
|
39
36
|
uploadFileAction,
|
|
40
37
|
upsertSSREntity,
|
|
41
38
|
write
|
|
42
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-HZDK56EK.js";
|
|
43
40
|
import {
|
|
44
41
|
resolveFileCategory
|
|
45
42
|
} from "./chunk-3PVYUPXK.js";
|
|
43
|
+
import {
|
|
44
|
+
require_react
|
|
45
|
+
} from "./chunk-RD3QLZQV.js";
|
|
46
46
|
import {
|
|
47
47
|
DEVICE_LOCAL_OWNER_ID,
|
|
48
48
|
getRuntimeServerContext,
|
|
@@ -50,22 +50,19 @@ import {
|
|
|
50
50
|
resolveReplicationServers,
|
|
51
51
|
scheduleDeleteReplication,
|
|
52
52
|
scheduleWriteReplication
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-WQDTSK5U.js";
|
|
54
54
|
import {
|
|
55
55
|
createAsyncThunk
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-6XVPMGXK.js";
|
|
57
57
|
import {
|
|
58
58
|
getIsDesktopApp
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import {
|
|
61
|
-
selectIdentityUserId
|
|
62
|
-
} from "./chunk-PXYBUFDB.js";
|
|
59
|
+
} from "./chunk-YHNUDTU4.js";
|
|
63
60
|
import {
|
|
64
61
|
createClientLogger
|
|
65
62
|
} from "./chunk-QQ56R7KS.js";
|
|
66
63
|
import {
|
|
67
|
-
|
|
68
|
-
} from "./chunk-
|
|
64
|
+
selectIdentityUserId
|
|
65
|
+
} from "./chunk-PXYBUFDB.js";
|
|
69
66
|
import {
|
|
70
67
|
asRecordOrEmpty
|
|
71
68
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -73,11 +70,11 @@ import {
|
|
|
73
70
|
isAbortError
|
|
74
71
|
} from "./chunk-7DPNBQSV.js";
|
|
75
72
|
import {
|
|
76
|
-
|
|
77
|
-
} from "./chunk-
|
|
73
|
+
buildTombstoneRecord
|
|
74
|
+
} from "./chunk-BV3FLP2L.js";
|
|
78
75
|
import {
|
|
79
|
-
|
|
80
|
-
} from "./chunk-
|
|
76
|
+
isSystemAdmin
|
|
77
|
+
} from "./chunk-CO6E7YK6.js";
|
|
81
78
|
import {
|
|
82
79
|
SEPARATOR,
|
|
83
80
|
createKey,
|
|
@@ -91,6 +88,9 @@ import {
|
|
|
91
88
|
import {
|
|
92
89
|
ulid
|
|
93
90
|
} from "./chunk-OJKUU3LP.js";
|
|
91
|
+
import {
|
|
92
|
+
extractUserId
|
|
93
|
+
} from "./chunk-M2EJHDJP.js";
|
|
94
94
|
import {
|
|
95
95
|
asTrimmedNonEmptyStringArray
|
|
96
96
|
} from "./chunk-I42VC5KR.js";
|
|
@@ -100,12 +100,12 @@ import {
|
|
|
100
100
|
import {
|
|
101
101
|
asTrimmedString
|
|
102
102
|
} from "./chunk-3EUW3WEO.js";
|
|
103
|
-
import {
|
|
104
|
-
isRecord
|
|
105
|
-
} from "./chunk-KUG52IAP.js";
|
|
106
103
|
import {
|
|
107
104
|
asOptionalFiniteNumber
|
|
108
105
|
} from "./chunk-WWC7I6TA.js";
|
|
106
|
+
import {
|
|
107
|
+
isRecord
|
|
108
|
+
} from "./chunk-KUG52IAP.js";
|
|
109
109
|
import {
|
|
110
110
|
asOptionalTrimmedString
|
|
111
111
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -1513,11 +1513,11 @@ var ENTITY_DELETE_STRATEGIES = {
|
|
|
1513
1513
|
await dispatch(deleteTable({ dbKey: key })).unwrap();
|
|
1514
1514
|
},
|
|
1515
1515
|
file: async (key, { thunkAPI }) => {
|
|
1516
|
-
const { deleteFileAction } = await import("./deleteFile-
|
|
1516
|
+
const { deleteFileAction } = await import("./deleteFile-ZCQESEEQ.js");
|
|
1517
1517
|
await deleteFileAction(key, thunkAPI);
|
|
1518
1518
|
},
|
|
1519
1519
|
image: async (key, { thunkAPI }) => {
|
|
1520
|
-
const { deleteFileAction } = await import("./deleteFile-
|
|
1520
|
+
const { deleteFileAction } = await import("./deleteFile-ZCQESEEQ.js");
|
|
1521
1521
|
await deleteFileAction(key, thunkAPI);
|
|
1522
1522
|
},
|
|
1523
1523
|
agent: async (key, { dispatch, userId, sourceServerOrigin }) => {
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
isMediaFile,
|
|
3
3
|
resolveFileCategory
|
|
4
4
|
} from "./chunk-3PVYUPXK.js";
|
|
5
|
-
import {
|
|
6
|
-
readAction,
|
|
7
|
-
readRequestManager,
|
|
8
|
-
resolveAgentReadServers
|
|
9
|
-
} from "./chunk-DGYCDA6W.js";
|
|
10
5
|
import {
|
|
11
6
|
loadFileFromIndexedDb,
|
|
12
7
|
removeAction,
|
|
13
8
|
saveFileToIndexedDb
|
|
14
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X3OZ655T.js";
|
|
10
|
+
import {
|
|
11
|
+
readAction,
|
|
12
|
+
readRequestManager,
|
|
13
|
+
resolveAgentReadServers
|
|
14
|
+
} from "./chunk-ZM5AZTQG.js";
|
|
15
15
|
import {
|
|
16
16
|
beginWriteAck,
|
|
17
17
|
compareRemoteRecordsByComparableTime,
|
|
@@ -29,19 +29,22 @@ import {
|
|
|
29
29
|
shouldReplaceLocalWithRemoteRecord,
|
|
30
30
|
shouldReplicateLocalRecord,
|
|
31
31
|
uploadToCurrentServer
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-WQDTSK5U.js";
|
|
33
33
|
import {
|
|
34
34
|
asyncThunkCreator,
|
|
35
35
|
buildCreateSlice,
|
|
36
36
|
createEntityAdapter,
|
|
37
37
|
noloDeleteRequest
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6XVPMGXK.js";
|
|
39
39
|
import {
|
|
40
40
|
fetchFromClientDb,
|
|
41
41
|
fetchFromServer,
|
|
42
|
+
googleSessionRequestToken,
|
|
43
|
+
googleSessionServer,
|
|
42
44
|
logger,
|
|
43
|
-
normalizeTimeFields
|
|
44
|
-
|
|
45
|
+
normalizeTimeFields,
|
|
46
|
+
scopeGoogleSessionServers
|
|
47
|
+
} from "./chunk-YHNUDTU4.js";
|
|
45
48
|
import {
|
|
46
49
|
isTombstoneRecord
|
|
47
50
|
} from "./chunk-BV3FLP2L.js";
|
|
@@ -52,6 +55,9 @@ import {
|
|
|
52
55
|
import {
|
|
53
56
|
ulid
|
|
54
57
|
} from "./chunk-OJKUU3LP.js";
|
|
58
|
+
import {
|
|
59
|
+
isPublicBuiltinPlatformAgentKey
|
|
60
|
+
} from "./chunk-KZAT2M2V.js";
|
|
55
61
|
import {
|
|
56
62
|
API_ENDPOINTS
|
|
57
63
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -643,14 +649,14 @@ async function getPageReadBaseline(db, actorId, dbKey) {
|
|
|
643
649
|
async function readProtectedPage(options) {
|
|
644
650
|
const { db, actorId, dbKey } = options;
|
|
645
651
|
const assertAccess = (origin) => {
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
652
|
+
const access2 = options.getCurrentAccess?.() ?? options;
|
|
653
|
+
if (access2.actorId !== actorId || !access2.token?.trim()) {
|
|
648
654
|
throw Error("\u6587\u6863\u8BFB\u53D6\u8EAB\u4EFD\u5DF2\u53D8\u5316\u6216\u8BA4\u8BC1\u5DF2\u64A4\u9500\uFF0C\u5DF2\u505C\u6B62\u8BFB\u53D6");
|
|
649
655
|
}
|
|
650
|
-
if (origin && !
|
|
656
|
+
if (origin && !access2.servers.some((server) => originOf(server) === origin)) {
|
|
651
657
|
throw Error("\u6587\u6863\u5F52\u5C5E\u670D\u52A1\u5668\u4E0D\u5728\u5DF2\u914D\u7F6E\u670D\u52A1\u5668\u4E2D\u6216\u5DF2\u79FB\u9664\uFF0C\u672A\u53D1\u9001\u8BA4\u8BC1\u4FE1\u606F\uFF0C\u672A\u8F6C\u53D1\u8BA4\u8BC1\u4FE1\u606F");
|
|
652
658
|
}
|
|
653
|
-
return
|
|
659
|
+
return origin ? googleSessionRequestToken(access2.token, origin) : access2.token;
|
|
654
660
|
};
|
|
655
661
|
assertAccess();
|
|
656
662
|
const sync = options.sync ?? createProtectedRecordSync({ db });
|
|
@@ -664,13 +670,10 @@ async function readProtectedPage(options) {
|
|
|
664
670
|
sync,
|
|
665
671
|
fetch: options.fetch,
|
|
666
672
|
isAuthorityAllowed: (origin) => {
|
|
667
|
-
const
|
|
668
|
-
return
|
|
673
|
+
const access2 = options.getCurrentAccess();
|
|
674
|
+
return access2.actorId === actorId && access2.servers.some((server) => originOf(server) === origin);
|
|
669
675
|
},
|
|
670
|
-
getToken: async () =>
|
|
671
|
-
const access = options.getCurrentAccess();
|
|
672
|
-
return access.actorId === actorId ? access.token ?? null : null;
|
|
673
|
-
}
|
|
676
|
+
getToken: async ({ authorityServer }) => assertAccess(authorityServer)
|
|
674
677
|
});
|
|
675
678
|
for (let count = 0; count < state.outbox.length; count++) {
|
|
676
679
|
if ((await transport.sendNext({ actorId, dbKey })).outcome !== "acked") break;
|
|
@@ -683,7 +686,9 @@ async function readProtectedPage(options) {
|
|
|
683
686
|
return state.workingCopy.data;
|
|
684
687
|
}
|
|
685
688
|
}
|
|
686
|
-
const
|
|
689
|
+
const access = options.getCurrentAccess?.() ?? options;
|
|
690
|
+
const googleAuthority = googleSessionServer(access.token);
|
|
691
|
+
const servers = saved ? [saved.authorityServer] : options.servers.filter((server) => access.servers.some((candidate) => originOf(candidate) === originOf(server)) && (!googleAuthority || originOf(server) === googleAuthority));
|
|
687
692
|
for (const server of servers) {
|
|
688
693
|
const origin = originOf(server);
|
|
689
694
|
if (!origin) continue;
|
|
@@ -832,6 +837,7 @@ var readAndWaitAction = async (payload, thunkApi) => {
|
|
|
832
837
|
userAuthorityRegistry
|
|
833
838
|
} = getRuntimeServerContext(state, preferredServerOrigin);
|
|
834
839
|
const allServers = resolveAgentReadServers({ dbKey, configuredServers });
|
|
840
|
+
const fetchScopedFromServer = (server, key, token, signal) => signal === void 0 ? fetchFromServer(server, key, googleSessionRequestToken(token, server, isPublicBuiltinPlatformAgentKey(key))) : fetchFromServer(server, key, googleSessionRequestToken(token, server, isPublicBuiltinPlatformAgentKey(key)), signal);
|
|
835
841
|
const isLoggedIn = !!currentToken;
|
|
836
842
|
const executeReadAndWait = async () => {
|
|
837
843
|
if (dbKey.startsWith("page-") && currentUserId && currentToken && typeof db.batch === "function") {
|
|
@@ -857,11 +863,12 @@ var readAndWaitAction = async (payload, thunkApi) => {
|
|
|
857
863
|
currentServer,
|
|
858
864
|
userAuthorityRegistry
|
|
859
865
|
});
|
|
860
|
-
|
|
866
|
+
let readServers = planAuthorityReadServers({
|
|
861
867
|
allServers,
|
|
862
868
|
authorityServer: preferredServerOrigin ?? authority.authorityServer,
|
|
863
869
|
serverOrigin: authority.serverOrigin
|
|
864
870
|
});
|
|
871
|
+
if (!isPublicBuiltinPlatformAgentKey(dbKey)) readServers = scopeGoogleSessionServers(currentToken, currentServer, readServers);
|
|
865
872
|
const hasPreferredAuthorityServer = !!preferredServerOrigin || !!authority.authorityServer;
|
|
866
873
|
const preferredAuthorityServer = hasPreferredAuthorityServer ? readServers[0] : null;
|
|
867
874
|
if (readServers.length === 0) {
|
|
@@ -874,7 +881,7 @@ var readAndWaitAction = async (payload, thunkApi) => {
|
|
|
874
881
|
}
|
|
875
882
|
if (preferredAuthorityServer) {
|
|
876
883
|
try {
|
|
877
|
-
const preferredRemoteData = await
|
|
884
|
+
const preferredRemoteData = await fetchScopedFromServer(
|
|
878
885
|
preferredAuthorityServer,
|
|
879
886
|
dbKey,
|
|
880
887
|
isLoggedIn ? currentToken : void 0
|
|
@@ -888,7 +895,7 @@ var readAndWaitAction = async (payload, thunkApi) => {
|
|
|
888
895
|
}
|
|
889
896
|
const remainingReadServers = preferredAuthorityServer ? readServers.filter((server) => server !== preferredAuthorityServer) : readServers;
|
|
890
897
|
const remotePromises = remainingReadServers.map(
|
|
891
|
-
(server) =>
|
|
898
|
+
(server) => fetchScopedFromServer(server, dbKey, isLoggedIn ? currentToken : void 0)
|
|
892
899
|
);
|
|
893
900
|
const chosenData = await processRemoteData(
|
|
894
901
|
db,
|
|
@@ -1487,7 +1494,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
1487
1494
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
1488
1495
|
read: create.asyncThunk(
|
|
1489
1496
|
async (payload, thunkApi) => {
|
|
1490
|
-
const { readAction: readAction2 } = await import("./read-
|
|
1497
|
+
const { readAction: readAction2 } = await import("./read-BRZHXUJ6.js");
|
|
1491
1498
|
return readAction2(payload, thunkApi);
|
|
1492
1499
|
},
|
|
1493
1500
|
{
|
|
@@ -1561,7 +1568,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
1561
1568
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
1562
1569
|
share: create.asyncThunk(
|
|
1563
1570
|
async (config, thunkApi) => {
|
|
1564
|
-
const { shareResourceAction } = await import("./action-
|
|
1571
|
+
const { shareResourceAction } = await import("./action-WZTKEF5H.js");
|
|
1565
1572
|
return shareResourceAction(config, thunkApi);
|
|
1566
1573
|
}
|
|
1567
1574
|
),
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toolRegistry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FTWAOKFU.js";
|
|
4
4
|
import {
|
|
5
5
|
runtime_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YFW4H6DL.js";
|
|
7
7
|
import {
|
|
8
8
|
canonicalizeToolNames
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YLAHYLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
isRecord
|
|
12
12
|
} from "./chunk-KUG52IAP.js";
|
|
13
13
|
import {
|
|
14
14
|
isNoloHostedProvider
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PQ63BDV3.js";
|
|
16
16
|
import {
|
|
17
17
|
asTrimmedLowercaseString
|
|
18
18
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isTombstoneRecord
|
|
3
|
+
} from "./chunk-BV3FLP2L.js";
|
|
4
|
+
import {
|
|
5
|
+
buildDialogKey,
|
|
6
|
+
dialogMessageKey
|
|
7
|
+
} from "./chunk-OJKUU3LP.js";
|
|
8
|
+
|
|
9
|
+
// packages/ai/memory/vnext/workContextAccess.ts
|
|
10
|
+
async function resolveWorkContextAccess(db, userId, dialogId, userMessageId) {
|
|
11
|
+
if (!userId || userId === "server" || typeof dialogId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(dialogId)) throw new Error("invalid work dialog");
|
|
12
|
+
const dialog = await db.get(buildDialogKey(userId, dialogId));
|
|
13
|
+
if (!dialog || dialog.id !== dialogId || dialog.userId != null && dialog.userId !== userId || isTombstoneRecord(dialog)) throw new Error("work dialog forbidden");
|
|
14
|
+
const scope = { ownerId: `user:${encodeURIComponent(userId)}`, spaceId: typeof dialog.spaceId === "string" && dialog.spaceId ? dialog.spaceId : null, dialogId };
|
|
15
|
+
if (userMessageId === void 0) return { scope };
|
|
16
|
+
if (typeof userMessageId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(userMessageId)) throw new Error("persisted user message required");
|
|
17
|
+
const message = await db.get(dialogMessageKey(dialogId, userMessageId));
|
|
18
|
+
if (!message || message.id !== userMessageId || message.dialogId != null && message.dialogId !== dialogId || message.role !== "user" || message.userId !== userId || isTombstoneRecord(message) || typeof message.content !== "string" || typeof message.createdAt !== "string") throw new Error("work source forbidden");
|
|
19
|
+
return { scope, sourceRef: JSON.stringify(["dialog", dialogId, "message", userMessageId]) };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
resolveWorkContextAccess
|
|
24
|
+
};
|