nolo-cli 0.16.0-alpha.2 → 0.16.0-alpha.21
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-QAUS6B7J.js → _executeModel-GRCQXT5R.js} +51 -45
- package/{action-GUOZYYGN.js → action-LT7BRFLK.js} +10 -9
- package/{addContentAction-QDGHGUBH.js → addContentAction-PL3KKBDH.js} +9 -8
- package/{addDialogAgentAction-Z4YCYZIV.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
- package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-WNL3CNQX.js} +32 -29
- package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-MPEUMRAS.js} +63 -57
- package/{agentListCommands-6B5X4RC6.js → agentListCommands-YO4AOQMS.js} +31 -28
- package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-WYM6YRYJ.js} +30 -27
- package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
- package/agentRecordCommands-BVWSHMIY.js +105 -0
- package/{agentRunCommand-SGMH67WT.js → agentRunCommand-E3ZI6RSF.js} +64 -55
- package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
- package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-P4VGX6H6.js} +26 -25
- package/{agentSlice-IVE735EV.js → agentSlice-D33GU3JL.js} +9 -8
- package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-VA4R2SWX.js} +29 -26
- package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-JWMWQNG6.js} +29 -26
- package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-KYXGLZSQ.js} +29 -26
- package/{appGetCommands-O4OCAMRW.js → appGetCommands-ELOO3JG6.js} +29 -26
- package/{appListCommands-UENFP4XY.js → appListCommands-SJUW4RLW.js} +29 -26
- package/{authCommand-YFTR3347.js → authCommand-WJZPOLSS.js} +16 -9
- package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
- package/{chunk-RKM3K52F.js → chunk-34WPV75U.js} +23 -2
- package/{chunk-VPTJB4HM.js → chunk-3ND52WIL.js} +2 -5
- package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
- package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
- package/{chunk-U7LEGLEB.js → chunk-4T5F7YZQ.js} +1 -1
- package/{chunk-OQMPU2ML.js → chunk-5PGGCJGV.js} +6 -6
- package/chunk-7BUYEZ6U.js +671 -0
- package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
- package/{chunk-WA6KZL5V.js → chunk-AAODAAUQ.js} +23 -20
- package/{chunk-GRTFNYLR.js → chunk-AKVLLMOU.js} +3 -3
- package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
- package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
- package/{chunk-QZVGMD5F.js → chunk-BE2GNT5E.js} +2 -8
- package/{chunk-JKWWVF2I.js → chunk-D3HVJJIA.js} +1 -1
- package/{chunk-B4KT7RN2.js → chunk-DKZFOK24.js} +18 -89
- package/chunk-DL6EPNIK.js +50 -0
- package/{chunk-YYIRR6QC.js → chunk-E5KQTMMJ.js} +212 -250
- package/{chunk-4QQFLN5C.js → chunk-EGPCU42M.js} +58 -8
- package/{chunk-XVP3C2KY.js → chunk-ELT65PZW.js} +2 -2
- package/{chunk-EMXI3N3Z.js → chunk-ENP2ELIL.js} +5 -5
- package/{chunk-6565R2TI.js → chunk-EXAEHRLI.js} +112 -191
- package/chunk-FQZZLA3C.js +223 -0
- package/{chunk-WPN6RMDF.js → chunk-GMZZ5EKJ.js} +3 -3
- package/{chunk-RSYUDGGZ.js → chunk-HQNPCMWL.js} +3 -3
- package/{chunk-OGGHETUE.js → chunk-HQPG2PIV.js} +62 -19
- package/{chunk-4NLUNENX.js → chunk-IQZ6TGVW.js} +10 -3
- package/{chunk-VE6XMVKG.js → chunk-J67FKTTY.js} +330 -213
- package/{chunk-G2MKOQCB.js → chunk-JFE7XW4D.js} +1 -1
- package/{setDialogExtraReferencesAction-2VLGWQKG.js → chunk-JLA4FXYC.js} +2 -17
- package/{chunk-OOIN7HSO.js → chunk-JP7REMYP.js} +19 -1
- package/chunk-KFEVY3ST.js +255 -0
- package/{chunk-I66RU7P7.js → chunk-KKWJ5VPZ.js} +1 -1
- package/{chunk-WRN5EQT7.js → chunk-L2RRMXNJ.js} +13 -4
- package/{chunk-ISYE6GZB.js → chunk-L6NVTGI7.js} +1 -1
- package/{chunk-HRQCKQA5.js → chunk-MUCU6ATG.js} +8 -257
- package/{chunk-BFRVXJJJ.js → chunk-MUIT5AAM.js} +112 -27
- package/{chunk-WNLPAOIT.js → chunk-MVQ4TBSD.js} +1 -1
- package/{chunk-O53CP2QR.js → chunk-N2HYIBLH.js} +6 -6
- package/{chunk-524BDL33.js → chunk-O6W2O2DA.js} +1 -15
- package/{chunk-YC3DJILJ.js → chunk-PUSK7HXJ.js} +64 -22
- package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
- package/{chunk-4IJYA27C.js → chunk-RG2U2MTJ.js} +1 -1
- package/{chunk-Z24FGIU2.js → chunk-RIDWN7AP.js} +34 -15
- package/{chunk-IKXL2HZ3.js → chunk-RK5NYQEL.js} +1 -1
- package/{chunk-QLFCNUVQ.js → chunk-RUTSBLDM.js} +1629 -261
- package/{chunk-TTGAVETO.js → chunk-RVOUXDFU.js} +5 -5
- package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
- package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
- package/{chunk-EHLHSX7R.js → chunk-UB4RYYNQ.js} +9 -2
- package/{chunk-N5424GSW.js → chunk-UGUW3FHG.js} +4 -4
- package/{chunk-YNHQIXX5.js → chunk-UIOYWBU7.js} +395 -326
- package/chunk-V5R4NZP2.js +78 -0
- package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
- package/{chunk-J55UHASN.js → chunk-VST53WEL.js} +1 -1
- package/{chunk-6MHDWKOT.js → chunk-VVKQFITN.js} +25 -12
- package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
- package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
- package/chunk-X4Q4UZEY.js +26 -0
- package/{chunk-E237VE6U.js → chunk-XFYDGBXL.js} +4 -4
- package/{chunk-JS33TCQ3.js → chunk-XHG22OEX.js} +4 -4
- package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
- package/{chunk-V2J635L5.js → chunk-XOIF2TNF.js} +2 -2
- package/{chunk-SFXYKGK2.js → chunk-XRZJGPFI.js} +7 -7
- package/chunk-ZHXJ6M7T.js +27 -0
- package/chunk-ZZ2MH7LE.js +84 -0
- package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
- package/codingSkills-36KN5NQT.js +48 -0
- package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-ONKZ46XE.js} +22 -21
- package/{createDialogAction-5HVQ33EX.js → createDialogAction-7QWJEBKU.js} +24 -23
- package/{createPageAction-4F3ZGQJD.js → createPageAction-PB3KXZIA.js} +28 -27
- package/{dbSlice-OP6UPXKA.js → dbSlice-CGSRFJN3.js} +8 -7
- package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
- package/{dialogCommands-ZL6L24BS.js → dialogCommands-YZFU4Q26.js} +30 -27
- package/{dialogSlice-FAWUQDJW.js → dialogSlice-53B5ISGQ.js} +22 -21
- package/{docCreateCommands-LYROQTFH.js → docCreateCommands-LOUC5PFB.js} +28 -25
- package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-HHPGT4BR.js} +29 -26
- package/{docReadCommands-PRULNF26.js → docReadCommands-YPSN4HEF.js} +28 -25
- package/{docStore-2UHVWLTV.js → docStore-LJXXRB5W.js} +23 -22
- package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-CJCZO54M.js} +28 -25
- package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
- package/{getPricing-UGDJHI7M.js → getPricing-RYY6OBA4.js} +4 -4
- package/handleSendMessageAction-ICGX4QCM.js +402 -0
- package/index.js +68 -68
- package/{localDialogRead-2VRI24F4.js → localDialogRead-HQZPVIE3.js} +1 -1
- package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
- package/{machineCommands-JQPEQFSE.js → machineCommands-YLDZXK4D.js} +64 -58
- package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-LTQL3DRE.js} +56 -50
- package/{models-LSCRJJ6P.js → models-5K5G2CZI.js} +2 -2
- package/package.json +1 -1
- package/queryRunOverlay-O4LOMMPO.js +161 -0
- package/{read-HXHAZBKH.js → read-3FMPZPER.js} +3 -3
- package/{readDocTool-VPBDTO4G.js → readDocTool-VSYHKK3V.js} +1 -1
- package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-OSPVWNAT.js} +699 -168
- package/{removeDialogAgentAction-HUFVN35S.js → removeDialogAgentAction-OAGA2G3U.js} +11 -10
- package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-76SUKKPX.js} +46 -40
- package/runOverlayPresentation-ZO4VCWEU.js +11 -0
- package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
- package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
- package/{setPrimaryDialogAgentAction-VB4UV2CC.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +27 -18
- package/{settingSlice-7JYPQNAC.js → settingSlice-7MNKHZ6R.js} +9 -8
- package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
- package/{spaceCommands-4LE45GB7.js → spaceCommands-GIF7MKVD.js} +31 -28
- package/{spaceSlice-444MFUP6.js → spaceSlice-M4PVN5PO.js} +22 -21
- package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-GCKTFSHQ.js} +96 -55
- package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
- package/{tools-YB6LXSVN.js → tools-RJVFXOLR.js} +35 -30
- package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-VUNVBRX3.js} +7 -6
- package/types-ZSTJ7MPR.js +7 -0
- package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-PSR67DLV.js} +25 -24
- package/agentRecordCommands-DCH2WBL2.js +0 -99
- package/chunk-BYXBJQAS.js +0 -0
- package/handleSendMessageAction-LJPUYNOH.js +0 -215
- package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
- package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
- package/{localRuntimeAuthority-TEGCOWX4.js → localRuntimeAuthority-4IXJCHZ7.js} +3 -3
|
@@ -3,7 +3,20 @@ import {
|
|
|
3
3
|
normalizeDialogRecord,
|
|
4
4
|
readDialogSnapshot,
|
|
5
5
|
sortDialogs
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HQNPCMWL.js";
|
|
7
|
+
import {
|
|
8
|
+
listFavoriteAgentIdsAcrossServers,
|
|
9
|
+
listLocalCachedAgents,
|
|
10
|
+
listRemoteAgents,
|
|
11
|
+
listRemoteAgentsAcrossServers
|
|
12
|
+
} from "./chunk-AKVLLMOU.js";
|
|
13
|
+
import "./chunk-ID4G2MAR.js";
|
|
14
|
+
import {
|
|
15
|
+
listUserRecordsFromServers
|
|
16
|
+
} from "./chunk-VST53WEL.js";
|
|
17
|
+
import {
|
|
18
|
+
buildOverlayPresentation
|
|
19
|
+
} from "./chunk-V5R4NZP2.js";
|
|
7
20
|
import {
|
|
8
21
|
ANSI_ESCAPE_REGEX,
|
|
9
22
|
CLI_AUTO_TIER_AGENT_KEYS,
|
|
@@ -19,6 +32,7 @@ import {
|
|
|
19
32
|
clearCollapsedPasteStore,
|
|
20
33
|
countPhysicalLines,
|
|
21
34
|
createCollapsedPasteStore,
|
|
35
|
+
detectSystemBrightnessFromEnv,
|
|
22
36
|
dimCliText,
|
|
23
37
|
displayWidth,
|
|
24
38
|
expandRangeToCollapsedPasteChips,
|
|
@@ -30,7 +44,6 @@ import {
|
|
|
30
44
|
getActiveDensity,
|
|
31
45
|
getActiveThemeName,
|
|
32
46
|
isBalanceExhaustedError,
|
|
33
|
-
isQuotaExhaustedError,
|
|
34
47
|
normalizeToolDisplayMode,
|
|
35
48
|
padOrTruncateToWidth,
|
|
36
49
|
releaseCollapsedPaste,
|
|
@@ -57,119 +70,125 @@ import {
|
|
|
57
70
|
visibleWidth,
|
|
58
71
|
wrapTextToLines,
|
|
59
72
|
wrapTranscriptLine
|
|
60
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-E5KQTMMJ.js";
|
|
61
74
|
import "./chunk-DZ3XJVET.js";
|
|
62
|
-
import "./chunk-6HYVJV7B.js";
|
|
63
75
|
import {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
listRemoteAgents,
|
|
67
|
-
listRemoteAgentsAcrossServers
|
|
68
|
-
} from "./chunk-GRTFNYLR.js";
|
|
69
|
-
import "./chunk-ID4G2MAR.js";
|
|
76
|
+
getReadableCliDb
|
|
77
|
+
} from "./chunk-WFHXMLHZ.js";
|
|
70
78
|
import {
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
deleteDbRecord,
|
|
80
|
+
queryUserRecords,
|
|
81
|
+
readDbRecord
|
|
82
|
+
} from "./chunk-IQZ6TGVW.js";
|
|
73
83
|
import {
|
|
74
84
|
createCliLocalRuntimeAdapter,
|
|
75
85
|
initCliLocale,
|
|
86
|
+
isQuotaExhaustedError,
|
|
76
87
|
parseCliLocale,
|
|
88
|
+
readTimestamp,
|
|
77
89
|
setCliLocale,
|
|
78
90
|
t
|
|
79
|
-
} from "./chunk-
|
|
80
|
-
import "./chunk-
|
|
81
|
-
import
|
|
82
|
-
getReadableCliDb
|
|
83
|
-
} from "./chunk-W4NVOSFF.js";
|
|
84
|
-
import {
|
|
85
|
-
deleteDbRecord,
|
|
86
|
-
queryUserRecords,
|
|
87
|
-
readDbRecord
|
|
88
|
-
} from "./chunk-4NLUNENX.js";
|
|
89
|
-
import "./chunk-QZVGMD5F.js";
|
|
91
|
+
} from "./chunk-RUTSBLDM.js";
|
|
92
|
+
import "./chunk-UB4RYYNQ.js";
|
|
93
|
+
import "./chunk-BE2GNT5E.js";
|
|
90
94
|
import {
|
|
91
95
|
resolveCliAgentKeyInput
|
|
92
96
|
} from "./chunk-VHBWHNVT.js";
|
|
93
97
|
import "./chunk-LTRXGFMS.js";
|
|
94
|
-
import "./chunk-
|
|
98
|
+
import "./chunk-MVQ4TBSD.js";
|
|
99
|
+
import "./chunk-6HYVJV7B.js";
|
|
95
100
|
import "./chunk-JEXVIMYZ.js";
|
|
96
101
|
import {
|
|
97
102
|
prepareTools
|
|
98
|
-
} from "./chunk-
|
|
99
|
-
import "./chunk-
|
|
103
|
+
} from "./chunk-L2RRMXNJ.js";
|
|
104
|
+
import "./chunk-L6NVTGI7.js";
|
|
100
105
|
import {
|
|
101
106
|
expandEnabledPacks
|
|
102
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-J67FKTTY.js";
|
|
103
108
|
import "./chunk-RQSOAMPJ.js";
|
|
104
|
-
import "./chunk-
|
|
109
|
+
import "./chunk-JP7REMYP.js";
|
|
105
110
|
import "./chunk-KQHGZWSV.js";
|
|
106
|
-
import "./chunk-
|
|
107
|
-
import "./chunk-U7LEGLEB.js";
|
|
111
|
+
import "./chunk-4T5F7YZQ.js";
|
|
108
112
|
import "./chunk-3LY4F7SV.js";
|
|
109
|
-
import "./chunk-VP4WJWKW.js";
|
|
110
|
-
import "./chunk-63W5N6P3.js";
|
|
111
113
|
import "./chunk-VF4K2QE6.js";
|
|
112
|
-
import "./chunk-
|
|
113
|
-
import
|
|
114
|
+
import "./chunk-N2HYIBLH.js";
|
|
115
|
+
import {
|
|
116
|
+
initialRunOverlayState,
|
|
117
|
+
reduceRunOverlay
|
|
118
|
+
} from "./chunk-DL6EPNIK.js";
|
|
114
119
|
import "./chunk-OWOHNGCN.js";
|
|
120
|
+
import "./chunk-JLA4FXYC.js";
|
|
121
|
+
import "./chunk-VP4WJWKW.js";
|
|
122
|
+
import "./chunk-63W5N6P3.js";
|
|
123
|
+
import "./chunk-WJRJDX2W.js";
|
|
124
|
+
import "./chunk-LM6IYQ3F.js";
|
|
125
|
+
import "./chunk-RIDWN7AP.js";
|
|
115
126
|
import {
|
|
116
127
|
extractReferenceKeysFromMessage
|
|
117
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-UIOYWBU7.js";
|
|
118
129
|
import {
|
|
119
130
|
buildBuiltinSummaryContent
|
|
120
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-XOIF2TNF.js";
|
|
132
|
+
import "./chunk-B5TOXZAK.js";
|
|
121
133
|
import "./chunk-MRC4Q34M.js";
|
|
122
|
-
import "./chunk-
|
|
134
|
+
import "./chunk-5PGGCJGV.js";
|
|
123
135
|
import "./chunk-CWMSB67P.js";
|
|
124
|
-
import "./chunk-
|
|
125
|
-
import "./chunk-JS33TCQ3.js";
|
|
126
|
-
import "./chunk-SOTZ6RDN.js";
|
|
136
|
+
import "./chunk-XHG22OEX.js";
|
|
127
137
|
import "./chunk-Z4NR32XR.js";
|
|
128
138
|
import "./chunk-M76ECQRD.js";
|
|
139
|
+
import "./chunk-3Q7WHGCB.js";
|
|
129
140
|
import {
|
|
130
141
|
buildSkillDiscoveryContextBlock
|
|
131
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-7OBMZCRD.js";
|
|
143
|
+
import "./chunk-7BUYEZ6U.js";
|
|
144
|
+
import "./chunk-VC6OZXO5.js";
|
|
132
145
|
import "./chunk-WZSRQNQG.js";
|
|
133
146
|
import {
|
|
134
147
|
buildLocalWorkspaceOpenAiTools,
|
|
135
148
|
buildLocalWorkspaceToolset,
|
|
136
149
|
getProcessRegistry
|
|
137
|
-
} from "./chunk-
|
|
138
|
-
import "./chunk-WA6KZL5V.js";
|
|
150
|
+
} from "./chunk-PUSK7HXJ.js";
|
|
139
151
|
import "./chunk-ZNFJWEN4.js";
|
|
152
|
+
import "./chunk-AAODAAUQ.js";
|
|
140
153
|
import "./chunk-OIQPORYI.js";
|
|
141
154
|
import {
|
|
142
155
|
readCommandActionGatePayload,
|
|
143
156
|
resolveAgentImageInputSupport
|
|
144
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-VVKQFITN.js";
|
|
145
158
|
import "./chunk-LSFAWXKC.js";
|
|
146
159
|
import {
|
|
147
160
|
buildCurrentTimeBlock,
|
|
148
161
|
buildIdentityBlock,
|
|
149
162
|
buildRuntimeGuidanceBlocks
|
|
150
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-34WPV75U.js";
|
|
164
|
+
import "./chunk-KFEVY3ST.js";
|
|
151
165
|
import {
|
|
152
166
|
resolvePlatformAuthToken
|
|
153
|
-
} from "./chunk-
|
|
154
|
-
import
|
|
155
|
-
canonicalizeToolNames
|
|
156
|
-
} from "./chunk-B4KT7RN2.js";
|
|
167
|
+
} from "./chunk-MUCU6ATG.js";
|
|
168
|
+
import "./chunk-DKZFOK24.js";
|
|
157
169
|
import {
|
|
158
170
|
DEFAULT_CONTEXT_WINDOW,
|
|
159
171
|
estimateTokenCount,
|
|
160
172
|
getModelContextWindow,
|
|
161
173
|
planCompression,
|
|
162
174
|
serializeMessageContent
|
|
163
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-EGPCU42M.js";
|
|
164
176
|
import {
|
|
165
177
|
clipCompactText
|
|
166
178
|
} from "./chunk-5MMAK75Q.js";
|
|
167
|
-
import "./chunk-OGGHETUE.js";
|
|
168
179
|
import "./chunk-5CS33IBL.js";
|
|
169
180
|
import "./chunk-JZPBVBIY.js";
|
|
170
|
-
import "./chunk-
|
|
171
|
-
import "./chunk-
|
|
172
|
-
import
|
|
181
|
+
import "./chunk-HQPG2PIV.js";
|
|
182
|
+
import "./chunk-ZHXJ6M7T.js";
|
|
183
|
+
import {
|
|
184
|
+
toErrorMessage
|
|
185
|
+
} from "./chunk-HNMXYYJR.js";
|
|
186
|
+
import "./chunk-ELT65PZW.js";
|
|
187
|
+
import "./chunk-AL2V7U3E.js";
|
|
188
|
+
import "./chunk-4PWB7JRR.js";
|
|
189
|
+
import {
|
|
190
|
+
canonicalizeToolNames
|
|
191
|
+
} from "./chunk-ZZ2MH7LE.js";
|
|
173
192
|
import "./chunk-5MIDPSSK.js";
|
|
174
193
|
import {
|
|
175
194
|
extractCustomId
|
|
@@ -178,15 +197,25 @@ import "./chunk-3ASDTTEI.js";
|
|
|
178
197
|
import {
|
|
179
198
|
compactWhitespace
|
|
180
199
|
} from "./chunk-DWLEOOGR.js";
|
|
181
|
-
import "./chunk-MYMMNKYL.js";
|
|
182
|
-
import "./chunk-CMKUBIGW.js";
|
|
183
|
-
import "./chunk-JBTJAPUF.js";
|
|
184
|
-
import "./chunk-ATNTHIZI.js";
|
|
185
200
|
import {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
201
|
+
checkStaleRun,
|
|
202
|
+
queryRunRecords,
|
|
203
|
+
readRunRecord
|
|
204
|
+
} from "./chunk-VNAEBGDK.js";
|
|
205
|
+
import {
|
|
206
|
+
clipText,
|
|
207
|
+
formatDuration,
|
|
208
|
+
formatRunAge,
|
|
209
|
+
getAgentRunStatusIcon,
|
|
210
|
+
isAgentNameFallback,
|
|
211
|
+
isAgentRunTerminalStatus,
|
|
212
|
+
resolveRunLabel,
|
|
213
|
+
runShowsLogTail,
|
|
214
|
+
shortRunId
|
|
215
|
+
} from "./chunk-FQZZLA3C.js";
|
|
216
|
+
import "./chunk-X7W4TNB4.js";
|
|
217
|
+
import "./chunk-ATNTHIZI.js";
|
|
218
|
+
import "./chunk-JBTJAPUF.js";
|
|
190
219
|
import {
|
|
191
220
|
runSelfUpdate
|
|
192
221
|
} from "./chunk-K6EUAOW3.js";
|
|
@@ -207,24 +236,24 @@ import {
|
|
|
207
236
|
import {
|
|
208
237
|
DEFAULT_NOLO_SERVER_URL
|
|
209
238
|
} from "./chunk-OLZBQWZU.js";
|
|
210
|
-
import "./chunk-
|
|
211
|
-
import "./chunk-
|
|
212
|
-
import "./chunk-
|
|
213
|
-
import "./chunk-
|
|
239
|
+
import "./chunk-RK5NYQEL.js";
|
|
240
|
+
import "./chunk-O6W2O2DA.js";
|
|
241
|
+
import "./chunk-UGUW3FHG.js";
|
|
242
|
+
import "./chunk-RVOUXDFU.js";
|
|
214
243
|
import "./chunk-Y5GCAMGP.js";
|
|
215
244
|
import "./chunk-KX6YBIHG.js";
|
|
216
|
-
import "./chunk-
|
|
217
|
-
import "./chunk-
|
|
218
|
-
import "./chunk-O4BU24WZ.js";
|
|
219
|
-
import "./chunk-I42VC5KR.js";
|
|
245
|
+
import "./chunk-XRZJGPFI.js";
|
|
246
|
+
import "./chunk-6Y7A3OQQ.js";
|
|
220
247
|
import "./chunk-WWC7I6TA.js";
|
|
221
|
-
import "./chunk-
|
|
248
|
+
import "./chunk-SKDNBYZK.js";
|
|
249
|
+
import "./chunk-I42VC5KR.js";
|
|
222
250
|
import {
|
|
223
251
|
asTrimmedLowercaseString
|
|
224
252
|
} from "./chunk-QSJ3HFEF.js";
|
|
225
|
-
import "./chunk-
|
|
226
|
-
import "./chunk-
|
|
227
|
-
import "./chunk-
|
|
253
|
+
import "./chunk-X4Q4UZEY.js";
|
|
254
|
+
import "./chunk-3ND52WIL.js";
|
|
255
|
+
import "./chunk-XMLRJUU5.js";
|
|
256
|
+
import "./chunk-R5V5G73M.js";
|
|
228
257
|
import "./chunk-GBRG75BQ.js";
|
|
229
258
|
import "./chunk-3EUW3WEO.js";
|
|
230
259
|
import "./chunk-U6VC4MU4.js";
|
|
@@ -248,7 +277,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
248
277
|
import { join } from "node:path";
|
|
249
278
|
var DEFAULT_CLI_PACKS = ["code", "agent-orchestration", "skills"];
|
|
250
279
|
var DEFAULT_CLI_PLATFORM_TOOLS = [
|
|
251
|
-
"
|
|
280
|
+
"ask_user",
|
|
252
281
|
"exa_search",
|
|
253
282
|
"fetchWebpage"
|
|
254
283
|
];
|
|
@@ -756,7 +785,7 @@ function createRawKeyReader(input) {
|
|
|
756
785
|
let buffer = "";
|
|
757
786
|
const tryParseSequence = () => {
|
|
758
787
|
if (!buffer) return null;
|
|
759
|
-
if (isSubmit(buffer)
|
|
788
|
+
if (isSubmit(buffer)) {
|
|
760
789
|
const sequence2 = buffer;
|
|
761
790
|
buffer = "";
|
|
762
791
|
return sequence2;
|
|
@@ -779,6 +808,7 @@ function createRawKeyReader(input) {
|
|
|
779
808
|
return candidate;
|
|
780
809
|
}
|
|
781
810
|
}
|
|
811
|
+
if (buffer === "\x1B") return void 0;
|
|
782
812
|
if (buffer.length >= 8) {
|
|
783
813
|
buffer = "";
|
|
784
814
|
return null;
|
|
@@ -790,16 +820,38 @@ function createRawKeyReader(input) {
|
|
|
790
820
|
return sequence;
|
|
791
821
|
};
|
|
792
822
|
let waiter = null;
|
|
823
|
+
let escTimer = null;
|
|
793
824
|
const tryDeliver = () => {
|
|
794
825
|
if (!waiter || !buffer) return;
|
|
795
826
|
const parsed = tryParseSequence();
|
|
796
|
-
if (parsed === void 0)
|
|
827
|
+
if (parsed === void 0) {
|
|
828
|
+
if (buffer === "\x1B" && !escTimer) {
|
|
829
|
+
escTimer = setTimeout(() => {
|
|
830
|
+
escTimer = null;
|
|
831
|
+
if (waiter && buffer === "\x1B") {
|
|
832
|
+
const resolve3 = waiter;
|
|
833
|
+
waiter = null;
|
|
834
|
+
buffer = "";
|
|
835
|
+
resolve3("\x1B");
|
|
836
|
+
}
|
|
837
|
+
}, 30);
|
|
838
|
+
}
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
if (escTimer) {
|
|
842
|
+
clearTimeout(escTimer);
|
|
843
|
+
escTimer = null;
|
|
844
|
+
}
|
|
797
845
|
const resolve2 = waiter;
|
|
798
846
|
waiter = null;
|
|
799
847
|
resolve2(parsed);
|
|
800
848
|
};
|
|
801
849
|
const onData = (chunk) => {
|
|
802
850
|
buffer += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
851
|
+
if (escTimer) {
|
|
852
|
+
clearTimeout(escTimer);
|
|
853
|
+
escTimer = null;
|
|
854
|
+
}
|
|
803
855
|
tryDeliver();
|
|
804
856
|
};
|
|
805
857
|
input.on("data", onData);
|
|
@@ -809,6 +861,10 @@ function createRawKeyReader(input) {
|
|
|
809
861
|
tryDeliver();
|
|
810
862
|
});
|
|
811
863
|
reader.dispose = () => {
|
|
864
|
+
if (escTimer) {
|
|
865
|
+
clearTimeout(escTimer);
|
|
866
|
+
escTimer = null;
|
|
867
|
+
}
|
|
812
868
|
waiter = null;
|
|
813
869
|
input.off("data", onData);
|
|
814
870
|
};
|
|
@@ -831,7 +887,6 @@ async function runSelectDialog(args) {
|
|
|
831
887
|
const output = args.output ?? process.stdout;
|
|
832
888
|
const input = args.input ?? process.stdin;
|
|
833
889
|
const readKey = args.readKey ?? createRawKeyReader(input);
|
|
834
|
-
output.write("\x1B[?1006h\x1B[?1000h");
|
|
835
890
|
const wasRaw = Boolean(input.isTTY && input.isRaw);
|
|
836
891
|
let renderedLineCount = 0;
|
|
837
892
|
const bottomAnchored = Boolean(args.bottomAnchored && args.bottomRow);
|
|
@@ -882,14 +937,15 @@ async function runSelectDialog(args) {
|
|
|
882
937
|
};
|
|
883
938
|
const resizeTarget = output;
|
|
884
939
|
const onOutputResize = () => paint();
|
|
885
|
-
if (input.isTTY && !wasRaw) {
|
|
886
|
-
input.setRawMode?.(true);
|
|
887
|
-
}
|
|
888
|
-
if (bottomAnchored && outputIsTty(output)) {
|
|
889
|
-
resizeTarget.on?.("resize", onOutputResize);
|
|
890
|
-
}
|
|
891
|
-
paint();
|
|
892
940
|
try {
|
|
941
|
+
output.write("\x1B[?1006h\x1B[?1000h");
|
|
942
|
+
if (input.isTTY && !wasRaw) {
|
|
943
|
+
input.setRawMode?.(true);
|
|
944
|
+
}
|
|
945
|
+
if (bottomAnchored && outputIsTty(output)) {
|
|
946
|
+
resizeTarget.on?.("resize", onOutputResize);
|
|
947
|
+
}
|
|
948
|
+
paint();
|
|
893
949
|
while (true) {
|
|
894
950
|
const sequence = await readKey();
|
|
895
951
|
if (sequence == null) {
|
|
@@ -897,6 +953,9 @@ async function runSelectDialog(args) {
|
|
|
897
953
|
}
|
|
898
954
|
const scrollAction = parseScrollAction(sequence);
|
|
899
955
|
if (scrollAction === "wheel-up" || scrollAction === "wheel-down") {
|
|
956
|
+
if (args.wheelPolicy === "ignore") {
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
900
959
|
selectedIndex = Math.min(
|
|
901
960
|
Math.max(
|
|
902
961
|
selectedIndex + (scrollAction === "wheel-up" ? -1 : 1),
|
|
@@ -1012,6 +1071,11 @@ async function runConfirmDialog(args) {
|
|
|
1012
1071
|
titleLines,
|
|
1013
1072
|
input,
|
|
1014
1073
|
output,
|
|
1074
|
+
// confirm is a non-list modal: a wheel scroll must do nothing at all — no
|
|
1075
|
+
// highlight move, no repaint, no cancel (spec). Without this it would
|
|
1076
|
+
// inherit runSelectDialog's default "move" and let the wheel flip
|
|
1077
|
+
// Allow/Deny, which is the opposite of the intended silent-swallow.
|
|
1078
|
+
wheelPolicy: "ignore",
|
|
1015
1079
|
...args.readKey ? { readKey: args.readKey } : {},
|
|
1016
1080
|
...args.bottomAnchored ? { bottomAnchored: args.bottomAnchored } : {},
|
|
1017
1081
|
...args.bottomRow ? { bottomRow: args.bottomRow } : {}
|
|
@@ -1365,7 +1429,6 @@ async function runAskChoiceDialog(args) {
|
|
|
1365
1429
|
const output = args.output ?? process.stdout;
|
|
1366
1430
|
const input = args.input ?? process.stdin;
|
|
1367
1431
|
const readKey = args.readKey ?? createRawKeyReader(input);
|
|
1368
|
-
output.write("\x1B[?1006h\x1B[?1000h");
|
|
1369
1432
|
const wasRaw = Boolean(input.isTTY && input.isRaw);
|
|
1370
1433
|
let renderedLineCount = 0;
|
|
1371
1434
|
const bottomAnchored = Boolean(args.bottomAnchored && args.bottomRow);
|
|
@@ -1442,14 +1505,15 @@ async function runAskChoiceDialog(args) {
|
|
|
1442
1505
|
};
|
|
1443
1506
|
const resizeTarget = output;
|
|
1444
1507
|
const onOutputResize = () => paint();
|
|
1445
|
-
if (input.isTTY && !wasRaw) {
|
|
1446
|
-
input.setRawMode?.(true);
|
|
1447
|
-
}
|
|
1448
|
-
if (bottomAnchored && outputIsTty(output)) {
|
|
1449
|
-
resizeTarget.on?.("resize", onOutputResize);
|
|
1450
|
-
}
|
|
1451
|
-
paint();
|
|
1452
1508
|
try {
|
|
1509
|
+
output.write("\x1B[?1006h\x1B[?1000h");
|
|
1510
|
+
if (input.isTTY && !wasRaw) {
|
|
1511
|
+
input.setRawMode?.(true);
|
|
1512
|
+
}
|
|
1513
|
+
if (bottomAnchored && outputIsTty(output)) {
|
|
1514
|
+
resizeTarget.on?.("resize", onOutputResize);
|
|
1515
|
+
}
|
|
1516
|
+
paint();
|
|
1453
1517
|
while (state.phase === "active") {
|
|
1454
1518
|
const sequence = await readKey();
|
|
1455
1519
|
if (sequence == null) {
|
|
@@ -1465,6 +1529,9 @@ async function runAskChoiceDialog(args) {
|
|
|
1465
1529
|
paint();
|
|
1466
1530
|
continue;
|
|
1467
1531
|
}
|
|
1532
|
+
if (SGR_MOUSE_REGEX.test(sequence)) {
|
|
1533
|
+
continue;
|
|
1534
|
+
}
|
|
1468
1535
|
let action = null;
|
|
1469
1536
|
const qs = state.questionStates[state.activeIndex];
|
|
1470
1537
|
const q = state.questions[state.activeIndex];
|
|
@@ -1608,6 +1675,274 @@ function createDialogHost(args) {
|
|
|
1608
1675
|
};
|
|
1609
1676
|
}
|
|
1610
1677
|
|
|
1678
|
+
// packages/cli/tui/runSnapshotDisplay.ts
|
|
1679
|
+
function runStatusTone(status) {
|
|
1680
|
+
if (!isAgentRunTerminalStatus(status)) return "warning";
|
|
1681
|
+
return status === "done" ? "success" : "danger";
|
|
1682
|
+
}
|
|
1683
|
+
function formatInFlightFact(inFlight, now, maxNameLength = 20) {
|
|
1684
|
+
const label = inFlight.kind === "llm" ? "thinking" : clipText(inFlight.name, maxNameLength);
|
|
1685
|
+
return `${label} ${formatDuration(Math.max(0, now - inFlight.startedAt))}`;
|
|
1686
|
+
}
|
|
1687
|
+
function activeInFlight(snapshot) {
|
|
1688
|
+
if (isAgentRunTerminalStatus(snapshot.status)) return null;
|
|
1689
|
+
return snapshot.inFlight ?? null;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
// packages/cli/tui/agentRunPanelLines.ts
|
|
1693
|
+
function formatPanelProgress(snapshot, now) {
|
|
1694
|
+
const parts = [];
|
|
1695
|
+
if (typeof snapshot.toolCallCount === "number" && Number.isFinite(snapshot.toolCallCount)) {
|
|
1696
|
+
parts.push(`${snapshot.toolCallCount} tools`);
|
|
1697
|
+
}
|
|
1698
|
+
const inFlight = activeInFlight(snapshot);
|
|
1699
|
+
if (inFlight) {
|
|
1700
|
+
parts.push(formatInFlightFact(inFlight, now));
|
|
1701
|
+
} else if (snapshot.lastToolNames && snapshot.lastToolNames.length > 0) {
|
|
1702
|
+
parts.push(snapshot.lastToolNames.join(", "));
|
|
1703
|
+
}
|
|
1704
|
+
return parts.length > 0 ? ` \xB7 ${parts.join(" \xB7 ")}` : "";
|
|
1705
|
+
}
|
|
1706
|
+
function formatPanelDetail(snapshot) {
|
|
1707
|
+
const note = snapshot.lastAssistantText?.trim();
|
|
1708
|
+
if (note) return note;
|
|
1709
|
+
if (!runShowsLogTail(snapshot.status)) return "";
|
|
1710
|
+
const lines = snapshot.logLines;
|
|
1711
|
+
if (!lines || lines.length === 0) return "";
|
|
1712
|
+
return lines[lines.length - 1]?.trim() ?? "";
|
|
1713
|
+
}
|
|
1714
|
+
function formatAgentRunPanelLines(snapshot, colorEnabled, now = Date.now()) {
|
|
1715
|
+
const lines = [];
|
|
1716
|
+
const name = snapshot.agentName || "sub-agent";
|
|
1717
|
+
const short = shortRunId(snapshot.runId);
|
|
1718
|
+
const runId = short ? ` (${short})` : "";
|
|
1719
|
+
const status = snapshot.status || "running";
|
|
1720
|
+
const statusSymbol = getAgentRunStatusIcon(status);
|
|
1721
|
+
const statusColor = runStatusTone(status);
|
|
1722
|
+
const errPart = snapshot.errorMessage ? ` \xB7 ${snapshot.errorMessage}` : "";
|
|
1723
|
+
const progressPart = formatPanelProgress(snapshot, now);
|
|
1724
|
+
const age = formatRunAge(snapshot, now);
|
|
1725
|
+
const agePart = age ? ` \xB7 ${age}` : "";
|
|
1726
|
+
if (!colorEnabled) {
|
|
1727
|
+
lines.push(
|
|
1728
|
+
`\u{1F916} Sub-Agent: ${name}${runId} \xB7 ${statusSymbol} ${status}${agePart}${progressPart}${errPart}`
|
|
1729
|
+
);
|
|
1730
|
+
} else {
|
|
1731
|
+
const botIcon = themeText("\u{1F916}", "accent", true);
|
|
1732
|
+
const labelText = themeText(" Sub-Agent: ", "muted", true);
|
|
1733
|
+
const nameText = themeText(`${name}${runId}`, "chrome", true);
|
|
1734
|
+
const statusText = themeText(` \xB7 ${statusSymbol} ${status}`, statusColor, true);
|
|
1735
|
+
const ageText = agePart ? themeText(agePart, "chrome") : "";
|
|
1736
|
+
const progressText = progressPart ? themeText(progressPart, "chrome") : "";
|
|
1737
|
+
const errorText = errPart ? themeText(errPart, "danger") : "";
|
|
1738
|
+
lines.push(`${botIcon}${labelText}${nameText}${statusText}${ageText}${progressText}${errorText}`);
|
|
1739
|
+
}
|
|
1740
|
+
const detail = formatPanelDetail(snapshot);
|
|
1741
|
+
if (detail) {
|
|
1742
|
+
if (!colorEnabled) {
|
|
1743
|
+
lines.push(` \u2514 ${detail}`);
|
|
1744
|
+
} else {
|
|
1745
|
+
lines.push(`${themeText(" \u2514 ", "muted")}${themeText(detail, "chrome")}`);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
return lines;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// packages/cli/tui/runDock.ts
|
|
1752
|
+
var RUN_DOCK_TICK_INTERVAL_MS = 1e3;
|
|
1753
|
+
var RUN_DOCK_LINGER_MS = 8e3;
|
|
1754
|
+
var RUN_DOCK_STALE_MS = 5 * 6e4;
|
|
1755
|
+
var RUN_DOCK_MAX_ROWS = 3;
|
|
1756
|
+
var RETIRED_MEMORY = 64;
|
|
1757
|
+
function mergeSnapshot(prev, next) {
|
|
1758
|
+
const merged = { ...prev, ...next };
|
|
1759
|
+
if (merged.errorMessage && next.errorMessage === void 0 && !isAgentRunTerminalStatus(merged.status)) {
|
|
1760
|
+
delete merged.errorMessage;
|
|
1761
|
+
}
|
|
1762
|
+
if (next.inFlight === void 0) {
|
|
1763
|
+
if (prev.inFlight !== void 0) merged.inFlight = prev.inFlight;
|
|
1764
|
+
}
|
|
1765
|
+
return merged;
|
|
1766
|
+
}
|
|
1767
|
+
function createRunDock(deps) {
|
|
1768
|
+
const now = deps.now ?? (() => Date.now());
|
|
1769
|
+
const tickIntervalMs = deps.tickIntervalMs ?? RUN_DOCK_TICK_INTERVAL_MS;
|
|
1770
|
+
const lingerMs = deps.lingerMs ?? RUN_DOCK_LINGER_MS;
|
|
1771
|
+
const staleMs = deps.staleMs ?? RUN_DOCK_STALE_MS;
|
|
1772
|
+
const maxRows = deps.maxRows ?? RUN_DOCK_MAX_ROWS;
|
|
1773
|
+
const setIntervalFn = deps.setIntervalFn ?? ((cb, ms) => setInterval(cb, ms));
|
|
1774
|
+
const clearIntervalFn = deps.clearIntervalFn ?? ((handle) => clearInterval(handle));
|
|
1775
|
+
const entries = /* @__PURE__ */ new Map();
|
|
1776
|
+
const retired = /* @__PURE__ */ new Set();
|
|
1777
|
+
let seqCounter = 0;
|
|
1778
|
+
let timer = null;
|
|
1779
|
+
let disposed = false;
|
|
1780
|
+
const stopTimer = () => {
|
|
1781
|
+
if (timer !== null) {
|
|
1782
|
+
clearIntervalFn(timer);
|
|
1783
|
+
timer = null;
|
|
1784
|
+
}
|
|
1785
|
+
};
|
|
1786
|
+
const prune = () => {
|
|
1787
|
+
const at = now();
|
|
1788
|
+
let changed = false;
|
|
1789
|
+
for (const [runId, entry] of entries) {
|
|
1790
|
+
const expiredTerminal = entry.terminalAt !== null && at - entry.terminalAt >= lingerMs;
|
|
1791
|
+
const stale = at - entry.updatedAt >= staleMs;
|
|
1792
|
+
if (!expiredTerminal && !stale) continue;
|
|
1793
|
+
entries.delete(runId);
|
|
1794
|
+
changed = true;
|
|
1795
|
+
if (expiredTerminal) {
|
|
1796
|
+
retired.add(runId);
|
|
1797
|
+
if (retired.size > RETIRED_MEMORY) {
|
|
1798
|
+
const oldest = retired.values().next().value;
|
|
1799
|
+
if (oldest !== void 0) retired.delete(oldest);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
if (entries.size === 0) stopTimer();
|
|
1804
|
+
return changed;
|
|
1805
|
+
};
|
|
1806
|
+
const tick = () => {
|
|
1807
|
+
prune();
|
|
1808
|
+
deps.onRepaint();
|
|
1809
|
+
};
|
|
1810
|
+
const ensureTimer = () => {
|
|
1811
|
+
if (timer === null && entries.size > 0) {
|
|
1812
|
+
timer = setIntervalFn(tick, tickIntervalMs);
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
const update = (snapshot) => {
|
|
1816
|
+
if (disposed) return;
|
|
1817
|
+
const runId = snapshot.runId;
|
|
1818
|
+
if (!runId) return;
|
|
1819
|
+
if (snapshot.status === "not_found") {
|
|
1820
|
+
remove(runId);
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
if (retired.has(runId)) return;
|
|
1824
|
+
const at = now();
|
|
1825
|
+
const prev = entries.get(runId);
|
|
1826
|
+
const merged = prev ? mergeSnapshot(prev.snapshot, snapshot) : snapshot;
|
|
1827
|
+
const terminal = isAgentRunTerminalStatus(merged.status);
|
|
1828
|
+
entries.set(runId, {
|
|
1829
|
+
snapshot: merged,
|
|
1830
|
+
seq: prev ? prev.seq : seqCounter++,
|
|
1831
|
+
updatedAt: at,
|
|
1832
|
+
// terminalAt 只在首次进入终态时记一次:终态 run 后续还会被轮询到,
|
|
1833
|
+
// 每次都刷新的话 linger 永远走不完,面板会一直挂着已完成的 run。
|
|
1834
|
+
terminalAt: terminal ? prev?.terminalAt ?? at : null
|
|
1835
|
+
});
|
|
1836
|
+
ensureTimer();
|
|
1837
|
+
deps.onRepaint();
|
|
1838
|
+
};
|
|
1839
|
+
const remove = (runId) => {
|
|
1840
|
+
if (!entries.delete(runId)) return;
|
|
1841
|
+
if (entries.size === 0) stopTimer();
|
|
1842
|
+
deps.onRepaint();
|
|
1843
|
+
};
|
|
1844
|
+
const clear = () => {
|
|
1845
|
+
if (entries.size === 0) return;
|
|
1846
|
+
entries.clear();
|
|
1847
|
+
stopTimer();
|
|
1848
|
+
deps.onRepaint();
|
|
1849
|
+
};
|
|
1850
|
+
const orderedEntries = () => [...entries.values()].sort((a, b) => {
|
|
1851
|
+
const aTerminal = a.terminalAt !== null ? 1 : 0;
|
|
1852
|
+
const bTerminal = b.terminalAt !== null ? 1 : 0;
|
|
1853
|
+
if (aTerminal !== bTerminal) return aTerminal - bTerminal;
|
|
1854
|
+
return a.seq - b.seq;
|
|
1855
|
+
});
|
|
1856
|
+
const getRuns = () => orderedEntries().map((entry) => entry.snapshot);
|
|
1857
|
+
const getLines = (colorEnabled) => {
|
|
1858
|
+
prune();
|
|
1859
|
+
const ordered = orderedEntries();
|
|
1860
|
+
if (ordered.length === 0) return [];
|
|
1861
|
+
const at = now();
|
|
1862
|
+
if (ordered.length === 1) {
|
|
1863
|
+
return formatAgentRunPanelLines(ordered[0].snapshot, colorEnabled, at);
|
|
1864
|
+
}
|
|
1865
|
+
return formatRunDockLines(
|
|
1866
|
+
ordered.map((entry) => entry.snapshot),
|
|
1867
|
+
colorEnabled,
|
|
1868
|
+
at,
|
|
1869
|
+
maxRows
|
|
1870
|
+
);
|
|
1871
|
+
};
|
|
1872
|
+
return {
|
|
1873
|
+
update,
|
|
1874
|
+
remove,
|
|
1875
|
+
clear,
|
|
1876
|
+
getRuns,
|
|
1877
|
+
getLines,
|
|
1878
|
+
dispose() {
|
|
1879
|
+
disposed = true;
|
|
1880
|
+
entries.clear();
|
|
1881
|
+
retired.clear();
|
|
1882
|
+
stopTimer();
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
function summarize(snapshots) {
|
|
1887
|
+
let running = 0;
|
|
1888
|
+
const terminal = /* @__PURE__ */ new Map();
|
|
1889
|
+
for (const snapshot of snapshots) {
|
|
1890
|
+
if (!isAgentRunTerminalStatus(snapshot.status)) {
|
|
1891
|
+
running += 1;
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1894
|
+
terminal.set(snapshot.status, (terminal.get(snapshot.status) ?? 0) + 1);
|
|
1895
|
+
}
|
|
1896
|
+
const parts = [];
|
|
1897
|
+
if (running > 0) parts.push(`${running} running`);
|
|
1898
|
+
for (const [status, count] of terminal) parts.push(`${count} ${status}`);
|
|
1899
|
+
return parts.join(" \xB7 ");
|
|
1900
|
+
}
|
|
1901
|
+
function formatRunDockLines(snapshots, colorEnabled, now = Date.now(), maxRows = RUN_DOCK_MAX_ROWS) {
|
|
1902
|
+
if (snapshots.length === 0) return [];
|
|
1903
|
+
const lines = [];
|
|
1904
|
+
const summary = summarize(snapshots);
|
|
1905
|
+
const header = `\u{1F916} runs \xB7 ${summary}`;
|
|
1906
|
+
lines.push(colorEnabled ? themeText(header, "muted", true) : header);
|
|
1907
|
+
const shown = snapshots.slice(0, Math.max(1, maxRows));
|
|
1908
|
+
for (const snapshot of shown) {
|
|
1909
|
+
lines.push(formatRunDockRow(snapshot, colorEnabled, now));
|
|
1910
|
+
}
|
|
1911
|
+
const hidden = snapshots.length - shown.length;
|
|
1912
|
+
if (hidden > 0) {
|
|
1913
|
+
const more = ` +${hidden} more`;
|
|
1914
|
+
lines.push(colorEnabled ? themeText(more, "chrome") : more);
|
|
1915
|
+
}
|
|
1916
|
+
return lines;
|
|
1917
|
+
}
|
|
1918
|
+
function formatRunDockRow(snapshot, colorEnabled, now) {
|
|
1919
|
+
const name = snapshot.agentName || "sub-agent";
|
|
1920
|
+
const short = shortRunId(snapshot.runId);
|
|
1921
|
+
const icon = getAgentRunStatusIcon(snapshot.status);
|
|
1922
|
+
const terminal = isAgentRunTerminalStatus(snapshot.status);
|
|
1923
|
+
const statusColor = runStatusTone(snapshot.status);
|
|
1924
|
+
const facts = [];
|
|
1925
|
+
const age = formatRunAge(snapshot, now);
|
|
1926
|
+
if (terminal) facts.push(age ? `${snapshot.status} ${age}` : snapshot.status);
|
|
1927
|
+
else if (age) facts.push(age);
|
|
1928
|
+
if (typeof snapshot.toolCallCount === "number" && Number.isFinite(snapshot.toolCallCount)) {
|
|
1929
|
+
facts.push(`${snapshot.toolCallCount} tools`);
|
|
1930
|
+
}
|
|
1931
|
+
const inFlight = activeInFlight(snapshot);
|
|
1932
|
+
if (inFlight) {
|
|
1933
|
+
facts.push(formatInFlightFact(inFlight, now));
|
|
1934
|
+
} else {
|
|
1935
|
+
const lastTool = snapshot.lastToolNames?.[snapshot.lastToolNames.length - 1];
|
|
1936
|
+
if (lastTool) facts.push(clipText(lastTool, 20));
|
|
1937
|
+
}
|
|
1938
|
+
if (snapshot.errorMessage) facts.push(clipText(snapshot.errorMessage, 40));
|
|
1939
|
+
const label = `${name}${short ? ` #${short}` : ""}`;
|
|
1940
|
+
const factsPart = facts.length > 0 ? ` \xB7 ${facts.join(" \xB7 ")}` : "";
|
|
1941
|
+
if (!colorEnabled) return ` ${icon} ${label}${factsPart}`;
|
|
1942
|
+
const errorTail = snapshot.errorMessage;
|
|
1943
|
+
return themeText(" ", "chrome") + themeText(icon, statusColor, true) + " " + themeText(label, "chrome", true) + themeText(factsPart, errorTail ? "danger" : "chrome");
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1611
1946
|
// packages/cli/tui/activityIndicator.ts
|
|
1612
1947
|
var ACTIVITY_FRAMES = ["\xB7", "~", "\u2248", "\u223F", "\u2248", "~"];
|
|
1613
1948
|
var ACTIVITY_FRAME_INTERVAL_MS = 150;
|
|
@@ -1691,16 +2026,19 @@ function createActivityIndicator(deps) {
|
|
|
1691
2026
|
}
|
|
1692
2027
|
return null;
|
|
1693
2028
|
};
|
|
1694
|
-
|
|
2029
|
+
const runDock = deps.runDock ?? createRunDock({
|
|
2030
|
+
onRepaint: deps.onRepaint,
|
|
2031
|
+
now,
|
|
2032
|
+
setIntervalFn,
|
|
2033
|
+
clearIntervalFn
|
|
2034
|
+
});
|
|
1695
2035
|
const updateAgentRun = (snapshot) => {
|
|
1696
|
-
|
|
1697
|
-
deps.onRepaint();
|
|
2036
|
+
runDock.update(snapshot);
|
|
1698
2037
|
};
|
|
1699
2038
|
const clearAgentRun = () => {
|
|
1700
|
-
|
|
1701
|
-
deps.onRepaint();
|
|
2039
|
+
runDock.clear();
|
|
1702
2040
|
};
|
|
1703
|
-
const
|
|
2041
|
+
const getAgentRuns = () => runDock.getRuns();
|
|
1704
2042
|
const getActivityLines = (colorEnabled = resolveCliColorEnabled()) => {
|
|
1705
2043
|
const lines = [];
|
|
1706
2044
|
const baseView = getView();
|
|
@@ -1716,9 +2054,7 @@ function createActivityIndicator(deps) {
|
|
|
1716
2054
|
);
|
|
1717
2055
|
}
|
|
1718
2056
|
}
|
|
1719
|
-
|
|
1720
|
-
lines.push(...formatAgentRunPanelLines(agentRunSnapshot, colorEnabled));
|
|
1721
|
-
}
|
|
2057
|
+
lines.push(...runDock.getLines(colorEnabled));
|
|
1722
2058
|
return lines.length > 0 ? lines : null;
|
|
1723
2059
|
};
|
|
1724
2060
|
const stop = () => {
|
|
@@ -1732,69 +2068,134 @@ function createActivityIndicator(deps) {
|
|
|
1732
2068
|
fallbackStartedAt = 0;
|
|
1733
2069
|
lastActivityAt = 0;
|
|
1734
2070
|
stopping = false;
|
|
1735
|
-
agentRunSnapshot = null;
|
|
1736
2071
|
};
|
|
1737
2072
|
return {
|
|
1738
2073
|
report,
|
|
1739
2074
|
updateAgentRun,
|
|
1740
2075
|
clearAgentRun,
|
|
1741
|
-
|
|
2076
|
+
getAgentRuns,
|
|
1742
2077
|
getView,
|
|
1743
2078
|
getActivityLines,
|
|
1744
2079
|
markStopping,
|
|
1745
2080
|
isStopping,
|
|
1746
|
-
stop
|
|
2081
|
+
stop,
|
|
2082
|
+
dispose() {
|
|
2083
|
+
stop();
|
|
2084
|
+
runDock.dispose();
|
|
2085
|
+
}
|
|
1747
2086
|
};
|
|
1748
2087
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
} else {
|
|
1768
|
-
const botIcon = themeText("\u{1F916}", "accent", true);
|
|
1769
|
-
const labelText = themeText(" Sub-Agent: ", "muted", true);
|
|
1770
|
-
const nameText = themeText(`${name}${runId}`, "chrome", true);
|
|
1771
|
-
const statusText = themeText(` \xB7 ${statusSymbol} ${status}`, statusColor, true);
|
|
1772
|
-
const pollsText = pollPart ? themeText(pollPart, "chrome") : "";
|
|
1773
|
-
const errorText = errPart ? themeText(errPart, "danger") : "";
|
|
1774
|
-
lines.push(`${botIcon}${labelText}${nameText}${statusText}${pollsText}${errorText}`);
|
|
2088
|
+
|
|
2089
|
+
// packages/cli/tui/runRegistryPoller.ts
|
|
2090
|
+
var RUN_POLL_INTERVAL_MS = 1e3;
|
|
2091
|
+
var RUN_RECONCILE_SILENCE_MS = 15e3;
|
|
2092
|
+
function snapshotFromRunRecord(record, now) {
|
|
2093
|
+
const label = resolveRunLabel(record);
|
|
2094
|
+
const startedAt = readTimestamp(record.startedAt);
|
|
2095
|
+
const endedAt = readTimestamp(record.endedAt);
|
|
2096
|
+
const activity = record.activity;
|
|
2097
|
+
const counters = activity?.counters;
|
|
2098
|
+
let inFlight = null;
|
|
2099
|
+
const raw = activity?.inFlight;
|
|
2100
|
+
if (raw && !isAgentRunTerminalStatus(record.status)) {
|
|
2101
|
+
const updatedAt = activity?.updatedAt ? Date.parse(activity.updatedAt) : NaN;
|
|
2102
|
+
const base = Number.isFinite(updatedAt) ? updatedAt : now;
|
|
2103
|
+
const startedFrom = base - (Number.isFinite(raw.sinceMs) ? raw.sinceMs : 0);
|
|
2104
|
+
const usable = Number.isFinite(startedFrom) && startedFrom > 0 ? Math.min(startedFrom, now) : now;
|
|
2105
|
+
inFlight = { kind: raw.kind, name: raw.name, startedAt: usable };
|
|
1775
2106
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
2107
|
+
return {
|
|
2108
|
+
runId: record.runId,
|
|
2109
|
+
status: record.status,
|
|
2110
|
+
...isAgentNameFallback(label) ? {} : { agentName: label },
|
|
2111
|
+
...startedAt !== void 0 ? { startedAt } : {},
|
|
2112
|
+
...endedAt !== void 0 ? { finishedAt: endedAt } : {},
|
|
2113
|
+
...typeof counters?.toolCalls === "number" ? { toolCallCount: counters.toolCalls } : {},
|
|
2114
|
+
// note 在终态时是死因("orphaned: process gone…"),非终态时只是备注。
|
|
2115
|
+
...record.note && isAgentRunTerminalStatus(record.status) ? { errorMessage: record.note } : {},
|
|
2116
|
+
inFlight,
|
|
2117
|
+
logKey: ""
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2120
|
+
function fingerprint(snapshot) {
|
|
2121
|
+
return JSON.stringify([
|
|
2122
|
+
snapshot.status,
|
|
2123
|
+
snapshot.agentName ?? "",
|
|
2124
|
+
snapshot.toolCallCount ?? -1,
|
|
2125
|
+
snapshot.errorMessage ?? "",
|
|
2126
|
+
snapshot.finishedAt ?? 0,
|
|
2127
|
+
snapshot.inFlight ? [snapshot.inFlight.kind, snapshot.inFlight.name, snapshot.inFlight.startedAt] : null
|
|
2128
|
+
]);
|
|
2129
|
+
}
|
|
2130
|
+
function createRunRegistryPoller(deps) {
|
|
2131
|
+
const now = deps.now ?? (() => Date.now());
|
|
2132
|
+
const intervalMs = deps.intervalMs ?? RUN_POLL_INTERVAL_MS;
|
|
2133
|
+
const reconcileSilenceMs = deps.reconcileSilenceMs ?? RUN_RECONCILE_SILENCE_MS;
|
|
2134
|
+
const setIntervalFn = deps.setIntervalFn ?? ((cb, ms) => setInterval(cb, ms));
|
|
2135
|
+
const clearIntervalFn = deps.clearIntervalFn ?? ((handle) => clearInterval(handle));
|
|
2136
|
+
let timer = null;
|
|
2137
|
+
let disposed = false;
|
|
2138
|
+
const lastEmitted = /* @__PURE__ */ new Map();
|
|
2139
|
+
const lastReconciledAt = /* @__PURE__ */ new Map();
|
|
2140
|
+
const stop = () => {
|
|
2141
|
+
if (timer !== null) {
|
|
2142
|
+
clearIntervalFn(timer);
|
|
2143
|
+
timer = null;
|
|
1782
2144
|
}
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
2145
|
+
lastEmitted.clear();
|
|
2146
|
+
lastReconciledAt.clear();
|
|
2147
|
+
};
|
|
2148
|
+
const freshnessOf = (record) => {
|
|
2149
|
+
return readTimestamp(record.activity?.updatedAt) ?? readTimestamp(record.startedAt) ?? 0;
|
|
2150
|
+
};
|
|
2151
|
+
const poll = () => {
|
|
2152
|
+
const at = now();
|
|
2153
|
+
const active = deps.getDockedRuns().filter(
|
|
2154
|
+
(run) => run.runId && !isAgentRunTerminalStatus(run.status)
|
|
2155
|
+
);
|
|
2156
|
+
if (active.length === 0) {
|
|
2157
|
+
stop();
|
|
2158
|
+
return;
|
|
1795
2159
|
}
|
|
1796
|
-
|
|
1797
|
-
|
|
2160
|
+
const alive = /* @__PURE__ */ new Set();
|
|
2161
|
+
for (const run of active) {
|
|
2162
|
+
alive.add(run.runId);
|
|
2163
|
+
let record;
|
|
2164
|
+
try {
|
|
2165
|
+
record = deps.readRecord(run.runId);
|
|
2166
|
+
if (deps.reconcile && record && !isAgentRunTerminalStatus(record.status) && at - freshnessOf(record) >= reconcileSilenceMs && at - (lastReconciledAt.get(run.runId) ?? 0) >= reconcileSilenceMs) {
|
|
2167
|
+
lastReconciledAt.set(run.runId, at);
|
|
2168
|
+
record = deps.reconcile(run.runId) ?? record;
|
|
2169
|
+
}
|
|
2170
|
+
} catch {
|
|
2171
|
+
continue;
|
|
2172
|
+
}
|
|
2173
|
+
if (!record) continue;
|
|
2174
|
+
const snapshot = snapshotFromRunRecord(record, at);
|
|
2175
|
+
const mark = fingerprint(snapshot);
|
|
2176
|
+
if (lastEmitted.get(run.runId) === mark) continue;
|
|
2177
|
+
lastEmitted.set(run.runId, mark);
|
|
2178
|
+
deps.update(snapshot);
|
|
2179
|
+
}
|
|
2180
|
+
for (const runId of [...lastEmitted.keys()]) {
|
|
2181
|
+
if (!alive.has(runId)) lastEmitted.delete(runId);
|
|
2182
|
+
}
|
|
2183
|
+
for (const runId of [...lastReconciledAt.keys()]) {
|
|
2184
|
+
if (!alive.has(runId)) lastReconciledAt.delete(runId);
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
return {
|
|
2188
|
+
ensureRunning() {
|
|
2189
|
+
if (disposed || timer !== null) return;
|
|
2190
|
+
timer = setIntervalFn(poll, intervalMs);
|
|
2191
|
+
},
|
|
2192
|
+
poll,
|
|
2193
|
+
stop,
|
|
2194
|
+
dispose() {
|
|
2195
|
+
disposed = true;
|
|
2196
|
+
stop();
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
1798
2199
|
}
|
|
1799
2200
|
|
|
1800
2201
|
// packages/ai/agent/utils/sortUtils.ts
|
|
@@ -3325,7 +3726,7 @@ function handleTuiInput(input, state) {
|
|
|
3325
3726
|
}
|
|
3326
3727
|
if (argText === "all") {
|
|
3327
3728
|
const before = registry.list().filter((p) => p.status === "running").length;
|
|
3328
|
-
registry.stopAll();
|
|
3729
|
+
registry.stopAll(void 0, { includePersist: true });
|
|
3329
3730
|
return { nextState: state, output: t("stopAllDone", String(before)) };
|
|
3330
3731
|
}
|
|
3331
3732
|
if (/^\d+$/.test(argText)) {
|
|
@@ -3600,6 +4001,7 @@ function handleTuiInput(input, state) {
|
|
|
3600
4001
|
}
|
|
3601
4002
|
|
|
3602
4003
|
// packages/cli/tui/detectBackground.ts
|
|
4004
|
+
import { execFileSync } from "node:child_process";
|
|
3603
4005
|
import { ReadStream } from "node:tty";
|
|
3604
4006
|
var OSC11_QUERY = "\x1B]11;?\x07";
|
|
3605
4007
|
var OSC11_REPLY_RE = /\x1b\]11;rgb:([0-9a-f]+)\/([0-9a-f]+)\/([0-9a-f]+)/i;
|
|
@@ -3628,7 +4030,7 @@ function parseOsc11Background(reply) {
|
|
|
3628
4030
|
function isTerminalDevice(stream) {
|
|
3629
4031
|
return stream instanceof ReadStream;
|
|
3630
4032
|
}
|
|
3631
|
-
async function
|
|
4033
|
+
async function probeTerminalBackground(args = {}) {
|
|
3632
4034
|
const stdin = args.stdin ?? process.stdin;
|
|
3633
4035
|
const stdout = args.stdout ?? process.stdout;
|
|
3634
4036
|
const timeoutMs = args.timeoutMs ?? 100;
|
|
@@ -3671,6 +4073,48 @@ async function detectTerminalBackground(args = {}) {
|
|
|
3671
4073
|
timer = setTimeout(() => finish(null), timeoutMs);
|
|
3672
4074
|
});
|
|
3673
4075
|
}
|
|
4076
|
+
async function detectTerminalBackground(args = {}) {
|
|
4077
|
+
const r = await probeTerminalBackground(args);
|
|
4078
|
+
if (r || !args.allowSystemFallback) return r;
|
|
4079
|
+
const brightness = detectSystemBrightness(process.env, { allowSubprocess: true });
|
|
4080
|
+
return brightness ? { brightness, hex: "" } : null;
|
|
4081
|
+
}
|
|
4082
|
+
function detectSystemBrightness(env = process.env, options = {}) {
|
|
4083
|
+
const envResult = detectSystemBrightnessFromEnv(env);
|
|
4084
|
+
if (envResult) return envResult;
|
|
4085
|
+
const allowSubprocess = options.allowSubprocess ?? false;
|
|
4086
|
+
if (!allowSubprocess) {
|
|
4087
|
+
return null;
|
|
4088
|
+
}
|
|
4089
|
+
if (process.platform === "darwin") {
|
|
4090
|
+
try {
|
|
4091
|
+
const out = execFileSync("defaults", ["read", "-g", "AppleInterfaceStyle"], {
|
|
4092
|
+
encoding: "utf8",
|
|
4093
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
4094
|
+
timeout: 200
|
|
4095
|
+
}).trim();
|
|
4096
|
+
if (out.toLowerCase() === "dark") return "dark";
|
|
4097
|
+
} catch {
|
|
4098
|
+
}
|
|
4099
|
+
} else if (process.platform === "linux") {
|
|
4100
|
+
try {
|
|
4101
|
+
const out = execFileSync(
|
|
4102
|
+
"gsettings",
|
|
4103
|
+
["get", "org.gnome.desktop.interface", "color-scheme"],
|
|
4104
|
+
{
|
|
4105
|
+
encoding: "utf8",
|
|
4106
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
4107
|
+
timeout: 200
|
|
4108
|
+
}
|
|
4109
|
+
).trim();
|
|
4110
|
+
const val = out.toLowerCase();
|
|
4111
|
+
if (/(?:^|[\s\-_:])dark(?:$|[\s\-_:])/i.test(val)) return "dark";
|
|
4112
|
+
if (/(?:^|[\s\-_:])light(?:$|[\s\-_:])/i.test(val)) return "light";
|
|
4113
|
+
} catch {
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
return null;
|
|
4117
|
+
}
|
|
3674
4118
|
|
|
3675
4119
|
// packages/core/chat/chatQueueMachine.ts
|
|
3676
4120
|
var initialChatQueueState = {
|
|
@@ -4032,8 +4476,8 @@ function renderTurnBlock(role, content, contentWidth, colorEnabled) {
|
|
|
4032
4476
|
const line = logicalLines[i];
|
|
4033
4477
|
let styledLine;
|
|
4034
4478
|
if (colorEnabled) {
|
|
4035
|
-
const prefix = i === 0 ? `${accentSeq}\u276F
|
|
4036
|
-
styledLine = `${prefix}${line}`;
|
|
4479
|
+
const prefix = i === 0 ? `${accentSeq}\u276F ` : `${chromeSeq}\u2502 `;
|
|
4480
|
+
styledLine = `${prefix}\x1B[1m${accentSeq}${line}`;
|
|
4037
4481
|
} else {
|
|
4038
4482
|
const prefix = i === 0 ? "\u276F " : " ";
|
|
4039
4483
|
styledLine = `${prefix}${line}`;
|
|
@@ -4766,6 +5210,52 @@ ${content}`;
|
|
|
4766
5210
|
return null;
|
|
4767
5211
|
}
|
|
4768
5212
|
var autoRouteByDialog = /* @__PURE__ */ new Map();
|
|
5213
|
+
function toOverlayStatus(status) {
|
|
5214
|
+
switch (status) {
|
|
5215
|
+
case "running":
|
|
5216
|
+
return "running";
|
|
5217
|
+
case "done":
|
|
5218
|
+
return "done";
|
|
5219
|
+
case "failed":
|
|
5220
|
+
case "timeout":
|
|
5221
|
+
case "killed":
|
|
5222
|
+
return "failed";
|
|
5223
|
+
case "orphaned":
|
|
5224
|
+
return "orphaned";
|
|
5225
|
+
default:
|
|
5226
|
+
return "running";
|
|
5227
|
+
}
|
|
5228
|
+
}
|
|
5229
|
+
function buildTuiRunOverlay(parentDialogId, reported) {
|
|
5230
|
+
if (!parentDialogId) return null;
|
|
5231
|
+
let runs;
|
|
5232
|
+
try {
|
|
5233
|
+
runs = queryRunRecords({ parentDialogId }, { env: process.env }).runs;
|
|
5234
|
+
} catch {
|
|
5235
|
+
return null;
|
|
5236
|
+
}
|
|
5237
|
+
if (runs.length === 0) return null;
|
|
5238
|
+
if (reported) {
|
|
5239
|
+
runs = runs.filter((run) => reported.get(run.runId) !== run.status);
|
|
5240
|
+
for (const run of runs) reported.set(run.runId, run.status);
|
|
5241
|
+
if (runs.length === 0) return null;
|
|
5242
|
+
}
|
|
5243
|
+
let overlay = initialRunOverlayState;
|
|
5244
|
+
for (const run of runs) {
|
|
5245
|
+
overlay = reduceRunOverlay(overlay, {
|
|
5246
|
+
type: "run-state-chg",
|
|
5247
|
+
runId: run.runId,
|
|
5248
|
+
info: {
|
|
5249
|
+
name: run.agentName ?? run.agentKey ?? run.runId,
|
|
5250
|
+
status: toOverlayStatus(run.status),
|
|
5251
|
+
batchId: run.batchId,
|
|
5252
|
+
parentDialogId: run.parentDialogId,
|
|
5253
|
+
...run.status === "failed" && run.note ? { errorMessage: run.note } : {}
|
|
5254
|
+
}
|
|
5255
|
+
});
|
|
5256
|
+
}
|
|
5257
|
+
return buildOverlayPresentation(overlay);
|
|
5258
|
+
}
|
|
4769
5259
|
async function runAgentChat(scriptDir, state, message, env, output, agentRunner = runAgentTurn, options = {}) {
|
|
4770
5260
|
let effectiveAgentKey = state.agentKey;
|
|
4771
5261
|
let effectiveAgentName = state.agentName;
|
|
@@ -4889,6 +5379,7 @@ async function runAgentChat(scriptDir, state, message, env, output, agentRunner
|
|
|
4889
5379
|
serverUrl: state.serverUrl,
|
|
4890
5380
|
message: effectiveMessage,
|
|
4891
5381
|
continueDialogId: state.dialogId,
|
|
5382
|
+
...state.agentKey === DEFAULT_TUI_AGENT_KEY && env.NOLO_AUTO_ROUTE !== "0" ? { dialogAgentMode: "auto" } : { dialogAgentMode: "fixed" },
|
|
4892
5383
|
runtimeMode: state.runtimeMode,
|
|
4893
5384
|
localRuntimeCwd: process.cwd(),
|
|
4894
5385
|
scriptDir,
|
|
@@ -4902,14 +5393,21 @@ async function runAgentChat(scriptDir, state, message, env, output, agentRunner
|
|
|
4902
5393
|
...options.confirmDestructiveAction ? { confirmDestructiveAction: options.confirmDestructiveAction } : {},
|
|
4903
5394
|
...options.requestUserChoice ? { requestUserChoice: options.requestUserChoice } : {},
|
|
4904
5395
|
...options.abortSignal ? { abortSignal: options.abortSignal } : {},
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
5396
|
+
// Always inject a local adapter factory so background run delegations from
|
|
5397
|
+
// inside a TUI turn are stamped with the current conversation. Previously
|
|
5398
|
+
// this factory only existed when pasted text was present, which meant a
|
|
5399
|
+
// plain (no-paste) turn had no injection point for parentDialogId and the
|
|
5400
|
+
// run-overlay could never see runs spawned this turn.
|
|
5401
|
+
...options.pastedTextStore?.items.size ? { pastedTextStore: options.pastedTextStore } : {},
|
|
5402
|
+
localRuntimeAdapterFactory: (factoryEnv, factoryOptions) => createCliLocalRuntimeAdapter({
|
|
5403
|
+
env: factoryEnv,
|
|
5404
|
+
cwd: factoryOptions?.cwd ?? state.cwd,
|
|
5405
|
+
...options.pastedTextStore ? { pastedTextStore: options.pastedTextStore } : {},
|
|
5406
|
+
// Stamp spawned background runs with the current TUI dialog so the
|
|
5407
|
+
// run-overlay can filter runs belonging to this conversation.
|
|
5408
|
+
...state.dialogId ? { parentDialogId: state.dialogId } : {},
|
|
5409
|
+
...options.activityReporter ? { activityReporter: options.activityReporter } : {}
|
|
5410
|
+
}),
|
|
4913
5411
|
...options.activityReporter ? { activityReporter: options.activityReporter } : {},
|
|
4914
5412
|
...skillAllowedTools !== void 0 ? { allowedToolNames: skillAllowedTools } : {},
|
|
4915
5413
|
...contextBlockScopes.length > 0 ? { contextBlockScopes } : {}
|
|
@@ -5151,7 +5649,8 @@ async function startTuiWorkspace(options) {
|
|
|
5151
5649
|
}
|
|
5152
5650
|
const detected = await detectTerminalBackground({
|
|
5153
5651
|
stdin: input,
|
|
5154
|
-
stdout: output
|
|
5652
|
+
stdout: output,
|
|
5653
|
+
allowSystemFallback: true
|
|
5155
5654
|
});
|
|
5156
5655
|
if (detected) {
|
|
5157
5656
|
setActiveBrightness(detected.brightness);
|
|
@@ -5184,6 +5683,13 @@ async function startTuiWorkspace(options) {
|
|
|
5184
5683
|
}
|
|
5185
5684
|
});
|
|
5186
5685
|
const activityReporter = (label) => activityIndicator.report(label);
|
|
5686
|
+
const reportedRunStatuses = /* @__PURE__ */ new Map();
|
|
5687
|
+
const runRegistryPoller = createRunRegistryPoller({
|
|
5688
|
+
getDockedRuns: () => activityIndicator.getAgentRuns(),
|
|
5689
|
+
update: (snapshot) => activityIndicator.updateAgentRun(snapshot),
|
|
5690
|
+
readRecord: (runId) => readRunRecord(runId),
|
|
5691
|
+
reconcile: (runId) => checkStaleRun(runId)
|
|
5692
|
+
});
|
|
5187
5693
|
let explicitAgentSwitch = false;
|
|
5188
5694
|
let copyViewExitResolver = null;
|
|
5189
5695
|
let copyViewRender = null;
|
|
@@ -5317,7 +5823,8 @@ async function startTuiWorkspace(options) {
|
|
|
5317
5823
|
if (!isInteractiveInput(input)) return;
|
|
5318
5824
|
const detected2 = await detectTerminalBackground({
|
|
5319
5825
|
stdin: input,
|
|
5320
|
-
stdout: output
|
|
5826
|
+
stdout: output,
|
|
5827
|
+
allowSystemFallback: true
|
|
5321
5828
|
});
|
|
5322
5829
|
if (sessionEnded) return;
|
|
5323
5830
|
if (!detected2) {
|
|
@@ -5348,6 +5855,7 @@ async function startTuiWorkspace(options) {
|
|
|
5348
5855
|
forcedStop = false;
|
|
5349
5856
|
turnEpoch += 1;
|
|
5350
5857
|
const myEpoch = turnEpoch;
|
|
5858
|
+
const turnParentDialogId = state.dialogId;
|
|
5351
5859
|
history.followBottom = true;
|
|
5352
5860
|
startTurn(history, "user");
|
|
5353
5861
|
appendToCurrentTurn(history, message);
|
|
@@ -5397,6 +5905,7 @@ async function startTuiWorkspace(options) {
|
|
|
5397
5905
|
onAgentRunStatus: (snapshot) => {
|
|
5398
5906
|
if (snapshot) {
|
|
5399
5907
|
activityIndicator.updateAgentRun(snapshot);
|
|
5908
|
+
runRegistryPoller.ensureRunning();
|
|
5400
5909
|
} else {
|
|
5401
5910
|
activityIndicator.clearAgentRun();
|
|
5402
5911
|
}
|
|
@@ -5445,7 +5954,11 @@ async function startTuiWorkspace(options) {
|
|
|
5445
5954
|
dialogLabel: runResult.title || runResult.dialogId
|
|
5446
5955
|
} : {},
|
|
5447
5956
|
...runResult.turnTokens ? { turnTokens: runResult.turnTokens } : {},
|
|
5448
|
-
...runResult.contextWindow ? { contextWindow: runResult.contextWindow } : {}
|
|
5957
|
+
...runResult.contextWindow ? { contextWindow: runResult.contextWindow } : {},
|
|
5958
|
+
// input_tokens 是累计上下文输入(含历史消息),把它持久化到
|
|
5959
|
+
// estimatedContextTokens:下一轮若 provider 不返回 usage,context
|
|
5960
|
+
// chip 仍显示真实累计占用而不是回退到启动时的静态估算。
|
|
5961
|
+
...runResult.turnTokens && runResult.turnTokens.input > 0 ? { estimatedContextTokens: runResult.turnTokens.input } : {}
|
|
5449
5962
|
};
|
|
5450
5963
|
}
|
|
5451
5964
|
if (!wasAborted && runResult.exitCode !== 0) {
|
|
@@ -5459,6 +5972,14 @@ async function startTuiWorkspace(options) {
|
|
|
5459
5972
|
emitCommandOutput(t("dialogNotSavedHint"));
|
|
5460
5973
|
}
|
|
5461
5974
|
}
|
|
5975
|
+
if (!wasAborted) {
|
|
5976
|
+
const overlayText = buildTuiRunOverlay(turnParentDialogId, reportedRunStatuses);
|
|
5977
|
+
if (overlayText) {
|
|
5978
|
+
emitCommandOutput(`
|
|
5979
|
+
\u4F60\u7684 run \u8FDB\u5C55\uFF1A
|
|
5980
|
+
${overlayText}`);
|
|
5981
|
+
}
|
|
5982
|
+
}
|
|
5462
5983
|
return { ok: !wasAborted, aborted: wasAborted };
|
|
5463
5984
|
} finally {
|
|
5464
5985
|
activityIndicator.stop();
|
|
@@ -5609,7 +6130,8 @@ async function startTuiWorkspace(options) {
|
|
|
5609
6130
|
if (result.action?.type === "theme-refresh") {
|
|
5610
6131
|
const detected2 = await detectTerminalBackground({
|
|
5611
6132
|
stdin: input,
|
|
5612
|
-
stdout: output
|
|
6133
|
+
stdout: output,
|
|
6134
|
+
allowSystemFallback: true
|
|
5613
6135
|
});
|
|
5614
6136
|
if (detected2 && applyDetectedBackground(detected2)) {
|
|
5615
6137
|
emitCommandOutput(t("themeRefreshed", detected2.brightness));
|
|
@@ -5937,6 +6459,8 @@ ${err.message}` : ""}`
|
|
|
5937
6459
|
clearInterval(autoThemeTimer);
|
|
5938
6460
|
autoThemeTimer = null;
|
|
5939
6461
|
}
|
|
6462
|
+
runRegistryPoller.dispose();
|
|
6463
|
+
activityIndicator.dispose();
|
|
5940
6464
|
resolveDone?.();
|
|
5941
6465
|
clearCollapsedPasteStore(pasteStore);
|
|
5942
6466
|
resizeTarget.off?.("resize", onResize);
|
|
@@ -6315,7 +6839,13 @@ ${renderStatusLine(state)}
|
|
|
6315
6839
|
rl.prompt();
|
|
6316
6840
|
}
|
|
6317
6841
|
} finally {
|
|
6318
|
-
getProcessRegistry()
|
|
6842
|
+
const registry = getProcessRegistry();
|
|
6843
|
+
const persistentCount = registry.list().filter((p) => p.persist && p.status === "running").length;
|
|
6844
|
+
registry.stopAll();
|
|
6845
|
+
if (persistentCount > 0) {
|
|
6846
|
+
output.write(`[nolo] ${t("persistentProcessesLeft", String(persistentCount))}
|
|
6847
|
+
`);
|
|
6848
|
+
}
|
|
6319
6849
|
rl.close();
|
|
6320
6850
|
}
|
|
6321
6851
|
}
|
|
@@ -6325,6 +6855,7 @@ export {
|
|
|
6325
6855
|
applyOutputChunkToCurrentTurn,
|
|
6326
6856
|
applyScrollAction,
|
|
6327
6857
|
applyTerminalOutputToText,
|
|
6858
|
+
buildTuiRunOverlay,
|
|
6328
6859
|
countPhysicalLines,
|
|
6329
6860
|
createFixedInput,
|
|
6330
6861
|
createHistoryOutputStream,
|