nolo-cli 0.8.0-alpha.24 → 0.8.0-alpha.26

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 (113) hide show
  1. package/{_executeModel-2ZAPHFOX.js → _executeModel-HM7KOYQX.js} +48 -50
  2. package/{action-QM2ONPYZ.js → action-UAHWPMZB.js} +7 -8
  3. package/{addContentAction-UXY3GM53.js → addContentAction-PFIP76LT.js} +6 -8
  4. package/{addDialogAgentAction-MUBYOG65.js → addDialogAgentAction-LWDAIDEU.js} +8 -9
  5. package/{agentDeleteCommand-5TFSII4Z.js → agentDeleteCommand-M6KIV6ZZ.js} +35 -26
  6. package/{agentEmailCommands-XMXWGUMZ.js → agentEmailCommands-X24B32EE.js} +60 -61
  7. package/{agentListCommands-OWEFQEY4.js → agentListCommands-3TQWUC4W.js} +34 -26
  8. package/{agentMachineCommands-DGHYBBFC.js → agentMachineCommands-AHOFELNN.js} +37 -27
  9. package/{agentRecordCommands-I433EE5F.js → agentRecordCommands-GCX4YO5J.js} +53 -54
  10. package/{agentRunCommand-UQSX3IGW.js → agentRunCommand-6Z73OBXZ.js} +56 -59
  11. package/{agentRuntimeLocal-73SVOC5U.js → agentRuntimeLocal-6Q4CEFXY.js} +26 -13
  12. package/{agentSlice-JQCS4LR3.js → agentSlice-73367RQ3.js} +7 -8
  13. package/{authCommand-B6P2XYLN.js → authCommand-ELPMOABY.js} +13 -13
  14. package/{authCommands-4YKA4GTU.js → authCommands-PUQRVHHW.js} +5 -5
  15. package/{chunk-DS3VC4EA.js → chunk-2H4I6KR4.js} +5 -5
  16. package/{chunk-AFON4QUU.js → chunk-3QKO4EHV.js} +3 -3
  17. package/{chunk-LE6JAIXE.js → chunk-3WSPFJ7B.js} +6 -6
  18. package/{chunk-QWM7YWVT.js → chunk-4GBNEA5B.js} +1 -1
  19. package/{chunk-PXZAAB4L.js → chunk-4LG74DRG.js} +4 -4
  20. package/{chunk-IYMGQ3TN.js → chunk-66DXKPRS.js} +2 -2
  21. package/{chunk-L76QNLGU.js → chunk-6L2PIG7I.js} +1 -1
  22. package/{chunk-FZ2G3I4B.js → chunk-6PXKSN2M.js} +2 -2
  23. package/{chunk-GAKEBQD6.js → chunk-D6OQHXVG.js} +11 -7
  24. package/{chunk-GROGNZOA.js → chunk-DXLC3MIQ.js} +85 -2326
  25. package/{chunk-Q7S2ORXX.js → chunk-EUELM55L.js} +10 -10
  26. package/{chunk-BT57QC5K.js → chunk-GK7YFA5J.js} +14 -14
  27. package/chunk-GVQT3FIB.js +2286 -0
  28. package/{chunk-LRKEOCWY.js → chunk-HUHOMATY.js} +17 -17
  29. package/{chunk-6QFNUK2G.js → chunk-I2HCZWJU.js} +1 -1
  30. package/{chunk-WVS3GX3B.js → chunk-IB65MC33.js} +2 -2
  31. package/{chunk-C4DZRHFJ.js → chunk-IG2EZS3N.js} +64 -17
  32. package/{chunk-Z3NEXVYE.js → chunk-IKXL2HZ3.js} +38 -1
  33. package/{chunk-2CVZSC5L.js → chunk-IVAOVLM7.js} +1 -1
  34. package/{chunk-L3KWEH3V.js → chunk-KPFGD3YA.js} +43 -12
  35. package/{chunk-AVMKZHBC.js → chunk-L53FGHA4.js} +3 -2
  36. package/{chunk-WKQGZJVI.js → chunk-LFETMU66.js} +8 -8
  37. package/{chunk-AISLHYDB.js → chunk-LWYCA4ZT.js} +306 -42
  38. package/{chunk-SBVUZC2E.js → chunk-MMCDCZM4.js} +6 -6
  39. package/{chunk-YOCHZD7D.js → chunk-NCGFB7NN.js} +5 -3
  40. package/{chunk-C4FTUXVF.js → chunk-QLUFR47U.js} +11 -1
  41. package/{chunk-IPA2WQGY.js → chunk-QXZ4YDXW.js} +178 -75
  42. package/{chunk-RQPZX6KP.js → chunk-S37OTGU7.js} +2 -2
  43. package/{chunk-FVVST32H.js → chunk-SCBYSC74.js} +1 -1
  44. package/{chunk-WM7P5OWZ.js → chunk-TUIH56DJ.js} +87 -53
  45. package/{chunk-UBSKX3LP.js → chunk-UZZCXRHF.js} +6 -6
  46. package/{chunk-WTBWWBSF.js → chunk-VAHPL4CG.js} +63 -40
  47. package/{chunk-BQECZ3Q4.js → chunk-VDS3NXE5.js} +219 -46
  48. package/{chunk-G7KM6BBZ.js → chunk-VNGCTQ32.js} +1 -1
  49. package/{chunk-BKGNXJAM.js → chunk-WKWEV6K4.js} +1 -1
  50. package/{chunk-JTINRTBT.js → chunk-WPHL6ALY.js} +1 -1
  51. package/{chunk-KTHLAJEY.js → chunk-WZF7M6GX.js} +1 -1
  52. package/{chunk-LTH6AVG7.js → chunk-XDXO65DS.js} +3 -3
  53. package/{chunk-BFDWXLFF.js → chunk-XGMCGPEA.js} +64 -5
  54. package/{chunk-VBKJTOAW.js → chunk-XHQWJUW4.js} +2 -2
  55. package/{chunk-VUEXKW6U.js → chunk-XIZIRGXB.js} +15 -15
  56. package/{chunk-P2SPC3FT.js → chunk-XW6CFB3M.js} +27 -25
  57. package/{chunk-3KGTFX3T.js → chunk-ZR4VHQ5D.js} +13 -1
  58. package/{createAgentAutomationAction-GXZNLJZK.js → createAgentAutomationAction-MYQ7Z7VA.js} +22 -25
  59. package/{createDialogAction-KLW42ZGF.js → createDialogAction-PIV7Z7ZQ.js} +24 -27
  60. package/{createPageAction-IBJHE6MH.js → createPageAction-7ZAEDSUY.js} +24 -27
  61. package/{dbSlice-R5EJKZBW.js → dbSlice-V4H2JFNB.js} +5 -6
  62. package/{deleteFile-WPWVZE4B.js → deleteFile-M7UNIUOO.js} +3 -3
  63. package/{dialogCommands-7O5PUZRU.js → dialogCommands-UMT7AOOR.js} +30 -21
  64. package/{dialogSlice-GGV7PF53.js → dialogSlice-4PYFGN7J.js} +22 -25
  65. package/{docCreateCommands-7ZO2NQQF.js → docCreateCommands-MAZSFQQ5.js} +33 -24
  66. package/{docDeleteCommands-YKIXZYBR.js → docDeleteCommands-DOTLD7HA.js} +33 -25
  67. package/{docReadCommands-5UDONBUL.js → docReadCommands-PH255AKZ.js} +33 -24
  68. package/{docStore-VDWTATFH.js → docStore-P7PG4YDJ.js} +21 -24
  69. package/{docUpdateCommands-EPZIIQMY.js → docUpdateCommands-RLRID2K7.js} +33 -24
  70. package/fetchMessages-KTNM7QAR.js +1 -1
  71. package/getPricing-6TOZXPAU.js +1 -1
  72. package/{handleSendMessageAction-MMATC5V5.js → handleSendMessageAction-BHUXTQHK.js} +27 -30
  73. package/index.js +62 -62
  74. package/{localDialogRead-YSKFFRTT.js → localDialogRead-2VRI24F4.js} +1 -1
  75. package/{machineCommands-PTHPKSIZ.js → machineCommands-GD46ZUZC.js} +63 -62
  76. package/{machineWsRunDispatch-M5L2NVWJ.js → machineWsRunDispatch-5SF5RE7E.js} +52 -53
  77. package/{models-H524GH3U.js → models-LSCRJJ6P.js} +1 -2
  78. package/package.json +1 -1
  79. package/{read-5ZMY7FKP.js → read-2MIMRBZ2.js} +3 -3
  80. package/{readDocTool-2NXDK32S.js → readDocTool-QHVGQHUJ.js} +1 -1
  81. package/{readlineWorkspace-4NXMEOHP.js → readlineWorkspace-IKXTXTYB.js} +115 -100
  82. package/{removeDialogAgentAction-KOLQ2R5W.js → removeDialogAgentAction-7GO2PRVQ.js} +12 -13
  83. package/{runAgentClientLoop-FGUYNGSA.js → runAgentClientLoop-CRIQXO42.js} +45 -48
  84. package/{setDialogExtraReferencesAction-OMTEO7X6.js → setDialogExtraReferencesAction-ZIDAVJSZ.js} +8 -9
  85. package/{setPrimaryDialogAgentAction-DOCIS6V4.js → setPrimaryDialogAgentAction-LK35C2D7.js} +12 -13
  86. package/{settingSlice-UWZJYDOA.js → settingSlice-PRRC6IJ7.js} +6 -7
  87. package/{skillDiscovery-UGSQGX2U.js → skillDiscovery-ZYHSX7VD.js} +3 -3
  88. package/{spaceCommands-S3EB6TOS.js → spaceCommands-XE4PS24W.js} +35 -28
  89. package/{spaceSlice-RG2GSV7K.js → spaceSlice-NYR6BQDL.js} +20 -23
  90. package/{streamAgentChatTurn-X576C23M.js → streamAgentChatTurn-CYEFWT4D.js} +95 -88
  91. package/{toolApiClient-C7P7YSE4.js → toolApiClient-QI3YBNWB.js} +2 -2
  92. package/{tools-HURZ2N4O.js → tools-4YAV2HQH.js} +32 -35
  93. package/{tuiSummaryLlmCaller-DG2LBTBX.js → tuiSummaryLlmCaller-TXLF4MEI.js} +3 -3
  94. package/{updateDialogTitleAction-62LVIAUZ.js → updateDialogTitleAction-FEEBVBNP.js} +27 -29
  95. package/chunk-5MMAK75Q.js +0 -15
  96. package/chunk-AZPCASRE.js +0 -36
  97. package/chunk-IOQIOZNI.js +0 -42
  98. package/chunk-UAD2WT54.js +0 -64
  99. package/{agentPullCommand-N6UWRTVL.js → agentPullCommand-LHFBA5EI.js} +6 -6
  100. package/{chunk-JK7VW2FN.js → chunk-5MIDPSSK.js} +3 -3
  101. package/{chunk-VC6OZXO5.js → chunk-6WWHKODG.js} +4 -4
  102. package/{chunk-BT37DVDA.js → chunk-7VKWMOSI.js} +9 -9
  103. package/{chunk-3QAF2LTL.js → chunk-DZ3XJVET.js} +3 -3
  104. package/{chunk-5CS33IBL.js → chunk-PDL2AV3E.js} +3 -3
  105. package/{chunk-5MMZUWSG.js → chunk-TOILAPLH.js} +5 -5
  106. package/{chunk-3HPUUWOR.js → chunk-TSKWE74T.js} +3 -3
  107. package/{chunk-DVRHHFEA.js → chunk-TSUJOM6N.js} +3 -3
  108. package/{db-6QED3ZVO.js → db-HCJ5PRB5.js} +3 -3
  109. package/{memoryCommands-HG4WKTU7.js → memoryCommands-HGNEENIN.js} +3 -3
  110. package/{offlineMarxistsAgentCommand-BCPJITJL.js → offlineMarxistsAgentCommand-5OOWZLJI.js} +3 -3
  111. package/{runtimeDoctorCommands-UWR5UDSM.js → runtimeDoctorCommands-4YVMXBQP.js} +5 -5
  112. package/{tableCommands-M3DJUETS.js → tableCommands-LV2PPHNY.js} +6 -6
  113. package/{understanding-ZOESBLF3.js → understanding-3CUQQ6SV.js} +3 -3
@@ -3,7 +3,7 @@ import {
3
3
  refreshAntigravityOAuthToken,
4
4
  refreshOpenAiCodexToken,
5
5
  refreshXaiOAuthToken
6
- } from "./chunk-5MMZUWSG.js";
6
+ } from "./chunk-TOILAPLH.js";
7
7
  import {
8
8
  CliProviderQuotaError,
9
9
  executeCli
@@ -12,7 +12,7 @@ import {
12
12
  buildLocalAgentLookupKeys,
13
13
  normalizeAgentHandle,
14
14
  shouldReadAgentKeyRemotely
15
- } from "./chunk-FVVST32H.js";
15
+ } from "./chunk-SCBYSC74.js";
16
16
  import {
17
17
  LOCAL_CODEX_AGENT_ID,
18
18
  LOCAL_CODEX_AGENT_KEY,
@@ -21,38 +21,45 @@ import {
21
21
  } from "./chunk-VHBWHNVT.js";
22
22
  import {
23
23
  inferCaptureIntent
24
- } from "./chunk-KTHLAJEY.js";
24
+ } from "./chunk-WZF7M6GX.js";
25
25
  import {
26
26
  buildCliPrompt
27
27
  } from "./chunk-ATNTHIZI.js";
28
28
  import {
29
29
  prepareTools
30
- } from "./chunk-WVS3GX3B.js";
30
+ } from "./chunk-IB65MC33.js";
31
31
  import {
32
32
  getAntigravityUserAgent,
33
33
  isAntigravityOAuthAgent,
34
34
  readAntigravityProjectId,
35
35
  resolveAntigravityCloudCodeBaseUrl
36
- } from "./chunk-QWM7YWVT.js";
36
+ } from "./chunk-4GBNEA5B.js";
37
37
  import {
38
38
  FORCED_TOOLS,
39
39
  addDefaultLightWebToolsForConfiguredAgents,
40
+ appendEnabledPackPromptPatches,
40
41
  applyDisabledTools,
41
42
  expandEnabledPacks,
42
43
  readXPostFunc,
43
44
  readXPostFunctionSchema,
44
45
  readXhsProfileFunc,
45
46
  readXhsProfileFunctionSchema
46
- } from "./chunk-IPA2WQGY.js";
47
+ } from "./chunk-QXZ4YDXW.js";
48
+ import {
49
+ CORE_DRAIN_REASON
50
+ } from "./chunk-D6OQHXVG.js";
47
51
  import {
48
52
  normalizeDialogTitle
49
53
  } from "./chunk-OWOHNGCN.js";
54
+ import {
55
+ prepareTokenUsageData
56
+ } from "./chunk-DXLC3MIQ.js";
50
57
  import {
51
58
  BUILTIN_TITLE_LLM_CONFIG
52
59
  } from "./chunk-V2J635L5.js";
53
60
  import {
54
61
  fetchServerSyncedCredential
55
- } from "./chunk-Q7S2ORXX.js";
62
+ } from "./chunk-EUELM55L.js";
56
63
  import {
57
64
  buildAgentRuntimeDialogWritePlan,
58
65
  buildLocalWorkspaceOpenAiTools,
@@ -65,23 +72,24 @@ import {
65
72
  parseSseDataLineJson,
66
73
  readOpenAiCompatibleSseCompletion,
67
74
  resolveOpenAiCompatibleProviderConfig
68
- } from "./chunk-C4DZRHFJ.js";
75
+ } from "./chunk-IG2EZS3N.js";
69
76
  import {
70
77
  buildPlatformChatCompletionRequest,
71
78
  canUsePlatformChatProvider,
72
79
  parsePlatformChatCompletionData,
73
80
  parsePlatformChatCompletionResponse,
74
81
  readSseDataValues,
82
+ resolveLegacyDeepSeekProxyChatFallback,
75
83
  resolvePlatformChatProviderConfig,
76
84
  shouldUsePlatformChatProvider
77
- } from "./chunk-3KGTFX3T.js";
85
+ } from "./chunk-ZR4VHQ5D.js";
78
86
  import {
79
87
  resolveAgentRuntimeConfigFromRecord
80
- } from "./chunk-YOCHZD7D.js";
88
+ } from "./chunk-NCGFB7NN.js";
81
89
  import {
82
90
  parseToolArgumentsJson,
83
91
  summarizeToolArguments
84
- } from "./chunk-AISLHYDB.js";
92
+ } from "./chunk-LWYCA4ZT.js";
85
93
  import {
86
94
  buildLoadSkillExecutor,
87
95
  buildNoloWorkspaceCliToolExecutors,
@@ -89,34 +97,22 @@ import {
89
97
  canonicalizeToolNames,
90
98
  parseNoloWorkspaceToolArguments,
91
99
  resolveRuntimeToolSurfaceForAgent
92
- } from "./chunk-FZ2G3I4B.js";
100
+ } from "./chunk-6PXKSN2M.js";
93
101
  import {
94
102
  clipCompactText
95
- } from "./chunk-5MMAK75Q.js";
103
+ } from "./chunk-GVQT3FIB.js";
96
104
  import {
97
105
  createFileCredentialBroker,
98
106
  resolveCurrentRunRuntimeToolPolicy,
99
107
  resolveLocalWorkspaceExecutorOptionsFromPolicy,
100
108
  resolveRequestedRuntimeToolNames
101
- } from "./chunk-5CS33IBL.js";
109
+ } from "./chunk-PDL2AV3E.js";
102
110
  import {
103
111
  createOAuthTokenStore,
104
112
  isTokenExpired,
105
113
  readOAuthCredential,
106
114
  resolveFreshAccessToken
107
115
  } from "./chunk-JZPBVBIY.js";
108
- import {
109
- asRecordOrEmpty
110
- } from "./chunk-KX6YBIHG.js";
111
- import {
112
- dialogMessageRange
113
- } from "./chunk-O4BU24WZ.js";
114
- import {
115
- asTrimmedNonEmptyStringArray
116
- } from "./chunk-I42VC5KR.js";
117
- import {
118
- asOptionalFiniteNumber
119
- } from "./chunk-WWC7I6TA.js";
120
116
  import {
121
117
  checkStaleRun,
122
118
  finalizeRunRecord,
@@ -124,6 +120,12 @@ import {
124
120
  listRunRecords,
125
121
  spawnLocalBackgroundRun
126
122
  } from "./chunk-AMJ7LA5D.js";
123
+ import {
124
+ toErrorMessage
125
+ } from "./chunk-HNMXYYJR.js";
126
+ import {
127
+ getDefaultCliLocalRuntimeDb
128
+ } from "./chunk-H33743XH.js";
127
129
  import {
128
130
  isCompiledBinary,
129
131
  parseUserIdFromAuthToken
@@ -132,11 +134,18 @@ import {
132
134
  DEFAULT_NOLO_SERVER_URL
133
135
  } from "./chunk-OLZBQWZU.js";
134
136
  import {
135
- toErrorMessage
136
- } from "./chunk-HNMXYYJR.js";
137
+ asRecordOrEmpty
138
+ } from "./chunk-KX6YBIHG.js";
137
139
  import {
138
- getDefaultCliLocalRuntimeDb
139
- } from "./chunk-H33743XH.js";
140
+ createTokenKey,
141
+ dialogMessageRange
142
+ } from "./chunk-O4BU24WZ.js";
143
+ import {
144
+ asTrimmedNonEmptyStringArray
145
+ } from "./chunk-I42VC5KR.js";
146
+ import {
147
+ asOptionalFiniteNumber
148
+ } from "./chunk-WWC7I6TA.js";
140
149
  import {
141
150
  BUILTIN_NOLO_AGENT_KEY,
142
151
  PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
@@ -144,13 +153,13 @@ import {
144
153
  PUBLIC_GLM_52_AGENT_KEY,
145
154
  PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
146
155
  PUBLIC_KIMI_K27_CODING_AGENT_KEY
147
- } from "./chunk-VBKJTOAW.js";
148
- import {
149
- asTrimmedString
150
- } from "./chunk-3EUW3WEO.js";
156
+ } from "./chunk-XHQWJUW4.js";
151
157
  import {
152
158
  isRecord
153
159
  } from "./chunk-KUG52IAP.js";
160
+ import {
161
+ asTrimmedString
162
+ } from "./chunk-3EUW3WEO.js";
154
163
  import {
155
164
  NOLO_CLUSTER_SERVERS
156
165
  } from "./chunk-LCBAMY2M.js";
@@ -197,6 +206,7 @@ import { request as httpRequest } from "node:http";
197
206
  import { request as httpsRequest } from "node:https";
198
207
  var TRANSIENT_FETCH_MAX_ATTEMPTS = 3;
199
208
  var TRANSIENT_FETCH_RETRY_BASE_DELAY_MS = 250;
209
+ var CORE_DRAINING_MAX_ATTEMPTS = 30;
200
210
  var RETRYABLE_HTTP_STATUSES = /* @__PURE__ */ new Set([429, 503]);
201
211
  function isTransientFetchError(error) {
202
212
  const message = toErrorMessage(error);
@@ -287,26 +297,44 @@ async function defaultLoopbackRequest(input, init) {
287
297
  req.end();
288
298
  });
289
299
  }
300
+ async function isCoreDrainingResponse(response) {
301
+ if (response.status !== 503) return false;
302
+ try {
303
+ const body = await response.clone().json();
304
+ return body?.reason === CORE_DRAIN_REASON;
305
+ } catch {
306
+ return false;
307
+ }
308
+ }
290
309
  async function fetchWithTransientRetry(fetchImpl, input, init, options = {}) {
291
310
  const retryableStatuses = options.retryableStatuses ?? RETRYABLE_HTTP_STATUSES;
311
+ const requestedMaxAttempts = Number(options.maxAttempts);
312
+ const maxAttempts = Number.isFinite(requestedMaxAttempts) ? Math.min(100, Math.max(1, Math.floor(requestedMaxAttempts))) : TRANSIENT_FETCH_MAX_ATTEMPTS;
313
+ const requestedCoreDrainingMaxAttempts = Number(options.coreDrainingMaxAttempts);
314
+ const coreDrainingMaxAttempts = Number.isFinite(requestedCoreDrainingMaxAttempts) ? Math.min(100, Math.max(1, Math.floor(requestedCoreDrainingMaxAttempts))) : CORE_DRAINING_MAX_ATTEMPTS;
315
+ const loopMaxAttempts = Math.max(maxAttempts, coreDrainingMaxAttempts);
292
316
  let lastError;
293
- for (let attempt = 1; attempt <= TRANSIENT_FETCH_MAX_ATTEMPTS; attempt += 1) {
317
+ for (let attempt = 1; attempt <= loopMaxAttempts; attempt += 1) {
294
318
  try {
295
319
  if (options.loopbackRequest && isLoopbackUrl(input)) {
296
320
  return await options.loopbackRequest(input, init);
297
321
  }
298
322
  const response = await fetchImpl(input, init);
299
- if (retryableStatuses.has(response.status) && attempt < TRANSIENT_FETCH_MAX_ATTEMPTS && !init?.signal?.aborted) {
300
- const delayMs = await resolveRetryAfterMs(response, attempt);
301
- await (options.sleep ?? defaultSleep)(delayMs);
302
- continue;
323
+ if (retryableStatuses.has(response.status) && !init?.signal?.aborted) {
324
+ const coreDraining = await isCoreDrainingResponse(response);
325
+ const attemptBudget = coreDraining ? coreDrainingMaxAttempts : maxAttempts;
326
+ if (attempt < attemptBudget) {
327
+ const delayMs = await resolveRetryAfterMs(response, attempt);
328
+ await (options.sleep ?? defaultSleep)(delayMs);
329
+ continue;
330
+ }
303
331
  }
304
332
  return response;
305
333
  } catch (error) {
306
334
  if (init?.signal?.aborted) throw error;
307
335
  if (!isTransientFetchError(error)) throw error;
308
336
  lastError = error;
309
- if (attempt < TRANSIENT_FETCH_MAX_ATTEMPTS) {
337
+ if (attempt < maxAttempts) {
310
338
  await (options.sleep ?? defaultSleep)(transientFetchRetryDelayMs(attempt));
311
339
  }
312
340
  }
@@ -8327,9 +8355,26 @@ function resolveCliEffectiveEnabledPacks(args) {
8327
8355
  }
8328
8356
  const base = args.enabledPacks ?? [];
8329
8357
  if (base.length === 0) {
8330
- return ["code", "agent-orchestration"];
8358
+ return ["code", "agent-orchestration", "skills"];
8331
8359
  }
8332
- return base.includes("agent-orchestration") ? base : [...base, "agent-orchestration"];
8360
+ const withOrchestration = base.includes("agent-orchestration") ? base : [...base, "agent-orchestration"];
8361
+ return withOrchestration.includes("skills") ? withOrchestration : [...withOrchestration, "skills"];
8362
+ }
8363
+ function withRuntimeEnabledPacksAndPrompt(config) {
8364
+ const rawRecord = config.rawRecord ?? {};
8365
+ const enabledPacks = config.enabledPacks ?? rawRecord.enabledPacks;
8366
+ const prompt = appendEnabledPackPromptPatches(
8367
+ config.prompt,
8368
+ enabledPacks
8369
+ );
8370
+ if (prompt === config.prompt && !enabledPacks?.length) {
8371
+ return config;
8372
+ }
8373
+ return {
8374
+ ...config,
8375
+ ...enabledPacks?.length ? { enabledPacks } : {},
8376
+ ...prompt ? { prompt } : {}
8377
+ };
8333
8378
  }
8334
8379
  function resolveCliRequestedToolNames(agentConfig, env) {
8335
8380
  const declaredOnly = shouldUseDeclaredOnlyLocalWorkspaceTools(env);
@@ -8641,6 +8686,33 @@ function createLocalDialogTitleGenerator(deps, ctx) {
8641
8686
  return result.source === "llm" ? result.title : null;
8642
8687
  };
8643
8688
  }
8689
+ async function writeLocalTokenRecord(args) {
8690
+ const rawUsage = args.input.result.usage;
8691
+ if (!rawUsage || typeof rawUsage !== "object" || Object.keys(rawUsage).length === 0) {
8692
+ return;
8693
+ }
8694
+ const timestamp = args.now();
8695
+ const prepared = prepareTokenUsageData({
8696
+ rawUsage,
8697
+ agentConfig: {
8698
+ model: args.input.result.model || "unknown",
8699
+ provider: args.input.result.provider,
8700
+ apiSource: "cli"
8701
+ },
8702
+ userId: args.userId,
8703
+ agentId: args.input.agentKey,
8704
+ dialogId: args.dialogId,
8705
+ timestamp,
8706
+ entry_path: "cli-local"
8707
+ });
8708
+ const recordKey = createTokenKey.record(args.userId, timestamp);
8709
+ const tokenRecord = {
8710
+ id: args.createId(),
8711
+ type: "token",
8712
+ ...prepared.tokenData
8713
+ };
8714
+ await args.store.write(recordKey, tokenRecord);
8715
+ }
8644
8716
  async function writeDialog(args) {
8645
8717
  let existingDialog = null;
8646
8718
  if (args.input.continueDialogId) {
@@ -8674,6 +8746,22 @@ async function writeDialog(args) {
8674
8746
  ...titleOverride ? { titleOverride } : {}
8675
8747
  });
8676
8748
  await args.store.batch(plan.ops);
8749
+ try {
8750
+ await writeLocalTokenRecord({
8751
+ store: args.store,
8752
+ input: args.input,
8753
+ userId: args.userId,
8754
+ dialogId: plan.dialogId,
8755
+ now: args.now,
8756
+ createId: args.createId,
8757
+ output: args.output
8758
+ });
8759
+ } catch (error) {
8760
+ args.output?.write(
8761
+ `[nolo] Token usage record write failed (non-fatal): ${toErrorMessage(error)}
8762
+ `
8763
+ );
8764
+ }
8677
8765
  const hasSubjectRefs = localTurnHasSubjectRefs(args.input);
8678
8766
  const isLocalUser = args.userId === "local";
8679
8767
  if (!isLocalUser) {
@@ -8707,6 +8795,42 @@ async function writeDialog(args) {
8707
8795
  }
8708
8796
  return { dialogId: plan.dialogId };
8709
8797
  }
8798
+ function resolveCliDialogRecordKey(userId, dialogId) {
8799
+ if (dialogId.startsWith("dialog-") && !dialogId.includes("-msg-")) {
8800
+ return dialogId;
8801
+ }
8802
+ return `dialog-${userId}-${dialogId}`;
8803
+ }
8804
+ async function loadCliDialogSummary(args) {
8805
+ const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
8806
+ const record = await args.store.read(dialogKey);
8807
+ if (!record || typeof record !== "object") return null;
8808
+ const summary = typeof record.summary === "string" ? record.summary.trim() : "";
8809
+ if (!summary) return null;
8810
+ const summarizedBeforeId = record.summarizedBeforeId;
8811
+ return {
8812
+ summary,
8813
+ ...typeof summarizedBeforeId === "string" && summarizedBeforeId ? { summarizedBeforeId } : {}
8814
+ };
8815
+ }
8816
+ async function saveCliDialogSummary(args) {
8817
+ const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
8818
+ const existing = await args.store.read(dialogKey) ?? {};
8819
+ const bareId = typeof existing.id === "string" && existing.id ? existing.id : args.dialogId.startsWith("dialog-") ? args.dialogId.slice(args.dialogId.lastIndexOf("-") + 1) : args.dialogId;
8820
+ const compressionCount = typeof existing.compressionCount === "number" ? existing.compressionCount + 1 : 1;
8821
+ await args.store.write(dialogKey, {
8822
+ ...existing,
8823
+ id: bareId,
8824
+ dbKey: dialogKey,
8825
+ type: "dialog",
8826
+ userId: args.userId,
8827
+ summary: args.summary,
8828
+ ...args.summarizedBeforeId !== void 0 ? { summarizedBeforeId: args.summarizedBeforeId } : {},
8829
+ compressionCount,
8830
+ summaryPending: false,
8831
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8832
+ });
8833
+ }
8710
8834
  function createCliLocalRuntimeAdapter(deps) {
8711
8835
  const now = deps.now ?? Date.now;
8712
8836
  const createId = deps.createId ?? createFallbackId;
@@ -8760,10 +8884,11 @@ function createCliLocalRuntimeAdapter(deps) {
8760
8884
  userId
8761
8885
  });
8762
8886
  const fallbackLocalCliAgentConfig = storedAgentConfig ? null : resolveBuiltinLocalCliAgentConfig(agentRef, userId);
8763
- const agentConfig = withResolvedRuntimeToolSurface(
8887
+ const baseAgentConfig = withResolvedRuntimeToolSurface(
8764
8888
  storedAgentConfig ?? fallbackLocalCliAgentConfig,
8765
8889
  deps.env
8766
8890
  );
8891
+ const agentConfig = baseAgentConfig ? withRuntimeEnabledPacksAndPrompt(baseAgentConfig) : baseAgentConfig;
8767
8892
  const requestedToolNames = agentConfig ? resolveCliRequestedToolNames(agentConfig, deps.env) : [];
8768
8893
  activeAgentToolNames = buildLocalPolicyToolNames({
8769
8894
  agentKey: agentConfig?.key,
@@ -8800,6 +8925,18 @@ function createCliLocalRuntimeAdapter(deps) {
8800
8925
  dialogId,
8801
8926
  store: await getOrCreateSharedStore(deps)
8802
8927
  }),
8928
+ loadDialogSummary: async (dialogId) => loadCliDialogSummary({
8929
+ store: await getOrCreateSharedStore(deps),
8930
+ userId,
8931
+ dialogId
8932
+ }),
8933
+ saveDialogSummary: async (input) => saveCliDialogSummary({
8934
+ store: await getOrCreateSharedStore(deps),
8935
+ userId,
8936
+ dialogId: input.dialogId,
8937
+ summary: input.summary,
8938
+ summarizedBeforeId: input.summarizedBeforeId
8939
+ }),
8803
8940
  saveTurn: async (input) => writeDialog({
8804
8941
  store: await getOrCreateSharedStore(deps),
8805
8942
  input,
@@ -9135,7 +9272,7 @@ function createCliLocalRuntimeAdapter(deps) {
9135
9272
  openAiToolNames: summarizeOpenAiToolNames(tools2),
9136
9273
  stream
9137
9274
  });
9138
- const res = await fetchWithTransientRetry(
9275
+ let res = await fetchWithTransientRetry(
9139
9276
  fetchImpl,
9140
9277
  request.url,
9141
9278
  {
@@ -9146,8 +9283,44 @@ function createCliLocalRuntimeAdapter(deps) {
9146
9283
  loopbackRequest
9147
9284
  }
9148
9285
  );
9286
+ let responseProviderConfig = providerConfig2;
9287
+ let firstErrorRaw;
9149
9288
  if (!res.ok) {
9150
- const raw2 = await res.text().catch(() => "");
9289
+ firstErrorRaw = await res.text().catch(() => "");
9290
+ const fallbackProviderConfig = resolveLegacyDeepSeekProxyChatFallback({
9291
+ providerConfig: providerConfig2,
9292
+ status: res.status,
9293
+ raw: firstErrorRaw
9294
+ });
9295
+ if (fallbackProviderConfig) {
9296
+ responseProviderConfig = fallbackProviderConfig;
9297
+ const fallbackRequest = buildPlatformChatCompletionRequest({
9298
+ providerConfig: fallbackProviderConfig,
9299
+ messages,
9300
+ tools: tools2,
9301
+ stream: false
9302
+ });
9303
+ logLocalRuntimeDiagnostic("provider.request.compatibility-fallback", {
9304
+ agentKey: agentConfig.key,
9305
+ provider: providerConfig2.provider,
9306
+ fromEndpoint: summarizeEndpoint(providerConfig2.endpoint) ?? null,
9307
+ toEndpoint: summarizeEndpoint(fallbackProviderConfig.endpoint) ?? null,
9308
+ reason: "legacy-proxy-responses-schema"
9309
+ });
9310
+ res = await fetchWithTransientRetry(
9311
+ fetchImpl,
9312
+ fallbackRequest.url,
9313
+ { ...fallbackRequest.init },
9314
+ {
9315
+ sleep: deps.sleep,
9316
+ loopbackRequest
9317
+ }
9318
+ );
9319
+ firstErrorRaw = void 0;
9320
+ }
9321
+ }
9322
+ if (!res.ok) {
9323
+ const raw2 = firstErrorRaw ?? await res.text().catch(() => "");
9151
9324
  const data2 = parsePlatformChatCompletionData(raw2);
9152
9325
  const rawPreview = raw2.length > 200 ? `${raw2.slice(0, 200)}\u2026(${raw2.length}b)` : raw2;
9153
9326
  const gatewayHeaders = [
@@ -9198,7 +9371,7 @@ function createCliLocalRuntimeAdapter(deps) {
9198
9371
  });
9199
9372
  const data = parsePlatformChatCompletionData(raw);
9200
9373
  return parsePlatformChatCompletionResponse({
9201
- providerConfig: providerConfig2,
9374
+ providerConfig: responseProviderConfig,
9202
9375
  data,
9203
9376
  trace: messages
9204
9377
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  canonicalizeToolNames
3
- } from "./chunk-FZ2G3I4B.js";
3
+ } from "./chunk-6PXKSN2M.js";
4
4
  import {
5
5
  asTrimmedString
6
6
  } from "./chunk-3EUW3WEO.js";
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-SBVUZC2E.js";
5
+ } from "./chunk-MMCDCZM4.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-DVRHHFEA.js";
4
+ } from "./chunk-TSUJOM6N.js";
5
5
  import {
6
6
  fetchFromClientDb
7
7
  } from "./chunk-OOSFSFMA.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-UBSKX3LP.js";
4
+ } from "./chunk-UZZCXRHF.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-UBSKX3LP.js";
3
+ } from "./chunk-UZZCXRHF.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-L3KWEH3V.js";
6
+ } from "./chunk-KPFGD3YA.js";
7
7
  import {
8
8
  selectIdentityToken
9
- } from "./chunk-DVRHHFEA.js";
9
+ } from "./chunk-TSUJOM6N.js";
10
10
  import {
11
11
  getIsDesktopApp
12
12
  } from "./chunk-OOSFSFMA.js";
@@ -1,15 +1,72 @@
1
- import {
2
- createSpaceKey
3
- } from "./chunk-UAD2WT54.js";
4
1
  import {
5
2
  patch,
6
3
  read
7
- } from "./chunk-L3KWEH3V.js";
4
+ } from "./chunk-KPFGD3YA.js";
8
5
  import {
9
6
  DEVICE_LOCAL_OWNER_ID,
10
7
  isDeviceLocalSpaceBody,
11
8
  selectIdentityUserId
12
- } from "./chunk-DVRHHFEA.js";
9
+ } from "./chunk-TSUJOM6N.js";
10
+
11
+ // packages/create/space/spaceKeys.ts
12
+ var SEPARATOR = "-";
13
+ var SPACE_PREFIX = "space";
14
+ var SPACE_PREFIX_WITH_SEPARATOR = `${SPACE_PREFIX}${SEPARATOR}`;
15
+ var normalizeSpaceId = (spaceId) => {
16
+ if (!spaceId) return spaceId;
17
+ return spaceId.startsWith(SPACE_PREFIX_WITH_SEPARATOR) ? spaceId.slice(SPACE_PREFIX_WITH_SEPARATOR.length) : spaceId;
18
+ };
19
+ var createSpaceKey = {
20
+ // 空间基础信息的key
21
+ space: (spaceId) => {
22
+ return [SPACE_PREFIX, normalizeSpaceId(spaceId)].join(SEPARATOR);
23
+ },
24
+ // 空间成员的key
25
+ member: (userId, spaceId) => {
26
+ return [SPACE_PREFIX, "member", userId, normalizeSpaceId(spaceId)].join(
27
+ SEPARATOR
28
+ );
29
+ },
30
+ // 查询用户所在的所有空间的范围
31
+ memberRange: (userId) => {
32
+ return {
33
+ start: [SPACE_PREFIX, "member", userId, ""].join(SEPARATOR),
34
+ end: [SPACE_PREFIX, "member", userId, "\uFFFF"].join(SEPARATOR)
35
+ };
36
+ },
37
+ /**
38
+ * 预留:未来若出现“按用户、按空间、且必须跨设备同步”的空间级偏好,
39
+ * 统一使用这个 key family。当前产品主链不要依赖它。
40
+ */
41
+ setting: (userId, spaceId) => {
42
+ return [SPACE_PREFIX, "setting", userId, normalizeSpaceId(spaceId)].join(
43
+ SEPARATOR
44
+ );
45
+ },
46
+ /**
47
+ * 预留:未来如确实需要批量读取空间级远端偏好,再使用这个范围。
48
+ */
49
+ settingRange: (userId) => {
50
+ return {
51
+ start: [SPACE_PREFIX, "setting", userId, ""].join(SEPARATOR),
52
+ end: [SPACE_PREFIX, "setting", userId, "\uFFFF"].join(SEPARATOR)
53
+ };
54
+ },
55
+ // 从成员key中提取空间key
56
+ // 成员 key 格式: space-member-{userId}-{spaceId}
57
+ // userId 是单段(无连字符),spaceId 是 ULID(无连字符)
58
+ spaceFromMember: (memberKey) => {
59
+ const parts = memberKey.split(SEPARATOR);
60
+ if (parts.length < 4) return "";
61
+ const spaceId = parts[parts.length - 1];
62
+ return [SPACE_PREFIX, spaceId].join(SEPARATOR);
63
+ },
64
+ // 从成员key中提取空间ID
65
+ spaceIdFromMember: (memberKey) => {
66
+ const parts = memberKey.split(SEPARATOR);
67
+ return parts.length >= 4 ? parts[parts.length - 1] : "";
68
+ }
69
+ };
13
70
 
14
71
  // packages/create/space/utils/permissions.ts
15
72
  var checkSpaceMembership = (spaceData, userId) => {
@@ -106,6 +163,8 @@ var addContentAction = async (input, thunkAPI) => {
106
163
  };
107
164
 
108
165
  export {
166
+ normalizeSpaceId,
167
+ createSpaceKey,
109
168
  checkSpaceMembership,
110
169
  localSpaceAuthorityPatchStamp,
111
170
  UNCATEGORIZED_ID,
@@ -7,7 +7,7 @@ import {
7
7
  scheduleExistingRecordReplication,
8
8
  shouldReplaceLocalWithRemoteRecord,
9
9
  shouldReplicateLocalRecord
10
- } from "./chunk-DVRHHFEA.js";
10
+ } from "./chunk-TSUJOM6N.js";
11
11
  import {
12
12
  fetchFromClientDb,
13
13
  fetchFromServer,
@@ -466,13 +466,13 @@ var readAction = async (payload, thunkApi) => {
466
466
  };
467
467
 
468
468
  export {
469
+ readRequestManager,
469
470
  BUILTIN_NOLO_AGENT_KEY,
470
471
  PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
471
472
  PUBLIC_DEEPSEEK_V4_PRO_AGENT_KEY,
472
473
  PUBLIC_KIMI_K27_CODING_AGENT_KEY,
473
474
  PUBLIC_GLM_52_AGENT_KEY,
474
475
  PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
475
- readRequestManager,
476
476
  resolveAgentReadServers,
477
477
  readAction
478
478
  };
@@ -7,21 +7,14 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-BKGNXJAM.js";
10
+ } from "./chunk-WKWEV6K4.js";
11
11
  import {
12
12
  buildDialogAttachmentPlan,
13
13
  extractFileContentIds
14
14
  } from "./chunk-MTU75CZ2.js";
15
15
  import {
16
- parsePositiveFiniteNumberOrFallback
17
- } from "./chunk-Y5GCAMGP.js";
18
- import {
19
- asRecordOrEmpty
20
- } from "./chunk-KX6YBIHG.js";
21
- import {
22
- asNonEmptyStringArray,
23
- asTrimmedNonEmptyStringArray
24
- } from "./chunk-I42VC5KR.js";
16
+ toErrorMessage
17
+ } from "./chunk-HNMXYYJR.js";
25
18
  import {
26
19
  parseUserIdFromAuthToken,
27
20
  readOption,
@@ -31,14 +24,21 @@ import {
31
24
  resolveServerUrl
32
25
  } from "./chunk-AVMJVOQY.js";
33
26
  import {
34
- toErrorMessage
35
- } from "./chunk-HNMXYYJR.js";
27
+ parsePositiveFiniteNumberOrFallback
28
+ } from "./chunk-Y5GCAMGP.js";
36
29
  import {
37
- asTrimmedString
38
- } from "./chunk-3EUW3WEO.js";
30
+ asRecordOrEmpty
31
+ } from "./chunk-KX6YBIHG.js";
32
+ import {
33
+ asNonEmptyStringArray,
34
+ asTrimmedNonEmptyStringArray
35
+ } from "./chunk-I42VC5KR.js";
39
36
  import {
40
37
  isRecord
41
38
  } from "./chunk-KUG52IAP.js";
39
+ import {
40
+ asTrimmedString
41
+ } from "./chunk-3EUW3WEO.js";
42
42
  import {
43
43
  asOptionalTrimmedString
44
44
  } from "./chunk-G3SUCT4W.js";
@@ -625,7 +625,7 @@ async function tryHttpDialogCandidates(args) {
625
625
  throw Object.assign(new Error("All HTTP dialog reads failed"), { attempts });
626
626
  }
627
627
  async function readDialogFromLocalDb(dialogKey, dialogId, limit) {
628
- const { readDialogFromLocalDb: readLocalDialog } = await import("./localDialogRead-YSKFFRTT.js");
628
+ const { readDialogFromLocalDb: readLocalDialog } = await import("./localDialogRead-2VRI24F4.js");
629
629
  const result = await readLocalDialog({ dialogKey, dialogId, limit });
630
630
  return {
631
631
  ...result,