nolo-cli 0.173.0-alpha.1 → 0.173.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 (64) hide show
  1. package/{_executeModel-KT7NUYZC.js → _executeModel-557MGBNC.js} +14 -14
  2. package/{agentDeleteCommand-SVGYPFU5.js → agentDeleteCommand-HG5EDCO6.js} +15 -15
  3. package/{agentEmailCommands-TBZJC37X.js → agentEmailCommands-7YX27N6M.js} +17 -17
  4. package/{agentListCommands-CD7CLGH4.js → agentListCommands-AT5IGY5W.js} +6 -6
  5. package/{agentMachineCommands-DQBUP3I5.js → agentMachineCommands-WR3IFBB6.js} +7 -7
  6. package/{agentRecordCommands-4PY33TAJ.js → agentRecordCommands-T6PXLK4B.js} +16 -16
  7. package/{agentRunCommand-P7BC5M3Z.js → agentRunCommand-RB3TFF6O.js} +17 -17
  8. package/{agentRuntimeLocal-XGBQ7JK2.js → agentRuntimeLocal-72TUBESS.js} +6 -6
  9. package/{agentSlice-NL7LRTLO.js → agentSlice-YQHUKPIF.js} +1 -1
  10. package/{appDeleteCommands-VBH3YLIO.js → appDeleteCommands-THIHX7BV.js} +6 -6
  11. package/{appDeployCommands-3MZXLEKN.js → appDeployCommands-5JA5DDMR.js} +6 -6
  12. package/{appDeployStatusCommands-FAWWEEOT.js → appDeployStatusCommands-EHFPCQHM.js} +6 -6
  13. package/{appGetCommands-VMMCATHU.js → appGetCommands-4HSRXSYD.js} +6 -6
  14. package/{appListCommands-NHM6PAIX.js → appListCommands-TD7BQFWQ.js} +6 -6
  15. package/{authCommand-KQ7GWCXK.js → authCommand-CVKPVPHN.js} +2 -2
  16. package/{chunk-TLBTPKDD.js → chunk-24VDDKCB.js} +8 -8
  17. package/{chunk-3TAVX6CD.js → chunk-2OWYKHKI.js} +37 -19
  18. package/{chunk-AFFHPBEU.js → chunk-4NYYWHM7.js} +5 -5
  19. package/{chunk-FX33MFLW.js → chunk-A6B3LSDB.js} +66 -18
  20. package/{chunk-O3OJRN5Z.js → chunk-DWFRZ3UI.js} +1 -1
  21. package/{chunk-73NYJAJS.js → chunk-EGT6ORP5.js} +8 -8
  22. package/{chunk-KBGWPSY6.js → chunk-EVW2U6RH.js} +3 -3
  23. package/{chunk-AV67EUU4.js → chunk-EY3QEZZR.js} +9 -9
  24. package/{chunk-CLY56QIC.js → chunk-FDPODXE3.js} +1 -1
  25. package/{chunk-J33JIJK7.js → chunk-HHEM4TV3.js} +1 -1
  26. package/{chunk-BGQZLBMJ.js → chunk-ISIFZP3N.js} +1 -1
  27. package/{chunk-BYNWE72R.js → chunk-IVPXG433.js} +20 -7
  28. package/{chunk-FJ76E5ZM.js → chunk-J63HVOSX.js} +2 -2
  29. package/{chunk-GXFAZGZ6.js → chunk-KXIJYPVC.js} +2 -2
  30. package/{chunk-N2N63HTQ.js → chunk-L7ZCLG72.js} +2 -2
  31. package/{chunk-O2LB346J.js → chunk-LCCULKPJ.js} +1 -1
  32. package/{chunk-VETQRONK.js → chunk-LTWBOZE6.js} +8 -8
  33. package/{chunk-JDWJ64VG.js → chunk-ONQ2APOE.js} +3 -3
  34. package/{chunk-25A6K2YP.js → chunk-QFAISMV5.js} +3 -3
  35. package/{chunk-W7S5CUGI.js → chunk-RABMW33C.js} +3 -3
  36. package/{chunk-WBA4HAFS.js → chunk-RYBZM4A2.js} +2 -2
  37. package/{chunk-4RYUMDOM.js → chunk-TMAQFKHS.js} +2 -2
  38. package/{chunk-ASGIXFB6.js → chunk-VJ52BYBK.js} +1 -1
  39. package/{chunk-64MLOS7B.js → chunk-Z4HDFBYK.js} +1 -1
  40. package/{commandRegistry-UVXIFHUI.js → commandRegistry-PJ3EQ6U7.js} +47 -47
  41. package/{contentThunks-I4HNLTQY.js → contentThunks-NVX3NBHZ.js} +3 -3
  42. package/{createAgentAutomationAction-GS5LQ52L.js → createAgentAutomationAction-EONFRZYA.js} +3 -3
  43. package/{createDialogAction-5WNACKWC.js → createDialogAction-ZVY45CNY.js} +4 -4
  44. package/{createPageAction-S7MGYSMU.js → createPageAction-N5XSWPN2.js} +3 -3
  45. package/{dialogCommands-OK3L6SAI.js → dialogCommands-CPK6MUIJ.js} +6 -6
  46. package/{dialogSlice-R62QV2OE.js → dialogSlice-ST2FXOF3.js} +2 -2
  47. package/{docCreateCommands-NMCMJPQX.js → docCreateCommands-GLR2HLYH.js} +6 -6
  48. package/{docDeleteCommands-46FMFRZU.js → docDeleteCommands-MPE53Z5W.js} +6 -6
  49. package/{docReadCommands-6NPY5P67.js → docReadCommands-MFKWAFDI.js} +6 -6
  50. package/{docStore-X5P4UGTZ.js → docStore-PPUT7MQV.js} +1 -1
  51. package/{docUpdateCommands-UDT4QLPL.js → docUpdateCommands-3QBT2XTK.js} +6 -6
  52. package/{handleSendMessageAction-IVQMBROO.js → handleSendMessageAction-74EKQW4M.js} +7 -7
  53. package/index.js +4 -4
  54. package/{localRuntimeAdapter-LY5MOJN4.js → localRuntimeAdapter-KQHAGAXR.js} +15 -15
  55. package/{machineCommands-KYTNSAIN.js → machineCommands-DMPHPCQS.js} +16 -16
  56. package/{machineWsRunDispatch-ZR3GCQMH.js → machineWsRunDispatch-736CCGUF.js} +16 -16
  57. package/package.json +1 -1
  58. package/{readlineWorkspace-SNA6I5UK.js → readlineWorkspace-K4WNNW2D.js} +17 -17
  59. package/{runAgentClientLoop-6G7JORHJ.js → runAgentClientLoop-Z6STKR3Z.js} +12 -12
  60. package/{spaceCommands-SEWFBY53.js → spaceCommands-U4UYF6IB.js} +6 -6
  61. package/{streamAgentChatTurn-EJDRXKAQ.js → streamAgentChatTurn-2ON7E6LT.js} +15 -15
  62. package/{tools-K3IZ7U5G.js → tools-ZB2YBHSS.js} +7 -7
  63. package/{tuiSummaryLlmCaller-2MC6SXZT.js → tuiSummaryLlmCaller-I2MRY6T5.js} +3 -3
  64. package/{updateDialogTitleAction-YO67K72J.js → updateDialogTitleAction-YMQAOVJ2.js} +3 -3
@@ -18,23 +18,23 @@ import "./chunk-RPZNVBA5.js";
18
18
  import "./chunk-NBTY7YJF.js";
19
19
  import "./chunk-VF4K2QE6.js";
20
20
  import "./chunk-UAD2WT54.js";
21
- import "./chunk-BYNWE72R.js";
22
- import "./chunk-O3OJRN5Z.js";
21
+ import "./chunk-IVPXG433.js";
22
+ import "./chunk-DWFRZ3UI.js";
23
23
  import "./chunk-ZNFJWEN4.js";
24
- import "./chunk-O2LB346J.js";
24
+ import "./chunk-LCCULKPJ.js";
25
25
  import "./chunk-HNUWUO75.js";
26
26
  import "./chunk-CHOZJMJS.js";
27
27
  import "./chunk-PWTNI4N7.js";
28
28
  import "./chunk-SRZ6BQIP.js";
29
- import "./chunk-J33JIJK7.js";
29
+ import "./chunk-HHEM4TV3.js";
30
30
  import "./chunk-2WZXXAQD.js";
31
31
  import "./chunk-7QQOOHDG.js";
32
32
  import "./chunk-G6OOUQWJ.js";
33
33
  import "./chunk-56GBUMO5.js";
34
34
  import "./chunk-WJZOQR2J.js";
35
35
  import "./chunk-ZEOR6XPJ.js";
36
- import "./chunk-BGQZLBMJ.js";
37
- import "./chunk-FX33MFLW.js";
36
+ import "./chunk-ISIFZP3N.js";
37
+ import "./chunk-A6B3LSDB.js";
38
38
  import "./chunk-2GRXE3YJ.js";
39
39
  import "./chunk-JLR5NWP2.js";
40
40
  import "./chunk-XAFCJN32.js";
@@ -65,10 +65,10 @@ import {
65
65
  detectLocalDevinCredentials,
66
66
  extractDevinToken,
67
67
  fetchAntigravityCloudCodeCompletion
68
- } from "./chunk-O3OJRN5Z.js";
68
+ } from "./chunk-DWFRZ3UI.js";
69
69
  import "./chunk-HNUWUO75.js";
70
70
  import "./chunk-7QQOOHDG.js";
71
- import "./chunk-FX33MFLW.js";
71
+ import "./chunk-A6B3LSDB.js";
72
72
  import "./chunk-XAFCJN32.js";
73
73
  import "./chunk-5ZUL4CUO.js";
74
74
  import "./chunk-UKZX3NHN.js";
@@ -20,7 +20,7 @@ import {
20
20
  toolRunUpdated,
21
21
  uiCardFallback,
22
22
  waitForAbortableDelay
23
- } from "./chunk-GXFAZGZ6.js";
23
+ } from "./chunk-KXIJYPVC.js";
24
24
  import {
25
25
  isGatewayHttpStatus
26
26
  } from "./chunk-NF64D32W.js";
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-VF4K2QE6.js";
65
65
  import {
66
66
  createDocState
67
- } from "./chunk-N2N63HTQ.js";
67
+ } from "./chunk-L7ZCLG72.js";
68
68
  import {
69
69
  addMemberSpace,
70
70
  fetchAuthoritativeRemoteSpace,
@@ -79,7 +79,7 @@ import {
79
79
  } from "./chunk-BAWAKW7X.js";
80
80
  import {
81
81
  createDialogAction
82
- } from "./chunk-WBA4HAFS.js";
82
+ } from "./chunk-RYBZM4A2.js";
83
83
  import {
84
84
  setDialogExtraReferencesAction
85
85
  } from "./chunk-IF7V3CBU.js";
@@ -102,7 +102,7 @@ import {
102
102
  updateContentCategory,
103
103
  updateContentTitle,
104
104
  writeStoredCollapsedCategories
105
- } from "./chunk-64MLOS7B.js";
105
+ } from "./chunk-Z4HDFBYK.js";
106
106
  import {
107
107
  buildDatabaseFileContentUrl,
108
108
  deleteDialog,
@@ -115,7 +115,7 @@ import {
115
115
  selectMsgById,
116
116
  uiAskChoiceFunc,
117
117
  uiAskChoiceFunctionSchema
118
- } from "./chunk-VETQRONK.js";
118
+ } from "./chunk-LTWBOZE6.js";
119
119
  import {
120
120
  buildMediaToolConfirmation,
121
121
  normalizeMediaConfirmExecutionRevision
@@ -126,7 +126,7 @@ import {
126
126
  runLlm,
127
127
  streamAgentChatTurn,
128
128
  updateAgent
129
- } from "./chunk-W7S5CUGI.js";
129
+ } from "./chunk-RABMW33C.js";
130
130
  import {
131
131
  getCurrentSpaceId,
132
132
  getCurrentSpaceIdRaw,
@@ -3882,7 +3882,7 @@ async function deleteDialogsFunc(args, thunkApi) {
3882
3882
  const deletedDialogIds = [];
3883
3883
  const deletedDialogKeys = [];
3884
3884
  const failures = [];
3885
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-R62QV2OE.js");
3885
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-ST2FXOF3.js");
3886
3886
  for (const target of targets) {
3887
3887
  try {
3888
3888
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -18563,7 +18563,7 @@ async function updateDocFunc(args, thunkApi) {
18563
18563
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
18564
18564
  };
18565
18565
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
18566
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-X5P4UGTZ.js");
18566
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-PPUT7MQV.js");
18567
18567
  if (getDocState().pageKey === id) {
18568
18568
  applyExternalDocUpdate({
18569
18569
  slateData: finalSlateData,
@@ -64,7 +64,7 @@ import {
64
64
  import {
65
65
  inlineImageUrlsForCustomProvider,
66
66
  prepareTools
67
- } from "./chunk-4RYUMDOM.js";
67
+ } from "./chunk-TMAQFKHS.js";
68
68
  import {
69
69
  getServerProviderSecret
70
70
  } from "./chunk-HS7MLR74.js";
@@ -86,7 +86,7 @@ import {
86
86
  resolveCliLocalRuntimeKeyCapability,
87
87
  resolveCliLocalSpawnDispatch,
88
88
  resolveStartAgentRunCwd
89
- } from "./chunk-TLBTPKDD.js";
89
+ } from "./chunk-24VDDKCB.js";
90
90
  import {
91
91
  deriveCredentialGroup,
92
92
  deriveCustomProviderCredentialGroup
@@ -97,7 +97,7 @@ import {
97
97
  } from "./chunk-KFHREHUQ.js";
98
98
  import {
99
99
  resolveAgentRequiredPackIds
100
- } from "./chunk-GXFAZGZ6.js";
100
+ } from "./chunk-KXIJYPVC.js";
101
101
  import {
102
102
  applyBuiltinAgentRuntimeOverride,
103
103
  applyTokenUsageToDayStats,
@@ -106,14 +106,14 @@ import {
106
106
  resolveBuiltinPlatformAgentConfig,
107
107
  runKeyed,
108
108
  validateAskChoiceInput
109
- } from "./chunk-VETQRONK.js";
109
+ } from "./chunk-LTWBOZE6.js";
110
110
  import {
111
111
  BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
112
112
  BUILTIN_TITLE_LLM_CONFIG
113
113
  } from "./chunk-523DITKR.js";
114
114
  import {
115
115
  fetchServerSyncedCredential
116
- } from "./chunk-W7S5CUGI.js";
116
+ } from "./chunk-RABMW33C.js";
117
117
  import {
118
118
  isTombstoneRecord
119
119
  } from "./chunk-D2MDMY2M.js";
@@ -170,7 +170,7 @@ import {
170
170
  runExecShellGates,
171
171
  validateConfiguredRootExecutionLease,
172
172
  verifyOwnerRouteAck
173
- } from "./chunk-BYNWE72R.js";
173
+ } from "./chunk-IVPXG433.js";
174
174
  import {
175
175
  accumulateGeminiChunks,
176
176
  buildGeminiGenerateContentRequest,
@@ -182,7 +182,7 @@ import {
182
182
  resolveAntigravityFinishReason,
183
183
  resolveGeminiModelQuirks,
184
184
  shouldUseGeminiNativeToolRoute
185
- } from "./chunk-O3OJRN5Z.js";
185
+ } from "./chunk-DWFRZ3UI.js";
186
186
  import {
187
187
  PlatformStreamInterruptedError,
188
188
  buildPlatformChatCompletionRequest,
@@ -193,14 +193,14 @@ import {
193
193
  readPlatformChatSseCompletion,
194
194
  resolvePlatformChatProviderConfig,
195
195
  shouldUsePlatformChatProvider
196
- } from "./chunk-O2LB346J.js";
196
+ } from "./chunk-LCCULKPJ.js";
197
197
  import {
198
198
  readSseDataValues,
199
199
  readSseFrames
200
200
  } from "./chunk-HNUWUO75.js";
201
201
  import {
202
202
  resolveAgentRuntimeConfigFromRecord
203
- } from "./chunk-J33JIJK7.js";
203
+ } from "./chunk-HHEM4TV3.js";
204
204
  import {
205
205
  resolveHistoricalToolContentCap
206
206
  } from "./chunk-2WZXXAQD.js";
@@ -213,12 +213,16 @@ import {
213
213
  findAgentStatePairingIssues,
214
214
  stablePromptCacheKey,
215
215
  toResponsesTools
216
- } from "./chunk-BGQZLBMJ.js";
216
+ } from "./chunk-ISIFZP3N.js";
217
217
  import {
218
218
  EMPTY_TOOL_RESULT_TEXT,
219
+ createToolImageBudget,
219
220
  hadToolImages,
221
+ toolImageNotices,
222
+ toolImageOmission,
223
+ toolImageSource,
220
224
  toolImages
221
- } from "./chunk-FX33MFLW.js";
225
+ } from "./chunk-A6B3LSDB.js";
222
226
  import {
223
227
  buildNoloWorkspaceOpenAiTools,
224
228
  filterClientNoloWorkspaceToolNames,
@@ -792,6 +796,7 @@ function buildAnthropicMessagesBody(args) {
792
796
  system.push({ type: "text", text: args.agentConfig.prompt.trim() });
793
797
  }
794
798
  const messages = [];
799
+ const imageBudget = createToolImageBudget();
795
800
  for (const raw of rawMessages) {
796
801
  if (!raw || typeof raw !== "object") continue;
797
802
  const message = raw;
@@ -819,17 +824,30 @@ function buildAnthropicMessagesBody(args) {
819
824
  const images = toolImages(message);
820
825
  if (!hadToolImages(message)) return text;
821
826
  const effective = text.trim() ? text : EMPTY_TOOL_RESULT_TEXT;
822
- if (!images.length) return [{ type: "text", text: effective }];
823
- if (!resolveAgentImageInputSupport(args.agentConfig)) {
824
- return [{ type: "text", text: effective }];
827
+ const notices = toolImageNotices(message);
828
+ const imageBlocks = [];
829
+ if (resolveAgentImageInputSupport(args.agentConfig)) {
830
+ for (const image of images) {
831
+ const decision = imageBudget(image);
832
+ if (decision === "duplicate") continue;
833
+ if (decision !== "delivered") {
834
+ if (!notices.seen.has(image)) {
835
+ notices.seen.add(image);
836
+ notices.text.push(toolImageOmission(toolImageSource(message), decision === "impossible"));
837
+ }
838
+ } else {
839
+ imageBlocks.push({ type: "image", source: {
840
+ type: "base64",
841
+ media_type: image.mimeType,
842
+ data: image.dataBase64
843
+ } });
844
+ }
845
+ }
825
846
  }
826
847
  return [
827
848
  { type: "text", text: effective },
828
- ...images.map((image) => ({ type: "image", source: {
829
- type: "base64",
830
- media_type: image.mimeType,
831
- data: image.dataBase64
832
- } }))
849
+ ...notices.text.map((text2) => ({ type: "text", text: text2 })),
850
+ ...imageBlocks
833
851
  ];
834
852
  })()
835
853
  }]);
@@ -7,7 +7,7 @@ import {
7
7
  mergeReferences,
8
8
  resolveReferenceAssets,
9
9
  resolveToolsFromKeys
10
- } from "./chunk-FJ76E5ZM.js";
10
+ } from "./chunk-J63HVOSX.js";
11
11
  import {
12
12
  UI_CARD_ENVELOPE_MAX_BYTES,
13
13
  getAllToolRuns,
@@ -20,7 +20,7 @@ import {
20
20
  selectSpaceContextLevel,
21
21
  selectUserTonePreset,
22
22
  uiCardFallback
23
- } from "./chunk-GXFAZGZ6.js";
23
+ } from "./chunk-KXIJYPVC.js";
24
24
  import {
25
25
  resolveToolBaseUrl
26
26
  } from "./chunk-MYOH447Z.js";
@@ -32,15 +32,15 @@ import {
32
32
  } from "./chunk-TDNAAXUQ.js";
33
33
  import {
34
34
  getDocState
35
- } from "./chunk-N2N63HTQ.js";
35
+ } from "./chunk-L7ZCLG72.js";
36
36
  import {
37
37
  getTableState
38
- } from "./chunk-64MLOS7B.js";
38
+ } from "./chunk-Z4HDFBYK.js";
39
39
  import {
40
40
  PERSONALIZATION_DIALOG_CATEGORY,
41
41
  buildPersonalizationDialogPolicyContext,
42
42
  selectAllMsgs
43
- } from "./chunk-VETQRONK.js";
43
+ } from "./chunk-LTWBOZE6.js";
44
44
  import {
45
45
  getCurrentSpaceIdRaw,
46
46
  getViewMode
@@ -19,21 +19,68 @@ function withoutToolImages(message) {
19
19
  }
20
20
  } : textOnly;
21
21
  }
22
+ var TOOL_IMAGE_NOTICES = Symbol("runtime-only-tool-image-notices");
23
+ function createToolImageNotices() {
24
+ return { text: [], seen: /* @__PURE__ */ new WeakSet() };
25
+ }
26
+ function toolImageNotices(message) {
27
+ const holder = message;
28
+ return holder[TOOL_IMAGE_NOTICES] ??= createToolImageNotices();
29
+ }
30
+ var delivery = /* @__PURE__ */ new WeakMap();
31
+ function resetToolImageDelivery(images) {
32
+ for (const image of images) delivery.delete(image);
33
+ }
34
+ function toolImageDelivery(image) {
35
+ return delivery.get(image);
36
+ }
37
+ function createToolImageBudget() {
38
+ let count = 0;
39
+ let bytes = 0;
40
+ const seen = /* @__PURE__ */ new Set();
41
+ return (image) => {
42
+ const key = `${image.mimeType}\0${image.dataBase64}`;
43
+ if (seen.has(key)) return "duplicate";
44
+ seen.add(key);
45
+ const size = Buffer.byteLength(image.dataBase64, "utf8");
46
+ if (size > 8 * 1024 * 1024) {
47
+ delivery.set(image, "impossible");
48
+ return "impossible";
49
+ }
50
+ if (count >= 4 || bytes + size > 8 * 1024 * 1024) return "pending";
51
+ count += 1;
52
+ bytes += size;
53
+ delivery.set(image, "delivered");
54
+ return "delivered";
55
+ };
56
+ }
57
+ function toolImageSource(message) {
58
+ const path = typeof message.content === "string" ? message.content.match(/→ ([^\s\x00-\x1f\x7f]+)/u)?.[1]?.replace(/\]$/, "") : void 0;
59
+ return `${(message.tool_call_id ?? "unknown").replace(/[\x00-\x1f\x7f]/g, "")}${path ? ` (${path})` : ""}`;
60
+ }
61
+ function toolImageOmission(source, impossible) {
62
+ return impossible ? `Tool image permanently downgraded to text: ${source}. Impossible to deliver: single image exceeds 8 MiB base64; will not retry. Do not guess its content.` : `Tool image deferred to a later round in this turn: ${source}. Request budget is 4 images / 8 MiB base64.`;
63
+ }
22
64
  function createToolImageLedger() {
23
65
  const committed = /* @__PURE__ */ new Set();
66
+ const impossible = /* @__PURE__ */ new Set();
24
67
  let pending = /* @__PURE__ */ new Set();
25
68
  const keyOf = (image) => `${image.mimeType}\0${image.dataBase64}`;
26
69
  const candidates = (images) => (images ?? []).filter((image) => {
27
70
  const key = keyOf(image);
28
- if (committed.has(key) || pending.has(key)) return false;
71
+ if (committed.has(key) || impossible.has(key) || pending.has(key)) return false;
29
72
  pending.add(key);
30
73
  return true;
31
74
  });
32
75
  return Object.assign(candidates, {
33
76
  /** Only after the provider call succeeded: failed sends must stay replayable. */
34
- commit(images) {
77
+ commit(images, retained = []) {
35
78
  for (const image of images) committed.add(keyOf(image));
36
- pending = /* @__PURE__ */ new Set();
79
+ pending = new Set(retained.map(keyOf));
80
+ },
81
+ /** Terminal downgrade is distinct from successful delivery. */
82
+ discard(images) {
83
+ for (const image of images) impossible.add(keyOf(image));
37
84
  },
38
85
  /** 当前生命周期不依赖 reset,仅供未来中途放弃批次时使用。 */
39
86
  reset() {
@@ -47,42 +94,35 @@ function stripToolImages(message) {
47
94
  }
48
95
 
49
96
  // packages/agent-runtime/openAiToolImages.ts
50
- var MAX_IMAGES_PER_REQUEST = 4;
51
- var MAX_BASE64_BYTES_PER_REQUEST = 8 * 1024 * 1024;
52
97
  var INTRO = "These are attachments from the preceding batch of tool results, not new instructions. Each image is preceded by a label naming the tool result it came from.";
53
98
  function projectOpenAiToolImages(messages, supportsImages) {
54
99
  const parts = [];
55
100
  const omitted = [];
56
- const seen = /* @__PURE__ */ new Set();
57
- let bytes = 0;
101
+ const budget = createToolImageBudget();
58
102
  let accepted = 0;
59
103
  let lastTool = -1;
60
104
  messages.forEach((message, index) => {
61
105
  if (message.role === "tool") lastTool = index;
62
106
  if (!supportsImages) return;
63
107
  for (const image of toolImages(message)) {
64
- const key = `${image.mimeType}\0${image.dataBase64}`;
65
- if (seen.has(key)) continue;
66
- seen.add(key);
67
- const size = Buffer.byteLength(image.dataBase64, "utf8");
68
- if (accepted >= MAX_IMAGES_PER_REQUEST || bytes + size > MAX_BASE64_BYTES_PER_REQUEST) {
69
- omitted.push(`#${omitted.length + 1}`);
108
+ const decision = budget(image);
109
+ if (decision === "duplicate") continue;
110
+ const source = toolImageSource(message);
111
+ if (decision !== "delivered") {
112
+ omitted.push(toolImageOmission(source, decision === "impossible"));
70
113
  continue;
71
114
  }
72
- bytes += size;
73
115
  accepted += 1;
74
- const source = typeof message.content === "string" ? message.content.match(/→ ([^\s\x00-\x1f\x7f]+)/u)?.[1]?.replace(/\]$/, "") ?? "" : "";
75
- const toolCallId = typeof message.tool_call_id === "string" ? message.tool_call_id : "unknown";
76
116
  parts.push({
77
117
  type: "text",
78
- text: `Image ${accepted} \u2014 from tool result ${toolCallId.replace(/[\x00-\x1f\x7f]/g, "")}${source ? ` (${source})` : ""}`
118
+ text: `Image ${accepted} \u2014 from tool result ${source}`
79
119
  });
80
120
  parts.push({ type: "image_url", image_url: { url: `data:${image.mimeType};base64,${image.dataBase64}` } });
81
121
  }
82
122
  });
83
123
  if (lastTool < 0) return messages;
84
124
  if (!parts.length && !omitted.length) return messages;
85
- const note = omitted.length ? ` Note: ${omitted.length} image(s) omitted (request budget: ${MAX_IMAGES_PER_REQUEST} images / 8 MiB base64) \u2014 they were NOT delivered, do not guess their content.` : "";
125
+ const note = omitted.length ? ` Note: ${omitted.length} image(s) omitted. ${omitted.join(" ")}` : "";
86
126
  const attachment = {
87
127
  role: "user",
88
128
  content: [{ type: "text", text: `${INTRO}${note}` }, ...parts]
@@ -97,6 +137,14 @@ export {
97
137
  TOOL_IMAGES,
98
138
  toolImages,
99
139
  withoutToolImages,
140
+ TOOL_IMAGE_NOTICES,
141
+ createToolImageNotices,
142
+ toolImageNotices,
143
+ resetToolImageDelivery,
144
+ toolImageDelivery,
145
+ createToolImageBudget,
146
+ toolImageSource,
147
+ toolImageOmission,
100
148
  createToolImageLedger,
101
149
  stripToolImages,
102
150
  projectOpenAiToolImages
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7QQOOHDG.js";
7
7
  import {
8
8
  projectOpenAiToolImages
9
- } from "./chunk-FX33MFLW.js";
9
+ } from "./chunk-A6B3LSDB.js";
10
10
  import {
11
11
  getAntigravityUserAgent,
12
12
  readAntigravityProjectId,
@@ -5,7 +5,7 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-4RYUMDOM.js";
8
+ } from "./chunk-TMAQFKHS.js";
9
9
  import {
10
10
  CONFIRMATION_INPUT_KEYS,
11
11
  INVALID_TOOL_ARGS_REPLACEMENT,
@@ -14,16 +14,16 @@ import {
14
14
  performFetchRequest,
15
15
  sanitizeOutboundMessages,
16
16
  stripModelToolArgs
17
- } from "./chunk-JDWJ64VG.js";
17
+ } from "./chunk-ONQ2APOE.js";
18
18
  import {
19
19
  findToolExecutor,
20
20
  toolDefinitionsByName
21
- } from "./chunk-TLBTPKDD.js";
21
+ } from "./chunk-24VDDKCB.js";
22
22
  import {
23
23
  classifyApiError,
24
24
  classifyGenerationError,
25
25
  extractErrorDiagnostics
26
- } from "./chunk-FJ76E5ZM.js";
26
+ } from "./chunk-J63HVOSX.js";
27
27
  import {
28
28
  createSSEParser,
29
29
  createToolRunId,
@@ -32,7 +32,7 @@ import {
32
32
  toolRunSetPending,
33
33
  toolRunStarted,
34
34
  toolRunSucceeded
35
- } from "./chunk-GXFAZGZ6.js";
35
+ } from "./chunk-KXIJYPVC.js";
36
36
  import {
37
37
  getPublicImageAgentMode
38
38
  } from "./chunk-VIDPVFP3.js";
@@ -42,10 +42,10 @@ import {
42
42
  messageStreaming,
43
43
  toolResultNeedsUserConfirmation,
44
44
  updateToolMessage
45
- } from "./chunk-VETQRONK.js";
45
+ } from "./chunk-LTWBOZE6.js";
46
46
  import {
47
47
  streamAgentChatTurn
48
- } from "./chunk-W7S5CUGI.js";
48
+ } from "./chunk-RABMW33C.js";
49
49
  import {
50
50
  getCurrentSpaceId
51
51
  } from "./chunk-ZJ7UHBJS.js";
@@ -85,7 +85,7 @@ import {
85
85
  } from "./chunk-56GBUMO5.js";
86
86
  import {
87
87
  normalizeChatCompletionsBodyForProvider
88
- } from "./chunk-BGQZLBMJ.js";
88
+ } from "./chunk-ISIFZP3N.js";
89
89
  import {
90
90
  EMPTY_ASSISTANT_REPAIR_PROMPT
91
91
  } from "./chunk-T7HBI3WZ.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-3TAVX6CD.js";
4
+ } from "./chunk-2OWYKHKI.js";
5
5
  import {
6
6
  t
7
7
  } from "./chunk-TDX2L4W2.js";
8
8
  import {
9
9
  clipMultilineText
10
- } from "./chunk-GXFAZGZ6.js";
10
+ } from "./chunk-KXIJYPVC.js";
11
11
  import {
12
12
  runLocalAgentTurn
13
- } from "./chunk-BYNWE72R.js";
13
+ } from "./chunk-IVPXG433.js";
14
14
  import {
15
15
  applyToolSurfaceConstraints
16
16
  } from "./chunk-2GRXE3YJ.js";
@@ -9,7 +9,7 @@ import {
9
9
  resolveRawAgentInput,
10
10
  resolveServerUrl,
11
11
  writeUsage
12
- } from "./chunk-ASGIXFB6.js";
12
+ } from "./chunk-VJ52BYBK.js";
13
13
  import {
14
14
  getReadableCliDb
15
15
  } from "./chunk-62TBKWTV.js";
@@ -31,7 +31,7 @@ import {
31
31
  resolveFileWriteGateEnabled,
32
32
  resolveLocalUserId,
33
33
  validateInstaboxWorkspaceSelection
34
- } from "./chunk-3TAVX6CD.js";
34
+ } from "./chunk-2OWYKHKI.js";
35
35
  import {
36
36
  clearCredentialAvailability,
37
37
  readEffectiveCredentialEntry,
@@ -79,14 +79,14 @@ import {
79
79
  } from "./chunk-BMQ2MJUK.js";
80
80
  import {
81
81
  resolveCliLocalRuntimeKeyCapability
82
- } from "./chunk-TLBTPKDD.js";
82
+ } from "./chunk-24VDDKCB.js";
83
83
  import {
84
84
  isTransientFetchError
85
85
  } from "./chunk-KFHREHUQ.js";
86
86
  import {
87
87
  parseUiCard,
88
88
  uiCardFallback
89
- } from "./chunk-GXFAZGZ6.js";
89
+ } from "./chunk-KXIJYPVC.js";
90
90
  import {
91
91
  isGatewayHttpStatus
92
92
  } from "./chunk-NF64D32W.js";
@@ -95,7 +95,7 @@ import {
95
95
  chooseMemoryOwners,
96
96
  loadMemoryCandidatesFromDb,
97
97
  resolveAgentMemoryPolicy
98
- } from "./chunk-WBA4HAFS.js";
98
+ } from "./chunk-RYBZM4A2.js";
99
99
  import {
100
100
  API_REPORTED_COST_MULTIPLIER,
101
101
  estimateMessagesTokens,
@@ -103,7 +103,7 @@ import {
103
103
  resolveAgentContextWindow,
104
104
  resolveOccupancy,
105
105
  resolveOccupancyWindow
106
- } from "./chunk-VETQRONK.js";
106
+ } from "./chunk-LTWBOZE6.js";
107
107
  import {
108
108
  buildSkillDiscoveryContextLayer
109
109
  } from "./chunk-AU7AXHUL.js";
@@ -115,10 +115,10 @@ import {
115
115
  LOCAL_AGENT_CONFIG_MISSING_CODE,
116
116
  LOCAL_TURN_ABORTED_CODE,
117
117
  readActionGate
118
- } from "./chunk-BYNWE72R.js";
118
+ } from "./chunk-IVPXG433.js";
119
119
  import {
120
120
  resolveAgentRuntimeConfigFromRecord
121
- } from "./chunk-J33JIJK7.js";
121
+ } from "./chunk-HHEM4TV3.js";
122
122
  import {
123
123
  createThinkParserState,
124
124
  flushThinkParser,
@@ -11376,7 +11376,7 @@ function isBalanceExhaustedError(error) {
11376
11376
 
11377
11377
  // packages/cli/client/agentRun.ts
11378
11378
  async function loadRunLocalAgentTurn() {
11379
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-XGBQ7JK2.js");
11379
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-72TUBESS.js");
11380
11380
  return runLocalAgentTurn;
11381
11381
  }
11382
11382
  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();
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-62TBKWTV.js";
7
7
  import {
8
8
  clearCliLocalRuntimePreparedAgentCache
9
- } from "./chunk-3TAVX6CD.js";
9
+ } from "./chunk-2OWYKHKI.js";
10
10
  import {
11
11
  readCredentialAvailability
12
12
  } from "./chunk-R4BMKAR5.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  TOOL_HAD_IMAGES,
6
6
  hadToolImages
7
- } from "./chunk-FX33MFLW.js";
7
+ } from "./chunk-A6B3LSDB.js";
8
8
  import {
9
9
  asOptionalFiniteNumber
10
10
  } from "./chunk-WWC7I6TA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  projectOpenAiToolImages
3
- } from "./chunk-FX33MFLW.js";
3
+ } from "./chunk-A6B3LSDB.js";
4
4
  import {
5
5
  getModelContextWindow
6
6
  } from "./chunk-7ZGMQZ5D.js";