@mcowger/pi-plexus 1.14.2 → 1.14.3

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/dist/extension.js +32 -1
  2. package/package.json +1 -1
package/dist/extension.js CHANGED
@@ -149,6 +149,12 @@ function convertToDescriptor(raw, baseUrl) {
149
149
  descriptor.piModel = raw.pi_model;
150
150
  if (raw.pi_options && Object.keys(raw.pi_options).length > 0)
151
151
  descriptor.piOptions = raw.pi_options;
152
+ const effortOption = raw.reasoning_options?.find((option) => option.type === "effort");
153
+ if (effortOption !== undefined) {
154
+ const values = effortOption.values.filter((value) => typeof value === "string" && value.length > 0);
155
+ if (values.length > 0)
156
+ descriptor.effortValues = values;
157
+ }
152
158
  return descriptor;
153
159
  }
154
160
  function isChatModel(model) {
@@ -634,6 +640,30 @@ import {
634
640
  getModel
635
641
  } from "@earendil-works/pi-ai/compat";
636
642
  var MINIMUM_OUTPUT_TOKENS = 8192;
643
+ var SERVER_EFFORT_LEVELS = [
644
+ "minimal",
645
+ "low",
646
+ "medium",
647
+ "high",
648
+ "xhigh",
649
+ "max"
650
+ ];
651
+ function serverThinkingLevelMap(descriptor) {
652
+ if (!descriptor.reasoning)
653
+ return;
654
+ if (descriptor.preferredApi !== "openai-completions" && descriptor.preferredApi !== "openai-responses") {
655
+ return;
656
+ }
657
+ const values = descriptor.effortValues;
658
+ if (values === undefined)
659
+ return;
660
+ const map = {};
661
+ for (const level of SERVER_EFFORT_LEVELS) {
662
+ if (values.includes(level))
663
+ map[level] = level;
664
+ }
665
+ return Object.keys(map).length > 0 ? map : undefined;
666
+ }
637
667
  function descriptorToPiModel(descriptor) {
638
668
  let builtinModel;
639
669
  if (descriptor.piProvider && descriptor.piModel) {
@@ -673,6 +703,7 @@ function descriptorToPiModel(descriptor) {
673
703
  } else if (builtinModel?.compat) {
674
704
  compat = builtinModel.compat;
675
705
  }
706
+ const serverThinkingLevelMapValue = serverThinkingLevelMap(descriptor);
676
707
  return {
677
708
  id: descriptor.id,
678
709
  name: descriptor.name,
@@ -685,7 +716,7 @@ function descriptorToPiModel(descriptor) {
685
716
  cost,
686
717
  contextWindow: descriptor.contextWindow,
687
718
  maxTokens: Math.max(descriptor.maxTokens, MINIMUM_OUTPUT_TOKENS),
688
- ...builtinModel?.thinkingLevelMap !== undefined ? { thinkingLevelMap: builtinModel.thinkingLevelMap } : {},
719
+ ...serverThinkingLevelMapValue !== undefined ? { thinkingLevelMap: serverThinkingLevelMapValue } : builtinModel?.thinkingLevelMap !== undefined ? { thinkingLevelMap: builtinModel.thinkingLevelMap } : {},
689
720
  ...builtinModel?.headers !== undefined ? { headers: builtinModel.headers } : {},
690
721
  ...compat !== undefined ? { compat } : {}
691
722
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcowger/pi-plexus",
3
- "version": "1.14.2",
3
+ "version": "1.14.3",
4
4
  "description": "Plexus AI proxy plugin for the pi coding agent",
5
5
  "type": "module",
6
6
  "files": [