nolo-cli 0.54.0 → 0.61.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 +3 -3
- package/{_executeModel-OPTKYHJA.js → _executeModel-R26QYY66.js} +50 -46
- package/{action-ORXWW2ZG.js → action-76JX3JX3.js} +7 -6
- package/{addContentAction-53BZ34AE.js → addContentAction-V3NAZRTJ.js} +6 -5
- package/{addDialogAgentAction-JRYUS54Y.js → addDialogAgentAction-RZOAF46K.js} +5 -4
- package/{agentDeleteCommand-FJIWU2BS.js → agentDeleteCommand-6GNQA4J4.js} +30 -27
- package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-HH67CYKD.js} +61 -57
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
- package/{agentListCommands-VJNKULIK.js → agentListCommands-23XW3OPZ.js} +61 -31
- package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-HXHASEWO.js} +31 -28
- package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
- package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-UHTQJVGC.js} +59 -55
- package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-OAMT77EX.js} +63 -59
- package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
- package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-QBK4H3T2.js} +26 -23
- package/{agentSlice-ODKF4J6M.js → agentSlice-7XJH5WQF.js} +8 -7
- package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-AX2O6VDV.js} +30 -27
- package/{appDeployCommands-37F4GPCU.js → appDeployCommands-L5ZR26CB.js} +30 -27
- package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-5HQHELRA.js} +30 -27
- package/{appGetCommands-YLOBA3EM.js → appGetCommands-HVSYOS57.js} +30 -27
- package/{appListCommands-UD62R5ME.js → appListCommands-XV2FPTWX.js} +30 -27
- package/{authCommand-OK6HLHGS.js → authCommand-WOTWLJNF.js} +35 -29
- package/{authCommands-2DUIUEMT.js → authCommands-ILTBI6JV.js} +7 -5
- package/{chatQueueReduxAdapter-TV2TUOQS.js → chatQueueReduxAdapter-F3R253JE.js} +20 -18
- package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
- package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
- package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
- package/{chunk-EA5OYZVD.js → chunk-37XDGCY7.js} +1 -1
- package/chunk-3BLB7QKO.js +433 -0
- package/{chunk-CS6TCJ7E.js → chunk-3JQ2NRYU.js} +30 -7
- package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
- package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
- package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
- package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
- package/{chunk-6HIGYUBQ.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
- package/{chunk-6COJEAYH.js → chunk-7KELZLC2.js} +44 -37
- package/chunk-AETZ7AD6.js +274 -0
- package/chunk-BFU6C242.js +66 -0
- package/{chunk-IA3A5373.js → chunk-C3FZR5EC.js} +1 -1
- package/{chunk-IWUMSAQF.js → chunk-CJCJF5XB.js} +26 -3
- package/{chunk-UGBHDMHI.js → chunk-CP7VIDZ7.js} +1 -1
- package/{chunk-TR4DXUYX.js → chunk-CQ2OZMLQ.js} +1181 -737
- package/{chunk-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
- package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
- package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
- package/{chunk-FJHMLRDQ.js → chunk-DWYSDNOH.js} +22 -28
- package/{chunk-AA564GBL.js → chunk-E3YVTQWT.js} +2 -2
- package/chunk-E4MARS3Q.js +114 -0
- package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
- package/chunk-EDKF7RX4.js +30 -0
- package/{chunk-TC6P4NDR.js → chunk-F44FAXP2.js} +6 -6
- package/{chunk-SYYUU7EV.js → chunk-FHAGENAS.js} +2 -3
- package/{chunk-NJUQBYFJ.js → chunk-FKFMIBTT.js} +3 -1
- package/{chunk-INZZJSQF.js → chunk-FZGV4FGK.js} +24 -12
- package/{chunk-6HDYSFLO.js → chunk-GSXDRMDO.js} +3 -3
- package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
- package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
- package/{chunk-EY7V7REW.js → chunk-KHCLMKZZ.js} +6 -280
- package/{chunk-EJE33XNR.js → chunk-KSCXMC6U.js} +1521 -565
- package/{chunk-XOJRZUPF.js → chunk-KWSQR2KK.js} +14 -29
- package/{chunk-2WBFJHQA.js → chunk-L7B47JXR.js} +34 -39
- package/{chunk-EICIFHVS.js → chunk-LAFC3B2I.js} +1 -1
- package/{chunk-N4JKMCY3.js → chunk-LJKICKVC.js} +2 -2
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-LRGKOI5Y.js → chunk-MBOEV4L2.js} +7 -3
- package/{chunk-SVDMVX4G.js → chunk-MMZ6ZTVO.js} +112 -73
- package/{chunk-JDSUTNYY.js → chunk-MP64VFGD.js} +2 -2
- package/{chunk-NFLA6GSU.js → chunk-MXUDQZXQ.js} +44 -5
- package/chunk-N4G4PKQ6.js +23 -0
- package/{chunk-WQHGJHAL.js → chunk-N6HLMLKE.js} +732 -726
- package/{chunk-YQBXOHE6.js → chunk-NO42UD73.js} +1 -1
- package/{chunk-MLEZPE3U.js → chunk-NRRPKMM7.js} +4 -4
- package/{chunk-KXKQO4Q6.js → chunk-NTW5GWDM.js} +58 -1
- package/chunk-ONXOABJR.js +215 -0
- package/{chunk-TY3ADTX5.js → chunk-OZX2IPKM.js} +7 -2
- package/{chunk-Q4XZVZPN.js → chunk-P7OOB7QP.js} +1 -1
- package/{chunk-XIJZOCSP.js → chunk-PEZJEQAO.js} +1 -1
- package/{chunk-SWJGJMTW.js → chunk-PQDIDWGX.js} +1 -1
- package/chunk-PSCNXBYA.js +11 -0
- package/{chunk-BY2FF2C4.js → chunk-QEFJJS2I.js} +55 -73
- package/{chunk-BG7J6Y5X.js → chunk-QEW2MFDQ.js} +1 -1
- package/{chunk-KLIBF3BY.js → chunk-RDBARW6T.js} +8 -3
- package/{chunk-ZVOHVJI3.js → chunk-RJ2SAFB5.js} +82 -35
- package/{chunk-MYMBBB6Q.js → chunk-RVWRKFUB.js} +5 -3
- package/{chunk-43CXXVJD.js → chunk-RXX4GDIH.js} +1 -1
- package/chunk-SEJ5OS6F.js +49 -0
- package/{chunk-JXIP6ZWH.js → chunk-SKIRVYEI.js} +18 -5
- package/{chunk-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
- package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
- package/{chunk-RHMDMTDK.js → chunk-SYNKICCB.js} +2 -2
- package/{chunk-YBFJQC2M.js → chunk-TBHAHL33.js} +65 -42
- package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
- package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
- package/{chunk-7FAS3NEF.js → chunk-VAKVNHK5.js} +19 -15
- package/{chunk-UOWXD4VN.js → chunk-VHO3TMQZ.js} +336 -244
- package/{chunk-SVC3GGUA.js → chunk-VMWYBIXG.js} +7 -5
- package/{chunk-ZHXJ6M7T.js → chunk-W7XHHYWM.js} +4 -0
- package/{chunk-UR66XPVF.js → chunk-XAVSS3KE.js} +21 -3
- package/{chunk-A65UV3M5.js → chunk-XOKOSO35.js} +10 -19
- package/{chunk-VZMUOPYG.js → chunk-XTJTN3RW.js} +46 -3
- package/{chunk-T5HJEUQN.js → chunk-YCDWJX45.js} +1 -1
- package/{chunk-BBTN4NQD.js → chunk-Z4QSJILV.js} +85 -13
- package/{chunk-5FCIPEKT.js → chunk-Z5MHFBJZ.js} +1051 -926
- package/{chunk-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
- package/{codingSkills-BCQXRZOI.js → codingSkills-TKROLCBA.js} +4 -3
- package/{contentThunks-KNI6VXLT.js → contentThunks-OZPK5B4Z.js} +21 -19
- package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
- package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-LCIBGE5T.js} +23 -21
- package/{createDialogAction-JDSMY4AY.js → createDialogAction-JPJZMHJE.js} +25 -22
- package/{createPageAction-T7RA3HCG.js → createPageAction-6P2WLNHO.js} +26 -23
- package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
- package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
- package/{dialogCommands-UQZYWOOV.js → dialogCommands-WAFKC3KK.js} +30 -27
- package/{dialogSlice-TYW2G7IL.js → dialogSlice-R5RZHFTU.js} +20 -18
- package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-GHGB42S7.js} +32 -28
- package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-Y5I7ZEX4.js} +33 -29
- package/{docReadCommands-ZLMFVC67.js → docReadCommands-BMXM6J7T.js} +32 -28
- package/{docStore-2URPBVCS.js → docStore-DKWZ6XJ5.js} +6 -5
- package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-QNABH3M2.js} +32 -28
- package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
- package/handleSendMessageAction-UQGKM4UX.js +675 -0
- package/index.js +79 -88
- package/{lib-2ZTNRXR4.js → lib-FRRS27KN.js} +63 -28
- package/{localRuntimeAuthority-KQDAE64E.js → localRuntimeAuthority-R5UBODT3.js} +6 -4
- package/{localRuntimeDb-PF7CFKDL.js → localRuntimeDb-P37ZTX55.js} +1 -1
- package/{machineCommands-RK6L7ZWL.js → machineCommands-YDAIPYU5.js} +298 -80
- package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-O6RM2ECT.js} +57 -53
- package/{memberThunks-THZYZFSN.js → memberThunks-VZI6G7YZ.js} +10 -8
- package/{models-JVKUEER5.js → models-FAMINFZ7.js} +2 -2
- package/package.json +3 -2
- package/{read-K4JU4MQC.js → read-2BYWW7AA.js} +3 -2
- package/{readDocTool-LQGR6FUN.js → readDocTool-LC3A7QTB.js} +1 -1
- package/{readlineWorkspace-XUFJV3RS.js → readlineWorkspace-5DP3AJWN.js} +4367 -2796
- package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
- package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-Y6HWP2PT.js} +51 -46
- package/{runtimeDoctorCommands-JKTTN723.js → runtimeDoctorCommands-CROTMULY.js} +7 -5
- package/{setDialogExtraReferencesAction-KCVJNGMB.js → setDialogExtraReferencesAction-Q32RGFTA.js} +6 -5
- package/{setPrimaryDialogAgentAction-VDOBOMKC.js → setPrimaryDialogAgentAction-BFYJHUJS.js} +8 -7
- package/{settingSlice-VR2IJSXC.js → settingSlice-IRUU4VFB.js} +6 -5
- package/{skillDiscovery-2QTZINON.js → skillDiscovery-CYUCJMAG.js} +2 -1
- package/{spaceCommands-S5YJJXL7.js → spaceCommands-CLN45IE3.js} +33 -215
- package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-6WFQJ4DY.js} +107 -74
- package/{switchDialogAgentAction-5L4UP7VI.js → switchDialogAgentAction-L2KOKCGG.js} +5 -4
- package/{tableCommands-R6WFRDYF.js → tableCommands-SUNTHAYX.js} +1 -1
- package/{toolApiClient-53U4UDFF.js → toolApiClient-VGYUB4P5.js} +2 -1
- package/{tools-SSXSTC3O.js → tools-RR53D65Q.js} +39 -35
- package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
- package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
- package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-WXS3AKOL.js} +23 -21
- package/agentSuperviseCommands-5AR3DKNN.js +0 -640
- package/chunk-6IGD47IC.js +0 -19
- package/chunk-FD36SCCD.js +0 -105
- package/chunk-GRFK2XP4.js +0 -230
- package/chunk-HJTAGT3W.js +0 -370
- package/chunk-SUEIAK5N.js +0 -2574
- package/handleSendMessageAction-GO53TY7U.js +0 -409
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
toTimestampMs,
|
|
14
14
|
upsert,
|
|
15
15
|
write
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DNNSCSA2.js";
|
|
17
17
|
import {
|
|
18
18
|
createUserKey,
|
|
19
19
|
createUserPreferenceKey,
|
|
@@ -24,20 +24,22 @@ import {
|
|
|
24
24
|
} from "./chunk-QSJ3HFEF.js";
|
|
25
25
|
import {
|
|
26
26
|
BUILTIN_NOLO_AGENT_KEY
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-L7B47JXR.js";
|
|
28
28
|
import {
|
|
29
29
|
asyncThunkCreator,
|
|
30
30
|
buildCreateSlice,
|
|
31
31
|
createAction,
|
|
32
32
|
createAsyncThunk,
|
|
33
|
-
createSelector
|
|
34
|
-
|
|
35
|
-
} from "./chunk-XOJRZUPF.js";
|
|
33
|
+
createSelector
|
|
34
|
+
} from "./chunk-KWSQR2KK.js";
|
|
36
35
|
import {
|
|
37
36
|
getAllServers,
|
|
38
37
|
getIsDesktopApp,
|
|
39
38
|
isProduction
|
|
40
39
|
} from "./chunk-QOKAKDPE.js";
|
|
40
|
+
import {
|
|
41
|
+
selectIdentityUserId
|
|
42
|
+
} from "./chunk-SEJ5OS6F.js";
|
|
41
43
|
import {
|
|
42
44
|
SERVERS
|
|
43
45
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P7OOB7QP.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FHAGENAS.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3BLB7QKO.js";
|
|
11
11
|
import {
|
|
12
12
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
13
13
|
isOwnedAgentKey,
|
|
@@ -77,12 +77,18 @@ function sortListedAgents(agents) {
|
|
|
77
77
|
});
|
|
78
78
|
return agents;
|
|
79
79
|
}
|
|
80
|
+
function readArgValue(args, flag) {
|
|
81
|
+
const index = args.indexOf(flag);
|
|
82
|
+
const value = index >= 0 ? args[index + 1] : void 0;
|
|
83
|
+
return value && !value.startsWith("--") ? value : void 0;
|
|
84
|
+
}
|
|
80
85
|
function parseAgentListArgs(args) {
|
|
81
86
|
return {
|
|
82
87
|
wantJson: args.includes("--json"),
|
|
83
88
|
wantSafe: args.includes("--safe"),
|
|
84
89
|
publicOnly: args.includes("--public-only"),
|
|
85
90
|
idsOnly: args.includes("--ids-only"),
|
|
91
|
+
scope: readArgValue(args, "--scope"),
|
|
86
92
|
showUnavailable: args.includes("--show-unavailable"),
|
|
87
93
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
88
94
|
// --verbose 拿回完整字段集排障。
|
|
@@ -118,6 +124,17 @@ async function hasReadableRecord(args) {
|
|
|
118
124
|
return false;
|
|
119
125
|
}
|
|
120
126
|
}
|
|
127
|
+
async function listRemotePublicAgents(args) {
|
|
128
|
+
const response = await args.fetchImpl(`${args.serverUrl}/rpc/getPublicAgents`, {
|
|
129
|
+
method: "POST",
|
|
130
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${args.authToken}` },
|
|
131
|
+
body: JSON.stringify({ limit: Math.min(args.limit ?? 500, 500), summary: true })
|
|
132
|
+
});
|
|
133
|
+
if (!response.ok) throw new Error(`Public agent catalog request failed (${response.status})`);
|
|
134
|
+
const payload = await response.json();
|
|
135
|
+
const records = Array.isArray(payload?.data?.data) ? payload.data.data : Array.isArray(payload?.data) ? payload.data : [];
|
|
136
|
+
return records.filter((record) => record?.isPublic === true).map((record) => normalizeListedAgent({ ...record, userId: record?.userId || "system" })).filter((agent) => agent != null).map((agent) => ({ ...agent, publicRecordExists: true }));
|
|
137
|
+
}
|
|
121
138
|
async function listRemoteAgents(args) {
|
|
122
139
|
const recordGroups = [await args.queryUserRecords({ ...args, type: "agent" })];
|
|
123
140
|
const agents = sortListedAgents(
|
|
@@ -214,6 +231,7 @@ export {
|
|
|
214
231
|
toSafeListedAgentSummary,
|
|
215
232
|
parseAgentListArgs,
|
|
216
233
|
listLocalCachedAgents,
|
|
234
|
+
listRemotePublicAgents,
|
|
217
235
|
listRemoteAgents,
|
|
218
236
|
listRemoteAgentsAcrossServers,
|
|
219
237
|
listFavoriteAgentIdsAcrossServers,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findModelConfig,
|
|
3
3
|
getProviderByModelName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MMZ6ZTVO.js";
|
|
5
5
|
import {
|
|
6
6
|
asOptionalFiniteNumber
|
|
7
7
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -207,9 +207,7 @@ function resolveAgentRuntimeConfigFromRecord(key, record) {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// packages/ai/agent/toolOutputPolicy.ts
|
|
210
|
-
var MAX_HISTORICAL_TOOL_CONTENT_CHARS = 1600;
|
|
211
210
|
var MAX_IN_TURN_TOOL_CONTENT_CHARS = 4e3;
|
|
212
|
-
var FRESH_TOOL_OUTPUT_MAX_CHARS = 32e3;
|
|
213
211
|
var DEFAULT_TOOL_OUTPUT_PROFILE = {
|
|
214
212
|
maxChars: MAX_IN_TURN_TOOL_CONTENT_CHARS,
|
|
215
213
|
headRatio: 0.5
|
|
@@ -234,21 +232,16 @@ function resolveHistoricalToolContentCap(toolName, historicalMaxChars) {
|
|
|
234
232
|
return profile?.historicalMaxChars !== void 0 ? Math.max(historicalMaxChars, profile.historicalMaxChars) : historicalMaxChars;
|
|
235
233
|
}
|
|
236
234
|
function projectToolMessageContent(input) {
|
|
237
|
-
const { content,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
const { content, toolName } = input;
|
|
236
|
+
const maxChars = resolveToolOutputProfile(toolName).maxChars;
|
|
237
|
+
if (content.length <= maxChars) return content;
|
|
238
|
+
return clipToolText(
|
|
239
|
+
content,
|
|
240
|
+
maxChars,
|
|
241
|
+
resolveToolOutputProfile(toolName).headRatio,
|
|
242
|
+
`
|
|
245
243
|
\u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
const cap = resolveHistoricalToolContentCap(toolName, historicalMaxChars);
|
|
249
|
-
if (content.length <= cap) return content;
|
|
250
|
-
return content.slice(0, cap) + `
|
|
251
|
-
\u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`;
|
|
244
|
+
);
|
|
252
245
|
}
|
|
253
246
|
function clipToolText(content, maxChars, headRatio, marker = "\n\n[... tool output middle omitted; head/tail preserved ...]\n\n") {
|
|
254
247
|
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
@@ -543,8 +536,6 @@ export {
|
|
|
543
536
|
hasImageInRuntimeMessages,
|
|
544
537
|
stripImagePartsFromMessages,
|
|
545
538
|
stripImagePartsForTextOnlyAgent,
|
|
546
|
-
MAX_HISTORICAL_TOOL_CONTENT_CHARS,
|
|
547
|
-
FRESH_TOOL_OUTPUT_MAX_CHARS,
|
|
548
539
|
resolveToolOutputProfile,
|
|
549
540
|
resolveHistoricalToolContentCap,
|
|
550
541
|
projectToolMessageContent,
|
|
@@ -8,6 +8,19 @@ import {
|
|
|
8
8
|
asOptionalTrimmedString
|
|
9
9
|
} from "./chunk-G3SUCT4W.js";
|
|
10
10
|
|
|
11
|
+
// packages/core/ollamaEndpoint.ts
|
|
12
|
+
function isOllamaEndpoint(endpoint) {
|
|
13
|
+
if (!endpoint || typeof endpoint !== "string") return false;
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(endpoint.includes("://") ? endpoint : `http://${endpoint}`);
|
|
16
|
+
if (url.port === "11434") return true;
|
|
17
|
+
const host = url.hostname.toLowerCase();
|
|
18
|
+
return host === "ollama.com" || host.endsWith(".ollama.com") || host === "ollama.ai" || host.endsWith(".ollama.ai");
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
// packages/ai/llm/usageRequestOptions.ts
|
|
12
25
|
var STREAM_USAGE_PROVIDERS = /* @__PURE__ */ new Set([
|
|
13
26
|
"google",
|
|
@@ -56,7 +69,7 @@ var normalizeProviderName = (providerName) => asTrimmedLowercaseString(providerN
|
|
|
56
69
|
var getUsageRequestOptions = (providerName, options) => {
|
|
57
70
|
const normalizedProvider = normalizeProviderName(providerName);
|
|
58
71
|
const api = options?.api ?? "chat-completions";
|
|
59
|
-
const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && isKimiCodeEndpoint(options?.endpoint);
|
|
72
|
+
const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && (isKimiCodeEndpoint(options?.endpoint) || isOllamaEndpoint(options?.endpoint));
|
|
60
73
|
if (api === "responses") {
|
|
61
74
|
return EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
|
|
62
75
|
usage: {
|
|
@@ -108,7 +121,7 @@ function shouldStripReasoningContentForOutbound(provider, model) {
|
|
|
108
121
|
const m = model?.trim().toLowerCase();
|
|
109
122
|
if (!p || !m) return false;
|
|
110
123
|
if (p === "deepseek" || p === "nolo") {
|
|
111
|
-
return m === "deepseek-v4-flash" || m === "deepseek-v4-flash-vision-exp" || m === "deepseek-v4-pro";
|
|
124
|
+
return m === "deepseek-flash" || m === "deepseek-v4-flash" || m === "deepseek-v4-flash-vision-exp" || m === "deepseek-v4-pro";
|
|
112
125
|
}
|
|
113
126
|
return false;
|
|
114
127
|
}
|
|
@@ -329,6 +342,33 @@ var extractToolCallsFromResponseOutput = (response) => {
|
|
|
329
342
|
return calls;
|
|
330
343
|
};
|
|
331
344
|
|
|
345
|
+
// packages/agent-runtime/promptCacheKey.ts
|
|
346
|
+
function collectStablePromptPrefix(messages, fallbackPrompt) {
|
|
347
|
+
const systemTexts = [];
|
|
348
|
+
if (fallbackPrompt?.trim()) systemTexts.push(fallbackPrompt.trim());
|
|
349
|
+
for (const raw of messages) {
|
|
350
|
+
if (!raw || typeof raw !== "object") continue;
|
|
351
|
+
const message = raw;
|
|
352
|
+
const role = String(message.role ?? "");
|
|
353
|
+
if (role !== "system" && role !== "developer") continue;
|
|
354
|
+
if (typeof message.content === "string") {
|
|
355
|
+
const boundary = Number(message.stable_prefix_chars);
|
|
356
|
+
const text = Number.isFinite(boundary) && boundary > 0 ? message.content.slice(0, boundary) : message.content;
|
|
357
|
+
if (text.trim()) systemTexts.push(text.trim());
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return systemTexts.join("\n\n");
|
|
361
|
+
}
|
|
362
|
+
function stablePromptCacheKey(parts, namespace) {
|
|
363
|
+
const value = JSON.stringify(parts);
|
|
364
|
+
let hash = 2166136261;
|
|
365
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
366
|
+
hash ^= value.charCodeAt(index);
|
|
367
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
368
|
+
}
|
|
369
|
+
return `${namespace}-${hash.toString(16).padStart(8, "0")}`;
|
|
370
|
+
}
|
|
371
|
+
|
|
332
372
|
// packages/core/chat/imageParts.ts
|
|
333
373
|
function isImageUrlPart(part) {
|
|
334
374
|
return isRecord(part) && part.type === "image_url";
|
|
@@ -340,6 +380,7 @@ function hasImageParts(messages) {
|
|
|
340
380
|
}
|
|
341
381
|
|
|
342
382
|
export {
|
|
383
|
+
isOllamaEndpoint,
|
|
343
384
|
getUsageRequestOptions,
|
|
344
385
|
isImageUrlPart,
|
|
345
386
|
hasImageParts,
|
|
@@ -351,5 +392,7 @@ export {
|
|
|
351
392
|
extractTextFromResponseOutput,
|
|
352
393
|
extractReasoningFromResponseOutput,
|
|
353
394
|
extractImagePartsFromResponseOutput,
|
|
354
|
-
extractToolCallsFromResponseOutput
|
|
395
|
+
extractToolCallsFromResponseOutput,
|
|
396
|
+
collectStablePromptPrefix,
|
|
397
|
+
stablePromptCacheKey
|
|
355
398
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
estimateTokenCount
|
|
3
|
+
} from "./chunk-PSCNXBYA.js";
|
|
1
4
|
import {
|
|
2
5
|
compactWhitespace
|
|
3
6
|
} from "./chunk-DWLEOOGR.js";
|
|
4
7
|
import {
|
|
5
8
|
addContentAction
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RVWRKFUB.js";
|
|
7
10
|
import {
|
|
8
11
|
upload
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DNNSCSA2.js";
|
|
10
13
|
import {
|
|
11
14
|
getRuntimeServerContext
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KWSQR2KK.js";
|
|
13
16
|
import {
|
|
14
17
|
API_ENDPOINTS
|
|
15
18
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -17,14 +20,6 @@ import {
|
|
|
17
20
|
normalizeServerOrigin
|
|
18
21
|
} from "./chunk-CF7PE763.js";
|
|
19
22
|
|
|
20
|
-
// packages/ai/context/tokenUtils.ts
|
|
21
|
-
var estimateTokenCount = (text) => {
|
|
22
|
-
if (!text) return 0;
|
|
23
|
-
const chineseChars = (text.match(/[\u4e00-\u9fa5\u3400-\u4dbf]/g) || []).length;
|
|
24
|
-
const otherChars = text.length - chineseChars;
|
|
25
|
-
return Math.ceil(chineseChars * 1.5 + otherChars * 0.25);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
23
|
// packages/core/chat/messageContentSerialize.ts
|
|
29
24
|
var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
|
|
30
25
|
if (typeof content === "string") {
|
|
@@ -708,9 +703,78 @@ function clipCompactText(value, max, ellipsis = "...") {
|
|
|
708
703
|
return `${compact.slice(0, max - ellipsis.length)}${ellipsis}`;
|
|
709
704
|
}
|
|
710
705
|
|
|
706
|
+
// packages/ai/token/providerCallTiming.ts
|
|
707
|
+
var defaultNow = () => {
|
|
708
|
+
const perf = globalThis.performance;
|
|
709
|
+
return typeof perf?.now === "function" ? perf.now() : Date.now();
|
|
710
|
+
};
|
|
711
|
+
var normalizeTimingMs = (value) => {
|
|
712
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
713
|
+
return void 0;
|
|
714
|
+
}
|
|
715
|
+
return Math.round(value);
|
|
716
|
+
};
|
|
717
|
+
var createProviderCallTimingTracker = (now = defaultNow) => ({
|
|
718
|
+
startMonotonicMs: now(),
|
|
719
|
+
now
|
|
720
|
+
});
|
|
721
|
+
var observeMeaningfulProviderResponseAt = (tracker, observedAt) => {
|
|
722
|
+
if (!tracker || tracker.firstMeaningfulMonotonicMs !== void 0) return;
|
|
723
|
+
tracker.firstMeaningfulMonotonicMs = observedAt;
|
|
724
|
+
};
|
|
725
|
+
var observeMeaningfulProviderResponse = (tracker) => {
|
|
726
|
+
if (!tracker) return;
|
|
727
|
+
observeMeaningfulProviderResponseAt(tracker, tracker.now());
|
|
728
|
+
};
|
|
729
|
+
var finalizeProviderCallTiming = (tracker) => {
|
|
730
|
+
if (!tracker) return {};
|
|
731
|
+
const callDurationMs = normalizeTimingMs(
|
|
732
|
+
Math.max(0, tracker.now() - tracker.startMonotonicMs)
|
|
733
|
+
);
|
|
734
|
+
const firstOutputMs = tracker.firstMeaningfulMonotonicMs !== void 0 ? normalizeTimingMs(
|
|
735
|
+
Math.max(0, tracker.firstMeaningfulMonotonicMs - tracker.startMonotonicMs)
|
|
736
|
+
) : void 0;
|
|
737
|
+
return {
|
|
738
|
+
...firstOutputMs !== void 0 ? { firstOutputMs } : {},
|
|
739
|
+
...callDurationMs !== void 0 ? { callDurationMs } : {}
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
var withProviderCallTimingFields = (usage, timing) => {
|
|
743
|
+
if (!usage || typeof usage !== "object") return usage;
|
|
744
|
+
return {
|
|
745
|
+
...usage,
|
|
746
|
+
...timing.firstOutputMs !== void 0 ? { firstOutputMs: timing.firstOutputMs } : {},
|
|
747
|
+
...timing.callDurationMs !== void 0 ? { callDurationMs: timing.callDurationMs } : {}
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
var isMeaningfulChatCompletionOutput = (delta) => {
|
|
751
|
+
if (!delta || typeof delta !== "object") return false;
|
|
752
|
+
const d = delta;
|
|
753
|
+
if (typeof d.content === "string" && d.content) return true;
|
|
754
|
+
if (typeof d.reasoning_content === "string" && d.reasoning_content) return true;
|
|
755
|
+
if (typeof d.reasoning === "string" && d.reasoning) return true;
|
|
756
|
+
return Array.isArray(d.tool_calls) && d.tool_calls.length > 0;
|
|
757
|
+
};
|
|
758
|
+
var isMeaningfulResponsesOutput = (event) => {
|
|
759
|
+
if (!event || typeof event !== "object") return false;
|
|
760
|
+
const e = event;
|
|
761
|
+
const type = typeof e.type === "string" ? e.type : "";
|
|
762
|
+
if (type.startsWith("response.") && type.endsWith(".delta")) {
|
|
763
|
+
const delta = e.delta;
|
|
764
|
+
if (typeof delta === "string" && delta.length > 0) return true;
|
|
765
|
+
if (delta && typeof delta === "object" && typeof delta.text === "string" && delta.text) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
return false;
|
|
769
|
+
}
|
|
770
|
+
if (type === "response.output_item.added" || type === "response.output_item.done") {
|
|
771
|
+
return e.item?.type === "function_call";
|
|
772
|
+
}
|
|
773
|
+
return false;
|
|
774
|
+
};
|
|
775
|
+
|
|
711
776
|
export {
|
|
712
777
|
clipCompactText,
|
|
713
|
-
estimateTokenCount,
|
|
714
778
|
planContextUsage,
|
|
715
779
|
buildDatabaseFileContentUrl,
|
|
716
780
|
serializeMessageContent,
|
|
@@ -723,5 +787,13 @@ export {
|
|
|
723
787
|
formatFileOperationsFromMessages,
|
|
724
788
|
formatMessagesForSummaryWithTruncation,
|
|
725
789
|
buildCompactionMetricsFromPlan,
|
|
726
|
-
formatCompactionMetricsLog
|
|
790
|
+
formatCompactionMetricsLog,
|
|
791
|
+
normalizeTimingMs,
|
|
792
|
+
createProviderCallTimingTracker,
|
|
793
|
+
observeMeaningfulProviderResponseAt,
|
|
794
|
+
observeMeaningfulProviderResponse,
|
|
795
|
+
finalizeProviderCallTiming,
|
|
796
|
+
withProviderCallTimingFields,
|
|
797
|
+
isMeaningfulChatCompletionOutput,
|
|
798
|
+
isMeaningfulResponsesOutput
|
|
727
799
|
};
|