nolo-cli 0.240.0-alpha.2 → 0.241.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/{_executeModel-5NA4USGG.js → _executeModel-UCWDB72C.js} +50 -50
  2. package/{action-X75O3XPH.js → action-24MZYW2B.js} +6 -6
  3. package/{addContentAction-GVC77QSN.js → addContentAction-HEMCSSHT.js} +9 -9
  4. package/{addDialogAgentAction-KKDVAMW3.js → addDialogAgentAction-SQYDOXHA.js} +8 -8
  5. package/{agentDeleteCommand-2RFGKFAB.js → agentDeleteCommand-P7O3ACNJ.js} +76 -77
  6. package/{agentEmailCommands-GQCQKKOR.js → agentEmailCommands-A5BRSYWK.js} +80 -81
  7. package/{agentListCommands-HSGLDPDQ.js → agentListCommands-LDRCOOMO.js} +37 -36
  8. package/{agentMachineCommands-BISF6PVV.js → agentMachineCommands-AYL53KJV.js} +31 -30
  9. package/{agentProviderCommands-O3Q25PKU.js → agentProviderCommands-N5EA3ED2.js} +2 -2
  10. package/{agentPullCommand-G6U2LHMW.js → agentPullCommand-QQQZSC6S.js} +1 -1
  11. package/{agentRecordCommands-AOXPGYAJ.js → agentRecordCommands-FICBZ57C.js} +75 -76
  12. package/{agentRunCommand-YTZJCRAL.js → agentRunCommand-CTXQGDUM.js} +81 -80
  13. package/{agentRunControl-VBL7UFSG.js → agentRunControl-CO6BASZF.js} +7 -7
  14. package/{agentRuntimeLocal-T7BX2WGL.js → agentRuntimeLocal-5YN4D5WT.js} +26 -25
  15. package/{agentSlice-XJNKE3PG.js → agentSlice-DJ5D4DU4.js} +9 -9
  16. package/{appDeleteCommands-LURUSPY7.js → appDeleteCommands-B4E7N7M2.js} +32 -31
  17. package/{appDeployCommands-SMEW4AK2.js → appDeployCommands-E4DTXRRM.js} +32 -31
  18. package/{appDeployStatusCommands-VYPJTBJK.js → appDeployStatusCommands-FCNHYHZM.js} +32 -31
  19. package/{appGetCommands-N4NI5GGJ.js → appGetCommands-4DXSQHUZ.js} +32 -31
  20. package/{appListCommands-5C6ONN3Z.js → appListCommands-2NN5E4F6.js} +32 -31
  21. package/{authCommand-4CVBDADE.js → authCommand-47DR6GZT.js} +22 -18
  22. package/{authCommands-EHU2BHOX.js → authCommands-ZZ3L5IFM.js} +10 -6
  23. package/builtinSkillRegistry-AYWYQVA4.js +1 -1
  24. package/{chromeOpsCommands-CSDG2HYN.js → chromeOpsCommands-VZWAY2KR.js} +1 -1
  25. package/{chunk-UFC4J7OY.js → chunk-24GVXSWK.js} +3 -3
  26. package/{chunk-4IQVE43Z.js → chunk-25OCZXSX.js} +15 -15
  27. package/{chunk-4X5AVCM7.js → chunk-2BSLGODA.js} +258 -23
  28. package/{chunk-U3G7RRXJ.js → chunk-2XMKW2OY.js} +4 -4
  29. package/{chunk-MYOSN6BT.js → chunk-3NFWMSTA.js} +31 -10
  30. package/{chunk-E5KY7RAY.js → chunk-3V6JT6WN.js} +344 -137
  31. package/{chunk-2X7WFDT6.js → chunk-4FE3IWRE.js} +1 -1
  32. package/{chunk-XS5A3EKX.js → chunk-4YFC3DWW.js} +75 -1
  33. package/chunk-53W5BXLN.js +340 -0
  34. package/{chunk-H7ZYKHAZ.js → chunk-5TJE4QCL.js} +102 -31
  35. package/{chunk-FZKA3XFA.js → chunk-6BGJHJRN.js} +9 -9
  36. package/{chunk-6WOLPIPY.js → chunk-6RSNVJGO.js} +2 -102
  37. package/{chunk-L32W3PRP.js → chunk-6X3CS6NJ.js} +161 -12
  38. package/{chunk-3FBAVU2Y.js → chunk-6XBOPKUH.js} +11 -76
  39. package/{chunk-62HXNQVV.js → chunk-776CXKMX.js} +1 -1
  40. package/{chunk-7TTMMOKH.js → chunk-7OTNBI77.js} +1 -1
  41. package/{chunk-BGGV6B5O.js → chunk-7Q7MKJZN.js} +83 -50
  42. package/{chunk-2574ANSV.js → chunk-7U2TFUWW.js} +1 -1
  43. package/{chunk-A3LUWRQK.js → chunk-B72AFRR2.js} +4 -4
  44. package/{chunk-P3IZUMIC.js → chunk-BDERPCJW.js} +4 -4
  45. package/{chunk-MYPKBJJO.js → chunk-BIJTI5SX.js} +2 -2
  46. package/{chunk-ZEKUFJLW.js → chunk-BWW6WRX6.js} +3 -3
  47. package/chunk-C5A54QS7.js +108 -0
  48. package/{chunk-IUTUWIKE.js → chunk-C646JEUV.js} +1 -1
  49. package/{chunk-FFYE5ATM.js → chunk-CT6GT2BG.js} +7 -7
  50. package/{chunk-T6VROBY7.js → chunk-CZLSTOVM.js} +2 -2
  51. package/{chunk-SRCCSTIM.js → chunk-DGUUOHBF.js} +2 -2
  52. package/{chunk-A5EVA6HU.js → chunk-DIBQXNGW.js} +2 -2
  53. package/{chunk-AVJDELEA.js → chunk-DLT2DN4M.js} +1 -1
  54. package/{chunk-IJTXNLQE.js → chunk-DLTMAXLF.js} +6 -6
  55. package/{chunk-5QZSEQSK.js → chunk-DWWUVRB5.js} +1 -1
  56. package/{chunk-TRHJ4NJB.js → chunk-EIFSCI4C.js} +381 -155
  57. package/{chunk-DXW5WDHZ.js → chunk-EW37CXCQ.js} +3 -3
  58. package/{chunk-GXXY2NL3.js → chunk-F3FQPVHE.js} +37 -2
  59. package/{chunk-7AJRJGSQ.js → chunk-FCAMGBLY.js} +378 -146
  60. package/{chunk-YGCOJNFZ.js → chunk-FPMPWNVQ.js} +3 -3
  61. package/{chunk-MECDGHLK.js → chunk-FSIEHQNH.js} +2 -2
  62. package/{chunk-B7DE5XJW.js → chunk-FXX6VFMV.js} +208 -25
  63. package/{chunk-Z2WZAE4P.js → chunk-G6OPRPXH.js} +11 -11
  64. package/{chunk-VSRISJXZ.js → chunk-GAHJLSDO.js} +1 -1
  65. package/{chunk-PGKA77TZ.js → chunk-GCVFX6ZL.js} +169 -106
  66. package/{chunk-E5KJOZWY.js → chunk-H6CHPU6M.js} +3 -3
  67. package/{chunk-RETQOQ4D.js → chunk-HNWZJI4N.js} +1 -1
  68. package/{chunk-BGGAY6OK.js → chunk-IPRPYKBP.js} +3 -3
  69. package/{chunk-G22P367E.js → chunk-IUXBKS5L.js} +57 -13
  70. package/{chunk-PRMEU7BT.js → chunk-KGIIZXPL.js} +4 -4
  71. package/chunk-KK3FCYZM.js +647 -0
  72. package/{chunk-4Q6HQORG.js → chunk-KOIDLCAQ.js} +1 -1
  73. package/{chunk-PROOOQZ3.js → chunk-LCQJH7KN.js} +1 -1
  74. package/{chunk-Y2MF4DCJ.js → chunk-LELADM5Q.js} +1 -1
  75. package/{chunk-RTHFJZ6M.js → chunk-LMFMV5UC.js} +2 -2
  76. package/{chunk-ANJRDS6U.js → chunk-LMZRXDWG.js} +3 -3
  77. package/{chunk-6CKUO32A.js → chunk-LN4ZVSO7.js} +6 -3
  78. package/{chunk-N2JROHD3.js → chunk-LT3DMEIB.js} +3 -3
  79. package/{chunk-F6YWDVIB.js → chunk-MDVP5TLI.js} +1 -1
  80. package/chunk-MVOZ22RZ.js +26 -0
  81. package/{chunk-CBUZ6DKA.js → chunk-N6EN3HK3.js} +1 -1
  82. package/{chunk-3EMIEC27.js → chunk-NBB2EBQD.js} +1 -1
  83. package/{chunk-TWTJV35S.js → chunk-NL7J2J5Z.js} +3 -3
  84. package/{chunk-EEOOBRA7.js → chunk-NQQL2DKF.js} +2 -2
  85. package/{chunk-AEQMKYZN.js → chunk-NWWQY2J5.js} +4 -4
  86. package/{chunk-AH5R7BYW.js → chunk-OATIWAKN.js} +5 -5
  87. package/{chunk-CD3RU7XL.js → chunk-OJRTTERA.js} +62 -2
  88. package/{chunk-HOM6LTEW.js → chunk-OYHJ4TW7.js} +6 -6
  89. package/{chunk-BXSMFPTG.js → chunk-QES2NCVM.js} +3 -3
  90. package/{chunk-Y5OWZQMJ.js → chunk-QGMIUVBT.js} +5 -5
  91. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  92. package/chunk-SR4FE5VD.js +9 -0
  93. package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
  94. package/{chunk-CKZPMJNU.js → chunk-T444ENEC.js} +3 -3
  95. package/{chunk-TEMLHVGX.js → chunk-TE2XH4KH.js} +1 -1
  96. package/{chunk-4FIO2S7Z.js → chunk-TFGGNRT6.js} +1 -1
  97. package/{chunk-HCNOO374.js → chunk-TTEBPPUV.js} +1 -1
  98. package/{chunk-RM4UMFY4.js → chunk-TXFYIWAW.js} +7 -7
  99. package/{chunk-6WZVM33D.js → chunk-TXQVH72L.js} +2 -2
  100. package/{chunk-OBSEKCVK.js → chunk-U4VSBDO5.js} +88 -0
  101. package/{chunk-OX6GNNVT.js → chunk-U5LOKQ2R.js} +24 -13
  102. package/{chunk-VM72HKW2.js → chunk-UAHUJ4HH.js} +11 -11
  103. package/{chunk-BIABIPGW.js → chunk-UAOFSUG7.js} +1 -1
  104. package/{chunk-D374I563.js → chunk-UKSKCDBG.js} +1 -1
  105. package/{chunk-IUMS6F53.js → chunk-WHO3LYDW.js} +9 -5
  106. package/{chunk-F3XI6WQP.js → chunk-X37RQEA3.js} +2 -2
  107. package/{chunk-B5SV4H3J.js → chunk-XAFOLWLU.js} +1 -1
  108. package/{chunk-HBRDSQ3M.js → chunk-XNEDFWT4.js} +2 -2
  109. package/{chunk-VREG6ANQ.js → chunk-Y5RN44VH.js} +8 -8
  110. package/{chunk-S2MHR4PU.js → chunk-YFRJAE3R.js} +178 -114
  111. package/{chunk-GDUC4VS2.js → chunk-YMCSR7PA.js} +7 -7
  112. package/{chunk-5ZUOVCKT.js → chunk-YUZ2DAIH.js} +3 -1
  113. package/{chunk-CVJRVBJL.js → chunk-ZBQ5UGYY.js} +3 -3
  114. package/{chunk-O6IPRAVV.js → chunk-ZQUCJBS4.js} +2 -2
  115. package/{chunk-KZPEGO6D.js → chunk-ZT3DYK5T.js} +3 -3
  116. package/{chunk-DNZ4JJ7C.js → chunk-ZTLTDUV6.js} +16 -3
  117. package/{cliAgentConfigHelpers-U5OAVAKQ.js → cliAgentConfigHelpers-RFR7ZCSK.js} +6 -6
  118. package/{cliAuthorityBrokerClient-S42VMGB6.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  119. package/{cliLocalAgentRecordReader-HVZAQCUD.js → cliLocalAgentRecordReader-AJ4UKHKT.js} +30 -29
  120. package/{commandRegistry-FIXBZJHE.js → commandRegistry-IHWZVV4G.js} +86 -86
  121. package/{contentThunks-U6OC4R2N.js → contentThunks-YQRCBDKF.js} +22 -21
  122. package/{cooldownCommands-U7XSRVJP.js → cooldownCommands-W67DE765.js} +1 -1
  123. package/{createAgentAutomationAction-IP4LFN3W.js → createAgentAutomationAction-ERSDNR4R.js} +22 -21
  124. package/{createDialogAction-IAGQJ3LH.js → createDialogAction-QXC7JZPE.js} +23 -22
  125. package/{createPageAction-AZ3UIFKA.js → createPageAction-RLZ7776F.js} +24 -23
  126. package/{db-M7FU2GNK.js → db-6NRZLEW2.js} +1 -1
  127. package/{dbSlice-DKKMJJYY.js → dbSlice-7M2ESEUO.js} +8 -8
  128. package/{deleteFile-TQSONMVU.js → deleteFile-WO6WSSNK.js} +5 -5
  129. package/{dialogCommands-PCDRMBWG.js → dialogCommands-UIRO4QNN.js} +37 -36
  130. package/{dialogNotifyCommand-O35MWMOS.js → dialogNotifyCommand-VDUFYBZV.js} +8 -8
  131. package/{dialogSlice-QAKYN4DE.js → dialogSlice-A4U3C76D.js} +20 -19
  132. package/{dialogUsageCommand-2SSLTXKO.js → dialogUsageCommand-SEC6UZWM.js} +2 -2
  133. package/{docCreateCommands-CFQFZOAD.js → docCreateCommands-MHPYTJWR.js} +31 -30
  134. package/{docDeleteCommands-5CPNTIIS.js → docDeleteCommands-VYULMBAQ.js} +32 -31
  135. package/{docReadCommands-XQILYSAJ.js → docReadCommands-FV3GGZ7V.js} +31 -30
  136. package/{docStore-GIVRT7TQ.js → docStore-AWWI72FA.js} +9 -9
  137. package/{docUpdateCommands-VETKSUDD.js → docUpdateCommands-JNS3HX7F.js} +31 -30
  138. package/fetchMessages-TQEUZD7H.js +1 -1
  139. package/{getPricing-LF5C4XSI.js → getPricing-U5AR7ZHS.js} +3 -3
  140. package/{handleSendMessageAction-HKIW4ZNO.js → handleSendMessageAction-WDJOUDNV.js} +41 -40
  141. package/{hostCredentialCreate-6VDJFNDO.js → hostCredentialCreate-H3FF2SAO.js} +75 -76
  142. package/index.js +8 -8
  143. package/keys-RWF7UCB4.js +1 -1
  144. package/{localDialogRead-AV2VKKPG.js → localDialogRead-3T2KMCRC.js} +1 -1
  145. package/{localRuntimeAdapter-BQ4F5PZV.js → localRuntimeAdapter-JAQQXZJP.js} +74 -73
  146. package/{localRuntimeAuthority-WCNA4A3G.js → localRuntimeAuthority-7DKIT7UH.js} +2 -2
  147. package/{localRuntimeDb-CRNIBOOM.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
  148. package/{machineCommands-K6XIGOAD.js → machineCommands-WYOFNB5I.js} +73 -74
  149. package/{machineWsRunDispatch-4OO7Z6UM.js → machineWsRunDispatch-Y7UIAZNM.js} +73 -74
  150. package/markdownToSlate-KIYM7B3P.js +8 -0
  151. package/{mcpLocalAuthorizeCommand-ZP6ESAGE.js → mcpLocalAuthorizeCommand-SCYEFLRK.js} +9 -9
  152. package/{memberThunks-PBJPZ2JU.js → memberThunks-DIITWU4M.js} +10 -10
  153. package/{models-H5NNZRLH.js → models-CINY5UZR.js} +2 -2
  154. package/package.json +1 -1
  155. package/{projectArchive-G7AOQPRW.js → projectArchive-IZJXBW5N.js} +26 -25
  156. package/{providerPresetApply-OPBCAONX.js → providerPresetApply-2QWXPJXZ.js} +5 -5
  157. package/{providerRegistry-J2HCVTHE.js → providerRegistry-W4LCKK6V.js} +5 -5
  158. package/{read-JEGPITEW.js → read-OBLJNMA2.js} +5 -5
  159. package/{readDocTool-TE3XIU4Y.js → readDocTool-QQZ4DAER.js} +1 -1
  160. package/{readlineWorkspace-XMPGXR77.js → readlineWorkspace-WF3SWZGR.js} +2914 -1240
  161. package/rememberExplicit-CPAPONSI.js +15 -0
  162. package/{removeDialogAgentAction-CX3OAH4Y.js → removeDialogAgentAction-HC3SOY3G.js} +10 -10
  163. package/{runAgentClientLoop-HQJPDFGQ.js → runAgentClientLoop-Z7V6TA3O.js} +48 -48
  164. package/{runtimeDoctorCommands-GUH2YGMH.js → runtimeDoctorCommands-KX6YLPWV.js} +8 -8
  165. package/{secretCommands-NJXFVHZU.js → secretCommands-STRAX275.js} +2 -2
  166. package/{setDialogExtraReferencesAction-CGM67EEQ.js → setDialogExtraReferencesAction-DDZUQPY6.js} +9 -9
  167. package/{setPrimaryDialogAgentAction-3ABWPPXR.js → setPrimaryDialogAgentAction-EB67OMAJ.js} +10 -10
  168. package/{settingThunks-AY76OHYX.js → settingThunks-TN6GFASU.js} +8 -8
  169. package/{spaceCommands-G63QGYQO.js → spaceCommands-HBYQUVJI.js} +30 -29
  170. package/{streamAgentChatTurn-E3XH2KFD.js → streamAgentChatTurn-CM7QQXOS.js} +78 -78
  171. package/{switchDialogAgentAction-G6EZRKCQ.js → switchDialogAgentAction-XY5TKQQE.js} +8 -8
  172. package/{tableCommands-JI75ZHDI.js → tableCommands-MXFL3JIT.js} +2 -2
  173. package/{toolApiClient-62UUPDUA.js → toolApiClient-53YMJ2G6.js} +7 -3
  174. package/{tools-7RSX22FT.js → tools-AT6H73LD.js} +39 -40
  175. package/{tuiRestart-KAAA7TND.js → tuiRestart-272SAYSK.js} +8 -8
  176. package/{tuiSummaryLlmCaller-BVNHMWLR.js → tuiSummaryLlmCaller-K2OVRVHG.js} +13 -12
  177. package/{updateCommands-ASK5XYPH.js → updateCommands-O3BOVVVN.js} +3 -3
  178. package/{updateDialogTitleAction-SEWV252V.js → updateDialogTitleAction-PGY4UPLH.js} +22 -21
  179. package/{usageCommand-JVT5J3DC.js → usageCommand-SCF3ROV2.js} +3 -3
  180. package/{usageRebuildCommand-IZYYUTEW.js → usageRebuildCommand-K5WPIBA5.js} +4 -4
  181. package/{windowsSelfUpdate-BSDIS2J5.js → windowsSelfUpdate-WJDUZLEO.js} +2 -2
  182. package/{workContext-MM3P5GP5.js → workContext-Y3ADAPZU.js} +2 -1
  183. package/chunk-XBAEM4RI.js +0 -272
  184. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  185. package/{chunk-ULLHVDTZ.js → chunk-C3GOEQJF.js} +3 -3
  186. package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
  187. package/{workloadLifecycle-YIZ7KLUP.js → workloadLifecycle-HFJIN5IZ.js} +5 -5
@@ -3,7 +3,7 @@ import {
3
3
  DEVIN_CONNECT_URL,
4
4
  parseSseDataLineJson,
5
5
  parseSseDataLineObject
6
- } from "./chunk-H7ZYKHAZ.js";
6
+ } from "./chunk-5TJE4QCL.js";
7
7
  import {
8
8
  EXECUTION_BACKEND_KINDS
9
9
  } from "./chunk-PWTNI4N7.js";
@@ -19,7 +19,7 @@ import {
19
19
  flushChatCompletionStream,
20
20
  providerHttpFailure,
21
21
  throwIfChatCompletionStreamFailed
22
- } from "./chunk-HOM6LTEW.js";
22
+ } from "./chunk-OYHJ4TW7.js";
23
23
  import {
24
24
  readSseFrames
25
25
  } from "./chunk-HNUWUO75.js";
@@ -31,14 +31,7 @@ import {
31
31
  evaluateRequestBudget,
32
32
  hasImageInRuntimeMessages,
33
33
  stripImagePartsFromMessages
34
- } from "./chunk-KZPEGO6D.js";
35
- import {
36
- resolveToolExecutionContract
37
- } from "./chunk-LKA64WH4.js";
38
- import {
39
- resolveAgentImageInputSupport,
40
- resolveToolImagePolicy
41
- } from "./chunk-BGGAY6OK.js";
34
+ } from "./chunk-ZT3DYK5T.js";
42
35
  import {
43
36
  applyShapingCounts,
44
37
  attachProjectionFacts,
@@ -49,7 +42,7 @@ import {
49
42
  projectUserPartForModel,
50
43
  resolveOutboundDiagnosticSink,
51
44
  writeThinkingFacts
52
- } from "./chunk-5QZSEQSK.js";
45
+ } from "./chunk-DWWUVRB5.js";
53
46
  import {
54
47
  createThinkParserState,
55
48
  createToolCallAccumulator,
@@ -58,16 +51,9 @@ import {
58
51
  finalizeAccumulatedToolCalls
59
52
  } from "./chunk-56GBUMO5.js";
60
53
  import {
61
- CREDENTIAL_HYGIENE_RULE,
62
- DELETE_SAFETY_RED_LINE,
63
- DISPATCH_BACKEND_POLICY,
64
- DISPATCH_CANDIDATE_POLICY,
65
- PARALLEL_DISPATCH_DEFAULT_RULE,
66
- PLATFORM_RISK_CONTROL_RULE,
67
54
  TOOL_GUIDED_SECTION_ORDER,
68
- VERIFY_BEFORE_CONCLUDING_RULE,
69
- buildConsultationModeBlock,
70
55
  buildIdentityBlock,
56
+ buildPlatformStaticScopedBlocks,
71
57
  buildRuntimeGuidanceBlocks,
72
58
  detectDispatchIntent,
73
59
  detectDispatchIntentFromMessages,
@@ -75,7 +61,25 @@ import {
75
61
  hashStablePrefixContent,
76
62
  resolveResponseGuidelines,
77
63
  resolveToolGuidedSections
78
- } from "./chunk-PGKA77TZ.js";
64
+ } from "./chunk-GCVFX6ZL.js";
65
+ import {
66
+ BRIDGE_STREAM_MAX_CHARS,
67
+ CLI_NOLO_WORKSPACE_TOOL_NAMES,
68
+ DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
69
+ NOLO_WORKSPACE_TOOL_NAMES,
70
+ buildDialogReadEnvelope,
71
+ buildNoloWorkspaceCommandArgs,
72
+ buildNoloWorkspaceOpenAiTools,
73
+ createStreamingDialogReadProjector,
74
+ noloPositiveIntegerString,
75
+ noloStringArg,
76
+ parseNoloWorkspaceToolArguments,
77
+ readTextStreamUpToChars,
78
+ resolveNoloDialogInput
79
+ } from "./chunk-IUXBKS5L.js";
80
+ import {
81
+ applyToolSurfaceConstraints
82
+ } from "./chunk-VS276URX.js";
79
83
  import {
80
84
  classifyUnparsableToolArgs,
81
85
  collectStablePromptPrefix,
@@ -99,7 +103,7 @@ import {
99
103
  toOpenAiCompatibleMessages,
100
104
  toResponsesTools,
101
105
  transferDowngradedToolTurnOrigin
102
- } from "./chunk-EEOOBRA7.js";
106
+ } from "./chunk-NQQL2DKF.js";
103
107
  import {
104
108
  TOOL_HAD_IMAGES,
105
109
  TOOL_IMAGES,
@@ -114,24 +118,14 @@ import {
114
118
  withoutToolImages
115
119
  } from "./chunk-X4O7FJF5.js";
116
120
  import {
117
- BRIDGE_STREAM_MAX_CHARS,
118
- CLI_NOLO_WORKSPACE_TOOL_NAMES,
119
- DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
120
- NOLO_WORKSPACE_TOOL_NAMES,
121
- buildDialogReadEnvelope,
122
- buildNoloWorkspaceCommandArgs,
123
- buildNoloWorkspaceOpenAiTools,
124
- createStreamingDialogReadProjector,
125
- noloPositiveIntegerString,
126
- noloStringArg,
127
- parseNoloWorkspaceToolArguments,
128
- readTextStreamUpToChars,
129
- resolveNoloDialogInput
130
- } from "./chunk-G22P367E.js";
121
+ resolveToolExecutionContract
122
+ } from "./chunk-LKA64WH4.js";
131
123
  import {
132
- applyToolSurfaceConstraints
133
- } from "./chunk-VS276URX.js";
124
+ resolveAgentImageInputSupport,
125
+ resolveToolImagePolicy
126
+ } from "./chunk-IPRPYKBP.js";
134
127
  import {
128
+ isContextOverflowText,
135
129
  isQuotaExhaustedError
136
130
  } from "./chunk-TLE77UJ5.js";
137
131
  import {
@@ -162,16 +156,18 @@ import {
162
156
  resolveEmptyAssistantFallbackMessage,
163
157
  resolveEmptyAssistantOutcome,
164
158
  resolveTruncatedReasoningTailLog
165
- } from "./chunk-DNZ4JJ7C.js";
159
+ } from "./chunk-ZTLTDUV6.js";
166
160
  import {
167
161
  COMPACTION_SUMMARY_SCHEMA_VERSION,
168
162
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
169
163
  buildBoundedCompactionRequest,
170
164
  buildCompactionMetricsFromPlan,
171
165
  buildSummarySourceDiagnostics,
166
+ buildSummarySourceSegments,
172
167
  classifySummaryError,
173
168
  computeSummarySourceMetadata,
174
169
  createSummaryBudget,
170
+ diffSummarySourceSegments,
175
171
  formatCompactionMetricsLog,
176
172
  getMessageTokenCount,
177
173
  getModelContextWindow,
@@ -183,10 +179,9 @@ import {
183
179
  resolveCompressionTriggerRatio,
184
180
  resolveEffectiveCompactionBudgets,
185
181
  runSummaryWithContract,
186
- sha256Hex,
187
182
  summaryCompletionTokens,
188
183
  truncateToolOutputForContext
189
- } from "./chunk-L32W3PRP.js";
184
+ } from "./chunk-6X3CS6NJ.js";
190
185
  import {
191
186
  createProviderCallTimingTracker,
192
187
  finalizeProviderCallTiming,
@@ -194,18 +189,21 @@ import {
194
189
  observeMeaningfulProviderResponse,
195
190
  withProviderCallTimingFields
196
191
  } from "./chunk-H57T64RA.js";
192
+ import {
193
+ sha256Hex
194
+ } from "./chunk-SR4FE5VD.js";
197
195
  import {
198
196
  clipCompactText
199
197
  } from "./chunk-5MMAK75Q.js";
200
198
  import {
201
199
  asRecordOrEmpty
202
200
  } from "./chunk-KX6YBIHG.js";
203
- import {
204
- isAbortError
205
- } from "./chunk-7DPNBQSV.js";
206
201
  import {
207
202
  isLevelNotFoundError
208
203
  } from "./chunk-OW765XBU.js";
204
+ import {
205
+ isAbortError
206
+ } from "./chunk-7DPNBQSV.js";
209
207
  import {
210
208
  TOOL_OUTPUT_SPILL_BYTES,
211
209
  TOOL_OUTPUT_SPILL_LINES,
@@ -243,9 +241,6 @@ import {
243
241
  import {
244
242
  dialogMessageRecordToAgentRuntimeMessage
245
243
  } from "./chunk-4ZCTKB27.js";
246
- import {
247
- WORKTREE_ISOLATION_PRELUDE
248
- } from "./chunk-EBKHA63G.js";
249
244
  import {
250
245
  canonicalizeToolName,
251
246
  canonicalizeToolNames
@@ -273,7 +268,7 @@ import {
273
268
  import {
274
269
  buildProviderAuthHeaders,
275
270
  buildProviderExecutionPlan
276
- } from "./chunk-RTHFJZ6M.js";
271
+ } from "./chunk-LMFMV5UC.js";
277
272
  import {
278
273
  toErrorMessage
279
274
  } from "./chunk-HNMXYYJR.js";
@@ -291,7 +286,7 @@ import {
291
286
  } from "./chunk-CF7PE763.js";
292
287
  import {
293
288
  PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL
294
- } from "./chunk-OBSEKCVK.js";
289
+ } from "./chunk-U4VSBDO5.js";
295
290
  import {
296
291
  asTrimmedLowercaseString
297
292
  } from "./chunk-QSJ3HFEF.js";
@@ -19315,6 +19310,137 @@ function createTurnUsageLedger(args2) {
19315
19310
  };
19316
19311
  }
19317
19312
 
19313
+ // packages/agent-runtime/agentRunIsolation.ts
19314
+ var ORCHESTRATION_TOOL_NAMES = /* @__PURE__ */ new Set([
19315
+ "startAgentRun",
19316
+ "controlAgentRun",
19317
+ "listAgents",
19318
+ "readAgent",
19319
+ "runStreamingAgent"
19320
+ ]);
19321
+ var INTERACTION_REQUIRED_TOOL_NAMES = /* @__PURE__ */ new Set([
19322
+ "ask_user",
19323
+ // 凭据请求:需要宿主交互面板(Block 1a);desktop 无通道时同 ask_user 剥离。
19324
+ "secret-request"
19325
+ ]);
19326
+ var SELF_MUTATION_TOOL_NAMES = /* @__PURE__ */ new Set([
19327
+ "updateSelf",
19328
+ "updateAgent"
19329
+ ]);
19330
+ var SUBTASK_REMOVED_TOOL_NAMES = /* @__PURE__ */ new Set([
19331
+ ...ORCHESTRATION_TOOL_NAMES,
19332
+ ...INTERACTION_REQUIRED_TOOL_NAMES,
19333
+ ...SELF_MUTATION_TOOL_NAMES
19334
+ ]);
19335
+ function isSubtaskRun(env) {
19336
+ if (!env) return false;
19337
+ const value = env.NOLO_AGENT_RUN_CHILD;
19338
+ return typeof value === "string" && value.length > 0 && value !== "0";
19339
+ }
19340
+ var RUN_WAKE_CHANNEL_ENV = "NOLO_RUN_WAKE";
19341
+ function hasRunWakeChannel(env) {
19342
+ if (!env) return false;
19343
+ const value = env[RUN_WAKE_CHANNEL_ENV];
19344
+ return typeof value === "string" && value.length > 0 && value !== "0";
19345
+ }
19346
+ function filterToolNamesForRunKind(toolNames, isSubtask) {
19347
+ if (!isSubtask) return [...toolNames];
19348
+ return toolNames.filter((name) => !SUBTASK_REMOVED_TOOL_NAMES.has(name));
19349
+ }
19350
+
19351
+ // packages/agent-runtime/subtaskBudget.ts
19352
+ var DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_1_TOOL_CALLS = 40;
19353
+ var DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_2_TOOL_CALLS = 80;
19354
+ var SUBTASK_SOFT_BUDGET_MILESTONE_1_PREFIX = "[\u7CFB\u7EDF\u63D0\u793A \xB7 \u5B50\u4EFB\u52A1\u8F6F\u9884\u7B97\u63D0\u9192]";
19355
+ var SUBTASK_SOFT_BUDGET_MILESTONE_2_PREFIX = "[\u7CFB\u7EDF\u63D0\u793A \xB7 \u5B50\u4EFB\u52A1\u5F3A\u6536\u655B\u63D0\u9192]";
19356
+ function buildSubtaskSoftBudgetMilestone1Prompt(toolCallCount) {
19357
+ return `${SUBTASK_SOFT_BUDGET_MILESTONE_1_PREFIX} \u5F53\u524D\u5B50\u4EFB\u52A1\u5DF2\u7D2F\u8BA1\u6267\u884C ${toolCallCount} \u6B21\u5DE5\u5177\u8C03\u7528\uFF0C\u8BF7\u505A\u4E00\u6B21\u6536\u655B\u81EA\u68C0\uFF1A\u82E5\u6838\u5FC3\u76EE\u6807\u4E0E\u5FC5\u9700\u9A8C\u8BC1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u5C3D\u5FEB\u6574\u7406\u7ED3\u679C\u5E76\u6536\u655B\u4EA4\u4ED8\uFF1B\u82E5\u540C\u4E00\u62A5\u9519\u5DF2\u8FDE\u7EED\u91CD\u8BD5\u4E14\u65E0\u65B0\u8BC1\u636E\uFF0C\u8BF7\u505C\u6B62\u76F2\u8BD5\u5E76\u5728\u7ED3\u679C\u4E2D\u5982\u5B9E\u62A5\u544A\u6839\u56E0\u4E0E\u963B\u788D\uFF1B\u82E5\u786E\u7CFB\u6B63\u5E38\u7684\u591A\u6587\u4EF6\u4FEE\u6539\u6216\u9A8C\u8BC1\u5DE5\u4F5C\uFF0C\u53EF\u7EE7\u7EED\u7A33\u6B65\u5B8C\u6210\u3002`;
19358
+ }
19359
+ function buildSubtaskSoftBudgetMilestone2Prompt(toolCallCount) {
19360
+ return `${SUBTASK_SOFT_BUDGET_MILESTONE_2_PREFIX} \u5F53\u524D\u5B50\u4EFB\u52A1\u5DF2\u7D2F\u8BA1\u6267\u884C ${toolCallCount} \u6B21\u5DE5\u5177\u8C03\u7528\u3002\u5EFA\u8BAE\u5728\u5B8C\u6210\u5F53\u524D\u624B\u5934\u6700\u540E\u4E00\u6B65\u5FC5\u8981\u9A8C\u8BC1\u540E\uFF0C\u7ACB\u5373\u6574\u7406\u5DF2\u6709\u6210\u679C\u3001\u672A\u5B8C\u6210\u9879\u4E0E\u5EFA\u8BAE\u7684\u4E0B\u4E00\u6B65\u76F4\u63A5\u4EA4\u4ED8\u7236\u5BF9\u8BDD\uFF0C\u907F\u514D\u5355\u6B21\u5B50\u4EFB\u52A1\u8FC7\u5EA6\u6D88\u8017\u914D\u989D\u4E0E\u4E0A\u4E0B\u6587\u3002`;
19361
+ }
19362
+ function resolveSoftBudgetEnv(explicitEnv) {
19363
+ if (explicitEnv !== void 0) return explicitEnv;
19364
+ if (typeof process !== "undefined" && process.env) return process.env;
19365
+ return void 0;
19366
+ }
19367
+ function isEnvSoftBudgetDisabled(env) {
19368
+ const raw = env?.NOLO_SUBTASK_SOFT_BUDGET?.trim().toLowerCase();
19369
+ return raw === "0" || raw === "false";
19370
+ }
19371
+ function hasParentDialogEnvSignal(env) {
19372
+ const raw = env?.NOLO_PARENT_DIALOG_ID;
19373
+ return typeof raw === "string" && raw.trim().length > 0;
19374
+ }
19375
+ function normalizeThreshold(value) {
19376
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
19377
+ return void 0;
19378
+ }
19379
+ return Math.floor(value);
19380
+ }
19381
+ function createSubtaskSoftBudgetAdvisor(options) {
19382
+ const env = resolveSoftBudgetEnv(options?.env);
19383
+ const envDisabled = isEnvSoftBudgetDisabled(env);
19384
+ const configDisabled = options?.softBudget === false || typeof options?.softBudget === "object" && options.softBudget !== null && options.softBudget.enabled === false;
19385
+ const configEnabled = options?.softBudget === true || typeof options?.softBudget === "object" && options.softBudget !== null && options.softBudget.enabled !== false;
19386
+ const hasSubtaskContext = options?.isSubtask === true || options?.runKind === "subtask" || hasParentDialogEnvSignal(env) || isSubtaskRun(env);
19387
+ const enabled = !envDisabled && !configDisabled && (configEnabled || hasSubtaskContext);
19388
+ const rawConfig = typeof options?.softBudget === "object" && options.softBudget !== null ? options.softBudget : void 0;
19389
+ const milestone1ToolCalls = normalizeThreshold(rawConfig?.milestone1ToolCalls) ?? DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_1_TOOL_CALLS;
19390
+ const explicitMilestone2 = normalizeThreshold(rawConfig?.milestone2ToolCalls);
19391
+ const milestone2ToolCalls = explicitMilestone2 !== void 0 ? Math.max(milestone1ToolCalls + 1, explicitMilestone2) : Math.max(
19392
+ DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_2_TOOL_CALLS,
19393
+ milestone1ToolCalls * 2
19394
+ );
19395
+ let milestone1Triggered = false;
19396
+ let milestone2Triggered = false;
19397
+ let lastObservedToolCallCount = 0;
19398
+ function observeToolCalls(toolCallCount) {
19399
+ const normalized = typeof toolCallCount === "number" && Number.isFinite(toolCallCount) && toolCallCount > 0 ? Math.floor(toolCallCount) : 0;
19400
+ if (normalized > lastObservedToolCallCount) {
19401
+ lastObservedToolCallCount = normalized;
19402
+ }
19403
+ if (!enabled) return null;
19404
+ if (!milestone2Triggered && normalized >= milestone2ToolCalls) {
19405
+ milestone1Triggered = true;
19406
+ milestone2Triggered = true;
19407
+ return {
19408
+ milestone: 2,
19409
+ threshold: milestone2ToolCalls,
19410
+ toolCallCount: normalized,
19411
+ message: buildSubtaskSoftBudgetMilestone2Prompt(normalized)
19412
+ };
19413
+ }
19414
+ if (!milestone1Triggered && normalized >= milestone1ToolCalls) {
19415
+ milestone1Triggered = true;
19416
+ return {
19417
+ milestone: 1,
19418
+ threshold: milestone1ToolCalls,
19419
+ toolCallCount: normalized,
19420
+ message: buildSubtaskSoftBudgetMilestone1Prompt(normalized)
19421
+ };
19422
+ }
19423
+ return null;
19424
+ }
19425
+ function getState2() {
19426
+ return {
19427
+ enabled,
19428
+ milestone1ToolCalls,
19429
+ milestone2ToolCalls,
19430
+ milestone1Triggered,
19431
+ milestone2Triggered,
19432
+ lastObservedToolCallCount
19433
+ };
19434
+ }
19435
+ return {
19436
+ enabled,
19437
+ milestone1ToolCalls,
19438
+ milestone2ToolCalls,
19439
+ observeToolCalls,
19440
+ getState: getState2
19441
+ };
19442
+ }
19443
+
19318
19444
  // packages/agent-runtime/leafFinalHandoff.ts
19319
19445
  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.`;
19320
19446
 
@@ -19379,8 +19505,17 @@ function findSummaryAnchorIndex(bridged, anchorId) {
19379
19505
  const index = Number(legacy[1]);
19380
19506
  return Number.isSafeInteger(index) && index < bridged.length ? index : -1;
19381
19507
  }
19382
- function logSummarySourceDiagnostics(phase, dialogId, history, anchor) {
19508
+ function logSummarySourceDiagnostics(phase, dialogId, history, anchor, segmentDiff) {
19383
19509
  const sourceHash = hashSummarySourceSlice(history, anchor)?.slice(0, 16);
19510
+ if (phase === "invalidated" && segmentDiff) {
19511
+ console.log(`[compaction-source] ${JSON.stringify({
19512
+ phase,
19513
+ dialogId,
19514
+ sourceHash,
19515
+ kind: "segment-diff",
19516
+ ...segmentDiff
19517
+ })}`);
19518
+ }
19384
19519
  const rows = buildSummarySourceDiagnostics(toPlanCompressionMessages(history), anchor);
19385
19520
  for (const row of rows) console.log(`[compaction-source] ${JSON.stringify({
19386
19521
  phase,
@@ -19578,13 +19713,15 @@ async function maybeAutoCompactLocalHistory(args2) {
19578
19713
  let reason;
19579
19714
  if (invalidStored?.schemaVersion !== void 0 && invalidStored.schemaVersion !== COMPACTION_SUMMARY_SCHEMA_VERSION) {
19580
19715
  reason = "schema-version-mismatch";
19581
- } else if (typeof invalidStored?.summarizedBeforeId !== "string" || !bridged.some((m) => m.id === invalidStored.summarizedBeforeId)) {
19716
+ } else if (typeof invalidStored?.summarizedBeforeId !== "string" || findSummaryAnchorIndex(bridged, invalidStored.summarizedBeforeId) === -1) {
19582
19717
  reason = "anchor-not-found";
19583
19718
  } else if (typeof invalidStored?.sourceCount === "number" && history.length < invalidStored.sourceCount) {
19584
19719
  reason = "history-trimmed";
19585
19720
  } else {
19586
19721
  reason = "hash-mismatch";
19587
19722
  }
19723
+ const currentSegments = buildSummarySourceSegments(bridged, invalidStored?.summarizedBeforeId);
19724
+ const segmentDiff = reason === "hash-mismatch" ? diffSummarySourceSegments(invalidStored?.sourceSegments, currentSegments) : void 0;
19588
19725
  console.warn(
19589
19726
  `[localLoop] invalidated dialog summary for ${dialogId} (${reason}); discarding and re-compressing`,
19590
19727
  // 诊断分项(**仅加日志,不改任何哈希/校验/重锚语义**):区分「历史真被改写」
@@ -19597,10 +19734,17 @@ async function maybeAutoCompactLocalHistory(args2) {
19597
19734
  storedSourceCount: typeof invalidStored?.sourceCount === "number" ? invalidStored.sourceCount : null,
19598
19735
  summarizedBeforeId: typeof invalidStored?.summarizedBeforeId === "string" ? invalidStored.summarizedBeforeId : null,
19599
19736
  recomputedHashPrefix: hashSummarySourceSlice(history, invalidStored?.summarizedBeforeId)?.slice(0, 8) ?? null,
19600
- storedHashPrefix: typeof invalidStored?.sourceHash === "string" && invalidStored.sourceHash ? invalidStored.sourceHash.slice(0, 8) : null
19737
+ storedHashPrefix: typeof invalidStored?.sourceHash === "string" && invalidStored.sourceHash ? invalidStored.sourceHash.slice(0, 8) : null,
19738
+ ...segmentDiff ? { segmentDiff } : {}
19601
19739
  }
19602
19740
  );
19603
- logSummarySourceDiagnostics("invalidated", dialogId, history, invalidStored?.summarizedBeforeId);
19741
+ logSummarySourceDiagnostics(
19742
+ "invalidated",
19743
+ dialogId,
19744
+ history,
19745
+ invalidStored?.summarizedBeforeId,
19746
+ segmentDiff
19747
+ );
19604
19748
  stored = null;
19605
19749
  }
19606
19750
  const existingSummary = typeof stored?.summary === "string" ? stored.summary : "";
@@ -19610,7 +19754,7 @@ async function maybeAutoCompactLocalHistory(args2) {
19610
19754
  const contextWindow = typeof args2.contextWindow === "number" && Number.isFinite(args2.contextWindow) && args2.contextWindow > 0 ? args2.contextWindow : getModelContextWindow(args2.model ?? "");
19611
19755
  const allMsgs = toPlanCompressionMessages(prepareHistoryForNextTurn(history, args2.contextReferenceResolver));
19612
19756
  const maxInputItems = resolveProviderInputItemLimit({ provider: args2.provider, endpoint: args2.providerEndpoint });
19613
- const force = args2.force === true || args2.requestOverBudget?.(
19757
+ const force = args2.force === true || invalidSummary || args2.requestOverBudget?.(
19614
19758
  existingSummary ? projectHistoryWithSummary({ history, summary: existingSummary, summarizedBeforeId }) : history
19615
19759
  ) === true;
19616
19760
  const plan = planCompression({
@@ -20034,8 +20178,13 @@ async function maybeAutoCompactLocalHistory(args2) {
20034
20178
  }
20035
20179
  };
20036
20180
  }
20181
+ const bridgedHistory = toPlanCompressionMessages(history);
20037
20182
  const sourceMeta = await computeSummarySourceMetadata(
20038
- toPlanCompressionMessages(history),
20183
+ bridgedHistory,
20184
+ bounded3.summarizedBeforeId
20185
+ );
20186
+ const sourceSegments = buildSummarySourceSegments(
20187
+ bridgedHistory,
20039
20188
  bounded3.summarizedBeforeId
20040
20189
  );
20041
20190
  if (Date.now() >= summaryDeadlineMs) throw Object.assign(new Error("Summary deadline exceeded"), { compactionReason: "timeout" });
@@ -20043,7 +20192,7 @@ async function maybeAutoCompactLocalHistory(args2) {
20043
20192
  throw Object.assign(new Error("auto-compaction aborted"), { compactionReason: "aborted" });
20044
20193
  }
20045
20194
  const saveT0 = Date.now();
20046
- await adapter.saveDialogSummary({
20195
+ const summarySavePayload = {
20047
20196
  dialogId,
20048
20197
  summary: newSummary,
20049
20198
  summarizedBeforeId: bounded3.summarizedBeforeId,
@@ -20051,12 +20200,14 @@ async function maybeAutoCompactLocalHistory(args2) {
20051
20200
  sourceHash: sourceMeta?.sourceHash,
20052
20201
  sourceCount: sourceMeta?.sourceCount ?? 0,
20053
20202
  schemaVersion: COMPACTION_SUMMARY_SCHEMA_VERSION,
20203
+ ...sourceSegments.length > 0 ? { sourceSegments } : {},
20054
20204
  referenceKeys: Array.from(
20055
20205
  new Set(
20056
20206
  history.slice(0, sourceMeta?.sourceCount ?? 0).flatMap((message) => extractReferenceKeysFromMessage(message))
20057
20207
  )
20058
20208
  )
20059
- });
20209
+ };
20210
+ await adapter.saveDialogSummary(summarySavePayload);
20060
20211
  saveElapsedMs = Date.now() - saveT0;
20061
20212
  logSummarySourceDiagnostics("saved", dialogId, history, bounded3.summarizedBeforeId);
20062
20213
  console.log(formatCompactionMetricsLog(metrics));
@@ -20239,7 +20390,7 @@ function createTurnCompactionController(args2) {
20239
20390
  return { history: result4.history, applied: result4.history !== history, usage: result4.usage };
20240
20391
  };
20241
20392
  let lastCompactionOutcome;
20242
- const prepareRequest = async (requestOverBudget, initial = false, availableHistoryTokens) => {
20393
+ const prepareRequest = async (requestOverBudget, initial = false, availableHistoryTokens, force = false) => {
20243
20394
  lastCompactionOutcome = void 0;
20244
20395
  const contextUsage = args2.getContextUsage();
20245
20396
  let inputTokens = contextUsage ? normalizeUsage(contextUsage).input_tokens : 0;
@@ -20251,8 +20402,8 @@ function createTurnCompactionController(args2) {
20251
20402
  }
20252
20403
  }
20253
20404
  const ratio = inputTokens > 0 ? Math.min(1, inputTokens / args2.contextWindow) : void 0;
20254
- if (!requestOverBudget && ratio !== void 0 && ratio < args2.compressionTriggerRatio * 0.85 && resolveProviderInputItemLimit({ provider: args2.provider, endpoint: args2.providerEndpoint }) === void 0) {
20255
- return;
20405
+ if (!force && !requestOverBudget && ratio !== void 0 && ratio < args2.compressionTriggerRatio * 0.85 && resolveProviderInputItemLimit({ provider: args2.provider, endpoint: args2.providerEndpoint }) === void 0) {
20406
+ return false;
20256
20407
  }
20257
20408
  try {
20258
20409
  const compacted = await maybeAutoCompactLocalHistory({
@@ -20272,6 +20423,7 @@ function createTurnCompactionController(args2) {
20272
20423
  providerEndpoint: args2.providerEndpoint,
20273
20424
  resolveProvider: args2.resolveProvider,
20274
20425
  contextWindow: args2.contextWindow,
20426
+ ...force ? { force: true } : {},
20275
20427
  ...ratio !== void 0 ? { realContextUsagePercent: ratio } : {},
20276
20428
  abortSignal: args2.abortSignal,
20277
20429
  timeoutMs: args2.timeoutMs,
@@ -20298,12 +20450,16 @@ function createTurnCompactionController(args2) {
20298
20450
  args2.onSelectedSummary?.(compacted.selectedSummary ?? { outcome: initial ? "absent" : "unknown" });
20299
20451
  }
20300
20452
  emitObservation(compacted);
20453
+ return Boolean(compacted.compressed && compacted.summaryGenerated);
20301
20454
  } catch (error) {
20302
20455
  lastCompactionOutcome = { ...lastCompactionOutcome, error: classifySummaryError(error) };
20303
20456
  console.warn("[localLoop] in-loop auto-compaction failed:", error);
20457
+ return false;
20304
20458
  }
20305
20459
  };
20306
- return { getLastCompactionOutcome: () => lastCompactionOutcome, runInitial, maybeCompactInLoop: () => prepareRequest(), forceCompact, prepareRequest };
20460
+ return { getLastCompactionOutcome: () => lastCompactionOutcome, runInitial, maybeCompactInLoop: async () => {
20461
+ await prepareRequest();
20462
+ }, forceCompact, prepareRequest };
20307
20463
  }
20308
20464
 
20309
20465
  // packages/agent-runtime/providerCallTelemetry.ts
@@ -20824,7 +20980,8 @@ async function runLocalAgentTurn(input) {
20824
20980
  // 防止 session-scope 的 agentCollaboration 段逐轮翻转击穿前缀缓存。
20825
20981
  dispatchIntent: detectDispatchIntentFromMessages(history) || detectDispatchIntent(
20826
20982
  typeof input.input === "string" ? input.input : void 0
20827
- )
20983
+ ),
20984
+ runKind: input.runKind
20828
20985
  });
20829
20986
  const callerScopes = normalizeContextBlockScopes(
20830
20987
  input.contextBlocks,
@@ -20862,24 +21019,8 @@ async function runLocalAgentTurn(input) {
20862
21019
  ] : []
20863
21020
  ];
20864
21021
  const mergedContextBlockScopes = [
20865
- // 删除安全红线:系统层最高优先级约束,位于所有块之前(含身份信息块),
20866
- // owner 要求常驻「根本提示词」的最顶部(2026-09-26 批量误删事故)。
20867
- { content: DELETE_SAFETY_RED_LINE, cacheScope: "session" },
20868
- // 凭据纪律:与红线同为系统层固定块,紧随其后(四条装配线同源)。
20869
- { content: CREDENTIAL_HYGIENE_RULE, cacheScope: "session" },
20870
- // 并行是默认:系统层固定块,紧随红线(localLoop 无 static 作用域,用 session 占位,
20871
- // 「最顶」由数组首位保证——与红线同一约定)。
20872
- { content: VERIFY_BEFORE_CONCLUDING_RULE, cacheScope: "session" },
20873
- { content: PARALLEL_DISPATCH_DEFAULT_RULE, cacheScope: "session" },
20874
- // 派发落点:并行派发纪律的下一层(派到哪个执行后端),沿用 session 占位约定。
20875
- { content: DISPATCH_BACKEND_POLICY, cacheScope: "session" },
20876
- { content: DISPATCH_CANDIDATE_POLICY, cacheScope: "session" },
20877
- // 平台风控纪律:无条件系统层块,沿用 session 占位约定。
20878
- { content: PLATFORM_RISK_CONTROL_RULE, cacheScope: "session" },
20879
- { content: buildConsultationModeBlock(), cacheScope: "session" },
20880
- // Git 任务隔离:系统层固定前置,四条装配线同序(请教模式之后、身份信息之前;
20881
- // skill 配置 disabled 也注入)。
20882
- { content: WORKTREE_ISOLATION_PRELUDE, cacheScope: "session" },
21022
+ // 顶部固定平台层(唯一真源见 platformStaticPromptLayers.ts;localLoop 无 static 作用域,session 占位)。
21023
+ ...buildPlatformStaticScopedBlocks(),
20883
21024
  { content: identityBlock, cacheScope: "session" },
20884
21025
  ...guidanceScopes,
20885
21026
  // 回复行为准则:local 线(CLI 非交互 / 桌面 / TUI)的唯一注入边界。
@@ -21031,6 +21172,12 @@ async function runLocalAgentTurn(input) {
21031
21172
  let skipFinalAppend = false;
21032
21173
  let partialContent = "";
21033
21174
  const progressGuard = createLocalLoopProgressGuard(input.progressGuardConfig);
21175
+ const softBudgetAdvisor = createSubtaskSoftBudgetAdvisor({
21176
+ softBudget: input.softBudget,
21177
+ isSubtask: input.isSubtask,
21178
+ runKind: input.runKind,
21179
+ ...input.softBudgetEnv ? { env: input.softBudgetEnv } : {}
21180
+ });
21034
21181
  let pendingInjectionCommits = [];
21035
21182
  let inFlightTransactions = [];
21036
21183
  let rollbackInjectionCommits = async () => {
@@ -21152,7 +21299,7 @@ async function runLocalAgentTurn(input) {
21152
21299
  });
21153
21300
  imageDowngradeEmitted = true;
21154
21301
  }
21155
- const requestMessages = projectRequest(transcript.working());
21302
+ let requestMessages = projectRequest(transcript.working());
21156
21303
  if (requestOverBudget(requestMessages)) {
21157
21304
  const budget = evaluateLocalRequestBudget({
21158
21305
  messages: requestMessages,
@@ -21173,7 +21320,7 @@ async function runLocalAgentTurn(input) {
21173
21320
  }));
21174
21321
  }
21175
21322
  budgetTrimPhase = contextPhase("budget-trim", requestMessages, { droppedCount: 0 });
21176
- const contextMetrics = {
21323
+ let contextMetrics = {
21177
21324
  ...preparedMessages.metrics,
21178
21325
  messageCount: requestMessages.length,
21179
21326
  contentChars: requestMessages.reduce(
@@ -21195,8 +21342,8 @@ async function runLocalAgentTurn(input) {
21195
21342
  input.onToolEvent || input.onObservationEvent || input.observationBoundary
21196
21343
  );
21197
21344
  let llmStreamActivity = 0;
21198
- const callStartedAt = Date.now();
21199
- const requestTelemetry = buildRequestTelemetry({
21345
+ let callStartedAt = Date.now();
21346
+ let requestTelemetry = buildRequestTelemetry({
21200
21347
  // 无 dialogId 的新对话用本 turn 唯一键,避免不同新对话共用一个槽误报漂移。
21201
21348
  dialogKey: input.continueDialogId || newDialogTelemetryKey,
21202
21349
  messages: requestMessages,
@@ -21235,83 +21382,148 @@ async function runLocalAgentTurn(input) {
21235
21382
  throw error;
21236
21383
  }
21237
21384
  }
21238
- let providerInvoked = false;
21239
- try {
21240
- result4 = await runCompleteWithTimeout({
21241
- provider: { complete: (messages2, options) => {
21242
- providerInvoked = true;
21243
- inFlightTransactions = [];
21244
- return provider.complete(messages2, options);
21245
- } },
21385
+ const tryOverflowRescueCompaction = async () => {
21386
+ const beforeTokens = estimateLocalRequestInput(requestMessages);
21387
+ const compacted = await compaction.prepareRequest((source) => {
21388
+ const projected = composeProviderMessages({
21389
+ prefix: transcript.working().slice(0, prefixCount),
21390
+ history: source,
21391
+ contextReferenceResolver: input.adapter.host === "cli" ? input.contextReferenceResolver : void 0
21392
+ });
21393
+ return requestOverBudget(projectRequest(projected.messages));
21394
+ }, false, availableHistoryTokens, true);
21395
+ if (!compacted) return false;
21396
+ const nextPrepared = prepareMessagesForProviderCall(transcript.working());
21397
+ const nextRequestMessages = projectRequest(transcript.working());
21398
+ const afterTokens = estimateLocalRequestInput(nextRequestMessages);
21399
+ if (afterTokens >= beforeTokens || requestOverBudget(nextRequestMessages)) return false;
21400
+ requestMessages = nextRequestMessages;
21401
+ contextMetrics = {
21402
+ ...nextPrepared.metrics,
21403
+ messageCount: requestMessages.length,
21404
+ contentChars: requestMessages.reduce(
21405
+ (total, message) => total + contentCharCount(message.content),
21406
+ 0
21407
+ ),
21408
+ stableContextChars: builtMessages.stableContextChars,
21409
+ dynamicContextChars: builtMessages.dynamicContextChars
21410
+ };
21411
+ callStartedAt = Date.now();
21412
+ requestTelemetry = buildRequestTelemetry({
21413
+ dialogKey: input.continueDialogId || newDialogTelemetryKey,
21246
21414
  messages: requestMessages,
21247
- options: {
21248
- timeoutMs: resolveLlmRequestTimeoutMs(input),
21249
- // 用户取消信号穿进 provider options:providerStreamRetry 据此在
21250
- // 取消后跳过重试,provider 分支(如 antigravity/openai-compatible)
21251
- // 也可把 fetch 绑定到同一信号,实现真正的传输层取消。
21252
- ...input.abortSignal ? { signal: input.abortSignal } : {},
21253
- // 计费归因:续聊轮次带上 dialogId,platform proxy 才能把 token 记录
21254
- // 归到具体对话而不是 chat-proxy 兜底桶。新对话首轮 id 尚未分配。
21255
- ...input.continueDialogId ? { dialogId: input.continueDialogId } : {},
21256
- ...shouldStreamDeltas ? { onTextDelta: (chunk) => {
21257
- llmStreamActivity += 1;
21258
- partialContent += chunk;
21259
- observationBoundary.emit({
21260
- kind: "text-delta",
21261
- chunk,
21262
- round,
21263
- atMs: Date.now()
21264
- });
21265
- } } : {},
21266
- ...shouldStreamReasoning ? { onReasoningDelta: (chunk) => {
21267
- llmStreamActivity += 1;
21268
- observationBoundary.emit({
21269
- kind: "reasoning-delta",
21270
- chunk,
21271
- round,
21272
- atMs: Date.now()
21273
- });
21274
- } } : {},
21275
- ...shouldPassToolEvents ? { onToolEvent: (event) => {
21276
- llmStreamActivity += 1;
21277
- observationBoundary.emit({
21278
- kind: "tool-event",
21279
- event,
21280
- round,
21281
- atMs: Date.now()
21282
- });
21283
- } } : {},
21284
- ...shouldPassToolEvents ? { toolEventRound: round } : {}
21415
+ provenance: {
21416
+ schemaVersion: 1,
21417
+ transport: provider.transport ?? "unknown",
21418
+ phases: [historyLoadedPhase, summaryProjectedPhase, budgetTrimPhase, contextPhase("final-request", requestMessages)],
21419
+ summary: selectedSummary
21285
21420
  },
21286
- timeoutMs: resolveLlmRequestTimeoutMs(input),
21287
- activityVersion: () => llmStreamActivity,
21288
- round,
21289
- input,
21290
- boundary: observationBoundary,
21291
- context: contextMetrics,
21292
- providerName: agentConfig.provider,
21293
- model: provider.model
21421
+ toolsHash: safeToolNamesHash(agentTools)
21294
21422
  });
21295
- } catch (error) {
21296
- if (!providerInvoked && inFlightTransactions.length > 0) {
21297
- const toRollback = inFlightTransactions;
21298
- inFlightTransactions = [];
21299
- try {
21300
- await rollbackInjectionCommits(toRollback);
21301
- } catch (rbErr) {
21302
- error = combineRollbackError(error, rbErr);
21423
+ resetToolImageDelivery(requestMessages.flatMap(toolImages));
21424
+ return true;
21425
+ };
21426
+ let overflowRescueAttempted = false;
21427
+ while (true) {
21428
+ llmStreamActivity = 0;
21429
+ partialContent = "";
21430
+ let providerInvoked = false;
21431
+ try {
21432
+ result4 = await runCompleteWithTimeout({
21433
+ provider: { complete: (messages2, options) => {
21434
+ providerInvoked = true;
21435
+ inFlightTransactions = [];
21436
+ return provider.complete(messages2, options);
21437
+ } },
21438
+ messages: requestMessages,
21439
+ options: {
21440
+ timeoutMs: resolveLlmRequestTimeoutMs(input),
21441
+ // 用户取消信号穿进 provider options:providerStreamRetry 据此在
21442
+ // 取消后跳过重试,provider 分支(如 antigravity/openai-compatible)
21443
+ // 也可把 fetch 绑定到同一信号,实现真正的传输层取消。
21444
+ ...input.abortSignal ? { signal: input.abortSignal } : {},
21445
+ // 计费归因:续聊轮次带上 dialogId,platform proxy 才能把 token 记录
21446
+ // 归到具体对话而不是 chat-proxy 兜底桶。新对话首轮 id 尚未分配。
21447
+ ...input.continueDialogId ? { dialogId: input.continueDialogId } : {},
21448
+ ...shouldStreamDeltas ? { onTextDelta: (chunk) => {
21449
+ llmStreamActivity += 1;
21450
+ partialContent += chunk;
21451
+ observationBoundary.emit({
21452
+ kind: "text-delta",
21453
+ chunk,
21454
+ round,
21455
+ atMs: Date.now()
21456
+ });
21457
+ } } : {},
21458
+ ...shouldStreamReasoning ? { onReasoningDelta: (chunk) => {
21459
+ llmStreamActivity += 1;
21460
+ observationBoundary.emit({
21461
+ kind: "reasoning-delta",
21462
+ chunk,
21463
+ round,
21464
+ atMs: Date.now()
21465
+ });
21466
+ } } : {},
21467
+ ...shouldPassToolEvents ? { onToolEvent: (event) => {
21468
+ llmStreamActivity += 1;
21469
+ observationBoundary.emit({
21470
+ kind: "tool-event",
21471
+ event,
21472
+ round,
21473
+ atMs: Date.now()
21474
+ });
21475
+ } } : {},
21476
+ ...shouldPassToolEvents ? { toolEventRound: round } : {}
21477
+ },
21478
+ timeoutMs: resolveLlmRequestTimeoutMs(input),
21479
+ activityVersion: () => llmStreamActivity,
21480
+ round,
21481
+ input,
21482
+ boundary: observationBoundary,
21483
+ context: contextMetrics,
21484
+ providerName: agentConfig.provider,
21485
+ model: provider.model
21486
+ });
21487
+ } catch (error) {
21488
+ if (!providerInvoked && inFlightTransactions.length > 0) {
21489
+ const toRollback = inFlightTransactions;
21490
+ inFlightTransactions = [];
21491
+ try {
21492
+ await rollbackInjectionCommits(toRollback);
21493
+ } catch (rbErr) {
21494
+ error = combineRollbackError(error, rbErr);
21495
+ }
21303
21496
  }
21497
+ if (providerInvoked) usageLedger.recordProviderCall({
21498
+ model: agentConfig.model,
21499
+ telemetry: {
21500
+ ...requestTelemetry,
21501
+ round,
21502
+ endTs: Date.now(),
21503
+ requestState: input.abortSignal?.aborted ? "cancelled" : "failed"
21504
+ }
21505
+ });
21506
+ if (providerInvoked && !overflowRescueAttempted && llmStreamActivity === 0 && !input.abortSignal?.aborted && isContextOverflowText(toErrorMessage(error))) {
21507
+ overflowRescueAttempted = true;
21508
+ if (await tryOverflowRescueCompaction()) {
21509
+ continue;
21510
+ }
21511
+ }
21512
+ throw error;
21304
21513
  }
21305
- if (providerInvoked) usageLedger.recordProviderCall({
21306
- model: agentConfig.model,
21307
- telemetry: {
21308
- ...requestTelemetry,
21309
- round,
21310
- endTs: Date.now(),
21311
- requestState: input.abortSignal?.aborted ? "cancelled" : "failed"
21514
+ if ((result4.error || result4.runtimeProviderFailure) && !overflowRescueAttempted && llmStreamActivity === 0 && !input.abortSignal?.aborted && isContextOverflowText(result4.runtimeProviderFailure?.message ?? result4.errorMessage ?? "")) {
21515
+ overflowRescueAttempted = true;
21516
+ usageLedger.recordProviderCall({
21517
+ usage: result4.usage,
21518
+ model: result4.model ?? agentConfig.model,
21519
+ provider: result4.provider,
21520
+ telemetry: { ...finalizeCallTelemetry(requestTelemetry, result4, round, callStartedAt), requestState: "failed" }
21521
+ });
21522
+ if (await tryOverflowRescueCompaction()) {
21523
+ continue;
21312
21524
  }
21313
- });
21314
- throw error;
21525
+ }
21526
+ break;
21315
21527
  }
21316
21528
  acceptToolImages.discard(requestMessages.flatMap(toolImages).filter((image) => toolImageDelivery(image) === "impossible"));
21317
21529
  acceptToolImages.commit(
@@ -21607,6 +21819,15 @@ ${reasoningTailLog}
21607
21819
  };
21608
21820
  break;
21609
21821
  }
21822
+ if (!input.abortSignal?.aborted) {
21823
+ const softBudgetAdvisory = softBudgetAdvisor.observeToolCalls(toolCallCount);
21824
+ if (softBudgetAdvisory) {
21825
+ transcript.push({
21826
+ role: "user",
21827
+ content: softBudgetAdvisory.message
21828
+ });
21829
+ }
21830
+ }
21610
21831
  loopTiming.mark("roundEnd", round);
21611
21832
  round += 1;
21612
21833
  }
@@ -23418,7 +23639,7 @@ async function saveCliPendingUserMessages(args2) {
23418
23639
  if (ops.length) await args2.store.batch(ops);
23419
23640
  }
23420
23641
  async function readCliPendingUserMessages(store, dialogId) {
23421
- const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-HVZAQCUD.js");
23642
+ const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-AJ4UKHKT.js");
23422
23643
  const rows = await readDialogMessageRecords({ store, dialogId });
23423
23644
  const uncertain = rows.filter(({ record: record2 }) => record2.metadata?.cliBatchPhase === "requested" && !record2.metadata?.cliBatchResolution);
23424
23645
  const recovery = uncertain.length ? {
@@ -24453,6 +24674,11 @@ export {
24453
24674
  runExecShellGates,
24454
24675
  executeLocalToolWithPolicy,
24455
24676
  LOCAL_TURN_ABORTED_CODE,
24677
+ isSubtaskRun,
24678
+ RUN_WAKE_CHANNEL_ENV,
24679
+ hasRunWakeChannel,
24680
+ filterToolNamesForRunKind,
24681
+ findSummaryAnchorIndex,
24456
24682
  validateStoredSummary,
24457
24683
  projectContextProvenance,
24458
24684
  hashToolDefinitions,