@protolabsai/proto 0.25.14 → 0.25.15

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 (2) hide show
  1. package/cli.js +59 -6
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -170894,7 +170894,7 @@ __export(geminiContentGenerator_exports, {
170894
170894
  createGeminiContentGenerator: () => createGeminiContentGenerator
170895
170895
  });
170896
170896
  function createGeminiContentGenerator(config2, gcConfig) {
170897
- const version2 = "0.25.14";
170897
+ const version2 = "0.25.15";
170898
170898
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
170899
170899
  const baseHeaders = {
170900
170900
  "User-Agent": userAgent2
@@ -171950,6 +171950,50 @@ function extractCuratedHistory2(comprehensiveHistory) {
171950
171950
  }
171951
171951
  return curatedHistory;
171952
171952
  }
171953
+ function hasTruncationCascade(contents) {
171954
+ if (contents.length === 0)
171955
+ return false;
171956
+ const last2 = contents[contents.length - 1];
171957
+ if (last2.role !== "user")
171958
+ return false;
171959
+ return last2.parts?.some((p2) => {
171960
+ const err2 = p2.functionResponse?.response?.["error"];
171961
+ return typeof err2 === "string" && err2.includes(TRUNCATION_CASCADE_MARKER);
171962
+ }) ?? false;
171963
+ }
171964
+ function trimLargeToolResponsesFromContext(contents) {
171965
+ return contents.map((content) => {
171966
+ if (content.role !== "user" || !content.parts)
171967
+ return content;
171968
+ const needsTrim = content.parts.some((p2) => {
171969
+ const out2 = p2.functionResponse?.response?.["output"];
171970
+ return typeof out2 === "string" && out2.length > LARGE_TOOL_RESPONSE_TRIM_CHARS;
171971
+ });
171972
+ if (!needsTrim)
171973
+ return content;
171974
+ return {
171975
+ ...content,
171976
+ parts: content.parts.map((p2) => {
171977
+ const out2 = p2.functionResponse?.response?.["output"];
171978
+ if (typeof out2 !== "string" || out2.length <= LARGE_TOOL_RESPONSE_TRIM_CHARS)
171979
+ return p2;
171980
+ const trimmed2 = out2.slice(0, LARGE_TOOL_RESPONSE_TRIM_CHARS) + `
171981
+
171982
+ [... output trimmed from ${out2.length} to ${LARGE_TOOL_RESPONSE_TRIM_CHARS} chars to reduce context size ...]`;
171983
+ return {
171984
+ ...p2,
171985
+ functionResponse: {
171986
+ ...p2.functionResponse,
171987
+ response: {
171988
+ ...p2.functionResponse.response,
171989
+ output: trimmed2
171990
+ }
171991
+ }
171992
+ };
171993
+ })
171994
+ };
171995
+ });
171996
+ }
171953
171997
  function trimToolErrorsFromContext(contents, maxTrimPairs = 6) {
171954
171998
  const trimmed2 = [...contents];
171955
171999
  let trimmed_count = 0;
@@ -171977,7 +172021,7 @@ function isSchemaDepthError(errorMessage) {
171977
172021
  function isInvalidArgumentError(errorMessage) {
171978
172022
  return errorMessage.includes("Request contains an invalid argument");
171979
172023
  }
171980
- var debugLogger22, StreamEventType, INVALID_CONTENT_RETRY_OPTIONS, INVALID_STREAM_RETRY_CONFIG, RATE_LIMIT_RETRY_OPTIONS, InvalidStreamError, GeminiChat;
172024
+ var debugLogger22, StreamEventType, INVALID_CONTENT_RETRY_OPTIONS, INVALID_STREAM_RETRY_CONFIG, RATE_LIMIT_RETRY_OPTIONS, TRUNCATION_CASCADE_MARKER, LARGE_TOOL_RESPONSE_TRIM_CHARS, InvalidStreamError, GeminiChat;
171981
172025
  var init_geminiChat = __esm({
171982
172026
  "packages/core/dist/src/core/geminiChat.js"() {
171983
172027
  "use strict";
@@ -172016,6 +172060,10 @@ var init_geminiChat = __esm({
172016
172060
  __name(isValidContentPart, "isValidContentPart");
172017
172061
  __name(validateHistory2, "validateHistory");
172018
172062
  __name(extractCuratedHistory2, "extractCuratedHistory");
172063
+ TRUNCATION_CASCADE_MARKER = "truncated due to max_tokens limit";
172064
+ LARGE_TOOL_RESPONSE_TRIM_CHARS = 1e4;
172065
+ __name(hasTruncationCascade, "hasTruncationCascade");
172066
+ __name(trimLargeToolResponsesFromContext, "trimLargeToolResponsesFromContext");
172019
172067
  __name(trimToolErrorsFromContext, "trimToolErrorsFromContext");
172020
172068
  InvalidStreamError = class extends Error {
172021
172069
  static {
@@ -172094,7 +172142,12 @@ var init_geminiChat = __esm({
172094
172142
  this.sendPromise = streamDonePromise;
172095
172143
  const userContent = createUserContent(params.message);
172096
172144
  this.history.push(userContent);
172097
- const requestContents = this.getHistory(true);
172145
+ let requestContents = this.getHistory(true);
172146
+ if (hasTruncationCascade(requestContents)) {
172147
+ const withoutErrors = trimToolErrorsFromContext(requestContents);
172148
+ requestContents = trimLargeToolResponsesFromContext(withoutErrors);
172149
+ debugLogger22.warn(`MAX_TOKENS cascade detected: trimmed context from ${this.getHistory(true).length} to ${requestContents.length} entries and capped large tool responses.`);
172150
+ }
172098
172151
  const self2 = this;
172099
172152
  return async function* () {
172100
172153
  try {
@@ -414908,7 +414961,7 @@ __name(getPackageJson, "getPackageJson");
414908
414961
  // packages/cli/src/utils/version.ts
414909
414962
  async function getCliVersion() {
414910
414963
  const pkgJson = await getPackageJson();
414911
- return "0.25.14";
414964
+ return "0.25.15";
414912
414965
  }
414913
414966
  __name(getCliVersion, "getCliVersion");
414914
414967
 
@@ -422680,7 +422733,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
422680
422733
 
422681
422734
  // packages/cli/src/generated/git-commit.ts
422682
422735
  init_esbuild_shims();
422683
- var GIT_COMMIT_INFO = "a04b13211";
422736
+ var GIT_COMMIT_INFO = "eda760681";
422684
422737
 
422685
422738
  // packages/cli/src/utils/systemInfo.ts
422686
422739
  async function getNpmVersion() {
@@ -490159,7 +490212,7 @@ var QwenAgent = class {
490159
490212
  async initialize(args2) {
490160
490213
  this.clientCapabilities = args2.clientCapabilities;
490161
490214
  const authMethods = buildAuthMethods();
490162
- const version2 = "0.25.14";
490215
+ const version2 = "0.25.15";
490163
490216
  return {
490164
490217
  protocolVersion: PROTOCOL_VERSION,
490165
490218
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protolabsai/proto",
3
- "version": "0.25.14",
3
+ "version": "0.25.15",
4
4
  "description": "proto - AI-powered coding agent",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "bundled"
22
22
  ],
23
23
  "config": {
24
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.25.14"
24
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.25.15"
25
25
  },
26
26
  "dependencies": {},
27
27
  "optionalDependencies": {