nolo-cli 0.227.0-alpha.1 → 0.228.0-alpha.2
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-VYCHHZVT.js} +78 -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-QWQKT54A.js} +116 -115
- package/{agentEmailCommands-UCVOWD3S.js → agentEmailCommands-EISMBIRE.js} +119 -118
- package/{agentFavoriteCommands-4PDOP3GW.js → agentFavoriteCommands-7LOP3HUD.js} +6 -6
- package/{agentGrantCommands-FLCEXLUH.js → agentGrantCommands-L6O2HVJI.js} +7 -7
- package/{agentListCommands-C65UESYM.js → agentListCommands-4WLG32IW.js} +79 -470
- package/{agentMachineCommands-V3DGEJU4.js → agentMachineCommands-DC6NKWTU.js} +59 -57
- package/{agentProviderCommands-7QBFRFRK.js → agentProviderCommands-STI3DQ6A.js} +7 -7
- package/{agentPullCommand-E6JBGBVG.js → agentPullCommand-KHV4EELF.js} +6 -6
- package/{agentRecordCommands-6RCJS2EY.js → agentRecordCommands-IZYUVHME.js} +107 -106
- package/{agentRunCommand-P3GRKXKS.js → agentRunCommand-QM7ETUTX.js} +113 -112
- package/{agentRunControl-SNZZ5XP4.js → agentRunControl-MBG4U6SL.js} +23 -17
- package/{agentRuntimeLocal-GOX2DIY7.js → agentRuntimeLocal-HOXKWCYO.js} +46 -45
- package/{agentSlice-N7H2FRJA.js → agentSlice-UG76KEBH.js} +17 -17
- package/{appDeleteCommands-LZDN26FU.js → appDeleteCommands-WWCC6WA5.js} +54 -52
- package/{appDeployCommands-6IO6TTZH.js → appDeployCommands-AU4IUN33.js} +54 -52
- package/{appDeployStatusCommands-FG3LX24J.js → appDeployStatusCommands-STUW7WXL.js} +54 -52
- package/{appGetCommands-NAKVDVD4.js → appGetCommands-BGTLIQ4K.js} +54 -52
- package/{appListCommands-KL56RN73.js → appListCommands-CUCPRUXW.js} +54 -52
- package/{authCommand-AUN5MXV2.js → authCommand-OZ2KTP4Z.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-UN7HIYMH.js → chunk-2X7WFDT6.js} +1 -1
- package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
- package/{chunk-CVERLOJM.js → chunk-3QIYD3VM.js} +639 -513
- package/{chunk-RU6DULV4.js → chunk-3U44JB3O.js} +1 -1
- package/{chunk-IAJJYHIB.js → chunk-3VZLEKV2.js} +7 -7
- package/{chunk-JWXITTQB.js → chunk-42OKN2LI.js} +1 -1
- package/{chunk-UAPNPNSG.js → chunk-45CAVC35.js} +1072 -859
- package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
- package/{chunk-SW6OD4KE.js → chunk-4QYJPWHH.js} +123 -12
- package/{chunk-PLPLH2XZ.js → chunk-4ZGPHFLE.js} +2 -2
- package/{chunk-NO3VBWTL.js → chunk-547ENH5T.js} +1 -1
- package/{chunk-CKT6QUE2.js → chunk-5YMA6DDZ.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-PVAWNHP5.js → chunk-7BCG67EI.js} +295 -102
- package/{chunk-VZW34YUL.js → chunk-7FEP5USX.js} +8 -5
- package/{chunk-VPAZ6BEN.js → chunk-7JGMNKKG.js} +18 -14
- package/{chunk-5HL4KC4A.js → chunk-ALAES342.js} +57 -86
- package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
- package/chunk-BIDSIRTS.js +307 -0
- package/chunk-BIWI5M4E.js +62 -0
- 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-VIHDJ3FK.js → chunk-CNMY2XM6.js} +14 -14
- package/{chunk-UVUVQVZ6.js → chunk-DBUR22G5.js} +2 -2
- package/{chunk-G6HJUMST.js → chunk-DEA37IUY.js} +2 -2
- package/{chunk-5RKRXQ2H.js → chunk-DGYCDA6W.js} +2 -2
- package/{chunk-FKEZOMIF.js → chunk-DLXMMTGM.js} +523 -202
- 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-ZI5SZ3MV.js → chunk-EGHP7KOY.js} +20 -20
- package/{chunk-OXA5GWHU.js → chunk-F6Z6ZCUV.js} +2 -2
- package/{chunk-X2KRQP7V.js → chunk-FJSNBZXR.js} +1 -1
- package/{chunk-3VFYQH3I.js → chunk-FPBJM2BW.js} +17 -39
- package/{chunk-KRRE4A7D.js → chunk-G7IUT2V3.js} +3 -2
- package/{chunk-LXTC53TN.js → chunk-GAYNXB6T.js} +184 -153
- package/{chunk-45LZIYXB.js → chunk-HBRDSQ3M.js} +1 -1
- package/{chunk-GRXSJR2Z.js → chunk-HF7BLF3F.js} +21 -21
- package/{chunk-T5N6NHAT.js → chunk-HHFGE2WF.js} +3 -3
- package/{chunk-IX2BXN2K.js → chunk-HSSBDZLD.js} +3 -3
- package/{chunk-TINJKQSO.js → chunk-HXB4VDGK.js} +20 -20
- package/{chunk-MWHOH4RJ.js → chunk-HYLRQDEE.js} +4 -4
- package/{chunk-L5I543VB.js → chunk-JQZRSXS5.js} +23 -23
- package/{chunk-T2BEPTAG.js → chunk-L32W3PRP.js} +47 -17
- package/{chunk-LA7JYAKF.js → chunk-LYD6C7OU.js} +3 -3
- package/{chunk-PHOSZT3E.js → chunk-M3OZRQNH.js} +1 -1
- package/{chunk-M3Y4IBIR.js → chunk-M4SFKP5L.js} +4 -4
- package/{chunk-7Z3WUZ4Q.js → chunk-MJI3UAXN.js} +52 -28
- package/{chunk-YOT437BH.js → chunk-MNEZUL5S.js} +137 -118
- package/{chunk-GOLPOTG5.js → chunk-MZG5CETE.js} +3 -3
- package/{chunk-KJAAPGBE.js → chunk-OBIC6EG7.js} +6 -6
- package/{chunk-CLCXHIBS.js → chunk-OJ45MEEI.js} +1 -1
- package/{chunk-AXYH4734.js → chunk-OOJNQK6V.js} +13 -13
- package/{chunk-2SKTCNWO.js → chunk-OTKSESZR.js} +2 -2
- package/{chunk-XIEYGCN6.js → chunk-OWKNSIXL.js} +149 -48
- package/{chunk-6XIE5ZGI.js → chunk-PDCV7P5W.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-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-F5AY2UZL.js → chunk-RRDRQOEC.js} +515 -9
- package/{chunk-6EDAMVG6.js → chunk-RTHFJZ6M.js} +10 -10
- package/{chunk-WJP4TH6U.js → chunk-S6FDXXZV.js} +1 -1
- package/{chunk-LJSNEV7M.js → chunk-SRCCSTIM.js} +7 -7
- package/{chunk-KMRKZNGT.js → chunk-TCZ2VJZQ.js} +13 -12
- package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
- package/{chunk-5LQDHFBN.js → chunk-TQEKUOTI.js} +14 -11
- package/{chunk-SRG5CNLC.js → chunk-TSPMLCWI.js} +6 -6
- package/{chunk-YGILMZ7N.js → chunk-TUSTONB3.js} +1 -1
- package/{chunk-YPPKC6FL.js → chunk-U2HBB7RS.js} +17 -17
- package/{chunk-HVUDBOQG.js → chunk-VMJVAJ6W.js} +9 -6
- package/{chunk-CQVGR3MX.js → chunk-VQ5N5GSV.js} +8 -8
- package/{chunk-ABGULE7H.js → chunk-WCFFRBL5.js} +12 -12
- package/{chunk-NAOO4PVX.js → chunk-WFDNADFX.js} +16 -16
- package/chunk-WFGNWWJI.js +326 -0
- package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
- package/{chunk-JHF6VLVL.js → chunk-X3E6EHJW.js} +32 -31
- package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
- package/{chunk-C2B7M567.js → chunk-XAG3FWBE.js} +15 -4
- package/{chunk-4OKTPFNX.js → chunk-XFXFPUO7.js} +105 -37
- package/{chunk-HYKGIXNO.js → chunk-XSW4EXQV.js} +85 -21
- package/{chunk-ZADGPNTV.js → chunk-XTJKU3Z4.js} +29 -29
- package/{chunk-T43K75CK.js → chunk-YKY4OVOX.js} +15 -15
- package/{chunk-ZYA2YDB6.js → chunk-YVFH2MFB.js} +16 -16
- package/{chunk-L42CBKBZ.js → chunk-ZEVQHCLM.js} +3 -3
- 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-H3HYQRRR.js} +48 -47
- package/{commandRegistry-TKR6OWXP.js → commandRegistry-FVYPE2IN.js} +93 -93
- package/{contentThunks-BQWRPCTM.js → contentThunks-GNFPG32S.js} +36 -35
- package/{cooldownCommands-FZYQOWI5.js → cooldownCommands-YB5H5BBK.js} +3 -3
- package/{createAgentAutomationAction-GFI6SJZV.js → createAgentAutomationAction-PB4QIFQ4.js} +36 -35
- package/{createDialogAction-MMBIHFFU.js → createDialogAction-EVTOPY7A.js} +37 -37
- package/{createPageAction-EEYUE5FB.js → createPageAction-2UYF2IDZ.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-6SZD4TYP.js} +58 -57
- package/{dialogNotifyCommand-VWS5G4OO.js → dialogNotifyCommand-SHGPCU22.js} +17 -17
- package/{dialogSlice-KGYIABDY.js → dialogSlice-5EQ2A6LY.js} +34 -33
- package/{dialogUsageCommand-FEWCN7IA.js → dialogUsageCommand-W2WCSGKF.js} +6 -6
- package/{docCreateCommands-LS32VKY3.js → docCreateCommands-25E6PGN3.js} +53 -51
- package/{docDeleteCommands-JTYR5RPH.js → docDeleteCommands-F7ZVGEHW.js} +55 -53
- package/{docReadCommands-E5LTVKWN.js → docReadCommands-JY2E5XEN.js} +53 -51
- package/{docStore-TVS2FNER.js → docStore-OKKIKLT3.js} +15 -15
- package/{docUpdateCommands-I3J3JDZ2.js → docUpdateCommands-OZ4CUSIQ.js} +53 -51
- package/{fetchMessages-Q3INLN5F.js → fetchMessages-TQEUZD7H.js} +3 -3
- package/{getPricing-VNGFM4PN.js → getPricing-LF5C4XSI.js} +6 -6
- package/{handleSendMessageAction-SSON36TJ.js → handleSendMessageAction-LNT7SZND.js} +68 -67
- package/{hostCredentialCreate-WTW4THJF.js → hostCredentialCreate-XUU2CSHI.js} +107 -106
- 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-IBSTMSX7.js} +114 -113
- package/{machineCommands-3LROJZDK.js → machineCommands-HSQHDHOT.js} +135 -119
- package/{machineWsRunDispatch-BUUJRUUB.js → machineWsRunDispatch-L6H7J66T.js} +105 -104
- 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-FQO654Z3.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-7U272DSA.js} +4398 -4165
- package/{removeDialogAgentAction-JQOJSUM7.js → removeDialogAgentAction-F5QE2O2B.js} +19 -19
- package/{runAgentClientLoop-4FCFLMDJ.js → runAgentClientLoop-AF4JQIJ7.js} +72 -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-BHHPCUHZ.js} +3 -3
- package/{spaceCommands-DB5DKC2J.js → spaceCommands-5VNWMDBE.js} +55 -53
- package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
- package/{streamAgentChatTurn-FCBGMD4D.js → streamAgentChatTurn-YSPEFY4K.js} +97 -95
- package/{switchDialogAgentAction-LAHLUECU.js → switchDialogAgentAction-IIJBPND3.js} +16 -16
- package/{tableCommands-VNSXHAMG.js → tableCommands-FTAOCBTX.js} +12 -12
- package/{tools-6JD36D6K.js → tools-M35PTIFB.js} +61 -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-IMIRJRQQ.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-2WZXXAQD.js +0 -57
- 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,11 +2,7 @@ import {
|
|
|
2
2
|
DEVIN_CONNECT_URL,
|
|
3
3
|
parseSseDataLineJson,
|
|
4
4
|
parseSseDataLineObject
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
evaluateFileWritePolicy,
|
|
8
|
-
summarizeToolArguments
|
|
9
|
-
} from "./chunk-CHOZJMJS.js";
|
|
5
|
+
} from "./chunk-U2HBB7RS.js";
|
|
10
6
|
import {
|
|
11
7
|
EXECUTION_BACKEND_KINDS
|
|
12
8
|
} from "./chunk-PWTNI4N7.js";
|
|
@@ -22,27 +18,26 @@ import {
|
|
|
22
18
|
flushChatCompletionStream,
|
|
23
19
|
providerHttpFailure,
|
|
24
20
|
throwIfChatCompletionStreamFailed
|
|
25
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HSSBDZLD.js";
|
|
26
22
|
import {
|
|
27
23
|
readSseFrames
|
|
28
24
|
} from "./chunk-HNUWUO75.js";
|
|
29
25
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
evaluateFileWritePolicy,
|
|
27
|
+
summarizeToolArguments
|
|
28
|
+
} from "./chunk-CHOZJMJS.js";
|
|
32
29
|
import {
|
|
33
30
|
evaluateRequestBudget,
|
|
34
31
|
hasImageInRuntimeMessages,
|
|
35
32
|
stripImagePartsFromMessages
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XAG3FWBE.js";
|
|
37
34
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
resolveToolOutputProfile
|
|
41
|
-
} from "./chunk-2WZXXAQD.js";
|
|
35
|
+
resolveToolExecutionContract
|
|
36
|
+
} from "./chunk-LKA64WH4.js";
|
|
42
37
|
import {
|
|
43
38
|
resolveAgentImageInputSupport,
|
|
44
39
|
resolveToolImagePolicy
|
|
45
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-DUUDXSLX.js";
|
|
46
41
|
import {
|
|
47
42
|
applyShapingCounts,
|
|
48
43
|
attachProjectionFacts,
|
|
@@ -53,7 +48,7 @@ import {
|
|
|
53
48
|
projectUserPartForModel,
|
|
54
49
|
resolveOutboundDiagnosticSink,
|
|
55
50
|
writeThinkingFacts
|
|
56
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-QYB23WUH.js";
|
|
57
52
|
import {
|
|
58
53
|
createThinkParserState,
|
|
59
54
|
createToolCallAccumulator,
|
|
@@ -79,25 +74,7 @@ import {
|
|
|
79
74
|
hashStablePrefixContent,
|
|
80
75
|
resolveResponseGuidelines,
|
|
81
76
|
resolveToolGuidedSections
|
|
82
|
-
} from "./chunk-
|
|
83
|
-
import {
|
|
84
|
-
BRIDGE_STREAM_MAX_CHARS,
|
|
85
|
-
CLI_NOLO_WORKSPACE_TOOL_NAMES,
|
|
86
|
-
DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
|
|
87
|
-
NOLO_WORKSPACE_TOOL_NAMES,
|
|
88
|
-
buildDialogReadEnvelope,
|
|
89
|
-
buildNoloWorkspaceCommandArgs,
|
|
90
|
-
buildNoloWorkspaceOpenAiTools,
|
|
91
|
-
createStreamingDialogReadProjector,
|
|
92
|
-
noloPositiveIntegerString,
|
|
93
|
-
noloStringArg,
|
|
94
|
-
parseNoloWorkspaceToolArguments,
|
|
95
|
-
readTextStreamUpToChars,
|
|
96
|
-
resolveNoloDialogInput
|
|
97
|
-
} from "./chunk-YOT437BH.js";
|
|
98
|
-
import {
|
|
99
|
-
applyToolSurfaceConstraints
|
|
100
|
-
} from "./chunk-IC2I373Q.js";
|
|
77
|
+
} from "./chunk-FPBJM2BW.js";
|
|
101
78
|
import {
|
|
102
79
|
classifyUnparsableToolArgs,
|
|
103
80
|
collectStablePromptPrefix,
|
|
@@ -121,7 +98,7 @@ import {
|
|
|
121
98
|
toOpenAiCompatibleMessages,
|
|
122
99
|
toResponsesTools,
|
|
123
100
|
transferDowngradedToolTurnOrigin
|
|
124
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-EEOOBRA7.js";
|
|
125
102
|
import {
|
|
126
103
|
TOOL_HAD_IMAGES,
|
|
127
104
|
TOOL_IMAGES,
|
|
@@ -134,13 +111,45 @@ import {
|
|
|
134
111
|
toolImageDelivery,
|
|
135
112
|
toolImages,
|
|
136
113
|
withoutToolImages
|
|
137
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-X4O7FJF5.js";
|
|
115
|
+
import {
|
|
116
|
+
BRIDGE_STREAM_MAX_CHARS,
|
|
117
|
+
CLI_NOLO_WORKSPACE_TOOL_NAMES,
|
|
118
|
+
DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
|
|
119
|
+
NOLO_WORKSPACE_TOOL_NAMES,
|
|
120
|
+
buildDialogReadEnvelope,
|
|
121
|
+
buildNoloWorkspaceCommandArgs,
|
|
122
|
+
buildNoloWorkspaceOpenAiTools,
|
|
123
|
+
createStreamingDialogReadProjector,
|
|
124
|
+
noloPositiveIntegerString,
|
|
125
|
+
noloStringArg,
|
|
126
|
+
parseNoloWorkspaceToolArguments,
|
|
127
|
+
readTextStreamUpToChars,
|
|
128
|
+
resolveNoloDialogInput
|
|
129
|
+
} from "./chunk-MNEZUL5S.js";
|
|
130
|
+
import {
|
|
131
|
+
applyToolSurfaceConstraints
|
|
132
|
+
} from "./chunk-VS276URX.js";
|
|
138
133
|
import {
|
|
139
134
|
isQuotaExhaustedError
|
|
140
135
|
} from "./chunk-TLE77UJ5.js";
|
|
136
|
+
import {
|
|
137
|
+
PROJECT_INSTRUCTION_MAX_BYTES,
|
|
138
|
+
PROJECT_INSTRUCTION_MAX_CHARS,
|
|
139
|
+
SECRET_PATTERNS,
|
|
140
|
+
clipToolText,
|
|
141
|
+
hasPotentialSecrets,
|
|
142
|
+
isCompleteInstructionOutput,
|
|
143
|
+
resolveHistoricalToolContentCap,
|
|
144
|
+
resolveToolOutputProfile,
|
|
145
|
+
sanitizeToolOutputContent,
|
|
146
|
+
sanitizeToolOutputText,
|
|
147
|
+
scrubObjectSecrets,
|
|
148
|
+
scrubSecrets
|
|
149
|
+
} from "./chunk-WFGNWWJI.js";
|
|
141
150
|
import {
|
|
142
151
|
isAgentSkillDisabled
|
|
143
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-FJSNBZXR.js";
|
|
144
153
|
import {
|
|
145
154
|
buildDialogFallbackTitleFromUserInput
|
|
146
155
|
} from "./chunk-2MBTWINN.js";
|
|
@@ -152,12 +161,13 @@ import {
|
|
|
152
161
|
resolveEmptyAssistantFallbackMessage,
|
|
153
162
|
resolveEmptyAssistantOutcome,
|
|
154
163
|
resolveTruncatedReasoningTailLog
|
|
155
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-QRGDJA4B.js";
|
|
156
165
|
import {
|
|
157
166
|
COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
158
167
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
159
168
|
buildBoundedCompactionRequest,
|
|
160
169
|
buildCompactionMetricsFromPlan,
|
|
170
|
+
buildSummarySourceDiagnostics,
|
|
161
171
|
classifySummaryError,
|
|
162
172
|
computeSummarySourceMetadata,
|
|
163
173
|
createSummaryBudget,
|
|
@@ -175,7 +185,7 @@ import {
|
|
|
175
185
|
sha256Hex,
|
|
176
186
|
summaryCompletionTokens,
|
|
177
187
|
truncateToolOutputForContext
|
|
178
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-L32W3PRP.js";
|
|
179
189
|
import {
|
|
180
190
|
createProviderCallTimingTracker,
|
|
181
191
|
finalizeProviderCallTiming,
|
|
@@ -193,11 +203,20 @@ import {
|
|
|
193
203
|
assertCredentialRef
|
|
194
204
|
} from "./chunk-OQHIVPG4.js";
|
|
195
205
|
import {
|
|
206
|
+
isAbortError
|
|
207
|
+
} from "./chunk-7DPNBQSV.js";
|
|
208
|
+
import {
|
|
209
|
+
isLevelNotFoundError
|
|
210
|
+
} from "./chunk-OW765XBU.js";
|
|
211
|
+
import {
|
|
212
|
+
TOOL_OUTPUT_SPILL_BYTES,
|
|
213
|
+
TOOL_OUTPUT_SPILL_LINES,
|
|
196
214
|
buildInteractiveCommandBlockedResult,
|
|
197
215
|
buildProcessTaskResultCapsule,
|
|
198
216
|
buildWorkspaceShellCommand,
|
|
199
217
|
buildWorkspaceShellEscapeBlockedResult,
|
|
200
218
|
buildWorkspaceShellPlan,
|
|
219
|
+
countLines,
|
|
201
220
|
createGlob,
|
|
202
221
|
deriveLabel,
|
|
203
222
|
extractActivity,
|
|
@@ -216,67 +235,63 @@ import {
|
|
|
216
235
|
spillToolOutput,
|
|
217
236
|
toProcessTaskView,
|
|
218
237
|
truncateToolOutput
|
|
219
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-VMJVAJ6W.js";
|
|
220
239
|
import {
|
|
221
240
|
estimateTokenCount
|
|
222
241
|
} from "./chunk-PSCNXBYA.js";
|
|
223
242
|
import {
|
|
224
|
-
|
|
225
|
-
} from "./chunk-
|
|
226
|
-
import {
|
|
227
|
-
isAbortError
|
|
228
|
-
} from "./chunk-7DPNBQSV.js";
|
|
229
|
-
import {
|
|
230
|
-
buildProviderAuthHeaders,
|
|
231
|
-
buildProviderExecutionPlan
|
|
232
|
-
} from "./chunk-6EDAMVG6.js";
|
|
233
|
-
import {
|
|
234
|
-
toErrorMessage
|
|
235
|
-
} from "./chunk-HNMXYYJR.js";
|
|
243
|
+
resolveNoloStateDir
|
|
244
|
+
} from "./chunk-6UBGXX2W.js";
|
|
236
245
|
import {
|
|
237
246
|
WORKTREE_ISOLATION_PRELUDE
|
|
238
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-G7IUT2V3.js";
|
|
239
248
|
import {
|
|
240
249
|
canonicalizeToolName,
|
|
241
250
|
canonicalizeToolNames
|
|
242
251
|
} from "./chunk-6OVNSQHN.js";
|
|
243
252
|
import {
|
|
244
|
-
|
|
245
|
-
|
|
253
|
+
dialogMessageKey,
|
|
254
|
+
dialogMessageRange
|
|
255
|
+
} from "./chunk-OJKUU3LP.js";
|
|
246
256
|
import {
|
|
247
|
-
|
|
248
|
-
} from "./chunk-
|
|
257
|
+
asTrimmedNonEmptyStringArray
|
|
258
|
+
} from "./chunk-I42VC5KR.js";
|
|
249
259
|
import {
|
|
250
|
-
|
|
251
|
-
} from "./chunk-
|
|
260
|
+
asOptionalPositiveFiniteNumber
|
|
261
|
+
} from "./chunk-U6VC4MU4.js";
|
|
252
262
|
import {
|
|
263
|
+
buildAgentsMdLayer,
|
|
264
|
+
buildAgentsMdLayerHeader,
|
|
253
265
|
buildDialogSummaryLayer
|
|
254
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-42OKN2LI.js";
|
|
255
267
|
import {
|
|
256
268
|
buildUserResponseLanguageContext
|
|
257
|
-
} from "./chunk-
|
|
258
|
-
import {
|
|
259
|
-
normalizeServerOrigin
|
|
260
|
-
} from "./chunk-CF7PE763.js";
|
|
261
|
-
import {
|
|
262
|
-
resolveNoloStateDir
|
|
263
|
-
} from "./chunk-6UBGXX2W.js";
|
|
269
|
+
} from "./chunk-JQZRSXS5.js";
|
|
264
270
|
import {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
} from "./chunk-
|
|
271
|
+
buildProviderAuthHeaders,
|
|
272
|
+
buildProviderExecutionPlan
|
|
273
|
+
} from "./chunk-RTHFJZ6M.js";
|
|
268
274
|
import {
|
|
269
|
-
|
|
270
|
-
} from "./chunk-
|
|
275
|
+
toErrorMessage
|
|
276
|
+
} from "./chunk-HNMXYYJR.js";
|
|
271
277
|
import {
|
|
272
278
|
asTrimmedString
|
|
273
279
|
} from "./chunk-3EUW3WEO.js";
|
|
274
280
|
import {
|
|
275
|
-
|
|
276
|
-
} from "./chunk-
|
|
281
|
+
isRecord
|
|
282
|
+
} from "./chunk-KUG52IAP.js";
|
|
277
283
|
import {
|
|
278
284
|
asOptionalTrimmedString
|
|
279
285
|
} from "./chunk-G3SUCT4W.js";
|
|
286
|
+
import {
|
|
287
|
+
normalizeServerOrigin
|
|
288
|
+
} from "./chunk-CF7PE763.js";
|
|
289
|
+
import {
|
|
290
|
+
PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL
|
|
291
|
+
} from "./chunk-OBSEKCVK.js";
|
|
292
|
+
import {
|
|
293
|
+
asTrimmedLowercaseString
|
|
294
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
280
295
|
import {
|
|
281
296
|
__export
|
|
282
297
|
} from "./chunk-U67V476Y.js";
|
|
@@ -323,6 +338,36 @@ function readTitleParams(value) {
|
|
|
323
338
|
return Object.fromEntries(entries);
|
|
324
339
|
}
|
|
325
340
|
|
|
341
|
+
// packages/agent-runtime/dialogHistoryOrder.ts
|
|
342
|
+
import { decodeTime } from "ulid";
|
|
343
|
+
function orderDialogHistory(messages) {
|
|
344
|
+
const time = (message) => {
|
|
345
|
+
if (Number.isFinite(message.cliHistoryOrder)) return message.cliHistoryOrder;
|
|
346
|
+
const id = message.id ?? message.cliMessageId;
|
|
347
|
+
if (!id) return Infinity;
|
|
348
|
+
const timestamp = /^(\d+)-/.exec(id);
|
|
349
|
+
if (timestamp) return Number(timestamp[1]);
|
|
350
|
+
if (/^[0-9A-HJKMNP-TV-Z]{26}$/.test(id)) {
|
|
351
|
+
try {
|
|
352
|
+
return decodeTime(id);
|
|
353
|
+
} catch {
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return Number.isFinite(message.createdAt) ? message.createdAt : -Infinity;
|
|
357
|
+
};
|
|
358
|
+
const identity2 = (message) => message.id ?? message.cliMessageId;
|
|
359
|
+
return messages.map((message, index) => ({ message, index, time: time(message) })).sort((a, b) => {
|
|
360
|
+
if (a.time !== b.time) return a.time < b.time ? -1 : 1;
|
|
361
|
+
const left = identity2(a.message), right = identity2(b.message);
|
|
362
|
+
if (left && right && left !== right) return left < right ? -1 : 1;
|
|
363
|
+
return a.index - b.index;
|
|
364
|
+
}).map(({ message }) => message);
|
|
365
|
+
}
|
|
366
|
+
function dialogTurnUserMessageId(turnId, index) {
|
|
367
|
+
if (typeof turnId !== "string" || !/^turn-[0-9A-HJKMNP-TV-Z]{26}$/.test(turnId)) return void 0;
|
|
368
|
+
return `${decodeTime(turnId.slice(5))}-${String(index + 1).padStart(3, "0")}-${turnId}`;
|
|
369
|
+
}
|
|
370
|
+
|
|
326
371
|
// packages/agent-runtime/contextRefusal.ts
|
|
327
372
|
var machineIdentifier = (value) => value && /^[A-Z][A-Z0-9_]{0,63}$/.test(value) ? value : void 0;
|
|
328
373
|
function classifyContextRefusal(args2) {
|
|
@@ -5548,8 +5593,8 @@ var runPromiseExitWith = (context3) => {
|
|
|
5548
5593
|
const runFork3 = runForkWith(context3);
|
|
5549
5594
|
return (effect, options) => {
|
|
5550
5595
|
const fiber3 = runFork3(effect, options);
|
|
5551
|
-
return new Promise((
|
|
5552
|
-
fiber3.addObserver((exit3) =>
|
|
5596
|
+
return new Promise((resolve7) => {
|
|
5597
|
+
fiber3.addObserver((exit3) => resolve7(exit3));
|
|
5553
5598
|
});
|
|
5554
5599
|
};
|
|
5555
5600
|
};
|
|
@@ -12772,8 +12817,8 @@ var toReadableStreamWith = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (
|
|
|
12772
12817
|
}
|
|
12773
12818
|
},
|
|
12774
12819
|
pull() {
|
|
12775
|
-
return new Promise((
|
|
12776
|
-
currentResolve =
|
|
12820
|
+
return new Promise((resolve7) => {
|
|
12821
|
+
currentResolve = resolve7;
|
|
12777
12822
|
latch.openUnsafe();
|
|
12778
12823
|
});
|
|
12779
12824
|
},
|
|
@@ -13307,255 +13352,6 @@ function sanitizeToolCallPairing(messages) {
|
|
|
13307
13352
|
return output;
|
|
13308
13353
|
}
|
|
13309
13354
|
|
|
13310
|
-
// packages/agent-runtime/secretScrubber.ts
|
|
13311
|
-
var SECRET_PATTERNS = [
|
|
13312
|
-
// 1. PEM 私钥块(高危硬拦截)
|
|
13313
|
-
{
|
|
13314
|
-
kind: "PRIVATE_KEY",
|
|
13315
|
-
placeholder: "[REDACTED:PRIVATE_KEY]",
|
|
13316
|
-
regex: /-----BEGIN (?:[A-Z0-9 ]+)?PRIVATE KEY-----[\s\S]+?-----END (?:[A-Z0-9 ]+)?PRIVATE KEY-----/g
|
|
13317
|
-
},
|
|
13318
|
-
// 2. Anthropic API Key (sk-ant-...)
|
|
13319
|
-
{
|
|
13320
|
-
kind: "ANTHROPIC_KEY",
|
|
13321
|
-
placeholder: "[REDACTED:ANTHROPIC_KEY]",
|
|
13322
|
-
regex: /\bsk-ant-[a-zA-Z0-9_\-]{20,}\b/g
|
|
13323
|
-
},
|
|
13324
|
-
// 3. OpenAI / DeepSeek / 通用 API Key (sk-...)
|
|
13325
|
-
{
|
|
13326
|
-
kind: "API_KEY",
|
|
13327
|
-
placeholder: "[REDACTED:API_KEY]",
|
|
13328
|
-
regex: /\bsk-[a-zA-Z0-9_\-]{24,}\b/g
|
|
13329
|
-
},
|
|
13330
|
-
// 3b. BigModel / 智谱(GLM)API Key:32 位 hex + "." + 16 位字母数字
|
|
13331
|
-
// (2026-11 实证:这类 key 没有任何可辨识前缀,此前漏在清洗与入路隔离之外,
|
|
13332
|
-
// 用户贴进对话后明文直接进了 prompt / 历史 / 工具日志。)
|
|
13333
|
-
{
|
|
13334
|
-
kind: "BIGMODEL_KEY",
|
|
13335
|
-
placeholder: "[REDACTED:BIGMODEL_KEY]",
|
|
13336
|
-
regex: /\b[0-9a-fA-F]{32}\.[A-Za-z0-9]{16}\b/g
|
|
13337
|
-
},
|
|
13338
|
-
// 4. GitHub 访问令牌 (ghp_..., gho_..., github_pat_...)
|
|
13339
|
-
{
|
|
13340
|
-
kind: "GITHUB_TOKEN",
|
|
13341
|
-
placeholder: "[REDACTED:GITHUB_TOKEN]",
|
|
13342
|
-
regex: /\b(?:gh[pousr]_[a-zA-Z0-9]{30,}|github_pat_[a-zA-Z0-9_]{40,})\b/g
|
|
13343
|
-
},
|
|
13344
|
-
// 5. Bearer Token (JWT / Authorization Bearer)
|
|
13345
|
-
{
|
|
13346
|
-
kind: "BEARER_TOKEN",
|
|
13347
|
-
placeholder: "Bearer [REDACTED:BEARER_TOKEN]",
|
|
13348
|
-
regex: /\bBearer\s+[a-zA-Z0-9_\-\.]{25,}\b/gi
|
|
13349
|
-
},
|
|
13350
|
-
// 6. 常见环境变量或配置中的密码赋值 (PASSWORD=..., PASSWD=...)
|
|
13351
|
-
{
|
|
13352
|
-
kind: "PASSWORD",
|
|
13353
|
-
placeholder: "$1=[REDACTED:PASSWORD]",
|
|
13354
|
-
regex: /\b((?:DB_|DATABASE_|ADMIN_|ROOT_|MYSQL_|POSTGRES_)?(?:PASSWORD|PASSWD|SECRET_KEY))\s*=\s*['"]?([^\s'"]{4,})['"]?/gi
|
|
13355
|
-
}
|
|
13356
|
-
];
|
|
13357
|
-
var QUICK_PROBE_SUBSTRINGS = [
|
|
13358
|
-
"sk-",
|
|
13359
|
-
"ghp_",
|
|
13360
|
-
"gho_",
|
|
13361
|
-
"ghu_",
|
|
13362
|
-
"ghs_",
|
|
13363
|
-
"ghr_",
|
|
13364
|
-
"github_pat_",
|
|
13365
|
-
"PRIVATE KEY",
|
|
13366
|
-
"Bearer ",
|
|
13367
|
-
"bearer ",
|
|
13368
|
-
"PASSWORD",
|
|
13369
|
-
"password",
|
|
13370
|
-
"PASSWD",
|
|
13371
|
-
"SECRET_KEY"
|
|
13372
|
-
];
|
|
13373
|
-
var UNPREFIXED_PROBE_REGEX = /\b[0-9a-fA-F]{32}\.[A-Za-z0-9]{16}\b/;
|
|
13374
|
-
function hasPotentialSecrets(text2) {
|
|
13375
|
-
if (typeof text2 !== "string" || text2.length === 0) return false;
|
|
13376
|
-
if (QUICK_PROBE_SUBSTRINGS.some((probe) => text2.includes(probe))) return true;
|
|
13377
|
-
return UNPREFIXED_PROBE_REGEX.test(text2);
|
|
13378
|
-
}
|
|
13379
|
-
function scrubSecrets(text2) {
|
|
13380
|
-
if (typeof text2 !== "string" || text2.length === 0) {
|
|
13381
|
-
return { cleaned: text2, redactedCount: 0, matchedKinds: [] };
|
|
13382
|
-
}
|
|
13383
|
-
if (!hasPotentialSecrets(text2)) {
|
|
13384
|
-
return { cleaned: text2, redactedCount: 0, matchedKinds: [] };
|
|
13385
|
-
}
|
|
13386
|
-
let cleaned = text2;
|
|
13387
|
-
let redactedCount = 0;
|
|
13388
|
-
const matchedKinds = [];
|
|
13389
|
-
for (const pattern of SECRET_PATTERNS) {
|
|
13390
|
-
pattern.regex.lastIndex = 0;
|
|
13391
|
-
const matches = cleaned.match(pattern.regex);
|
|
13392
|
-
if (matches && matches.length > 0) {
|
|
13393
|
-
redactedCount += matches.length;
|
|
13394
|
-
if (!matchedKinds.includes(pattern.kind)) {
|
|
13395
|
-
matchedKinds.push(pattern.kind);
|
|
13396
|
-
}
|
|
13397
|
-
cleaned = cleaned.replace(pattern.regex, pattern.placeholder);
|
|
13398
|
-
}
|
|
13399
|
-
}
|
|
13400
|
-
return { cleaned, redactedCount, matchedKinds };
|
|
13401
|
-
}
|
|
13402
|
-
function scrubObjectSecrets(val) {
|
|
13403
|
-
if (val === null || val === void 0) return val;
|
|
13404
|
-
if (typeof val === "string") {
|
|
13405
|
-
return scrubSecrets(val).cleaned;
|
|
13406
|
-
}
|
|
13407
|
-
if (Array.isArray(val)) {
|
|
13408
|
-
return val.map((item) => scrubObjectSecrets(item));
|
|
13409
|
-
}
|
|
13410
|
-
if (typeof val === "object") {
|
|
13411
|
-
if (val instanceof Date || val instanceof RegExp) return val;
|
|
13412
|
-
const result4 = {};
|
|
13413
|
-
for (const [k, v] of Object.entries(val)) {
|
|
13414
|
-
result4[k] = scrubObjectSecrets(v);
|
|
13415
|
-
}
|
|
13416
|
-
return result4;
|
|
13417
|
-
}
|
|
13418
|
-
return val;
|
|
13419
|
-
}
|
|
13420
|
-
|
|
13421
|
-
// packages/agent-runtime/toolOutputSanitizer.ts
|
|
13422
|
-
var SANITIZE_REPLACEMENT_CHAR = "\uFFFD";
|
|
13423
|
-
var MAX_CONTROL_SEQUENCE_CHARS = 256;
|
|
13424
|
-
var ESC = 27;
|
|
13425
|
-
var BEL = 7;
|
|
13426
|
-
var LINE_FEED = 10;
|
|
13427
|
-
var TAB = 9;
|
|
13428
|
-
var DEL = 127;
|
|
13429
|
-
var C1_DCS = 144;
|
|
13430
|
-
var C1_SOS = 152;
|
|
13431
|
-
var C1_CSI = 155;
|
|
13432
|
-
var C1_ST = 156;
|
|
13433
|
-
var C1_OSC = 157;
|
|
13434
|
-
var C1_PM = 158;
|
|
13435
|
-
var C1_APC = 159;
|
|
13436
|
-
var HIGH_SURROGATE_MIN = 55296;
|
|
13437
|
-
var HIGH_SURROGATE_MAX = 56319;
|
|
13438
|
-
var LOW_SURROGATE_MIN = 56320;
|
|
13439
|
-
var LOW_SURROGATE_MAX = 57343;
|
|
13440
|
-
var NEEDS_SANITIZE_RE = new RegExp("[\\u0000-\\u0008\\u000b-\\u001f\\u007f-\\u009f]|\\p{Cs}", "u");
|
|
13441
|
-
function isC1Introducer(code) {
|
|
13442
|
-
return code === C1_CSI || code === C1_OSC || code === C1_DCS || code === C1_SOS || code === C1_PM || code === C1_APC;
|
|
13443
|
-
}
|
|
13444
|
-
var UNTERMINATED_SEQUENCE = -1;
|
|
13445
|
-
function skipCsiBody(text2, start, limit) {
|
|
13446
|
-
let i = start;
|
|
13447
|
-
while (i < limit) {
|
|
13448
|
-
const code = text2.charCodeAt(i);
|
|
13449
|
-
if (code >= 64 && code <= 126) return i + 1;
|
|
13450
|
-
if (code >= 32 && code <= 63) {
|
|
13451
|
-
i += 1;
|
|
13452
|
-
continue;
|
|
13453
|
-
}
|
|
13454
|
-
return i;
|
|
13455
|
-
}
|
|
13456
|
-
return UNTERMINATED_SEQUENCE;
|
|
13457
|
-
}
|
|
13458
|
-
function skipControlStringBody(text2, start, limit) {
|
|
13459
|
-
const length = text2.length;
|
|
13460
|
-
let i = start;
|
|
13461
|
-
while (i < limit) {
|
|
13462
|
-
const code = text2.charCodeAt(i);
|
|
13463
|
-
if (code === BEL || code === C1_ST) return i + 1;
|
|
13464
|
-
if (code === ESC && i + 1 < length && text2.charCodeAt(i + 1) === 92) {
|
|
13465
|
-
return Math.min(i + 2, limit);
|
|
13466
|
-
}
|
|
13467
|
-
i += 1;
|
|
13468
|
-
}
|
|
13469
|
-
return UNTERMINATED_SEQUENCE;
|
|
13470
|
-
}
|
|
13471
|
-
function skipEscapeSequence(text2, escIndex) {
|
|
13472
|
-
const length = text2.length;
|
|
13473
|
-
const limit = Math.min(length, escIndex + MAX_CONTROL_SEQUENCE_CHARS);
|
|
13474
|
-
const leadIndex = escIndex + 1;
|
|
13475
|
-
if (leadIndex >= length) return leadIndex;
|
|
13476
|
-
const lead = text2.charCodeAt(leadIndex);
|
|
13477
|
-
if (lead === 91) {
|
|
13478
|
-
const csiEnd = skipCsiBody(text2, leadIndex + 1, limit);
|
|
13479
|
-
return csiEnd === UNTERMINATED_SEQUENCE ? escIndex + 1 : csiEnd;
|
|
13480
|
-
}
|
|
13481
|
-
if (lead === 93 || lead === 80 || lead === 88 || lead === 94 || lead === 95) {
|
|
13482
|
-
const stringEnd = skipControlStringBody(text2, leadIndex + 1, limit);
|
|
13483
|
-
return stringEnd === UNTERMINATED_SEQUENCE ? escIndex + 1 : stringEnd;
|
|
13484
|
-
}
|
|
13485
|
-
let j = leadIndex;
|
|
13486
|
-
while (j < limit && text2.charCodeAt(j) >= 32 && text2.charCodeAt(j) <= 47) {
|
|
13487
|
-
j += 1;
|
|
13488
|
-
}
|
|
13489
|
-
if (j < limit) {
|
|
13490
|
-
const final = text2.charCodeAt(j);
|
|
13491
|
-
if (final >= 48 && final <= 126) return j + 1;
|
|
13492
|
-
}
|
|
13493
|
-
return escIndex + 1;
|
|
13494
|
-
}
|
|
13495
|
-
function skipC1Sequence(text2, index) {
|
|
13496
|
-
const limit = Math.min(text2.length, index + MAX_CONTROL_SEQUENCE_CHARS);
|
|
13497
|
-
const code = text2.charCodeAt(index);
|
|
13498
|
-
const bodyEnd = code === C1_CSI ? skipCsiBody(text2, index + 1, limit) : skipControlStringBody(text2, index + 1, limit);
|
|
13499
|
-
return bodyEnd === UNTERMINATED_SEQUENCE ? index + 1 : bodyEnd;
|
|
13500
|
-
}
|
|
13501
|
-
function sanitizeToolOutputText(text2) {
|
|
13502
|
-
if (typeof text2 !== "string" || text2.length === 0) return text2;
|
|
13503
|
-
if (!NEEDS_SANITIZE_RE.test(text2)) return text2;
|
|
13504
|
-
const out = [];
|
|
13505
|
-
const length = text2.length;
|
|
13506
|
-
let plainStart = 0;
|
|
13507
|
-
let i = 0;
|
|
13508
|
-
const dropRange = (end3) => {
|
|
13509
|
-
if (plainStart < i) out.push(text2.slice(plainStart, i));
|
|
13510
|
-
i = end3;
|
|
13511
|
-
plainStart = end3;
|
|
13512
|
-
};
|
|
13513
|
-
while (i < length) {
|
|
13514
|
-
const code = text2.charCodeAt(i);
|
|
13515
|
-
if (code === LINE_FEED || code === TAB) {
|
|
13516
|
-
i += 1;
|
|
13517
|
-
continue;
|
|
13518
|
-
}
|
|
13519
|
-
if (code === ESC) {
|
|
13520
|
-
dropRange(skipEscapeSequence(text2, i));
|
|
13521
|
-
continue;
|
|
13522
|
-
}
|
|
13523
|
-
if (isC1Introducer(code)) {
|
|
13524
|
-
dropRange(skipC1Sequence(text2, i));
|
|
13525
|
-
continue;
|
|
13526
|
-
}
|
|
13527
|
-
if (code < 32 || code === DEL || code >= 128 && code <= 159) {
|
|
13528
|
-
dropRange(i + 1);
|
|
13529
|
-
continue;
|
|
13530
|
-
}
|
|
13531
|
-
if (code >= HIGH_SURROGATE_MIN && code <= HIGH_SURROGATE_MAX) {
|
|
13532
|
-
const low = text2.charCodeAt(i + 1);
|
|
13533
|
-
if (low >= LOW_SURROGATE_MIN && low <= LOW_SURROGATE_MAX) {
|
|
13534
|
-
i += 2;
|
|
13535
|
-
continue;
|
|
13536
|
-
}
|
|
13537
|
-
if (plainStart < i) out.push(text2.slice(plainStart, i));
|
|
13538
|
-
out.push(SANITIZE_REPLACEMENT_CHAR);
|
|
13539
|
-
i += 1;
|
|
13540
|
-
plainStart = i;
|
|
13541
|
-
continue;
|
|
13542
|
-
}
|
|
13543
|
-
if (code >= LOW_SURROGATE_MIN && code <= LOW_SURROGATE_MAX) {
|
|
13544
|
-
if (plainStart < i) out.push(text2.slice(plainStart, i));
|
|
13545
|
-
out.push(SANITIZE_REPLACEMENT_CHAR);
|
|
13546
|
-
i += 1;
|
|
13547
|
-
plainStart = i;
|
|
13548
|
-
continue;
|
|
13549
|
-
}
|
|
13550
|
-
i += 1;
|
|
13551
|
-
}
|
|
13552
|
-
if (plainStart < length) out.push(text2.slice(plainStart));
|
|
13553
|
-
return out.join("");
|
|
13554
|
-
}
|
|
13555
|
-
function sanitizeToolOutputContent(content) {
|
|
13556
|
-
return typeof content === "string" ? sanitizeToolOutputText(content) : content;
|
|
13557
|
-
}
|
|
13558
|
-
|
|
13559
13355
|
// packages/agent-runtime/providerMessageProjection.ts
|
|
13560
13356
|
var TOOL_DURATION_METADATA_KEY = "toolExecMs";
|
|
13561
13357
|
var OBSERVATION_ONLY_METADATA_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -13702,6 +13498,7 @@ function projectToolContentForProvider(args2) {
|
|
|
13702
13498
|
const content = typeof rawContent === "string" ? sanitizeToolOutputText(rawContent) : rawContent;
|
|
13703
13499
|
if (typeof content !== "string") return content;
|
|
13704
13500
|
if (isSpilledToolOutput(content)) return content;
|
|
13501
|
+
if (isCompleteInstructionOutput(args2.toolName, args2.metadata, content)) return content;
|
|
13705
13502
|
const metadataText = compactToolMetadata(args2.metadata);
|
|
13706
13503
|
const embeddedMetadataIndex = metadataText ? content.indexOf("\n\n[tool metadata]\n") : -1;
|
|
13707
13504
|
const contentForProjection = embeddedMetadataIndex >= 0 ? content.slice(0, embeddedMetadataIndex) : content;
|
|
@@ -15033,12 +14830,255 @@ async function invokeCapability(capabilityOrName, input, ctx = {}) {
|
|
|
15033
14830
|
}
|
|
15034
14831
|
|
|
15035
14832
|
// packages/agent-runtime/localWorkspaceTools.ts
|
|
15036
|
-
import { existsSync as
|
|
14833
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
15037
14834
|
import { createHash as createHash3 } from "node:crypto";
|
|
15038
14835
|
|
|
14836
|
+
// packages/agent-runtime/agentsMd.ts
|
|
14837
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
14838
|
+
import { resolve } from "node:path";
|
|
14839
|
+
var AGENTS_MD_MAX_BYTES = 8192;
|
|
14840
|
+
var AGENTS_MD_MARKER_RESERVE_BYTES = 512;
|
|
14841
|
+
var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
|
|
14842
|
+
function truncateAgentsMdContent(content, maxBytes = AGENTS_MD_MAX_BYTES) {
|
|
14843
|
+
const buf = Buffer.from(content, "utf8");
|
|
14844
|
+
if (buf.byteLength <= maxBytes) {
|
|
14845
|
+
return content;
|
|
14846
|
+
}
|
|
14847
|
+
let boundary = Math.min(maxBytes, buf.byteLength);
|
|
14848
|
+
while (boundary > 0 && boundary < buf.byteLength && (buf[boundary] & 192) === 128) {
|
|
14849
|
+
boundary--;
|
|
14850
|
+
}
|
|
14851
|
+
const boundarySlice = buf.subarray(0, boundary).toString("utf8");
|
|
14852
|
+
const slice = buf.subarray(0, maxBytes);
|
|
14853
|
+
const lastNewline = slice.lastIndexOf(10);
|
|
14854
|
+
if (lastNewline > 0) {
|
|
14855
|
+
const lineCandidate = slice.subarray(0, lastNewline).toString("utf8");
|
|
14856
|
+
const lineBytes = Buffer.byteLength(lineCandidate, "utf8");
|
|
14857
|
+
const boundaryBytes = Buffer.byteLength(boundarySlice, "utf8");
|
|
14858
|
+
if (lineCandidate.trim().length > 0 && lineBytes * 2 >= boundaryBytes) {
|
|
14859
|
+
return lineCandidate.replace(/\r$/, "");
|
|
14860
|
+
}
|
|
14861
|
+
}
|
|
14862
|
+
return boundarySlice.replace(/\r$/, "");
|
|
14863
|
+
}
|
|
14864
|
+
var AGENTS_MD_SUMMARY_MAX_BYTES = 3072;
|
|
14865
|
+
var AGENTS_MD_SUMMARY_ITEM_MAX_CHARS = 120;
|
|
14866
|
+
var AGENTS_MD_SUMMARY_PRIORITY_KEYWORDS = [
|
|
14867
|
+
"review",
|
|
14868
|
+
"\u8BC4\u5BA1",
|
|
14869
|
+
"commit",
|
|
14870
|
+
"\u63D0\u4EA4",
|
|
14871
|
+
"worktree",
|
|
14872
|
+
"\u6D4B\u8BD5",
|
|
14873
|
+
"typecheck",
|
|
14874
|
+
"\u7C7B\u578B\u68C0\u67E5",
|
|
14875
|
+
"push",
|
|
14876
|
+
"\u53D1\u5E03",
|
|
14877
|
+
"\u6587\u6863\u843D\u4F4D",
|
|
14878
|
+
"\u5220\u9664",
|
|
14879
|
+
"\u6D3E\u53D1"
|
|
14880
|
+
];
|
|
14881
|
+
var AGENTS_MD_SUMMARY_POINTER_INSTRUCTION = "\u7528 readFile \u8BFB\u5168\u6587\uFF1A%REL%\uFF08cwd\uFF09/ %PATH%\n\u4EC5\u7D22\u5F15\uFF1A\u63D0\u4EA4/\u8BC4\u5BA1\u95E8\u7981\u3001worktree \u9694\u79BB\u3001\u6D4B\u8BD5/typecheck\u3001\u6587\u6863\u843D\u4F4D\u3001\u5220\u9664\u3001push/\u53D1\u5E03\u524D\uFF0C**\u5FC5\u987B\u5148 readFile \u8BFB\u5168\u6587\u518D\u6267\u884C**\u3002\n\u8DEF\u5F84\uFF1A%REL% \u76F8\u5BF9 cwd\uFF1Bmachine:<id>/\u6C99\u76D2\u6267\u884C\u9762 cwd \u7531\u5176\u51B3\u5B9A\uFF0C\u8BFB\u4E0D\u5230\u8BA9\u5BBF\u4E3B\u6CE8\u5165\u6216\u7528\u7EDD\u5BF9\u8DEF\u5F84\u3002";
|
|
14882
|
+
var AGENTS_MD_SUMMARY_DELETE_REFERENCE = "- \u5220\u9664/\u4E0D\u53EF\u9006\u64CD\u4F5C\uFF1A\u9075\u5B88\u7CFB\u7EDF\u63D0\u793A\u7684\u5220\u9664\u7EA2\u7EBF\uFF08\u5148\u5448\u73B0\u5B8C\u6574\u5F85\u5220\u6E05\u5355\u5E76\u83B7\u7528\u6237\u660E\u786E\u786E\u8BA4\uFF0C\u7981\u6B62\u5148\u5220\u540E\u62A5\u3001\u7981\u6B62\u6A21\u7CCA\u5B9A\u4F4D\uFF09\uFF0C\u4ED3\u5E93\u82E5\u6709\u9644\u52A0\u5220\u9664\u89C4\u5219\u89C1\u5B8C\u6574\u6587\u4EF6\u3002";
|
|
14883
|
+
var clipToChars = (text2, maxChars) => text2.length <= maxChars ? text2 : `${text2.slice(0, maxChars).trimEnd()}\u2026`;
|
|
14884
|
+
var parseAgentsMdItem = (body) => {
|
|
14885
|
+
const bold = /^\*\*(.+?)\*\*/.exec(body);
|
|
14886
|
+
if (bold) {
|
|
14887
|
+
return {
|
|
14888
|
+
label: bold[1].trim().replace(/[::]$/, ""),
|
|
14889
|
+
rest: body.slice(bold[0].length).replace(/^[::\s]+/, "")
|
|
14890
|
+
};
|
|
14891
|
+
}
|
|
14892
|
+
const firstClause = body.split(/[::]/)[0];
|
|
14893
|
+
return {
|
|
14894
|
+
label: clipToChars(firstClause.trim(), 40),
|
|
14895
|
+
rest: body.slice(firstClause.length).replace(/^[::\s]+/, "")
|
|
14896
|
+
};
|
|
14897
|
+
};
|
|
14898
|
+
var AGENTS_MD_COMMAND_TOKEN_PREFIX = /^(bunx?|npx|node|npm|pnpm|yarn|git|gh|tsc|deno)\b\s/;
|
|
14899
|
+
var extractAgentsMdCommandTokens = (body) => {
|
|
14900
|
+
const tokens = [];
|
|
14901
|
+
const seen = /* @__PURE__ */ new Set();
|
|
14902
|
+
for (const match7 of body.matchAll(/`([^`\n]+)`/g)) {
|
|
14903
|
+
const raw = match7[1];
|
|
14904
|
+
if (!AGENTS_MD_COMMAND_TOKEN_PREFIX.test(raw)) continue;
|
|
14905
|
+
if (seen.has(raw)) continue;
|
|
14906
|
+
seen.add(raw);
|
|
14907
|
+
tokens.push(raw);
|
|
14908
|
+
}
|
|
14909
|
+
return tokens;
|
|
14910
|
+
};
|
|
14911
|
+
var buildAgentsMdItemGist = (firstSentence, bulletBody) => {
|
|
14912
|
+
const max4 = AGENTS_MD_SUMMARY_ITEM_MAX_CHARS;
|
|
14913
|
+
const clipped = clipToChars(firstSentence, max4);
|
|
14914
|
+
const missing = extractAgentsMdCommandTokens(bulletBody).filter(
|
|
14915
|
+
(token) => !clipped.includes(token)
|
|
14916
|
+
);
|
|
14917
|
+
if (missing.length === 0) return clipped;
|
|
14918
|
+
let tail = "";
|
|
14919
|
+
for (const token of missing) {
|
|
14920
|
+
const candidate = tail ? `${tail} \`${token}\`` : `\`${token}\``;
|
|
14921
|
+
if (candidate.length > max4) continue;
|
|
14922
|
+
tail = candidate;
|
|
14923
|
+
}
|
|
14924
|
+
if (!tail) return clipped;
|
|
14925
|
+
const room = max4 - tail.length - 2;
|
|
14926
|
+
const head3 = room > 0 ? clipToChars(firstSentence, room) : "";
|
|
14927
|
+
return head3 ? `${head3} ${tail}` : tail;
|
|
14928
|
+
};
|
|
14929
|
+
var priorityOf = (label) => {
|
|
14930
|
+
const lowered = label.toLowerCase();
|
|
14931
|
+
for (let i = 0; i < AGENTS_MD_SUMMARY_PRIORITY_KEYWORDS.length; i += 1) {
|
|
14932
|
+
if (lowered.includes(AGENTS_MD_SUMMARY_PRIORITY_KEYWORDS[i].toLowerCase())) {
|
|
14933
|
+
return i;
|
|
14934
|
+
}
|
|
14935
|
+
}
|
|
14936
|
+
return -1;
|
|
14937
|
+
};
|
|
14938
|
+
var collectAgentsMdSummaryItems = (content) => {
|
|
14939
|
+
const items = [];
|
|
14940
|
+
const seen = /* @__PURE__ */ new Set();
|
|
14941
|
+
let section = null;
|
|
14942
|
+
for (const rawLine of content.split(/\r?\n/)) {
|
|
14943
|
+
const line = rawLine.trim();
|
|
14944
|
+
if (!line) continue;
|
|
14945
|
+
const heading = /^#{2,3}\s+(.+)$/.exec(line);
|
|
14946
|
+
if (heading) {
|
|
14947
|
+
section = heading[1].trim();
|
|
14948
|
+
continue;
|
|
14949
|
+
}
|
|
14950
|
+
if (line.startsWith("#") || line.startsWith("<") || line.startsWith("<!--")) {
|
|
14951
|
+
continue;
|
|
14952
|
+
}
|
|
14953
|
+
const bullet = /^[-*]\s+(.+)$/.exec(line);
|
|
14954
|
+
if (!bullet) continue;
|
|
14955
|
+
const { label, rest } = parseAgentsMdItem(bullet[1]);
|
|
14956
|
+
if (!label || seen.has(label)) continue;
|
|
14957
|
+
seen.add(label);
|
|
14958
|
+
const firstSentence = rest.split("\u3002")[0].trim();
|
|
14959
|
+
items.push({
|
|
14960
|
+
section,
|
|
14961
|
+
label,
|
|
14962
|
+
gist: buildAgentsMdItemGist(firstSentence, bullet[1]),
|
|
14963
|
+
priority: priorityOf(label)
|
|
14964
|
+
});
|
|
14965
|
+
}
|
|
14966
|
+
return items;
|
|
14967
|
+
};
|
|
14968
|
+
function buildAgentsMdSummaryBody(content, filePath, options = {}) {
|
|
14969
|
+
const budgetBytes = options.budgetBytes ?? AGENTS_MD_SUMMARY_MAX_BYTES;
|
|
14970
|
+
const items = collectAgentsMdSummaryItems(content);
|
|
14971
|
+
if (items.length === 0) return null;
|
|
14972
|
+
const relativePath = options.fileName ?? "AGENTS.md";
|
|
14973
|
+
const pointer = AGENTS_MD_SUMMARY_POINTER_INSTRUCTION.replaceAll(
|
|
14974
|
+
"%REL%",
|
|
14975
|
+
relativePath
|
|
14976
|
+
).replaceAll("%PATH%", filePath);
|
|
14977
|
+
const head3 = `${pointer}
|
|
14978
|
+
${AGENTS_MD_SUMMARY_DELETE_REFERENCE}
|
|
14979
|
+
`;
|
|
14980
|
+
if (Buffer.byteLength(head3, "utf8") > budgetBytes) return null;
|
|
14981
|
+
const candidates = [
|
|
14982
|
+
...items.filter((item) => item.priority >= 0).sort((a, b) => a.priority - b.priority),
|
|
14983
|
+
...items.filter((item) => item.priority < 0)
|
|
14984
|
+
];
|
|
14985
|
+
const noteBlock = `
|
|
14986
|
+
\u2026\uFF08\u7D22\u5F15\u5DF2\u622A\u65AD\uFF0C\u5176\u4F59\u951A\u70B9\u89C1\u5B8C\u6574\u6587\u4EF6\uFF09`;
|
|
14987
|
+
const noteBytes = Buffer.byteLength(noteBlock, "utf8");
|
|
14988
|
+
let used = Buffer.byteLength(head3, "utf8");
|
|
14989
|
+
const admitted = [];
|
|
14990
|
+
const seenSections = /* @__PURE__ */ new Set();
|
|
14991
|
+
let truncated = false;
|
|
14992
|
+
for (const item of candidates) {
|
|
14993
|
+
const line = item.gist ? `- ${item.label}\uFF1A${item.gist}` : `- ${item.label}`;
|
|
14994
|
+
const headingCost = item.section && !seenSections.has(item.section) ? Buffer.byteLength(`
|
|
14995
|
+
## ${item.section}`, "utf8") : 0;
|
|
14996
|
+
const cost = headingCost + Buffer.byteLength(`
|
|
14997
|
+
${line}`, "utf8");
|
|
14998
|
+
if (used + cost + noteBytes > budgetBytes) {
|
|
14999
|
+
truncated = true;
|
|
15000
|
+
continue;
|
|
15001
|
+
}
|
|
15002
|
+
used += cost;
|
|
15003
|
+
if (item.section) seenSections.add(item.section);
|
|
15004
|
+
admitted.push(item);
|
|
15005
|
+
}
|
|
15006
|
+
const groupOrder = [];
|
|
15007
|
+
for (const item of admitted) {
|
|
15008
|
+
if (!groupOrder.includes(item.section)) groupOrder.push(item.section);
|
|
15009
|
+
}
|
|
15010
|
+
const frozen = [];
|
|
15011
|
+
for (const section of groupOrder) {
|
|
15012
|
+
for (const item of admitted) {
|
|
15013
|
+
if (item.section !== section) continue;
|
|
15014
|
+
frozen.push({
|
|
15015
|
+
section,
|
|
15016
|
+
line: item.gist ? `- ${item.label}\uFF1A${item.gist}` : `- ${item.label}`
|
|
15017
|
+
});
|
|
15018
|
+
}
|
|
15019
|
+
}
|
|
15020
|
+
if (admitted.length === 0) return null;
|
|
15021
|
+
return `${head3}${renderSummarySections(frozen)}${truncated ? noteBlock : ""}`;
|
|
15022
|
+
}
|
|
15023
|
+
var renderSummarySections = (entries) => {
|
|
15024
|
+
let rendered = "";
|
|
15025
|
+
let currentSection = null;
|
|
15026
|
+
for (const entry of entries) {
|
|
15027
|
+
if (entry.section && entry.section !== currentSection) {
|
|
15028
|
+
rendered += `
|
|
15029
|
+
## ${entry.section}`;
|
|
15030
|
+
currentSection = entry.section;
|
|
15031
|
+
}
|
|
15032
|
+
rendered += `
|
|
15033
|
+
${entry.line}`;
|
|
15034
|
+
}
|
|
15035
|
+
return rendered;
|
|
15036
|
+
};
|
|
15037
|
+
function readAgentsMdLayerFromDisk(cwd) {
|
|
15038
|
+
for (const name of AGENTS_MD_CANDIDATES) {
|
|
15039
|
+
const filePath = resolve(cwd, name);
|
|
15040
|
+
if (!existsSync(filePath)) continue;
|
|
15041
|
+
try {
|
|
15042
|
+
const raw = readFileSync(filePath, "utf8");
|
|
15043
|
+
const content = raw.trim();
|
|
15044
|
+
if (!content) continue;
|
|
15045
|
+
const totalBytes = Buffer.byteLength(raw, "utf8");
|
|
15046
|
+
const trimmedBytes = Buffer.byteLength(content, "utf8");
|
|
15047
|
+
const headerBytes = Buffer.byteLength(buildAgentsMdLayerHeader(name), "utf8");
|
|
15048
|
+
if (headerBytes + trimmedBytes <= AGENTS_MD_MAX_BYTES) {
|
|
15049
|
+
return buildAgentsMdLayer(content, name);
|
|
15050
|
+
}
|
|
15051
|
+
const summaryBody = buildAgentsMdSummaryBody(content, filePath, {
|
|
15052
|
+
// 正文预算 = 摘要上限 − 块头部:buildAgentsMdLayer 会再拼一次头部,
|
|
15053
|
+
// 因此「头部 + 正文」才等于最终注入字节,不得超过摘要上限。
|
|
15054
|
+
budgetBytes: AGENTS_MD_SUMMARY_MAX_BYTES - headerBytes,
|
|
15055
|
+
fileName: name
|
|
15056
|
+
});
|
|
15057
|
+
if (summaryBody) return buildAgentsMdLayer(summaryBody, name);
|
|
15058
|
+
const buildMarker = (omitted2, withPath) => {
|
|
15059
|
+
const pathPart = withPath ? `\u5B8C\u6574\u6587\u4EF6\uFF1A${filePath}` : `\u5B8C\u6574\u6587\u4EF6\uFF1A\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u7684 ${name}`;
|
|
15060
|
+
return `<!-- AGENTS.md truncated: \u539F\u6587\u4EF6 ${totalBytes} \u5B57\u8282\uFF0C\u6CE8\u5165\u9884\u7B97 ${AGENTS_MD_MAX_BYTES} \u5B57\u8282\uFF0C\u5DF2\u7701\u7565 ${omitted2} \u5B57\u8282\uFF08\u4E0A\u6587\u53EF\u80FD\u7F3A\u5C11\u6587\u4EF6\u672B\u5C3E\u7684 commit/review \u95E8\u7981\u7EC6\u5219\uFF0C\u63D0\u4EA4/\u8BC4\u5BA1\u524D\u8BF7\u8BFB\u5B8C\u6574\u6587\u4EF6\uFF09\u3002${pathPart} -->`;
|
|
15061
|
+
};
|
|
15062
|
+
const bodyBudget = AGENTS_MD_MAX_BYTES - AGENTS_MD_MARKER_RESERVE_BYTES - 2 - headerBytes;
|
|
15063
|
+
const body = truncateAgentsMdContent(content, bodyBudget);
|
|
15064
|
+
const bodyBytes = Buffer.byteLength(body, "utf8");
|
|
15065
|
+
const omitted = Math.max(0, totalBytes - bodyBytes);
|
|
15066
|
+
let marker = buildMarker(omitted, true);
|
|
15067
|
+
if (Buffer.byteLength(marker, "utf8") > AGENTS_MD_MARKER_RESERVE_BYTES) {
|
|
15068
|
+
marker = buildMarker(omitted, false);
|
|
15069
|
+
}
|
|
15070
|
+
return buildAgentsMdLayer(`${body}
|
|
15071
|
+
|
|
15072
|
+
${marker}`, name);
|
|
15073
|
+
} catch {
|
|
15074
|
+
}
|
|
15075
|
+
}
|
|
15076
|
+
return null;
|
|
15077
|
+
}
|
|
15078
|
+
|
|
15039
15079
|
// packages/agent-runtime/visualRenderer.node.ts
|
|
15040
15080
|
import { createRequire } from "node:module";
|
|
15041
|
-
import { existsSync } from "node:fs";
|
|
15081
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
15042
15082
|
import { realpath, stat, readFile } from "node:fs/promises";
|
|
15043
15083
|
import { isAbsolute, relative, win32 } from "node:path";
|
|
15044
15084
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -15091,7 +15131,7 @@ var VisualRenderSemaphore = class {
|
|
|
15091
15131
|
active = 0;
|
|
15092
15132
|
queue = [];
|
|
15093
15133
|
async run(task) {
|
|
15094
|
-
if (this.active >= this.limit) await new Promise((
|
|
15134
|
+
if (this.active >= this.limit) await new Promise((resolve7) => this.queue.push(resolve7));
|
|
15095
15135
|
else this.active++;
|
|
15096
15136
|
try {
|
|
15097
15137
|
return await task();
|
|
@@ -15109,7 +15149,7 @@ function visualRendererCapability() {
|
|
|
15109
15149
|
if (process.env.NOLO_VISUAL_RENDERER_DISABLED === "1") return { available: false, reasonCode: "disabled", reason: "Platform renderer disabled by NOLO_VISUAL_RENDERER_DISABLED=1 on this runtime host." };
|
|
15110
15150
|
try {
|
|
15111
15151
|
const { chromium } = require2("playwright");
|
|
15112
|
-
const executablePath = [chromium.executablePath(), resolveExecutableOnPath("google-chrome"), resolveExecutableOnPath("chromium"), resolveExecutableOnPath("chromium-browser")].find((path) => !!path &&
|
|
15152
|
+
const executablePath = [chromium.executablePath(), resolveExecutableOnPath("google-chrome"), resolveExecutableOnPath("chromium"), resolveExecutableOnPath("chromium-browser")].find((path) => !!path && existsSync2(path));
|
|
15113
15153
|
if (!executablePath) return { available: false, reasonCode: "missing-browser", reason: "No Chromium renderer installed. Install Playwright Chromium (playwright install chromium) or system Chromium/Google Chrome on the runtime host." };
|
|
15114
15154
|
return { available: true, chromium, executablePath };
|
|
15115
15155
|
} catch {
|
|
@@ -15285,7 +15325,7 @@ finally:
|
|
|
15285
15325
|
pass
|
|
15286
15326
|
bus.signal_unsubscribe(subscription)
|
|
15287
15327
|
`;
|
|
15288
|
-
var capturePortalScreenshot = (signal) => new Promise((
|
|
15328
|
+
var capturePortalScreenshot = (signal) => new Promise((resolve7, reject) => {
|
|
15289
15329
|
const child = spawn("/usr/bin/python3", ["-c", PORTAL_SCRIPT], { stdio: ["ignore", "pipe", "pipe"] });
|
|
15290
15330
|
let stdout = "";
|
|
15291
15331
|
let stderr = "";
|
|
@@ -15306,7 +15346,7 @@ var capturePortalScreenshot = (signal) => new Promise((resolve6, reject) => {
|
|
|
15306
15346
|
if (signal.aborted) return reject(new Error("portal capture timeout"));
|
|
15307
15347
|
if (code !== 0) return reject(new Error(stderr.trim() || `portal helper exited ${code}`));
|
|
15308
15348
|
try {
|
|
15309
|
-
|
|
15349
|
+
resolve7(JSON.parse(stdout));
|
|
15310
15350
|
} catch {
|
|
15311
15351
|
reject(new Error("invalid portal response"));
|
|
15312
15352
|
}
|
|
@@ -15318,7 +15358,7 @@ function createHostWindowCapture(options = {}) {
|
|
|
15318
15358
|
let active = 0;
|
|
15319
15359
|
const waiters = [];
|
|
15320
15360
|
function acquire(signal) {
|
|
15321
|
-
return new Promise((
|
|
15361
|
+
return new Promise((resolve7, reject) => {
|
|
15322
15362
|
const abort = () => {
|
|
15323
15363
|
const index = waiters.indexOf(start);
|
|
15324
15364
|
if (index >= 0) waiters.splice(index, 1);
|
|
@@ -15327,7 +15367,7 @@ function createHostWindowCapture(options = {}) {
|
|
|
15327
15367
|
const start = () => {
|
|
15328
15368
|
signal.removeEventListener("abort", abort);
|
|
15329
15369
|
active++;
|
|
15330
|
-
|
|
15370
|
+
resolve7();
|
|
15331
15371
|
};
|
|
15332
15372
|
if (signal.aborted) return abort();
|
|
15333
15373
|
if (active < concurrency) start();
|
|
@@ -15385,7 +15425,7 @@ var captureHostWindow = createHostWindowCapture();
|
|
|
15385
15425
|
// packages/agent-runtime/localWorkspaceTools.ts
|
|
15386
15426
|
import { lstat as lstat2, readdir as readdir2, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
15387
15427
|
import { homedir } from "node:os";
|
|
15388
|
-
import { dirname as dirname2, relative as relative4, resolve as
|
|
15428
|
+
import { dirname as dirname2, relative as relative4, resolve as resolve5, sep as sep2 } from "node:path";
|
|
15389
15429
|
import { spawn as spawnChildProcess2 } from "node:child_process";
|
|
15390
15430
|
|
|
15391
15431
|
// packages/agent-runtime/runResultReadProjection.ts
|
|
@@ -15468,12 +15508,12 @@ function isLineRangeCovered(request3, covered) {
|
|
|
15468
15508
|
|
|
15469
15509
|
// packages/agent-runtime/fileTextSearch.ts
|
|
15470
15510
|
import { readdir, readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
15471
|
-
import { basename as basename2, relative as relative2, resolve as
|
|
15511
|
+
import { basename as basename2, relative as relative2, resolve as resolve3 } from "node:path";
|
|
15472
15512
|
import { spawn as spawnChildProcess } from "node:child_process";
|
|
15473
15513
|
|
|
15474
15514
|
// packages/agent-runtime/gitignore.ts
|
|
15475
15515
|
import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
|
|
15476
|
-
import { resolve } from "node:path";
|
|
15516
|
+
import { resolve as resolve2 } from "node:path";
|
|
15477
15517
|
function isIgnorableFsError(err) {
|
|
15478
15518
|
if (err && typeof err === "object" && "code" in err) {
|
|
15479
15519
|
const code = err.code;
|
|
@@ -15484,7 +15524,7 @@ function isIgnorableFsError(err) {
|
|
|
15484
15524
|
async function readRootGitignorePatterns(workspaceRoot) {
|
|
15485
15525
|
let content;
|
|
15486
15526
|
try {
|
|
15487
|
-
content = await readFile2(
|
|
15527
|
+
content = await readFile2(resolve2(workspaceRoot, ".gitignore"), "utf8");
|
|
15488
15528
|
} catch (err) {
|
|
15489
15529
|
if (isIgnorableFsError(err)) return [];
|
|
15490
15530
|
throw err;
|
|
@@ -15498,7 +15538,7 @@ async function readRootGitignorePatterns(workspaceRoot) {
|
|
|
15498
15538
|
}
|
|
15499
15539
|
async function hasRootGitignore(workspaceRoot) {
|
|
15500
15540
|
try {
|
|
15501
|
-
await stat2(
|
|
15541
|
+
await stat2(resolve2(workspaceRoot, ".gitignore"));
|
|
15502
15542
|
return true;
|
|
15503
15543
|
} catch (err) {
|
|
15504
15544
|
if (isIgnorableFsError(err)) return false;
|
|
@@ -15569,7 +15609,7 @@ function parseMatches(root, output) {
|
|
|
15569
15609
|
const records = [];
|
|
15570
15610
|
const pattern = /(?:^|\n)([^\0\n]+)\0(\d+):(.*?)(?=\n[^\0\n]+\0|$)/gs;
|
|
15571
15611
|
for (const match7 of output.matchAll(pattern)) {
|
|
15572
|
-
records.push({ file:
|
|
15612
|
+
records.push({ file: resolve3(root, match7[1] ?? ""), line: Number(match7[2]), text: (match7[3] ?? "").replace(/\n$/, "") });
|
|
15573
15613
|
}
|
|
15574
15614
|
return records;
|
|
15575
15615
|
}
|
|
@@ -15627,7 +15667,7 @@ async function jsSearch(o, targetPath) {
|
|
|
15627
15667
|
} else {
|
|
15628
15668
|
const walk = async (dir) => {
|
|
15629
15669
|
for (const e of await readdir(dir, { withFileTypes: true })) {
|
|
15630
|
-
const f =
|
|
15670
|
+
const f = resolve3(dir, e.name), rel = pathFor(o.root, f);
|
|
15631
15671
|
if (e.isDirectory()) {
|
|
15632
15672
|
if (!excludes.some((p) => globMatch(p, rel))) await walk(f);
|
|
15633
15673
|
} else if (e.isFile() && !excludes.some((p) => globMatch(p, rel)) && !isIgnored(rel) && (!o.include || globMatch(o.include, rel))) {
|
|
@@ -15676,7 +15716,7 @@ var COMMAND_ENGINES = [
|
|
|
15676
15716
|
{ engine: "grep", binaryOption: "resolveGrepBinary", binaryName: "grep", argsKey: "grep" }
|
|
15677
15717
|
];
|
|
15678
15718
|
async function searchFileTextMatches(o) {
|
|
15679
|
-
const targetPath =
|
|
15719
|
+
const targetPath = resolve3(o.root, o.target || ".");
|
|
15680
15720
|
const targetStat = await stat3(targetPath).catch(() => null);
|
|
15681
15721
|
if (!targetStat) return { matches: [], totalMatches: 0, truncated: false, engine: "js" };
|
|
15682
15722
|
if (targetStat.isFile()) return jsSearch(o, targetPath);
|
|
@@ -15745,7 +15785,7 @@ function resolveCleanupReport(evidence, previousStatus) {
|
|
|
15745
15785
|
}
|
|
15746
15786
|
var TERMINAL_EVENT_TYPES = /* @__PURE__ */ new Set(["exited", "killed"]);
|
|
15747
15787
|
function defaultSleep(ms) {
|
|
15748
|
-
return new Promise((
|
|
15788
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
15749
15789
|
}
|
|
15750
15790
|
function defaultSignalSender(pid, signal) {
|
|
15751
15791
|
process.kill(pid, signal);
|
|
@@ -16026,7 +16066,7 @@ function buildReadWorkspaceParameters() {
|
|
|
16026
16066
|
const path = buildWorkspacePathProperty();
|
|
16027
16067
|
const lines = {
|
|
16028
16068
|
type: "string",
|
|
16029
|
-
description: 'Line slice: "40-120" (range, 1-based, inclusive), "120-" (from line to end), "-50" (tail N lines), "50" (head N lines). Omit to read
|
|
16069
|
+
description: 'Line slice: "40-120" (range, 1-based, inclusive), "120-" (from line to end), "-50" (tail N lines), "50" (head N lines). Omit to read from the start; large results return a bounded window. Continue from metadata endLine + 1.'
|
|
16030
16070
|
};
|
|
16031
16071
|
const force = {
|
|
16032
16072
|
type: "boolean",
|
|
@@ -16036,14 +16076,20 @@ function buildReadWorkspaceParameters() {
|
|
|
16036
16076
|
type: "object",
|
|
16037
16077
|
properties: {
|
|
16038
16078
|
path,
|
|
16079
|
+
files: {
|
|
16080
|
+
type: "array",
|
|
16081
|
+
minItems: 1,
|
|
16082
|
+
maxItems: 8,
|
|
16083
|
+
description: "Batch of files with optional individual line ranges; mutually exclusive with path. One shared output budget applies.",
|
|
16084
|
+
items: { type: "object", properties: { path, lines, force }, required: ["path"], additionalProperties: false }
|
|
16085
|
+
},
|
|
16039
16086
|
lines,
|
|
16040
16087
|
force,
|
|
16041
16088
|
raw: {
|
|
16042
16089
|
type: "boolean",
|
|
16043
16090
|
description: "Read original bytes including full runtime acceptance observations in *.result.md. Default compacts only machine observations; report text and physical line numbers are unchanged."
|
|
16044
16091
|
}
|
|
16045
|
-
}
|
|
16046
|
-
required: ["path"]
|
|
16092
|
+
}
|
|
16047
16093
|
};
|
|
16048
16094
|
}
|
|
16049
16095
|
function buildReadWorkspaceFileTool() {
|
|
@@ -16366,9 +16412,9 @@ function filterDeclaredWorkspaceToolNames(args2) {
|
|
|
16366
16412
|
// packages/agent-runtime/workspacePathGuard.ts
|
|
16367
16413
|
import { constants as fsConstants } from "node:fs";
|
|
16368
16414
|
import { lstat, mkdir, open, readlink, realpath as realpath2 } from "node:fs/promises";
|
|
16369
|
-
import { basename as basename3, dirname, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as
|
|
16415
|
+
import { basename as basename3, dirname, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as resolve4, sep } from "node:path";
|
|
16370
16416
|
function isPathInsideRoot(root, targetPath) {
|
|
16371
|
-
const rel = relative3(
|
|
16417
|
+
const rel = relative3(resolve4(root), resolve4(targetPath));
|
|
16372
16418
|
return rel === "" || rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute2(rel);
|
|
16373
16419
|
}
|
|
16374
16420
|
function isNotFoundError(error) {
|
|
@@ -16377,7 +16423,7 @@ function isNotFoundError(error) {
|
|
|
16377
16423
|
}
|
|
16378
16424
|
async function realpathAllowMissing(targetPath) {
|
|
16379
16425
|
const tail = [];
|
|
16380
|
-
let current =
|
|
16426
|
+
let current = resolve4(targetPath);
|
|
16381
16427
|
for (; ; ) {
|
|
16382
16428
|
try {
|
|
16383
16429
|
const real = await realpath2(current);
|
|
@@ -16396,8 +16442,8 @@ async function realpathAllowMissing(targetPath) {
|
|
|
16396
16442
|
}
|
|
16397
16443
|
async function resolveWorkspaceSafePath(args2) {
|
|
16398
16444
|
const requested = args2.requestedPath ?? args2.targetPath;
|
|
16399
|
-
const lexicalRoot =
|
|
16400
|
-
const targetPath =
|
|
16445
|
+
const lexicalRoot = resolve4(args2.workspaceRoot);
|
|
16446
|
+
const targetPath = resolve4(args2.targetPath);
|
|
16401
16447
|
const lexicalInside = args2.lexicalInside ?? isPathInsideRoot(lexicalRoot, targetPath);
|
|
16402
16448
|
const [physicalRoot, resolved] = await Promise.all([
|
|
16403
16449
|
realpath2(lexicalRoot).catch(() => null),
|
|
@@ -16553,7 +16599,7 @@ async function openPinnedDirectory(dirPath, guard) {
|
|
|
16553
16599
|
}
|
|
16554
16600
|
async function createMissingDirectoryChain(guard) {
|
|
16555
16601
|
const missing = [];
|
|
16556
|
-
let existing =
|
|
16602
|
+
let existing = resolve4(guard.path);
|
|
16557
16603
|
for (; ; ) {
|
|
16558
16604
|
try {
|
|
16559
16605
|
await lstat(existing);
|
|
@@ -16815,7 +16861,6 @@ function readExpectedReplacementCount(args2) {
|
|
|
16815
16861
|
}
|
|
16816
16862
|
return value;
|
|
16817
16863
|
}
|
|
16818
|
-
var READ_FILE_SLICE_FALLBACK_LINES = 200;
|
|
16819
16864
|
function isAbsentArg(value) {
|
|
16820
16865
|
return value === void 0 || value === null;
|
|
16821
16866
|
}
|
|
@@ -16887,17 +16932,9 @@ function parseLinesArg(value) {
|
|
|
16887
16932
|
return { slice: { startLine, endLine } };
|
|
16888
16933
|
}
|
|
16889
16934
|
function readFileSliceArgs(args2) {
|
|
16890
|
-
|
|
16891
|
-
const withFallback = (slice2, invalidLines) => {
|
|
16892
|
-
warnings.push(
|
|
16893
|
-
`No usable line range remained; returned the first ${READ_FILE_SLICE_FALLBACK_LINES} lines instead of the whole file.`
|
|
16894
|
-
);
|
|
16895
|
-
return { ...slice2, maxLines: READ_FILE_SLICE_FALLBACK_LINES, warnings, invalidLines };
|
|
16896
|
-
};
|
|
16897
|
-
if (isAbsentArg(args2.lines)) return { warnings, invalidLines: void 0 };
|
|
16935
|
+
if (isAbsentArg(args2.lines) || args2.lines === "") return {};
|
|
16898
16936
|
const { slice, warning } = parseLinesArg(args2.lines);
|
|
16899
|
-
|
|
16900
|
-
return slice ? { ...slice, warnings, invalidLines: void 0 } : withFallback({}, describeRejectedArgValue(args2.lines));
|
|
16937
|
+
return slice ? { slice } : { error: clipMarkerValue(warning ?? "Invalid line range", 240) };
|
|
16901
16938
|
}
|
|
16902
16939
|
function buildReadFileSliceHint(totalLines) {
|
|
16903
16940
|
return `File has ${totalLines} lines. Use lines: ${LINES_ARG_SYNTAX}, or omit it for the whole file.`;
|
|
@@ -17040,7 +17077,7 @@ function resolveRipgrepBinary(env = process.env) {
|
|
|
17040
17077
|
const fromEnv = asOptionalTrimmedString(env.NOLO_BUNDLED_RG);
|
|
17041
17078
|
if (fromEnv) {
|
|
17042
17079
|
try {
|
|
17043
|
-
if (
|
|
17080
|
+
if (existsSync3(fromEnv)) return fromEnv;
|
|
17044
17081
|
} catch {
|
|
17045
17082
|
}
|
|
17046
17083
|
}
|
|
@@ -17061,14 +17098,14 @@ async function resolveRuntimeOwnedSpillPath(targetPath) {
|
|
|
17061
17098
|
}
|
|
17062
17099
|
function expandHomePath(requestedPath) {
|
|
17063
17100
|
if (requestedPath === "~") return homedir();
|
|
17064
|
-
if (requestedPath.startsWith("~/")) return
|
|
17101
|
+
if (requestedPath.startsWith("~/")) return resolve5(homedir(), requestedPath.slice(2));
|
|
17065
17102
|
return requestedPath;
|
|
17066
17103
|
}
|
|
17067
17104
|
function resolveRequestedWorkspacePath(workspaceRoot, requestedPath) {
|
|
17068
|
-
return
|
|
17105
|
+
return resolve5(resolve5(workspaceRoot), expandHomePath(requestedPath));
|
|
17069
17106
|
}
|
|
17070
17107
|
async function resolveLocalWorkspaceToolApproval(args2) {
|
|
17071
|
-
const workspaceRoot =
|
|
17108
|
+
const workspaceRoot = resolve5(args2.workspaceRoot);
|
|
17072
17109
|
const targetPath = resolveRequestedWorkspacePath(workspaceRoot, args2.requestedPath);
|
|
17073
17110
|
const insideWorkspace = isPathInsideWorkspace({ workspaceRoot, targetPath });
|
|
17074
17111
|
const guard = await resolveWorkspaceSafePath({
|
|
@@ -17165,8 +17202,63 @@ var READ_FILE_LEDGER_MAX_RECORDS = 64;
|
|
|
17165
17202
|
var READ_FILE_LEDGER_MAX_KEYS = 256;
|
|
17166
17203
|
async function readFileTool(args2) {
|
|
17167
17204
|
const parsed = parseWorkspaceToolArguments(args2.call.arguments);
|
|
17205
|
+
if (parsed.files !== void 0 && !args2.batchItem) {
|
|
17206
|
+
if (!Array.isArray(parsed.files) || parsed.files.length < 1 || parsed.files.length > 8 || pickFirstAlias(parsed, PATH_FIELD_ALIASES) !== void 0) {
|
|
17207
|
+
return { content: "[readFile] Supply either path or files (1\u20138 items), not both.", metadata: { status: "invalid-arguments" } };
|
|
17208
|
+
}
|
|
17209
|
+
if (parsed.files.some((file) => !file || typeof file !== "object" || typeof file.path !== "string" || !file.path || file.path.length > 512 || file.lines !== void 0 && typeof file.lines !== "string")) {
|
|
17210
|
+
return { content: "[readFile] Each batch item requires a path (maximum 512 characters) and optional string lines.", metadata: { status: "invalid-arguments" } };
|
|
17211
|
+
}
|
|
17212
|
+
const items = parsed.files.map((item) => ({ path: item.path, status: "not-delivered" }));
|
|
17213
|
+
const budget = resolveHistoricalToolContentCap("readFile", 0);
|
|
17214
|
+
const batchStartLedger = args2.readLedger ? new Map([...args2.readLedger].map(([key, entry2]) => [key, { ...entry2, records: [...entry2.records] }])) : void 0;
|
|
17215
|
+
for (let i = 0; i < parsed.files.length; i++) {
|
|
17216
|
+
const file = parsed.files[i];
|
|
17217
|
+
if (!file || typeof file !== "object" || typeof file.path !== "string" || !file.path || file.lines !== void 0 && typeof file.lines !== "string") {
|
|
17218
|
+
items[i] = { ...items[i], status: "invalid-arguments" };
|
|
17219
|
+
continue;
|
|
17220
|
+
}
|
|
17221
|
+
const trialLedger = args2.readLedger ? new Map([...args2.readLedger].map(([key, entry2]) => [key, { ...entry2, records: [...entry2.records] }])) : void 0;
|
|
17222
|
+
try {
|
|
17223
|
+
const result4 = await readFileTool({ ...args2, batchItem: true, readLedger: trialLedger, call: { ...args2.call, arguments: JSON.stringify(file) } });
|
|
17224
|
+
const metadata2 = result4.metadata ?? {};
|
|
17225
|
+
const candidate = { path: file.path, status: metadata2.deduped ? "already-delivered" : metadata2.status === "invalid-arguments" ? "invalid-arguments" : metadata2.truncatedByCharLimit || metadata2.partialLine ? "partial" : "complete", content: result4.content, ...metadata2 };
|
|
17226
|
+
const previous = items[i];
|
|
17227
|
+
items[i] = candidate;
|
|
17228
|
+
const formatted = formatToolMessageContent({ toolName: "readFile", content: JSON.stringify(items), metadata: { batch: true, items: items.map(({ path, status, startLine, endLine }) => ({ path, status, startLine, endLine })) } });
|
|
17229
|
+
if (formatted.length > budget) {
|
|
17230
|
+
items[i] = previous;
|
|
17231
|
+
continue;
|
|
17232
|
+
}
|
|
17233
|
+
if (args2.readLedger && trialLedger) {
|
|
17234
|
+
args2.readLedger.clear();
|
|
17235
|
+
for (const [key, value] of trialLedger) args2.readLedger.set(key, value);
|
|
17236
|
+
}
|
|
17237
|
+
} catch {
|
|
17238
|
+
items[i] = { path: file.path, status: "error" };
|
|
17239
|
+
}
|
|
17240
|
+
}
|
|
17241
|
+
const batchContent = JSON.stringify(items);
|
|
17242
|
+
const batchMetadata = { batch: true, items: items.map(({ path, status, startLine, endLine }) => ({ path, status, startLine, endLine })) };
|
|
17243
|
+
if (formatToolMessageContent({ toolName: "readFile", content: batchContent, metadata: batchMetadata }).length > budget) {
|
|
17244
|
+
if (args2.readLedger && batchStartLedger) {
|
|
17245
|
+
args2.readLedger.clear();
|
|
17246
|
+
for (const [key, value] of batchStartLedger) args2.readLedger.set(key, value);
|
|
17247
|
+
}
|
|
17248
|
+
return { content: "[readFile] Batch request exceeds the shared delivery budget; no content delivered. Use fewer or shorter paths.", metadata: { status: "batch-limit-exceeded" } };
|
|
17249
|
+
}
|
|
17250
|
+
return { content: batchContent, metadata: batchMetadata };
|
|
17251
|
+
}
|
|
17168
17252
|
const requestedPath = requireWorkspaceToolPath(parsed);
|
|
17169
|
-
const
|
|
17253
|
+
const parsedSlice = readFileSliceArgs(parsed);
|
|
17254
|
+
if (parsedSlice.error) {
|
|
17255
|
+
return {
|
|
17256
|
+
content: `[readFile] Invalid lines: ${parsedSlice.error} No file content was read. Use lines: ${LINES_ARG_SYNTAX}, or omit lines.`,
|
|
17257
|
+
metadata: { status: "invalid-arguments", tool: "readFile" }
|
|
17258
|
+
};
|
|
17259
|
+
}
|
|
17260
|
+
const sliceArgs = parsedSlice.slice ?? {};
|
|
17261
|
+
const warnings = [];
|
|
17170
17262
|
const approval = await resolveLocalWorkspaceToolApproval({
|
|
17171
17263
|
workspaceRoot: args2.workspaceRoot,
|
|
17172
17264
|
requestedPath,
|
|
@@ -17182,45 +17274,101 @@ async function readFileTool(args2) {
|
|
|
17182
17274
|
content,
|
|
17183
17275
|
...sliceArgs
|
|
17184
17276
|
});
|
|
17185
|
-
const truncatedRead = defensivelyTruncateReadFile({
|
|
17186
|
-
content: sliced.content,
|
|
17187
|
-
totalLines: sliced.totalLines
|
|
17188
|
-
});
|
|
17189
|
-
const invalidLinesMarker = invalidLines !== void 0 ? `[readFile] lines=${clipMarkerValue(invalidLines)} was rejected (only ONE range: ${LINES_ARG_SYNTAX}); returned lines ${sliced.startLine}-${sliced.endLine} instead. Fix the argument before relying on this window.
|
|
17190
|
-
` : "";
|
|
17191
|
-
const finalRead = invalidLinesMarker.length > 0 ? defensivelyTruncateReadFile({
|
|
17192
|
-
content: truncatedRead.content,
|
|
17193
|
-
totalLines: sliced.totalLines,
|
|
17194
|
-
limit: Math.max(1, READ_FILE_MAX_CHAR_LIMIT - invalidLinesMarker.length)
|
|
17195
|
-
}) : truncatedRead;
|
|
17196
|
-
const finalContent = invalidLinesMarker + finalRead.content;
|
|
17197
|
-
const truncatedByCharLimit = truncatedRead.truncatedByCharLimit || finalRead.truncatedByCharLimit;
|
|
17198
|
-
const isTruncated = sliced.truncated || truncatedByCharLimit;
|
|
17199
17277
|
const relativePath = normalizeWorkspaceRelativePath({
|
|
17200
|
-
workspaceRoot:
|
|
17278
|
+
workspaceRoot: resolve5(args2.workspaceRoot),
|
|
17201
17279
|
targetPath: absolutePath
|
|
17202
17280
|
});
|
|
17281
|
+
const instructionPath = AGENTS_MD_CANDIDATES.some((name) => absolutePath === resolve5(args2.workspaceRoot, name));
|
|
17282
|
+
const instructionLimit = PROJECT_INSTRUCTION_MAX_BYTES;
|
|
17283
|
+
const instructionOversized = Buffer.byteLength(content) > instructionLimit || countLines(content) > TOOL_OUTPUT_SPILL_LINES;
|
|
17284
|
+
const instruction = !args2.batchItem && instructionPath && !instructionOversized;
|
|
17285
|
+
if (!args2.batchItem && instructionPath && instructionOversized && Object.keys(sliceArgs).length === 0) {
|
|
17286
|
+
return {
|
|
17287
|
+
content: `[readFile] Project instruction exceeds the delivery limit (${instructionLimit} bytes or ${TOOL_OUTPUT_SPILL_LINES} lines); no content delivered. Continue with lines="1-" to inspect the first bounded range.`,
|
|
17288
|
+
metadata: { path: relativePath, status: "instruction-limit-exceeded", truncated: true, totalBytes: Buffer.byteLength(originalContent) }
|
|
17289
|
+
};
|
|
17290
|
+
}
|
|
17291
|
+
const cap = instruction ? PROJECT_INSTRUCTION_MAX_CHARS : resolveHistoricalToolContentCap("readFile", 0);
|
|
17292
|
+
const selectedLines = splitTextLines(sliced.content);
|
|
17293
|
+
const makeMetadata = (body, endLine, windowed2, partialLine) => ({
|
|
17294
|
+
path: relativePath,
|
|
17295
|
+
...instruction ? { projectInstruction: true } : {},
|
|
17296
|
+
bytes: Buffer.byteLength(body),
|
|
17297
|
+
totalBytes: Buffer.byteLength(originalContent),
|
|
17298
|
+
...projection.projected ? {
|
|
17299
|
+
projection: "run-result-observations",
|
|
17300
|
+
projectedTotalBytes: Buffer.byteLength(content),
|
|
17301
|
+
rawReadHint: "readFile raw:true reads original evidence; line numbers are unchanged."
|
|
17302
|
+
} : {},
|
|
17303
|
+
startLine: sliced.startLine,
|
|
17304
|
+
...partialLine ? { partialLine: true } : { endLine },
|
|
17305
|
+
totalLines: sliced.totalLines,
|
|
17306
|
+
truncated: sliced.truncated || windowed2,
|
|
17307
|
+
...scrubSecrets(sanitizeToolOutputText(body)).cleaned !== body ? { contentSanitized: true } : {},
|
|
17308
|
+
...windowed2 ? { truncatedByByteLimit: true, truncatedByCharLimit: true } : {},
|
|
17309
|
+
...sliceArgs.maxLines ? { maxLines: sliceArgs.maxLines } : {},
|
|
17310
|
+
...sliceArgs.tailLines ? { tailLines: sliceArgs.tailLines } : {},
|
|
17311
|
+
...activity ? { activity } : {}
|
|
17312
|
+
});
|
|
17313
|
+
const fits = (body, endLine, windowed2) => {
|
|
17314
|
+
if (Buffer.byteLength(body) > TOOL_OUTPUT_SPILL_BYTES || countLines(body) > TOOL_OUTPUT_SPILL_LINES) return false;
|
|
17315
|
+
const metadata2 = makeMetadata(body, endLine, windowed2, false);
|
|
17316
|
+
return formatToolMessageContent({ toolName: "readFile", content: body, metadata: metadata2 }).length <= cap;
|
|
17317
|
+
};
|
|
17318
|
+
let deliveredCount = selectedLines.length;
|
|
17319
|
+
let finalContent = sliced.content;
|
|
17320
|
+
let windowed = false;
|
|
17321
|
+
if (!fits(finalContent, sliced.endLine, false)) {
|
|
17322
|
+
let low = 0;
|
|
17323
|
+
let high = selectedLines.length;
|
|
17324
|
+
while (low < high) {
|
|
17325
|
+
const mid = Math.ceil((low + high) / 2);
|
|
17326
|
+
const candidate = selectedLines.slice(0, mid).join("\n");
|
|
17327
|
+
if (fits(candidate, sliced.startLine + mid - 1, true)) low = mid;
|
|
17328
|
+
else high = mid - 1;
|
|
17329
|
+
}
|
|
17330
|
+
deliveredCount = low;
|
|
17331
|
+
windowed = true;
|
|
17332
|
+
finalContent = selectedLines.slice(0, deliveredCount).join("\n");
|
|
17333
|
+
}
|
|
17334
|
+
const oversizedLine = windowed && deliveredCount === 0;
|
|
17335
|
+
if (oversizedLine) {
|
|
17336
|
+
let low = 0;
|
|
17337
|
+
let high = Math.min(sliced.content.length, cap);
|
|
17338
|
+
while (low < high) {
|
|
17339
|
+
const mid = Math.ceil((low + high) / 2);
|
|
17340
|
+
const candidate = defensivelyTruncateReadFile({ content: sliced.content, totalLines: sliced.totalLines, limit: mid }).content;
|
|
17341
|
+
const metadata2 = makeMetadata(candidate, sliced.startLine, true, true);
|
|
17342
|
+
const fitsPreview = Buffer.byteLength(candidate) <= TOOL_OUTPUT_SPILL_BYTES && countLines(candidate) <= TOOL_OUTPUT_SPILL_LINES && formatToolMessageContent({ toolName: "readFile", content: candidate, metadata: metadata2 }).length <= cap;
|
|
17343
|
+
if (fitsPreview) low = mid;
|
|
17344
|
+
else high = mid - 1;
|
|
17345
|
+
}
|
|
17346
|
+
finalContent = low > 0 ? defensivelyTruncateReadFile({ content: sliced.content, totalLines: sliced.totalLines, limit: low }).content : "[readFile] Line exceeds the delivery budget; use codeSearch or another tool to inspect it.";
|
|
17347
|
+
}
|
|
17348
|
+
const deliveredEndLine = windowed && !oversizedLine ? sliced.startLine + deliveredCount - 1 : sliced.endLine;
|
|
17349
|
+
const metadata = makeMetadata(finalContent, deliveredEndLine, windowed, oversizedLine);
|
|
17203
17350
|
const force = parsed.force === true;
|
|
17204
17351
|
const ledger = args2.readLedger;
|
|
17205
|
-
const
|
|
17352
|
+
const deliveredRange = { startLine: sliced.startLine, endLine: deliveredEndLine };
|
|
17206
17353
|
const fingerprint = createHash3("sha1").update(originalContent).update(parsed.raw === true ? "\0raw" : "\0default").digest("hex").slice(0, 20);
|
|
17207
17354
|
let entry = ledger?.get(relativePath);
|
|
17208
17355
|
if (entry && entry.fingerprint !== fingerprint) {
|
|
17209
17356
|
entry = void 0;
|
|
17210
17357
|
ledger?.delete(relativePath);
|
|
17211
17358
|
}
|
|
17212
|
-
if (!force && entry && ledger) {
|
|
17213
|
-
const retainedCap = resolveHistoricalToolContentCap("readFile", 0);
|
|
17359
|
+
if (!force && entry && ledger && !oversizedLine) {
|
|
17360
|
+
const retainedCap = instructionPath && !instructionOversized ? PROJECT_INSTRUCTION_MAX_CHARS : resolveHistoricalToolContentCap("readFile", 0);
|
|
17214
17361
|
const retained = filterRetainedLedgerRecords(entry.records, retainedCap);
|
|
17215
|
-
if (retained.length > 0 && isLineRangeCovered(
|
|
17362
|
+
if (retained.length > 0 && isLineRangeCovered(deliveredRange, retained)) {
|
|
17216
17363
|
ledger.delete(relativePath);
|
|
17217
17364
|
ledger.set(relativePath, entry);
|
|
17218
17365
|
return {
|
|
17219
|
-
content: `[readFile] ${relativePath} lines ${
|
|
17366
|
+
content: `[readFile] ${relativePath} lines ${deliveredRange.startLine}-${deliveredRange.endLine} were already delivered earlier and the file is unchanged; not resending. Pass force:true to refetch.` + (windowed ? ` Continue with lines=${deliveredEndLine + 1}-.` : ""),
|
|
17220
17367
|
metadata: {
|
|
17221
17368
|
path: relativePath,
|
|
17222
|
-
startLine:
|
|
17223
|
-
endLine:
|
|
17369
|
+
startLine: deliveredRange.startLine,
|
|
17370
|
+
endLine: deliveredRange.endLine,
|
|
17371
|
+
...windowed ? { truncated: true } : {},
|
|
17224
17372
|
totalLines: sliced.totalLines,
|
|
17225
17373
|
deduped: true,
|
|
17226
17374
|
...warnings.length ? { warnings: [...warnings, buildReadFileSliceHint(sliced.totalLines)] } : {},
|
|
@@ -17229,29 +17377,10 @@ async function readFileTool(args2) {
|
|
|
17229
17377
|
};
|
|
17230
17378
|
}
|
|
17231
17379
|
}
|
|
17232
|
-
|
|
17233
|
-
|
|
17234
|
-
bytes: Buffer.byteLength(finalContent),
|
|
17235
|
-
totalBytes: Buffer.byteLength(originalContent),
|
|
17236
|
-
...projection.projected ? {
|
|
17237
|
-
projection: "run-result-observations",
|
|
17238
|
-
projectedTotalBytes: Buffer.byteLength(content),
|
|
17239
|
-
rawReadHint: "readFile raw:true reads original evidence; line numbers are unchanged."
|
|
17240
|
-
} : {},
|
|
17241
|
-
startLine: sliced.startLine,
|
|
17242
|
-
endLine: sliced.endLine,
|
|
17243
|
-
totalLines: sliced.totalLines,
|
|
17244
|
-
truncated: isTruncated,
|
|
17245
|
-
...truncatedByCharLimit ? { truncatedByByteLimit: true, truncatedByCharLimit: true } : {},
|
|
17246
|
-
...sliceArgs.maxLines ? { maxLines: sliceArgs.maxLines } : {},
|
|
17247
|
-
...sliceArgs.tailLines ? { tailLines: sliceArgs.tailLines } : {},
|
|
17248
|
-
...warnings.length ? { warnings: [...warnings, buildReadFileSliceHint(sliced.totalLines)] } : {},
|
|
17249
|
-
...activity ? { activity } : {}
|
|
17250
|
-
};
|
|
17251
|
-
if (!isTruncated && ledger) {
|
|
17252
|
-
const persistedChars = finalContent.length + "\n\n[tool metadata]\n".length + JSON.stringify(metadata).length;
|
|
17380
|
+
if (!oversizedLine && ledger) {
|
|
17381
|
+
const persistedChars = formatToolMessageContent({ toolName: "readFile", content: finalContent, metadata }).length;
|
|
17253
17382
|
const records = entry?.records ?? [];
|
|
17254
|
-
records.push({ ...
|
|
17383
|
+
records.push({ ...deliveredRange, chars: persistedChars });
|
|
17255
17384
|
ledger.delete(relativePath);
|
|
17256
17385
|
ledger.set(relativePath, {
|
|
17257
17386
|
fingerprint,
|
|
@@ -17287,7 +17416,7 @@ async function writeFileTool(args2) {
|
|
|
17287
17416
|
await ensureGuardedParentDirectory({ workspaceRoot: args2.workspaceRoot, fileApproval: approval });
|
|
17288
17417
|
await writeGuardApprovedFile(approval, content);
|
|
17289
17418
|
const relativePath = normalizeWorkspaceRelativePath({
|
|
17290
|
-
workspaceRoot:
|
|
17419
|
+
workspaceRoot: resolve5(args2.workspaceRoot),
|
|
17291
17420
|
targetPath: absolutePath
|
|
17292
17421
|
});
|
|
17293
17422
|
const activity = extractActivity(parsed);
|
|
@@ -17410,7 +17539,7 @@ ${hint}` : "")
|
|
|
17410
17539
|
}
|
|
17411
17540
|
await writeGuardApprovedFile(approval, nextContent);
|
|
17412
17541
|
const relativePath = normalizeWorkspaceRelativePath({
|
|
17413
|
-
workspaceRoot:
|
|
17542
|
+
workspaceRoot: resolve5(args2.workspaceRoot),
|
|
17414
17543
|
targetPath: absolutePath
|
|
17415
17544
|
});
|
|
17416
17545
|
const activity = extractActivity(parsed);
|
|
@@ -17450,7 +17579,7 @@ async function listWorkspaceEntries(args2) {
|
|
|
17450
17579
|
const names = (await readdir2(dirPath)).sort((left, right) => left.localeCompare(right));
|
|
17451
17580
|
for (const name of names) {
|
|
17452
17581
|
if (truncated) break;
|
|
17453
|
-
const absolutePath =
|
|
17582
|
+
const absolutePath = resolve5(dirPath, name);
|
|
17454
17583
|
const info = await stat4(absolutePath);
|
|
17455
17584
|
const relativePath = relative4(args2.dirPath, absolutePath) || ".";
|
|
17456
17585
|
const isDirectory = info.isDirectory();
|
|
@@ -17479,7 +17608,7 @@ async function internalSearchWorkspace(args2) {
|
|
|
17479
17608
|
allowRuntimeOwnedSpill: true,
|
|
17480
17609
|
...args2.confirmExternalFileAccess ? { confirmExternalFileAccess: args2.confirmExternalFileAccess } : {}
|
|
17481
17610
|
});
|
|
17482
|
-
const workspaceRoot =
|
|
17611
|
+
const workspaceRoot = resolve5(args2.workspaceRoot);
|
|
17483
17612
|
const inside = isPathInsideWorkspace({ workspaceRoot, targetPath: searchPath });
|
|
17484
17613
|
const result4 = await searchFileTextMatches({
|
|
17485
17614
|
root: inside ? workspaceRoot : searchPath,
|
|
@@ -17559,7 +17688,7 @@ async function globFilesTool(args2) {
|
|
|
17559
17688
|
...args2.confirmExternalFileAccess ? { confirmExternalFileAccess: args2.confirmExternalFileAccess } : {}
|
|
17560
17689
|
});
|
|
17561
17690
|
const relativeSearchPath = normalizeWorkspaceRelativePath({
|
|
17562
|
-
workspaceRoot:
|
|
17691
|
+
workspaceRoot: resolve5(args2.workspaceRoot),
|
|
17563
17692
|
targetPath: searchPath
|
|
17564
17693
|
});
|
|
17565
17694
|
const pathPrefix = relativeSearchPath === "." ? "" : `${relativeSearchPath.replace(/\/+$/, "")}/`;
|
|
@@ -17856,7 +17985,7 @@ async function launchProcessTool(args2) {
|
|
|
17856
17985
|
];
|
|
17857
17986
|
const detached = process.platform !== "win32";
|
|
17858
17987
|
const proc = spawnChildProcess2(cmdArgs[0] ?? "", cmdArgs.slice(1), {
|
|
17859
|
-
cwd:
|
|
17988
|
+
cwd: resolve5(args2.workspaceRoot),
|
|
17860
17989
|
stdio: ["ignore", "pipe", "pipe"],
|
|
17861
17990
|
detached,
|
|
17862
17991
|
windowsHide: true
|
|
@@ -18180,12 +18309,12 @@ function createLocalWorkspaceToolExecutors(args2) {
|
|
|
18180
18309
|
images: results2.flatMap((result4) => result4.images ?? [])
|
|
18181
18310
|
};
|
|
18182
18311
|
},
|
|
18183
|
-
readFile: (call) => readFileTool({
|
|
18312
|
+
readFile: Object.assign((call) => readFileTool({
|
|
18184
18313
|
call,
|
|
18185
18314
|
workspaceRoot: args2.workspaceRoot,
|
|
18186
18315
|
...readFileLedger ? { readLedger: readFileLedger } : {},
|
|
18187
18316
|
...fileAccess
|
|
18188
|
-
}),
|
|
18317
|
+
}), { resetReadLedger: () => readFileLedger?.clear() }),
|
|
18189
18318
|
writeFile: (call) => writeFileTool({
|
|
18190
18319
|
call,
|
|
18191
18320
|
workspaceRoot: args2.workspaceRoot,
|
|
@@ -19185,42 +19314,7 @@ function createTurnUsageLedger(args2) {
|
|
|
19185
19314
|
}
|
|
19186
19315
|
|
|
19187
19316
|
// packages/agent-runtime/leafFinalHandoff.ts
|
|
19188
|
-
var LEAF_FINAL_HANDOFF_INSTRUCTIONS = `Leaf subtask final: return only the result, blockers/findings, and minimal evidence the parent needs. Do not narrate your process or restate the task. Keep success
|
|
19189
|
-
|
|
19190
|
-
// packages/agent-runtime/taskExecutionContract.ts
|
|
19191
|
-
var present = (value) => typeof value === "string" && value.trim().length > 0;
|
|
19192
|
-
function evaluateTaskExecutionContract(contract, outcome = {}) {
|
|
19193
|
-
if (!contract) return void 0;
|
|
19194
|
-
const result4 = (status, ...reasons) => ({ taskId: contract.taskId, status, reasons });
|
|
19195
|
-
if (outcome.stopped) return result4("blocked", "stopped");
|
|
19196
|
-
if (!present(contract.taskId) || !["owner", "implementation-leaf"].includes(contract.role) || !["active", "paused", "revoked"].includes(contract.authorization) || !["pending", "waived", "accepted", "unknown"].includes(contract.acceptance) || !["complete", "incomplete", "unknown"].includes(contract.implementation) || !["changed", "unchanged", "unknown"].includes(contract.changes)) {
|
|
19197
|
-
return result4("blocked", "invalid_contract");
|
|
19198
|
-
}
|
|
19199
|
-
if (contract.authorization === "revoked") return result4("blocked", "authorization_revoked");
|
|
19200
|
-
if (contract.authorization === "paused") return result4("blocked", "authorization_paused");
|
|
19201
|
-
if (outcome.executionFailed) return result4("blocked", "execution_failed");
|
|
19202
|
-
if (outcome.budgetExhausted) return result4("incomplete", "budget_exhausted");
|
|
19203
|
-
if (contract.implementation !== "complete") return result4("incomplete", "implementation_incomplete");
|
|
19204
|
-
if (contract.acceptance === "pending") return result4("waiting", "acceptance_pending");
|
|
19205
|
-
if (contract.acceptance === "unknown") return result4("blocked", "acceptance_unknown");
|
|
19206
|
-
if (contract.changes === "unknown") return result4("incomplete", "changes_unknown");
|
|
19207
|
-
if (contract.role === "implementation-leaf" || contract.changes === "unchanged") return result4("completed");
|
|
19208
|
-
if (!present(contract.revision)) return result4("incomplete", "revision_missing");
|
|
19209
|
-
const review = contract.review;
|
|
19210
|
-
if (!review || !present(review.evidenceRef)) return result4("incomplete", "review_missing");
|
|
19211
|
-
if (review.revision !== contract.revision) return result4("incomplete", "review_stale");
|
|
19212
|
-
if (!present(contract.authorInstanceId) || !present(review.reviewerInstanceId) || review.reviewerInstanceId === contract.authorInstanceId) return result4("blocked", "review_not_independent");
|
|
19213
|
-
if (review.verdict !== "APPROVE" || review.hasCriticalOrHigh !== false) return result4("blocked", "review_rejected");
|
|
19214
|
-
const commit = contract.commit;
|
|
19215
|
-
if (!commit || !present(commit.commitId) || !present(commit.evidenceRef)) return result4("incomplete", "commit_missing");
|
|
19216
|
-
if (commit.revision !== contract.revision) return result4("incomplete", "commit_stale");
|
|
19217
|
-
const merge4 = contract.localMerge;
|
|
19218
|
-
if (!merge4 || !present(merge4.targetBranch) || !present(merge4.mergeCommitId) || !present(merge4.evidenceRef)) {
|
|
19219
|
-
return result4("incomplete", "local_merge_missing");
|
|
19220
|
-
}
|
|
19221
|
-
if (merge4.sourceCommitId !== commit.commitId) return result4("incomplete", "local_merge_mismatch");
|
|
19222
|
-
return result4("completed");
|
|
19223
|
-
}
|
|
19317
|
+
var LEAF_FINAL_HANDOFF_INSTRUCTIONS = `Leaf subtask final: return only the result, blockers/findings, and minimal evidence the parent needs. Do not narrate your process or restate the task. Keep success concise without dropping the current delivery scope, unresolved blockers or evidence references; on failure include the blocker, severity when relevant, and an evidence reference (file:line, test command, commit, artifact, or run/dialog). If the task explicitly requires a long-form deliverable (document, translation, dataset, code, or other artifact), provide that deliverable in full and keep only the handoff around it concise. During execution, follow the brief as given: keep progress updates incremental to the brief; the final report must stand alone with the complete current delivery scope, unresolved blockers and evidence references, including on continuation; only when new evidence would materially change the goal, risk, irreversibility, or DoD should you surface it as a blocker/finding \u2014 do not silently expand scope or re-litigate the settled direction. Own investigation, implementation, related checks and failure fixes within the brief\u2019s scope and budget; leave goals and critical decisions to the parent. For required DoD checks, include the worktree, checked version (including uncommitted change scope), command, check scope, pass/fail and original-output reference; explicitly mark checks not run or evidence unavailable. Reuse valid same-version evidence; additional checks are warranted for version changes, missing/conflicting evidence or integration risk. Do not invent version metadata. Process done/exit 0 and assistant claims do not establish passing tests, user acceptance, independent review approval, integration or release; runtime acceptance is observations only and unknown remains unknown. Preserve a requested reviewer JSON/checkVerdict format; do not wrap it in another report. Keep success concise without omitting required evidence.`;
|
|
19224
19318
|
|
|
19225
19319
|
// packages/agent-runtime/contextBlockScope.ts
|
|
19226
19320
|
var isContextBlockScope = (value) => {
|
|
@@ -19283,6 +19377,16 @@ function findSummaryAnchorIndex(bridged, anchorId) {
|
|
|
19283
19377
|
const index = Number(legacy[1]);
|
|
19284
19378
|
return Number.isSafeInteger(index) && index < bridged.length ? index : -1;
|
|
19285
19379
|
}
|
|
19380
|
+
function logSummarySourceDiagnostics(phase, dialogId, history, anchor) {
|
|
19381
|
+
const sourceHash = hashSummarySourceSlice(history, anchor)?.slice(0, 16);
|
|
19382
|
+
const rows = buildSummarySourceDiagnostics(toPlanCompressionMessages(history), anchor);
|
|
19383
|
+
for (const row of rows) console.log(`[compaction-source] ${JSON.stringify({
|
|
19384
|
+
phase,
|
|
19385
|
+
dialogId,
|
|
19386
|
+
sourceHash,
|
|
19387
|
+
...row
|
|
19388
|
+
})}`);
|
|
19389
|
+
}
|
|
19286
19390
|
function hashSummarySourceSlice(history, summarizedBeforeId) {
|
|
19287
19391
|
if (!summarizedBeforeId) return void 0;
|
|
19288
19392
|
const bridged = toPlanCompressionMessages(history);
|
|
@@ -19494,6 +19598,7 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19494
19598
|
storedHashPrefix: typeof invalidStored?.sourceHash === "string" && invalidStored.sourceHash ? invalidStored.sourceHash.slice(0, 8) : null
|
|
19495
19599
|
}
|
|
19496
19600
|
);
|
|
19601
|
+
logSummarySourceDiagnostics("invalidated", dialogId, history, invalidStored?.summarizedBeforeId);
|
|
19497
19602
|
stored = null;
|
|
19498
19603
|
}
|
|
19499
19604
|
const existingSummary = typeof stored?.summary === "string" ? stored.summary : "";
|
|
@@ -19781,7 +19886,7 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19781
19886
|
primaryElapsedMs = Date.now() - compactionT0;
|
|
19782
19887
|
logCompactionTiming("provider-error", {});
|
|
19783
19888
|
emitPhase({ kind: "compaction-retry", attempt: attempt + 1, maxAttempts });
|
|
19784
|
-
await new Promise((
|
|
19889
|
+
await new Promise((resolve7, reject) => {
|
|
19785
19890
|
const signal = requestController.signal;
|
|
19786
19891
|
const cancel = () => {
|
|
19787
19892
|
clearTimeout(timer);
|
|
@@ -19790,7 +19895,7 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19790
19895
|
};
|
|
19791
19896
|
const timer = setTimeout(() => {
|
|
19792
19897
|
signal.removeEventListener("abort", cancel);
|
|
19793
|
-
|
|
19898
|
+
resolve7();
|
|
19794
19899
|
}, delayMs);
|
|
19795
19900
|
signal.addEventListener("abort", cancel, { once: true });
|
|
19796
19901
|
if (signal.aborted) cancel();
|
|
@@ -19804,16 +19909,16 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19804
19909
|
(error) => ({ kind: "provider-error", error })
|
|
19805
19910
|
);
|
|
19806
19911
|
const guards = [];
|
|
19807
|
-
if (timeoutMs) guards.push(new Promise((
|
|
19912
|
+
if (timeoutMs) guards.push(new Promise((resolve7) => {
|
|
19808
19913
|
timeoutHandle = setTimeout(() => {
|
|
19809
19914
|
requestController.abort(new DOMException("Summary deadline exceeded", "TimeoutError"));
|
|
19810
|
-
|
|
19915
|
+
resolve7({ kind: "timeout" });
|
|
19811
19916
|
}, timeoutMs);
|
|
19812
19917
|
}));
|
|
19813
|
-
if (args2.abortSignal) guards.push(new Promise((
|
|
19918
|
+
if (args2.abortSignal) guards.push(new Promise((resolve7) => {
|
|
19814
19919
|
abortListener = () => {
|
|
19815
19920
|
requestController.abort(args2.abortSignal?.reason);
|
|
19816
|
-
|
|
19921
|
+
resolve7({ kind: "aborted" });
|
|
19817
19922
|
};
|
|
19818
19923
|
args2.abortSignal?.addEventListener("abort", abortListener, { once: true });
|
|
19819
19924
|
if (args2.abortSignal?.aborted) abortListener();
|
|
@@ -19951,6 +20056,7 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19951
20056
|
)
|
|
19952
20057
|
});
|
|
19953
20058
|
saveElapsedMs = Date.now() - saveT0;
|
|
20059
|
+
logSummarySourceDiagnostics("saved", dialogId, history, bounded3.summarizedBeforeId);
|
|
19954
20060
|
console.log(formatCompactionMetricsLog(metrics));
|
|
19955
20061
|
logCompactionTiming("success", {
|
|
19956
20062
|
model: result4?.model ?? args2.model ?? null,
|
|
@@ -20517,10 +20623,6 @@ function attachUsageRecordsToError(error, usageRecords) {
|
|
|
20517
20623
|
}
|
|
20518
20624
|
async function persistFailedLocalTurn(args2) {
|
|
20519
20625
|
const errorMessage = toErrorMessage(args2.error);
|
|
20520
|
-
const businessCompletion = evaluateTaskExecutionContract(args2.input.taskExecutionContract, {
|
|
20521
|
-
stopped: args2.input.abortSignal?.aborted || args2.error instanceof Error && args2.error.code === LOCAL_TURN_ABORTED_CODE,
|
|
20522
|
-
executionFailed: true
|
|
20523
|
-
});
|
|
20524
20626
|
try {
|
|
20525
20627
|
const saved = await args2.adapter.saveTurn({
|
|
20526
20628
|
agentKey: args2.agentKey,
|
|
@@ -20531,7 +20633,6 @@ async function persistFailedLocalTurn(args2) {
|
|
|
20531
20633
|
toolCallCount: args2.toolCallCount ?? 0,
|
|
20532
20634
|
error: true,
|
|
20533
20635
|
errorMessage,
|
|
20534
|
-
...businessCompletion ? { businessCompletion } : {},
|
|
20535
20636
|
...args2.usage ? { usage: args2.usage } : {}
|
|
20536
20637
|
},
|
|
20537
20638
|
...args2.accountingUsage ? { accountingUsage: args2.accountingUsage } : {},
|
|
@@ -20821,19 +20922,23 @@ async function runLocalAgentTurn(input) {
|
|
|
20821
20922
|
summaryFallback: input.compactionSummaryFallback ?? readHostCompactionSummaryFallback(input.adapter),
|
|
20822
20923
|
boundary: observationBoundary,
|
|
20823
20924
|
getContextUsage: () => usageLedger.lastContextUsage(),
|
|
20824
|
-
getCanonicalCompactionHistory: () => [
|
|
20925
|
+
getCanonicalCompactionHistory: () => orderDialogHistory([
|
|
20825
20926
|
...canonicalHistory,
|
|
20826
20927
|
...transcript.persisted(
|
|
20827
20928
|
sanitizedPersistedInput,
|
|
20828
20929
|
input.persistedInputReference
|
|
20829
|
-
)
|
|
20830
|
-
|
|
20930
|
+
).map((message) => {
|
|
20931
|
+
const receipt = message.cliMessageId;
|
|
20932
|
+
return receipt ? { ...message, id: receipt } : message;
|
|
20933
|
+
})
|
|
20934
|
+
]),
|
|
20831
20935
|
getWorkingPrefix: () => transcript.working().slice(0, prefixCount),
|
|
20832
20936
|
onSelectedSummary: (summary) => {
|
|
20833
20937
|
selectedSummary = summary;
|
|
20834
20938
|
},
|
|
20835
20939
|
replaceWorkingView: (next) => {
|
|
20836
20940
|
transcript.replaceWorkingHistory(next);
|
|
20941
|
+
input.adapter.onWorkingHistoryReplaced?.();
|
|
20837
20942
|
summaryProjectedPhase = contextPhase("summary-projected", next);
|
|
20838
20943
|
},
|
|
20839
20944
|
contextReferenceResolver: input.adapter.host === "cli" ? input.contextReferenceResolver : void 0,
|
|
@@ -20880,6 +20985,11 @@ async function runLocalAgentTurn(input) {
|
|
|
20880
20985
|
})));
|
|
20881
20986
|
messages.splice(currentInputStart, messages.length - currentInputStart, ...sanitizedUsers);
|
|
20882
20987
|
}
|
|
20988
|
+
if (!input.userMessages?.length && input.adapter.host === "cli") {
|
|
20989
|
+
const userIndex = builtMessages.prefixCount + history.length;
|
|
20990
|
+
const id = dialogTurnUserMessageId(input.runtimeContext?.turnId, 0);
|
|
20991
|
+
if (id && messages[userIndex]?.role === "user") messages[userIndex] = { ...messages[userIndex], id };
|
|
20992
|
+
}
|
|
20883
20993
|
const acceptToolImages = createToolImageLedger();
|
|
20884
20994
|
const transcript = createTurnTranscript({
|
|
20885
20995
|
initialWorking: messages,
|
|
@@ -20929,7 +21039,8 @@ async function runLocalAgentTurn(input) {
|
|
|
20929
21039
|
transcript.push({
|
|
20930
21040
|
role: "user",
|
|
20931
21041
|
content,
|
|
20932
|
-
...message.cliMessageId ? { cliMessageId: message.cliMessageId } : {}
|
|
21042
|
+
...message.cliMessageId ? { cliMessageId: message.cliMessageId } : {},
|
|
21043
|
+
...Number.isFinite(message.cliHistoryOrder) ? { cliHistoryOrder: message.cliHistoryOrder } : {}
|
|
20933
21044
|
});
|
|
20934
21045
|
}
|
|
20935
21046
|
pendingInjectionCommits.push({ commit: entry.commit, rollback: entry.rollback, messages: entry.messages });
|
|
@@ -21525,12 +21636,6 @@ ${reasoningTailLog}
|
|
|
21525
21636
|
...result4,
|
|
21526
21637
|
stopReason: input.abortSignal?.aborted ? "aborted" : result4.error || result4.runtimeProviderFailure || result4.emptyAssistantFallbackReason ? "error" : stopReason
|
|
21527
21638
|
};
|
|
21528
|
-
delete result4.businessCompletion;
|
|
21529
|
-
const businessCompletion = evaluateTaskExecutionContract(input.taskExecutionContract, {
|
|
21530
|
-
stopped: input.abortSignal?.aborted,
|
|
21531
|
-
executionFailed: result4.error === true || !!result4.runtimeProviderFailure || !!result4.emptyAssistantFallbackReason
|
|
21532
|
-
});
|
|
21533
|
-
if (businessCompletion) result4.businessCompletion = businessCompletion;
|
|
21534
21639
|
if (!skipFinalAppend) {
|
|
21535
21640
|
const truncatedReasoningTailLog = resolveTruncatedReasoningTailLog(
|
|
21536
21641
|
result4.emptyAssistantFallbackReason,
|
|
@@ -22561,12 +22666,12 @@ function rethrowBrokerError(op, _error) {
|
|
|
22561
22666
|
}
|
|
22562
22667
|
function createDefaultSecurityRunner(securityBin = DEFAULT_SECURITY_BIN) {
|
|
22563
22668
|
return function defaultSecurityRunner(input) {
|
|
22564
|
-
return new Promise((
|
|
22669
|
+
return new Promise((resolve7) => {
|
|
22565
22670
|
let settled = false;
|
|
22566
22671
|
const finish = (result4) => {
|
|
22567
22672
|
if (settled) return;
|
|
22568
22673
|
settled = true;
|
|
22569
|
-
|
|
22674
|
+
resolve7(result4);
|
|
22570
22675
|
};
|
|
22571
22676
|
let child;
|
|
22572
22677
|
try {
|
|
@@ -22893,12 +22998,12 @@ function parseGetSecretFromStdout(stdout) {
|
|
|
22893
22998
|
return parsed.secret;
|
|
22894
22999
|
}
|
|
22895
23000
|
function spawnShell(bin, args2, stdin) {
|
|
22896
|
-
return new Promise((
|
|
23001
|
+
return new Promise((resolve7) => {
|
|
22897
23002
|
let settled = false;
|
|
22898
23003
|
const finish = (result4) => {
|
|
22899
23004
|
if (settled) return;
|
|
22900
23005
|
settled = true;
|
|
22901
|
-
|
|
23006
|
+
resolve7(result4);
|
|
22902
23007
|
};
|
|
22903
23008
|
let child;
|
|
22904
23009
|
try {
|
|
@@ -23057,14 +23162,14 @@ function brokerFailure(op) {
|
|
|
23057
23162
|
throw new Error(`credential_broker_${op}_failed`);
|
|
23058
23163
|
}
|
|
23059
23164
|
function createDefaultSecretToolRunner(secretToolBin = DEFAULT_SECRET_TOOL_BIN) {
|
|
23060
|
-
return (input) => new Promise((
|
|
23165
|
+
return (input) => new Promise((resolve7) => {
|
|
23061
23166
|
let stdout = "";
|
|
23062
23167
|
let stderr = "";
|
|
23063
23168
|
let settled = false;
|
|
23064
23169
|
const finish = (result4) => {
|
|
23065
23170
|
if (settled) return;
|
|
23066
23171
|
settled = true;
|
|
23067
|
-
|
|
23172
|
+
resolve7(result4);
|
|
23068
23173
|
};
|
|
23069
23174
|
let child;
|
|
23070
23175
|
try {
|
|
@@ -23265,6 +23370,7 @@ function dialogMessageRecordToAgentRuntimeMessage(record2) {
|
|
|
23265
23370
|
return {
|
|
23266
23371
|
...typeof record2.id === "string" ? { id: record2.id } : {},
|
|
23267
23372
|
role: record2.role,
|
|
23373
|
+
...Number.isFinite(record2.metadata?.cliHistoryOrder) ? { cliHistoryOrder: record2.metadata.cliHistoryOrder } : {},
|
|
23268
23374
|
content: record2.content ?? "",
|
|
23269
23375
|
...record2.contextReference !== void 0 ? { context_reference: record2.contextReference } : {},
|
|
23270
23376
|
...typeof record2.reasoning_content === "string" ? { reasoning_content: record2.reasoning_content } : {},
|
|
@@ -23710,11 +23816,11 @@ var E_ALREADY_LOCKED = new Error("mutex already locked");
|
|
|
23710
23816
|
var E_CANCELED = new Error("request for lock canceled");
|
|
23711
23817
|
var __awaiter$2 = function(thisArg, _arguments, P, generator) {
|
|
23712
23818
|
function adopt(value) {
|
|
23713
|
-
return value instanceof P ? value : new P(function(
|
|
23714
|
-
|
|
23819
|
+
return value instanceof P ? value : new P(function(resolve7) {
|
|
23820
|
+
resolve7(value);
|
|
23715
23821
|
});
|
|
23716
23822
|
}
|
|
23717
|
-
return new (P || (P = Promise))(function(
|
|
23823
|
+
return new (P || (P = Promise))(function(resolve7, reject) {
|
|
23718
23824
|
function fulfilled(value) {
|
|
23719
23825
|
try {
|
|
23720
23826
|
step(generator.next(value));
|
|
@@ -23730,7 +23836,7 @@ var __awaiter$2 = function(thisArg, _arguments, P, generator) {
|
|
|
23730
23836
|
}
|
|
23731
23837
|
}
|
|
23732
23838
|
function step(result4) {
|
|
23733
|
-
result4.done ?
|
|
23839
|
+
result4.done ? resolve7(result4.value) : adopt(result4.value).then(fulfilled, rejected);
|
|
23734
23840
|
}
|
|
23735
23841
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23736
23842
|
});
|
|
@@ -23745,8 +23851,8 @@ var Semaphore = class {
|
|
|
23745
23851
|
acquire(weight = 1, priority = 0) {
|
|
23746
23852
|
if (weight <= 0)
|
|
23747
23853
|
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
23748
|
-
return new Promise((
|
|
23749
|
-
const task = { resolve:
|
|
23854
|
+
return new Promise((resolve7, reject) => {
|
|
23855
|
+
const task = { resolve: resolve7, reject, weight, priority };
|
|
23750
23856
|
const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
|
|
23751
23857
|
if (i === -1 && weight <= this._value) {
|
|
23752
23858
|
this._dispatchItem(task);
|
|
@@ -23771,10 +23877,10 @@ var Semaphore = class {
|
|
|
23771
23877
|
if (this._couldLockImmediately(weight, priority)) {
|
|
23772
23878
|
return Promise.resolve();
|
|
23773
23879
|
} else {
|
|
23774
|
-
return new Promise((
|
|
23880
|
+
return new Promise((resolve7) => {
|
|
23775
23881
|
if (!this._weightedWaiters[weight - 1])
|
|
23776
23882
|
this._weightedWaiters[weight - 1] = [];
|
|
23777
|
-
insertSorted(this._weightedWaiters[weight - 1], { resolve:
|
|
23883
|
+
insertSorted(this._weightedWaiters[weight - 1], { resolve: resolve7, priority });
|
|
23778
23884
|
});
|
|
23779
23885
|
}
|
|
23780
23886
|
}
|
|
@@ -23857,11 +23963,11 @@ function findIndexFromEnd(a, predicate) {
|
|
|
23857
23963
|
}
|
|
23858
23964
|
var __awaiter$1 = function(thisArg, _arguments, P, generator) {
|
|
23859
23965
|
function adopt(value) {
|
|
23860
|
-
return value instanceof P ? value : new P(function(
|
|
23861
|
-
|
|
23966
|
+
return value instanceof P ? value : new P(function(resolve7) {
|
|
23967
|
+
resolve7(value);
|
|
23862
23968
|
});
|
|
23863
23969
|
}
|
|
23864
|
-
return new (P || (P = Promise))(function(
|
|
23970
|
+
return new (P || (P = Promise))(function(resolve7, reject) {
|
|
23865
23971
|
function fulfilled(value) {
|
|
23866
23972
|
try {
|
|
23867
23973
|
step(generator.next(value));
|
|
@@ -23877,7 +23983,7 @@ var __awaiter$1 = function(thisArg, _arguments, P, generator) {
|
|
|
23877
23983
|
}
|
|
23878
23984
|
}
|
|
23879
23985
|
function step(result4) {
|
|
23880
|
-
result4.done ?
|
|
23986
|
+
result4.done ? resolve7(result4.value) : adopt(result4.value).then(fulfilled, rejected);
|
|
23881
23987
|
}
|
|
23882
23988
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23883
23989
|
});
|
|
@@ -23968,7 +24074,7 @@ async function registerDialogOwner(args2) {
|
|
|
23968
24074
|
// packages/cli/client/localDialogRecords.ts
|
|
23969
24075
|
var localDialogMessageRecordToRuntimeMessage = dialogMessageRecordToAgentRuntimeMessage;
|
|
23970
24076
|
function buildLocalDialogWritePlan(args2) {
|
|
23971
|
-
|
|
24077
|
+
const plan = buildAgentRuntimeDialogWritePlan({
|
|
23972
24078
|
input: args2.input,
|
|
23973
24079
|
userId: args2.userId,
|
|
23974
24080
|
now: args2.now,
|
|
@@ -23980,6 +24086,21 @@ function buildLocalDialogWritePlan(args2) {
|
|
|
23980
24086
|
},
|
|
23981
24087
|
...args2.titleOverride ? { titleOverride: args2.titleOverride } : {}
|
|
23982
24088
|
});
|
|
24089
|
+
const turnId = args2.input.runtimeContext?.turnId;
|
|
24090
|
+
const captureUserMessageIds = [];
|
|
24091
|
+
if (typeof turnId === "string" && /^turn-[0-9A-HJKMNP-TV-Z]{26}$/.test(turnId)) {
|
|
24092
|
+
const messages = args2.input.messages.filter((message) => message.role !== "system");
|
|
24093
|
+
for (const [index, message] of messages.entries()) {
|
|
24094
|
+
if (message.role !== "user" || message.cliMessageId) continue;
|
|
24095
|
+
const op = plan.ops[index + 1];
|
|
24096
|
+
const id = dialogTurnUserMessageId(turnId, index);
|
|
24097
|
+
const key = `dialog-${plan.dialogId}-msg-${id}`;
|
|
24098
|
+
op.key = key;
|
|
24099
|
+
op.value = { ...op.value, id, dbKey: key };
|
|
24100
|
+
captureUserMessageIds.push(id);
|
|
24101
|
+
}
|
|
24102
|
+
}
|
|
24103
|
+
return { ...plan, captureUserMessageIds };
|
|
23983
24104
|
}
|
|
23984
24105
|
async function saveCliPendingUserMessages(args2) {
|
|
23985
24106
|
const dialogKey = `dialog-${args2.userId}-${args2.dialogId}`;
|
|
@@ -24026,7 +24147,7 @@ async function saveCliPendingUserMessages(args2) {
|
|
|
24026
24147
|
if (ops.length) await args2.store.batch(ops);
|
|
24027
24148
|
}
|
|
24028
24149
|
async function readCliPendingUserMessages(store, dialogId) {
|
|
24029
|
-
const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-
|
|
24150
|
+
const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-H3HYQRRR.js");
|
|
24030
24151
|
const rows = await readDialogMessageRecords({ store, dialogId });
|
|
24031
24152
|
const uncertain = rows.filter(({ record: record2 }) => record2.metadata?.cliBatchPhase === "requested" && !record2.metadata?.cliBatchResolution);
|
|
24032
24153
|
const recovery = uncertain.length ? {
|
|
@@ -24075,6 +24196,8 @@ async function markCliUserBatchPhase(store, dialogId, messageId, phase, messageI
|
|
|
24075
24196
|
metadata: {
|
|
24076
24197
|
...message.metadata,
|
|
24077
24198
|
queueState: "accepted",
|
|
24199
|
+
cliBatchId: messageId,
|
|
24200
|
+
...Number.isFinite(prepared?.cliHistoryOrder) ? { cliHistoryOrder: prepared.cliHistoryOrder } : {},
|
|
24078
24201
|
...id === messageId ? { cliBatchPhase: phase, acceptedUserMessageIds: [...messageIds] } : {}
|
|
24079
24202
|
}
|
|
24080
24203
|
} });
|
|
@@ -24089,6 +24212,8 @@ async function rollbackCliUserBatchPhase(store, dialogId, batchId, messageIds) {
|
|
|
24089
24212
|
if (!record2) continue;
|
|
24090
24213
|
const metadata = { ...record2.metadata };
|
|
24091
24214
|
delete metadata.cliBatchPhase;
|
|
24215
|
+
delete metadata.cliBatchId;
|
|
24216
|
+
delete metadata.acceptedUserMessageIds;
|
|
24092
24217
|
metadata.queueState = "pending";
|
|
24093
24218
|
ops.push({ type: "put", key, value: { ...record2, metadata } });
|
|
24094
24219
|
}
|
|
@@ -24237,10 +24362,10 @@ function buildLoadSkillExecutor(args2) {
|
|
|
24237
24362
|
metadata: { loadSkill: true, resolved: false }
|
|
24238
24363
|
};
|
|
24239
24364
|
}
|
|
24240
|
-
const { resolveSkillByName } = await import("./skillDiscovery-
|
|
24365
|
+
const { resolveSkillByName } = await import("./skillDiscovery-BHHPCUHZ.js");
|
|
24241
24366
|
const resolved = resolveSkillByName(args2.cwd, name);
|
|
24242
24367
|
if (!resolved) {
|
|
24243
|
-
const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-
|
|
24368
|
+
const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-BAE2LDXF.js");
|
|
24244
24369
|
const builtin = resolveBuiltinSkillByName(name);
|
|
24245
24370
|
if (builtin) {
|
|
24246
24371
|
const denied = await rejectDisabledBuiltin(args2.agentSkillSource, builtin.slug, name, args2.resolveAgentSkillSource);
|
|
@@ -24267,8 +24392,8 @@ ${builtin.content}`,
|
|
|
24267
24392
|
};
|
|
24268
24393
|
}
|
|
24269
24394
|
try {
|
|
24270
|
-
const { readFileSync } = await import("node:fs");
|
|
24271
|
-
const body =
|
|
24395
|
+
const { readFileSync: readFileSync2 } = await import("node:fs");
|
|
24396
|
+
const body = readFileSync2(resolved, "utf8");
|
|
24272
24397
|
return {
|
|
24273
24398
|
content: `Skill "${name}" loaded inline. Follow its instructions.
|
|
24274
24399
|
|
|
@@ -24319,7 +24444,7 @@ async function loadPreciseSkill(cwd, parsed, agentSkillSource, resolveAgentSkill
|
|
|
24319
24444
|
if (!nonEmpty(parsed.slug) || has2("projectBinding") || has2("relativePath")) {
|
|
24320
24445
|
return reject("builtin requires only an exact slug.");
|
|
24321
24446
|
}
|
|
24322
|
-
const { listBuiltinSkills } = await import("./builtinSkillRegistry-
|
|
24447
|
+
const { listBuiltinSkills } = await import("./builtinSkillRegistry-BAE2LDXF.js");
|
|
24323
24448
|
const builtin = listBuiltinSkills().find((entry) => entry.slug === parsed.slug);
|
|
24324
24449
|
if (!builtin) return reject("builtin slug not found.");
|
|
24325
24450
|
const denied = await rejectDisabledBuiltin(agentSkillSource, builtin.slug, builtin.slug, resolveAgentSkillSource);
|
|
@@ -24344,8 +24469,8 @@ ${builtin.content}`,
|
|
|
24344
24469
|
return reject("project requires projectBinding and relativePath only.");
|
|
24345
24470
|
}
|
|
24346
24471
|
try {
|
|
24347
|
-
const { realpathSync, statSync, readFileSync } = await import("node:fs");
|
|
24348
|
-
const { resolve:
|
|
24472
|
+
const { realpathSync, statSync, readFileSync: readFileSync2 } = await import("node:fs");
|
|
24473
|
+
const { resolve: resolve7, relative: relative6, isAbsolute: isAbsolute5, basename: basename4, sep: sep3 } = await import("node:path");
|
|
24349
24474
|
const inside = (root, target) => {
|
|
24350
24475
|
const rel = relative6(root, target);
|
|
24351
24476
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep3}`) && !isAbsolute5(rel);
|
|
@@ -24357,8 +24482,8 @@ ${builtin.content}`,
|
|
|
24357
24482
|
if (isAbsolute5(parsed.relativePath) || basename4(parsed.relativePath) !== "SKILL.md") {
|
|
24358
24483
|
return reject("relativePath must reference a project SKILL.md.");
|
|
24359
24484
|
}
|
|
24360
|
-
const skillsRoot =
|
|
24361
|
-
const candidate =
|
|
24485
|
+
const skillsRoot = resolve7(realCwd, ".agents", "skills");
|
|
24486
|
+
const candidate = resolve7(realCwd, parsed.relativePath);
|
|
24362
24487
|
if (!inside(skillsRoot, candidate)) return reject("path is outside cwd/.agents/skills/.");
|
|
24363
24488
|
const realRoot = realpathSync(skillsRoot);
|
|
24364
24489
|
const realPath = realpathSync(candidate);
|
|
@@ -24366,7 +24491,7 @@ ${builtin.content}`,
|
|
|
24366
24491
|
return reject("skill path escapes cwd/.agents/skills/ or is not SKILL.md.");
|
|
24367
24492
|
}
|
|
24368
24493
|
if (!statSync(realPath).isFile()) return reject("SKILL.md is not a file.");
|
|
24369
|
-
const body =
|
|
24494
|
+
const body = readFileSync2(realPath, "utf8");
|
|
24370
24495
|
return {
|
|
24371
24496
|
content: `Skill "${parsed.relativePath}" loaded inline. Follow its instructions.
|
|
24372
24497
|
|
|
@@ -24385,7 +24510,7 @@ ${body}`,
|
|
|
24385
24510
|
}
|
|
24386
24511
|
}
|
|
24387
24512
|
async function formatUnknownSkillMessage(cwd, requestedName) {
|
|
24388
|
-
const { discoverSkills } = await import("./skillDiscovery-
|
|
24513
|
+
const { discoverSkills } = await import("./skillDiscovery-BHHPCUHZ.js");
|
|
24389
24514
|
let available = [];
|
|
24390
24515
|
try {
|
|
24391
24516
|
available = discoverSkills(cwd).map((s) => s.name);
|
|
@@ -24957,11 +25082,11 @@ function createDevinProvider(options) {
|
|
|
24957
25082
|
}
|
|
24958
25083
|
|
|
24959
25084
|
// packages/agent-runtime/executionLeaseValidation.ts
|
|
24960
|
-
import { isAbsolute as isAbsolute4, relative as relative5, resolve as
|
|
25085
|
+
import { isAbsolute as isAbsolute4, relative as relative5, resolve as resolve6 } from "node:path";
|
|
24961
25086
|
function withinRoot(root, child) {
|
|
24962
25087
|
if (!isAbsolute4(root) || !isAbsolute4(child)) return false;
|
|
24963
|
-
const canonicalRoot =
|
|
24964
|
-
const canonicalChild =
|
|
25088
|
+
const canonicalRoot = resolve6(root);
|
|
25089
|
+
const canonicalChild = resolve6(child);
|
|
24965
25090
|
const suffix = relative5(canonicalRoot, canonicalChild);
|
|
24966
25091
|
return suffix === "" || suffix !== ".." && !suffix.startsWith("../") && !suffix.startsWith("..\\") && !isAbsolute4(suffix);
|
|
24967
25092
|
}
|
|
@@ -25028,13 +25153,14 @@ export {
|
|
|
25028
25153
|
createStrictHostCredentialBroker,
|
|
25029
25154
|
readCommandActionGatePayload,
|
|
25030
25155
|
readActionGate,
|
|
25156
|
+
orderDialogHistory,
|
|
25031
25157
|
Option_exports,
|
|
25032
25158
|
Duration_exports,
|
|
25033
25159
|
Exit_exports,
|
|
25034
25160
|
Effect_exports,
|
|
25035
|
-
scrubSecrets,
|
|
25036
25161
|
isDestructiveShellCommand,
|
|
25037
25162
|
evaluateShellCommandPolicy,
|
|
25163
|
+
readAgentsMdLayerFromDisk,
|
|
25038
25164
|
filterRetainedLedgerRecords,
|
|
25039
25165
|
isLineRangeCovered,
|
|
25040
25166
|
runTaskStop,
|