gemini-cli-leo 0.1.30-pre.1 → 0.1.30-pre.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.
package/gemini.mjs CHANGED
@@ -174783,8 +174783,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
174783
174783
  var init_git_commit = __esm({
174784
174784
  "packages/core/dist/src/generated/git-commit.js"() {
174785
174785
  "use strict";
174786
- GIT_COMMIT_INFO = "0fcc42b";
174787
- CLI_VERSION = "0.1.30-pre.1";
174786
+ GIT_COMMIT_INFO = "d95638c";
174787
+ CLI_VERSION = "0.1.30-pre.2";
174788
174788
  }
174789
174789
  });
174790
174790
 
@@ -266769,6 +266769,71 @@ function truncateForTelemetry(value, maxLength = 1e4) {
266769
266769
  function isAsyncIterable(value) {
266770
266770
  return typeof value === "object" && value !== null && Symbol.asyncIterator in value;
266771
266771
  }
266772
+ function createEndSpan(span, meta, tracesEnabled, logPrompts) {
266773
+ let spanEnded = false;
266774
+ return () => {
266775
+ if (spanEnded) {
266776
+ return;
266777
+ }
266778
+ spanEnded = true;
266779
+ try {
266780
+ if (tracesEnabled) {
266781
+ if (logPrompts !== false) {
266782
+ if (meta.input !== void 0) {
266783
+ const truncated = truncateForTelemetry(meta.input);
266784
+ if (truncated !== void 0) {
266785
+ span.setAttribute(GEN_AI_INPUT_MESSAGES, truncated);
266786
+ }
266787
+ }
266788
+ if (meta.output !== void 0) {
266789
+ const truncated = truncateForTelemetry(meta.output);
266790
+ if (truncated !== void 0) {
266791
+ span.setAttribute(GEN_AI_OUTPUT_MESSAGES, truncated);
266792
+ }
266793
+ }
266794
+ }
266795
+ for (const [key, value] of Object.entries(meta.attributes)) {
266796
+ const truncated = truncateForTelemetry(value);
266797
+ if (truncated !== void 0) {
266798
+ span.setAttribute(key, truncated);
266799
+ }
266800
+ }
266801
+ } else {
266802
+ for (const [key, value] of Object.entries(meta.attributes)) {
266803
+ if (key === GEN_AI_OPERATION_NAME || key === GEN_AI_AGENT_NAME || key === GEN_AI_AGENT_DESCRIPTION || key === GEN_AI_CONVERSATION_ID) {
266804
+ const truncated = truncateForTelemetry(value);
266805
+ if (truncated !== void 0) {
266806
+ span.setAttribute(key, truncated);
266807
+ }
266808
+ }
266809
+ }
266810
+ }
266811
+ if (meta.error) {
266812
+ span.setStatus({
266813
+ code: SpanStatusCode.ERROR,
266814
+ message: getErrorMessage2(meta.error)
266815
+ });
266816
+ if (meta.error instanceof Error) {
266817
+ span.recordException(meta.error);
266818
+ }
266819
+ } else {
266820
+ span.setStatus({ code: SpanStatusCode.OK });
266821
+ }
266822
+ } catch (e3) {
266823
+ diag2.error("Error setting span attributes in endSpan", e3);
266824
+ span.setStatus({
266825
+ code: SpanStatusCode.ERROR,
266826
+ message: `Error in endSpan: ${getErrorMessage2(e3)}`
266827
+ });
266828
+ } finally {
266829
+ meta.input = void 0;
266830
+ meta.output = void 0;
266831
+ meta.error = void 0;
266832
+ meta.attributes = {};
266833
+ span.end();
266834
+ }
266835
+ };
266836
+ }
266772
266837
  async function runInDevTraceSpan(opts, fn2) {
266773
266838
  const { operation, logPrompts, sessionId, tracesEnabled, ...restOfSpanOpts } = opts;
266774
266839
  restOfSpanOpts.attributes = {
@@ -266786,65 +266851,7 @@ async function runInDevTraceSpan(opts, fn2) {
266786
266851
  [GEN_AI_CONVERSATION_ID]: sessionId
266787
266852
  }
266788
266853
  };
266789
- let spanEnded = false;
266790
- const endSpan = () => {
266791
- if (spanEnded) {
266792
- return;
266793
- }
266794
- spanEnded = true;
266795
- try {
266796
- if (tracesEnabled) {
266797
- if (logPrompts !== false) {
266798
- if (meta.input !== void 0) {
266799
- const truncated = truncateForTelemetry(meta.input);
266800
- if (truncated !== void 0) {
266801
- span.setAttribute(GEN_AI_INPUT_MESSAGES, truncated);
266802
- }
266803
- }
266804
- if (meta.output !== void 0) {
266805
- const truncated = truncateForTelemetry(meta.output);
266806
- if (truncated !== void 0) {
266807
- span.setAttribute(GEN_AI_OUTPUT_MESSAGES, truncated);
266808
- }
266809
- }
266810
- }
266811
- for (const [key, value] of Object.entries(meta.attributes)) {
266812
- const truncated = truncateForTelemetry(value);
266813
- if (truncated !== void 0) {
266814
- span.setAttribute(key, truncated);
266815
- }
266816
- }
266817
- } else {
266818
- for (const [key, value] of Object.entries(meta.attributes)) {
266819
- if (key === GEN_AI_OPERATION_NAME || key === GEN_AI_AGENT_NAME || key === GEN_AI_AGENT_DESCRIPTION || key === GEN_AI_CONVERSATION_ID) {
266820
- const truncated = truncateForTelemetry(value);
266821
- if (truncated !== void 0) {
266822
- span.setAttribute(key, truncated);
266823
- }
266824
- }
266825
- }
266826
- }
266827
- if (meta.error) {
266828
- span.setStatus({
266829
- code: SpanStatusCode.ERROR,
266830
- message: getErrorMessage2(meta.error)
266831
- });
266832
- if (meta.error instanceof Error) {
266833
- span.recordException(meta.error);
266834
- }
266835
- } else {
266836
- span.setStatus({ code: SpanStatusCode.OK });
266837
- }
266838
- } catch (e3) {
266839
- diag2.error("Error setting span attributes in endSpan", e3);
266840
- span.setStatus({
266841
- code: SpanStatusCode.ERROR,
266842
- message: `Error in endSpan: ${getErrorMessage2(e3)}`
266843
- });
266844
- } finally {
266845
- span.end();
266846
- }
266847
- };
266854
+ const endSpan = createEndSpan(span, meta, tracesEnabled, logPrompts);
266848
266855
  let isStream4 = false;
266849
266856
  try {
266850
266857
  const result2 = await fn2({ metadata: meta });
@@ -267105,12 +267112,27 @@ var init_telemetry = __esm({
267105
267112
  function isTelemetrySdkInitialized() {
267106
267113
  return telemetryInitialized;
267107
267114
  }
267108
- function bufferTelemetryEvent(fn2) {
267115
+ function bufferTelemetryEvent(fn2, config2) {
267116
+ if (config2 && typeof config2.getTelemetryEnabled === "function" && !config2.getTelemetryEnabled()) {
267117
+ return;
267118
+ }
267109
267119
  if (telemetryInitialized) {
267110
- fn2();
267111
- } else {
267112
- telemetryBuffer.push(fn2);
267120
+ try {
267121
+ const result2 = fn2();
267122
+ if (result2 instanceof Promise) {
267123
+ result2.catch((e3) => {
267124
+ debugLogger.error("Error executing telemetry event promise", e3);
267125
+ });
267126
+ }
267127
+ } catch (e3) {
267128
+ debugLogger.error("Error executing telemetry event", e3);
267129
+ }
267130
+ return;
267131
+ }
267132
+ if (telemetryBuffer.length >= MAX_TELEMETRY_BUFFER_SIZE) {
267133
+ telemetryBuffer.shift();
267113
267134
  }
267135
+ telemetryBuffer.push(fn2);
267114
267136
  }
267115
267137
  async function flushTelemetryBuffer() {
267116
267138
  if (!telemetryInitialized)
@@ -267354,6 +267376,7 @@ async function shutdownTelemetry(config2, fromProcessExit = true) {
267354
267376
  debugLogger.error("Error shutting down SDK:", error40);
267355
267377
  } finally {
267356
267378
  telemetryInitialized = false;
267379
+ telemetryBuffer.length = 0;
267357
267380
  sdk = void 0;
267358
267381
  trace.disable();
267359
267382
  context.disable();
@@ -267376,7 +267399,7 @@ async function shutdownTelemetry(config2, fromProcessExit = true) {
267376
267399
  activeTelemetryEmail = void 0;
267377
267400
  }
267378
267401
  }
267379
- var import_exporter_trace_otlp_grpc, import_exporter_logs_otlp_grpc, import_exporter_metrics_otlp_grpc, import_exporter_trace_otlp_http, import_exporter_logs_otlp_http, import_exporter_metrics_otlp_http, import_grpc_js, import_sdk_node, import_resources, import_sdk_trace_node, import_sdk_logs, import_sdk_metrics2, import_instrumentation_http, DiagLoggerAdapter, sdk, spanProcessor, logRecordProcessor, metricReader, telemetryInitialized, callbackRegistered, authListener, keychainAvailabilityListener, tokenStorageTypeListener, telemetryBuffer, activeTelemetryEmail;
267402
+ var import_exporter_trace_otlp_grpc, import_exporter_logs_otlp_grpc, import_exporter_metrics_otlp_grpc, import_exporter_trace_otlp_http, import_exporter_logs_otlp_http, import_exporter_metrics_otlp_http, import_grpc_js, import_sdk_node, import_resources, import_sdk_trace_node, import_sdk_logs, import_sdk_metrics2, import_instrumentation_http, DiagLoggerAdapter, sdk, spanProcessor, logRecordProcessor, metricReader, telemetryInitialized, callbackRegistered, authListener, keychainAvailabilityListener, tokenStorageTypeListener, MAX_TELEMETRY_BUFFER_SIZE, telemetryBuffer, activeTelemetryEmail;
267380
267403
  var init_sdk = __esm({
267381
267404
  "packages/core/dist/src/telemetry/sdk.js"() {
267382
267405
  "use strict";
@@ -267431,6 +267454,7 @@ var init_sdk = __esm({
267431
267454
  authListener = void 0;
267432
267455
  keychainAvailabilityListener = void 0;
267433
267456
  tokenStorageTypeListener = void 0;
267457
+ MAX_TELEMETRY_BUFFER_SIZE = 100;
267434
267458
  telemetryBuffer = [];
267435
267459
  }
267436
267460
  });
@@ -267449,7 +267473,7 @@ function logCliConfiguration(config2, event) {
267449
267473
  }).catch((e3) => {
267450
267474
  debugLogger.error("Failed to log telemetry event", e3);
267451
267475
  });
267452
- });
267476
+ }, config2);
267453
267477
  }
267454
267478
  function logUserPrompt(config2, event) {
267455
267479
  ClearcutLogger.getInstance(config2)?.logNewPromptEvent(event);
@@ -267460,7 +267484,7 @@ function logUserPrompt(config2, event) {
267460
267484
  attributes: event.toOpenTelemetryAttributes(config2)
267461
267485
  };
267462
267486
  logger7.emit(logRecord);
267463
- });
267487
+ }, config2);
267464
267488
  }
267465
267489
  function logToolCall(config2, event) {
267466
267490
  const uiEvent = {
@@ -267498,7 +267522,7 @@ function logToolCall(config2, event) {
267498
267522
  });
267499
267523
  }
267500
267524
  }
267501
- });
267525
+ }, config2);
267502
267526
  }
267503
267527
  function logToolOutputTruncated(config2, event) {
267504
267528
  ClearcutLogger.getInstance(config2)?.logToolOutputTruncatedEvent(event);
@@ -267509,7 +267533,7 @@ function logToolOutputTruncated(config2, event) {
267509
267533
  attributes: event.toOpenTelemetryAttributes(config2)
267510
267534
  };
267511
267535
  logger7.emit(logRecord);
267512
- });
267536
+ }, config2);
267513
267537
  }
267514
267538
  function logToolOutputMasking(config2, event) {
267515
267539
  ClearcutLogger.getInstance(config2)?.logToolOutputMaskingEvent(event);
@@ -267520,7 +267544,7 @@ function logToolOutputMasking(config2, event) {
267520
267544
  attributes: event.toOpenTelemetryAttributes(config2)
267521
267545
  };
267522
267546
  logger7.emit(logRecord);
267523
- });
267547
+ }, config2);
267524
267548
  }
267525
267549
  function logFileOperation(config2, event) {
267526
267550
  ClearcutLogger.getInstance(config2)?.logFileOperationEvent(event);
@@ -267538,7 +267562,7 @@ function logFileOperation(config2, event) {
267538
267562
  extension: event.extension,
267539
267563
  programming_language: event.programming_language
267540
267564
  });
267541
- });
267565
+ }, config2);
267542
267566
  }
267543
267567
  function logApiRequest(config2, event) {
267544
267568
  ClearcutLogger.getInstance(config2)?.logApiRequestEvent(event);
@@ -267546,7 +267570,7 @@ function logApiRequest(config2, event) {
267546
267570
  const logger7 = import_api_logs2.logs.getLogger(SERVICE_NAME);
267547
267571
  logger7.emit(event.toLogRecord(config2));
267548
267572
  logger7.emit(event.toSemanticLogRecord(config2));
267549
- });
267573
+ }, config2);
267550
267574
  }
267551
267575
  function logFlashFallback(config2, event) {
267552
267576
  ClearcutLogger.getInstance(config2)?.logFlashFallbackEvent();
@@ -267557,7 +267581,7 @@ function logFlashFallback(config2, event) {
267557
267581
  attributes: event.toOpenTelemetryAttributes(config2)
267558
267582
  };
267559
267583
  logger7.emit(logRecord);
267560
- });
267584
+ }, config2);
267561
267585
  }
267562
267586
  function logRipgrepFallback(config2, event) {
267563
267587
  ClearcutLogger.getInstance(config2)?.logRipgrepFallbackEvent();
@@ -267568,7 +267592,7 @@ function logRipgrepFallback(config2, event) {
267568
267592
  attributes: event.toOpenTelemetryAttributes(config2)
267569
267593
  };
267570
267594
  logger7.emit(logRecord);
267571
- });
267595
+ }, config2);
267572
267596
  }
267573
267597
  function logApiError(config2, event) {
267574
267598
  const uiEvent = {
@@ -267596,7 +267620,7 @@ function logApiError(config2, event) {
267596
267620
  "error.type": event.error_type || "unknown"
267597
267621
  }
267598
267622
  });
267599
- });
267623
+ }, config2);
267600
267624
  }
267601
267625
  function logApiResponse(config2, event) {
267602
267626
  const uiEvent = {
@@ -267631,7 +267655,7 @@ function logApiResponse(config2, event) {
267631
267655
  genAiAttributes: conventionAttributes
267632
267656
  });
267633
267657
  }
267634
- });
267658
+ }, config2);
267635
267659
  }
267636
267660
  function logLoopDetected(config2, event) {
267637
267661
  ClearcutLogger.getInstance(config2)?.logLoopDetectedEvent(event);
@@ -267642,7 +267666,7 @@ function logLoopDetected(config2, event) {
267642
267666
  attributes: event.toOpenTelemetryAttributes(config2)
267643
267667
  };
267644
267668
  logger7.emit(logRecord);
267645
- });
267669
+ }, config2);
267646
267670
  }
267647
267671
  function logLoopDetectionDisabled(config2, event) {
267648
267672
  ClearcutLogger.getInstance(config2)?.logLoopDetectionDisabledEvent();
@@ -267653,7 +267677,7 @@ function logLoopDetectionDisabled(config2, event) {
267653
267677
  attributes: event.toOpenTelemetryAttributes(config2)
267654
267678
  };
267655
267679
  logger7.emit(logRecord);
267656
- });
267680
+ }, config2);
267657
267681
  }
267658
267682
  function logNextSpeakerCheck(config2, event) {
267659
267683
  ClearcutLogger.getInstance(config2)?.logNextSpeakerCheck(event);
@@ -267664,7 +267688,7 @@ function logNextSpeakerCheck(config2, event) {
267664
267688
  attributes: event.toOpenTelemetryAttributes(config2)
267665
267689
  };
267666
267690
  logger7.emit(logRecord);
267667
- });
267691
+ }, config2);
267668
267692
  }
267669
267693
  function logSlashCommand(config2, event) {
267670
267694
  ClearcutLogger.getInstance(config2)?.logSlashCommandEvent(event);
@@ -267675,7 +267699,7 @@ function logSlashCommand(config2, event) {
267675
267699
  attributes: event.toOpenTelemetryAttributes(config2)
267676
267700
  };
267677
267701
  logger7.emit(logRecord);
267678
- });
267702
+ }, config2);
267679
267703
  }
267680
267704
  function logRewind(config2, event) {
267681
267705
  const uiEvent = {
@@ -267693,7 +267717,7 @@ function logRewind(config2, event) {
267693
267717
  attributes: event.toOpenTelemetryAttributes(config2)
267694
267718
  };
267695
267719
  logger7.emit(logRecord);
267696
- });
267720
+ }, config2);
267697
267721
  }
267698
267722
  function logIdeConnection(config2, event) {
267699
267723
  ClearcutLogger.getInstance(config2)?.logIdeConnectionEvent(event);
@@ -267704,7 +267728,7 @@ function logIdeConnection(config2, event) {
267704
267728
  attributes: event.toOpenTelemetryAttributes(config2)
267705
267729
  };
267706
267730
  logger7.emit(logRecord);
267707
- });
267731
+ }, config2);
267708
267732
  }
267709
267733
  function logConversationFinishedEvent(config2, event) {
267710
267734
  ClearcutLogger.getInstance(config2)?.logConversationFinishedEvent(event);
@@ -267715,7 +267739,7 @@ function logConversationFinishedEvent(config2, event) {
267715
267739
  attributes: event.toOpenTelemetryAttributes(config2)
267716
267740
  };
267717
267741
  logger7.emit(logRecord);
267718
- });
267742
+ }, config2);
267719
267743
  }
267720
267744
  function logChatCompression(config2, event) {
267721
267745
  ClearcutLogger.getInstance(config2)?.logChatCompressionEvent(event);
@@ -267739,7 +267763,7 @@ function logMalformedJsonResponse(config2, event) {
267739
267763
  attributes: event.toOpenTelemetryAttributes(config2)
267740
267764
  };
267741
267765
  logger7.emit(logRecord);
267742
- });
267766
+ }, config2);
267743
267767
  }
267744
267768
  function logInvalidChunk(config2, event) {
267745
267769
  ClearcutLogger.getInstance(config2)?.logInvalidChunkEvent(event);
@@ -267751,7 +267775,7 @@ function logInvalidChunk(config2, event) {
267751
267775
  };
267752
267776
  logger7.emit(logRecord);
267753
267777
  recordInvalidChunk(config2);
267754
- });
267778
+ }, config2);
267755
267779
  }
267756
267780
  function logNetworkRetryAttempt(config2, event) {
267757
267781
  ClearcutLogger.getInstance(config2)?.logNetworkRetryAttemptEvent(event);
@@ -267766,7 +267790,7 @@ function logNetworkRetryAttempt(config2, event) {
267766
267790
  model: event.model,
267767
267791
  attempt: event.attempt
267768
267792
  });
267769
- });
267793
+ }, config2);
267770
267794
  }
267771
267795
  function logContentRetry(config2, event) {
267772
267796
  ClearcutLogger.getInstance(config2)?.logContentRetryEvent(event);
@@ -267778,7 +267802,7 @@ function logContentRetry(config2, event) {
267778
267802
  };
267779
267803
  logger7.emit(logRecord);
267780
267804
  recordContentRetry(config2);
267781
- });
267805
+ }, config2);
267782
267806
  }
267783
267807
  function logContentRetryFailure(config2, event) {
267784
267808
  ClearcutLogger.getInstance(config2)?.logContentRetryFailureEvent(event);
@@ -267790,7 +267814,7 @@ function logContentRetryFailure(config2, event) {
267790
267814
  };
267791
267815
  logger7.emit(logRecord);
267792
267816
  recordContentRetryFailure(config2);
267793
- });
267817
+ }, config2);
267794
267818
  }
267795
267819
  function logModelRouting(config2, event) {
267796
267820
  ClearcutLogger.getInstance(config2)?.logModelRoutingEvent(event);
@@ -267802,7 +267826,7 @@ function logModelRouting(config2, event) {
267802
267826
  };
267803
267827
  logger7.emit(logRecord);
267804
267828
  recordModelRoutingMetrics(config2, event);
267805
- });
267829
+ }, config2);
267806
267830
  }
267807
267831
  function logModelSlashCommand(config2, event) {
267808
267832
  ClearcutLogger.getInstance(config2)?.logModelSlashCommandEvent(event);
@@ -267814,7 +267838,7 @@ function logModelSlashCommand(config2, event) {
267814
267838
  };
267815
267839
  logger7.emit(logRecord);
267816
267840
  recordModelSlashCommand(config2, event);
267817
- });
267841
+ }, config2);
267818
267842
  }
267819
267843
  async function logExtensionInstallEvent(config2, event) {
267820
267844
  await ClearcutLogger.getInstance(config2)?.logExtensionInstallEvent(event);
@@ -267825,7 +267849,7 @@ async function logExtensionInstallEvent(config2, event) {
267825
267849
  attributes: event.toOpenTelemetryAttributes(config2)
267826
267850
  };
267827
267851
  logger7.emit(logRecord);
267828
- });
267852
+ }, config2);
267829
267853
  }
267830
267854
  async function logExtensionUninstall(config2, event) {
267831
267855
  await ClearcutLogger.getInstance(config2)?.logExtensionUninstallEvent(event);
@@ -267836,7 +267860,7 @@ async function logExtensionUninstall(config2, event) {
267836
267860
  attributes: event.toOpenTelemetryAttributes(config2)
267837
267861
  };
267838
267862
  logger7.emit(logRecord);
267839
- });
267863
+ }, config2);
267840
267864
  }
267841
267865
  async function logExtensionUpdateEvent(config2, event) {
267842
267866
  await ClearcutLogger.getInstance(config2)?.logExtensionUpdateEvent(event);
@@ -267847,7 +267871,7 @@ async function logExtensionUpdateEvent(config2, event) {
267847
267871
  attributes: event.toOpenTelemetryAttributes(config2)
267848
267872
  };
267849
267873
  logger7.emit(logRecord);
267850
- });
267874
+ }, config2);
267851
267875
  }
267852
267876
  async function logExtensionEnable(config2, event) {
267853
267877
  await ClearcutLogger.getInstance(config2)?.logExtensionEnableEvent(event);
@@ -267858,7 +267882,7 @@ async function logExtensionEnable(config2, event) {
267858
267882
  attributes: event.toOpenTelemetryAttributes(config2)
267859
267883
  };
267860
267884
  logger7.emit(logRecord);
267861
- });
267885
+ }, config2);
267862
267886
  }
267863
267887
  async function logExtensionDisable(config2, event) {
267864
267888
  await ClearcutLogger.getInstance(config2)?.logExtensionDisableEvent(event);
@@ -267869,7 +267893,7 @@ async function logExtensionDisable(config2, event) {
267869
267893
  attributes: event.toOpenTelemetryAttributes(config2)
267870
267894
  };
267871
267895
  logger7.emit(logRecord);
267872
- });
267896
+ }, config2);
267873
267897
  }
267874
267898
  function logEditStrategy(config2, event) {
267875
267899
  ClearcutLogger.getInstance(config2)?.logEditStrategyEvent(event);
@@ -267880,7 +267904,7 @@ function logEditStrategy(config2, event) {
267880
267904
  attributes: event.toOpenTelemetryAttributes(config2)
267881
267905
  };
267882
267906
  logger7.emit(logRecord);
267883
- });
267907
+ }, config2);
267884
267908
  }
267885
267909
  function logEditCorrectionEvent(config2, event) {
267886
267910
  ClearcutLogger.getInstance(config2)?.logEditCorrectionEvent(event);
@@ -267891,7 +267915,7 @@ function logEditCorrectionEvent(config2, event) {
267891
267915
  attributes: event.toOpenTelemetryAttributes(config2)
267892
267916
  };
267893
267917
  logger7.emit(logRecord);
267894
- });
267918
+ }, config2);
267895
267919
  }
267896
267920
  function logAgentStart(config2, event) {
267897
267921
  ClearcutLogger.getInstance(config2)?.logAgentStartEvent(event);
@@ -267902,7 +267926,7 @@ function logAgentStart(config2, event) {
267902
267926
  attributes: event.toOpenTelemetryAttributes(config2)
267903
267927
  };
267904
267928
  logger7.emit(logRecord);
267905
- });
267929
+ }, config2);
267906
267930
  }
267907
267931
  function logAgentFinish(config2, event) {
267908
267932
  ClearcutLogger.getInstance(config2)?.logAgentFinishEvent(event);
@@ -267914,7 +267938,7 @@ function logAgentFinish(config2, event) {
267914
267938
  };
267915
267939
  logger7.emit(logRecord);
267916
267940
  recordAgentRunMetrics(config2, event);
267917
- });
267941
+ }, config2);
267918
267942
  }
267919
267943
  function logRecoveryAttempt(config2, event) {
267920
267944
  ClearcutLogger.getInstance(config2)?.logRecoveryAttemptEvent(event);
@@ -267926,7 +267950,7 @@ function logRecoveryAttempt(config2, event) {
267926
267950
  };
267927
267951
  logger7.emit(logRecord);
267928
267952
  recordRecoveryAttemptMetrics(config2, event);
267929
- });
267953
+ }, config2);
267930
267954
  }
267931
267955
  function logWebFetchFallbackAttempt(config2, event) {
267932
267956
  ClearcutLogger.getInstance(config2)?.logWebFetchFallbackAttemptEvent(event);
@@ -267937,7 +267961,7 @@ function logWebFetchFallbackAttempt(config2, event) {
267937
267961
  attributes: event.toOpenTelemetryAttributes(config2)
267938
267962
  };
267939
267963
  logger7.emit(logRecord);
267940
- });
267964
+ }, config2);
267941
267965
  }
267942
267966
  function logLlmLoopCheck(config2, event) {
267943
267967
  ClearcutLogger.getInstance(config2)?.logLlmLoopCheckEvent(event);
@@ -267948,7 +267972,7 @@ function logLlmLoopCheck(config2, event) {
267948
267972
  attributes: event.toOpenTelemetryAttributes(config2)
267949
267973
  };
267950
267974
  logger7.emit(logRecord);
267951
- });
267975
+ }, config2);
267952
267976
  }
267953
267977
  function logApprovalModeSwitch(config2, event) {
267954
267978
  ClearcutLogger.getInstance(config2)?.logApprovalModeSwitchEvent(event);
@@ -267957,7 +267981,7 @@ function logApprovalModeSwitch(config2, event) {
267957
267981
  body: event.toLogBody(),
267958
267982
  attributes: event.toOpenTelemetryAttributes(config2)
267959
267983
  });
267960
- });
267984
+ }, config2);
267961
267985
  }
267962
267986
  function logApprovalModeDuration(config2, event) {
267963
267987
  ClearcutLogger.getInstance(config2)?.logApprovalModeDurationEvent(event);
@@ -267966,7 +267990,7 @@ function logApprovalModeDuration(config2, event) {
267966
267990
  body: event.toLogBody(),
267967
267991
  attributes: event.toOpenTelemetryAttributes(config2)
267968
267992
  });
267969
- });
267993
+ }, config2);
267970
267994
  }
267971
267995
  function logPlanExecution(config2, event) {
267972
267996
  ClearcutLogger.getInstance(config2)?.logPlanExecutionEvent(event);
@@ -267978,7 +268002,7 @@ function logPlanExecution(config2, event) {
267978
268002
  recordPlanExecution(config2, {
267979
268003
  approval_mode: event.approval_mode
267980
268004
  });
267981
- });
268005
+ }, config2);
267982
268006
  }
267983
268007
  function logHookCall(config2, event) {
267984
268008
  ClearcutLogger.getInstance(config2)?.logHookCallEvent(event);
@@ -267990,7 +268014,7 @@ function logHookCall(config2, event) {
267990
268014
  };
267991
268015
  logger7.emit(logRecord);
267992
268016
  recordHookCallMetrics(config2, event.hook_event_name, event.hook_name, event.duration_ms, event.success);
267993
- });
268017
+ }, config2);
267994
268018
  }
267995
268019
  function logStartupStats(config2, event) {
267996
268020
  ClearcutLogger.getInstance(config2)?.logStartupStatsEvent(event);
@@ -268005,7 +268029,7 @@ function logStartupStats(config2, event) {
268005
268029
  }).catch((e3) => {
268006
268030
  debugLogger.error("Failed to log telemetry event", e3);
268007
268031
  });
268008
- });
268032
+ }, config2);
268009
268033
  }
268010
268034
  function logKeychainAvailability(config2, event) {
268011
268035
  ClearcutLogger.getInstance(config2)?.logKeychainAvailabilityEvent(event);
@@ -268017,7 +268041,7 @@ function logKeychainAvailability(config2, event) {
268017
268041
  };
268018
268042
  logger7.emit(logRecord);
268019
268043
  recordKeychainAvailability(config2, event);
268020
- });
268044
+ }, config2);
268021
268045
  }
268022
268046
  function logTokenStorageInitialization(config2, event) {
268023
268047
  ClearcutLogger.getInstance(config2)?.logTokenStorageInitializationEvent(event);
@@ -268029,7 +268053,7 @@ function logTokenStorageInitialization(config2, event) {
268029
268053
  };
268030
268054
  logger7.emit(logRecord);
268031
268055
  recordTokenStorageInitialization(config2, event);
268032
- });
268056
+ }, config2);
268033
268057
  }
268034
268058
  function logOnboardingStart(config2, event) {
268035
268059
  ClearcutLogger.getInstance(config2)?.logOnboardingStartEvent(event);
@@ -268041,7 +268065,7 @@ function logOnboardingStart(config2, event) {
268041
268065
  };
268042
268066
  logger7.emit(logRecord);
268043
268067
  recordOnboardingStart(config2);
268044
- });
268068
+ }, config2);
268045
268069
  }
268046
268070
  function logOnboardingSuccess(config2, event) {
268047
268071
  ClearcutLogger.getInstance(config2)?.logOnboardingSuccessEvent(event);
@@ -268053,7 +268077,7 @@ function logOnboardingSuccess(config2, event) {
268053
268077
  };
268054
268078
  logger7.emit(logRecord);
268055
268079
  recordOnboardingSuccess(config2, event.userTier, event.duration_ms);
268056
- });
268080
+ }, config2);
268057
268081
  }
268058
268082
  function logBillingEvent(config2, event) {
268059
268083
  bufferTelemetryEvent(() => {
@@ -268063,7 +268087,7 @@ function logBillingEvent(config2, event) {
268063
268087
  attributes: event.toOpenTelemetryAttributes(config2)
268064
268088
  };
268065
268089
  logger7.emit(logRecord);
268066
- });
268090
+ }, config2);
268067
268091
  const cc = ClearcutLogger.getInstance(config2);
268068
268092
  if (cc) {
268069
268093
  if (event instanceof CreditsUsedEvent) {
@@ -318232,7 +318256,7 @@ function getVersion() {
318232
318256
  }
318233
318257
  versionPromise = (async () => {
318234
318258
  const pkgJson = await getPackageJson(__dirname4);
318235
- return "0.1.30-pre.1";
318259
+ return "0.1.30-pre.2";
318236
318260
  })();
318237
318261
  return versionPromise;
318238
318262
  }
@@ -323807,11 +323831,14 @@ var init_loggingContentGenerator = __esm({
323807
323831
  get paidTier() {
323808
323832
  return this.wrapped.paidTier;
323809
323833
  }
323834
+ shouldRecordPromptPayloads() {
323835
+ return Boolean(this.config.getTelemetryLogPromptsEnabled?.()) && Boolean(this.config.getTelemetryTracesEnabled?.());
323836
+ }
323810
323837
  logApiRequest(contents, model, promptId, role, generationConfig, serverDetails) {
323811
- const requestText = JSON.stringify(contents);
323838
+ const requestText = this.config.getTelemetryLogPromptsEnabled?.() ? safeJsonStringify(contents) : void 0;
323812
323839
  logApiRequest(this.config, new ApiRequestEvent(model, {
323813
323840
  prompt_id: promptId,
323814
- contents,
323841
+ contents: this.shouldRecordPromptPayloads() ? contents : [],
323815
323842
  generate_content_config: generationConfig,
323816
323843
  server: serverDetails
323817
323844
  }, requestText, role));
@@ -323847,7 +323874,7 @@ var init_loggingContentGenerator = __esm({
323847
323874
  _logApiResponse(requestContents, durationMs, model, prompt_id, role, responseId, responseCandidates, usageMetadata, responseText, generationConfig, serverDetails) {
323848
323875
  const event = new ApiResponseEvent(model, durationMs, {
323849
323876
  prompt_id,
323850
- contents: requestContents,
323877
+ contents: this.shouldRecordPromptPayloads() ? requestContents : [],
323851
323878
  generate_content_config: generationConfig,
323852
323879
  server: serverDetails
323853
323880
  }, {
@@ -323885,7 +323912,7 @@ var init_loggingContentGenerator = __esm({
323885
323912
  const errorType = getErrorType(error40);
323886
323913
  logApiError(this.config, new ApiErrorEvent(model, errorMessage, durationMs, {
323887
323914
  prompt_id,
323888
- contents: requestContents,
323915
+ contents: this.shouldRecordPromptPayloads() ? requestContents : [],
323889
323916
  generate_content_config: generationConfig,
323890
323917
  server: serverDetails
323891
323918
  }, this.config.getContentGeneratorConfig()?.authType, errorType, isStructuredError(error40) ? (
@@ -323917,13 +323944,13 @@ var init_loggingContentGenerator = __esm({
323917
323944
  spanMetadata.attributes[GEN_AI_USAGE_INPUT_TOKENS] = response.usageMetadata?.promptTokenCount ?? 0;
323918
323945
  spanMetadata.attributes[GEN_AI_USAGE_OUTPUT_TOKENS] = response.usageMetadata?.candidatesTokenCount ?? 0;
323919
323946
  const durationMs = Date.now() - startTime;
323920
- this._logApiResponse(contents, durationMs, response.modelVersion || req.model, userPromptId, role, response.responseId, response.candidates, response.usageMetadata, JSON.stringify({
323947
+ this._logApiResponse(contents, durationMs, response.modelVersion || req.model, userPromptId, role, response.responseId, response.candidates, response.usageMetadata, this.config.getTelemetryLogPromptsEnabled?.() ? safeJsonStringify({
323921
323948
  candidates: response.candidates,
323922
323949
  usageMetadata: response.usageMetadata,
323923
323950
  responseId: response.responseId,
323924
323951
  modelVersion: response.modelVersion,
323925
323952
  promptFeedback: response.promptFeedback
323926
- }), req.config, serverDetails);
323953
+ }) : void 0, req.config, serverDetails);
323927
323954
  this.config.refreshUserQuotaIfStale().catch((e3) => debugLogger.debug("quota refresh failed", e3));
323928
323955
  return response;
323929
323956
  } catch (error40) {
@@ -323981,13 +324008,13 @@ var init_loggingContentGenerator = __esm({
323981
324008
  yield response;
323982
324009
  }
323983
324010
  const durationMs = Date.now() - startTime;
323984
- this._logApiResponse(requestContents, durationMs, responses[0]?.modelVersion || req.model, userPromptId, role, responses[0]?.responseId, responses.flatMap((response) => response.candidates || []), lastUsageMetadata, JSON.stringify(responses.map((r4) => ({
324011
+ this._logApiResponse(requestContents, durationMs, responses[0]?.modelVersion || req.model, userPromptId, role, responses[0]?.responseId, responses.flatMap((response) => response.candidates || []), lastUsageMetadata, this.config.getTelemetryLogPromptsEnabled?.() ? safeJsonStringify(responses.map((r4) => ({
323985
324012
  candidates: r4.candidates,
323986
324013
  usageMetadata: r4.usageMetadata,
323987
324014
  responseId: r4.responseId,
323988
324015
  modelVersion: r4.modelVersion,
323989
324016
  promptFeedback: r4.promptFeedback
323990
- }))), req.config, serverDetails);
324017
+ }))) : void 0, req.config, serverDetails);
323991
324018
  this.config.refreshUserQuotaIfStale().catch((e3) => debugLogger.debug("quota refresh failed", e3));
323992
324019
  spanMetadata.output = responses.map((response) => response.candidates?.[0]?.content ?? null);
323993
324020
  if (lastUsageMetadata) {
@@ -329459,7 +329486,7 @@ function getSafeGitEnv(baseEnv = process.env) {
329459
329486
  const execMatch = baseSshCommand.match(/^\s*(?:"([^"]+)"|'([^']+)'|(\S+))/);
329460
329487
  const executable = execMatch ? execMatch[1] || execMatch[2] || execMatch[3] || "" : "";
329461
329488
  const execName = executable.split(/[/\\]/).pop() || "";
329462
- const isPlink = /^(?:tortoise)?plink(?:\.exe)?$/i.test(execName);
329489
+ const isPlink = /^(?:tortoise(?:git)?)?plink(?:\.exe)?$/i.test(execName);
329463
329490
  const batchFlag = isPlink ? "-batch" : "-o BatchMode=yes";
329464
329491
  const hasBatchFlag = isPlink ? /(?:^|\s)-batch(?:\s|$)/.test(baseSshCommand) : /\bbatchmode\s*=\s*yes\b/i.test(baseSshCommand) && !/\bbatchmode\s*=\s*no\b/i.test(baseSshCommand);
329465
329492
  let gitSshCommand = baseSshCommand;
@@ -356876,7 +356903,7 @@ function collapseOlderFunctionResponses(history, maxBytesPerOldResponse = COLLAP
356876
356903
  if (part.inlineData) {
356877
356904
  partsModified = true;
356878
356905
  return {
356879
- text: "[Binary content omitted from previous turn to conserve memory]"
356906
+ text: OMITTED_BINARY_MESSAGE
356880
356907
  };
356881
356908
  }
356882
356909
  if (!part.functionResponse?.response) {
@@ -356996,30 +357023,63 @@ async function truncateHistoryToBudget(history, config2) {
356996
357023
  } else {
356997
357024
  contentStr = JSON.stringify(responseObj, null, 2);
356998
357025
  }
356999
- const tokens = estimateTokenCountSync([{ text: contentStr }]);
357026
+ contentStr = contentStr ?? "";
357027
+ const nestedParts = part.functionResponse.parts ?? [];
357028
+ if (!contentStr && nestedParts.length > 0) {
357029
+ contentStr = nestedParts.map((p2) => p2.text || (p2.inlineData ? `[Inline Data: ${p2.inlineData.mimeType}]` : "")).filter(Boolean).join("\n") || JSON.stringify(nestedParts, null, 2);
357030
+ }
357031
+ const nestedTokens = nestedParts.length > 0 ? estimateTokenCountSync(nestedParts) : 0;
357032
+ const textTokens = estimateTokenCountSync([{ text: contentStr }]);
357033
+ const tokens = textTokens + nestedTokens;
357000
357034
  if (functionResponseTokenCounter + tokens > COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET) {
357001
- try {
357002
- const { outputFile } = await saveTruncatedToolOutput(contentStr, part.functionResponse.name ?? "unknown_tool", config2.getNextCompressionTruncationId(), config2.storage.getProjectTempDir());
357003
- const truncatedMessage = formatTruncatedToolOutput(contentStr, outputFile, config2.getTruncateToolOutputThreshold());
357035
+ const toolName = part.functionResponse.name?.trim() || "generic_tool";
357036
+ if (part.functionResponse.response !== void 0 && nestedParts.length > 0 && functionResponseTokenCounter + textTokens <= COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET) {
357004
357037
  newParts.unshift({
357005
357038
  functionResponse: {
357006
- // eslint-disable-next-line @typescript-eslint/no-misused-spread
357007
- ...part.functionResponse,
357008
- response: { output: truncatedMessage }
357039
+ id: part.functionResponse.id,
357040
+ name: toolName,
357041
+ response: part.functionResponse.response
357009
357042
  }
357010
357043
  });
357011
- functionResponseTokenCounter += estimateTokenCountSync([
357012
- { text: truncatedMessage }
357013
- ]);
357014
- } catch (error40) {
357015
- debugLogger.debug("Failed to truncate history to budget:", error40);
357016
- newParts.unshift(part);
357017
- functionResponseTokenCounter += tokens;
357044
+ functionResponseTokenCounter += textTokens;
357045
+ } else {
357046
+ try {
357047
+ const { outputFile } = await saveTruncatedToolOutput(contentStr, toolName, config2.getNextCompressionTruncationId(), config2.storage.getProjectTempDir());
357048
+ const truncatedMessage = formatTruncatedToolOutput(contentStr, outputFile, config2.getTruncateToolOutputThreshold());
357049
+ newParts.unshift({
357050
+ functionResponse: {
357051
+ id: part.functionResponse.id,
357052
+ name: toolName,
357053
+ response: { output: truncatedMessage }
357054
+ }
357055
+ });
357056
+ functionResponseTokenCounter += estimateTokenCountSync([
357057
+ { text: truncatedMessage }
357058
+ ]);
357059
+ } catch (error40) {
357060
+ debugLogger.debug("Failed to truncate history to budget:", error40);
357061
+ newParts.unshift(part);
357062
+ functionResponseTokenCounter += tokens;
357063
+ }
357018
357064
  }
357019
357065
  } else {
357020
357066
  functionResponseTokenCounter += tokens;
357021
357067
  newParts.unshift(part);
357022
357068
  }
357069
+ } else if (part.inlineData) {
357070
+ const tokens = estimateTokenCountSync([part]);
357071
+ if (functionResponseTokenCounter + tokens > COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET) {
357072
+ const omittedPart = {
357073
+ text: OMITTED_BINARY_MESSAGE
357074
+ };
357075
+ newParts.unshift(omittedPart);
357076
+ functionResponseTokenCounter += estimateTokenCountSync([
357077
+ omittedPart
357078
+ ]);
357079
+ } else {
357080
+ functionResponseTokenCounter += tokens;
357081
+ newParts.unshift(part);
357082
+ }
357023
357083
  } else {
357024
357084
  newParts.unshift(part);
357025
357085
  }
@@ -357029,7 +357089,7 @@ async function truncateHistoryToBudget(history, config2) {
357029
357089
  }
357030
357090
  return truncatedHistory;
357031
357091
  }
357032
- var DEFAULT_COMPRESSION_TOKEN_THRESHOLD, RECENT_TURNS_PROTECTED, RETRIEVAL_TOOL_NAMES_EXEMPT_FROM_COLLAPSE, COLLAPSED_FUNCTION_RESPONSE_MAX_BYTES, MAX_EXEMPT_RETRIEVAL_HISTORY_BYTES, COLLAPSE_HISTORY_BYTE_THRESHOLD, defaultGraphemeSegmenter, COMPRESSION_PRESERVE_THRESHOLD, COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET, ChatCompressionService;
357092
+ var DEFAULT_COMPRESSION_TOKEN_THRESHOLD, RECENT_TURNS_PROTECTED, RETRIEVAL_TOOL_NAMES_EXEMPT_FROM_COLLAPSE, COLLAPSED_FUNCTION_RESPONSE_MAX_BYTES, MAX_EXEMPT_RETRIEVAL_HISTORY_BYTES, COLLAPSE_HISTORY_BYTE_THRESHOLD, OMITTED_BINARY_MESSAGE, defaultGraphemeSegmenter, COMPRESSION_PRESERVE_THRESHOLD, COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET, ChatCompressionService;
357033
357093
  var init_chatCompressionService = __esm({
357034
357094
  "packages/core/dist/src/context/chatCompressionService.js"() {
357035
357095
  "use strict";
@@ -357061,6 +357121,7 @@ var init_chatCompressionService = __esm({
357061
357121
  COLLAPSED_FUNCTION_RESPONSE_MAX_BYTES = 2048;
357062
357122
  MAX_EXEMPT_RETRIEVAL_HISTORY_BYTES = 64 * 1024;
357063
357123
  COLLAPSE_HISTORY_BYTE_THRESHOLD = 256 * 1024;
357124
+ OMITTED_BINARY_MESSAGE = "[Binary content omitted from previous turn to conserve memory]";
357064
357125
  defaultGraphemeSegmenter = new Intl.Segmenter(void 0, {
357065
357126
  granularity: "grapheme"
357066
357127
  });
@@ -373355,7 +373416,10 @@ ${responseText}` : responseText;
373355
373416
  const result2 = await this.toolOutputMaskingService.mask(history, this.config);
373356
373417
  let updatedHistory = result2.maskedCount > 0 ? result2.newHistory : history;
373357
373418
  if (calculateHistoryByteSize(updatedHistory) >= COLLAPSE_HISTORY_BYTE_THRESHOLD) {
373358
- updatedHistory = collapseOlderFunctionResponses([...updatedHistory]);
373419
+ const collapsedHistory = collapseOlderFunctionResponses(updatedHistory);
373420
+ if (collapsedHistory !== updatedHistory) {
373421
+ updatedHistory = collapsedHistory;
373422
+ }
373359
373423
  }
373360
373424
  if (updatedHistory !== history) {
373361
373425
  const existingTurns = chat.getHistoryTurns?.(false);
@@ -511678,7 +511742,7 @@ async function loadSandboxConfig(settings, argv) {
511678
511742
  }
511679
511743
  const command2 = getSandboxCommand(sandboxValue);
511680
511744
  const packageJson2 = await getPackageJson(__dirname11);
511681
- const image3 = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.69.0-nightly.20261104.g89e9d25d6" ?? customImage ?? packageJson2?.config?.sandboxImageUri;
511745
+ const image3 = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.70.0-nightly.20261110.g1603e9bab" ?? customImage ?? packageJson2?.config?.sandboxImageUri;
511682
511746
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
511683
511747
  return command2 && (image3 || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image: image3 } : void 0;
511684
511748
  }
@@ -520603,7 +520667,7 @@ var GIT_COMMIT_INFO2;
520603
520667
  var init_git_commit2 = __esm({
520604
520668
  "packages/cli/src/generated/git-commit.ts"() {
520605
520669
  "use strict";
520606
- GIT_COMMIT_INFO2 = "0fcc42b";
520670
+ GIT_COMMIT_INFO2 = "d95638c";
520607
520671
  }
520608
520672
  });
520609
520673