nolo-cli 0.38.0-alpha.2 → 0.47.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/{_executeModel-2S6HNTBF.js → _executeModel-JWAASOOT.js} +43 -45
  2. package/{action-KMBZ3LCZ.js → action-FLLC2SIX.js} +7 -7
  3. package/{addContentAction-KQ44UT2U.js → addContentAction-SVSPUUK4.js} +6 -6
  4. package/{addDialogAgentAction-ILSDCMYL.js → addDialogAgentAction-W3JGU4F7.js} +5 -5
  5. package/{agentDeleteCommand-6XYC7JVL.js → agentDeleteCommand-QL7TF5F2.js} +26 -27
  6. package/{agentEmailCommands-NGL5B3UC.js → agentEmailCommands-AC3XQM53.js} +57 -59
  7. package/{agentListCommands-R7TKN3DL.js → agentListCommands-4YMFHDU6.js} +33 -31
  8. package/{agentMachineCommands-AXOO4OKN.js → agentMachineCommands-MFQKYUV4.js} +25 -26
  9. package/{agentPullCommand-TSWAJPS2.js → agentPullCommand-M552CYSI.js} +2 -2
  10. package/{agentRecordCommands-GJHH5GYI.js → agentRecordCommands-QG3YBSTQ.js} +53 -55
  11. package/{agentRunCommand-4MEMHFT5.js → agentRunCommand-B4PGT36L.js} +56 -58
  12. package/{agentRunControl-7MUPSYDQ.js → agentRunControl-LHXOP4IU.js} +43 -1
  13. package/{agentRuntimeLocal-CPEWDR3Z.js → agentRuntimeLocal-V2UKJPNE.js} +21 -22
  14. package/{agentSlice-LAILHBMM.js → agentSlice-B5O3RTRP.js} +6 -6
  15. package/{agentSuperviseCommands-MKWW3ICX.js → agentSuperviseCommands-IMRZ56RC.js} +2 -2
  16. package/{appDeleteCommands-6SYOAMTR.js → appDeleteCommands-BQCRRHOM.js} +25 -26
  17. package/{appDeployCommands-ZNMFUV2K.js → appDeployCommands-UMJ67TUR.js} +25 -26
  18. package/{appDeployStatusCommands-G5FIZT64.js → appDeployStatusCommands-KASPUR4V.js} +25 -26
  19. package/{appGetCommands-4RIFLLZZ.js → appGetCommands-FFT2LTGF.js} +25 -26
  20. package/{appListCommands-DK2JJ65T.js → appListCommands-TAVWFRZZ.js} +25 -26
  21. package/{authCommand-B2XRHNJH.js → authCommand-OY2E2VQK.js} +12 -12
  22. package/{authCommands-GWABTFMR.js → authCommands-SBQVTD6V.js} +5 -5
  23. package/{chatQueueReduxAdapter-DQWFZYNL.js → chatQueueReduxAdapter-OVDKLHLD.js} +20 -20
  24. package/chunk-25J3BB35.js +6041 -0
  25. package/chunk-2BWU4ORW.js +2574 -0
  26. package/{chunk-U6QQLXWI.js → chunk-2X5S4IBZ.js} +1 -1
  27. package/{chunk-MJWX4JQO.js → chunk-3EEK7T3D.js} +1 -1
  28. package/{chunk-UNHKVD2N.js → chunk-43CXXVJD.js} +1 -1
  29. package/{chunk-WRP5TTM6.js → chunk-4MXGXSYN.js} +83 -3
  30. package/{chunk-2KO5QQFV.js → chunk-5IQX2XPA.js} +2 -2
  31. package/{chunk-ARFXKWJH.js → chunk-5PFBRLJN.js} +157 -51
  32. package/{chunk-W445DPVT.js → chunk-5QRCPERU.js} +1 -1
  33. package/{chunk-GKHV4UH5.js → chunk-5UOBIU5G.js} +31 -3
  34. package/{chunk-BMB563Y6.js → chunk-6BYAXNH5.js} +3 -3
  35. package/{chunk-SMPAUSX5.js → chunk-6FGXGFAH.js} +2 -2
  36. package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
  37. package/{chunk-NT3QRCVS.js → chunk-7US2USK7.js} +7 -7
  38. package/{chunk-FTM4KUOZ.js → chunk-7XTC3KRG.js} +1 -1
  39. package/{chunk-IMHO5LC6.js → chunk-7XZ5GXSN.js} +1 -1
  40. package/{chunk-E2OQ5N2F.js → chunk-AEXP2UZT.js} +341 -16
  41. package/{chunk-MZZZYUZS.js → chunk-AV2CELZZ.js} +37 -12
  42. package/{chunk-JI2TIPLP.js → chunk-AYXSUBVC.js} +1 -1
  43. package/{chunk-KR74XLMV.js → chunk-BIMCW2CC.js} +3 -3
  44. package/{chunk-GEGSCLZZ.js → chunk-C5UWCCLI.js} +3 -3
  45. package/{chunk-J6WH4PYZ.js → chunk-CIF4X6ZM.js} +1 -1
  46. package/{chunk-LZZQTQPY.js → chunk-CTXR4SRT.js} +3 -3
  47. package/{chunk-GZRMWK5R.js → chunk-DQLYEGP7.js} +2 -2
  48. package/{chunk-45NBTCS2.js → chunk-DROE55W3.js} +216 -48
  49. package/{chunk-GUYMR3JL.js → chunk-E2QH2AYX.js} +69 -3
  50. package/{chunk-B6H5XCT2.js → chunk-EMEUU5IY.js} +3 -3
  51. package/{chunk-X6EN3KJX.js → chunk-ENYDQKOB.js} +319 -71
  52. package/{chunk-RCFIB45Q.js → chunk-EVBFYPDC.js} +2 -2
  53. package/{chunk-PV734VZX.js → chunk-EXLOROHG.js} +1 -1
  54. package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
  55. package/{chunk-WRN7L5CS.js → chunk-FA4SY4F5.js} +1 -1
  56. package/{chunk-IFS5CUEH.js → chunk-FJHLA6SX.js} +1 -1
  57. package/{chunk-D72M3G32.js → chunk-FM6ZGNMV.js} +12 -12
  58. package/{chunk-T2BZICLK.js → chunk-G46DB6KG.js} +49 -6
  59. package/{chunk-FGLKRJDI.js → chunk-GK74OOFT.js} +2 -2
  60. package/{chunk-LM6IYQ3F.js → chunk-GLKOYSRU.js} +8 -1
  61. package/{chunk-YNAGAUJT.js → chunk-GYSVYO35.js} +61 -49
  62. package/{chunk-JIADXJYU.js → chunk-H2G6JXTR.js} +1 -1
  63. package/{chunk-MGIHZ5CJ.js → chunk-HAPCUPEO.js} +2 -2
  64. package/{chunk-LD6Y6RJY.js → chunk-HGDOIDQ4.js} +2 -2
  65. package/{chunk-IZNJDUJ4.js → chunk-I4JISVWK.js} +1 -1
  66. package/{chunk-N4XRDM26.js → chunk-IA3A5373.js} +2 -2
  67. package/{chunk-X2K2JSO4.js → chunk-IWUMSAQF.js} +5 -1
  68. package/{chunk-GEPHJJW4.js → chunk-L7NG2M6H.js} +1 -1
  69. package/{chunk-XQES6LXQ.js → chunk-LFLWZX76.js} +2 -2
  70. package/{chunk-IIOHYLIG.js → chunk-LGUQHYAL.js} +1 -1
  71. package/{chunk-4AWH4LQA.js → chunk-LYGNQHUW.js} +3 -1
  72. package/{db-3H3JECGY.js → chunk-M5PVFLD4.js} +11 -158
  73. package/{chunk-WN5AJG5I.js → chunk-MKZRKDQM.js} +1 -1
  74. package/{chunk-V5GA74HI.js → chunk-MZXZJVVD.js} +20 -39
  75. package/{chunk-EJAL5LSG.js → chunk-NC3CSWVT.js} +2 -2
  76. package/{chunk-6XG52ZQ6.js → chunk-NI2BS6UD.js} +22 -3
  77. package/{chunk-FXZBSLFK.js → chunk-NSQNNYGW.js} +20 -51
  78. package/{chunk-VOXNBPLB.js → chunk-OFSVXPQS.js} +651 -43
  79. package/{chunk-ZBB3MZR3.js → chunk-OLNC7AWK.js} +7 -4
  80. package/{chunk-J5NMOM35.js → chunk-OYNDYVSE.js} +1 -1
  81. package/{chunk-C6ELZQ7H.js → chunk-OZVGA4SY.js} +1 -1
  82. package/{chunk-K4KIFRIN.js → chunk-Q24S4NDF.js} +1 -1
  83. package/{chunk-HRSIJO5A.js → chunk-RNNAJ34U.js} +1 -1
  84. package/{chunk-JK7UM3LT.js → chunk-SEIOEDBB.js} +110 -49
  85. package/{chunk-2WKUUY2E.js → chunk-SVEUG45B.js} +5 -3
  86. package/{chunk-IZCHPD7T.js → chunk-TNPCQNGQ.js} +11 -6
  87. package/{chunk-4DMPISV6.js → chunk-URBGEE42.js} +2 -2
  88. package/{chunk-23KKIMD5.js → chunk-WVGEBWA6.js} +4 -4
  89. package/{chunk-TH7ZZKPJ.js → chunk-XIRSTDYF.js} +275 -134
  90. package/{chunk-64KIQZA2.js → chunk-XO3G35OV.js} +1 -1
  91. package/{chunk-CVXDBLYH.js → chunk-XOFZEJGM.js} +5 -5
  92. package/{chunk-XT73C4VH.js → chunk-Z5NW3O7V.js} +1 -1
  93. package/{codingSkills-H6N5EKSX.js → codingSkills-QLDAXJRA.js} +3 -4
  94. package/{cooldownCommands-C2SZLEEO.js → cooldownCommands-GI5NNWGL.js} +5 -3
  95. package/{createAgentAutomationAction-767ZITQJ.js → createAgentAutomationAction-TQ7PYONU.js} +21 -21
  96. package/{createDialogAction-H75NDXYH.js → createDialogAction-EOQFCM3K.js} +24 -25
  97. package/{createPageAction-KYJYZPLC.js → createPageAction-ZG5PH6BI.js} +22 -23
  98. package/db-VQSAOWAO.js +162 -0
  99. package/{dbSlice-PIQGICNM.js → dbSlice-XWUM4QOF.js} +5 -5
  100. package/deleteFile-NPZ64DFN.js +1 -1
  101. package/{dialogCommands-SSQLOBRU.js → dialogCommands-DCGMVLBA.js} +29 -27
  102. package/{dialogSlice-YJV3AVFM.js → dialogSlice-YHGPDBAZ.js} +20 -20
  103. package/{docCreateCommands-WYP6MQ56.js → docCreateCommands-A2LVLROP.js} +26 -28
  104. package/{docDeleteCommands-6YNU4LZ7.js → docDeleteCommands-ENMROKH6.js} +27 -29
  105. package/{docReadCommands-PFJMIPYU.js → docReadCommands-XSRUV4EM.js} +26 -28
  106. package/{docStore-JOODSWDW.js → docStore-WIKRGVQJ.js} +22 -22
  107. package/{docUpdateCommands-KAP6JSGT.js → docUpdateCommands-5B5NBORA.js} +26 -28
  108. package/{fetchMessages-CUEFN4GQ.js → fetchMessages-KZQVBXKY.js} +3 -3
  109. package/{getPricing-P3E2WRIH.js → getPricing-X3HXP6VQ.js} +3 -3
  110. package/{handleSendMessageAction-DGL6H4E4.js → handleSendMessageAction-WT4FDMQS.js} +21 -21
  111. package/index.js +70 -70
  112. package/levelLazyShim-GZBKODGI.js +7 -0
  113. package/{localDialogRead-P7CHFMIC.js → localDialogRead-NQ33HBSI.js} +2 -2
  114. package/{localRuntimeAuthority-S77B5QVB.js → localRuntimeAuthority-KQDAE64E.js} +4 -4
  115. package/{localRuntimeDb-N3H3HQ7G.js → localRuntimeDb-PF7CFKDL.js} +2 -2
  116. package/{machineCommands-NAFWPMLI.js → machineCommands-BFLTBAK6.js} +51 -53
  117. package/{machineWsRunDispatch-EWA7J37I.js → machineWsRunDispatch-VCJB5LHO.js} +51 -53
  118. package/{models-L7S2EKPM.js → models-7LWATQFH.js} +2 -2
  119. package/package.json +1 -1
  120. package/{read-6C2XD3YZ.js → read-DQQ75VI3.js} +2 -2
  121. package/{readDocTool-Y7AB365O.js → readDocTool-HCQQFAZD.js} +1 -1
  122. package/{readlineWorkspace-BCQVDX4V.js → readlineWorkspace-VBJLMU6V.js} +5168 -5003
  123. package/{removeDialogAgentAction-KG5WMJRZ.js → removeDialogAgentAction-DNONRKST.js} +7 -7
  124. package/{runAgentClientLoop-B3TTKXIX.js → runAgentClientLoop-4QOEJOJP.js} +41 -42
  125. package/{runtimeDoctorCommands-HT4O2PXL.js → runtimeDoctorCommands-JKTTN723.js} +4 -4
  126. package/serverStoreFactory-YMXDF4NI.js +20 -0
  127. package/{setDialogExtraReferencesAction-O2NLXMSM.js → setDialogExtraReferencesAction-ERHUPT3F.js} +6 -6
  128. package/{setPrimaryDialogAgentAction-FYYUY7PB.js → setPrimaryDialogAgentAction-6C2HYNEC.js} +7 -7
  129. package/{settingSlice-GPLI6E3M.js → settingSlice-YVRJFKQX.js} +6 -6
  130. package/{skillDiscovery-COX56OBO.js → skillDiscovery-GPUDHDTZ.js} +1 -2
  131. package/{spaceCommands-VHOKUADK.js → spaceCommands-FBB7XSAW.js} +24 -25
  132. package/{spaceSlice-ZKUZSVYD.js → spaceSlice-YMDZ4G6H.js} +21 -21
  133. package/{streamAgentChatTurn-PLTB7RMV.js → streamAgentChatTurn-5NBWQHY6.js} +93 -52
  134. package/{switchDialogAgentAction-GH5P6Q3Z.js → switchDialogAgentAction-HP57XYFP.js} +5 -5
  135. package/{tools-KQXDW66A.js → tools-37H5A4OG.js} +34 -35
  136. package/{tuiSummaryLlmCaller-SHRB4RWM.js → tuiSummaryLlmCaller-NBTWT57U.js} +25 -14
  137. package/{updateDialogTitleAction-OTYEQJAK.js → updateDialogTitleAction-XAGMXHW5.js} +24 -23
  138. package/chunk-4APLX2RT.js +0 -1514
  139. package/chunk-AETZ7AD6.js +0 -274
  140. package/chunk-OFZPJ3NT.js +0 -114
  141. package/chunk-P66M7LSQ.js +0 -58
  142. package/{chunk-6WD3OOJS.js → chunk-UV6VISQJ.js} +0 -0
  143. package/{tableCommands-PQUJ55AS.js → tableCommands-P2TXJ3CF.js} +1 -1
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-EJAL5LSG.js";
8
+ } from "./chunk-NC3CSWVT.js";
9
9
  import {
10
10
  INVALID_TOOL_ARGS_REPLACEMENT,
11
11
  buildInvalidToolCallSelfHealResult,
12
12
  parseToolCallArguments,
13
13
  performFetchRequest,
14
14
  sanitizeOutboundMessages
15
- } from "./chunk-FXZBSLFK.js";
15
+ } from "./chunk-NSQNNYGW.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,30 +23,27 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-JK7UM3LT.js";
26
+ } from "./chunk-SEIOEDBB.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
30
30
  import {
31
31
  getCurrentSpaceId
32
- } from "./chunk-D72M3G32.js";
32
+ } from "./chunk-FM6ZGNMV.js";
33
33
  import {
34
34
  addToolMessage,
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-ARFXKWJH.js";
38
+ } from "./chunk-5PFBRLJN.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-CVXDBLYH.js";
41
+ } from "./chunk-XOFZEJGM.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
45
45
  tokenUsageLiveUpdate
46
46
  } from "./chunk-MRWGHF56.js";
47
- import {
48
- EMPTY_ASSISTANT_REPAIR_PROMPT
49
- } from "./chunk-P66M7LSQ.js";
50
47
  import {
51
48
  accumulateToolCallDelta,
52
49
  createThinkParserState,
@@ -57,25 +54,26 @@ import {
57
54
  processThinkChunk
58
55
  } from "./chunk-N7J63Q6C.js";
59
56
  import {
57
+ EMPTY_ASSISTANT_REPAIR_PROMPT,
60
58
  getModelInfo
61
- } from "./chunk-WRP5TTM6.js";
59
+ } from "./chunk-4MXGXSYN.js";
62
60
  import {
63
61
  getApiEndpoint
64
- } from "./chunk-C6ELZQ7H.js";
62
+ } from "./chunk-OZVGA4SY.js";
65
63
  import {
66
64
  toErrorMessage
67
65
  } from "./chunk-HNMXYYJR.js";
68
66
  import {
69
67
  selectCurrentServer
70
- } from "./chunk-B6H5XCT2.js";
68
+ } from "./chunk-EMEUU5IY.js";
71
69
  import {
72
70
  write
73
- } from "./chunk-23KKIMD5.js";
71
+ } from "./chunk-WVGEBWA6.js";
74
72
  import {
75
73
  createDialogMessageKeyAndId,
76
74
  dialogMessageKey,
77
75
  toTrimmedString
78
- } from "./chunk-2WKUUY2E.js";
76
+ } from "./chunk-SVEUG45B.js";
79
77
  import {
80
78
  extractCustomId
81
79
  } from "./chunk-BJIRLHJR.js";
@@ -313,10 +311,18 @@ function updateTotalUsage(currentUsage, newUsageChunk) {
313
311
  return currentUsage;
314
312
  }
315
313
  if (!currentUsage) {
314
+ const hasExplicitTokenField = [
315
+ "prompt_tokens",
316
+ "completion_tokens",
317
+ "total_tokens",
318
+ "input_tokens",
319
+ "output_tokens"
320
+ ].some((field) => Object.prototype.hasOwnProperty.call(newUsageChunk, field));
316
321
  const first = {
317
- completion_tokens: 0,
318
- prompt_tokens: 0,
319
- total_tokens: 0,
322
+ // Do not synthesize zero token fields for metadata-only events such as
323
+ // `{provider_call_id}`. Explicit provider zeros remain real reported
324
+ // usage; only pure metadata is eligible for estimated fallback.
325
+ ...hasExplicitTokenField ? { completion_tokens: 0, prompt_tokens: 0, total_tokens: 0 } : {},
320
326
  ...newUsageChunk
321
327
  };
322
328
  applyResponsesUsageFields(first, newUsageChunk);
@@ -356,6 +362,10 @@ function updateTotalUsage(currentUsage, newUsageChunk) {
356
362
  if (billingModel) {
357
363
  updatedUsage.billing_model = billingModel;
358
364
  }
365
+ const providerCallId = asOptionalTrimmedString(newUsageChunk.provider_call_id);
366
+ if (providerCallId) {
367
+ updatedUsage.provider_call_id = providerCallId;
368
+ }
359
369
  return updatedUsage;
360
370
  }
361
371
  function applyResponsesUsageFields(target, chunk) {
@@ -1017,9 +1027,24 @@ function createInitialStreamState() {
1017
1027
  hasHandedOff: false,
1018
1028
  hasProcessedToolCalls: false,
1019
1029
  alreadyFinalized: false,
1020
- finishReason: null
1030
+ finishReason: null,
1031
+ billingFailed: false,
1032
+ skipBilling: false
1021
1033
  };
1022
1034
  }
1035
+ function shouldSkipBillingForUserAbort(error, totalUsage) {
1036
+ if (!isAbortError(error)) return false;
1037
+ if (!totalUsage || typeof totalUsage !== "object") return true;
1038
+ const hasTokenField = [
1039
+ "prompt_tokens",
1040
+ "completion_tokens",
1041
+ "total_tokens",
1042
+ "input_tokens",
1043
+ "output_tokens"
1044
+ ].some((field) => Object.prototype.hasOwnProperty.call(totalUsage, field));
1045
+ const hasCost = Object.prototype.hasOwnProperty.call(totalUsage, "cost") && typeof totalUsage.cost === "number";
1046
+ return !(hasTokenField || hasCost);
1047
+ }
1023
1048
  function buildRequestBodyWithTools(bodyData, agentConfig, disableToolsForThisRequest) {
1024
1049
  const messagesForBody = Array.isArray(bodyData?.messages) ? sanitizeOutboundMessages(bodyData.messages) : bodyData?.messages;
1025
1050
  const baseBody = messagesForBody !== bodyData?.messages ? { ...bodyData, messages: messagesForBody } : bodyData;
@@ -1079,7 +1104,9 @@ async function finalizeStream(state, ctx) {
1079
1104
  reasoningBuffer: state.reasoningBuffer,
1080
1105
  messageMetadata: ctx.messageMetadata,
1081
1106
  toolCalls: state.assistantToolCalls,
1082
- spaceId: ctx.spaceId
1107
+ spaceId: ctx.spaceId,
1108
+ billingFailed: state.billingFailed,
1109
+ skipBilling: state.skipBilling
1083
1110
  })
1084
1111
  );
1085
1112
  return {
@@ -1099,7 +1126,8 @@ function markEmptyCompletionAsError(state, ctx) {
1099
1126
  contentBuffer: appendTextChunk(
1100
1127
  state.contentBuffer,
1101
1128
  `[\u9519\u8BEF: ${EMPTY_UPSTREAM_STREAM_MESSAGE}]`
1102
- )
1129
+ ),
1130
+ billingFailed: true
1103
1131
  };
1104
1132
  }
1105
1133
  function markStreamMessageAborted(ctx, errorMessage) {
@@ -1435,7 +1463,7 @@ async function handleStreamCompletion(state, ctx, finalizeCtx) {
1435
1463
  };
1436
1464
  }
1437
1465
  if (!state.hasProcessedToolCalls && state.accumulatedToolCalls.length > 0) {
1438
- if (state.totalUsage) {
1466
+ if (state.totalUsage && !state.billingFailed) {
1439
1467
  ctx.dispatch(tokenUsageLiveUpdate({
1440
1468
  input_tokens: state.totalUsage.prompt_tokens ?? state.totalUsage.input_tokens,
1441
1469
  output_tokens: state.totalUsage.completion_tokens ?? state.totalUsage.output_tokens,
@@ -1532,7 +1560,8 @@ var sendOpenAICompletionsRequest = async ({
1532
1560
  hasHandedOff: hasHandedOffOverall,
1533
1561
  finishReason: lastFinishReason,
1534
1562
  messageId,
1535
- usage: streamState.totalUsage ?? void 0
1563
+ usage: streamState.totalUsage ?? void 0,
1564
+ billingFailed: streamState.billingFailed
1536
1565
  });
1537
1566
  try {
1538
1567
  if (!parentMessageId) {
@@ -1615,7 +1644,8 @@ var sendOpenAICompletionsRequest = async ({
1615
1644
  contentBuffer: appendTextChunk(
1616
1645
  streamState.contentBuffer,
1617
1646
  `[\u9519\u8BEF: ${errorMessage}]`
1618
- )
1647
+ ),
1648
+ billingFailed: true
1619
1649
  };
1620
1650
  streamState = await finalizeStream(streamState, finalizeCtx);
1621
1651
  return buildMeta();
@@ -1711,7 +1741,8 @@ var sendOpenAICompletionsRequest = async ({
1711
1741
  streamState.contentBuffer,
1712
1742
  `
1713
1743
  [API Error] ${errorMsg}`
1714
- )
1744
+ ),
1745
+ billingFailed: true
1715
1746
  };
1716
1747
  await reader.cancel();
1717
1748
  break;
@@ -1744,29 +1775,6 @@ var sendOpenAICompletionsRequest = async ({
1744
1775
  streamState.finishReason = finishReason;
1745
1776
  if (finishReason === "tool_calls") {
1746
1777
  throttler.flush();
1747
- if (streamState.totalUsage) {
1748
- dispatch(tokenUsageLiveUpdate({
1749
- input_tokens: streamState.totalUsage.prompt_tokens ?? streamState.totalUsage.input_tokens,
1750
- output_tokens: streamState.totalUsage.completion_tokens ?? streamState.totalUsage.output_tokens,
1751
- cost: streamState.totalUsage.cost,
1752
- dialogKey
1753
- }));
1754
- }
1755
- const toolResult = await processAccumulatedToolCalls(
1756
- streamState,
1757
- {
1758
- dispatch,
1759
- agentConfig,
1760
- dialogId,
1761
- dialogKey,
1762
- messageId,
1763
- messageMetadata
1764
- }
1765
- );
1766
- streamState = toolResult.state;
1767
- hasHandedOffOverall ||= toolResult.hasHandedOff;
1768
- hasPendingInteractionOverall ||= toolResult.hasPendingInteraction;
1769
- streamState = await finalizeStream(streamState, finalizeCtx);
1770
1778
  } else if (finishReason !== "stop") {
1771
1779
  const finishErrorMessage = finishReason === "error" ? getChoiceFinishErrorMessage(data, choice) : null;
1772
1780
  streamState = {
@@ -1776,7 +1784,8 @@ var sendOpenAICompletionsRequest = async ({
1776
1784
  finishErrorMessage ? `
1777
1785
  [API Error] Error: ${finishErrorMessage}` : finishReason === "error" ? "\n[API Error] Error: \u6A21\u578B\u54CD\u5E94\u4EE5 error \u7ED3\u675F\uFF0C\u4F46\u4E0A\u6E38\u672A\u8FD4\u56DE\u5177\u4F53\u9519\u8BEF\u3002\u8BF7\u91CD\u8BD5\uFF0C\u6216\u5207\u6362\u5230\u5176\u4ED6\u652F\u6301\u56FE\u7247\u8F93\u5165\u7684\u6A21\u578B\u3002" : `
1778
1786
  [\u6D41\u7ED3\u675F\u539F\u56E0: ${finishReason}]`
1779
- )
1787
+ ),
1788
+ ...finishReason === "error" ? { billingFailed: true } : {}
1780
1789
  };
1781
1790
  }
1782
1791
  }
@@ -1787,6 +1796,7 @@ var sendOpenAICompletionsRequest = async ({
1787
1796
  throttler.flush();
1788
1797
  let errorText;
1789
1798
  const isAbort = isAbortError(error);
1799
+ const skipBilling = shouldSkipBillingForUserAbort(error, streamState.totalUsage);
1790
1800
  if (isAbort) {
1791
1801
  errorText = "\n[\u7528\u6237\u4E2D\u65AD]";
1792
1802
  } else {
@@ -1796,7 +1806,9 @@ var sendOpenAICompletionsRequest = async ({
1796
1806
  console.error("[SSE] sendOpenAICompletionsRequest error:", error);
1797
1807
  streamState = {
1798
1808
  ...streamState,
1799
- contentBuffer: appendTextChunk(streamState.contentBuffer, errorText)
1809
+ contentBuffer: appendTextChunk(streamState.contentBuffer, errorText),
1810
+ billingFailed: isAbort ? streamState.billingFailed : true,
1811
+ skipBilling: streamState.skipBilling || skipBilling
1800
1812
  };
1801
1813
  if (!isAbort) {
1802
1814
  markStreamMessageAborted(
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dialogMessageKey
3
- } from "./chunk-2WKUUY2E.js";
3
+ } from "./chunk-SVEUG45B.js";
4
4
  import {
5
5
  asOptionalFiniteNumber
6
6
  } from "./chunk-WWC7I6TA.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-B6H5XCT2.js";
3
+ } from "./chunk-EMEUU5IY.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-23KKIMD5.js";
6
+ } from "./chunk-WVGEBWA6.js";
7
7
  import {
8
8
  selectIdentityToken
9
9
  } from "./chunk-HHBXCRJS.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  selectCurrentServer,
3
3
  selectRemoteServers
4
- } from "./chunk-B6H5XCT2.js";
4
+ } from "./chunk-EMEUU5IY.js";
5
5
  import {
6
6
  createUserKey,
7
7
  extractAgentInfo,
@@ -10,7 +10,7 @@ import {
10
10
  sanitizeShareData,
11
11
  shareKey,
12
12
  toNonEmptyString
13
- } from "./chunk-2WKUUY2E.js";
13
+ } from "./chunk-SVEUG45B.js";
14
14
  import {
15
15
  noloDeleteRequest,
16
16
  noloWriteRequest,
@@ -11,7 +11,7 @@ import {
11
11
  getAntigravityUserAgent,
12
12
  normalizeAntigravityTokenPayload,
13
13
  refreshAntigravityToken
14
- } from "./chunk-PV734VZX.js";
14
+ } from "./chunk-EXLOROHG.js";
15
15
  import {
16
16
  writeOAuthCredential
17
17
  } from "./chunk-FD36SCCD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveNoloHome
3
- } from "./chunk-LM6IYQ3F.js";
3
+ } from "./chunk-GLKOYSRU.js";
4
4
 
5
5
  // packages/cli/localRuntimeDb.ts
6
6
  import path from "node:path";
@@ -14,7 +14,7 @@ function buildCliLocalRuntimeDbEnv(env = process.env) {
14
14
  };
15
15
  }
16
16
  async function getDefaultCliLocalRuntimeDb(options = {}) {
17
- const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-S77B5QVB.js");
17
+ const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-KQDAE64E.js");
18
18
  return getAuthorityBackedDb(options);
19
19
  }
20
20
 
@@ -113,6 +113,9 @@ function parseResetAtText(value, now) {
113
113
  const parsed = Date.parse(m[1]);
114
114
  return Number.isFinite(parsed) && parsed > now ? parsed : void 0;
115
115
  }
116
+ function matchesPeriodicUsageLimitText(text) {
117
+ return /weekly usage limit|monthly usage limit/i.test(text);
118
+ }
116
119
  function resolveNextAvailableAt(body, now, headers) {
117
120
  const headerRetryAfter = headers && typeof headers.get === "function" ? headers.get("retry-after") : headers?.["retry-after"] ?? headers?.["Retry-After"];
118
121
  const retryAfter = headerRetryAfter ? readRetryAfterTimestamp({ retryAfter: headerRetryAfter }, now) : readRetryAfterTimestamp(body, now);
@@ -124,7 +127,8 @@ function resolveNextAvailableAt(body, now, headers) {
124
127
  return clampCooldownDeadline(absolute, now);
125
128
  }
126
129
  const text = typeof body === "string" ? body : JSON.stringify(body ?? "");
127
- const parsed = parseResetAtText(text, now) ?? now + (parseResetsInMs(text) ?? DEFAULT_PROVIDER_RETRY_MS);
130
+ const absoluteFromText = parseResetAtText(text, now);
131
+ const parsed = absoluteFromText ?? (matchesPeriodicUsageLimitText(text) ? now + MAX_COOLDOWN_MS : now + (parseResetsInMs(text) ?? DEFAULT_PROVIDER_RETRY_MS));
128
132
  return clampCooldownDeadline(parsed, now);
129
133
  }
130
134
  function resolveAvailabilityAction(status, body, now, headers) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveNoloHome
3
- } from "./chunk-LM6IYQ3F.js";
3
+ } from "./chunk-GLKOYSRU.js";
4
4
 
5
5
  // packages/database-engine/cliAuthorityBrokerClient.ts
6
6
  import { createConnection } from "node:net";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-GZRMWK5R.js";
4
+ } from "./chunk-DQLYEGP7.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-A7GB5UGH.js";
14
14
  import {
15
15
  createSpaceKey
16
- } from "./chunk-MJWX4JQO.js";
16
+ } from "./chunk-3EEK7T3D.js";
17
17
  import {
18
18
  asTrimmedLowercaseString
19
19
  } from "./chunk-QSJ3HFEF.js";
@@ -22,7 +22,7 @@ var CODE_WORK_DISCIPLINE_BODY = `## \u6548\u7387\u4F18\u5148\uFF08\u7701 token\u
22
22
  - **\u5EFA\u8BAE\u6C47\u62A5**\uFF1A\u4EA4\u4ED8\u65F6\u628A\u8FC7\u7A0B\u4E2D\u53D1\u73B0\u7684**\u4EFB\u4F55\u503C\u5F97\u7528\u6237\u77E5\u9053\u7684\u4E8B**\u90FD\u5217\u51FA\u6765\uFF08\u9884\u5B58\u65E0\u5173\u6539\u52A8\u3001\u65E2\u6709\u6D4B\u8BD5\u9694\u79BB\u95EE\u9898\u3001\u6F5C\u5728\u98CE\u9669\u3001\u540E\u7EED\u53EF\u4F18\u5316\u70B9\u3001\u9700\u7528\u6237\u51B3\u7B56\u7684\u4E8B\u9879\uFF09\uFF0C\u4E0D\u8981\u53EA\u62A5\u300C\u505A\u5B8C\u4E86\u300D\u3002
23
23
 
24
24
  ## Review \u7EAA\u5F8B\uFF08commit \u524D\u786C\u95E8\uFF09
25
- - \u9664 \u22642 \u6B65\u96F6\u903B\u8F91\u98CE\u9669\u7684\u673A\u68B0\u6539\u52A8\uFF08\u9519\u522B\u5B57/\u683C\u5F0F/CSS \u5FAE\u8C03\uFF09\u5916\uFF0C\u6240\u6709\u4EE3\u7801\u53D8\u66F4 commit \u524D\u5FC5\u987B\u5148\u6D3E**\u5176\u4ED6 agent**\uFF08\u4E0D\u540C\u6A21\u578B\u5BB6\u65CF\u4F18\u5148\uFF09review \u5DE5\u4F5C\u533A diff\uFF08\`git diff\`\uFF0C\u672A\u63D0\u4EA4\u7684\u6539\u52A8\uFF09\u3002reviewer \u4E0D\u53EF\u662F\u81EA\u5DF1\u3002\u65E0 review \u4E0D commit\u2014\u2014\u8FD9\u662F\u786C\u95E8\uFF0C\u4E0D\u662F\u5EFA\u8BAE\u3002
25
+ - \u9664 \u22642 \u6B65\u96F6\u903B\u8F91\u98CE\u9669\u7684\u673A\u68B0\u6539\u52A8\uFF08\u9519\u522B\u5B57/\u683C\u5F0F/CSS \u5FAE\u8C03\uFF09\u5916\uFF0C\u6240\u6709\u4EE3\u7801\u53D8\u66F4 commit \u524D\u5FC5\u987B\u5148\u6D3E**\u5176\u4ED6 agent**\uFF08\u4E0D\u540C\u6A21\u578B\u5BB6\u65CF\u4F18\u5148\uFF09review \u5DE5\u4F5C\u533A diff\uFF08\`git diff\`\uFF0C\u672A\u63D0\u4EA4\u7684\u6539\u52A8\uFF09\u3002reviewer \u4E0D\u53EF\u662F\u672C\u6B21\u6539\u52A8\u7684\u4F5C\u8005\uFF08\u7F16\u6392\u8005\u4EE5\u81EA\u8EAB agent \u8EAB\u4EFD\u6D3E\u51FA\u7684\u5168\u65B0\u5B9E\u4F8B\u4E0D\u5171\u4EAB\u7F16\u6392\u8005\u4E0A\u4E0B\u6587\uFF0C\u4E0E\u4F5C\u8005\u8DE8\u6A21\u578B\u5BB6\u65CF\u65F6\u4E0D\u7B97\u300C\u81EA\u5DF1\u300D\uFF0C\u8DE8\u5BB6\u65CF\u4F18\u5148\u975E\u5F3A\u5236\uFF09\u3002\u65E0 review \u4E0D commit\u2014\u2014\u8FD9\u662F\u786C\u95E8\uFF0C\u4E0D\u662F\u5EFA\u8BAE\u3002
26
26
  - \u6D3E\u53D1\u8D70 \`startAgentRun(agentKey, task, { ephemeral: true })\`\uFF08web/\u684C\u9762\u7AEF\u6CA1\u6709 nolo CLI\uFF0C\u6240\u6709 host \u90FD\u6709\u8FD9\u4E2A\u5DE5\u5177\uFF09\u3002ephemeral \u8BA9 review \u5B8C\u6210\u540E\u4E0D\u7559 dialog \u8BB0\u5F55\u3002
27
27
  - task \u91CC\u5FC5\u987B\u5199\u660E\u5BA1\u67E5\u5BF9\u8C61\uFF08\`git diff\` \u770B\u5DE5\u4F5C\u533A\u6539\u52A8\uFF0C\u6216 \`git diff alpha...HEAD\` \u770B\u5DF2\u63D0\u4EA4\u6539\u52A8\uFF09\uFF0C\u5426\u5219 reviewer \u4E0D\u77E5\u9053\u5BA1\u4EC0\u4E48\u3002
28
28
  - \u6309\u89D2\u8272\u52A0\u8F7D\u5BF9\u5E94 skill\uFF1Areviewer \u5148 \`loadSkill("coding-review")\` \u62FF\u901A\u7528\u6D41\u7A0B\uFF0C\u518D\u6309\u89D2\u8272 \`loadSkill("coding-review-<role>")\` \u62FF\u68C0\u67E5\u9879\u3002\u89D2\u8272\u6E05\u5355\uFF1Acode-quality\uFF08**\u5FC5\u8DD1**\uFF09/ architecture\uFF08**\u5355\u72EC\u6D3E\u53D1**\uFF0C\u4E2D\u7EA7\u4EE5\u4E0A\u95EE\u9898\uFF09/ security\uFF08\u6309\u9700 + \u5B89\u5168\u654F\u611F\u89E6\u53D1\u5FC5\u8DD1\uFF09/ frontend-ux\uFF08\u6D89\u53CA UI \u65F6\uFF09/ backend-data\uFF08\u6D89\u53CA server \u65F6\uFF09\u3002\u89D2\u8272\u5207\u5272\u7684\u76EE\u7684\u662F\u6CE8\u610F\u529B\u9694\u79BB\u2014\u2014\u6BCF\u4E2A\u89D2\u8272\u53EA\u76EF\u81EA\u5DF1\u7684\u68C0\u67E5\u9762\uFF0C\u6309\u9700\u542F\u7528\uFF0C\u907F\u514D\u4E00\u4E2A reviewer \u80CC\u6240\u6709\u89D2\u8272\u5BFC\u81F4\u6CE8\u610F\u529B\u7A00\u91CA\u3002
@@ -183,6 +183,7 @@ function parseAgentRunArgs(args, options = {}) {
183
183
  const dodCommands = readRepeatedFlagValues(args, "--dod").map((v) => v.trim()).filter(Boolean);
184
184
  const taskRowDbKey = readFlagValue(args, "--task-row-dbkey");
185
185
  const artifactIds = readFlagValue(args, "--artifact-ids")?.split(",").map((item) => item.trim()).filter(Boolean);
186
+ const queueFile = readFlagValue(args, "--queue-file");
186
187
  return {
187
188
  agentKey,
188
189
  message,
@@ -217,7 +218,8 @@ function parseAgentRunArgs(args, options = {}) {
217
218
  ...cwd ? { cwd } : {},
218
219
  ...blockedToolNames.length ? { blockedToolNames } : {},
219
220
  ...dodCommands.length ? { dodCommands } : {},
220
- ...typeof timeoutMs === "number" ? { timeoutMs } : {}
221
+ ...typeof timeoutMs === "number" ? { timeoutMs } : {},
222
+ ...queueFile ? { queueFile } : {}
221
223
  };
222
224
  }
223
225
 
@@ -1,30 +1,13 @@
1
1
  import {
2
2
  createLegacyServerDb,
3
3
  createLevelAuthorityStore
4
- } from "./chunk-J6WH4PYZ.js";
5
- import {
6
- isLevelLockError
7
- } from "./chunk-URMS4XY2.js";
4
+ } from "./chunk-CIF4X6ZM.js";
8
5
  import {
9
6
  Level
10
- } from "./chunk-6WD3OOJS.js";
11
- import {
12
- resolveServerDbPath
13
- } from "./chunk-LM6IYQ3F.js";
7
+ } from "./chunk-UV6VISQJ.js";
14
8
  import {
15
9
  asTrimmedLowercaseString
16
10
  } from "./chunk-QSJ3HFEF.js";
17
- import "./chunk-4VNS5WPM.js";
18
-
19
- // packages/database-engine/ensureDbOpen.ts
20
- async function ensureDbOpen(db) {
21
- if (db.status === "open") {
22
- return;
23
- }
24
- if (typeof db.open === "function") {
25
- await db.open();
26
- }
27
- }
28
11
 
29
12
  // packages/database-engine/serverStoreFactory.ts
30
13
  import fs from "fs";
@@ -343,151 +326,21 @@ function getOrCreateServerStoreRuntime(dbPath, options = {}) {
343
326
  } else if (!cachedDriver) {
344
327
  globalScope.__serverAuthorityStoreDriver = driver;
345
328
  }
346
- const authorityStore2 = globalScope.__serverAuthorityStore;
329
+ const authorityStore = globalScope.__serverAuthorityStore;
347
330
  if (!globalScope.__serverDb) {
348
- globalScope.__serverDb = createLegacyServerDb(authorityStore2);
331
+ globalScope.__serverDb = createLegacyServerDb(authorityStore);
349
332
  }
350
333
  return {
351
- authorityStore: authorityStore2,
334
+ authorityStore,
352
335
  serverDb: globalScope.__serverDb
353
336
  };
354
337
  }
355
338
 
356
- // packages/database-engine/db.ts
357
- var DB_PATH = resolveServerDbPath();
358
- console.log("\u6570\u636E\u5E93\u914D\u7F6E:");
359
- console.log("- \u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55:", process.cwd());
360
- console.log("- \u6570\u636E\u5E93\u8DEF\u5F84:", DB_PATH);
361
- function isServerDbLockError(error) {
362
- const queue = [error];
363
- const seen = /* @__PURE__ */ new Set();
364
- while (queue.length > 0) {
365
- const current = queue.shift();
366
- if (!current || seen.has(current)) continue;
367
- seen.add(current);
368
- if (isLevelLockError(current)) return true;
369
- if (current?.cause) queue.push(current.cause);
370
- if (Array.isArray(current?.errors)) {
371
- queue.push(...current.errors);
372
- }
373
- }
374
- return false;
375
- }
376
- var ServerDbShuttingDownError = class extends Error {
377
- code = "SERVER_DB_SHUTTING_DOWN";
378
- // advisory-only:现有调用方检查 isLevelLifecycleError(匹配 LEVEL_*_NOT_OPEN),
379
- // 不消费此字段。保留是为了未来可能的 shutdown-aware retry 逻辑。
380
- retryable = true;
381
- constructor(message) {
382
- super(message);
383
- this.name = "ServerDbShuttingDownError";
384
- }
385
- };
386
- var {
387
- authorityStore,
388
- serverDb
389
- } = getOrCreateServerStoreRuntime(DB_PATH);
390
- console.log("- LevelDB\u5B9E\u9645\u8DEF\u5F84:", serverDb.location);
391
- var db_default = serverDb;
392
- function getServerAuthorityStore() {
393
- return authorityStore;
394
- }
395
- var DEFAULT_SERVER_DB_OPEN_LOCK_TIMEOUT_MS = 8e3;
396
- var DEFAULT_SERVER_DB_OPEN_LOCK_INTERVAL_MS = 25;
397
- var serverDbShuttingDown = false;
398
- function markServerDbShuttingDown() {
399
- serverDbShuttingDown = true;
400
- }
401
- function clearServerDbShuttingDown() {
402
- serverDbShuttingDown = false;
403
- }
404
- function resolveServerDbOpenLockTimeoutMs(env = process.env) {
405
- const raw = env.NOLO_SERVER_DB_OPEN_LOCK_TIMEOUT_MS;
406
- if (!raw) return DEFAULT_SERVER_DB_OPEN_LOCK_TIMEOUT_MS;
407
- const parsed = Number(raw);
408
- return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_SERVER_DB_OPEN_LOCK_TIMEOUT_MS;
409
- }
410
- function defaultSleep(ms) {
411
- return new Promise((resolve) => setTimeout(resolve, ms));
412
- }
413
- async function ensureServerDbOpen(options) {
414
- const status = authorityStore.status;
415
- if (status === "open") return;
416
- if (serverDbShuttingDown) {
417
- throw new ServerDbShuttingDownError(
418
- "Server DB is shutting down (blue-green phase 2 drain); cannot reopen LevelDB"
419
- );
420
- }
421
- const timeoutMs = options?.timeoutMs ?? resolveServerDbOpenLockTimeoutMs();
422
- const intervalMs = options?.intervalMs ?? DEFAULT_SERVER_DB_OPEN_LOCK_INTERVAL_MS;
423
- const sleep = options?.sleep ?? defaultSleep;
424
- const now = options?.now ?? Date.now;
425
- const deadline = now() + timeoutMs;
426
- let lastLockWarnAt = Number.NEGATIVE_INFINITY;
427
- for (let attempt = 1; ; attempt += 1) {
428
- if (serverDbShuttingDown) {
429
- throw new ServerDbShuttingDownError(
430
- "Server DB shutdown signaled during lock retry; aborting reopen"
431
- );
432
- }
433
- try {
434
- await ensureDbOpen(authorityStore);
435
- if (status !== "opening" && !options?.quiet) {
436
- console.log("\u2705 LevelDB \u5DF2\u6253\u5F00");
437
- }
438
- return;
439
- } catch (err) {
440
- if (!isServerDbLockError(err)) {
441
- if (!options?.quiet) console.error("\u274C \u6253\u5F00 LevelDB \u5931\u8D25:", err);
442
- throw err;
443
- }
444
- const remainingMs = deadline - now();
445
- if (remainingMs <= 0) {
446
- if (!options?.quiet) {
447
- console.error(
448
- `\u274C \u6253\u5F00 LevelDB \u5931\u8D25: \u9501\u88AB\u5176\u4ED6\u8FDB\u7A0B\u6301\u6709\uFF0C\u5DF2\u91CD\u8BD5 ${attempt} \u6B21 / ${timeoutMs}ms\u3002 \u901A\u5E38\u662F\u4E0A\u4E00\u4E2A server \u8FDB\u7A0B\u672A\u5B8C\u5168\u9000\u51FA\uFF08\u6CE8\u610F\u7236\u5B50\u8FDB\u7A0B\u6811\uFF09\uFF0C \u6392\u67E5\uFF1Afuser -v ${authorityStore.location ?? "<dbPath>"}/LOCK`
449
- );
450
- }
451
- throw err;
452
- }
453
- if (!options?.quiet && now() - lastLockWarnAt >= 1e3) {
454
- lastLockWarnAt = now();
455
- console.warn(
456
- `\u26A0\uFE0F LevelDB \u88AB\u5176\u4ED6\u8FDB\u7A0B\u5360\u7528\uFF08\u5DF2\u5C1D\u8BD5 ${attempt} \u6B21\uFF0C\u8DDD\u8D85\u65F6\u7EA6 ${Math.max(1, Math.ceil(remainingMs / 1e3))}s\uFF09\uFF0C${intervalMs}ms \u540E\u7EE7\u7EED`
457
- );
458
- }
459
- await sleep(intervalMs);
460
- }
461
- }
462
- }
463
- async function openServerDb() {
464
- return ensureServerDbOpen();
465
- }
466
- async function closeServerDb() {
467
- markServerDbShuttingDown();
468
- for (let i = 0; i < 50; i++) {
469
- const s = authorityStore.status;
470
- if (s !== "opening") break;
471
- await defaultSleep(100);
472
- }
473
- const status = authorityStore.status;
474
- if (status !== "open") return;
475
- try {
476
- await authorityStore.close();
477
- console.log("\u2705 LevelDB \u5DF2\u5173\u95ED");
478
- } catch (err) {
479
- console.error("\u274C \u5173\u95ED LevelDB \u5931\u8D25:", err);
480
- }
481
- }
482
339
  export {
483
- ServerDbShuttingDownError,
484
- clearServerDbShuttingDown,
485
- closeServerDb,
486
- db_default as default,
487
- ensureServerDbOpen,
488
- getServerAuthorityStore,
489
- isServerDbLockError,
490
- markServerDbShuttingDown,
491
- openServerDb,
492
- serverDb
340
+ safeJsonEncoding,
341
+ ensureServerDbDirectory,
342
+ createLevelBackedAuthorityStore,
343
+ resolveServerStoreDriver,
344
+ createAuthorityStoreForDriver,
345
+ getOrCreateServerStoreRuntime
493
346
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-XQES6LXQ.js";
3
+ } from "./chunk-LFLWZX76.js";
4
4
  import {
5
5
  resolveServerUrl
6
6
  } from "./chunk-A7GB5UGH.js";