nolo-cli 0.97.0-alpha.2 → 0.98.0-alpha.2

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 (58) hide show
  1. package/{_executeModel-G2MRKK2K.js → _executeModel-MA3D2J4W.js} +13 -13
  2. package/{agentDeleteCommand-4427YKQF.js → agentDeleteCommand-FHUJH5X4.js} +6 -6
  3. package/{agentEmailCommands-RNBKKO7Q.js → agentEmailCommands-RE2E7J5U.js} +15 -15
  4. package/{agentListCommands-O4AEMQVV.js → agentListCommands-GATRXEMT.js} +6 -6
  5. package/{agentMachineCommands-FOFX5S2Q.js → agentMachineCommands-WAB65VQQ.js} +7 -7
  6. package/{agentRecordCommands-6QK7AMXQ.js → agentRecordCommands-J5OBRSAV.js} +15 -15
  7. package/{agentRunCommand-2W3Q3A7M.js → agentRunCommand-VUSTQP4Z.js} +15 -15
  8. package/{agentRuntimeLocal-IW3IM5P6.js → agentRuntimeLocal-VXZSDIGT.js} +6 -6
  9. package/{agentSlice-SK47GTN7.js → agentSlice-65ETD734.js} +1 -1
  10. package/{appDeleteCommands-ZXLXNRHF.js → appDeleteCommands-PDZ7HQYH.js} +6 -6
  11. package/{appDeployCommands-PWB4YERK.js → appDeployCommands-KLLW32YA.js} +6 -6
  12. package/{appDeployStatusCommands-2EZKZP7Y.js → appDeployStatusCommands-IPNJ445T.js} +6 -6
  13. package/{appGetCommands-JNUKOWHO.js → appGetCommands-QA57XGXS.js} +6 -6
  14. package/{appListCommands-6X3H67SS.js → appListCommands-YBTAUFZS.js} +6 -6
  15. package/{chatQueueReduxAdapter-ZJ555AT2.js → chatQueueReduxAdapter-5QOW43T4.js} +4 -4
  16. package/{chunk-NEDZDG3M.js → chunk-4OEFYTWL.js} +1 -1
  17. package/{chunk-4EZHSKTB.js → chunk-5H7KJX7J.js} +1 -1
  18. package/{chunk-3SK4LEIH.js → chunk-677AH2IM.js} +9 -9
  19. package/{chunk-SDTTBMBU.js → chunk-6VFARHZW.js} +5 -5
  20. package/{chunk-QLNJRTKI.js → chunk-AD2L6YCC.js} +2 -2
  21. package/{chunk-ADTY7BWR.js → chunk-C26JRUFH.js} +1 -1
  22. package/{chunk-B4ZH7KVO.js → chunk-D2QT5FW4.js} +1 -1
  23. package/{chunk-R7N5TMTV.js → chunk-D4T5RT5D.js} +3 -3
  24. package/{chunk-WRFW73PB.js → chunk-DHDVZFNC.js} +18 -14
  25. package/{chunk-ASQYTZTR.js → chunk-DNCEALKX.js} +48 -9
  26. package/{chunk-X4QAVDFE.js → chunk-FSX24MR3.js} +9 -9
  27. package/{chunk-EHKBVWKL.js → chunk-FUUHG5LT.js} +1 -1
  28. package/{chunk-O35EJJVP.js → chunk-GABFWSOQ.js} +4 -4
  29. package/{chunk-7D6Z6AA4.js → chunk-GZBATRJA.js} +2 -2
  30. package/{chunk-L7I247DF.js → chunk-L5UXH3B2.js} +1 -1
  31. package/{chunk-OZPMVBJI.js → chunk-N2WELJE7.js} +2 -2
  32. package/{chunk-OIMN34NA.js → chunk-PELKTR62.js} +6 -6
  33. package/{chunk-NUVMWYJM.js → chunk-PY5D7R4Z.js} +13 -10
  34. package/{chunk-RSJECD7I.js → chunk-TVYSVSA2.js} +3 -3
  35. package/{chunk-2YMRWISD.js → chunk-ZCYXJSTU.js} +1 -1
  36. package/{contentThunks-YLWTUILV.js → contentThunks-Y6FA2TCW.js} +5 -5
  37. package/{createAgentAutomationAction-HFLPOBWQ.js → createAgentAutomationAction-JXAFQO5V.js} +5 -5
  38. package/{createDialogAction-4H52MURR.js → createDialogAction-O2QABXZF.js} +6 -6
  39. package/{createPageAction-5YDRMJOS.js → createPageAction-GUQDPKO5.js} +5 -5
  40. package/{dialogCommands-KFK2FF5B.js → dialogCommands-JJDASFIL.js} +6 -6
  41. package/{dialogSlice-TMSHUGEM.js → dialogSlice-J2YJNE6E.js} +4 -4
  42. package/{docCreateCommands-V777WOZ7.js → docCreateCommands-OB3X3EQM.js} +6 -6
  43. package/{docDeleteCommands-5KHT7Z5Q.js → docDeleteCommands-WMHRGF22.js} +6 -6
  44. package/{docReadCommands-BLROGWP3.js → docReadCommands-NWGGLIAZ.js} +6 -6
  45. package/{docStore-OBC5QOW7.js → docStore-6KKYKAGQ.js} +1 -1
  46. package/{docUpdateCommands-QXOZHQ5H.js → docUpdateCommands-3DDSOLPS.js} +6 -6
  47. package/{handleSendMessageAction-4LGNXH6T.js → handleSendMessageAction-A4XLEEPU.js} +4 -4
  48. package/index.js +42 -42
  49. package/{machineCommands-SNLCRHQK.js → machineCommands-QWDAUIRP.js} +15 -15
  50. package/{machineWsRunDispatch-ZGZVDQSO.js → machineWsRunDispatch-S2SMIDWM.js} +15 -15
  51. package/package.json +1 -1
  52. package/{readlineWorkspace-OUL7ZN7D.js → readlineWorkspace-3VZDKUXT.js} +15 -15
  53. package/{runAgentClientLoop-GD3APV7V.js → runAgentClientLoop-ADZRHNG6.js} +11 -11
  54. package/{spaceCommands-TIDVUPDV.js → spaceCommands-E7MQ4VU2.js} +6 -6
  55. package/{streamAgentChatTurn-M73KWCCU.js → streamAgentChatTurn-TUP7YO3H.js} +13 -13
  56. package/{tools-DXXDQ2CP.js → tools-2VDNDFET.js} +8 -8
  57. package/{tuiSummaryLlmCaller-VJY3YD2Q.js → tuiSummaryLlmCaller-WFRWERGK.js} +2 -2
  58. package/{updateDialogTitleAction-XI73NQMU.js → updateDialogTitleAction-KSWXWWFT.js} +5 -5
@@ -27,7 +27,7 @@ import {
27
27
  resolveLocalUserId,
28
28
  t,
29
29
  toolLabel
30
- } from "./chunk-NUVMWYJM.js";
30
+ } from "./chunk-PY5D7R4Z.js";
31
31
  import {
32
32
  createRunActivityTracker,
33
33
  popSingleQueueMessage,
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-LTRXGFMS.js";
65
65
  import {
66
66
  formatAgentListCard
67
- } from "./chunk-X4QAVDFE.js";
67
+ } from "./chunk-FSX24MR3.js";
68
68
  import {
69
69
  isTransientFetchError
70
70
  } from "./chunk-5UTFL4QJ.js";
@@ -85,11 +85,11 @@ import {
85
85
  chooseMemoryOwners,
86
86
  loadMemoryCandidatesFromDb,
87
87
  resolveAgentMemoryPolicy
88
- } from "./chunk-OZPMVBJI.js";
88
+ } from "./chunk-N2WELJE7.js";
89
89
  import {
90
90
  API_REPORTED_COST_MULTIPLIER,
91
91
  parseUiAskChoiceContent
92
- } from "./chunk-WRFW73PB.js";
92
+ } from "./chunk-DHDVZFNC.js";
93
93
  import {
94
94
  isOAuthApiKeyRef
95
95
  } from "./chunk-YYLHWIW6.js";
@@ -112,10 +112,10 @@ import {
112
112
  LOCAL_AGENT_CONFIG_MISSING_CODE,
113
113
  LOCAL_TURN_ABORTED_CODE,
114
114
  readActionGate
115
- } from "./chunk-SDTTBMBU.js";
115
+ } from "./chunk-6VFARHZW.js";
116
116
  import {
117
117
  resolveAgentRuntimeConfigFromRecord
118
- } from "./chunk-4EZHSKTB.js";
118
+ } from "./chunk-5H7KJX7J.js";
119
119
  import {
120
120
  createThinkParserState,
121
121
  flushThinkParser,
@@ -138,10 +138,10 @@ import {
138
138
  DEFAULT_CONTEXT_WINDOW,
139
139
  getModelContextWindow,
140
140
  normalizeUsage
141
- } from "./chunk-NEDZDG3M.js";
141
+ } from "./chunk-4OEFYTWL.js";
142
142
  import {
143
143
  clipCompactText
144
- } from "./chunk-ASQYTZTR.js";
144
+ } from "./chunk-DNCEALKX.js";
145
145
  import {
146
146
  findModelConfig
147
147
  } from "./chunk-OIVSQH2O.js";
@@ -10433,7 +10433,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
10433
10433
  // packages/cli/client/agentRun.ts
10434
10434
  import { ulid as ulid2 } from "ulid";
10435
10435
  async function loadRunLocalAgentTurn() {
10436
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-IW3IM5P6.js");
10436
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-VXZSDIGT.js");
10437
10437
  return runLocalAgentTurn;
10438
10438
  }
10439
10439
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -8,7 +8,7 @@ import {
8
8
  readSseFrames,
9
9
  streamSseDataValues,
10
10
  throwIfChatCompletionStreamFailed
11
- } from "./chunk-2YMRWISD.js";
11
+ } from "./chunk-ZCYXJSTU.js";
12
12
  import {
13
13
  DEVIN_CONNECT_URL
14
14
  } from "./chunk-Q5FJJ6XI.js";
@@ -20,7 +20,7 @@ import {
20
20
  resolveHistoricalToolContentCap,
21
21
  resolveToolOutputProfile,
22
22
  stripImagePartsFromMessages
23
- } from "./chunk-4EZHSKTB.js";
23
+ } from "./chunk-5H7KJX7J.js";
24
24
  import {
25
25
  downgradeUnparsableToolCalls,
26
26
  hasParsableObjectArguments,
@@ -46,7 +46,7 @@ import {
46
46
  requiresBareImageUrl,
47
47
  resolveToolGuidedSections,
48
48
  toBareImageUrlMessages
49
- } from "./chunk-L7I247DF.js";
49
+ } from "./chunk-L5UXH3B2.js";
50
50
  import {
51
51
  convertMessagesToResponsesInput,
52
52
  extractReasoningFromResponseOutput,
@@ -93,7 +93,7 @@ import {
93
93
  resolveEmptyAssistantFallbackMessage,
94
94
  resolveEmptyAssistantOutcome,
95
95
  resolveTruncatedReasoningTailLog
96
- } from "./chunk-NEDZDG3M.js";
96
+ } from "./chunk-4OEFYTWL.js";
97
97
  import {
98
98
  COMPACTION_SUMMARY_SCHEMA_VERSION,
99
99
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
@@ -112,7 +112,7 @@ import {
112
112
  resolveCompressionTriggerRatio,
113
113
  truncateToolOutputForContext,
114
114
  withProviderCallTimingFields
115
- } from "./chunk-ASQYTZTR.js";
115
+ } from "./chunk-DNCEALKX.js";
116
116
  import {
117
117
  estimateTokenCount
118
118
  } from "./chunk-PSCNXBYA.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-X4QAVDFE.js";
3
+ } from "./chunk-FSX24MR3.js";
4
4
  import {
5
5
  i18n_default
6
- } from "./chunk-WRFW73PB.js";
6
+ } from "./chunk-DHDVZFNC.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-O6OSWFZQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-NUVMWYJM.js";
3
+ } from "./chunk-PY5D7R4Z.js";
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-LS2ZANRJ.js";
@@ -9,7 +9,7 @@ import {
9
9
  initReactI18next,
10
10
  instance,
11
11
  toast
12
- } from "./chunk-WRFW73PB.js";
12
+ } from "./chunk-DHDVZFNC.js";
13
13
  import {
14
14
  require_date_fns
15
15
  } from "./chunk-M76ECQRD.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-NUVMWYJM.js";
4
+ } from "./chunk-PY5D7R4Z.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-X4QAVDFE.js";
7
+ } from "./chunk-FSX24MR3.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-SDTTBMBU.js";
10
+ } from "./chunk-6VFARHZW.js";
11
11
  import {
12
12
  applyToolSurfaceConstraints
13
13
  } from "./chunk-IIVGDG4I.js";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-AGGIDPCZ.js";
15
15
  import {
16
16
  runLlm
17
- } from "./chunk-RSJECD7I.js";
17
+ } from "./chunk-TVYSVSA2.js";
18
18
  import {
19
19
  cleanupCliSessionForDialog
20
20
  } from "./chunk-TOP2VXOR.js";
@@ -55,7 +55,7 @@ import {
55
55
  getModelInfo,
56
56
  normalizeUsage,
57
57
  resolveAutoExecutionProfile
58
- } from "./chunk-NEDZDG3M.js";
58
+ } from "./chunk-4OEFYTWL.js";
59
59
  import {
60
60
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
61
61
  buildCompactionMetricsFromPlan,
@@ -66,7 +66,7 @@ import {
66
66
  normalizeAssistantContentBuffer,
67
67
  planCompression,
68
68
  serializeMessageContent
69
- } from "./chunk-ASQYTZTR.js";
69
+ } from "./chunk-DNCEALKX.js";
70
70
  import {
71
71
  findModelConfig,
72
72
  getModelConfig
@@ -13789,7 +13789,8 @@ var recharge_locale_default = {
13789
13789
  loginRequired: "Please sign in before recharging",
13790
13790
  serverUnavailable: "The server is unavailable. Please try again later.",
13791
13791
  createOrder: "Failed to create the payment order",
13792
- createAddress: "Failed to get the {{token}} address"
13792
+ createAddress: "Failed to get the {{token}} address",
13793
+ methodUnavailable: "This payment method is currently unavailable. Please pick another one."
13793
13794
  },
13794
13795
  notesTitle: "Notes",
13795
13796
  notes: [
@@ -13857,7 +13858,8 @@ var recharge_locale_default = {
13857
13858
  loginRequired: "\u8BF7\u5148\u767B\u5F55\u540E\u518D\u5145\u503C",
13858
13859
  serverUnavailable: "\u5F53\u524D\u670D\u52A1\u5668\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
13859
13860
  createOrder: "\u521B\u5EFA\u652F\u4ED8\u8BA2\u5355\u5931\u8D25",
13860
- createAddress: "\u521B\u5EFA {{token}} \u5730\u5740\u5931\u8D25"
13861
+ createAddress: "\u521B\u5EFA {{token}} \u5730\u5740\u5931\u8D25",
13862
+ methodUnavailable: "\u8BE5\u652F\u4ED8\u65B9\u5F0F\u5F53\u524D\u4E0D\u53EF\u7528\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u65B9\u5F0F\u3002"
13861
13863
  },
13862
13864
  notesTitle: "\u63D0\u793A",
13863
13865
  notes: [
@@ -13925,7 +13927,8 @@ var recharge_locale_default = {
13925
13927
  loginRequired: "\u8ACB\u5148\u767B\u5165\u5F8C\u518D\u5132\u503C",
13926
13928
  serverUnavailable: "\u76EE\u524D\u4F3A\u670D\u5668\u7121\u6CD5\u4F7F\u7528\uFF0C\u8ACB\u7A0D\u5F8C\u91CD\u8A66",
13927
13929
  createOrder: "\u5EFA\u7ACB\u652F\u4ED8\u8A02\u55AE\u5931\u6557",
13928
- createAddress: "\u5EFA\u7ACB {{token}} \u5730\u5740\u5931\u6557"
13930
+ createAddress: "\u5EFA\u7ACB {{token}} \u5730\u5740\u5931\u6557",
13931
+ methodUnavailable: "\u8A72\u652F\u4ED8\u65B9\u5F0F\u76EE\u524D\u4E0D\u53EF\u7528\uFF0C\u8ACB\u9078\u64C7\u5176\u4ED6\u65B9\u5F0F\u3002"
13929
13932
  },
13930
13933
  notesTitle: "\u63D0\u793A",
13931
13934
  notes: [
@@ -13993,7 +13996,8 @@ var recharge_locale_default = {
13993
13996
  loginRequired: "\u30C1\u30E3\u30FC\u30B8\u306E\u524D\u306B\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044",
13994
13997
  serverUnavailable: "\u30B5\u30FC\u30D0\u30FC\u304C\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u304A\u8A66\u3057\u304F\u3060\u3055\u3044",
13995
13998
  createOrder: "\u6C7A\u6E08\u6CE8\u6587\u306E\u4F5C\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
13996
- createAddress: "{{token}} \u30A2\u30C9\u30EC\u30B9\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F"
13999
+ createAddress: "{{token}} \u30A2\u30C9\u30EC\u30B9\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
14000
+ methodUnavailable: "\u3053\u306E\u652F\u6255\u3044\u65B9\u6CD5\u306F\u73FE\u5728\u3054\u5229\u7528\u3044\u305F\u3060\u3051\u307E\u305B\u3093\u3002\u5225\u306E\u65B9\u6CD5\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
13997
14001
  },
13998
14002
  notesTitle: "\u3054\u6848\u5185",
13999
14003
  notes: [
@@ -17470,7 +17474,7 @@ var messageSlice = createSliceWithThunks({
17470
17474
  runtimeOptions: args.runtimeOptions
17471
17475
  });
17472
17476
  if (agentKeyToUse) {
17473
- const { streamAgentChatTurn } = await import("./agentSlice-SK47GTN7.js");
17477
+ const { streamAgentChatTurn } = await import("./agentSlice-65ETD734.js");
17474
17478
  await dispatch(
17475
17479
  streamAgentChatTurn({
17476
17480
  agentKey: agentKeyToUse,
@@ -18606,7 +18610,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
18606
18610
  }
18607
18611
  if (isCurrentDialog) {
18608
18612
  await thunkApi.dispatch(resetMsgs());
18609
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-TMSHUGEM.js");
18613
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-J2YJNE6E.js");
18610
18614
  dispatch(clearPendingAttachments2());
18611
18615
  }
18612
18616
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -18614,15 +18618,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
18614
18618
 
18615
18619
  // packages/chat/dialog/dialogSlice.ts
18616
18620
  var runCreateDialogAction = async (args, thunkApi) => {
18617
- const { createDialogAction } = await import("./createDialogAction-4H52MURR.js");
18621
+ const { createDialogAction } = await import("./createDialogAction-O2QABXZF.js");
18618
18622
  return createDialogAction(args, thunkApi);
18619
18623
  };
18620
18624
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
18621
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-HFLPOBWQ.js");
18625
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-JXAFQO5V.js");
18622
18626
  return createAgentAutomationAction(args, thunkApi);
18623
18627
  };
18624
18628
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
18625
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-XI73NQMU.js");
18629
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-KSWXWWFT.js");
18626
18630
  return updateDialogTitleAction(args, thunkApi);
18627
18631
  };
18628
18632
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -18646,7 +18650,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
18646
18650
  return setDialogExtraReferencesAction(args, thunkApi);
18647
18651
  };
18648
18652
  var runHandleSendMessageAction = async (args, thunkApi) => {
18649
- const { handleSendMessageAction } = await import("./handleSendMessageAction-4LGNXH6T.js");
18653
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-A4XLEEPU.js");
18650
18654
  return handleSendMessageAction(args, thunkApi);
18651
18655
  };
18652
18656
  function clearDialogState() {
@@ -18659,7 +18663,7 @@ var createPageAndAddReference = createAsyncThunk(
18659
18663
  async (payload, { dispatch, getState, rejectWithValue }) => {
18660
18664
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
18661
18665
  try {
18662
- const { createDocState } = await import("./docStore-OBC5QOW7.js");
18666
+ const { createDocState } = await import("./docStore-6KKYKAGQ.js");
18663
18667
  const pageKey = await createDocState(
18664
18668
  { slateData, title },
18665
18669
  { dispatch, getState }
@@ -367,6 +367,7 @@ var truncateToolOutputForContext = (text, contextWindow) => {
367
367
  // packages/ai/context/planCompression.ts
368
368
  var MIN_COMPRESS_COUNT = 5;
369
369
  var ACTIVE_SUMMARY_TAIL_KEEP_COUNT = 2;
370
+ var COMPACTION_RETENTION_CUSHION_RATIO = 0.18;
370
371
  var MIN_TRIGGER_PENDING_COUNT = MIN_COMPRESS_COUNT + ACTIVE_SUMMARY_TAIL_KEEP_COUNT;
371
372
  var getMessageTokenCount = (msg) => {
372
373
  const content = serializeMessageContent(msg.content) || "";
@@ -465,15 +466,42 @@ function calculateCompressCount(pendingMsgs, rawMessageBudget, opts) {
465
466
  }
466
467
  return pendingMsgs.length - keepCount;
467
468
  }
469
+ function resolveEffectiveCompactionBudgets(args) {
470
+ const {
471
+ contextWindow,
472
+ triggerRatio,
473
+ historyBudget,
474
+ rawMessageBudget,
475
+ summaryTokens,
476
+ cushionRatio = COMPACTION_RETENTION_CUSHION_RATIO
477
+ } = args;
478
+ const maxRetainedRatio = Math.max(
479
+ 0.2,
480
+ Number((triggerRatio - cushionRatio).toFixed(4))
481
+ );
482
+ const maxRetainedHistoryBudget = Math.floor(contextWindow * maxRetainedRatio);
483
+ const effectiveHistoryBudget = Math.min(historyBudget, maxRetainedHistoryBudget);
484
+ const effectiveRawMessageBudget = Math.min(
485
+ rawMessageBudget,
486
+ Math.max(0, effectiveHistoryBudget - summaryTokens)
487
+ );
488
+ return {
489
+ effectiveHistoryBudget,
490
+ effectiveRawMessageBudget,
491
+ maxRetainedRatio
492
+ };
493
+ }
468
494
  function guardToolChainBoundary(pendingMsgs, compressCount) {
469
495
  let count = compressCount;
470
- while (count > 0 && count < pendingMsgs.length && pendingMsgs[count].role === "tool") {
471
- count--;
496
+ while (count < pendingMsgs.length && pendingMsgs[count].role === "tool") {
497
+ count++;
472
498
  }
473
- if (count > 0) {
474
- const lastCompressed = pendingMsgs[count - 1];
475
- if (hasOpenEndedToolCall(lastCompressed)) {
499
+ while (count > 0 && hasOpenEndedToolCall(pendingMsgs[count - 1])) {
500
+ if (count < pendingMsgs.length && pendingMsgs[count].role === "tool") {
501
+ count++;
502
+ } else {
476
503
  count--;
504
+ break;
477
505
  }
478
506
  }
479
507
  return count;
@@ -548,11 +576,22 @@ function planCompression(input) {
548
576
  emptyReason: "not-triggered"
549
577
  });
550
578
  }
551
- let compressCount = calculateCompressCount(pendingMsgs, rawMessageBudget, {
552
- keepTailCount: shouldRunActiveSummary || triggeredByRealUsage || triggeredByColdResume,
553
- totalUsed,
554
- historyBudget
579
+ const { effectiveHistoryBudget, effectiveRawMessageBudget } = resolveEffectiveCompactionBudgets({
580
+ contextWindow,
581
+ triggerRatio,
582
+ historyBudget,
583
+ rawMessageBudget,
584
+ summaryTokens
555
585
  });
586
+ let compressCount = calculateCompressCount(
587
+ pendingMsgs,
588
+ effectiveRawMessageBudget,
589
+ {
590
+ keepTailCount: shouldRunActiveSummary || triggeredByRealUsage || triggeredByColdResume,
591
+ totalUsed,
592
+ historyBudget: effectiveHistoryBudget
593
+ }
594
+ );
556
595
  compressCount = guardToolChainBoundary(pendingMsgs, compressCount);
557
596
  if (compressCount < MIN_COMPRESS_COUNT) {
558
597
  return emptyPlan(startIndex, {
@@ -81,10 +81,10 @@ import {
81
81
  } from "./chunk-VF4K2QE6.js";
82
82
  import {
83
83
  createDocState
84
- } from "./chunk-7D6Z6AA4.js";
84
+ } from "./chunk-GZBATRJA.js";
85
85
  import {
86
86
  createDialogAction
87
- } from "./chunk-OZPMVBJI.js";
87
+ } from "./chunk-N2WELJE7.js";
88
88
  import {
89
89
  DEFAULT_COLLAPSED_CATEGORIES,
90
90
  addContentToSpace,
@@ -102,7 +102,7 @@ import {
102
102
  updateContentCategory,
103
103
  updateContentTitle,
104
104
  writeStoredCollapsedCategories
105
- } from "./chunk-B4ZH7KVO.js";
105
+ } from "./chunk-D2QT5FW4.js";
106
106
  import {
107
107
  getCurrentSpaceId,
108
108
  getCurrentSpaceIdRaw,
@@ -124,14 +124,14 @@ import {
124
124
  selectMsgById,
125
125
  uiAskChoiceFunc,
126
126
  uiAskChoiceFunctionSchema
127
- } from "./chunk-WRFW73PB.js";
127
+ } from "./chunk-DHDVZFNC.js";
128
128
  import {
129
129
  createAgent,
130
130
  deleteServerSyncedCredential,
131
131
  runLlm,
132
132
  streamAgentChatTurn,
133
133
  updateAgent
134
- } from "./chunk-RSJECD7I.js";
134
+ } from "./chunk-TVYSVSA2.js";
135
135
  import {
136
136
  getActiveDialogKey,
137
137
  selectCurrentDialogKey,
@@ -179,7 +179,7 @@ import {
179
179
  } from "./chunk-FDTR4QJ6.js";
180
180
  import {
181
181
  buildDatabaseFileContentUrl
182
- } from "./chunk-ASQYTZTR.js";
182
+ } from "./chunk-DNCEALKX.js";
183
183
  import {
184
184
  DEFAULT_MODEL
185
185
  } from "./chunk-OIVSQH2O.js";
@@ -3945,7 +3945,7 @@ async function deleteDialogsFunc(args, thunkApi) {
3945
3945
  const deletedDialogIds = [];
3946
3946
  const deletedDialogKeys = [];
3947
3947
  const failures = [];
3948
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-TMSHUGEM.js");
3948
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-J2YJNE6E.js");
3949
3949
  for (const target of targets) {
3950
3950
  try {
3951
3951
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -14906,7 +14906,7 @@ var executeToolRun = createAsyncThunk(
14906
14906
  if (!executionInput) {
14907
14907
  throw new Error(`ToolRun ${id} has no input to execute with.`);
14908
14908
  }
14909
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-DXXDQ2CP.js");
14909
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-2VDNDFET.js");
14910
14910
  const { executor } = findToolExecutor2(run.toolName);
14911
14911
  toolRunStarted({
14912
14912
  id: run.id,
@@ -17413,7 +17413,7 @@ async function updateDocFunc(args, thunkApi) {
17413
17413
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
17414
17414
  };
17415
17415
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
17416
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-OBC5QOW7.js");
17416
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-6KKYKAGQ.js");
17417
17417
  if (getDocState().pageKey === id) {
17418
17418
  applyExternalDocUpdate({
17419
17419
  slateData: finalSlateData,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-O35EJJVP.js";
4
+ } from "./chunk-GABFWSOQ.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  clipMultilineText,
9
9
  fetchAndSerializeTable
10
- } from "./chunk-X4QAVDFE.js";
10
+ } from "./chunk-FSX24MR3.js";
11
11
  import {
12
12
  isGatewayHttpStatus
13
13
  } from "./chunk-NF64D32W.js";
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-MEYIRKDN.js";
29
29
  import {
30
30
  fetchAndCacheMessages
31
- } from "./chunk-WRFW73PB.js";
31
+ } from "./chunk-DHDVZFNC.js";
32
32
  import {
33
33
  shouldUseServerProxy
34
34
  } from "./chunk-YYLHWIW6.js";
35
35
  import {
36
36
  fetchServerSyncedCredential
37
- } from "./chunk-RSJECD7I.js";
37
+ } from "./chunk-TVYSVSA2.js";
38
38
  import {
39
39
  buildSkillGuidancePromptBlock,
40
40
  extractRuntimePageCapabilities,
@@ -48,7 +48,7 @@ import {
48
48
  detectDispatchIntentFromMessages,
49
49
  normalizeChatCompletionsBodyForProvider,
50
50
  resolveToolGuidedSections
51
- } from "./chunk-L7I247DF.js";
51
+ } from "./chunk-L5UXH3B2.js";
52
52
  import {
53
53
  convertMessagesToResponsesInput,
54
54
  getUsageRequestOptions,
@@ -326,7 +326,7 @@ async function saveDocState(arg, { dispatch, getState }) {
326
326
  ).unwrap();
327
327
  if (dbSpaceId) {
328
328
  try {
329
- const { updateContentTitle } = await import("./contentThunks-YLWTUILV.js");
329
+ const { updateContentTitle } = await import("./contentThunks-Y6FA2TCW.js");
330
330
  await dispatch(
331
331
  updateContentTitle({
332
332
  spaceId: dbSpaceId,
@@ -365,7 +365,7 @@ async function saveDocState(arg, { dispatch, getState }) {
365
365
  }
366
366
  }
367
367
  async function createDocState(args, thunkApi) {
368
- const { createPageAction } = await import("./createPageAction-5YDRMJOS.js");
368
+ const { createPageAction } = await import("./createPageAction-GUQDPKO5.js");
369
369
  return createPageAction(args, thunkApi);
370
370
  }
371
371
  function subscribe(listener) {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-IIVGDG4I.js";
8
8
  import {
9
9
  getModelContextWindow
10
- } from "./chunk-NEDZDG3M.js";
10
+ } from "./chunk-4OEFYTWL.js";
11
11
  import {
12
12
  estimateTokenCount
13
13
  } from "./chunk-PSCNXBYA.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-B4ZH7KVO.js";
3
+ } from "./chunk-D2QT5FW4.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-WRFW73PB.js";
8
+ } from "./chunk-DHDVZFNC.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-QLNJRTKI.js";
8
+ } from "./chunk-AD2L6YCC.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-O35EJJVP.js";
15
+ } from "./chunk-GABFWSOQ.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,7 +23,7 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-X4QAVDFE.js";
26
+ } from "./chunk-FSX24MR3.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
@@ -35,10 +35,10 @@ import {
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-WRFW73PB.js";
38
+ } from "./chunk-DHDVZFNC.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-RSJECD7I.js";
41
+ } from "./chunk-TVYSVSA2.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
@@ -56,7 +56,7 @@ import {
56
56
  import {
57
57
  EMPTY_ASSISTANT_REPAIR_PROMPT,
58
58
  getModelInfo
59
- } from "./chunk-NEDZDG3M.js";
59
+ } from "./chunk-4OEFYTWL.js";
60
60
  import {
61
61
  getApiEndpoint
62
62
  } from "./chunk-OIVSQH2O.js";
@@ -61,7 +61,7 @@ import {
61
61
  import {
62
62
  inlineImageUrlsForCustomProvider,
63
63
  prepareTools
64
- } from "./chunk-QLNJRTKI.js";
64
+ } from "./chunk-AD2L6YCC.js";
65
65
  import {
66
66
  getServerProviderSecret
67
67
  } from "./chunk-HS7MLR74.js";
@@ -80,7 +80,7 @@ import {
80
80
  rememberMemoryFunctionSchema,
81
81
  resolveAgentRequiredPackIds,
82
82
  setTodoListFunc
83
- } from "./chunk-X4QAVDFE.js";
83
+ } from "./chunk-FSX24MR3.js";
84
84
  import {
85
85
  fetchWithTransientRetry,
86
86
  isTransientFetchError
@@ -109,14 +109,14 @@ import {
109
109
  prepareTokenUsageData,
110
110
  resolveBuiltinPlatformAgentConfig,
111
111
  runKeyed
112
- } from "./chunk-WRFW73PB.js";
112
+ } from "./chunk-DHDVZFNC.js";
113
113
  import {
114
114
  BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
115
115
  BUILTIN_TITLE_LLM_CONFIG
116
116
  } from "./chunk-MC4XLIJ7.js";
117
117
  import {
118
118
  fetchServerSyncedCredential
119
- } from "./chunk-RSJECD7I.js";
119
+ } from "./chunk-TVYSVSA2.js";
120
120
  import {
121
121
  require_date_fns
122
122
  } from "./chunk-M76ECQRD.js";
@@ -170,7 +170,7 @@ import {
170
170
  resolveOpenAiCompatibleProviderConfig,
171
171
  shouldUseGeminiNativeToolRoute,
172
172
  summarizeToolArguments
173
- } from "./chunk-SDTTBMBU.js";
173
+ } from "./chunk-6VFARHZW.js";
174
174
  import {
175
175
  PlatformStreamInterruptedError,
176
176
  buildPlatformChatCompletionRequest,
@@ -182,11 +182,11 @@ import {
182
182
  readSseDataValues,
183
183
  resolvePlatformChatProviderConfig,
184
184
  shouldUsePlatformChatProvider
185
- } from "./chunk-2YMRWISD.js";
185
+ } from "./chunk-ZCYXJSTU.js";
186
186
  import {
187
187
  resolveAgentRuntimeConfigFromRecord,
188
188
  resolveHistoricalToolContentCap
189
- } from "./chunk-4EZHSKTB.js";
189
+ } from "./chunk-5H7KJX7J.js";
190
190
  import {
191
191
  isDevinOAuthAgent
192
192
  } from "./chunk-5ZUL4CUO.js";
@@ -218,14 +218,14 @@ import {
218
218
  } from "./chunk-2MBTWINN.js";
219
219
  import {
220
220
  normalizeUsage
221
- } from "./chunk-NEDZDG3M.js";
221
+ } from "./chunk-4OEFYTWL.js";
222
222
  import {
223
223
  clipCompactText,
224
224
  createProviderCallTimingTracker,
225
225
  finalizeProviderCallTiming,
226
226
  observeMeaningfulProviderResponseAt,
227
227
  withProviderCallTimingFields
228
- } from "./chunk-ASQYTZTR.js";
228
+ } from "./chunk-DNCEALKX.js";
229
229
  import {
230
230
  estimateTokenCount
231
231
  } from "./chunk-PSCNXBYA.js";
@@ -11040,6 +11040,8 @@ function waitForRunTerminal(args) {
11040
11040
  const loop = Effect_exports.gen(function* () {
11041
11041
  token = args.claim?.acquire() ?? null;
11042
11042
  const deadline = Date.now() + args.timeoutMs;
11043
+ const maxIterations = Math.ceil(args.timeoutMs / Math.max(1, args.pollIntervalMs)) + 1;
11044
+ let iterations = 0;
11043
11045
  while (true) {
11044
11046
  const state = yield* readEffect(args.read);
11045
11047
  lastState = state;
@@ -11050,7 +11052,8 @@ function waitForRunTerminal(args) {
11050
11052
  }
11051
11053
  return { kind: "terminal", state };
11052
11054
  }
11053
- if (Date.now() >= deadline) {
11055
+ iterations += 1;
11056
+ if (Date.now() >= deadline || iterations >= maxIterations) {
11054
11057
  return { kind: "timeout", waitedMs: args.timeoutMs, lastState };
11055
11058
  }
11056
11059
  const slept = yield* sleep(args.pollIntervalMs);