@raoxxxwq/pi-codebuddy-sdk 0.3.0 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raoxxxwq/pi-codebuddy-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Pi extension that uses CodeBuddy (via Agent SDK) as a model provider and adds an AskCodebuddy tool.",
5
5
  "author": "raoxxxwq",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -899,7 +899,7 @@ function observeServedContextWindow(label: string, servedModel: string, observed
899
899
  if (!Number.isFinite(observed) || observed <= 0) return;
900
900
  try {
901
901
  const previousRegistered = MODELS.find((candidate) => candidate.id === model.id)?.contextWindow;
902
- const { changed, floorChanged, record } = recordObservedContextWindow(
902
+ const { changed, record } = recordObservedContextWindow(
903
903
  calibrationCache,
904
904
  model.id,
905
905
  calibrationEnvironment,
@@ -907,11 +907,11 @@ function observeServedContextWindow(label: string, servedModel: string, observed
907
907
  );
908
908
  if (!changed) return;
909
909
  saveCalibrationCache(calibrationCache);
910
- const floor = record.capabilities.contextWindow?.floor;
911
- if (floor != null) {
910
+ const latest = record.capabilities.contextWindow?.latest;
911
+ if (latest != null) {
912
912
  MODELS = MODELS.map((candidate) => (
913
913
  candidate.id === model.id
914
- ? { ...candidate, contextWindow: floor }
914
+ ? { ...candidate, contextWindow: latest }
915
915
  : candidate
916
916
  ));
917
917
  }
@@ -919,7 +919,7 @@ function observeServedContextWindow(label: string, servedModel: string, observed
919
919
  `calibration: ${label} observed=${observed} floor=${record.capabilities.contextWindow?.floor ?? "?"} ` +
920
920
  `latest=${record.capabilities.contextWindow?.latest ?? "?"} servedModel=${servedModel} registeredBefore=${previousRegistered ?? "?"}`,
921
921
  );
922
- if (floorChanged && floor != null && previousRegistered != null && floor !== previousRegistered) {
922
+ if (latest != null && previousRegistered != null && latest !== previousRegistered) {
923
923
  scheduleCalibrationRefresh(`contextWindow:${model.id}`);
924
924
  }
925
925
  } catch (err) {
@@ -90,8 +90,8 @@ export function applyContextWindowCalibrations<T extends { id: string; contextWi
90
90
  ): T[] {
91
91
  return models.map((model) => {
92
92
  const metric = getContextWindowCalibration(cache, model.id, environment);
93
- if (!metric?.floor) return model;
94
- return { ...model, contextWindow: metric.floor };
93
+ if (!metric?.latest) return model;
94
+ return { ...model, contextWindow: metric.latest };
95
95
  });
96
96
  }
97
97
 
package/src/models.ts CHANGED
@@ -12,8 +12,8 @@ export type PiModel = {
12
12
  cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
13
13
  };
14
14
 
15
- const CONSERVATIVE_DEFAULT_CONTEXT = 65_536;
16
- const CONSERVATIVE_GEMINI_CONTEXT = 131_072;
15
+ const CONSERVATIVE_DEFAULT_CONTEXT = 200_000;
16
+ const CONSERVATIVE_GEMINI_CONTEXT = 1_048_576;
17
17
  const DEFAULT_MAX_TOKENS = 8192;
18
18
 
19
19
  function detectThinking(id: string): boolean {