nolo-cli 0.32.0 → 0.33.0-alpha.10
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 +6 -12
- package/{_executeModel-LTMSIBS4.js → _executeModel-YXWAXPWQ.js} +77 -67
- package/{action-HI3VRQLP.js → action-OQWPNKAH.js} +17 -15
- package/{addContentAction-NCURJ6PK.js → addContentAction-YVINZQTF.js} +14 -13
- package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-6IOCIEPI.js} +14 -13
- package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-VGHWJN5T.js} +44 -60
- package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-ZLRF35I3.js} +91 -81
- package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
- package/{agentListCommands-SF3HEUTT.js → agentListCommands-OHZJ7AFP.js} +75 -79
- package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-62PHPGTK.js} +43 -59
- package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-TSWAJPS2.js} +5 -5
- package/agentRecordCommands-CW2JWERD.js +113 -0
- package/agentRunCommand-O4HV7YWA.js +131 -0
- package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-4PSBNUOE.js} +37 -51
- package/{agentSlice-4XWW344Y.js → agentSlice-OUTQ5O72.js} +16 -14
- package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-VTDBVHYR.js} +40 -56
- package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-WOUP7MDA.js} +40 -56
- package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-N2NWZKEN.js} +40 -56
- package/{appGetCommands-QSSOSEYL.js → appGetCommands-GYKLWWCA.js} +40 -56
- package/{appListCommands-PH3XWNDX.js → appListCommands-RUWBSEJK.js} +40 -56
- package/{authCommand-BBDHMSO6.js → authCommand-YVXVH25I.js} +21 -20
- package/{authCommands-4UDEKRE6.js → authCommands-WTW6MEYS.js} +10 -10
- package/chatQueueReduxAdapter-2QJAD4KQ.js +181 -0
- package/{chunk-EEF23OOK.js → chunk-266VUBLK.js} +7 -7
- package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
- package/{chunk-2HXKAPH7.js → chunk-2QLAVHVK.js} +6 -6
- package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
- package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
- package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
- package/{chunk-KGEVMUMI.js → chunk-3RUW3ONU.js} +11 -11
- package/{chunk-RXVX5LFR.js → chunk-3UG2IIZ3.js} +1 -1
- package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
- package/{chunk-V54H24CQ.js → chunk-4F5M2MW5.js} +3 -3
- package/{chunk-2ZRP5RUG.js → chunk-4OV7DXFJ.js} +12 -11
- package/{chunk-W367V5CH.js → chunk-54BAYVCY.js} +404 -117
- package/{chunk-GAF5X6B7.js → chunk-5QW3O3ET.js} +284 -310
- package/{chunk-DLWCWUNW.js → chunk-64OVNZXE.js} +1197 -757
- package/{chunk-ODS2MVMU.js → chunk-66CWPJK2.js} +19 -303
- package/{chunk-PTHDLIRB.js → chunk-6KOS7ZBZ.js} +1 -1
- package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-ATK5WJOA.js → chunk-6YXDOOSH.js} +4 -4
- package/{chunk-SWYMCHM7.js → chunk-75U775RZ.js} +69 -1
- package/{chunk-UDA3ZYLW.js → chunk-7YYHKBJP.js} +31 -72
- package/chunk-ADLYMQB6.js +642 -0
- package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
- package/{chunk-43EPBPZ2.js → chunk-ASDXPOJH.js} +2 -2
- package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
- package/chunk-BFPSVRCQ.js +1799 -0
- package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
- package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
- package/{chunk-4PNU7W7K.js → chunk-C7H5GMXT.js} +107 -125
- package/chunk-CPYYM4RJ.js +98 -0
- package/{chunk-3GZT3L6F.js → chunk-DDVIBKIB.js} +326 -481
- package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
- package/{chunk-BGTUGS3T.js → chunk-DKMOY3QI.js} +4 -30
- package/chunk-EGRJC4ZN.js +91 -0
- package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
- package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
- package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
- package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
- package/chunk-GJXRIOLS.js +241 -0
- package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
- package/chunk-HS7MLR74.js +38 -0
- package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
- package/chunk-IDAU4UFS.js +437 -0
- package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
- package/{chunk-OWHNFZNW.js → chunk-IKWTTKWG.js} +4 -4
- package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
- package/{chunk-ZJH3LKEW.js → chunk-IR6W62Q6.js} +102 -15
- package/{chunk-RH53LMEJ.js → chunk-J44TVX2O.js} +2 -4
- package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
- package/chunk-KHCLMKZZ.js +3062 -0
- package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
- package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
- package/{chunk-XDHHF73Q.js → chunk-LUIHOUZC.js} +95 -95
- package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-MITD7CON.js → chunk-MDIAECHA.js} +1461 -301
- package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
- package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
- package/{chunk-Q3CSL43H.js → chunk-N4XRDM26.js} +1 -1
- package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
- package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
- package/chunk-OW765XBU.js +10 -0
- package/{chunk-VMWR7VNI.js → chunk-PRMMCFIN.js} +13 -9
- package/{chunk-JZPBVBIY.js → chunk-QTZD6HBK.js} +18 -8
- package/chunk-RCFIB45Q.js +28 -0
- package/{chunk-7S54ZGF6.js → chunk-RJKIB55Y.js} +256 -12
- package/chunk-RPRRIFXV.js +231 -0
- package/chunk-RQFO3CAF.js +300 -0
- package/chunk-RY57GLGW.js +188 -0
- package/{chunk-YHGHADBQ.js → chunk-SCUETSRP.js} +4 -4
- package/{chunk-TA6EA2A3.js → chunk-TFK3HUNQ.js} +182 -20
- package/{chunk-LAXMH7JY.js → chunk-UM4H3URE.js} +18 -15
- package/{chunk-6YABCOFU.js → chunk-UNHKVD2N.js} +1 -1
- package/{chunk-G5GVZAXF.js → chunk-UNOTBWZZ.js} +15 -19
- package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
- package/chunk-URMS4XY2.js +10 -0
- package/{chunk-SFWZUTCI.js → chunk-VBUQYOX7.js} +2 -2
- package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
- package/chunk-VIDPVFP3.js +20 -0
- package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
- package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
- package/{chunk-VVEH6XUE.js → chunk-X2DAEZ3X.js} +1 -1
- package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
- package/{chunk-3FCNXC2J.js → chunk-XRO5VGQ6.js} +3735 -1394
- package/chunk-Y5GCAMGP.js +9 -0
- package/{chunk-O3JR45Q2.js → chunk-YBMI5JAH.js} +44 -44
- package/{chunk-V42OE5HT.js → chunk-YDTYDA5W.js} +3 -3
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
- package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
- package/{chunk-3UGKATZQ.js → chunk-ZWS6DUHX.js} +26 -435
- package/chunk-ZZ2MH7LE.js +84 -0
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
- package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
- package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
- package/{createAgentAutomationAction-WLRNE7C4.js → createAgentAutomationAction-H6ZRPXBR.js} +41 -31
- package/createDialogAction-UJ6LFJYM.js +61 -0
- package/{createPageAction-7YROVZ3W.js → createPageAction-KVPT3IRK.js} +57 -47
- package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
- package/{dbSlice-BBL3PEVW.js → dbSlice-UI2VCBLG.js} +13 -12
- package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
- package/dialogCommands-6ASXJP3H.js +82 -0
- package/{dialogSlice-N4HPG6HM.js → dialogSlice-B7KCGHMY.js} +37 -29
- package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-S4E4MKVC.js} +42 -56
- package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-M7XLKWRM.js} +44 -58
- package/{docReadCommands-H55VQ2US.js → docReadCommands-LSCMW2FR.js} +42 -56
- package/{docStore-B5AHDNW5.js → docStore-ZYWZWIRB.js} +40 -30
- package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-OMRBAFOB.js} +45 -59
- package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
- package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
- package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-Y2XKODRT.js} +39 -31
- package/index.js +74 -74
- package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
- package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
- package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-S77B5QVB.js} +10 -4
- package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
- package/{machineCommands-H3UMKE76.js → machineCommands-62RUZVSW.js} +95 -85
- package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
- package/machineWsRunDispatch-L3HD3FSF.js +129 -0
- package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
- package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
- package/package.json +1 -4
- package/{read-64OQDO3I.js → read-2VHEHCAN.js} +8 -7
- package/{readDocTool-MXM3T6PE.js → readDocTool-CSWD6NPC.js} +1 -2
- package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-3MOJWFM7.js} +3358 -3409
- package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-2T7BPM3T.js} +19 -17
- package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-Y5UW544I.js} +73 -64
- package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KHGQKT3B.js} +6 -6
- package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-GPT37HTW.js} +15 -14
- package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-3746P7IW.js} +19 -17
- package/{settingSlice-4M37TN7V.js → settingSlice-FIFOQ6OR.js} +16 -14
- package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
- package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
- package/{spaceCommands-7VVKJBDV.js → spaceCommands-NKSBD5G3.js} +45 -241
- package/{spaceSlice-T6YK6D34.js → spaceSlice-L44CI2QR.js} +39 -61
- package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-7DU4Z2VJ.js} +1262 -150
- package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-MQTUTQHL.js} +14 -13
- package/syncMapping-RK2MANUX.js +43 -0
- package/{tableCommands-RJZ3V4TF.js → tableCommands-64FZBAI3.js} +9 -8
- package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
- package/tools-2JI52WJP.js +99 -0
- package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-EAWQ3IZX.js} +25 -21
- package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
- package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-HW33OIJI.js} +49 -38
- package/agentRecordCommands-JFZRQJQ4.js +0 -103
- package/agentRunCommand-NOX5FLKO.js +0 -121
- package/chunk-AYMOSAHE.js +0 -3158
- package/chunk-D2BPX6DQ.js +0 -1707
- package/chunk-DCDL3GC4.js +0 -171
- package/chunk-F3MP7CP6.js +0 -73
- package/chunk-WZSRQNQG.js +0 -2587
- package/createDialogAction-Y6YV64QB.js +0 -52
- package/dialogCommands-XLO5CAHZ.js +0 -95
- package/machineWsRunDispatch-HONRUK3R.js +0 -119
- package/tools-KYZX3BGO.js +0 -90
- package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
- package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
|
@@ -1,7 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLocalProviderSecret
|
|
3
|
+
} from "./chunk-HS7MLR74.js";
|
|
1
4
|
import {
|
|
2
5
|
ANTIGRAVITY_CLOUD_CODE_BASE_URL,
|
|
3
6
|
isAntigravityOAuthAgent
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SCUETSRP.js";
|
|
8
|
+
import {
|
|
9
|
+
clipMultilineText,
|
|
10
|
+
fetchAndSerializeTable,
|
|
11
|
+
resolveBuiltinSkillPage,
|
|
12
|
+
waitForAbortableDelay
|
|
13
|
+
} from "./chunk-MDIAECHA.js";
|
|
14
|
+
import {
|
|
15
|
+
createDrainExhaustedResponse,
|
|
16
|
+
isCoreDrainingBody,
|
|
17
|
+
isGatewayHttpStatus,
|
|
18
|
+
normalizeNonNegativeMs,
|
|
19
|
+
parseRetryAfterHeaderMs
|
|
20
|
+
} from "./chunk-RQSOAMPJ.js";
|
|
21
|
+
import {
|
|
22
|
+
slateToSimplifiedMarkdown
|
|
23
|
+
} from "./chunk-75U775RZ.js";
|
|
24
|
+
import {
|
|
25
|
+
extractCategorizedMentions
|
|
26
|
+
} from "./chunk-GM6PU7B6.js";
|
|
27
|
+
import {
|
|
28
|
+
fetchAndCacheMessages
|
|
29
|
+
} from "./chunk-DDVIBKIB.js";
|
|
30
|
+
import {
|
|
31
|
+
shouldUseServerProxy
|
|
32
|
+
} from "./chunk-YYLHWIW6.js";
|
|
33
|
+
import {
|
|
34
|
+
fetchServerSyncedCredential
|
|
35
|
+
} from "./chunk-66CWPJK2.js";
|
|
5
36
|
import {
|
|
6
37
|
buildCurrentTimeBlock,
|
|
7
38
|
buildIdentityBlock,
|
|
@@ -9,81 +40,79 @@ import {
|
|
|
9
40
|
requiresBareImageUrl,
|
|
10
41
|
resolveToolGuidedSections,
|
|
11
42
|
toBareImageUrlMessages
|
|
12
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-ZWS6DUHX.js";
|
|
13
44
|
import {
|
|
14
45
|
convertMessagesToResponsesInput,
|
|
46
|
+
getUsageRequestOptions,
|
|
15
47
|
preserveAgentStateFields
|
|
16
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-NNWHHCVP.js";
|
|
49
|
+
import {
|
|
50
|
+
buildProviderAuthHeaders
|
|
51
|
+
} from "./chunk-7YYHKBJP.js";
|
|
52
|
+
import {
|
|
53
|
+
estimateTokenCount
|
|
54
|
+
} from "./chunk-DKMOY3QI.js";
|
|
17
55
|
import {
|
|
18
|
-
buildProviderAuthHeaders,
|
|
19
56
|
isOpenAiResponsesModel,
|
|
20
57
|
resolvePlatformChatCompletionsEndpoint,
|
|
21
58
|
resolvePlatformResponsesEndpoint
|
|
22
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-CPYYM4RJ.js";
|
|
23
60
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
waitForAbortableDelay
|
|
29
|
-
} from "./chunk-MITD7CON.js";
|
|
30
|
-
import {
|
|
31
|
-
createDrainExhaustedResponse,
|
|
32
|
-
isCoreDrainingBody,
|
|
33
|
-
isGatewayHttpStatus,
|
|
34
|
-
normalizeNonNegativeMs,
|
|
35
|
-
parseRetryAfterHeaderMs
|
|
36
|
-
} from "./chunk-Z5MXSEOJ.js";
|
|
61
|
+
clampReasoningEffort,
|
|
62
|
+
getModelConfig,
|
|
63
|
+
isModelSupportReasoningEffort
|
|
64
|
+
} from "./chunk-DFUPZE6V.js";
|
|
37
65
|
import {
|
|
38
|
-
|
|
39
|
-
} from "./chunk-
|
|
66
|
+
createFileCredentialBroker
|
|
67
|
+
} from "./chunk-RQFO3CAF.js";
|
|
40
68
|
import {
|
|
41
|
-
|
|
42
|
-
|
|
69
|
+
MEMORY_USE_GUIDANCE,
|
|
70
|
+
buildUserResponseLanguageContext,
|
|
71
|
+
wrapHistoricalSummaryWithReplayGuard
|
|
72
|
+
} from "./chunk-FMEVI5TG.js";
|
|
43
73
|
import {
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
buildSkillGuidancePromptBlock,
|
|
75
|
+
extractRuntimePageCapabilities,
|
|
76
|
+
resolveSkillGraphFromRoots
|
|
77
|
+
} from "./chunk-HUCT7HID.js";
|
|
46
78
|
import {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} from "./chunk-ODS2MVMU.js";
|
|
79
|
+
canonicalizeToolNames
|
|
80
|
+
} from "./chunk-ZZ2MH7LE.js";
|
|
50
81
|
import {
|
|
51
82
|
toErrorMessage
|
|
52
83
|
} from "./chunk-HNMXYYJR.js";
|
|
53
|
-
import {
|
|
54
|
-
clampReasoningEffort,
|
|
55
|
-
getModelConfig,
|
|
56
|
-
isModelSupportReasoningEffort
|
|
57
|
-
} from "./chunk-2K4NDPT5.js";
|
|
58
84
|
import {
|
|
59
85
|
isDeepInfraKimiModel,
|
|
60
86
|
isFireworksKimiModel,
|
|
61
87
|
resolveFireworksKimiModel
|
|
62
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-OR2HNLVO.js";
|
|
89
|
+
import {
|
|
90
|
+
createSpaceKey
|
|
91
|
+
} from "./chunk-4F5M2MW5.js";
|
|
63
92
|
import {
|
|
64
93
|
read
|
|
65
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-UM4H3URE.js";
|
|
66
95
|
import {
|
|
67
96
|
asTrimmedLowercaseString
|
|
68
97
|
} from "./chunk-QSJ3HFEF.js";
|
|
98
|
+
import {
|
|
99
|
+
getRuntimeServerContext
|
|
100
|
+
} from "./chunk-X664KVEV.js";
|
|
69
101
|
import {
|
|
70
102
|
isAbortError
|
|
71
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-WJSW43QZ.js";
|
|
104
|
+
import {
|
|
105
|
+
asTrimmedString
|
|
106
|
+
} from "./chunk-3EUW3WEO.js";
|
|
107
|
+
import {
|
|
108
|
+
extractCustomId
|
|
109
|
+
} from "./chunk-BJIRLHJR.js";
|
|
72
110
|
import {
|
|
73
111
|
API_ENDPOINTS
|
|
74
112
|
} from "./chunk-LCBAMY2M.js";
|
|
75
113
|
import {
|
|
76
114
|
isLoopbackUrl
|
|
77
115
|
} from "./chunk-4SN6J65J.js";
|
|
78
|
-
import {
|
|
79
|
-
asTrimmedString
|
|
80
|
-
} from "./chunk-3EUW3WEO.js";
|
|
81
|
-
import {
|
|
82
|
-
buildSkillGuidancePromptBlock,
|
|
83
|
-
canonicalizeToolNames,
|
|
84
|
-
extractRuntimePageCapabilities,
|
|
85
|
-
resolveSkillGraphFromRoots
|
|
86
|
-
} from "./chunk-3AUWC6EM.js";
|
|
87
116
|
import {
|
|
88
117
|
asOptionalTrimmedString
|
|
89
118
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -452,55 +481,6 @@ function resolveAgentCallPlan(agentConfig, _env) {
|
|
|
452
481
|
};
|
|
453
482
|
}
|
|
454
483
|
|
|
455
|
-
// packages/ai/llm/usageRequestOptions.ts
|
|
456
|
-
var STREAM_USAGE_PROVIDERS = /* @__PURE__ */ new Set([
|
|
457
|
-
"google",
|
|
458
|
-
"openrouter",
|
|
459
|
-
"xai",
|
|
460
|
-
"openai",
|
|
461
|
-
"fireworks",
|
|
462
|
-
"mistral",
|
|
463
|
-
"cloudflare",
|
|
464
|
-
"gmi"
|
|
465
|
-
]);
|
|
466
|
-
var EXTRA_USAGE_FIELD_PROVIDERS = /* @__PURE__ */ new Set(["openrouter"]);
|
|
467
|
-
var normalizeProviderName = (providerName) => asTrimmedLowercaseString(providerName);
|
|
468
|
-
var getUsageRequestOptions = (providerName, options) => {
|
|
469
|
-
const normalizedProvider = normalizeProviderName(providerName);
|
|
470
|
-
const api = options?.api ?? "chat-completions";
|
|
471
|
-
if (api === "responses") {
|
|
472
|
-
return EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
|
|
473
|
-
usage: {
|
|
474
|
-
include: true
|
|
475
|
-
}
|
|
476
|
-
} : {};
|
|
477
|
-
}
|
|
478
|
-
return {
|
|
479
|
-
...STREAM_USAGE_PROVIDERS.has(normalizedProvider) ? {
|
|
480
|
-
stream_options: {
|
|
481
|
-
include_usage: true
|
|
482
|
-
}
|
|
483
|
-
} : {},
|
|
484
|
-
...EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
|
|
485
|
-
usage: {
|
|
486
|
-
include: true
|
|
487
|
-
}
|
|
488
|
-
} : {}
|
|
489
|
-
};
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
// packages/app/i18n/mapLanguage.ts
|
|
493
|
-
var languageMap = {
|
|
494
|
-
"en-US": "English",
|
|
495
|
-
"zh-CN": "Simplified Chinese",
|
|
496
|
-
"zh-TW": "Traditional Chinese",
|
|
497
|
-
"ja-JP": "Japanese"
|
|
498
|
-
// Add more mappings as needed
|
|
499
|
-
};
|
|
500
|
-
var mapLanguage = (responseLanguage) => {
|
|
501
|
-
return languageMap[responseLanguage] || responseLanguage;
|
|
502
|
-
};
|
|
503
|
-
|
|
504
484
|
// packages/ai/agent/contextCompiler.ts
|
|
505
485
|
function createHash(_algo) {
|
|
506
486
|
let buf = "";
|
|
@@ -680,12 +660,10 @@ var buildSystemPromptContext = (options) => {
|
|
|
680
660
|
} = options;
|
|
681
661
|
const safeLanguage = options.language ?? (typeof navigator !== "undefined" ? navigator.language : "en");
|
|
682
662
|
const { name, prompt: mainPrompt, dbKey, model } = agentConfig;
|
|
683
|
-
const mappedLanguage = mapLanguage(safeLanguage);
|
|
684
663
|
const identitySection = buildIdentityBlock({
|
|
685
664
|
agentName: name,
|
|
686
665
|
agentId: dbKey,
|
|
687
|
-
model
|
|
688
|
-
responseLanguage: mappedLanguage
|
|
666
|
+
model
|
|
689
667
|
});
|
|
690
668
|
const corePersonaSection = mainPrompt ? `-- - \u6838\u5FC3\u89D2\u8272\u4E0E\u4EFB\u52A1-- -
|
|
691
669
|
${mainPrompt}` : "";
|
|
@@ -718,6 +696,7 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
|
|
|
718
696
|
${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
719
697
|
return compileContextLayers([
|
|
720
698
|
{ id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
|
|
699
|
+
{ id: "user-response-language", owner: "platform", cacheScope: "session", content: buildUserResponseLanguageContext({ language: safeLanguage }) },
|
|
721
700
|
{ id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
|
|
722
701
|
{ id: "core-persona", owner: "agent", cacheScope: "session", content: corePersonaSection },
|
|
723
702
|
{ id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
|
|
@@ -1280,27 +1259,6 @@ async function safeBrokerGet(broker, ref) {
|
|
|
1280
1259
|
}
|
|
1281
1260
|
}
|
|
1282
1261
|
|
|
1283
|
-
// packages/shared/providerSecrets.ts
|
|
1284
|
-
function providerSecretKey(presetId) {
|
|
1285
|
-
const normalized = presetId.trim().replace(/[^a-zA-Z0-9]+/g, "_").toUpperCase();
|
|
1286
|
-
return `${normalized}_KEY`;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
// packages/ai/agent/providerSecrets.ts
|
|
1290
|
-
var STORAGE_KEY = "nolo-local-secrets";
|
|
1291
|
-
function readLocalSecrets() {
|
|
1292
|
-
if (typeof localStorage === "undefined") return {};
|
|
1293
|
-
try {
|
|
1294
|
-
const value = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "{}");
|
|
1295
|
-
return value && typeof value === "object" ? value : {};
|
|
1296
|
-
} catch {
|
|
1297
|
-
return {};
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
function getLocalProviderSecret(presetId) {
|
|
1301
|
-
return readLocalSecrets()[providerSecretKey(presetId)] ?? null;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
1262
|
// packages/ai/chat/fetchUtils.ts
|
|
1305
1263
|
var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
|
|
1306
1264
|
const apiSource = agentConfig.apiSource === "custom" || agentConfig.apiSource === "cli" ? agentConfig.apiSource : void 0;
|
|
@@ -1418,7 +1376,336 @@ var performFetchRequest = async (params) => {
|
|
|
1418
1376
|
}
|
|
1419
1377
|
};
|
|
1420
1378
|
|
|
1379
|
+
// packages/create/editor/transforms/slateToText.ts
|
|
1380
|
+
function getNodeText(node) {
|
|
1381
|
+
if (node.text) {
|
|
1382
|
+
return node.text;
|
|
1383
|
+
}
|
|
1384
|
+
if (node.children && Array.isArray(node.children)) {
|
|
1385
|
+
return node.children.map(getNodeText).join("\n");
|
|
1386
|
+
}
|
|
1387
|
+
return "";
|
|
1388
|
+
}
|
|
1389
|
+
function slateToText(nodes) {
|
|
1390
|
+
if (!nodes || nodes.length === 0) {
|
|
1391
|
+
return "";
|
|
1392
|
+
}
|
|
1393
|
+
return nodes.map(getNodeText).join("\n\n");
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
// packages/ai/context/buildReferenceContext.ts
|
|
1397
|
+
var MAX_META_TEXT_LENGTH = 80;
|
|
1398
|
+
var DIALOG_REFERENCE_MESSAGE_LIMIT = 20;
|
|
1399
|
+
var DIALOG_REFERENCE_SNIPPET_CHARS = 1200;
|
|
1400
|
+
var DIALOG_HANDOFF_SNIPPET_CHARS = 360;
|
|
1401
|
+
var truncateMetaText = (value, max = MAX_META_TEXT_LENGTH) => {
|
|
1402
|
+
if (!value) return "";
|
|
1403
|
+
if (value.length <= max) return value;
|
|
1404
|
+
return `${value.slice(0, max - 3)}...`;
|
|
1405
|
+
};
|
|
1406
|
+
var readSafe = async (dispatch, dbKey) => {
|
|
1407
|
+
try {
|
|
1408
|
+
return await dispatch(read({
|
|
1409
|
+
dbKey
|
|
1410
|
+
})).unwrap();
|
|
1411
|
+
} catch {
|
|
1412
|
+
return null;
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
var buildMentionMetaMap = async (slateData, dispatch) => {
|
|
1416
|
+
const metaMap = /* @__PURE__ */ new Map();
|
|
1417
|
+
const mentions = extractCategorizedMentions(slateData);
|
|
1418
|
+
if (!mentions) return metaMap;
|
|
1419
|
+
const pageEntries = await Promise.all(
|
|
1420
|
+
(mentions.pages || []).map(async (pageId) => {
|
|
1421
|
+
const pageData = await readSafe(dispatch, pageId);
|
|
1422
|
+
if (!pageData) {
|
|
1423
|
+
return [`page:${pageId}`, { displayType: "page", metaParts: [] }];
|
|
1424
|
+
}
|
|
1425
|
+
if (pageData.type === "dialog" /* DIALOG */) {
|
|
1426
|
+
const agentCount = Array.isArray(pageData.cybots) ? pageData.cybots.length : 0;
|
|
1427
|
+
return [
|
|
1428
|
+
`page:${pageId}`,
|
|
1429
|
+
{
|
|
1430
|
+
displayType: "dialog",
|
|
1431
|
+
title: pageData.title,
|
|
1432
|
+
metaParts: [
|
|
1433
|
+
`agents=${agentCount}`,
|
|
1434
|
+
`updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
|
|
1435
|
+
]
|
|
1436
|
+
}
|
|
1437
|
+
];
|
|
1438
|
+
}
|
|
1439
|
+
const tags = pageData.tags && pageData.tags.length > 0 ? pageData.tags.slice(0, 5).join(", ") : "";
|
|
1440
|
+
return [
|
|
1441
|
+
`page:${pageId}`,
|
|
1442
|
+
{
|
|
1443
|
+
displayType: "page",
|
|
1444
|
+
title: pageData.title,
|
|
1445
|
+
metaParts: [
|
|
1446
|
+
pageData.spaceId ? `space=${pageData.spaceId}` : "",
|
|
1447
|
+
tags ? `tags=${tags}` : "",
|
|
1448
|
+
`updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
|
|
1449
|
+
].filter(Boolean)
|
|
1450
|
+
}
|
|
1451
|
+
];
|
|
1452
|
+
})
|
|
1453
|
+
);
|
|
1454
|
+
pageEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
1455
|
+
const agentEntries = await Promise.all(
|
|
1456
|
+
(mentions.agents || []).map(async (agentId) => {
|
|
1457
|
+
const agentData = await readSafe(dispatch, agentId);
|
|
1458
|
+
if (!agentData) {
|
|
1459
|
+
return [`agent:${agentId}`, { displayType: "agent", metaParts: [] }];
|
|
1460
|
+
}
|
|
1461
|
+
const desc = truncateMetaText(
|
|
1462
|
+
agentData.description || agentData.introduction || ""
|
|
1463
|
+
);
|
|
1464
|
+
return [
|
|
1465
|
+
`agent:${agentId}`,
|
|
1466
|
+
{
|
|
1467
|
+
displayType: "agent",
|
|
1468
|
+
title: agentData.name,
|
|
1469
|
+
metaParts: [
|
|
1470
|
+
`public=${agentData.isPublic ? "yes" : "no"}`,
|
|
1471
|
+
desc ? `desc=${desc}` : ""
|
|
1472
|
+
].filter(Boolean)
|
|
1473
|
+
}
|
|
1474
|
+
];
|
|
1475
|
+
})
|
|
1476
|
+
);
|
|
1477
|
+
agentEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
1478
|
+
const spaceEntries = await Promise.all(
|
|
1479
|
+
(mentions.spaces || []).map(async (spaceId) => {
|
|
1480
|
+
const spaceKey = createSpaceKey.space(spaceId);
|
|
1481
|
+
const spaceData = await readSafe(dispatch, spaceKey);
|
|
1482
|
+
if (!spaceData) {
|
|
1483
|
+
return [`space:${spaceId}`, { displayType: "space", metaParts: [] }];
|
|
1484
|
+
}
|
|
1485
|
+
const desc = truncateMetaText(spaceData.description || "");
|
|
1486
|
+
const categoriesCount = Object.keys(spaceData.categories || {}).length;
|
|
1487
|
+
const contentsCount = Object.keys(spaceData.contents || {}).length;
|
|
1488
|
+
return [
|
|
1489
|
+
`space:${spaceId}`,
|
|
1490
|
+
{
|
|
1491
|
+
displayType: "space",
|
|
1492
|
+
title: spaceData.name,
|
|
1493
|
+
metaParts: [
|
|
1494
|
+
desc ? `desc=${desc}` : "",
|
|
1495
|
+
`categories=${categoriesCount}`,
|
|
1496
|
+
`contents=${contentsCount}`
|
|
1497
|
+
].filter(Boolean)
|
|
1498
|
+
}
|
|
1499
|
+
];
|
|
1500
|
+
})
|
|
1501
|
+
);
|
|
1502
|
+
spaceEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
1503
|
+
return metaMap;
|
|
1504
|
+
};
|
|
1505
|
+
var buildInlineMention = (node, metaMap) => {
|
|
1506
|
+
const resourceType = node.resourceType || "unknown";
|
|
1507
|
+
const resourceId = node.resourceId || "unknown";
|
|
1508
|
+
const key = `${resourceType}:${resourceId}`;
|
|
1509
|
+
const meta = metaMap.get(key);
|
|
1510
|
+
const label = meta?.title || node.label || resourceId || "mention";
|
|
1511
|
+
const displayType = meta?.displayType || resourceType;
|
|
1512
|
+
const metaParts = meta?.metaParts ?? [];
|
|
1513
|
+
const idPart = resourceType === "tool" ? `tool=${resourceId}` : `dbkey=${resourceId}`;
|
|
1514
|
+
const metaSuffix = metaParts.length ? ` | ${metaParts.join(" | ")}` : "";
|
|
1515
|
+
return `@${label}(${displayType} | ${idPart}${metaSuffix})`;
|
|
1516
|
+
};
|
|
1517
|
+
var clipReferenceText = (value, max) => {
|
|
1518
|
+
const raw = typeof value === "string" ? value : value == null ? "" : JSON.stringify(value);
|
|
1519
|
+
return clipMultilineText(raw, max);
|
|
1520
|
+
};
|
|
1521
|
+
var fetchDialogReference = async (dbKey, refContent, dispatch) => {
|
|
1522
|
+
const dialogConfig = refContent;
|
|
1523
|
+
const dialogTitle = dialogConfig.title || `Untitled Dialog (${dbKey})`;
|
|
1524
|
+
const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
|
|
1525
|
+
const checkpoint = dialogConfig.runtimeCheckpoint || null;
|
|
1526
|
+
const summary = asTrimmedString(dialogConfig.summary);
|
|
1527
|
+
const messages = await dispatch(
|
|
1528
|
+
async (_dispatch, getState, { db }) => {
|
|
1529
|
+
const state = getState();
|
|
1530
|
+
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
1531
|
+
return await fetchAndCacheMessages({
|
|
1532
|
+
db,
|
|
1533
|
+
dialogId,
|
|
1534
|
+
limit: DIALOG_REFERENCE_MESSAGE_LIMIT,
|
|
1535
|
+
token,
|
|
1536
|
+
remoteServers: remoteServers.length > 0 ? remoteServers : void 0
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
);
|
|
1540
|
+
const sortedMessages = [...messages].reverse();
|
|
1541
|
+
const formatContent = (content) => clipReferenceText(content, DIALOG_REFERENCE_SNIPPET_CHARS);
|
|
1542
|
+
const transcript = sortedMessages.map((msg, index) => {
|
|
1543
|
+
const toolLine = msg.toolName ? ` tool=${msg.toolName}` : "";
|
|
1544
|
+
const agentLine = msg.cybotKey ? ` agent=${msg.cybotKey}` : "";
|
|
1545
|
+
const createdLine = msg.createdAt ? ` at=${msg.createdAt}` : "";
|
|
1546
|
+
return [
|
|
1547
|
+
`### Message ${index + 1}: ${msg.role || "unknown"} id=${msg.id || "unknown"}${toolLine}${agentLine}${createdLine}`,
|
|
1548
|
+
formatContent(msg.content) || "[empty]"
|
|
1549
|
+
].join("\n");
|
|
1550
|
+
}).join("\n\n");
|
|
1551
|
+
const checkpointLines = [];
|
|
1552
|
+
if (checkpoint && typeof checkpoint === "object") {
|
|
1553
|
+
if (checkpoint.status) checkpointLines.push(`- status: ${checkpoint.status}`);
|
|
1554
|
+
if (checkpoint.lastUserInput) checkpointLines.push(`- lastUserInput: ${formatContent(checkpoint.lastUserInput)}`);
|
|
1555
|
+
if (checkpoint.lastAssistantText) checkpointLines.push(`- lastAssistantText: ${formatContent(checkpoint.lastAssistantText)}`);
|
|
1556
|
+
if (Array.isArray(checkpoint.lastToolNames) && checkpoint.lastToolNames.length) {
|
|
1557
|
+
checkpointLines.push(`- lastToolNames: ${checkpoint.lastToolNames.join(", ")}`);
|
|
1558
|
+
}
|
|
1559
|
+
if (Array.isArray(checkpoint.availableToolNames) && checkpoint.availableToolNames.length) {
|
|
1560
|
+
checkpointLines.push(`- availableToolNames: ${checkpoint.availableToolNames.join(", ")}`);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
const recentToolEvidence = sortedMessages.filter((msg) => msg.role === "tool" || msg.toolName).slice(-3).map((msg) => {
|
|
1564
|
+
const label = msg.toolName ? `${msg.toolName}` : "tool";
|
|
1565
|
+
return `- ${label} id=${msg.id || "unknown"}: ${clipReferenceText(msg.content, DIALOG_HANDOFF_SNIPPET_CHARS) || "[empty]"}`;
|
|
1566
|
+
});
|
|
1567
|
+
const handoffLines = [
|
|
1568
|
+
`- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
|
|
1569
|
+
`- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
|
|
1570
|
+
summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
|
|
1571
|
+
recentToolEvidence.length ? `- Recent tool evidence:
|
|
1572
|
+
${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
|
|
1573
|
+
`- For exact claims, old decisions, original wording, files/tools mentioned earlier, or anything not visible in the recent transcript, call searchDialogMessages with DB Key ${dbKey}.`
|
|
1574
|
+
].filter(Boolean);
|
|
1575
|
+
const referenceBody = [
|
|
1576
|
+
`Conversation Reference:`,
|
|
1577
|
+
`DB Key: ${dbKey}`,
|
|
1578
|
+
`Title: ${dialogTitle}`,
|
|
1579
|
+
`Status: ${dialogConfig.status || "unknown"}`,
|
|
1580
|
+
`Loaded Recent Messages: ${sortedMessages.length}`,
|
|
1581
|
+
`Conversation Handoff:
|
|
1582
|
+
${handoffLines.join("\n")}`,
|
|
1583
|
+
checkpointLines.length ? `Runtime Checkpoint:
|
|
1584
|
+
${checkpointLines.join("\n")}` : "",
|
|
1585
|
+
summary ? `Passive Summary (compressed history, not original wording):
|
|
1586
|
+
${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
|
|
1587
|
+
`Recent Transcript (original message excerpts, oldest to newest):
|
|
1588
|
+
${transcript || "[no recent messages loaded]"}`,
|
|
1589
|
+
[
|
|
1590
|
+
`Coverage Note: This reference intentionally loads only the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages plus summaries/checkpoint to control token load.`,
|
|
1591
|
+
`Original Message Lookup Policy: If the user asks for an exact old message, original wording, who said what, why a decision was made, early-history detail, file/tool evidence, failed attempts, or a comparison with prior work, use searchDialogMessages({ dialogKey: "${dbKey}", query: "..." }) before making a factual claim from this referenced conversation.`
|
|
1592
|
+
].join("\n")
|
|
1593
|
+
].filter(Boolean).join("\n\n");
|
|
1594
|
+
const tokenEstimate = estimateTokenCount(referenceBody);
|
|
1595
|
+
return `${referenceBody}
|
|
1596
|
+
|
|
1597
|
+
Token Load Estimate: ${tokenEstimate} tokens for this conversation reference.
|
|
1598
|
+
---
|
|
1599
|
+
|
|
1600
|
+
`;
|
|
1601
|
+
};
|
|
1602
|
+
var fetchTableReference = async (dbKey, refContent, dispatch) => {
|
|
1603
|
+
const tableMeta = refContent;
|
|
1604
|
+
const title = tableMeta.displayName || tableMeta.description || `Untitled Table (${dbKey})`;
|
|
1605
|
+
const { markdown: tableMd } = await dispatch(
|
|
1606
|
+
async (_dispatch, getState, { db }) => {
|
|
1607
|
+
const state = getState();
|
|
1608
|
+
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
1609
|
+
return await fetchAndSerializeTable(tableMeta, db, {
|
|
1610
|
+
token,
|
|
1611
|
+
remoteServers
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
);
|
|
1615
|
+
const tags = tableMeta.tags?.length ? tableMeta.tags.join(", ") : "None";
|
|
1616
|
+
const description = tableMeta.description || "No description provided.";
|
|
1617
|
+
return `Reference Item (Table):
|
|
1618
|
+
DB Key: ${dbKey}
|
|
1619
|
+
Title: ${title}
|
|
1620
|
+
Description: ${description}
|
|
1621
|
+
Tags: ${tags}
|
|
1622
|
+
Content (Markdown Table):
|
|
1623
|
+
|
|
1624
|
+
${tableMd}
|
|
1625
|
+
---
|
|
1626
|
+
|
|
1627
|
+
`;
|
|
1628
|
+
};
|
|
1629
|
+
var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
|
|
1630
|
+
if (!refContent?.slateData) return null;
|
|
1631
|
+
const title = refContent.title || `Untitled (${dbKey})`;
|
|
1632
|
+
let contentString;
|
|
1633
|
+
let contentType;
|
|
1634
|
+
const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
|
|
1635
|
+
switch (options.format) {
|
|
1636
|
+
case "text":
|
|
1637
|
+
contentType = "Plain Text";
|
|
1638
|
+
contentString = slateToText(refContent.slateData);
|
|
1639
|
+
break;
|
|
1640
|
+
case "simplified_markdown":
|
|
1641
|
+
contentType = "Simplified Markdown";
|
|
1642
|
+
if (inlineMentionMeta) {
|
|
1643
|
+
const metaMap = await buildMentionMetaMap(refContent.slateData, dispatch);
|
|
1644
|
+
contentString = slateToSimplifiedMarkdown(refContent.slateData, {
|
|
1645
|
+
mentionResolver: (node) => buildInlineMention(node, metaMap)
|
|
1646
|
+
});
|
|
1647
|
+
} else {
|
|
1648
|
+
contentString = slateToSimplifiedMarkdown(refContent.slateData);
|
|
1649
|
+
}
|
|
1650
|
+
break;
|
|
1651
|
+
case "json":
|
|
1652
|
+
default:
|
|
1653
|
+
contentType = "Slate JSON";
|
|
1654
|
+
contentString = JSON.stringify(refContent.slateData, null, 2);
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
if (!contentString || typeof contentString === "string" && !contentString.trim() || contentString === "[]") {
|
|
1658
|
+
return null;
|
|
1659
|
+
}
|
|
1660
|
+
const tags = (refContent.tags || []).length > 0 ? refContent.tags.join(", ") : "None";
|
|
1661
|
+
const createdAt = refContent.created || "Unknown Creation Date";
|
|
1662
|
+
const updatedAt = refContent.updated || "Unknown Update Date";
|
|
1663
|
+
return `Reference Item:
|
|
1664
|
+
DB Key: ${dbKey}
|
|
1665
|
+
Title: ${title}
|
|
1666
|
+
Content (${contentType}):
|
|
1667
|
+
${contentString}
|
|
1668
|
+
Tags: ${tags}
|
|
1669
|
+
Created At: ${createdAt}
|
|
1670
|
+
Updated At: ${updatedAt}
|
|
1671
|
+
---
|
|
1672
|
+
|
|
1673
|
+
`;
|
|
1674
|
+
};
|
|
1675
|
+
var fetchReferenceContents = async (references, dispatch, options = { format: "simplified_markdown" }) => {
|
|
1676
|
+
const result = /* @__PURE__ */ new Map();
|
|
1677
|
+
if (!references || references.length === 0) return result;
|
|
1678
|
+
const referencePromises = references.map(async (dbKey) => {
|
|
1679
|
+
try {
|
|
1680
|
+
const hasPreloaded = options.preloaded?.has(dbKey);
|
|
1681
|
+
const refContent = hasPreloaded ? options.preloaded?.get(dbKey) : await dispatch(read({
|
|
1682
|
+
dbKey
|
|
1683
|
+
})).unwrap();
|
|
1684
|
+
if (!refContent) return null;
|
|
1685
|
+
let formatted = null;
|
|
1686
|
+
if (refContent.type === "dialog" /* DIALOG */) {
|
|
1687
|
+
formatted = await fetchDialogReference(dbKey, refContent, dispatch);
|
|
1688
|
+
} else if (refContent.type === "table" /* TABLE */) {
|
|
1689
|
+
formatted = await fetchTableReference(dbKey, refContent, dispatch);
|
|
1690
|
+
} else {
|
|
1691
|
+
formatted = await fetchSlateReference(dbKey, refContent, dispatch, options);
|
|
1692
|
+
}
|
|
1693
|
+
if (formatted) return [dbKey, formatted];
|
|
1694
|
+
return null;
|
|
1695
|
+
} catch (error) {
|
|
1696
|
+
console.error(`Error fetching reference ${dbKey}:`, error);
|
|
1697
|
+
return null;
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
const resolved = await Promise.all(referencePromises);
|
|
1701
|
+
resolved.forEach((item) => {
|
|
1702
|
+
if (item) result.set(item[0], item[1]);
|
|
1703
|
+
});
|
|
1704
|
+
return result;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1421
1707
|
export {
|
|
1708
|
+
fetchReferenceContents,
|
|
1422
1709
|
mergeReferences,
|
|
1423
1710
|
resolveReferenceAssets,
|
|
1424
1711
|
resolveToolsFromKeys,
|