nolo-cli 0.172.0-alpha.2 → 0.173.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 (91) hide show
  1. package/{_executeModel-IABRBGAE.js → _executeModel-KT7NUYZC.js} +22 -21
  2. package/{accountResolver-JS7QDNNL.js → accountResolver-YGMLY3WW.js} +2 -1
  3. package/{agentDeleteCommand-ATU2HZT2.js → agentDeleteCommand-SVGYPFU5.js} +30 -28
  4. package/{agentEmailCommands-YTKUTNLR.js → agentEmailCommands-TBZJC37X.js} +32 -30
  5. package/{agentListCommands-ZBA5JTWP.js → agentListCommands-CD7CLGH4.js} +20 -18
  6. package/{agentMachineCommands-ZSKWBVPO.js → agentMachineCommands-DQBUP3I5.js} +18 -16
  7. package/{agentProviderCommands-TWVILNAN.js → agentProviderCommands-FXEMNSZ2.js} +2 -2
  8. package/{agentRecordCommands-KVN6OF4P.js → agentRecordCommands-4PY33TAJ.js} +30 -28
  9. package/{agentRunCommand-CC6JZOGT.js → agentRunCommand-P7BC5M3Z.js} +31 -29
  10. package/{agentRuntimeLocal-JA2Q6UBJ.js → agentRuntimeLocal-XGBQ7JK2.js} +15 -13
  11. package/{agentSlice-RVJDFNRB.js → agentSlice-NL7LRTLO.js} +1 -1
  12. package/{appDeleteCommands-4XONJLO7.js → appDeleteCommands-VBH3YLIO.js} +19 -17
  13. package/{appDeployCommands-SDGJMAUG.js → appDeployCommands-3MZXLEKN.js} +19 -17
  14. package/{appDeployStatusCommands-A6O3FEEW.js → appDeployStatusCommands-FAWWEEOT.js} +19 -17
  15. package/{appGetCommands-U4Z5HSNF.js → appGetCommands-VMMCATHU.js} +19 -17
  16. package/{appListCommands-T4HVTIUC.js → appListCommands-NHM6PAIX.js} +19 -17
  17. package/{authCommand-BSOLJFPV.js → authCommand-KQ7GWCXK.js} +8 -4
  18. package/{chromeCommands-IY4NVSXZ.js → chromeCommands-Z5LDHMYN.js} +2 -1
  19. package/{chromeOpsCommands-6JHNTKXU.js → chromeOpsCommands-CHBIUDJD.js} +2 -1
  20. package/{chunk-ZB4JKLJM.js → chunk-25A6K2YP.js} +3 -3
  21. package/{chunk-6J227QXV.js → chunk-2GRXE3YJ.js} +21 -0
  22. package/{chunk-74PQM3XI.js → chunk-3TAVX6CD.js} +75 -39
  23. package/{chunk-BW3LCST7.js → chunk-4RYUMDOM.js} +2 -2
  24. package/{chunk-MYZHJKLG.js → chunk-64MLOS7B.js} +1 -1
  25. package/{chunk-CZLO63PE.js → chunk-73NYJAJS.js} +10 -10
  26. package/{chunk-I33CJERI.js → chunk-7QQOOHDG.js} +2 -2
  27. package/{chunk-BKCR2JHG.js → chunk-7ZGMQZ5D.js} +0 -45
  28. package/{chunk-X7KVZ2OK.js → chunk-AFFHPBEU.js} +7 -7
  29. package/{chunk-AKXKBNLQ.js → chunk-ASGIXFB6.js} +2 -2
  30. package/{chunk-UG3UI4Z7.js → chunk-AV67EUU4.js} +13 -13
  31. package/{chunk-EWLPIR2S.js → chunk-BAXCQF6H.js} +1 -1
  32. package/{chunk-FZSVCJUU.js → chunk-BGQZLBMJ.js} +4 -101
  33. package/{chunk-2EC6FNS4.js → chunk-BYNWE72R.js} +29 -91
  34. package/{chunk-WKF6C3X5.js → chunk-CLY56QIC.js} +3 -3
  35. package/{chunk-AJ52EA72.js → chunk-D2J22QSE.js} +1 -1
  36. package/{chunk-BU2YQBV4.js → chunk-DPQYIS6D.js} +41 -1
  37. package/{chunk-TYQZRSL6.js → chunk-ENIQIEAF.js} +1 -1
  38. package/{chunk-TCWK2EQX.js → chunk-FJ76E5ZM.js} +2 -2
  39. package/chunk-FX33MFLW.js +103 -0
  40. package/{chunk-UA4VAUQL.js → chunk-GXFAZGZ6.js} +2 -2
  41. package/{chunk-5WOL7BUP.js → chunk-J33JIJK7.js} +2 -2
  42. package/{chunk-WW5MNBTZ.js → chunk-JDWJ64VG.js} +5 -5
  43. package/{chunk-OQ3DOBYB.js → chunk-JOUFPRE4.js} +178 -2
  44. package/{chunk-6BDTSKUT.js → chunk-KBGWPSY6.js} +4 -4
  45. package/{chunk-BE42X662.js → chunk-KPSNHLFI.js} +4 -6
  46. package/{chunk-O4H4HD4X.js → chunk-N2N63HTQ.js} +2 -2
  47. package/{chunk-R2RDXNEE.js → chunk-O2LB346J.js} +3 -3
  48. package/{chunk-XWX5ZGWR.js → chunk-O3OJRN5Z.js} +89 -24
  49. package/{chunk-OPNHKULV.js → chunk-P34IX26T.js} +2 -2
  50. package/{chunk-ISMHFI2Y.js → chunk-QWNMFO5E.js} +3 -3
  51. package/{chunk-PJVGNB4L.js → chunk-RPZNVBA5.js} +1 -1
  52. package/{chunk-SUBKVXFM.js → chunk-RUKAOMXD.js} +1 -1
  53. package/chunk-SRZ6BQIP.js +68 -0
  54. package/{chunk-7TBARDLF.js → chunk-T7HBI3WZ.js} +1 -1
  55. package/{chunk-SDAIVJZG.js → chunk-TLBTPKDD.js} +11 -11
  56. package/chunk-UKZX3NHN.js +48 -0
  57. package/{chunk-ULE7ABRN.js → chunk-VETQRONK.js} +13 -11
  58. package/{chunk-ORKQ3T5D.js → chunk-W7S5CUGI.js} +3 -3
  59. package/{chunk-F3F3ARBN.js → chunk-WBA4HAFS.js} +2 -2
  60. package/{chunk-XBJIESNS.js → chunk-XAFCJN32.js} +2 -2
  61. package/{chunk-CAAH5LNN.js → chunk-Y3BUTWUJ.js} +2 -2
  62. package/{chunk-KNDA4K34.js → chunk-YBTP3PUM.js} +1 -1
  63. package/{chunk-RATR6VCP.js → chunk-ZEOR6XPJ.js} +1 -1
  64. package/{commandRegistry-ICL67WF7.js → commandRegistry-UVXIFHUI.js} +53 -53
  65. package/{contentThunks-SM5FP7FM.js → contentThunks-I4HNLTQY.js} +6 -5
  66. package/{createAgentAutomationAction-ECWLREQU.js → createAgentAutomationAction-GS5LQ52L.js} +6 -5
  67. package/{createDialogAction-LROHLFQ2.js → createDialogAction-5WNACKWC.js} +7 -6
  68. package/{createPageAction-KUQVLZMZ.js → createPageAction-S7MGYSMU.js} +6 -5
  69. package/{dialogCommands-T5JYBPS6.js → dialogCommands-OK3L6SAI.js} +19 -17
  70. package/{dialogSlice-2FWQCZDB.js → dialogSlice-R62QV2OE.js} +5 -4
  71. package/{docCreateCommands-7F4ICTJQ.js → docCreateCommands-NMCMJPQX.js} +18 -16
  72. package/{docDeleteCommands-4INN7EWS.js → docDeleteCommands-46FMFRZU.js} +19 -17
  73. package/{docReadCommands-7PZZR3C3.js → docReadCommands-6NPY5P67.js} +18 -16
  74. package/{docStore-WUR5MNKF.js → docStore-X5P4UGTZ.js} +1 -1
  75. package/{docUpdateCommands-H2YXAGOV.js → docUpdateCommands-UDT4QLPL.js} +18 -16
  76. package/{handleSendMessageAction-DVXNAQ2V.js → handleSendMessageAction-IVQMBROO.js} +13 -13
  77. package/index.js +4 -4
  78. package/{localRuntimeAdapter-M64P55I7.js → localRuntimeAdapter-LY5MOJN4.js} +28 -26
  79. package/{machineCommands-2H7QW35Q.js → machineCommands-KYTNSAIN.js} +29 -27
  80. package/{machineWsRunDispatch-4L2DSIMF.js → machineWsRunDispatch-ZR3GCQMH.js} +29 -27
  81. package/package.json +1 -1
  82. package/{providerPresetApply-5K4PBX4J.js → providerPresetApply-MBMGCNKZ.js} +1 -2
  83. package/{providerRegistry-K5MSZ3Y5.js → providerRegistry-P4KYS6SE.js} +1 -2
  84. package/{readlineWorkspace-KNE2THUN.js → readlineWorkspace-SNA6I5UK.js} +34 -32
  85. package/{runAgentClientLoop-34ME2HDT.js → runAgentClientLoop-6G7JORHJ.js} +20 -19
  86. package/{spaceCommands-HAVZ3PQN.js → spaceCommands-SEWFBY53.js} +18 -16
  87. package/{streamAgentChatTurn-YXFJ3UWD.js → streamAgentChatTurn-EJDRXKAQ.js} +26 -24
  88. package/{tools-M7H7Z44Z.js → tools-K3IZ7U5G.js} +13 -13
  89. package/{tuiSummaryLlmCaller-KVAXEH7O.js → tuiSummaryLlmCaller-2MC6SXZT.js} +8 -7
  90. package/{updateDialogTitleAction-YXQ2AJVK.js → updateDialogTitleAction-YO67K72J.js} +6 -5
  91. package/chunk-TSCI6X6C.js +0 -185
@@ -0,0 +1,103 @@
1
+ // packages/agent-runtime/toolImages.ts
2
+ var EMPTY_TOOL_RESULT_TEXT = "[Tool completed without output]";
3
+ var TOOL_HAD_IMAGES = "toolHadImages";
4
+ function hadToolImages(message) {
5
+ return message.tool_result_metadata?.[TOOL_HAD_IMAGES] === true || toolImages(message).length > 0;
6
+ }
7
+ var TOOL_IMAGES = Symbol("runtime-only-tool-images");
8
+ function toolImages(message) {
9
+ return message[TOOL_IMAGES] ?? [];
10
+ }
11
+ function withoutToolImages(message) {
12
+ if (!(TOOL_IMAGES in message)) return message;
13
+ const { [TOOL_IMAGES]: _images, ...textOnly } = message;
14
+ return _images?.length ? {
15
+ ...textOnly,
16
+ tool_result_metadata: {
17
+ ...message.tool_result_metadata,
18
+ [TOOL_HAD_IMAGES]: true
19
+ }
20
+ } : textOnly;
21
+ }
22
+ function createToolImageLedger() {
23
+ const committed = /* @__PURE__ */ new Set();
24
+ let pending = /* @__PURE__ */ new Set();
25
+ const keyOf = (image) => `${image.mimeType}\0${image.dataBase64}`;
26
+ const candidates = (images) => (images ?? []).filter((image) => {
27
+ const key = keyOf(image);
28
+ if (committed.has(key) || pending.has(key)) return false;
29
+ pending.add(key);
30
+ return true;
31
+ });
32
+ return Object.assign(candidates, {
33
+ /** Only after the provider call succeeded: failed sends must stay replayable. */
34
+ commit(images) {
35
+ for (const image of images) committed.add(keyOf(image));
36
+ pending = /* @__PURE__ */ new Set();
37
+ },
38
+ /** 当前生命周期不依赖 reset,仅供未来中途放弃批次时使用。 */
39
+ reset() {
40
+ pending = /* @__PURE__ */ new Set();
41
+ }
42
+ });
43
+ }
44
+ function stripToolImages(message) {
45
+ if (!toolImages(message).length) return message;
46
+ return withoutToolImages(message);
47
+ }
48
+
49
+ // packages/agent-runtime/openAiToolImages.ts
50
+ var MAX_IMAGES_PER_REQUEST = 4;
51
+ var MAX_BASE64_BYTES_PER_REQUEST = 8 * 1024 * 1024;
52
+ 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
+ function projectOpenAiToolImages(messages, supportsImages) {
54
+ const parts = [];
55
+ const omitted = [];
56
+ const seen = /* @__PURE__ */ new Set();
57
+ let bytes = 0;
58
+ let accepted = 0;
59
+ let lastTool = -1;
60
+ messages.forEach((message, index) => {
61
+ if (message.role === "tool") lastTool = index;
62
+ if (!supportsImages) return;
63
+ 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}`);
70
+ continue;
71
+ }
72
+ bytes += size;
73
+ 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
+ parts.push({
77
+ type: "text",
78
+ text: `Image ${accepted} \u2014 from tool result ${toolCallId.replace(/[\x00-\x1f\x7f]/g, "")}${source ? ` (${source})` : ""}`
79
+ });
80
+ parts.push({ type: "image_url", image_url: { url: `data:${image.mimeType};base64,${image.dataBase64}` } });
81
+ }
82
+ });
83
+ if (lastTool < 0) return messages;
84
+ 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.` : "";
86
+ const attachment = {
87
+ role: "user",
88
+ content: [{ type: "text", text: `${INTRO}${note}` }, ...parts]
89
+ };
90
+ return [...messages.slice(0, lastTool + 1), attachment, ...messages.slice(lastTool + 1)];
91
+ }
92
+
93
+ export {
94
+ EMPTY_TOOL_RESULT_TEXT,
95
+ TOOL_HAD_IMAGES,
96
+ hadToolImages,
97
+ TOOL_IMAGES,
98
+ toolImages,
99
+ withoutToolImages,
100
+ createToolImageLedger,
101
+ stripToolImages,
102
+ projectOpenAiToolImages
103
+ };
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VYNMQ6HW.js";
9
9
  import {
10
10
  fetchAndCacheTableRows
11
- } from "./chunk-MYZHJKLG.js";
11
+ } from "./chunk-64MLOS7B.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-M7H7Z44Z.js");
524
+ const { findToolExecutor } = await import("./tools-K3IZ7U5G.js");
525
525
  const { executor } = findToolExecutor(run.toolName);
526
526
  toolRunStarted({
527
527
  id: run.id,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveAgentImageInputSupport
3
- } from "./chunk-I33CJERI.js";
3
+ } from "./chunk-7QQOOHDG.js";
4
4
  import {
5
5
  TOOL_HAD_IMAGES,
6
6
  hadToolImages
7
- } from "./chunk-FZSVCJUU.js";
7
+ } from "./chunk-FX33MFLW.js";
8
8
  import {
9
9
  asOptionalFiniteNumber
10
10
  } from "./chunk-WWC7I6TA.js";
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-HS7MLR74.js";
4
4
  import {
5
5
  performServerProxyFetchWithRetry
6
- } from "./chunk-TCWK2EQX.js";
6
+ } from "./chunk-FJ76E5ZM.js";
7
7
  import {
8
8
  fetchServerSyncedCredential
9
- } from "./chunk-ORKQ3T5D.js";
9
+ } from "./chunk-W7S5CUGI.js";
10
10
  import {
11
11
  buildSkillGuidancePromptBlock
12
12
  } from "./chunk-3LNVSFTH.js";
@@ -23,7 +23,7 @@ import {
23
23
  compileContextLayers,
24
24
  detectDispatchIntentFromMessages,
25
25
  resolveToolGuidedSections
26
- } from "./chunk-RATR6VCP.js";
26
+ } from "./chunk-ZEOR6XPJ.js";
27
27
  import {
28
28
  convertMessagesToResponsesInput,
29
29
  getUsageRequestOptions,
@@ -32,11 +32,11 @@ import {
32
32
  resolveReasoningReplayOptions,
33
33
  shouldStripReasoningContentForOutbound,
34
34
  stablePromptCacheKey
35
- } from "./chunk-FZSVCJUU.js";
35
+ } from "./chunk-BGQZLBMJ.js";
36
36
  import {
37
37
  resolveAgentCallPlan,
38
38
  resolveClientWire
39
- } from "./chunk-XBJIESNS.js";
39
+ } from "./chunk-XAFCJN32.js";
40
40
  import {
41
41
  createFileCredentialBroker
42
42
  } from "./chunk-76YUTLOT.js";
@@ -1,6 +1,9 @@
1
1
  import {
2
- ANTIGRAVITY_CLOUD_CODE_BASE_URL
3
- } from "./chunk-TSCI6X6C.js";
2
+ asOptionalFiniteNumber
3
+ } from "./chunk-WWC7I6TA.js";
4
+ import {
5
+ trimTrailingSlash
6
+ } from "./chunk-I2QHI2XM.js";
4
7
  import {
5
8
  commandCodeModels,
6
9
  kimiCodeModels,
@@ -12,6 +15,12 @@ import {
12
15
  stepfunModels,
13
16
  stepfunStepPlanModels
14
17
  } from "./chunk-GC64WGMD.js";
18
+ import {
19
+ toErrorMessage
20
+ } from "./chunk-HNMXYYJR.js";
21
+ import {
22
+ asOptionalTrimmedString
23
+ } from "./chunk-G3SUCT4W.js";
15
24
  import {
16
25
  PLATFORM_HOSTED_DEEPSEEK_FLASH_OFF_PEAK_PRICE,
17
26
  PLATFORM_HOSTED_DEEPSEEK_FLASH_PEAK_PRICE,
@@ -22,6 +31,157 @@ import {
22
31
  asTrimmedLowercaseString
23
32
  } from "./chunk-QSJ3HFEF.js";
24
33
 
34
+ // packages/agent-runtime/antigravityOAuth.ts
35
+ var decodeBase64 = (s) => typeof Buffer !== "undefined" ? Buffer.from(s, "base64").toString("utf8") : typeof atob === "function" ? atob(s) : s;
36
+ var ANTIGRAVITY_CLIENT_ID = decodeBase64(
37
+ "MTA3MTAwNjA2MDU5MS10bWhzc2luMmgyMWxjcmUyMzV2dG9sb2poNGc0MDNlcC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbQ=="
38
+ );
39
+ var ANTIGRAVITY_CLIENT_SECRET = decodeBase64(
40
+ "R09DU1BYLUs1OEZXUjQ4NkxkTEoxbUxCOHNYQzR6NnFEQWY="
41
+ );
42
+ var ANTIGRAVITY_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
43
+ var ANTIGRAVITY_TOKEN_URL = "https://oauth2.googleapis.com/token";
44
+ var ANTIGRAVITY_USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json";
45
+ var ANTIGRAVITY_CALLBACK_PORT = 51121;
46
+ var ANTIGRAVITY_CALLBACK_PATH = "/oauth-callback";
47
+ var ANTIGRAVITY_CALLBACK_URL = `http://127.0.0.1:${ANTIGRAVITY_CALLBACK_PORT}${ANTIGRAVITY_CALLBACK_PATH}`;
48
+ var ANTIGRAVITY_SCOPES = [
49
+ "https://www.googleapis.com/auth/cloud-platform",
50
+ "https://www.googleapis.com/auth/userinfo.email",
51
+ "https://www.googleapis.com/auth/userinfo.profile",
52
+ "https://www.googleapis.com/auth/cclog",
53
+ "https://www.googleapis.com/auth/experimentsandconfigs"
54
+ ];
55
+ var ANTIGRAVITY_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1e3;
56
+ var ANTIGRAVITY_TOKEN_REQUEST_TIMEOUT_MS = 3e4;
57
+ var ANTIGRAVITY_CLOUD_CODE_BASE_URL = "https://daily-cloudcode-pa.googleapis.com";
58
+ var ANTIGRAVITY_CLOUD_CODE_HOST = "cloudcode-pa.googleapis.com";
59
+ var ANTIGRAVITY_CLOUD_CODE_HOSTS = [
60
+ ANTIGRAVITY_CLOUD_CODE_HOST,
61
+ "daily-cloudcode-pa.googleapis.com"
62
+ ];
63
+ function isAntigravityCloudCodeHostname(rawHost) {
64
+ const hostname = asTrimmedLowercaseString(rawHost ?? "").replace(/\.+$/, "");
65
+ if (!hostname) return false;
66
+ return ANTIGRAVITY_CLOUD_CODE_HOSTS.includes(hostname);
67
+ }
68
+ function isAntigravityCloudCodeBaseUrl(raw) {
69
+ const value = typeof raw === "string" ? raw.trim() : "";
70
+ if (!value) return false;
71
+ try {
72
+ return isAntigravityCloudCodeHostname(new URL(value).hostname);
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+ var ANTIGRAVITY_LEGACY_GENERIC_BASE_RE = /^https?:\/\/cloudcode-pa\.googleapis\.com$/i;
78
+ function getAntigravityUserAgent() {
79
+ const version = process.env.NOLO_ANTIGRAVITY_VERSION || "2.23.1";
80
+ const os = process.platform === "win32" ? "windows" : process.platform;
81
+ const arch = process.arch === "x64" ? "amd64" : process.arch === "ia32" ? "386" : process.arch;
82
+ return `antigravity/hub/${version} ${os}/${arch}`;
83
+ }
84
+ function resolveAntigravityCloudCodeBaseUrl(customProviderUrl) {
85
+ const raw = (customProviderUrl ?? "").trim();
86
+ if (!raw) return ANTIGRAVITY_CLOUD_CODE_BASE_URL;
87
+ const trimmed = trimTrailingSlash(raw);
88
+ if (isAntigravityCloudCodeBaseUrl(trimmed)) {
89
+ const base = trimmed.replace(/\/v1internal:.*$/i, "").replace(/\/$/, "");
90
+ if (ANTIGRAVITY_LEGACY_GENERIC_BASE_RE.test(base)) {
91
+ return ANTIGRAVITY_CLOUD_CODE_BASE_URL;
92
+ }
93
+ return base;
94
+ }
95
+ return ANTIGRAVITY_CLOUD_CODE_BASE_URL;
96
+ }
97
+ function isAntigravityOAuthAgent(agentConfig) {
98
+ if (!agentConfig) return false;
99
+ const apiKeyRef = asTrimmedLowercaseString(agentConfig.apiKeyRef);
100
+ const provider = asTrimmedLowercaseString(agentConfig.provider);
101
+ const url = asTrimmedLowercaseString(agentConfig.customProviderUrl);
102
+ return apiKeyRef === "antigravity" || provider === "google-antigravity" || // 只看解析后的 hostname(同 resolver):后缀 host / userinfo / path 里的官方串
103
+ // 都不构成 antigravity 身份。
104
+ isAntigravityCloudCodeBaseUrl(url);
105
+ }
106
+ function readAntigravityProjectId(metadata) {
107
+ return asOptionalTrimmedString(metadata?.projectId);
108
+ }
109
+ function normalizeAntigravityTokenPayload(args) {
110
+ const {
111
+ payload,
112
+ baseCredential,
113
+ now = Date.now(),
114
+ clientSkewMs = ANTIGRAVITY_ACCESS_TOKEN_CLIENT_SKEW_MS
115
+ } = args;
116
+ if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
117
+ throw new Error("Antigravity token response missing access_token");
118
+ }
119
+ const accessToken = payload.access_token.trim();
120
+ const expiresIn = asOptionalFiniteNumber(payload.expires_in);
121
+ const expiresAt = expiresIn !== void 0 ? now + expiresIn * 1e3 - clientSkewMs : baseCredential?.expiresAt;
122
+ const refreshToken = typeof payload.refresh_token === "string" && payload.refresh_token.trim() ? payload.refresh_token.trim() : baseCredential?.refreshToken;
123
+ const scope = typeof payload.scope === "string" && payload.scope.trim() ? payload.scope.trim() : baseCredential?.scope;
124
+ return {
125
+ ...baseCredential ?? {},
126
+ provider: baseCredential?.provider ?? "antigravity",
127
+ accessToken,
128
+ ...refreshToken ? { refreshToken } : {},
129
+ ...expiresAt !== void 0 ? { expiresAt } : {},
130
+ ...scope ? { scope } : {},
131
+ obtainedAt: now
132
+ };
133
+ }
134
+ async function refreshAntigravityToken(credential, deps = {}) {
135
+ if (!credential.refreshToken || !credential.refreshToken.trim()) {
136
+ throw new Error("Antigravity credential has no refresh_token");
137
+ }
138
+ const fetchImpl = deps.fetchImpl ?? fetch;
139
+ let response;
140
+ try {
141
+ response = await fetchImpl(ANTIGRAVITY_TOKEN_URL, {
142
+ method: "POST",
143
+ headers: {
144
+ "Content-Type": "application/x-www-form-urlencoded",
145
+ Accept: "application/json"
146
+ },
147
+ body: new URLSearchParams({
148
+ client_id: ANTIGRAVITY_CLIENT_ID,
149
+ client_secret: ANTIGRAVITY_CLIENT_SECRET,
150
+ refresh_token: credential.refreshToken.trim(),
151
+ grant_type: "refresh_token"
152
+ }),
153
+ signal: AbortSignal.timeout(ANTIGRAVITY_TOKEN_REQUEST_TIMEOUT_MS)
154
+ });
155
+ } catch (error) {
156
+ throw new Error(
157
+ `Antigravity token refresh failed: ${toErrorMessage(error)}`
158
+ );
159
+ }
160
+ let rawBodyText = "";
161
+ let payload;
162
+ try {
163
+ rawBodyText = await response.text();
164
+ payload = rawBodyText ? JSON.parse(rawBodyText) : {};
165
+ } catch {
166
+ payload = {};
167
+ }
168
+ if (!response.ok) {
169
+ const errorCode = typeof payload.error === "string" && payload.error.trim() ? payload.error.trim() : void 0;
170
+ const errorDescription = typeof payload.error_description === "string" && payload.error_description.trim() ? payload.error_description.trim() : void 0;
171
+ const detail = (errorCode && errorDescription && errorDescription !== errorCode ? `${errorCode}: ${errorDescription}` : errorCode ?? errorDescription ?? rawBodyText.trim()) || `HTTP ${response.status}`;
172
+ throw new Error(`Antigravity token refresh failed: ${detail}`);
173
+ }
174
+ if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
175
+ throw new Error("Antigravity token refresh response missing access_token");
176
+ }
177
+ const now = deps.now?.() ?? Date.now();
178
+ return normalizeAntigravityTokenPayload({
179
+ payload,
180
+ baseCredential: credential,
181
+ now
182
+ });
183
+ }
184
+
25
185
  // packages/integrations/deepseek/models.ts
26
186
  var deepseekModels = [
27
187
  // ── 旗舰 ──
@@ -723,6 +883,22 @@ function isSubscriptionOAuthCredential(apiKeyRef) {
723
883
  }
724
884
 
725
885
  export {
886
+ ANTIGRAVITY_CLIENT_ID,
887
+ ANTIGRAVITY_CLIENT_SECRET,
888
+ ANTIGRAVITY_AUTH_URL,
889
+ ANTIGRAVITY_TOKEN_URL,
890
+ ANTIGRAVITY_USERINFO_URL,
891
+ ANTIGRAVITY_CALLBACK_PORT,
892
+ ANTIGRAVITY_CALLBACK_PATH,
893
+ ANTIGRAVITY_SCOPES,
894
+ ANTIGRAVITY_CLOUD_CODE_BASE_URL,
895
+ isAntigravityCloudCodeBaseUrl,
896
+ getAntigravityUserAgent,
897
+ resolveAntigravityCloudCodeBaseUrl,
898
+ isAntigravityOAuthAgent,
899
+ readAntigravityProjectId,
900
+ normalizeAntigravityTokenPayload,
901
+ refreshAntigravityToken,
726
902
  SUBSCRIPTION_OAUTH_PROVIDERS,
727
903
  CUSTOM_API_KEY_TEMPLATES,
728
904
  ALL_PROVIDER_REGISTRY,
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-74PQM3XI.js";
4
+ } from "./chunk-3TAVX6CD.js";
5
5
  import {
6
6
  t
7
7
  } from "./chunk-TDX2L4W2.js";
8
8
  import {
9
9
  clipMultilineText
10
- } from "./chunk-UA4VAUQL.js";
10
+ } from "./chunk-GXFAZGZ6.js";
11
11
  import {
12
12
  runLocalAgentTurn
13
- } from "./chunk-2EC6FNS4.js";
13
+ } from "./chunk-BYNWE72R.js";
14
14
  import {
15
15
  applyToolSurfaceConstraints
16
- } from "./chunk-6J227QXV.js";
16
+ } from "./chunk-2GRXE3YJ.js";
17
17
  import {
18
18
  resolveLocalRuntimeEnvFromPolicy
19
19
  } from "./chunk-LIQJTQRN.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-UEILX4EV.js";
4
4
  import {
5
5
  compareAgentSelection
6
- } from "./chunk-6J227QXV.js";
6
+ } from "./chunk-2GRXE3YJ.js";
7
7
  import {
8
8
  DEFAULT_PROVIDER_RETRY_MS,
9
9
  isAgentUnavailableNow,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-JLR5NWP2.js";
12
12
  import {
13
13
  isOAuthApiKeyRef
14
- } from "./chunk-BKCR2JHG.js";
14
+ } from "./chunk-UKZX3NHN.js";
15
15
  import {
16
16
  isOwnedAgentKey,
17
17
  ownedAgentKey,
@@ -21,12 +21,10 @@ import {
21
21
  getModelAbility
22
22
  } from "./chunk-HLAL63BZ.js";
23
23
  import {
24
+ isAntigravityOAuthAgent,
24
25
  isSubscriptionEndpoint,
25
26
  isSubscriptionOAuthCredential
26
- } from "./chunk-OQ3DOBYB.js";
27
- import {
28
- isAntigravityOAuthAgent
29
- } from "./chunk-TSCI6X6C.js";
27
+ } from "./chunk-JOUFPRE4.js";
30
28
 
31
29
  // packages/ai/agent/agentBilling.ts
32
30
  function resolveBillingSource(candidate) {
@@ -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-SM5FP7FM.js");
336
+ const { updateContentTitle } = await import("./contentThunks-I4HNLTQY.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-KUQVLZMZ.js");
375
+ const { createPageAction } = await import("./createPageAction-S7MGYSMU.js");
376
376
  return createPageAction(args, thunkApi);
377
377
  }
378
378
  function subscribe(listener) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-HNUWUO75.js";
4
4
  import {
5
5
  resolveAgentImageInputSupport
6
- } from "./chunk-I33CJERI.js";
6
+ } from "./chunk-7QQOOHDG.js";
7
7
  import {
8
8
  accumulateToolCallDelta,
9
9
  createThinkParserState,
@@ -30,11 +30,11 @@ import {
30
30
  stablePromptCacheKey,
31
31
  toOpenAiCompatibleMessages,
32
32
  toResponsesTools
33
- } from "./chunk-FZSVCJUU.js";
33
+ } from "./chunk-BGQZLBMJ.js";
34
34
  import {
35
35
  isMeaningfulChatCompletionOutput,
36
36
  isMeaningfulResponsesOutput
37
- } from "./chunk-BKCR2JHG.js";
37
+ } from "./chunk-7ZGMQZ5D.js";
38
38
  import {
39
39
  clipCompactText
40
40
  } from "./chunk-5MMAK75Q.js";
@@ -1,11 +1,17 @@
1
1
  import {
2
2
  streamSseDataValues
3
3
  } from "./chunk-HNUWUO75.js";
4
+ import {
5
+ resolveAgentImageInputSupport
6
+ } from "./chunk-7QQOOHDG.js";
7
+ import {
8
+ projectOpenAiToolImages
9
+ } from "./chunk-FX33MFLW.js";
4
10
  import {
5
11
  getAntigravityUserAgent,
6
12
  readAntigravityProjectId,
7
13
  resolveAntigravityCloudCodeBaseUrl
8
- } from "./chunk-TSCI6X6C.js";
14
+ } from "./chunk-JOUFPRE4.js";
9
15
  import {
10
16
  asOptionalTrimmedString
11
17
  } from "./chunk-G3SUCT4W.js";
@@ -145,20 +151,60 @@ function parseDataUrlToInlineData(url) {
145
151
  if (!match) return null;
146
152
  return { mimeType: match[1], data: match[2] };
147
153
  }
148
- function extractInlineDataParts(content) {
149
- if (!Array.isArray(content)) return [];
150
- const parts = [];
151
- for (const part of content) {
152
- if (!part || typeof part !== "object") continue;
153
- if (part.type !== "image_url") continue;
154
- const url = part.image_url?.url;
155
- if (typeof url !== "string" || !url.trim()) continue;
156
- const inline = parseDataUrlToInlineData(url);
157
- if (inline) parts.push({ inlineData: inline });
154
+ function filterOrphanedToolMessages(messages) {
155
+ if (!Array.isArray(messages)) return [];
156
+ const result = [];
157
+ let pendingFunctionCalls = [];
158
+ let toolCallIndex = 0;
159
+ for (const raw of messages) {
160
+ if (!raw || typeof raw !== "object" || !("role" in raw)) continue;
161
+ const role = String(raw.role);
162
+ if (role === "system") {
163
+ result.push(raw);
164
+ continue;
165
+ }
166
+ if (role === "user") {
167
+ pendingFunctionCalls = [];
168
+ result.push(raw);
169
+ continue;
170
+ }
171
+ if (role === "assistant" || role === "model") {
172
+ pendingFunctionCalls = [];
173
+ const calls = "tool_calls" in raw && Array.isArray(raw.tool_calls) ? raw.tool_calls : [];
174
+ for (const call of calls) {
175
+ if (!call || typeof call !== "object") continue;
176
+ const name = call.function?.name || `tool_${++toolCallIndex}`;
177
+ const id = typeof call.id === "string" ? call.id : "";
178
+ pendingFunctionCalls.push({ name, id });
179
+ }
180
+ result.push(raw);
181
+ continue;
182
+ }
183
+ if (role === "tool") {
184
+ const toolCallId = "tool_call_id" in raw && typeof raw.tool_call_id === "string" ? raw.tool_call_id : "";
185
+ const rawName = "name" in raw && typeof raw.name === "string" ? raw.name.trim() : "";
186
+ const pendingIndex = pendingFunctionCalls.findIndex(
187
+ (p) => toolCallId ? p.id === toolCallId : rawName ? p.name === rawName : true
188
+ );
189
+ if (pendingIndex === -1) {
190
+ continue;
191
+ }
192
+ pendingFunctionCalls.splice(pendingIndex, 1);
193
+ result.push(raw);
194
+ continue;
195
+ }
196
+ result.push(raw);
158
197
  }
159
- return parts;
198
+ return result;
160
199
  }
161
200
  function convertOpenAiMessagesToGemini(messages, options) {
201
+ const sanitizedMessages = filterOrphanedToolMessages(
202
+ messages ?? []
203
+ );
204
+ const effectiveMessages = projectOpenAiToolImages(
205
+ sanitizedMessages,
206
+ options.supportsToolImages === true
207
+ );
162
208
  const contents = [];
163
209
  const systemTexts = [];
164
210
  let toolCallIndex = 0;
@@ -186,7 +232,7 @@ function convertOpenAiMessagesToGemini(messages, options) {
186
232
  pendingFunctionCalls = [];
187
233
  pushOrMergeContent("user", dummyResponses);
188
234
  };
189
- for (const raw of messages) {
235
+ for (const raw of effectiveMessages) {
190
236
  if (!raw || typeof raw !== "object" || !("role" in raw)) continue;
191
237
  const role = String(raw.role);
192
238
  const content = "content" in raw ? raw.content : null;
@@ -199,16 +245,25 @@ function convertOpenAiMessagesToGemini(messages, options) {
199
245
  }
200
246
  if (role === "user") {
201
247
  flushPendingFunctionCalls();
202
- const text = messageText(
203
- content
204
- );
205
- const imageParts = extractInlineDataParts(
206
- content
207
- );
208
- if (!text && imageParts.length === 0) continue;
209
248
  const parts = [];
210
- if (text) parts.push({ text });
211
- for (const img of imageParts) parts.push(img);
249
+ if (typeof content === "string") {
250
+ const text = content.trim();
251
+ if (text) parts.push({ text });
252
+ } else if (Array.isArray(content)) {
253
+ for (const part of content) {
254
+ if (!part || typeof part !== "object") continue;
255
+ if (part.type === "text" && typeof part.text === "string" && part.text.trim()) {
256
+ parts.push({ text: part.text });
257
+ } else if (part.type === "image_url") {
258
+ const url = part.image_url?.url;
259
+ if (typeof url === "string" && url.trim()) {
260
+ const inline = parseDataUrlToInlineData(url);
261
+ if (inline) parts.push({ inlineData: inline });
262
+ }
263
+ }
264
+ }
265
+ }
266
+ if (parts.length === 0) continue;
212
267
  pushOrMergeContent("user", parts);
213
268
  continue;
214
269
  }
@@ -585,9 +640,13 @@ function shouldUseGeminiNativeToolRoute(provider, model, tools, isImageModel) {
585
640
  return provider === "google" && !isImageModel(model) && isGemini3Model(model) && Array.isArray(tools) && tools.length > 0;
586
641
  }
587
642
  function buildGeminiGenerateContentRequest(args) {
643
+ const supportsToolImages = args.supportsToolImages ?? false;
588
644
  const { contents, systemTexts } = convertOpenAiMessagesToGemini(
589
645
  args.messages,
590
- { attachSkipThoughtSignature: args.attachSkipThoughtSignature }
646
+ {
647
+ attachSkipThoughtSignature: args.attachSkipThoughtSignature,
648
+ supportsToolImages
649
+ }
591
650
  );
592
651
  const request = { contents };
593
652
  if (systemTexts.length > 0) {
@@ -628,8 +687,14 @@ function buildCloudCodeAssistPayload(args) {
628
687
  const rawMessages = Array.isArray(args.openAiBody.messages) ? args.openAiBody.messages : [];
629
688
  const quirks = resolveGeminiModelQuirks(model);
630
689
  const isClaude = quirks.isClaudeCrossModel;
690
+ const supportsToolImages = resolveAgentImageInputSupport({
691
+ ...args.agentConfig,
692
+ model,
693
+ hasVision: args.agentConfig.hasVision ?? false
694
+ });
631
695
  const { contents, systemTexts } = convertOpenAiMessagesToGemini(rawMessages, {
632
- attachSkipThoughtSignature: quirks.allowsThoughtSignatureSentinel
696
+ attachSkipThoughtSignature: quirks.allowsThoughtSignatureSentinel,
697
+ supportsToolImages
633
698
  });
634
699
  if (contents.length === 0) {
635
700
  throw new Error("Antigravity Cloud Code Assist request has no user/model contents.");
@@ -3,7 +3,7 @@ import {
3
3
  classifyAgentApiKeyRef,
4
4
  formatUnsupportedAgentApiKeyRefMessage,
5
5
  shouldReadAgentKeyRemotely
6
- } from "./chunk-PJVGNB4L.js";
6
+ } from "./chunk-RPZNVBA5.js";
7
7
  import {
8
8
  resolveCliAgentKeyInput
9
9
  } from "./chunk-NBTY7YJF.js";
@@ -556,7 +556,7 @@ async function buildCreatedAgentRecord(args) {
556
556
  const resolvedAgentInput = resolveCliAgentKeyInput(args.parsed.agentInput);
557
557
  const agentKey = resolvedAgentInput.startsWith("agent-") ? resolvedAgentInput : createAgentKey.private(userId || "local", resolvedAgentInput);
558
558
  if (args.parsed.presetId) {
559
- const { resolveProviderPresetFields } = await import("./providerPresetApply-5K4PBX4J.js");
559
+ const { resolveProviderPresetFields } = await import("./providerPresetApply-MBMGCNKZ.js");
560
560
  const fields = resolveProviderPresetFields(args.parsed.presetId);
561
561
  if (fields.kind === "manual") {
562
562
  throw new Error(
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-SUBKVXFM.js";
4
+ } from "./chunk-RUKAOMXD.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-OPNHKULV.js";
7
+ } from "./chunk-P34IX26T.js";
8
8
  import {
9
9
  deriveCredentialGroup
10
- } from "./chunk-BE42X662.js";
10
+ } from "./chunk-KPSNHLFI.js";
11
11
  import {
12
12
  isTombstoneRecord
13
13
  } from "./chunk-D2MDMY2M.js";