nolo-cli 0.32.0 → 0.33.0-alpha.3
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-RWPVI3YV.js} +76 -67
- package/{action-HI3VRQLP.js → action-SMLG6OTB.js} +17 -15
- package/{addContentAction-NCURJ6PK.js → addContentAction-SFO244QN.js} +14 -13
- package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-W44ZCEHB.js} +14 -13
- package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-KU2RXQPP.js} +42 -59
- package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-MPCMDENS.js} +89 -80
- package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
- package/{agentListCommands-SF3HEUTT.js → agentListCommands-EPD4N6FX.js} +73 -78
- package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-AF7C3YRT.js} +40 -57
- package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-YH5GEBK4.js} +5 -5
- package/agentRecordCommands-EYE6MZZG.js +112 -0
- package/agentRunCommand-LL22SGTN.js +130 -0
- package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-JX34G47Z.js} +35 -50
- package/{agentSlice-4XWW344Y.js → agentSlice-TNMFQQOV.js} +15 -13
- package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-43K5VXQB.js} +38 -55
- package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-FEEJSVDZ.js} +38 -55
- package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-H76CG45R.js} +38 -55
- package/{appGetCommands-QSSOSEYL.js → appGetCommands-MDZYFTYZ.js} +38 -55
- package/{appListCommands-PH3XWNDX.js → appListCommands-TUJJXPWG.js} +38 -55
- package/{authCommand-BBDHMSO6.js → authCommand-T7UK4CWS.js} +18 -18
- package/{authCommands-4UDEKRE6.js → authCommands-EAPFGNHN.js} +8 -8
- package/chatQueueReduxAdapter-LVQXC4ZY.js +180 -0
- package/chunk-2H3XIBY4.js +239 -0
- package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
- package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
- package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
- package/{chunk-SWYMCHM7.js → chunk-37V5LNEQ.js} +69 -1
- package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
- package/{chunk-O3JR45Q2.js → chunk-3VAQHAXT.js} +44 -44
- package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
- package/{chunk-LAXMH7JY.js → chunk-57QJXIB6.js} +18 -15
- package/chunk-5CS33IBL.js +301 -0
- package/{chunk-3UGKATZQ.js → chunk-5SBK2MTI.js} +8 -369
- package/chunk-6PO2SYCS.js +1800 -0
- package/{chunk-TA6EA2A3.js → chunk-6SXC35F4.js} +182 -20
- package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-3GZT3L6F.js → chunk-73GINUCW.js} +326 -481
- package/{chunk-VMWR7VNI.js → chunk-7E72JMBB.js} +7 -7
- package/{chunk-4PNU7W7K.js → chunk-AAGCMVFT.js} +106 -124
- package/chunk-ADLYMQB6.js +642 -0
- package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
- package/{chunk-UDA3ZYLW.js → chunk-AFV4FOT2.js} +70 -24
- package/{chunk-BGTUGS3T.js → chunk-AOXVOC6D.js} +4 -30
- package/{chunk-2ZRP5RUG.js → chunk-B2BSG6QQ.js} +12 -11
- package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
- package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
- package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
- package/{chunk-G5GVZAXF.js → chunk-CLP2K7U4.js} +15 -19
- package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
- package/{chunk-YHGHADBQ.js → chunk-DPMBNHOJ.js} +4 -4
- package/chunk-EGRJC4ZN.js +91 -0
- package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
- package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
- package/{chunk-RH53LMEJ.js → chunk-FSSX3XRY.js} +2 -4
- package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
- package/{chunk-EEF23OOK.js → chunk-GMXWYXAF.js} +7 -7
- package/{chunk-SFWZUTCI.js → chunk-GTYM4HKV.js} +1 -1
- package/{chunk-MITD7CON.js → chunk-HDKRSRYU.js} +1461 -301
- package/chunk-HS7MLR74.js +38 -0
- package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
- package/{chunk-PTHDLIRB.js → chunk-I6N2UVVY.js} +1 -1
- package/chunk-IDAU4UFS.js +437 -0
- package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
- package/{chunk-OWHNFZNW.js → chunk-IL545V3E.js} +4 -4
- package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
- package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
- package/{chunk-2HXKAPH7.js → chunk-JMPYDFHY.js} +6 -6
- package/{chunk-V54H24CQ.js → chunk-JTSGWTYZ.js} +3 -3
- package/{chunk-ATK5WJOA.js → chunk-JZ5AMMXU.js} +4 -4
- 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-DLWCWUNW.js → chunk-LOD75GOS.js} +336 -32
- package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-XDHHF73Q.js → chunk-M4NC7NF6.js} +95 -95
- package/{chunk-3FCNXC2J.js → chunk-MPZJVZDC.js} +3735 -1394
- package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
- package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
- package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
- package/{chunk-6YABCOFU.js → chunk-NUO3QFWD.js} +1 -1
- package/{chunk-GAF5X6B7.js → chunk-O6GEBMIY.js} +269 -309
- package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
- package/chunk-OW765XBU.js +10 -0
- package/chunk-PREQU5QV.js +231 -0
- package/{chunk-Q3CSL43H.js → chunk-Q5ITEGIN.js} +1 -1
- package/{chunk-7S54ZGF6.js → chunk-RAZOLMJR.js} +256 -12
- package/chunk-RCFIB45Q.js +28 -0
- package/chunk-RY57GLGW.js +188 -0
- package/{chunk-KGEVMUMI.js → chunk-TFPUAELY.js} +11 -11
- package/{chunk-ZJH3LKEW.js → chunk-UK5JGQVU.js} +94 -15
- package/chunk-URMS4XY2.js +10 -0
- package/{chunk-RXVX5LFR.js → chunk-VH2F7ZB6.js} +1 -1
- package/chunk-VIDPVFP3.js +20 -0
- package/{chunk-W367V5CH.js → chunk-WHD6BG7M.js} +400 -115
- 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-43EPBPZ2.js → chunk-XCCGU6QB.js} +2 -2
- package/chunk-Y5GCAMGP.js +9 -0
- 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-ODS2MVMU.js → chunk-ZJMME4DS.js} +19 -303
- package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
- 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-INQT23LX.js} +40 -31
- package/createDialogAction-LDCPDI73.js +60 -0
- package/{createPageAction-7YROVZ3W.js → createPageAction-5YXOG2M4.js} +56 -47
- package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
- package/{dbSlice-BBL3PEVW.js → dbSlice-3SD5L5H2.js} +13 -12
- package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
- package/dialogCommands-CHJO47AX.js +81 -0
- package/{dialogSlice-N4HPG6HM.js → dialogSlice-DOWKOILN.js} +36 -29
- package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-OVZARUFX.js} +40 -55
- package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-E2XJ62LD.js} +42 -57
- package/{docReadCommands-H55VQ2US.js → docReadCommands-I7OSREPJ.js} +40 -55
- package/{docStore-B5AHDNW5.js → docStore-UAWSKZ2Y.js} +39 -30
- package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-X4Z26VJM.js} +43 -58
- package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
- package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
- package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-C3TSDWKH.js} +38 -31
- package/index.js +67 -67
- package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
- package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
- package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-E3R24J4T.js} +4 -2
- package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-DDZCJFQZ.js} +1 -1
- package/{machineCommands-H3UMKE76.js → machineCommands-BUOIYJAD.js} +93 -84
- package/{machineWsRunDispatch-HONRUK3R.js → machineWsRunDispatch-7CRWAA6O.js} +83 -74
- 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-6G73BMEY.js} +8 -7
- package/{readDocTool-MXM3T6PE.js → readDocTool-DK4EI2GA.js} +1 -2
- package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-ZDWEASJV.js} +265 -428
- package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-E7H557UO.js} +19 -17
- package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-U7HYA3O5.js} +72 -64
- package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KIKM6BIO.js} +5 -5
- package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-RMMGBR5F.js} +15 -14
- package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-FWBKKLVA.js} +19 -17
- package/{settingSlice-4M37TN7V.js → settingSlice-73PV4KG4.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-GEWZXGHM.js} +43 -240
- package/{spaceSlice-T6YK6D34.js → spaceSlice-B6MOVY4N.js} +38 -61
- package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-T527EQTT.js} +1261 -150
- package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-US6QNL3N.js} +14 -13
- package/syncMapping-RK2MANUX.js +43 -0
- package/{tableCommands-RJZ3V4TF.js → tableCommands-QE47K72R.js} +8 -7
- package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
- package/tools-XMWCVMPM.js +98 -0
- package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-NCAJSVSD.js} +24 -21
- package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-XPJZRJEL.js} +48 -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/tools-KYZX3BGO.js +0 -90
- package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
- package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isImageUrlPart
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NNWHHCVP.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
clipMultilineText,
|
|
9
|
-
fetchAndSerializeTable
|
|
10
|
-
} from "./chunk-D2BPX6DQ.js";
|
|
11
|
-
import {
|
|
12
|
-
slateToSimplifiedMarkdown
|
|
13
|
-
} from "./chunk-SWYMCHM7.js";
|
|
14
|
-
import {
|
|
15
|
-
fetchAndCacheMessages
|
|
16
|
-
} from "./chunk-3GZT3L6F.js";
|
|
17
|
-
import {
|
|
18
|
-
estimateTokenCount
|
|
19
|
-
} from "./chunk-BGTUGS3T.js";
|
|
20
|
-
import {
|
|
21
|
-
createSpaceKey
|
|
22
|
-
} from "./chunk-V54H24CQ.js";
|
|
23
|
-
import {
|
|
24
|
-
read
|
|
25
|
-
} from "./chunk-LAXMH7JY.js";
|
|
5
|
+
canonicalizeToolNames
|
|
6
|
+
} from "./chunk-ZZ2MH7LE.js";
|
|
26
7
|
import {
|
|
27
8
|
asTrimmedLowercaseString
|
|
28
9
|
} from "./chunk-QSJ3HFEF.js";
|
|
29
|
-
import {
|
|
30
|
-
extractCustomId
|
|
31
|
-
} from "./chunk-TOW4E763.js";
|
|
32
|
-
import {
|
|
33
|
-
getRuntimeServerContext
|
|
34
|
-
} from "./chunk-2IJAKBK2.js";
|
|
35
|
-
import {
|
|
36
|
-
extractCategorizedMentions
|
|
37
|
-
} from "./chunk-VP4WJWKW.js";
|
|
38
10
|
import {
|
|
39
11
|
asTrimmedString
|
|
40
12
|
} from "./chunk-3EUW3WEO.js";
|
|
41
|
-
import {
|
|
42
|
-
canonicalizeToolNames
|
|
43
|
-
} from "./chunk-3AUWC6EM.js";
|
|
44
13
|
|
|
45
14
|
// packages/agent-runtime/identityBlock.ts
|
|
46
15
|
var buildIdentityBlock = (input) => {
|
|
@@ -48,340 +17,11 @@ var buildIdentityBlock = (input) => {
|
|
|
48
17
|
"--- \u8EAB\u4EFD\u4FE1\u606F ---",
|
|
49
18
|
asTrimmedString(input.agentName) ? `\u540D\u79F0: ${asTrimmedString(input.agentName)}` : "",
|
|
50
19
|
asTrimmedString(input.agentId) ? `ID: ${asTrimmedString(input.agentId)}` : "",
|
|
51
|
-
asTrimmedString(input.model) ? `\u6A21\u578B: ${asTrimmedString(input.model)}` : ""
|
|
52
|
-
`\u56DE\u590D\u8BED\u8A00: ${asTrimmedString(input.responseLanguage) || "\u9ED8\u8BA4\u8DDF\u968F\u7528\u6237\u672C\u8F6E\u8F93\u5165\u8BED\u8A00"}`
|
|
20
|
+
asTrimmedString(input.model) ? `\u6A21\u578B: ${asTrimmedString(input.model)}` : ""
|
|
53
21
|
].filter(Boolean);
|
|
54
22
|
return lines.join("\n");
|
|
55
23
|
};
|
|
56
24
|
|
|
57
|
-
// packages/create/editor/transforms/slateToText.ts
|
|
58
|
-
function getNodeText(node) {
|
|
59
|
-
if (node.text) {
|
|
60
|
-
return node.text;
|
|
61
|
-
}
|
|
62
|
-
if (node.children && Array.isArray(node.children)) {
|
|
63
|
-
return node.children.map(getNodeText).join("\n");
|
|
64
|
-
}
|
|
65
|
-
return "";
|
|
66
|
-
}
|
|
67
|
-
function slateToText(nodes) {
|
|
68
|
-
if (!nodes || nodes.length === 0) {
|
|
69
|
-
return "";
|
|
70
|
-
}
|
|
71
|
-
return nodes.map(getNodeText).join("\n\n");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// packages/ai/context/buildReferenceContext.ts
|
|
75
|
-
var MAX_META_TEXT_LENGTH = 80;
|
|
76
|
-
var DIALOG_REFERENCE_MESSAGE_LIMIT = 20;
|
|
77
|
-
var DIALOG_REFERENCE_SNIPPET_CHARS = 1200;
|
|
78
|
-
var DIALOG_HANDOFF_SNIPPET_CHARS = 360;
|
|
79
|
-
var truncateMetaText = (value, max = MAX_META_TEXT_LENGTH) => {
|
|
80
|
-
if (!value) return "";
|
|
81
|
-
if (value.length <= max) return value;
|
|
82
|
-
return `${value.slice(0, max - 3)}...`;
|
|
83
|
-
};
|
|
84
|
-
var readSafe = async (dispatch, dbKey) => {
|
|
85
|
-
try {
|
|
86
|
-
return await dispatch(read({
|
|
87
|
-
dbKey
|
|
88
|
-
})).unwrap();
|
|
89
|
-
} catch {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var buildMentionMetaMap = async (slateData, dispatch) => {
|
|
94
|
-
const metaMap = /* @__PURE__ */ new Map();
|
|
95
|
-
const mentions = extractCategorizedMentions(slateData);
|
|
96
|
-
if (!mentions) return metaMap;
|
|
97
|
-
const pageEntries = await Promise.all(
|
|
98
|
-
(mentions.pages || []).map(async (pageId) => {
|
|
99
|
-
const pageData = await readSafe(dispatch, pageId);
|
|
100
|
-
if (!pageData) {
|
|
101
|
-
return [`page:${pageId}`, { displayType: "page", metaParts: [] }];
|
|
102
|
-
}
|
|
103
|
-
if (pageData.type === "dialog" /* DIALOG */) {
|
|
104
|
-
const agentCount = Array.isArray(pageData.cybots) ? pageData.cybots.length : 0;
|
|
105
|
-
return [
|
|
106
|
-
`page:${pageId}`,
|
|
107
|
-
{
|
|
108
|
-
displayType: "dialog",
|
|
109
|
-
title: pageData.title,
|
|
110
|
-
metaParts: [
|
|
111
|
-
`agents=${agentCount}`,
|
|
112
|
-
`updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
];
|
|
116
|
-
}
|
|
117
|
-
const tags = pageData.tags && pageData.tags.length > 0 ? pageData.tags.slice(0, 5).join(", ") : "";
|
|
118
|
-
return [
|
|
119
|
-
`page:${pageId}`,
|
|
120
|
-
{
|
|
121
|
-
displayType: "page",
|
|
122
|
-
title: pageData.title,
|
|
123
|
-
metaParts: [
|
|
124
|
-
pageData.spaceId ? `space=${pageData.spaceId}` : "",
|
|
125
|
-
tags ? `tags=${tags}` : "",
|
|
126
|
-
`updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
|
|
127
|
-
].filter(Boolean)
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
})
|
|
131
|
-
);
|
|
132
|
-
pageEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
133
|
-
const agentEntries = await Promise.all(
|
|
134
|
-
(mentions.agents || []).map(async (agentId) => {
|
|
135
|
-
const agentData = await readSafe(dispatch, agentId);
|
|
136
|
-
if (!agentData) {
|
|
137
|
-
return [`agent:${agentId}`, { displayType: "agent", metaParts: [] }];
|
|
138
|
-
}
|
|
139
|
-
const desc = truncateMetaText(
|
|
140
|
-
agentData.description || agentData.introduction || ""
|
|
141
|
-
);
|
|
142
|
-
return [
|
|
143
|
-
`agent:${agentId}`,
|
|
144
|
-
{
|
|
145
|
-
displayType: "agent",
|
|
146
|
-
title: agentData.name,
|
|
147
|
-
metaParts: [
|
|
148
|
-
`public=${agentData.isPublic ? "yes" : "no"}`,
|
|
149
|
-
desc ? `desc=${desc}` : ""
|
|
150
|
-
].filter(Boolean)
|
|
151
|
-
}
|
|
152
|
-
];
|
|
153
|
-
})
|
|
154
|
-
);
|
|
155
|
-
agentEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
156
|
-
const spaceEntries = await Promise.all(
|
|
157
|
-
(mentions.spaces || []).map(async (spaceId) => {
|
|
158
|
-
const spaceKey = createSpaceKey.space(spaceId);
|
|
159
|
-
const spaceData = await readSafe(dispatch, spaceKey);
|
|
160
|
-
if (!spaceData) {
|
|
161
|
-
return [`space:${spaceId}`, { displayType: "space", metaParts: [] }];
|
|
162
|
-
}
|
|
163
|
-
const desc = truncateMetaText(spaceData.description || "");
|
|
164
|
-
const categoriesCount = Object.keys(spaceData.categories || {}).length;
|
|
165
|
-
const contentsCount = Object.keys(spaceData.contents || {}).length;
|
|
166
|
-
return [
|
|
167
|
-
`space:${spaceId}`,
|
|
168
|
-
{
|
|
169
|
-
displayType: "space",
|
|
170
|
-
title: spaceData.name,
|
|
171
|
-
metaParts: [
|
|
172
|
-
desc ? `desc=${desc}` : "",
|
|
173
|
-
`categories=${categoriesCount}`,
|
|
174
|
-
`contents=${contentsCount}`
|
|
175
|
-
].filter(Boolean)
|
|
176
|
-
}
|
|
177
|
-
];
|
|
178
|
-
})
|
|
179
|
-
);
|
|
180
|
-
spaceEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
181
|
-
return metaMap;
|
|
182
|
-
};
|
|
183
|
-
var buildInlineMention = (node, metaMap) => {
|
|
184
|
-
const resourceType = node.resourceType || "unknown";
|
|
185
|
-
const resourceId = node.resourceId || "unknown";
|
|
186
|
-
const key = `${resourceType}:${resourceId}`;
|
|
187
|
-
const meta = metaMap.get(key);
|
|
188
|
-
const label = meta?.title || node.label || resourceId || "mention";
|
|
189
|
-
const displayType = meta?.displayType || resourceType;
|
|
190
|
-
const metaParts = meta?.metaParts ?? [];
|
|
191
|
-
const idPart = resourceType === "tool" ? `tool=${resourceId}` : `dbkey=${resourceId}`;
|
|
192
|
-
const metaSuffix = metaParts.length ? ` | ${metaParts.join(" | ")}` : "";
|
|
193
|
-
return `@${label}(${displayType} | ${idPart}${metaSuffix})`;
|
|
194
|
-
};
|
|
195
|
-
var clipReferenceText = (value, max) => {
|
|
196
|
-
const raw = typeof value === "string" ? value : value == null ? "" : JSON.stringify(value);
|
|
197
|
-
return clipMultilineText(raw, max);
|
|
198
|
-
};
|
|
199
|
-
var fetchDialogReference = async (dbKey, refContent, dispatch) => {
|
|
200
|
-
const dialogConfig = refContent;
|
|
201
|
-
const dialogTitle = dialogConfig.title || `Untitled Dialog (${dbKey})`;
|
|
202
|
-
const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
|
|
203
|
-
const checkpoint = dialogConfig.runtimeCheckpoint || null;
|
|
204
|
-
const summary = asTrimmedString(dialogConfig.summary);
|
|
205
|
-
const messages = await dispatch(
|
|
206
|
-
async (_dispatch, getState, { db }) => {
|
|
207
|
-
const state = getState();
|
|
208
|
-
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
209
|
-
return await fetchAndCacheMessages({
|
|
210
|
-
db,
|
|
211
|
-
dialogId,
|
|
212
|
-
limit: DIALOG_REFERENCE_MESSAGE_LIMIT,
|
|
213
|
-
token,
|
|
214
|
-
remoteServers: remoteServers.length > 0 ? remoteServers : void 0
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
const sortedMessages = [...messages].reverse();
|
|
219
|
-
const formatContent = (content) => clipReferenceText(content, DIALOG_REFERENCE_SNIPPET_CHARS);
|
|
220
|
-
const transcript = sortedMessages.map((msg, index) => {
|
|
221
|
-
const toolLine = msg.toolName ? ` tool=${msg.toolName}` : "";
|
|
222
|
-
const agentLine = msg.cybotKey ? ` agent=${msg.cybotKey}` : "";
|
|
223
|
-
const createdLine = msg.createdAt ? ` at=${msg.createdAt}` : "";
|
|
224
|
-
return [
|
|
225
|
-
`### Message ${index + 1}: ${msg.role || "unknown"} id=${msg.id || "unknown"}${toolLine}${agentLine}${createdLine}`,
|
|
226
|
-
formatContent(msg.content) || "[empty]"
|
|
227
|
-
].join("\n");
|
|
228
|
-
}).join("\n\n");
|
|
229
|
-
const checkpointLines = [];
|
|
230
|
-
if (checkpoint && typeof checkpoint === "object") {
|
|
231
|
-
if (checkpoint.status) checkpointLines.push(`- status: ${checkpoint.status}`);
|
|
232
|
-
if (checkpoint.lastUserInput) checkpointLines.push(`- lastUserInput: ${formatContent(checkpoint.lastUserInput)}`);
|
|
233
|
-
if (checkpoint.lastAssistantText) checkpointLines.push(`- lastAssistantText: ${formatContent(checkpoint.lastAssistantText)}`);
|
|
234
|
-
if (Array.isArray(checkpoint.lastToolNames) && checkpoint.lastToolNames.length) {
|
|
235
|
-
checkpointLines.push(`- lastToolNames: ${checkpoint.lastToolNames.join(", ")}`);
|
|
236
|
-
}
|
|
237
|
-
if (Array.isArray(checkpoint.availableToolNames) && checkpoint.availableToolNames.length) {
|
|
238
|
-
checkpointLines.push(`- availableToolNames: ${checkpoint.availableToolNames.join(", ")}`);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const recentToolEvidence = sortedMessages.filter((msg) => msg.role === "tool" || msg.toolName).slice(-3).map((msg) => {
|
|
242
|
-
const label = msg.toolName ? `${msg.toolName}` : "tool";
|
|
243
|
-
return `- ${label} id=${msg.id || "unknown"}: ${clipReferenceText(msg.content, DIALOG_HANDOFF_SNIPPET_CHARS) || "[empty]"}`;
|
|
244
|
-
});
|
|
245
|
-
const handoffLines = [
|
|
246
|
-
`- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
|
|
247
|
-
`- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
|
|
248
|
-
summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
|
|
249
|
-
recentToolEvidence.length ? `- Recent tool evidence:
|
|
250
|
-
${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
|
|
251
|
-
`- 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}.`
|
|
252
|
-
].filter(Boolean);
|
|
253
|
-
const referenceBody = [
|
|
254
|
-
`Conversation Reference:`,
|
|
255
|
-
`DB Key: ${dbKey}`,
|
|
256
|
-
`Title: ${dialogTitle}`,
|
|
257
|
-
`Status: ${dialogConfig.status || "unknown"}`,
|
|
258
|
-
`Loaded Recent Messages: ${sortedMessages.length}`,
|
|
259
|
-
`Conversation Handoff:
|
|
260
|
-
${handoffLines.join("\n")}`,
|
|
261
|
-
checkpointLines.length ? `Runtime Checkpoint:
|
|
262
|
-
${checkpointLines.join("\n")}` : "",
|
|
263
|
-
summary ? `Passive Summary (compressed history, not original wording):
|
|
264
|
-
${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
|
|
265
|
-
`Recent Transcript (original message excerpts, oldest to newest):
|
|
266
|
-
${transcript || "[no recent messages loaded]"}`,
|
|
267
|
-
[
|
|
268
|
-
`Coverage Note: This reference intentionally loads only the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages plus summaries/checkpoint to control token load.`,
|
|
269
|
-
`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.`
|
|
270
|
-
].join("\n")
|
|
271
|
-
].filter(Boolean).join("\n\n");
|
|
272
|
-
const tokenEstimate = estimateTokenCount(referenceBody);
|
|
273
|
-
return `${referenceBody}
|
|
274
|
-
|
|
275
|
-
Token Load Estimate: ${tokenEstimate} tokens for this conversation reference.
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
`;
|
|
279
|
-
};
|
|
280
|
-
var fetchTableReference = async (dbKey, refContent, dispatch) => {
|
|
281
|
-
const tableMeta = refContent;
|
|
282
|
-
const title = tableMeta.displayName || tableMeta.description || `Untitled Table (${dbKey})`;
|
|
283
|
-
const { markdown: tableMd } = await dispatch(
|
|
284
|
-
async (_dispatch, getState, { db }) => {
|
|
285
|
-
const state = getState();
|
|
286
|
-
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
287
|
-
return await fetchAndSerializeTable(tableMeta, db, {
|
|
288
|
-
token,
|
|
289
|
-
remoteServers
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
);
|
|
293
|
-
const tags = tableMeta.tags?.length ? tableMeta.tags.join(", ") : "None";
|
|
294
|
-
const description = tableMeta.description || "No description provided.";
|
|
295
|
-
return `Reference Item (Table):
|
|
296
|
-
DB Key: ${dbKey}
|
|
297
|
-
Title: ${title}
|
|
298
|
-
Description: ${description}
|
|
299
|
-
Tags: ${tags}
|
|
300
|
-
Content (Markdown Table):
|
|
301
|
-
|
|
302
|
-
${tableMd}
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
`;
|
|
306
|
-
};
|
|
307
|
-
var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
|
|
308
|
-
if (!refContent?.slateData) return null;
|
|
309
|
-
const title = refContent.title || `Untitled (${dbKey})`;
|
|
310
|
-
let contentString;
|
|
311
|
-
let contentType;
|
|
312
|
-
const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
|
|
313
|
-
switch (options.format) {
|
|
314
|
-
case "text":
|
|
315
|
-
contentType = "Plain Text";
|
|
316
|
-
contentString = slateToText(refContent.slateData);
|
|
317
|
-
break;
|
|
318
|
-
case "simplified_markdown":
|
|
319
|
-
contentType = "Simplified Markdown";
|
|
320
|
-
if (inlineMentionMeta) {
|
|
321
|
-
const metaMap = await buildMentionMetaMap(refContent.slateData, dispatch);
|
|
322
|
-
contentString = slateToSimplifiedMarkdown(refContent.slateData, {
|
|
323
|
-
mentionResolver: (node) => buildInlineMention(node, metaMap)
|
|
324
|
-
});
|
|
325
|
-
} else {
|
|
326
|
-
contentString = slateToSimplifiedMarkdown(refContent.slateData);
|
|
327
|
-
}
|
|
328
|
-
break;
|
|
329
|
-
case "json":
|
|
330
|
-
default:
|
|
331
|
-
contentType = "Slate JSON";
|
|
332
|
-
contentString = JSON.stringify(refContent.slateData, null, 2);
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
if (!contentString || typeof contentString === "string" && !contentString.trim() || contentString === "[]") {
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
const tags = (refContent.tags || []).length > 0 ? refContent.tags.join(", ") : "None";
|
|
339
|
-
const createdAt = refContent.created || "Unknown Creation Date";
|
|
340
|
-
const updatedAt = refContent.updated || "Unknown Update Date";
|
|
341
|
-
return `Reference Item:
|
|
342
|
-
DB Key: ${dbKey}
|
|
343
|
-
Title: ${title}
|
|
344
|
-
Content (${contentType}):
|
|
345
|
-
${contentString}
|
|
346
|
-
Tags: ${tags}
|
|
347
|
-
Created At: ${createdAt}
|
|
348
|
-
Updated At: ${updatedAt}
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
`;
|
|
352
|
-
};
|
|
353
|
-
var fetchReferenceContents = async (references, dispatch, options = { format: "simplified_markdown" }) => {
|
|
354
|
-
const result = /* @__PURE__ */ new Map();
|
|
355
|
-
if (!references || references.length === 0) return result;
|
|
356
|
-
const referencePromises = references.map(async (dbKey) => {
|
|
357
|
-
try {
|
|
358
|
-
const hasPreloaded = options.preloaded?.has(dbKey);
|
|
359
|
-
const refContent = hasPreloaded ? options.preloaded?.get(dbKey) : await dispatch(read({
|
|
360
|
-
dbKey
|
|
361
|
-
})).unwrap();
|
|
362
|
-
if (!refContent) return null;
|
|
363
|
-
let formatted = null;
|
|
364
|
-
if (refContent.type === "dialog" /* DIALOG */) {
|
|
365
|
-
formatted = await fetchDialogReference(dbKey, refContent, dispatch);
|
|
366
|
-
} else if (refContent.type === "table" /* TABLE */) {
|
|
367
|
-
formatted = await fetchTableReference(dbKey, refContent, dispatch);
|
|
368
|
-
} else {
|
|
369
|
-
formatted = await fetchSlateReference(dbKey, refContent, dispatch, options);
|
|
370
|
-
}
|
|
371
|
-
if (formatted) return [dbKey, formatted];
|
|
372
|
-
return null;
|
|
373
|
-
} catch (error) {
|
|
374
|
-
console.error(`Error fetching reference ${dbKey}:`, error);
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
const resolved = await Promise.all(referencePromises);
|
|
379
|
-
resolved.forEach((item) => {
|
|
380
|
-
if (item) result.set(item[0], item[1]);
|
|
381
|
-
});
|
|
382
|
-
return result;
|
|
383
|
-
};
|
|
384
|
-
|
|
385
25
|
// packages/agent-runtime/contextLayerContract.ts
|
|
386
26
|
var buildContextLayerContractBlock = (options = {}) => {
|
|
387
27
|
const lines = [
|
|
@@ -636,10 +276,10 @@ var AGENT_ORCHESTRATION_RUN_INSTRUCTIONS = `--- \u591A Agent \u7F16\u6392\uFF08\
|
|
|
636
276
|
var AGENT_COLLABORATION_INSTRUCTIONS = `--- \u591A Agent \u534F\u4F5C\uFF08\u8BA1\u5212 \u2192 \u6309\u9700\u6D3E\u53D1 \u2192 \u5BA1\u67E5\uFF09 ---
|
|
637
277
|
\u7F16\u6392\u4E0D\u662F\u76EE\u7684\uFF0C\u4EA7\u51FA\u624D\u662F\u3002**\u6309\u590D\u6742\u5EA6\u5206\u6863\u51B3\u5B9A\u8C01\u6765\u505A**\uFF0C\u65E2\u4E0D\u4E3A\u300C\u51D1\u6570\u91CF\u300D\u6D3E\u53D1\uFF0C\u4E5F\u4E0D\u56E0\u4E3A\u81EA\u5DF1\u987A\u624B\u5C31\u5305\u529E\u672C\u8BE5\u5E76\u884C\u7684\u72EC\u7ACB\u9886\u57DF\u3002\u6BCF\u8F6E\u53EA\u63A8\u8FDB\u5F53\u524D\u6700\u6709\u4EF7\u503C\u7684\u52A8\u4F5C\uFF0C\u62FF\u5230\u7ED3\u679C\u548C\u8BC1\u636E\u518D\u5224\u65AD\u4E0B\u4E00\u6B65\u3002
|
|
638
278
|
|
|
639
|
-
**\u5206\u6863\u6807\u51C6\uFF08\
|
|
640
|
-
- \u7B80\u5355\uFF1A\
|
|
641
|
-
- \u4E2D\u7B49\uFF1A\
|
|
642
|
-
- \u590D\u6742\uFF1A\u8DE8 3 \u4E2A\u4EE5\u4E0A\u72EC\u7ACB\u9886\u57DF\uFF0C\u6216\u542B\u4ED3\u5E93\u6539\u52A8\uFF0B\u9A8C\u8BC1\uFF0B\u53D1\u5E03/\u8FC1\u79FB\u7684\u957F\u94FE\u8DEF \u2192 \u5148\
|
|
279
|
+
**\u5206\u6863\u6807\u51C6\uFF08\u6309\u903B\u8F91\u6B65\u9AA4\u6570\u548C\u89E6\u53CA\u6587\u4EF6\u6570\uFF0C\u9886\u57DF\u6570\u4EC5\u4F5C\u590D\u6742\u6863\u8F85\u52A9\u5224\u636E\uFF09**\uFF1A
|
|
280
|
+
- \u7B80\u5355\uFF1A\u903B\u8F91\u6B65\u9AA4 <5 \u4E14\u53EA\u8BFB/\u641C/\u6539 \u22642 \u4E2A\u6587\u4EF6 \u2192 \u81EA\u5DF1\u505A\uFF0C\u4E0D\u6D3E\u53D1\u3002
|
|
281
|
+
- \u4E2D\u7B49\uFF1A\u8D85\u51FA\u7B80\u5355\u6863\u3001\u4F46\u672A\u8DE8 3 \u4E2A\u72EC\u7ACB\u9886\u57DF \u2192 \u5148\u5206\u6790\u7ED9\u65B9\u6848\uFF0C\u65B9\u6848\u8BA4\u53EF\u540E\u6D3E\u53D1\u6267\u884C\u8005\uFF08\u4F18\u5148\u4F4E\u6210\u672C\u6A21\u578B\u5982 DeepSeek Flash\uFF09\uFF1B\u81EA\u5DF1\u53EA\u505A\u89C4\u5212\u3001review\u3001\u96C6\u6210\u3002
|
|
282
|
+
- \u590D\u6742\uFF1A\u8DE8 3 \u4E2A\u4EE5\u4E0A\u72EC\u7ACB\u9886\u57DF\uFF0C\u6216\u542B\u4ED3\u5E93\u6539\u52A8\uFF0B\u9A8C\u8BC1\uFF0B\u53D1\u5E03/\u8FC1\u79FB\u7684\u957F\u94FE\u8DEF \u2192 \u5148\u4E0E\u5019\u9009 agent \u8BA8\u8BBA\u8FBE\u6210\u4E00\u81F4\uFF0C\u518D\u6309\u9886\u57DF\u62C6\u5206\u6D3E\u53D1\uFF1B\u6B64\u6863\u9ED8\u8BA4\u81F3\u5C11\u6D3E 2 \u4E2A\u72EC\u7ACB\u5B50\u4EFB\u52A1\u6216\u5BA1\u8BA1\uFF0C\u82E5\u9009\u62E9\u4E0D\u6D3E\uFF0C\u5FC5\u987B\u5728\u8BA1\u5212\u91CC\u5199\u660E\u6210\u672C/\u6536\u76CA\u7406\u7531\u3002
|
|
643
283
|
|
|
644
284
|
**\u62C6\u5206\u539F\u5219**\uFF1A
|
|
645
285
|
- \u6309\u72EC\u7ACB\u9886\u57DF\u62C6\uFF0C\u4E0D\u6309\u6587\u4EF6\u6570\u91CF\u62C6\uFF1A\u67B6\u6784/\u540E\u7AEF\u3001\u524D\u7AEF\u3001\u6D4B\u8BD5\u3001\u6587\u6863/\u8FC1\u79FB\u3001\u53D1\u5E03/\u5B89\u5168\u5404\u81EA\u72EC\u7ACB\u65F6\u53EF\u5E76\u884C\u3002
|
|
@@ -880,7 +520,6 @@ function toBareImageUrlMessages(messages) {
|
|
|
880
520
|
|
|
881
521
|
export {
|
|
882
522
|
buildIdentityBlock,
|
|
883
|
-
fetchReferenceContents,
|
|
884
523
|
buildRuntimeGuidanceBlocks,
|
|
885
524
|
resolveToolGuidedSections,
|
|
886
525
|
buildCurrentTimeBlock,
|