nolo-cli 0.228.0-alpha.1 → 0.229.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-WZKT6XEU.js → _executeModel-VYCHHZVT.js} +18 -16
- package/{agentDeleteCommand-PZWRHNXY.js → agentDeleteCommand-QWQKT54A.js} +24 -22
- package/{agentEmailCommands-QTKMEICX.js → agentEmailCommands-EISMBIRE.js} +24 -22
- package/{agentListCommands-GUGMORTK.js → agentListCommands-4WLG32IW.js} +23 -415
- package/{agentMachineCommands-7QGICJLM.js → agentMachineCommands-DC6NKWTU.js} +12 -11
- package/{agentRecordCommands-SLLADS5C.js → agentRecordCommands-IZYUVHME.js} +24 -22
- package/{agentRunCommand-OFQLOF5Y.js → agentRunCommand-QM7ETUTX.js} +25 -23
- package/{agentRuntimeLocal-TU4LA353.js → agentRuntimeLocal-HOXKWCYO.js} +9 -8
- package/{agentSlice-L4SBGWTB.js → agentSlice-UG76KEBH.js} +1 -1
- package/{appDeleteCommands-JWP3XPUA.js → appDeleteCommands-WWCC6WA5.js} +13 -12
- package/{appDeployCommands-6E4TQCWI.js → appDeployCommands-AU4IUN33.js} +13 -12
- package/{appDeployStatusCommands-ALU4SADG.js → appDeployStatusCommands-STUW7WXL.js} +13 -12
- package/{appGetCommands-JEY4L6L4.js → appGetCommands-BGTLIQ4K.js} +13 -12
- package/{appListCommands-PCAVHU7M.js → appListCommands-CUCPRUXW.js} +13 -12
- package/{authCommand-CGRIIOOV.js → authCommand-OZ2KTP4Z.js} +2 -2
- package/{chunk-JUSHVFNF.js → chunk-3QIYD3VM.js} +414 -342
- package/{chunk-H6L2NFHY.js → chunk-3VZLEKV2.js} +2 -2
- package/{chunk-3P54D2E4.js → chunk-42OKN2LI.js} +1 -1
- package/{chunk-EXJK7TQO.js → chunk-45CAVC35.js} +43 -288
- package/{chunk-SMJEXX2S.js → chunk-4QYJPWHH.js} +2 -2
- package/{chunk-Q3IVPFVO.js → chunk-5YMA6DDZ.js} +1 -1
- package/{chunk-R3NEQZ53.js → chunk-7BCG67EI.js} +8 -8
- package/{chunk-CYWNWA77.js → chunk-7FEP5USX.js} +6 -3
- package/{chunk-GACR7H6T.js → chunk-CNMY2XM6.js} +2 -2
- package/{chunk-STJ6LSQE.js → chunk-DLXMMTGM.js} +82 -21
- package/{chunk-MDZWUD3R.js → chunk-EGHP7KOY.js} +3 -3
- package/{chunk-AGYPUBFW.js → chunk-FPBJM2BW.js} +4 -1
- package/{chunk-IXG6YXQM.js → chunk-GAYNXB6T.js} +51 -40
- package/{chunk-XJPLSAPJ.js → chunk-HF7BLF3F.js} +2 -2
- package/{chunk-GYS5FUYR.js → chunk-HXB4VDGK.js} +1 -1
- package/{chunk-BNMPUQW6.js → chunk-JQZRSXS5.js} +23 -23
- package/{chunk-VSYTM22R.js → chunk-LYD6C7OU.js} +2 -2
- package/{chunk-QBZCGP34.js → chunk-M3OZRQNH.js} +1 -1
- package/{chunk-DDC6P6EH.js → chunk-MJI3UAXN.js} +34 -10
- package/{chunk-RYOLWYBK.js → chunk-MNEZUL5S.js} +16 -1
- package/{chunk-GOCSSER3.js → chunk-MZG5CETE.js} +2 -2
- package/{chunk-QCB42576.js → chunk-OJ45MEEI.js} +1 -1
- package/{chunk-UE2EVEYS.js → chunk-OTKSESZR.js} +2 -2
- package/{chunk-NHY322ZU.js → chunk-RRDRQOEC.js} +508 -2
- package/{chunk-2MCB7CD7.js → chunk-TCZ2VJZQ.js} +3 -3
- package/{chunk-D6YNCNM6.js → chunk-TQEKUOTI.js} +2 -2
- package/{chunk-2NPD3FTX.js → chunk-U2HBB7RS.js} +14 -14
- package/{chunk-AUAJTAFM.js → chunk-VQ5N5GSV.js} +1 -1
- package/{chunk-K67C2JUC.js → chunk-WCFFRBL5.js} +3 -3
- package/{chunk-GPOV42YM.js → chunk-WFDNADFX.js} +1 -1
- package/chunk-WFGNWWJI.js +326 -0
- package/{chunk-OYU2MA5S.js → chunk-X3E6EHJW.js} +9 -8
- package/{chunk-GUXZK7SE.js → chunk-XAG3FWBE.js} +11 -0
- package/{chunk-OG6MQOQG.js → chunk-XFXFPUO7.js} +2 -2
- package/{chunk-UWAIJOF2.js → chunk-XTJKU3Z4.js} +4 -4
- package/{chunk-IAAIUH64.js → chunk-YVFH2MFB.js} +3 -3
- package/{chunk-TGNIKIHR.js → chunk-ZEVQHCLM.js} +1 -1
- package/{cliLocalAgentRecordReader-M3F76NIP.js → cliLocalAgentRecordReader-H3HYQRRR.js} +11 -10
- package/{commandRegistry-ZLWHQVAI.js → commandRegistry-FVYPE2IN.js} +47 -47
- package/{contentThunks-4ZX2TO7C.js → contentThunks-GNFPG32S.js} +3 -3
- package/{createAgentAutomationAction-L4CYUZJG.js → createAgentAutomationAction-PB4QIFQ4.js} +3 -3
- package/{createDialogAction-QTU2R2Q3.js → createDialogAction-EVTOPY7A.js} +4 -4
- package/{createPageAction-F3GJTHW2.js → createPageAction-2UYF2IDZ.js} +4 -4
- package/{dialogCommands-NRLCOPJR.js → dialogCommands-6SZD4TYP.js} +13 -12
- package/{dialogSlice-P2S4LXQD.js → dialogSlice-5EQ2A6LY.js} +2 -2
- package/{docCreateCommands-YJRDA3RX.js → docCreateCommands-25E6PGN3.js} +12 -11
- package/{docDeleteCommands-A5QIHZNF.js → docDeleteCommands-F7ZVGEHW.js} +13 -12
- package/{docReadCommands-CF2LTMYH.js → docReadCommands-JY2E5XEN.js} +12 -11
- package/{docStore-6O7NYL6A.js → docStore-OKKIKLT3.js} +1 -1
- package/{docUpdateCommands-QRKV4ZXE.js → docUpdateCommands-OZ4CUSIQ.js} +12 -11
- package/{handleSendMessageAction-7IHLR37A.js → handleSendMessageAction-LNT7SZND.js} +12 -11
- package/{hostCredentialCreate-VNCQUAFT.js → hostCredentialCreate-XUU2CSHI.js} +24 -22
- package/index.js +3 -3
- package/{localRuntimeAdapter-FOWVNMIK.js → localRuntimeAdapter-IBSTMSX7.js} +23 -21
- package/{machineCommands-ZGC3J4JB.js → machineCommands-HSQHDHOT.js} +41 -24
- package/{machineWsRunDispatch-KK5U4M3G.js → machineWsRunDispatch-L6H7J66T.js} +24 -22
- package/package.json +1 -1
- package/{projectArchive-7ZDYBXAX.js → projectArchive-FQO654Z3.js} +4 -4
- package/{readlineWorkspace-YHT4SX2C.js → readlineWorkspace-7U272DSA.js} +36 -33
- package/{runAgentClientLoop-H4ED5V3K.js → runAgentClientLoop-AF4JQIJ7.js} +16 -14
- package/{skillDiscovery-I37M5KJC.js → skillDiscovery-BHHPCUHZ.js} +3 -3
- package/{spaceCommands-MEH3HJBC.js → spaceCommands-5VNWMDBE.js} +12 -11
- package/{streamAgentChatTurn-ZXPOXU33.js → streamAgentChatTurn-YSPEFY4K.js} +24 -21
- package/{tools-2MRWA2PP.js → tools-M35PTIFB.js} +11 -9
- package/{updateDialogTitleAction-RZ3KZSGQ.js → updateDialogTitleAction-IMIRJRQQ.js} +3 -3
- package/chunk-2WZXXAQD.js +0 -57
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
targetForRunKind,
|
|
18
18
|
validateAccessAndBalance,
|
|
19
19
|
withRequestContextBlocks
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-X3E6EHJW.js";
|
|
21
21
|
import {
|
|
22
22
|
resolveUserSkillRuntime
|
|
23
23
|
} from "./chunk-ZXF6D3I6.js";
|
|
@@ -30,14 +30,15 @@ import {
|
|
|
30
30
|
persistToolMessages,
|
|
31
31
|
readStreamChunk,
|
|
32
32
|
sendOpenAICompletionsRequest,
|
|
33
|
+
serializeAgentRunMessages,
|
|
33
34
|
updateTotalUsage
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-MJI3UAXN.js";
|
|
35
36
|
import "./chunk-JEXVIMYZ.js";
|
|
36
37
|
import {
|
|
37
38
|
inlineImageUrlsForCustomProvider,
|
|
38
39
|
prepareTools,
|
|
39
40
|
shouldInlineImageUrlsForAgent
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-OTKSESZR.js";
|
|
41
42
|
import {
|
|
42
43
|
DirectApiKeyResolutionError,
|
|
43
44
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
@@ -49,23 +50,24 @@ import {
|
|
|
49
50
|
sanitizeOutboundResponsesInput,
|
|
50
51
|
selectResponsesConversationState,
|
|
51
52
|
updateResponsesConversationState
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-XTJKU3Z4.js";
|
|
53
54
|
import "./chunk-HS7MLR74.js";
|
|
54
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-GAYNXB6T.js";
|
|
55
56
|
import {
|
|
56
57
|
isGptProModel,
|
|
57
58
|
isPlatformPaidAgentCall,
|
|
58
59
|
shouldBlockForGptPro
|
|
59
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-RRDRQOEC.js";
|
|
61
|
+
import "./chunk-AMWMV56B.js";
|
|
60
62
|
import "./chunk-6QHKRARD.js";
|
|
61
63
|
import {
|
|
62
64
|
performServerProxyFetchWithRetry
|
|
63
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-EGHP7KOY.js";
|
|
64
66
|
import {
|
|
65
67
|
createSSEParser,
|
|
66
68
|
selectMaxExecutionTime,
|
|
67
69
|
waitForAbortableDelay
|
|
68
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-HF7BLF3F.js";
|
|
69
71
|
import "./chunk-NF64D32W.js";
|
|
70
72
|
import "./chunk-RBPUNSG5.js";
|
|
71
73
|
import "./chunk-4JVNURX4.js";
|
|
@@ -75,9 +77,9 @@ import "./chunk-FJ23FZXF.js";
|
|
|
75
77
|
import "./chunk-AGIM7IMJ.js";
|
|
76
78
|
import "./chunk-63W5N6P3.js";
|
|
77
79
|
import "./chunk-VF4K2QE6.js";
|
|
78
|
-
import "./chunk-
|
|
79
|
-
import "./chunk-
|
|
80
|
-
import "./chunk-
|
|
80
|
+
import "./chunk-LYD6C7OU.js";
|
|
81
|
+
import "./chunk-4QYJPWHH.js";
|
|
82
|
+
import "./chunk-HXB4VDGK.js";
|
|
81
83
|
import {
|
|
82
84
|
getCurrentSpaceId
|
|
83
85
|
} from "./chunk-547ENH5T.js";
|
|
@@ -102,11 +104,11 @@ import {
|
|
|
102
104
|
updateDialogSummaryAction,
|
|
103
105
|
updateTokens,
|
|
104
106
|
updateToolMessage
|
|
105
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-7BCG67EI.js";
|
|
106
108
|
import "./chunk-TZXPT53C.js";
|
|
107
109
|
import "./chunk-BUDVRYES.js";
|
|
108
110
|
import "./chunk-523DITKR.js";
|
|
109
|
-
import "./chunk-
|
|
111
|
+
import "./chunk-WCFFRBL5.js";
|
|
110
112
|
import "./chunk-BYXBJQAS.js";
|
|
111
113
|
import "./chunk-QYPE3TS3.js";
|
|
112
114
|
import {
|
|
@@ -188,21 +190,21 @@ import {
|
|
|
188
190
|
evaluateRequestBudget,
|
|
189
191
|
extractImageUrlsFromMessages,
|
|
190
192
|
stripImagePartsForTextOnlyAgent
|
|
191
|
-
} from "./chunk-
|
|
192
|
-
import "./chunk-
|
|
193
|
+
} from "./chunk-XAG3FWBE.js";
|
|
194
|
+
import "./chunk-BYXBJQAS.js";
|
|
193
195
|
import "./chunk-DUUDXSLX.js";
|
|
194
196
|
import {
|
|
195
197
|
projectUserPartForModel
|
|
196
198
|
} from "./chunk-QYB23WUH.js";
|
|
197
199
|
import "./chunk-56GBUMO5.js";
|
|
198
|
-
import "./chunk-
|
|
200
|
+
import "./chunk-FPBJM2BW.js";
|
|
199
201
|
import {
|
|
200
202
|
extractImagePartsFromResponseOutput,
|
|
201
203
|
extractTextFromResponseOutput,
|
|
202
204
|
toResponsesTools
|
|
203
205
|
} from "./chunk-EEOOBRA7.js";
|
|
204
206
|
import "./chunk-X4O7FJF5.js";
|
|
205
|
-
import "./chunk-
|
|
207
|
+
import "./chunk-MNEZUL5S.js";
|
|
206
208
|
import "./chunk-QJTZ76CP.js";
|
|
207
209
|
import {
|
|
208
210
|
resolveRuntimeToolSurfaceForAgent
|
|
@@ -215,6 +217,7 @@ import {
|
|
|
215
217
|
resolveAgentCallPlan,
|
|
216
218
|
resolveClientWire
|
|
217
219
|
} from "./chunk-OBIC6EG7.js";
|
|
220
|
+
import "./chunk-WFGNWWJI.js";
|
|
218
221
|
import "./chunk-FJSNBZXR.js";
|
|
219
222
|
import {
|
|
220
223
|
resolveAgentContextWindow
|
|
@@ -260,8 +263,8 @@ import {
|
|
|
260
263
|
import "./chunk-YZMNK53S.js";
|
|
261
264
|
import "./chunk-I42VC5KR.js";
|
|
262
265
|
import "./chunk-U6VC4MU4.js";
|
|
263
|
-
import "./chunk-
|
|
264
|
-
import "./chunk-
|
|
266
|
+
import "./chunk-42OKN2LI.js";
|
|
267
|
+
import "./chunk-JQZRSXS5.js";
|
|
265
268
|
import "./chunk-KHCLMKZZ.js";
|
|
266
269
|
import "./chunk-LCBAMY2M.js";
|
|
267
270
|
import "./chunk-62HXNQVV.js";
|
|
@@ -2240,7 +2243,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
|
|
|
2240
2243
|
agentKey,
|
|
2241
2244
|
userInput: agentRunUserInput,
|
|
2242
2245
|
...Array.isArray(contextBlocks) && contextBlocks.length > 0 ? { contextBlocks } : {},
|
|
2243
|
-
messages: cleanedMessages,
|
|
2246
|
+
messages: serializeAgentRunMessages(cleanedMessages),
|
|
2244
2247
|
stream: true,
|
|
2245
2248
|
persistDialog: true,
|
|
2246
2249
|
continueDialogId: dialogId2,
|
|
@@ -3176,7 +3179,7 @@ ${info.actionHint}` : streamError;
|
|
|
3176
3179
|
agentKey,
|
|
3177
3180
|
userInput: agentRunUserInput,
|
|
3178
3181
|
...Array.isArray(contextBlocks) && contextBlocks.length > 0 ? { contextBlocks } : {},
|
|
3179
|
-
messages: cleanedMessages,
|
|
3182
|
+
messages: serializeAgentRunMessages(cleanedMessages),
|
|
3180
3183
|
stream: true,
|
|
3181
3184
|
persistDialog: false,
|
|
3182
3185
|
clientDialogId: dialogId,
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
toolQueryFunc,
|
|
9
9
|
toolQueryFunctionSchema,
|
|
10
10
|
toolRegistry
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-GAYNXB6T.js";
|
|
12
|
+
import "./chunk-RRDRQOEC.js";
|
|
13
|
+
import "./chunk-AMWMV56B.js";
|
|
13
14
|
import "./chunk-6QHKRARD.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-HF7BLF3F.js";
|
|
15
16
|
import "./chunk-NF64D32W.js";
|
|
16
17
|
import "./chunk-RBPUNSG5.js";
|
|
17
18
|
import "./chunk-4JVNURX4.js";
|
|
@@ -21,15 +22,15 @@ import "./chunk-FJ23FZXF.js";
|
|
|
21
22
|
import "./chunk-AGIM7IMJ.js";
|
|
22
23
|
import "./chunk-63W5N6P3.js";
|
|
23
24
|
import "./chunk-VF4K2QE6.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-LYD6C7OU.js";
|
|
26
|
+
import "./chunk-4QYJPWHH.js";
|
|
27
|
+
import "./chunk-HXB4VDGK.js";
|
|
27
28
|
import "./chunk-547ENH5T.js";
|
|
28
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-7BCG67EI.js";
|
|
29
30
|
import "./chunk-TZXPT53C.js";
|
|
30
31
|
import "./chunk-BUDVRYES.js";
|
|
31
32
|
import "./chunk-523DITKR.js";
|
|
32
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-WCFFRBL5.js";
|
|
33
34
|
import "./chunk-BYXBJQAS.js";
|
|
34
35
|
import "./chunk-QYPE3TS3.js";
|
|
35
36
|
import "./chunk-RG2DGNL6.js";
|
|
@@ -61,9 +62,10 @@ import "./chunk-HXER7YJF.js";
|
|
|
61
62
|
import "./chunk-BV3FLP2L.js";
|
|
62
63
|
import "./chunk-S6K5F3KP.js";
|
|
63
64
|
import "./chunk-4JH2UMJR.js";
|
|
64
|
-
import "./chunk-
|
|
65
|
+
import "./chunk-MNEZUL5S.js";
|
|
65
66
|
import "./chunk-QJTZ76CP.js";
|
|
66
67
|
import "./chunk-VS276URX.js";
|
|
68
|
+
import "./chunk-WFGNWWJI.js";
|
|
67
69
|
import "./chunk-FJSNBZXR.js";
|
|
68
70
|
import "./chunk-QRGDJA4B.js";
|
|
69
71
|
import "./chunk-5ZUL4CUO.js";
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./chunk-Z4PCXPUE.js";
|
|
4
4
|
import {
|
|
5
5
|
updateContentTitle
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HXB4VDGK.js";
|
|
7
7
|
import "./chunk-547ENH5T.js";
|
|
8
8
|
import {
|
|
9
9
|
isAssistantToolStub,
|
|
10
10
|
selectAllMsgs
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7BCG67EI.js";
|
|
12
12
|
import "./chunk-TZXPT53C.js";
|
|
13
13
|
import {
|
|
14
14
|
require_format
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-523DITKR.js";
|
|
20
20
|
import {
|
|
21
21
|
runLlm
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WCFFRBL5.js";
|
|
23
23
|
import "./chunk-BYXBJQAS.js";
|
|
24
24
|
import "./chunk-QYPE3TS3.js";
|
|
25
25
|
import "./chunk-RG2DGNL6.js";
|
package/chunk-2WZXXAQD.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// packages/ai/agent/toolOutputPolicy.ts
|
|
2
|
-
var MAX_IN_TURN_TOOL_CONTENT_CHARS = 4e3;
|
|
3
|
-
var DEFAULT_TOOL_OUTPUT_PROFILE = {
|
|
4
|
-
maxChars: MAX_IN_TURN_TOOL_CONTENT_CHARS,
|
|
5
|
-
headRatio: 0.5
|
|
6
|
-
};
|
|
7
|
-
var TOOL_OUTPUT_PROFILES = {
|
|
8
|
-
readFile: { maxChars: 4800, headRatio: 0.68, historicalMaxChars: 4800 },
|
|
9
|
-
read_file: { maxChars: 4800, headRatio: 0.68, historicalMaxChars: 4800 },
|
|
10
|
-
readWorkspaceFile: { maxChars: 4800, headRatio: 0.68, historicalMaxChars: 4800 },
|
|
11
|
-
globFiles: { maxChars: 2800, headRatio: 0.85 },
|
|
12
|
-
execShell: { maxChars: 4e3, headRatio: 0.35 },
|
|
13
|
-
runCommand: { maxChars: 4e3, headRatio: 0.35 },
|
|
14
|
-
launchProcess: { maxChars: 2800, headRatio: 0.35 },
|
|
15
|
-
editFile: { maxChars: 1200, headRatio: 0.62 },
|
|
16
|
-
writeFile: { maxChars: 1e3, headRatio: 0.62 },
|
|
17
|
-
readPastedText: { maxChars: 4800, headRatio: 0.5, historicalMaxChars: 4800 },
|
|
18
|
-
// loadSkill 内联的是文档正文(SKILL.md 全文),与 readFile 同类,不该因为工具名未登记就退回
|
|
19
|
-
// DEFAULT 的 4000。历史事故(nolo-plan omitted middle)正是 headRatio 0.5 掐掉中段,把
|
|
20
|
-
// 「MUST / 禁止」所在的中段静默省略。取 4800(与 readFile 同级),不激进放大;headRatio 同 DEFAULT。
|
|
21
|
-
loadSkill: { maxChars: 4800, headRatio: 0.5 }
|
|
22
|
-
};
|
|
23
|
-
function resolveToolOutputProfile(toolName) {
|
|
24
|
-
return (toolName ? TOOL_OUTPUT_PROFILES[toolName] : void 0) ?? DEFAULT_TOOL_OUTPUT_PROFILE;
|
|
25
|
-
}
|
|
26
|
-
function resolveHistoricalToolContentCap(toolName, historicalMaxChars) {
|
|
27
|
-
const profile = toolName ? TOOL_OUTPUT_PROFILES[toolName] : void 0;
|
|
28
|
-
return profile?.historicalMaxChars !== void 0 ? Math.max(historicalMaxChars, profile.historicalMaxChars) : historicalMaxChars;
|
|
29
|
-
}
|
|
30
|
-
function projectToolMessageContent(input) {
|
|
31
|
-
const { content, toolName } = input;
|
|
32
|
-
const maxChars = resolveToolOutputProfile(toolName).maxChars;
|
|
33
|
-
if (content.length <= maxChars) return content;
|
|
34
|
-
return clipToolText(
|
|
35
|
-
content,
|
|
36
|
-
maxChars,
|
|
37
|
-
resolveToolOutputProfile(toolName).headRatio,
|
|
38
|
-
`
|
|
39
|
-
\u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
function clipToolText(content, maxChars, headRatio, marker = "\n\n[... tool output middle omitted; head/tail preserved ...]\n\n") {
|
|
43
|
-
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
44
|
-
if (normalized.length <= maxChars) return normalized;
|
|
45
|
-
if (maxChars <= marker.length + 2) return normalized.slice(0, maxChars);
|
|
46
|
-
const available = maxChars - marker.length;
|
|
47
|
-
const headChars = Math.max(1, Math.floor(available * headRatio));
|
|
48
|
-
const tailChars = Math.max(1, available - headChars);
|
|
49
|
-
return `${normalized.slice(0, headChars)}${marker}${normalized.slice(-tailChars)}`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
resolveToolOutputProfile,
|
|
54
|
-
resolveHistoricalToolContentCap,
|
|
55
|
-
projectToolMessageContent,
|
|
56
|
-
clipToolText
|
|
57
|
-
};
|