nolo-cli 0.83.0 → 0.84.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-LUNEV235.js → _executeModel-BPUR2QYH.js} +29 -28
- package/{action-YVYQEAAV.js → action-P4TNFGAD.js} +3 -3
- package/{addContentAction-O7R66HEX.js → addContentAction-MB2HHMDZ.js} +2 -2
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-S2NRBCWW.js} +2 -2
- package/{agentDeleteCommand-2YAHAZFJ.js → agentDeleteCommand-MNAA6MIG.js} +15 -14
- package/{agentEmailCommands-G6A7IRPQ.js → agentEmailCommands-SK34WJKU.js} +37 -36
- package/{agentListCommands-KMS675GZ.js → agentListCommands-I26MKI4T.js} +31 -19
- package/{agentMachineCommands-W2SMNSQ3.js → agentMachineCommands-M6QDR6P3.js} +15 -14
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-X3UNW77C.js} +1 -1
- package/{agentRecordCommands-D7BRMFNI.js → agentRecordCommands-HTHLO2MM.js} +36 -35
- package/{agentRunCommand-VL6MMEUB.js → agentRunCommand-IAIRCMTH.js} +38 -36
- package/{agentRuntimeLocal-VXZSDIGT.js → agentRuntimeLocal-3WTYYIT2.js} +16 -11
- package/{agentSlice-5YJHUO47.js → agentSlice-TVP3HINW.js} +2 -2
- package/{appDeleteCommands-32MHLR4L.js → appDeleteCommands-SB5TNLKY.js} +16 -15
- package/{appDeployCommands-WCQOUSOB.js → appDeployCommands-2IPKZINV.js} +16 -15
- package/{appDeployStatusCommands-6QKB7DYN.js → appDeployStatusCommands-K63TFUID.js} +16 -15
- package/{appGetCommands-SFAPP5PB.js → appGetCommands-VU2SLNEH.js} +16 -15
- package/{appListCommands-EKUBDRUO.js → appListCommands-S3T4DJ36.js} +16 -15
- package/{authCommand-F4EFRRX6.js → authCommand-HGP2XTKC.js} +100 -8
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-Q2VVY3SC.js} +2 -2
- package/{chatQueueReduxAdapter-PQMRR2PK.js → chatQueueReduxAdapter-TWIYKVIZ.js} +9 -9
- package/{chunk-Z77CRGTW.js → chunk-3AMA42ZI.js} +1 -1
- package/{chunk-5FBTLSFG.js → chunk-3BGIKIPF.js} +317 -153
- package/{chunk-ORYWEJO4.js → chunk-3IUWIAHP.js} +3 -3
- package/{chunk-Q2XN3EOZ.js → chunk-3VUWPRFW.js} +17 -7
- package/{chunk-GEPUP7OO.js → chunk-3YIAR5UI.js} +1 -1
- package/{chunk-5H7KJX7J.js → chunk-4MK3I7Y4.js} +1 -1
- package/{chunk-6VFARHZW.js → chunk-52Q2IW2X.js} +783 -999
- package/{chunk-6Q33GUCC.js → chunk-5MEYHVIB.js} +1 -1
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-FZGV4FGK.js → chunk-6GFOD3TK.js} +260 -140
- package/{chunk-HJUYAD4A.js → chunk-6Z7MY3V7.js} +1 -1
- package/{chunk-V4MJDUSR.js → chunk-AHAHBQMU.js} +1 -1
- package/{chunk-TOP2VXOR.js → chunk-BFDFRLLQ.js} +2 -2
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-RG6JBBX5.js → chunk-CWQINZEA.js} +119 -3
- package/{chunk-BTI7PJDX.js → chunk-DD6XE56O.js} +12 -65
- package/{chunk-ETI2NYVF.js → chunk-FKNWP6SG.js} +1 -1
- package/{chunk-SSDAAEC2.js → chunk-FP76KI2Y.js} +280 -40
- package/chunk-FV3JEYR3.js +870 -0
- package/{chunk-DHDMC6FO.js → chunk-GIVFXPWK.js} +2 -0
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-UZGQNTVW.js → chunk-GNCCNNZD.js} +3 -1
- package/{chunk-AFUORTY4.js → chunk-GP5LKBUZ.js} +1 -1
- package/{chunk-ZCYXJSTU.js → chunk-H4AHY5BU.js} +4 -81
- package/{chunk-OEVAY4J6.js → chunk-HAFJ3NDE.js} +2 -2
- package/{chunk-IIVGDG4I.js → chunk-HCT7U36O.js} +3 -0
- package/{chunk-4OEFYTWL.js → chunk-HKNXJGEC.js} +1 -1
- package/{chunk-VLTIYV3X.js → chunk-HYJFRTLW.js} +1 -1
- package/{chunk-NA35QHCF.js → chunk-K36IXSCQ.js} +1 -1
- package/{chunk-DRGSDQBL.js → chunk-KAUSRTO6.js} +2 -2
- package/{chunk-GPCZ7UXG.js → chunk-LJ5VW2UJ.js} +1 -1
- package/{chunk-YFE4A4O7.js → chunk-LMREEBWT.js} +120 -37
- package/{chunk-JRQFUXY7.js → chunk-LVIFM7VW.js} +1 -1
- package/{chunk-RFCKMYDK.js → chunk-MZYBSTMH.js} +4 -4
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-DNCEALKX.js → chunk-P5EVSOPA.js} +2 -2
- package/{chunk-BP4XNZRM.js → chunk-PBA4UJBK.js} +1 -1
- package/{chunk-G2O6V3HJ.js → chunk-PMAIQX7A.js} +3 -3
- package/{chunk-AEOE4Z6Q.js → chunk-QSHEEA5N.js} +2 -2
- package/{chunk-KQ4ONNQD.js → chunk-QU7KDSZX.js} +1 -1
- package/{chunk-45C5ER5U.js → chunk-RPJUFEGR.js} +4 -4
- package/{chunk-X6DN5HBD.js → chunk-U4OKDZFH.js} +3 -3
- package/{chunk-4S5QUMJP.js → chunk-UDVH2P4A.js} +4 -4
- package/{chunk-UKZDAFYT.js → chunk-UEVXFHQB.js} +2 -2
- package/{chunk-H62HCIUP.js → chunk-VRTTFDBM.js} +2 -1
- package/{chunk-6IG4XSS6.js → chunk-WP5UXDA5.js} +71 -4
- package/{chunk-3DII57IT.js → chunk-XD2MJFUG.js} +1 -1
- package/{chunk-QVKRR2SS.js → chunk-XP3VVAPG.js} +878 -175
- package/{chunk-L5UXH3B2.js → chunk-Z2PV6O2T.js} +18 -2
- package/{chunk-53HEEOTT.js → chunk-Z5625XML.js} +1 -1
- package/{contentThunks-GJV22WVZ.js → contentThunks-JYWI7G7I.js} +10 -10
- package/{createAgentAutomationAction-6V25TZEO.js → createAgentAutomationAction-Z4SUJ54Y.js} +10 -10
- package/{createDialogAction-SX36BGSX.js → createDialogAction-RCHFLVJ2.js} +12 -12
- package/{createPageAction-IR4BGJSI.js → createPageAction-YK2253XQ.js} +11 -11
- package/{dbSlice-XVWBAGYN.js → dbSlice-A6C6H32X.js} +1 -1
- package/{dialogCommands-5J56DFWN.js → dialogCommands-X4UOZQWX.js} +16 -15
- package/{dialogSlice-UNX2FAPZ.js → dialogSlice-IVTWLCE2.js} +15 -9
- package/{docCreateCommands-KYI2DC2U.js → docCreateCommands-VD6TGHG4.js} +15 -14
- package/{docDeleteCommands-67REUSRY.js → docDeleteCommands-OT3R2G4W.js} +16 -15
- package/{docReadCommands-HOSVSBDJ.js → docReadCommands-2G7BIXSH.js} +15 -14
- package/{docStore-JWVG5NDO.js → docStore-UENKCCDX.js} +2 -2
- package/{docUpdateCommands-EMGCSMXY.js → docUpdateCommands-45MVJKZA.js} +15 -14
- package/{handleSendMessageAction-B75UOJKF.js → handleSendMessageAction-LM2J4HC3.js} +50 -58
- package/index.js +51 -51
- package/{machineCommands-GFPTOY6L.js → machineCommands-6N6MQIE6.js} +38 -37
- package/{machineWsRunDispatch-46PSZ3DJ.js → machineWsRunDispatch-7MFKVQCR.js} +35 -34
- package/{memberThunks-QGFLFVCI.js → memberThunks-P2ECUJ56.js} +2 -2
- package/package.json +1 -1
- package/pdf-U6KSUEZZ.js +26435 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-XI3WUPTI.js} +2 -2
- package/{providerRegistry-757OWH3O.js → providerRegistry-KEPWWGXD.js} +2 -2
- package/{readlineWorkspace-UFSWHFKD.js → readlineWorkspace-JWBON5CX.js} +184 -63
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-W66BJ7CF.js} +4 -4
- package/{runAgentClientLoop-25LJ4XGV.js → runAgentClientLoop-TA4SSPHE.js} +26 -26
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-2ALKG3WA.js} +3 -3
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-TQZB55F6.js} +4 -4
- package/{settingSlice-ZQZVUPKK.js → settingSlice-P4ZW7K5X.js} +2 -2
- package/{spaceCommands-NKJVJCQQ.js → spaceCommands-6NSAXB7D.js} +15 -14
- package/{streamAgentChatTurn-A46QFV4O.js → streamAgentChatTurn-X5ENGUIS.js} +94 -34
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-3KI72HHS.js} +2 -2
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-G3M73RTB.js} +2 -2
- package/{tools-TTDGRNY6.js → tools-XRQR7ZZR.js} +23 -23
- package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-UFGFOIIW.js} +5 -4
- package/{updateDialogTitleAction-QJPZGF52.js → updateDialogTitleAction-ESUUD3GT.js} +10 -10
- package/chunk-Q5FJJ6XI.js +0 -103
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
resolveServerUrl,
|
|
11
11
|
writeUsage
|
|
12
12
|
} from "./chunk-V7E4PXQD.js";
|
|
13
|
+
import {
|
|
14
|
+
resolveMachineId
|
|
15
|
+
} from "./chunk-ESHYE7WU.js";
|
|
13
16
|
import {
|
|
14
17
|
agentRunCardLabels,
|
|
15
18
|
createCliLocalRuntimeAdapter,
|
|
@@ -26,8 +29,9 @@ import {
|
|
|
26
29
|
resolveFileWriteGateEnabled,
|
|
27
30
|
resolveLocalUserId,
|
|
28
31
|
t,
|
|
29
|
-
toolLabel
|
|
30
|
-
|
|
32
|
+
toolLabel,
|
|
33
|
+
toolLabelVariants
|
|
34
|
+
} from "./chunk-LMREEBWT.js";
|
|
31
35
|
import {
|
|
32
36
|
createRunActivityTracker,
|
|
33
37
|
popSingleQueueMessage,
|
|
@@ -48,23 +52,20 @@ import {
|
|
|
48
52
|
import {
|
|
49
53
|
readDbRecord,
|
|
50
54
|
resolveAgentRecordFromHybridStore
|
|
51
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-QSHEEA5N.js";
|
|
52
56
|
import {
|
|
53
57
|
isLocalCliAgentKey
|
|
54
58
|
} from "./chunk-SV5IJK6K.js";
|
|
55
59
|
import {
|
|
56
60
|
CliProviderQuotaError
|
|
57
61
|
} from "./chunk-MP64VFGD.js";
|
|
58
|
-
import {
|
|
59
|
-
resolveMachineId
|
|
60
|
-
} from "./chunk-ESHYE7WU.js";
|
|
61
62
|
import {
|
|
62
63
|
applyModelLayerOverride,
|
|
63
64
|
buildModelLayerOverride
|
|
64
65
|
} from "./chunk-LTRXGFMS.js";
|
|
65
66
|
import {
|
|
66
67
|
formatAgentListCard
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-3BGIKIPF.js";
|
|
68
69
|
import {
|
|
69
70
|
isTransientFetchError
|
|
70
71
|
} from "./chunk-5UTFL4QJ.js";
|
|
@@ -80,16 +81,19 @@ import {
|
|
|
80
81
|
formatStopRunCard,
|
|
81
82
|
isAgentRunTerminalStatus
|
|
82
83
|
} from "./chunk-3VNWWVKB.js";
|
|
84
|
+
import {
|
|
85
|
+
extractGoogleValidationLink
|
|
86
|
+
} from "./chunk-BMQ2MJUK.js";
|
|
83
87
|
import {
|
|
84
88
|
buildMemorySubjectsForAgent,
|
|
85
89
|
chooseMemoryOwners,
|
|
86
90
|
loadMemoryCandidatesFromDb,
|
|
87
91
|
resolveAgentMemoryPolicy
|
|
88
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-MZYBSTMH.js";
|
|
89
93
|
import {
|
|
90
94
|
API_REPORTED_COST_MULTIPLIER,
|
|
91
95
|
parseUiAskChoiceContent
|
|
92
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-XP3VVAPG.js";
|
|
93
97
|
import {
|
|
94
98
|
isOAuthApiKeyRef
|
|
95
99
|
} from "./chunk-YYLHWIW6.js";
|
|
@@ -112,10 +116,10 @@ import {
|
|
|
112
116
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
113
117
|
LOCAL_TURN_ABORTED_CODE,
|
|
114
118
|
readActionGate
|
|
115
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-52Q2IW2X.js";
|
|
116
120
|
import {
|
|
117
121
|
resolveAgentRuntimeConfigFromRecord
|
|
118
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-4MK3I7Y4.js";
|
|
119
123
|
import {
|
|
120
124
|
createThinkParserState,
|
|
121
125
|
flushThinkParser,
|
|
@@ -130,7 +134,7 @@ import {
|
|
|
130
134
|
} from "./chunk-FDTR4QJ6.js";
|
|
131
135
|
import {
|
|
132
136
|
isAntigravityOAuthAgent
|
|
133
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-GNCCNNZD.js";
|
|
134
138
|
import {
|
|
135
139
|
resolveClientVersion
|
|
136
140
|
} from "./chunk-6OZ36FXI.js";
|
|
@@ -138,10 +142,10 @@ import {
|
|
|
138
142
|
DEFAULT_CONTEXT_WINDOW,
|
|
139
143
|
getModelContextWindow,
|
|
140
144
|
normalizeUsage
|
|
141
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-HKNXJGEC.js";
|
|
142
146
|
import {
|
|
143
147
|
clipCompactText
|
|
144
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-P5EVSOPA.js";
|
|
145
149
|
import {
|
|
146
150
|
findModelConfig
|
|
147
151
|
} from "./chunk-OIVSQH2O.js";
|
|
@@ -386,6 +390,24 @@ function styleCliText(text, style, enabled = resolveCliColorEnabled()) {
|
|
|
386
390
|
function dimCliText(text, enabled = resolveCliColorEnabled()) {
|
|
387
391
|
return styleCliText(text, "dim", enabled);
|
|
388
392
|
}
|
|
393
|
+
var OSC8_OPEN = "\x1B]8;;";
|
|
394
|
+
var OSC8_CLOSE = "\x1B\\";
|
|
395
|
+
function sanitizeHyperlinkLabel(label) {
|
|
396
|
+
return label.replace(/[\u0000-\u001f\u007f]/g, "");
|
|
397
|
+
}
|
|
398
|
+
function resolveCliHyperlinkEnabled(env = process.env, isTTY = Boolean(process.stdout.isTTY)) {
|
|
399
|
+
const setting = asTrimmedLowercaseString(env.NOLO_CLI_HYPERLINKS);
|
|
400
|
+
if (setting === "0" || setting === "false" || setting === "off") return false;
|
|
401
|
+
if (setting === "1" || setting === "true" || setting === "on") return true;
|
|
402
|
+
return isTTY;
|
|
403
|
+
}
|
|
404
|
+
function formatCliHyperlink(url, label, enabled = resolveCliHyperlinkEnabled()) {
|
|
405
|
+
if (!url) return label;
|
|
406
|
+
const safeLabel = sanitizeHyperlinkLabel(label);
|
|
407
|
+
if (!enabled) return `${safeLabel} (${url})`;
|
|
408
|
+
if (!safeLabel) return url;
|
|
409
|
+
return `${OSC8_OPEN}${url}${OSC8_CLOSE}${safeLabel}${OSC8_OPEN}${OSC8_CLOSE}`;
|
|
410
|
+
}
|
|
389
411
|
|
|
390
412
|
// node_modules/ansi-regex/index.js
|
|
391
413
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
@@ -620,8 +642,12 @@ function stringWidth(input, options = {}) {
|
|
|
620
642
|
|
|
621
643
|
// packages/cli/tui/tuiAnsi.ts
|
|
622
644
|
var ANSI_ESCAPE_REGEX = /\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g;
|
|
645
|
+
var OSC8_HYPERLINK_REGEX = /\x1b\]8;;[^\x1b]*\x1b\\/g;
|
|
623
646
|
var ALL_ANSI_ESCAPE_REGEX = ansiRegex();
|
|
624
647
|
var FIRST_ANSI_ESCAPE_REGEX = ansiRegex({ onlyFirst: true });
|
|
648
|
+
function stripOsc8Hyperlinks(text) {
|
|
649
|
+
return text.replace(OSC8_HYPERLINK_REGEX, "");
|
|
650
|
+
}
|
|
625
651
|
function stripAnsi2(text) {
|
|
626
652
|
return text.replace(ANSI_ESCAPE_REGEX, "").replace(ALL_ANSI_ESCAPE_REGEX, "");
|
|
627
653
|
}
|
|
@@ -783,6 +809,7 @@ function visibleWidth(str) {
|
|
|
783
809
|
}
|
|
784
810
|
function truncateAnsi(text, maxWidth) {
|
|
785
811
|
if (maxWidth <= 0) return "";
|
|
812
|
+
text = stripOsc8Hyperlinks(text);
|
|
786
813
|
if (visibleWidth(text) <= maxWidth) return text;
|
|
787
814
|
let width = 0;
|
|
788
815
|
let out = "";
|
|
@@ -823,7 +850,7 @@ function countPhysicalLines(text, columns) {
|
|
|
823
850
|
const lines = text.split("\n");
|
|
824
851
|
let total = 0;
|
|
825
852
|
for (const line of lines) {
|
|
826
|
-
const width =
|
|
853
|
+
const width = visibleWidth(stripOsc8Hyperlinks(line));
|
|
827
854
|
total += Math.max(1, Math.ceil(width / columns));
|
|
828
855
|
}
|
|
829
856
|
return Math.max(total, 1);
|
|
@@ -8196,12 +8223,79 @@ function normalizeListLine(line) {
|
|
|
8196
8223
|
}
|
|
8197
8224
|
return line;
|
|
8198
8225
|
}
|
|
8226
|
+
var TOOL_TREE_HEADER_RE = /^•\s+(.+?)\s+\((\d+)\)$/;
|
|
8227
|
+
var TOOL_TREE_LEAF_RE = /^([├└]──\s+)(.*?)\s{2}(✓|✗|!)(?:\s+(.*))?$/;
|
|
8228
|
+
var TOOL_SINGLE_RE = /^▸\s+(.+?)(?:\s+·\s+(.*?))?(?:\s{2}(✓|✗|!)(?:\s+(.*))?)$/;
|
|
8229
|
+
function plainToolLine(line) {
|
|
8230
|
+
return stripAnsi2(line);
|
|
8231
|
+
}
|
|
8232
|
+
var TOOL_TREE_GROUP_LABELS = new Set(
|
|
8233
|
+
["execShell", "readFile", "fetchWebpage", "exa_search"].flatMap(toolLabelVariants)
|
|
8234
|
+
);
|
|
8235
|
+
function isKnownToolGroupLabel(label) {
|
|
8236
|
+
return TOOL_TREE_GROUP_LABELS.has(label);
|
|
8237
|
+
}
|
|
8238
|
+
function toolTreeHeaderMatch(line) {
|
|
8239
|
+
const match = plainToolLine(line).match(TOOL_TREE_HEADER_RE);
|
|
8240
|
+
return match && isKnownToolGroupLabel(match[1]) ? match : null;
|
|
8241
|
+
}
|
|
8242
|
+
function isToolTreeHeaderLine(line) {
|
|
8243
|
+
return toolTreeHeaderMatch(line) !== null;
|
|
8244
|
+
}
|
|
8245
|
+
function isToolTreeLeafLine(line) {
|
|
8246
|
+
return TOOL_TREE_LEAF_RE.test(plainToolLine(line));
|
|
8247
|
+
}
|
|
8248
|
+
function isToolSingleLine(line) {
|
|
8249
|
+
return TOOL_SINGLE_RE.test(plainToolLine(line));
|
|
8250
|
+
}
|
|
8251
|
+
function isToolGroupBoundary(cur, next) {
|
|
8252
|
+
return isToolTreeLeafLine(cur) && isToolTreeHeaderLine(next);
|
|
8253
|
+
}
|
|
8254
|
+
function statusColorSeq(marker, brightness) {
|
|
8255
|
+
if (marker === "\u2713") return colorSeq("success", brightness);
|
|
8256
|
+
if (marker === "\u2717") return colorSeq("danger", brightness);
|
|
8257
|
+
return colorSeq("warning", brightness);
|
|
8258
|
+
}
|
|
8259
|
+
function styleTuiToolLine(line, brightness) {
|
|
8260
|
+
const plain = plainToolLine(line);
|
|
8261
|
+
const chrome = colorSeq("chrome", brightness);
|
|
8262
|
+
const muted = colorSeq("muted", brightness);
|
|
8263
|
+
const header = toolTreeHeaderMatch(plain);
|
|
8264
|
+
if (header) {
|
|
8265
|
+
return `${chrome}\u2022${STYLE.reset} ${STYLE.bold}${muted}${header[1]}${STYLE.reset} ${chrome}${STYLE.dim}(${header[2]})${STYLE.reset}`;
|
|
8266
|
+
}
|
|
8267
|
+
const leaf = plain.match(TOOL_TREE_LEAF_RE);
|
|
8268
|
+
if (leaf) {
|
|
8269
|
+
const [, connector, detail, marker, statusDetail] = leaf;
|
|
8270
|
+
let rendered = `${chrome}${connector}${STYLE.reset}${chrome}${detail}${STYLE.reset}`;
|
|
8271
|
+
rendered += ` ${statusColorSeq(marker, brightness)}${marker}${STYLE.reset}`;
|
|
8272
|
+
if (statusDetail) {
|
|
8273
|
+
const metaSeq = marker === "\u2713" ? chrome : statusColorSeq(marker, brightness);
|
|
8274
|
+
rendered += ` ${metaSeq}${STYLE.dim}${statusDetail}${STYLE.reset}`;
|
|
8275
|
+
}
|
|
8276
|
+
return rendered;
|
|
8277
|
+
}
|
|
8278
|
+
const single = plain.match(TOOL_SINGLE_RE);
|
|
8279
|
+
if (single) {
|
|
8280
|
+
const [, label, detail, marker, statusDetail] = single;
|
|
8281
|
+
let rendered = `${chrome}\u25B8${STYLE.reset} ${STYLE.bold}${muted}${label}${STYLE.reset}`;
|
|
8282
|
+
if (detail) rendered += ` ${chrome}\xB7 ${detail}${STYLE.reset}`;
|
|
8283
|
+
rendered += ` ${statusColorSeq(marker, brightness)}${marker}${STYLE.reset}`;
|
|
8284
|
+
if (statusDetail) {
|
|
8285
|
+
const metaSeq = marker === "\u2713" ? chrome : statusColorSeq(marker, brightness);
|
|
8286
|
+
rendered += ` ${metaSeq}${STYLE.dim}${statusDetail}${STYLE.reset}`;
|
|
8287
|
+
}
|
|
8288
|
+
return rendered;
|
|
8289
|
+
}
|
|
8290
|
+
return null;
|
|
8291
|
+
}
|
|
8199
8292
|
function isPolishListLikeLine(line) {
|
|
8200
|
-
return LIST_LIKE_RE_FOR_GUARD.test(normalizeListLine(line));
|
|
8293
|
+
return LIST_LIKE_RE_FOR_GUARD.test(normalizeListLine(plainToolLine(line)));
|
|
8201
8294
|
}
|
|
8202
|
-
var LIST_LIKE_RE_FOR_GUARD = /^\s*(?:•|☐|☑|\d+\.)\s|^\s*[\u2460-\u2473]|^\s*[├└]──\s/;
|
|
8295
|
+
var LIST_LIKE_RE_FOR_GUARD = /^\s*(?:•|☐|☑|\d+\.)\s|^\s*[\u2460-\u2473]|^\s*[├└]──\s|^\s*▸\s/;
|
|
8203
8296
|
function polishBreathInsertsBlankBetween(cur, next) {
|
|
8204
8297
|
if (cur === "" || next === "") return false;
|
|
8298
|
+
if (isToolGroupBoundary(cur, next)) return true;
|
|
8205
8299
|
return isPolishListLikeLine(cur) !== isPolishListLikeLine(next);
|
|
8206
8300
|
}
|
|
8207
8301
|
function convertMarkdownTablesForTerminal(text) {
|
|
@@ -8271,16 +8365,14 @@ function polishAssistantStructure(text, options = {}) {
|
|
|
8271
8365
|
return line;
|
|
8272
8366
|
});
|
|
8273
8367
|
const afterHeading = maskedLines.join("\n").replace(/([^\n])\n(#{1,3} )/g, "$1\n\n$2").replace(/^(#{1,3} .+)\n(?!\n)/gm, "$1\n\n").replace(/\n{4,}/g, "\n\n\n");
|
|
8274
|
-
const LIST_LIKE = /^\s*(?:•|☐|☑|\d+\.)\s|^\s*[\u2460-\u2473]|^\s*[├└]──\s/;
|
|
8275
8368
|
const headingLines = afterHeading.split("\n");
|
|
8276
8369
|
const breathed = [];
|
|
8277
8370
|
for (let i = 0; i < headingLines.length; i++) {
|
|
8278
8371
|
breathed.push(headingLines[i]);
|
|
8279
8372
|
const cur = headingLines[i];
|
|
8280
8373
|
const next = headingLines[i + 1];
|
|
8281
|
-
if (
|
|
8282
|
-
if (
|
|
8283
|
-
breathed.push("");
|
|
8374
|
+
if (next === void 0) continue;
|
|
8375
|
+
if (polishBreathInsertsBlankBetween(cur, next)) breathed.push("");
|
|
8284
8376
|
}
|
|
8285
8377
|
const polishedMasked = breathed.join("\n");
|
|
8286
8378
|
const polished = polishedMasked.replace(
|
|
@@ -8290,6 +8382,8 @@ function polishAssistantStructure(text, options = {}) {
|
|
|
8290
8382
|
return options.trimEdges === false ? polished : polished.trim();
|
|
8291
8383
|
}
|
|
8292
8384
|
function styleRichMarkdownLine(line, brightness) {
|
|
8385
|
+
const toolLine = styleTuiToolLine(line, brightness);
|
|
8386
|
+
if (toolLine !== null) return toolLine;
|
|
8293
8387
|
const heading = line.match(/^(#{1,3})\s+(.+)$/);
|
|
8294
8388
|
if (heading) {
|
|
8295
8389
|
const level = heading[1].length;
|
|
@@ -8441,16 +8535,23 @@ function emitFormattedAssistantBlock(write, text, trailingNewline = false) {
|
|
|
8441
8535
|
}
|
|
8442
8536
|
function classifyStreamLine(line) {
|
|
8443
8537
|
if (line === "") return "blank";
|
|
8444
|
-
|
|
8538
|
+
const plain = plainToolLine(line);
|
|
8539
|
+
if (isToolTreeHeaderLine(plain)) return "tool-header";
|
|
8540
|
+
if (isToolTreeLeafLine(plain)) return "tool-leaf";
|
|
8541
|
+
if (isToolSingleLine(plain)) return "tool";
|
|
8542
|
+
if (TASK_LIST_RE.test(plain) || UNORDERED_LIST_RE.test(plain) || ORDERED_LIST_RE.test(plain) || /^\s*(?:•|☐|☑)\s/.test(plain) || /^\s*[\u2460-\u2473]/.test(plain)) {
|
|
8445
8543
|
return "list";
|
|
8446
8544
|
}
|
|
8545
|
+
if (isPolishListLikeLine(plain)) return "list";
|
|
8447
8546
|
return "prose";
|
|
8448
8547
|
}
|
|
8548
|
+
function isStreamListLike(kind) {
|
|
8549
|
+
return kind === "list" || kind === "tool-header" || kind === "tool-leaf" || kind === "tool";
|
|
8550
|
+
}
|
|
8449
8551
|
function needsListProseBreath(prev, next) {
|
|
8450
8552
|
if (prev === null || prev === "blank" || next === "blank") return false;
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
return prevList !== nextList;
|
|
8553
|
+
if (prev === "tool-leaf" && next === "tool-header") return true;
|
|
8554
|
+
return isStreamListLike(prev) !== isStreamListLike(next);
|
|
8454
8555
|
}
|
|
8455
8556
|
function createRenderAwareStreamWriter(args) {
|
|
8456
8557
|
const brightness = resolveTuiBrightness();
|
|
@@ -9808,6 +9909,7 @@ ${this.text}
|
|
|
9808
9909
|
// packages/cli/client/agentRunOutput.ts
|
|
9809
9910
|
var IDENTITY_LABEL_SEPARATOR = " > ";
|
|
9810
9911
|
var THINKING_PREVIEW_BUFFER_LIMIT = 512;
|
|
9912
|
+
var TUI_PROGRESS_BUFFER_LIMIT = 1200;
|
|
9811
9913
|
function appendThinkingPreview(current, chunk, limit = THINKING_PREVIEW_BUFFER_LIMIT) {
|
|
9812
9914
|
if (limit <= 0) return "";
|
|
9813
9915
|
const combined = current + chunk;
|
|
@@ -9869,6 +9971,14 @@ function formatToolJsonEvent(event) {
|
|
|
9869
9971
|
})}
|
|
9870
9972
|
`;
|
|
9871
9973
|
}
|
|
9974
|
+
function shouldPromoteTuiNarration(text) {
|
|
9975
|
+
if (text.length >= TUI_PROGRESS_BUFFER_LIMIT) return true;
|
|
9976
|
+
return /(^|\n)\s*(?:#{1,3}\s|```|[-*+]\s|\d+[.)]\s)/.test(text);
|
|
9977
|
+
}
|
|
9978
|
+
function narrationActivityLabel(text) {
|
|
9979
|
+
const oneLine = stripAnsi2(text).replace(/[`*_#>]/g, "").replace(/\s+/g, " ").trim();
|
|
9980
|
+
return truncateThinkingHint(oneLine, 60);
|
|
9981
|
+
}
|
|
9872
9982
|
function createCliTurnOutput(params) {
|
|
9873
9983
|
const { options } = params;
|
|
9874
9984
|
const workingLabel = params.workingLabel ?? `${options.agentName} -> working`;
|
|
@@ -9877,7 +9987,8 @@ function createCliTurnOutput(params) {
|
|
|
9877
9987
|
tuiTrees: options.output.tuiTrees === true
|
|
9878
9988
|
});
|
|
9879
9989
|
const eventMode = resolveAgentEventMode(options);
|
|
9880
|
-
const
|
|
9990
|
+
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
9991
|
+
const showThinking = !assistantLabelManaged && options.showThinking !== false;
|
|
9881
9992
|
let streamedAssistantText = false;
|
|
9882
9993
|
let everStreamedAnyText = false;
|
|
9883
9994
|
let printedAssistantLabel = false;
|
|
@@ -9914,7 +10025,6 @@ function createCliTurnOutput(params) {
|
|
|
9914
10025
|
}
|
|
9915
10026
|
};
|
|
9916
10027
|
let compactionEvent = null;
|
|
9917
|
-
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
9918
10028
|
const writeToolOutput = (chunk) => {
|
|
9919
10029
|
if (!chunk) return;
|
|
9920
10030
|
if (typeof options.output.writeToolBlock === "function") {
|
|
@@ -9926,9 +10036,25 @@ function createCliTurnOutput(params) {
|
|
|
9926
10036
|
const renderWriter = createRenderAwareStreamWriter({
|
|
9927
10037
|
write: (chunk) => options.output.write(chunk)
|
|
9928
10038
|
});
|
|
10039
|
+
let pendingTuiNarration = "";
|
|
10040
|
+
let tuiNarrationPromoted = false;
|
|
10041
|
+
const flushPendingTuiNarration = () => {
|
|
10042
|
+
if (!pendingTuiNarration) return;
|
|
10043
|
+
formatToolEvent.reset?.();
|
|
10044
|
+
renderWriter.push(pendingTuiNarration);
|
|
10045
|
+
pendingTuiNarration = "";
|
|
10046
|
+
tuiNarrationPromoted = true;
|
|
10047
|
+
streamedAssistantText = true;
|
|
10048
|
+
options.activityReporter?.(null);
|
|
10049
|
+
};
|
|
10050
|
+
const dropPendingTuiProgress = () => {
|
|
10051
|
+
pendingTuiNarration = "";
|
|
10052
|
+
tuiNarrationPromoted = false;
|
|
10053
|
+
options.activityReporter?.(null);
|
|
10054
|
+
};
|
|
9929
10055
|
const writeVisibleAssistantChunk = (chunk) => {
|
|
9930
10056
|
if (!chunk) return;
|
|
9931
|
-
formatToolEvent.reset?.();
|
|
10057
|
+
if (!assistantLabelManaged) formatToolEvent.reset?.();
|
|
9932
10058
|
const parsed = processThinkChunk(chunk, thinkState);
|
|
9933
10059
|
thinkState = parsed.state;
|
|
9934
10060
|
if (!parsed.content && !parsed.reasoning) return;
|
|
@@ -9944,8 +10070,23 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9944
10070
|
}
|
|
9945
10071
|
printedAssistantLabel = true;
|
|
9946
10072
|
}
|
|
9947
|
-
streamedAssistantText = true;
|
|
9948
10073
|
everStreamedAnyText = true;
|
|
10074
|
+
if (assistantLabelManaged) {
|
|
10075
|
+
if (tuiNarrationPromoted) {
|
|
10076
|
+
renderWriter.push(parsed.content);
|
|
10077
|
+
streamedAssistantText = true;
|
|
10078
|
+
return;
|
|
10079
|
+
}
|
|
10080
|
+
pendingTuiNarration += parsed.content;
|
|
10081
|
+
if (shouldPromoteTuiNarration(pendingTuiNarration)) {
|
|
10082
|
+
flushPendingTuiNarration();
|
|
10083
|
+
} else {
|
|
10084
|
+
const label = narrationActivityLabel(pendingTuiNarration);
|
|
10085
|
+
if (label) options.activityReporter?.(label);
|
|
10086
|
+
}
|
|
10087
|
+
return;
|
|
10088
|
+
}
|
|
10089
|
+
streamedAssistantText = true;
|
|
9949
10090
|
renderWriter.push(parsed.content);
|
|
9950
10091
|
};
|
|
9951
10092
|
const handleToolEvent = (event) => {
|
|
@@ -9961,6 +10102,9 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9961
10102
|
return;
|
|
9962
10103
|
}
|
|
9963
10104
|
if (event.type === "tool-call") {
|
|
10105
|
+
if (assistantLabelManaged && pendingTuiNarration) {
|
|
10106
|
+
dropPendingTuiProgress();
|
|
10107
|
+
}
|
|
9964
10108
|
renderWriter.flush();
|
|
9965
10109
|
formatToolEvent(event);
|
|
9966
10110
|
endThinkingPhase();
|
|
@@ -9968,6 +10112,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9968
10112
|
options.output.write("\n");
|
|
9969
10113
|
streamedAssistantText = false;
|
|
9970
10114
|
}
|
|
10115
|
+
if (assistantLabelManaged) tuiNarrationPromoted = false;
|
|
9971
10116
|
const activeLabel = formatConservativeActiveToolLabel(event);
|
|
9972
10117
|
spinner.show(activeLabel);
|
|
9973
10118
|
options.activityReporter?.(activeLabel);
|
|
@@ -9991,6 +10136,26 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9991
10136
|
return {
|
|
9992
10137
|
spinner,
|
|
9993
10138
|
eventMode,
|
|
10139
|
+
/**
|
|
10140
|
+
* Terminal cleanup for abort/error paths that never reach `finish()`.
|
|
10141
|
+
*
|
|
10142
|
+
* A user abort discards the transient TUI progress buffer: the user stopped
|
|
10143
|
+
* on purpose and the dock already showed that text as activity. A genuine
|
|
10144
|
+
* failure must not swallow prose that never got the chance to be *proven*
|
|
10145
|
+
* durable (only a following tool call proves "progress"), so it promotes the
|
|
10146
|
+
* pending buffer and flushes what was already promoted — otherwise a short
|
|
10147
|
+
* final answer followed by a transport error disappears from the transcript.
|
|
10148
|
+
*/
|
|
10149
|
+
cancel(cleanup) {
|
|
10150
|
+
if (assistantLabelManaged && cleanup?.preservePendingNarration) {
|
|
10151
|
+
flushPendingTuiNarration();
|
|
10152
|
+
if (streamedAssistantText) {
|
|
10153
|
+
renderWriter.flush();
|
|
10154
|
+
options.output.write("\n");
|
|
10155
|
+
}
|
|
10156
|
+
}
|
|
10157
|
+
dropPendingTuiProgress();
|
|
10158
|
+
},
|
|
9994
10159
|
pushText(chunk) {
|
|
9995
10160
|
writeVisibleAssistantChunk(chunk);
|
|
9996
10161
|
},
|
|
@@ -9998,10 +10163,6 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9998
10163
|
markThinkingDelta(chunk);
|
|
9999
10164
|
},
|
|
10000
10165
|
handleToolEvent,
|
|
10001
|
-
/** 记录一条 compaction 观测事件(TUI 在 turn 结束时渲染一行 dim 摘要)。
|
|
10002
|
-
* 一轮内可能来多条(轮开始 + 每个 round),按显著性保留最高者:
|
|
10003
|
-
* 失败 > 新生成摘要 > 投影复用 > 跳过,避免末尾的例行跳过事件
|
|
10004
|
-
* 覆盖掉中途真正发生的压缩。 */
|
|
10005
10166
|
recordCompaction(event) {
|
|
10006
10167
|
const significance = (e) => e.failed ? 4 : e.summaryGenerated ? 3 : e.compressed ? 2 : 1;
|
|
10007
10168
|
if (!compactionEvent || significance(event) >= significance(compactionEvent)) {
|
|
@@ -10013,12 +10174,28 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10013
10174
|
spinner.show(activeLabel);
|
|
10014
10175
|
options.activityReporter?.(activeLabel);
|
|
10015
10176
|
},
|
|
10177
|
+
/**
|
|
10178
|
+
* Pre-delta turn phase label (ctx-overflow-feedback batch 3).
|
|
10179
|
+
*
|
|
10180
|
+
* localLoop 在首个 provider delta 之前依次发出 turn-phase 事件
|
|
10181
|
+
* (validating-context → compacting → waiting-provider);此前 CLI 只有
|
|
10182
|
+
* llm-start 才进入明确 working 状态,压缩期间 spinner 停在通用
|
|
10183
|
+
* working 文案上,用户无法区分「卡在检查上下文 / 压缩 / 等模型」。
|
|
10184
|
+
* 两个显示面(bare CLI 的 spinner 与 TUI 的 dock activityReporter)与
|
|
10185
|
+
* showWorking 走同一条投影,保证两端文案不漂移。
|
|
10186
|
+
*/
|
|
10187
|
+
showPhase(phase) {
|
|
10188
|
+
const label = phase === "validating-context" ? t("contextChecking") : phase === "compacting" ? t("contextCompacting") : t("waitingForModel");
|
|
10189
|
+
spinner.show(label);
|
|
10190
|
+
options.activityReporter?.(label);
|
|
10191
|
+
},
|
|
10016
10192
|
finish(fallbackContent) {
|
|
10017
10193
|
const flushedThink = flushThinkParser(thinkState);
|
|
10018
10194
|
thinkState = flushedThink.state;
|
|
10019
10195
|
if (flushedThink.content) {
|
|
10020
10196
|
writeVisibleAssistantChunk(flushedThink.content);
|
|
10021
10197
|
}
|
|
10198
|
+
if (assistantLabelManaged) flushPendingTuiNarration();
|
|
10022
10199
|
endThinkingPhase();
|
|
10023
10200
|
spinner.stop();
|
|
10024
10201
|
options.activityReporter?.(null);
|
|
@@ -10123,6 +10300,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10123
10300
|
let content = "";
|
|
10124
10301
|
let dialogId;
|
|
10125
10302
|
let usage;
|
|
10303
|
+
let sawDone = false;
|
|
10126
10304
|
const handlePayload = (payload) => {
|
|
10127
10305
|
if (typeof payload?.dialogId === "string" && payload.dialogId.trim()) {
|
|
10128
10306
|
dialogId = payload.dialogId;
|
|
@@ -10135,6 +10313,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10135
10313
|
}
|
|
10136
10314
|
if (payload?.type === "done") {
|
|
10137
10315
|
usage = payload.usage;
|
|
10316
|
+
sawDone = true;
|
|
10138
10317
|
return;
|
|
10139
10318
|
}
|
|
10140
10319
|
if (payload?.type === "dialog" || payload?.type === "status") {
|
|
@@ -10188,6 +10367,9 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10188
10367
|
}
|
|
10189
10368
|
} catch (error) {
|
|
10190
10369
|
turnOutput.spinner.stop();
|
|
10370
|
+
turnOutput.cancel({
|
|
10371
|
+
preservePendingNarration: !options.abortSignal?.aborted
|
|
10372
|
+
});
|
|
10191
10373
|
if (options.abortSignal?.aborted) {
|
|
10192
10374
|
return {
|
|
10193
10375
|
exitCode: 0,
|
|
@@ -10217,6 +10399,15 @@ ${describeClientVersionTooOldFailure(message, error)}`);
|
|
|
10217
10399
|
`);
|
|
10218
10400
|
return { exitCode: 1 };
|
|
10219
10401
|
}
|
|
10402
|
+
if (options.abortSignal?.aborted && !sawDone) {
|
|
10403
|
+
turnOutput.spinner.stop();
|
|
10404
|
+
turnOutput.cancel();
|
|
10405
|
+
return {
|
|
10406
|
+
exitCode: 0,
|
|
10407
|
+
...dialogId ? { dialogId } : {},
|
|
10408
|
+
streamInterrupted: true
|
|
10409
|
+
};
|
|
10410
|
+
}
|
|
10220
10411
|
turnOutput.finish(content);
|
|
10221
10412
|
const usageText = formatUsage(usage, dialogId);
|
|
10222
10413
|
if (usageText && shouldShowUsage(options.env))
|
|
@@ -10433,7 +10624,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
10433
10624
|
// packages/cli/client/agentRun.ts
|
|
10434
10625
|
import { ulid as ulid2 } from "ulid";
|
|
10435
10626
|
async function loadRunLocalAgentTurn() {
|
|
10436
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
10627
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-3WTYYIT2.js");
|
|
10437
10628
|
return runLocalAgentTurn;
|
|
10438
10629
|
}
|
|
10439
10630
|
var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
|
|
@@ -10760,6 +10951,22 @@ var SERVER_FALLBACK_HINT = "or use --server to run on the server explicitly.";
|
|
|
10760
10951
|
function buildAuthFailure(ctx) {
|
|
10761
10952
|
const platformNoToken = ctx.where === "server chat proxy" && isAuthNoTokenBody(ctx.message);
|
|
10762
10953
|
const fix = platformNoToken ? `This install is not logged in \u2014 run \`nolo login\`, or set AUTH_TOKEN / NOLO_SERVER` : ctx.where === "server chat proxy" ? `Check the agent's provider/api-key settings on nolo.chat` : `Fix the local credential/config and retry`;
|
|
10954
|
+
const { url: validationUrl, text: validationText } = extractGoogleValidationLink(ctx.message);
|
|
10955
|
+
const validationLabel = validationText || "Verify your account";
|
|
10956
|
+
if (validationUrl) {
|
|
10957
|
+
const linkLine = `
|
|
10958
|
+
${formatCliHyperlink(validationUrl, validationLabel)}`;
|
|
10959
|
+
const rawLine = resolveCliHyperlinkEnabled() ? `
|
|
10960
|
+
\u70B9\u4E0D\u4E86\u5C31\u590D\u5236\u8FD9\u884C: ${validationUrl}` : "";
|
|
10961
|
+
const verifyHint = `
|
|
10962
|
+
\u24D8 \u60F3\u4E00\u952E\u6253\u5F00\uFF1F\u8DD1 \`nolo auth antigravity --verify\` \u2014\u2014 \u5B83\u4F1A\u7528\u672C\u5730\u51ED\u8BC1\u62FF\u5230\u5F53\u524D\u9A8C\u8BC1\u94FE\u63A5\u5E76\u76F4\u63A5\u62C9\u8D77\u6D4F\u89C8\u5668\u3002`;
|
|
10963
|
+
const retryLine = `
|
|
10964
|
+
\u9A8C\u8BC1\u5B8C\u6210\u540E\u76F4\u63A5\u91CD\u8BD5\u521A\u624D\u7684\u547D\u4EE4\u5373\u53EF\uFF0Ctoken \u4E0D\u7528\u91CD\u65B0\u767B\u5F55\u3002`;
|
|
10965
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}: Google requires a one-time account verification \u2014 your credential is fine).
|
|
10966
|
+
Open this link in a browser signed into ${ctx.credentialAccountId ? `\`${ctx.credentialAccountId}\`` : "the Google account behind this credential"}:${linkLine}${rawLine}${verifyHint}${retryLine}
|
|
10967
|
+
Detail: ${ctx.message} ${NO_FALLBACK} Use --server to run on the server explicitly.
|
|
10968
|
+
`;
|
|
10969
|
+
}
|
|
10763
10970
|
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}, auth rejected). Detail: ${ctx.message} ${NO_FALLBACK} ${fix}, ${SERVER_FALLBACK_HINT}.
|
|
10764
10971
|
`;
|
|
10765
10972
|
}
|
|
@@ -10795,6 +11002,17 @@ function buildUpstreamFailure(ctx) {
|
|
|
10795
11002
|
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}). Detail: ${ctx.message} ${NO_FALLBACK} ${fix}, ${SERVER_FALLBACK_HINT}.
|
|
10796
11003
|
`;
|
|
10797
11004
|
}
|
|
11005
|
+
function formatLocalTurnFailureLine(error) {
|
|
11006
|
+
const message = toErrorMessage(error);
|
|
11007
|
+
if (error?.code === "LLM_REQUEST_TIMEOUT") {
|
|
11008
|
+
const msMatch = /after (\d+)ms/.exec(message);
|
|
11009
|
+
const deadline = msMatch && Number.isFinite(Number(msMatch[1])) ? formatElapsed(Math.round(Number(msMatch[1]) / 1e3)) : "the configured window";
|
|
11010
|
+
return `[nolo] ${t("llmRequestTimedOut", deadline)}
|
|
11011
|
+
`;
|
|
11012
|
+
}
|
|
11013
|
+
return `[nolo] Local agent run failed: ${message}
|
|
11014
|
+
`;
|
|
11015
|
+
}
|
|
10798
11016
|
var FAILURE_BUILDERS = {
|
|
10799
11017
|
auth: buildAuthFailure,
|
|
10800
11018
|
"rejected-payload": buildRejectedPayloadFailure,
|
|
@@ -10803,6 +11021,7 @@ var FAILURE_BUILDERS = {
|
|
|
10803
11021
|
upstream: buildUpstreamFailure
|
|
10804
11022
|
};
|
|
10805
11023
|
function describeLocalRunFailure(message, rawError) {
|
|
11024
|
+
const credentialAccountId = rawError && typeof rawError === "object" && typeof rawError.credentialAccountId === "string" ? rawError.credentialAccountId.trim() || void 0 : void 0;
|
|
10806
11025
|
if (rawError && typeof rawError === "object" && "code" in rawError && rawError.code === "PLATFORM_STREAM_INTERRUPTED") {
|
|
10807
11026
|
return "[nolo] The platform LLM stream was interrupted before the turn completed. Your conversation was preserved. Send another message to continue.\n";
|
|
10808
11027
|
}
|
|
@@ -10880,7 +11099,8 @@ function describeLocalRunFailure(message, rawError) {
|
|
|
10880
11099
|
status: cls.status,
|
|
10881
11100
|
...cls.statusInferred ? { statusInferred: true } : {},
|
|
10882
11101
|
...cls.quotaExhausted ? { quotaExhausted: true } : {},
|
|
10883
|
-
...cooldownUntil ? { cooldownUntil } : {}
|
|
11102
|
+
...cooldownUntil ? { cooldownUntil } : {},
|
|
11103
|
+
...credentialAccountId ? { credentialAccountId } : {}
|
|
10884
11104
|
};
|
|
10885
11105
|
return FAILURE_BUILDERS[cls.kind](ctx);
|
|
10886
11106
|
}
|
|
@@ -11197,6 +11417,18 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11197
11417
|
if (event.kind === "llm-start") {
|
|
11198
11418
|
turnOutput.showWorking();
|
|
11199
11419
|
}
|
|
11420
|
+
if (event.kind === "turn-phase") {
|
|
11421
|
+
turnOutput.showPhase(event.phase);
|
|
11422
|
+
}
|
|
11423
|
+
if (event.kind === "compaction-start") {
|
|
11424
|
+
turnOutput.showPhase("compacting");
|
|
11425
|
+
}
|
|
11426
|
+
if (event.kind === "compaction-end" || // 压缩失败(timeout/provider-error)时 localLoop 按失败原子性语义
|
|
11427
|
+
// 带着裁剪后的历史继续本轮,切回等待模型文案;aborted 时 turn 随即
|
|
11428
|
+
// 结束,不再切文案(终态由 abort 路径收尾)。
|
|
11429
|
+
event.kind === "compaction-failed" && event.reason !== "aborted") {
|
|
11430
|
+
turnOutput.showPhase("waiting-provider");
|
|
11431
|
+
}
|
|
11200
11432
|
if (event.kind === "image-downgraded") {
|
|
11201
11433
|
options.output.write(
|
|
11202
11434
|
"[nolo] \u5F53\u524D agent \u88AB\u914D\u7F6E\u4E3A\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u56FE\u7247\u5DF2\u7528\u5360\u4F4D\u6587\u672C\u66FF\u4EE3\u3002\u8BF7\u68C0\u67E5\u6A21\u578B\u7684\u56FE\u7247\u80FD\u529B\u914D\u7F6E\uFF0C\u6216\u7528 /switch \u9009\u62E9\u652F\u6301\u56FE\u7247\u7684 agent \u540E\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002\n"
|
|
@@ -11242,6 +11474,9 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11242
11474
|
};
|
|
11243
11475
|
} catch (error) {
|
|
11244
11476
|
turnOutput.spinner.stop();
|
|
11477
|
+
turnOutput.cancel({
|
|
11478
|
+
preservePendingNarration: error?.code !== LOCAL_TURN_ABORTED_CODE && !options.abortSignal?.aborted
|
|
11479
|
+
});
|
|
11245
11480
|
const savedDialogId = error?.dialogId;
|
|
11246
11481
|
const abortedUsageRecords = error?.usageRecords;
|
|
11247
11482
|
const abortedTurnCredits = sumPlatformCredits(abortedUsageRecords);
|
|
@@ -11265,10 +11500,12 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11265
11500
|
error.cooldownUntil = cooldownUntil;
|
|
11266
11501
|
}
|
|
11267
11502
|
if (settings.reportFailure) {
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11503
|
+
const failureLine = formatLocalTurnFailureLine(error);
|
|
11504
|
+
if (typeof options.output.writeErr === "function") {
|
|
11505
|
+
options.output.writeErr(failureLine);
|
|
11506
|
+
} else {
|
|
11507
|
+
options.output.write(failureLine);
|
|
11508
|
+
}
|
|
11272
11509
|
if (cooldownUntil) {
|
|
11273
11510
|
options.output.write(
|
|
11274
11511
|
`[nolo] \u5DF2\u6807\u8BB0\u51B7\u5374\u81F3 ${cooldownUntil}\uFF0C\u5230\u671F\u524D\u6D3E\u53D1\u8BE5 agent \u4F1A\u88AB\u51B7\u5374\u95E8\u63A7\u62E6\u622A\u3002
|
|
@@ -13526,7 +13763,10 @@ async function resolveAgentRunAgentKey(args) {
|
|
|
13526
13763
|
}
|
|
13527
13764
|
async function runAgentRunCommand(args, deps) {
|
|
13528
13765
|
const env = deps.env ?? process.env;
|
|
13529
|
-
const output = deps.output ??
|
|
13766
|
+
const output = deps.output ?? {
|
|
13767
|
+
write: (chunk) => process.stdout.write(chunk),
|
|
13768
|
+
writeErr: (chunk) => process.stderr.write(chunk)
|
|
13769
|
+
};
|
|
13530
13770
|
if (args.includes("--help") || args.includes("-h")) {
|
|
13531
13771
|
writeUsage(output, deps.commandPath);
|
|
13532
13772
|
return 0;
|