nolo-cli 0.19.0 → 0.24.0-alpha.7
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-X5PCIZN6.js → _executeModel-ARCMGGMY.js} +46 -44
- package/{action-LT7BRFLK.js → action-5MNAXR5B.js} +7 -6
- package/{addContentAction-PL3KKBDH.js → addContentAction-UNSYTVTB.js} +5 -5
- package/{addDialogAgentAction-FCMSKYAF.js → addDialogAgentAction-LJGNP2AO.js} +5 -5
- package/{agentDeleteCommand-2BZDQV36.js → agentDeleteCommand-C5PIEBMZ.js} +27 -26
- package/{agentEmailCommands-2QJDGRMB.js → agentEmailCommands-QTGQ3ZAD.js} +57 -55
- package/{agentListCommands-6VEPTKBI.js → agentListCommands-LRHBS3A5.js} +30 -26
- package/{agentMachineCommands-NVVHNWYI.js → agentMachineCommands-4PXIT4BP.js} +25 -24
- package/{agentRecordCommands-4GGRDMD4.js → agentRecordCommands-ZZPTYTYR.js} +52 -50
- package/{agentRunCommand-XOLQNKBZ.js → agentRunCommand-7ZTPZNUX.js} +55 -54
- package/{agentRunControl-Y5AFH5PQ.js → agentRunControl-SNUKXN6J.js} +6 -2
- package/{agentRuntimeLocal-7WYWCGL4.js → agentRuntimeLocal-QOYY5UV2.js} +19 -18
- package/{agentSlice-EAXPGEYV.js → agentSlice-J3W3RX2I.js} +5 -5
- package/{appDeleteCommands-77KR2RJ4.js → appDeleteCommands-7NS46XDH.js} +23 -22
- package/{appDeployCommands-K7CAHGBI.js → appDeployCommands-RSRNQ67U.js} +23 -22
- package/{appDeployStatusCommands-4OEKLTBT.js → appDeployStatusCommands-EF4RSGC6.js} +23 -22
- package/{appGetCommands-VM2WDLAZ.js → appGetCommands-YA7JWYUX.js} +23 -22
- package/{appListCommands-GX6BBA6U.js → appListCommands-WM2ON6JW.js} +23 -22
- package/{authCommand-DY6UUL6O.js → authCommand-HJP7FURK.js} +12 -13
- package/{authCommands-XTBV7OFZ.js → authCommands-NYZM2B2I.js} +4 -5
- package/{chunk-MKA6QE5E.js → chunk-2IPEVBUO.js} +126 -68
- package/{chunk-OWOHNGCN.js → chunk-2MBTWINN.js} +42 -3
- package/{chunk-K6EUAOW3.js → chunk-35RYGII3.js} +1 -1
- package/{chunk-TRT4I4UD.js → chunk-4POUK2BV.js} +2 -2
- package/{chunk-LLWKHDG4.js → chunk-4ULSC37S.js} +1 -3
- package/{chunk-EDV7EBOI.js → chunk-4ZH6GUJF.js} +2151 -1500
- package/{chunk-MVQ4TBSD.js → chunk-54VHTARN.js} +1 -1
- package/{chunk-L4F3I4SR.js → chunk-5HQQ4LUU.js} +4 -6
- package/{chunk-Z4NR32XR.js → chunk-5RGU3J7P.js} +13 -0
- package/{chunk-7BUYEZ6U.js → chunk-7H3UTGPM.js} +12 -72
- package/{chunk-RQN4SEKL.js → chunk-7W6GFNJL.js} +1 -1
- package/{chunk-HEGV7BH3.js → chunk-AQZCWJOG.js} +1 -1
- package/{chunk-3ND52WIL.js → chunk-ATWUOTJP.js} +180 -24
- package/chunk-CF7S2RYZ.js +376 -0
- package/{chunk-I2ZJKTG5.js → chunk-CGVRC2TB.js} +7 -7
- package/{chunk-UAIVG4J6.js → chunk-CHSCAUZN.js} +1 -8
- package/{chunk-KFEVY3ST.js → chunk-D34RI6NI.js} +18 -8
- package/{chunk-ROWQEJRP.js → chunk-DXJS7VSG.js} +3 -2
- package/{chunk-MHSGJW4Z.js → chunk-EHOYZRTI.js} +44 -14
- package/{chunk-XRZJGPFI.js → chunk-FON47ACC.js} +4 -4
- package/{chunk-SCTYAHYK.js → chunk-H2NAWOLH.js} +217 -141
- package/{chunk-MPVYDS7I.js → chunk-H6ODMJR3.js} +3 -3
- package/{chunk-R35XMF6F.js → chunk-H73ZV2GL.js} +352 -30
- package/{chunk-4T5F7YZQ.js → chunk-I6RJGORZ.js} +1 -1
- package/{chunk-OK6YSWLH.js → chunk-IICW77GI.js} +1 -1
- package/{chunk-VDXCXCXH.js → chunk-IUDMBCXC.js} +1 -1
- package/{chunk-AHCY2S2I.js → chunk-JADNODCQ.js} +1 -1
- package/{chunk-DFCFMCY6.js → chunk-JBLY6HQP.js} +2 -2
- package/{chunk-UGUW3FHG.js → chunk-JMSCXQUG.js} +2 -2
- package/{chunk-N54HIJVJ.js → chunk-KFUCLS7Z.js} +101 -9
- package/{chunk-FQZZLA3C.js → chunk-KXKQO4Q6.js} +17 -0
- package/{chunk-3Q7WHGCB.js → chunk-L65QKSVJ.js} +1 -1
- package/{chunk-3ZX7PERL.js → chunk-LALVWNE4.js} +20 -7
- package/{chunk-PJSV3IZ5.js → chunk-M3TMVJKG.js} +1 -1
- package/{chunk-REA4JLBH.js → chunk-M5OZCOBV.js} +7 -6
- package/{chunk-JLA4FXYC.js → chunk-MALVZUYL.js} +1 -1
- package/{chunk-GFUIQ4RY.js → chunk-MXFQHRSS.js} +1 -1
- package/{chunk-LSFAWXKC.js → chunk-N7J63Q6C.js} +1 -0
- package/{chunk-6Y7A3OQQ.js → chunk-NRY4GCKJ.js} +2 -0
- package/{chunk-G5U6LDLG.js → chunk-NVHPMDSZ.js} +6 -6
- package/{chunk-23FZYPLC.js → chunk-OJFYT3ZQ.js} +842 -1060
- package/{chunk-ELT65PZW.js → chunk-OXLLFZNF.js} +1 -1
- package/{chunk-CZ6NYQTV.js → chunk-P4QWLZGU.js} +2 -2
- package/{chunk-5MIDPSSK.js → chunk-PB7G5MAM.js} +3 -3
- package/{chunk-HWW2M4SN.js → chunk-QLVWFXZQ.js} +5 -4
- package/{chunk-VYHDJEQD.js → chunk-QNLLGS37.js} +136 -78
- package/{chunk-XHG22OEX.js → chunk-ROJI6DRT.js} +2 -2
- package/{chunk-BV4VEE3W.js → chunk-ROYOKSX4.js} +243 -354
- package/{chunk-VNAEBGDK.js → chunk-RZNYL4LW.js} +123 -26
- package/{chunk-RVOUXDFU.js → chunk-S6KVFOUG.js} +6 -34
- package/{chunk-V3ED5AWK.js → chunk-S77SCVBU.js} +27 -16
- package/{chunk-UBHAWFQ6.js → chunk-S7RWIPDI.js} +42 -19
- package/{chunk-B5TOXZAK.js → chunk-SIZQB7BD.js} +1 -1
- package/{chunk-DFFIZ25G.js → chunk-SLOGKB7M.js} +4 -1
- package/{chunk-FXUSIQC2.js → chunk-SROR5TSM.js} +1 -1
- package/{chunk-PIZYJVHQ.js → chunk-TN4YHAI3.js} +4 -4
- package/{chunk-IYEXFJPC.js → chunk-TW35GDNW.js} +64 -57
- package/chunk-UZ6XXCVR.js +50 -0
- package/{chunk-DKZFOK24.js → chunk-UZH44DWK.js} +7 -288
- package/{chunk-YGW4G5W5.js → chunk-X546QUDT.js} +61 -12
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-SWDPIPOY.js → chunk-ZGVW7MSZ.js} +1 -1
- package/{chunk-34WPV75U.js → chunk-ZUXIXYJI.js} +1 -1
- package/{chunk-VC6OZXO5.js → chunk-ZWJOGMKH.js} +2 -26
- package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
- package/{codingSkills-36KN5NQT.js → codingSkills-EN6Z6G6U.js} +4 -4
- package/{createAgentAutomationAction-GNFF524X.js → createAgentAutomationAction-MKQWN4VQ.js} +19 -18
- package/{createDialogAction-RB55KCLO.js → createDialogAction-YWIZPLFS.js} +22 -20
- package/{createPageAction-Y7343GLU.js → createPageAction-74TTEIPC.js} +20 -19
- package/{db-W3O47YGF.js → db-W5UHK4P3.js} +150 -0
- package/{dbSlice-CGSRFJN3.js → dbSlice-5BKDURDL.js} +4 -4
- package/{dialogCommands-IAZK6YHQ.js → dialogCommands-MJIP32FL.js} +24 -23
- package/{dialogSlice-UQAXF23P.js → dialogSlice-KLLVH4WI.js} +24 -18
- package/{docCreateCommands-I2EWZGCI.js → docCreateCommands-5DN472U6.js} +24 -27
- package/{docDeleteCommands-IZ45UZKG.js → docDeleteCommands-HE76LBN4.js} +25 -24
- package/{docReadCommands-R6Z4QJYU.js → docReadCommands-XVGZSCBS.js} +24 -23
- package/{docStore-5HOJ4D7D.js → docStore-SPH3D6BT.js} +20 -19
- package/{docUpdateCommands-2LRBKQPY.js → docUpdateCommands-P7IAWUAD.js} +24 -27
- package/{fetchMessages-BMGVZVSE.js → fetchMessages-W4IKHPCS.js} +2 -3
- package/{getPricing-G7DLAST6.js → getPricing-WENPBVWH.js} +3 -3
- package/{handleSendMessageAction-Q4HY35WX.js → handleSendMessageAction-ZU6WJVL7.js} +23 -20
- package/index.js +74 -74
- package/{localDialogRead-4H3QJFLW.js → localDialogRead-JXTAHW2E.js} +2 -2
- package/{machineCommands-PKBPQKTY.js → machineCommands-NI76PVHK.js} +59 -57
- package/{machineWsRunDispatch-UZAW4OXJ.js → machineWsRunDispatch-W3G6NJVQ.js} +51 -49
- package/{models-DJFSJ7SW.js → models-DB27UAE3.js} +2 -2
- package/package.json +1 -1
- package/{read-3FMPZPER.js → read-F3L3T2WJ.js} +2 -1
- package/{readDocTool-VSYHKK3V.js → readDocTool-FOHWVA4R.js} +1 -1
- package/{readlineWorkspace-Y2RDOFZG.js → readlineWorkspace-BDH4G477.js} +880 -425
- package/{removeDialogAgentAction-OAGA2G3U.js → removeDialogAgentAction-QCFGIUIH.js} +8 -7
- package/{runAgentClientLoop-NBPIKJ6J.js → runAgentClientLoop-ZPKMXCM5.js} +45 -38
- package/{setDialogExtraReferencesAction-JZEXA5SL.js → setDialogExtraReferencesAction-DK4CKERU.js} +5 -5
- package/{setPrimaryDialogAgentAction-4ZUQQKDG.js → setPrimaryDialogAgentAction-SJSO6N27.js} +8 -7
- package/{settingSlice-7MNKHZ6R.js → settingSlice-XNM5AFPU.js} +6 -5
- package/{spaceCommands-DHCZ7J5I.js → spaceCommands-3GGBJRQR.js} +25 -24
- package/{spaceSlice-ZXLLG3CR.js → spaceSlice-47Z6XLFQ.js} +21 -18
- package/{streamAgentChatTurn-L3YW6LSB.js → streamAgentChatTurn-VT5K5JSD.js} +140 -98
- package/switchDialogAgentAction-4OAC6QRN.js +61 -0
- package/{tableCommands-BEQAGE4I.js → tableCommands-HEQYT2KP.js} +1 -1
- package/{toolApiClient-QI3YBNWB.js → toolApiClient-ISM4ZQX4.js} +2 -2
- package/{tools-ECGXR5QF.js → tools-L7RCHAPT.js} +36 -33
- package/{tuiSummaryLlmCaller-OMSCNHXA.js → tuiSummaryLlmCaller-3DYOLTVN.js} +6 -6
- package/{updateCommands-XTW55TOT.js → updateCommands-HTCOBXCA.js} +2 -2
- package/{updateDialogTitleAction-HQ2EUDFT.js → updateDialogTitleAction-KMPVPQ4A.js} +28 -27
- package/chunk-DL6EPNIK.js +0 -50
- package/chunk-V5R4NZP2.js +0 -78
- package/chunk-X4Q4UZEY.js +0 -26
- package/queryRunOverlay-O4LOMMPO.js +0 -161
- package/runOverlayPresentation-ZO4VCWEU.js +0 -11
- package/types-ZSTJ7MPR.js +0 -7
- package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
- package/{runtimeDoctorCommands-E2OUORHK.js → runtimeDoctorCommands-HSU632DY.js} +3 -3
|
@@ -8,24 +8,26 @@ import {
|
|
|
8
8
|
writeUsage
|
|
9
9
|
} from "./chunk-DZ3XJVET.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
normalizeAgentHandle,
|
|
15
|
-
readDbRecord,
|
|
16
|
-
resolveAgentRecordFromHybridStore
|
|
17
|
-
} from "./chunk-DFCFMCY6.js";
|
|
11
|
+
resolveMachineId
|
|
12
|
+
} from "./chunk-6HYVJV7B.js";
|
|
18
13
|
import {
|
|
19
14
|
agentRunCardLabels,
|
|
20
|
-
createCliCallAgentToolExecutor,
|
|
21
15
|
createCliLocalRuntimeAdapter,
|
|
22
16
|
getCliLocale,
|
|
23
17
|
isBuiltinNoloAgentRef,
|
|
24
|
-
|
|
18
|
+
isSubtaskRun,
|
|
25
19
|
parseAgentRunEvent,
|
|
26
20
|
t,
|
|
27
21
|
toolLabel
|
|
28
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OJFYT3ZQ.js";
|
|
23
|
+
import {
|
|
24
|
+
getReadableCliDb
|
|
25
|
+
} from "./chunk-WFHXMLHZ.js";
|
|
26
|
+
import {
|
|
27
|
+
normalizeAgentHandle,
|
|
28
|
+
readDbRecord,
|
|
29
|
+
resolveAgentRecordFromHybridStore
|
|
30
|
+
} from "./chunk-JBLY6HQP.js";
|
|
29
31
|
import {
|
|
30
32
|
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
31
33
|
isLocalCliAgentKey
|
|
@@ -34,12 +36,9 @@ import {
|
|
|
34
36
|
applyModelLayerOverride,
|
|
35
37
|
buildModelLayerOverride
|
|
36
38
|
} from "./chunk-LTRXGFMS.js";
|
|
37
|
-
import {
|
|
38
|
-
resolveMachineId
|
|
39
|
-
} from "./chunk-6HYVJV7B.js";
|
|
40
39
|
import {
|
|
41
40
|
formatAgentListCard
|
|
42
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4ZH6GUJF.js";
|
|
43
42
|
import {
|
|
44
43
|
isGatewayHttpStatus
|
|
45
44
|
} from "./chunk-RQSOAMPJ.js";
|
|
@@ -51,23 +50,19 @@ import {
|
|
|
51
50
|
chooseMemoryOwners,
|
|
52
51
|
loadMemoryCandidatesFromDb,
|
|
53
52
|
resolveAgentMemoryPolicy
|
|
54
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-TW35GDNW.js";
|
|
55
54
|
import {
|
|
56
55
|
API_REPORTED_COST_MULTIPLIER,
|
|
57
56
|
normalizeUsage,
|
|
58
57
|
parseUiAskChoiceContent
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-H2NAWOLH.js";
|
|
60
59
|
import {
|
|
61
60
|
buildSkillDiscoveryContextBlock
|
|
62
61
|
} from "./chunk-7OBMZCRD.js";
|
|
63
62
|
import {
|
|
64
63
|
parseExternalSkillMarkdown,
|
|
65
64
|
parseSkillDocProtocol
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import {
|
|
68
|
-
buildPlatformChatCompletionRequest,
|
|
69
|
-
parsePlatformChatCompletionData
|
|
70
|
-
} from "./chunk-N54HIJVJ.js";
|
|
65
|
+
} from "./chunk-ZWJOGMKH.js";
|
|
71
66
|
import {
|
|
72
67
|
resolveAgentRuntimeConfigFromRecord
|
|
73
68
|
} from "./chunk-OIQPORYI.js";
|
|
@@ -76,29 +71,25 @@ import {
|
|
|
76
71
|
LOCAL_TURN_ABORTED_CODE,
|
|
77
72
|
readActionGate,
|
|
78
73
|
readCommandActionGatePayload
|
|
79
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-X546QUDT.js";
|
|
80
75
|
import {
|
|
81
76
|
createThinkParserState,
|
|
82
77
|
flushThinkParser,
|
|
83
78
|
processThinkChunk
|
|
84
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-N7J63Q6C.js";
|
|
85
80
|
import {
|
|
86
|
-
resolvePlatformAuthToken
|
|
87
|
-
|
|
88
|
-
} from "./chunk-MHSGJW4Z.js";
|
|
81
|
+
resolvePlatformAuthToken
|
|
82
|
+
} from "./chunk-EHOYZRTI.js";
|
|
89
83
|
import {
|
|
90
84
|
DEFAULT_CONTEXT_WINDOW,
|
|
91
85
|
getModelContextWindow
|
|
92
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-CGVRC2TB.js";
|
|
93
87
|
import {
|
|
94
88
|
clipCompactText
|
|
95
89
|
} from "./chunk-5MMAK75Q.js";
|
|
96
90
|
import {
|
|
97
91
|
findModelConfig
|
|
98
|
-
} from "./chunk-
|
|
99
|
-
import {
|
|
100
|
-
toErrorMessage
|
|
101
|
-
} from "./chunk-HNMXYYJR.js";
|
|
92
|
+
} from "./chunk-CHSCAUZN.js";
|
|
102
93
|
import {
|
|
103
94
|
buildMemoryOverlayLayer,
|
|
104
95
|
buildMemoryUseGuidanceLayer
|
|
@@ -110,7 +101,7 @@ import {
|
|
|
110
101
|
createRunActivityTracker,
|
|
111
102
|
finalizeRunRecord,
|
|
112
103
|
spawnLocalBackgroundRun
|
|
113
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-RZNYL4LW.js";
|
|
114
105
|
import {
|
|
115
106
|
formatFinishedRunCard,
|
|
116
107
|
formatListRunsCard,
|
|
@@ -120,10 +111,13 @@ import {
|
|
|
120
111
|
formatStopRunCard,
|
|
121
112
|
isAgentRunTerminalStatus,
|
|
122
113
|
runShowsLogTail
|
|
123
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-KXKQO4Q6.js";
|
|
124
115
|
import {
|
|
125
116
|
CliProviderQuotaError
|
|
126
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-CMKUBIGW.js";
|
|
118
|
+
import {
|
|
119
|
+
toErrorMessage
|
|
120
|
+
} from "./chunk-HNMXYYJR.js";
|
|
127
121
|
import {
|
|
128
122
|
readPipeText,
|
|
129
123
|
spawnProcess
|
|
@@ -136,7 +130,7 @@ import {
|
|
|
136
130
|
} from "./chunk-Y5GCAMGP.js";
|
|
137
131
|
import {
|
|
138
132
|
createMemoryKey
|
|
139
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-NRY4GCKJ.js";
|
|
140
134
|
import {
|
|
141
135
|
asTrimmedLowercaseString
|
|
142
136
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -144,7 +138,7 @@ import {
|
|
|
144
138
|
BUILTIN_NOLO_AGENT_KEY,
|
|
145
139
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
146
140
|
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
147
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-ATWUOTJP.js";
|
|
148
142
|
import {
|
|
149
143
|
asTrimmedString
|
|
150
144
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -155,97 +149,6 @@ import {
|
|
|
155
149
|
asOptionalTrimmedString
|
|
156
150
|
} from "./chunk-G3SUCT4W.js";
|
|
157
151
|
|
|
158
|
-
// packages/agent-runtime/quickChatIntentCore.ts
|
|
159
|
-
var INTENT_MODEL = "deepseek-v4-flash";
|
|
160
|
-
var INTENT_PROVIDER = "nolo";
|
|
161
|
-
var QUICK_CHAT_INTENT_TIMEOUT_MS = 4e3;
|
|
162
|
-
var SHORT_GREETING_MAX_LENGTH = 20;
|
|
163
|
-
var SHORT_GREETING_PATTERN = /^(?:hi|hello|hey|hiya|yo|sup|howdy|嗨|哈喽|哈囉|你好|您好|在吗|在嘛|喂|早上好|中午好|下午好|晚上好|拜拜|再见|谢谢|thanks|thx|ok|好的|收到|了解)[!.。,、~~]?$/iu;
|
|
164
|
-
var VALID_QUICK_CHAT_SKILLS = /* @__PURE__ */ new Set([
|
|
165
|
-
"table",
|
|
166
|
-
"doc",
|
|
167
|
-
"code",
|
|
168
|
-
"pagebuilder"
|
|
169
|
-
]);
|
|
170
|
-
function isShortGreeting(text) {
|
|
171
|
-
const trimmed = text.trim();
|
|
172
|
-
if (!trimmed) return false;
|
|
173
|
-
if (trimmed.length > SHORT_GREETING_MAX_LENGTH) return false;
|
|
174
|
-
return SHORT_GREETING_PATTERN.test(trimmed);
|
|
175
|
-
}
|
|
176
|
-
var COMPLEXITY_SIMPLE_MAX_LENGTH = 80;
|
|
177
|
-
var COMPLEXITY_MEDIUM_MAX_LENGTH = 500;
|
|
178
|
-
var COMPLEXITY_KEYWORDS = /为什么|如何|分析|对比|比较|设计|架构|实现|原理|推导|评价|区别|关系|影响|优化|重构/;
|
|
179
|
-
var COMPLEXITY_CODE_BLOCK = /```[\s\S]*```/;
|
|
180
|
-
function estimateComplexity(text) {
|
|
181
|
-
const trimmed = text.trim();
|
|
182
|
-
const len = trimmed.length;
|
|
183
|
-
if (len > COMPLEXITY_MEDIUM_MAX_LENGTH) return "complex";
|
|
184
|
-
if (COMPLEXITY_CODE_BLOCK.test(trimmed)) return "complex";
|
|
185
|
-
if (len > COMPLEXITY_SIMPLE_MAX_LENGTH) return "medium";
|
|
186
|
-
if (COMPLEXITY_KEYWORDS.test(trimmed)) return "medium";
|
|
187
|
-
return "simple";
|
|
188
|
-
}
|
|
189
|
-
var TIER_DESCRIPTIONS = {
|
|
190
|
-
flash: "\u5FEB\u901F\u7B80\u5355\uFF1A\u95EE\u5019\u3001\u95F2\u804A\u3001\u5FEB\u901F\u95EE\u7B54\u3001\u7FFB\u8BD1\u3001\u77ED\u6587",
|
|
191
|
-
balanced: "\u5E73\u8861\u63A8\u7406\uFF1A\u5206\u6790\u3001\u4E2D\u7B49\u957F\u5EA6\u5199\u4F5C\u3001\u4EE3\u7801\u3001\u63A8\u7406\uFF08\u5F53\u524D\u8DEF\u7531\u81F3 DeepSeek V4 Flash\uFF09",
|
|
192
|
-
quality: "\u9AD8\u8D28\u91CF\u6DF1\u5EA6\uFF1A\u590D\u6742\u63A8\u7406\u3001\u957F\u6587\u3001\u67B6\u6784\u8BBE\u8BA1\u3001\u6DF1\u5EA6\u5206\u6790\uFF08\u5F53\u524D\u8DEF\u7531\u81F3 DeepSeek V4 Flash\uFF09"
|
|
193
|
-
};
|
|
194
|
-
function buildQuickChatIntentSystemPrompt(tierAgents) {
|
|
195
|
-
const agentList = tierAgents.map((t2) => ` - "${t2.agentKey}"\uFF1A${t2.description}`).join("\n");
|
|
196
|
-
return `\u4F60\u662F\u4E00\u4E2A\u610F\u56FE\u8DEF\u7531\u5668\u3002\u6839\u636E\u7528\u6237\u6D88\u606F\uFF0C\u5224\u65AD\u5E94\u8BE5\u4EA4\u7ED9\u54EA\u4E2A agent \u5904\u7406\u3002
|
|
197
|
-
|
|
198
|
-
\u53EF\u9009 agent \u5217\u8868\uFF08agentKey \u4E0E\u63CF\u8FF0\uFF09\uFF1A
|
|
199
|
-
${agentList}
|
|
200
|
-
|
|
201
|
-
\u5224\u65AD\u539F\u5219\uFF08\u9ED8\u8BA4\u504F\u5411\u901A\u7528\u6863\u4F4D\uFF1B\u4E13\u804C agent \u5728\u660E\u786E\u5339\u914D\u65F6\u4F7F\u7528\uFF1B**\u7F16\u7801/\u672C\u5730\u4ED3\u5E93\u4EFB\u52A1\u8D70\u901A\u7528\u6863 balanced/quality**\uFF09\uFF1A
|
|
202
|
-
- \u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C**\u9664\u975E\u7528\u6237\u660E\u786E\u8868\u8FBE\u8981\u5EFA\u5E94\u7528/\u5EFA Agent/\u63D0\u4EA4\u53CD\u9988/\u591A Agent \u7F16\u6392**\uFF0C\u5426\u5219\u9009\u901A\u7528\u6863\u4F4D\uFF08flash/balanced/quality\uFF09\uFF1A
|
|
203
|
-
- \u7B80\u5355\u95EE\u5019\u3001\u95F2\u804A\u3001\u5FEB\u901F\u95EE\u7B54\u3001\u7FFB\u8BD1\u3001\u77ED\u6587 \u2192 \u9009 flash \u6863
|
|
204
|
-
- \u9700\u8981\u63A8\u7406\u3001\u5206\u6790\u3001\u4E2D\u7B49\u957F\u5EA6\u5199\u4F5C\u3001\u666E\u901A\u4EE3\u7801\u89E3\u91CA/\u67B6\u6784\u95EE\u7B54 \u2192 \u9009 balanced \u6863
|
|
205
|
-
- \u590D\u6742\u63A8\u7406\u3001\u957F\u6587\u3001\u67B6\u6784\u8BBE\u8BA1\u3001\u6DF1\u5EA6\u5206\u6790 \u2192 \u9009 quality \u6863
|
|
206
|
-
- **\u660E\u786E\u7F16\u7801\u4EFB\u52A1\uFF08\u5B9E\u73B0\u529F\u80FD\u3001\u4FEE bug\u3001refactor\u3001\u5199/\u8865\u6D4B\u8BD5\u3001\u8DD1 build/tests/ci\uFF09\u6216\u67E5\u770B\u672C\u673A\u4ED3\u5E93/\u4EE3\u7801\u72B6\u6001\uFF08git/\u5206\u652F/commit/\u672C\u5730\u4E0E\u8FDC\u7A0B\u5DEE\u8DDD/\u672A\u63D0\u4EA4\u6539\u52A8\u7B49\uFF09** \u2192 \u9009 balanced \u6216 quality \u6863\uFF08\u6309\u590D\u6742\u5EA6\uFF1B**\u4E0D\u8981\u9009 flash**\uFF09
|
|
207
|
-
- \u4E13\u804C agent \u8DEF\u7531\u89C4\u5219\uFF08\u6709\u660E\u786E\u5339\u914D\u65F6\u4F7F\u7528\uFF09\uFF1A
|
|
208
|
-
- \u8981\u63D0\u4EA4/\u8BB0\u5F55 bug\u3001\u4F53\u9A8C\u95EE\u9898\u3001\u6570\u636E\u5F02\u5E38\u3001\u4EA7\u54C1\u5EFA\u8BAE\uFF0C\u6216\u53E3\u8BED\u5982\u300C\u60F3\u53CD\u9988\u4E00\u4E9B\u95EE\u9898\u300D\u300C\u53CD\u9988\u4E00\u4E0B\u300D\u2192 \u9009\u610F\u89C1\u53CD\u9988\u4E13\u804C agent
|
|
209
|
-
- \u8981\u65B0\u5EFA\u6216\u5B9A\u5236 AI/Agent/\u667A\u80FD\u4F53\u52A9\u624B\uFF08\u542B\u914D\u7F6E\u5DE5\u5177\u3001\u77E5\u8BC6\u3001\u786E\u8BA4\u521B\u5EFA\uFF09\u2192 \u9009\u521B\u5EFA Agent \u4E13\u804C agent
|
|
210
|
-
- \u8981\u505A/\u6539/\u53D1\u5E03\u7F51\u7AD9\u3001\u7F51\u9875\u3001\u5C0F\u5E94\u7528\u3001\u9884\u7EA6\u9875\u3001\u535A\u5BA2\u3001\u770B\u677F \u2192 \u9009\u5E94\u7528\u6784\u5EFA\u4E13\u804C agent
|
|
211
|
-
- \u8981\u6D3E\u591A\u4E2A agent\u3001\u591A agent \u5E76\u884C\u3001\u62C6\u6210\u4EFB\u52A1\u540E\u53F0\u6267\u884C\u3001\u591A\u4E2A agent review\u3001\u8BA9\u4E0D\u540C agent \u8BA8\u8BBA/\u4F1A\u5546 \u2192 \u9009\u591A Agent \u7F16\u6392\u4E13\u804C agent\uFF08\u663E\u5F0F multi-agent \u4F18\u5148\uFF09
|
|
212
|
-
- **\u62FF\u4E0D\u51C6\u65F6**\uFF1A\u7EAF\u95F2\u804A\u9009 flash\uFF1B**\u82E5\u6CBE\u8FB9\u672C\u5730\u4ED3\u5E93/\u5F53\u524D\u4EE3\u7801\u72B6\u6001\uFF0C\u9009 balanced/quality**\u3002
|
|
213
|
-
|
|
214
|
-
\u5728\u7ED9\u51FA agentKey \u4E4B\u524D\uFF0C\u5148\u5728\u5FC3\u91CC\u533A\u5206\u5019\u9009\u6863\u4F4D\u7684\u8FB9\u754C\u518D\u7ED9\u7F6E\u4FE1\u5EA6\uFF1Abalanced \u4E0E quality \u7684\u8FB9\u754C\u5728\u4E8E\u590D\u6742\u5EA6/\u7BC7\u5E45/\u662F\u5426\u9700\u8981\u6DF1\u5EA6\u5206\u6790\uFF0C\u62FF\u4E0D\u51C6\u5C31\u7ED9\u4F4E confidence\u3002
|
|
215
|
-
|
|
216
|
-
\u540C\u65F6\u5224\u65AD\u672C\u8F6E\u6D88\u606F\u662F\u5426\u9700\u8981\u6302\u8F7D\u5BF9\u8C61\u64CD\u4F5C\u6280\u80FD\uFF08skills \u6570\u7EC4\uFF0C\u672A\u547D\u4E2D\u7ED9 []\uFF09\uFF1A
|
|
217
|
-
- \u7528\u6237\u8981\u65B0\u5EFA/\u6574\u7406/\u5F55\u5165/\u6279\u91CF\u5904\u7406\u8868\u683C\u6570\u636E\uFF08\u5EFA\u8868\u3001\u52A0\u884C\u3001\u6539\u5217\u3001\u6309\u6761\u4EF6\u6574\u7406\u6570\u636E\uFF09\u2192 skills \u542B "table"
|
|
218
|
-
- \u7528\u6237\u8981\u5199/\u6DA6\u8272/\u6539\u5199/\u7EED\u5199/\u6392\u7248\u4E00\u7BC7\u6587\u6863\u6216\u6587\u7AE0 \u2192 skills \u542B "doc"
|
|
219
|
-
- \u7528\u6237\u8981\u5199/\u6539/\u5B9E\u73B0/\u4FEE bug/refactor/\u8865\u6D4B\u8BD5/\u5BA1\u67E5\u5E76\u4FEE\u6539\u4EE3\u7801 \u2192 skills \u542B "code"\uFF08\u4EC5\u95EE\u901A\u7528\u77E5\u8BC6\u3001\u7EAF\u95F2\u804A\u3001\u53EA\u67E5\u770B git/\u4ED3\u5E93\u72B6\u6001\u800C\u4E0D\u4FEE\u6539\u4EE3\u7801\u65F6\u4E0D\u6302 "code"\uFF09
|
|
220
|
-
- \u7528\u6237\u60F3\u8981\u4E00\u4E2A\u53EF\u4EA4\u4E92\u7684\u53EF\u89C6\u5316\u9875\u9762/\u62A5\u544A/\u770B\u677F/\u4E3B\u9875/\u6559\u7A0B/\u5BF9\u6BD4\u9875/\u8BA1\u5212\u9875\uFF08\u5982"\u505A\u4E2A\u65E5\u62A5""\u505A\u4E00\u4E2A\u4E2A\u4EBA\u4E3B\u9875""\u505A\u4E2A\u9500\u552E\u770B\u677F""\u505A\u4E2A\u65B9\u6848\u5BF9\u6BD4\u9875""\u505A\u4E2A\u5B66\u4E60\u8BA1\u5212\u9875"\uFF09\u2192 skills \u542B "pagebuilder"
|
|
221
|
-
- \u666E\u901A\u95EE\u7B54/\u7EAF\u95F2\u804A/\u5EFA\u5E94\u7528 \u2192 skills \u4E3A []
|
|
222
|
-
|
|
223
|
-
\u53EA\u8F93\u51FA JSON\uFF0C\u4E0D\u8981\u8F93\u51FA\u5176\u4ED6\u5185\u5BB9\uFF1A
|
|
224
|
-
{"confidence": <0\u52301\u4E4B\u95F4\u7684\u5C0F\u6570\uFF0C\u8868\u793A\u4F60\u5BF9\u8FD9\u4E2A\u5206\u7C7B\u5224\u65AD\u7684\u628A\u63E1\u7A0B\u5EA6>, "agentKey": "<\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u7684 agentKey>", "skills": <\u5B57\u7B26\u4E32\u6570\u7EC4\uFF0C\u5143\u7D20\u53EA\u80FD\u662F ${[...VALID_QUICK_CHAT_SKILLS].map((s) => `"${s}"`).join(" | ")}\uFF0C\u672A\u547D\u4E2D\u7ED9 []>}`;
|
|
225
|
-
}
|
|
226
|
-
function parseQuickChatIntentResult(content, tierAgents) {
|
|
227
|
-
try {
|
|
228
|
-
const parsed = JSON.parse(content.trim());
|
|
229
|
-
if (typeof parsed !== "object" || parsed === null || !("agentKey" in parsed)) return null;
|
|
230
|
-
const key = parsed.agentKey;
|
|
231
|
-
if (typeof key !== "string") return null;
|
|
232
|
-
if (!tierAgents.some((t2) => t2.agentKey === key)) return null;
|
|
233
|
-
const rawConfidence = parsed.confidence;
|
|
234
|
-
const confidence = typeof rawConfidence === "number" && Number.isFinite(rawConfidence) && rawConfidence >= 0 && rawConfidence <= 1 ? rawConfidence : void 0;
|
|
235
|
-
const rawSkills = parsed.skills;
|
|
236
|
-
let skills;
|
|
237
|
-
if (Array.isArray(rawSkills)) {
|
|
238
|
-
const filtered = [...new Set(rawSkills)].filter(
|
|
239
|
-
(s) => typeof s === "string" && VALID_QUICK_CHAT_SKILLS.has(s)
|
|
240
|
-
);
|
|
241
|
-
if (filtered.length > 0) skills = filtered;
|
|
242
|
-
}
|
|
243
|
-
return { agentKey: key, confidence, skills };
|
|
244
|
-
} catch {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
152
|
// packages/cli/client/autoModelRouter.ts
|
|
250
153
|
var CLI_AUTO_TIER_AGENT_KEYS = {
|
|
251
154
|
flash: PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
@@ -260,9 +163,7 @@ var CLI_AUTO_TIER_MODELS = {
|
|
|
260
163
|
var CLI_IMAGE_AGENT_KEY = PUBLIC_KIMI_K26_IMAGE_AGENT_KEY;
|
|
261
164
|
var CLI_IMAGE_AGENT_MODEL = "kimi-k2.6";
|
|
262
165
|
var CLI_AUTO_TIER_AGENT_KEY_TABLE = {
|
|
263
|
-
[CLI_AUTO_TIER_AGENT_KEYS.flash]: true
|
|
264
|
-
[CLI_AUTO_TIER_AGENT_KEYS.balanced]: true,
|
|
265
|
-
[CLI_AUTO_TIER_AGENT_KEYS.quality]: true
|
|
166
|
+
[CLI_AUTO_TIER_AGENT_KEYS.flash]: true
|
|
266
167
|
};
|
|
267
168
|
function resolveCliAutoAgentModel(agentKey) {
|
|
268
169
|
if (agentKey === CLI_AUTO_TIER_AGENT_KEYS.flash) return CLI_AUTO_TIER_MODELS.flash;
|
|
@@ -275,90 +176,15 @@ function resolveCliAutoAgentModel(agentKey) {
|
|
|
275
176
|
if (agentKey === CLI_IMAGE_AGENT_KEY) return CLI_IMAGE_AGENT_MODEL;
|
|
276
177
|
return void 0;
|
|
277
178
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
description: TIER_DESCRIPTIONS[tier]
|
|
282
|
-
}));
|
|
283
|
-
var tierForAgentKey = (agentKey) => {
|
|
284
|
-
for (const tier of ["flash", "balanced", "quality"]) {
|
|
285
|
-
if (CLI_AUTO_TIER_AGENT_KEYS[tier] === agentKey) return tier;
|
|
286
|
-
}
|
|
287
|
-
return null;
|
|
288
|
-
};
|
|
289
|
-
function resolveCliAutoFallbackTier(text) {
|
|
290
|
-
switch (estimateComplexity(text)) {
|
|
291
|
-
case "complex":
|
|
292
|
-
return "quality";
|
|
293
|
-
case "medium":
|
|
294
|
-
return "balanced";
|
|
295
|
-
case "simple":
|
|
296
|
-
default:
|
|
297
|
-
return "flash";
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
async function classifyCliAutoRoute(text, options) {
|
|
301
|
-
const timeoutMs = options.timeoutMs ?? QUICK_CHAT_INTENT_TIMEOUT_MS;
|
|
302
|
-
const fallbackTier = resolveCliAutoFallbackTier(text);
|
|
303
|
-
const fallback = () => ({
|
|
304
|
-
agentKey: CLI_AUTO_TIER_AGENT_KEYS[fallbackTier],
|
|
305
|
-
tier: fallbackTier,
|
|
306
|
-
classified: false
|
|
307
|
-
});
|
|
308
|
-
if (!text.trim()) return fallback();
|
|
309
|
-
if (isShortGreeting(text)) {
|
|
310
|
-
return {
|
|
311
|
-
agentKey: CLI_AUTO_TIER_AGENT_KEYS.flash,
|
|
312
|
-
tier: "flash",
|
|
313
|
-
classified: true
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
if (!options.authToken) return fallback();
|
|
317
|
-
const fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
318
|
-
const controller = new AbortController();
|
|
319
|
-
const timeoutHandle = setTimeout(() => controller.abort(), timeoutMs);
|
|
320
|
-
try {
|
|
321
|
-
const routeOptions = buildRouteOptions();
|
|
322
|
-
const messages = [
|
|
323
|
-
{ role: "system", content: buildQuickChatIntentSystemPrompt(routeOptions) },
|
|
324
|
-
{ role: "user", content: text }
|
|
325
|
-
];
|
|
326
|
-
const { url, init } = buildPlatformChatCompletionRequest({
|
|
327
|
-
providerConfig: {
|
|
328
|
-
serverUrl: options.serverUrl,
|
|
329
|
-
authToken: options.authToken,
|
|
330
|
-
agentKey: CLI_AUTO_TIER_AGENT_KEYS.flash,
|
|
331
|
-
model: INTENT_MODEL,
|
|
332
|
-
provider: INTENT_PROVIDER,
|
|
333
|
-
endpoint: resolvePlatformChatCompletionsEndpoint(INTENT_PROVIDER) ?? "",
|
|
334
|
-
requestOptions: {}
|
|
335
|
-
},
|
|
336
|
-
messages,
|
|
337
|
-
stream: false
|
|
338
|
-
});
|
|
339
|
-
const response = await fetchImpl(url, {
|
|
340
|
-
...init,
|
|
341
|
-
signal: controller.signal
|
|
342
|
-
});
|
|
343
|
-
if (!response.ok) return fallback();
|
|
344
|
-
const data = parsePlatformChatCompletionData(await response.text());
|
|
345
|
-
const content = data?.choices?.[0]?.message?.content;
|
|
346
|
-
if (typeof content !== "string" || !content.trim()) return fallback();
|
|
347
|
-
const parsed = parseQuickChatIntentResult(content, routeOptions);
|
|
348
|
-
if (!parsed) return fallback();
|
|
349
|
-
const tier = tierForAgentKey(parsed.agentKey) ?? fallbackTier;
|
|
350
|
-
return {
|
|
351
|
-
agentKey: parsed.agentKey,
|
|
352
|
-
tier,
|
|
353
|
-
classified: true,
|
|
354
|
-
confidence: parsed.confidence,
|
|
355
|
-
skills: parsed.skills
|
|
356
|
-
};
|
|
357
|
-
} catch {
|
|
358
|
-
return fallback();
|
|
359
|
-
} finally {
|
|
360
|
-
clearTimeout(timeoutHandle);
|
|
179
|
+
function classifyCliAutoRoute(_text, options) {
|
|
180
|
+
if (options.hasImages) {
|
|
181
|
+
return { agentKey: CLI_IMAGE_AGENT_KEY, tier: "image", classified: true };
|
|
361
182
|
}
|
|
183
|
+
return {
|
|
184
|
+
agentKey: CLI_AUTO_TIER_AGENT_KEYS.flash,
|
|
185
|
+
tier: "flash",
|
|
186
|
+
classified: true
|
|
187
|
+
};
|
|
362
188
|
}
|
|
363
189
|
|
|
364
190
|
// packages/cli/client/tokenUsage.ts
|
|
@@ -706,7 +532,7 @@ function wrapTranscriptLine(line, columns, hangingIndent = "") {
|
|
|
706
532
|
}
|
|
707
533
|
const openingStyles = [...activeStyles];
|
|
708
534
|
const isContinuation = result.length > 0 && hangingIndent.length > 0;
|
|
709
|
-
const indentWidth = isContinuation ?
|
|
535
|
+
const indentWidth = isContinuation ? visibleWidth(hangingIndent) : 0;
|
|
710
536
|
const maxSegmentWidth = Math.max(1, columns - indentWidth);
|
|
711
537
|
let width = 0;
|
|
712
538
|
let end = start;
|
|
@@ -808,13 +634,17 @@ var THEME_PALETTES = {
|
|
|
808
634
|
// denser slate — 687584 read too blue in dense prose (inline code/tool labels); 5E6A78 pulls blue down while staying darker than the old value
|
|
809
635
|
},
|
|
810
636
|
dark: {
|
|
811
|
-
accent: { hex: "
|
|
812
|
-
//
|
|
637
|
+
accent: { hex: "5BA3D9", ansiFallback: "\x1B[34m" },
|
|
638
|
+
// trail dark primary (was wrongly copied from catppuccin 89B4FA)
|
|
813
639
|
chrome: { hex: "6C7086", ansiFallback: "\x1B[90m" },
|
|
814
|
-
success: { hex: "
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
640
|
+
success: { hex: "5CB87A", ansiFallback: "\x1B[32m" },
|
|
641
|
+
// trail dark success (was A6E3A1)
|
|
642
|
+
warning: { hex: "E6B35C", ansiFallback: "\x1B[33m" },
|
|
643
|
+
// trail dark warning (was F9E2AF)
|
|
644
|
+
info: { hex: "6BB8E8", ansiFallback: "\x1B[36m" },
|
|
645
|
+
// trail dark info (was 94E2D5)
|
|
646
|
+
danger: { hex: "E07060", ansiFallback: "\x1B[31m" },
|
|
647
|
+
// trail dark error (was F38BA8)
|
|
818
648
|
muted: { hex: "9AA3B8", ansiFallback: "\x1B[90m" }
|
|
819
649
|
// dimmed from A6ADC8 so secondary text sits a step below body text
|
|
820
650
|
}
|
|
@@ -1096,6 +926,13 @@ function diffLineSequences(env = process.env, brightness = resolveTuiBrightness(
|
|
|
1096
926
|
context: { fg: "", bg: "", bar: " " }
|
|
1097
927
|
};
|
|
1098
928
|
}
|
|
929
|
+
function renderSurfaceLine(args) {
|
|
930
|
+
const { text, surface, padTo } = args;
|
|
931
|
+
if (!surface) return text;
|
|
932
|
+
const reopened = text.split("\x1B[0m").join(`\x1B[0m${surface}`);
|
|
933
|
+
const padding = " ".repeat(Math.max(0, padTo - visibleWidth(text)));
|
|
934
|
+
return `${surface}${reopened}${padding}\x1B[0m`;
|
|
935
|
+
}
|
|
1099
936
|
function renderDiffLine(args) {
|
|
1100
937
|
const { kind, text } = args;
|
|
1101
938
|
const env = args.env ?? process.env;
|
|
@@ -1108,13 +945,23 @@ function renderDiffLine(args) {
|
|
|
1108
945
|
return `${themeColorSequence(token, env)}${text}\x1B[39m`;
|
|
1109
946
|
}
|
|
1110
947
|
const seq = seqs[kind];
|
|
1111
|
-
|
|
1112
|
-
|
|
948
|
+
return renderSurfaceLine({
|
|
949
|
+
text: `${seq.fg}${text}`,
|
|
950
|
+
surface: seq.bg,
|
|
951
|
+
padTo: args.padTo ?? visibleWidth(text)
|
|
952
|
+
});
|
|
1113
953
|
}
|
|
1114
954
|
function surfaceBackgroundSequence(env = process.env, brightness = resolveTuiBrightness(env)) {
|
|
1115
955
|
if (!supportsTruecolor(env)) return "";
|
|
1116
956
|
return hexToBgSgr((SURFACE_HEX[activeThemeName] ?? SURFACE_HEX.trail)[brightness]);
|
|
1117
957
|
}
|
|
958
|
+
function userSurfaceBackgroundSequence(env = process.env, brightness = resolveTuiBrightness(env)) {
|
|
959
|
+
if (!supportsTruecolor(env)) return "";
|
|
960
|
+
const palette = THEME_PALETTES[activeThemeName] ?? THEME_PALETTES.trail;
|
|
961
|
+
const accentHex = palette[brightness].accent.hex;
|
|
962
|
+
const weight = brightness === "dark" ? 0.24 : 0.16;
|
|
963
|
+
return hexToBgSgr(blendHex(accentHex, resolveTerminalBaseHex(brightness), weight));
|
|
964
|
+
}
|
|
1118
965
|
function themeColorSequence(token, env = process.env, brightness = resolveTuiBrightness(env)) {
|
|
1119
966
|
const palette = THEME_PALETTES[activeThemeName] ?? THEME_PALETTES.trail;
|
|
1120
967
|
const entry = palette[brightness][token];
|
|
@@ -2426,7 +2273,7 @@ function isReadToolName(name) {
|
|
|
2426
2273
|
}
|
|
2427
2274
|
function isSearchToolName(name) {
|
|
2428
2275
|
if (!name) return false;
|
|
2429
|
-
return name === "grep" || name === "searchFiles" || name === "search_files" || name === "globFiles" || name === "glob_files" || name === "glob" || name === "searchWorkspace" || name === "search";
|
|
2276
|
+
return name === "grep" || name === "searchFiles" || name === "search_files" || name === "globFiles" || name === "glob_files" || name === "glob" || name === "searchWorkspace" || name === "search_workspace" || name === "search_all_spaces" || name === "search";
|
|
2430
2277
|
}
|
|
2431
2278
|
function isRunToolName(name) {
|
|
2432
2279
|
if (!name) return false;
|
|
@@ -2573,8 +2420,43 @@ function resolveLoadSkillName(event) {
|
|
|
2573
2420
|
if (match?.[1]) return match[1];
|
|
2574
2421
|
return argName || "skill";
|
|
2575
2422
|
}
|
|
2423
|
+
function formatTodoListForCli(event, colorEnabled) {
|
|
2424
|
+
if (event.type !== "tool-result" || event.toolName !== "setTodoList") {
|
|
2425
|
+
return void 0;
|
|
2426
|
+
}
|
|
2427
|
+
let raw = event.metadata?.displayData;
|
|
2428
|
+
let parsed = typeof raw === "object" && raw !== null;
|
|
2429
|
+
if (typeof raw === "string") {
|
|
2430
|
+
try {
|
|
2431
|
+
raw = JSON.parse(raw);
|
|
2432
|
+
parsed = true;
|
|
2433
|
+
} catch {
|
|
2434
|
+
raw = void 0;
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
if (!parsed && typeof event.content === "string") {
|
|
2438
|
+
try {
|
|
2439
|
+
raw = JSON.parse(event.content);
|
|
2440
|
+
parsed = true;
|
|
2441
|
+
} catch {
|
|
2442
|
+
raw = void 0;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
const todos = Array.isArray(raw?.todos) ? raw.todos : void 0;
|
|
2446
|
+
if (!todos) return void 0;
|
|
2447
|
+
if (todos.length === 0) return "\u2611 Todo\n (empty)\n";
|
|
2448
|
+
const lines = todos.map((todo) => {
|
|
2449
|
+
const status = todo?.status === "done" ? "\u2713" : todo?.status === "in_progress" ? "\u25D0" : "\u25CB";
|
|
2450
|
+
const title = typeof todo?.title === "string" ? todo.title : "Untitled task";
|
|
2451
|
+
return ` ${status} ${title}`;
|
|
2452
|
+
});
|
|
2453
|
+
const text = [`\u2611 Todo (${todos.length})`, ...lines].join("\n") + "\n";
|
|
2454
|
+
return colorEnabled ? themeText(text, "chrome") : text;
|
|
2455
|
+
}
|
|
2576
2456
|
function formatCompactToolLine(event, pending, colorEnabled) {
|
|
2577
2457
|
const toolName = event.toolName || pending?.toolName || "tool";
|
|
2458
|
+
const todoBlock = formatTodoListForCli(event, colorEnabled);
|
|
2459
|
+
if (todoBlock) return todoBlock;
|
|
2578
2460
|
if (isReadToolName(toolName) && event.type === "tool-result") {
|
|
2579
2461
|
const rawPath = (typeof event.metadata?.path === "string" ? event.metadata.path : void 0) || (typeof event.metadata?.filePath === "string" ? event.metadata.filePath : void 0) || event.argumentsPreview || pending?.argumentsPreview || "";
|
|
2580
2462
|
return formatReadTreeBlockForCli([{ path: rawPath, metadata: event.metadata }], colorEnabled);
|
|
@@ -2656,7 +2538,8 @@ function formatEditDetailBlock(lines, colorEnabled) {
|
|
|
2656
2538
|
return lines.map((line) => ` ${renderDiffLine({ kind: line.kind, text: line.text, padTo, colorEnabled: true })}
|
|
2657
2539
|
`).join("");
|
|
2658
2540
|
}
|
|
2659
|
-
function createToolEventFormatter(mode, colorEnabled = resolveCliColorEnabled()) {
|
|
2541
|
+
function createToolEventFormatter(mode, colorEnabled = resolveCliColorEnabled(), opts = {}) {
|
|
2542
|
+
const suppressRunProgressCards = opts.suppressRunProgressCards === true;
|
|
2660
2543
|
const pending = /* @__PURE__ */ new Map();
|
|
2661
2544
|
let readBuffer = [];
|
|
2662
2545
|
let searchBuffer = [];
|
|
@@ -2680,9 +2563,16 @@ function createToolEventFormatter(mode, colorEnabled = resolveCliColorEnabled())
|
|
|
2680
2563
|
statusFold = null;
|
|
2681
2564
|
const substance = cardSubstance(fold);
|
|
2682
2565
|
if (lastPrintedCardByRunId.get(fold.runId) === substance) return "";
|
|
2683
|
-
lastPrintedCardByRunId.set(fold.runId, substance);
|
|
2684
2566
|
const prevLog = lastEmittedLogByRunId.get(fold.runId);
|
|
2685
2567
|
const changed = Boolean(fold.logKey) && fold.logKey !== prevLog;
|
|
2568
|
+
if (suppressRunProgressCards) {
|
|
2569
|
+
const terminal = isAgentRunTerminalStatus(fold.status);
|
|
2570
|
+
if (!terminal && !fold.errorMessage && !changed) {
|
|
2571
|
+
lastPrintedCardByRunId.set(fold.runId, substance);
|
|
2572
|
+
return "";
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
lastPrintedCardByRunId.set(fold.runId, substance);
|
|
2686
2576
|
if (changed && runShowsLogTail(fold.status)) {
|
|
2687
2577
|
lastEmittedLogByRunId.set(fold.runId, fold.logKey);
|
|
2688
2578
|
}
|
|
@@ -3060,7 +2950,9 @@ function createCliTurnOutput(params) {
|
|
|
3060
2950
|
const spinner = params.spinner ?? new Spinner(options.output, workingLabel, Boolean(options.activityReporter));
|
|
3061
2951
|
const toolDisplayMode = resolveToolDisplayMode(options.env);
|
|
3062
2952
|
const traceLocalTools = shouldEmitToolEvents(toolDisplayMode);
|
|
3063
|
-
const formatToolEvent = createToolEventFormatter(toolDisplayMode
|
|
2953
|
+
const formatToolEvent = createToolEventFormatter(toolDisplayMode, void 0, {
|
|
2954
|
+
suppressRunProgressCards: typeof options.onAgentRunStatus === "function"
|
|
2955
|
+
});
|
|
3064
2956
|
const eventMode = resolveAgentEventMode(options);
|
|
3065
2957
|
let streamedAssistantText = false;
|
|
3066
2958
|
let everStreamedAnyText = false;
|
|
@@ -3557,7 +3449,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
3557
3449
|
// packages/cli/client/agentRun.ts
|
|
3558
3450
|
import { ulid } from "ulid";
|
|
3559
3451
|
async function loadRunLocalAgentTurn() {
|
|
3560
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3452
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-QOYY5UV2.js");
|
|
3561
3453
|
return runLocalAgentTurn;
|
|
3562
3454
|
}
|
|
3563
3455
|
async function resolveCurrentMachineId(options) {
|
|
@@ -3996,55 +3888,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
3996
3888
|
...options.parentDialogId ? { parentThreadId: options.parentDialogId } : {}
|
|
3997
3889
|
} : void 0;
|
|
3998
3890
|
const currentDialogId = options.continueDialogId ?? ulid();
|
|
3999
|
-
const
|
|
4000
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-7WYWCGL4.js");
|
|
4001
|
-
return runLocalAgentTurn(input);
|
|
4002
|
-
};
|
|
4003
|
-
const createFreshChildBaseAdapter = () => {
|
|
4004
|
-
const fresh = options.localRuntimeAdapterFactory?.(options.env, {
|
|
4005
|
-
cwd: options.localRuntimeCwd
|
|
4006
|
-
}) ?? buildDefaultLocalRuntimeAdapter(options);
|
|
4007
|
-
return applyEphemeralIfRequested(options, fresh);
|
|
4008
|
-
};
|
|
4009
|
-
const withLocalDelegation = (args) => {
|
|
4010
|
-
let adapter2;
|
|
4011
|
-
const callAgentExecutor = createCliCallAgentToolExecutor(
|
|
4012
|
-
{
|
|
4013
|
-
env: options.env,
|
|
4014
|
-
fetchImpl: options.fetchImpl,
|
|
4015
|
-
cwd: options.localRuntimeCwd,
|
|
4016
|
-
output: options.output
|
|
4017
|
-
},
|
|
4018
|
-
{
|
|
4019
|
-
createChildAdapter: (child) => withLocalDelegation({
|
|
4020
|
-
base: createFreshChildBaseAdapter(),
|
|
4021
|
-
dialogId: child.dialogId,
|
|
4022
|
-
spaceId: child.spaceId,
|
|
4023
|
-
runtimeContext: child.runtimeContext
|
|
4024
|
-
}),
|
|
4025
|
-
runChildTurn,
|
|
4026
|
-
dialogId: args.dialogId,
|
|
4027
|
-
spaceId: args.spaceId,
|
|
4028
|
-
runtimeContext: args.runtimeContext
|
|
4029
|
-
}
|
|
4030
|
-
);
|
|
4031
|
-
adapter2 = {
|
|
4032
|
-
...args.base,
|
|
4033
|
-
executeTool: async (call) => {
|
|
4034
|
-
if (call.name === "callAgent") {
|
|
4035
|
-
return callAgentExecutor(call);
|
|
4036
|
-
}
|
|
4037
|
-
return args.base.executeTool(call);
|
|
4038
|
-
}
|
|
4039
|
-
};
|
|
4040
|
-
return adapter2;
|
|
4041
|
-
};
|
|
4042
|
-
const adapter = withLocalDelegation({
|
|
4043
|
-
base: baseAdapter,
|
|
4044
|
-
dialogId: currentDialogId,
|
|
4045
|
-
spaceId: options.spaceId,
|
|
4046
|
-
runtimeContext
|
|
4047
|
-
});
|
|
3891
|
+
const adapter = baseAdapter;
|
|
4048
3892
|
const expandedMessage = options.pastedTextStore?.items.size ? expandCollapsedPastes(options.message, options.pastedTextStore) : options.message;
|
|
4049
3893
|
const workingLabel = `${options.agentName} -> working locally`;
|
|
4050
3894
|
const turnOutput = createCliTurnOutput({
|
|
@@ -4795,6 +4639,40 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
4795
4639
|
};
|
|
4796
4640
|
};
|
|
4797
4641
|
|
|
4642
|
+
// packages/ai/tools/agent/quotaCircuitBreaker.ts
|
|
4643
|
+
var QUOTA_ERROR_PATTERNS = [
|
|
4644
|
+
/429/,
|
|
4645
|
+
/quota/i,
|
|
4646
|
+
/rate\s*limit/i,
|
|
4647
|
+
/too\s*many\s*requests/i,
|
|
4648
|
+
/额度/,
|
|
4649
|
+
/上限/,
|
|
4650
|
+
/用尽/,
|
|
4651
|
+
/CliProviderQuotaError/i
|
|
4652
|
+
];
|
|
4653
|
+
function isCliProviderQuotaErrorShape(error) {
|
|
4654
|
+
if (!error || typeof error !== "object") return false;
|
|
4655
|
+
const e = error;
|
|
4656
|
+
return e.name === "CliProviderQuotaError" || typeof e.message === "string" && e.message.startsWith("[QUOTA_LIMITED:");
|
|
4657
|
+
}
|
|
4658
|
+
function isQuotaExhaustedError(error) {
|
|
4659
|
+
if (!error) return false;
|
|
4660
|
+
if (isCliProviderQuotaErrorShape(error)) return true;
|
|
4661
|
+
if (error instanceof Error) {
|
|
4662
|
+
return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error.message));
|
|
4663
|
+
}
|
|
4664
|
+
if (typeof error === "string") {
|
|
4665
|
+
return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error));
|
|
4666
|
+
}
|
|
4667
|
+
const maybeStatus = error.status;
|
|
4668
|
+
if (typeof maybeStatus === "number" && maybeStatus === 429) return true;
|
|
4669
|
+
const maybeStatusCode = error.statusCode;
|
|
4670
|
+
if (typeof maybeStatusCode === "number" && maybeStatusCode === 429) return true;
|
|
4671
|
+
return false;
|
|
4672
|
+
}
|
|
4673
|
+
var DEFAULT_QUOTA_BREAKER_MS = 6 * 3600 * 1e3;
|
|
4674
|
+
var DEFAULT_AGENT_NOT_FOUND_BREAKER_MS = 15 * 60 * 1e3;
|
|
4675
|
+
|
|
4798
4676
|
// packages/cli/agentRunCommand.ts
|
|
4799
4677
|
function resolvePositiveMs(value, fallback) {
|
|
4800
4678
|
return parsePositiveFiniteNumberOrFallback(value, fallback);
|
|
@@ -4918,7 +4796,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
4918
4796
|
if (wantsFallbackSuggestions) {
|
|
4919
4797
|
effectiveMessage = `${parsed.message}
|
|
4920
4798
|
|
|
4921
|
-
[Quota fallback context for agent decision: If this execution for ${parsed.agentKey} hits subscription quota, YOU (the agent) must decide the next agent to use. Do not rely on automatic wrapper. Reason based on the specific task (complexity, length, domain), agent strengths, cost, previous attempt results. Suggested alternatives: ${parsed.fallbackAgentKeys.join(", ")}. Update the task row with attempt history and dispatch the chosen next (via
|
|
4799
|
+
[Quota fallback context for agent decision: If this execution for ${parsed.agentKey} hits subscription quota, YOU (the agent) must decide the next agent to use. Do not rely on automatic wrapper. Reason based on the specific task (complexity, length, domain), agent strengths, cost, previous attempt results. Suggested alternatives: ${parsed.fallbackAgentKeys.join(", ")}. Update the task row with attempt history and dispatch the chosen next (via startAgentRun \u5F02\u6B65\u6D3E\u53D1)).]`;
|
|
4922
4800
|
}
|
|
4923
4801
|
const resolvedAgentKey = parsed.runtimeMode !== "local" ? await (deps.resolveAgentRunAgentKey ?? resolveAgentRunAgentKey)({
|
|
4924
4802
|
agentInput: resolveRawAgentInput(args, deps.commandPath) ?? parsed.agentKey,
|
|
@@ -4936,7 +4814,9 @@ async function runAgentRunCommand(args, deps) {
|
|
|
4936
4814
|
const hasExplicitAgent = Boolean(readFlagValue(args, "--agent"));
|
|
4937
4815
|
const route = await classifyCliAutoRoute(effectiveMessage, {
|
|
4938
4816
|
serverUrl,
|
|
4939
|
-
authToken
|
|
4817
|
+
authToken,
|
|
4818
|
+
// 有图 → kimi vision 档;无图 → flash 档。漏传会永远走 flash。
|
|
4819
|
+
hasImages: parsed.imageUrls.length > 0
|
|
4940
4820
|
});
|
|
4941
4821
|
if (hasExplicitAgent) {
|
|
4942
4822
|
modelOverride = buildModelLayerOverride(
|
|
@@ -5054,92 +4934,99 @@ async function runAgentRunCommand(args, deps) {
|
|
|
5054
4934
|
return 0;
|
|
5055
4935
|
}
|
|
5056
4936
|
const cliCwd = parsed.cwd ?? process.cwd();
|
|
4937
|
+
const isSubtask = isSubtaskRun(env);
|
|
5057
4938
|
const extraContextBlocks = [];
|
|
5058
|
-
const
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
4939
|
+
const contextBlockScopes = [];
|
|
4940
|
+
let memoryPromptBlock = null;
|
|
4941
|
+
let memoryOverlayLayer = null;
|
|
4942
|
+
let memoryUseGuidanceLayer = null;
|
|
4943
|
+
if (!isSubtask) {
|
|
4944
|
+
const AGENTS_MD_MAX = 8192;
|
|
4945
|
+
for (const name of ["AGENTS.md", "CLAUDE.md"]) {
|
|
4946
|
+
const agentsMdPath = join2(cliCwd, name);
|
|
4947
|
+
if (existsSync2(agentsMdPath)) {
|
|
4948
|
+
try {
|
|
4949
|
+
let mdContent = readFileSync2(agentsMdPath, "utf8").trim();
|
|
4950
|
+
if (!mdContent) continue;
|
|
4951
|
+
if (Buffer.byteLength(mdContent, "utf8") > AGENTS_MD_MAX) {
|
|
4952
|
+
mdContent = Buffer.from(mdContent, "utf8").subarray(0, AGENTS_MD_MAX).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
|
|
4953
|
+
}
|
|
4954
|
+
extraContextBlocks.push(`--- \u9879\u76EE\u6307\u4EE4\uFF08${name}\uFF09---
|
|
5069
4955
|
${mdContent}`);
|
|
5070
|
-
|
|
5071
|
-
|
|
4956
|
+
break;
|
|
4957
|
+
} catch {
|
|
4958
|
+
}
|
|
5072
4959
|
}
|
|
5073
4960
|
}
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
4961
|
+
extraContextBlocks.push(...buildSkillContextBlocks(skillReferences));
|
|
4962
|
+
const skillDiscoveryBlock = buildSkillDiscoveryContextBlock(cliCwd);
|
|
4963
|
+
if (skillDiscoveryBlock) {
|
|
4964
|
+
extraContextBlocks.push(skillDiscoveryBlock);
|
|
4965
|
+
}
|
|
4966
|
+
if (!deps.memoryRecallDisabled) {
|
|
4967
|
+
const memoryServerUrl = resolveServerUrl(env);
|
|
4968
|
+
const memoryAuthToken = resolveAuthToken(args, env);
|
|
4969
|
+
const memoryAgentKey = effectiveAgentKey;
|
|
4970
|
+
const memorySpaceId = parsed.spaceId ?? void 0;
|
|
4971
|
+
try {
|
|
4972
|
+
const resolvedRuntimeMode = parsed.runtimeMode ?? (env.NOLO_RUNTIME_MODE === "local" || env.NOLO_RUNTIME_MODE === "server" || env.NOLO_RUNTIME_MODE === "auto" ? env.NOLO_RUNTIME_MODE : "auto");
|
|
4973
|
+
const usesExplicitServerRuntime = resolvedRuntimeMode === "server";
|
|
4974
|
+
if (usesExplicitServerRuntime && memoryAuthToken && memoryServerUrl) {
|
|
4975
|
+
const memoryResponse = await fetch(`${memoryServerUrl}/api/memory/query`, {
|
|
4976
|
+
method: "POST",
|
|
4977
|
+
headers: {
|
|
4978
|
+
"Content-Type": "application/json",
|
|
4979
|
+
Authorization: `Bearer ${memoryAuthToken}`
|
|
4980
|
+
},
|
|
4981
|
+
body: JSON.stringify({
|
|
4982
|
+
agentKey: memoryAgentKey,
|
|
4983
|
+
userInput: effectiveMessage,
|
|
4984
|
+
...memorySpaceId ? { spaceId: memorySpaceId } : {}
|
|
4985
|
+
}),
|
|
4986
|
+
signal: AbortSignal.timeout(5e3)
|
|
4987
|
+
});
|
|
4988
|
+
if (memoryResponse.ok) {
|
|
4989
|
+
const memoryPayload = await memoryResponse.json().catch(() => null);
|
|
4990
|
+
const block = typeof memoryPayload?.promptBlock === "string" ? memoryPayload.promptBlock.trim() : "";
|
|
4991
|
+
memoryPromptBlock = block || null;
|
|
4992
|
+
} else {
|
|
4993
|
+
console.warn("[cli-memory] memory query returned non-ok status:", memoryResponse.status);
|
|
4994
|
+
}
|
|
4995
|
+
} else {
|
|
4996
|
+
const localDb = await getDefaultCliLocalRuntimeDb({ env });
|
|
4997
|
+
const machineId = resolveMachineId();
|
|
4998
|
+
const resolution = await resolveMemoryRuntime({
|
|
4999
|
+
db: localDb,
|
|
5000
|
+
userId: machineId,
|
|
5095
5001
|
agentKey: memoryAgentKey,
|
|
5096
5002
|
userInput: effectiveMessage,
|
|
5097
5003
|
...memorySpaceId ? { spaceId: memorySpaceId } : {}
|
|
5098
|
-
})
|
|
5099
|
-
|
|
5100
|
-
});
|
|
5101
|
-
if (memoryResponse.ok) {
|
|
5102
|
-
const memoryPayload = await memoryResponse.json().catch(() => null);
|
|
5103
|
-
const block = typeof memoryPayload?.promptBlock === "string" ? memoryPayload.promptBlock.trim() : "";
|
|
5104
|
-
memoryPromptBlock = block || null;
|
|
5105
|
-
} else {
|
|
5106
|
-
console.warn("[cli-memory] memory query returned non-ok status:", memoryResponse.status);
|
|
5004
|
+
});
|
|
5005
|
+
memoryPromptBlock = resolution.promptBlock;
|
|
5107
5006
|
}
|
|
5108
|
-
}
|
|
5109
|
-
|
|
5110
|
-
const machineId = resolveMachineId();
|
|
5111
|
-
const resolution = await resolveMemoryRuntime({
|
|
5112
|
-
db: localDb,
|
|
5113
|
-
userId: machineId,
|
|
5114
|
-
agentKey: memoryAgentKey,
|
|
5115
|
-
userInput: effectiveMessage,
|
|
5116
|
-
...memorySpaceId ? { spaceId: memorySpaceId } : {}
|
|
5117
|
-
});
|
|
5118
|
-
memoryPromptBlock = resolution.promptBlock;
|
|
5007
|
+
} catch (memoryError) {
|
|
5008
|
+
console.warn("[cli-memory] memory recall failed, omitting memory layer:", memoryError);
|
|
5119
5009
|
}
|
|
5120
|
-
} catch (memoryError) {
|
|
5121
|
-
console.warn("[cli-memory] memory recall failed, omitting memory layer:", memoryError);
|
|
5122
5010
|
}
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
contextBlockScopes.push({ content: block, cacheScope: "session" });
|
|
5011
|
+
memoryOverlayLayer = buildMemoryOverlayLayer({ promptBlock: memoryPromptBlock });
|
|
5012
|
+
memoryUseGuidanceLayer = buildMemoryUseGuidanceLayer({ promptBlock: memoryPromptBlock });
|
|
5013
|
+
const agentsMdMarker = "--- \u9879\u76EE\u6307\u4EE4\uFF08";
|
|
5014
|
+
for (const block of extraContextBlocks) {
|
|
5015
|
+
if (block.startsWith(agentsMdMarker)) {
|
|
5016
|
+
contextBlockScopes.push({ content: block, cacheScope: "session" });
|
|
5017
|
+
}
|
|
5131
5018
|
}
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5019
|
+
if (memoryUseGuidanceLayer?.content?.trim()) {
|
|
5020
|
+
contextBlockScopes.push({ content: memoryUseGuidanceLayer.content, cacheScope: "session" });
|
|
5021
|
+
}
|
|
5022
|
+
for (const block of extraContextBlocks) {
|
|
5023
|
+
if (!block.startsWith(agentsMdMarker)) {
|
|
5024
|
+
contextBlockScopes.push({ content: block, cacheScope: "turn" });
|
|
5025
|
+
}
|
|
5026
|
+
}
|
|
5027
|
+
if (memoryOverlayLayer?.content?.trim()) {
|
|
5028
|
+
contextBlockScopes.push({ content: memoryOverlayLayer.content, cacheScope: "turn" });
|
|
5139
5029
|
}
|
|
5140
|
-
}
|
|
5141
|
-
if (memoryOverlayLayer?.content?.trim()) {
|
|
5142
|
-
contextBlockScopes.push({ content: memoryOverlayLayer.content, cacheScope: "turn" });
|
|
5143
5030
|
}
|
|
5144
5031
|
const buildRunOptions = (targetAgentKey) => ({
|
|
5145
5032
|
agentName: targetAgentKey,
|
|
@@ -5287,10 +5174,8 @@ function isBalanceExhaustedError(error) {
|
|
|
5287
5174
|
}
|
|
5288
5175
|
|
|
5289
5176
|
export {
|
|
5290
|
-
CLI_AUTO_TIER_AGENT_KEYS,
|
|
5291
5177
|
CLI_IMAGE_AGENT_KEY,
|
|
5292
5178
|
CLI_AUTO_TIER_AGENT_KEY_TABLE,
|
|
5293
|
-
resolveCliAutoFallbackTier,
|
|
5294
5179
|
classifyCliAutoRoute,
|
|
5295
5180
|
resolveAgentContextWindow,
|
|
5296
5181
|
formatTokenCount,
|
|
@@ -5321,7 +5206,9 @@ export {
|
|
|
5321
5206
|
resolveTuiBrightness,
|
|
5322
5207
|
setActiveTerminalBaseHex,
|
|
5323
5208
|
applyDetectedBackground,
|
|
5209
|
+
renderSurfaceLine,
|
|
5324
5210
|
surfaceBackgroundSequence,
|
|
5211
|
+
userSurfaceBackgroundSequence,
|
|
5325
5212
|
themeColorSequence,
|
|
5326
5213
|
themeText,
|
|
5327
5214
|
formatAssistantDisplay,
|
|
@@ -5343,6 +5230,8 @@ export {
|
|
|
5343
5230
|
prependSubjectDialogMarker,
|
|
5344
5231
|
normalizeCliImageInput,
|
|
5345
5232
|
inspectLocalRunWorkspace,
|
|
5233
|
+
QUOTA_ERROR_PATTERNS,
|
|
5234
|
+
isQuotaExhaustedError,
|
|
5346
5235
|
runAgentRunCommand,
|
|
5347
5236
|
isBalanceExhaustedError
|
|
5348
5237
|
};
|