nolo-cli 0.174.0-alpha.1 → 0.176.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 (65) hide show
  1. package/{_executeModel-557MGBNC.js → _executeModel-OV72YSE4.js} +14 -14
  2. package/{agentDeleteCommand-Z46YYASI.js → agentDeleteCommand-HOWS5BAT.js} +16 -16
  3. package/{agentEmailCommands-ZSNW7MNV.js → agentEmailCommands-3EETPZFC.js} +18 -18
  4. package/{agentListCommands-3XYURQNT.js → agentListCommands-7ZZHM4GC.js} +7 -7
  5. package/{agentMachineCommands-EWMEPQSX.js → agentMachineCommands-BGQVXERS.js} +8 -8
  6. package/{agentRecordCommands-JO7YAN2P.js → agentRecordCommands-L2O46J54.js} +17 -17
  7. package/{agentRunCommand-EOUATYYD.js → agentRunCommand-7HDQ4RLO.js} +18 -18
  8. package/{agentRuntimeLocal-J5RQ3K7G.js → agentRuntimeLocal-3QX3FMER.js} +7 -7
  9. package/{agentSlice-YQHUKPIF.js → agentSlice-VC7BZD5N.js} +1 -1
  10. package/{appDeleteCommands-OF7LWX5L.js → appDeleteCommands-NJAVC6F4.js} +7 -7
  11. package/{appDeployCommands-73I3WQXX.js → appDeployCommands-POTCQDWQ.js} +7 -7
  12. package/{appDeployStatusCommands-AV3B5FIN.js → appDeployStatusCommands-YIG5S2ET.js} +7 -7
  13. package/{appGetCommands-UDQ5RCCL.js → appGetCommands-HSXKEA64.js} +7 -7
  14. package/{appListCommands-66J7KUEQ.js → appListCommands-GKLZKGKZ.js} +7 -7
  15. package/{authCommand-CVKPVPHN.js → authCommand-2IUG2PX7.js} +3 -3
  16. package/{chunk-EDF4FPCQ.js → chunk-33AGCT5W.js} +1 -1
  17. package/{chunk-I2NZPJAT.js → chunk-36OQE7ZU.js} +9 -9
  18. package/{chunk-QFAISMV5.js → chunk-3ERN2PSD.js} +3 -3
  19. package/{chunk-RYBZM4A2.js → chunk-73FHDE7C.js} +2 -2
  20. package/{chunk-TMAQFKHS.js → chunk-CCWUO2ZE.js} +2 -2
  21. package/{chunk-HHEM4TV3.js → chunk-CS4FUKMG.js} +2 -2
  22. package/{chunk-LCCULKPJ.js → chunk-DRR5E2EM.js} +24 -5
  23. package/{chunk-ONQ2APOE.js → chunk-GA4NE7QH.js} +3 -3
  24. package/{chunk-RABMW33C.js → chunk-GHNRJ3TK.js} +3 -3
  25. package/{chunk-Z4HDFBYK.js → chunk-GJU7F5IR.js} +1 -1
  26. package/{chunk-A6B3LSDB.js → chunk-IJOJMOCX.js} +6 -2
  27. package/{chunk-XOTLB33F.js → chunk-IR55JAHL.js} +3 -3
  28. package/{chunk-4NYYWHM7.js → chunk-JJE5HQ6M.js} +5 -5
  29. package/{chunk-LTWBOZE6.js → chunk-LQRXBYTS.js} +8 -8
  30. package/{chunk-DRQTD2FX.js → chunk-MR7SWXO4.js} +31 -23
  31. package/{chunk-VJ52BYBK.js → chunk-P3KTMRQ2.js} +1 -1
  32. package/{chunk-IFRQFQ2C.js → chunk-QA5LXQFO.js} +194 -13
  33. package/{chunk-DWFRZ3UI.js → chunk-QMFYP3O4.js} +12 -7
  34. package/{chunk-L7ZCLG72.js → chunk-S4SXPMPC.js} +2 -2
  35. package/{chunk-KXIJYPVC.js → chunk-SYIWIP4D.js} +2 -2
  36. package/{chunk-24VDDKCB.js → chunk-TV6QW46C.js} +8 -8
  37. package/{chunk-ISIFZP3N.js → chunk-U3YGSKXD.js} +64 -3
  38. package/{chunk-J63HVOSX.js → chunk-UPJVQK5J.js} +2 -2
  39. package/{chunk-EGT6ORP5.js → chunk-XIM37FAU.js} +8 -8
  40. package/{chunk-7QQOOHDG.js → chunk-XRU4QTSX.js} +24 -8
  41. package/{commandRegistry-QZOWJ4SJ.js → commandRegistry-B24YK3LB.js} +47 -47
  42. package/{contentThunks-NVX3NBHZ.js → contentThunks-F4Y7V4IH.js} +3 -3
  43. package/{createAgentAutomationAction-EONFRZYA.js → createAgentAutomationAction-7K5M7ULU.js} +3 -3
  44. package/{createDialogAction-ZVY45CNY.js → createDialogAction-SYA2LFEN.js} +4 -4
  45. package/{createPageAction-N5XSWPN2.js → createPageAction-FAYZZVYI.js} +3 -3
  46. package/{dialogCommands-FMWGAGIM.js → dialogCommands-K6AQZTAS.js} +7 -7
  47. package/{dialogSlice-ST2FXOF3.js → dialogSlice-QRWP73XJ.js} +2 -2
  48. package/{docCreateCommands-NAVBZ3AV.js → docCreateCommands-3ZDCDYLH.js} +7 -7
  49. package/{docDeleteCommands-V3DDFY72.js → docDeleteCommands-O74MHZEA.js} +7 -7
  50. package/{docReadCommands-AHN3F4MJ.js → docReadCommands-QJPAFQS3.js} +7 -7
  51. package/{docStore-PPUT7MQV.js → docStore-TABPPAGD.js} +1 -1
  52. package/{docUpdateCommands-2AEUHRAW.js → docUpdateCommands-M3THSN6V.js} +7 -7
  53. package/{handleSendMessageAction-74EKQW4M.js → handleSendMessageAction-FRBUFXEC.js} +8 -8
  54. package/index.js +4 -4
  55. package/{localRuntimeAdapter-D2RWVWNO.js → localRuntimeAdapter-2YSA5D7P.js} +16 -16
  56. package/{machineCommands-WM3Y5FEW.js → machineCommands-LVRRVNPD.js} +17 -17
  57. package/{machineWsRunDispatch-BC2NIKFO.js → machineWsRunDispatch-HUQ6HPSC.js} +17 -17
  58. package/package.json +1 -1
  59. package/{readlineWorkspace-S2KV2QPV.js → readlineWorkspace-N74QNU7H.js} +18 -18
  60. package/{runAgentClientLoop-Z6STKR3Z.js → runAgentClientLoop-NYZWX6JF.js} +12 -12
  61. package/{spaceCommands-MCDPNA5Y.js → spaceCommands-5ZN5J2X3.js} +7 -7
  62. package/{streamAgentChatTurn-2ON7E6LT.js → streamAgentChatTurn-LP3RQ3K5.js} +16 -16
  63. package/{tools-ZB2YBHSS.js → tools-KYFVARQ5.js} +7 -7
  64. package/{tuiSummaryLlmCaller-I2MRY6T5.js → tuiSummaryLlmCaller-OM3V6TZG.js} +4 -4
  65. package/{updateDialogTitleAction-YMQAOVJ2.js → updateDialogTitleAction-4ESKJ7L6.js} +3 -3
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-NBTY7YJF.js";
6
6
  import {
7
7
  resolveCliLocalRuntimeKeyCapability
8
- } from "./chunk-24VDDKCB.js";
8
+ } from "./chunk-TV6QW46C.js";
9
9
  import {
10
10
  HIGH_RISK_MUTATION_TOOL_NAMES
11
11
  } from "./chunk-2GRXE3YJ.js";
@@ -2,7 +2,7 @@ import {
2
2
  DEVIN_CONNECT_URL,
3
3
  parseSseDataLineJson,
4
4
  parseSseDataLineObject
5
- } from "./chunk-DWFRZ3UI.js";
5
+ } from "./chunk-QMFYP3O4.js";
6
6
  import {
7
7
  applyChatCompletionDelta,
8
8
  applyResponsesToolEvent,
@@ -11,7 +11,7 @@ import {
11
11
  flushChatCompletionStream,
12
12
  providerHttpFailure,
13
13
  throwIfChatCompletionStreamFailed
14
- } from "./chunk-LCCULKPJ.js";
14
+ } from "./chunk-DRR5E2EM.js";
15
15
  import {
16
16
  readSseFrames
17
17
  } from "./chunk-HNUWUO75.js";
@@ -28,15 +28,16 @@ import {
28
28
  import {
29
29
  hasImageInRuntimeMessages,
30
30
  stripImagePartsFromMessages
31
- } from "./chunk-HHEM4TV3.js";
31
+ } from "./chunk-CS4FUKMG.js";
32
32
  import {
33
33
  clipToolText,
34
34
  resolveHistoricalToolContentCap,
35
35
  resolveToolOutputProfile
36
36
  } from "./chunk-2WZXXAQD.js";
37
37
  import {
38
- resolveAgentImageInputSupport
39
- } from "./chunk-7QQOOHDG.js";
38
+ resolveAgentImageInputSupport,
39
+ resolveToolImagePolicy
40
+ } from "./chunk-XRU4QTSX.js";
40
41
  import {
41
42
  applyShapingCounts,
42
43
  attachProjectionFacts,
@@ -95,7 +96,7 @@ import {
95
96
  toOpenAiCompatibleMessages,
96
97
  toResponsesTools,
97
98
  transferDowngradedToolTurnOrigin
98
- } from "./chunk-ISIFZP3N.js";
99
+ } from "./chunk-U3YGSKXD.js";
99
100
  import {
100
101
  TOOL_HAD_IMAGES,
101
102
  TOOL_IMAGES,
@@ -108,7 +109,7 @@ import {
108
109
  toolImageDelivery,
109
110
  toolImages,
110
111
  withoutToolImages
111
- } from "./chunk-A6B3LSDB.js";
112
+ } from "./chunk-IJOJMOCX.js";
112
113
  import {
113
114
  BRIDGE_STREAM_MAX_CHARS,
114
115
  CLI_NOLO_WORKSPACE_TOOL_NAMES,
@@ -15900,6 +15901,153 @@ async function renderVisualPage(args2) {
15900
15901
  });
15901
15902
  }
15902
15903
 
15904
+ // packages/agent-runtime/hostWindowCapture.ts
15905
+ import { spawn as spawn2 } from "node:child_process";
15906
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
15907
+ var HOST_CAPTURE_TIMEOUT_MS = 9e3;
15908
+ var UNAVAILABLE = "\u5F53\u524D\u73AF\u5883\u65E0\u53EF\u7528\u622A\u5C4F\u6743\u9650/\u670D\u52A1";
15909
+ var PORTAL_SCRIPT = String.raw`
15910
+ import json, signal
15911
+ from gi.repository import Gio, GLib
15912
+ bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
15913
+ loop = GLib.MainLoop()
15914
+ handle = None
15915
+ finished = False
15916
+ result = None
15917
+ responses = {}
15918
+ def response(conn, sender, path, interface, name, parameters, data):
15919
+ global result, finished
15920
+ responses[path] = parameters.unpack()
15921
+ if handle == path:
15922
+ result = responses[path]
15923
+ finished = True
15924
+ loop.quit()
15925
+ def stop(*args):
15926
+ loop.quit()
15927
+ return False
15928
+ subscription = bus.signal_subscribe('org.freedesktop.portal.Desktop', 'org.freedesktop.portal.Request', 'Response', None, None, Gio.DBusSignalFlags.NONE, response, None)
15929
+ signal.signal(signal.SIGTERM, stop)
15930
+ try:
15931
+ options = {'interactive': GLib.Variant('b', True), 'handle_token': GLib.Variant('s', 'nolo_capture')}
15932
+ handle = bus.call_sync('org.freedesktop.portal.Desktop', '/org/freedesktop/portal/desktop', 'org.freedesktop.portal.Screenshot', 'Screenshot', GLib.Variant('(sa{sv})', ('', options)), GLib.VariantType.new('(o)'), Gio.DBusCallFlags.NONE, 7000, None).unpack()[0]
15933
+ if handle in responses:
15934
+ result = responses[handle]
15935
+ finished = True
15936
+ else:
15937
+ GLib.timeout_add(8000, stop)
15938
+ loop.run()
15939
+ if result is None:
15940
+ print(json.dumps({'error': 'portal response timeout'}), flush=True)
15941
+ else:
15942
+ code, values = result
15943
+ print(json.dumps({'code': code, 'uri': values.get('uri')}), flush=True)
15944
+ finally:
15945
+ if handle and not finished:
15946
+ try:
15947
+ bus.call_sync('org.freedesktop.portal.Desktop', handle, 'org.freedesktop.portal.Request', 'Close', None, None, Gio.DBusCallFlags.NONE, 200, None)
15948
+ except Exception:
15949
+ pass
15950
+ bus.signal_unsubscribe(subscription)
15951
+ `;
15952
+ var capturePortalScreenshot = (signal) => new Promise((resolve6, reject) => {
15953
+ const child = spawn2("/usr/bin/python3", ["-c", PORTAL_SCRIPT], { stdio: ["ignore", "pipe", "pipe"] });
15954
+ let stdout = "";
15955
+ let stderr = "";
15956
+ const stop = () => {
15957
+ child.kill("SIGTERM");
15958
+ };
15959
+ signal.addEventListener("abort", stop, { once: true });
15960
+ if (signal.aborted) stop();
15961
+ child.stdout.on("data", (data) => {
15962
+ stdout = (stdout + data).slice(-16384);
15963
+ });
15964
+ child.stderr.on("data", (data) => {
15965
+ stderr = (stderr + data).slice(-4096);
15966
+ });
15967
+ child.once("error", reject);
15968
+ child.once("close", (code) => {
15969
+ signal.removeEventListener("abort", stop);
15970
+ if (signal.aborted) return reject(new Error("portal capture timeout"));
15971
+ if (code !== 0) return reject(new Error(stderr.trim() || `portal helper exited ${code}`));
15972
+ try {
15973
+ resolve6(JSON.parse(stdout));
15974
+ } catch {
15975
+ reject(new Error("invalid portal response"));
15976
+ }
15977
+ });
15978
+ });
15979
+ function createHostWindowCapture(options = {}) {
15980
+ const concurrency = Math.max(1, Math.min(2, Math.floor(options.concurrency || 1)));
15981
+ const timeoutMs = Math.max(1, Math.min(HOST_CAPTURE_TIMEOUT_MS, options.timeoutMs || HOST_CAPTURE_TIMEOUT_MS));
15982
+ let active = 0;
15983
+ const waiters = [];
15984
+ function acquire(signal) {
15985
+ return new Promise((resolve6, reject) => {
15986
+ const abort = () => {
15987
+ const index = waiters.indexOf(start);
15988
+ if (index >= 0) waiters.splice(index, 1);
15989
+ reject(new Error("portal capture timeout (queue)"));
15990
+ };
15991
+ const start = () => {
15992
+ signal.removeEventListener("abort", abort);
15993
+ active++;
15994
+ resolve6();
15995
+ };
15996
+ if (signal.aborted) return abort();
15997
+ if (active < concurrency) start();
15998
+ else {
15999
+ waiters.push(start);
16000
+ signal.addEventListener("abort", abort, { once: true });
16001
+ }
16002
+ });
16003
+ }
16004
+ return async () => {
16005
+ const controller = new AbortController();
16006
+ let timer;
16007
+ const work = async () => {
16008
+ await acquire(controller.signal);
16009
+ try {
16010
+ const reply = await (options.portal ?? capturePortalScreenshot)(controller.signal);
16011
+ if (controller.signal.aborted) throw new Error("portal capture timeout");
16012
+ if (reply.error) throw new Error(reply.error);
16013
+ if (reply.code !== 0) throw new Error(reply.code === 1 ? "portal denied/cancelled (Response 1)" : `portal failed (Response ${reply.code})`);
16014
+ if (!reply.uri) throw new Error("portal returned no file URI");
16015
+ const uri = new URL(reply.uri);
16016
+ if (uri.protocol !== "file:" || uri.hostname && uri.hostname !== "localhost") throw new Error("portal returned a non-local file URI");
16017
+ const path = fileURLToPath2(uri);
16018
+ const image = await (options.readImage ?? readLocalImage)(path);
16019
+ if (!image.images?.length) throw new Error("portal image could not be decoded");
16020
+ const dimensions = /\[image (\d+x\d+) (\d+) bytes/.exec(image.content);
16021
+ if (!dimensions) throw new Error("invalid image summary");
16022
+ return {
16023
+ ...image,
16024
+ content: `[screenshot ${dimensions[1]} ${Math.round(Number(dimensions[2]) / 1024)}KB \u2192 ${path}]
16025
+ \u6765\u6E90\uFF1A\u5BBF\u4E3B portal \u5168\u5C4F/\u4EA4\u4E92\u9009\u62E9\u7ED3\u679C\uFF1Bportal \u672A\u63D0\u4F9B\u5E94\u7528/\u7A97\u53E3\u8EAB\u4EFD\uFF0C\u65E0\u6CD5\u786E\u8BA4\u7A97\u53E3\u540D\u3002`
16026
+ };
16027
+ } finally {
16028
+ active--;
16029
+ waiters.shift()?.();
16030
+ }
16031
+ };
16032
+ try {
16033
+ return await Promise.race([
16034
+ work(),
16035
+ new Promise((_, reject) => {
16036
+ timer = setTimeout(() => {
16037
+ controller.abort();
16038
+ reject(new Error("portal capture timeout"));
16039
+ }, timeoutMs);
16040
+ })
16041
+ ]);
16042
+ } catch (error) {
16043
+ return { content: `${UNAVAILABLE}\uFF1A${error instanceof Error ? error.message : String(error)}` };
16044
+ } finally {
16045
+ clearTimeout(timer);
16046
+ }
16047
+ };
16048
+ }
16049
+ var captureHostWindow = createHostWindowCapture();
16050
+
15903
16051
  // packages/agent-runtime/localWorkspaceTools.ts
15904
16052
  import { lstat, mkdir as mkdir2, readdir as readdir2, readFile as readFile4, realpath as realpath2, stat as stat4, writeFile as writeFile2 } from "node:fs/promises";
15905
16053
  import { homedir } from "node:os";
@@ -16417,6 +16565,7 @@ function runTasks(args2) {
16417
16565
  var WORKSPACE_TOOL_NAMES = [
16418
16566
  "readFile",
16419
16567
  "read_image",
16568
+ "captureHostWindow",
16420
16569
  "writeFile",
16421
16570
  "editFile",
16422
16571
  "globFiles",
@@ -16722,6 +16871,16 @@ function buildTaskStopTool() {
16722
16871
  };
16723
16872
  }
16724
16873
  function buildWorkspaceToolDefinition(toolName) {
16874
+ if (toolName === "captureHostWindow") {
16875
+ return {
16876
+ type: "function",
16877
+ function: {
16878
+ name: "captureHostWindow",
16879
+ description: "Capture the host desktop through the Screenshot portal (interactive permission/selection may appear). Returns an image or a fail-closed reason within 9s. Portal does not identify the application/window: never infer a window name. Linux host requires /usr/bin/python3 with Gio. No arguments.",
16880
+ parameters: { type: "object", properties: {}, additionalProperties: false }
16881
+ }
16882
+ };
16883
+ }
16725
16884
  if (toolName === "read_image") {
16726
16885
  return {
16727
16886
  type: "function",
@@ -18127,6 +18286,16 @@ function createLocalWorkspaceToolExecutors(args2) {
18127
18286
  ...fileAccess,
18128
18287
  ...args2.resolveRipgrepBinary ? { resolveRipgrepBinary: args2.resolveRipgrepBinary } : {}
18129
18288
  }),
18289
+ captureHostWindow: async (call) => {
18290
+ let parsed;
18291
+ try {
18292
+ parsed = JSON.parse(call.arguments || "{}");
18293
+ } catch {
18294
+ return { content: "captureHostWindow accepts an empty JSON object" };
18295
+ }
18296
+ if (!isRecord(parsed) || Object.keys(parsed).length) return { content: "captureHostWindow accepts no arguments" };
18297
+ return captureHostWindow();
18298
+ },
18130
18299
  read_image: async (call) => {
18131
18300
  const parsed = parseWorkspaceToolArguments(call.arguments);
18132
18301
  if (Object.keys(parsed).some((key) => key !== "path")) throw new Error("read_image accepts exactly one path");
@@ -20745,13 +20914,15 @@ ${reasoningTailLog}
20745
20914
  }
20746
20915
 
20747
20916
  // packages/integrations/openai/responsesRequestBody.ts
20748
- function buildResponsesRequestBody(body, model) {
20917
+ function buildResponsesRequestBody(body, model, options) {
20749
20918
  const tools = Array.isArray(body.tools) ? toResponsesTools(body.tools) : void 0;
20750
20919
  const reasoningEffort = body.reasoning && typeof body.reasoning === "object" ? void 0 : typeof body.reasoning_effort === "string" && body.reasoning_effort.trim() ? body.reasoning_effort : void 0;
20751
20920
  return {
20752
20921
  ...body,
20753
20922
  model,
20754
- input: Array.isArray(body.input) && body.input.length > 0 ? body.input : convertMessagesToResponsesInput(body.messages ?? []),
20923
+ input: Array.isArray(body.input) && body.input.length > 0 ? body.input : convertMessagesToResponsesInput(body.messages ?? [], {
20924
+ supportsToolImages: options?.supportsToolImages
20925
+ }),
20755
20926
  ...Array.isArray(body.tools) ? { tools: tools ?? void 0 } : {},
20756
20927
  ...typeof body.max_tokens === "number" ? { max_output_tokens: body.max_tokens } : {},
20757
20928
  ...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
@@ -21082,8 +21253,16 @@ function buildOpenAiCompatibleChatCompletionRequest(args2) {
21082
21253
  args2.providerConfig.model
21083
21254
  );
21084
21255
  const sanitizedMessages = sanitizeForOutbound(args2.messages, args2.tools);
21256
+ const toolImagePolicy = resolveToolImagePolicy({
21257
+ routeKind: isResponses ? "responses" : "openai-compatible",
21258
+ legacySupportsToolImages: isResponses ? false : void 0,
21259
+ provider: args2.providerConfig.usageProvider ?? args2.providerConfig.provider,
21260
+ model: args2.providerConfig.model,
21261
+ customProviderUrl: args2.providerConfig.endpoint,
21262
+ hasVision: args2.providerConfig.hasVision
21263
+ });
21085
21264
  const messages = toOpenAiCompatibleMessages(sanitizedMessages, {
21086
- supportsToolImages: !isResponses && resolveAgentImageInputSupport({ provider: args2.providerConfig.usageProvider ?? args2.providerConfig.provider, model: args2.providerConfig.model, customProviderUrl: args2.providerConfig.endpoint, hasVision: args2.providerConfig.hasVision ?? false }),
21265
+ supportsToolImages: !isResponses && toolImagePolicy.supportsToolImages,
21087
21266
  stripReasoningContent: shouldStripReasoning,
21088
21267
  ...args2.shapingCounts ? { shapingCounts: args2.shapingCounts } : {},
21089
21268
  ...resolveReasoningReplayOptions(
@@ -21120,7 +21299,9 @@ function buildOpenAiCompatibleChatCompletionRequest(args2) {
21120
21299
  )
21121
21300
  } : {}
21122
21301
  };
21123
- const body = isResponses ? buildResponsesRequestBody(rawBody, args2.providerConfig.model) : normalizeChatCompletionsBodyForProvider({
21302
+ const body = isResponses ? buildResponsesRequestBody(rawBody, args2.providerConfig.model, {
21303
+ supportsToolImages: toolImagePolicy.supportsToolImages
21304
+ }) : normalizeChatCompletionsBodyForProvider({
21124
21305
  body: rawBody,
21125
21306
  provider: args2.providerConfig.provider,
21126
21307
  model: args2.providerConfig.model,
@@ -21997,11 +22178,11 @@ async function readNoloProcessStream(readable) {
21997
22178
  async function runNoloWorkspaceCliTool(call, args2) {
21998
22179
  const cliArgs = buildNoloWorkspaceCommandArgs(call);
21999
22180
  const bunSpawn = globalThis.Bun?.spawn;
22000
- const spawn2 = args2.spawn ?? (typeof bunSpawn === "function" ? bunSpawn : nodeSpawnFallback);
22181
+ const spawn3 = args2.spawn ?? (typeof bunSpawn === "function" ? bunSpawn : nodeSpawnFallback);
22001
22182
  const execPath = args2.processExecPath ?? process.execPath;
22002
22183
  const entrypoint = args2.cliEntrypoint;
22003
22184
  const cmd = entrypoint && entrypoint !== execPath ? [execPath, entrypoint, ...cliArgs] : [execPath, ...cliArgs];
22004
- const proc = spawn2({
22185
+ const proc = spawn3({
22005
22186
  cmd,
22006
22187
  stdout: "pipe",
22007
22188
  stderr: "pipe",
@@ -2,11 +2,11 @@ import {
2
2
  streamSseDataValues
3
3
  } from "./chunk-HNUWUO75.js";
4
4
  import {
5
- resolveAgentImageInputSupport
6
- } from "./chunk-7QQOOHDG.js";
5
+ resolveToolImagePolicy
6
+ } from "./chunk-XRU4QTSX.js";
7
7
  import {
8
8
  projectOpenAiToolImages
9
- } from "./chunk-A6B3LSDB.js";
9
+ } from "./chunk-IJOJMOCX.js";
10
10
  import {
11
11
  getAntigravityUserAgent,
12
12
  readAntigravityProjectId,
@@ -640,7 +640,11 @@ function shouldUseGeminiNativeToolRoute(provider, model, tools, isImageModel) {
640
640
  return provider === "google" && !isImageModel(model) && isGemini3Model(model) && Array.isArray(tools) && tools.length > 0;
641
641
  }
642
642
  function buildGeminiGenerateContentRequest(args) {
643
- const supportsToolImages = args.supportsToolImages ?? false;
643
+ const supportsToolImages = resolveToolImagePolicy(args.toolImagePolicy ?? {
644
+ routeKind: "gemini-native",
645
+ hasVision: args.supportsToolImages,
646
+ legacySupportsToolImages: args.supportsToolImages ?? false
647
+ }).supportsToolImages;
644
648
  const { contents, systemTexts } = convertOpenAiMessagesToGemini(
645
649
  args.messages,
646
650
  {
@@ -687,11 +691,12 @@ function buildCloudCodeAssistPayload(args) {
687
691
  const rawMessages = Array.isArray(args.openAiBody.messages) ? args.openAiBody.messages : [];
688
692
  const quirks = resolveGeminiModelQuirks(model);
689
693
  const isClaude = quirks.isClaudeCrossModel;
690
- const supportsToolImages = resolveAgentImageInputSupport({
694
+ const supportsToolImages = resolveToolImagePolicy({
691
695
  ...args.agentConfig,
696
+ routeKind: "antigravity",
692
697
  model,
693
- hasVision: args.agentConfig.hasVision ?? false
694
- });
698
+ hasVision: args.agentConfig.hasVision
699
+ }).supportsToolImages;
695
700
  const { contents, systemTexts } = convertOpenAiMessagesToGemini(rawMessages, {
696
701
  attachSkipThoughtSignature: quirks.allowsThoughtSignatureSentinel,
697
702
  supportsToolImages
@@ -333,7 +333,7 @@ async function saveDocState(arg, { dispatch, getState }) {
333
333
  ).unwrap();
334
334
  if (dbSpaceId) {
335
335
  try {
336
- const { updateContentTitle } = await import("./contentThunks-NVX3NBHZ.js");
336
+ const { updateContentTitle } = await import("./contentThunks-F4Y7V4IH.js");
337
337
  await dispatch(
338
338
  updateContentTitle({
339
339
  spaceId: dbSpaceId,
@@ -372,7 +372,7 @@ async function saveDocState(arg, { dispatch, getState }) {
372
372
  }
373
373
  }
374
374
  async function createDocState(args, thunkApi) {
375
- const { createPageAction } = await import("./createPageAction-N5XSWPN2.js");
375
+ const { createPageAction } = await import("./createPageAction-FAYZZVYI.js");
376
376
  return createPageAction(args, thunkApi);
377
377
  }
378
378
  function subscribe(listener) {
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VYNMQ6HW.js";
9
9
  import {
10
10
  fetchAndCacheTableRows
11
- } from "./chunk-Z4HDFBYK.js";
11
+ } from "./chunk-GJU7F5IR.js";
12
12
  import {
13
13
  require_react
14
14
  } from "./chunk-YDH3FDFQ.js";
@@ -521,7 +521,7 @@ var executeToolRun = createAsyncThunk(
521
521
  if (!executionInput) {
522
522
  throw new Error(`ToolRun ${id} has no input to execute with.`);
523
523
  }
524
- const { findToolExecutor } = await import("./tools-ZB2YBHSS.js");
524
+ const { findToolExecutor } = await import("./tools-KYFVARQ5.js");
525
525
  const { executor } = findToolExecutor(run.toolName);
526
526
  toolRunStarted({
527
527
  id: run.id,
@@ -20,7 +20,7 @@ import {
20
20
  toolRunUpdated,
21
21
  uiCardFallback,
22
22
  waitForAbortableDelay
23
- } from "./chunk-KXIJYPVC.js";
23
+ } from "./chunk-SYIWIP4D.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-L7ZCLG72.js";
67
+ } from "./chunk-S4SXPMPC.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-RYBZM4A2.js";
82
+ } from "./chunk-73FHDE7C.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-Z4HDFBYK.js";
105
+ } from "./chunk-GJU7F5IR.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-LTWBOZE6.js";
118
+ } from "./chunk-LQRXBYTS.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-RABMW33C.js";
129
+ } from "./chunk-GHNRJ3TK.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-ST2FXOF3.js");
3885
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-QRWP73XJ.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-PPUT7MQV.js");
18566
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-TABPPAGD.js");
18567
18567
  if (getDocState().pageKey === id) {
18568
18568
  applyExternalDocUpdate({
18569
18569
  slateData: finalSlateData,
@@ -1,6 +1,13 @@
1
1
  import {
2
- projectOpenAiToolImages
3
- } from "./chunk-A6B3LSDB.js";
2
+ EMPTY_TOOL_RESULT_TEXT,
3
+ TOOL_HAD_IMAGES,
4
+ TOOL_IMAGES,
5
+ createToolImageBudget,
6
+ formatToolImageBudgetNote,
7
+ hadToolImages,
8
+ projectOpenAiToolImages,
9
+ toolImages
10
+ } from "./chunk-IJOJMOCX.js";
4
11
  import {
5
12
  getModelContextWindow
6
13
  } from "./chunk-7ZGMQZ5D.js";
@@ -92,14 +99,57 @@ var toResponsesTools = (tools) => {
92
99
  };
93
100
  var convertMessagesToResponsesInput = (messages, options) => {
94
101
  const input = [];
102
+ const imageBudget = createToolImageBudget();
103
+ let acceptedImages = 0;
95
104
  for (const message of messages) {
96
105
  if (!message?.role) continue;
97
106
  if (message.role === "tool") {
98
107
  if (!message.tool_call_id) continue;
108
+ if (!options?.supportsToolImages || !hadToolImages(message)) {
109
+ input.push({
110
+ type: "function_call_output",
111
+ call_id: message.tool_call_id,
112
+ output: normalizeToolOutput(message.content)
113
+ });
114
+ continue;
115
+ }
116
+ const images = toolImages(message);
117
+ const text = typeof message.content === "string" ? message.content : normalizeToolOutput(message.content);
118
+ const effectiveText = text.trim() ? text : EMPTY_TOOL_RESULT_TEXT;
119
+ const outputParts = [
120
+ { type: "input_text", text: effectiveText }
121
+ ];
122
+ let toolOmitted = 0;
123
+ for (const image of images) {
124
+ const decision = imageBudget(image);
125
+ if (decision === "duplicate") continue;
126
+ if (decision !== "delivered") {
127
+ toolOmitted += 1;
128
+ continue;
129
+ }
130
+ acceptedImages += 1;
131
+ outputParts.push({
132
+ type: "input_text",
133
+ text: `Image ${acceptedImages}`
134
+ });
135
+ outputParts.push({
136
+ type: "input_image",
137
+ image_url: `data:${image.mimeType};base64,${image.dataBase64}`
138
+ });
139
+ }
140
+ if (toolOmitted > 0) {
141
+ outputParts.push({
142
+ type: "input_text",
143
+ text: formatToolImageBudgetNote(toolOmitted)
144
+ });
145
+ }
146
+ const hadPersistedImages = message?.tool_result_metadata?.[TOOL_HAD_IMAGES] === true;
147
+ const hasInjectedParts = outputParts.some((p) => p.type === "input_image") || toolOmitted > 0;
148
+ const shouldUseArray = hadPersistedImages || hasInjectedParts;
99
149
  input.push({
100
150
  type: "function_call_output",
101
151
  call_id: message.tool_call_id,
102
- output: normalizeToolOutput(message.content)
152
+ output: shouldUseArray ? outputParts : normalizeToolOutput(message.content)
103
153
  });
104
154
  continue;
105
155
  }
@@ -1000,6 +1050,17 @@ function preserveAgentStateFields(source, target, options) {
1000
1050
  }
1001
1051
  }
1002
1052
  if (source.role === "tool") {
1053
+ if (TOOL_IMAGES in source) {
1054
+ mutableTarget[TOOL_IMAGES] = source[TOOL_IMAGES];
1055
+ }
1056
+ if (source.tool_result_metadata) {
1057
+ Object.defineProperty(mutableTarget, "tool_result_metadata", {
1058
+ value: source.tool_result_metadata,
1059
+ enumerable: false,
1060
+ configurable: true,
1061
+ writable: true
1062
+ });
1063
+ }
1003
1064
  const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
1004
1065
  if (toolCallId) mutableTarget.tool_call_id = toolCallId;
1005
1066
  }
@@ -2,7 +2,7 @@ import {
2
2
  clipMultilineText,
3
3
  fetchAndSerializeTable,
4
4
  waitForAbortableDelay
5
- } from "./chunk-KXIJYPVC.js";
5
+ } from "./chunk-SYIWIP4D.js";
6
6
  import {
7
7
  isGatewayHttpStatus
8
8
  } from "./chunk-NF64D32W.js";
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-AGIM7IMJ.js";
22
22
  import {
23
23
  fetchAndCacheMessages
24
- } from "./chunk-LTWBOZE6.js";
24
+ } from "./chunk-LQRXBYTS.js";
25
25
  import {
26
26
  createSpaceKey
27
27
  } from "./chunk-UAD2WT54.js";
@@ -5,7 +5,7 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-TMAQFKHS.js";
8
+ } from "./chunk-CCWUO2ZE.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-ONQ2APOE.js";
17
+ } from "./chunk-GA4NE7QH.js";
18
18
  import {
19
19
  findToolExecutor,
20
20
  toolDefinitionsByName
21
- } from "./chunk-24VDDKCB.js";
21
+ } from "./chunk-TV6QW46C.js";
22
22
  import {
23
23
  classifyApiError,
24
24
  classifyGenerationError,
25
25
  extractErrorDiagnostics
26
- } from "./chunk-J63HVOSX.js";
26
+ } from "./chunk-UPJVQK5J.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-KXIJYPVC.js";
35
+ } from "./chunk-SYIWIP4D.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-LTWBOZE6.js";
45
+ } from "./chunk-LQRXBYTS.js";
46
46
  import {
47
47
  streamAgentChatTurn
48
- } from "./chunk-RABMW33C.js";
48
+ } from "./chunk-GHNRJ3TK.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-ISIFZP3N.js";
88
+ } from "./chunk-U3YGSKXD.js";
89
89
  import {
90
90
  EMPTY_ASSISTANT_REPAIR_PROMPT
91
91
  } from "./chunk-T7HBI3WZ.js";