@google/gemini-cli 0.47.0-nightly.20260609.g0567b25a2 → 0.47.0

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 (67) hide show
  1. package/bundle/builtin/antigravity-support/SKILL.md +58 -0
  2. package/bundle/{chunk-2CIX5Q6A.js → chunk-2KWNCPLL.js} +2 -2
  3. package/bundle/{chunk-EMUTS6IK.js → chunk-2Q4476DN.js} +1 -1
  4. package/bundle/{chunk-WKBFPVMG.js → chunk-4GCG36AT.js} +1 -1
  5. package/bundle/{chunk-DCTGU54Z.js → chunk-6KE4CNFS.js} +1 -1
  6. package/bundle/{chunk-GCIN3SBW.js → chunk-6LT65VVT.js} +1 -1
  7. package/bundle/{chunk-2QJY5FON.js → chunk-BBNWCBRR.js} +1 -1
  8. package/bundle/{chunk-EHNTNNG7.js → chunk-CNIL75JT.js} +2 -2
  9. package/bundle/{chunk-UWRWOGGE.js → chunk-DXBHZ3TN.js} +8 -9
  10. package/bundle/{chunk-PL643LQI.js → chunk-FBADLP6O.js} +1 -1
  11. package/bundle/{chunk-AAUTETSH.js → chunk-FXI4U6PC.js} +2 -2
  12. package/bundle/{chunk-HP476PBA.js → chunk-HQ3WN6AK.js} +2 -2
  13. package/bundle/{chunk-I5A5X2DX.js → chunk-HR72IGHE.js} +165 -114
  14. package/bundle/{chunk-C6JF7KUM.js → chunk-JW7ZLS43.js} +474 -369
  15. package/bundle/{chunk-LUEQKTRO.js → chunk-L2MPIDNJ.js} +1 -1
  16. package/bundle/{chunk-LRU4AG5Z.js → chunk-LYEXSPQM.js} +6 -9
  17. package/bundle/{chunk-IZHHDHX6.js → chunk-M6POVUEU.js} +2 -2
  18. package/bundle/{chunk-BN4LGSIP.js → chunk-OF4FXFRD.js} +165 -114
  19. package/bundle/{chunk-QRLOGZOF.js → chunk-QIXRZAM6.js} +14529 -7889
  20. package/bundle/{chunk-AEYK5HWH.js → chunk-SBG6CUNK.js} +453 -355
  21. package/bundle/{chunk-4HDJHI5R.js → chunk-TG7JXYWL.js} +3 -3
  22. package/bundle/{chunk-IZ2I7Q2U.js → chunk-VIAOQQWI.js} +3 -3
  23. package/bundle/{chunk-2T3UO3GD.js → chunk-WSPZQ6DG.js} +212 -174
  24. package/bundle/{chunk-J3HLXOXQ.js → chunk-YYVEOJOI.js} +1 -1
  25. package/bundle/{chunk-BQBAQ2Q3.js → chunk-ZH37ZXAY.js} +3 -3
  26. package/bundle/{cleanup-FLYMRJHN.js → cleanup-3B3REU73.js} +2 -2
  27. package/bundle/{cleanup-MGYBYNJH.js → cleanup-GEKT3TY7.js} +2 -2
  28. package/bundle/{cleanup-Q3IUYRFR.js → cleanup-YLDEE5FO.js} +2 -2
  29. package/bundle/{core-HEUZ5HF5.js → core-HFORMEVY.js} +9 -1
  30. package/bundle/{dist-CE4H7NUW.js → core-ZX62TRQZ.js} +9 -1
  31. package/bundle/{devtoolsService-2HWL5NFR.js → devtoolsService-PHAD4RFS.js} +2 -2
  32. package/bundle/{devtoolsService-G6QHDK2R.js → devtoolsService-VQNGMCMU.js} +2 -2
  33. package/bundle/{devtoolsService-6L5OLG5H.js → devtoolsService-XFCKGUDN.js} +3 -4
  34. package/bundle/{dist-I7YW7PD5.js → dist-UINE5I5P.js} +9 -1
  35. package/bundle/{gemini-HILUTGAC.js → gemini-FOEJAXHE.js} +14 -14
  36. package/bundle/{gemini-COTZTFOT.js → gemini-PDNY7O5B.js} +14 -14
  37. package/bundle/{gemini-JJPFCGRS.js → gemini-VTIJURKH.js} +196 -212
  38. package/bundle/gemini.js +7 -7
  39. package/bundle/{interactiveCli-LZI7JXIK.js → interactiveCli-5LZR6JYR.js} +44 -20
  40. package/bundle/{interactiveCli-ZLNOSGX5.js → interactiveCli-EEVGQBIN.js} +44 -20
  41. package/bundle/{interactiveCli-4HTU7R6H.js → interactiveCli-ZHNRZVK3.js} +331 -326
  42. package/bundle/{liteRtServerManager-3E5GRFLO.js → liteRtServerManager-CCZNRFEE.js} +4 -4
  43. package/bundle/{liteRtServerManager-76QFKETH.js → liteRtServerManager-L63JEWQK.js} +4 -4
  44. package/bundle/{liteRtServerManager-OJD3HSWN.js → liteRtServerManager-QEGKNHBK.js} +4 -4
  45. package/bundle/{oauth2-provider-XWGCFTD2.js → oauth2-provider-7VJY4VWP.js} +1 -1
  46. package/bundle/{oauth2-provider-HPJFIAG6.js → oauth2-provider-D3K72R73.js} +1 -1
  47. package/bundle/{oauth2-provider-HWRKMSF7.js → oauth2-provider-NJB6EG2W.js} +72 -38
  48. package/bundle/{start-3DT6X44L.js → start-EDWM2AMD.js} +6 -6
  49. package/bundle/{start-BX2QHAEC.js → start-RGSZYXG3.js} +6 -6
  50. package/bundle/{start-Q4WEY7Z6.js → start-TZSG66O4.js} +6 -6
  51. package/package.json +1 -1
  52. package/bundle/chunk-3JPECJG6.js +0 -398
  53. package/bundle/chunk-DCUISZSY.js +0 -118
  54. package/bundle/chunk-H6BD5ZKD.js +0 -512
  55. package/bundle/chunk-MSM65VWS.js +0 -17320
  56. package/bundle/chunk-OT53DK2V.js +0 -154
  57. package/bundle/chunk-SO6BWWGF.js +0 -81685
  58. package/bundle/chunk-WVAJOJDO.js +0 -1571
  59. package/bundle/chunk-ZZMWIUE5.js +0 -394571
  60. package/bundle/cleanup-UN4WQ3DJ.js +0 -32
  61. package/bundle/devtoolsService-LPQTHDXY.js +0 -856
  62. package/bundle/dist-SYYTVWDP.js +0 -2140
  63. package/bundle/gemini-NQMNY7AW.js +0 -16409
  64. package/bundle/interactiveCli-6NPEXVAG.js +0 -34742
  65. package/bundle/liteRtServerManager-OXYRVBA4.js +0 -65
  66. package/bundle/oauth2-provider-WJGZJ73D.js +0 -235
  67. package/bundle/start-Z54XBIIY.js +0 -18
@@ -276060,6 +276060,9 @@ function isActiveModel(model, useGemini3_1 = false, useCustomToolModel = false,
276060
276060
  return model !== PREVIEW_GEMINI_3_1_MODEL && model !== PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL;
276061
276061
  }
276062
276062
  }
276063
+ var CCPA_AI_MODEL_MAPPINGS = {
276064
+ [DEFAULT_GEMINI_3_5_FLASH_MODEL]: SECONDARY_GEMINI_3_5_FLASH_MODEL
276065
+ };
276063
276066
 
276064
276067
  // packages/core/dist/src/billing/billing.js
276065
276068
  var G1_CREDIT_TYPE = "GOOGLE_ONE_AI";
@@ -279300,8 +279303,8 @@ function isValidToolName(name3, options = {}) {
279300
279303
  }
279301
279304
 
279302
279305
  // packages/core/dist/src/generated/git-commit.js
279303
- var GIT_COMMIT_INFO = "0567b25a2";
279304
- var CLI_VERSION = "0.47.0-nightly.20260602.gcfcecebe8";
279306
+ var GIT_COMMIT_INFO = "74c6d8e02";
279307
+ var CLI_VERSION = "0.47.0";
279305
279308
 
279306
279309
  // packages/core/dist/src/ide/detect-ide.js
279307
279310
  var IDE_DEFINITIONS = {
@@ -281640,6 +281643,322 @@ async function deleteStoredSession(config2, sessionIdOrBasename) {
281640
281643
  // packages/core/dist/src/services/chatRecordingService.js
281641
281644
  import readline4 from "node:readline";
281642
281645
  import { randomUUID as randomUUID4 } from "node:crypto";
281646
+
281647
+ // packages/core/dist/src/utils/partUtils.js
281648
+ function partToString(value, options) {
281649
+ if (!value) {
281650
+ return "";
281651
+ }
281652
+ if (typeof value === "string") {
281653
+ return value;
281654
+ }
281655
+ if (Array.isArray(value)) {
281656
+ return value.map((part2) => partToString(part2, options)).join("");
281657
+ }
281658
+ const part = value;
281659
+ if (options?.verbose) {
281660
+ if (part.videoMetadata !== void 0) {
281661
+ return `[Video Metadata]`;
281662
+ }
281663
+ if (part.thought !== void 0) {
281664
+ return `[Thought: ${part.thought}]`;
281665
+ }
281666
+ if (part.codeExecutionResult !== void 0) {
281667
+ return `[Code Execution Result]`;
281668
+ }
281669
+ if (part.executableCode !== void 0) {
281670
+ return `[Executable Code]`;
281671
+ }
281672
+ if (part.fileData !== void 0) {
281673
+ return `[File Data]`;
281674
+ }
281675
+ if (part.functionCall !== void 0) {
281676
+ return `[Function Call: ${part.functionCall.name}]`;
281677
+ }
281678
+ if (part.functionResponse !== void 0) {
281679
+ return `[Function Response: ${part.functionResponse.name}]`;
281680
+ }
281681
+ if (part.inlineData !== void 0) {
281682
+ const mimeType = part.inlineData.mimeType ?? "unknown";
281683
+ const data = part.inlineData.data ?? "";
281684
+ const bytes = Math.ceil(data.length * 3 / 4);
281685
+ const kb = (bytes / 1024).toFixed(1);
281686
+ const category = mimeType.startsWith("audio/") ? "Audio" : mimeType.startsWith("video/") ? "Video" : mimeType.startsWith("image/") ? "Image" : "Media";
281687
+ return `[${category}: ${mimeType}, ${kb} KB]`;
281688
+ }
281689
+ }
281690
+ return part.text ?? "";
281691
+ }
281692
+ function clonePart(part) {
281693
+ return { ...part };
281694
+ }
281695
+ function updatePart(part, updates) {
281696
+ return { ...part, ...updates };
281697
+ }
281698
+ function cloneFunctionResponse(resp) {
281699
+ return { ...resp };
281700
+ }
281701
+ function cloneFunctionCall(call) {
281702
+ return { ...call };
281703
+ }
281704
+ function getResponseText(response) {
281705
+ if (response.candidates && response.candidates.length > 0) {
281706
+ const candidate = response.candidates[0];
281707
+ if (candidate.content && candidate.content.parts && candidate.content.parts.length > 0) {
281708
+ return candidate.content.parts.filter((part) => part.text && !part.thought).map((part) => part.text).join("");
281709
+ }
281710
+ }
281711
+ return null;
281712
+ }
281713
+ async function flatMapTextParts(parts2, transform2) {
281714
+ const result2 = [];
281715
+ const partArray = Array.isArray(parts2) ? parts2 : typeof parts2 === "string" ? [{ text: parts2 }] : [parts2];
281716
+ for (const part of partArray) {
281717
+ let textToProcess;
281718
+ if (typeof part === "string") {
281719
+ textToProcess = part;
281720
+ } else if ("text" in part) {
281721
+ textToProcess = part.text;
281722
+ }
281723
+ if (textToProcess !== void 0) {
281724
+ const transformedParts = await transform2(textToProcess);
281725
+ result2.push(...transformedParts);
281726
+ } else {
281727
+ result2.push(part);
281728
+ }
281729
+ }
281730
+ return result2;
281731
+ }
281732
+ function appendToLastTextPart(prompt, textToAppend, separator = "\n\n") {
281733
+ if (!textToAppend) {
281734
+ return prompt;
281735
+ }
281736
+ if (prompt.length === 0) {
281737
+ return [{ text: textToAppend }];
281738
+ }
281739
+ const newPrompt = [...prompt];
281740
+ const lastPart = newPrompt.at(-1);
281741
+ if (typeof lastPart === "string") {
281742
+ newPrompt[newPrompt.length - 1] = `${lastPart}${separator}${textToAppend}`;
281743
+ } else if (lastPart && "text" in lastPart) {
281744
+ newPrompt[newPrompt.length - 1] = {
281745
+ ...lastPart,
281746
+ text: `${lastPart.text}${separator}${textToAppend}`
281747
+ };
281748
+ } else {
281749
+ newPrompt.push({ text: `${separator}${textToAppend}` });
281750
+ }
281751
+ return newPrompt;
281752
+ }
281753
+ function isTextPart(part) {
281754
+ return typeof part === "object" && part !== null && "text" in part && typeof part.text === "string";
281755
+ }
281756
+
281757
+ // packages/core/dist/src/core/geminiRequest.js
281758
+ function partListUnionToString(value) {
281759
+ return partToString(value, { verbose: true });
281760
+ }
281761
+
281762
+ // packages/core/dist/src/core/agentChatHistory.js
281763
+ var AgentChatHistory = class {
281764
+ history = [];
281765
+ constructor(initialTurns = []) {
281766
+ this.history = [...initialTurns];
281767
+ }
281768
+ /**
281769
+ * Adds a new turn to the history.
281770
+ * Every turn must have a durable ID, usually provided by the ChatRecordingService.
281771
+ */
281772
+ push(turn) {
281773
+ this.history.push(turn);
281774
+ }
281775
+ /**
281776
+ * Overwrites the entire history with a new list of turns.
281777
+ */
281778
+ set(turns) {
281779
+ this.history = [...turns];
281780
+ }
281781
+ clear() {
281782
+ this.history = [];
281783
+ }
281784
+ get() {
281785
+ return this.history;
281786
+ }
281787
+ /**
281788
+ * Returns a copy of the raw Gemini Content[] for API consumption.
281789
+ */
281790
+ getContents() {
281791
+ return this.history.map((h3) => h3.content);
281792
+ }
281793
+ map(callback) {
281794
+ return this.history.map(callback);
281795
+ }
281796
+ flatMap(callback) {
281797
+ return this.history.flatMap(callback);
281798
+ }
281799
+ get length() {
281800
+ return this.history.length;
281801
+ }
281802
+ };
281803
+
281804
+ // packages/core/dist/src/utils/cryptoUtils.js
281805
+ import { createHash as createHash4 } from "node:crypto";
281806
+ function deriveStableId(sourceIds) {
281807
+ const sortedIds = [...sourceIds].sort();
281808
+ return createHash4("sha256").update(sortedIds.join("|")).digest("hex").slice(0, 32);
281809
+ }
281810
+
281811
+ // packages/core/dist/src/utils/sessionUtils.js
281812
+ function ensureStableToolIds(history) {
281813
+ for (let i4 = 0; i4 < history.length; i4++) {
281814
+ const turn = history[i4];
281815
+ const parts2 = turn.content.parts || [];
281816
+ for (let partIdx = 0; partIdx < parts2.length; partIdx++) {
281817
+ const part = parts2[partIdx];
281818
+ if (part.functionCall && !part.functionCall.id) {
281819
+ const name3 = part.functionCall.name;
281820
+ const nextTurn = history[i4 + 1];
281821
+ let pairedId;
281822
+ if (nextTurn?.content.role === "user") {
281823
+ const matchingResp = nextTurn.content.parts?.find((p2) => p2.functionResponse && p2.functionResponse.name === name3 && !p2.functionResponse.id);
281824
+ if (matchingResp) {
281825
+ pairedId = `synth_${name3}_${deriveStableId([turn.id, i4.toString(), partIdx.toString()])}`;
281826
+ part.functionCall.id = pairedId;
281827
+ matchingResp.functionResponse.id = pairedId;
281828
+ }
281829
+ }
281830
+ if (!part.functionCall.id) {
281831
+ part.functionCall.id = `synth_${name3}_${deriveStableId([turn.id, i4.toString(), partIdx.toString()])}`;
281832
+ }
281833
+ }
281834
+ if (part.functionResponse && !part.functionResponse.id) {
281835
+ const name3 = part.functionResponse.name;
281836
+ const prevTurn = history[i4 - 1];
281837
+ if (prevTurn?.content.role === "model") {
281838
+ const matchingCall = prevTurn.content.parts?.find((p2) => p2.functionCall && p2.functionCall.name === name3 && !p2.functionCall.id);
281839
+ if (matchingCall) {
281840
+ const pairedId = `synth_${name3}_${deriveStableId([prevTurn.id, (i4 - 1).toString(), partIdx.toString()])}`;
281841
+ matchingCall.functionCall.id = pairedId;
281842
+ part.functionResponse.id = pairedId;
281843
+ }
281844
+ }
281845
+ if (!part.functionResponse.id) {
281846
+ part.functionResponse.id = `synth_orph_${name3}_${deriveStableId([turn.id, i4.toString(), partIdx.toString()])}`;
281847
+ }
281848
+ }
281849
+ }
281850
+ }
281851
+ }
281852
+ function ensurePartArray(content) {
281853
+ if (Array.isArray(content)) {
281854
+ return content.map((part) => typeof part === "string" ? { text: part } : part);
281855
+ }
281856
+ if (typeof content === "string") {
281857
+ return [{ text: content }];
281858
+ }
281859
+ return [content];
281860
+ }
281861
+ function isIgnoredUserContent(trimmedContent) {
281862
+ return trimmedContent.length === 0 || trimmedContent.startsWith("/") || trimmedContent.startsWith("?") || trimmedContent.startsWith("<session_context>") || trimmedContent.startsWith("<hook_context>");
281863
+ }
281864
+ function convertSessionToClientHistory(messages) {
281865
+ const clientHistory = [];
281866
+ for (const msg of messages) {
281867
+ if (msg.type === "info" || msg.type === "error" || msg.type === "warning") {
281868
+ continue;
281869
+ }
281870
+ if (msg.type === "user") {
281871
+ const contentString = partListUnionToString(msg.content);
281872
+ const trimmedContent = contentString.trim();
281873
+ if (isIgnoredUserContent(trimmedContent)) {
281874
+ continue;
281875
+ }
281876
+ clientHistory.push({
281877
+ id: msg.id,
281878
+ content: {
281879
+ role: "user",
281880
+ parts: ensurePartArray(msg.content)
281881
+ }
281882
+ });
281883
+ } else if (msg.type === "gemini") {
281884
+ const modelParts = [];
281885
+ const contentParts = msg.content ? ensurePartArray(msg.content) : [];
281886
+ const hasCallsInContent = contentParts.some((p2) => !!p2.functionCall);
281887
+ const hasThoughtsInContent = contentParts.some((p2) => p2.thought);
281888
+ if (hasCallsInContent || hasThoughtsInContent) {
281889
+ modelParts.push(...contentParts);
281890
+ } else {
281891
+ if (msg.thoughts && msg.thoughts.length > 0) {
281892
+ for (const thought of msg.thoughts) {
281893
+ const thoughtText = thought.subject ? `**${thought.subject}** ${thought.description}` : thought.description;
281894
+ modelParts.push({
281895
+ text: thoughtText,
281896
+ thought: true
281897
+ });
281898
+ }
281899
+ }
281900
+ modelParts.push(...contentParts);
281901
+ if (msg.toolCalls && msg.toolCalls.length > 0) {
281902
+ for (const toolCall of msg.toolCalls) {
281903
+ modelParts.push({
281904
+ functionCall: {
281905
+ id: toolCall.id,
281906
+ name: toolCall.name,
281907
+ args: toolCall.args
281908
+ }
281909
+ });
281910
+ }
281911
+ }
281912
+ }
281913
+ if (modelParts.length > 0) {
281914
+ clientHistory.push({
281915
+ id: msg.id,
281916
+ content: {
281917
+ role: "model",
281918
+ parts: modelParts
281919
+ }
281920
+ });
281921
+ if (msg.toolCalls && msg.toolCalls.length > 0) {
281922
+ const functionResponseParts = [];
281923
+ for (const toolCall of msg.toolCalls) {
281924
+ if (toolCall.result) {
281925
+ let responseData;
281926
+ if (typeof toolCall.result === "string") {
281927
+ responseData = {
281928
+ functionResponse: {
281929
+ id: toolCall.id,
281930
+ name: toolCall.name,
281931
+ response: {
281932
+ output: toolCall.result
281933
+ }
281934
+ }
281935
+ };
281936
+ } else if (Array.isArray(toolCall.result)) {
281937
+ functionResponseParts.push(...ensurePartArray(toolCall.result));
281938
+ continue;
281939
+ } else {
281940
+ responseData = toolCall.result;
281941
+ }
281942
+ functionResponseParts.push(responseData);
281943
+ }
281944
+ }
281945
+ if (functionResponseParts.length > 0) {
281946
+ clientHistory.push({
281947
+ id: `${msg.id}_response`,
281948
+ content: {
281949
+ role: "user",
281950
+ parts: functionResponseParts
281951
+ }
281952
+ });
281953
+ }
281954
+ }
281955
+ }
281956
+ }
281957
+ }
281958
+ return clientHistory;
281959
+ }
281960
+
281961
+ // packages/core/dist/src/services/chatRecordingService.js
281643
281962
  var ENOSPC_WARNING_MESSAGE = "Chat recording disabled: No space left on device. The conversation will continue but will not be saved to disk. Free up disk space and restart to enable recording.";
281644
281963
  function hasProperty(obj, prop) {
281645
281964
  return obj !== null && typeof obj === "object" && prop in obj;
@@ -281662,9 +281981,22 @@ function isMetadataUpdateRecord(record2) {
281662
281981
  function isPartialMetadataRecord(record2) {
281663
281982
  return isStringProperty(record2, "sessionId") && isStringProperty(record2, "projectHash");
281664
281983
  }
281665
- function isTextPart(part) {
281984
+ function isTextPart2(part) {
281666
281985
  return isStringProperty(part, "text");
281667
281986
  }
281987
+ function isResumableMessageRecord(message) {
281988
+ const contentString = message.content ? partListUnionToString(message.content) : "";
281989
+ if (message.type === "user") {
281990
+ return !isIgnoredUserContent(contentString.trim());
281991
+ }
281992
+ if (message.type === "gemini") {
281993
+ return contentString.trim().length > 0 || (message.toolCalls?.length ?? 0) > 0 || (message.thoughts?.length ?? 0) > 0;
281994
+ }
281995
+ return false;
281996
+ }
281997
+ function hasResumableConversationContent(messages) {
281998
+ return messages.some((message) => isResumableMessageRecord(message));
281999
+ }
281668
282000
  async function loadConversationRecord(filePath, options) {
281669
282001
  if (!fs30.existsSync(filePath)) {
281670
282002
  return null;
@@ -281726,15 +282058,15 @@ async function loadConversationRecord(filePath, options) {
281726
282058
  }
281727
282059
  const id = record2.id;
281728
282060
  const isUser = hasProperty(record2, "type") && record2.type === "user";
281729
- const isUserOrAssistant = hasProperty(record2, "type") && (record2.type === "user" || record2.type === "gemini");
282061
+ const isResumable = isResumableMessageRecord(record2);
281730
282062
  if (options?.metadataOnly) {
281731
282063
  messageIds.push(id);
281732
- messageKinds.set(id, { isUser, isUserOrAssistant });
282064
+ messageKinds.set(id, { isUser, isResumable });
281733
282065
  }
281734
- if (!firstUserMessageStr && isUser && hasProperty(record2, "content") && record2["content"]) {
282066
+ if (!firstUserMessageStr && isUser && hasProperty(record2, "content") && record2["content"] && isResumable) {
281735
282067
  const rawContent = record2["content"];
281736
282068
  if (Array.isArray(rawContent)) {
281737
- firstUserMessageStr = rawContent.map((p2) => isTextPart(p2) ? p2["text"] : "").join("");
282069
+ firstUserMessageStr = rawContent.map((p2) => isTextPart2(p2) ? p2["text"] : "").join("");
281738
282070
  } else if (typeof rawContent === "string") {
281739
282071
  firstUserMessageStr = rawContent;
281740
282072
  }
@@ -281762,16 +282094,19 @@ async function loadConversationRecord(filePath, options) {
281762
282094
  if (isMessageRecord(msg)) {
281763
282095
  const id = msg.id;
281764
282096
  const isUser = msg.type === "user";
281765
- const isUserOrAssistant = msg.type === "user" || msg.type === "gemini";
282097
+ const isResumable = isResumableMessageRecord(msg);
281766
282098
  if (options?.metadataOnly) {
281767
282099
  messageIds.push(id);
281768
- messageKinds.set(id, { isUser, isUserOrAssistant });
282100
+ messageKinds.set(id, {
282101
+ isUser,
282102
+ isResumable
282103
+ });
281769
282104
  } else {
281770
282105
  messagesMap.set(id, msg);
281771
282106
  }
281772
- if (!firstUserMessageStr && isUser && msg.content && (Array.isArray(msg.content) || typeof msg.content === "string")) {
282107
+ if (!firstUserMessageStr && isUser && isResumable && msg.content && (Array.isArray(msg.content) || typeof msg.content === "string")) {
281773
282108
  if (Array.isArray(msg.content)) {
281774
- firstUserMessageStr = msg.content.map((p2) => isTextPart(p2) ? p2.text : "").join("");
282109
+ firstUserMessageStr = msg.content.map((p2) => isTextPart2(p2) ? p2.text : "").join("");
281775
282110
  } else {
281776
282111
  firstUserMessageStr = msg.content;
281777
282112
  }
@@ -281790,16 +282125,19 @@ async function loadConversationRecord(filePath, options) {
281790
282125
  if (isMessageRecord(msg)) {
281791
282126
  const id = msg.id;
281792
282127
  const isUser = msg.type === "user";
281793
- const isUserOrAssistant = msg.type === "user" || msg.type === "gemini";
282128
+ const isResumable = isResumableMessageRecord(msg);
281794
282129
  if (options?.metadataOnly) {
281795
282130
  messageIds.push(id);
281796
- messageKinds.set(id, { isUser, isUserOrAssistant });
282131
+ messageKinds.set(id, {
282132
+ isUser,
282133
+ isResumable
282134
+ });
281797
282135
  } else {
281798
282136
  messagesMap.set(id, msg);
281799
282137
  }
281800
- if (!firstUserMessageStr && isUser && msg.content && (Array.isArray(msg.content) || typeof msg.content === "string")) {
282138
+ if (!firstUserMessageStr && isUser && isResumable && msg.content && (Array.isArray(msg.content) || typeof msg.content === "string")) {
281801
282139
  if (Array.isArray(msg.content)) {
281802
- firstUserMessageStr = msg.content.map((p2) => isTextPart(p2) ? p2.text : "").join("");
282140
+ firstUserMessageStr = msg.content.map((p2) => isTextPart2(p2) ? p2.text : "").join("");
281803
282141
  } else {
281804
282142
  firstUserMessageStr = msg.content;
281805
282143
  }
@@ -281815,18 +282153,18 @@ async function loadConversationRecord(filePath, options) {
281815
282153
  return await parseLegacyRecordFallback(filePath, options);
281816
282154
  }
281817
282155
  const loadedMessages = Array.from(messagesMap.values());
281818
- const metadataFirstUserMessage = loadedMessages.find((message) => message.type === "user") ?? null;
282156
+ const metadataFirstUserMessage = loadedMessages.find((message) => message.type === "user" && isResumableMessageRecord(message)) ?? null;
281819
282157
  let fallbackFirstUserMessage = firstUserMessageStr;
281820
282158
  if (!fallbackFirstUserMessage && metadataFirstUserMessage) {
281821
282159
  const rawContent = metadataFirstUserMessage.content;
281822
282160
  if (Array.isArray(rawContent)) {
281823
- fallbackFirstUserMessage = rawContent.map((part) => isTextPart(part) ? part["text"] : "").join("");
282161
+ fallbackFirstUserMessage = rawContent.map((part) => isTextPart2(part) ? part["text"] : "").join("");
281824
282162
  } else if (typeof rawContent === "string") {
281825
282163
  fallbackFirstUserMessage = rawContent;
281826
282164
  }
281827
282165
  }
281828
282166
  const userMessageCount = options?.metadataOnly ? Array.from(messageKinds.values()).filter((m) => m.isUser).length : loadedMessages.filter((m) => m.type === "user").length;
281829
- const hasUserOrAssistant = options?.metadataOnly ? Array.from(messageKinds.values()).some((m) => m.isUserOrAssistant) : loadedMessages.some((m) => m.type === "user" || m.type === "gemini");
282167
+ const hasResumableContent = options?.metadataOnly ? Array.from(messageKinds.values()).some((m) => m.isResumable) : hasResumableConversationContent(loadedMessages);
281830
282168
  return {
281831
282169
  sessionId: metadata2.sessionId,
281832
282170
  projectHash: metadata2.projectHash,
@@ -281841,7 +282179,7 @@ async function loadConversationRecord(filePath, options) {
281841
282179
  userMessageCount,
281842
282180
  memoryScratchpadIsStale: isTrackingMemoryScratchpadFreshness ? memoryScratchpadIsStale : void 0,
281843
282181
  firstUserMessage: fallbackFirstUserMessage,
281844
- hasUserOrAssistantMessage: hasUserOrAssistant
282182
+ hasResumableContent
281845
282183
  };
281846
282184
  } catch (error40) {
281847
282185
  debugLogger.error("Error loading conversation record from JSONL:", error40);
@@ -282173,6 +282511,20 @@ var ChatRecordingService = class {
282173
282511
  throw error40;
282174
282512
  }
282175
282513
  }
282514
+ /**
282515
+ * Deletes the current session only if it has no resumable conversation
282516
+ * content. This removes abandoned startup-only sessions while preserving any
282517
+ * session with a real user prompt, model response, or tool activity.
282518
+ */
282519
+ async deleteCurrentSessionIfNotResumableAsync() {
282520
+ if (!this.conversationFile || !this.cachedConversation) {
282521
+ return;
282522
+ }
282523
+ if (hasResumableConversationContent(this.cachedConversation.messages)) {
282524
+ return;
282525
+ }
282526
+ await this.deleteCurrentSessionAsync();
282527
+ }
282176
282528
  /**
282177
282529
  * Rewinds the conversation to the state just before the specified message ID.
282178
282530
  * All messages from (and including) the specified ID onwards are removed.
@@ -282249,11 +282601,11 @@ async function parseLegacyRecordFallback(filePath, options) {
282249
282601
  const legacyRecord = parsed;
282250
282602
  if (options?.metadataOnly) {
282251
282603
  let fallbackFirstUserMessageStr;
282252
- const firstUserMessage = legacyRecord.messages?.find((m) => m.type === "user");
282604
+ const firstUserMessage = legacyRecord.messages?.find((m) => m.type === "user" && isResumableMessageRecord(m));
282253
282605
  if (firstUserMessage) {
282254
282606
  const rawContent = firstUserMessage.content;
282255
282607
  if (Array.isArray(rawContent)) {
282256
- fallbackFirstUserMessageStr = rawContent.map((p2) => isTextPart(p2) ? p2["text"] : "").join("");
282608
+ fallbackFirstUserMessageStr = rawContent.map((p2) => isTextPart2(p2) ? p2["text"] : "").join("");
282257
282609
  } else if (typeof rawContent === "string") {
282258
282610
  fallbackFirstUserMessageStr = rawContent;
282259
282611
  }
@@ -282264,13 +282616,13 @@ async function parseLegacyRecordFallback(filePath, options) {
282264
282616
  messageCount: legacyRecord.messages?.length || 0,
282265
282617
  userMessageCount: legacyRecord.messages?.filter((m) => m.type === "user").length || 0,
282266
282618
  firstUserMessage: fallbackFirstUserMessageStr,
282267
- hasUserOrAssistantMessage: legacyRecord.messages?.some((m) => m.type === "user" || m.type === "gemini") || false
282619
+ hasResumableContent: legacyRecord.messages?.some((m) => isResumableMessageRecord(m)) || false
282268
282620
  };
282269
282621
  }
282270
282622
  return {
282271
282623
  ...legacyRecord,
282272
282624
  userMessageCount: legacyRecord.messages?.filter((m) => m.type === "user").length || 0,
282273
- hasUserOrAssistantMessage: legacyRecord.messages?.some((m) => m.type === "user" || m.type === "gemini") || false
282625
+ hasResumableContent: legacyRecord.messages?.some((m) => isResumableMessageRecord(m)) || false
282274
282626
  };
282275
282627
  }
282276
282628
  } catch {
@@ -284879,116 +285231,6 @@ function toVertexGenerationConfig(config2) {
284879
285231
  };
284880
285232
  }
284881
285233
 
284882
- // packages/core/dist/src/utils/partUtils.js
284883
- function partToString(value, options) {
284884
- if (!value) {
284885
- return "";
284886
- }
284887
- if (typeof value === "string") {
284888
- return value;
284889
- }
284890
- if (Array.isArray(value)) {
284891
- return value.map((part2) => partToString(part2, options)).join("");
284892
- }
284893
- const part = value;
284894
- if (options?.verbose) {
284895
- if (part.videoMetadata !== void 0) {
284896
- return `[Video Metadata]`;
284897
- }
284898
- if (part.thought !== void 0) {
284899
- return `[Thought: ${part.thought}]`;
284900
- }
284901
- if (part.codeExecutionResult !== void 0) {
284902
- return `[Code Execution Result]`;
284903
- }
284904
- if (part.executableCode !== void 0) {
284905
- return `[Executable Code]`;
284906
- }
284907
- if (part.fileData !== void 0) {
284908
- return `[File Data]`;
284909
- }
284910
- if (part.functionCall !== void 0) {
284911
- return `[Function Call: ${part.functionCall.name}]`;
284912
- }
284913
- if (part.functionResponse !== void 0) {
284914
- return `[Function Response: ${part.functionResponse.name}]`;
284915
- }
284916
- if (part.inlineData !== void 0) {
284917
- const mimeType = part.inlineData.mimeType ?? "unknown";
284918
- const data = part.inlineData.data ?? "";
284919
- const bytes = Math.ceil(data.length * 3 / 4);
284920
- const kb = (bytes / 1024).toFixed(1);
284921
- const category = mimeType.startsWith("audio/") ? "Audio" : mimeType.startsWith("video/") ? "Video" : mimeType.startsWith("image/") ? "Image" : "Media";
284922
- return `[${category}: ${mimeType}, ${kb} KB]`;
284923
- }
284924
- }
284925
- return part.text ?? "";
284926
- }
284927
- function clonePart(part) {
284928
- return { ...part };
284929
- }
284930
- function updatePart(part, updates) {
284931
- return { ...part, ...updates };
284932
- }
284933
- function cloneFunctionResponse(resp) {
284934
- return { ...resp };
284935
- }
284936
- function cloneFunctionCall(call) {
284937
- return { ...call };
284938
- }
284939
- function getResponseText(response) {
284940
- if (response.candidates && response.candidates.length > 0) {
284941
- const candidate = response.candidates[0];
284942
- if (candidate.content && candidate.content.parts && candidate.content.parts.length > 0) {
284943
- return candidate.content.parts.filter((part) => part.text && !part.thought).map((part) => part.text).join("");
284944
- }
284945
- }
284946
- return null;
284947
- }
284948
- async function flatMapTextParts(parts2, transform2) {
284949
- const result2 = [];
284950
- const partArray = Array.isArray(parts2) ? parts2 : typeof parts2 === "string" ? [{ text: parts2 }] : [parts2];
284951
- for (const part of partArray) {
284952
- let textToProcess;
284953
- if (typeof part === "string") {
284954
- textToProcess = part;
284955
- } else if ("text" in part) {
284956
- textToProcess = part.text;
284957
- }
284958
- if (textToProcess !== void 0) {
284959
- const transformedParts = await transform2(textToProcess);
284960
- result2.push(...transformedParts);
284961
- } else {
284962
- result2.push(part);
284963
- }
284964
- }
284965
- return result2;
284966
- }
284967
- function appendToLastTextPart(prompt, textToAppend, separator = "\n\n") {
284968
- if (!textToAppend) {
284969
- return prompt;
284970
- }
284971
- if (prompt.length === 0) {
284972
- return [{ text: textToAppend }];
284973
- }
284974
- const newPrompt = [...prompt];
284975
- const lastPart = newPrompt.at(-1);
284976
- if (typeof lastPart === "string") {
284977
- newPrompt[newPrompt.length - 1] = `${lastPart}${separator}${textToAppend}`;
284978
- } else if (lastPart && "text" in lastPart) {
284979
- newPrompt[newPrompt.length - 1] = {
284980
- ...lastPart,
284981
- text: `${lastPart.text}${separator}${textToAppend}`
284982
- };
284983
- } else {
284984
- newPrompt.push({ text: `${separator}${textToAppend}` });
284985
- }
284986
- return newPrompt;
284987
- }
284988
- function isTextPart2(part) {
284989
- return typeof part === "object" && part !== null && "text" in part && typeof part.text === "string";
284990
- }
284991
-
284992
285234
  // packages/core/dist/src/utils/generateContentResponseUtilities.js
284993
285235
  var BINARY_INJECTION_KEY = "__binary_injection__";
284994
285236
  function createFunctionResponsePart(callId, toolName, output) {
@@ -303466,7 +303708,7 @@ function getVersion() {
303466
303708
  }
303467
303709
  versionPromise = (async () => {
303468
303710
  const pkgJson = await getPackageJson(__dirname4);
303469
- return "0.47.0-nightly.20260602.gcfcecebe8";
303711
+ return "0.47.0";
303470
303712
  })();
303471
303713
  return versionPromise;
303472
303714
  }
@@ -303902,7 +304144,7 @@ ${errorMessage}`, true);
303902
304144
  };
303903
304145
 
303904
304146
  // packages/core/dist/src/utils/llm-edit-fixer.js
303905
- import { createHash as createHash4 } from "node:crypto";
304147
+ import { createHash as createHash5 } from "node:crypto";
303906
304148
 
303907
304149
  // packages/core/dist/src/utils/secure-browser-launcher.js
303908
304150
  import { execFile as execFile6 } from "node:child_process";
@@ -305248,7 +305490,7 @@ async function generateJsonWithTimeout(client, params, timeoutMs) {
305248
305490
  }
305249
305491
  async function FixLLMEditWithInstruction(instruction, old_string, new_string, error40, current_content, baseLlmClient, abortSignal) {
305250
305492
  const promptId = getPromptIdWithFallback("llm-fixer");
305251
- const cacheKey = createHash4("sha256").update(JSON.stringify([
305493
+ const cacheKey = createHash5("sha256").update(JSON.stringify([
305252
305494
  current_content,
305253
305495
  old_string,
305254
305496
  new_string,
@@ -307900,6 +308142,52 @@ var LoggingContentGenerator = class {
307900
308142
  }
307901
308143
  };
307902
308144
 
308145
+ // packages/core/dist/src/core/modelMappingContentGenerator.js
308146
+ var ModelMappingContentGenerator = class {
308147
+ wrapped;
308148
+ mappings;
308149
+ constructor(wrapped, mappings) {
308150
+ this.wrapped = wrapped;
308151
+ this.mappings = mappings;
308152
+ }
308153
+ getWrapped() {
308154
+ return this.wrapped;
308155
+ }
308156
+ get userTier() {
308157
+ return this.wrapped.userTier;
308158
+ }
308159
+ get userTierName() {
308160
+ return this.wrapped.userTierName;
308161
+ }
308162
+ get paidTier() {
308163
+ return this.wrapped.paidTier;
308164
+ }
308165
+ mapModel(req) {
308166
+ if (req.model) {
308167
+ const normalizedModel = normalizeModelId(req.model);
308168
+ if (this.mappings[normalizedModel]) {
308169
+ return {
308170
+ ...req,
308171
+ model: req.model.startsWith("models/") ? `models/${this.mappings[normalizedModel]}` : this.mappings[normalizedModel]
308172
+ };
308173
+ }
308174
+ }
308175
+ return req;
308176
+ }
308177
+ generateContent(request, userPromptId, role) {
308178
+ return this.wrapped.generateContent(this.mapModel(request), userPromptId, role);
308179
+ }
308180
+ generateContentStream(request, userPromptId, role) {
308181
+ return this.wrapped.generateContentStream(this.mapModel(request), userPromptId, role);
308182
+ }
308183
+ countTokens(request) {
308184
+ return this.wrapped.countTokens(this.mapModel(request));
308185
+ }
308186
+ embedContent(request) {
308187
+ return this.wrapped.embedContent(this.mapModel(request));
308188
+ }
308189
+ };
308190
+
307903
308191
  // packages/core/dist/src/code_assist/codeAssist.js
307904
308192
  async function createCodeAssistContentGenerator(httpOptions, authType, config2, sessionId) {
307905
308193
  if (authType === AuthType2.LOGIN_WITH_GOOGLE || authType === AuthType2.COMPUTE_ADC) {
@@ -307911,8 +308199,14 @@ async function createCodeAssistContentGenerator(httpOptions, authType, config2,
307911
308199
  }
307912
308200
  function getCodeAssistServer(config2) {
307913
308201
  let server = config2.getContentGenerator();
307914
- if (server instanceof LoggingContentGenerator) {
307915
- server = server.getWrapped();
308202
+ while (true) {
308203
+ if (server instanceof LoggingContentGenerator) {
308204
+ server = server.getWrapped();
308205
+ } else if (server instanceof ModelMappingContentGenerator) {
308206
+ server = server.getWrapped();
308207
+ } else {
308208
+ break;
308209
+ }
307916
308210
  }
307917
308211
  if (!(server instanceof CodeAssistServer)) {
307918
308212
  return void 0;
@@ -308281,7 +308575,7 @@ async function createContentGenerator(config2, gcConfig, sessionId) {
308281
308575
  }
308282
308576
  if (config2.authType === AuthType2.LOGIN_WITH_GOOGLE || config2.authType === AuthType2.COMPUTE_ADC) {
308283
308577
  const httpOptions = { headers: baseHeaders };
308284
- return new LoggingContentGenerator(await createCodeAssistContentGenerator(httpOptions, config2.authType, gcConfig, sessionId), gcConfig);
308578
+ return new LoggingContentGenerator(new ModelMappingContentGenerator(await createCodeAssistContentGenerator(httpOptions, config2.authType, gcConfig, sessionId), CCPA_AI_MODEL_MAPPINGS), gcConfig);
308285
308579
  }
308286
308580
  if (config2.authType === AuthType2.USE_GEMINI || config2.authType === AuthType2.USE_VERTEX_AI || config2.authType === AuthType2.GATEWAY) {
308287
308581
  let headers = { ...baseHeaders };
@@ -327316,48 +327610,6 @@ var TopicState = class {
327316
327610
  // packages/core/dist/src/agents/local-executor.js
327317
327611
  import { randomUUID as randomUUID12 } from "node:crypto";
327318
327612
 
327319
- // packages/core/dist/src/core/agentChatHistory.js
327320
- var AgentChatHistory = class {
327321
- history = [];
327322
- constructor(initialTurns = []) {
327323
- this.history = [...initialTurns];
327324
- }
327325
- /**
327326
- * Adds a new turn to the history.
327327
- * Every turn must have a durable ID, usually provided by the ChatRecordingService.
327328
- */
327329
- push(turn) {
327330
- this.history.push(turn);
327331
- }
327332
- /**
327333
- * Overwrites the entire history with a new list of turns.
327334
- */
327335
- set(turns) {
327336
- this.history = [...turns];
327337
- }
327338
- clear() {
327339
- this.history = [];
327340
- }
327341
- get() {
327342
- return this.history;
327343
- }
327344
- /**
327345
- * Returns a copy of the raw Gemini Content[] for API consumption.
327346
- */
327347
- getContents() {
327348
- return this.history.map((h3) => h3.content);
327349
- }
327350
- map(callback) {
327351
- return this.history.map(callback);
327352
- }
327353
- flatMap(callback) {
327354
- return this.history.flatMap(callback);
327355
- }
327356
- get length() {
327357
- return this.history.length;
327358
- }
327359
- };
327360
-
327361
327613
  // packages/core/dist/src/core/geminiChat.js
327362
327614
  import { randomUUID as randomUUID5 } from "node:crypto";
327363
327615
 
@@ -327369,13 +327621,6 @@ function isFunctionCall(content) {
327369
327621
  return content.role === "model" && !!content.parts && content.parts.every((part) => !!part.functionCall);
327370
327622
  }
327371
327623
 
327372
- // packages/core/dist/src/utils/cryptoUtils.js
327373
- import { createHash as createHash6 } from "node:crypto";
327374
- function deriveStableId(sourceIds) {
327375
- const sortedIds = [...sourceIds].sort();
327376
- return createHash6("sha256").update(sortedIds.join("|")).digest("hex").slice(0, 32);
327377
- }
327378
-
327379
327624
  // packages/core/dist/src/utils/historyHardening.js
327380
327625
  var SYNTHETIC_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
327381
327626
  var DEFAULT_SENTINELS = {
@@ -327638,158 +327883,6 @@ function scrubPart(part) {
327638
327883
  return scrubbed;
327639
327884
  }
327640
327885
 
327641
- // packages/core/dist/src/core/geminiRequest.js
327642
- function partListUnionToString(value) {
327643
- return partToString(value, { verbose: true });
327644
- }
327645
-
327646
- // packages/core/dist/src/utils/sessionUtils.js
327647
- function ensureStableToolIds(history) {
327648
- for (let i4 = 0; i4 < history.length; i4++) {
327649
- const turn = history[i4];
327650
- const parts2 = turn.content.parts || [];
327651
- for (let partIdx = 0; partIdx < parts2.length; partIdx++) {
327652
- const part = parts2[partIdx];
327653
- if (part.functionCall && !part.functionCall.id) {
327654
- const name3 = part.functionCall.name;
327655
- const nextTurn = history[i4 + 1];
327656
- let pairedId;
327657
- if (nextTurn?.content.role === "user") {
327658
- const matchingResp = nextTurn.content.parts?.find((p2) => p2.functionResponse && p2.functionResponse.name === name3 && !p2.functionResponse.id);
327659
- if (matchingResp) {
327660
- pairedId = `synth_${name3}_${deriveStableId([turn.id, i4.toString(), partIdx.toString()])}`;
327661
- part.functionCall.id = pairedId;
327662
- matchingResp.functionResponse.id = pairedId;
327663
- }
327664
- }
327665
- if (!part.functionCall.id) {
327666
- part.functionCall.id = `synth_${name3}_${deriveStableId([turn.id, i4.toString(), partIdx.toString()])}`;
327667
- }
327668
- }
327669
- if (part.functionResponse && !part.functionResponse.id) {
327670
- const name3 = part.functionResponse.name;
327671
- const prevTurn = history[i4 - 1];
327672
- if (prevTurn?.content.role === "model") {
327673
- const matchingCall = prevTurn.content.parts?.find((p2) => p2.functionCall && p2.functionCall.name === name3 && !p2.functionCall.id);
327674
- if (matchingCall) {
327675
- const pairedId = `synth_${name3}_${deriveStableId([prevTurn.id, (i4 - 1).toString(), partIdx.toString()])}`;
327676
- matchingCall.functionCall.id = pairedId;
327677
- part.functionResponse.id = pairedId;
327678
- }
327679
- }
327680
- if (!part.functionResponse.id) {
327681
- part.functionResponse.id = `synth_orph_${name3}_${deriveStableId([turn.id, i4.toString(), partIdx.toString()])}`;
327682
- }
327683
- }
327684
- }
327685
- }
327686
- }
327687
- function ensurePartArray(content) {
327688
- if (Array.isArray(content)) {
327689
- return content.map((part) => typeof part === "string" ? { text: part } : part);
327690
- }
327691
- if (typeof content === "string") {
327692
- return [{ text: content }];
327693
- }
327694
- return [content];
327695
- }
327696
- function convertSessionToClientHistory(messages) {
327697
- const clientHistory = [];
327698
- for (const msg of messages) {
327699
- if (msg.type === "info" || msg.type === "error" || msg.type === "warning") {
327700
- continue;
327701
- }
327702
- if (msg.type === "user") {
327703
- const contentString = partListUnionToString(msg.content);
327704
- const trimmedContent = contentString.trim();
327705
- if (trimmedContent.startsWith("/") || trimmedContent.startsWith("?") || trimmedContent.startsWith("<session_context>") || trimmedContent.startsWith("<hook_context>")) {
327706
- continue;
327707
- }
327708
- clientHistory.push({
327709
- id: msg.id,
327710
- content: {
327711
- role: "user",
327712
- parts: ensurePartArray(msg.content)
327713
- }
327714
- });
327715
- } else if (msg.type === "gemini") {
327716
- const modelParts = [];
327717
- const contentParts = msg.content ? ensurePartArray(msg.content) : [];
327718
- const hasCallsInContent = contentParts.some((p2) => !!p2.functionCall);
327719
- const hasThoughtsInContent = contentParts.some((p2) => p2.thought);
327720
- if (hasCallsInContent || hasThoughtsInContent) {
327721
- modelParts.push(...contentParts);
327722
- } else {
327723
- if (msg.thoughts && msg.thoughts.length > 0) {
327724
- for (const thought of msg.thoughts) {
327725
- const thoughtText = thought.subject ? `**${thought.subject}** ${thought.description}` : thought.description;
327726
- modelParts.push({
327727
- text: thoughtText,
327728
- thought: true
327729
- });
327730
- }
327731
- }
327732
- modelParts.push(...contentParts);
327733
- if (msg.toolCalls && msg.toolCalls.length > 0) {
327734
- for (const toolCall of msg.toolCalls) {
327735
- modelParts.push({
327736
- functionCall: {
327737
- id: toolCall.id,
327738
- name: toolCall.name,
327739
- args: toolCall.args
327740
- }
327741
- });
327742
- }
327743
- }
327744
- }
327745
- if (modelParts.length > 0) {
327746
- clientHistory.push({
327747
- id: msg.id,
327748
- content: {
327749
- role: "model",
327750
- parts: modelParts
327751
- }
327752
- });
327753
- if (msg.toolCalls && msg.toolCalls.length > 0) {
327754
- const functionResponseParts = [];
327755
- for (const toolCall of msg.toolCalls) {
327756
- if (toolCall.result) {
327757
- let responseData;
327758
- if (typeof toolCall.result === "string") {
327759
- responseData = {
327760
- functionResponse: {
327761
- id: toolCall.id,
327762
- name: toolCall.name,
327763
- response: {
327764
- output: toolCall.result
327765
- }
327766
- }
327767
- };
327768
- } else if (Array.isArray(toolCall.result)) {
327769
- functionResponseParts.push(...ensurePartArray(toolCall.result));
327770
- continue;
327771
- } else {
327772
- responseData = toolCall.result;
327773
- }
327774
- functionResponseParts.push(responseData);
327775
- }
327776
- }
327777
- if (functionResponseParts.length > 0) {
327778
- clientHistory.push({
327779
- id: `${msg.id}_response`,
327780
- content: {
327781
- role: "user",
327782
- parts: functionResponseParts
327783
- }
327784
- });
327785
- }
327786
- }
327787
- }
327788
- }
327789
- }
327790
- return clientHistory;
327791
- }
327792
-
327793
327886
  // packages/core/dist/src/core/geminiChat.js
327794
327887
  var StreamEventType;
327795
327888
  (function(StreamEventType2) {
@@ -335804,7 +335897,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
335804
335897
  return provider;
335805
335898
  }
335806
335899
  case "oauth2": {
335807
- const { OAuth2AuthProvider } = await import("./oauth2-provider-HWRKMSF7.js");
335900
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-D3K72R73.js");
335808
335901
  const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
335809
335902
  await provider.initialize();
335810
335903
  return provider;
@@ -364867,6 +364960,7 @@ async function discoverTools(mcpServerName, mcpServerConfig, mcpClient, cliConfi
364867
364960
  } catch (error40) {
364868
364961
  if (!isMcpMethodNotFoundError(error40)) {
364869
364962
  cliConfig.emitMcpDiagnostic("error", `Error discovering tools from ${mcpServerName}: ${getErrorMessage(error40)}`, error40, mcpServerName);
364963
+ throw error40;
364870
364964
  }
364871
364965
  return [];
364872
364966
  }
@@ -375668,7 +375762,7 @@ ${sections.join("\n")}
375668
375762
  if (authType === AuthType2.USE_GEMINI) {
375669
375763
  setFlashModels("gemini-3-flash-preview", "gemini-3.5-flash");
375670
375764
  } else {
375671
- setFlashModels("gemini-3-flash", "gemini-3-flash");
375765
+ setFlashModels("gemini-3.5-flash", "gemini-3.5-flash");
375672
375766
  }
375673
375767
  } else {
375674
375768
  setFlashModels("gemini-3-flash-preview", "gemini-2.5-flash");
@@ -393411,6 +393505,7 @@ export {
393411
393505
  isAutoModel,
393412
393506
  supportsMultimodalFunctionResponse,
393413
393507
  isActiveModel,
393508
+ CCPA_AI_MODEL_MAPPINGS,
393414
393509
  G1_CREDIT_TYPE,
393415
393510
  OVERAGE_ELIGIBLE_MODELS,
393416
393511
  isOverageEligibleModel,
@@ -393546,6 +393641,22 @@ export {
393546
393641
  getMatchingSessionFiles,
393547
393642
  deleteSessionFileAndArtifacts,
393548
393643
  deleteStoredSession,
393644
+ partToString,
393645
+ clonePart,
393646
+ updatePart,
393647
+ cloneFunctionResponse,
393648
+ cloneFunctionCall,
393649
+ getResponseText,
393650
+ flatMapTextParts,
393651
+ appendToLastTextPart,
393652
+ isTextPart,
393653
+ partListUnionToString,
393654
+ AgentChatHistory,
393655
+ ensureStableToolIds,
393656
+ isIgnoredUserContent,
393657
+ convertSessionToClientHistory,
393658
+ isResumableMessageRecord,
393659
+ hasResumableConversationContent,
393549
393660
  loadConversationRecord,
393550
393661
  ChatRecordingService,
393551
393662
  UiTelemetryService,
@@ -393621,15 +393732,6 @@ export {
393621
393732
  logOnboardingStart,
393622
393733
  logOnboardingSuccess,
393623
393734
  logBillingEvent,
393624
- partToString,
393625
- clonePart,
393626
- updatePart,
393627
- cloneFunctionResponse,
393628
- cloneFunctionCall,
393629
- getResponseText,
393630
- flatMapTextParts,
393631
- appendToLastTextPart,
393632
- isTextPart2 as isTextPart,
393633
393735
  BINARY_INJECTION_KEY,
393634
393736
  convertToFunctionResponse,
393635
393737
  getResponseTextFromParts,
@@ -393823,10 +393925,6 @@ export {
393823
393925
  AskUserTool,
393824
393926
  AskUserInvocation,
393825
393927
  isCompletedAskUserTool,
393826
- AgentChatHistory,
393827
- partListUnionToString,
393828
- ensureStableToolIds,
393829
- convertSessionToClientHistory,
393830
393928
  StreamEventType,
393831
393929
  SYNTHETIC_THOUGHT_SIGNATURE2 as SYNTHETIC_THOUGHT_SIGNATURE,
393832
393930
  isValidNonThoughtTextPart,