nolo-cli 0.107.0-alpha.4 → 0.108.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 (72) hide show
  1. package/{_executeModel-UDCSOTD2.js → _executeModel-BY3P5LBB.js} +12 -12
  2. package/{agentDeleteCommand-OWYHN6D6.js → agentDeleteCommand-66KXCSRR.js} +7 -6
  3. package/{agentEmailCommands-AU5I4M4W.js → agentEmailCommands-63UTONDK.js} +18 -17
  4. package/{agentListCommands-B2V4YAC4.js → agentListCommands-NXCOTTZL.js} +9 -8
  5. package/{agentMachineCommands-YMNME2L6.js → agentMachineCommands-Z6RGPZSG.js} +7 -6
  6. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-X3UNW77C.js} +1 -1
  7. package/{agentRecordCommands-G4KK4R7H.js → agentRecordCommands-JP54ZWND.js} +17 -16
  8. package/{agentRunCommand-UTZJA23G.js → agentRunCommand-RMQWWSHF.js} +17 -16
  9. package/{agentRuntimeLocal-KCMC2TBD.js → agentRuntimeLocal-E67CTV45.js} +5 -4
  10. package/{agentSlice-R7PR6KYM.js → agentSlice-DG5TIQHE.js} +1 -1
  11. package/{appDeleteCommands-JEPA3EWE.js → appDeleteCommands-Z36CLGUK.js} +8 -7
  12. package/{appDeployCommands-UTB76XFM.js → appDeployCommands-ECMUWG6S.js} +8 -7
  13. package/{appDeployStatusCommands-LGHF2SBD.js → appDeployStatusCommands-CL24TDMA.js} +8 -7
  14. package/{appGetCommands-PX2BFHOB.js → appGetCommands-ITHGOYGJ.js} +8 -7
  15. package/{appListCommands-BSMPTWKC.js → appListCommands-EEOSI6RC.js} +8 -7
  16. package/{authCommand-YW42YZA4.js → authCommand-HGP2XTKC.js} +99 -7
  17. package/{chatQueueReduxAdapter-2P6NFX64.js → chatQueueReduxAdapter-DKLWTT3G.js} +2 -2
  18. package/{chunk-PQFHGD77.js → chunk-2OASQKU2.js} +1 -1
  19. package/{chunk-62CATUYY.js → chunk-4NNTATRH.js} +12 -769
  20. package/{chunk-EEGDMATE.js → chunk-AODJ7WSF.js} +3 -3
  21. package/{chunk-UVA7OYO3.js → chunk-CW67PN7L.js} +3 -3
  22. package/{chunk-4CR5I7BD.js → chunk-DOTZ5GTO.js} +1 -1
  23. package/chunk-FV3JEYR3.js +870 -0
  24. package/{chunk-MS7TSPZR.js → chunk-G4VIHCGJ.js} +3 -3
  25. package/chunk-GMZLP5DV.js +82 -0
  26. package/{chunk-UZGQNTVW.js → chunk-GNCCNNZD.js} +3 -1
  27. package/{chunk-GO3Z72MT.js → chunk-H4AHY5BU.js} +3 -80
  28. package/{chunk-NA35QHCF.js → chunk-HSSRGGXJ.js} +1 -1
  29. package/{chunk-GEPUP7OO.js → chunk-IQPFGYO3.js} +1 -1
  30. package/{chunk-XT35TTFG.js → chunk-KZJP33ZK.js} +1 -1
  31. package/{chunk-GPCZ7UXG.js → chunk-LJ5VW2UJ.js} +1 -1
  32. package/{chunk-C3M4465B.js → chunk-LPIYPEME.js} +9 -9
  33. package/{chunk-AEOE4Z6Q.js → chunk-LWKP7AWH.js} +1 -1
  34. package/{chunk-3UZPUAES.js → chunk-P3GYTNDF.js} +1 -1
  35. package/{chunk-ETI2NYVF.js → chunk-PHXD6JTX.js} +1 -1
  36. package/{chunk-W7HLWAQ7.js → chunk-PWBDVI4R.js} +5 -5
  37. package/{chunk-KQ4ONNQD.js → chunk-QU7KDSZX.js} +1 -1
  38. package/{chunk-IBOZNTG2.js → chunk-RVE4DCV3.js} +2 -2
  39. package/{chunk-IBOOZVVD.js → chunk-RZGLXO2B.js} +26 -22
  40. package/{chunk-GL3EHUR4.js → chunk-SYXOBWOC.js} +4 -4
  41. package/{chunk-ASIFZ2WY.js → chunk-T3GEOSRJ.js} +2 -2
  42. package/{chunk-JDPFV2JV.js → chunk-TR22GEUU.js} +2 -2
  43. package/{chunk-FG3HKPQP.js → chunk-UDIIVXKA.js} +41 -28
  44. package/{chunk-NOF3HDSN.js → chunk-YTLRHRH3.js} +3 -3
  45. package/{chunk-T75QD6AB.js → chunk-YWIEQS6H.js} +513 -27
  46. package/{chunk-53HEEOTT.js → chunk-Z5625XML.js} +1 -1
  47. package/{contentThunks-IV2T3EJC.js → contentThunks-JHK6X2KU.js} +3 -3
  48. package/{createAgentAutomationAction-JCOIEYY4.js → createAgentAutomationAction-7HX7KBES.js} +3 -3
  49. package/{createDialogAction-NGG7YVNU.js → createDialogAction-VUUUZL54.js} +4 -4
  50. package/{createPageAction-D2VOOLP3.js → createPageAction-QWNMGO3O.js} +3 -3
  51. package/{dialogCommands-H7FPUYUQ.js → dialogCommands-EN7TYD3I.js} +8 -7
  52. package/{dialogSlice-6JZOOTDS.js → dialogSlice-P2K47T3P.js} +2 -2
  53. package/{docCreateCommands-WRG2JLGM.js → docCreateCommands-43JKQEIH.js} +7 -6
  54. package/{docDeleteCommands-SHWJIBJS.js → docDeleteCommands-RL6D46XE.js} +8 -7
  55. package/{docReadCommands-WJN3WT6O.js → docReadCommands-TOEUEQDG.js} +7 -6
  56. package/{docStore-HUPQ2FSS.js → docStore-3AHKTJRI.js} +1 -1
  57. package/{docUpdateCommands-IE32IL6O.js → docUpdateCommands-FWU5G2XB.js} +7 -6
  58. package/{handleSendMessageAction-DFPMQ7YM.js → handleSendMessageAction-ID5IKXUE.js} +2 -2
  59. package/index.js +51 -51
  60. package/{machineCommands-M2T2I5NF.js → machineCommands-TTKK4F7C.js} +16 -15
  61. package/{machineWsRunDispatch-ISBKOOD7.js → machineWsRunDispatch-RX64L3ET.js} +16 -15
  62. package/package.json +1 -1
  63. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-XI3WUPTI.js} +2 -2
  64. package/{providerRegistry-757OWH3O.js → providerRegistry-KEPWWGXD.js} +2 -2
  65. package/{readlineWorkspace-XQRDGWRZ.js → readlineWorkspace-KIMUDPPV.js} +20 -19
  66. package/{runAgentClientLoop-5ZA62FBA.js → runAgentClientLoop-AN4WIRPQ.js} +10 -10
  67. package/{spaceCommands-5GLCWZPO.js → spaceCommands-NA4JMIGT.js} +7 -6
  68. package/{streamAgentChatTurn-6UZJMYRB.js → streamAgentChatTurn-3TYTHZPJ.js} +11 -11
  69. package/{tools-KMGFWO43.js → tools-34SEJSLQ.js} +8 -8
  70. package/{tuiSummaryLlmCaller-OHHFTHMG.js → tuiSummaryLlmCaller-UFGFOIIW.js} +2 -1
  71. package/{updateDialogTitleAction-QTKNIURB.js → updateDialogTitleAction-RDHNT265.js} +3 -3
  72. package/chunk-Q5FJJ6XI.js +0 -103
@@ -5,13 +5,16 @@ import {
5
5
  finalizeResponsesToolCalls,
6
6
  flushChatCompletionStream,
7
7
  providerHttpFailure,
8
- readSseFrames,
9
- streamSseDataValues,
10
8
  throwIfChatCompletionStreamFailed
11
- } from "./chunk-GO3Z72MT.js";
9
+ } from "./chunk-H4AHY5BU.js";
12
10
  import {
13
- DEVIN_CONNECT_URL
14
- } from "./chunk-Q5FJJ6XI.js";
11
+ DEVIN_CONNECT_URL,
12
+ parseSseDataLineJson,
13
+ parseSseDataLineObject
14
+ } from "./chunk-FV3JEYR3.js";
15
+ import {
16
+ readSseFrames
17
+ } from "./chunk-GMZLP5DV.js";
15
18
  import {
16
19
  clipToolText,
17
20
  hasImageInRuntimeMessages,
@@ -72,11 +75,6 @@ import {
72
75
  readTextStreamUpToChars,
73
76
  resolveNoloDialogInput
74
77
  } from "./chunk-IIVGDG4I.js";
75
- import {
76
- getAntigravityUserAgent,
77
- readAntigravityProjectId,
78
- resolveAntigravityCloudCodeBaseUrl
79
- } from "./chunk-UZGQNTVW.js";
80
78
  import {
81
79
  buildProviderAuthHeaders,
82
80
  buildProviderExecutionPlan
@@ -14367,23 +14365,6 @@ function kimiIdentityHeaders(url) {
14367
14365
  return isKimiEndpoint(url) ? { "User-Agent": KIMI_CODE_USER_AGENT } : {};
14368
14366
  }
14369
14367
 
14370
- // packages/agent-runtime/sseDataLine.ts
14371
- function parseSseDataLineJson(line) {
14372
- const trimmed = line.trim();
14373
- if (!trimmed.startsWith("data:")) return null;
14374
- const payload = trimmed.slice(5).trim();
14375
- if (!payload || payload === "[DONE]") return null;
14376
- try {
14377
- return JSON.parse(payload);
14378
- } catch {
14379
- return null;
14380
- }
14381
- }
14382
- function parseSseDataLineObject(line) {
14383
- const parsed = parseSseDataLineJson(line);
14384
- return parsed && typeof parsed === "object" ? parsed : null;
14385
- }
14386
-
14387
14368
  // packages/integrations/openai/responsesRequestBody.ts
14388
14369
  function buildResponsesRequestBody(body, model) {
14389
14370
  const tools = Array.isArray(body.tools) ? toResponsesTools(body.tools) : void 0;
@@ -19668,737 +19649,8 @@ No skills were discovered in this workspace.`;
19668
19649
  Available skills: ${available.join(", ")}`;
19669
19650
  }
19670
19651
 
19671
- // packages/core/chat/upstreamErrorBody.ts
19672
- function parseUpstreamErrorBody(errorText, statusText) {
19673
- if (errorText) {
19674
- try {
19675
- const parsed = JSON.parse(errorText);
19676
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
19677
- const error = parsed.error;
19678
- if (error && typeof error === "object" && !Array.isArray(error)) {
19679
- return parsed;
19680
- }
19681
- }
19682
- } catch {
19683
- }
19684
- }
19685
- return { error: { message: errorText || statusText } };
19686
- }
19687
-
19688
- // packages/agent-runtime/antigravityCloudCodeProvider.ts
19689
- import { randomUUID } from "node:crypto";
19690
-
19691
- // packages/agent-runtime/antigravityWireModel.ts
19692
- var WIRE_PROFILES = {
19693
- // Antigravity discovery exposes 3.7 Flash as one tiered wire model.
19694
- // The UI labels its effort variants (Low/Medium/High), but the literal
19695
- // -medium/-high ids return 404 from streamGenerateContent.
19696
- "gemini-3.7-flash-tiered": { modelEnum: "MODEL_PLACEHOLDER_M301", maxOutputTokens: 65536 },
19697
- // Gemini 3.8 Flash 沿用 3.7 的 tiered 兼容策略:仓库内暂无 Antigravity discovery
19698
- // 证据确认 3.8 的 wire modelEnum,禁止虚构,先只声明同档输出上限;enum 待
19699
- // discovery 证据到位后补齐。
19700
- "gemini-3.8-flash-tiered": { maxOutputTokens: 65536 },
19701
- "gemini-3.6-flash-low": { maxOutputTokens: 65536 },
19702
- "gemini-3.6-flash-medium": { maxOutputTokens: 65536 },
19703
- "gemini-3.6-flash-high": { maxOutputTokens: 65536 },
19704
- // 旧模型 wire 映射保留:存量自定义 agent 仍可能引用(注册表已下线不影响此处)。
19705
- "gemini-3.5-flash-extra-low": { modelEnum: "MODEL_PLACEHOLDER_M187", maxOutputTokens: 65536 },
19706
- "gemini-3.5-flash-low": { modelEnum: "MODEL_PLACEHOLDER_M20", maxOutputTokens: 65536 },
19707
- "gemini-3-flash-agent": { modelEnum: "MODEL_PLACEHOLDER_M132", maxOutputTokens: 65536 },
19708
- "gemini-3.1-pro-low": { modelEnum: "MODEL_PLACEHOLDER_M36", maxOutputTokens: 65535 },
19709
- "gemini-pro-agent": { modelEnum: "MODEL_PLACEHOLDER_M16", maxOutputTokens: 65535 },
19710
- "claude-sonnet-5": { maxOutputTokens: 64e3 },
19711
- "claude-sonnet-4-6": { maxOutputTokens: 64e3 },
19712
- "claude-opus-4-6-thinking": { maxOutputTokens: 64e3 },
19713
- "gemini-2.5-flash": { maxOutputTokens: 65536 },
19714
- "gemini-2.5-pro": { maxOutputTokens: 65536 }
19715
- };
19716
- function resolveAntigravityWireModel(logicalModelId) {
19717
- const id = logicalModelId.trim();
19718
- const lower = id.toLowerCase();
19719
- if (lower === "gemini-3.5-flash") {
19720
- const wireModelId = "gemini-3.5-flash-low";
19721
- return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
19722
- }
19723
- if (lower === "gemini-3.7-flash" || ["gemini-3.7-flash-low", "gemini-3.7-flash-medium", "gemini-3.7-flash-high"].includes(lower)) {
19724
- const wireModelId = "gemini-3.7-flash-tiered";
19725
- return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
19726
- }
19727
- if (lower === "gemini-3.8-flash" || ["gemini-3.8-flash-low", "gemini-3.8-flash-medium", "gemini-3.8-flash-high"].includes(lower)) {
19728
- const wireModelId = "gemini-3.8-flash-tiered";
19729
- return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
19730
- }
19731
- if (lower === "gemini-3.6-flash") {
19732
- const wireModelId = "gemini-3.6-flash-low";
19733
- return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
19734
- }
19735
- if (lower === "gemini-3.1-pro" || lower === "gemini-3.1-pro-preview") {
19736
- const wireModelId = "gemini-3.1-pro-low";
19737
- return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
19738
- }
19739
- if (WIRE_PROFILES[id]) {
19740
- return { wireModelId: id, profile: WIRE_PROFILES[id] };
19741
- }
19742
- return { wireModelId: id };
19743
- }
19744
-
19745
- // packages/agent-runtime/geminiNativeShared.ts
19746
- var SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
19747
- function resolveGeminiModelQuirks(modelId) {
19748
- const lower = modelId.toLowerCase();
19749
- const isGemini3 = lower.includes("gemini-3");
19750
- const isStrictSignatureModel = lower.includes("gemini-3.5") || lower.includes("flash-preview");
19751
- const isClaude = lower.includes("claude");
19752
- return {
19753
- requiresThoughtSignature: isGemini3,
19754
- allowsThoughtSignatureSentinel: isGemini3 && !isStrictSignatureModel,
19755
- isClaudeCrossModel: isClaude
19756
- };
19757
- }
19758
- function isGemini3Model(modelId) {
19759
- return resolveGeminiModelQuirks(modelId).requiresThoughtSignature;
19760
- }
19761
- function messageText(content) {
19762
- if (typeof content === "string") return content;
19763
- if (!Array.isArray(content)) return "";
19764
- return content.filter(
19765
- (part) => part?.type === "text"
19766
- ).map((part) => part.text).join("\n").trim();
19767
- }
19768
- function parseDataUrlToInlineData(url) {
19769
- const match7 = /^data:([A-Za-z0-9.+-]+\/[A-Za-z0-9.+-]+);base64,([A-Za-z0-9+/=]*)$/.exec(
19770
- url
19771
- );
19772
- if (!match7) return null;
19773
- return { mimeType: match7[1], data: match7[2] };
19774
- }
19775
- function extractInlineDataParts(content) {
19776
- if (!Array.isArray(content)) return [];
19777
- const parts2 = [];
19778
- for (const part of content) {
19779
- if (!part || typeof part !== "object") continue;
19780
- if (part.type !== "image_url") continue;
19781
- const url = part.image_url?.url;
19782
- if (typeof url !== "string" || !url.trim()) continue;
19783
- const inline = parseDataUrlToInlineData(url);
19784
- if (inline) parts2.push({ inlineData: inline });
19785
- }
19786
- return parts2;
19787
- }
19788
- function convertOpenAiMessagesToGemini(messages, options) {
19789
- const contents = [];
19790
- const systemTexts = [];
19791
- let toolCallIndex = 0;
19792
- let pendingFunctionCalls = [];
19793
- const pushOrMergeContent = (role, parts2) => {
19794
- if (parts2.length === 0) return;
19795
- const last = contents[contents.length - 1];
19796
- if (last && last.role === role) {
19797
- last.parts.push(...parts2);
19798
- } else {
19799
- contents.push({ role, parts: parts2 });
19800
- }
19801
- };
19802
- const flushPendingFunctionCalls = () => {
19803
- if (pendingFunctionCalls.length === 0) return;
19804
- const dummyResponses = pendingFunctionCalls.map(
19805
- ({ name, id }) => ({
19806
- functionResponse: {
19807
- name,
19808
- response: { output: "{}" },
19809
- ...id ? { id } : {}
19810
- }
19811
- })
19812
- );
19813
- pendingFunctionCalls = [];
19814
- pushOrMergeContent("user", dummyResponses);
19815
- };
19816
- for (const raw of messages) {
19817
- if (!raw || typeof raw !== "object" || !("role" in raw)) continue;
19818
- const role = String(raw.role);
19819
- const content = "content" in raw ? raw.content : null;
19820
- if (role === "system") {
19821
- const text = messageText(
19822
- content
19823
- );
19824
- if (text) systemTexts.push(text);
19825
- continue;
19826
- }
19827
- if (role === "user") {
19828
- flushPendingFunctionCalls();
19829
- const text = messageText(
19830
- content
19831
- );
19832
- const imageParts = extractInlineDataParts(
19833
- content
19834
- );
19835
- if (!text && imageParts.length === 0) continue;
19836
- const parts2 = [];
19837
- if (text) parts2.push({ text });
19838
- for (const img of imageParts) parts2.push(img);
19839
- pushOrMergeContent("user", parts2);
19840
- continue;
19841
- }
19842
- if (role === "assistant") {
19843
- flushPendingFunctionCalls();
19844
- const text = messageText(
19845
- content
19846
- );
19847
- const toolCalls = "tool_calls" in raw && Array.isArray(raw.tool_calls) ? raw.tool_calls ?? [] : [];
19848
- const parts2 = [];
19849
- if (text) {
19850
- parts2.push({ text });
19851
- }
19852
- for (const call of toolCalls) {
19853
- const name = call?.function?.name?.trim();
19854
- if (!name) continue;
19855
- const id = call.id?.trim() || `${name}_${toolCallIndex++}`;
19856
- pendingFunctionCalls.push({ name, id });
19857
- const realSignature = typeof call.thought_signature === "string" && call.thought_signature ? call.thought_signature : void 0;
19858
- const isFirstFunctionCallPart = !parts2.some(
19859
- (p) => "functionCall" in p
19860
- );
19861
- const signature = realSignature ?? (options.attachSkipThoughtSignature && isFirstFunctionCallPart ? SKIP_THOUGHT_SIGNATURE : void 0);
19862
- const part = {
19863
- functionCall: {
19864
- name,
19865
- args: parseToolArgs(call.function?.arguments),
19866
- ...id ? { id } : {}
19867
- },
19868
- ...signature ? { thoughtSignature: signature } : {}
19869
- };
19870
- parts2.push(part);
19871
- }
19872
- pushOrMergeContent("model", parts2);
19873
- continue;
19874
- }
19875
- if (role === "tool") {
19876
- const toolCallId = "tool_call_id" in raw && typeof raw.tool_call_id === "string" ? raw.tool_call_id : "";
19877
- const rawName = "name" in raw && typeof raw.name === "string" ? raw.name.trim() : "";
19878
- const pendingIndex = pendingFunctionCalls.findIndex(
19879
- (p) => toolCallId ? p.id === toolCallId : rawName ? p.name === rawName : true
19880
- );
19881
- if (pendingIndex === -1) continue;
19882
- const [{ name, id }] = pendingFunctionCalls.splice(pendingIndex, 1);
19883
- const output = messageText(content) || "{}";
19884
- pushOrMergeContent("user", [
19885
- {
19886
- functionResponse: {
19887
- name,
19888
- response: { output },
19889
- // 保留 OpenAI tool_call_id:antigravity Cloud Code Assist 网关把
19890
- // Gemini contents 转成 Claude messages 时需要 functionResponse →
19891
- // tool_result 的 tool_use_id;缺 id 时网关报
19892
- // "tool_result.tool_use_id: Field required"(HTTP 400)。
19893
- ...id ? { id } : {}
19894
- }
19895
- }
19896
- ]);
19897
- }
19898
- }
19899
- flushPendingFunctionCalls();
19900
- if (contents.length > 0 && contents[0]?.role === "model") {
19901
- contents.unshift({
19902
- role: "user",
19903
- parts: [{ text: "Continue the conversation." }]
19904
- });
19905
- }
19906
- return { contents, systemTexts };
19907
- }
19908
- function parseToolArgs(raw) {
19909
- if (typeof raw === "string") {
19910
- try {
19911
- const parsed = JSON.parse(raw);
19912
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
19913
- return parsed;
19914
- }
19915
- } catch {
19916
- }
19917
- }
19918
- if (raw && typeof raw === "object" && !Array.isArray(raw)) {
19919
- return raw;
19920
- }
19921
- return {};
19922
- }
19923
- function sanitizeGeminiSchemaNode(node, active) {
19924
- const out = {};
19925
- if (!node || typeof node !== "object" || Array.isArray(node)) {
19926
- return { type: "string" };
19927
- }
19928
- if (active?.has(node)) {
19929
- return { type: "object", description: "(circular schema reference)" };
19930
- }
19931
- const seen = active ?? /* @__PURE__ */ new WeakSet();
19932
- seen.add(node);
19933
- try {
19934
- return sanitizeGeminiSchemaNodeInner(node, out, seen);
19935
- } finally {
19936
- seen.delete(node);
19937
- }
19938
- }
19939
- function sanitizeGeminiSchemaNodeInner(src, out, seen) {
19940
- if (Array.isArray(src.type)) {
19941
- const firstNonNull = src.type.find((t) => t !== "null");
19942
- if (typeof firstNonNull === "string") out.type = firstNonNull;
19943
- out.nullable = true;
19944
- } else if (typeof src.type === "string") {
19945
- out.type = src.type;
19946
- }
19947
- if (typeof src.description === "string") out.description = src.description;
19948
- if (typeof src.minimum === "number") out.minimum = src.minimum;
19949
- if (typeof src.maximum === "number") out.maximum = src.maximum;
19950
- if (Array.isArray(src.enum) && src.enum.length > 0) out.enum = src.enum;
19951
- if (src.nullable === true) out.nullable = true;
19952
- if ("const" in src && src.const !== void 0 && !out.enum) {
19953
- out.enum = [src.const];
19954
- }
19955
- const variantBranches = [
19956
- ...Array.isArray(src.oneOf) ? src.oneOf : [],
19957
- ...Array.isArray(src.anyOf) ? src.anyOf : []
19958
- ];
19959
- if (variantBranches.length > 0) {
19960
- const mergedProperties = {};
19961
- let requiredIntersection;
19962
- for (const branch of variantBranches) {
19963
- const sanitized = sanitizeGeminiSchemaNode(branch, seen);
19964
- const branchProperties = sanitized.properties ?? {};
19965
- for (const [key, value] of Object.entries(branchProperties)) {
19966
- const previous = mergedProperties[key];
19967
- const prevEnum = previous?.enum;
19968
- const nextEnum = value?.enum;
19969
- if (prevEnum && nextEnum) {
19970
- mergedProperties[key] = {
19971
- ...value,
19972
- enum: [.../* @__PURE__ */ new Set([...prevEnum, ...nextEnum])]
19973
- };
19974
- } else {
19975
- mergedProperties[key] = value;
19976
- }
19977
- }
19978
- const branchRequired = Array.isArray(sanitized.required) ? sanitized.required : [];
19979
- requiredIntersection = requiredIntersection === void 0 ? [...branchRequired] : requiredIntersection.filter((r) => branchRequired.includes(r));
19980
- }
19981
- out.properties = {
19982
- ...out.properties ?? {},
19983
- ...mergedProperties
19984
- };
19985
- if (requiredIntersection !== void 0 && requiredIntersection.length > 0) {
19986
- out.required = requiredIntersection;
19987
- }
19988
- if (typeof out.type !== "string") out.type = "object";
19989
- }
19990
- if (Array.isArray(src.allOf)) {
19991
- for (const branch of src.allOf) {
19992
- const sanitized = sanitizeGeminiSchemaNode(branch, seen);
19993
- out.properties = {
19994
- ...out.properties ?? {},
19995
- ...sanitized.properties ?? {}
19996
- };
19997
- if (Array.isArray(sanitized.required)) {
19998
- out.required = [
19999
- .../* @__PURE__ */ new Set([
20000
- ...out.required ?? [],
20001
- ...sanitized.required ?? []
20002
- ])
20003
- ];
20004
- }
20005
- }
20006
- if (typeof out.type !== "string") out.type = "object";
20007
- }
20008
- if (src.properties && typeof src.properties === "object") {
20009
- const properties = {};
20010
- for (const [key, value] of Object.entries(
20011
- src.properties
20012
- )) {
20013
- properties[key] = sanitizeGeminiSchemaNode(value, seen);
20014
- }
20015
- out.properties = properties;
20016
- if (typeof out.type !== "string") out.type = "object";
20017
- }
20018
- if (Array.isArray(src.required)) {
20019
- const properties = out.properties ?? {};
20020
- const required = [...new Set(src.required)].filter(
20021
- (r) => typeof r === "string" && r in properties
20022
- );
20023
- if (required.length > 0) out.required = required;
20024
- }
20025
- if (src.items !== void 0) {
20026
- out.items = sanitizeGeminiSchemaNode(src.items, seen);
20027
- if (typeof out.type !== "string") out.type = "array";
20028
- }
20029
- if (typeof out.type !== "string") out.type = "object";
20030
- return out;
20031
- }
20032
- function convertOpenAiToolsToGemini(tools) {
20033
- if (!Array.isArray(tools) || tools.length === 0) return void 0;
20034
- const declarations = [];
20035
- for (const tool of tools) {
20036
- if (!tool || typeof tool !== "object" || !("function" in tool)) continue;
20037
- const fn3 = tool.function;
20038
- const name = typeof fn3.name === "string" ? fn3.name : "";
20039
- if (!name) continue;
20040
- declarations.push({
20041
- name,
20042
- description: typeof fn3.description === "string" ? fn3.description : "",
20043
- parameters: sanitizeGeminiSchemaNode(
20044
- fn3.parameters ?? { type: "object", properties: {} }
20045
- )
20046
- });
20047
- }
20048
- if (declarations.length === 0) return void 0;
20049
- return [{ functionDeclarations: declarations }];
20050
- }
20051
- function createGeminiAccumulatorState() {
20052
- return {
20053
- text: "",
20054
- toolCalls: [],
20055
- reasoning: "",
20056
- events: []
20057
- };
20058
- }
20059
- function applyGeminiChunk(chunk, state, options) {
20060
- if (!chunk || typeof chunk !== "object") return;
20061
- const response = "response" in chunk && chunk.response && typeof chunk.response === "object" ? chunk.response : chunk;
20062
- if ("usageMetadata" in response && response.usageMetadata && typeof response.usageMetadata === "object") {
20063
- const meta = response.usageMetadata;
20064
- const prompt = typeof meta.promptTokenCount === "number" ? meta.promptTokenCount : 0;
20065
- const candidates2 = typeof meta.candidatesTokenCount === "number" ? meta.candidatesTokenCount : 0;
20066
- const total = typeof meta.totalTokenCount === "number" ? meta.totalTokenCount : prompt + candidates2;
20067
- const cached3 = typeof meta.cachedContentTokenCount === "number" && Number.isFinite(meta.cachedContentTokenCount) ? (
20068
- // cached ⊆ prompt;对畸形上游防御性钳位,避免 cache_read > input 破坏归一化与计费
20069
- Math.min(Math.max(0, Math.floor(meta.cachedContentTokenCount)), prompt)
20070
- ) : 0;
20071
- state.usage = {
20072
- prompt_tokens: prompt,
20073
- completion_tokens: candidates2,
20074
- total_tokens: total,
20075
- ...cached3 > 0 ? { cache_read_input_tokens: cached3 } : {}
20076
- };
20077
- state.events.push({ kind: "usage", usage: state.usage });
20078
- }
20079
- const candidates = Array.isArray(response.candidates) ? response.candidates : [];
20080
- for (const candidate of candidates) {
20081
- if (!candidate || typeof candidate !== "object") continue;
20082
- const candidateFinishReason = candidate.finishReason;
20083
- if (typeof candidateFinishReason === "string" && candidateFinishReason.trim()) {
20084
- state.finishReason = candidateFinishReason.trim();
20085
- state.events.push({ kind: "finish", reason: state.finishReason });
20086
- }
20087
- const parts2 = Array.isArray(
20088
- candidate.content?.parts
20089
- ) ? candidate.content.parts : [];
20090
- for (const part of parts2) {
20091
- if (!part || typeof part !== "object") continue;
20092
- const partSignature = part.thoughtSignature;
20093
- const isThought = Boolean(part.thought);
20094
- if ("text" in part && typeof part.text === "string") {
20095
- const piece = part.text;
20096
- if (!isThought) {
20097
- state.text += piece;
20098
- if (piece) {
20099
- state.events.push({ kind: "text", text: piece });
20100
- if (options?.onTextDelta) options.onTextDelta(piece);
20101
- }
20102
- } else {
20103
- state.reasoning += piece;
20104
- if (piece) {
20105
- state.events.push({ kind: "reasoning", text: piece });
20106
- if (options?.onReasoningDelta) options.onReasoningDelta(piece);
20107
- }
20108
- }
20109
- }
20110
- if (isThought && typeof partSignature === "string" && partSignature) {
20111
- state.pendingThoughtSignature = partSignature;
20112
- }
20113
- if ("functionCall" in part && part.functionCall) {
20114
- const call = part.functionCall;
20115
- const name = typeof call.name === "string" ? call.name : "tool";
20116
- const id = typeof call.id === "string" ? call.id : `${name}_${state.toolCalls.length}`;
20117
- const argsObj = call.args && typeof call.args === "object" ? call.args : {};
20118
- const resolvedSignature = typeof partSignature === "string" && partSignature ? partSignature : state.pendingThoughtSignature;
20119
- state.pendingThoughtSignature = void 0;
20120
- const toolCall = {
20121
- id,
20122
- type: "function",
20123
- function: { name, arguments: JSON.stringify(argsObj) },
20124
- ...typeof resolvedSignature === "string" && resolvedSignature ? { thought_signature: resolvedSignature } : {}
20125
- };
20126
- state.toolCalls.push(toolCall);
20127
- state.events.push({ kind: "tool_call", toolCall });
20128
- }
20129
- }
20130
- }
20131
- }
20132
- function accumulateGeminiChunks(chunks2, options) {
20133
- const state = createGeminiAccumulatorState();
20134
- for (const chunk of chunks2) {
20135
- applyGeminiChunk(chunk, state, options);
20136
- }
20137
- return {
20138
- text: state.text,
20139
- toolCalls: state.toolCalls,
20140
- usage: state.usage,
20141
- finishReason: state.finishReason,
20142
- reasoningContent: state.reasoning,
20143
- events: state.events
20144
- };
20145
- }
20146
- async function accumulateGeminiStream(stream, options) {
20147
- const state = createGeminiAccumulatorState();
20148
- for await (const chunk of stream) {
20149
- applyGeminiChunk(chunk, state, options);
20150
- }
20151
- return {
20152
- text: state.text,
20153
- toolCalls: state.toolCalls,
20154
- usage: state.usage,
20155
- finishReason: state.finishReason,
20156
- reasoningContent: state.reasoning,
20157
- events: state.events
20158
- };
20159
- }
20160
- function shouldUseGeminiNativeToolRoute(provider, model, tools, isImageModel) {
20161
- return provider === "google" && !isImageModel(model) && isGemini3Model(model) && Array.isArray(tools) && tools.length > 0;
20162
- }
20163
- function buildGeminiGenerateContentRequest(args2) {
20164
- const { contents, systemTexts } = convertOpenAiMessagesToGemini(
20165
- args2.messages,
20166
- { attachSkipThoughtSignature: args2.attachSkipThoughtSignature }
20167
- );
20168
- const request3 = { contents };
20169
- if (systemTexts.length > 0) {
20170
- request3.systemInstruction = {
20171
- role: "user",
20172
- parts: systemTexts.map((text) => ({ text }))
20173
- };
20174
- }
20175
- const toolsResult = convertOpenAiToolsToGemini(args2.tools);
20176
- if (toolsResult) {
20177
- request3.tools = toolsResult;
20178
- request3.toolConfig = { functionCallingConfig: { mode: "AUTO" } };
20179
- }
20180
- const generationConfig = {};
20181
- if (typeof args2.maxTokens === "number" && args2.maxTokens > 0) {
20182
- generationConfig.maxOutputTokens = args2.maxTokens;
20183
- }
20184
- if (typeof args2.temperature === "number") {
20185
- generationConfig.temperature = args2.temperature;
20186
- }
20187
- if (Object.keys(generationConfig).length > 0) {
20188
- request3.generationConfig = generationConfig;
20189
- }
20190
- return request3;
20191
- }
20192
-
20193
- // packages/agent-runtime/antigravityCloudCodeProvider.ts
20194
- var STREAM_PATH = "/v1internal:streamGenerateContent?alt=sse";
20195
- function buildCloudCodeAssistPayload(args2) {
20196
- const projectId = readAntigravityProjectId(args2.metadata);
20197
- if (!projectId) {
20198
- throw new Error(
20199
- "Antigravity OAuth credential is missing metadata.projectId. Re-run `nolo auth antigravity`."
20200
- );
20201
- }
20202
- const logicalModel = asOptionalTrimmedString(args2.openAiBody.model) ?? asOptionalTrimmedString(args2.agentConfig.model) ?? "gemini-3.1-pro";
20203
- const { wireModelId: model, profile } = resolveAntigravityWireModel(logicalModel);
20204
- const rawMessages = Array.isArray(args2.openAiBody.messages) ? args2.openAiBody.messages : [];
20205
- const quirks = resolveGeminiModelQuirks(model);
20206
- const isClaude = quirks.isClaudeCrossModel;
20207
- const { contents, systemTexts } = convertOpenAiMessagesToGemini(rawMessages, {
20208
- attachSkipThoughtSignature: quirks.allowsThoughtSignatureSentinel
20209
- });
20210
- if (contents.length === 0) {
20211
- throw new Error("Antigravity Cloud Code Assist request has no user/model contents.");
20212
- }
20213
- const prompt = args2.agentConfig.prompt?.trim();
20214
- if (prompt) systemTexts.unshift(prompt);
20215
- const request3 = { contents };
20216
- if (systemTexts.length > 0) {
20217
- request3.systemInstruction = {
20218
- role: "user",
20219
- parts: systemTexts.map((text) => ({ text }))
20220
- };
20221
- }
20222
- const tools = convertOpenAiToolsToGemini(
20223
- Array.isArray(args2.openAiBody.tools) ? args2.openAiBody.tools : void 0
20224
- );
20225
- if (tools) {
20226
- request3.tools = tools;
20227
- request3.toolConfig = { functionCallingConfig: { mode: "AUTO" } };
20228
- }
20229
- const generationConfig = {};
20230
- if (profile?.maxOutputTokens) {
20231
- generationConfig.maxOutputTokens = profile.maxOutputTokens;
20232
- } else if (typeof args2.agentConfig.max_tokens === "number" && args2.agentConfig.max_tokens > 0) {
20233
- generationConfig.maxOutputTokens = args2.agentConfig.max_tokens;
20234
- }
20235
- if (typeof args2.agentConfig.temperature === "number") {
20236
- generationConfig.temperature = args2.agentConfig.temperature;
20237
- }
20238
- if (Object.keys(generationConfig).length > 0) {
20239
- request3.generationConfig = generationConfig;
20240
- }
20241
- const agentId = randomUUID();
20242
- const trajectoryId = randomUUID();
20243
- const step = 2;
20244
- const requestId = `agent/${agentId}/${Date.now()}/${trajectoryId}/${step}`;
20245
- const labels = {
20246
- trajectory_id: trajectoryId,
20247
- last_step_index: String(step - 1),
20248
- used_claude: String(isClaude),
20249
- used_claude_conservative: String(isClaude)
20250
- };
20251
- if (profile?.modelEnum) {
20252
- labels.model_enum = profile.modelEnum;
20253
- }
20254
- request3.labels = labels;
20255
- request3.sessionId = `-${Math.floor(Math.random() * 9e15)}`;
20256
- return {
20257
- url: `${resolveAntigravityCloudCodeBaseUrl(args2.agentConfig.customProviderUrl)}${STREAM_PATH}`,
20258
- envelope: {
20259
- project: projectId,
20260
- model,
20261
- request: request3,
20262
- requestId,
20263
- requestType: "agent",
20264
- userAgent: "antigravity"
20265
- }
20266
- };
20267
- }
20268
- function resolveAntigravityFinishReason(upstream) {
20269
- const normalized = (upstream ?? "").trim().toUpperCase();
20270
- if (normalized === "MAX_TOKENS") return "length";
20271
- if (normalized === "SAFETY" || normalized === "RECITATION" || normalized === "PROHIBITED_CONTENT" || normalized === "BLOCKLIST") {
20272
- return "content_filter";
20273
- }
20274
- return "stop";
20275
- }
20276
- function normalizeAntigravityCompletion(decoded) {
20277
- const { text, toolCalls, usage, finishReason, reasoningContent, events } = decoded;
20278
- const normalizedFinishReason = (finishReason ?? "").trim().toUpperCase();
20279
- if (!text && !reasoningContent && toolCalls.length === 0 && !finishReason && !usage) {
20280
- const body = {
20281
- error: {
20282
- message: "antigravity upstream returned an empty stream (no content, finishReason or usage); channel degradation, not model emptiness"
20283
- },
20284
- provider_events: events
20285
- };
20286
- return {
20287
- status: 502,
20288
- text: "",
20289
- toolCalls: [],
20290
- providerEvents: events,
20291
- body
20292
- };
20293
- }
20294
- if (normalizedFinishReason === "MALFORMED_FUNCTION_CALL") {
20295
- const message2 = "antigravity upstream returned MALFORMED_FUNCTION_CALL (model generated an invalid function call or tool arguments were rejected by upstream)";
20296
- const providerFailure = {
20297
- kind: "provider_failure",
20298
- provider: "antigravity",
20299
- code: "MALFORMED_FUNCTION_CALL",
20300
- message: message2,
20301
- providerReason: "MALFORMED_FUNCTION_CALL",
20302
- retryable: false,
20303
- status: 502
20304
- };
20305
- return {
20306
- status: 502,
20307
- text: "",
20308
- toolCalls: [],
20309
- finishReason,
20310
- providerEvents: events,
20311
- providerFailure,
20312
- runtimeProviderFailure: {
20313
- message: providerFailure.message,
20314
- retryable: providerFailure.retryable
20315
- },
20316
- body: {
20317
- error: {
20318
- message: message2,
20319
- code: "MALFORMED_FUNCTION_CALL",
20320
- category: "malformed_function_call",
20321
- providerReason: "MALFORMED_FUNCTION_CALL",
20322
- retryable: false
20323
- },
20324
- provider_failure: providerFailure,
20325
- provider_events: events
20326
- }
20327
- };
20328
- }
20329
- const message = {
20330
- role: "assistant",
20331
- content: text || null
20332
- };
20333
- if (toolCalls.length > 0) message.tool_calls = toolCalls;
20334
- if (reasoningContent) message.reasoning_content = reasoningContent;
20335
- return {
20336
- status: 200,
20337
- text,
20338
- ...reasoningContent ? { reasoningContent } : {},
20339
- toolCalls,
20340
- ...usage ? { usage } : {},
20341
- ...finishReason ? { finishReason } : {},
20342
- providerEvents: events,
20343
- body: {
20344
- choices: [{
20345
- index: 0,
20346
- message,
20347
- finish_reason: toolCalls.length > 0 ? "tool_calls" : resolveAntigravityFinishReason(finishReason)
20348
- }],
20349
- ...usage ? { usage } : {},
20350
- provider_events: events
20351
- }
20352
- };
20353
- }
20354
- async function fetchAntigravityCloudCodeCompletion(args2) {
20355
- const fetchImpl = args2.fetchImpl ?? fetch;
20356
- const { url, envelope } = buildCloudCodeAssistPayload(args2);
20357
- const response = await fetchImpl(url, {
20358
- method: "POST",
20359
- headers: {
20360
- Authorization: `Bearer ${args2.accessToken}`,
20361
- "Content-Type": "application/json",
20362
- "User-Agent": getAntigravityUserAgent()
20363
- },
20364
- body: JSON.stringify(envelope),
20365
- signal: args2.signal
20366
- });
20367
- if (!response.ok) {
20368
- const errorText = await response.text();
20369
- return {
20370
- status: response.status,
20371
- text: "",
20372
- toolCalls: [],
20373
- providerEvents: [],
20374
- // 保留上游结构:Antigravity 的限流 body 同样携带结构化的重置信息,
20375
- // 压成字符串会让冷却退化成 5 分钟默认值。
20376
- body: parseUpstreamErrorBody(errorText, response.statusText)
20377
- };
20378
- }
20379
- const chunkStream = streamSseDataValues(response, parseSseDataLineJson);
20380
- const { text, toolCalls, usage, finishReason, reasoningContent, events } = await accumulateGeminiStream(chunkStream, {
20381
- onTextDelta: args2.onTextDelta,
20382
- onReasoningDelta: args2.onReasoningDelta
20383
- });
20384
- const normalized = normalizeAntigravityCompletion({
20385
- text,
20386
- toolCalls,
20387
- usage,
20388
- finishReason,
20389
- reasoningContent,
20390
- events
20391
- });
20392
- if (normalized.status !== 200 || !text && toolCalls.length === 0) {
20393
- console.warn(
20394
- `[antigravity] empty completion: finishReason=${JSON.stringify(finishReason)} reasoningLen=${reasoningContent?.length ?? 0} usage=${JSON.stringify(usage) ?? "none"} model=${String(envelope.model)} base=${new URL(url).host}`
20395
- );
20396
- }
20397
- return normalized;
20398
- }
20399
-
20400
19652
  // packages/agent-runtime/devin/devinProvider.ts
20401
- import { randomBytes, randomUUID as randomUUID2 } from "node:crypto";
19653
+ import { randomBytes, randomUUID } from "node:crypto";
20402
19654
  var CLIENT_NAME = "chisel";
20403
19655
  var CLIENT_VERSION = "2026.8.18";
20404
19656
  function writeVarint(fieldNum, value) {
@@ -20460,7 +19712,7 @@ function encodeDevinClientMetadata(token) {
20460
19712
  function encodeDevinChatMessage(msg) {
20461
19713
  const source = msg.role === "assistant" ? 2 : msg.role === "tool" ? 4 : 1;
20462
19714
  return Buffer.concat([
20463
- writeStringField(1, randomUUID2()),
19715
+ writeStringField(1, randomUUID()),
20464
19716
  writeVarint(2, source),
20465
19717
  writeStringField(3, msg.text),
20466
19718
  ...(msg.toolCalls ?? []).map(
@@ -20548,7 +19800,7 @@ ${item.text}`;
20548
19800
  const chatMessageBuffers = coalesced.map((m) => encodeDevinChatMessage(m));
20549
19801
  const completionConfig = buildCompletionConfig({ temperature });
20550
19802
  const modelConfig = Buffer.concat([
20551
- writeStringField(1, randomUUID2()),
19803
+ writeStringField(1, randomUUID()),
20552
19804
  writeVarint(2, 1),
20553
19805
  writeVarint(3, 4)
20554
19806
  ]);
@@ -20560,7 +19812,7 @@ ${item.text}`;
20560
19812
  writeMessageField(8, completionConfig),
20561
19813
  ...tools.map((tool) => writeMessageField(10, encodeDevinToolDefinition(tool))),
20562
19814
  writeMessageField(15, modelConfig),
20563
- writeStringField(16, randomUUID2()),
19815
+ writeStringField(16, randomUUID()),
20564
19816
  writeVarint(20, 1),
20565
19817
  writeStringField(21, model)
20566
19818
  ]);
@@ -20934,8 +20186,6 @@ export {
20934
20186
  LOCAL_AGENT_CONFIG_MISSING_CODE,
20935
20187
  LOCAL_TURN_ABORTED_CODE,
20936
20188
  runLocalAgentTurn,
20937
- parseSseDataLineJson,
20938
- parseSseDataLineObject,
20939
20189
  codexStreamFailureStatus,
20940
20190
  aggregateResponsesStream,
20941
20191
  buildOpenAiCompatibleChatCompletionRequest,
@@ -20969,13 +20219,6 @@ export {
20969
20219
  buildLocalDialogWritePlan,
20970
20220
  buildNoloWorkspaceCliToolExecutors,
20971
20221
  buildLoadSkillExecutor,
20972
- parseUpstreamErrorBody,
20973
- isGemini3Model,
20974
- accumulateGeminiChunks,
20975
- shouldUseGeminiNativeToolRoute,
20976
- buildGeminiGenerateContentRequest,
20977
- resolveAntigravityFinishReason,
20978
- fetchAntigravityCloudCodeCompletion,
20979
20222
  readDevinUpstreamFailure,
20980
20223
  createDevinProvider
20981
20224
  };