@bd7pil/opencode-deep-memory 0.8.1 → 0.8.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/dist/index.js CHANGED
@@ -432,9 +432,6 @@ var PluginState = class {
432
432
  const last = this._lastMemoryNudgeMessageCount.get(sessionID);
433
433
  return last != null ? currentMessageCount - last : Number.POSITIVE_INFINITY;
434
434
  }
435
- setModelContextWindow(tokens) {
436
- if (tokens > 0) this._modelContextWindow = tokens;
437
- }
438
435
  getModelContextWindow() {
439
436
  return this._modelContextWindow;
440
437
  }
@@ -15369,14 +15366,13 @@ function extractInputTokensFromMessages(messages) {
15369
15366
  for (const part of msg.parts) {
15370
15367
  if (typeof part !== "object" || part === null) continue;
15371
15368
  const p = part;
15372
- if (p["type"] === "step-finish") {
15373
- const tokens = p;
15374
- const input = tokens.tokens?.input ?? 0;
15375
- const cached2 = tokens.tokens?.cached ?? 0;
15376
- const total = input + cached2;
15377
- if (total > best) best = total;
15378
- if (best > 0) return best;
15379
- }
15369
+ if (p["type"] !== "step-finish") continue;
15370
+ const tokens = p;
15371
+ const input = tokens.tokens?.input ?? 0;
15372
+ const cached2 = tokens.tokens?.cache?.read ?? 0;
15373
+ const total = input + cached2;
15374
+ if (total > best) best = total;
15375
+ if (best > 0) return best;
15380
15376
  }
15381
15377
  }
15382
15378
  return best;
@@ -16182,29 +16178,6 @@ function createNotifyHandler(client, logger) {
16182
16178
  };
16183
16179
  }
16184
16180
 
16185
- // src/shared/model-limits.ts
16186
- var KNOWN_MODEL_LIMITS = {
16187
- "deepseek-v4-pro": 1e6,
16188
- "deepseek-v4": 1e6,
16189
- "deepseek-v3": 64e3,
16190
- "deepseek-r1": 64e3,
16191
- "claude-opus-4": 2e5,
16192
- "claude-sonnet-4": 2e5,
16193
- "gpt-4o": 128e3,
16194
- "o1": 2e5,
16195
- "o3-mini": 2e5,
16196
- "gemini-2.5-pro": 1e6,
16197
- "gemini-2.5-flash": 1e6,
16198
- "qwen-max": 131072
16199
- };
16200
- function lookupModelLimit(modelID) {
16201
- if (KNOWN_MODEL_LIMITS[modelID]) return KNOWN_MODEL_LIMITS[modelID];
16202
- for (const [key, limit] of Object.entries(KNOWN_MODEL_LIMITS)) {
16203
- if (modelID.includes(key)) return limit;
16204
- }
16205
- return void 0;
16206
- }
16207
-
16208
16181
  // src/extract/enrich.ts
16209
16182
  import { stat } from "fs/promises";
16210
16183
 
@@ -16536,14 +16509,10 @@ var deepMemoryPlugin = async (input) => {
16536
16509
  const defaultModel = configResult.data?.model;
16537
16510
  if (typeof defaultModel === "string" && defaultModel.includes("/")) {
16538
16511
  const slashIdx = defaultModel.indexOf("/");
16539
- const providerID = defaultModel.slice(0, slashIdx);
16540
- const modelID = defaultModel.slice(slashIdx + 1);
16541
- state.recordFallbackModel({ providerID, modelID });
16542
- const limit = lookupModelLimit(modelID);
16543
- if (limit) {
16544
- state.setModelContextWindow(limit);
16545
- logger.debug("resolved model context window", { modelID, limit });
16546
- }
16512
+ state.recordFallbackModel({
16513
+ providerID: defaultModel.slice(0, slashIdx),
16514
+ modelID: defaultModel.slice(slashIdx + 1)
16515
+ });
16547
16516
  }
16548
16517
  }).catch((err) => {
16549
16518
  logger.debug("config.get failed, dream/distill will omit model", {