nolo-cli 0.97.0-alpha.1 → 0.97.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 (182) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-JIG7MRXQ.js → _executeModel-DYHTQJZC.js} +68 -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-THAZ5GQS.js → agentDeleteCommand-LLNNP3AM.js} +47 -43
  7. package/{agentEmailCommands-A7T7AJA4.js → agentEmailCommands-EO3H2LDW.js} +90 -82
  8. package/agentListCommands-J3MWAZWO.js +741 -0
  9. package/{agentMachineCommands-DM4N5PK3.js → agentMachineCommands-V65VOQNK.js} +42 -38
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-EMZCM6VA.js} +1 -1
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
  12. package/agentRecordCommands-VY35OMX3.js +136 -0
  13. package/{agentRunCommand-JVSTGVG2.js → agentRunCommand-CSEX4QIH.js} +90 -80
  14. package/{agentRunControl-WCTKX5VL.js → agentRunControl-5T64LM2M.js} +2 -2
  15. package/{agentRuntimeLocal-73CVIWBB.js → agentRuntimeLocal-AY6YNUAL.js} +44 -36
  16. package/{agentSlice-6X4JL2E3.js → agentSlice-FOZUXW7X.js} +11 -11
  17. package/{appDeleteCommands-S7CK4OYL.js → appDeleteCommands-QTTL3QF3.js} +42 -38
  18. package/{appDeployCommands-U6TMS5GO.js → appDeployCommands-43LJECGV.js} +42 -38
  19. package/{appDeployStatusCommands-DTNQJ3LJ.js → appDeployStatusCommands-L5BKOLYW.js} +42 -38
  20. package/{appGetCommands-3SHZEQD5.js → appGetCommands-HOFZKOPC.js} +42 -38
  21. package/{appListCommands-E2ZMIUB6.js → appListCommands-I7C3SJCE.js} +42 -38
  22. package/{authCommand-F4EFRRX6.js → authCommand-2YPMMIJN.js} +117 -23
  23. package/{authCommands-RGOGCPP6.js → authCommands-FFDS4FVX.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-CALVIJTX.js} +6 -5
  25. package/{chatQueueReduxAdapter-LAQEZQKE.js → chatQueueReduxAdapter-NMEZRYC2.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-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  30. package/{chunk-YQTQQX2H.js → chunk-2UV22D2F.js} +1 -1
  31. package/{chunk-R2B3MIZA.js → chunk-3BFMH6GE.js} +6 -7
  32. package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
  33. package/{chunk-QIAVMDHY.js → chunk-3LX6YE3P.js} +4 -4
  34. package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
  35. package/chunk-4LCOCOR5.js +50 -0
  36. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  37. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  38. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  39. package/chunk-5J3PYNUP.js +255 -0
  40. package/chunk-5MMAK75Q.js +15 -0
  41. package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
  42. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  43. package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
  44. package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
  45. package/{chunk-IIVGDG4I.js → chunk-6PHKBY2Q.js} +10 -4
  46. package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
  47. package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
  48. package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
  49. package/{chunk-ZWUOR654.js → chunk-7WCQEMPB.js} +971 -1093
  50. package/{chunk-BLJWCTRL.js → chunk-AOPCEXTB.js} +1 -1
  51. package/{chunk-LXF6XQDT.js → chunk-AQ3I6DZE.js} +865 -207
  52. package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
  53. package/{chunk-RG6JBBX5.js → chunk-AWF3WO5R.js} +166 -13
  54. package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
  55. package/chunk-BMQ2MJUK.js +153 -0
  56. package/{chunk-HWIZU4OL.js → chunk-C3VLSD4K.js} +236 -36
  57. package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
  58. package/chunk-CHOZJMJS.js +78 -0
  59. package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
  60. package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
  61. package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
  62. package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
  63. package/{chunk-KQ4ONNQD.js → chunk-DAWDCRIG.js} +82 -8
  64. package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
  65. package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
  66. package/{chunk-LZIWMYX4.js → chunk-EKS2APRJ.js} +21 -5
  67. package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
  68. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  69. package/chunk-FD5K6MPI.js +7808 -0
  70. package/chunk-GMZLP5DV.js +82 -0
  71. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  72. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  73. package/{chunk-JCIHVIVG.js → chunk-HKTIX4ZE.js} +23 -76
  74. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  75. package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
  76. package/{chunk-3VNWWVKB.js → chunk-I3QNET24.js} +30 -17
  77. package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
  78. package/{chunk-6FVRQBRR.js → chunk-JJ7P5CIY.js} +56 -34
  79. package/{chunk-3WD6RUUJ.js → chunk-JZ5II5UV.js} +15 -20
  80. package/{chunk-JRQFUXY7.js → chunk-KCDUTE5V.js} +96 -19
  81. package/{chunk-Y5HW6GM2.js → chunk-KHVJXNRY.js} +100 -100
  82. package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
  83. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  84. package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
  85. package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
  86. package/{chunk-TDRTS7QW.js → chunk-O6JPWEEK.js} +77 -17
  87. package/chunk-OCZKATRC.js +129 -0
  88. package/{chunk-6D6VBVEW.js → chunk-OTEMQQZI.js} +80 -14
  89. package/{chunk-7OLPQSMQ.js → chunk-OYOWA3CP.js} +24 -5
  90. package/chunk-P6GMCCAT.js +870 -0
  91. package/{chunk-ESWUWEFS.js → chunk-PQTSOHBT.js} +13 -13
  92. package/{chunk-WGR3J4Q6.js → chunk-Q4GP72HX.js} +9 -3
  93. package/{chunk-DHDMC6FO.js → chunk-QKUMVP3O.js} +11 -6
  94. package/{chunk-TZJJ77KQ.js → chunk-RMAWULCS.js} +498 -480
  95. package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
  96. package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
  97. package/{chunk-76WEAXJB.js → chunk-SACTCJAC.js} +18 -15
  98. package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
  99. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  100. package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
  101. package/chunk-TY3TIUJK.js +89 -0
  102. package/chunk-UEGYKNHO.js +13349 -0
  103. package/chunk-UNYJU5L6.js +780 -0
  104. package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
  105. package/chunk-VIWDGTDA.js +8 -0
  106. package/chunk-VJVNU77E.js +83 -0
  107. package/{chunk-54ADB4W7.js → chunk-VYN7O3OY.js} +1 -1
  108. package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
  109. package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
  110. package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
  111. package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
  112. package/{chunk-SNPMM7H3.js → chunk-Y6AZRODX.js} +13 -13
  113. package/{chunk-SQQVLHMH.js → chunk-YJKDTJ2X.js} +7 -7
  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/{chunk-Z77CRGTW.js → chunk-ZYWQNCBN.js} +1 -1
  119. package/commandRegistry-MRPLKSWP.js +833 -0
  120. package/{contentThunks-ATLWNC2D.js → contentThunks-TD5YOAQM.js} +32 -30
  121. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  122. package/{createAgentAutomationAction-QYYWTVUR.js → createAgentAutomationAction-XUG62ANM.js} +32 -30
  123. package/{createDialogAction-7I5VGWCR.js → createDialogAction-L3CMZKNL.js} +36 -33
  124. package/{createPageAction-WNURYCWU.js → createPageAction-WJ3MX6JS.js} +38 -36
  125. package/{chunk-YVIV7WT4.js → cursorProvider-YGGNMVWX.js} +2496 -9890
  126. package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
  127. package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
  128. package/{dialogCommands-RILHDRQ5.js → dialogCommands-VM3I4HBW.js} +45 -41
  129. package/{dialogSlice-W5BYELVR.js → dialogSlice-DSHG3YUE.js} +36 -29
  130. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  131. package/{docCreateCommands-GSTPU7SG.js → docCreateCommands-TYUJPCOP.js} +44 -40
  132. package/{docDeleteCommands-2FC3LSUT.js → docDeleteCommands-5XEG2LXO.js} +44 -40
  133. package/{docReadCommands-27POBA34.js → docReadCommands-M6RO6QHV.js} +43 -39
  134. package/{docStore-7LAHBFP2.js → docStore-RYOGMPEF.js} +11 -10
  135. package/{docUpdateCommands-U4II6VCO.js → docUpdateCommands-DKOFTZRX.js} +44 -40
  136. package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
  137. package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
  138. package/{handleSendMessageAction-SKMJMVRU.js → handleSendMessageAction-XH742B27.js} +91 -83
  139. package/index.js +87 -884
  140. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
  141. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
  142. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
  143. package/{machineCommands-S2RNYKVJ.js → machineCommands-BKYVMMEG.js} +85 -77
  144. package/{machineWsRunDispatch-JC44LBLP.js → machineWsRunDispatch-QOBSQQ72.js} +82 -74
  145. package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
  146. package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
  147. package/oauthTokenStore-ITEB663N.js +23 -0
  148. package/package.json +1 -1
  149. package/pdf-U6KSUEZZ.js +26435 -0
  150. package/processSpawn-SOAV3FEV.js +11 -0
  151. package/profileConfig-ZGOFORWV.js +43 -0
  152. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-76AVU3HD.js} +7 -7
  153. package/{providerRegistry-757OWH3O.js → providerRegistry-Z62NC45X.js} +11 -7
  154. package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
  155. package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
  156. package/{readlineWorkspace-VZSBXUH4.js → readlineWorkspace-7P7IORIT.js} +2450 -2022
  157. package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
  158. package/{runAgentClientLoop-ZYENU7GH.js → runAgentClientLoop-7WXN6I7L.js} +62 -58
  159. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
  160. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  161. package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
  162. package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
  163. package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
  164. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  165. package/{spaceCommands-QB3NNEMN.js → spaceCommands-QFP4ZXKG.js} +44 -40
  166. package/{streamAgentChatTurn-43GPPQSN.js → streamAgentChatTurn-B4PXPJJS.js} +184 -91
  167. package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
  168. package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
  169. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
  170. package/{tools-SX6Y4STZ.js → tools-QFS2L7BU.js} +55 -51
  171. package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
  172. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  173. package/{updateDialogTitleAction-VAKA4ZNY.js → updateDialogTitleAction-HTDYCNNZ.js} +81 -43
  174. package/agentListCommands-BRZFEJQM.js +0 -406
  175. package/agentRecordCommands-TTAEMNHB.js +0 -128
  176. package/chunk-K4YGZD3P.js +0 -18881
  177. package/chunk-M76ECQRD.js +0 -13658
  178. package/chunk-Q5FJJ6XI.js +0 -103
  179. package/chunk-S7Z2HMCN.js +0 -25
  180. package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
  181. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  182. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -11,13 +11,13 @@ import {
11
11
  getAntigravityUserAgent,
12
12
  normalizeAntigravityTokenPayload,
13
13
  refreshAntigravityToken
14
- } from "./chunk-UZGQNTVW.js";
15
- import {
16
- writeOAuthCredential
17
- } from "./chunk-ONXOABJR.js";
14
+ } from "./chunk-S5XGT6GB.js";
18
15
  import {
19
16
  toErrorMessage
20
17
  } from "./chunk-HNMXYYJR.js";
18
+ import {
19
+ writeOAuthCredential
20
+ } from "./chunk-HNGRBWYF.js";
21
21
  import {
22
22
  asOptionalFiniteNumber
23
23
  } from "./chunk-WWC7I6TA.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,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-AFUORTY4.js";
4
+ } from "./chunk-SONWNI3L.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -1,17 +1,15 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-BLJWCTRL.js";
4
+ } from "./chunk-AOPCEXTB.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-76WEAXJB.js";
7
+ } from "./chunk-SACTCJAC.js";
8
8
  import {
9
- deriveCredentialGroup,
10
- toSafeAgentSummary
11
- } from "./chunk-RG6JBBX5.js";
9
+ deriveCredentialGroup
10
+ } from "./chunk-AWF3WO5R.js";
12
11
  import {
13
12
  PUBLIC_AGENT_KEY_PREFIX,
14
- isOwnedAgentKey,
15
13
  ownedAgentKey,
16
14
  ownedAgentKeyPrefix,
17
15
  parseOwnedAgentId,
@@ -53,6 +51,9 @@ function normalizeListedAgent(record) {
53
51
  ...typeof record?.handle === "string" && record.handle ? { handle: record.handle } : {},
54
52
  ...typeof record?.introduction === "string" && record.introduction ? { introduction: record.introduction } : typeof record?.description === "string" && record.description ? { introduction: record.description } : {},
55
53
  ...typeof record?.provider === "string" && record.provider ? { provider: record.provider } : {},
54
+ // 仅供 resolveBillingSource 判定订阅端点(Step Plan / OpenCode Go 等),
55
+ // safe 投影不输出它。缺了它本地 agent list 会把订阅端点全报成 user_api。
56
+ ...typeof record?.customProviderUrl === "string" && record.customProviderUrl ? { customProviderUrl: record.customProviderUrl } : {},
56
57
  ...typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? { inputPrice: record.inputPrice } : {},
57
58
  ...typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? { outputPrice: record.outputPrice } : {},
58
59
  updatedAt: typeof record?.updatedAt === "string" || typeof record?.updatedAt === "number" ? record.updatedAt : typeof record?.createdAt === "string" || typeof record?.createdAt === "number" ? record.createdAt : typeof record?.created === "string" || typeof record?.created === "number" ? record.created : null,
@@ -67,16 +68,10 @@ function normalizeListedAgent(record) {
67
68
  ...credentialKind !== void 0 ? { credentialKind } : {},
68
69
  ...typeof record?.apiSource === "string" && record.apiSource ? { apiSource: record.apiSource } : {},
69
70
  ...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {},
70
- ...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {}
71
+ ...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {},
72
+ ...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
71
73
  };
72
74
  }
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
75
  function sortListedAgents(agents) {
81
76
  agents.sort((a, b) => {
82
77
  const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
@@ -97,6 +92,7 @@ function parseAgentListArgs(args) {
97
92
  publicOnly: args.includes("--public-only"),
98
93
  idsOnly: args.includes("--ids-only"),
99
94
  scope: readArgValue(args, "--scope"),
95
+ query: readArgValue(args, "--query"),
100
96
  showUnavailable: args.includes("--show-unavailable"),
101
97
  // --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
102
98
  // --verbose 拿回完整字段集排障。
@@ -110,7 +106,7 @@ async function listLocalCachedAgents(args) {
110
106
  for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
111
107
  for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
112
108
  if (typeof key !== "string" || !value || typeof value !== "object") continue;
113
- if (isOwnedAgentKey(key, args.userId)) {
109
+ if (key.startsWith(ownedPrefix)) {
114
110
  privateRecords.set(key, { ...value, dbKey: key });
115
111
  continue;
116
112
  }
@@ -237,14 +233,78 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
237
233
  return args.agents;
238
234
  }
239
235
 
236
+ // packages/ai/agent/quotaSnapshot.ts
237
+ function findTightestQuotaWindow(quota, now = Date.now()) {
238
+ if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
239
+ return void 0;
240
+ }
241
+ let best;
242
+ let bestScore = -Infinity;
243
+ for (const w of quota.windows) {
244
+ let score = 0;
245
+ if (typeof w.utilization === "number" && w.utilization >= 0) {
246
+ score = 500 + Math.min(w.utilization, 1) * 500;
247
+ } else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
248
+ const util = Math.max(0, 1 - w.remaining / w.limit);
249
+ score = 500 + util * 500;
250
+ } else if (typeof w.resetAt === "number" && w.resetAt > now) {
251
+ score = 200;
252
+ } else if (typeof w.remaining === "number") {
253
+ score = 100;
254
+ }
255
+ if (score > bestScore) {
256
+ bestScore = score;
257
+ best = w;
258
+ }
259
+ }
260
+ return best ?? quota.windows[0];
261
+ }
262
+ function formatQuotaSummary(quota, now = Date.now(), options) {
263
+ const tightest = findTightestQuotaWindow(quota, now);
264
+ if (!tightest) return void 0;
265
+ const compact = options?.compact === true;
266
+ const parts = [];
267
+ if (typeof tightest.utilization === "number") {
268
+ const pct = Math.round(tightest.utilization * 100);
269
+ parts.push(`${pct}%\u5DF2\u7528`);
270
+ } else if (typeof tightest.remaining === "number") {
271
+ if (typeof tightest.limit === "number") {
272
+ parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
273
+ } else {
274
+ parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
275
+ }
276
+ }
277
+ if (compact) return parts.length > 0 ? parts[0] : void 0;
278
+ if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
279
+ parts.push(tightest.scope);
280
+ }
281
+ if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
282
+ const diffSec = Math.round((tightest.resetAt - now) / 1e3);
283
+ if (diffSec < 60) {
284
+ parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
285
+ } else if (diffSec < 3600) {
286
+ parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
287
+ } else if (diffSec < 86400) {
288
+ const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
289
+ parts.push(`${hours}h\u540E\u91CD\u7F6E`);
290
+ } else {
291
+ const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
292
+ parts.push(`${days}d\u540E\u91CD\u7F6E`);
293
+ }
294
+ }
295
+ if (parts.length === 0) return void 0;
296
+ if (parts.length === 1 && parts[0] === tightest.scope) return void 0;
297
+ return parts.join(" \xB7 ");
298
+ }
299
+
240
300
  export {
241
301
  normalizeListedAgent,
242
- toSafeListedAgentSummary,
243
302
  parseAgentListArgs,
244
303
  listLocalCachedAgents,
245
304
  listRemotePublicAgents,
246
305
  listRemoteAgents,
247
306
  listRemoteAgentsAcrossServers,
248
307
  listFavoriteAgentIdsAcrossServers,
249
- decorateAgentsWithPublicStatusAcrossServers
308
+ decorateAgentsWithPublicStatusAcrossServers,
309
+ formatQuotaSummary
250
310
  };
@@ -0,0 +1,129 @@
1
+ // packages/ai/chat/parseApiError.ts
2
+ var CONTEXT_OVERFLOW_ACTIONS = [
3
+ "compact-and-retry",
4
+ "new-dialog",
5
+ "switch-model",
6
+ "retry"
7
+ ];
8
+ var CONTEXT_TOO_LARGE_ACTIONS = [
9
+ "new-dialog",
10
+ "switch-model",
11
+ "retry"
12
+ ];
13
+ var truncateErrorMessage = (message, maxChars = 320) => message.length <= maxChars ? message : `${message.slice(0, maxChars)}\u2026`;
14
+ var isContextOverflowText = (message) => /maximum context|context (length|window|overflow|limit)|context_length_exceed\w*|requested about .*tokens|too many tokens|prompt is too long|exceeds? (the )?(model|max)/i.test(
15
+ message
16
+ );
17
+ function classifyApiError(input) {
18
+ const { status, message, body, code } = input;
19
+ const errorMessage = message;
20
+ let defaultMessage = `\u72B6\u6001\u7801 ${status} ${input.statusText ?? ""}`;
21
+ switch (status) {
22
+ case 400:
23
+ if (isContextOverflowText(errorMessage) || isContextOverflowText(body) || code === "UPSTREAM_400") {
24
+ return {
25
+ kind: "context_overflow",
26
+ message: "\u4E0A\u4E0B\u6587\u8FC7\u957F\uFF1A\u672C\u8F6E\u6D88\u606F\u6216\u5DE5\u5177\u7ED3\u679C\u592A\u5927\u3002\u8BF7\u7F29\u5C0F\u8303\u56F4\uFF0C\u6216\u5148\u8BFB\u53D6\u66F4\u5C0F\u7247\u6BB5\u540E\u518D\u7EE7\u7EED\u3002",
27
+ code,
28
+ status,
29
+ retryable: true,
30
+ actions: [...CONTEXT_OVERFLOW_ACTIONS]
31
+ };
32
+ }
33
+ if (code === "MISSING_PROVIDER_API_KEY") {
34
+ return {
35
+ kind: "generic",
36
+ message: truncateErrorMessage(errorMessage),
37
+ code,
38
+ status,
39
+ retryable: false
40
+ };
41
+ }
42
+ if (errorMessage && errorMessage !== defaultMessage) {
43
+ return {
44
+ kind: "generic",
45
+ message: `\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}`,
46
+ code,
47
+ status,
48
+ retryable: false
49
+ };
50
+ }
51
+ return { kind: "generic", message: "\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165", code, status, retryable: false };
52
+ case 413:
53
+ return {
54
+ kind: "context_too_large",
55
+ message: "\u8BF7\u6C42\u5185\u5BB9\u8FC7\u5927\uFF1A\u8BF7\u51CF\u5C11\u4E00\u6B21\u53D1\u9001\u7684\u6D88\u606F\u3001\u6587\u4EF6\u6216\u5DE5\u5177\u7ED3\u679C\u3002",
56
+ code,
57
+ status,
58
+ retryable: true,
59
+ actions: [...CONTEXT_TOO_LARGE_ACTIONS]
60
+ };
61
+ case 401:
62
+ return {
63
+ kind: "auth",
64
+ message: code === "AUTH_TOKEN_EXPIRED" ? "\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_ACCOUNT_INVALID" ? "\u8D26\u6237\u65E0\u6548\u6216\u5DF2\u88AB\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458" : code === "AUTH_NO_TOKEN" ? "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55" : code === "AUTH_INVALID_TOKEN" ? "\u767B\u5F55\u51ED\u8BC1\u65E0\u6548\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_TOKEN_NOT_ACTIVE" ? "\u4EE4\u724C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5" : errorMessage && errorMessage !== `\u72B6\u6001\u7801 401 Unauthorized` ? `\u8BA4\u8BC1\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}` : "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55",
65
+ code,
66
+ status,
67
+ retryable: true,
68
+ actions: ["retry"]
69
+ };
70
+ case 503:
71
+ return {
72
+ kind: "server",
73
+ message: errorMessage && errorMessage !== `\u72B6\u6001\u7801 503 Service Unavailable` ? truncateErrorMessage(errorMessage) : "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
74
+ code,
75
+ status,
76
+ retryable: true,
77
+ actions: ["retry"]
78
+ };
79
+ case 504:
80
+ return {
81
+ kind: "timeout",
82
+ message: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
83
+ code,
84
+ status,
85
+ retryable: true,
86
+ actions: ["retry"]
87
+ };
88
+ default:
89
+ return {
90
+ kind: "generic",
91
+ message: `API\u8BF7\u6C42\u5931\u8D25: ${truncateErrorMessage(errorMessage)}`,
92
+ code,
93
+ status,
94
+ retryable: true,
95
+ actions: ["retry"]
96
+ };
97
+ }
98
+ }
99
+ async function parseApiErrorInfo(response) {
100
+ const errorBody = await response.text();
101
+ let errorMessage = `\u72B6\u6001\u7801 ${response.status} ${response.statusText}`;
102
+ let errorCode = `E${response.status}`;
103
+ try {
104
+ const errorJson = JSON.parse(errorBody);
105
+ errorMessage = errorJson?.error?.message || errorJson?.message || errorJson?.msg || errorBody || errorMessage;
106
+ errorCode = errorJson?.error?.code || errorJson?.code || errorCode;
107
+ } catch (_e) {
108
+ if (errorBody) {
109
+ errorMessage = errorBody;
110
+ }
111
+ }
112
+ return classifyApiError({
113
+ status: response.status,
114
+ statusText: response.statusText,
115
+ message: errorMessage,
116
+ body: errorBody,
117
+ code: errorCode
118
+ });
119
+ }
120
+ async function parseApiError(response) {
121
+ return (await parseApiErrorInfo(response)).message;
122
+ }
123
+
124
+ export {
125
+ CONTEXT_OVERFLOW_ACTIONS,
126
+ CONTEXT_TOO_LARGE_ACTIONS,
127
+ isContextOverflowText,
128
+ parseApiError
129
+ };
@@ -1,9 +1,19 @@
1
+ import {
2
+ _appendRetiredStateBatch,
3
+ loadMemoryVNextCatalog
4
+ } from "./chunk-TY3TIUJK.js";
1
5
  import {
2
6
  resolveMachineId
3
7
  } from "./chunk-ESHYE7WU.js";
4
8
  import {
5
9
  getDefaultCliLocalRuntimeDb
6
- } from "./chunk-2F7RJC6L.js";
10
+ } from "./chunk-ZOVKKMF6.js";
11
+ import {
12
+ resolveAuthTokenFromEnv
13
+ } from "./chunk-A7GB5UGH.js";
14
+ import {
15
+ DEFAULT_NOLO_SERVER_URL
16
+ } from "./chunk-OLZBQWZU.js";
7
17
  import {
8
18
  buildCliRuntimeEnv,
9
19
  clearProfileAuthToken,
@@ -12,20 +22,14 @@ import {
12
22
  getProfileTokens,
13
23
  loadProfileConfig,
14
24
  saveDefaultProfile
15
- } from "./chunk-BYMV6QZG.js";
16
- import {
17
- resolveAuthTokenFromEnv
18
- } from "./chunk-A7GB5UGH.js";
19
- import {
20
- DEFAULT_NOLO_SERVER_URL
21
- } from "./chunk-OLZBQWZU.js";
25
+ } from "./chunk-TNIX77YM.js";
22
26
  import {
23
27
  asTrimmedNonEmptyStringArray,
24
28
  createMemoryKey,
25
29
  createMemoryOwnerIndexKey,
26
30
  createMemorySubjectKindIndexKey,
27
31
  memoryOwnerRange
28
- } from "./chunk-VMFTFOWF.js";
32
+ } from "./chunk-3AH7LNUB.js";
29
33
  import {
30
34
  asTrimmedString
31
35
  } from "./chunk-3EUW3WEO.js";
@@ -39,6 +43,29 @@ import { stdin as input, stdout as output } from "node:process";
39
43
  import { spawn } from "node:child_process";
40
44
 
41
45
  // packages/ai/memory/delete.ts
46
+ var VNEXT_STATE_ID_PREFIX = "vnext-state-";
47
+ var toVNextMemoryItem = (state, owner) => ({
48
+ id: `${VNEXT_STATE_ID_PREFIX}${state.id}`,
49
+ ownerType: owner.ownerType,
50
+ ownerId: owner.ownerId,
51
+ visibility: "private",
52
+ subjectType: "user",
53
+ subjectId: owner.ownerId,
54
+ kind: "semantic",
55
+ content: state.text.trim(),
56
+ createdAt: state.createdAt,
57
+ lastActivatedAt: state.createdAt,
58
+ activationCount: 1,
59
+ importance: 0.9,
60
+ confidence: 0.9,
61
+ resident: state.facet === "preference" || state.facet === "style"
62
+ });
63
+ var matchesVNextFilters = (state, idSet, contentSub) => {
64
+ if (!idSet && !contentSub) return false;
65
+ if (idSet && !idSet.has(`${VNEXT_STATE_ID_PREFIX}${state.id}`)) return false;
66
+ if (contentSub && !state.text.toLowerCase().includes(contentSub)) return false;
67
+ return true;
68
+ };
42
69
  function hasExplicitDeleteFilters(filters) {
43
70
  return Boolean(
44
71
  filters.ids && filters.ids.length > 0 || typeof filters.contentSubstring === "string" && filters.contentSubstring.trim().length > 0 || filters.tags && filters.tags.length > 0 || typeof filters.sourceDialogId === "string" && filters.sourceDialogId.trim().length > 0 || typeof filters.patternKeyPrefix === "string" && filters.patternKeyPrefix.trim().length > 0 || filters.facets && filters.facets.length > 0 || typeof filters.subjectId === "string" && filters.subjectId.trim().length > 0
@@ -127,8 +154,32 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
127
154
  matchedItems.push(item);
128
155
  if (matchedItems.length >= limit) break;
129
156
  }
157
+ const idSet = normalizeSet(filters.ids);
158
+ const contentSub = asTrimmedString(filters.contentSubstring).toLowerCase();
159
+ const vnextStateIdsToRetire = [];
160
+ const vnextStatesToRetire = [];
161
+ const vnextMatchedItems = [];
162
+ let vnextPrincipalId = null;
163
+ const hasScopingFilters = Boolean(
164
+ normalizeSet(filters.kinds) || normalizeSet(filters.facets) || normalizeSet(filters.tags) || asTrimmedString(filters.subjectType) || asTrimmedString(filters.subjectId) || asTrimmedString(filters.patternKeyPrefix) || asTrimmedString(filters.sourceDialogId)
165
+ );
166
+ const canMatchVNext = !hasScopingFilters && (contentSub.length > 0 || idSet !== null && [...idSet].some((id) => id.startsWith(VNEXT_STATE_ID_PREFIX)));
167
+ if (canMatchVNext) {
168
+ vnextPrincipalId = `${owner.ownerType}:${encodeURIComponent(owner.ownerId)}`;
169
+ const catalog = await loadMemoryVNextCatalog(db, vnextPrincipalId);
170
+ for (const state of catalog.states) {
171
+ if (matchedItems.length >= limit) break;
172
+ if (state.retiredAt) continue;
173
+ if (!matchesVNextFilters(state, idSet, contentSub)) continue;
174
+ vnextStateIdsToRetire.push(state.id);
175
+ vnextStatesToRetire.push(state);
176
+ const projected = toVNextMemoryItem(state, owner);
177
+ vnextMatchedItems.push(projected);
178
+ matchedItems.push(projected);
179
+ }
180
+ }
130
181
  if (matchedItems.length === 0) {
131
- return { deletedCount: 0, deletedIds: [], matchedItems: [] };
182
+ return { deletedCount: 0, deletedIds: [], retiredIds: [], matchedItems: [] };
132
183
  }
133
184
  const token = generateMemoryDeletionToken(
134
185
  owner.ownerId,
@@ -138,6 +189,7 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
138
189
  return {
139
190
  deletedCount: 0,
140
191
  deletedIds: [],
192
+ retiredIds: [],
141
193
  matchedItems,
142
194
  deletionToken: token
143
195
  };
@@ -147,14 +199,28 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
147
199
  "deletionToken mismatch: memory dataset changed since preview; please rerun dry-run preview before confirming."
148
200
  );
149
201
  }
150
- const batch = db.batch();
151
- for (const item of matchedItems) {
152
- deleteMemoryItemWithIndexesInBatch(batch, item);
202
+ const vnextMatchedIdSet = new Set(
203
+ vnextStateIdsToRetire.map((stateId) => `${VNEXT_STATE_ID_PREFIX}${stateId}`)
204
+ );
205
+ const legacyItems = matchedItems.filter((item) => !vnextMatchedIdSet.has(item.id));
206
+ const shouldRetireVNext = vnextStatesToRetire.length > 0;
207
+ if (legacyItems.length > 0 || shouldRetireVNext) {
208
+ const batch = db.batch();
209
+ for (const item of legacyItems) {
210
+ deleteMemoryItemWithIndexesInBatch(batch, item);
211
+ }
212
+ if (shouldRetireVNext) {
213
+ const nowIso = (/* @__PURE__ */ new Date()).toISOString();
214
+ for (const state of vnextStatesToRetire) {
215
+ _appendRetiredStateBatch(batch, { ...state, retiredAt: nowIso });
216
+ }
217
+ }
218
+ await batch.write();
153
219
  }
154
- await batch.write();
155
220
  return {
156
221
  deletedCount: matchedItems.length,
157
222
  deletedIds: matchedItems.map((item) => item.id),
223
+ retiredIds: vnextMatchedItems.map((item) => item.id),
158
224
  matchedItems,
159
225
  deletionToken: token
160
226
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-YVIV7WT4.js";
3
+ } from "./chunk-FD5K6MPI.js";
4
4
  import {
5
5
  getReadableCliDb
6
- } from "./chunk-LS2ZANRJ.js";
6
+ } from "./chunk-CTUQJVQM.js";
7
7
  import {
8
8
  buildCreatedAgentRecord,
9
9
  buildUpdatedAgentRecord,
@@ -12,7 +12,7 @@ import {
12
12
  resolveAgentRecordFromHybridStore,
13
13
  sanitizeAgentRecordForCliOutput,
14
14
  writeAgentRecord
15
- } from "./chunk-76WEAXJB.js";
15
+ } from "./chunk-SACTCJAC.js";
16
16
  import {
17
17
  resolveCliAgentKeyInput
18
18
  } from "./chunk-SV5IJK6K.js";
@@ -212,7 +212,7 @@ async function runAgentCreateCommand(args, deps = {}) {
212
212
  clearCliLocalRuntimePreparedAgentCache();
213
213
  let verifyResult;
214
214
  if (parsed.verify) {
215
- const { verifyCustomProvider } = await import("./agentProviderCommands-GNPTL5XR.js");
215
+ const { verifyCustomProvider } = await import("./agentProviderCommands-EMZCM6VA.js");
216
216
  const rec = built.nextRecord;
217
217
  verifyResult = await verifyCustomProvider({
218
218
  providerUrl: rec.customProviderUrl,
@@ -222,15 +222,34 @@ async function runAgentCreateCommand(args, deps = {}) {
222
222
  fetchImpl
223
223
  });
224
224
  }
225
+ const apiKeyRef = String(built.updates?.apiKeyRef || "").trim();
226
+ let authHint;
227
+ const OAUTH_REFS = /* @__PURE__ */ new Set(["claude", "chatgpt", "xai", "antigravity", "cloudflare"]);
228
+ if (apiKeyRef && OAUTH_REFS.has(apiKeyRef)) {
229
+ try {
230
+ const { createOAuthTokenStore } = await import("./oauthTokenStore-ITEB663N.js");
231
+ const store = createOAuthTokenStore();
232
+ if (!store.read(apiKeyRef)) {
233
+ authHint = `Subscription "${apiKeyRef}" is not authorized yet. Run \`nolo auth ${apiKeyRef}\` to log in.`;
234
+ }
235
+ } catch {
236
+ }
237
+ }
225
238
  output.write(JSON.stringify({
226
239
  ok: true,
227
240
  agentKey: built.agentKey,
228
241
  baseUrl: built.serverUrl,
229
242
  updates: sanitizeAgentRecordForCliOutput(built.updates),
230
243
  record: sanitizeAgentRecordForCliOutput(built.nextRecord),
231
- ...verifyResult ? { verify: verifyResult } : {}
244
+ ...verifyResult ? { verify: verifyResult } : {},
245
+ ...authHint ? { hint: authHint } : {}
232
246
  }, null, 2));
233
247
  output.write("\n");
248
+ if (authHint) {
249
+ const errorOutput = deps.error ?? process.stderr;
250
+ errorOutput.write(`[nolo] Hint: ${authHint}
251
+ `);
252
+ }
234
253
  return 0;
235
254
  } catch (error) {
236
255
  output.write(