nolo-cli 0.206.1 → 0.207.0
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-U2XB3H4R.js → _executeModel-J7C6BIAS.js} +20 -20
- package/{agentDeleteCommand-NVXNQ2VQ.js → agentDeleteCommand-KMRFMAZZ.js} +36 -36
- package/{agentEmailCommands-VUJOYASY.js → agentEmailCommands-6QO4IX72.js} +35 -35
- package/{agentListCommands-KDRCBFUE.js → agentListCommands-CPI4EWX4.js} +27 -47
- package/{agentMachineCommands-TGZIF2SL.js → agentMachineCommands-HSSTZYNV.js} +16 -16
- package/{agentProviderCommands-SKW4L6NN.js → agentProviderCommands-EMKA6NAN.js} +2 -2
- package/{agentPullCommand-LGASFNH7.js → agentPullCommand-2JMJP5BS.js} +1 -1
- package/{agentRecordCommands-DM5UHNZM.js → agentRecordCommands-ZL5I4ODT.js} +32 -32
- package/{agentRunCommand-T6JGFAFZ.js → agentRunCommand-ROWADWSO.js} +33 -33
- package/{agentRunControl-GOH5VSQU.js → agentRunControl-45EM36PW.js} +3 -3
- package/{agentRuntimeLocal-N5S7NSJB.js → agentRuntimeLocal-MYHHTO4B.js} +12 -12
- package/{agentSlice-6XXGHTPP.js → agentSlice-OGOKIDXG.js} +1 -1
- package/{appDeleteCommands-VJNS4HSF.js → appDeleteCommands-DKINMBOK.js} +18 -18
- package/{appDeployCommands-HLZIEHUP.js → appDeployCommands-C3JX4GRQ.js} +18 -18
- package/{appDeployStatusCommands-PT64TF2T.js → appDeployStatusCommands-LVRMBYUP.js} +18 -18
- package/{appGetCommands-FM2ICAF7.js → appGetCommands-CSD32O6F.js} +18 -18
- package/{appListCommands-QVC3TKQD.js → appListCommands-YFEJLREL.js} +18 -18
- package/authCommand-22FYBEGY.js +69 -0
- package/{authCommands-MZUXPRYJ.js → authCommands-WK6E42L2.js} +2 -2
- package/{chromeOpsCommands-ECVS6CAO.js → chromeOpsCommands-HEN5AX2J.js} +1 -1
- package/{chunk-5ZBZHVMF.js → chunk-2GALTKXN.js} +36 -19
- package/{authCommand-NZC3H2EN.js → chunk-2NZUZIHB.js} +18 -43
- package/{chunk-JBWLZ3CB.js → chunk-2REKDWYL.js} +2 -2
- package/{chunk-DDVXTOFJ.js → chunk-36ZR37HK.js} +8 -8
- package/{chunk-PPCUXO3E.js → chunk-3RQVYR4B.js} +103 -0
- package/{chunk-YJ6UWOO5.js → chunk-3YYHTRF7.js} +2 -2
- package/{chunk-64K7WX26.js → chunk-4WVJLODK.js} +1 -1
- package/{chunk-5OJDQAJ2.js → chunk-5FMSOP2W.js} +2 -2
- package/{chunk-2Q3LOAFE.js → chunk-6HVBI6TI.js} +2 -2
- package/{chunk-U7HTU2S7.js → chunk-7AUQ3WCW.js} +1 -1
- package/{chunk-3UCYYSKN.js → chunk-7VTNQXNS.js} +29 -29
- package/{chunk-QSAUX2Q2.js → chunk-7WSZHITX.js} +2 -2
- package/{chunk-NUAQ3QHF.js → chunk-AFHKLTOB.js} +2 -2
- package/{chunk-LKV5K7PW.js → chunk-AJ7K2REY.js} +2 -2
- package/{chunk-P64WRQYV.js → chunk-AZMYUSVF.js} +1 -1
- package/{chunk-IAYMBPDZ.js → chunk-BRA5E6CI.js} +2 -2
- package/{chunk-5XNUQGLF.js → chunk-DLTR5MMT.js} +7 -7
- package/{chunk-4RERKW4Q.js → chunk-DTVCIIUZ.js} +5 -5
- package/{chunk-5BHQICF2.js → chunk-E32ZPIX6.js} +7 -6
- package/{chunk-73PRLLT6.js → chunk-EI77BHWD.js} +5 -5
- package/{chunk-WPOKOKZA.js → chunk-EPRYABUO.js} +1 -1
- package/{chunk-WC6TH54L.js → chunk-FSGQN6RC.js} +5 -5
- package/{chunk-7LJEJV4F.js → chunk-GMEAELJ6.js} +88 -1
- package/{chunk-YF4ZRVP3.js → chunk-HXHPAEAN.js} +1 -1
- package/{chunk-7DQSP7JU.js → chunk-J5JTMQIA.js} +1 -1
- package/{chunk-EVG6HQQ7.js → chunk-JBOUVTZX.js} +2 -2
- package/{chunk-D3DGBEYY.js → chunk-JUNMZOX6.js} +2 -2
- package/{chunk-7T5TLIY4.js → chunk-LKDF3ATR.js} +1 -1
- package/{chunk-LEJSZV6V.js → chunk-P2ZLUIW2.js} +243 -15
- package/{chunk-PK5TD4ST.js → chunk-PQTOTGMI.js} +1 -1
- package/{chunk-3ZUXGHFS.js → chunk-Q54YKNWP.js} +4 -80
- package/{chunk-LDPZBAQK.js → chunk-Q55XFXQ6.js} +2 -2
- package/{chunk-L5FZUSB6.js → chunk-QVUYL2TW.js} +3 -3
- package/{chunk-XNOILBHV.js → chunk-QWHAFJIJ.js} +1 -1
- package/{chunk-W45PCJHS.js → chunk-R56VAYY4.js} +1 -1
- package/{chunk-4NWJ3Z3G.js → chunk-RIGJPEBW.js} +1 -1
- package/{chunk-K7ZZPUNO.js → chunk-RTAVELOC.js} +12 -12
- package/{chunk-5MXA4LWL.js → chunk-U6QSCADP.js} +1 -1
- package/{chunk-ZCKXJTCW.js → chunk-UDHMQGMR.js} +10 -10
- package/{chunk-7NMNKOW5.js → chunk-UVXVWXYH.js} +2 -2
- package/{chunk-JASKVAYJ.js → chunk-UYY2CECP.js} +2 -2
- package/{chunk-6AMR3AE6.js → chunk-UZT65S6D.js} +12 -1
- package/{chunk-LTI5T3A6.js → chunk-VY3D2DSK.js} +1 -1
- package/{chunk-SEOM7GLZ.js → chunk-WADDWY7O.js} +1 -1
- package/{chunk-YZGNKHUM.js → chunk-WBSCOXFS.js} +1 -1
- package/{chunk-2PW2KOII.js → chunk-XBZDTBTK.js} +2 -2
- package/{chunk-ZRDUMMDG.js → chunk-XDLQYUBV.js} +9 -7
- package/{chunk-UGCQKKXW.js → chunk-XE4Q46FF.js} +1 -1
- package/{chunk-BAPZCPYU.js → chunk-XKH3DAKH.js} +1 -1
- package/{chunk-MNWKNN6V.js → chunk-XXYDK7L5.js} +1 -1
- package/{chunk-2GKUVGRT.js → chunk-XYKRRB5Z.js} +13 -5
- package/{chunk-Y3ASVJWL.js → chunk-ZG6RWZGY.js} +3 -3
- package/{chunk-AWVFQMOV.js → chunk-ZYKJBRZ3.js} +5 -1
- package/{commandRegistry-PASVNTAX.js → commandRegistry-3WR5YAN4.js} +70 -70
- package/{contentThunks-IXBWQP4P.js → contentThunks-4AJV2XJY.js} +4 -4
- package/{cooldownCommands-I4ETQ4AO.js → cooldownCommands-YL7H74YB.js} +3 -3
- package/{createAgentAutomationAction-7O7PFPDO.js → createAgentAutomationAction-YMY5N7IX.js} +4 -4
- package/{createDialogAction-DRHO4XCF.js → createDialogAction-RIMBMOTA.js} +5 -5
- package/{createPageAction-TFGJRDZX.js → createPageAction-MDNA4BXK.js} +4 -4
- package/{db-2QOTXYGH.js → db-HUCI5R4G.js} +2 -2
- package/{dialogCommands-RYIONJLY.js → dialogCommands-LH6ILXLQ.js} +21 -21
- package/{dialogSlice-CXIZ5UTI.js → dialogSlice-JWULZZKI.js} +3 -3
- package/{dialogUsageCommand-QTG6ILEJ.js → dialogUsageCommand-ZCPPHPJ5.js} +1 -1
- package/{docCreateCommands-KC2V2RPX.js → docCreateCommands-ZJV2YVBO.js} +16 -16
- package/{docDeleteCommands-S2SDQL2S.js → docDeleteCommands-5YMS6VX6.js} +17 -17
- package/{docReadCommands-3YGFKAOZ.js → docReadCommands-UCHOA64J.js} +16 -16
- package/{docStore-5AHNSAEI.js → docStore-IGB6VYJW.js} +1 -1
- package/{docUpdateCommands-PU6MQTLW.js → docUpdateCommands-R7DXVPBN.js} +16 -16
- package/{getPricing-3PQY3TGI.js → getPricing-RPAQXFXY.js} +1 -1
- package/{handleSendMessageAction-SO3PD3YA.js → handleSendMessageAction-2TN3FOIF.js} +12 -12
- package/index.js +7 -7
- package/{localDialogRead-FUXGZ57B.js → localDialogRead-5VCMQQZF.js} +1 -1
- package/{localRuntimeAdapter-5B7QODVK.js → localRuntimeAdapter-QLD7V33U.js} +29 -29
- package/{localRuntimeAuthority-NEGF3LRQ.js → localRuntimeAuthority-OYH4AE4G.js} +2 -2
- package/{localRuntimeDb-SDYFAEKA.js → localRuntimeDb-VBIMCWUC.js} +1 -1
- package/{machineCommands-U3DO4TFR.js → machineCommands-3TQNL2KD.js} +30 -30
- package/{machineWsRunDispatch-Y3IMIZO7.js → machineWsRunDispatch-6Z6KSDUJ.js} +30 -30
- package/package.json +1 -1
- package/{providerPresetApply-EQESXT6X.js → providerPresetApply-YKCAQCBR.js} +3 -3
- package/{providerRegistry-PZ56P43E.js → providerRegistry-QBBABMUW.js} +3 -3
- package/{readlineWorkspace-32IDD2MQ.js → readlineWorkspace-NHPGVRF6.js} +558 -139
- package/{removeDialogAgentAction-BDLO7UC2.js → removeDialogAgentAction-GZ56EZZI.js} +1 -1
- package/{runAgentClientLoop-ERVJ4LFY.js → runAgentClientLoop-P3ZALQBG.js} +18 -18
- package/{runtimeDoctorCommands-3VFVTGPI.js → runtimeDoctorCommands-3R3ZOZVS.js} +5 -5
- package/{secretCommands-RLIO3QK5.js → secretCommands-ZCZ4KVET.js} +1 -1
- package/{setPrimaryDialogAgentAction-PGBTR247.js → setPrimaryDialogAgentAction-JPTPBQH4.js} +1 -1
- package/{spaceCommands-4UWABUD7.js → spaceCommands-VZ4FGE6E.js} +15 -15
- package/{streamAgentChatTurn-2M4L7PF4.js → streamAgentChatTurn-TXTRBFOW.js} +22 -22
- package/{tools-GINHFGST.js → tools-72N432Y2.js} +13 -13
- package/{tuiSummaryLlmCaller-CEIZAKUV.js → tuiSummaryLlmCaller-WJBM4E2H.js} +6 -6
- package/{updateCommands-X23W5F73.js → updateCommands-Q6CYAEYJ.js} +3 -3
- package/{updateDialogTitleAction-4EIHKTKR.js → updateDialogTitleAction-EWTTA5A4.js} +4 -4
- package/{windowsSelfUpdate-SVJKL6VH.js → windowsSelfUpdate-XSQVF2GK.js} +2 -2
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveAuthGuidanceState
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WBSCOXFS.js";
|
|
4
4
|
import {
|
|
5
5
|
fetchCiStatus,
|
|
6
6
|
summarizeLatest
|
|
7
7
|
} from "./chunk-CKAHAVMK.js";
|
|
8
8
|
import "./chunk-M3JEW6N6.js";
|
|
9
|
+
import {
|
|
10
|
+
runAnthropicOAuthLogin,
|
|
11
|
+
runCursorOAuthLogin,
|
|
12
|
+
runDevinOAuthLogin,
|
|
13
|
+
runXaiOAuthDeviceCode,
|
|
14
|
+
runXaiOAuthLogin,
|
|
15
|
+
syncCredentialToServer
|
|
16
|
+
} from "./chunk-2NZUZIHB.js";
|
|
17
|
+
import {
|
|
18
|
+
runCloudflareOAuthLogin
|
|
19
|
+
} from "./chunk-U6QSCADP.js";
|
|
9
20
|
import {
|
|
10
21
|
isHiddenFromDialogList,
|
|
11
22
|
loadLocalRunChildDialogIds,
|
|
12
23
|
normalizeDialogRecord,
|
|
13
24
|
readDialogSnapshot,
|
|
14
25
|
sortDialogs
|
|
15
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-36ZR37HK.js";
|
|
16
27
|
import {
|
|
17
|
-
formatQuotaSummary,
|
|
18
28
|
listFavoriteAgentIdsAcrossServers,
|
|
19
29
|
listLocalCachedAgents,
|
|
20
30
|
listRemoteAgents,
|
|
21
31
|
listRemoteAgentsAcrossServers,
|
|
22
32
|
normalizeListedAgent
|
|
23
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-Q54YKNWP.js";
|
|
24
34
|
import "./chunk-ID4G2MAR.js";
|
|
25
35
|
import {
|
|
26
36
|
listUserRecordsFromServers,
|
|
27
37
|
readLiveDbRecordAfterTombstoneMerge
|
|
28
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-XKH3DAKH.js";
|
|
29
39
|
import {
|
|
30
40
|
refreshSubscriptionQuotas
|
|
31
41
|
} from "./chunk-YGILMZ7N.js";
|
|
32
42
|
import {
|
|
33
43
|
ANSI_ESCAPE_REGEX,
|
|
34
44
|
COLLAPSED_PASTE_PLACEHOLDER_RE,
|
|
45
|
+
OWNER_OAUTH_UNAVAILABLE_HINT,
|
|
35
46
|
THEME_PALETTES,
|
|
36
47
|
TUI_TREE_MARKER,
|
|
37
48
|
allocateCollapsedPaste,
|
|
@@ -60,6 +71,8 @@ import {
|
|
|
60
71
|
getActiveThemeMode,
|
|
61
72
|
getActiveThemeName,
|
|
62
73
|
isBalanceExhaustedError,
|
|
74
|
+
isInvalidGrantError,
|
|
75
|
+
isOwnerOAuthUnavailableError,
|
|
63
76
|
isRunResultStalledOrTruncated,
|
|
64
77
|
padOrTruncateToWidth,
|
|
65
78
|
platformCreditsFromUsage,
|
|
@@ -102,18 +115,18 @@ import {
|
|
|
102
115
|
wrapTextToLines,
|
|
103
116
|
wrapTranscriptLine,
|
|
104
117
|
wrapTranscriptLineWithLayout
|
|
105
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-2GALTKXN.js";
|
|
106
119
|
import "./chunk-6QDYSCPW.js";
|
|
107
|
-
import "./chunk-
|
|
120
|
+
import "./chunk-AFHKLTOB.js";
|
|
108
121
|
import "./chunk-Y5GCAMGP.js";
|
|
109
122
|
import {
|
|
110
123
|
getReadableCliDb
|
|
111
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-J5JTMQIA.js";
|
|
112
125
|
import {
|
|
113
126
|
deleteDbRecord,
|
|
114
127
|
queryUserRecords,
|
|
115
128
|
readDbRecord
|
|
116
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-XBZDTBTK.js";
|
|
117
130
|
import {
|
|
118
131
|
RUN_WAKE_CHANNEL_ENV,
|
|
119
132
|
clearCliLocalRuntimePreparedAgentCache,
|
|
@@ -123,24 +136,30 @@ import {
|
|
|
123
136
|
formatApprovalRemaining,
|
|
124
137
|
readTimestamp,
|
|
125
138
|
registerHostApprovalRenderer
|
|
126
|
-
} from "./chunk-
|
|
127
|
-
import
|
|
139
|
+
} from "./chunk-7VTNQXNS.js";
|
|
140
|
+
import {
|
|
141
|
+
anthropicGrantRemainingMs,
|
|
142
|
+
resolveServerSyncConfig,
|
|
143
|
+
runAntigravityOAuthLogin,
|
|
144
|
+
runOpenAiCodexBrowserPkce,
|
|
145
|
+
runOpenAiCodexDeviceCode
|
|
146
|
+
} from "./chunk-VY3D2DSK.js";
|
|
128
147
|
import "./chunk-VP3BINY7.js";
|
|
129
|
-
import "./chunk-
|
|
130
|
-
import "./chunk-
|
|
131
|
-
import "./chunk-U7HTU2S7.js";
|
|
132
|
-
import "./chunk-WOAZVUSN.js";
|
|
148
|
+
import "./chunk-R56VAYY4.js";
|
|
149
|
+
import "./chunk-7AUQ3WCW.js";
|
|
133
150
|
import {
|
|
134
151
|
NOLO_DEFAULT_AGENT_KEY,
|
|
135
152
|
resolveCliAgentKeyInput
|
|
136
153
|
} from "./chunk-NBTY7YJF.js";
|
|
154
|
+
import "./chunk-LKZPX6YH.js";
|
|
155
|
+
import "./chunk-WOAZVUSN.js";
|
|
137
156
|
import "./chunk-VIWDGTDA.js";
|
|
138
157
|
import "./chunk-HGDKT2D6.js";
|
|
139
158
|
import "./chunk-F7CI2ZC5.js";
|
|
140
159
|
import {
|
|
141
160
|
defaultOpenBrowser,
|
|
142
161
|
saveTokenLogin
|
|
143
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-XE4Q46FF.js";
|
|
144
163
|
import "./chunk-TY3TIUJK.js";
|
|
145
164
|
import "./chunk-S73EPYNC.js";
|
|
146
165
|
import "./chunk-RQ22OZD7.js";
|
|
@@ -157,20 +176,20 @@ import "./chunk-NEZGPBL7.js";
|
|
|
157
176
|
import "./chunk-JEXVIMYZ.js";
|
|
158
177
|
import {
|
|
159
178
|
prepareTools
|
|
160
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-Q55XFXQ6.js";
|
|
161
180
|
import "./chunk-HS7MLR74.js";
|
|
162
|
-
import "./chunk-
|
|
181
|
+
import "./chunk-RTAVELOC.js";
|
|
163
182
|
import "./chunk-KFHREHUQ.js";
|
|
164
|
-
import "./chunk-
|
|
183
|
+
import "./chunk-QVUYL2TW.js";
|
|
165
184
|
import "./chunk-OXME3PEE.js";
|
|
166
185
|
import "./chunk-KSTEXKL6.js";
|
|
167
186
|
import "./chunk-Z3MQYKRN.js";
|
|
168
|
-
import "./chunk-
|
|
187
|
+
import "./chunk-7WSZHITX.js";
|
|
169
188
|
import "./chunk-NF64D32W.js";
|
|
170
189
|
import "./chunk-3L2WKC3W.js";
|
|
171
190
|
import "./chunk-I5PBXF7O.js";
|
|
172
191
|
import "./chunk-VF4K2QE6.js";
|
|
173
|
-
import "./chunk-
|
|
192
|
+
import "./chunk-BRA5E6CI.js";
|
|
174
193
|
import "./chunk-MYOH447Z.js";
|
|
175
194
|
import "./chunk-RXUKDHS5.js";
|
|
176
195
|
import "./chunk-WYKMOZTW.js";
|
|
@@ -178,17 +197,17 @@ import "./chunk-AGIM7IMJ.js";
|
|
|
178
197
|
import "./chunk-A2ZMIRLN.js";
|
|
179
198
|
import "./chunk-VIDPVFP3.js";
|
|
180
199
|
import "./chunk-63W5N6P3.js";
|
|
181
|
-
import "./chunk-
|
|
182
|
-
import "./chunk-
|
|
200
|
+
import "./chunk-AJ7K2REY.js";
|
|
201
|
+
import "./chunk-WADDWY7O.js";
|
|
183
202
|
import "./chunk-5XBUWM6I.js";
|
|
184
203
|
import {
|
|
185
204
|
estimateMessagesTokens,
|
|
186
205
|
historyTokensBeforeLatestAssistant
|
|
187
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-UDHMQGMR.js";
|
|
188
207
|
import "./chunk-TZXPT53C.js";
|
|
189
208
|
import "./chunk-LEC5ALIN.js";
|
|
190
209
|
import "./chunk-523DITKR.js";
|
|
191
|
-
import "./chunk-
|
|
210
|
+
import "./chunk-ZG6RWZGY.js";
|
|
192
211
|
import "./chunk-BYXBJQAS.js";
|
|
193
212
|
import "./chunk-QYPE3TS3.js";
|
|
194
213
|
import "./chunk-T3U2KQF4.js";
|
|
@@ -200,11 +219,11 @@ import "./chunk-ZRAU6T47.js";
|
|
|
200
219
|
import "./chunk-4LCOCOR5.js";
|
|
201
220
|
import "./chunk-OWYYDMGJ.js";
|
|
202
221
|
import "./chunk-YDH3FDFQ.js";
|
|
203
|
-
import "./chunk-
|
|
204
|
-
import "./chunk-
|
|
222
|
+
import "./chunk-P2ZLUIW2.js";
|
|
223
|
+
import "./chunk-ZYKJBRZ3.js";
|
|
205
224
|
import "./chunk-5ZMIIR23.js";
|
|
206
225
|
import "./chunk-CVMMWN6P.js";
|
|
207
|
-
import "./chunk-
|
|
226
|
+
import "./chunk-AZMYUSVF.js";
|
|
208
227
|
import "./chunk-GLKOYSRU.js";
|
|
209
228
|
import "./chunk-GL7W7TTR.js";
|
|
210
229
|
import "./chunk-HWZT5DKX.js";
|
|
@@ -242,23 +261,24 @@ import {
|
|
|
242
261
|
buildLocalWorkspaceOpenAiTools,
|
|
243
262
|
buildLocalWorkspaceToolset,
|
|
244
263
|
readCommandActionGatePayload
|
|
245
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-XDLQYUBV.js";
|
|
246
265
|
import "./chunk-ZNFJWEN4.js";
|
|
247
|
-
import "./chunk-
|
|
248
|
-
import "./chunk-
|
|
266
|
+
import "./chunk-UYY2CECP.js";
|
|
267
|
+
import "./chunk-UVXVWXYH.js";
|
|
249
268
|
import "./chunk-HNUWUO75.js";
|
|
250
269
|
import "./chunk-CHOZJMJS.js";
|
|
251
270
|
import "./chunk-PWTNI4N7.js";
|
|
252
271
|
import "./chunk-Y63ZSOR6.js";
|
|
253
|
-
import "./chunk-
|
|
272
|
+
import "./chunk-XXYDK7L5.js";
|
|
254
273
|
import "./chunk-2WZXXAQD.js";
|
|
255
|
-
import "./chunk-
|
|
274
|
+
import "./chunk-2REKDWYL.js";
|
|
256
275
|
import "./chunk-4KB6WQUL.js";
|
|
257
276
|
import "./chunk-56GBUMO5.js";
|
|
258
277
|
import {
|
|
259
278
|
CREDENTIAL_HYGIENE_RULE,
|
|
260
279
|
DELETE_SAFETY_RED_LINE,
|
|
261
280
|
DISPATCH_BACKEND_POLICY,
|
|
281
|
+
DISPATCH_CANDIDATE_POLICY,
|
|
262
282
|
PARALLEL_DISPATCH_DEFAULT_RULE,
|
|
263
283
|
PLATFORM_RISK_CONTROL_RULE,
|
|
264
284
|
buildConsultationModeBlock,
|
|
@@ -266,15 +286,16 @@ import {
|
|
|
266
286
|
buildRuntimeGuidanceBlocks,
|
|
267
287
|
resolveResponseGuidelines,
|
|
268
288
|
resolveToolGuidedSections
|
|
269
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-UZT65S6D.js";
|
|
270
290
|
import "./chunk-CVCRAO6Q.js";
|
|
271
291
|
import "./chunk-E2BESSAW.js";
|
|
272
|
-
import "./chunk-
|
|
292
|
+
import "./chunk-6HVBI6TI.js";
|
|
273
293
|
import {
|
|
294
|
+
formatQuotaSummary,
|
|
274
295
|
isQuotaExhaustedError
|
|
275
|
-
} from "./chunk-
|
|
296
|
+
} from "./chunk-GMEAELJ6.js";
|
|
276
297
|
import "./chunk-WJZOQR2J.js";
|
|
277
|
-
import "./chunk-
|
|
298
|
+
import "./chunk-QWHAFJIJ.js";
|
|
278
299
|
import "./chunk-2MBTWINN.js";
|
|
279
300
|
import {
|
|
280
301
|
extractReferenceKeysFromMessage,
|
|
@@ -305,7 +326,10 @@ import {
|
|
|
305
326
|
compactWhitespace
|
|
306
327
|
} from "./chunk-DWLEOOGR.js";
|
|
307
328
|
import "./chunk-7DPNBQSV.js";
|
|
308
|
-
import
|
|
329
|
+
import {
|
|
330
|
+
createOAuthTokenStore,
|
|
331
|
+
isTokenExpired
|
|
332
|
+
} from "./chunk-G7Y4GXTY.js";
|
|
309
333
|
import {
|
|
310
334
|
buildMemoryOverlayLayer,
|
|
311
335
|
buildMemoryUseGuidanceLayer,
|
|
@@ -330,7 +354,7 @@ import {
|
|
|
330
354
|
extractCustomId,
|
|
331
355
|
parsePublicAgentId
|
|
332
356
|
} from "./chunk-M2EJHDJP.js";
|
|
333
|
-
import "./chunk-
|
|
357
|
+
import "./chunk-HXHPAEAN.js";
|
|
334
358
|
import {
|
|
335
359
|
TAIL_LINES_MAX,
|
|
336
360
|
backfillRunRecordParentDialog,
|
|
@@ -338,7 +362,7 @@ import {
|
|
|
338
362
|
isRunRecordClaimed,
|
|
339
363
|
listRunRecords,
|
|
340
364
|
readRunRecord
|
|
341
|
-
} from "./chunk-
|
|
365
|
+
} from "./chunk-PQTOTGMI.js";
|
|
342
366
|
import {
|
|
343
367
|
clipText,
|
|
344
368
|
formatDuration,
|
|
@@ -359,10 +383,10 @@ import {
|
|
|
359
383
|
import "./chunk-6UBGXX2W.js";
|
|
360
384
|
import {
|
|
361
385
|
resolvePlatformAuthToken
|
|
362
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-EPRYABUO.js";
|
|
363
387
|
import "./chunk-YUA6OAH5.js";
|
|
364
388
|
import "./chunk-SM3NSZJV.js";
|
|
365
|
-
import "./chunk-
|
|
389
|
+
import "./chunk-E32ZPIX6.js";
|
|
366
390
|
import {
|
|
367
391
|
toErrorMessage
|
|
368
392
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -377,7 +401,7 @@ import {
|
|
|
377
401
|
import {
|
|
378
402
|
checkForCliUpdate,
|
|
379
403
|
runSelfUpdateDetailed
|
|
380
|
-
} from "./chunk-
|
|
404
|
+
} from "./chunk-JBOUVTZX.js";
|
|
381
405
|
import {
|
|
382
406
|
parseUserIdFromAuthToken,
|
|
383
407
|
resolveAuthToken,
|
|
@@ -410,14 +434,14 @@ import {
|
|
|
410
434
|
resolveDefaultSpawn,
|
|
411
435
|
spawnProcess
|
|
412
436
|
} from "./chunk-4O22PGNQ.js";
|
|
413
|
-
import "./chunk-
|
|
437
|
+
import "./chunk-LKDF3ATR.js";
|
|
414
438
|
import {
|
|
415
439
|
dailyWelcomeTip,
|
|
416
440
|
initCliLocale,
|
|
417
441
|
parseCliLocale,
|
|
418
442
|
setCliLocale,
|
|
419
443
|
t
|
|
420
|
-
} from "./chunk-
|
|
444
|
+
} from "./chunk-3RQVYR4B.js";
|
|
421
445
|
import "./chunk-ECX3NKRD.js";
|
|
422
446
|
import "./chunk-XJWWBO34.js";
|
|
423
447
|
import "./chunk-I42VC5KR.js";
|
|
@@ -6435,6 +6459,7 @@ var SLASH_COMMANDS = [
|
|
|
6435
6459
|
"/skill",
|
|
6436
6460
|
"/customize",
|
|
6437
6461
|
"/login",
|
|
6462
|
+
"/auth",
|
|
6438
6463
|
"/profile",
|
|
6439
6464
|
"/update",
|
|
6440
6465
|
"/version",
|
|
@@ -8138,6 +8163,7 @@ function buildCliEstimateSystemText(opts = {}) {
|
|
|
8138
8163
|
CREDENTIAL_HYGIENE_RULE,
|
|
8139
8164
|
PARALLEL_DISPATCH_DEFAULT_RULE,
|
|
8140
8165
|
DISPATCH_BACKEND_POLICY,
|
|
8166
|
+
DISPATCH_CANDIDATE_POLICY,
|
|
8141
8167
|
PLATFORM_RISK_CONTROL_RULE,
|
|
8142
8168
|
buildConsultationModeBlock(),
|
|
8143
8169
|
prompt,
|
|
@@ -9241,6 +9267,13 @@ ${t("autoUsage")}` };
|
|
|
9241
9267
|
action: { type: "login", args: rest }
|
|
9242
9268
|
};
|
|
9243
9269
|
}
|
|
9270
|
+
case "/auth": {
|
|
9271
|
+
return {
|
|
9272
|
+
nextState: state,
|
|
9273
|
+
output: "",
|
|
9274
|
+
action: { type: "auth", args: rest }
|
|
9275
|
+
};
|
|
9276
|
+
}
|
|
9244
9277
|
case "/profile":
|
|
9245
9278
|
return {
|
|
9246
9279
|
nextState: state,
|
|
@@ -13008,7 +13041,16 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
|
|
|
13008
13041
|
});
|
|
13009
13042
|
scheduleTitlePatchSync(runResult);
|
|
13010
13043
|
if (!wasAborted && runResult.exitCode !== 0) {
|
|
13011
|
-
if (
|
|
13044
|
+
if (isOwnerOAuthUnavailableError(runResult.localError)) {
|
|
13045
|
+
ctx.emitCommandOutput(OWNER_OAUTH_UNAVAILABLE_HINT);
|
|
13046
|
+
} else if (isInvalidGrantError(runResult.localError)) {
|
|
13047
|
+
const provider = "claude";
|
|
13048
|
+
ctx.emitCommandOutput(t("auth.grantExpiredHint", provider));
|
|
13049
|
+
ctx.state = {
|
|
13050
|
+
...ctx.state,
|
|
13051
|
+
suggestedAuthCommand: `/auth ${provider}`
|
|
13052
|
+
};
|
|
13053
|
+
} else if (isBalanceExhaustedError(runResult.localError) && runResult.dialogId) {
|
|
13012
13054
|
ctx.emitCommandOutput(t("balanceExhaustedHint"));
|
|
13013
13055
|
} else if (isQuotaExhaustedError(runResult.localError)) {
|
|
13014
13056
|
ctx.emitCommandOutput(t("quotaExhaustedHint"));
|
|
@@ -13333,8 +13375,8 @@ function openVisibleUrlAtScreen(history, contentWidth, scrollTop, screenRow, scr
|
|
|
13333
13375
|
}
|
|
13334
13376
|
|
|
13335
13377
|
// packages/cli/tui/tuiRender.ts
|
|
13336
|
-
function createTuiRender(
|
|
13337
|
-
const { output, history, selectionState } =
|
|
13378
|
+
function createTuiRender(host2) {
|
|
13379
|
+
const { output, history, selectionState } = host2;
|
|
13338
13380
|
const RENDER_THROTTLE_MS = 33;
|
|
13339
13381
|
let renderScheduled = false;
|
|
13340
13382
|
let renderTimer = null;
|
|
@@ -13349,15 +13391,15 @@ function createTuiRender(host) {
|
|
|
13349
13391
|
paintSyncedFrame();
|
|
13350
13392
|
};
|
|
13351
13393
|
const paintSyncedFrame = () => {
|
|
13352
|
-
if (
|
|
13353
|
-
|
|
13394
|
+
if (host2.fixedInput.isPaused()) {
|
|
13395
|
+
host2.imageRenderer?.suspend();
|
|
13354
13396
|
return;
|
|
13355
13397
|
}
|
|
13356
13398
|
output.write("\x1B[?2026h\x1B[?25l");
|
|
13357
13399
|
try {
|
|
13358
13400
|
renderHistoryToOutput();
|
|
13359
|
-
if (
|
|
13360
|
-
|
|
13401
|
+
if (host2.fixedInput.active)
|
|
13402
|
+
host2.fixedInput.repaint(host2.buffer, host2.cursorPos);
|
|
13361
13403
|
} finally {
|
|
13362
13404
|
output.write("\x1B[?25h\x1B[?2026l");
|
|
13363
13405
|
}
|
|
@@ -13375,12 +13417,12 @@ function createTuiRender(host) {
|
|
|
13375
13417
|
if (syncingLayout) return;
|
|
13376
13418
|
syncingLayout = true;
|
|
13377
13419
|
try {
|
|
13378
|
-
const reservedRows =
|
|
13379
|
-
const imageRenderer =
|
|
13420
|
+
const reservedRows = host2.getReservedRows?.() ?? 0;
|
|
13421
|
+
const imageRenderer = host2.imageRenderer;
|
|
13380
13422
|
renderHistory(
|
|
13381
13423
|
output,
|
|
13382
13424
|
history,
|
|
13383
|
-
|
|
13425
|
+
host2.fixedInput.getInputLines(),
|
|
13384
13426
|
selectionState,
|
|
13385
13427
|
reservedRows,
|
|
13386
13428
|
imageRenderer && withImages ? {
|
|
@@ -13392,15 +13434,15 @@ function createTuiRender(host) {
|
|
|
13392
13434
|
}
|
|
13393
13435
|
};
|
|
13394
13436
|
const renderHistoryToOutput = () => {
|
|
13395
|
-
if (
|
|
13396
|
-
|
|
13437
|
+
if (host2.fixedInput.isPaused()) {
|
|
13438
|
+
host2.imageRenderer?.suspend();
|
|
13397
13439
|
return;
|
|
13398
13440
|
}
|
|
13399
|
-
|
|
13441
|
+
host2.imageRenderer?.resume();
|
|
13400
13442
|
renderHistoryCore(true);
|
|
13401
13443
|
};
|
|
13402
13444
|
const renderHistoryUnderDialog = () => {
|
|
13403
|
-
|
|
13445
|
+
host2.imageRenderer?.suspend();
|
|
13404
13446
|
renderHistoryCore(false);
|
|
13405
13447
|
};
|
|
13406
13448
|
return {
|
|
@@ -14369,6 +14411,346 @@ async function runTuiLogin(args, emit, deps = {}) {
|
|
|
14369
14411
|
}
|
|
14370
14412
|
}
|
|
14371
14413
|
|
|
14414
|
+
// packages/cli/tui/tuiAuth.ts
|
|
14415
|
+
var TUI_AUTH_PROVIDERS = [
|
|
14416
|
+
"claude",
|
|
14417
|
+
"chatgpt",
|
|
14418
|
+
"antigravity",
|
|
14419
|
+
"xai",
|
|
14420
|
+
"cursor",
|
|
14421
|
+
"devin"
|
|
14422
|
+
];
|
|
14423
|
+
var PROVIDER_DISPLAY_NAMES = {
|
|
14424
|
+
claude: "Claude (Anthropic)",
|
|
14425
|
+
chatgpt: "ChatGPT (OpenAI)",
|
|
14426
|
+
antigravity: "Antigravity (Google)",
|
|
14427
|
+
xai: "xAI (Grok)",
|
|
14428
|
+
cursor: "Cursor",
|
|
14429
|
+
devin: "Devin",
|
|
14430
|
+
cloudflare: "Cloudflare"
|
|
14431
|
+
};
|
|
14432
|
+
function strWidth(str) {
|
|
14433
|
+
let w = 0;
|
|
14434
|
+
for (const ch of str) {
|
|
14435
|
+
w += ch.charCodeAt(0) > 255 ? 2 : 1;
|
|
14436
|
+
}
|
|
14437
|
+
return w;
|
|
14438
|
+
}
|
|
14439
|
+
function padRight(str, width) {
|
|
14440
|
+
const diff = width - strWidth(str);
|
|
14441
|
+
return diff > 0 ? str + " ".repeat(diff) : str;
|
|
14442
|
+
}
|
|
14443
|
+
function formatGrantRemaining(provider, credential, now) {
|
|
14444
|
+
if (provider !== "claude" || !credential) return "-";
|
|
14445
|
+
const rem = anthropicGrantRemainingMs(credential, now);
|
|
14446
|
+
if (rem === void 0) return "-";
|
|
14447
|
+
if (rem <= 0) return t("auth.grantExpired");
|
|
14448
|
+
const days = Math.floor(rem / (24 * 3600 * 1e3));
|
|
14449
|
+
const hours = Math.floor(rem % (24 * 3600 * 1e3) / (3600 * 1e3));
|
|
14450
|
+
if (days > 0) return `${days}d ${hours}h`;
|
|
14451
|
+
const minutes = Math.floor(rem / (60 * 1e3));
|
|
14452
|
+
if (minutes > 0) return `${minutes}m`;
|
|
14453
|
+
return "<1m";
|
|
14454
|
+
}
|
|
14455
|
+
function formatLocalStatus(credential, now) {
|
|
14456
|
+
if (!credential) return t("auth.statusUnauthenticated");
|
|
14457
|
+
if (isTokenExpired(credential, 0, now)) return t("auth.statusExpired");
|
|
14458
|
+
return t("auth.statusAuthenticated");
|
|
14459
|
+
}
|
|
14460
|
+
function formatServerSyncStatus(credential) {
|
|
14461
|
+
if (!credential) return "-";
|
|
14462
|
+
if (credential.serverManaged) {
|
|
14463
|
+
return t("auth.syncStatusSynced");
|
|
14464
|
+
}
|
|
14465
|
+
return t("auth.syncStatusNotSynced");
|
|
14466
|
+
}
|
|
14467
|
+
function toAuthProviderPickerItems(tokenStore, now = Date.now()) {
|
|
14468
|
+
return TUI_AUTH_PROVIDERS.map((provider) => {
|
|
14469
|
+
const cred = tokenStore.read(provider);
|
|
14470
|
+
const isAuthed = cred && !isTokenExpired(cred, 0, now);
|
|
14471
|
+
const isExp = cred && isTokenExpired(cred, 0, now);
|
|
14472
|
+
const statusLabel = isAuthed ? `\u2713 ${t("auth.statusAuthenticated")}` : isExp ? `\u26A0 ${t("auth.statusExpired")}` : t("auth.statusUnauthenticated");
|
|
14473
|
+
const brandName = PROVIDER_DISPLAY_NAMES[provider] ?? provider;
|
|
14474
|
+
const label = `${padRight(brandName, 26)} ${statusLabel}`;
|
|
14475
|
+
const grantPart = formatGrantRemaining(provider, cred, now);
|
|
14476
|
+
const syncPart = formatServerSyncStatus(cred);
|
|
14477
|
+
const detailParts = [];
|
|
14478
|
+
if (provider === "claude" && cred && grantPart !== "-") {
|
|
14479
|
+
detailParts.push(`${t("auth.statusColGrantRemaining")}: ${grantPart}`);
|
|
14480
|
+
}
|
|
14481
|
+
if (cred && syncPart !== "-") {
|
|
14482
|
+
detailParts.push(syncPart);
|
|
14483
|
+
}
|
|
14484
|
+
const detail = detailParts.length > 0 ? detailParts.join(" \xB7 ") : void 0;
|
|
14485
|
+
return {
|
|
14486
|
+
label,
|
|
14487
|
+
...detail ? { detail } : {},
|
|
14488
|
+
provider
|
|
14489
|
+
};
|
|
14490
|
+
});
|
|
14491
|
+
}
|
|
14492
|
+
async function promptSelectProvider(deps, tokenStore, now = Date.now()) {
|
|
14493
|
+
const items = toAuthProviderPickerItems(tokenStore, now);
|
|
14494
|
+
if (deps.selectProvider) {
|
|
14495
|
+
return deps.selectProvider(items);
|
|
14496
|
+
}
|
|
14497
|
+
if (deps.dialogHost) {
|
|
14498
|
+
const pickResult = await deps.dialogHost.run(
|
|
14499
|
+
(anchor) => runSelectDialog({
|
|
14500
|
+
items,
|
|
14501
|
+
initialIndex: 0,
|
|
14502
|
+
titleLines: [renderDialogTitle(t("auth.pickerTitle"))],
|
|
14503
|
+
input: deps.input ?? process.stdin,
|
|
14504
|
+
output: deps.output ?? process.stdout,
|
|
14505
|
+
...anchor
|
|
14506
|
+
})
|
|
14507
|
+
);
|
|
14508
|
+
if (pickResult.kind === "selected") {
|
|
14509
|
+
return pickResult.item.provider;
|
|
14510
|
+
}
|
|
14511
|
+
return null;
|
|
14512
|
+
}
|
|
14513
|
+
return null;
|
|
14514
|
+
}
|
|
14515
|
+
function renderAuthStatusPanel(tokenStore, now = Date.now()) {
|
|
14516
|
+
const headers = [
|
|
14517
|
+
t("auth.statusColProvider"),
|
|
14518
|
+
t("auth.statusColLocalStatus"),
|
|
14519
|
+
t("auth.statusColGrantRemaining"),
|
|
14520
|
+
t("auth.statusColServerSync")
|
|
14521
|
+
];
|
|
14522
|
+
const rows = TUI_AUTH_PROVIDERS.map((provider) => {
|
|
14523
|
+
const cred = tokenStore.read(provider);
|
|
14524
|
+
return [
|
|
14525
|
+
provider,
|
|
14526
|
+
formatLocalStatus(cred, now),
|
|
14527
|
+
formatGrantRemaining(provider, cred, now),
|
|
14528
|
+
formatServerSyncStatus(cred)
|
|
14529
|
+
];
|
|
14530
|
+
});
|
|
14531
|
+
const colWidths = headers.map((header, colIndex) => {
|
|
14532
|
+
let max = strWidth(header);
|
|
14533
|
+
for (const row of rows) {
|
|
14534
|
+
const cellWidth = strWidth(row[colIndex] ?? "");
|
|
14535
|
+
if (cellWidth > max) max = cellWidth;
|
|
14536
|
+
}
|
|
14537
|
+
return Math.max(max, 10);
|
|
14538
|
+
});
|
|
14539
|
+
const formatLine = (cells) => cells.map((cell, i) => padRight(cell, colWidths[i] + 2)).join("").trimEnd();
|
|
14540
|
+
const lines = [
|
|
14541
|
+
t("auth.statusTitle"),
|
|
14542
|
+
"",
|
|
14543
|
+
formatLine(headers),
|
|
14544
|
+
formatLine(colWidths.map((w) => "-".repeat(w)))
|
|
14545
|
+
];
|
|
14546
|
+
for (const row of rows) {
|
|
14547
|
+
lines.push(formatLine(row));
|
|
14548
|
+
}
|
|
14549
|
+
lines.push("");
|
|
14550
|
+
lines.push(t("auth.statusBottomHint"));
|
|
14551
|
+
return lines.join("\n");
|
|
14552
|
+
}
|
|
14553
|
+
function classifyAuthFlowError(err, provider) {
|
|
14554
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
14555
|
+
if (/state verification failed|state mismatch|invalid_state/i.test(msg)) {
|
|
14556
|
+
return t("auth.errorStateMismatch", provider);
|
|
14557
|
+
}
|
|
14558
|
+
if (/denied|cancelled|canceled|rejected|access_denied|abort/i.test(msg)) {
|
|
14559
|
+
return t("auth.errorCancelled", provider);
|
|
14560
|
+
}
|
|
14561
|
+
if (/invalid_grant|expired|revoked|refresh[_ ]token.*(expired|invalid)/i.test(msg)) {
|
|
14562
|
+
return t("auth.errorGrantExpired", provider);
|
|
14563
|
+
}
|
|
14564
|
+
if (/fetch failed|econnrefused|enotfound|etimedout|timeout|network|socket|ehostunreach/i.test(
|
|
14565
|
+
msg
|
|
14566
|
+
)) {
|
|
14567
|
+
return t("auth.errorNetwork");
|
|
14568
|
+
}
|
|
14569
|
+
return t("auth.commandFailed", provider, msg);
|
|
14570
|
+
}
|
|
14571
|
+
async function runTuiAuthLogout(provider, emit, deps = {}) {
|
|
14572
|
+
const tokenStore = deps.tokenStore ?? createOAuthTokenStore();
|
|
14573
|
+
const credential = tokenStore.read(provider);
|
|
14574
|
+
if (!credential) {
|
|
14575
|
+
emit(t("auth.noLocalCredential", provider));
|
|
14576
|
+
return { status: "failed", reason: "no_credential" };
|
|
14577
|
+
}
|
|
14578
|
+
const wasServerManaged = Boolean(credential.serverManaged);
|
|
14579
|
+
tokenStore.remove(provider);
|
|
14580
|
+
if (wasServerManaged) {
|
|
14581
|
+
emit(t("auth.logoutLocalWithServerNotice", provider));
|
|
14582
|
+
} else {
|
|
14583
|
+
emit(t("auth.logoutSuccess", provider));
|
|
14584
|
+
}
|
|
14585
|
+
return { status: "logout-success" };
|
|
14586
|
+
}
|
|
14587
|
+
async function runTuiAuth(args, emit, deps = {}) {
|
|
14588
|
+
const tokenStore = deps.tokenStore ?? createOAuthTokenStore();
|
|
14589
|
+
const now = deps.now?.() ?? Date.now();
|
|
14590
|
+
if (args.length === 0) {
|
|
14591
|
+
if (deps.selectProvider || deps.dialogHost) {
|
|
14592
|
+
const selected = await promptSelectProvider(deps, tokenStore, now);
|
|
14593
|
+
if (!selected) {
|
|
14594
|
+
return { status: "failed", reason: "cancelled" };
|
|
14595
|
+
}
|
|
14596
|
+
return runTuiAuth([selected], emit, deps);
|
|
14597
|
+
}
|
|
14598
|
+
const panel = renderAuthStatusPanel(tokenStore, now);
|
|
14599
|
+
emit(panel);
|
|
14600
|
+
return { status: "status-rendered" };
|
|
14601
|
+
}
|
|
14602
|
+
const [subCommand, ...rest] = args;
|
|
14603
|
+
if (subCommand === "logout") {
|
|
14604
|
+
const target = rest[0]?.toLowerCase();
|
|
14605
|
+
if (!target || !isValidProvider(target)) {
|
|
14606
|
+
emit(t("auth.unknownProvider", target ?? "", TUI_AUTH_PROVIDERS.join(", ")));
|
|
14607
|
+
return { status: "failed", reason: "unknown_provider" };
|
|
14608
|
+
}
|
|
14609
|
+
return runTuiAuthLogout(target, emit, deps);
|
|
14610
|
+
}
|
|
14611
|
+
const provider = subCommand.toLowerCase();
|
|
14612
|
+
if (!isValidProvider(provider)) {
|
|
14613
|
+
emit(t("auth.unknownProvider", provider, TUI_AUTH_PROVIDERS.join(", ")));
|
|
14614
|
+
return { status: "failed", reason: "unknown_provider" };
|
|
14615
|
+
}
|
|
14616
|
+
const flowDeps = {
|
|
14617
|
+
...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {},
|
|
14618
|
+
...deps.sleep ? { sleep: deps.sleep } : {},
|
|
14619
|
+
...deps.now ? { now: deps.now } : {},
|
|
14620
|
+
readLine: async (rawPrompt) => {
|
|
14621
|
+
const prompt = t("auth.pasteCallbackPrompt");
|
|
14622
|
+
if (deps.readLine) {
|
|
14623
|
+
return deps.readLine(prompt);
|
|
14624
|
+
}
|
|
14625
|
+
if (deps.dialogHost) {
|
|
14626
|
+
return deps.dialogHost.withKeyboard(async () => {
|
|
14627
|
+
const readline2 = await import("node:readline/promises");
|
|
14628
|
+
const rl2 = readline2.createInterface({
|
|
14629
|
+
input: deps.input ?? process.stdin,
|
|
14630
|
+
output: deps.output ?? process.stdout
|
|
14631
|
+
});
|
|
14632
|
+
try {
|
|
14633
|
+
return await rl2.question(prompt);
|
|
14634
|
+
} finally {
|
|
14635
|
+
rl2.close();
|
|
14636
|
+
}
|
|
14637
|
+
});
|
|
14638
|
+
}
|
|
14639
|
+
const readline = await import("node:readline/promises");
|
|
14640
|
+
const rl = readline.createInterface({
|
|
14641
|
+
input: deps.input ?? process.stdin,
|
|
14642
|
+
output: deps.output ?? process.stdout
|
|
14643
|
+
});
|
|
14644
|
+
try {
|
|
14645
|
+
return await rl.question(prompt);
|
|
14646
|
+
} finally {
|
|
14647
|
+
rl.close();
|
|
14648
|
+
}
|
|
14649
|
+
},
|
|
14650
|
+
...deps.manualCode || rest.includes("--manual") || rest.includes("--no-browser") ? { manualCode: true } : {},
|
|
14651
|
+
openBrowser: deps.openBrowser ?? defaultOpenBrowser,
|
|
14652
|
+
output: { log: (msg) => emit(redactSecrets(String(msg))) },
|
|
14653
|
+
error: { error: (msg) => emit(redactSecrets(String(msg))) }
|
|
14654
|
+
};
|
|
14655
|
+
let credential;
|
|
14656
|
+
try {
|
|
14657
|
+
if (provider === "claude") {
|
|
14658
|
+
credential = await runAnthropicOAuthLogin(flowDeps);
|
|
14659
|
+
} else if (provider === "chatgpt") {
|
|
14660
|
+
const useDeviceCode = rest.includes("--device-code");
|
|
14661
|
+
credential = useDeviceCode ? await runOpenAiCodexDeviceCode(flowDeps) : await runOpenAiCodexBrowserPkce(flowDeps);
|
|
14662
|
+
} else if (provider === "xai") {
|
|
14663
|
+
const useDeviceCode = rest.includes("--device-code");
|
|
14664
|
+
credential = useDeviceCode ? await runXaiOAuthDeviceCode(flowDeps) : await runXaiOAuthLogin(flowDeps);
|
|
14665
|
+
} else if (provider === "cursor") {
|
|
14666
|
+
credential = await runCursorOAuthLogin(flowDeps);
|
|
14667
|
+
} else if (provider === "devin") {
|
|
14668
|
+
credential = await runDevinOAuthLogin(flowDeps);
|
|
14669
|
+
} else if (provider === "cloudflare") {
|
|
14670
|
+
credential = await runCloudflareOAuthLogin(flowDeps);
|
|
14671
|
+
} else {
|
|
14672
|
+
credential = await runAntigravityOAuthLogin(flowDeps);
|
|
14673
|
+
}
|
|
14674
|
+
} catch (err) {
|
|
14675
|
+
const errorText = classifyAuthFlowError(err, provider);
|
|
14676
|
+
emit(redactSecrets(errorText));
|
|
14677
|
+
return {
|
|
14678
|
+
status: "failed",
|
|
14679
|
+
reason: err instanceof Error ? err.message : String(err)
|
|
14680
|
+
};
|
|
14681
|
+
}
|
|
14682
|
+
tokenStore.write(provider, credential);
|
|
14683
|
+
const accountLabel = credential.metadata?.email ?? credential.accountId ?? "";
|
|
14684
|
+
emit(
|
|
14685
|
+
t(
|
|
14686
|
+
"auth.authorizationSaved",
|
|
14687
|
+
provider,
|
|
14688
|
+
accountLabel ? t("auth.authorizationSavedForAccount", accountLabel) : ""
|
|
14689
|
+
)
|
|
14690
|
+
);
|
|
14691
|
+
const hasExplicitNoSync = rest.includes("--no-sync-to-server");
|
|
14692
|
+
const hasExplicitSync = rest.includes("--sync-to-server");
|
|
14693
|
+
let shouldSync = false;
|
|
14694
|
+
if (hasExplicitNoSync) {
|
|
14695
|
+
shouldSync = false;
|
|
14696
|
+
} else if (hasExplicitSync) {
|
|
14697
|
+
shouldSync = true;
|
|
14698
|
+
} else {
|
|
14699
|
+
const syncConfig = (deps.resolveServerSyncConfig ?? resolveServerSyncConfig)();
|
|
14700
|
+
if (!syncConfig) {
|
|
14701
|
+
emit(t("auth.noServerConfigured", provider));
|
|
14702
|
+
shouldSync = false;
|
|
14703
|
+
} else {
|
|
14704
|
+
const question = t(
|
|
14705
|
+
"auth.syncPromptQuestion",
|
|
14706
|
+
syncConfig.serverOrigin,
|
|
14707
|
+
provider
|
|
14708
|
+
);
|
|
14709
|
+
if (deps.promptSync) {
|
|
14710
|
+
shouldSync = await deps.promptSync(question);
|
|
14711
|
+
} else if (deps.dialogHost) {
|
|
14712
|
+
const syncResult = await deps.dialogHost.run(
|
|
14713
|
+
(anchor) => runSelectDialog({
|
|
14714
|
+
items: [
|
|
14715
|
+
{ label: t("auth.syncOptionNo"), value: false },
|
|
14716
|
+
{ label: t("auth.syncOptionYes"), value: true }
|
|
14717
|
+
],
|
|
14718
|
+
initialIndex: 0,
|
|
14719
|
+
titleLines: [renderDialogTitle(question)],
|
|
14720
|
+
input: deps.input ?? process.stdin,
|
|
14721
|
+
output: deps.output ?? process.stdout,
|
|
14722
|
+
...anchor
|
|
14723
|
+
})
|
|
14724
|
+
);
|
|
14725
|
+
shouldSync = syncResult.kind === "selected" ? syncResult.item.value : false;
|
|
14726
|
+
} else if (deps.readLine) {
|
|
14727
|
+
const raw = await deps.readLine(question);
|
|
14728
|
+
const trimmed = raw.trim().toLowerCase();
|
|
14729
|
+
shouldSync = trimmed === "y" || trimmed === "yes";
|
|
14730
|
+
} else {
|
|
14731
|
+
shouldSync = false;
|
|
14732
|
+
}
|
|
14733
|
+
}
|
|
14734
|
+
}
|
|
14735
|
+
if (shouldSync) {
|
|
14736
|
+
const syncFn = deps.syncCredentialToServer ?? syncCredentialToServer;
|
|
14737
|
+
const syncResult = await syncFn(provider, credential, {
|
|
14738
|
+
...deps,
|
|
14739
|
+
output: flowDeps.output,
|
|
14740
|
+
error: flowDeps.error
|
|
14741
|
+
});
|
|
14742
|
+
if (syncResult === "mark_failed") {
|
|
14743
|
+
emit(t("auth.markFailed"));
|
|
14744
|
+
}
|
|
14745
|
+
} else if (!hasExplicitNoSync) {
|
|
14746
|
+
emit(t("auth.notSyncedToServer", provider));
|
|
14747
|
+
}
|
|
14748
|
+
return { status: "success", credential };
|
|
14749
|
+
}
|
|
14750
|
+
function isValidProvider(provider) {
|
|
14751
|
+
return TUI_AUTH_PROVIDERS.includes(provider) || provider === "cloudflare";
|
|
14752
|
+
}
|
|
14753
|
+
|
|
14372
14754
|
// packages/cli/tui/dialogPicker.ts
|
|
14373
14755
|
var DEFAULT_PICKER_LIMIT = 20;
|
|
14374
14756
|
var PICKER_OVERSAMPLE_FACTOR = 5;
|
|
@@ -14532,7 +14914,7 @@ ${content}`);
|
|
|
14532
14914
|
}
|
|
14533
14915
|
return parts.join("\n\n");
|
|
14534
14916
|
};
|
|
14535
|
-
async function runSubmittedSlashLine(line,
|
|
14917
|
+
async function runSubmittedSlashLine(line, host2, actionGateHandler, confirmDestructiveAction) {
|
|
14536
14918
|
const {
|
|
14537
14919
|
history,
|
|
14538
14920
|
pasteStore,
|
|
@@ -14554,21 +14936,21 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14554
14936
|
selfUpdater,
|
|
14555
14937
|
spawnRunner,
|
|
14556
14938
|
installAltScreenRestoreHandlers: installAltScreenRestoreHandlers2
|
|
14557
|
-
} =
|
|
14558
|
-
const result = handleTuiInput2(line,
|
|
14559
|
-
const previousState =
|
|
14560
|
-
const previousAgentKey =
|
|
14561
|
-
|
|
14562
|
-
if (previousState.permissionGrants?.remote === true &&
|
|
14563
|
-
|
|
14564
|
-
}
|
|
14565
|
-
if (!persistPermissionGrantChanges(previousState.permissionGrants,
|
|
14939
|
+
} = host2;
|
|
14940
|
+
const result = handleTuiInput2(line, host2.state, collectConversationTurns(host2.history));
|
|
14941
|
+
const previousState = host2.state;
|
|
14942
|
+
const previousAgentKey = host2.state.agentKey;
|
|
14943
|
+
host2.state = result.nextState;
|
|
14944
|
+
if (previousState.permissionGrants?.remote === true && host2.state.permissionGrants?.remote !== true) {
|
|
14945
|
+
host2.revokeRemoteShellGrants?.();
|
|
14946
|
+
}
|
|
14947
|
+
if (!persistPermissionGrantChanges(previousState.permissionGrants, host2.state.permissionGrants)) {
|
|
14566
14948
|
emitCommandOutput(t("autoPersistFailed"));
|
|
14567
14949
|
}
|
|
14568
14950
|
const command = line.trim().split(/\s+/)[0];
|
|
14569
14951
|
if ((command === "/agent" || command === "/switch") && result.nextState !== previousState) {
|
|
14570
14952
|
clearCliLocalRuntimePreparedAgentCache();
|
|
14571
|
-
persistAgentSelection2(
|
|
14953
|
+
persistAgentSelection2(host2.state, options.env ?? process.env);
|
|
14572
14954
|
}
|
|
14573
14955
|
const interactive = isInteractiveInput(input);
|
|
14574
14956
|
const isChatAction = result.action?.type === "chat";
|
|
@@ -14578,7 +14960,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14578
14960
|
interactive && !isChatAction ? line.trim() : ""
|
|
14579
14961
|
);
|
|
14580
14962
|
}
|
|
14581
|
-
if (
|
|
14963
|
+
if (host2.state.agentKey !== previousAgentKey) {
|
|
14582
14964
|
persistExplicitAgentSwitch(previousAgentKey);
|
|
14583
14965
|
}
|
|
14584
14966
|
if (result.action?.type === "exit") {
|
|
@@ -14597,7 +14979,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14597
14979
|
deleteOptions: { type: "messages" },
|
|
14598
14980
|
authToken,
|
|
14599
14981
|
fetchImpl,
|
|
14600
|
-
serverUrl:
|
|
14982
|
+
serverUrl: host2.state.serverUrl
|
|
14601
14983
|
});
|
|
14602
14984
|
emitCommandOutput(t("clearedDialog"));
|
|
14603
14985
|
} catch (error) {
|
|
@@ -14608,8 +14990,8 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14608
14990
|
}
|
|
14609
14991
|
clearCollapsedPasteStore(pasteStore);
|
|
14610
14992
|
bumpDraftEpoch();
|
|
14611
|
-
|
|
14612
|
-
...
|
|
14993
|
+
host2.state = {
|
|
14994
|
+
...host2.state,
|
|
14613
14995
|
turnTokens: void 0,
|
|
14614
14996
|
lastAuthorityTurnCount: void 0,
|
|
14615
14997
|
liveTurnEstimatedTokens: void 0,
|
|
@@ -14621,13 +15003,13 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14621
15003
|
cachedMemoryOverlay: void 0,
|
|
14622
15004
|
// 新对话重新加载记忆
|
|
14623
15005
|
estimatedContextTokens: estimateDefaultCliContextTokens({
|
|
14624
|
-
cwd:
|
|
14625
|
-
agentKey:
|
|
14626
|
-
userLanguage:
|
|
15006
|
+
cwd: host2.state.cwd,
|
|
15007
|
+
agentKey: host2.state.agentKey,
|
|
15008
|
+
userLanguage: host2.state.userLanguage,
|
|
14627
15009
|
responseViewport: TUI_RESPONSE_VIEWPORT,
|
|
14628
15010
|
...resolveAgentModelIdentity({
|
|
14629
|
-
agentKey:
|
|
14630
|
-
agentName:
|
|
15011
|
+
agentKey: host2.state.agentKey,
|
|
15012
|
+
agentName: host2.state.agentName
|
|
14631
15013
|
})
|
|
14632
15014
|
})
|
|
14633
15015
|
};
|
|
@@ -14648,7 +15030,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14648
15030
|
if (result.action?.type === "learn-history") {
|
|
14649
15031
|
const token = resolvePlatformAuthToken(options.env ?? {});
|
|
14650
15032
|
try {
|
|
14651
|
-
const response = await fetchImpl(new URL("/api/agent/runs/control",
|
|
15033
|
+
const response = await fetchImpl(new URL("/api/agent/runs/control", host2.state.serverUrl), {
|
|
14652
15034
|
method: "POST",
|
|
14653
15035
|
headers: { "Content-Type": "application/json", ...token ? { Authorization: `Bearer ${token}` } : {} },
|
|
14654
15036
|
body: JSON.stringify({ action: "learn", limit: result.action.limit }),
|
|
@@ -14690,7 +15072,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14690
15072
|
const compactStart = Date.now();
|
|
14691
15073
|
try {
|
|
14692
15074
|
const compactResult = await runner({
|
|
14693
|
-
serverUrl:
|
|
15075
|
+
serverUrl: host2.state.serverUrl,
|
|
14694
15076
|
authToken,
|
|
14695
15077
|
dialogId: result.action.dialogId,
|
|
14696
15078
|
summaryLlmCaller: options.summaryLlmCaller,
|
|
@@ -14702,12 +15084,12 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14702
15084
|
}
|
|
14703
15085
|
});
|
|
14704
15086
|
const elapsedSec = ((Date.now() - compactStart) / 1e3).toFixed(1);
|
|
14705
|
-
|
|
14706
|
-
...
|
|
15087
|
+
host2.state = {
|
|
15088
|
+
...host2.state,
|
|
14707
15089
|
dialogId: compactResult.dialogId,
|
|
14708
15090
|
dialogKey: compactResult.dialogKey,
|
|
14709
15091
|
dialogLabel: compactResult.dialogId,
|
|
14710
|
-
dialogTitle:
|
|
15092
|
+
dialogTitle: host2.state.dialogTitle,
|
|
14711
15093
|
// Compact forks into a fresh dialog that only inherits the summary,
|
|
14712
15094
|
// not the full message history. Drop usage-derived context so the
|
|
14713
15095
|
// composer chip falls back to the default CLI surface estimate and
|
|
@@ -14723,17 +15105,17 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14723
15105
|
cachedMemoryOverlay: void 0,
|
|
14724
15106
|
// compact 创建新 dialog,重新加载记忆
|
|
14725
15107
|
estimatedContextTokens: estimateDefaultCliContextTokens({
|
|
14726
|
-
cwd:
|
|
14727
|
-
agentKey:
|
|
14728
|
-
userLanguage:
|
|
15108
|
+
cwd: host2.state.cwd,
|
|
15109
|
+
agentKey: host2.state.agentKey,
|
|
15110
|
+
userLanguage: host2.state.userLanguage,
|
|
14729
15111
|
responseViewport: TUI_RESPONSE_VIEWPORT,
|
|
14730
15112
|
messages: [
|
|
14731
15113
|
...compactResult.summary ? [{ role: "system", content: compactResult.summary }] : [],
|
|
14732
|
-
...compactResult.compactedMessageCount > 0 ?
|
|
15114
|
+
...compactResult.compactedMessageCount > 0 ? host2.history.turns.slice(compactResult.compactedMessageCount) : compactResult.summaryGenerated ? [] : host2.history.turns
|
|
14733
15115
|
],
|
|
14734
15116
|
...resolveAgentModelIdentity({
|
|
14735
|
-
agentKey:
|
|
14736
|
-
agentName:
|
|
15117
|
+
agentKey: host2.state.agentKey,
|
|
15118
|
+
agentName: host2.state.agentName
|
|
14737
15119
|
})
|
|
14738
15120
|
})
|
|
14739
15121
|
};
|
|
@@ -14794,8 +15176,8 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14794
15176
|
}
|
|
14795
15177
|
if (result.action?.type === "cwd-refresh") {
|
|
14796
15178
|
if ((options.env?.NOLO_CLI_GIT_STATUS ?? process.env.NOLO_CLI_GIT_STATUS) !== "0") {
|
|
14797
|
-
const gitStatus = await detectGitStatusAsync(
|
|
14798
|
-
|
|
15179
|
+
const gitStatus = await detectGitStatusAsync(host2.state.cwd);
|
|
15180
|
+
host2.state = { ...host2.state, gitStatus };
|
|
14799
15181
|
}
|
|
14800
15182
|
if (result.action.switchMessage) {
|
|
14801
15183
|
emitCommandOutput(result.action.switchMessage);
|
|
@@ -14805,24 +15187,24 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14805
15187
|
if (result.action?.type === "switch-agent") {
|
|
14806
15188
|
const query = result.action.target;
|
|
14807
15189
|
try {
|
|
14808
|
-
const entries = await (
|
|
15190
|
+
const entries = await (host2.loadAgentCatalog ?? loadAgentCatalog)({
|
|
14809
15191
|
env: options.env ?? process.env,
|
|
14810
|
-
currentKey:
|
|
15192
|
+
currentKey: host2.state.agentKey,
|
|
14811
15193
|
fetchImpl,
|
|
14812
|
-
fallbackFetchImpl:
|
|
15194
|
+
fallbackFetchImpl: host2.fallbackFetchImpl,
|
|
14813
15195
|
fresh: true
|
|
14814
15196
|
});
|
|
14815
15197
|
const target = resolveAgentSwitchTarget(query, entries);
|
|
14816
15198
|
if (!target || !entries.some((entry) => entry.key === target.key)) {
|
|
14817
15199
|
emitCommandOutput(t("agentUnknown", query));
|
|
14818
15200
|
} else {
|
|
14819
|
-
const nextState = applyAgentSwitchState(
|
|
14820
|
-
const oldKey =
|
|
14821
|
-
|
|
15201
|
+
const nextState = applyAgentSwitchState(host2.state, target, host2.history.turns);
|
|
15202
|
+
const oldKey = host2.state.agentKey;
|
|
15203
|
+
host2.state = nextState;
|
|
14822
15204
|
clearCliLocalRuntimePreparedAgentCache();
|
|
14823
|
-
persistAgentSelection2(
|
|
14824
|
-
if (
|
|
14825
|
-
emitCommandOutput(formatAgentSwitchMessage({ name: target.name, dialogId:
|
|
15205
|
+
persistAgentSelection2(host2.state, options.env ?? process.env);
|
|
15206
|
+
if (host2.state.agentKey !== oldKey) persistExplicitAgentSwitch(oldKey);
|
|
15207
|
+
emitCommandOutput(formatAgentSwitchMessage({ name: target.name, dialogId: host2.state.dialogId }));
|
|
14826
15208
|
}
|
|
14827
15209
|
} catch (error) {
|
|
14828
15210
|
emitCommandOutput(`[nolo] Agent switch failed: ${toErrorMessage(error)}`);
|
|
@@ -14832,7 +15214,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14832
15214
|
try {
|
|
14833
15215
|
const pickResult = await dialogHost.run(
|
|
14834
15216
|
(anchor) => runAgentPicker({
|
|
14835
|
-
currentKey:
|
|
15217
|
+
currentKey: host2.state.agentKey,
|
|
14836
15218
|
env: options.env ?? process.env,
|
|
14837
15219
|
input,
|
|
14838
15220
|
output,
|
|
@@ -14844,8 +15226,8 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14844
15226
|
`);
|
|
14845
15227
|
} else if (pickResult.kind === "selected") {
|
|
14846
15228
|
clearCliLocalRuntimePreparedAgentCache();
|
|
14847
|
-
|
|
14848
|
-
...
|
|
15229
|
+
host2.state = {
|
|
15230
|
+
...host2.state,
|
|
14849
15231
|
agentName: pickResult.name,
|
|
14850
15232
|
agentKey: pickResult.key,
|
|
14851
15233
|
contextWindow: resolveAgentContextWindow({
|
|
@@ -14854,13 +15236,13 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14854
15236
|
model: pickResult.model
|
|
14855
15237
|
}),
|
|
14856
15238
|
estimatedContextTokens: estimateDefaultCliContextTokens({
|
|
14857
|
-
cwd:
|
|
15239
|
+
cwd: host2.state.cwd,
|
|
14858
15240
|
agentKey: pickResult.key,
|
|
14859
15241
|
agentName: pickResult.name,
|
|
14860
15242
|
model: pickResult.model,
|
|
14861
|
-
userLanguage:
|
|
15243
|
+
userLanguage: host2.state.userLanguage,
|
|
14862
15244
|
responseViewport: TUI_RESPONSE_VIEWPORT,
|
|
14863
|
-
messages:
|
|
15245
|
+
messages: host2.history.turns
|
|
14864
15246
|
}),
|
|
14865
15247
|
turnTokens: void 0,
|
|
14866
15248
|
lastAuthorityTurnCount: void 0,
|
|
@@ -14868,11 +15250,11 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14868
15250
|
cachedMemoryOverlay: void 0
|
|
14869
15251
|
// 切换 agent 后重新加载记忆
|
|
14870
15252
|
};
|
|
14871
|
-
persistAgentSelection2(
|
|
15253
|
+
persistAgentSelection2(host2.state, options.env ?? process.env);
|
|
14872
15254
|
output.write(
|
|
14873
15255
|
`${formatAgentSwitchMessage({
|
|
14874
15256
|
name: pickResult.name,
|
|
14875
|
-
dialogId:
|
|
15257
|
+
dialogId: host2.state.dialogId
|
|
14876
15258
|
})}
|
|
14877
15259
|
`
|
|
14878
15260
|
);
|
|
@@ -14894,7 +15276,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14894
15276
|
}
|
|
14895
15277
|
}
|
|
14896
15278
|
if (result.action?.type === "set-mouse") {
|
|
14897
|
-
|
|
15279
|
+
host2.fixedInput.setMouseEnabled(result.action.enabled);
|
|
14898
15280
|
}
|
|
14899
15281
|
if (result.action?.type === "set-math") {
|
|
14900
15282
|
setMathRenderingEnabled(result.action.enabled);
|
|
@@ -14908,7 +15290,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14908
15290
|
}
|
|
14909
15291
|
resetHistoryFrameDiffCache(output);
|
|
14910
15292
|
renderHistoryToOutput();
|
|
14911
|
-
|
|
15293
|
+
host2.fixedInput.repaint(host2.buffer, host2.cursorPos);
|
|
14912
15294
|
}
|
|
14913
15295
|
if (result.action?.type === "copy-last") {
|
|
14914
15296
|
const text = readLatestAssistantReply(history) ?? "";
|
|
@@ -14977,8 +15359,8 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14977
15359
|
history.currentContent = "";
|
|
14978
15360
|
history.scrollTop = 0;
|
|
14979
15361
|
history.followBottom = true;
|
|
14980
|
-
|
|
14981
|
-
...
|
|
15362
|
+
host2.state = {
|
|
15363
|
+
...host2.state,
|
|
14982
15364
|
dialogId: pickResult.dialog.id,
|
|
14983
15365
|
dialogKey: pickResult.dialog.dbKey,
|
|
14984
15366
|
dialogLabel: pickResult.dialog.title || pickResult.dialog.id,
|
|
@@ -14994,15 +15376,15 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
14994
15376
|
cachedMemoryOverlay: void 0,
|
|
14995
15377
|
// 切换对话后重新加载记忆
|
|
14996
15378
|
estimatedContextTokens: estimateDefaultCliContextTokens({
|
|
14997
|
-
cwd:
|
|
14998
|
-
agentKey:
|
|
14999
|
-
agentName:
|
|
15000
|
-
userLanguage:
|
|
15379
|
+
cwd: host2.state.cwd,
|
|
15380
|
+
agentKey: host2.state.agentKey,
|
|
15381
|
+
agentName: host2.state.agentName,
|
|
15382
|
+
userLanguage: host2.state.userLanguage,
|
|
15001
15383
|
responseViewport: TUI_RESPONSE_VIEWPORT,
|
|
15002
15384
|
messages: history.turns,
|
|
15003
15385
|
...resolveAgentModelIdentity({
|
|
15004
|
-
agentKey:
|
|
15005
|
-
agentName:
|
|
15386
|
+
agentKey: host2.state.agentKey,
|
|
15387
|
+
agentName: host2.state.agentName
|
|
15006
15388
|
})
|
|
15007
15389
|
})
|
|
15008
15390
|
};
|
|
@@ -15028,7 +15410,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
15028
15410
|
if (result.action?.type === "list-agents") {
|
|
15029
15411
|
try {
|
|
15030
15412
|
const pickResult = await runAgentPicker({
|
|
15031
|
-
currentKey:
|
|
15413
|
+
currentKey: host2.state.agentKey,
|
|
15032
15414
|
env: options.env ?? process.env,
|
|
15033
15415
|
input,
|
|
15034
15416
|
output,
|
|
@@ -15055,7 +15437,7 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
|
|
|
15055
15437
|
const shellInvocation = process.platform === "win32" ? [process.env.ComSpec || "cmd.exe", "/d", "/s", "/c", shellCmd] : ["/bin/sh", "-c", shellCmd];
|
|
15056
15438
|
const proc = spawnRunner({
|
|
15057
15439
|
cmd: shellInvocation,
|
|
15058
|
-
cwd:
|
|
15440
|
+
cwd: host2.state.cwd,
|
|
15059
15441
|
env: options.env ?? process.env,
|
|
15060
15442
|
stdout: "pipe",
|
|
15061
15443
|
stderr: "pipe"
|
|
@@ -15101,13 +15483,13 @@ ${stderrText.trim()}
|
|
|
15101
15483
|
emitCommandOutput(t("mediaPreprocessStart", base));
|
|
15102
15484
|
const transcript = await transcribeMediaFile({
|
|
15103
15485
|
path: result.action.path,
|
|
15104
|
-
serverUrl:
|
|
15486
|
+
serverUrl: host2.state.serverUrl,
|
|
15105
15487
|
authToken,
|
|
15106
15488
|
language: result.action.lang,
|
|
15107
15489
|
fromSec: trim.fromSec,
|
|
15108
15490
|
toSec: trim.toSec,
|
|
15109
15491
|
denoise: result.action.denoise,
|
|
15110
|
-
dialogId:
|
|
15492
|
+
dialogId: host2.state.dialogId,
|
|
15111
15493
|
fetchImpl,
|
|
15112
15494
|
onProgress: (info) => {
|
|
15113
15495
|
const label = info.message ?? info.stage ?? "";
|
|
@@ -15115,10 +15497,10 @@ ${stderrText.trim()}
|
|
|
15115
15497
|
}
|
|
15116
15498
|
});
|
|
15117
15499
|
const block = formatTranscriptForModel(transcript, result.action.path);
|
|
15118
|
-
|
|
15119
|
-
...
|
|
15500
|
+
host2.state = {
|
|
15501
|
+
...host2.state,
|
|
15120
15502
|
pendingTranscripts: [
|
|
15121
|
-
...
|
|
15503
|
+
...host2.state.pendingTranscripts ?? [],
|
|
15122
15504
|
block
|
|
15123
15505
|
]
|
|
15124
15506
|
};
|
|
@@ -15137,16 +15519,28 @@ ${stderrText.trim()}
|
|
|
15137
15519
|
}
|
|
15138
15520
|
}
|
|
15139
15521
|
if (result.action?.type === "login") {
|
|
15140
|
-
const env =
|
|
15522
|
+
const env = host2.options.env ?? process.env;
|
|
15141
15523
|
const outcome = await runTuiLogin(
|
|
15142
15524
|
result.action.args ?? [],
|
|
15143
15525
|
(text) => emitCommandOutput(text)
|
|
15144
15526
|
);
|
|
15145
15527
|
if (outcome.status === "success") {
|
|
15146
15528
|
env.AUTH_TOKEN = outcome.token;
|
|
15147
|
-
|
|
15529
|
+
host2.state = { ...host2.state, showAuthGuidance: false };
|
|
15148
15530
|
}
|
|
15149
15531
|
}
|
|
15532
|
+
if (result.action?.type === "auth") {
|
|
15533
|
+
await runTuiAuth(
|
|
15534
|
+
result.action.args ?? [],
|
|
15535
|
+
(text) => emitCommandOutput(text),
|
|
15536
|
+
{
|
|
15537
|
+
fetchImpl: host2.fetchImpl,
|
|
15538
|
+
dialogHost: host2.dialogHost,
|
|
15539
|
+
input: host2.input,
|
|
15540
|
+
output: host2.output
|
|
15541
|
+
}
|
|
15542
|
+
);
|
|
15543
|
+
}
|
|
15150
15544
|
if (result.action?.type === "chat") {
|
|
15151
15545
|
let messageForModel = result.action.message;
|
|
15152
15546
|
const mediaPaths = result.action.mediaPaths ?? [];
|
|
@@ -15164,9 +15558,9 @@ ${stderrText.trim()}
|
|
|
15164
15558
|
emitCommandOutput(t("mediaPreprocessStart", base));
|
|
15165
15559
|
const transcript = await transcribeMediaFile({
|
|
15166
15560
|
path: mediaPath,
|
|
15167
|
-
serverUrl:
|
|
15561
|
+
serverUrl: host2.state.serverUrl,
|
|
15168
15562
|
authToken,
|
|
15169
|
-
dialogId:
|
|
15563
|
+
dialogId: host2.state.dialogId,
|
|
15170
15564
|
fromSec: trim.fromSec,
|
|
15171
15565
|
toSec: trim.toSec,
|
|
15172
15566
|
fetchImpl,
|
|
@@ -15202,9 +15596,9 @@ ${messageForModel}` : block;
|
|
|
15202
15596
|
for (const path3 of unreadable) {
|
|
15203
15597
|
try {
|
|
15204
15598
|
const image = await readClipboardImage({ env: options.env ?? process.env });
|
|
15205
|
-
|
|
15206
|
-
...
|
|
15207
|
-
attachedImages: mergeAttachedImages(
|
|
15599
|
+
host2.state = {
|
|
15600
|
+
...host2.state,
|
|
15601
|
+
attachedImages: mergeAttachedImages(host2.state.attachedImages, [image])
|
|
15208
15602
|
};
|
|
15209
15603
|
emitCommandOutput(
|
|
15210
15604
|
`[nolo] image attached from clipboard (path unreadable: ${path3})`
|
|
@@ -15223,17 +15617,17 @@ ${messageForModel}` : block;
|
|
|
15223
15617
|
}
|
|
15224
15618
|
const { imageUrls } = await resolveAttachmentImageUrls({
|
|
15225
15619
|
actionImagePaths: result.action.imagePaths,
|
|
15226
|
-
attachedImages:
|
|
15620
|
+
attachedImages: host2.state.attachedImages,
|
|
15227
15621
|
onFailure: (_path, err) => output.write(`[nolo] image skipped: ${err.message}
|
|
15228
15622
|
`)
|
|
15229
15623
|
});
|
|
15230
15624
|
const localAttachmentPaths = [
|
|
15231
15625
|
...result.action.imagePaths ?? [],
|
|
15232
|
-
...
|
|
15626
|
+
...host2.state.attachedImages.map((img) => img.sourcePath),
|
|
15233
15627
|
...result.action.mediaPaths ?? []
|
|
15234
15628
|
];
|
|
15235
|
-
|
|
15236
|
-
...
|
|
15629
|
+
host2.state = {
|
|
15630
|
+
...host2.state,
|
|
15237
15631
|
attachedImages: []
|
|
15238
15632
|
};
|
|
15239
15633
|
history.followBottom = true;
|
|
@@ -15256,7 +15650,7 @@ ${messageForModel}` : block;
|
|
|
15256
15650
|
${err.message}` : ""}`
|
|
15257
15651
|
);
|
|
15258
15652
|
}
|
|
15259
|
-
if (
|
|
15653
|
+
if (host2.fixedInput.active) host2.fixedInput.repaint(host2.buffer, host2.cursorPos);
|
|
15260
15654
|
}
|
|
15261
15655
|
return false;
|
|
15262
15656
|
}
|
|
@@ -16615,6 +17009,19 @@ ${err.message}` : ""}`
|
|
|
16615
17009
|
env.AUTH_TOKEN = outcome.token;
|
|
16616
17010
|
state = { ...state, showAuthGuidance: false };
|
|
16617
17011
|
}
|
|
17012
|
+
} else if (res.action?.type === "auth") {
|
|
17013
|
+
state = res.nextState;
|
|
17014
|
+
await runTuiAuth(res.action.args ?? [], (text) => {
|
|
17015
|
+
output.write(`${text}
|
|
17016
|
+
`);
|
|
17017
|
+
}, {
|
|
17018
|
+
fetchImpl: options.fetchImpl ?? fetch,
|
|
17019
|
+
// 与空闲路径一致:选择器/粘贴码交互要接同一套弹窗宿主与输入输出,
|
|
17020
|
+
// 否则 busy 期间 /auth 会拿不到键盘输入,表现为"卡住没反应"。
|
|
17021
|
+
dialogHost,
|
|
17022
|
+
input,
|
|
17023
|
+
output
|
|
17024
|
+
});
|
|
16618
17025
|
} else if (res.action?.type === "transcribe") {
|
|
16619
17026
|
output.write(
|
|
16620
17027
|
`[nolo] ${t("transcribeBusyHint")}
|
|
@@ -16896,7 +17303,7 @@ ${merged}` : merged;
|
|
|
16896
17303
|
if (busyLock) {
|
|
16897
17304
|
const trimmedText = submittedText.trim();
|
|
16898
17305
|
const busySlashCommand = trimmedText.split(/\s+/)[0]?.toLowerCase();
|
|
16899
|
-
const isBusyLocalSlash = busySlashCommand === "/context" || busySlashCommand === "/ctx" || busySlashCommand === "/cd" || busySlashCommand === "/switch" || busySlashCommand === "/theme" || busySlashCommand === "/runtime" || busySlashCommand === "/logs" || busySlashCommand === "/auto" || busySlashCommand === "/tasks" || busySlashCommand === "/jobs" || busySlashCommand === "/procs" || busySlashCommand === "/agents" || busySlashCommand === "/doc" || busySlashCommand === "/skill" || busySlashCommand === "/customize" || busySlashCommand === "/login" || busySlashCommand === "/profile" || busySlashCommand === "/paste" || busySlashCommand === "/version" || busySlashCommand === "/links" || busySlashCommand === "/transcribe" || busySlashCommand === "/shell-revoke";
|
|
17306
|
+
const isBusyLocalSlash = busySlashCommand === "/context" || busySlashCommand === "/ctx" || busySlashCommand === "/cd" || busySlashCommand === "/switch" || busySlashCommand === "/theme" || busySlashCommand === "/runtime" || busySlashCommand === "/logs" || busySlashCommand === "/auto" || busySlashCommand === "/tasks" || busySlashCommand === "/jobs" || busySlashCommand === "/procs" || busySlashCommand === "/agents" || busySlashCommand === "/doc" || busySlashCommand === "/skill" || busySlashCommand === "/customize" || busySlashCommand === "/login" || busySlashCommand === "/auth" || busySlashCommand === "/profile" || busySlashCommand === "/paste" || busySlashCommand === "/version" || busySlashCommand === "/links" || busySlashCommand === "/transcribe" || busySlashCommand === "/shell-revoke";
|
|
16900
17307
|
if (isBusyLocalSlash) {
|
|
16901
17308
|
await handleBusyLocalSlash(submittedText, busySlashCommand);
|
|
16902
17309
|
return;
|
|
@@ -16937,6 +17344,18 @@ ${merged}` : merged;
|
|
|
16937
17344
|
}
|
|
16938
17345
|
return;
|
|
16939
17346
|
}
|
|
17347
|
+
if (!submittedText.trim() && state.suggestedAuthCommand) {
|
|
17348
|
+
const authCmd = state.suggestedAuthCommand;
|
|
17349
|
+
state = { ...state, suggestedAuthCommand: void 0 };
|
|
17350
|
+
buffer = "";
|
|
17351
|
+
cursorPos = 0;
|
|
17352
|
+
bumpDraftEpoch();
|
|
17353
|
+
await runSubmittedLine(authCmd, host, runOneAgentTurn);
|
|
17354
|
+
return;
|
|
17355
|
+
}
|
|
17356
|
+
if (state.suggestedAuthCommand) {
|
|
17357
|
+
state = { ...state, suggestedAuthCommand: void 0 };
|
|
17358
|
+
}
|
|
16940
17359
|
if (!submittedText.trim() && chatQueueBinding && chatQueueBinding.queueLength() > 0) {
|
|
16941
17360
|
const { actionGateHandler, confirmDestructiveAction } = buildInteractiveTurnHandlers();
|
|
16942
17361
|
const manualBinding = ensureChatQueueBinding(turnCtx, actionGateHandler, confirmDestructiveAction);
|