@protolabsai/proto 0.30.0 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +65 -9
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -155944,7 +155944,7 @@ var init_pipeline = __esm({
155944
155944
  this.converter = new OpenAIContentConverter(this.contentGeneratorConfig.model, this.contentGeneratorConfig.schemaCompliance, this.contentGeneratorConfig.modalities ?? {});
155945
155945
  }
155946
155946
  async execute(request3, userPromptId) {
155947
- const effectiveModel = this.contentGeneratorConfig.model;
155947
+ const effectiveModel = this.resolveEffectiveModel(request3);
155948
155948
  this.converter.setModel(effectiveModel);
155949
155949
  this.converter.setModalities(this.contentGeneratorConfig.modalities ?? {});
155950
155950
  return this.executeWithErrorHandling(request3, userPromptId, false, effectiveModel, async (openaiRequest) => {
@@ -155956,7 +155956,7 @@ var init_pipeline = __esm({
155956
155956
  });
155957
155957
  }
155958
155958
  async executeStream(request3, userPromptId) {
155959
- const effectiveModel = this.contentGeneratorConfig.model;
155959
+ const effectiveModel = this.resolveEffectiveModel(request3);
155960
155960
  this.converter.setModel(effectiveModel);
155961
155961
  this.converter.setModalities(this.contentGeneratorConfig.modalities ?? {});
155962
155962
  return this.executeWithErrorHandling(request3, userPromptId, true, effectiveModel, async (openaiRequest, context2) => {
@@ -156306,6 +156306,22 @@ var init_pipeline = __esm({
156306
156306
  context2.duration = Date.now() - context2.startTime;
156307
156307
  this.config.errorHandler.handle(error40, context2, request3);
156308
156308
  }
156309
+ /**
156310
+ * Resolve which model to actually send to the upstream. Defaults to the
156311
+ * configured model. Callers may opt into using `request.model` instead by
156312
+ * setting `request.config.allowModelOverride = true` — the request.model
156313
+ * string is used verbatim and the caller takes responsibility for it being
156314
+ * valid/available on the backend (e.g. recap → "protolabs/fast" alias).
156315
+ */
156316
+ resolveEffectiveModel(request3) {
156317
+ const configured = this.contentGeneratorConfig.model;
156318
+ const allowOverride = request3.config?.["allowModelOverride"] === true;
156319
+ const requested = request3.model;
156320
+ if (allowOverride && typeof requested === "string" && requested.length > 0) {
156321
+ return requested;
156322
+ }
156323
+ return configured;
156324
+ }
156309
156325
  /**
156310
156326
  * Create request context with common properties
156311
156327
  */
@@ -169067,7 +169083,7 @@ __export(geminiContentGenerator_exports, {
169067
169083
  createGeminiContentGenerator: () => createGeminiContentGenerator
169068
169084
  });
169069
169085
  function createGeminiContentGenerator(config2, gcConfig) {
169070
- const version2 = "0.30.0";
169086
+ const version2 = "0.31.1";
169071
169087
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
169072
169088
  const baseHeaders = {
169073
169089
  "User-Agent": userAgent2
@@ -210664,6 +210680,22 @@ Usage notes:
210664
210680
  - Users will always be able to select "Other" to provide custom text input
210665
210681
  - Use multiSelect: true to allow multiple answers to be selected for a question
210666
210682
  - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
210683
+ - IMPORTANT: \`questions\` is a real array. Do NOT JSON-encode it as a string.
210684
+
210685
+ Example shape (replace placeholder text with your actual question/options):
210686
+ {
210687
+ "questions": [
210688
+ {
210689
+ "question": "<your question, ending in '?'>",
210690
+ "header": "<short label, \u226430 chars>",
210691
+ "options": [
210692
+ { "label": "<choice A>", "description": "<what choice A means>" },
210693
+ { "label": "<choice B>", "description": "<what choice B means>" }
210694
+ ],
210695
+ "multiSelect": false
210696
+ }
210697
+ ]
210698
+ }
210667
210699
 
210668
210700
  Plan mode note: In plan mode, use this tool to clarify requirements or choose between approaches BEFORE finalizing your plan. Do NOT use this tool to ask "Is this plan ready?" or "Should I proceed?" - use ExitPlanMode for plan approval.
210669
210701
  `;
@@ -210843,6 +210875,16 @@ ${answersContent}`;
210843
210875
  this.config = config2;
210844
210876
  }
210845
210877
  validateToolParams(params) {
210878
+ if (typeof params.questions === "string") {
210879
+ const raw2 = params.questions;
210880
+ try {
210881
+ const parsed = JSON.parse(raw2);
210882
+ debugLogger40.warn(`[ask_user_question] coerced stringified questions array (len=${raw2.length}). Model emitted JSON-encoded string instead of native array.`);
210883
+ params.questions = parsed;
210884
+ } catch {
210885
+ return 'Parameter "questions" was a string that could not be parsed as JSON. Pass `questions` as a real array literal, not a JSON-encoded string.';
210886
+ }
210887
+ }
210846
210888
  if (!Array.isArray(params.questions)) {
210847
210889
  return 'Parameter "questions" must be an array.';
210848
210890
  }
@@ -284998,6 +285040,13 @@ var init_followup = __esm({
284998
285040
  });
284999
285041
 
285000
285042
  // packages/core/dist/src/recap/recapGenerator.js
285043
+ function pickRecapModel(config2) {
285044
+ const available = config2.getModelsConfig().getAllConfiguredModels();
285045
+ if (available.some((m3) => m3.id === PREFERRED_RECAP_MODEL_ID)) {
285046
+ return { model: PREFERRED_RECAP_MODEL_ID, isOverride: true };
285047
+ }
285048
+ return { model: config2.getModel(), isOverride: false };
285049
+ }
285001
285050
  async function generateRecap(config2, conversationHistory, abortSignal) {
285002
285051
  if (conversationHistory.length === 0)
285003
285052
  return null;
@@ -285007,9 +285056,10 @@ async function generateRecap(config2, conversationHistory, abortSignal) {
285007
285056
  ...recent,
285008
285057
  { role: "user", parts: [{ text: RECAP_PROMPT }] }
285009
285058
  ];
285059
+ const { model, isOverride } = pickRecapModel(config2);
285010
285060
  const generator = config2.getContentGenerator();
285011
285061
  const response = await generator.generateContent({
285012
- model: config2.getModel(),
285062
+ model,
285013
285063
  contents,
285014
285064
  config: {
285015
285065
  abortSignal,
@@ -285018,7 +285068,11 @@ async function generateRecap(config2, conversationHistory, abortSignal) {
285018
285068
  // tool-stripping path. Without this, assistant turns containing
285019
285069
  // tool_calls — i.e. most of the agent's actual work — are dropped
285020
285070
  // before the request leaves, starving the recap of context.
285021
- tools: []
285071
+ tools: [],
285072
+ // Opt into the model override path in the OpenAI pipeline. Pipeline
285073
+ // ignores request.model by default for safety; for recap we know the
285074
+ // alias resolves on the gateway, so honor it.
285075
+ ...isOverride ? { allowModelOverride: true } : {}
285022
285076
  }
285023
285077
  }, "recap");
285024
285078
  const text = response.candidates?.[0]?.content?.parts?.map((p2) => p2.text ?? "").join("").trim();
@@ -285032,7 +285086,7 @@ async function generateRecap(config2, conversationHistory, abortSignal) {
285032
285086
  return null;
285033
285087
  }
285034
285088
  }
285035
- var debugLogger99, RECENT_MESSAGE_WINDOW, RECAP_PROMPT;
285089
+ var debugLogger99, RECENT_MESSAGE_WINDOW, PREFERRED_RECAP_MODEL_ID, RECAP_PROMPT;
285036
285090
  var init_recapGenerator = __esm({
285037
285091
  "packages/core/dist/src/recap/recapGenerator.js"() {
285038
285092
  "use strict";
@@ -285040,11 +285094,13 @@ var init_recapGenerator = __esm({
285040
285094
  init_debugLogger();
285041
285095
  debugLogger99 = createDebugLogger("RECAP");
285042
285096
  RECENT_MESSAGE_WINDOW = 30;
285097
+ PREFERRED_RECAP_MODEL_ID = "protolabs/fast";
285043
285098
  RECAP_PROMPT = `That last agent turn was long. Summarize where we are so the user can pick back up cold.
285044
285099
 
285045
285100
  Write exactly 1-3 short sentences. Lead with the high-level goal \u2014 what they're building or debugging, not implementation details. Then state the concrete current status or next step. No status reports, no commit recaps, no apologies.
285046
285101
 
285047
285102
  Reply with ONLY the recap text \u2014 no headers, no quotes, no preamble.`;
285103
+ __name(pickRecapModel, "pickRecapModel");
285048
285104
  __name(generateRecap, "generateRecap");
285049
285105
  }
285050
285106
  });
@@ -414963,7 +415019,7 @@ __name(getPackageJson, "getPackageJson");
414963
415019
  // packages/cli/src/utils/version.ts
414964
415020
  async function getCliVersion() {
414965
415021
  const pkgJson = await getPackageJson();
414966
- return "0.30.0";
415022
+ return "0.31.1";
414967
415023
  }
414968
415024
  __name(getCliVersion, "getCliVersion");
414969
415025
 
@@ -422735,7 +422791,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
422735
422791
 
422736
422792
  // packages/cli/src/generated/git-commit.ts
422737
422793
  init_esbuild_shims();
422738
- var GIT_COMMIT_INFO = "482391a6a";
422794
+ var GIT_COMMIT_INFO = "eb13fd9ee";
422739
422795
 
422740
422796
  // packages/cli/src/utils/systemInfo.ts
422741
422797
  async function getNpmVersion() {
@@ -490901,7 +490957,7 @@ var QwenAgent = class {
490901
490957
  async initialize(args2) {
490902
490958
  this.clientCapabilities = args2.clientCapabilities;
490903
490959
  const authMethods = buildAuthMethods();
490904
- const version2 = "0.30.0";
490960
+ const version2 = "0.31.1";
490905
490961
  return {
490906
490962
  protocolVersion: PROTOCOL_VERSION,
490907
490963
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protolabsai/proto",
3
- "version": "0.30.0",
3
+ "version": "0.31.1",
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.30.0"
24
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.31.1"
25
25
  },
26
26
  "dependencies": {},
27
27
  "optionalDependencies": {