nolo-cli 0.54.0 → 0.61.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.
Files changed (154) hide show
  1. package/README.md +3 -3
  2. package/{_executeModel-OPTKYHJA.js → _executeModel-CKT6RGTL.js} +48 -45
  3. package/{action-ORXWW2ZG.js → action-76JX3JX3.js} +7 -6
  4. package/{addContentAction-53BZ34AE.js → addContentAction-V3NAZRTJ.js} +6 -5
  5. package/{addDialogAgentAction-JRYUS54Y.js → addDialogAgentAction-RZOAF46K.js} +5 -4
  6. package/{agentDeleteCommand-FJIWU2BS.js → agentDeleteCommand-VN7NPXQ4.js} +30 -27
  7. package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-F2TNAV4A.js} +59 -56
  8. package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
  9. package/{agentListCommands-VJNKULIK.js → agentListCommands-OSM2ANI3.js} +61 -31
  10. package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-MTPWYVRV.js} +31 -28
  11. package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
  12. package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-VWAWTVVC.js} +57 -54
  13. package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-PLZOBNVK.js} +61 -58
  14. package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
  15. package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-XCJLRWQE.js} +26 -23
  16. package/{agentSlice-ODKF4J6M.js → agentSlice-F6DOP4IW.js} +8 -7
  17. package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-3BCFTRFJ.js} +30 -27
  18. package/{appDeployCommands-37F4GPCU.js → appDeployCommands-B4GMHCYA.js} +30 -27
  19. package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-4MN36WIG.js} +30 -27
  20. package/{appGetCommands-YLOBA3EM.js → appGetCommands-4GJIEUAX.js} +30 -27
  21. package/{appListCommands-UD62R5ME.js → appListCommands-CHU53GSX.js} +30 -27
  22. package/{authCommand-OK6HLHGS.js → authCommand-WOTWLJNF.js} +35 -29
  23. package/{authCommands-2DUIUEMT.js → authCommands-ILTBI6JV.js} +7 -5
  24. package/{chatQueueReduxAdapter-TV2TUOQS.js → chatQueueReduxAdapter-HNSQXNIR.js} +20 -18
  25. package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
  26. package/{chunk-TR4DXUYX.js → chunk-2HPRMEEZ.js} +1180 -736
  27. package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
  28. package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
  29. package/{chunk-JXIP6ZWH.js → chunk-37QVS7BU.js} +18 -5
  30. package/{chunk-EA5OYZVD.js → chunk-37XDGCY7.js} +1 -1
  31. package/chunk-3BLB7QKO.js +433 -0
  32. package/{chunk-CS6TCJ7E.js → chunk-3JQ2NRYU.js} +30 -7
  33. package/{chunk-RHMDMTDK.js → chunk-3JWKQDA4.js} +2 -2
  34. package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
  35. package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
  36. package/{chunk-EJE33XNR.js → chunk-4C4ST2YE.js} +1521 -565
  37. package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
  38. package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
  39. package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
  40. package/{chunk-5FCIPEKT.js → chunk-7O7KH4X5.js} +1051 -926
  41. package/{chunk-6HDYSFLO.js → chunk-7UF7CQ6B.js} +3 -3
  42. package/{chunk-SUEIAK5N.js → chunk-AQMVUA7N.js} +1 -0
  43. package/{chunk-WQHGJHAL.js → chunk-AVE2YR4F.js} +732 -726
  44. package/{chunk-6COJEAYH.js → chunk-B7DXRX7F.js} +44 -37
  45. package/chunk-BFU6C242.js +66 -0
  46. package/{chunk-IA3A5373.js → chunk-C3FZR5EC.js} +1 -1
  47. package/{chunk-IWUMSAQF.js → chunk-CJCJF5XB.js} +26 -3
  48. package/{chunk-UGBHDMHI.js → chunk-CP7VIDZ7.js} +1 -1
  49. package/{chunk-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
  50. package/{chunk-YBFJQC2M.js → chunk-D5XKNNUV.js} +65 -42
  51. package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
  52. package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
  53. package/{chunk-AA564GBL.js → chunk-DZZL7UBV.js} +1 -1
  54. package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
  55. package/chunk-EDKF7RX4.js +30 -0
  56. package/{chunk-FJHMLRDQ.js → chunk-ES6CVKVD.js} +21 -27
  57. package/{chunk-SYYUU7EV.js → chunk-FHAGENAS.js} +2 -3
  58. package/{chunk-NJUQBYFJ.js → chunk-FKFMIBTT.js} +3 -1
  59. package/{chunk-INZZJSQF.js → chunk-FZGV4FGK.js} +24 -12
  60. package/{chunk-YQBXOHE6.js → chunk-GAL47RNP.js} +1 -1
  61. package/{chunk-UOWXD4VN.js → chunk-HBPV76EK.js} +335 -243
  62. package/{chunk-MLEZPE3U.js → chunk-HLU5Q2GV.js} +4 -4
  63. package/{chunk-TC6P4NDR.js → chunk-HQP7HJDL.js} +6 -6
  64. package/{chunk-7FAS3NEF.js → chunk-IYCUMIYS.js} +19 -15
  65. package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
  66. package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
  67. package/{chunk-XOJRZUPF.js → chunk-KWSQR2KK.js} +14 -29
  68. package/{chunk-2WBFJHQA.js → chunk-L7B47JXR.js} +34 -39
  69. package/{chunk-EICIFHVS.js → chunk-LAFC3B2I.js} +1 -1
  70. package/{chunk-N4JKMCY3.js → chunk-LJKICKVC.js} +2 -2
  71. package/chunk-M3JEW6N6.js +193 -0
  72. package/{chunk-LRGKOI5Y.js → chunk-MBOEV4L2.js} +7 -3
  73. package/{chunk-SVDMVX4G.js → chunk-MMZ6ZTVO.js} +112 -73
  74. package/{chunk-JDSUTNYY.js → chunk-MP64VFGD.js} +2 -2
  75. package/{chunk-NFLA6GSU.js → chunk-MXUDQZXQ.js} +44 -5
  76. package/chunk-N4G4PKQ6.js +23 -0
  77. package/{chunk-KXKQO4Q6.js → chunk-NTW5GWDM.js} +58 -1
  78. package/chunk-ONXOABJR.js +215 -0
  79. package/{chunk-TY3ADTX5.js → chunk-OZX2IPKM.js} +7 -2
  80. package/{chunk-Q4XZVZPN.js → chunk-P7OOB7QP.js} +1 -1
  81. package/{chunk-XIJZOCSP.js → chunk-PEZJEQAO.js} +1 -1
  82. package/{chunk-SWJGJMTW.js → chunk-PQDIDWGX.js} +1 -1
  83. package/chunk-PSCNXBYA.js +11 -0
  84. package/{chunk-BY2FF2C4.js → chunk-QEFJJS2I.js} +55 -73
  85. package/{chunk-BG7J6Y5X.js → chunk-QEW2MFDQ.js} +1 -1
  86. package/{chunk-KLIBF3BY.js → chunk-RDBARW6T.js} +8 -3
  87. package/{chunk-ZVOHVJI3.js → chunk-RJ2SAFB5.js} +82 -35
  88. package/{chunk-MYMBBB6Q.js → chunk-RVWRKFUB.js} +5 -3
  89. package/{chunk-43CXXVJD.js → chunk-RXX4GDIH.js} +1 -1
  90. package/chunk-SEJ5OS6F.js +49 -0
  91. package/{chunk-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
  92. package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
  93. package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
  94. package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
  95. package/{chunk-SVC3GGUA.js → chunk-VMWYBIXG.js} +7 -5
  96. package/{chunk-ZHXJ6M7T.js → chunk-W7XHHYWM.js} +4 -0
  97. package/{chunk-UR66XPVF.js → chunk-XAVSS3KE.js} +21 -3
  98. package/{chunk-A65UV3M5.js → chunk-XOKOSO35.js} +10 -19
  99. package/{chunk-VZMUOPYG.js → chunk-XTJTN3RW.js} +46 -3
  100. package/{chunk-T5HJEUQN.js → chunk-YCDWJX45.js} +1 -1
  101. package/{chunk-BBTN4NQD.js → chunk-Z4QSJILV.js} +85 -13
  102. package/{chunk-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
  103. package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
  104. package/{codingSkills-BCQXRZOI.js → codingSkills-VDXQYWX4.js} +2 -2
  105. package/{contentThunks-KNI6VXLT.js → contentThunks-7YG2ZYQC.js} +21 -19
  106. package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
  107. package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-PJQSCAIO.js} +23 -21
  108. package/{createDialogAction-JDSMY4AY.js → createDialogAction-SFEJX6SP.js} +23 -21
  109. package/{createPageAction-T7RA3HCG.js → createPageAction-B7WRHOQO.js} +24 -22
  110. package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
  111. package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
  112. package/{dialogCommands-UQZYWOOV.js → dialogCommands-VL2X22QC.js} +30 -27
  113. package/{dialogSlice-TYW2G7IL.js → dialogSlice-ANMACABO.js} +20 -18
  114. package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-ITLGZ5YI.js} +29 -26
  115. package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-LH3YNL4C.js} +30 -27
  116. package/{docReadCommands-ZLMFVC67.js → docReadCommands-YAJ77F36.js} +29 -26
  117. package/{docStore-2URPBVCS.js → docStore-D4HGHPWI.js} +6 -5
  118. package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-DQBOMH2G.js} +29 -26
  119. package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
  120. package/handleSendMessageAction-DF2OABGW.js +675 -0
  121. package/index.js +79 -88
  122. package/{lib-2ZTNRXR4.js → lib-FRRS27KN.js} +63 -28
  123. package/{localRuntimeAuthority-KQDAE64E.js → localRuntimeAuthority-R5UBODT3.js} +6 -4
  124. package/{localRuntimeDb-PF7CFKDL.js → localRuntimeDb-P37ZTX55.js} +1 -1
  125. package/{machineCommands-RK6L7ZWL.js → machineCommands-JXDYQ5LB.js} +296 -79
  126. package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-3QHI7JX5.js} +55 -52
  127. package/{memberThunks-THZYZFSN.js → memberThunks-VZI6G7YZ.js} +10 -8
  128. package/{models-JVKUEER5.js → models-FAMINFZ7.js} +2 -2
  129. package/package.json +3 -2
  130. package/{read-K4JU4MQC.js → read-2BYWW7AA.js} +3 -2
  131. package/{readDocTool-LQGR6FUN.js → readDocTool-LC3A7QTB.js} +1 -1
  132. package/{readlineWorkspace-XUFJV3RS.js → readlineWorkspace-KVZTEAHB.js} +4365 -2795
  133. package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
  134. package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-KGTEL7ZP.js} +49 -45
  135. package/{runtimeDoctorCommands-JKTTN723.js → runtimeDoctorCommands-CROTMULY.js} +7 -5
  136. package/{setDialogExtraReferencesAction-KCVJNGMB.js → setDialogExtraReferencesAction-Q32RGFTA.js} +6 -5
  137. package/{setPrimaryDialogAgentAction-VDOBOMKC.js → setPrimaryDialogAgentAction-BFYJHUJS.js} +8 -7
  138. package/{settingSlice-VR2IJSXC.js → settingSlice-IRUU4VFB.js} +6 -5
  139. package/{skillDiscovery-2QTZINON.js → skillDiscovery-NTRLM6KP.js} +1 -1
  140. package/{spaceCommands-S5YJJXL7.js → spaceCommands-KNAYWMCZ.js} +33 -215
  141. package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-FLYPTXKZ.js} +105 -73
  142. package/{switchDialogAgentAction-5L4UP7VI.js → switchDialogAgentAction-L2KOKCGG.js} +5 -4
  143. package/{tableCommands-R6WFRDYF.js → tableCommands-SUNTHAYX.js} +1 -1
  144. package/{toolApiClient-53U4UDFF.js → toolApiClient-VGYUB4P5.js} +2 -1
  145. package/{tools-SSXSTC3O.js → tools-CVLUXK6P.js} +37 -34
  146. package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
  147. package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
  148. package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-HWJIZEIV.js} +23 -21
  149. package/agentSuperviseCommands-5AR3DKNN.js +0 -640
  150. package/chunk-6IGD47IC.js +0 -19
  151. package/chunk-FD36SCCD.js +0 -105
  152. package/chunk-GRFK2XP4.js +0 -230
  153. package/chunk-HJTAGT3W.js +0 -370
  154. package/handleSendMessageAction-GO53TY7U.js +0 -409
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-SVC3GGUA.js";
3
+ } from "./chunk-VMWYBIXG.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-7NYDJAQ7.js";
7
- import {
8
- selectIdentityToken
9
- } from "./chunk-XOJRZUPF.js";
6
+ } from "./chunk-DNNSCSA2.js";
10
7
  import {
11
8
  getIsDesktopApp
12
9
  } from "./chunk-QOKAKDPE.js";
10
+ import {
11
+ selectIdentityToken
12
+ } from "./chunk-SEJ5OS6F.js";
13
13
 
14
14
  // packages/ai/agent/cliChatClient.ts
15
15
  function getCliChatRequestConfig(thunkApi) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  MODEL_LOOKUP_MAP
3
- } from "./chunk-SVDMVX4G.js";
3
+ } from "./chunk-MMZ6ZTVO.js";
4
4
  import {
5
5
  ALL_MODELS
6
- } from "./chunk-NJUQBYFJ.js";
6
+ } from "./chunk-FKFMIBTT.js";
7
7
  import {
8
8
  BUILTIN_NOLO_AGENT_KEY
9
- } from "./chunk-2WBFJHQA.js";
9
+ } from "./chunk-L7B47JXR.js";
10
10
 
11
11
  // packages/ai/llm/getModelContextWindow.ts
12
12
  var DEFAULT_CONTEXT_WINDOW = 256e3;
@@ -34,6 +34,13 @@ function stripPreviewSuffix(model) {
34
34
  }
35
35
  return model;
36
36
  }
37
+ function stripModelTag(model) {
38
+ const colonIndex = model.indexOf(":");
39
+ if (colonIndex > 0) {
40
+ return model.slice(0, colonIndex);
41
+ }
42
+ return model;
43
+ }
37
44
  var fullModelMap = null;
38
45
  var getFullModelMap = () => {
39
46
  if (!fullModelMap) {
@@ -80,25 +87,48 @@ function fuzzyContextWindow(normalizedName) {
80
87
  if (normalizedName.includes("qwen3.7") || normalizedName.includes("qwen3p7")) return 262144;
81
88
  if (normalizedName.includes("minimax-m2") || normalizedName.includes("minimax_m2")) return 262144;
82
89
  if (normalizedName.includes("claude")) return 2e5;
90
+ if (normalizedName.includes("llama3.1") || normalizedName.includes("llama-3.1") || normalizedName.includes("llama3.2") || normalizedName.includes("llama-3.2") || normalizedName.includes("llama3.3") || normalizedName.includes("llama-3.3") || normalizedName.includes("qwen2.5") || normalizedName.includes("qwen-2.5") || normalizedName.includes("mistral-nemo") || normalizedName.includes("phi3.5") || normalizedName.includes("phi-3.5") || normalizedName.includes("phi4") || normalizedName.includes("phi-4")) {
91
+ return 131072;
92
+ }
93
+ if (normalizedName.includes("qwen2") || normalizedName.includes("qwen-2") || normalizedName.includes("mistral") || normalizedName.includes("mixtral")) {
94
+ return 32768;
95
+ }
96
+ if (normalizedName.includes("codellama") || normalizedName.includes("starcoder") || normalizedName.includes("phi3") || normalizedName.includes("phi-3")) {
97
+ return 16384;
98
+ }
99
+ if (normalizedName.includes("llama3") || normalizedName.includes("llama-3") || normalizedName.includes("gemma2") || normalizedName.includes("gemma-2") || normalizedName.includes("gemma")) {
100
+ return 8192;
101
+ }
102
+ if (normalizedName.includes("llama2") || normalizedName.includes("llama-2") || normalizedName.includes("llama")) {
103
+ return 4096;
104
+ }
83
105
  return void 0;
84
106
  }
85
107
  var getModelContextWindow = (modelName) => {
86
108
  if (!modelName) return DEFAULT_CONTEXT_WINDOW;
87
109
  const normalizedName = modelName.toLowerCase();
88
110
  const map = getFullModelMap();
89
- const candidates = [modelName, normalizedName];
90
- const strippedEffort = stripEffortSuffix(modelName);
91
- if (strippedEffort !== modelName) {
92
- candidates.push(strippedEffort, strippedEffort.toLowerCase());
93
- }
94
- const strippedPreview = stripPreviewSuffix(modelName);
95
- if (strippedPreview !== modelName) {
96
- candidates.push(strippedPreview, strippedPreview.toLowerCase());
111
+ const rawCandidates = [modelName, normalizedName];
112
+ const strippedTag = stripModelTag(modelName);
113
+ if (strippedTag !== modelName) {
114
+ rawCandidates.push(strippedTag, strippedTag.toLowerCase());
97
115
  }
98
- if (strippedEffort !== modelName) {
99
- const strippedBoth = stripPreviewSuffix(strippedEffort);
100
- if (strippedBoth !== strippedEffort) {
101
- candidates.push(strippedBoth, strippedBoth.toLowerCase());
116
+ const candidates = [];
117
+ for (const base of rawCandidates) {
118
+ candidates.push(base);
119
+ const strippedEffort = stripEffortSuffix(base);
120
+ if (strippedEffort !== base) {
121
+ candidates.push(strippedEffort, strippedEffort.toLowerCase());
122
+ }
123
+ const strippedPreview = stripPreviewSuffix(base);
124
+ if (strippedPreview !== base) {
125
+ candidates.push(strippedPreview, strippedPreview.toLowerCase());
126
+ }
127
+ if (strippedEffort !== base) {
128
+ const strippedBoth = stripPreviewSuffix(strippedEffort);
129
+ if (strippedBoth !== strippedEffort) {
130
+ candidates.push(strippedBoth, strippedBoth.toLowerCase());
131
+ }
102
132
  }
103
133
  }
104
134
  for (const candidate of candidates) {
@@ -152,7 +182,7 @@ var readCacheCreationInputTokens = (usage) => firstPositive(usage, [
152
182
  ]);
153
183
 
154
184
  // packages/agent-runtime/emptyAssistantRepair.ts
155
- var EMPTY_ASSISTANT_REPAIR_PROMPT = "\u8BF7\u7ED9\u51FA\u660E\u786E\u7684\u6587\u5B57\u56DE\u7B54\u6216\u6267\u884C\u4E0B\u4E00\u6B65\uFF1A\u5982\u679C\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u76F4\u63A5\u603B\u7ED3\u7ED3\u679C\uFF1B\u5982\u679C\u9700\u8981\u8C03\u7528\u5DE5\u5177\uFF0C\u8BF7\u76F4\u63A5\u8F93\u51FA tool_calls\u3002\u8BF7\u5207\u52FF\u8FD4\u56DE\u7A7A\u5185\u5BB9\u3002";
185
+ var EMPTY_ASSISTANT_REPAIR_PROMPT = "\u8BF7\u7ED9\u51FA\u660E\u786E\u7684\u6587\u5B57\u56DE\u7B54\u6216\u6267\u884C\u4E0B\u4E00\u6B65\uFF1A\u5982\u679C\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u76F4\u63A5\u603B\u7ED3\u7ED3\u679C\uFF1B\u5982\u679C\u9700\u8981\u8C03\u7528\u5DE5\u5177\uFF0C\u53EA\u80FD\u8C03\u7528\u672C\u6B21\u8BF7\u6C42\u4E2D\u5DF2\u58F0\u660E\u7684\u5DE5\u5177\u2014\u2014\u4F60\u60F3\u7528\u7684\u5DE5\u5177\u4E0D\u5728\u58F0\u660E\u5217\u8868\u4E2D\u65F6\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u8C03\u7528\u5B83\uFF0C\u76F4\u63A5\u7528\u6587\u5B57\u8BF4\u660E\u8BE5\u80FD\u529B\u5F53\u524D\u4E0D\u53EF\u7528\u3002\u8BF7\u5207\u52FF\u8FD4\u56DE\u7A7A\u5185\u5BB9\u3002";
156
186
  var EMPTY_ASSISTANT_FALLBACK_MESSAGE = "\u6A21\u578B\u8FDE\u7EED\u8FD4\u56DE\u7A7A\u6D88\u606F\uFF0C\u5F53\u524D\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\uFF0C\u6216\u7ED9\u51FA\u66F4\u5177\u4F53\u7684\u4FEE\u6539\u8303\u56F4\u3002";
157
187
  var LENGTH_TRUNCATED_FALLBACK_MESSAGE = "\u8F93\u51FA\u8FBE\u5230\u957F\u5EA6\u4E0A\u9650\u88AB\u622A\u65AD\uFF0C\u5EFA\u8BAE\u7F29\u77ED\u4EFB\u52A1\u6216\u63D0\u9AD8\u8F93\u51FA\u4E0A\u9650\u3002";
158
188
  var STREAM_TRUNCATED_FALLBACK_MESSAGE = "\u4E0A\u6E38\u54CD\u5E94\u6D41\u5728\u6536\u5C3E\u524D\u88AB\u4E2D\u65AD\uFF08\u672A\u6536\u5230\u7ED3\u675F\u6807\u8BB0\uFF09\uFF0C\u672C\u8F6E\u8F93\u51FA\u4E0D\u5B8C\u6574\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\u3002";
@@ -246,7 +276,7 @@ var FLASH_PROFILE = createProfile({
246
276
  tier: "flash",
247
277
  legacyAgentKey: BUILTIN_NOLO_AGENT_KEY,
248
278
  name: "nolo",
249
- model: "glm-5-3-flash"
279
+ model: "deepseek-flash"
250
280
  });
251
281
  var AUTO_EXECUTION_PROFILES = {
252
282
  flash: FLASH_PROFILE,
@@ -15,15 +15,17 @@ import {
15
15
  processThinkChunk
16
16
  } from "./chunk-N7J63Q6C.js";
17
17
  import {
18
+ collectStablePromptPrefix,
18
19
  convertMessagesToResponsesInput,
19
20
  extractTextFromResponseOutput,
20
21
  extractToolCallsFromResponseOutput,
21
22
  getUsageRequestOptions,
22
23
  hasImageParts,
23
24
  shouldStripReasoningContentForOutbound,
25
+ stablePromptCacheKey,
24
26
  toOpenAiCompatibleMessages,
25
27
  toResponsesTools
26
- } from "./chunk-VZMUOPYG.js";
28
+ } from "./chunk-XTJTN3RW.js";
27
29
  import {
28
30
  buildProviderExecutionPlan,
29
31
  canUsePlatformChatProvider,
@@ -33,13 +35,15 @@ import {
33
35
  resolvePlatformAuthToken,
34
36
  resolvePlatformServerUrl,
35
37
  resolveProviderTransportDecision
36
- } from "./chunk-KLIBF3BY.js";
38
+ } from "./chunk-RDBARW6T.js";
37
39
  import {
38
- clipCompactText
39
- } from "./chunk-BBTN4NQD.js";
40
+ clipCompactText,
41
+ isMeaningfulChatCompletionOutput,
42
+ isMeaningfulResponsesOutput
43
+ } from "./chunk-Z4QSJILV.js";
40
44
  import {
41
45
  NOLO_CLIENT_VERSION_HEADER
42
- } from "./chunk-HPW5MNDQ.js";
46
+ } from "./chunk-22BTGNSP.js";
43
47
  import {
44
48
  isRecord
45
49
  } from "./chunk-KUG52IAP.js";
@@ -78,33 +82,6 @@ function extractUsageFromSsePayload(parsed) {
78
82
  return void 0;
79
83
  }
80
84
 
81
- // packages/agent-runtime/promptCacheKey.ts
82
- function collectStablePromptPrefix(messages, fallbackPrompt) {
83
- const systemTexts = [];
84
- if (fallbackPrompt?.trim()) systemTexts.push(fallbackPrompt.trim());
85
- for (const raw of messages) {
86
- if (!raw || typeof raw !== "object") continue;
87
- const message = raw;
88
- const role = String(message.role ?? "");
89
- if (role !== "system" && role !== "developer") continue;
90
- if (typeof message.content === "string") {
91
- const boundary = Number(message.stable_prefix_chars);
92
- const text = Number.isFinite(boundary) && boundary > 0 ? message.content.slice(0, boundary) : message.content;
93
- if (text.trim()) systemTexts.push(text.trim());
94
- }
95
- }
96
- return systemTexts.join("\n\n");
97
- }
98
- function stablePromptCacheKey(parts, namespace) {
99
- const value = JSON.stringify(parts);
100
- let hash = 2166136261;
101
- for (let index = 0; index < value.length; index += 1) {
102
- hash ^= value.charCodeAt(index);
103
- hash = Math.imul(hash, 16777619) >>> 0;
104
- }
105
- return `${namespace}-${hash.toString(16).padStart(8, "0")}`;
106
- }
107
-
108
85
  // packages/core/chat/providerFailureMessage.ts
109
86
  var RAW_BODY_CLIP = 400;
110
87
  function describeProviderFailure(args) {
@@ -266,6 +243,11 @@ function finalizeResponsesToolCalls(calls) {
266
243
  }
267
244
 
268
245
  // packages/agent-runtime/processChatCompletionDelta.ts
246
+ function observeFirstMeaningfulChatCompletionDelta(state) {
247
+ if (!state.onMeaningfulDelta || state.sawMeaningfulDelta) return;
248
+ state.sawMeaningfulDelta = true;
249
+ state.onMeaningfulDelta();
250
+ }
269
251
  function extractChatCompletionStreamError(parsed) {
270
252
  const raw = parsed?.error;
271
253
  if (!raw) return null;
@@ -308,6 +290,9 @@ function applyChatCompletionDelta(parsed, state) {
308
290
  }
309
291
  const delta = parsed?.choices?.[0]?.delta;
310
292
  if (!delta || typeof delta !== "object") return false;
293
+ if (isMeaningfulChatCompletionOutput(delta)) {
294
+ observeFirstMeaningfulChatCompletionDelta(state);
295
+ }
311
296
  const reasoningChunk = typeof delta.reasoning_content === "string" ? delta.reasoning_content : typeof delta.reasoning === "string" ? delta.reasoning : "";
312
297
  if (reasoningChunk) {
313
298
  state.reasoning += reasoningChunk;
@@ -380,6 +365,16 @@ async function* readSseFrames(response) {
380
365
  boundary = findSseFrameBoundary(buffer);
381
366
  }
382
367
  }
368
+ const remaining = decoder.decode();
369
+ if (remaining) {
370
+ buffer += remaining;
371
+ let boundary = findSseFrameBoundary(buffer);
372
+ while (boundary) {
373
+ yield buffer.slice(0, boundary.index);
374
+ buffer = buffer.slice(boundary.index + boundary.separatorLength);
375
+ boundary = findSseFrameBoundary(buffer);
376
+ }
377
+ }
383
378
  if (buffer.trim()) yield buffer;
384
379
  }
385
380
  function findSseFrameBoundary(buffer) {
@@ -405,6 +400,16 @@ async function* streamSseDataValues(response, parse) {
405
400
  if (parsed) yield parsed;
406
401
  }
407
402
  }
403
+ const remaining = decoder.decode();
404
+ if (remaining) {
405
+ buffer += remaining;
406
+ const lines = buffer.split("\n");
407
+ buffer = lines.pop() ?? "";
408
+ for (const line of lines) {
409
+ const parsed = parse(line);
410
+ if (parsed) yield parsed;
411
+ }
412
+ }
408
413
  if (buffer.trim()) {
409
414
  const parsed = parse(buffer);
410
415
  if (parsed) yield parsed;
@@ -419,6 +424,45 @@ async function readSseDataValues(response, parse) {
419
424
  }
420
425
 
421
426
  // packages/agent-runtime/platformChatProvider.ts
427
+ var PlatformStreamInterruptedError = class extends Error {
428
+ code = "PLATFORM_STREAM_INTERRUPTED";
429
+ name = "PlatformStreamInterrupted";
430
+ phase;
431
+ httpStatus;
432
+ frameCount;
433
+ textChars;
434
+ sawDone;
435
+ sawUsage;
436
+ sawFinishReason;
437
+ elapsedMs;
438
+ constructor(args) {
439
+ super(
440
+ args.message ?? `Platform LLM stream interrupted (${args.phase}, frames=${args.frameCount ?? 0}, chars=${args.textChars ?? 0})`,
441
+ args.cause !== void 0 ? { cause: args.cause } : void 0
442
+ );
443
+ this.name = "PlatformStreamInterrupted";
444
+ this.phase = args.phase;
445
+ this.httpStatus = args.httpStatus ?? (args.phase === "streaming" ? 200 : 0);
446
+ this.frameCount = args.frameCount ?? 0;
447
+ this.textChars = args.textChars ?? 0;
448
+ this.sawDone = args.sawDone ?? false;
449
+ this.sawUsage = args.sawUsage ?? false;
450
+ this.sawFinishReason = args.sawFinishReason ?? false;
451
+ this.elapsedMs = args.elapsedMs ?? 0;
452
+ if (args.cause !== void 0 && this.cause === void 0) {
453
+ this.cause = args.cause;
454
+ }
455
+ }
456
+ };
457
+ function isAbortOrTimeoutError(error) {
458
+ if (typeof DOMException !== "undefined" && error instanceof DOMException) {
459
+ return error.name === "AbortError" || error.name === "TimeoutError";
460
+ }
461
+ if (error instanceof Error) {
462
+ return error.name === "AbortError" || error.name === "TimeoutError";
463
+ }
464
+ return false;
465
+ }
422
466
  var CHAT_PROXY_PATH = "/api/v1/chat";
423
467
  function shouldDisableThinking(providerConfig) {
424
468
  return providerConfig.provider.toLowerCase() === "mimo" || /xiaomimimo\.com/i.test(providerConfig.endpoint);
@@ -545,11 +589,12 @@ function buildPlatformChatCompletionRequest(args) {
545
589
  headers: {
546
590
  "Content-Type": "application/json",
547
591
  Authorization: `Bearer ${args.providerConfig.authToken}`,
592
+ ...args.requestId ? { "x-request-id": args.requestId } : {},
548
593
  // 流式请求显式放弃压缩协商。实测记录(2026-09-01,glm-5-3-flash 经
549
594
  // nolo.chat):某个时间窗内 SSE 响应带 content-encoding: gzip 返回,
550
595
  // 整条流被攒成 1 个 chunk,首字节 = 总生成时长(5.8/10.6/16.3s);
551
596
  // 同一分钟交替发起的 identity 请求为 123-138 chunks、首字节
552
- // 1.2-3.6s。即压缩中间件一旦介入,流式的全部 TTFT 收益归零。
597
+ // 1.2-3.6s。即压缩中间件一旦介入,流式的首个输出收益归零。
553
598
  // 该窗口之后线上不再压缩 SSE(同一探针 6/6 未压缩),具体是哪一跳
554
599
  // 压的没有定论;边缘侧已把流式路径排除出 encode
555
600
  // (configureCaddyProxy.sh),这里是不依赖任何中间跳行为的客户端兜底
@@ -709,15 +754,24 @@ function processPlatformChatSseEvent(event, state) {
709
754
  if (dsml.content) {
710
755
  state.content += dsml.content;
711
756
  state.onTextDelta?.(dsml.content);
757
+ if (isMeaningfulResponsesOutput(parsed)) {
758
+ observeFirstMeaningfulChatCompletionDelta(state);
759
+ }
712
760
  }
713
761
  continue;
714
762
  }
715
763
  if (eventType === "response.reasoning_text.delta" && typeof parsed?.delta === "string") {
716
764
  state.reasoning += parsed.delta;
717
765
  state.onReasoningDelta?.(parsed.delta);
766
+ if (isMeaningfulResponsesOutput(parsed)) {
767
+ observeFirstMeaningfulChatCompletionDelta(state);
768
+ }
718
769
  continue;
719
770
  }
720
771
  if (eventType === "response.output_item.added" || eventType === "response.output_item.done" || eventType === "response.function_call_arguments.delta" || eventType === "response.function_call_arguments.done") {
772
+ if (isMeaningfulResponsesOutput(parsed)) {
773
+ observeFirstMeaningfulChatCompletionDelta(state);
774
+ }
721
775
  applyResponsesToolEvent(state.responsesToolCalls, parsed);
722
776
  continue;
723
777
  }
@@ -727,6 +781,8 @@ function processPlatformChatSseEvent(event, state) {
727
781
  }
728
782
  }
729
783
  async function readPlatformChatSseCompletion(args) {
784
+ const startedAtMs = Date.now();
785
+ let frameCount = 0;
730
786
  const state = {
731
787
  content: "",
732
788
  reasoning: "",
@@ -735,6 +791,7 @@ async function readPlatformChatSseCompletion(args) {
735
791
  usesResponsesApi: args.usesResponsesApi,
736
792
  onTextDelta: args.onTextDelta,
737
793
  onReasoningDelta: args.onReasoningDelta,
794
+ ...args.onMeaningfulDelta ? { onMeaningfulDelta: args.onMeaningfulDelta } : {},
738
795
  completedResponsesPayload: void 0,
739
796
  responsesToolCalls: createResponsesToolAccumulator(),
740
797
  dsmlToolCallState: createDsmlParserState(),
@@ -745,8 +802,35 @@ async function readPlatformChatSseCompletion(args) {
745
802
  finishReason: void 0,
746
803
  sawDone: false
747
804
  };
748
- for await (const frame of readSseFrames(args.response)) {
749
- processPlatformChatSseEvent(frame, state);
805
+ try {
806
+ for await (const frame of readSseFrames(args.response)) {
807
+ frameCount += 1;
808
+ processPlatformChatSseEvent(frame, state);
809
+ }
810
+ } catch (cause) {
811
+ if (cause instanceof PlatformStreamInterruptedError) {
812
+ throw cause;
813
+ }
814
+ if (isAbortOrTimeoutError(cause)) {
815
+ throw cause;
816
+ }
817
+ const elapsedMs = Date.now() - startedAtMs;
818
+ const textChars = state.content.length;
819
+ const sawDone = state.sawDone;
820
+ const sawUsage = Boolean(state.usage);
821
+ const sawFinishReason = Boolean(state.finishReason);
822
+ throw new PlatformStreamInterruptedError({
823
+ message: cause instanceof Error ? cause.message : "Platform chat SSE stream interrupted",
824
+ phase: "streaming",
825
+ httpStatus: 200,
826
+ frameCount,
827
+ textChars,
828
+ sawDone,
829
+ sawUsage,
830
+ sawFinishReason,
831
+ elapsedMs,
832
+ cause
833
+ });
750
834
  }
751
835
  flushChatCompletionStream(state);
752
836
  if (state.usesResponsesApi) {
@@ -762,6 +846,8 @@ async function readPlatformChatSseCompletion(args) {
762
846
  if (dsml.content) state.content += dsml.content;
763
847
  }
764
848
  throwIfChatCompletionStreamFailed(state);
849
+ const streamComplete = state.sawDone || Boolean(state.usage) || Boolean(state.finishReason);
850
+ const streamTruncated = !streamComplete;
765
851
  if (state.usesResponsesApi) {
766
852
  const response = state.completedResponsesPayload;
767
853
  const completedToolCalls = response ? extractToolCallsFromResponseOutput(response) : [];
@@ -777,13 +863,13 @@ async function readPlatformChatSseCompletion(args) {
777
863
  );
778
864
  const tool_calls2 = completedToolCalls.length > 0 ? completedToolCalls : normalizedDsmlCalls.length > 0 ? normalizedDsmlCalls : completionsToolCalls.length > 0 ? completionsToolCalls : finalizeResponsesToolCalls(state.responsesToolCalls);
779
865
  const finalUsage2 = mergeBillingIntoUsage(state.usage, state.billing);
780
- const streamComplete2 = state.sawDone || !!state.usage || !!state.finishReason;
781
866
  return {
782
867
  content: normalizedFinal.content || state.content,
783
868
  ...state.reasoning ? { reasoning_content: state.reasoning } : {},
784
869
  ...tool_calls2.length > 0 ? { tool_calls: tool_calls2 } : {},
785
870
  ...finalUsage2 ? { usage: finalUsage2 } : {},
786
- ...streamComplete2 ? { stream_complete: true } : {},
871
+ ...streamComplete ? { stream_complete: true } : {},
872
+ ...streamTruncated ? { streamTruncated: true } : {},
787
873
  // finish_reason 供 executePlatformChatCompletion 穿透给 localLoop 的
788
874
  // 空轮/截断判定;此前 reader 从不回传,流式路径恒缺。
789
875
  ...state.finishReason ? { finish_reason: state.finishReason } : {}
@@ -791,13 +877,13 @@ async function readPlatformChatSseCompletion(args) {
791
877
  }
792
878
  const tool_calls = finalizeAccumulatedToolCalls(state.accumulatedToolCalls);
793
879
  const finalUsage = mergeBillingIntoUsage(state.usage, state.billing);
794
- const streamComplete = state.sawDone || !!state.usage || !!state.finishReason;
795
880
  return {
796
881
  content: state.content,
797
882
  ...state.reasoning ? { reasoning_content: state.reasoning } : {},
798
883
  ...tool_calls.length > 0 ? { tool_calls } : {},
799
884
  ...finalUsage ? { usage: finalUsage } : {},
800
885
  ...streamComplete ? { stream_complete: true } : {},
886
+ ...streamTruncated ? { streamTruncated: true } : {},
801
887
  ...state.finishReason ? { finish_reason: state.finishReason } : {}
802
888
  };
803
889
  }
@@ -841,8 +927,7 @@ export {
841
927
  createResponsesToolAccumulator,
842
928
  applyResponsesToolEvent,
843
929
  finalizeResponsesToolCalls,
844
- collectStablePromptPrefix,
845
- stablePromptCacheKey,
930
+ PlatformStreamInterruptedError,
846
931
  resolvePlatformChatProviderConfig,
847
932
  buildPlatformChatCompletionRequest,
848
933
  parsePlatformChatCompletionData,