nolo-cli 0.227.0-alpha.1 → 0.228.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-JKQGZ3HU.js → _executeModel-WZKT6XEU.js} +76 -77
- package/{action-CK64LS6S.js → action-GDZDXPMB.js} +9 -9
- package/{addContentAction-CARFID6E.js → addContentAction-7RO4AMRI.js} +14 -14
- package/{addDialogAgentAction-APLZLFW5.js → addDialogAgentAction-EVYBGTXB.js} +16 -16
- package/{agentDeleteCommand-NVR2V2HH.js → agentDeleteCommand-PZWRHNXY.js} +113 -114
- package/{agentEmailCommands-UCVOWD3S.js → agentEmailCommands-QTKMEICX.js} +116 -117
- package/{agentFavoriteCommands-4PDOP3GW.js → agentFavoriteCommands-7LOP3HUD.js} +6 -6
- package/{agentGrantCommands-FLCEXLUH.js → agentGrantCommands-L6O2HVJI.js} +7 -7
- package/{agentListCommands-C65UESYM.js → agentListCommands-GUGMORTK.js} +72 -71
- package/{agentMachineCommands-V3DGEJU4.js → agentMachineCommands-7QGICJLM.js} +57 -56
- package/{agentProviderCommands-7QBFRFRK.js → agentProviderCommands-STI3DQ6A.js} +7 -7
- package/{agentPullCommand-E6JBGBVG.js → agentPullCommand-KHV4EELF.js} +6 -6
- package/{agentRecordCommands-6RCJS2EY.js → agentRecordCommands-SLLADS5C.js} +104 -105
- package/{agentRunCommand-P3GRKXKS.js → agentRunCommand-OFQLOF5Y.js} +110 -111
- package/{agentRunControl-SNZZ5XP4.js → agentRunControl-MBG4U6SL.js} +23 -17
- package/{agentRuntimeLocal-GOX2DIY7.js → agentRuntimeLocal-TU4LA353.js} +44 -44
- package/{agentSlice-N7H2FRJA.js → agentSlice-L4SBGWTB.js} +17 -17
- package/{appDeleteCommands-LZDN26FU.js → appDeleteCommands-JWP3XPUA.js} +52 -51
- package/{appDeployCommands-6IO6TTZH.js → appDeployCommands-6E4TQCWI.js} +52 -51
- package/{appDeployStatusCommands-FG3LX24J.js → appDeployStatusCommands-ALU4SADG.js} +52 -51
- package/{appGetCommands-NAKVDVD4.js → appGetCommands-JEY4L6L4.js} +52 -51
- package/{appListCommands-KL56RN73.js → appListCommands-PCAVHU7M.js} +52 -51
- package/{authCommand-AUN5MXV2.js → authCommand-CGRIIOOV.js} +30 -31
- package/{authCommands-D2IPS6ES.js → authCommands-55OGQGCR.js} +12 -13
- package/{builtinSkillRegistry-UQGLKRYP.js → builtinSkillRegistry-BAE2LDXF.js} +4 -4
- package/{chromeOpsCommands-UJWN5HWH.js → chromeOpsCommands-WAA45NCS.js} +8 -8
- package/{chunk-OB6DVWPF.js → chunk-262R3XNN.js} +16 -2
- package/{chunk-KMRKZNGT.js → chunk-2MCB7CD7.js} +13 -12
- package/{chunk-YPPKC6FL.js → chunk-2NPD3FTX.js} +3 -3
- package/{chunk-UN7HIYMH.js → chunk-2X7WFDT6.js} +1 -1
- package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
- package/{chunk-JWXITTQB.js → chunk-3P54D2E4.js} +1 -1
- package/{chunk-RU6DULV4.js → chunk-3U44JB3O.js} +1 -1
- package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
- package/{chunk-PLPLH2XZ.js → chunk-4ZGPHFLE.js} +2 -2
- package/{chunk-NO3VBWTL.js → chunk-547ENH5T.js} +1 -1
- package/chunk-5ZUOVCKT.js +32 -0
- package/{chunk-XZODOEKU.js → chunk-6QHKRARD.js} +2 -2
- package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
- package/{chunk-VPAZ6BEN.js → chunk-7JGMNKKG.js} +18 -14
- package/{chunk-3VFYQH3I.js → chunk-AGYPUBFW.js} +14 -39
- package/{chunk-5HL4KC4A.js → chunk-ALAES342.js} +57 -86
- package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
- package/{chunk-CQVGR3MX.js → chunk-AUAJTAFM.js} +8 -8
- package/chunk-BIDSIRTS.js +307 -0
- package/chunk-BIWI5M4E.js +62 -0
- package/{chunk-L5I543VB.js → chunk-BNMPUQW6.js} +1 -1
- package/{chunk-UCFPVYP7.js → chunk-BP5ZJ6B4.js} +1 -1
- package/{chunk-2G3YSVO6.js → chunk-CBUZ6DKA.js} +3 -3
- package/{chunk-KYH7XW3K.js → chunk-CD3RU7XL.js} +16 -1
- package/{chunk-SFTTXGPM.js → chunk-CMMI3DAT.js} +16 -16
- package/{chunk-VZW34YUL.js → chunk-CYWNWA77.js} +5 -5
- package/{chunk-5LQDHFBN.js → chunk-D6YNCNM6.js} +14 -11
- package/{chunk-UVUVQVZ6.js → chunk-DBUR22G5.js} +2 -2
- package/{chunk-7Z3WUZ4Q.js → chunk-DDC6P6EH.js} +24 -24
- package/{chunk-G6HJUMST.js → chunk-DEA37IUY.js} +2 -2
- package/{chunk-5RKRXQ2H.js → chunk-DGYCDA6W.js} +2 -2
- package/{chunk-3HTP4WZQ.js → chunk-DUUDXSLX.js} +21 -7
- package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
- package/{chunk-TOKPHZ55.js → chunk-EEOOBRA7.js} +5 -5
- package/{chunk-UAPNPNSG.js → chunk-EXJK7TQO.js} +1040 -582
- package/{chunk-OXA5GWHU.js → chunk-F6Z6ZCUV.js} +2 -2
- package/{chunk-X2KRQP7V.js → chunk-FJSNBZXR.js} +1 -1
- package/{chunk-KRRE4A7D.js → chunk-G7IUT2V3.js} +3 -2
- package/{chunk-VIHDJ3FK.js → chunk-GACR7H6T.js} +14 -14
- package/{chunk-GOLPOTG5.js → chunk-GOCSSER3.js} +3 -3
- package/{chunk-NAOO4PVX.js → chunk-GPOV42YM.js} +16 -16
- package/{chunk-C2B7M567.js → chunk-GUXZK7SE.js} +5 -5
- package/{chunk-TINJKQSO.js → chunk-GYS5FUYR.js} +20 -20
- package/{chunk-IAJJYHIB.js → chunk-H6L2NFHY.js} +7 -7
- package/{chunk-45LZIYXB.js → chunk-HBRDSQ3M.js} +1 -1
- package/{chunk-T5N6NHAT.js → chunk-HHFGE2WF.js} +3 -3
- package/{chunk-IX2BXN2K.js → chunk-HSSBDZLD.js} +3 -3
- package/{chunk-MWHOH4RJ.js → chunk-HYLRQDEE.js} +4 -4
- package/{chunk-ZYA2YDB6.js → chunk-IAAIUH64.js} +16 -16
- package/{chunk-LXTC53TN.js → chunk-IXG6YXQM.js} +143 -123
- package/{chunk-CVERLOJM.js → chunk-JUSHVFNF.js} +236 -182
- package/{chunk-ABGULE7H.js → chunk-K67C2JUC.js} +12 -12
- package/{chunk-T2BEPTAG.js → chunk-L32W3PRP.js} +47 -17
- package/{chunk-M3Y4IBIR.js → chunk-M4SFKP5L.js} +4 -4
- package/{chunk-ZI5SZ3MV.js → chunk-MDZWUD3R.js} +20 -20
- package/{chunk-F5AY2UZL.js → chunk-NHY322ZU.js} +8 -8
- package/{chunk-KJAAPGBE.js → chunk-OBIC6EG7.js} +6 -6
- package/{chunk-4OKTPFNX.js → chunk-OG6MQOQG.js} +105 -37
- package/{chunk-AXYH4734.js → chunk-OOJNQK6V.js} +13 -13
- package/{chunk-XIEYGCN6.js → chunk-OWKNSIXL.js} +149 -48
- package/{chunk-JHF6VLVL.js → chunk-OYU2MA5S.js} +29 -29
- package/{chunk-6XIE5ZGI.js → chunk-PDCV7P5W.js} +1 -1
- package/{chunk-CKT6QUE2.js → chunk-Q3IVPFVO.js} +1 -1
- package/{chunk-PHOSZT3E.js → chunk-QBZCGP34.js} +1 -1
- package/{chunk-CLCXHIBS.js → chunk-QCB42576.js} +1 -1
- package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
- package/{chunk-YQETUZ5V.js → chunk-QRGDJA4B.js} +11 -11
- package/{chunk-ULAQPRHX.js → chunk-QYB23WUH.js} +1 -1
- package/{chunk-PVAWNHP5.js → chunk-R3NEQZ53.js} +295 -102
- package/{chunk-CSW7IPVD.js → chunk-R6Z5S5GA.js} +11 -11
- package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
- package/{chunk-GUVXQSFZ.js → chunk-RBPUNSG5.js} +1 -1
- package/{chunk-GOQ6ZVTN.js → chunk-RG2DGNL6.js} +3 -3
- package/{chunk-6EDAMVG6.js → chunk-RTHFJZ6M.js} +10 -10
- package/{chunk-YOT437BH.js → chunk-RYOLWYBK.js} +122 -118
- package/{chunk-WJP4TH6U.js → chunk-S6FDXXZV.js} +1 -1
- package/{chunk-SW6OD4KE.js → chunk-SMJEXX2S.js} +123 -12
- package/{chunk-LJSNEV7M.js → chunk-SRCCSTIM.js} +7 -7
- package/{chunk-FKEZOMIF.js → chunk-STJ6LSQE.js} +453 -193
- package/{chunk-L42CBKBZ.js → chunk-TGNIKIHR.js} +3 -3
- package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
- package/{chunk-SRG5CNLC.js → chunk-TSPMLCWI.js} +6 -6
- package/{chunk-YGILMZ7N.js → chunk-TUSTONB3.js} +1 -1
- package/{chunk-2SKTCNWO.js → chunk-UE2EVEYS.js} +2 -2
- package/{chunk-ZADGPNTV.js → chunk-UWAIJOF2.js} +29 -29
- package/{chunk-HVUDBOQG.js → chunk-VMJVAJ6W.js} +9 -6
- package/{chunk-LA7JYAKF.js → chunk-VSYTM22R.js} +3 -3
- package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
- package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
- package/{chunk-GRXSJR2Z.js → chunk-XJPLSAPJ.js} +21 -21
- package/{chunk-HYKGIXNO.js → chunk-XSW4EXQV.js} +85 -21
- package/{chunk-T43K75CK.js → chunk-YKY4OVOX.js} +15 -15
- package/{chunk-5RKUPJYL.js → chunk-ZH3KXFHS.js} +11 -3
- package/chunk-ZOHO6MOF.js +376 -0
- package/{chunk-PXKF5CV4.js → chunk-ZXF6D3I6.js} +10 -8
- package/{cliAgentConfigHelpers-QVSQYTKC.js → cliAgentConfigHelpers-BTRHMPW2.js} +14 -14
- package/{cliEnvHelpers-D6HMC46Z.js → cliEnvHelpers-CNMP3RDX.js} +2 -2
- package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
- package/{cliLocalAgentRecordReader-SPKAJYME.js → cliLocalAgentRecordReader-M3F76NIP.js} +46 -46
- package/{commandRegistry-TKR6OWXP.js → commandRegistry-ZLWHQVAI.js} +93 -93
- package/{contentThunks-BQWRPCTM.js → contentThunks-4ZX2TO7C.js} +36 -35
- package/{cooldownCommands-FZYQOWI5.js → cooldownCommands-YB5H5BBK.js} +3 -3
- package/{createAgentAutomationAction-GFI6SJZV.js → createAgentAutomationAction-L4CYUZJG.js} +36 -35
- package/{createDialogAction-MMBIHFFU.js → createDialogAction-QTU2R2Q3.js} +37 -37
- package/{createPageAction-EEYUE5FB.js → createPageAction-F3GJTHW2.js} +39 -38
- package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
- package/{dbSlice-X4Z4E4QU.js → dbSlice-XRUZOGSU.js} +13 -13
- package/{deleteFile-QOOP2UK7.js → deleteFile-6URDHYRB.js} +9 -9
- package/{dialogCommands-OXBQ73DD.js → dialogCommands-NRLCOPJR.js} +56 -56
- package/{dialogNotifyCommand-VWS5G4OO.js → dialogNotifyCommand-SHGPCU22.js} +17 -17
- package/{dialogSlice-KGYIABDY.js → dialogSlice-P2S4LXQD.js} +34 -33
- package/{dialogUsageCommand-FEWCN7IA.js → dialogUsageCommand-W2WCSGKF.js} +6 -6
- package/{docCreateCommands-LS32VKY3.js → docCreateCommands-YJRDA3RX.js} +51 -50
- package/{docDeleteCommands-JTYR5RPH.js → docDeleteCommands-A5QIHZNF.js} +53 -52
- package/{docReadCommands-E5LTVKWN.js → docReadCommands-CF2LTMYH.js} +51 -50
- package/{docStore-TVS2FNER.js → docStore-6O7NYL6A.js} +15 -15
- package/{docUpdateCommands-I3J3JDZ2.js → docUpdateCommands-QRKV4ZXE.js} +51 -50
- package/{fetchMessages-Q3INLN5F.js → fetchMessages-TQEUZD7H.js} +3 -3
- package/{getPricing-VNGFM4PN.js → getPricing-LF5C4XSI.js} +6 -6
- package/{handleSendMessageAction-SSON36TJ.js → handleSendMessageAction-7IHLR37A.js} +66 -66
- package/{hostCredentialCreate-WTW4THJF.js → hostCredentialCreate-VNCQUAFT.js} +104 -105
- package/index.js +54 -16
- package/keys-RWF7UCB4.js +1 -1
- package/{localDialogRead-V36DX2Q2.js → localDialogRead-CCOCVGAP.js} +2 -2
- package/{localRuntimeAdapter-MI2JGXSF.js → localRuntimeAdapter-FOWVNMIK.js} +111 -112
- package/{machineCommands-3LROJZDK.js → machineCommands-ZGC3J4JB.js} +115 -116
- package/{machineWsRunDispatch-BUUJRUUB.js → machineWsRunDispatch-KK5U4M3G.js} +102 -103
- package/{memberThunks-CFEPHAND.js → memberThunks-7Y3OYSJQ.js} +17 -17
- package/{memoryCommands-JQMEJO7J.js → memoryCommands-BC6REPQB.js} +6 -6
- package/{overlay-THLKYIWY.js → overlay-BBQZXGYI.js} +5 -3
- package/package.json +1 -1
- package/{projectArchive-3X54XFVN.js → projectArchive-7ZDYBXAX.js} +44 -43
- package/{providerPresetApply-FO36N5TX.js → providerPresetApply-WHAMP2D5.js} +9 -9
- package/{providerRegistry-U2BSFE6K.js → providerRegistry-ZI2KORJ7.js} +9 -9
- package/{read-KA3L2V7O.js → read-TYMBGEXO.js} +9 -9
- package/{readDocTool-AMAZAPAW.js → readDocTool-SKQVHBLO.js} +1 -1
- package/{readlineWorkspace-Z3YUH4SX.js → readlineWorkspace-YHT4SX2C.js} +4391 -4161
- package/{removeDialogAgentAction-JQOJSUM7.js → removeDialogAgentAction-F5QE2O2B.js} +19 -19
- package/{runAgentClientLoop-4FCFLMDJ.js → runAgentClientLoop-H4ED5V3K.js} +70 -71
- package/{runtimeDoctorCommands-CXOCVDPU.js → runtimeDoctorCommands-RRKPBGVO.js} +16 -16
- package/{secretCommands-GGUAWAE7.js → secretCommands-KZWBZIYS.js} +2 -2
- package/{setDialogExtraReferencesAction-YXQTGXIN.js → setDialogExtraReferencesAction-72L27ERM.js} +15 -15
- package/{setPrimaryDialogAgentAction-YNLB66WE.js → setPrimaryDialogAgentAction-GJJDUSGJ.js} +19 -19
- package/{settingThunks-E6N7RSSS.js → settingThunks-ZRGWVGZD.js} +18 -18
- package/{skillDiscovery-B5V23AXP.js → skillDiscovery-I37M5KJC.js} +3 -3
- package/{spaceCommands-DB5DKC2J.js → spaceCommands-MEH3HJBC.js} +53 -52
- package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
- package/{streamAgentChatTurn-FCBGMD4D.js → streamAgentChatTurn-ZXPOXU33.js} +91 -92
- package/{switchDialogAgentAction-LAHLUECU.js → switchDialogAgentAction-IIJBPND3.js} +16 -16
- package/{tableCommands-VNSXHAMG.js → tableCommands-FTAOCBTX.js} +12 -12
- package/{tools-6JD36D6K.js → tools-2MRWA2PP.js} +59 -60
- package/tuiRestart-2IL37YIB.js +41 -0
- package/{tuiSummaryLlmCaller-UHZIPGAX.js → tuiSummaryLlmCaller-W2QN4VAC.js} +21 -21
- package/{updateCommands-KZ54HCU5.js → updateCommands-CPATDG6J.js} +8 -6
- package/{updateDialogTitleAction-RV3EUEN3.js → updateDialogTitleAction-RZ3KZSGQ.js} +36 -35
- package/{usageCommand-KFVV6UL3.js → usageCommand-2BF74MKF.js} +2 -2
- package/{usageRebuildCommand-HHFSNK46.js → usageRebuildCommand-UHB55BQM.js} +3 -3
- package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-ZFD6J5HF.js} +2 -2
- package/chunk-BJF2MHJ3.js +0 -118
- package/chunk-KEPOVMF4.js +0 -91
- package/chunk-PMDVQBGA.js +0 -100
- package/chunk-WACI5I6V.js +0 -147
- package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +4 -4
- package/{chunk-AGP3YSEC.js → chunk-4N6G2CKP.js} +3 -3
- package/{chunk-VXL2FZTP.js → chunk-HXER7YJF.js} +3 -3
- package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
- package/{chunk-SSGTV4FC.js → chunk-USGHJSGO.js} +5 -5
- package/{chunk-IC2I373Q.js → chunk-VS276URX.js} +3 -3
- package/{chunk-AETZ7AD6.js → chunk-W6RFEDN4.js} +3 -3
- package/{offlineMarxistsAgentCommand-AGA2X5E4.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +5 -5
- package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
|
@@ -2,8 +2,11 @@ import {
|
|
|
2
2
|
findPotentialSecrets
|
|
3
3
|
} from "./chunk-6QDYSCPW.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
applyMemoryInterpreterMutation,
|
|
6
|
+
deriveStateResident,
|
|
7
|
+
resolvePureVNextRuntime,
|
|
8
|
+
touchMemoryItemsInDb
|
|
9
|
+
} from "./chunk-ZOHO6MOF.js";
|
|
7
10
|
import {
|
|
8
11
|
getReadableCliDb
|
|
9
12
|
} from "./chunk-YFLVRVYK.js";
|
|
@@ -21,6 +24,7 @@ import {
|
|
|
21
24
|
isLiveAgentRunObservation,
|
|
22
25
|
isMachineBoundLocalhostCustomProvider,
|
|
23
26
|
isSubtaskRun,
|
|
27
|
+
normalizeCliRunImages,
|
|
24
28
|
parseAgentRunArgs,
|
|
25
29
|
parseAgentRunEvent,
|
|
26
30
|
readFlagValue,
|
|
@@ -31,15 +35,7 @@ import {
|
|
|
31
35
|
resolveServerUrl,
|
|
32
36
|
validateInstaboxWorkspaceSelection,
|
|
33
37
|
writeUsage
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import {
|
|
36
|
-
clearCredentialAvailability,
|
|
37
|
-
readEffectiveCredentialEntry
|
|
38
|
-
} from "./chunk-FIYSMXHY.js";
|
|
39
|
-
import {
|
|
40
|
-
readDbRecord,
|
|
41
|
-
resolveAgentRecordFromHybridStore
|
|
42
|
-
} from "./chunk-5LQDHFBN.js";
|
|
38
|
+
} from "./chunk-STJ6LSQE.js";
|
|
43
39
|
import {
|
|
44
40
|
boxGlyphs,
|
|
45
41
|
displayWidth,
|
|
@@ -47,26 +43,22 @@ import {
|
|
|
47
43
|
stripAnsi,
|
|
48
44
|
tokenizeAnsiLine,
|
|
49
45
|
visibleWidth
|
|
50
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-XSW4EXQV.js";
|
|
51
47
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
clearCredentialAvailability,
|
|
49
|
+
readEffectiveCredentialEntry
|
|
50
|
+
} from "./chunk-WWTSEBDF.js";
|
|
51
|
+
import {
|
|
52
|
+
CliProviderQuotaError
|
|
53
|
+
} from "./chunk-R7XWZDOH.js";
|
|
54
|
+
import {
|
|
55
|
+
resolveMachineId
|
|
56
|
+
} from "./chunk-S73EPYNC.js";
|
|
56
57
|
import {
|
|
57
|
-
_appendEntityBatch,
|
|
58
|
-
_appendEvidenceBatch,
|
|
59
|
-
_appendRelationBatch,
|
|
60
|
-
_appendRetiredStateBatch,
|
|
61
|
-
_appendStateBatch,
|
|
62
|
-
getMemoryEntityVNext,
|
|
63
|
-
getMemoryEvidenceVNext,
|
|
64
58
|
getMemoryEvidenceVNextStrict,
|
|
65
|
-
getMemoryStateVNext,
|
|
66
|
-
listMemoryStatesForEntityVNext,
|
|
67
59
|
loadMemoryVNextCatalog,
|
|
68
60
|
putMemoryEvidenceVNext
|
|
69
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-324FWHUA.js";
|
|
70
62
|
import {
|
|
71
63
|
rankMemoryCandidates,
|
|
72
64
|
recallMemoryVNextLocal
|
|
@@ -74,8 +66,9 @@ import {
|
|
|
74
66
|
import {
|
|
75
67
|
DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET,
|
|
76
68
|
EXPLICIT_REMEMBER_PREFIX_REGEX,
|
|
77
|
-
buildMemoryOverlay
|
|
78
|
-
|
|
69
|
+
buildMemoryOverlay,
|
|
70
|
+
emptyMemoryInjectionObservation
|
|
71
|
+
} from "./chunk-4I2MXV5Q.js";
|
|
79
72
|
import {
|
|
80
73
|
buildLegacyMemoryEvidence,
|
|
81
74
|
resolveLegacyMemoryPrincipal
|
|
@@ -83,38 +76,27 @@ import {
|
|
|
83
76
|
import {
|
|
84
77
|
isBuiltinNoloAgentRef,
|
|
85
78
|
resolveLocalUserId
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import {
|
|
88
|
-
CliProviderQuotaError
|
|
89
|
-
} from "./chunk-MK2Q7ZJD.js";
|
|
90
|
-
import {
|
|
91
|
-
resolveMachineId
|
|
92
|
-
} from "./chunk-S73EPYNC.js";
|
|
79
|
+
} from "./chunk-HHFGE2WF.js";
|
|
93
80
|
import {
|
|
94
81
|
extractGoogleValidationLink
|
|
95
82
|
} from "./chunk-BMQ2MJUK.js";
|
|
96
83
|
import {
|
|
97
84
|
resolveCliLocalRuntimeKeyCapability
|
|
98
|
-
} from "./chunk-
|
|
99
|
-
import {
|
|
100
|
-
isTransientFetchError
|
|
101
|
-
} from "./chunk-KFHREHUQ.js";
|
|
85
|
+
} from "./chunk-IXG6YXQM.js";
|
|
102
86
|
import {
|
|
103
87
|
parseUiCard,
|
|
104
88
|
uiCardFallback
|
|
105
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-XJPLSAPJ.js";
|
|
106
90
|
import {
|
|
107
91
|
isGatewayHttpStatus
|
|
108
92
|
} from "./chunk-NF64D32W.js";
|
|
109
93
|
import {
|
|
110
94
|
buildMemorySubjectsForAgent,
|
|
111
|
-
resolveAgentMemoryPolicy
|
|
112
|
-
} from "./chunk-SW6OD4KE.js";
|
|
113
|
-
import {
|
|
114
95
|
chooseMemoryOwners,
|
|
115
96
|
loadMemoryCandidatesFromDb,
|
|
116
|
-
loadOwnerItemsFromDb
|
|
117
|
-
|
|
97
|
+
loadOwnerItemsFromDb,
|
|
98
|
+
resolveAgentMemoryPolicy
|
|
99
|
+
} from "./chunk-SMJEXX2S.js";
|
|
118
100
|
import {
|
|
119
101
|
API_REPORTED_COST_MULTIPLIER,
|
|
120
102
|
estimateMessagesTokens,
|
|
@@ -124,7 +106,25 @@ import {
|
|
|
124
106
|
resolveAgentContextWindow,
|
|
125
107
|
resolveOccupancy,
|
|
126
108
|
resolveOccupancyWindow
|
|
127
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-R3NEQZ53.js";
|
|
110
|
+
import {
|
|
111
|
+
parsePositiveFiniteNumberOrFallback
|
|
112
|
+
} from "./chunk-Y5GCAMGP.js";
|
|
113
|
+
import {
|
|
114
|
+
readDbRecord,
|
|
115
|
+
resolveAgentRecordFromHybridStore
|
|
116
|
+
} from "./chunk-D6YNCNM6.js";
|
|
117
|
+
import {
|
|
118
|
+
isTransientFetchError
|
|
119
|
+
} from "./chunk-DXWGFL2Z.js";
|
|
120
|
+
import {
|
|
121
|
+
isCliAuthorityBrokerProtocolError,
|
|
122
|
+
isCliAuthorityBrokerTimeoutError,
|
|
123
|
+
isCliAuthorityBrokerUnavailableError
|
|
124
|
+
} from "./chunk-5ZMIIR23.js";
|
|
125
|
+
import {
|
|
126
|
+
getDefaultCliLocalRuntimeDb
|
|
127
|
+
} from "./chunk-N5Z2V73W.js";
|
|
128
128
|
import {
|
|
129
129
|
awaitLocalWriterChild,
|
|
130
130
|
createRunActivityTracker,
|
|
@@ -134,6 +134,7 @@ import {
|
|
|
134
134
|
popSingleQueueMessage,
|
|
135
135
|
readRunRecord,
|
|
136
136
|
recordRunResultHeaderMeta,
|
|
137
|
+
recordRunStartup,
|
|
137
138
|
registerLocalForegroundWriter,
|
|
138
139
|
reportRunProcessIdentity,
|
|
139
140
|
resolveResultServerMeta,
|
|
@@ -141,8 +142,9 @@ import {
|
|
|
141
142
|
resolveRunsDir,
|
|
142
143
|
serverOriginForDialog,
|
|
143
144
|
settleRunTerminalAuthoritatively,
|
|
144
|
-
spawnLocalBackgroundRun
|
|
145
|
-
|
|
145
|
+
spawnLocalBackgroundRun,
|
|
146
|
+
transitionRunToTerminal
|
|
147
|
+
} from "./chunk-OWKNSIXL.js";
|
|
146
148
|
import {
|
|
147
149
|
formatAgentListCard,
|
|
148
150
|
formatFinishedRunCard,
|
|
@@ -153,30 +155,25 @@ import {
|
|
|
153
155
|
formatStopRunCard,
|
|
154
156
|
getAgentRunStatusIcon,
|
|
155
157
|
isAgentRunTerminalStatus
|
|
156
|
-
} from "./chunk-
|
|
157
|
-
import {
|
|
158
|
-
isCliAuthorityBrokerProtocolError,
|
|
159
|
-
isCliAuthorityBrokerTimeoutError,
|
|
160
|
-
isCliAuthorityBrokerUnavailableError
|
|
161
|
-
} from "./chunk-5ZMIIR23.js";
|
|
162
|
-
import {
|
|
163
|
-
getDefaultCliLocalRuntimeDb
|
|
164
|
-
} from "./chunk-N5Z2V73W.js";
|
|
158
|
+
} from "./chunk-OOJNQK6V.js";
|
|
165
159
|
import {
|
|
166
160
|
isLocalCliAgentKey
|
|
167
161
|
} from "./chunk-BR3GT6MR.js";
|
|
168
162
|
import {
|
|
169
163
|
buildSkillDiscoveryContextLayer
|
|
170
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-Q3IVPFVO.js";
|
|
171
165
|
import {
|
|
172
166
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
173
167
|
LOCAL_TURN_ABORTED_CODE,
|
|
174
168
|
markCliUserBatchPhase,
|
|
175
169
|
readActionGate
|
|
176
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-JUSHVFNF.js";
|
|
177
171
|
import {
|
|
178
172
|
resolveAgentRuntimeConfigFromRecord
|
|
179
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-GUXZK7SE.js";
|
|
174
|
+
import {
|
|
175
|
+
resolveAgentImageInputSupport
|
|
176
|
+
} from "./chunk-DUUDXSLX.js";
|
|
180
177
|
import {
|
|
181
178
|
createThinkParserState,
|
|
182
179
|
flushThinkParser,
|
|
@@ -188,18 +185,18 @@ import {
|
|
|
188
185
|
isQuotaExhaustedText,
|
|
189
186
|
resolveAvailabilityAction,
|
|
190
187
|
resolveCredentialKeyWithFallback
|
|
191
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-QJTZ76CP.js";
|
|
192
189
|
import {
|
|
193
190
|
ATTACHMENT_PART_TYPE,
|
|
194
191
|
ATTACHMENT_PART_VERSION,
|
|
195
192
|
describeAttachmentForModel,
|
|
196
193
|
normalizeAttachmentPart
|
|
197
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-QRGDJA4B.js";
|
|
198
195
|
import {
|
|
199
196
|
findCodexOAuthPinnedContextWindow,
|
|
200
197
|
normalizeUsage,
|
|
201
198
|
readCacheReadInputTokensOrNull
|
|
202
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-L32W3PRP.js";
|
|
203
200
|
import {
|
|
204
201
|
isOAuthApiKeyRef
|
|
205
202
|
} from "./chunk-UKZX3NHN.js";
|
|
@@ -209,7 +206,7 @@ import {
|
|
|
209
206
|
import {
|
|
210
207
|
normalizeRuntimeToolPolicyOverride,
|
|
211
208
|
resolveEffectiveRuntimeToolPolicy
|
|
212
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-USGHJSGO.js";
|
|
213
210
|
import {
|
|
214
211
|
compactWhitespace
|
|
215
212
|
} from "./chunk-DWLEOOGR.js";
|
|
@@ -218,18 +215,12 @@ import {
|
|
|
218
215
|
isQuotaExhaustedError
|
|
219
216
|
} from "./chunk-EWQ3HGNZ.js";
|
|
220
217
|
import {
|
|
221
|
-
|
|
222
|
-
} from "./chunk-
|
|
223
|
-
import {
|
|
224
|
-
resolveClientVersion
|
|
225
|
-
} from "./chunk-6EDAMVG6.js";
|
|
226
|
-
import {
|
|
227
|
-
toErrorMessage
|
|
228
|
-
} from "./chunk-HNMXYYJR.js";
|
|
218
|
+
estimateTokenCount
|
|
219
|
+
} from "./chunk-PSCNXBYA.js";
|
|
229
220
|
import {
|
|
230
221
|
parseExternalSkillMarkdown,
|
|
231
222
|
parseSkillDocProtocol
|
|
232
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-W6RFEDN4.js";
|
|
233
224
|
import {
|
|
234
225
|
BUILTIN_NOLO_AGENT_KEY,
|
|
235
226
|
BUILTIN_NOLO_AGENT_NAME,
|
|
@@ -240,16 +231,8 @@ import {
|
|
|
240
231
|
parsePublicAgentId
|
|
241
232
|
} from "./chunk-M2EJHDJP.js";
|
|
242
233
|
import {
|
|
243
|
-
|
|
244
|
-
} from "./chunk-
|
|
245
|
-
import {
|
|
246
|
-
CLIENT_VERSION_TOO_OLD_CODE,
|
|
247
|
-
NOLO_CLIENT_VERSION_HEADER,
|
|
248
|
-
buildClientVersionUpgradeMessage
|
|
249
|
-
} from "./chunk-OBSEKCVK.js";
|
|
250
|
-
import {
|
|
251
|
-
asTrimmedLowercaseString
|
|
252
|
-
} from "./chunk-QSJ3HFEF.js";
|
|
234
|
+
ulid
|
|
235
|
+
} from "./chunk-OJKUU3LP.js";
|
|
253
236
|
import {
|
|
254
237
|
buildAgentsMdLayer,
|
|
255
238
|
buildAgentsMdLayerHeader,
|
|
@@ -257,15 +240,18 @@ import {
|
|
|
257
240
|
buildMemoryUseGuidanceLayer,
|
|
258
241
|
partitionScopedBlocks,
|
|
259
242
|
renderTurnContextBlocksWithScope
|
|
260
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-3P54D2E4.js";
|
|
261
244
|
import {
|
|
262
245
|
exitCliFromWatchdog,
|
|
263
246
|
getLogger,
|
|
264
247
|
normalizeError
|
|
265
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-6XRPBZRS.js";
|
|
266
249
|
import {
|
|
267
|
-
|
|
268
|
-
|
|
250
|
+
RuntimeProtocolMismatchError,
|
|
251
|
+
RuntimeVersionMismatchError,
|
|
252
|
+
resolveAuthToken,
|
|
253
|
+
validateAgentRunProtocol
|
|
254
|
+
} from "./chunk-BIDSIRTS.js";
|
|
269
255
|
import {
|
|
270
256
|
readPipeText,
|
|
271
257
|
spawnProcess
|
|
@@ -276,19 +262,36 @@ import {
|
|
|
276
262
|
t,
|
|
277
263
|
toolLabel,
|
|
278
264
|
toolLabelVariants
|
|
279
|
-
} from "./chunk-
|
|
265
|
+
} from "./chunk-262R3XNN.js";
|
|
280
266
|
import {
|
|
281
|
-
|
|
282
|
-
} from "./chunk-
|
|
267
|
+
isAntigravityOAuthAgent
|
|
268
|
+
} from "./chunk-7JGMNKKG.js";
|
|
269
|
+
import {
|
|
270
|
+
resolveClientVersion
|
|
271
|
+
} from "./chunk-RTHFJZ6M.js";
|
|
272
|
+
import {
|
|
273
|
+
toErrorMessage
|
|
274
|
+
} from "./chunk-HNMXYYJR.js";
|
|
283
275
|
import {
|
|
284
276
|
asTrimmedString
|
|
285
277
|
} from "./chunk-3EUW3WEO.js";
|
|
278
|
+
import {
|
|
279
|
+
findModelConfig
|
|
280
|
+
} from "./chunk-CD3RU7XL.js";
|
|
286
281
|
import {
|
|
287
282
|
asOptionalTrimmedString
|
|
288
283
|
} from "./chunk-G3SUCT4W.js";
|
|
284
|
+
import {
|
|
285
|
+
CLIENT_VERSION_TOO_OLD_CODE,
|
|
286
|
+
NOLO_CLIENT_VERSION_HEADER,
|
|
287
|
+
buildClientVersionUpgradeMessage
|
|
288
|
+
} from "./chunk-OBSEKCVK.js";
|
|
289
|
+
import {
|
|
290
|
+
asTrimmedLowercaseString
|
|
291
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
289
292
|
|
|
290
293
|
// packages/cli/agentRunCommand.ts
|
|
291
|
-
import { createHash as
|
|
294
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
292
295
|
|
|
293
296
|
// packages/cli/agentRunLocalWorkspace.ts
|
|
294
297
|
import { createHash } from "node:crypto";
|
|
@@ -8415,7 +8418,7 @@ function normalizeListLine(line) {
|
|
|
8415
8418
|
}
|
|
8416
8419
|
return line;
|
|
8417
8420
|
}
|
|
8418
|
-
var TOOL_TREE_HEADER_RE =
|
|
8421
|
+
var TOOL_TREE_HEADER_RE = /^(?:▸|•)\s+(.+?)\s+\((\d+)\) · (.*?) ✓$/;
|
|
8419
8422
|
var TOOL_SINGLE_RE = /^▸\s+(.+?)(?:\s+·\s+(.*?))?(?:\s{2}(✓|✗|!)(?:\s+(.*))?)$/;
|
|
8420
8423
|
function plainToolLine(line) {
|
|
8421
8424
|
return stripAnsi(line);
|
|
@@ -8461,23 +8464,40 @@ function statusColorSeq(marker, brightness) {
|
|
|
8461
8464
|
if (marker === "\u2717") return colorSeq("danger", brightness);
|
|
8462
8465
|
return colorSeq("warning", brightness);
|
|
8463
8466
|
}
|
|
8467
|
+
function styleToolDetailSegments(detail, muted, chrome) {
|
|
8468
|
+
const metaMatch = detail.match(/^(.*?)(\s+·\s+(?:\d+\s+(?:lines?|bytes?\s+written|replacements?|matches?)(?:\s+·\s+truncated)?|truncated))$/);
|
|
8469
|
+
if (!metaMatch) {
|
|
8470
|
+
return `${muted}${detail}${STYLE.reset}`;
|
|
8471
|
+
}
|
|
8472
|
+
return `${muted}${metaMatch[1]}${STYLE.reset}${chrome}${STYLE.dim}${metaMatch[2]}${STYLE.reset}`;
|
|
8473
|
+
}
|
|
8464
8474
|
function styleTuiToolLine(line, brightness) {
|
|
8465
8475
|
const plain = plainToolLine(line);
|
|
8466
8476
|
const chrome = colorSeq("chrome", brightness);
|
|
8467
8477
|
const muted = colorSeq("muted", brightness);
|
|
8478
|
+
const info = colorSeq("info", brightness);
|
|
8479
|
+
const danger = colorSeq("danger", brightness);
|
|
8468
8480
|
const header = toolTreeHeaderMatch(plain);
|
|
8469
8481
|
if (header) {
|
|
8470
|
-
|
|
8482
|
+
const glyph = plain.startsWith("\u2022") ? "\u2022" : "\u25B8";
|
|
8483
|
+
return `${chrome}${glyph}${STYLE.reset} ${STYLE.bold}${info}${header[1]}${STYLE.reset} ${chrome}${STYLE.dim}(${header[2]})${STYLE.reset} ${chrome}\xB7${STYLE.reset} ${muted}${header[3]}${STYLE.reset} ${statusColorSeq("\u2713", brightness)}\u2713${STYLE.reset}`;
|
|
8471
8484
|
}
|
|
8472
8485
|
const single = plain.match(TOOL_SINGLE_RE);
|
|
8473
8486
|
if (single) {
|
|
8474
8487
|
const [, label, detail, marker, statusDetail] = single;
|
|
8475
|
-
|
|
8476
|
-
|
|
8488
|
+
const isError = marker === "\u2717";
|
|
8489
|
+
const labelColor = isError ? danger : info;
|
|
8490
|
+
let rendered = `${chrome}\u25B8${STYLE.reset} ${STYLE.bold}${labelColor}${label}${STYLE.reset}`;
|
|
8491
|
+
if (detail) {
|
|
8492
|
+
rendered += ` ${chrome}\xB7${STYLE.reset} ${styleToolDetailSegments(detail, muted, chrome)}`;
|
|
8493
|
+
}
|
|
8477
8494
|
rendered += ` ${statusColorSeq(marker, brightness)}${marker}${STYLE.reset}`;
|
|
8478
8495
|
if (statusDetail) {
|
|
8479
|
-
|
|
8480
|
-
|
|
8496
|
+
if (isError) {
|
|
8497
|
+
rendered += ` ${danger}${statusDetail}${STYLE.reset}`;
|
|
8498
|
+
} else {
|
|
8499
|
+
rendered += ` ${chrome}${STYLE.dim}${statusDetail}${STYLE.reset}`;
|
|
8500
|
+
}
|
|
8481
8501
|
}
|
|
8482
8502
|
return rendered;
|
|
8483
8503
|
}
|
|
@@ -9008,6 +9028,9 @@ function formatAssistantTextForCli(text) {
|
|
|
9008
9028
|
return text.replace(/\u003cthink\u003e[\s\S]*?\u003c\/think\u003e\s*/gi, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
9009
9029
|
}
|
|
9010
9030
|
|
|
9031
|
+
// packages/cli/client/toolOutput.ts
|
|
9032
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
9033
|
+
|
|
9011
9034
|
// packages/cli/tui/tuiLayout.ts
|
|
9012
9035
|
var DEFAULT_TERMINAL_ROWS = 24;
|
|
9013
9036
|
var DEFAULT_TERMINAL_COLUMNS = 80;
|
|
@@ -9039,19 +9062,231 @@ function resolveHistoryViewportHeight(terminalRows, composerRows, foregroundRese
|
|
|
9039
9062
|
return Math.max(0, rows - composer - reserved);
|
|
9040
9063
|
}
|
|
9041
9064
|
|
|
9042
|
-
// packages/
|
|
9065
|
+
// packages/core/redactSecrets.ts
|
|
9043
9066
|
var REDACTED = "\u27E8redacted\u27E9";
|
|
9044
9067
|
function redactSecrets(text) {
|
|
9045
|
-
return text.replace(/\b(?:sk|pk)-[A-Za-z0-9_-]{10,}/g, REDACTED).replace(
|
|
9046
|
-
/\b(
|
|
9068
|
+
return text.replace(/\b(?:sk|pk)-[A-Za-z0-9_-]{10,}/g, REDACTED).replace(
|
|
9069
|
+
/\b(Authorization:\s*Basic\s+)[A-Za-z0-9._~+/=-]{8,}/gi,
|
|
9047
9070
|
`$1${REDACTED}`
|
|
9071
|
+
).replace(/\b(Bearer\s+)[A-Za-z0-9._~+/=-]{12,}/gi, `$1${REDACTED}`).replace(
|
|
9072
|
+
/(^|\s)((?:--[a-z0-9-]*(?:token|key|secret|password|credential)[a-z0-9-]*)(?:[^\S\r\n]*=[^\S\r\n]*|[^\S\r\n]+))(?:"(?:\\[^\r\n]|[^"\\\r\n]){8,}(?:"|(?=[\r\n]|$))|'(?:\\[^\r\n]|[^'\\\r\n]){8,}(?:'|(?=[\r\n]|$))|[^\s"']{8,})/gi,
|
|
9073
|
+
`$1$2${REDACTED}`
|
|
9048
9074
|
).replace(
|
|
9049
|
-
|
|
9075
|
+
/(^|[^\w-])((?:[A-Z0-9]+_)*(?:API[_-]?KEY|APIKEY|ACCESS[_-]?TOKEN|AUTH[_-]?TOKEN|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIALS?|KEY)\s*[=:]\s*)(?:"(?:\\[^\r\n]|[^"\\\r\n]){8,}(?:"|(?=[\r\n]|$))|'(?:\\[^\r\n]|[^'\\\r\n]){8,}(?:'|(?=[\r\n]|$))|[^\s"',;]{8,})/g,
|
|
9076
|
+
`$1$2${REDACTED}`
|
|
9077
|
+
).replace(
|
|
9078
|
+
/\b((?:api[_-]?key|apikey|access[_-]?token|auth[_-]?token|token|secret|password|passwd|credential)s?\s*[=:]\s*)(?:"(?:\\[^\r\n]|[^"\\\r\n]){8,}(?:"|(?=[\r\n]|$))|'(?:\\[^\r\n]|[^'\\\r\n]){8,}(?:'|(?=[\r\n]|$))|[^\s"',;]{8,})/gi,
|
|
9050
9079
|
`$1${REDACTED}`
|
|
9051
9080
|
);
|
|
9052
9081
|
}
|
|
9053
9082
|
|
|
9054
|
-
// packages/cli/tui/
|
|
9083
|
+
// packages/cli/tui/redactSecrets.ts
|
|
9084
|
+
var NORMAL_GIST_SECRET_PATTERNS = [
|
|
9085
|
+
/\bbearer\s+[A-Za-z0-9._~+/=-]{8,}/i,
|
|
9086
|
+
/\bsk-(?:ant-)?(?:api)?[0-9a-zA-Z-]{10,}/,
|
|
9087
|
+
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{10,}/,
|
|
9088
|
+
/\bxox[baprs]-[A-Za-z0-9-]{10,}/
|
|
9089
|
+
];
|
|
9090
|
+
function withholdIfSecretLike(gist) {
|
|
9091
|
+
if (!gist) return "";
|
|
9092
|
+
if (findPotentialSecrets(gist).length > 0) return "";
|
|
9093
|
+
if (NORMAL_GIST_SECRET_PATTERNS.some((pattern) => pattern.test(gist))) return "";
|
|
9094
|
+
return gist;
|
|
9095
|
+
}
|
|
9096
|
+
|
|
9097
|
+
// packages/core/shellCommandGist.ts
|
|
9098
|
+
function shellWords(text, validationOnly = false) {
|
|
9099
|
+
const words2 = [];
|
|
9100
|
+
let word = "", started = false;
|
|
9101
|
+
let quote;
|
|
9102
|
+
for (let i = 0; i < text.length; i++) {
|
|
9103
|
+
const ch = text[i];
|
|
9104
|
+
if (ch === "\\" && quote !== "'") {
|
|
9105
|
+
const next = text[++i];
|
|
9106
|
+
if (next === void 0) return null;
|
|
9107
|
+
word += next;
|
|
9108
|
+
started = true;
|
|
9109
|
+
continue;
|
|
9110
|
+
}
|
|
9111
|
+
if (ch === "$" && quote !== "'" || ch === "`" && quote !== "'") return null;
|
|
9112
|
+
if (quote) {
|
|
9113
|
+
if (ch === quote) quote = void 0;
|
|
9114
|
+
else word += ch;
|
|
9115
|
+
continue;
|
|
9116
|
+
}
|
|
9117
|
+
if (ch === "'" || ch === '"') {
|
|
9118
|
+
quote = ch;
|
|
9119
|
+
started = true;
|
|
9120
|
+
continue;
|
|
9121
|
+
}
|
|
9122
|
+
if (validationOnly && (ch === "|" || ch === "~")) {
|
|
9123
|
+
word += ch;
|
|
9124
|
+
started = true;
|
|
9125
|
+
continue;
|
|
9126
|
+
}
|
|
9127
|
+
if (/[<> &|;(){}*?\[\]#~]/.test(ch) && !/\s/.test(ch)) return null;
|
|
9128
|
+
if (/\s/.test(ch)) {
|
|
9129
|
+
if (started) words2.push(word);
|
|
9130
|
+
word = "";
|
|
9131
|
+
started = false;
|
|
9132
|
+
} else {
|
|
9133
|
+
word += ch;
|
|
9134
|
+
started = true;
|
|
9135
|
+
}
|
|
9136
|
+
}
|
|
9137
|
+
if (quote) return null;
|
|
9138
|
+
if (started) words2.push(word);
|
|
9139
|
+
return words2;
|
|
9140
|
+
}
|
|
9141
|
+
function isSafeGitTarget(token) {
|
|
9142
|
+
if (!token || token.startsWith("-")) return false;
|
|
9143
|
+
if (/:\/\/|@/.test(token)) return false;
|
|
9144
|
+
return true;
|
|
9145
|
+
}
|
|
9146
|
+
function clipShortText(text, maxLen = 24) {
|
|
9147
|
+
const oneLine = text.replace(/\s+/g, " ").trim();
|
|
9148
|
+
if (!oneLine) return "";
|
|
9149
|
+
return oneLine.length <= maxLen ? oneLine : `${oneLine.slice(0, maxLen - 1)}\u2026`;
|
|
9150
|
+
}
|
|
9151
|
+
function parseGit(rest) {
|
|
9152
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9153
|
+
if (!tokens2) return null;
|
|
9154
|
+
let i = 0, context;
|
|
9155
|
+
while (tokens2[i]?.startsWith("-")) {
|
|
9156
|
+
const option = tokens2[i++];
|
|
9157
|
+
if (["-C", "-c", "--git-dir", "--work-tree"].includes(option)) {
|
|
9158
|
+
const value = tokens2[i++];
|
|
9159
|
+
if (!value || value.startsWith("-")) return null;
|
|
9160
|
+
if (option === "-C") context = value;
|
|
9161
|
+
} else if (!/^(--git-dir|--work-tree)=.+/.test(option) && !["--no-pager", "--no-optional-locks", "--literal-pathspecs"].includes(option)) return null;
|
|
9162
|
+
}
|
|
9163
|
+
const sub = tokens2[i++];
|
|
9164
|
+
const args = tokens2.slice(i);
|
|
9165
|
+
const result = (action, object, readOnly) => ({ action, object, context, readOnly });
|
|
9166
|
+
if (sub === "worktree") {
|
|
9167
|
+
const operation = args.shift();
|
|
9168
|
+
const operands = [];
|
|
9169
|
+
let end = false;
|
|
9170
|
+
for (let j = 0; j < args.length; j++) {
|
|
9171
|
+
const token = args[j];
|
|
9172
|
+
if (!end && token === "--") {
|
|
9173
|
+
end = true;
|
|
9174
|
+
continue;
|
|
9175
|
+
}
|
|
9176
|
+
if (!end && token.startsWith("-")) {
|
|
9177
|
+
if (operation === "add" && ["-b", "-B", "--reason"].includes(token)) {
|
|
9178
|
+
if (!args[++j] || args[j].startsWith("-")) return null;
|
|
9179
|
+
} else if (!(operation === "add" && ["--detach", "--checkout", "--no-checkout", "--lock"].includes(token)) && !(operation === "list" && ["--porcelain", "-v", "--verbose", "-z"].includes(token)) && !(operation === "remove" && ["-f", "--force"].includes(token))) return null;
|
|
9180
|
+
} else operands.push(token);
|
|
9181
|
+
}
|
|
9182
|
+
if (operation === "list" && !operands.length) return result("\u5217\u51FA\u5DE5\u4F5C\u533A", void 0, true);
|
|
9183
|
+
if (operation === "add" && operands.length >= 1 && operands.length <= 2) return result("\u521B\u5EFA\u5DE5\u4F5C\u533A", operands[0], false);
|
|
9184
|
+
if (operation === "remove" && operands.length === 1) return result("\u79FB\u9664\u5DE5\u4F5C\u533A", operands[0], false);
|
|
9185
|
+
return null;
|
|
9186
|
+
}
|
|
9187
|
+
if (sub === "branch") {
|
|
9188
|
+
let mode = "create", end = false;
|
|
9189
|
+
const operands = [];
|
|
9190
|
+
for (const token of args) {
|
|
9191
|
+
if (!end && token === "--") {
|
|
9192
|
+
end = true;
|
|
9193
|
+
continue;
|
|
9194
|
+
}
|
|
9195
|
+
if (!end && token.startsWith("-")) {
|
|
9196
|
+
if (["-d", "-D", "--delete"].includes(token) && mode === "create") mode = "delete";
|
|
9197
|
+
else if (["--list", "-a", "--all", "-r", "--remotes", "-v", "-vv", "--show-current"].includes(token) && mode === "create") mode = "list";
|
|
9198
|
+
else return null;
|
|
9199
|
+
} else operands.push(token);
|
|
9200
|
+
}
|
|
9201
|
+
if (mode === "delete" && operands.length === 1) return result("\u5220\u9664\u5206\u652F", operands[0], false);
|
|
9202
|
+
if (mode === "list" || !args.length) return result("\u5217\u51FA\u5206\u652F", void 0, true);
|
|
9203
|
+
if (mode === "create" && operands.length >= 1 && operands.length <= 2) return result("\u521B\u5EFA\u5206\u652F", operands[0], false);
|
|
9204
|
+
return null;
|
|
9205
|
+
}
|
|
9206
|
+
if (sub === "checkout" && args.some((t2) => t2 === "." || t2 === "--" || t2.includes("/"))) return null;
|
|
9207
|
+
const nonFlagArgs = (list) => {
|
|
9208
|
+
const out = [];
|
|
9209
|
+
for (let j = 0; j < list.length; j++) {
|
|
9210
|
+
const tok = list[j];
|
|
9211
|
+
if (tok === "--") {
|
|
9212
|
+
out.push(...list.slice(j + 1));
|
|
9213
|
+
break;
|
|
9214
|
+
}
|
|
9215
|
+
if (tok.startsWith("-")) {
|
|
9216
|
+
if (["-m", "-F", "-b", "-B", "-n", "--max-count", "--format", "--pretty", "--since", "--until", "--author", "-U"].includes(tok)) j++;
|
|
9217
|
+
continue;
|
|
9218
|
+
}
|
|
9219
|
+
out.push(tok);
|
|
9220
|
+
}
|
|
9221
|
+
return out;
|
|
9222
|
+
};
|
|
9223
|
+
switch (sub) {
|
|
9224
|
+
case "status":
|
|
9225
|
+
return result("\u67E5\u72B6\u6001", void 0, true);
|
|
9226
|
+
case "log":
|
|
9227
|
+
return result("\u67E5\u5386\u53F2", void 0, true);
|
|
9228
|
+
case "rev-list":
|
|
9229
|
+
return result("\u7EDF\u8BA1\u63D0\u4EA4", void 0, true);
|
|
9230
|
+
case "merge-base":
|
|
9231
|
+
return result("\u67E5\u5171\u540C\u7956\u5148", void 0, true);
|
|
9232
|
+
case "rev-parse":
|
|
9233
|
+
return result("\u67E5\u4ED3\u5E93\u4FE1\u606F", void 0, true);
|
|
9234
|
+
case "show": {
|
|
9235
|
+
const target = nonFlagArgs(args)[0];
|
|
9236
|
+
return result("\u770B\u63D0\u4EA4", isSafeGitTarget(target) ? clipShortText(target, 20) : void 0, true);
|
|
9237
|
+
}
|
|
9238
|
+
case "diff": {
|
|
9239
|
+
const target = nonFlagArgs(args).find(isSafeGitTarget);
|
|
9240
|
+
return result("\u770B\u5DEE\u5F02", target ? baseName(target) ?? clipShortText(target, 20) : void 0, true);
|
|
9241
|
+
}
|
|
9242
|
+
case "tag": {
|
|
9243
|
+
const hasMutating = args.some((t2) => ["-d", "--delete", "-a", "-s", "-f", "--force"].includes(t2)) || nonFlagArgs(args).length > 0;
|
|
9244
|
+
return hasMutating ? result("\u7BA1\u6807\u7B7E", void 0, false) : result("\u67E5\u6807\u7B7E", void 0, true);
|
|
9245
|
+
}
|
|
9246
|
+
case "add": {
|
|
9247
|
+
if (args.some((t2) => t2 === "-A" || t2 === "--all" || t2 === ".")) return result("\u6682\u5B58\u5168\u90E8\u4FEE\u6539", void 0, false);
|
|
9248
|
+
const files = nonFlagArgs(args).filter(isSafeGitTarget);
|
|
9249
|
+
if (files.length === 1) return result("\u6682\u5B58", baseName(files[0]) ?? files[0], false);
|
|
9250
|
+
if (files.length > 1) return result("\u6682\u5B58", `${files.length} \u9879`, false);
|
|
9251
|
+
return result("\u6682\u5B58\u4FEE\u6539", void 0, false);
|
|
9252
|
+
}
|
|
9253
|
+
case "commit":
|
|
9254
|
+
return result("\u63D0\u4EA4", void 0, false);
|
|
9255
|
+
case "merge": {
|
|
9256
|
+
const branch = nonFlagArgs(args).find(isSafeGitTarget);
|
|
9257
|
+
return result("\u5408\u5E76", branch ? clipShortText(branch, 28) : void 0, false);
|
|
9258
|
+
}
|
|
9259
|
+
case "checkout":
|
|
9260
|
+
case "switch": {
|
|
9261
|
+
const branch = nonFlagArgs(args).find(isSafeGitTarget);
|
|
9262
|
+
return result("\u5207\u6362\u5206\u652F", branch ? clipShortText(branch, 28) : void 0, false);
|
|
9263
|
+
}
|
|
9264
|
+
case "push": {
|
|
9265
|
+
const parts = nonFlagArgs(args).filter(isSafeGitTarget);
|
|
9266
|
+
const target = parts.length >= 2 ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
9267
|
+
return result("\u63A8\u9001", target ? clipShortText(target, 28) : void 0, false);
|
|
9268
|
+
}
|
|
9269
|
+
case "pull": {
|
|
9270
|
+
const parts = nonFlagArgs(args).filter(isSafeGitTarget);
|
|
9271
|
+
const target = parts.length >= 2 ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
9272
|
+
return result("\u62C9\u53D6", target ? clipShortText(target, 28) : void 0, false);
|
|
9273
|
+
}
|
|
9274
|
+
case "fetch": {
|
|
9275
|
+
const remote = nonFlagArgs(args).find(isSafeGitTarget);
|
|
9276
|
+
return result("\u83B7\u53D6\u8FDC\u7AEF", remote ? clipShortText(remote, 24) : void 0, true);
|
|
9277
|
+
}
|
|
9278
|
+
case "stash": {
|
|
9279
|
+
const op = nonFlagArgs(args)[0];
|
|
9280
|
+
return op === "list" ? result("\u67E5\u8D2E\u85CF", void 0, true) : result("\u6682\u5B58", void 0, false);
|
|
9281
|
+
}
|
|
9282
|
+
case "reset":
|
|
9283
|
+
return result("\u91CD\u7F6E", void 0, false);
|
|
9284
|
+
case "restore":
|
|
9285
|
+
return result("\u6062\u590D\u6587\u4EF6", void 0, false);
|
|
9286
|
+
default:
|
|
9287
|
+
return null;
|
|
9288
|
+
}
|
|
9289
|
+
}
|
|
9055
9290
|
function baseName(path2) {
|
|
9056
9291
|
const cleaned = path2.replace(/^['"]|['"]$/g, "").replace(/\/+$/, "");
|
|
9057
9292
|
if (!cleaned || cleaned === "." || cleaned === "..") return void 0;
|
|
@@ -9113,9 +9348,14 @@ function splitSegments(command) {
|
|
|
9113
9348
|
return { segments, hasFallback };
|
|
9114
9349
|
}
|
|
9115
9350
|
function stripEnvAssignments(segment) {
|
|
9116
|
-
let rest = segment;
|
|
9117
|
-
|
|
9118
|
-
rest = rest.replace(/^
|
|
9351
|
+
let rest = segment.trimStart();
|
|
9352
|
+
if (/^export\s+[A-Za-z_][A-Za-z0-9_]*=/.test(rest)) {
|
|
9353
|
+
rest = rest.replace(/^export\s+/, "");
|
|
9354
|
+
}
|
|
9355
|
+
while (/^[A-Za-z_][A-Za-z0-9_]*=(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\S*)\s*/.test(rest)) {
|
|
9356
|
+
const next = rest.replace(/^[A-Za-z_][A-Za-z0-9_]*=(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\S*)\s*/, "");
|
|
9357
|
+
if (next === rest) break;
|
|
9358
|
+
rest = next;
|
|
9119
9359
|
}
|
|
9120
9360
|
return rest;
|
|
9121
9361
|
}
|
|
@@ -9123,182 +9363,399 @@ function firstVerbToken(segment) {
|
|
|
9123
9363
|
let rest = stripEnvAssignments(segment).trim();
|
|
9124
9364
|
const wrappers = /* @__PURE__ */ new Set(["sudo", "env", "command", "time", "nohup", "exec"]);
|
|
9125
9365
|
let guard = 0;
|
|
9126
|
-
while (guard++ <
|
|
9366
|
+
while (guard++ < 6) {
|
|
9127
9367
|
const before = rest;
|
|
9128
9368
|
rest = stripEnvAssignments(rest).trim();
|
|
9129
9369
|
const m = rest.match(/^(\S+)\s*(.*)$/s);
|
|
9130
9370
|
if (!m) return { verb: "", rest: "" };
|
|
9131
9371
|
const [, word, restAfter] = m;
|
|
9132
|
-
|
|
9372
|
+
const base = word.replace(/^.*\//, "");
|
|
9373
|
+
if (wrappers.has(base) && restAfter.trim()) {
|
|
9133
9374
|
rest = restAfter.trim();
|
|
9134
9375
|
continue;
|
|
9135
9376
|
}
|
|
9377
|
+
if (base === "timeout" && restAfter.trim()) {
|
|
9378
|
+
const tokens2 = shellWords(restAfter.trim());
|
|
9379
|
+
if (!tokens2 || tokens2.length < 2) return { verb: "timeout", rest: restAfter.trim() };
|
|
9380
|
+
let idx = 0;
|
|
9381
|
+
while (idx < tokens2.length && tokens2[idx].startsWith("-")) {
|
|
9382
|
+
const opt = tokens2[idx++];
|
|
9383
|
+
if (["-k", "-s", "--kill-after", "--signal"].includes(opt)) idx++;
|
|
9384
|
+
}
|
|
9385
|
+
if (idx < tokens2.length && /^\d+(?:\.\d+)?[smhd]?$/i.test(tokens2[idx])) idx++;
|
|
9386
|
+
if (idx < tokens2.length) {
|
|
9387
|
+
const inner = tokens2.slice(idx).map((q) => /\s/.test(q) ? JSON.stringify(q) : q).join(" ");
|
|
9388
|
+
rest = inner;
|
|
9389
|
+
continue;
|
|
9390
|
+
}
|
|
9391
|
+
}
|
|
9136
9392
|
if (before !== rest && !rest) return { verb: "", rest: "" };
|
|
9137
|
-
return { verb:
|
|
9393
|
+
return { verb: base, rest: restAfter.trim() };
|
|
9138
9394
|
}
|
|
9139
9395
|
return { verb: "", rest };
|
|
9140
9396
|
}
|
|
9397
|
+
function extractSafeSearchTarget(rest) {
|
|
9398
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9399
|
+
if (!tokens2) return void 0;
|
|
9400
|
+
const valuedOpts = /* @__PURE__ */ new Set(["-e", "-f", "-g", "--glob", "-t", "--type", "-T", "--type-not", "-A", "-B", "-C", "-m", "--max-count", "--max-filesize", "--color", "--sort"]);
|
|
9401
|
+
let hasExtendedRegex = false;
|
|
9402
|
+
let pattern;
|
|
9403
|
+
for (let i = 0; i < tokens2.length; i++) {
|
|
9404
|
+
const tok = tokens2[i];
|
|
9405
|
+
if (tok === "--") {
|
|
9406
|
+
pattern = tokens2[i + 1];
|
|
9407
|
+
break;
|
|
9408
|
+
}
|
|
9409
|
+
if (tok.startsWith("-")) {
|
|
9410
|
+
if (tok === "-E" || tok === "-P" || tok === "--extended-regexp") hasExtendedRegex = true;
|
|
9411
|
+
if (valuedOpts.has(tok)) {
|
|
9412
|
+
if (tok === "-e" && !pattern && tokens2[i + 1]) pattern = tokens2[i + 1];
|
|
9413
|
+
i++;
|
|
9414
|
+
}
|
|
9415
|
+
continue;
|
|
9416
|
+
}
|
|
9417
|
+
pattern = tok;
|
|
9418
|
+
break;
|
|
9419
|
+
}
|
|
9420
|
+
if (!pattern || hasExtendedRegex || /[|[\]^$()*+?\\]/.test(pattern)) return void 0;
|
|
9421
|
+
return clipShortText(pattern, 22);
|
|
9422
|
+
}
|
|
9423
|
+
function parseSed(rest) {
|
|
9424
|
+
const rawTokens = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9425
|
+
if (!rawTokens) return null;
|
|
9426
|
+
let quiet = false;
|
|
9427
|
+
let inPlace = false;
|
|
9428
|
+
const scripts = [];
|
|
9429
|
+
const positional = [];
|
|
9430
|
+
for (let i = 0; i < rawTokens.length; i++) {
|
|
9431
|
+
const tok = rawTokens[i];
|
|
9432
|
+
if (tok === "--") {
|
|
9433
|
+
positional.push(...rawTokens.slice(i + 1));
|
|
9434
|
+
break;
|
|
9435
|
+
}
|
|
9436
|
+
if (tok.startsWith("-") && tok.length > 1) {
|
|
9437
|
+
if (tok === "--quiet" || tok === "--silent") {
|
|
9438
|
+
quiet = true;
|
|
9439
|
+
continue;
|
|
9440
|
+
}
|
|
9441
|
+
if (tok === "--in-place" || tok.startsWith("--in-place=")) {
|
|
9442
|
+
inPlace = true;
|
|
9443
|
+
continue;
|
|
9444
|
+
}
|
|
9445
|
+
if (tok === "--regexp-extended") continue;
|
|
9446
|
+
if (tok.startsWith("--expression=")) {
|
|
9447
|
+
scripts.push(tok.slice("--expression=".length));
|
|
9448
|
+
continue;
|
|
9449
|
+
}
|
|
9450
|
+
if (tok === "--expression") {
|
|
9451
|
+
if (rawTokens[i + 1] === void 0) return null;
|
|
9452
|
+
scripts.push(rawTokens[++i]);
|
|
9453
|
+
continue;
|
|
9454
|
+
}
|
|
9455
|
+
if (tok.startsWith("--")) return null;
|
|
9456
|
+
for (let c = 1; c < tok.length; c++) {
|
|
9457
|
+
const flag = tok[c];
|
|
9458
|
+
if (flag === "n") {
|
|
9459
|
+
quiet = true;
|
|
9460
|
+
continue;
|
|
9461
|
+
}
|
|
9462
|
+
if (flag === "r" || flag === "E") continue;
|
|
9463
|
+
if (flag === "i") {
|
|
9464
|
+
inPlace = true;
|
|
9465
|
+
if (c === tok.length - 1 && rawTokens[i + 1] === "") i++;
|
|
9466
|
+
break;
|
|
9467
|
+
}
|
|
9468
|
+
if (flag === "e") {
|
|
9469
|
+
if (c + 1 < tok.length) {
|
|
9470
|
+
scripts.push(tok.slice(c + 1));
|
|
9471
|
+
} else {
|
|
9472
|
+
if (rawTokens[i + 1] === void 0) return null;
|
|
9473
|
+
scripts.push(rawTokens[++i]);
|
|
9474
|
+
}
|
|
9475
|
+
break;
|
|
9476
|
+
}
|
|
9477
|
+
return null;
|
|
9478
|
+
}
|
|
9479
|
+
continue;
|
|
9480
|
+
}
|
|
9481
|
+
positional.push(tok);
|
|
9482
|
+
}
|
|
9483
|
+
const isSedScript = (tok) => /^(?:\d+|\$)(?:,\s*(?:\d+|\$))?[pdq=!]?$/.test(tok) || /^s[|/#]/.test(tok) || /^\/.*\/[pd=!]?$/.test(tok) || /^\d+[ew]/.test(tok);
|
|
9484
|
+
for (const tok of positional) {
|
|
9485
|
+
if (isSedScript(tok)) scripts.push(tok);
|
|
9486
|
+
}
|
|
9487
|
+
const files = positional.filter((t2) => !isSedScript(t2));
|
|
9488
|
+
if (scripts.length === 0 && files.length >= 2) {
|
|
9489
|
+
scripts.push(files.shift());
|
|
9490
|
+
}
|
|
9491
|
+
const fileToken = files[files.length - 1];
|
|
9492
|
+
const target = fileToken ? baseName(fileToken) : void 0;
|
|
9493
|
+
if (inPlace) {
|
|
9494
|
+
const isSafeSub = (part) => {
|
|
9495
|
+
if (part.length < 4 || part[0] !== "s") return false;
|
|
9496
|
+
const delim = part[1];
|
|
9497
|
+
if (delim !== "|" && delim !== "/" && delim !== "#") return false;
|
|
9498
|
+
let delimsSeen = 1;
|
|
9499
|
+
let idx = 2;
|
|
9500
|
+
for (; idx < part.length && delimsSeen < 3; idx++) {
|
|
9501
|
+
const ch = part[idx];
|
|
9502
|
+
if (ch === "\\" && idx + 1 < part.length) {
|
|
9503
|
+
idx++;
|
|
9504
|
+
continue;
|
|
9505
|
+
}
|
|
9506
|
+
if (ch === delim) delimsSeen++;
|
|
9507
|
+
}
|
|
9508
|
+
if (delimsSeen !== 3) return false;
|
|
9509
|
+
return /^[gipI]*$/.test(part.slice(idx));
|
|
9510
|
+
};
|
|
9511
|
+
const allSafe = scripts.every((s) => {
|
|
9512
|
+
const parts = s.split(";").map((p) => p.trim()).filter(Boolean);
|
|
9513
|
+
return parts.length > 0 && parts.every(isSafeSub);
|
|
9514
|
+
});
|
|
9515
|
+
if (!allSafe) return null;
|
|
9516
|
+
const replaceCount = (rest.match(/s[|/#][^|/#]*[|/#][^|/#]*[|/#]/g) ?? []).length;
|
|
9517
|
+
return {
|
|
9518
|
+
verb: "\u7F16\u8F91",
|
|
9519
|
+
target,
|
|
9520
|
+
count: replaceCount > 1 ? replaceCount : void 0,
|
|
9521
|
+
unit: "\u5904\u66FF\u6362",
|
|
9522
|
+
readOnly: false
|
|
9523
|
+
};
|
|
9524
|
+
}
|
|
9525
|
+
if (quiet) {
|
|
9526
|
+
const isStrictReadOnlyPrint = (s) => /^(?:\d+|\$)(?:\s*,\s*(?:\d+|\$))?\s*p$/.test(s.trim());
|
|
9527
|
+
if (scripts.length === 0 || !scripts.every(isStrictReadOnlyPrint)) {
|
|
9528
|
+
return null;
|
|
9529
|
+
}
|
|
9530
|
+
return { verb: "\u67E5\u770B", target, readOnly: true };
|
|
9531
|
+
}
|
|
9532
|
+
return { verb: "\u5904\u7406\u6587\u672C", target, readOnly: false };
|
|
9533
|
+
}
|
|
9534
|
+
function parseNolo(rest) {
|
|
9535
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9536
|
+
if (!tokens2 || tokens2.length === 0) return null;
|
|
9537
|
+
const sub = tokens2[0];
|
|
9538
|
+
const action = tokens2[1];
|
|
9539
|
+
const nonFlag = tokens2.slice(2).filter((t2) => !t2.startsWith("-"));
|
|
9540
|
+
if (sub === "browser" || sub === "chrome") {
|
|
9541
|
+
const map = {
|
|
9542
|
+
status: ["\u67E5\u6D4F\u89C8\u5668\u72B6\u6001", true],
|
|
9543
|
+
"list-tabs": ["\u5217\u6D4F\u89C8\u5668\u6807\u7B7E", true],
|
|
9544
|
+
"read-page": ["\u6D4F\u89C8\u5668\u8BFB\u9875\u9762", true],
|
|
9545
|
+
"read-network": ["\u67E5\u6D4F\u89C8\u5668\u8BF7\u6C42", true],
|
|
9546
|
+
screenshot: ["\u6D4F\u89C8\u5668\u622A\u56FE", true],
|
|
9547
|
+
"open-tab": ["\u6D4F\u89C8\u5668\u5F00\u6807\u7B7E", false],
|
|
9548
|
+
click: ["\u6D4F\u89C8\u5668\u70B9\u51FB", false],
|
|
9549
|
+
type: ["\u6D4F\u89C8\u5668\u8F93\u5165", false],
|
|
9550
|
+
press: ["\u6D4F\u89C8\u5668\u6309\u952E", false]
|
|
9551
|
+
};
|
|
9552
|
+
if (action && map[action]) return { verb: map[action][0], readOnly: map[action][1] };
|
|
9553
|
+
return { verb: "\u6D4F\u89C8\u5668\u64CD\u4F5C", readOnly: false };
|
|
9554
|
+
}
|
|
9555
|
+
if (sub === "agent") {
|
|
9556
|
+
if (action === "list" || action === "providers" || action === "models") return { verb: action === "list" ? "\u5217\u667A\u80FD\u4F53" : "\u5217\u6A21\u578B\u901A\u9053", readOnly: true };
|
|
9557
|
+
if (action === "read") return { verb: "\u8BFB\u667A\u80FD\u4F53", target: nonFlag[0] ? clipShortText(nonFlag[0], 24) : void 0, readOnly: true };
|
|
9558
|
+
if (action === "create") return { verb: "\u521B\u5EFA\u667A\u80FD\u4F53", target: nonFlag[0] ? clipShortText(nonFlag[0], 24) : void 0, readOnly: false };
|
|
9559
|
+
if (action === "delete") return { verb: "\u5220\u9664\u667A\u80FD\u4F53", target: nonFlag[0] ? clipShortText(nonFlag[0], 24) : void 0, readOnly: false };
|
|
9560
|
+
return { verb: "\u7BA1\u7406\u667A\u80FD\u4F53", readOnly: false };
|
|
9561
|
+
}
|
|
9562
|
+
if (sub === "dialog") {
|
|
9563
|
+
if (action === "list") return { verb: "\u5217\u5BF9\u8BDD", readOnly: true };
|
|
9564
|
+
if (action === "read") return { verb: "\u8BFB\u5BF9\u8BDD", target: nonFlag[0] ? clipShortText(nonFlag[0], 20) : void 0, readOnly: true };
|
|
9565
|
+
if (action === "status") return { verb: "\u67E5\u5BF9\u8BDD\u72B6\u6001", readOnly: true };
|
|
9566
|
+
if (action === "search") return { verb: "\u641C\u5BF9\u8BDD", readOnly: true };
|
|
9567
|
+
return { verb: "\u7BA1\u5BF9\u8BDD", readOnly: false };
|
|
9568
|
+
}
|
|
9569
|
+
if (sub === "secret") {
|
|
9570
|
+
if (action === "list") return { verb: "\u5217\u51ED\u636E", readOnly: true };
|
|
9571
|
+
if (action === "run") return { verb: "\u5E26\u51ED\u636E\u6267\u884C", readOnly: false };
|
|
9572
|
+
return { verb: "\u7BA1\u51ED\u636E", readOnly: false };
|
|
9573
|
+
}
|
|
9574
|
+
if (sub === "ci") return { verb: "\u67E5 CI \u72B6\u6001", readOnly: true };
|
|
9575
|
+
return null;
|
|
9576
|
+
}
|
|
9141
9577
|
function classifySegment(segment) {
|
|
9142
9578
|
const { verb, rest } = firstVerbToken(segment);
|
|
9143
9579
|
if (!verb) return null;
|
|
9144
9580
|
switch (verb) {
|
|
9145
9581
|
case "cd":
|
|
9146
|
-
return { verb: "\u8FDB\u5165\u76EE\u5F55", target: baseName(rest) };
|
|
9582
|
+
return { verb: "\u8FDB\u5165\u76EE\u5F55", target: baseName(rest), readOnly: true };
|
|
9147
9583
|
case "mkdir":
|
|
9148
|
-
return { verb: "\u5EFA\u76EE\u5F55", target: baseName(rest.replace(/^-\S+\s+/, "")) };
|
|
9584
|
+
return { verb: "\u5EFA\u76EE\u5F55", target: baseName(rest.replace(/^-\S+\s+/, "")), readOnly: false };
|
|
9149
9585
|
case "cp":
|
|
9150
|
-
return { verb: "\u590D\u5236", target: baseName(rest.split(/\s+/).pop() ?? "") };
|
|
9586
|
+
return { verb: "\u590D\u5236", target: baseName(rest.split(/\s+/).pop() ?? ""), readOnly: false };
|
|
9151
9587
|
case "mv":
|
|
9152
|
-
return { verb: "\u79FB\u52A8", target: baseName(rest.split(/\s+/).pop() ?? "") };
|
|
9588
|
+
return { verb: "\u79FB\u52A8", target: baseName(rest.split(/\s+/).pop() ?? ""), readOnly: false };
|
|
9153
9589
|
case "rm":
|
|
9154
|
-
return { verb: "\u5220\u9664", target: baseName(rest.split(/\s+/).pop() ?? "") };
|
|
9590
|
+
return { verb: "\u5220\u9664", target: baseName(rest.split(/\s+/).pop() ?? ""), readOnly: false };
|
|
9155
9591
|
case "touch":
|
|
9156
|
-
return { verb: "\u521B\u5EFA\u6587\u4EF6", target: baseName(rest) };
|
|
9157
|
-
case "cat":
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
return { verb: "\
|
|
9592
|
+
return { verb: "\u521B\u5EFA\u6587\u4EF6", target: baseName(rest), readOnly: false };
|
|
9593
|
+
case "cat": {
|
|
9594
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9595
|
+
const file = tokens2?.find((t2) => !t2.startsWith("-"));
|
|
9596
|
+
return { verb: "\u8BFB\u53D6", target: baseName(file ?? rest.split(/\s+/)[0] ?? ""), readOnly: true };
|
|
9597
|
+
}
|
|
9598
|
+
case "ls": {
|
|
9599
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9600
|
+
const dir = tokens2?.find((t2) => !t2.startsWith("-"));
|
|
9601
|
+
return { verb: "\u5217\u51FA\u76EE\u5F55", target: dir ? baseName(dir) : void 0, readOnly: true };
|
|
9602
|
+
}
|
|
9161
9603
|
case "grep":
|
|
9162
9604
|
case "rg":
|
|
9163
|
-
return { verb: "\u641C\u7D22" };
|
|
9605
|
+
return { verb: "\u641C\u7D22", target: extractSafeSearchTarget(rest), readOnly: true };
|
|
9164
9606
|
case "chmod":
|
|
9165
|
-
return { verb: "\u6539\u6743\u9650", target: baseName(rest.split(/\s+/).pop() ?? "") };
|
|
9607
|
+
return { verb: "\u6539\u6743\u9650", target: baseName(rest.split(/\s+/).pop() ?? ""), readOnly: false };
|
|
9166
9608
|
case "chown":
|
|
9167
|
-
return { verb: "\u6539\u5C5E\u4E3B", target: baseName(rest.split(/\s+/).pop() ?? "") };
|
|
9609
|
+
return { verb: "\u6539\u5C5E\u4E3B", target: baseName(rest.split(/\s+/).pop() ?? ""), readOnly: false };
|
|
9168
9610
|
case "tar":
|
|
9169
9611
|
case "unzip":
|
|
9170
|
-
return { verb: "\u89E3\u538B" };
|
|
9612
|
+
return { verb: "\u89E3\u538B", readOnly: false };
|
|
9171
9613
|
case "git": {
|
|
9172
|
-
const
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
const
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
checkout: "\u5207\u6362\u5206\u652F",
|
|
9191
|
-
switch: "\u5207\u6362\u5206\u652F",
|
|
9192
|
-
merge: "\u5408\u5E76",
|
|
9193
|
-
rebase: "\u53D8\u57FA",
|
|
9194
|
-
log: "\u67E5\u5386\u53F2",
|
|
9195
|
-
diff: "\u770B\u5DEE\u5F02",
|
|
9196
|
-
worktree: "\u7BA1\u7406\u5DE5\u4F5C\u533A",
|
|
9197
|
-
branch: "\u7BA1\u7406\u5206\u652F",
|
|
9198
|
-
stash: "\u6682\u5B58",
|
|
9199
|
-
reset: "\u91CD\u7F6E",
|
|
9200
|
-
restore: "\u6062\u590D\u6587\u4EF6"
|
|
9201
|
-
};
|
|
9202
|
-
const mapped = gitVerbs[sub];
|
|
9203
|
-
return mapped ? { verb: mapped } : null;
|
|
9614
|
+
const parsed = parseGit(rest);
|
|
9615
|
+
return parsed ? { verb: parsed.action, target: parsed.object, readOnly: parsed.readOnly } : null;
|
|
9616
|
+
}
|
|
9617
|
+
case "sed":
|
|
9618
|
+
return parseSed(rest);
|
|
9619
|
+
case "nolo":
|
|
9620
|
+
return parseNolo(rest);
|
|
9621
|
+
case "gh": {
|
|
9622
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9623
|
+
if (!tokens2?.length) return null;
|
|
9624
|
+
const sub = tokens2[0];
|
|
9625
|
+
const op = tokens2[1];
|
|
9626
|
+
const isRead = ["view", "list", "status", "checks", "diff"].includes(op ?? "");
|
|
9627
|
+
if (sub === "pr") return { verb: isRead ? "\u67E5 PR" : "\u64CD\u4F5C PR", readOnly: isRead };
|
|
9628
|
+
if (sub === "run") return { verb: isRead ? "\u67E5 CI \u8FD0\u884C" : "\u64CD\u4F5C CI \u8FD0\u884C", readOnly: isRead };
|
|
9629
|
+
if (sub === "issue") return { verb: isRead ? "\u67E5 Issue" : "\u64CD\u4F5C Issue", readOnly: isRead };
|
|
9630
|
+
if (sub === "api") return { verb: "\u8C03 GitHub API", readOnly: false };
|
|
9631
|
+
return null;
|
|
9204
9632
|
}
|
|
9205
|
-
case "
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
const
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
target: baseName(fileToken ?? ""),
|
|
9212
|
-
count: replaceCount > 1 ? replaceCount : void 0,
|
|
9213
|
-
unit: "\u5904\u66FF\u6362"
|
|
9214
|
-
};
|
|
9633
|
+
case "ps":
|
|
9634
|
+
return { verb: "\u67E5\u8FDB\u7A0B", readOnly: true };
|
|
9635
|
+
case "sha256sum": {
|
|
9636
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9637
|
+
const file = tokens2?.find((t2) => !t2.startsWith("-"));
|
|
9638
|
+
return { verb: "\u7B97\u6821\u9A8C\u548C", target: file ? baseName(file) : void 0, readOnly: true };
|
|
9215
9639
|
}
|
|
9216
9640
|
case "dnf":
|
|
9217
9641
|
case "yum": {
|
|
9218
9642
|
const sub = rest.split(/\s+/)[0] ?? "";
|
|
9219
|
-
if (sub === "install") return { verb: "\u88C5\u8F6F\u4EF6\u5305" };
|
|
9220
|
-
if (sub === "remove" || sub === "erase") return { verb: "\u5378\u8F7D\u8F6F\u4EF6\u5305" };
|
|
9221
|
-
if (sub === "update" || sub === "upgrade") return { verb: "\u66F4\u65B0\u7CFB\u7EDF" };
|
|
9222
|
-
if (sub === "search") return { verb: "\u641C\u7D22\u8F6F\u4EF6\u5305" };
|
|
9223
|
-
if (sub === "list") return { verb: "\u5217\u51FA\u8F6F\u4EF6\u5305" };
|
|
9224
|
-
if (sub === "history") return { verb: "\u67E5\u5B89\u88C5\u5386\u53F2" };
|
|
9643
|
+
if (sub === "install") return { verb: "\u88C5\u8F6F\u4EF6\u5305", readOnly: false };
|
|
9644
|
+
if (sub === "remove" || sub === "erase") return { verb: "\u5378\u8F7D\u8F6F\u4EF6\u5305", readOnly: false };
|
|
9645
|
+
if (sub === "update" || sub === "upgrade") return { verb: "\u66F4\u65B0\u7CFB\u7EDF", readOnly: false };
|
|
9646
|
+
if (sub === "search") return { verb: "\u641C\u7D22\u8F6F\u4EF6\u5305", readOnly: true };
|
|
9647
|
+
if (sub === "list") return { verb: "\u5217\u51FA\u8F6F\u4EF6\u5305", readOnly: true };
|
|
9648
|
+
if (sub === "history") return { verb: "\u67E5\u5B89\u88C5\u5386\u53F2", readOnly: true };
|
|
9225
9649
|
return null;
|
|
9226
9650
|
}
|
|
9227
9651
|
case "rpm":
|
|
9228
9652
|
case "pacman":
|
|
9229
9653
|
case "apt":
|
|
9230
9654
|
case "apt-get":
|
|
9231
|
-
return { verb: "\u7BA1\u8F6F\u4EF6\u5305" };
|
|
9655
|
+
return { verb: "\u7BA1\u8F6F\u4EF6\u5305", readOnly: false };
|
|
9232
9656
|
case "systemctl":
|
|
9233
9657
|
case "journalctl": {
|
|
9234
9658
|
const tokens2 = rest.split(/\s+/).filter((t2) => t2 && !t2.startsWith("-"));
|
|
9235
9659
|
const sub = tokens2[0] ?? "";
|
|
9236
|
-
if (verb === "journalctl") return { verb: "\u67E5\u65E5\u5FD7" };
|
|
9660
|
+
if (verb === "journalctl") return { verb: "\u67E5\u65E5\u5FD7", readOnly: true };
|
|
9237
9661
|
const sysVerbs = {
|
|
9238
|
-
start: "\u542F\u52A8\u670D\u52A1",
|
|
9239
|
-
stop: "\u505C\u6B62\u670D\u52A1",
|
|
9240
|
-
restart: "\u91CD\u542F\u670D\u52A1",
|
|
9241
|
-
status: "\u67E5\u670D\u52A1\u72B6\u6001",
|
|
9242
|
-
enable: "\u542F\u7528\u670D\u52A1",
|
|
9243
|
-
disable: "\u505C\u7528\u670D\u52A1",
|
|
9244
|
-
"daemon-reload": "\u91CD\u8F7D\u670D\u52A1\u914D\u7F6E",
|
|
9245
|
-
"list-units": "\u5217\u670D\u52A1",
|
|
9246
|
-
"list-unit-files": "\u5217\u670D\u52A1",
|
|
9247
|
-
is: "\u67E5\u670D\u52A1\u72B6\u6001",
|
|
9248
|
-
cat: "\u770B\u670D\u52A1\u5B9A\u4E49"
|
|
9662
|
+
start: ["\u542F\u52A8\u670D\u52A1", false],
|
|
9663
|
+
stop: ["\u505C\u6B62\u670D\u52A1", false],
|
|
9664
|
+
restart: ["\u91CD\u542F\u670D\u52A1", false],
|
|
9665
|
+
status: ["\u67E5\u670D\u52A1\u72B6\u6001", true],
|
|
9666
|
+
enable: ["\u542F\u7528\u670D\u52A1", false],
|
|
9667
|
+
disable: ["\u505C\u7528\u670D\u52A1", false],
|
|
9668
|
+
"daemon-reload": ["\u91CD\u8F7D\u670D\u52A1\u914D\u7F6E", false],
|
|
9669
|
+
"list-units": ["\u5217\u670D\u52A1", true],
|
|
9670
|
+
"list-unit-files": ["\u5217\u670D\u52A1", true],
|
|
9671
|
+
is: ["\u67E5\u670D\u52A1\u72B6\u6001", true],
|
|
9672
|
+
cat: ["\u770B\u670D\u52A1\u5B9A\u4E49", true]
|
|
9249
9673
|
};
|
|
9250
9674
|
const mapped = sysVerbs[sub];
|
|
9251
|
-
return mapped ? { verb: mapped } : null;
|
|
9675
|
+
return mapped ? { verb: mapped[0], readOnly: mapped[1] } : null;
|
|
9252
9676
|
}
|
|
9253
9677
|
case "awk":
|
|
9254
|
-
return { verb: "\u5904\u7406\u6587\u672C" };
|
|
9678
|
+
return { verb: "\u5904\u7406\u6587\u672C", readOnly: true };
|
|
9255
9679
|
case "find": {
|
|
9256
9680
|
if (/(?:^|\s)(?:-delete|-exec|-execdir|-ok|-okdir)(?:\s|$)/.test(rest)) return null;
|
|
9257
|
-
return { verb: "\u67E5\u627E\u6587\u4EF6" };
|
|
9681
|
+
return { verb: "\u67E5\u627E\u6587\u4EF6", readOnly: true };
|
|
9258
9682
|
}
|
|
9259
9683
|
case "curl":
|
|
9260
9684
|
case "wget":
|
|
9261
|
-
return { verb: "\u4E0B\u8F7D" };
|
|
9685
|
+
return { verb: "\u4E0B\u8F7D", readOnly: false };
|
|
9262
9686
|
case "bun":
|
|
9263
9687
|
case "npm":
|
|
9264
9688
|
case "pnpm":
|
|
9265
9689
|
case "yarn": {
|
|
9266
|
-
const tokens2 = rest.split(/\s+/).filter(Boolean);
|
|
9690
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]) ?? rest.split(/\s+/).filter(Boolean);
|
|
9267
9691
|
const sub = tokens2[0] ?? "";
|
|
9268
9692
|
if (sub === "test") {
|
|
9269
9693
|
const target = tokens2.slice(1).find((t2) => !t2.startsWith("-"));
|
|
9270
|
-
return { verb: "\u8DD1\u6D4B\u8BD5", target: target ? baseName(target) : void 0 };
|
|
9694
|
+
return { verb: "\u8DD1\u6D4B\u8BD5", target: target ? baseName(target) : void 0, readOnly: false };
|
|
9271
9695
|
}
|
|
9272
|
-
if (sub === "install" || sub === "i" || sub === "add") return { verb: "\u88C5\u4F9D\u8D56" };
|
|
9696
|
+
if (sub === "install" || sub === "i" || sub === "add") return { verb: "\u88C5\u4F9D\u8D56", readOnly: false };
|
|
9273
9697
|
if (sub === "run") {
|
|
9274
9698
|
const script = tokens2[1];
|
|
9275
|
-
return { verb: "\u8DD1\u811A\u672C", target: script };
|
|
9699
|
+
return { verb: "\u8DD1\u811A\u672C", target: script, readOnly: false };
|
|
9276
9700
|
}
|
|
9277
|
-
if (sub === "build") return { verb: "\u6784\u5EFA" };
|
|
9701
|
+
if (sub === "build") return { verb: "\u6784\u5EFA", readOnly: false };
|
|
9278
9702
|
if (sub === "x" || sub === "exec") {
|
|
9279
|
-
return { verb: "\u6267\u884C", target: tokens2[1] };
|
|
9703
|
+
return { verb: "\u6267\u884C", target: tokens2[1], readOnly: false };
|
|
9704
|
+
}
|
|
9705
|
+
if (verb === "bun" && (sub === "-e" || sub === "-p" || sub === "--inline-heredoc" || tokens2.includes("--inline-heredoc"))) {
|
|
9706
|
+
return { verb: "\u6267\u884C\u5185\u8054\u811A\u672C (Bun)", readOnly: false };
|
|
9707
|
+
}
|
|
9708
|
+
const scriptFile = tokens2.find((t2) => !t2.startsWith("-") && (/\.(?:ts|tsx|js|mjs|mts|cjs)$/i.test(t2) || t2.includes("/")));
|
|
9709
|
+
if (scriptFile) {
|
|
9710
|
+
return { verb: "\u8FD0\u884C\u811A\u672C", target: baseName(scriptFile), readOnly: false };
|
|
9280
9711
|
}
|
|
9281
9712
|
return null;
|
|
9282
9713
|
}
|
|
9283
|
-
case "node":
|
|
9284
9714
|
case "python":
|
|
9285
|
-
case "python3":
|
|
9715
|
+
case "python3": {
|
|
9716
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]) ?? [];
|
|
9717
|
+
if (tokens2.includes("--inline-heredoc") || /(?:^|\s)-[A-Za-z]*c(?:\s|$)/.test(rest)) {
|
|
9718
|
+
return { verb: "\u6267\u884C\u5185\u8054\u811A\u672C (Python)", readOnly: false };
|
|
9719
|
+
}
|
|
9720
|
+
const script = rest.split(/\s+/).find((t2) => t2 && !t2.startsWith("-"));
|
|
9721
|
+
return { verb: "\u6267\u884C\u811A\u672C", target: baseName(script ?? ""), readOnly: false };
|
|
9722
|
+
}
|
|
9723
|
+
case "node": {
|
|
9724
|
+
if (/(?:^|\s)-[A-Za-z]*e(?:\s|$)/.test(rest)) return null;
|
|
9725
|
+
const script = rest.split(/\s+/).find((t2) => t2 && !t2.startsWith("-"));
|
|
9726
|
+
return { verb: "\u6267\u884C\u811A\u672C", target: baseName(script ?? ""), readOnly: false };
|
|
9727
|
+
}
|
|
9286
9728
|
case "bash":
|
|
9287
9729
|
case "sh":
|
|
9288
9730
|
case "zsh": {
|
|
9289
9731
|
if (/(?:^|\s)-[A-Za-z]*[ce](?:\s|$)/.test(rest)) return null;
|
|
9290
9732
|
const script = rest.split(/\s+/).find((t2) => t2 && !t2.startsWith("-"));
|
|
9291
|
-
return { verb: "\u6267\u884C\u811A\u672C", target: baseName(script ?? "") };
|
|
9733
|
+
return { verb: "\u6267\u884C\u811A\u672C", target: baseName(script ?? ""), readOnly: false };
|
|
9292
9734
|
}
|
|
9293
9735
|
case "echo":
|
|
9294
9736
|
case "printf":
|
|
9295
|
-
return { verb: "\u8F93\u51FA" };
|
|
9737
|
+
return { verb: "\u8F93\u51FA", readOnly: true };
|
|
9296
9738
|
case "head":
|
|
9297
9739
|
case "tail":
|
|
9298
9740
|
case "wc":
|
|
9299
9741
|
case "sort":
|
|
9300
|
-
case "uniq":
|
|
9301
|
-
|
|
9742
|
+
case "uniq": {
|
|
9743
|
+
const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
|
|
9744
|
+
let file;
|
|
9745
|
+
if (tokens2) {
|
|
9746
|
+
for (let i = 0; i < tokens2.length; i++) {
|
|
9747
|
+
const tok = tokens2[i];
|
|
9748
|
+
if (tok === "-n" || tok === "-c") {
|
|
9749
|
+
i++;
|
|
9750
|
+
continue;
|
|
9751
|
+
}
|
|
9752
|
+
if (tok.startsWith("-")) continue;
|
|
9753
|
+
file = tok;
|
|
9754
|
+
break;
|
|
9755
|
+
}
|
|
9756
|
+
}
|
|
9757
|
+
return file ? { verb: "\u67E5\u770B", target: baseName(file), readOnly: true } : { verb: "\u67E5\u770B\u8F93\u51FA", readOnly: true };
|
|
9758
|
+
}
|
|
9302
9759
|
default:
|
|
9303
9760
|
return null;
|
|
9304
9761
|
}
|
|
@@ -9401,13 +9858,77 @@ function hasNonFilterPipeline(command) {
|
|
|
9401
9858
|
}
|
|
9402
9859
|
return false;
|
|
9403
9860
|
}
|
|
9861
|
+
function collapseSafeHeredocs(command) {
|
|
9862
|
+
const lines = command.split(/\r?\n/);
|
|
9863
|
+
const out = [];
|
|
9864
|
+
for (let i = 0; i < lines.length; i++) {
|
|
9865
|
+
const line = lines[i];
|
|
9866
|
+
const trimmed = line.trim();
|
|
9867
|
+
if (!trimmed) continue;
|
|
9868
|
+
const hd = trimmed.match(/^(.*?)\s*<<-?\s*'([A-Za-z0-9_]+)'\s*$/);
|
|
9869
|
+
if (hd) {
|
|
9870
|
+
const head = hd[1].trim();
|
|
9871
|
+
const tag = hd[2];
|
|
9872
|
+
let end = -1;
|
|
9873
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
9874
|
+
if (lines[j].trim() === tag) {
|
|
9875
|
+
end = j;
|
|
9876
|
+
break;
|
|
9877
|
+
}
|
|
9878
|
+
}
|
|
9879
|
+
if (end === -1) return null;
|
|
9880
|
+
out.push(`${head} --inline-heredoc`);
|
|
9881
|
+
i = end;
|
|
9882
|
+
continue;
|
|
9883
|
+
}
|
|
9884
|
+
out.push(trimmed);
|
|
9885
|
+
}
|
|
9886
|
+
return out.join("\n");
|
|
9887
|
+
}
|
|
9888
|
+
function normalizeTopLevelNewlines(command) {
|
|
9889
|
+
let out = "";
|
|
9890
|
+
let quote = null;
|
|
9891
|
+
for (let i = 0; i < command.length; i++) {
|
|
9892
|
+
const ch = command[i];
|
|
9893
|
+
const next = command[i + 1];
|
|
9894
|
+
if (quote) {
|
|
9895
|
+
if (ch === "\\" && next && quote === '"') {
|
|
9896
|
+
out += ch + next;
|
|
9897
|
+
i++;
|
|
9898
|
+
continue;
|
|
9899
|
+
}
|
|
9900
|
+
if (ch === quote) quote = null;
|
|
9901
|
+
out += ch === "\n" ? " " : ch;
|
|
9902
|
+
continue;
|
|
9903
|
+
}
|
|
9904
|
+
if (ch === '"' || ch === "'") {
|
|
9905
|
+
quote = ch;
|
|
9906
|
+
out += ch;
|
|
9907
|
+
continue;
|
|
9908
|
+
}
|
|
9909
|
+
if (ch === "\\" && next) {
|
|
9910
|
+
out += ch + next;
|
|
9911
|
+
i++;
|
|
9912
|
+
continue;
|
|
9913
|
+
}
|
|
9914
|
+
if (ch === "\n") {
|
|
9915
|
+
if (!out.endsWith("&& ") && out.trim().length > 0) out += " && ";
|
|
9916
|
+
continue;
|
|
9917
|
+
}
|
|
9918
|
+
out += ch;
|
|
9919
|
+
}
|
|
9920
|
+
return out.replace(/(?:\s*&&\s*)+$/, "").trim();
|
|
9921
|
+
}
|
|
9404
9922
|
function summarizeShellCommand(command) {
|
|
9405
|
-
const
|
|
9923
|
+
const collapsed = collapseSafeHeredocs(command);
|
|
9924
|
+
if (collapsed === null) return null;
|
|
9925
|
+
const normalized = normalizeTopLevelNewlines(collapsed);
|
|
9406
9926
|
if (!normalized) return null;
|
|
9407
9927
|
if (hasNonFilterPipeline(normalized)) return null;
|
|
9408
9928
|
const { segments, hasFallback } = splitSegments(normalized);
|
|
9409
9929
|
if (segments.length === 0) return null;
|
|
9410
9930
|
if (hasFallback) return null;
|
|
9931
|
+
if (segments.some((segment) => !shellWords(segment, true))) return null;
|
|
9411
9932
|
const actions = [];
|
|
9412
9933
|
for (const segment of segments) {
|
|
9413
9934
|
const action = classifySegment(segment);
|
|
@@ -9416,24 +9937,67 @@ function summarizeShellCommand(command) {
|
|
|
9416
9937
|
}
|
|
9417
9938
|
const summary = summarizeActions(actions);
|
|
9418
9939
|
if (!summary) return null;
|
|
9419
|
-
|
|
9940
|
+
const readOnly = actions.every((a) => a.readOnly === true);
|
|
9941
|
+
const single = segments.length === 1 ? firstVerbToken(segments[0]) : void 0;
|
|
9942
|
+
const git = single?.verb === "git" ? parseGit(single.rest) : null;
|
|
9943
|
+
const singleAction = segments.length === 1 && !actions[0]?.count ? { action: actions[0].verb, ...actions[0].target ? { object: actions[0].target } : {} } : {};
|
|
9944
|
+
return { summary, foldedSegments: segments.length, readOnly, ...singleAction, ...git ?? {} };
|
|
9945
|
+
}
|
|
9946
|
+
|
|
9947
|
+
// packages/core/toolActivityPresentation.ts
|
|
9948
|
+
var families = {
|
|
9949
|
+
readFile: ["read", "\u8BFB\u53D6", ["path"], true],
|
|
9950
|
+
read_file: ["read", "\u8BFB\u53D6", ["path"], true],
|
|
9951
|
+
readWorkspaceFile: ["read", "\u8BFB\u53D6", ["path"], true],
|
|
9952
|
+
writeFile: ["write", "\u5199\u5165", ["path"], false],
|
|
9953
|
+
editFile: ["edit", "\u4FEE\u6539", ["path"], false],
|
|
9954
|
+
globFiles: ["find", "\u67E5\u627E\u6587\u4EF6", ["pattern", "path"], true],
|
|
9955
|
+
search: ["search", "\u641C\u7D22", ["query", "pattern"], true],
|
|
9956
|
+
grep: ["search", "\u641C\u7D22", ["pattern", "query"], true],
|
|
9957
|
+
loadSkill: ["skill", "\u52A0\u8F7D\u6280\u80FD", ["name", "slug"], true]
|
|
9958
|
+
};
|
|
9959
|
+
var shellTools = /* @__PURE__ */ new Set(["execShell", "exec_shell", "runCommand", "launchProcess"]);
|
|
9960
|
+
function projectToolActivity(input, translate) {
|
|
9961
|
+
const text = (...keys) => {
|
|
9962
|
+
for (const key of keys) {
|
|
9963
|
+
const value = input.args?.[key];
|
|
9964
|
+
if (typeof value === "string" && value.length) return value;
|
|
9965
|
+
}
|
|
9966
|
+
return void 0;
|
|
9967
|
+
};
|
|
9968
|
+
let action = input.toolName, object, summary, readOnly = false;
|
|
9969
|
+
let confidence = "raw-fallback";
|
|
9970
|
+
let context = text("cwd");
|
|
9971
|
+
if (shellTools.has(input.toolName)) {
|
|
9972
|
+
object = text("command", "cmd");
|
|
9973
|
+
const gist = object ? summarizeShellCommand(object) : null;
|
|
9974
|
+
action = gist?.action ?? gist?.summary ?? "\u547D\u4EE4";
|
|
9975
|
+
if (gist) {
|
|
9976
|
+
object = gist.object;
|
|
9977
|
+
context = context ?? gist.context;
|
|
9978
|
+
summary = gist.summary;
|
|
9979
|
+
readOnly = gist.readOnly === true;
|
|
9980
|
+
confidence = "recognized";
|
|
9981
|
+
}
|
|
9982
|
+
if (!gist || gist.action) action = translate?.(gist?.action ? `toolActivity.shell.${gist.action}` : "toolActivity.shell", action) ?? action;
|
|
9983
|
+
} else {
|
|
9984
|
+
const family = families[input.toolName];
|
|
9985
|
+
if (family) {
|
|
9986
|
+
action = translate?.(`toolActivity.${family[0]}`, family[1]) ?? family[1];
|
|
9987
|
+
object = text(...family[2]);
|
|
9988
|
+
readOnly = family[3];
|
|
9989
|
+
confidence = "recognized";
|
|
9990
|
+
} else object = text("path", "query", "command", "url", "name");
|
|
9991
|
+
}
|
|
9992
|
+
return { key: input.key, action, object, context, ...summary ? { summary } : {}, readOnly, confidence, state: input.state, attention: input.attention, standalone: input.mode !== "ordinary" || input.attention.length > 0 || ["failed", "cancelled", "repairing"].includes(input.state), scopeKey: input.scopeKey, batchKey: input.batchKey, evidenceKey: input.evidenceKey };
|
|
9993
|
+
}
|
|
9994
|
+
function canCoalesceToolActivities(previous, next) {
|
|
9995
|
+
return !previous.standalone && !next.standalone && previous.attention.length === 0 && next.attention.length === 0 && !!previous.scopeKey && previous.scopeKey === next.scopeKey && !!previous.batchKey && previous.batchKey === next.batchKey;
|
|
9420
9996
|
}
|
|
9421
9997
|
|
|
9422
9998
|
// packages/cli/tui/askTextSanitize.ts
|
|
9423
9999
|
var ASK_SECRET_PLACEHOLDER = "\u27E8redacted\u27E9";
|
|
9424
10000
|
var C0_C1_CONTROL_REGEX = /[\x00-\x1f\x7f-\x9f]/g;
|
|
9425
|
-
var NORMAL_GIST_SECRET_PATTERNS = [
|
|
9426
|
-
/\bbearer\s+[A-Za-z0-9._~+/=-]{8,}/i,
|
|
9427
|
-
/\bsk-(?:ant-)?(?:api)?[0-9a-zA-Z-]{10,}/,
|
|
9428
|
-
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{10,}/,
|
|
9429
|
-
/\bxox[baprs]-[A-Za-z0-9-]{10,}/
|
|
9430
|
-
];
|
|
9431
|
-
function withholdIfSecretLike(gist) {
|
|
9432
|
-
if (!gist) return "";
|
|
9433
|
-
if (findPotentialSecrets(gist).length > 0) return "";
|
|
9434
|
-
if (NORMAL_GIST_SECRET_PATTERNS.some((pattern) => pattern.test(gist))) return "";
|
|
9435
|
-
return gist;
|
|
9436
|
-
}
|
|
9437
10001
|
function toText(value) {
|
|
9438
10002
|
return typeof value === "string" ? value : String(value ?? "");
|
|
9439
10003
|
}
|
|
@@ -9777,14 +10341,6 @@ function formatSearchItemQuery(query, path2, customHomedir) {
|
|
|
9777
10341
|
if (!text) return "search";
|
|
9778
10342
|
return text.length > 80 ? `${text.slice(0, 79)}\u2026` : text;
|
|
9779
10343
|
}
|
|
9780
|
-
function formatRunItemCommand(command, exitCode, timedOut) {
|
|
9781
|
-
let text = compactWhitespace(command || "");
|
|
9782
|
-
if (!text) text = "command";
|
|
9783
|
-
text = text.length > 80 ? `${text.slice(0, 79)}\u2026` : text;
|
|
9784
|
-
if (timedOut) return `${text} (timed out)`;
|
|
9785
|
-
if (typeof exitCode === "number" && exitCode !== 0) return `${text} (exit ${exitCode})`;
|
|
9786
|
-
return text;
|
|
9787
|
-
}
|
|
9788
10344
|
function formatFetchItemUrl(url) {
|
|
9789
10345
|
const text = (url || "").trim();
|
|
9790
10346
|
if (!text) return "webpage";
|
|
@@ -10485,19 +11041,16 @@ function formatNormalToolLine(event, pending, colorEnabled, opts) {
|
|
|
10485
11041
|
const label = toolLabel(toolName);
|
|
10486
11042
|
const cols = typeof process !== "undefined" && typeof process.stdout?.columns === "number" && process.stdout.columns > 0 ? process.stdout.columns : 80;
|
|
10487
11043
|
const totalBudget = Math.max(1, resolveHistoryLayoutGeometry(cols).contentWidth - displayWidth("\u25C8 "));
|
|
10488
|
-
if (readActionGate(event.metadata?.actionGate)) {
|
|
10489
|
-
const
|
|
10490
|
-
const
|
|
10491
|
-
|
|
10492
|
-
const fittedAction = maxActionWidth > 0 && displayWidth(actionText) > maxActionWidth ? truncateByDisplayWidth(actionText, maxActionWidth) : maxActionWidth > 0 ? actionText : "";
|
|
10493
|
-
return formatToolTraceLine(fitNormalLine(`\u25B8 ${label}`, `! ${fittedAction}`, totalBudget), colorEnabled, "error");
|
|
11044
|
+
if (readActionGate(event.metadata?.actionGate) || event.metadata?.permissionRequest) {
|
|
11045
|
+
const gist2 = opts?.tuiTrees ? normalToolGist(event) : "";
|
|
11046
|
+
const title = gist2 ? `${label} \xB7 ${gist2}` : label;
|
|
11047
|
+
return formatToolTraceLine(fitNormalLine(`\u25B8 ${title}`, `! ${t("toolNeedsAction")}`, totalBudget), colorEnabled, "error");
|
|
10494
11048
|
}
|
|
10495
11049
|
if (event.type === "tool-error" || event.metadata?.timedOut || isFailedToolResult(event)) {
|
|
10496
11050
|
const reason = event.metadata?.timedOut ? t("toolTimedOut") : toolFailureReason(event) || t("toolFailed");
|
|
10497
|
-
const
|
|
10498
|
-
const
|
|
10499
|
-
|
|
10500
|
-
return formatToolTraceLine(fitNormalLine(`\u25B8 ${label}`, `\u2717 ${fittedReason}`, totalBudget), colorEnabled, "error");
|
|
11051
|
+
const gist2 = opts?.tuiTrees ? normalToolGist(event) : "";
|
|
11052
|
+
const title = gist2 ? `${label} \xB7 ${gist2}` : label;
|
|
11053
|
+
return formatToolTraceLine(fitNormalLine(`\u25B8 ${title}`, `\u2717 ${reason}`, totalBudget), colorEnabled, "error");
|
|
10501
11054
|
}
|
|
10502
11055
|
const resultSummary = normalResultSummary(event);
|
|
10503
11056
|
const gist = [normalToolGist(event), resultSummary].filter(Boolean).join(" \xB7 ");
|
|
@@ -10608,11 +11161,17 @@ var TUI_TREE_TOOLS = {
|
|
|
10608
11161
|
Search: ["exa_search"],
|
|
10609
11162
|
Fetch: ["fetchWebpage"]
|
|
10610
11163
|
};
|
|
11164
|
+
function toolDetails(event, line) {
|
|
11165
|
+
const command = event.metadata?.command;
|
|
11166
|
+
return isRunToolName(event.toolName) && typeof command === "string" ? `${line}${safeApprovalMultilineText(command)}
|
|
11167
|
+
` : line;
|
|
11168
|
+
}
|
|
10611
11169
|
function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts = {}) {
|
|
10612
11170
|
const pending = /* @__PURE__ */ new Map();
|
|
11171
|
+
let scope = 0;
|
|
10613
11172
|
let tree = null;
|
|
10614
11173
|
const treeKind = (name) => Object.keys(TUI_TREE_TOOLS).find((kind) => TUI_TREE_TOOLS[kind].includes(name)) ?? null;
|
|
10615
|
-
const treeLine = (kind, items, fallback) => {
|
|
11174
|
+
const treeLine = (kind, items, fallback, details) => {
|
|
10616
11175
|
const label = kind === "Run" ? toolLabel("execShell") : kind === "Read" ? toolLabel("readFile") : kind === "Fetch" ? toolLabel("fetchWebpage") : toolLabel("exa_search");
|
|
10617
11176
|
const header = `${label} (${items.length}) \xB7 `;
|
|
10618
11177
|
const columns = resolveHistoryLayoutGeometry(process.stdout.columns).contentWidth - displayWidth("\u25C8 ");
|
|
@@ -10628,6 +11187,7 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
|
|
|
10628
11187
|
kind,
|
|
10629
11188
|
summary,
|
|
10630
11189
|
fallback,
|
|
11190
|
+
details,
|
|
10631
11191
|
previousRow: tree?.lastRow
|
|
10632
11192
|
};
|
|
10633
11193
|
if (tree) tree.lastRow = `\u25B8 ${summary}`;
|
|
@@ -10635,8 +11195,9 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
|
|
|
10635
11195
|
`;
|
|
10636
11196
|
};
|
|
10637
11197
|
const formatTreeEvent = (event, call) => {
|
|
11198
|
+
if (event.type === "tool-error") tree = null;
|
|
10638
11199
|
if (!opts.tuiTrees || event.type !== "tool-result") return null;
|
|
10639
|
-
if (isFailedToolResult(event) || event.metadata?.failed || event.metadata?.timedOut || readActionGate(event.metadata?.actionGate)) {
|
|
11200
|
+
if (isFailedToolResult(event) || event.metadata?.failed || event.metadata?.timedOut || readActionGate(event.metadata?.actionGate) || event.metadata?.permissionRequest) {
|
|
10640
11201
|
tree = null;
|
|
10641
11202
|
return null;
|
|
10642
11203
|
}
|
|
@@ -10646,24 +11207,40 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
|
|
|
10646
11207
|
tree = null;
|
|
10647
11208
|
return null;
|
|
10648
11209
|
}
|
|
11210
|
+
const activity = projectToolActivity({
|
|
11211
|
+
key: event.toolCallId,
|
|
11212
|
+
toolName: name,
|
|
11213
|
+
args: event.metadata,
|
|
11214
|
+
state: "success",
|
|
11215
|
+
attention: [],
|
|
11216
|
+
mode: "ordinary",
|
|
11217
|
+
// Formatter lifecycle/reset is the real assistant-output boundary;
|
|
11218
|
+
// round comes from the execution stream, never from adjacent rows.
|
|
11219
|
+
scopeKey: `assistant:${scope}`,
|
|
11220
|
+
batchKey: Number.isInteger(event.round) && event.round >= 0 ? `round:${event.round}` : void 0,
|
|
11221
|
+
evidenceKey: event.toolCallId
|
|
11222
|
+
});
|
|
10649
11223
|
let item = "";
|
|
10650
11224
|
const m = event.metadata ?? {};
|
|
10651
11225
|
if (kind === "Run") {
|
|
10652
|
-
|
|
10653
|
-
item = command ? formatRunItemCommand(command, typeof m.exitCode === "number" ? m.exitCode : void 0, Boolean(m.timedOut)) : "command";
|
|
11226
|
+
item = activity.summary ?? (activity.confidence === "raw-fallback" ? clipCompactText(redactSecrets(activity.object ?? ""), 56, "\u2026") : [activity.action, activity.object].filter(Boolean).join(" "));
|
|
10654
11227
|
}
|
|
10655
11228
|
if (kind === "Read") item = formatReadItemPath(typeof m.path === "string" ? m.path : typeof m.filePath === "string" ? m.filePath : "file", m);
|
|
10656
11229
|
if (kind === "Search") item = formatSearchItemQuery(typeof m.query === "string" ? m.query : typeof m.pattern === "string" ? m.pattern : "search", typeof m.path === "string" ? m.path : void 0);
|
|
10657
11230
|
if (kind === "Fetch") item = formatFetchItemUrl(typeof m.url === "string" ? m.url : "webpage");
|
|
10658
|
-
item =
|
|
10659
|
-
if (tree?.kind !== kind) tree = { kind, items: [] };
|
|
11231
|
+
item = safeAskText(item) || toolLabel(name);
|
|
11232
|
+
if (tree?.kind !== kind || !canCoalesceToolActivities(tree.activity, activity)) tree = { kind, items: [], activity };
|
|
10660
11233
|
tree.items.push(item);
|
|
10661
11234
|
if (tree.items.length < 2) {
|
|
10662
|
-
const
|
|
10663
|
-
tree.lastRow = stripAnsi(
|
|
10664
|
-
|
|
11235
|
+
const line2 = formatNormalToolLine(event, call, colorEnabled, opts);
|
|
11236
|
+
tree.lastRow = stripAnsi(line2).trimEnd();
|
|
11237
|
+
const rawCommand = typeof m.command === "string" ? m.command : "";
|
|
11238
|
+
const runIdentity = kind === "Run" && activity.readOnly && rawCommand ? createHash2("sha256").update(rawCommand).digest("hex").slice(0, 16) : void 0;
|
|
11239
|
+
return `${TUI_TREE_MARKER}${JSON.stringify({ kind, summary: stripAnsi(line2).trimEnd().replace(/^▸ /, ""), fallback: line2, details: toolDetails(event, line2), appendOnly: true, ...runIdentity ? { readOnly: true, runIdentity } : {} })}${TUI_TREE_END}
|
|
11240
|
+
`;
|
|
10665
11241
|
}
|
|
10666
|
-
|
|
11242
|
+
const line = formatNormalToolLine(event, call, colorEnabled, opts);
|
|
11243
|
+
return treeLine(kind, tree.items, line, toolDetails(event, line));
|
|
10667
11244
|
};
|
|
10668
11245
|
const format = (event) => {
|
|
10669
11246
|
if (event.type === "tool-call") {
|
|
@@ -10677,10 +11254,16 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
|
|
|
10677
11254
|
pending.delete(event.toolCallId);
|
|
10678
11255
|
const treeOutput = formatTreeEvent(event, call);
|
|
10679
11256
|
if (treeOutput !== null) return treeOutput;
|
|
10680
|
-
|
|
11257
|
+
const line = formatNormalToolLine(event, call, colorEnabled, opts);
|
|
11258
|
+
if (opts.tuiTrees && line && isRunToolName(event.toolName)) {
|
|
11259
|
+
return `${TUI_TREE_MARKER}${JSON.stringify({ kind: "Run", summary: "", fallback: line, details: toolDetails(event, line), appendOnly: true })}${TUI_TREE_END}
|
|
11260
|
+
`;
|
|
11261
|
+
}
|
|
11262
|
+
return line;
|
|
10681
11263
|
};
|
|
10682
11264
|
format.reset = () => {
|
|
10683
11265
|
tree = null;
|
|
11266
|
+
scope++;
|
|
10684
11267
|
};
|
|
10685
11268
|
format.consume = (event) => {
|
|
10686
11269
|
if (event.type === "tool-call") {
|
|
@@ -10928,10 +11511,6 @@ function shouldPromoteTuiNarration(text) {
|
|
|
10928
11511
|
if (text.length >= TUI_PROGRESS_BUFFER_LIMIT) return true;
|
|
10929
11512
|
return /(^|\n)\s*(?:#{1,3}\s|```|[-*+]\s|\d+[.)]\s)/.test(text);
|
|
10930
11513
|
}
|
|
10931
|
-
function narrationActivityLabel(text) {
|
|
10932
|
-
const oneLine = stripAnsi(text).replace(/[`*_#>]/g, "").replace(/\s+/g, " ").trim();
|
|
10933
|
-
return truncateThinkingHint(oneLine, 60);
|
|
10934
|
-
}
|
|
10935
11514
|
function createCliTurnOutput(params) {
|
|
10936
11515
|
const { options } = params;
|
|
10937
11516
|
const workingLabel = params.workingLabel ?? `${options.agentName} -> working`;
|
|
@@ -10944,12 +11523,7 @@ function createCliTurnOutput(params) {
|
|
|
10944
11523
|
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
10945
11524
|
const showThinking = !assistantLabelManaged && options.showThinking !== false;
|
|
10946
11525
|
const hidesRoutineTuiToolDetail = (event) => {
|
|
10947
|
-
|
|
10948
|
-
if (event.type === "tool-error") return false;
|
|
10949
|
-
if (readActionGate(event.metadata?.actionGate)) return false;
|
|
10950
|
-
if (event.metadata?.timedOut || event.metadata?.failed || event.metadata?.error) return false;
|
|
10951
|
-
if (typeof event.metadata?.exitCode === "number" && event.metadata.exitCode !== 0) return false;
|
|
10952
|
-
return true;
|
|
11526
|
+
return false;
|
|
10953
11527
|
};
|
|
10954
11528
|
let streamedAssistantText = false;
|
|
10955
11529
|
let everStreamedAnyText = false;
|
|
@@ -11023,11 +11597,6 @@ function createCliTurnOutput(params) {
|
|
|
11023
11597
|
streamedAssistantText = true;
|
|
11024
11598
|
options.activityReporter?.(null);
|
|
11025
11599
|
};
|
|
11026
|
-
const dropPendingTuiProgress = () => {
|
|
11027
|
-
pendingTuiNarration = "";
|
|
11028
|
-
tuiNarrationPromoted = false;
|
|
11029
|
-
options.activityReporter?.(null);
|
|
11030
|
-
};
|
|
11031
11600
|
const writeVisibleAssistantChunk = (chunk) => {
|
|
11032
11601
|
if (!chunk) return;
|
|
11033
11602
|
if (!assistantLabelManaged) formatToolEvent.reset?.();
|
|
@@ -11046,6 +11615,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
11046
11615
|
}
|
|
11047
11616
|
printedAssistantLabel = true;
|
|
11048
11617
|
}
|
|
11618
|
+
if (assistantLabelManaged) options.activityReporter?.(t("generatingReply"));
|
|
11049
11619
|
everStreamedAnyText = true;
|
|
11050
11620
|
if (assistantLabelManaged) {
|
|
11051
11621
|
if (tuiNarrationPromoted) {
|
|
@@ -11057,8 +11627,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
11057
11627
|
if (shouldPromoteTuiNarration(pendingTuiNarration)) {
|
|
11058
11628
|
flushPendingTuiNarration();
|
|
11059
11629
|
} else {
|
|
11060
|
-
|
|
11061
|
-
if (label) options.activityReporter?.(label);
|
|
11630
|
+
options.activityReporter?.(t("generatingReply"));
|
|
11062
11631
|
}
|
|
11063
11632
|
return;
|
|
11064
11633
|
}
|
|
@@ -11079,7 +11648,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
11079
11648
|
}
|
|
11080
11649
|
if (event.type === "tool-call") {
|
|
11081
11650
|
if (assistantLabelManaged && pendingTuiNarration) {
|
|
11082
|
-
|
|
11651
|
+
flushPendingTuiNarration();
|
|
11083
11652
|
}
|
|
11084
11653
|
renderWriter.flush();
|
|
11085
11654
|
if (!hidesRoutineTuiToolDetail(event)) {
|
|
@@ -11120,12 +11689,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
11120
11689
|
/**
|
|
11121
11690
|
* Terminal cleanup for abort/error paths that never reach `finish()`.
|
|
11122
11691
|
*
|
|
11123
|
-
*
|
|
11124
|
-
* on purpose and the dock already showed that text as activity. A genuine
|
|
11125
|
-
* failure must not swallow prose that never got the chance to be *proven*
|
|
11126
|
-
* durable (only a following tool call proves "progress"), so it promotes the
|
|
11127
|
-
* pending buffer and flushes what was already promoted — otherwise a short
|
|
11128
|
-
* final answer followed by a transport error disappears from the transcript.
|
|
11692
|
+
* Preserve original prose on both abort and transport failure.
|
|
11129
11693
|
*/
|
|
11130
11694
|
cancel(cleanup) {
|
|
11131
11695
|
if (assistantLabelManaged && cleanup?.preservePendingNarration) {
|
|
@@ -11135,7 +11699,8 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
11135
11699
|
options.output.write("\n");
|
|
11136
11700
|
}
|
|
11137
11701
|
}
|
|
11138
|
-
|
|
11702
|
+
flushPendingTuiNarration();
|
|
11703
|
+
renderWriter.flush();
|
|
11139
11704
|
},
|
|
11140
11705
|
pushText(chunk) {
|
|
11141
11706
|
writeVisibleAssistantChunk(chunk);
|
|
@@ -11714,7 +12279,7 @@ function isBalanceExhaustedError(error) {
|
|
|
11714
12279
|
|
|
11715
12280
|
// packages/cli/client/agentRun.ts
|
|
11716
12281
|
async function loadRunLocalAgentTurn() {
|
|
11717
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
12282
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-TU4LA353.js");
|
|
11718
12283
|
return runLocalAgentTurn;
|
|
11719
12284
|
}
|
|
11720
12285
|
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();
|
|
@@ -12509,6 +13074,10 @@ function describeLocalRunFailure(message, rawError) {
|
|
|
12509
13074
|
}
|
|
12510
13075
|
if (isMissingBatchReceiptFailure(message)) {
|
|
12511
13076
|
return `[nolo] ${describeMissingBatchReceipt()}.
|
|
13077
|
+
`;
|
|
13078
|
+
}
|
|
13079
|
+
if (/\bimage_model_unsupported\b/.test(message)) {
|
|
13080
|
+
return `[nolo] ${message}. ${NO_FALLBACK} Check the selected model's image capability or use a model known to support images.
|
|
12512
13081
|
`;
|
|
12513
13082
|
}
|
|
12514
13083
|
const cls = classifyLocalRunError(message);
|
|
@@ -12858,6 +13427,17 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12858
13427
|
options.modelOverride
|
|
12859
13428
|
) : resolvedBaseAdapter;
|
|
12860
13429
|
if (adapter2) adapter2 = applyEphemeralIfRequested(options, adapter2);
|
|
13430
|
+
if (adapter2 && options.imageUrls?.length) {
|
|
13431
|
+
const imageAdapter = adapter2;
|
|
13432
|
+
adapter2 = { ...imageAdapter, loadAgentConfig: async (agentRef) => {
|
|
13433
|
+
const config = await imageAdapter.loadAgentConfig(agentRef);
|
|
13434
|
+
if (!config) return config;
|
|
13435
|
+
if (!resolveAgentImageInputSupport({ ...config, hasVision: config.hasVision ?? false })) {
|
|
13436
|
+
throw new Error("image_model_unsupported: child model image capability is unsupported or unknown");
|
|
13437
|
+
}
|
|
13438
|
+
return config;
|
|
13439
|
+
} };
|
|
13440
|
+
}
|
|
12861
13441
|
return adapter2;
|
|
12862
13442
|
})();
|
|
12863
13443
|
if (!baseAdapter) {
|
|
@@ -12946,6 +13526,9 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12946
13526
|
try {
|
|
12947
13527
|
const saved = await commandAdapter.saveTurn({
|
|
12948
13528
|
...input,
|
|
13529
|
+
// Receipt-backed user rows are excluded below to avoid duplicate persistence.
|
|
13530
|
+
// Keep their explicit identities for post-sync native memory capture.
|
|
13531
|
+
...{ cliCaptureUserMessageIds: input.messages.filter((message) => message.role === "user").map((message) => message.cliMessageId).filter((id) => typeof id === "string") },
|
|
12949
13532
|
messages: input.messages.filter((message) => {
|
|
12950
13533
|
const cliMessageId = message.cliMessageId;
|
|
12951
13534
|
if (!cliMessageId) return true;
|
|
@@ -14185,6 +14768,73 @@ var createDetachedThrottle = (input) => {
|
|
|
14185
14768
|
};
|
|
14186
14769
|
};
|
|
14187
14770
|
|
|
14771
|
+
// packages/ai/memory/vnext/recallBudget.ts
|
|
14772
|
+
var DEFAULT_DEEP_MEMORY_TOKENS = DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET;
|
|
14773
|
+
var resolveMemoryBudget = (value) => {
|
|
14774
|
+
const budget = value ?? DEFAULT_DEEP_MEMORY_TOKENS;
|
|
14775
|
+
if (!Number.isSafeInteger(budget) || budget < 512) {
|
|
14776
|
+
throw new Error("memory budget must be a safe integer >= 512 estimated tokens");
|
|
14777
|
+
}
|
|
14778
|
+
return budget;
|
|
14779
|
+
};
|
|
14780
|
+
var clipMemoryText = (text, maxTokens) => {
|
|
14781
|
+
if (estimateTokenCount(text) <= maxTokens) return text;
|
|
14782
|
+
const suffix = "\u2026[truncated]";
|
|
14783
|
+
if (estimateTokenCount(suffix) > maxTokens) return "";
|
|
14784
|
+
let lo = 0;
|
|
14785
|
+
let hi = text.length;
|
|
14786
|
+
while (lo < hi) {
|
|
14787
|
+
const mid = Math.ceil((lo + hi) / 2);
|
|
14788
|
+
if (estimateTokenCount(text.slice(0, mid) + suffix) <= maxTokens) lo = mid;
|
|
14789
|
+
else hi = mid - 1;
|
|
14790
|
+
}
|
|
14791
|
+
if (lo && /[\uD800-\uDBFF]/.test(text[lo - 1])) lo--;
|
|
14792
|
+
return text.slice(0, lo) + suffix;
|
|
14793
|
+
};
|
|
14794
|
+
var DESCRIPTIVE_FIELDS = /* @__PURE__ */ new Set(["text", "name", "facet", "subtype", "value", "aliases"]);
|
|
14795
|
+
var compactMemoryRow = (row, fieldTokens = 128) => Object.fromEntries(Object.entries(row).map(([key, value]) => [
|
|
14796
|
+
key,
|
|
14797
|
+
DESCRIPTIVE_FIELDS.has(key) && estimateTokenCount(typeof value === "string" ? value : JSON.stringify(value) ?? "") > fieldTokens ? clipMemoryText(typeof value === "string" ? value : JSON.stringify(value) ?? "", fieldTokens) : value
|
|
14798
|
+
]));
|
|
14799
|
+
var memoryMessageTokens = (messages) => messages.reduce((sum, message) => sum + estimateTokenCount(message.content) + 8, 0);
|
|
14800
|
+
var buildBudgetedMemoryInput = (input) => {
|
|
14801
|
+
const maxTokens = resolveMemoryBudget(input.maxTokens);
|
|
14802
|
+
const query = clipMemoryText(input.query, Math.floor(maxTokens / 4));
|
|
14803
|
+
const rows = [];
|
|
14804
|
+
const messages = () => [
|
|
14805
|
+
{ role: "system", content: input.system + "\nThis is a budgeted subset. Omitted candidates are unknown, not absent. Select only supplied exact ids; never infer nonexistence from omissions." },
|
|
14806
|
+
{ role: "user", content: `Query:
|
|
14807
|
+
${query}
|
|
14808
|
+
|
|
14809
|
+
Memory catalog:
|
|
14810
|
+
${JSON.stringify({ candidates: rows })}` }
|
|
14811
|
+
];
|
|
14812
|
+
if (memoryMessageTokens(messages()) > maxTokens) {
|
|
14813
|
+
throw new Error("memory budget cannot fit instructions and query");
|
|
14814
|
+
}
|
|
14815
|
+
let clipped = false;
|
|
14816
|
+
for (const original of input.rows) {
|
|
14817
|
+
const row = compactMemoryRow(original);
|
|
14818
|
+
rows.push(row);
|
|
14819
|
+
if (memoryMessageTokens(messages()) > maxTokens) rows.pop();
|
|
14820
|
+
else if (JSON.stringify(row) !== JSON.stringify(original)) clipped = true;
|
|
14821
|
+
}
|
|
14822
|
+
const result = messages();
|
|
14823
|
+
return {
|
|
14824
|
+
messages: result,
|
|
14825
|
+
rows,
|
|
14826
|
+
budget: {
|
|
14827
|
+
maxTokens,
|
|
14828
|
+
usedTokens: memoryMessageTokens(result),
|
|
14829
|
+
truncated: clipped || rows.length !== input.rows.length || query !== input.query,
|
|
14830
|
+
queryTruncated: query !== input.query,
|
|
14831
|
+
offeredCandidates: rows.length,
|
|
14832
|
+
totalCandidates: input.rows.length,
|
|
14833
|
+
omittedCandidates: input.rows.length - rows.length
|
|
14834
|
+
}
|
|
14835
|
+
};
|
|
14836
|
+
};
|
|
14837
|
+
|
|
14188
14838
|
// packages/ai/memory/vnext/recall.ts
|
|
14189
14839
|
var MAX_RECALL_REFS = 6;
|
|
14190
14840
|
var stripFence = (raw) => {
|
|
@@ -14214,76 +14864,84 @@ var parseSelection = (raw) => {
|
|
|
14214
14864
|
reason: obj.reason
|
|
14215
14865
|
};
|
|
14216
14866
|
};
|
|
14217
|
-
var catalogText = (entities, states) => JSON.stringify(
|
|
14218
|
-
{
|
|
14219
|
-
entities: entities.map((entity) => ({
|
|
14220
|
-
id: entity.id,
|
|
14221
|
-
type: entity.type,
|
|
14222
|
-
name: entity.name,
|
|
14223
|
-
...entity.subtype ? { subtype: entity.subtype } : {},
|
|
14224
|
-
...entity.aliases?.length ? { aliases: entity.aliases } : {}
|
|
14225
|
-
})),
|
|
14226
|
-
states: states.map((state2) => ({
|
|
14227
|
-
id: state2.id,
|
|
14228
|
-
entityId: state2.entityId,
|
|
14229
|
-
facet: state2.facet,
|
|
14230
|
-
text: state2.text,
|
|
14231
|
-
// Retired (superseded) States stay listed as recoverable history; the
|
|
14232
|
-
// boolean — not the retiredAt timestamp — enters the prompt so no
|
|
14233
|
-
// timestamps reach LLM text.
|
|
14234
|
-
...state2.retiredAt ? { retired: true } : {}
|
|
14235
|
-
}))
|
|
14236
|
-
},
|
|
14237
|
-
null,
|
|
14238
|
-
2
|
|
14239
|
-
);
|
|
14240
14867
|
var createMemoryVNextRecall = (input) => async (query) => {
|
|
14241
14868
|
const startedAt = performance.now();
|
|
14869
|
+
const maxTokens = resolveMemoryBudget(input.maxInputTokens);
|
|
14242
14870
|
const { entities, states } = await loadMemoryVNextCatalog(input.db, input.ownerId);
|
|
14243
|
-
if (entities.length === 0 && states.length === 0) {
|
|
14871
|
+
if (!query.trim() || entities.length === 0 && states.length === 0) {
|
|
14244
14872
|
return {
|
|
14245
14873
|
query,
|
|
14246
14874
|
refs: [],
|
|
14247
14875
|
entities: [],
|
|
14248
14876
|
states: [],
|
|
14249
|
-
reason: "memory catalog is empty",
|
|
14877
|
+
reason: query.trim() ? "memory catalog is empty" : "query is empty",
|
|
14250
14878
|
trace: {
|
|
14251
14879
|
candidateEntities: 0,
|
|
14252
14880
|
candidateStates: 0,
|
|
14253
14881
|
selectedRefs: 0,
|
|
14882
|
+
budget: {
|
|
14883
|
+
maxTokens,
|
|
14884
|
+
usedTokens: 0,
|
|
14885
|
+
truncated: false,
|
|
14886
|
+
offeredCandidates: 0,
|
|
14887
|
+
totalCandidates: entities.length + states.length,
|
|
14888
|
+
omittedCandidates: entities.length + states.length
|
|
14889
|
+
},
|
|
14254
14890
|
elapsedMs: Math.round((performance.now() - startedAt) * 10) / 10
|
|
14255
14891
|
}
|
|
14256
14892
|
};
|
|
14257
14893
|
}
|
|
14258
|
-
const
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14894
|
+
const hits = recallMemoryVNextLocal({ query, entities, states, limit: states.length });
|
|
14895
|
+
const priority = new Set(hits.flatMap(({ state: state2 }) => [state2.id, state2.entityId]));
|
|
14896
|
+
const rankedStates = [
|
|
14897
|
+
...hits.map(({ state: state2 }) => state2),
|
|
14898
|
+
...states.filter((state2) => !priority.has(state2.id)).sort((a, b) => a.id.localeCompare(b.id))
|
|
14899
|
+
];
|
|
14900
|
+
const rankedEntities = [...entities].sort((a, b) => Number(priority.has(b.id)) - Number(priority.has(a.id)) || a.id.localeCompare(b.id));
|
|
14901
|
+
const stateRows = rankedStates.map((state2) => ({
|
|
14902
|
+
kind: "state",
|
|
14903
|
+
id: state2.id,
|
|
14904
|
+
entityId: state2.entityId,
|
|
14905
|
+
facet: state2.facet,
|
|
14906
|
+
text: state2.text,
|
|
14907
|
+
...state2.retiredAt ? { retired: true } : {}
|
|
14908
|
+
}));
|
|
14909
|
+
const entityRows = rankedEntities.map((entity) => ({
|
|
14910
|
+
kind: "entity",
|
|
14911
|
+
id: entity.id,
|
|
14912
|
+
type: entity.type,
|
|
14913
|
+
name: entity.name,
|
|
14914
|
+
...entity.subtype ? { subtype: entity.subtype } : {},
|
|
14915
|
+
...entity.aliases?.length ? { aliases: entity.aliases } : {}
|
|
14916
|
+
}));
|
|
14917
|
+
const request = buildBudgetedMemoryInput({
|
|
14918
|
+
query,
|
|
14919
|
+
maxTokens: input.maxInputTokens,
|
|
14920
|
+
rows: [
|
|
14921
|
+
...stateRows.filter((row) => priority.has(row.id)),
|
|
14922
|
+
...entityRows.filter((row) => priority.has(row.id)),
|
|
14923
|
+
...stateRows.filter((row) => !priority.has(row.id)),
|
|
14924
|
+
...entityRows.filter((row) => !priority.has(row.id))
|
|
14280
14925
|
],
|
|
14926
|
+
system: [
|
|
14927
|
+
"Select the smallest useful set of long-lived memory entrances for the user query.",
|
|
14928
|
+
'Return ONLY JSON: {"refs":["exact-id"],"reason":"short explanation"}.',
|
|
14929
|
+
`Select at most ${MAX_RECALL_REFS} exact ids from the supplied catalog.`,
|
|
14930
|
+
"Prefer current State ids; retired States are history entrances, not current facts.",
|
|
14931
|
+
"Select an Entity when it is a useful navigation anchor.",
|
|
14932
|
+
"Do not select unrelated memories merely because they are personal or interesting.",
|
|
14933
|
+
"Historical questions may select a relevant entrance; deeper evidence is handled by inspect."
|
|
14934
|
+
].join("\n")
|
|
14935
|
+
});
|
|
14936
|
+
const result = await input.provider.complete(
|
|
14937
|
+
request.messages,
|
|
14281
14938
|
input.timeoutMs ? { timeoutMs: input.timeoutMs } : void 0
|
|
14282
14939
|
);
|
|
14283
14940
|
const selected = parseSelection(result.content);
|
|
14284
14941
|
const entityById = new Map(entities.map((entity) => [entity.id, entity]));
|
|
14285
14942
|
const stateById = new Map(states.map((state2) => [state2.id, state2]));
|
|
14286
|
-
const
|
|
14943
|
+
const offered = new Set(request.rows.map((row) => row.id));
|
|
14944
|
+
const validRefs = selected.refs.filter((ref) => offered.has(ref) && (entityById.has(ref) || stateById.has(ref)));
|
|
14287
14945
|
return {
|
|
14288
14946
|
query,
|
|
14289
14947
|
refs: validRefs,
|
|
@@ -14300,6 +14958,7 @@ ${catalogText(entities, states)}`
|
|
|
14300
14958
|
candidateEntities: entities.length,
|
|
14301
14959
|
candidateStates: states.length,
|
|
14302
14960
|
selectedRefs: validRefs.length,
|
|
14961
|
+
budget: request.budget,
|
|
14303
14962
|
elapsedMs: Math.round((performance.now() - startedAt) * 10) / 10
|
|
14304
14963
|
}
|
|
14305
14964
|
};
|
|
@@ -14455,254 +15114,6 @@ var runMemoryVNextShadowRead = async (input) => {
|
|
|
14455
15114
|
};
|
|
14456
15115
|
var isMemoryVNextShadowReadEnabled = (env = typeof process !== "undefined" ? process.env : {}) => env.NOLO_MEMORY_VNEXT_SHADOW_READ === "1" || env.NOLO_MEMORY_VNEXT_SHADOW_READ === "true";
|
|
14457
15116
|
|
|
14458
|
-
// packages/ai/memory/vnext/applyMutation.ts
|
|
14459
|
-
async function validateMutation(db, ownerId, mutation) {
|
|
14460
|
-
const pending = {
|
|
14461
|
-
evidenceIds: /* @__PURE__ */ new Set(),
|
|
14462
|
-
entityIds: /* @__PURE__ */ new Set(),
|
|
14463
|
-
stateIds: /* @__PURE__ */ new Set(),
|
|
14464
|
-
relationIds: /* @__PURE__ */ new Set()
|
|
14465
|
-
};
|
|
14466
|
-
for (const ev of mutation.evidence ?? []) {
|
|
14467
|
-
if (!ev.id || typeof ev.id !== "string") {
|
|
14468
|
-
throw new Error("evidence id must be a non-empty string");
|
|
14469
|
-
}
|
|
14470
|
-
if (pending.evidenceIds.has(ev.id)) {
|
|
14471
|
-
throw new Error(`duplicate evidence id in mutation: ${ev.id}`);
|
|
14472
|
-
}
|
|
14473
|
-
pending.evidenceIds.add(ev.id);
|
|
14474
|
-
}
|
|
14475
|
-
for (const ent of mutation.entities ?? []) {
|
|
14476
|
-
if (!ent.id || typeof ent.id !== "string") {
|
|
14477
|
-
throw new Error("entity id must be a non-empty string");
|
|
14478
|
-
}
|
|
14479
|
-
if (pending.entityIds.has(ent.id)) {
|
|
14480
|
-
throw new Error(`duplicate entity id in mutation: ${ent.id}`);
|
|
14481
|
-
}
|
|
14482
|
-
pending.entityIds.add(ent.id);
|
|
14483
|
-
}
|
|
14484
|
-
for (const st of mutation.states ?? []) {
|
|
14485
|
-
if (!st.id || typeof st.id !== "string") {
|
|
14486
|
-
throw new Error("state id must be a non-empty string");
|
|
14487
|
-
}
|
|
14488
|
-
if (pending.stateIds.has(st.id)) {
|
|
14489
|
-
throw new Error(`duplicate state id in mutation: ${st.id}`);
|
|
14490
|
-
}
|
|
14491
|
-
pending.stateIds.add(st.id);
|
|
14492
|
-
}
|
|
14493
|
-
for (const rel of mutation.relations ?? []) {
|
|
14494
|
-
if (!rel.id || typeof rel.id !== "string") {
|
|
14495
|
-
throw new Error("relation id must be a non-empty string");
|
|
14496
|
-
}
|
|
14497
|
-
if (pending.relationIds.has(rel.id)) {
|
|
14498
|
-
throw new Error(`duplicate relation id in mutation: ${rel.id}`);
|
|
14499
|
-
}
|
|
14500
|
-
pending.relationIds.add(rel.id);
|
|
14501
|
-
}
|
|
14502
|
-
const supersededIds = /* @__PURE__ */ new Set();
|
|
14503
|
-
for (const sid of mutation.supersededStateIds ?? []) {
|
|
14504
|
-
if (supersededIds.has(sid)) {
|
|
14505
|
-
throw new Error(`duplicate supersededStateId in mutation: ${sid}`);
|
|
14506
|
-
}
|
|
14507
|
-
supersededIds.add(sid);
|
|
14508
|
-
}
|
|
14509
|
-
for (const ev of mutation.evidence ?? []) {
|
|
14510
|
-
if (ev.ownerId !== ownerId) {
|
|
14511
|
-
throw new Error(
|
|
14512
|
-
`evidence ${ev.id} has ownerId ${ev.ownerId}, expected ${ownerId}`
|
|
14513
|
-
);
|
|
14514
|
-
}
|
|
14515
|
-
}
|
|
14516
|
-
for (const ent of mutation.entities ?? []) {
|
|
14517
|
-
if (ent.ownerId !== ownerId) {
|
|
14518
|
-
throw new Error(
|
|
14519
|
-
`entity ${ent.id} has ownerId ${ent.ownerId}, expected ${ownerId}`
|
|
14520
|
-
);
|
|
14521
|
-
}
|
|
14522
|
-
}
|
|
14523
|
-
for (const st of mutation.states ?? []) {
|
|
14524
|
-
if (st.ownerId !== ownerId) {
|
|
14525
|
-
throw new Error(
|
|
14526
|
-
`state ${st.id} has ownerId ${st.ownerId}, expected ${ownerId}`
|
|
14527
|
-
);
|
|
14528
|
-
}
|
|
14529
|
-
}
|
|
14530
|
-
for (const rel of mutation.relations ?? []) {
|
|
14531
|
-
if (rel.ownerId !== ownerId) {
|
|
14532
|
-
throw new Error(
|
|
14533
|
-
`relation ${rel.id} has ownerId ${rel.ownerId}, expected ${ownerId}`
|
|
14534
|
-
);
|
|
14535
|
-
}
|
|
14536
|
-
}
|
|
14537
|
-
for (const st of mutation.states ?? []) {
|
|
14538
|
-
if (supersededIds.has(st.id)) {
|
|
14539
|
-
throw new Error(
|
|
14540
|
-
`state ${st.id} appears in both states and supersededStateIds; a record cannot be created and retired in the same mutation`
|
|
14541
|
-
);
|
|
14542
|
-
}
|
|
14543
|
-
}
|
|
14544
|
-
const facetSlots = /* @__PURE__ */ new Set();
|
|
14545
|
-
for (const st of mutation.states ?? []) {
|
|
14546
|
-
const slot = `${st.entityId} ${st.facet}`;
|
|
14547
|
-
if (facetSlots.has(slot)) {
|
|
14548
|
-
throw new Error(
|
|
14549
|
-
`mutation writes parallel current states for entity ${st.entityId} facet ${st.facet}`
|
|
14550
|
-
);
|
|
14551
|
-
}
|
|
14552
|
-
facetSlots.add(slot);
|
|
14553
|
-
}
|
|
14554
|
-
for (const ev of mutation.evidence ?? []) {
|
|
14555
|
-
const existing = await getMemoryEvidenceVNext(db, ownerId, ev.id);
|
|
14556
|
-
if (existing) {
|
|
14557
|
-
throw new Error(
|
|
14558
|
-
`evidence ${ev.id} already exists (owner ${ownerId}); use a unique id`
|
|
14559
|
-
);
|
|
14560
|
-
}
|
|
14561
|
-
}
|
|
14562
|
-
for (const ent of mutation.entities ?? []) {
|
|
14563
|
-
const existing = await getMemoryEntityVNext(db, ownerId, ent.id);
|
|
14564
|
-
if (existing) {
|
|
14565
|
-
throw new Error(
|
|
14566
|
-
`entity ${ent.id} already exists (owner ${ownerId}); use a unique id`
|
|
14567
|
-
);
|
|
14568
|
-
}
|
|
14569
|
-
}
|
|
14570
|
-
for (const st of mutation.states ?? []) {
|
|
14571
|
-
if (!pending.entityIds.has(st.entityId)) {
|
|
14572
|
-
const entity = await getMemoryEntityVNext(db, ownerId, st.entityId);
|
|
14573
|
-
if (!entity) {
|
|
14574
|
-
throw new Error(
|
|
14575
|
-
`memory state ${st.id} references missing entity ${st.entityId} (owner ${ownerId})`
|
|
14576
|
-
);
|
|
14577
|
-
}
|
|
14578
|
-
}
|
|
14579
|
-
for (const evidenceId of st.evidenceIds) {
|
|
14580
|
-
if (!pending.evidenceIds.has(evidenceId)) {
|
|
14581
|
-
const ev = await getMemoryEvidenceVNext(db, ownerId, evidenceId);
|
|
14582
|
-
if (!ev) {
|
|
14583
|
-
throw new Error(
|
|
14584
|
-
`memory state ${st.id} references missing evidence ${evidenceId} (owner ${ownerId})`
|
|
14585
|
-
);
|
|
14586
|
-
}
|
|
14587
|
-
}
|
|
14588
|
-
}
|
|
14589
|
-
const existing = await getMemoryStateVNext(db, ownerId, st.id);
|
|
14590
|
-
if (existing) {
|
|
14591
|
-
if (existing.retiredAt) {
|
|
14592
|
-
throw new Error(
|
|
14593
|
-
`cannot update retired memory state ${st.id} (owner ${ownerId})`
|
|
14594
|
-
);
|
|
14595
|
-
}
|
|
14596
|
-
if (existing.entityId !== st.entityId || existing.facet !== st.facet) {
|
|
14597
|
-
throw new Error(
|
|
14598
|
-
`state ${st.id} already exists with different entity/facet (${existing.entityId}/${existing.facet} vs ${st.entityId}/${st.facet}); use supersede instead`
|
|
14599
|
-
);
|
|
14600
|
-
}
|
|
14601
|
-
}
|
|
14602
|
-
if (!existing) {
|
|
14603
|
-
const existingStates = await listMemoryStatesForEntityVNext(db, ownerId, st.entityId);
|
|
14604
|
-
for (const es of existingStates) {
|
|
14605
|
-
if (es.facet === st.facet && !es.retiredAt) {
|
|
14606
|
-
if (!supersededIds.has(es.id)) {
|
|
14607
|
-
throw new Error(
|
|
14608
|
-
`entity ${st.entityId} facet ${st.facet} already has current state ${es.id}; supersede it or use a different facet`
|
|
14609
|
-
);
|
|
14610
|
-
}
|
|
14611
|
-
}
|
|
14612
|
-
}
|
|
14613
|
-
}
|
|
14614
|
-
}
|
|
14615
|
-
for (const sid of mutation.supersededStateIds ?? []) {
|
|
14616
|
-
const existing = await getMemoryStateVNext(db, ownerId, sid);
|
|
14617
|
-
if (!existing) {
|
|
14618
|
-
throw new Error(
|
|
14619
|
-
`cannot supersede missing memory state: ${sid} (owner ${ownerId})`
|
|
14620
|
-
);
|
|
14621
|
-
}
|
|
14622
|
-
if (existing.retiredAt) {
|
|
14623
|
-
throw new Error(
|
|
14624
|
-
`cannot supersede already retired memory state: ${sid} (owner ${ownerId})`
|
|
14625
|
-
);
|
|
14626
|
-
}
|
|
14627
|
-
const replacement = (mutation.states ?? []).find(
|
|
14628
|
-
(st) => st.entityId === existing.entityId && st.facet === existing.facet
|
|
14629
|
-
);
|
|
14630
|
-
if (!replacement) {
|
|
14631
|
-
throw new Error(
|
|
14632
|
-
`superseded state ${sid} (entity ${existing.entityId} facet ${existing.facet}) has no replacement in this mutation`
|
|
14633
|
-
);
|
|
14634
|
-
}
|
|
14635
|
-
}
|
|
14636
|
-
for (const rel of mutation.relations ?? []) {
|
|
14637
|
-
for (const [side, ref] of [
|
|
14638
|
-
["from", rel.from],
|
|
14639
|
-
["to", rel.to]
|
|
14640
|
-
]) {
|
|
14641
|
-
if (pending.entityIds.has(ref) || pending.stateIds.has(ref) || pending.evidenceIds.has(ref)) {
|
|
14642
|
-
continue;
|
|
14643
|
-
}
|
|
14644
|
-
const resolved = await getMemoryEntityVNext(db, ownerId, ref) ?? await getMemoryStateVNext(db, ownerId, ref) ?? await getMemoryEvidenceVNext(db, ownerId, ref);
|
|
14645
|
-
if (!resolved) {
|
|
14646
|
-
throw new Error(
|
|
14647
|
-
`memory relation ${rel.id} references missing ${side} ${ref} (owner ${ownerId})`
|
|
14648
|
-
);
|
|
14649
|
-
}
|
|
14650
|
-
}
|
|
14651
|
-
}
|
|
14652
|
-
}
|
|
14653
|
-
var applyMutationWithoutCoordination = async (db, ownerId, mutation) => {
|
|
14654
|
-
await validateMutation(db, ownerId, mutation);
|
|
14655
|
-
const batch = db.batch();
|
|
14656
|
-
for (const ev of mutation.evidence ?? []) {
|
|
14657
|
-
_appendEvidenceBatch(batch, ev);
|
|
14658
|
-
}
|
|
14659
|
-
for (const ent of mutation.entities ?? []) {
|
|
14660
|
-
_appendEntityBatch(batch, ent);
|
|
14661
|
-
}
|
|
14662
|
-
for (const st of mutation.states ?? []) {
|
|
14663
|
-
_appendStateBatch(batch, st);
|
|
14664
|
-
}
|
|
14665
|
-
for (const sid of mutation.supersededStateIds ?? []) {
|
|
14666
|
-
const existing = await getMemoryStateVNext(db, ownerId, sid);
|
|
14667
|
-
if (!existing) {
|
|
14668
|
-
throw new Error(
|
|
14669
|
-
`cannot supersede missing memory state: ${sid} (owner ${ownerId})`
|
|
14670
|
-
);
|
|
14671
|
-
}
|
|
14672
|
-
const replacement = (mutation.states ?? []).find(
|
|
14673
|
-
(st) => st.entityId === existing.entityId && st.facet === existing.facet
|
|
14674
|
-
);
|
|
14675
|
-
const retired = {
|
|
14676
|
-
...existing,
|
|
14677
|
-
retiredAt: replacement?.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
14678
|
-
};
|
|
14679
|
-
_appendRetiredStateBatch(batch, retired);
|
|
14680
|
-
}
|
|
14681
|
-
for (const rel of mutation.relations ?? []) {
|
|
14682
|
-
_appendRelationBatch(batch, rel);
|
|
14683
|
-
}
|
|
14684
|
-
await batch.write();
|
|
14685
|
-
};
|
|
14686
|
-
var pendingByDb = /* @__PURE__ */ new WeakMap();
|
|
14687
|
-
var applyMemoryInterpreterMutation = async (db, ownerId, mutation) => {
|
|
14688
|
-
let owners = pendingByDb.get(db);
|
|
14689
|
-
if (!owners) {
|
|
14690
|
-
owners = /* @__PURE__ */ new Map();
|
|
14691
|
-
pendingByDb.set(db, owners);
|
|
14692
|
-
}
|
|
14693
|
-
const previous = owners.get(ownerId) ?? Promise.resolve();
|
|
14694
|
-
const operation = previous.then(() => applyMutationWithoutCoordination(db, ownerId, mutation));
|
|
14695
|
-
const settled = operation.then(() => {
|
|
14696
|
-
}, () => {
|
|
14697
|
-
});
|
|
14698
|
-
owners.set(ownerId, settled);
|
|
14699
|
-
try {
|
|
14700
|
-
await operation;
|
|
14701
|
-
} finally {
|
|
14702
|
-
if (owners.get(ownerId) === settled) owners.delete(ownerId);
|
|
14703
|
-
}
|
|
14704
|
-
};
|
|
14705
|
-
|
|
14706
15117
|
// packages/ai/memory/vnext/legacyMigrationApply.ts
|
|
14707
15118
|
var isSameLegacyMemoryEvidence = (left, right) => left.id === right.id && left.ownerId === right.ownerId && left.text === right.text && left.sourceRef === right.sourceRef && left.confidence === right.confidence && left.createdAt === right.createdAt;
|
|
14708
15119
|
var applyLegacyMemoryEvidence = async (db, item) => {
|
|
@@ -15389,6 +15800,10 @@ var resolveMemoryVNextM4Selection = async (input) => {
|
|
|
15389
15800
|
const renderItems = [...recalledStates, ...uncoveredLegacy];
|
|
15390
15801
|
return {
|
|
15391
15802
|
renderItems,
|
|
15803
|
+
sources: new Map([
|
|
15804
|
+
...recalledStates.map((item) => [item, "vnext"]),
|
|
15805
|
+
...uncoveredLegacy.map((item) => [item, "legacy-uncovered"])
|
|
15806
|
+
]),
|
|
15392
15807
|
recalledStateCount: recalledStates.length,
|
|
15393
15808
|
uncoveredLegacyCount: uncoveredLegacy.length,
|
|
15394
15809
|
coveredSuppressedCount
|
|
@@ -15516,6 +15931,10 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
15516
15931
|
let outcome = "error";
|
|
15517
15932
|
let errorKind = "runtime_error";
|
|
15518
15933
|
let fallbackKind = "none";
|
|
15934
|
+
let injection = emptyMemoryInjectionObservation();
|
|
15935
|
+
const injectionEmit = (observation) => {
|
|
15936
|
+
injection = observation;
|
|
15937
|
+
};
|
|
15519
15938
|
const finish = (result) => {
|
|
15520
15939
|
outcome = fallbackKind === "none" ? result.promptBlock ? "result" : "empty" : "fallback";
|
|
15521
15940
|
errorKind = fallbackKind;
|
|
@@ -15539,7 +15958,8 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
15539
15958
|
db: input.db,
|
|
15540
15959
|
owners,
|
|
15541
15960
|
userInput: input.userInput,
|
|
15542
|
-
maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET
|
|
15961
|
+
maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET,
|
|
15962
|
+
injectionEmit
|
|
15543
15963
|
});
|
|
15544
15964
|
} catch (error) {
|
|
15545
15965
|
pureFailed = true;
|
|
@@ -15668,8 +16088,8 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
15668
16088
|
);
|
|
15669
16089
|
const selected = [...residentItems, ...ranked];
|
|
15670
16090
|
const legacyLatencyMs = Math.round((performance.now() - legacyStartedAt) * 10) / 10;
|
|
15671
|
-
const renderOverlay = (items) =>
|
|
15672
|
-
let promptBlock = renderOverlay(selected);
|
|
16091
|
+
const renderOverlay = (items, sources) => buildMemoryOverlay(items, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET, sources, injectionEmit });
|
|
16092
|
+
let promptBlock = configuredPrimary ? null : renderOverlay(selected);
|
|
15673
16093
|
const primaryRead = configuredPrimary;
|
|
15674
16094
|
let allCoveredByVNext = false;
|
|
15675
16095
|
if (primaryRead) {
|
|
@@ -15698,7 +16118,7 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
15698
16118
|
);
|
|
15699
16119
|
})
|
|
15700
16120
|
]).finally(() => clearTimeout(timer));
|
|
15701
|
-
promptBlock = renderOverlay(m4.renderItems);
|
|
16121
|
+
promptBlock = renderOverlay(m4.renderItems, m4.sources);
|
|
15702
16122
|
allCoveredByVNext = m4.uncoveredLegacyCount === 0 && m4.recalledStateCount > 0;
|
|
15703
16123
|
const source = m4.recalledStateCount > 0 ? m4.uncoveredLegacyCount === 0 ? "vnext" : "hybrid" : m4.uncoveredLegacyCount > 0 ? "legacy_fallback" : "none";
|
|
15704
16124
|
emitPrimary({
|
|
@@ -15712,6 +16132,7 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
15712
16132
|
...source === "legacy_fallback" ? { fallbackReason: "no_vnext_context" } : {}
|
|
15713
16133
|
});
|
|
15714
16134
|
} catch (error) {
|
|
16135
|
+
promptBlock = renderOverlay(selected);
|
|
15715
16136
|
fallbackKind = error === timeoutMarker ? "timeout" : "runtime_error";
|
|
15716
16137
|
emitPrimary({
|
|
15717
16138
|
...base,
|
|
@@ -15767,6 +16188,7 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
15767
16188
|
return finish({ selectedItems: selected, promptBlock });
|
|
15768
16189
|
} finally {
|
|
15769
16190
|
const observation = {
|
|
16191
|
+
...injection,
|
|
15770
16192
|
event: "memory_runtime_result",
|
|
15771
16193
|
configuredPure,
|
|
15772
16194
|
configuredPrimary,
|
|
@@ -15967,6 +16389,35 @@ async function resolveAgentBoundMachineIdFromRecord(args) {
|
|
|
15967
16389
|
return resolveBoundMachineId(record) || void 0;
|
|
15968
16390
|
}
|
|
15969
16391
|
async function runAgentRunCommand(args, deps) {
|
|
16392
|
+
const env = deps.env ?? process.env;
|
|
16393
|
+
const runId = env.NOLO_AGENT_RUN_ID;
|
|
16394
|
+
const controlDeps = { env, homedir: deps.homedir, fs: deps.fs, now: deps.now };
|
|
16395
|
+
const failStartup = async (error) => {
|
|
16396
|
+
if (!runId || readRunRecord(runId, controlDeps)?.status !== "running") return;
|
|
16397
|
+
const result = await settleRunTerminalAuthoritatively(runId, {
|
|
16398
|
+
status: "failed",
|
|
16399
|
+
exitCode: 1,
|
|
16400
|
+
failureReason: error instanceof RuntimeProtocolMismatchError ? "runtime_protocol_mismatch" : error instanceof RuntimeVersionMismatchError ? "runtime_version_mismatch" : "startup_failed",
|
|
16401
|
+
note: error ? toErrorMessage(error) : "Child initialization returned without terminal result"
|
|
16402
|
+
}, controlDeps, (id, update, d) => transitionRunToTerminal(id, update, d));
|
|
16403
|
+
if (result.kind === "contended") throw new Error(`Startup settlement lock busy: ${runId}`);
|
|
16404
|
+
};
|
|
16405
|
+
try {
|
|
16406
|
+
if (runId) {
|
|
16407
|
+
if (!readRunRecord(runId, controlDeps)) throw new Error("[local-writer-resource] missing child binding");
|
|
16408
|
+
await recordRunStartup(runId, "initializing", controlDeps);
|
|
16409
|
+
validateAgentRunProtocol(env.NOLO_AGENT_RUN_PROTOCOL);
|
|
16410
|
+
await recordRunStartup(runId, "protocol_validated", controlDeps);
|
|
16411
|
+
}
|
|
16412
|
+
const code = await runAgentRunCommandImpl(args, deps);
|
|
16413
|
+
if (runId) await failStartup();
|
|
16414
|
+
return code;
|
|
16415
|
+
} catch (error) {
|
|
16416
|
+
await failStartup(error);
|
|
16417
|
+
throw error;
|
|
16418
|
+
}
|
|
16419
|
+
}
|
|
16420
|
+
async function runAgentRunCommandImpl(args, deps) {
|
|
15970
16421
|
const env = deps.env ?? process.env;
|
|
15971
16422
|
const output = deps.output ?? {
|
|
15972
16423
|
write: (chunk) => process.stdout.write(chunk),
|
|
@@ -15989,10 +16440,17 @@ async function runAgentRunCommand(args, deps) {
|
|
|
15989
16440
|
return 1;
|
|
15990
16441
|
}
|
|
15991
16442
|
const rawRunner = deps.runner ?? runAgentTurn;
|
|
16443
|
+
let modelPhaseRecorded = false;
|
|
15992
16444
|
const watchdogAbort = new AbortController();
|
|
15993
16445
|
let activeRunner;
|
|
15994
16446
|
const runner = (options) => {
|
|
15995
|
-
activeRunner = Promise.resolve().then(
|
|
16447
|
+
activeRunner = Promise.resolve().then(async () => {
|
|
16448
|
+
if (env.NOLO_AGENT_RUN_ID && !modelPhaseRecorded) {
|
|
16449
|
+
await recordRunStartup(env.NOLO_AGENT_RUN_ID, "model", { env, homedir: deps.homedir, fs: deps.fs, now: deps.now });
|
|
16450
|
+
modelPhaseRecorded = true;
|
|
16451
|
+
}
|
|
16452
|
+
return rawRunner({ ...options, abortSignal: watchdogAbort.signal });
|
|
16453
|
+
}).then((result) => {
|
|
15996
16454
|
watchdogAbort.signal.throwIfAborted();
|
|
15997
16455
|
return result;
|
|
15998
16456
|
});
|
|
@@ -16425,6 +16883,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
16425
16883
|
);
|
|
16426
16884
|
const shellApprovalChild = process.connected && typeof process.send === "function" ? createShellApprovalChild(process) : void 0;
|
|
16427
16885
|
try {
|
|
16886
|
+
const imageUrls = await normalizeCliRunImages(parsed.imageUrls, normalizeCliImageInput);
|
|
16428
16887
|
const buildRunOptions = (targetAgentKey, turnMessage = effectiveMessage) => ({
|
|
16429
16888
|
...shellApprovalChild ? { execShellApproval: targetAgentKey === agentKey ? shellApprovalChild.authority : {
|
|
16430
16889
|
request: async () => {
|
|
@@ -16444,7 +16903,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
16444
16903
|
responseViewport: "unknown",
|
|
16445
16904
|
serverUrl: resolveServerUrl(env),
|
|
16446
16905
|
message: formatTurnMessage(turnMessage),
|
|
16447
|
-
imageUrls
|
|
16906
|
+
imageUrls,
|
|
16448
16907
|
scriptDir: deps.scriptDir,
|
|
16449
16908
|
env: runEnv,
|
|
16450
16909
|
output,
|
|
@@ -16674,7 +17133,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
16674
17133
|
acceptance.checks.observations = dodResults.map((check, index) => ({
|
|
16675
17134
|
// Command lines/output can contain credentials. Persist only a digest
|
|
16676
17135
|
// here; the pre-existing registry is the execution evidence reference.
|
|
16677
|
-
commandFingerprint: `sha256:${
|
|
17136
|
+
commandFingerprint: `sha256:${createHash3("sha256").update(check.command).digest("hex")}`,
|
|
16678
17137
|
cwd: childRecordForDoD?.cwd || process.cwd(),
|
|
16679
17138
|
exitCode: check.exitCode,
|
|
16680
17139
|
evidence: `${childRunId}.json#/dodResults/${index}`,
|
|
@@ -16744,6 +17203,16 @@ async function runAgentRunCommand(args, deps) {
|
|
|
16744
17203
|
}
|
|
16745
17204
|
|
|
16746
17205
|
export {
|
|
17206
|
+
resolveAgentModelIdentity,
|
|
17207
|
+
resolveAgentContextWindow2 as resolveAgentContextWindow,
|
|
17208
|
+
platformCreditsFromUsage,
|
|
17209
|
+
formatCreditsChip,
|
|
17210
|
+
resolveAuthorityTurnCount,
|
|
17211
|
+
computeBaselineContextTokens,
|
|
17212
|
+
preserveContextUsageWithoutReceipt,
|
|
17213
|
+
resolveContextUsage,
|
|
17214
|
+
renderTokenStatus,
|
|
17215
|
+
redactSecrets,
|
|
16747
17216
|
resolveCliColorEnabled,
|
|
16748
17217
|
dimCliText,
|
|
16749
17218
|
THEME_PALETTES,
|
|
@@ -16769,21 +17238,10 @@ export {
|
|
|
16769
17238
|
formatAssistantDisplay,
|
|
16770
17239
|
resolveHistoryLayoutGeometry,
|
|
16771
17240
|
resolveHistoryViewportHeight,
|
|
16772
|
-
redactSecrets,
|
|
16773
17241
|
safeAskText,
|
|
16774
17242
|
safeApprovalMultilineText,
|
|
16775
17243
|
TUI_TREE_MARKER,
|
|
16776
17244
|
TUI_TREE_TOOLS,
|
|
16777
|
-
resolveAgentModelIdentity,
|
|
16778
|
-
resolveAgentContextWindow2 as resolveAgentContextWindow,
|
|
16779
|
-
platformCreditsFromUsage,
|
|
16780
|
-
formatCreditsChip,
|
|
16781
|
-
formatTokenCount,
|
|
16782
|
-
resolveAuthorityTurnCount,
|
|
16783
|
-
computeBaselineContextTokens,
|
|
16784
|
-
preserveContextUsageWithoutReceipt,
|
|
16785
|
-
resolveContextUsage,
|
|
16786
|
-
renderTokenStatus,
|
|
16787
17245
|
createIdleHeapReleaser,
|
|
16788
17246
|
COLLAPSED_PASTE_PLACEHOLDER_RE,
|
|
16789
17247
|
shouldCollapsePaste,
|