nolo-cli 0.107.0-alpha.4 → 0.107.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 (209) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-UDCSOTD2.js → _executeModel-C4EH5TZG.js} +77 -69
  3. package/action-GVA5ARSJ.js +20 -0
  4. package/{addContentAction-MB2HHMDZ.js → addContentAction-M2WOWZCL.js} +13 -12
  5. package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-QMAQ5Z6N.js} +19 -20
  6. package/{agentDeleteCommand-OWYHN6D6.js → agentDeleteCommand-D3RICSHX.js} +118 -43
  7. package/{agentEmailCommands-AU5I4M4W.js → agentEmailCommands-YC2A4USQ.js} +99 -89
  8. package/agentListCommands-UDJELMYP.js +741 -0
  9. package/{agentMachineCommands-YMNME2L6.js → agentMachineCommands-XH4IBGTO.js} +48 -44
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-CMVTBY5X.js} +97 -2
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
  12. package/agentRecordCommands-3EOC2QMN.js +138 -0
  13. package/agentRunCommand-BTHYOVVS.js +167 -0
  14. package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
  15. package/{agentRuntimeLocal-KCMC2TBD.js → agentRuntimeLocal-N4YGKL7M.js} +44 -40
  16. package/{agentSlice-R7PR6KYM.js → agentSlice-NIN4T6CF.js} +15 -14
  17. package/{appDeleteCommands-JEPA3EWE.js → appDeleteCommands-7DAF33AM.js} +46 -42
  18. package/{appDeployCommands-UTB76XFM.js → appDeployCommands-ZPZSMFGZ.js} +46 -42
  19. package/{appDeployStatusCommands-LGHF2SBD.js → appDeployStatusCommands-FWBDSSS5.js} +46 -42
  20. package/{appGetCommands-PX2BFHOB.js → appGetCommands-SZZOHGEP.js} +46 -42
  21. package/{appListCommands-BSMPTWKC.js → appListCommands-FPMUBDPM.js} +46 -42
  22. package/{authCommand-YW42YZA4.js → authCommand-VL3G26NQ.js} +119 -25
  23. package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZK4K67Y5.js} +11 -9
  25. package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
  26. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
  27. package/{chunk-JDPFV2JV.js → chunk-2NNRWRM5.js} +20 -11
  28. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  29. package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
  30. package/{chunk-UVA7OYO3.js → chunk-2ZHBFX5R.js} +29 -9
  31. package/{chunk-QTGQ2LTL.js → chunk-3DQY5IFB.js} +6 -10
  32. package/chunk-4LCOCOR5.js +50 -0
  33. package/{chunk-JPGCXHNM.js → chunk-4LKMZ3RR.js} +1 -1
  34. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  35. package/{chunk-6D6VBVEW.js → chunk-4W24JM32.js} +80 -14
  36. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  37. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  38. package/chunk-5MMAK75Q.js +15 -0
  39. package/{chunk-7S4YWN7P.js → chunk-5UUIGN6I.js} +4 -4
  40. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  41. package/{chunk-IBOOZVVD.js → chunk-6IJDSYUA.js} +849 -279
  42. package/{chunk-4MK3I7Y4.js → chunk-6MAW4XOF.js} +5 -5
  43. package/chunk-76HO2DP6.js +15 -0
  44. package/chunk-7AY2H3GA.js +13692 -0
  45. package/{chunk-4CR5I7BD.js → chunk-7HYOPBUW.js} +47 -67
  46. package/{chunk-VLTIYV3X.js → chunk-7I25CBT5.js} +34 -8
  47. package/chunk-AGIM7IMJ.js +147 -0
  48. package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
  49. package/{chunk-6OZ36FXI.js → chunk-BIPGGSJS.js} +22 -4
  50. package/{chunk-EYAQT56M.js → chunk-BNQMNUKZ.js} +9 -6
  51. package/{chunk-62CATUYY.js → chunk-CBUMFIFE.js} +834 -962
  52. package/{chunk-OIVSQH2O.js → chunk-CDEEFJXN.js} +308 -11
  53. package/chunk-CHOZJMJS.js +78 -0
  54. package/{chunk-ETI2NYVF.js → chunk-CIP3AAMT.js} +4 -4
  55. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  56. package/{chunk-IBOZNTG2.js → chunk-DGEUP3DK.js} +23 -28
  57. package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
  58. package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
  59. package/{chunk-HKNXJGEC.js → chunk-ECFHBYUW.js} +85 -50
  60. package/{chunk-ACTMNVHM.js → chunk-EHSYSKXV.js} +1 -1
  61. package/{chunk-WV42OMV7.js → chunk-ELUDRSRD.js} +8 -8
  62. package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
  63. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  64. package/{chunk-BFDFRLLQ.js → chunk-EZ4VZHAG.js} +5 -5
  65. package/{chunk-GO3Z72MT.js → chunk-FHLMQIU7.js} +65 -95
  66. package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
  67. package/{chunk-SH43IESU.js → chunk-GGC55Q32.js} +199 -29
  68. package/chunk-GMZLP5DV.js +82 -0
  69. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  70. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  71. package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
  72. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  73. package/{chunk-BNGW5ASC.js → chunk-I2RGRVQ7.js} +22 -2
  74. package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
  75. package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
  76. package/{chunk-GQBOR3G6.js → chunk-JBKHQOYK.js} +8 -4
  77. package/{chunk-XD2MJFUG.js → chunk-JEFXP73H.js} +1 -1
  78. package/{chunk-PBA4UJBK.js → chunk-JIXGJTBU.js} +4 -4
  79. package/{chunk-AEOE4Z6Q.js → chunk-K6L5PNXK.js} +39 -15
  80. package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
  81. package/{chunk-GPCZ7UXG.js → chunk-KD6D6BLA.js} +1 -1
  82. package/{chunk-UZGQNTVW.js → chunk-KHKTDMYG.js} +8 -6
  83. package/{chunk-MRIHM22T.js → chunk-LBFL6RZG.js} +58 -9
  84. package/{chunk-C3M4465B.js → chunk-LKIVH2I2.js} +403 -658
  85. package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
  86. package/{chunk-DHDMC6FO.js → chunk-LUBFABMJ.js} +15 -14
  87. package/{chunk-NA35QHCF.js → chunk-LVBFKW65.js} +1 -1
  88. package/chunk-LWLNLZC5.js +265 -0
  89. package/{chunk-EEGDMATE.js → chunk-M3NMHYRB.js} +86 -81
  90. package/chunk-N4NGJDT6.js +929 -0
  91. package/{chunk-GL3EHUR4.js → chunk-N7NLLRQQ.js} +68 -46
  92. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  93. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  94. package/chunk-NWENLDMM.js +42 -0
  95. package/chunk-O7SVKKLY.js +875 -0
  96. package/chunk-OCZKATRC.js +129 -0
  97. package/{chunk-6Z7MY3V7.js → chunk-OEJLGVBL.js} +5 -5
  98. package/{chunk-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
  99. package/{chunk-GEPUP7OO.js → chunk-OR2UWD6X.js} +3 -3
  100. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  101. package/{chunk-J4MOO56S.js → chunk-PNXHPLRU.js} +10 -2
  102. package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
  103. package/{chunk-P5EVSOPA.js → chunk-R6EBQEQE.js} +22 -29
  104. package/{chunk-NOF3HDSN.js → chunk-RLSF5CSE.js} +11 -9
  105. package/chunk-RQ6CTX2E.js +164 -0
  106. package/{chunk-3UZPUAES.js → chunk-RSB4PWX4.js} +1 -1
  107. package/{chunk-KQ4ONNQD.js → chunk-RXA3HAVW.js} +190 -8
  108. package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
  109. package/chunk-SQHMSDDU.js +8004 -0
  110. package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
  111. package/{chunk-JRQFUXY7.js → chunk-TBAXFWOS.js} +99 -22
  112. package/{chunk-PQFHGD77.js → chunk-TBM2RS3U.js} +161 -14
  113. package/{chunk-XT35TTFG.js → chunk-TCYU7L6V.js} +18 -20
  114. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  115. package/chunk-TY3TIUJK.js +89 -0
  116. package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
  117. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  118. package/chunk-UM7TA3K4.js +1008 -0
  119. package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
  120. package/chunk-VIWDGTDA.js +8 -0
  121. package/chunk-VJVNU77E.js +83 -0
  122. package/{chunk-W7HLWAQ7.js → chunk-VPLUU4IX.js} +118 -90
  123. package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
  124. package/chunk-VZLO4XJD.js +17 -0
  125. package/{chunk-AHAHBQMU.js → chunk-WDLSZMTA.js} +2 -2
  126. package/{chunk-53HEEOTT.js → chunk-WF5X57VW.js} +83 -16
  127. package/{chunk-VRTTFDBM.js → chunk-WPHY3VPF.js} +35 -22
  128. package/{chunk-ASIFZ2WY.js → chunk-YKZLFY5J.js} +66 -54
  129. package/chunk-YV25TM3R.js +780 -0
  130. package/{chunk-MS7TSPZR.js → chunk-YXKNBVYW.js} +19 -17
  131. package/chunk-ZRAU6T47.js +56 -0
  132. package/commandRegistry-UU6IOTHI.js +833 -0
  133. package/{contentThunks-IV2T3EJC.js → contentThunks-ARD56LKI.js} +39 -36
  134. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  135. package/{createAgentAutomationAction-JCOIEYY4.js → createAgentAutomationAction-HWJLU6DD.js} +40 -37
  136. package/createDialogAction-CHYA6PZE.js +70 -0
  137. package/{createPageAction-D2VOOLP3.js → createPageAction-TSCYNFX7.js} +47 -43
  138. package/{chunk-FG3HKPQP.js → cursorProvider-YGGNMVWX.js} +2751 -10185
  139. package/{dbSlice-A6C6H32X.js → dbSlice-TG4MZ5EB.js} +12 -11
  140. package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
  141. package/{dialogCommands-H7FPUYUQ.js → dialogCommands-IJYQAQMB.js} +49 -46
  142. package/{dialogSlice-6JZOOTDS.js → dialogSlice-H476I77R.js} +57 -37
  143. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  144. package/{docCreateCommands-WRG2JLGM.js → docCreateCommands-AZSK4NAG.js} +48 -44
  145. package/{docDeleteCommands-SHWJIBJS.js → docDeleteCommands-DDJMSMFZ.js} +49 -45
  146. package/{docReadCommands-WJN3WT6O.js → docReadCommands-5F5Q6EBZ.js} +47 -43
  147. package/{docStore-HUPQ2FSS.js → docStore-HW2RDZDM.js} +17 -13
  148. package/{docUpdateCommands-IE32IL6O.js → docUpdateCommands-XPNPVZOC.js} +48 -44
  149. package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
  150. package/{getPricing-LUSEABA6.js → getPricing-DOBBZLOK.js} +4 -4
  151. package/{handleSendMessageAction-DFPMQ7YM.js → handleSendMessageAction-IOXE7ILC.js} +109 -42
  152. package/index.js +87 -884
  153. package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
  154. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-UYCKO7YZ.js} +2 -2
  155. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
  156. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
  157. package/{machineCommands-M2T2I5NF.js → machineCommands-Q7TDGM6P.js} +96 -86
  158. package/machineWsRunDispatch-T5VFOQ3R.js +154 -0
  159. package/{memberThunks-P2ECUJ56.js → memberThunks-5S5D3N4U.js} +20 -18
  160. package/{models-T3SG6MJ5.js → models-PQU25T6Q.js} +2 -2
  161. package/oauthTokenStore-ITEB663N.js +23 -0
  162. package/package.json +1 -1
  163. package/processSpawn-SOAV3FEV.js +11 -0
  164. package/profileConfig-ZGOFORWV.js +43 -0
  165. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-HAQWVAQX.js} +7 -7
  166. package/{providerRegistry-757OWH3O.js → providerRegistry-5FGWB3X5.js} +11 -7
  167. package/{read-COE3ZYR6.js → read-LSYFLSIM.js} +8 -7
  168. package/{readDocTool-5USN4A6V.js → readDocTool-XWRXV3DR.js} +5 -3
  169. package/{readlineWorkspace-XQRDGWRZ.js → readlineWorkspace-25U6P3DG.js} +2595 -2031
  170. package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-4TEFC3VL.js} +22 -26
  171. package/{runAgentClientLoop-5ZA62FBA.js → runAgentClientLoop-CZOYWHDN.js} +78 -71
  172. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
  173. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  174. package/{setDialogExtraReferencesAction-WX5VTY6O.js → setDialogExtraReferencesAction-LSEN44OY.js} +16 -14
  175. package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-SR366X5A.js} +23 -27
  176. package/{chunk-GP5LKBUZ.js → settingThunks-CTVPPGIN.js} +226 -940
  177. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  178. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  179. package/{spaceCommands-5GLCWZPO.js → spaceCommands-3UK63WPE.js} +51 -47
  180. package/{streamAgentChatTurn-6UZJMYRB.js → streamAgentChatTurn-LV6ZWUD4.js} +214 -114
  181. package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-M6NAFOOU.js} +19 -20
  182. package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
  183. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-AD7CXTA4.js} +4 -3
  184. package/tools-UJOV6CQZ.js +117 -0
  185. package/{tuiSummaryLlmCaller-OHHFTHMG.js → tuiSummaryLlmCaller-DEH7ZEM6.js} +25 -23
  186. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  187. package/{updateDialogTitleAction-QTKNIURB.js → updateDialogTitleAction-JYXKIBNJ.js} +84 -45
  188. package/action-P4TNFGAD.js +0 -31
  189. package/agentListCommands-B2V4YAC4.js +0 -410
  190. package/agentRecordCommands-G4KK4R7H.js +0 -128
  191. package/agentRunCommand-UTZJA23G.js +0 -156
  192. package/browser-image-compression-MFDTD7K6.js +0 -1763
  193. package/chatQueueReduxAdapter-2P6NFX64.js +0 -186
  194. package/chunk-CQ3WA2NE.js +0 -299
  195. package/chunk-M76ECQRD.js +0 -13658
  196. package/chunk-MEYIRKDN.js +0 -8967
  197. package/chunk-PUOC4YRO.js +0 -394
  198. package/chunk-Q5FJJ6XI.js +0 -103
  199. package/chunk-S7Z2HMCN.js +0 -25
  200. package/chunk-T75QD6AB.js +0 -20923
  201. package/chunk-Y5GCAMGP.js +0 -9
  202. package/chunk-YPREESF4.js +0 -225
  203. package/createDialogAction-NGG7YVNU.js +0 -65
  204. package/machineWsRunDispatch-ISBKOOD7.js +0 -144
  205. package/settingSlice-P4ZW7K5X.js +0 -204
  206. package/syncMapping-N6RGXGBW.js +0 -437
  207. package/tools-KMGFWO43.js +0 -110
  208. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  209. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -0,0 +1,17 @@
1
+ // packages/ai/lecture/mediaToolConfirm.ts
2
+ var MEDIA_TOOL_CONFIRM_STATUS = "requires_confirmation";
3
+ var MEDIA_TOOL_NEEDS_USER_INPUT = true;
4
+ var MEDIA_TOOL_CONFIRM_INTERACTION = "authorize";
5
+ function normalizeMediaConfirmExecutionRevision(value) {
6
+ return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
7
+ }
8
+ function isMediaToolConfirmation(value) {
9
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
10
+ const v = value;
11
+ return v.status === MEDIA_TOOL_CONFIRM_STATUS && v.needsUserInput === MEDIA_TOOL_NEEDS_USER_INPUT && v.interaction === MEDIA_TOOL_CONFIRM_INTERACTION && (v.reason === "unauthorized" || v.reason === "budget_overrun") && typeof v.jobId === "string" && (v.step === "transcribe" || v.step === "translate") && typeof v.summary === "string";
12
+ }
13
+
14
+ export {
15
+ normalizeMediaConfirmExecutionRevision,
16
+ isMediaToolConfirmation
17
+ };
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  patch,
6
6
  read
7
- } from "./chunk-VRTTFDBM.js";
7
+ } from "./chunk-WPHY3VPF.js";
8
8
  import {
9
9
  DEVICE_LOCAL_OWNER_ID,
10
10
  isDeviceLocalSpaceBody
11
- } from "./chunk-UKWGR5SS.js";
11
+ } from "./chunk-O7SVKKLY.js";
12
12
  import {
13
13
  selectIdentityUserId
14
14
  } from "./chunk-SEJ5OS6F.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ writeOAuthCredential
3
+ } from "./chunk-HNGRBWYF.js";
1
4
  import {
2
5
  ANTIGRAVITY_AUTH_URL,
3
6
  ANTIGRAVITY_CALLBACK_PATH,
@@ -11,19 +14,16 @@ import {
11
14
  getAntigravityUserAgent,
12
15
  normalizeAntigravityTokenPayload,
13
16
  refreshAntigravityToken
14
- } from "./chunk-UZGQNTVW.js";
15
- import {
16
- writeOAuthCredential
17
- } from "./chunk-ONXOABJR.js";
17
+ } from "./chunk-KHKTDMYG.js";
18
18
  import {
19
19
  toErrorMessage
20
20
  } from "./chunk-HNMXYYJR.js";
21
- import {
22
- asOptionalFiniteNumber
23
- } from "./chunk-WWC7I6TA.js";
24
21
  import {
25
22
  isRecord
26
23
  } from "./chunk-KUG52IAP.js";
24
+ import {
25
+ asOptionalFiniteNumber
26
+ } from "./chunk-WWC7I6TA.js";
27
27
  import {
28
28
  asTrimmedString
29
29
  } from "./chunk-3EUW3WEO.js";
@@ -367,6 +367,77 @@ async function refreshAntigravityOAuthToken(credential, deps = {}) {
367
367
  // packages/cli/oauth/flows/openai-codex.ts
368
368
  import { createHash as createHash2 } from "node:crypto";
369
369
 
370
+ // packages/agent-runtime/oauthRefreshError.ts
371
+ var PERMANENT_REFRESH_CODES = /* @__PURE__ */ new Set([
372
+ "invalid_grant",
373
+ // OpenAI 令牌端点对失效/不存在的 refresh token 返回 401
374
+ // {"error":{"code":"invalid_refresh_token",...}}(2026-10-01 用必然无效的
375
+ // token 实测)。线上 chatgpt 凭据正是因为没认出它,被当成临时的
376
+ // "unauthorized"、每 15 分钟重试一次且永远不提示重新授权。
377
+ "invalid_refresh_token",
378
+ "refresh_token_reused",
379
+ "invalid_client"
380
+ ]);
381
+ var SAFE_MESSAGES = {
382
+ invalid_grant: "refresh token \u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
383
+ invalid_refresh_token: "refresh token \u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
384
+ refresh_token_reused: "refresh token \u5DF2\u88AB\u5176\u4ED6\u526F\u672C\u4F7F\u7528\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
385
+ invalid_client: "OAuth \u5BA2\u6237\u7AEF\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
386
+ unauthorized: "\u4E0A\u6E38\u62D2\u7EDD\u4E86\u5237\u65B0\u8BF7\u6C42\uFF08401/403\uFF09",
387
+ rate_limited: "\u4E0A\u6E38\u9650\u6D41\uFF0C\u7A0D\u540E\u91CD\u8BD5",
388
+ http_5xx: "\u4E0A\u6E38\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528",
389
+ network: "\u65E0\u6CD5\u8FDE\u63A5\u4E0A\u6E38",
390
+ bad_response: "\u4E0A\u6E38\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94",
391
+ unknown: "\u5237\u65B0\u5931\u8D25"
392
+ };
393
+ var OAuthRefreshError = class extends Error {
394
+ code;
395
+ status;
396
+ retryAfterMs;
397
+ constructor(code, opts = {}) {
398
+ super(SAFE_MESSAGES[code]);
399
+ this.name = "OAuthRefreshError";
400
+ this.code = code;
401
+ if (opts.status !== void 0) this.status = opts.status;
402
+ if (opts.retryAfterMs !== void 0) this.retryAfterMs = opts.retryAfterMs;
403
+ }
404
+ get permanent() {
405
+ return PERMANENT_REFRESH_CODES.has(this.code);
406
+ }
407
+ };
408
+ function readErrorCode(payload) {
409
+ if (!payload || typeof payload !== "object") return void 0;
410
+ const err = payload.error;
411
+ if (typeof err === "string") return err;
412
+ if (err && typeof err === "object") {
413
+ const code = err.code;
414
+ if (typeof code === "string") return code;
415
+ }
416
+ return void 0;
417
+ }
418
+ function classifyOAuthRefreshHttpFailure(status, payload, headers) {
419
+ const raw = readErrorCode(payload)?.toLowerCase();
420
+ if (raw === "invalid_grant") return new OAuthRefreshError("invalid_grant", { status });
421
+ if (raw === "invalid_refresh_token") {
422
+ return new OAuthRefreshError("invalid_refresh_token", { status });
423
+ }
424
+ if (raw === "refresh_token_reused") {
425
+ return new OAuthRefreshError("refresh_token_reused", { status });
426
+ }
427
+ if (raw === "invalid_client") return new OAuthRefreshError("invalid_client", { status });
428
+ if (status === 429) {
429
+ const seconds = Number(headers?.get("retry-after"));
430
+ return new OAuthRefreshError("rate_limited", {
431
+ status,
432
+ ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
433
+ });
434
+ }
435
+ if (status === 401 || status === 403) return new OAuthRefreshError("unauthorized", { status });
436
+ if (status >= 500) return new OAuthRefreshError("http_5xx", { status });
437
+ return new OAuthRefreshError("unknown", { status });
438
+ }
439
+ var TRANSIENT_MAX_MS = 15 * 6e4;
440
+
370
441
  // packages/agent-runtime/openaiCodexOAuth.ts
371
442
  var OPENAI_CODEX_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
372
443
  var OPENAI_CODEX_SCOPES = [
@@ -463,17 +534,14 @@ async function refreshOpenAiCodexToken(credential, deps = {}) {
463
534
  signal: AbortSignal.timeout(OPENAI_CODEX_TOKEN_REQUEST_TIMEOUT_MS)
464
535
  });
465
536
  } catch (error) {
466
- throw new Error(
467
- `OpenAI Codex token refresh failed: ${toErrorMessage(error)}`
468
- );
537
+ throw new OAuthRefreshError("network");
469
538
  }
470
539
  const payload = await response.json().catch(() => ({}));
471
540
  if (!response.ok) {
472
- const detail = typeof payload.error_description === "string" && payload.error_description ? payload.error_description : typeof payload.error === "string" && payload.error ? payload.error : `HTTP ${response.status}`;
473
- throw new Error(`OpenAI Codex token refresh failed: ${detail}`);
541
+ throw classifyOAuthRefreshHttpFailure(response.status, payload, response.headers);
474
542
  }
475
543
  if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
476
- throw new Error("OpenAI Codex token refresh response missing access_token");
544
+ throw new OAuthRefreshError("bad_response");
477
545
  }
478
546
  const now = deps.now?.() ?? Date.now();
479
547
  return normalizeOpenAiCodexTokenPayload({
@@ -1047,11 +1115,10 @@ async function refreshAnthropicToken(credential, deps = {}) {
1047
1115
  });
1048
1116
  const payload = await response.json().catch(() => ({}));
1049
1117
  if (!response.ok) {
1050
- const detail = typeof payload.error_description === "string" ? payload.error_description : typeof payload.error === "string" ? payload.error : `HTTP ${response.status}`;
1051
- throw new Error(`Claude token refresh failed: ${detail}`);
1118
+ throw classifyOAuthRefreshHttpFailure(response.status, payload, response.headers);
1052
1119
  }
1053
1120
  if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
1054
- throw new Error("Claude token refresh response missing access_token");
1121
+ throw new OAuthRefreshError("bad_response");
1055
1122
  }
1056
1123
  const now = deps.now?.() ?? Date.now();
1057
1124
  return normalizeAnthropicTokenPayload({
@@ -1,25 +1,17 @@
1
- import {
2
- fileKey,
3
- getFileIdFromKey,
4
- ulid
5
- } from "./chunk-VMFTFOWF.js";
6
1
  import {
7
2
  loadFileFromIndexedDb,
8
3
  removeAction,
9
4
  saveFileToIndexedDb
10
- } from "./chunk-ABQYVJBJ.js";
5
+ } from "./chunk-EV235ILT.js";
11
6
  import {
12
7
  readAction,
13
8
  readRequestManager,
14
9
  resolveAgentReadServers
15
- } from "./chunk-WV42OMV7.js";
10
+ } from "./chunk-ELUDRSRD.js";
16
11
  import {
17
- asyncThunkCreator,
18
- buildCreateSlice,
12
+ beginWriteAck,
19
13
  compareRemoteRecordsByComparableTime,
20
- createEntityAdapter,
21
14
  getRuntimeServerContext,
22
- noloDeleteRequest,
23
15
  pickBestSettledRemoteRecord,
24
16
  planAuthorityReadServers,
25
17
  resolveAuthorityReplicationServers,
@@ -32,19 +24,30 @@ import {
32
24
  shouldReplaceLocalWithRemoteRecord,
33
25
  shouldReplicateLocalRecord,
34
26
  uploadToCurrentServer
35
- } from "./chunk-UKWGR5SS.js";
36
- import {
37
- fetchFromClientDb,
38
- fetchFromServer,
39
- logger,
40
- normalizeTimeFields
41
- } from "./chunk-QOKAKDPE.js";
27
+ } from "./chunk-O7SVKKLY.js";
42
28
  import {
43
29
  isTombstoneRecord
44
- } from "./chunk-GBRG75BQ.js";
30
+ } from "./chunk-D2MDMY2M.js";
45
31
  import {
46
32
  isRecord
47
33
  } from "./chunk-KUG52IAP.js";
34
+ import {
35
+ fileKey,
36
+ getFileIdFromKey,
37
+ ulid
38
+ } from "./chunk-OKGVNZTL.js";
39
+ import {
40
+ asyncThunkCreator,
41
+ buildCreateSlice,
42
+ createEntityAdapter,
43
+ noloDeleteRequest
44
+ } from "./chunk-VY6VFGKR.js";
45
+ import {
46
+ fetchFromClientDb,
47
+ fetchFromServer,
48
+ logger,
49
+ normalizeTimeFields
50
+ } from "./chunk-HIM3FCLF.js";
48
51
  import {
49
52
  API_ENDPOINTS
50
53
  } from "./chunk-LCBAMY2M.js";
@@ -260,12 +263,14 @@ var writeAction = async (writeConfig, thunkApi) => {
260
263
  `Invalid data type "${data.type}" for writeAction with key ${customKey}. Proceeding anyway.`
261
264
  );
262
265
  }
266
+ let writeAck = null;
263
267
  try {
264
268
  const willSaveData = normalizeTimeFields({
265
269
  ...data,
266
270
  dbKey: customKey,
267
271
  userId: recordUserId
268
272
  });
273
+ writeAck = beginWriteAck(customKey);
269
274
  await saveToClientDb(clientDb, customKey, willSaveData);
270
275
  const servers = resolveAuthorityReplicationServers({
271
276
  currentServer,
@@ -283,8 +288,14 @@ var writeAction = async (writeConfig, thunkApi) => {
283
288
  logger.debug(
284
289
  `[writeAction] Initiating background sync for key: ${customKey} to ${servers.length} servers.`
285
290
  );
286
- scheduleWriteReplication(servers, serverWriteConfig, state);
291
+ const replication = scheduleWriteReplication(
292
+ servers,
293
+ serverWriteConfig,
294
+ state
295
+ );
296
+ writeAck.settleWithReplication(replication);
287
297
  } else {
298
+ writeAck.markNotReplicated();
288
299
  logger.warn(
289
300
  { customKey },
290
301
  "[writeAction] No available servers, data only saved locally."
@@ -292,6 +303,7 @@ var writeAction = async (writeConfig, thunkApi) => {
292
303
  }
293
304
  return willSaveData;
294
305
  } catch (error) {
306
+ writeAck?.markAborted();
295
307
  const errorMessage = `Write action failed for ${customKey}: ${error?.message || "Unknown error"}`;
296
308
  logger.error({ error }, "[writeAction] Error");
297
309
  actionToast.error(`Failed to save data for ${customKey}.`);
@@ -493,6 +505,7 @@ var resolveFileCategory = ({
493
505
  }
494
506
  return "other";
495
507
  };
508
+ var MAX_MEDIA_FILE_SIZE = 120 * 1024 * 1024;
496
509
 
497
510
  // packages/database/actions/upload.ts
498
511
  var saveToClientDb2 = async (clientDb, dbKey, metadata) => {
@@ -712,7 +725,7 @@ var dbSlice = createSliceWithThunks({
712
725
  // 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
713
726
  read: create.asyncThunk(
714
727
  async (payload, thunkApi) => {
715
- const { readAction: readAction2 } = await import("./read-COE3ZYR6.js");
728
+ const { readAction: readAction2 } = await import("./read-LSYFLSIM.js");
716
729
  return readAction2(payload, thunkApi);
717
730
  },
718
731
  {
@@ -786,7 +799,7 @@ var dbSlice = createSliceWithThunks({
786
799
  // 这里改成动态 import,运行期才解析,彻底断开这条边。
787
800
  share: create.asyncThunk(
788
801
  async (config, thunkApi) => {
789
- const { shareResourceAction } = await import("./action-P4TNFGAD.js");
802
+ const { shareResourceAction } = await import("./action-GVA5ARSJ.js");
790
803
  return shareResourceAction(config, thunkApi);
791
804
  }
792
805
  ),
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-C3M4465B.js";
3
+ } from "./chunk-LKIVH2I2.js";
4
4
  import {
5
- i18n_default
6
- } from "./chunk-T75QD6AB.js";
5
+ runtime_default
6
+ } from "./chunk-7AY2H3GA.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
- } from "./chunk-O6OSWFZQ.js";
9
+ } from "./chunk-IHPDK6UD.js";
10
10
  import {
11
11
  isNoloHostedProvider
12
- } from "./chunk-Q67DOFOO.js";
12
+ } from "./chunk-SZC4REES.js";
13
13
  import {
14
14
  asTrimmedLowercaseString
15
15
  } from "./chunk-QSJ3HFEF.js";
@@ -18,6 +18,8 @@ import {
18
18
  } from "./chunk-KUG52IAP.js";
19
19
 
20
20
  // packages/ai/chat/inlineImageUrlsForCustomProvider.ts
21
+ var INLINE_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
22
+ var INLINE_IMAGE_TOTAL_MAX_BYTES = 20 * 1024 * 1024;
21
23
  var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
22
24
  var shouldInlineImageUrlsForAgent = (agentConfig) => {
23
25
  const apiSource = agentConfig?.apiSource?.toLowerCase();
@@ -29,14 +31,14 @@ var shouldInlineImageUrlsForAgent = (agentConfig) => {
29
31
  };
30
32
  var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
31
33
  var bytesToBase64 = (bytes) => {
32
- let binary = "";
33
- for (const byte of bytes) {
34
- binary += String.fromCharCode(byte);
34
+ const chunks = [];
35
+ for (let offset = 0; offset < bytes.length; offset += 32768) {
36
+ chunks.push(String.fromCharCode.apply(null, Array.from(bytes.subarray(offset, offset + 32768))));
35
37
  }
36
- return btoa(binary);
38
+ return btoa(chunks.join(""));
37
39
  };
38
- var defaultFetchImage = async (url) => {
39
- const response = await fetch(url);
40
+ var defaultFetchImage = async (url, signal, _maxBytes) => {
41
+ const response = await fetch(url, { signal });
40
42
  if (!response.ok) {
41
43
  return {
42
44
  ok: false,
@@ -50,59 +52,69 @@ var defaultFetchImage = async (url) => {
50
52
  bytes
51
53
  };
52
54
  };
53
- var cloneImagePartWithDataUrl = async (part, fetchImage, isAllowedImageUrl) => {
55
+ var cloneImagePartWithDataUrl = async (part, fetchImage, options, usedBytes) => {
54
56
  const url = part?.image_url?.url;
55
- if (typeof url !== "string" || !isInlineCandidate(url) || isAllowedImageUrl && !isAllowedImageUrl(url)) {
57
+ if (typeof url !== "string" || !isInlineCandidate(url) || options.isAllowedImageUrl && !options.isAllowedImageUrl(url)) return part;
58
+ if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
59
+ const remaining = options.maxTotalBytes === void 0 ? void 0 : options.maxTotalBytes - usedBytes.value;
60
+ const fetchLimit = options.maxBytes === void 0 ? remaining : remaining === void 0 ? options.maxBytes : Math.min(options.maxBytes, remaining);
61
+ const result = await fetchImage(url, options.signal, fetchLimit);
62
+ if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
63
+ if (result.skippedSize !== void 0) {
64
+ const reason = options.maxBytes !== void 0 && result.skippedSize > options.maxBytes ? "per-image" : "total-budget";
65
+ options.onSkipTooLarge?.(url, result.skippedSize, reason);
56
66
  return part;
57
67
  }
58
- const result = await fetchImage(url);
59
68
  if (!result.ok || !result.bytes) return part;
60
- const mimeType = result.mimeType || "application/octet-stream";
61
- return {
62
- ...part,
63
- image_url: {
64
- ...part.image_url,
65
- url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}`
66
- }
67
- };
69
+ if (options.maxBytes !== void 0 && result.bytes.byteLength > options.maxBytes) {
70
+ options.onSkipTooLarge?.(url, result.bytes.byteLength, "per-image");
71
+ return part;
72
+ }
73
+ if (options.maxTotalBytes !== void 0 && usedBytes.value + result.bytes.byteLength > options.maxTotalBytes) {
74
+ options.onSkipTooLarge?.(url, result.bytes.byteLength, "total-budget");
75
+ return part;
76
+ }
77
+ usedBytes.value += result.bytes.byteLength;
78
+ const mimeType = (result.mimeType || "application/octet-stream").split(";")[0].trim() || "application/octet-stream";
79
+ return { ...part, image_url: { ...part.image_url, url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}` } };
68
80
  };
69
81
  var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
70
82
  if (!options.shouldInline) return bodyData;
71
83
  const body = bodyData;
72
84
  if (!Array.isArray(body?.messages)) return bodyData;
73
85
  const fetchImage = options.fetchImage ?? defaultFetchImage;
74
- let changed = false;
75
- const messages = [];
76
- for (const message of body.messages) {
77
- if (!Array.isArray(message?.content)) {
78
- messages.push(message);
79
- continue;
86
+ const fetched = /* @__PURE__ */ new Map();
87
+ const fetchOnce = (url, signal, maxBytes) => {
88
+ let result = fetched.get(url);
89
+ if (!result) {
90
+ result = fetchImage(url, signal, maxBytes);
91
+ fetched.set(url, result);
80
92
  }
81
- const content = await Promise.all(
82
- message.content.map(async (part) => {
83
- if (part?.type !== "image_url") return part;
84
- return cloneImagePartWithDataUrl(
85
- part,
86
- fetchImage,
87
- options.isAllowedImageUrl
88
- );
89
- })
90
- );
91
- let messageChanged = false;
92
- for (let i = 0; i < content.length; i++) {
93
- if (content[i] !== message.content[i]) {
93
+ return result;
94
+ };
95
+ const usedBytes = { value: 0 };
96
+ let changed = false;
97
+ const messages = [...body.messages];
98
+ for (let mi = messages.length - 1; mi >= 0; mi--) {
99
+ const message = messages[mi];
100
+ if (!Array.isArray(message?.content)) continue;
101
+ const content = [...message.content];
102
+ for (let pi = content.length - 1; pi >= 0; pi--) {
103
+ const part = content[pi];
104
+ if (part?.type !== "image_url") continue;
105
+ if (options.maxTotalBytes !== void 0 && usedBytes.value >= options.maxTotalBytes) {
106
+ if (typeof part?.image_url?.url === "string" && isInlineCandidate(part.image_url.url)) options.onSkipTooLarge?.(part.image_url.url, void 0, "total-budget");
107
+ continue;
108
+ }
109
+ const cloned = await cloneImagePartWithDataUrl(part, fetchOnce, options, usedBytes);
110
+ if (cloned !== part) {
111
+ content[pi] = cloned;
94
112
  changed = true;
95
- messageChanged = true;
96
- break;
97
113
  }
98
114
  }
99
- messages.push(messageChanged ? { ...message, content } : message);
115
+ if (content.some((part, index) => part !== message.content[index])) messages[mi] = { ...message, content };
100
116
  }
101
- if (!changed) return bodyData;
102
- return {
103
- ...body,
104
- messages
105
- };
117
+ return changed ? { ...body, messages } : bodyData;
106
118
  };
107
119
 
108
120
  // packages/ai/tools/toolSchemaCompatibility.ts
@@ -151,12 +163,12 @@ var PREPARE_TOOLS_CACHE_LIMIT = 128;
151
163
  var warnedUnknownToolNames = /* @__PURE__ */ new Set();
152
164
  function getTranslation(keys, defaultVal) {
153
165
  for (const key of keys) {
154
- if (i18n_default.exists(key)) {
155
- return i18n_default.t(key);
166
+ if (runtime_default.exists(key)) {
167
+ return runtime_default.t(key);
156
168
  }
157
169
  const aiKey = key.startsWith("ai:") ? key : `ai:${key}`;
158
- if (i18n_default.exists(aiKey)) {
159
- return i18n_default.t(aiKey);
170
+ if (runtime_default.exists(aiKey)) {
171
+ return runtime_default.t(aiKey);
160
172
  }
161
173
  }
162
174
  return defaultVal;
@@ -203,7 +215,7 @@ function translateSchema(schema) {
203
215
  return nextSchema;
204
216
  }
205
217
  function currentI18nLanguage() {
206
- return typeof i18n_default.language === "string" ? i18n_default.language : "";
218
+ return typeof runtime_default.language === "string" ? runtime_default.language : "";
207
219
  }
208
220
  function translateSchemaCached(schema) {
209
221
  if (!schema || typeof schema !== "object") return schema;