nolo-cli 0.95.0-alpha.6 → 0.95.0

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 (180) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-AUQRMRWL.js → _executeModel-4NTXSCYT.js} +67 -63
  3. package/{action-YVYQEAAV.js → action-GI44T4DR.js} +10 -10
  4. package/{addContentAction-O7R66HEX.js → addContentAction-B2DRF7P6.js} +9 -9
  5. package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-T3I7IXPK.js} +15 -17
  6. package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-QYCCUQ35.js} +47 -43
  7. package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-GJ7KXHA6.js} +89 -82
  8. package/{agentListCommands-U46ODMQU.js → agentListCommands-JDU7V3M5.js} +77 -82
  9. package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-PXJG3EDI.js} +42 -38
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-YK2BIIXZ.js} +1 -1
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
  12. package/agentRecordCommands-3ONMYU6P.js +135 -0
  13. package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-L6NJGDBA.js} +88 -80
  14. package/{agentRunControl-XLGD3UZ5.js → agentRunControl-5T64LM2M.js} +2 -2
  15. package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-SYLNOKCT.js} +44 -36
  16. package/{agentSlice-ZYT2OUR3.js → agentSlice-X63VSE6R.js} +11 -11
  17. package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-IP22BHZE.js} +42 -38
  18. package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-5ZTQL6UL.js} +42 -38
  19. package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-G6EMAT75.js} +42 -38
  20. package/{appGetCommands-2AQSOV2A.js → appGetCommands-UXBDAYEM.js} +42 -38
  21. package/{appListCommands-HCIJGZFY.js → appListCommands-J274GTVP.js} +42 -38
  22. package/{authCommand-F4EFRRX6.js → authCommand-W6I6GD3F.js} +115 -23
  23. package/{authCommands-RGOGCPP6.js → authCommands-GBIFZWD3.js} +5 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZMF6YGNO.js} +6 -5
  25. package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-KN774OKJ.js} +30 -29
  26. package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
  27. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
  28. package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
  29. package/{chunk-XOVEWFLK.js → chunk-2JCOP36I.js} +100 -100
  30. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  31. package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
  32. package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
  33. package/chunk-4LCOCOR5.js +50 -0
  34. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  35. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  36. package/{chunk-IAO6JBYW.js → chunk-5B7XS6UO.js} +164 -14
  37. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  38. package/chunk-5J3PYNUP.js +255 -0
  39. package/chunk-5MMAK75Q.js +15 -0
  40. package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
  41. package/{chunk-AFDS2CVM.js → chunk-5T2W2ZZN.js} +15 -20
  42. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  43. package/{chunk-YQTQQX2H.js → chunk-67HHBCFJ.js} +1 -1
  44. package/{chunk-SNPMM7H3.js → chunk-67T7O467.js} +13 -13
  45. package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
  46. package/{chunk-4MY4GLIW.js → chunk-6IHBIRPK.js} +969 -1090
  47. package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
  48. package/{chunk-DHDMC6FO.js → chunk-6TPOEJMQ.js} +9 -4
  49. package/{chunk-LLT642J4.js → chunk-6UPZ63YT.js} +24 -5
  50. package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
  51. package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
  52. package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
  53. package/{chunk-MMPXJXHT.js → chunk-7VJHIB2S.js} +573 -476
  54. package/{chunk-OA6Q2A4I.js → chunk-A7RSPKU6.js} +98 -22
  55. package/{chunk-KQ4ONNQD.js → chunk-ALFH24P3.js} +56 -7
  56. package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
  57. package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
  58. package/{chunk-JRQFUXY7.js → chunk-B2XUQXQX.js} +96 -19
  59. package/chunk-BMQ2MJUK.js +153 -0
  60. package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
  61. package/chunk-CHOZJMJS.js +78 -0
  62. package/{chunk-A6G32FNX.js → chunk-CJXHT3S7.js} +13 -13
  63. package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
  64. package/{chunk-JOHSKZQX.js → chunk-CQMQXVFQ.js} +859 -141
  65. package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
  66. package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
  67. package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
  68. package/{chunk-ZXKVPF4K.js → chunk-DA54MHPJ.js} +236 -36
  69. package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
  70. package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
  71. package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
  72. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  73. package/chunk-GMZLP5DV.js +82 -0
  74. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  75. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  76. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  77. package/{chunk-ZLR5JN3E.js → chunk-HWRQVJGX.js} +7 -7
  78. package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
  79. package/{chunk-NTW5GWDM.js → chunk-I3QNET24.js} +32 -17
  80. package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
  81. package/{chunk-QIAVMDHY.js → chunk-IUVCUGQR.js} +4 -4
  82. package/{chunk-EGSKXKR5.js → chunk-IX27RP45.js} +1 -1
  83. package/{chunk-IIVGDG4I.js → chunk-LNPYTNMG.js} +8 -4
  84. package/{chunk-BLJWCTRL.js → chunk-LVITW736.js} +1 -1
  85. package/{chunk-76WEAXJB.js → chunk-M3LRSBOX.js} +18 -15
  86. package/{chunk-XRWZB6CF.js → chunk-M73PVOVS.js} +23 -76
  87. package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
  88. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  89. package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
  90. package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
  91. package/chunk-OCZKATRC.js +129 -0
  92. package/chunk-P6GMCCAT.js +870 -0
  93. package/{chunk-CPH3W5A7.js → chunk-Q4GP72HX.js} +94 -3
  94. package/{chunk-Z77CRGTW.js → chunk-R4SQ3LGW.js} +1 -1
  95. package/chunk-RE3CDVRX.js +7600 -0
  96. package/{chunk-DEUUPHOO.js → chunk-RKGKDQGJ.js} +74 -17
  97. package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
  98. package/{chunk-BZWBEHGD.js → chunk-S3VFZW75.js} +66 -38
  99. package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
  100. package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
  101. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  102. package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
  103. package/chunk-UNYJU5L6.js +780 -0
  104. package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
  105. package/chunk-V2SAIXHE.js +13349 -0
  106. package/chunk-VIWDGTDA.js +8 -0
  107. package/chunk-VJVNU77E.js +83 -0
  108. package/{chunk-6D6VBVEW.js → chunk-VPFEPRME.js} +9 -9
  109. package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
  110. package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
  111. package/{chunk-BGSLKVCP.js → chunk-XTDH3PGV.js} +6 -7
  112. package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
  113. package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
  114. package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
  115. package/{chunk-TOP2VXOR.js → chunk-Z4CSIXYP.js} +2 -2
  116. package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
  117. package/chunk-ZRAU6T47.js +56 -0
  118. package/commandRegistry-NPS6IYBO.js +833 -0
  119. package/{contentThunks-PT23JWJX.js → contentThunks-EB4JFL4K.js} +32 -30
  120. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  121. package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-NZS7N4AW.js} +32 -30
  122. package/{createDialogAction-XZPLHD5G.js → createDialogAction-4Q4J7P4T.js} +36 -33
  123. package/{createPageAction-KHVJQ3CS.js → createPageAction-FPKRGV7D.js} +38 -36
  124. package/{chunk-3SJQXXGY.js → cursorProvider-YGGNMVWX.js} +2560 -9879
  125. package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
  126. package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
  127. package/{dialogCommands-ZUWW5UT6.js → dialogCommands-XXZH5K6U.js} +45 -41
  128. package/{dialogSlice-3YH242HS.js → dialogSlice-DXEZ3PA3.js} +36 -29
  129. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  130. package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-FLNUDWG6.js} +44 -40
  131. package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-74OURFAB.js} +44 -40
  132. package/{docReadCommands-7BZT2QTW.js → docReadCommands-QENWDQVH.js} +43 -39
  133. package/{docStore-YSZRNUUD.js → docStore-2JTPJVFK.js} +11 -10
  134. package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-J4HWJ5JO.js} +44 -40
  135. package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
  136. package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
  137. package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-FGPHI364.js} +91 -83
  138. package/index.js +87 -884
  139. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
  140. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
  141. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
  142. package/{machineCommands-QC4TD7GJ.js → machineCommands-26AZP4AS.js} +84 -77
  143. package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-GQ5XJ2DL.js} +81 -74
  144. package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
  145. package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
  146. package/oauthTokenStore-ITEB663N.js +23 -0
  147. package/package.json +1 -1
  148. package/pdf-U6KSUEZZ.js +26435 -0
  149. package/processSpawn-SOAV3FEV.js +11 -0
  150. package/profileConfig-ZGOFORWV.js +43 -0
  151. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-DD6NGWW6.js} +7 -7
  152. package/{providerRegistry-757OWH3O.js → providerRegistry-XDRLMYGJ.js} +7 -7
  153. package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
  154. package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
  155. package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-B7NBQCX6.js} +2448 -2022
  156. package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
  157. package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-RVB5K6R2.js} +61 -58
  158. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
  159. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  160. package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
  161. package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
  162. package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
  163. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  164. package/{spaceCommands-P3ONT6LL.js → spaceCommands-BYDGOMW7.js} +44 -40
  165. package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-HV3FSRHN.js} +183 -91
  166. package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
  167. package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
  168. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
  169. package/{tools-R5UF2KZO.js → tools-AZR26MXC.js} +54 -51
  170. package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
  171. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  172. package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-HEWCCXZZ.js} +81 -43
  173. package/agentRecordCommands-SIPURU2S.js +0 -128
  174. package/chunk-FOWEGIMF.js +0 -18881
  175. package/chunk-M76ECQRD.js +0 -13658
  176. package/chunk-Q5FJJ6XI.js +0 -103
  177. package/chunk-S7Z2HMCN.js +0 -25
  178. package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
  179. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  180. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -1,17 +1,15 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-BLJWCTRL.js";
4
+ } from "./chunk-LVITW736.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-76WEAXJB.js";
7
+ } from "./chunk-M3LRSBOX.js";
8
8
  import {
9
- deriveCredentialGroup,
10
- toSafeAgentSummary
11
- } from "./chunk-IAO6JBYW.js";
9
+ deriveCredentialGroup
10
+ } from "./chunk-5B7XS6UO.js";
12
11
  import {
13
12
  PUBLIC_AGENT_KEY_PREFIX,
14
- isOwnedAgentKey,
15
13
  ownedAgentKey,
16
14
  ownedAgentKeyPrefix,
17
15
  parseOwnedAgentId,
@@ -67,16 +65,10 @@ function normalizeListedAgent(record) {
67
65
  ...credentialKind !== void 0 ? { credentialKind } : {},
68
66
  ...typeof record?.apiSource === "string" && record.apiSource ? { apiSource: record.apiSource } : {},
69
67
  ...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {},
70
- ...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {}
68
+ ...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {},
69
+ ...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
71
70
  };
72
71
  }
73
- function toSafeListedAgentSummary(agent, options) {
74
- const summary = toSafeAgentSummary(agent, options);
75
- if (agent.publicRecordExists === false) {
76
- delete summary.publicKey;
77
- }
78
- return summary;
79
- }
80
72
  function sortListedAgents(agents) {
81
73
  agents.sort((a, b) => {
82
74
  const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
@@ -97,6 +89,7 @@ function parseAgentListArgs(args) {
97
89
  publicOnly: args.includes("--public-only"),
98
90
  idsOnly: args.includes("--ids-only"),
99
91
  scope: readArgValue(args, "--scope"),
92
+ query: readArgValue(args, "--query"),
100
93
  showUnavailable: args.includes("--show-unavailable"),
101
94
  // --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
102
95
  // --verbose 拿回完整字段集排障。
@@ -110,7 +103,7 @@ async function listLocalCachedAgents(args) {
110
103
  for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
111
104
  for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
112
105
  if (typeof key !== "string" || !value || typeof value !== "object") continue;
113
- if (isOwnedAgentKey(key, args.userId)) {
106
+ if (key.startsWith(ownedPrefix)) {
114
107
  privateRecords.set(key, { ...value, dbKey: key });
115
108
  continue;
116
109
  }
@@ -237,14 +230,78 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
237
230
  return args.agents;
238
231
  }
239
232
 
233
+ // packages/ai/agent/quotaSnapshot.ts
234
+ function findTightestQuotaWindow(quota, now = Date.now()) {
235
+ if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
236
+ return void 0;
237
+ }
238
+ let best;
239
+ let bestScore = -Infinity;
240
+ for (const w of quota.windows) {
241
+ let score = 0;
242
+ if (typeof w.utilization === "number" && w.utilization >= 0) {
243
+ score = 500 + Math.min(w.utilization, 1) * 500;
244
+ } else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
245
+ const util = Math.max(0, 1 - w.remaining / w.limit);
246
+ score = 500 + util * 500;
247
+ } else if (typeof w.resetAt === "number" && w.resetAt > now) {
248
+ score = 200;
249
+ } else if (typeof w.remaining === "number") {
250
+ score = 100;
251
+ }
252
+ if (score > bestScore) {
253
+ bestScore = score;
254
+ best = w;
255
+ }
256
+ }
257
+ return best ?? quota.windows[0];
258
+ }
259
+ function formatQuotaSummary(quota, now = Date.now(), options) {
260
+ const tightest = findTightestQuotaWindow(quota, now);
261
+ if (!tightest) return void 0;
262
+ const compact = options?.compact === true;
263
+ const parts = [];
264
+ if (typeof tightest.utilization === "number") {
265
+ const pct = Math.round(tightest.utilization * 100);
266
+ parts.push(`${pct}%\u5DF2\u7528`);
267
+ } else if (typeof tightest.remaining === "number") {
268
+ if (typeof tightest.limit === "number") {
269
+ parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
270
+ } else {
271
+ parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
272
+ }
273
+ }
274
+ if (compact) return parts.length > 0 ? parts[0] : void 0;
275
+ if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
276
+ parts.push(tightest.scope);
277
+ }
278
+ if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
279
+ const diffSec = Math.round((tightest.resetAt - now) / 1e3);
280
+ if (diffSec < 60) {
281
+ parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
282
+ } else if (diffSec < 3600) {
283
+ parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
284
+ } else if (diffSec < 86400) {
285
+ const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
286
+ parts.push(`${hours}h\u540E\u91CD\u7F6E`);
287
+ } else {
288
+ const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
289
+ parts.push(`${days}d\u540E\u91CD\u7F6E`);
290
+ }
291
+ }
292
+ if (parts.length === 0) return void 0;
293
+ if (parts.length === 1 && parts[0] === tightest.scope) return void 0;
294
+ return parts.join(" \xB7 ");
295
+ }
296
+
240
297
  export {
241
298
  normalizeListedAgent,
242
- toSafeListedAgentSummary,
243
299
  parseAgentListArgs,
244
300
  listLocalCachedAgents,
245
301
  listRemotePublicAgents,
246
302
  listRemoteAgents,
247
303
  listRemoteAgentsAcrossServers,
248
304
  listFavoriteAgentIdsAcrossServers,
249
- decorateAgentsWithPublicStatusAcrossServers
305
+ decorateAgentsWithPublicStatusAcrossServers,
306
+ formatQuotaSummary
250
307
  };
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  patch,
6
6
  read
7
- } from "./chunk-H62HCIUP.js";
7
+ } from "./chunk-HYZIYH2H.js";
8
8
  import {
9
9
  DEVICE_LOCAL_OWNER_ID,
10
10
  isDeviceLocalSpaceBody
11
- } from "./chunk-UKWGR5SS.js";
11
+ } from "./chunk-WIWM4FE3.js";
12
12
  import {
13
13
  selectIdentityUserId
14
14
  } from "./chunk-SEJ5OS6F.js";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  clipMultilineText,
9
9
  fetchAndSerializeTable
10
- } from "./chunk-MMPXJXHT.js";
10
+ } from "./chunk-7VJHIB2S.js";
11
11
  import {
12
12
  isGatewayHttpStatus
13
13
  } from "./chunk-NF64D32W.js";
@@ -17,37 +17,40 @@ import {
17
17
  normalizeNonNegativeMs,
18
18
  parseRetryAfterHeaderMs
19
19
  } from "./chunk-3L2WKC3W.js";
20
- import {
21
- slateToSimplifiedMarkdown
22
- } from "./chunk-J4MOO56S.js";
23
20
  import {
24
21
  waitForAbortableDelay
25
22
  } from "./chunk-N4G4PKQ6.js";
23
+ import {
24
+ resolvePageReadMarkdown,
25
+ slateToSimplifiedMarkdown
26
+ } from "./chunk-UQNS32WZ.js";
26
27
  import {
27
28
  extractCategorizedMentions
28
29
  } from "./chunk-MEYIRKDN.js";
29
30
  import {
30
31
  fetchAndCacheMessages
31
- } from "./chunk-FOWEGIMF.js";
32
+ } from "./chunk-V2SAIXHE.js";
32
33
  import {
33
34
  shouldUseServerProxy
34
35
  } from "./chunk-YYLHWIW6.js";
35
36
  import {
36
37
  fetchServerSyncedCredential
37
- } from "./chunk-ZLR5JN3E.js";
38
+ } from "./chunk-HWRQVJGX.js";
38
39
  import {
39
40
  buildSkillGuidancePromptBlock,
40
41
  extractRuntimePageCapabilities,
41
42
  resolveBuiltinSkillPage,
42
43
  resolveSkillGraphFromRoots
43
- } from "./chunk-JRQFUXY7.js";
44
+ } from "./chunk-B2XUQXQX.js";
44
45
  import {
46
+ DELETE_SAFETY_RED_LINE,
45
47
  buildIdentityBlock,
46
48
  buildRuntimeGuidanceBlocks,
47
49
  compileContextLayers,
50
+ detectDispatchIntentFromMessages,
48
51
  normalizeChatCompletionsBodyForProvider,
49
52
  resolveToolGuidedSections
50
- } from "./chunk-OA6Q2A4I.js";
53
+ } from "./chunk-A7RSPKU6.js";
51
54
  import {
52
55
  convertMessagesToResponsesInput,
53
56
  getUsageRequestOptions,
@@ -57,64 +60,64 @@ import {
57
60
  import {
58
61
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
59
62
  isAntigravityOAuthAgent
60
- } from "./chunk-UZGQNTVW.js";
63
+ } from "./chunk-S5XGT6GB.js";
61
64
  import {
62
65
  buildProviderAuthHeaders
63
- } from "./chunk-6OZ36FXI.js";
66
+ } from "./chunk-27ONFIEY.js";
64
67
  import {
65
68
  estimateTokenCount
66
69
  } from "./chunk-PSCNXBYA.js";
70
+ import {
71
+ createFileCredentialBroker
72
+ } from "./chunk-ESRMFY7G.js";
67
73
  import {
68
74
  isOpenAiResponsesModel,
69
75
  resolvePlatformChatCompletionsEndpoint,
70
76
  resolvePlatformResponsesEndpoint
71
- } from "./chunk-GQBOR3G6.js";
77
+ } from "./chunk-7KVZ5LDQ.js";
78
+ import {
79
+ toErrorMessage
80
+ } from "./chunk-HNMXYYJR.js";
72
81
  import {
73
82
  clampReasoningEffort,
74
83
  getModelConfig,
75
84
  isModelSupportReasoningEffort
76
- } from "./chunk-OIVSQH2O.js";
77
- import {
78
- createFileCredentialBroker
79
- } from "./chunk-HVURBGF3.js";
85
+ } from "./chunk-3BXNTXYI.js";
80
86
  import {
81
- toErrorMessage
82
- } from "./chunk-HNMXYYJR.js";
87
+ createSpaceKey
88
+ } from "./chunk-UAD2WT54.js";
83
89
  import {
84
90
  MEMORY_USE_GUIDANCE,
85
91
  buildUserResponseLanguageContext,
86
92
  wrapHistoricalSummaryWithReplayGuard
87
- } from "./chunk-2GRGFCF6.js";
93
+ } from "./chunk-4VJAC32I.js";
88
94
  import {
89
95
  canonicalizeToolNames
90
- } from "./chunk-O6OSWFZQ.js";
96
+ } from "./chunk-XUWRURDF.js";
91
97
  import {
92
98
  isDeepInfraKimiModel,
93
99
  isFireworksKimiModel,
94
100
  isPlatformMimoProviderModel,
95
101
  resolveFireworksKimiModel
96
- } from "./chunk-Q67DOFOO.js";
97
- import {
98
- createSpaceKey
99
- } from "./chunk-UAD2WT54.js";
102
+ } from "./chunk-Y3PMXGLH.js";
100
103
  import {
101
104
  read
102
- } from "./chunk-H62HCIUP.js";
105
+ } from "./chunk-HYZIYH2H.js";
103
106
  import {
104
107
  asTrimmedLowercaseString
105
108
  } from "./chunk-QSJ3HFEF.js";
106
- import {
107
- extractCustomId
108
- } from "./chunk-M2EJHDJP.js";
109
109
  import {
110
110
  getRuntimeServerContext
111
- } from "./chunk-UKWGR5SS.js";
111
+ } from "./chunk-WIWM4FE3.js";
112
112
  import {
113
113
  isAbortError
114
114
  } from "./chunk-QOKAKDPE.js";
115
115
  import {
116
116
  isRecord
117
117
  } from "./chunk-KUG52IAP.js";
118
+ import {
119
+ extractCustomId
120
+ } from "./chunk-M2EJHDJP.js";
118
121
  import {
119
122
  asTrimmedString
120
123
  } from "./chunk-3EUW3WEO.js";
@@ -619,7 +622,9 @@ var buildSystemPromptContext = (options) => {
619
622
  ${mainPrompt}` : "";
620
623
  const agentTools = canonicalizeToolNames(agentConfig.tools ?? []);
621
624
  const hasAskTool = agentTools.includes("ask_user");
622
- const toolSections = resolveToolGuidedSections(agentTools);
625
+ const toolSections = resolveToolGuidedSections(agentTools, {
626
+ dispatchIntent: options.dispatchIntent === true
627
+ });
623
628
  const {
624
629
  startupProtocol,
625
630
  contextLayerContract,
@@ -645,6 +650,14 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
645
650
  const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
646
651
  ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
647
652
  return compileContextLayers([
653
+ // 删除安全红线:系统层最高优先级约束,位于所有层之前(含身份信息),
654
+ // owner 要求常驻「根本提示词」的最顶部(2026-09-26 批量误删事故)。
655
+ {
656
+ id: "delete-safety-red-line",
657
+ owner: "platform",
658
+ cacheScope: "static",
659
+ content: DELETE_SAFETY_RED_LINE
660
+ },
648
661
  { id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
649
662
  { id: "user-response-language", owner: "platform", cacheScope: "session", content: buildUserResponseLanguageContext({ language: safeLanguage }) },
650
663
  { id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
@@ -652,6 +665,7 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
652
665
  { id: "tool-round-economy", owner: "platform", cacheScope: "session", content: toolSections.toolRoundEconomy },
653
666
  { id: "tool-use-guidance", owner: "platform", cacheScope: "session", content: toolSections.toolUseGuidance },
654
667
  { id: "privilege-escalation", owner: "platform", cacheScope: "session", content: toolSections.privilegeEscalation },
668
+ { id: "shell-task-lifecycle", owner: "platform", cacheScope: "session", content: toolSections.shellTaskLifecycle },
655
669
  { id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
656
670
  { id: "agent-collaboration", owner: "platform", cacheScope: "session", content: toolSections.agentCollaboration },
657
671
  { id: "web-access", owner: "platform", cacheScope: "session", content: toolSections.webAccess },
@@ -699,8 +713,9 @@ var applyClaudeCache = (stableContent, dynamicContent) => {
699
713
  var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true) => {
700
714
  if (!prependSystemPrompt) return messages;
701
715
  if (!contexts && !agentConfig.prompt) return messages;
716
+ const dispatchIntent = detectDispatchIntentFromMessages(messages);
702
717
  if (isClaudeModel(resolvedModel)) {
703
- const compiled = buildSystemPromptContext({ agentConfig, language, contexts });
718
+ const compiled = buildSystemPromptContext({ agentConfig, language, contexts, dispatchIntent });
704
719
  if (!compiled.content.trim()) return messages;
705
720
  const content = applyClaudeCache(
706
721
  compiled.stablePrefixContent,
@@ -709,7 +724,7 @@ var prependPromptMessage = (messages, agentConfig, resolvedModel, language, cont
709
724
  const systemMessage2 = { role: "system", content };
710
725
  return [systemMessage2, ...messages];
711
726
  }
712
- const promptContent = buildSystemPrompt({ agentConfig, language, contexts });
727
+ const promptContent = buildSystemPrompt({ agentConfig, language, contexts, dispatchIntent });
713
728
  if (!promptContent.trim()) return messages;
714
729
  const systemMessage = { role: "system", content: promptContent };
715
730
  return [systemMessage, ...messages];
@@ -772,8 +787,13 @@ var buildRequestBody = (options) => {
772
787
  endpoint: customProviderUrl
773
788
  });
774
789
  Object.assign(bodyData, usageRequestOptions);
775
- if (reasoning_effort && isModelSupportReasoningEffort(model)) {
776
- const clamped = clampReasoningEffort(reasoning_effort, providerName);
790
+ const effectiveProviderForReasoning = providerName?.toLowerCase() === "openrouter" || customProviderUrl?.toLowerCase().includes("openrouter.ai") ? "openrouter" : providerName;
791
+ if (reasoning_effort && isModelSupportReasoningEffort(model, effectiveProviderForReasoning)) {
792
+ const clamped = clampReasoningEffort(
793
+ reasoning_effort,
794
+ effectiveProviderForReasoning,
795
+ model
796
+ );
777
797
  if (clamped) {
778
798
  bodyData.reasoning_effort = clamped;
779
799
  }
@@ -892,7 +912,9 @@ function generateResponseRequestBody(agentConfig, msgs, contexts, prependSystemP
892
912
  const promptContent = buildSystemPrompt({
893
913
  agentConfig,
894
914
  language,
895
- contexts
915
+ contexts,
916
+ // 按当前用户输入检测派发意图:无意图只注入最小派发协议(安全硬门常在)。
917
+ dispatchIntent: detectDispatchIntentFromMessages(msgs)
896
918
  });
897
919
  body.instructions = promptContent;
898
920
  }
@@ -1202,7 +1224,7 @@ var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
1202
1224
  };
1203
1225
  };
1204
1226
  var fetchDirectly = async (params) => {
1205
- const { api, agentConfig, bodyData, signal, currentServer, token } = params;
1227
+ const { api, agentConfig, bodyData, signal, currentServer, token, dialogId } = params;
1206
1228
  try {
1207
1229
  const apiKey = await resolveDirectRequestApiKey(agentConfig, {
1208
1230
  syncFetcher: currentServer && token ? (ref) => fetchServerSyncedCredential({ currentServer, authToken: token }, ref) : void 0,
@@ -1222,7 +1244,8 @@ var fetchDirectly = async (params) => {
1222
1244
  const authHeaders = buildProviderAuthHeaders({
1223
1245
  endpoint: api,
1224
1246
  apiKey: apiKey ?? "",
1225
- apiKeyHeader: agentConfig.apiKeyHeader
1247
+ apiKeyHeader: agentConfig.apiKeyHeader,
1248
+ sessionId: dialogId || agentConfig.dbKey || agentConfig.key
1226
1249
  });
1227
1250
  return await fetch(api, {
1228
1251
  method: "POST",
@@ -1788,12 +1811,17 @@ ${tableMd}
1788
1811
  `;
1789
1812
  };
1790
1813
  var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
1791
- if (!refContent?.slateData) return null;
1814
+ const hasSlate = Array.isArray(refContent?.slateData) && refContent.slateData.length > 0;
1815
+ const legacyContent = hasSlate ? null : resolvePageReadMarkdown(refContent).trim() || null;
1816
+ if (!hasSlate && !legacyContent) return null;
1792
1817
  const title = refContent.title || `Untitled (${dbKey})`;
1793
1818
  let contentString;
1794
1819
  let contentType;
1795
1820
  const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
1796
- switch (options.format) {
1821
+ if (legacyContent) {
1822
+ contentType = "Markdown (legacy content)";
1823
+ contentString = legacyContent;
1824
+ } else switch (options.format) {
1797
1825
  case "text":
1798
1826
  contentType = "Plain Text";
1799
1827
  contentString = slateToText(refContent.slateData);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-6OZ36FXI.js";
3
+ } from "./chunk-27ONFIEY.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";
@@ -41,7 +41,7 @@ var ANTIGRAVITY_CLOUD_CODE_BASE_URL = "https://daily-cloudcode-pa.googleapis.com
41
41
  var ANTIGRAVITY_CLOUD_CODE_HOST = "cloudcode-pa.googleapis.com";
42
42
  var ANTIGRAVITY_LEGACY_GENERIC_BASE_RE = /^https?:\/\/cloudcode-pa\.googleapis\.com$/i;
43
43
  function getAntigravityUserAgent() {
44
- const version = process.env.NOLO_ANTIGRAVITY_VERSION || "2.1.4";
44
+ const version = process.env.NOLO_ANTIGRAVITY_VERSION || "2.18.1";
45
45
  const os = process.platform === "win32" ? "windows" : process.platform;
46
46
  const arch = process.arch === "x64" ? "amd64" : process.arch === "ia32" ? "386" : process.arch;
47
47
  return `antigravity/hub/${version} ${os}/${arch}`;
@@ -129,7 +129,9 @@ async function refreshAntigravityToken(credential, deps = {}) {
129
129
  payload = {};
130
130
  }
131
131
  if (!response.ok) {
132
- const detail = typeof payload.error_description === "string" && payload.error_description.trim() ? payload.error_description.trim() : typeof payload.error === "string" && payload.error.trim() ? payload.error.trim() : rawBodyText.trim() || `HTTP ${response.status}`;
132
+ const errorCode = typeof payload.error === "string" && payload.error.trim() ? payload.error.trim() : void 0;
133
+ const errorDescription = typeof payload.error_description === "string" && payload.error_description.trim() ? payload.error_description.trim() : void 0;
134
+ const detail = (errorCode && errorDescription && errorDescription !== errorCode ? `${errorCode}: ${errorDescription}` : errorCode ?? errorDescription ?? rawBodyText.trim()) || `HTTP ${response.status}`;
133
135
  throw new Error(`Antigravity token refresh failed: ${detail}`);
134
136
  }
135
137
  if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
@@ -14,12 +14,12 @@ import {
14
14
  toTimestampMs,
15
15
  upsert,
16
16
  write
17
- } from "./chunk-H62HCIUP.js";
17
+ } from "./chunk-HYZIYH2H.js";
18
18
  import {
19
19
  createUserKey,
20
20
  createUserPreferenceKey,
21
21
  ulid
22
- } from "./chunk-VMFTFOWF.js";
22
+ } from "./chunk-3AH7LNUB.js";
23
23
  import {
24
24
  asTrimmedLowercaseString
25
25
  } from "./chunk-QSJ3HFEF.js";
@@ -29,7 +29,7 @@ import {
29
29
  createAction,
30
30
  createAsyncThunk,
31
31
  createSelector
32
- } from "./chunk-UKWGR5SS.js";
32
+ } from "./chunk-WIWM4FE3.js";
33
33
  import {
34
34
  getAllServers,
35
35
  getIsDesktopApp,
@@ -251,13 +251,13 @@ var neutral = {
251
251
  };
252
252
  var ocean = {
253
253
  light: {
254
- primary: "#0969DA",
255
- primaryLight: "#218BFF",
256
- primaryDark: "#0550AE",
257
- primaryGradient: "linear-gradient(135deg, #0969DA, #218BFF)",
258
- primaryGhost: "rgba(9,105,218,0.08)",
259
- primaryHover: "rgba(9,105,218,0.10)",
260
- borderAccent: "#54AEFF",
254
+ primary: "#006EDC",
255
+ primaryLight: "#0874DC",
256
+ primaryDark: "#0052AD",
257
+ primaryGradient: "linear-gradient(135deg, #006EDC, #0874DC)",
258
+ primaryGhost: "rgba(0,110,220,0.08)",
259
+ primaryHover: "rgba(0,110,220,0.10)",
260
+ borderAccent: "#73BEFF",
261
261
  ...semantic.light,
262
262
  ...mkLight("#FFFFFF", "#F6F8FA", "#EBF0F4", "#1C2128", "#57606A", "#6E7781", "#D0D7DE", "#F6F8FA")
263
263
  },
@@ -724,23 +724,23 @@ var mono = {
724
724
  }
725
725
  };
726
726
  var catppuccin = {
727
- // 保留 catppuccin 的柔和圆角 + 弹性缓动;色值换成 Ghostty "GitHub Light/Dark Default"
728
- // 官方 palette,获得通透高对比的观感。合成后名字/位次不变,DEFAULT_THEME_NAME 不动。
727
+ // 保留 catppuccin 的柔和圆角 + 弹性缓动;light surface 沿用 GitHub Light palette,
728
+ // light accent 为品牌海蓝(非 GitHub 蓝),dark 为 Catppuccin Mocha。合成后名字/位次不变,DEFAULT_THEME_NAME 不动。
729
729
  // Reviewer 改进:dark textTertiary/quaternary 提亮达 WCAG AA;light warning 改琥珀色;
730
730
  // light backgroundElevated 拉开与画布的层级,大圆角浮层不再粘连。
731
731
  meta: { radiusBoost: 2, motionEase: "cubic-bezier(0.22, 1, 0.36, 1)" },
732
732
  light: {
733
- // Ghostty GitHub Light Default — 纯白 canvas + blue-500 accent
734
- primary: "#0969DA",
735
- primaryLight: "#218BFF",
736
- primaryDark: "#0550AE",
737
- primaryGradient: "linear-gradient(135deg, #0969DA, #218BFF)",
738
- primaryGhost: "rgba(9,105,218,0.08)",
739
- primaryHover: "rgba(9,105,218,0.10)",
740
- borderAccent: "#54AEFF",
733
+ // 纯白 canvas + 海蓝 accent(#006EDC:白字 4.93:1,#F6F8FA 上 4.63:1;品牌见 docs/brand-outdoor-aesthetic.md)
734
+ primary: "#006EDC",
735
+ primaryLight: "#0874DC",
736
+ primaryDark: "#0052AD",
737
+ primaryGradient: "linear-gradient(135deg, #006EDC, #0874DC)",
738
+ primaryGhost: "rgba(0,110,220,0.08)",
739
+ primaryHover: "rgba(0,110,220,0.10)",
740
+ borderAccent: "#73BEFF",
741
741
  success: "#116329",
742
742
  warning: "#9A6700",
743
- info: "#0969DA",
743
+ info: "#006EDC",
744
744
  error: "#CF222E",
745
745
  background: "#FFFFFF",
746
746
  backgroundSecondary: "#F6F8FA",
@@ -308,6 +308,8 @@ function saveProfileOAuthSync(provider, sync, path = getDefaultProfileConfigPath
308
308
  }
309
309
 
310
310
  export {
311
+ normalizeProfileServerUrl,
312
+ isProtectedHomeProfileWrite,
311
313
  getDefaultProfileConfigPath,
312
314
  loadProfileConfig,
313
315
  clearProfileAuthToken,
@@ -319,6 +321,8 @@ export {
319
321
  getCurrentProfile,
320
322
  saveProfileLocale,
321
323
  getAgentSelectionAuditPath,
324
+ redactArgvSecrets,
325
+ appendAgentSelectionAudit,
322
326
  readLastAgentSelectionAudit,
323
327
  saveProfileAgentSelection,
324
328
  getProfileOAuthSync,
@@ -1,3 +1,6 @@
1
+ import {
2
+ readSseFrames
3
+ } from "./chunk-GMZLP5DV.js";
1
4
  import {
2
5
  sanitizeForOutbound
3
6
  } from "./chunk-CQ3WA2NE.js";
@@ -35,16 +38,18 @@ import {
35
38
  resolvePlatformAuthToken,
36
39
  resolvePlatformServerUrl,
37
40
  resolveProviderTransportDecision
38
- } from "./chunk-6OZ36FXI.js";
41
+ } from "./chunk-27ONFIEY.js";
39
42
  import {
40
- clipCompactText,
41
43
  isMeaningfulChatCompletionOutput,
42
44
  isMeaningfulResponsesOutput
43
- } from "./chunk-WADCY6G6.js";
45
+ } from "./chunk-6ZWMH6TJ.js";
46
+ import {
47
+ clipCompactText
48
+ } from "./chunk-5MMAK75Q.js";
44
49
  import {
45
50
  NOLO_CLIENT_VERSION_HEADER,
46
51
  isPlatformMimoProviderModel
47
- } from "./chunk-Q67DOFOO.js";
52
+ } from "./chunk-Y3PMXGLH.js";
48
53
  import {
49
54
  isRecord
50
55
  } from "./chunk-KUG52IAP.js";
@@ -347,83 +352,6 @@ function flushChatCompletionStream(state) {
347
352
  }
348
353
  }
349
354
 
350
- // packages/agent-runtime/sseFrames.ts
351
- async function* readSseFrames(response) {
352
- const reader = response.body?.getReader();
353
- if (!reader) {
354
- throw new Error("SSE response did not include a readable body.");
355
- }
356
- const decoder = new TextDecoder();
357
- let buffer = "";
358
- while (true) {
359
- const { done, value } = await reader.read();
360
- if (done) break;
361
- buffer += decoder.decode(value, { stream: true });
362
- let boundary = findSseFrameBoundary(buffer);
363
- while (boundary) {
364
- yield buffer.slice(0, boundary.index);
365
- buffer = buffer.slice(boundary.index + boundary.separatorLength);
366
- boundary = findSseFrameBoundary(buffer);
367
- }
368
- }
369
- const remaining = decoder.decode();
370
- if (remaining) {
371
- buffer += remaining;
372
- let boundary = findSseFrameBoundary(buffer);
373
- while (boundary) {
374
- yield buffer.slice(0, boundary.index);
375
- buffer = buffer.slice(boundary.index + boundary.separatorLength);
376
- boundary = findSseFrameBoundary(buffer);
377
- }
378
- }
379
- if (buffer.trim()) yield buffer;
380
- }
381
- function findSseFrameBoundary(buffer) {
382
- const lfLf = buffer.indexOf("\n\n");
383
- const crLfCrLf = buffer.indexOf("\r\n\r\n");
384
- if (lfLf === -1 && crLfCrLf === -1) return null;
385
- const useLf = lfLf !== -1 && (crLfCrLf === -1 || lfLf < crLfCrLf);
386
- return useLf ? { index: lfLf, separatorLength: 2 } : { index: crLfCrLf, separatorLength: 4 };
387
- }
388
- async function* streamSseDataValues(response, parse) {
389
- const reader = response.body?.getReader();
390
- if (!reader) return;
391
- const decoder = new TextDecoder();
392
- let buffer = "";
393
- while (true) {
394
- const { done, value } = await reader.read();
395
- if (done) break;
396
- buffer += decoder.decode(value, { stream: true });
397
- const lines = buffer.split("\n");
398
- buffer = lines.pop() ?? "";
399
- for (const line of lines) {
400
- const parsed = parse(line);
401
- if (parsed) yield parsed;
402
- }
403
- }
404
- const remaining = decoder.decode();
405
- if (remaining) {
406
- buffer += remaining;
407
- const lines = buffer.split("\n");
408
- buffer = lines.pop() ?? "";
409
- for (const line of lines) {
410
- const parsed = parse(line);
411
- if (parsed) yield parsed;
412
- }
413
- }
414
- if (buffer.trim()) {
415
- const parsed = parse(buffer);
416
- if (parsed) yield parsed;
417
- }
418
- }
419
- async function readSseDataValues(response, parse) {
420
- const values = [];
421
- for await (const value of streamSseDataValues(response, parse)) {
422
- values.push(value);
423
- }
424
- return values;
425
- }
426
-
427
355
  // packages/agent-runtime/platformChatProvider.ts
428
356
  var PlatformStreamInterruptedError = class extends Error {
429
357
  code = "PLATFORM_STREAM_INTERRUPTED";
@@ -926,9 +854,6 @@ export {
926
854
  applyChatCompletionDelta,
927
855
  flushChatCompletionStream,
928
856
  providerHttpFailure,
929
- readSseFrames,
930
- streamSseDataValues,
931
- readSseDataValues,
932
857
  createResponsesToolAccumulator,
933
858
  applyResponsesToolEvent,
934
859
  finalizeResponsesToolCalls,