nolo-cli 0.29.2 → 0.30.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-BFVTGZXE.js → _executeModel-VBHHG7LT.js} +62 -68
- package/{action-LG32A6DJ.js → action-FENWPT3C.js} +14 -15
- package/{addContentAction-MPGMBJTQ.js → addContentAction-Z5S5ZQ7I.js} +12 -12
- package/{addDialogAgentAction-ZH23WDID.js → addDialogAgentAction-VUNVD2XR.js} +11 -11
- package/{agentDeleteCommand-4S4STG42.js → agentDeleteCommand-LLGZXUYJ.js} +60 -39
- package/{agentEmailCommands-3F4IP4DI.js → agentEmailCommands-LC2FPN6G.js} +76 -81
- package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
- package/{agentListCommands-JCRV2XF6.js → agentListCommands-A6OBQ3QX.js} +57 -40
- package/{agentMachineCommands-KYXPYSFP.js → agentMachineCommands-4O4Q5B5X.js} +53 -35
- package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
- package/{agentRecordCommands-UADUPIXO.js → agentRecordCommands-W22RIQRV.js} +73 -78
- package/{agentRunCommand-MJWSR53W.js → agentRunCommand-V4OBU4FB.js} +77 -82
- package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
- package/{agentRuntimeLocal-PC5RRRPT.js → agentRuntimeLocal-I57YSGH4.js} +48 -30
- package/{agentSlice-C5OYLNBT.js → agentSlice-3ZHY7RAO.js} +12 -13
- package/{appDeleteCommands-ZXODZ5AD.js → appDeleteCommands-DJJF466K.js} +53 -35
- package/{appDeployCommands-AWC6JPZH.js → appDeployCommands-WJZGIOEZ.js} +53 -35
- package/{appDeployStatusCommands-74NXMDAI.js → appDeployStatusCommands-ICYXUJNO.js} +53 -35
- package/{appGetCommands-6YGIAP5L.js → appGetCommands-UOCWYJPV.js} +53 -35
- package/{appListCommands-DZWBHMNK.js → appListCommands-EOKWTXPW.js} +53 -35
- package/{authCommand-XMQHBK5L.js → authCommand-H5KE7K7K.js} +16 -16
- package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
- package/{chunk-OEWEE4VW.js → chunk-2XM5KUNE.js} +4 -2
- package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
- package/{chunk-HEXXIS77.js → chunk-3RIWR23B.js} +1 -1
- package/{chunk-R7LOFGRE.js → chunk-446VANPP.js} +18 -14
- package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
- package/{chunk-QC6ZWDSV.js → chunk-56IUA7RU.js} +3 -3
- package/{chunk-R3JSTDQO.js → chunk-66O5MZYH.js} +1 -1
- package/{chunk-PSK2RUHV.js → chunk-7CD24PU4.js} +360 -2
- package/{chunk-G2BZ43DV.js → chunk-A4JDTA5T.js} +13 -13
- package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
- package/{chunk-SKDNBYZK.js → chunk-BOL2D2JW.js} +1 -1
- package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
- package/{chunk-2TYLTEAH.js → chunk-CV6I4HBA.js} +1 -1
- package/chunk-DCDL3GC4.js +171 -0
- package/{chunk-FVOSIYXM.js → chunk-DCWBP2O7.js} +42 -393
- package/{chunk-OLWMGSW2.js → chunk-DI6MXJK5.js} +37 -37
- package/{chunk-HRPWRVBI.js → chunk-DKRT67FG.js} +11 -11
- package/{chunk-L6RBX4L4.js → chunk-DWQNDGO7.js} +20 -8
- package/{chunk-VKBTAQWT.js → chunk-FS5TTXPS.js} +6 -6
- package/chunk-G5JHHUAK.js +73 -0
- package/{chunk-TOGGHWHI.js → chunk-G6VITLCZ.js} +3 -3
- package/{chunk-RJBTU7AS.js → chunk-GAGUBI42.js} +302 -14
- package/{chunk-NXMJ55RU.js → chunk-GVKTKT3O.js} +3 -3
- package/{chunk-5ZXNLOAG.js → chunk-HI7QZNWX.js} +17 -10
- package/{chunk-DF7SMWEV.js → chunk-HLG6GAUD.js} +1 -1
- package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
- package/{chunk-IC7W63RM.js → chunk-IZ3CBMD5.js} +3 -3
- package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
- package/chunk-KW47OSRJ.js +3246 -0
- package/{chunk-Q5RXHXKU.js → chunk-KWKD3BCC.js} +189 -122
- package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
- package/{chunk-4BDPDTJU.js → chunk-L3VQOVKK.js} +8 -8
- package/{chunk-HALKDXKP.js → chunk-MEUZFIAJ.js} +8 -4
- package/{chunk-H5S4XUGI.js → chunk-MMCVBEAD.js} +174 -149
- package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
- package/chunk-OYK7PA5U.js +1707 -0
- package/{chunk-6HTWA77J.js → chunk-Q24P6TUS.js} +1 -1
- package/{chunk-GMJS5AYP.js → chunk-QLV2GKU5.js} +16 -178
- package/{chunk-WMB7GVPN.js → chunk-SWOTB2TX.js} +134 -1166
- package/{chunk-GC34RRTQ.js → chunk-SWYMCHM7.js} +1 -69
- package/{chunk-BBGRJB5E.js → chunk-SZ5CBYMZ.js} +4 -4
- package/chunk-T27IEBNQ.js +149 -0
- package/{chunk-WX3ZOSTL.js → chunk-T3Y5EMJS.js} +24 -26
- package/{chunk-UFL6WHHJ.js → chunk-THTAR67C.js} +1056 -137
- package/{chunk-2FX23RGA.js → chunk-TJYWZ3LO.js} +4 -4
- package/{chunk-KEF5OBOZ.js → chunk-UKC5HU2C.js} +33 -27
- package/{chunk-HRJEPMZY.js → chunk-UTQZ73QQ.js} +2 -2
- package/{chunk-GT3GG2H7.js → chunk-VSTUQGLT.js} +1 -1
- package/{chunk-32ZM6HVI.js → chunk-W2YKDXT7.js} +95 -95
- package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
- package/{chunk-XS7UPVR7.js → chunk-XD5NQEOH.js} +5 -5
- package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
- package/{chunk-JSB4N6NU.js → chunk-YLADSPDU.js} +3 -3
- package/{chunk-FRN5QOKN.js → chunk-YWGSCF37.js} +19 -4
- package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
- package/{createAgentAutomationAction-BK4UZJKU.js → createAgentAutomationAction-3GMH6ORX.js} +30 -37
- package/{createDialogAction-MJJUI2MK.js → createDialogAction-R5MCL4RE.js} +32 -38
- package/{createPageAction-YMZ7K363.js → createPageAction-QYTG656R.js} +43 -50
- package/{dbSlice-6QJYQUBV.js → dbSlice-OBV7VFCF.js} +11 -11
- package/{deleteFile-WDZ3VM7B.js → deleteFile-AC45HYSM.js} +5 -5
- package/{dialogCommands-OKH45ASS.js → dialogCommands-NUQGIXVZ.js} +53 -37
- package/{dialogSlice-UDOKNDHB.js → dialogSlice-CFDECXEU.js} +27 -34
- package/{docCreateCommands-MCLMR4TE.js → docCreateCommands-UNFCXB5N.js} +52 -36
- package/{docDeleteCommands-ONDHI7JV.js → docDeleteCommands-NG5IVKE5.js} +54 -38
- package/{docReadCommands-FCXBMISW.js → docReadCommands-6J7MUUX6.js} +52 -36
- package/{docStore-N66O4CGH.js → docStore-MZZWJM4F.js} +28 -35
- package/{docUpdateCommands-T3XN6XOX.js → docUpdateCommands-6AW3VZOX.js} +55 -39
- package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
- package/{getPricing-X6I23RN6.js → getPricing-XQYSSVV6.js} +6 -7
- package/{handleSendMessageAction-KC4AYUZP.js → handleSendMessageAction-IU2QNTLM.js} +30 -37
- package/index.js +72 -72
- package/{localDialogRead-UFLBS6OT.js → localDialogRead-P72W2U2R.js} +1 -1
- package/{machineCommands-DIMRFA3Y.js → machineCommands-Z2QEWTHZ.js} +76 -81
- package/{machineWsRunDispatch-2DYJZI6Z.js → machineWsRunDispatch-SJTYHZHN.js} +71 -76
- package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
- package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
- package/package.json +1 -1
- package/{read-C7Y6LSBM.js → read-QK7ZRX6G.js} +6 -6
- package/{readDocTool-TOHRYJHP.js → readDocTool-EYDMVRBL.js} +2 -1
- package/{readlineWorkspace-HUPHMLDG.js → readlineWorkspace-EY3BPXIU.js} +150 -162
- package/{removeDialogAgentAction-WZXPOH5S.js → removeDialogAgentAction-TBW3UZJW.js} +15 -16
- package/{runAgentClientLoop-5TGSUKHV.js → runAgentClientLoop-N3YDLTMS.js} +61 -66
- package/{setDialogExtraReferencesAction-INZY2ENI.js → setDialogExtraReferencesAction-Q3ANF2NR.js} +12 -12
- package/{setPrimaryDialogAgentAction-WCVLPYCF.js → setPrimaryDialogAgentAction-FQ5R3EFJ.js} +15 -16
- package/{settingSlice-IDUM4LWU.js → settingSlice-JKKV2T7O.js} +13 -14
- package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
- package/{spaceCommands-XSSDB3YK.js → spaceCommands-R6AEQNLG.js} +57 -40
- package/{spaceSlice-BXDCO6PT.js → spaceSlice-MCH7RLLP.js} +27 -34
- package/{streamAgentChatTurn-HRFMVSVC.js → streamAgentChatTurn-Q4U2CVMI.js} +130 -1300
- package/{switchDialogAgentAction-YBFFCBOD.js → switchDialogAgentAction-QQGVE4SL.js} +11 -11
- package/{toolApiClient-WVTUYOFM.js → toolApiClient-ARGFDJAG.js} +2 -2
- package/{tools-5V6FHWQU.js → tools-Y3UBLLYW.js} +50 -56
- package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-4474IBTI.js} +12 -12
- package/{updateDialogTitleAction-W62C4W4K.js → updateDialogTitleAction-3J7GH67I.js} +35 -43
- package/chunk-5CS33IBL.js +0 -301
- package/chunk-5MMAK75Q.js +0 -15
- package/chunk-HYSJHRWD.js +0 -669
- package/chunk-MRC4Q34M.js +0 -188
- package/chunk-SIZQB7BD.js +0 -91
- package/chunk-UEOPA6MV.js +0 -641
- package/chunk-VIDPVFP3.js +0 -20
- package/chunk-W2LZV5GE.js +0 -231
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YYLHWIW6.js +0 -48
- package/chunk-Z54ZAZZC.js +0 -1791
- package/chunk-ZZ2MH7LE.js +0 -84
- package/{chunk-OMP5L5NF.js → chunk-44HACRCK.js} +3 -3
- package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
- package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
- package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
- package/{chunk-XMLRJUU5.js → chunk-ZFTCLBEX.js} +9 -9
- package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
- package/{tableCommands-QSZILI7I.js → tableCommands-PRJNWN6Q.js} +6 -6
|
@@ -2,14 +2,43 @@ import {
|
|
|
2
2
|
isImageUrlPart
|
|
3
3
|
} from "./chunk-D34RI6NI.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
wrapHistoricalSummaryWithReplayGuard
|
|
6
|
+
} from "./chunk-4PWB7JRR.js";
|
|
7
|
+
import {
|
|
8
|
+
clipMultilineText,
|
|
9
|
+
fetchAndSerializeTable
|
|
10
|
+
} from "./chunk-OYK7PA5U.js";
|
|
11
|
+
import {
|
|
12
|
+
slateToSimplifiedMarkdown
|
|
13
|
+
} from "./chunk-SWYMCHM7.js";
|
|
14
|
+
import {
|
|
15
|
+
estimateTokenCount,
|
|
16
|
+
fetchAndCacheMessages
|
|
17
|
+
} from "./chunk-THTAR67C.js";
|
|
18
|
+
import {
|
|
19
|
+
createSpaceKey
|
|
20
|
+
} from "./chunk-YLADSPDU.js";
|
|
21
|
+
import {
|
|
22
|
+
read
|
|
23
|
+
} from "./chunk-A4JDTA5T.js";
|
|
7
24
|
import {
|
|
8
25
|
asTrimmedLowercaseString
|
|
9
26
|
} from "./chunk-QSJ3HFEF.js";
|
|
27
|
+
import {
|
|
28
|
+
extractCustomId
|
|
29
|
+
} from "./chunk-TOW4E763.js";
|
|
30
|
+
import {
|
|
31
|
+
getRuntimeServerContext
|
|
32
|
+
} from "./chunk-ZFTCLBEX.js";
|
|
33
|
+
import {
|
|
34
|
+
extractCategorizedMentions
|
|
35
|
+
} from "./chunk-VP4WJWKW.js";
|
|
10
36
|
import {
|
|
11
37
|
asTrimmedString
|
|
12
38
|
} from "./chunk-3EUW3WEO.js";
|
|
39
|
+
import {
|
|
40
|
+
canonicalizeToolNames
|
|
41
|
+
} from "./chunk-3AUWC6EM.js";
|
|
13
42
|
|
|
14
43
|
// packages/agent-runtime/identityBlock.ts
|
|
15
44
|
var buildIdentityBlock = (input) => {
|
|
@@ -23,6 +52,334 @@ var buildIdentityBlock = (input) => {
|
|
|
23
52
|
return lines.join("\n");
|
|
24
53
|
};
|
|
25
54
|
|
|
55
|
+
// packages/create/editor/transforms/slateToText.ts
|
|
56
|
+
function getNodeText(node) {
|
|
57
|
+
if (node.text) {
|
|
58
|
+
return node.text;
|
|
59
|
+
}
|
|
60
|
+
if (node.children && Array.isArray(node.children)) {
|
|
61
|
+
return node.children.map(getNodeText).join("\n");
|
|
62
|
+
}
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
65
|
+
function slateToText(nodes) {
|
|
66
|
+
if (!nodes || nodes.length === 0) {
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
return nodes.map(getNodeText).join("\n\n");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// packages/ai/context/buildReferenceContext.ts
|
|
73
|
+
var MAX_META_TEXT_LENGTH = 80;
|
|
74
|
+
var DIALOG_REFERENCE_MESSAGE_LIMIT = 20;
|
|
75
|
+
var DIALOG_REFERENCE_SNIPPET_CHARS = 1200;
|
|
76
|
+
var DIALOG_HANDOFF_SNIPPET_CHARS = 360;
|
|
77
|
+
var truncateMetaText = (value, max = MAX_META_TEXT_LENGTH) => {
|
|
78
|
+
if (!value) return "";
|
|
79
|
+
if (value.length <= max) return value;
|
|
80
|
+
return `${value.slice(0, max - 3)}...`;
|
|
81
|
+
};
|
|
82
|
+
var readSafe = async (dispatch, dbKey) => {
|
|
83
|
+
try {
|
|
84
|
+
return await dispatch(read({
|
|
85
|
+
dbKey
|
|
86
|
+
})).unwrap();
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var buildMentionMetaMap = async (slateData, dispatch) => {
|
|
92
|
+
const metaMap = /* @__PURE__ */ new Map();
|
|
93
|
+
const mentions = extractCategorizedMentions(slateData);
|
|
94
|
+
if (!mentions) return metaMap;
|
|
95
|
+
const pageEntries = await Promise.all(
|
|
96
|
+
(mentions.pages || []).map(async (pageId) => {
|
|
97
|
+
const pageData = await readSafe(dispatch, pageId);
|
|
98
|
+
if (!pageData) {
|
|
99
|
+
return [`page:${pageId}`, { displayType: "page", metaParts: [] }];
|
|
100
|
+
}
|
|
101
|
+
if (pageData.type === "dialog" /* DIALOG */) {
|
|
102
|
+
const agentCount = Array.isArray(pageData.cybots) ? pageData.cybots.length : 0;
|
|
103
|
+
return [
|
|
104
|
+
`page:${pageId}`,
|
|
105
|
+
{
|
|
106
|
+
displayType: "dialog",
|
|
107
|
+
title: pageData.title,
|
|
108
|
+
metaParts: [
|
|
109
|
+
`agents=${agentCount}`,
|
|
110
|
+
`updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
const tags = pageData.tags && pageData.tags.length > 0 ? pageData.tags.slice(0, 5).join(", ") : "";
|
|
116
|
+
return [
|
|
117
|
+
`page:${pageId}`,
|
|
118
|
+
{
|
|
119
|
+
displayType: "page",
|
|
120
|
+
title: pageData.title,
|
|
121
|
+
metaParts: [
|
|
122
|
+
pageData.spaceId ? `space=${pageData.spaceId}` : "",
|
|
123
|
+
tags ? `tags=${tags}` : "",
|
|
124
|
+
`updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
|
|
125
|
+
].filter(Boolean)
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
pageEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
131
|
+
const agentEntries = await Promise.all(
|
|
132
|
+
(mentions.agents || []).map(async (agentId) => {
|
|
133
|
+
const agentData = await readSafe(dispatch, agentId);
|
|
134
|
+
if (!agentData) {
|
|
135
|
+
return [`agent:${agentId}`, { displayType: "agent", metaParts: [] }];
|
|
136
|
+
}
|
|
137
|
+
const desc = truncateMetaText(
|
|
138
|
+
agentData.description || agentData.introduction || ""
|
|
139
|
+
);
|
|
140
|
+
return [
|
|
141
|
+
`agent:${agentId}`,
|
|
142
|
+
{
|
|
143
|
+
displayType: "agent",
|
|
144
|
+
title: agentData.name,
|
|
145
|
+
metaParts: [
|
|
146
|
+
`public=${agentData.isPublic ? "yes" : "no"}`,
|
|
147
|
+
desc ? `desc=${desc}` : ""
|
|
148
|
+
].filter(Boolean)
|
|
149
|
+
}
|
|
150
|
+
];
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
agentEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
154
|
+
const spaceEntries = await Promise.all(
|
|
155
|
+
(mentions.spaces || []).map(async (spaceId) => {
|
|
156
|
+
const spaceKey = createSpaceKey.space(spaceId);
|
|
157
|
+
const spaceData = await readSafe(dispatch, spaceKey);
|
|
158
|
+
if (!spaceData) {
|
|
159
|
+
return [`space:${spaceId}`, { displayType: "space", metaParts: [] }];
|
|
160
|
+
}
|
|
161
|
+
const desc = truncateMetaText(spaceData.description || "");
|
|
162
|
+
const categoriesCount = Object.keys(spaceData.categories || {}).length;
|
|
163
|
+
const contentsCount = Object.keys(spaceData.contents || {}).length;
|
|
164
|
+
return [
|
|
165
|
+
`space:${spaceId}`,
|
|
166
|
+
{
|
|
167
|
+
displayType: "space",
|
|
168
|
+
title: spaceData.name,
|
|
169
|
+
metaParts: [
|
|
170
|
+
desc ? `desc=${desc}` : "",
|
|
171
|
+
`categories=${categoriesCount}`,
|
|
172
|
+
`contents=${contentsCount}`
|
|
173
|
+
].filter(Boolean)
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
spaceEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
|
|
179
|
+
return metaMap;
|
|
180
|
+
};
|
|
181
|
+
var buildInlineMention = (node, metaMap) => {
|
|
182
|
+
const resourceType = node.resourceType || "unknown";
|
|
183
|
+
const resourceId = node.resourceId || "unknown";
|
|
184
|
+
const key = `${resourceType}:${resourceId}`;
|
|
185
|
+
const meta = metaMap.get(key);
|
|
186
|
+
const label = meta?.title || node.label || resourceId || "mention";
|
|
187
|
+
const displayType = meta?.displayType || resourceType;
|
|
188
|
+
const metaParts = meta?.metaParts ?? [];
|
|
189
|
+
const idPart = resourceType === "tool" ? `tool=${resourceId}` : `dbkey=${resourceId}`;
|
|
190
|
+
const metaSuffix = metaParts.length ? ` | ${metaParts.join(" | ")}` : "";
|
|
191
|
+
return `@${label}(${displayType} | ${idPart}${metaSuffix})`;
|
|
192
|
+
};
|
|
193
|
+
var clipReferenceText = (value, max) => {
|
|
194
|
+
const raw = typeof value === "string" ? value : value == null ? "" : JSON.stringify(value);
|
|
195
|
+
return clipMultilineText(raw, max);
|
|
196
|
+
};
|
|
197
|
+
var fetchDialogReference = async (dbKey, refContent, dispatch) => {
|
|
198
|
+
const dialogConfig = refContent;
|
|
199
|
+
const dialogTitle = dialogConfig.title || `Untitled Dialog (${dbKey})`;
|
|
200
|
+
const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
|
|
201
|
+
const checkpoint = dialogConfig.runtimeCheckpoint || null;
|
|
202
|
+
const summary = asTrimmedString(dialogConfig.summary);
|
|
203
|
+
const messages = await dispatch(
|
|
204
|
+
async (_dispatch, getState, { db }) => {
|
|
205
|
+
const state = getState();
|
|
206
|
+
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
207
|
+
return await fetchAndCacheMessages({
|
|
208
|
+
db,
|
|
209
|
+
dialogId,
|
|
210
|
+
limit: DIALOG_REFERENCE_MESSAGE_LIMIT,
|
|
211
|
+
token,
|
|
212
|
+
remoteServers: remoteServers.length > 0 ? remoteServers : void 0
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
const sortedMessages = [...messages].reverse();
|
|
217
|
+
const formatContent = (content) => clipReferenceText(content, DIALOG_REFERENCE_SNIPPET_CHARS);
|
|
218
|
+
const transcript = sortedMessages.map((msg, index) => {
|
|
219
|
+
const toolLine = msg.toolName ? ` tool=${msg.toolName}` : "";
|
|
220
|
+
const agentLine = msg.cybotKey ? ` agent=${msg.cybotKey}` : "";
|
|
221
|
+
const createdLine = msg.createdAt ? ` at=${msg.createdAt}` : "";
|
|
222
|
+
return [
|
|
223
|
+
`### Message ${index + 1}: ${msg.role || "unknown"} id=${msg.id || "unknown"}${toolLine}${agentLine}${createdLine}`,
|
|
224
|
+
formatContent(msg.content) || "[empty]"
|
|
225
|
+
].join("\n");
|
|
226
|
+
}).join("\n\n");
|
|
227
|
+
const checkpointLines = [];
|
|
228
|
+
if (checkpoint && typeof checkpoint === "object") {
|
|
229
|
+
if (checkpoint.status) checkpointLines.push(`- status: ${checkpoint.status}`);
|
|
230
|
+
if (checkpoint.lastUserInput) checkpointLines.push(`- lastUserInput: ${formatContent(checkpoint.lastUserInput)}`);
|
|
231
|
+
if (checkpoint.lastAssistantText) checkpointLines.push(`- lastAssistantText: ${formatContent(checkpoint.lastAssistantText)}`);
|
|
232
|
+
if (Array.isArray(checkpoint.lastToolNames) && checkpoint.lastToolNames.length) {
|
|
233
|
+
checkpointLines.push(`- lastToolNames: ${checkpoint.lastToolNames.join(", ")}`);
|
|
234
|
+
}
|
|
235
|
+
if (Array.isArray(checkpoint.availableToolNames) && checkpoint.availableToolNames.length) {
|
|
236
|
+
checkpointLines.push(`- availableToolNames: ${checkpoint.availableToolNames.join(", ")}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const recentToolEvidence = sortedMessages.filter((msg) => msg.role === "tool" || msg.toolName).slice(-3).map((msg) => {
|
|
240
|
+
const label = msg.toolName ? `${msg.toolName}` : "tool";
|
|
241
|
+
return `- ${label} id=${msg.id || "unknown"}: ${clipReferenceText(msg.content, DIALOG_HANDOFF_SNIPPET_CHARS) || "[empty]"}`;
|
|
242
|
+
});
|
|
243
|
+
const handoffLines = [
|
|
244
|
+
`- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
|
|
245
|
+
`- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
|
|
246
|
+
summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
|
|
247
|
+
recentToolEvidence.length ? `- Recent tool evidence:
|
|
248
|
+
${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
|
|
249
|
+
`- 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}.`
|
|
250
|
+
].filter(Boolean);
|
|
251
|
+
const referenceBody = [
|
|
252
|
+
`Conversation Reference:`,
|
|
253
|
+
`DB Key: ${dbKey}`,
|
|
254
|
+
`Title: ${dialogTitle}`,
|
|
255
|
+
`Status: ${dialogConfig.status || "unknown"}`,
|
|
256
|
+
`Loaded Recent Messages: ${sortedMessages.length}`,
|
|
257
|
+
`Conversation Handoff:
|
|
258
|
+
${handoffLines.join("\n")}`,
|
|
259
|
+
checkpointLines.length ? `Runtime Checkpoint:
|
|
260
|
+
${checkpointLines.join("\n")}` : "",
|
|
261
|
+
summary ? `Passive Summary (compressed history, not original wording):
|
|
262
|
+
${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
|
|
263
|
+
`Recent Transcript (original message excerpts, oldest to newest):
|
|
264
|
+
${transcript || "[no recent messages loaded]"}`,
|
|
265
|
+
[
|
|
266
|
+
`Coverage Note: This reference intentionally loads only the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages plus summaries/checkpoint to control token load.`,
|
|
267
|
+
`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.`
|
|
268
|
+
].join("\n")
|
|
269
|
+
].filter(Boolean).join("\n\n");
|
|
270
|
+
const tokenEstimate = estimateTokenCount(referenceBody);
|
|
271
|
+
return `${referenceBody}
|
|
272
|
+
|
|
273
|
+
Token Load Estimate: ${tokenEstimate} tokens for this conversation reference.
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
`;
|
|
277
|
+
};
|
|
278
|
+
var fetchTableReference = async (dbKey, refContent, dispatch) => {
|
|
279
|
+
const tableMeta = refContent;
|
|
280
|
+
const title = tableMeta.displayName || tableMeta.description || `Untitled Table (${dbKey})`;
|
|
281
|
+
const { markdown: tableMd } = await dispatch(
|
|
282
|
+
async (_dispatch, getState, { db }) => {
|
|
283
|
+
const state = getState();
|
|
284
|
+
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
285
|
+
return await fetchAndSerializeTable(tableMeta, db, {
|
|
286
|
+
token,
|
|
287
|
+
remoteServers
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
const tags = tableMeta.tags?.length ? tableMeta.tags.join(", ") : "None";
|
|
292
|
+
const description = tableMeta.description || "No description provided.";
|
|
293
|
+
return `Reference Item (Table):
|
|
294
|
+
DB Key: ${dbKey}
|
|
295
|
+
Title: ${title}
|
|
296
|
+
Description: ${description}
|
|
297
|
+
Tags: ${tags}
|
|
298
|
+
Content (Markdown Table):
|
|
299
|
+
|
|
300
|
+
${tableMd}
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
`;
|
|
304
|
+
};
|
|
305
|
+
var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
|
|
306
|
+
if (!refContent?.slateData) return null;
|
|
307
|
+
const title = refContent.title || `Untitled (${dbKey})`;
|
|
308
|
+
let contentString;
|
|
309
|
+
let contentType;
|
|
310
|
+
const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
|
|
311
|
+
switch (options.format) {
|
|
312
|
+
case "text":
|
|
313
|
+
contentType = "Plain Text";
|
|
314
|
+
contentString = slateToText(refContent.slateData);
|
|
315
|
+
break;
|
|
316
|
+
case "simplified_markdown":
|
|
317
|
+
contentType = "Simplified Markdown";
|
|
318
|
+
if (inlineMentionMeta) {
|
|
319
|
+
const metaMap = await buildMentionMetaMap(refContent.slateData, dispatch);
|
|
320
|
+
contentString = slateToSimplifiedMarkdown(refContent.slateData, {
|
|
321
|
+
mentionResolver: (node) => buildInlineMention(node, metaMap)
|
|
322
|
+
});
|
|
323
|
+
} else {
|
|
324
|
+
contentString = slateToSimplifiedMarkdown(refContent.slateData);
|
|
325
|
+
}
|
|
326
|
+
break;
|
|
327
|
+
case "json":
|
|
328
|
+
default:
|
|
329
|
+
contentType = "Slate JSON";
|
|
330
|
+
contentString = JSON.stringify(refContent.slateData, null, 2);
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
if (!contentString || typeof contentString === "string" && !contentString.trim() || contentString === "[]") {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
const tags = (refContent.tags || []).length > 0 ? refContent.tags.join(", ") : "None";
|
|
337
|
+
const createdAt = refContent.created || "Unknown Creation Date";
|
|
338
|
+
const updatedAt = refContent.updated || "Unknown Update Date";
|
|
339
|
+
return `Reference Item:
|
|
340
|
+
DB Key: ${dbKey}
|
|
341
|
+
Title: ${title}
|
|
342
|
+
Content (${contentType}):
|
|
343
|
+
${contentString}
|
|
344
|
+
Tags: ${tags}
|
|
345
|
+
Created At: ${createdAt}
|
|
346
|
+
Updated At: ${updatedAt}
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
`;
|
|
350
|
+
};
|
|
351
|
+
var fetchReferenceContents = async (references, dispatch, options = { format: "simplified_markdown" }) => {
|
|
352
|
+
const result = /* @__PURE__ */ new Map();
|
|
353
|
+
if (!references || references.length === 0) return result;
|
|
354
|
+
const referencePromises = references.map(async (dbKey) => {
|
|
355
|
+
try {
|
|
356
|
+
const hasPreloaded = options.preloaded?.has(dbKey);
|
|
357
|
+
const refContent = hasPreloaded ? options.preloaded?.get(dbKey) : await dispatch(read({
|
|
358
|
+
dbKey
|
|
359
|
+
})).unwrap();
|
|
360
|
+
if (!refContent) return null;
|
|
361
|
+
let formatted = null;
|
|
362
|
+
if (refContent.type === "dialog" /* DIALOG */) {
|
|
363
|
+
formatted = await fetchDialogReference(dbKey, refContent, dispatch);
|
|
364
|
+
} else if (refContent.type === "table" /* TABLE */) {
|
|
365
|
+
formatted = await fetchTableReference(dbKey, refContent, dispatch);
|
|
366
|
+
} else {
|
|
367
|
+
formatted = await fetchSlateReference(dbKey, refContent, dispatch, options);
|
|
368
|
+
}
|
|
369
|
+
if (formatted) return [dbKey, formatted];
|
|
370
|
+
return null;
|
|
371
|
+
} catch (error) {
|
|
372
|
+
console.error(`Error fetching reference ${dbKey}:`, error);
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
const resolved = await Promise.all(referencePromises);
|
|
377
|
+
resolved.forEach((item) => {
|
|
378
|
+
if (item) result.set(item[0], item[1]);
|
|
379
|
+
});
|
|
380
|
+
return result;
|
|
381
|
+
};
|
|
382
|
+
|
|
26
383
|
// packages/agent-runtime/contextLayerContract.ts
|
|
27
384
|
var buildContextLayerContractBlock = (options = {}) => {
|
|
28
385
|
const lines = [
|
|
@@ -521,6 +878,7 @@ function toBareImageUrlMessages(messages) {
|
|
|
521
878
|
|
|
522
879
|
export {
|
|
523
880
|
buildIdentityBlock,
|
|
881
|
+
fetchReferenceContents,
|
|
524
882
|
buildRuntimeGuidanceBlocks,
|
|
525
883
|
resolveToolGuidedSections,
|
|
526
884
|
buildCurrentTimeBlock,
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fileKey,
|
|
3
|
-
getFileIdFromKey,
|
|
4
|
-
ulid
|
|
5
|
-
} from "./chunk-NRY4GCKJ.js";
|
|
6
1
|
import {
|
|
7
2
|
loadFileFromIndexedDb,
|
|
8
3
|
removeAction,
|
|
9
4
|
saveFileToIndexedDb
|
|
10
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BOL2D2JW.js";
|
|
11
6
|
import {
|
|
12
7
|
readAction,
|
|
13
8
|
readRequestManager,
|
|
14
9
|
resolveAgentReadServers
|
|
15
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DWQNDGO7.js";
|
|
16
11
|
import {
|
|
17
12
|
asyncThunkCreator,
|
|
18
13
|
buildCreateSlice,
|
|
@@ -32,22 +27,27 @@ import {
|
|
|
32
27
|
shouldReplaceLocalWithRemoteRecord,
|
|
33
28
|
shouldReplicateLocalRecord,
|
|
34
29
|
uploadToCurrentServer
|
|
35
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZFTCLBEX.js";
|
|
36
31
|
import {
|
|
37
32
|
fetchFromClientDb,
|
|
38
33
|
fetchFromServer,
|
|
39
34
|
logger,
|
|
40
35
|
normalizeTimeFields
|
|
41
36
|
} from "./chunk-R5V5G73M.js";
|
|
37
|
+
import {
|
|
38
|
+
API_ENDPOINTS
|
|
39
|
+
} from "./chunk-LCBAMY2M.js";
|
|
40
|
+
import {
|
|
41
|
+
fileKey,
|
|
42
|
+
getFileIdFromKey,
|
|
43
|
+
ulid
|
|
44
|
+
} from "./chunk-WHLVPK32.js";
|
|
42
45
|
import {
|
|
43
46
|
isTombstoneRecord
|
|
44
47
|
} from "./chunk-GBRG75BQ.js";
|
|
45
48
|
import {
|
|
46
49
|
isRecord
|
|
47
50
|
} from "./chunk-KUG52IAP.js";
|
|
48
|
-
import {
|
|
49
|
-
API_ENDPOINTS
|
|
50
|
-
} from "./chunk-LCBAMY2M.js";
|
|
51
51
|
|
|
52
52
|
// packages/database/actions/readAndWait.ts
|
|
53
53
|
var hashTokenScope = (currentToken) => {
|
|
@@ -704,7 +704,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
704
704
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
705
705
|
read: create.asyncThunk(
|
|
706
706
|
async (payload, thunkApi) => {
|
|
707
|
-
const { readAction: readAction2 } = await import("./read-
|
|
707
|
+
const { readAction: readAction2 } = await import("./read-QK7ZRX6G.js");
|
|
708
708
|
return readAction2(payload, thunkApi);
|
|
709
709
|
},
|
|
710
710
|
{
|
|
@@ -778,7 +778,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
778
778
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
779
779
|
share: create.asyncThunk(
|
|
780
780
|
async (config, thunkApi) => {
|
|
781
|
-
const { shareResourceAction } = await import("./action-
|
|
781
|
+
const { shareResourceAction } = await import("./action-FENWPT3C.js");
|
|
782
782
|
return shareResourceAction(config, thunkApi);
|
|
783
783
|
}
|
|
784
784
|
),
|
|
@@ -516,6 +516,7 @@ var isPlatformHostedClaudeModel = (model) => PLATFORM_HOSTED_CLAUDE_MODELS.some(
|
|
|
516
516
|
);
|
|
517
517
|
var PLATFORM_HOSTED_GROK_4_6_MODEL = "grok-4.6";
|
|
518
518
|
var isPlatformHostedGrokModel = (model) => asTrimmedLowercaseString(model) === PLATFORM_HOSTED_GROK_4_6_MODEL;
|
|
519
|
+
var PLATFORM_HOSTED_QWEN_37_FLASH_MODEL = "qwen3.7-flash";
|
|
519
520
|
var PLATFORM_CREDITS_PER_USD = 7;
|
|
520
521
|
var EXTERNAL_API_DISCOUNT = 0.8;
|
|
521
522
|
var toPlatformCredits = (usdPerMillion) => Number(
|
|
@@ -687,6 +688,19 @@ var platformHostedModels = [
|
|
|
687
688
|
maxOutputTokens: 1e5,
|
|
688
689
|
contextWindow: 5e5,
|
|
689
690
|
supportsTool: true
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
name: PLATFORM_HOSTED_QWEN_37_FLASH_MODEL,
|
|
694
|
+
displayName: "Qwen 3.7 Flash",
|
|
695
|
+
hasVision: true,
|
|
696
|
+
// 上游 OpenRouter:$0.03/$0.13 per 1M → nolo 8 折 ×7
|
|
697
|
+
price: {
|
|
698
|
+
input: toPlatformCredits(0.03),
|
|
699
|
+
output: toPlatformCredits(0.13)
|
|
700
|
+
},
|
|
701
|
+
maxOutputTokens: 65536,
|
|
702
|
+
contextWindow: 1e6,
|
|
703
|
+
supportsTool: true
|
|
690
704
|
}
|
|
691
705
|
];
|
|
692
706
|
|
|
@@ -705,6 +719,7 @@ export {
|
|
|
705
719
|
resolveFireworksKimiModel,
|
|
706
720
|
isPlatformHostedClaudeModel,
|
|
707
721
|
isPlatformHostedGrokModel,
|
|
722
|
+
PLATFORM_HOSTED_QWEN_37_FLASH_MODEL,
|
|
708
723
|
PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
|
|
709
724
|
PLATFORM_HOSTED_DEEPSEEK_FLASH_PRICE,
|
|
710
725
|
getPlatformHostedDeepSeekV4Price,
|