@khalilgharbaoui/opencode-claude-code-plugin 0.63.0 → 0.63.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/dist/index.js CHANGED
@@ -8429,7 +8429,20 @@ function transferClaudeSession(fromKey, toKey) {
8429
8429
  function effortSessionKey(baseKey, effort) {
8430
8430
  return effort ? `${baseKey}::effort=${effort}` : baseKey;
8431
8431
  }
8432
- function invalidateOtherEffortSessions(baseKey, effort) {
8432
+ function spawnIdentity(key) {
8433
+ const parts = key.split("::");
8434
+ if (parts.length > 1 && parts[parts.length - 1].startsWith("effort=")) parts.pop();
8435
+ const last = parts.length - 1;
8436
+ if (parts[last].startsWith("context=")) {
8437
+ try {
8438
+ const context = JSON.parse(parts[last].slice("context=".length));
8439
+ if (Array.isArray(context)) parts[last] = `context=${JSON.stringify(context.slice(0, 2))}`;
8440
+ } catch {
8441
+ }
8442
+ }
8443
+ return parts.join("::");
8444
+ }
8445
+ function invalidateOtherSpawnVariants(baseKey, effort) {
8433
8446
  const levels = [
8434
8447
  void 0,
8435
8448
  "minimal",
@@ -8439,16 +8452,23 @@ function invalidateOtherEffortSessions(baseKey, effort) {
8439
8452
  "xhigh",
8440
8453
  "max"
8441
8454
  ];
8442
- const staleKeys = levels.filter((level) => level !== effort).map((level) => effortSessionKey(baseKey, level));
8455
+ const currentKey = effortSessionKey(baseKey, effort);
8456
+ const identity = spawnIdentity(currentKey);
8457
+ const staleKeys = [
8458
+ .../* @__PURE__ */ new Set([
8459
+ ...[...claudeSessions.keys()].reverse(),
8460
+ ...levels.map((level) => effortSessionKey(baseKey, level)),
8461
+ ...activeProcesses.keys()
8462
+ ])
8463
+ ].filter((key) => key !== currentKey && spawnIdentity(key) === identity);
8443
8464
  for (const key of staleKeys) {
8444
8465
  const active = activeProcesses.get(key);
8445
8466
  if (getPendingProxyCalls(key).length || hasExitPlanModeQuestions(key) || active?.pendingProxyCompletions?.size || active && (active.lineEmitter.listenerCount("line") > 0 || isSideQuestionPending(active))) {
8446
8467
  throw new Error(
8447
- "Cannot change reasoning effort while the previous effort session has pending work. Finish that work at its original effort first."
8468
+ "Cannot change reasoning effort, prompt cache TTL, maxTurns or maxBudgetUsd while this conversation's previous claude process has pending work. Finish that work under its original settings first."
8448
8469
  );
8449
8470
  }
8450
8471
  }
8451
- const currentKey = effortSessionKey(baseKey, effort);
8452
8472
  for (const key of staleKeys) {
8453
8473
  deleteActiveProcess(key);
8454
8474
  if (transferClaudeSession(key, currentKey)) {
@@ -18582,7 +18602,7 @@ var ClaudeCodeLanguageModel = class {
18582
18602
  });
18583
18603
  }
18584
18604
  }
18585
- if (!compactionMode) invalidateOtherEffortSessions(baseKey, reasoningEffort);
18605
+ if (!compactionMode) invalidateOtherSpawnVariants(baseKey, reasoningEffort);
18586
18606
  if (!compactionMode && affinity !== "default") {
18587
18607
  recordSessionSpawn(affinity, {
18588
18608
  model: stripAccountSuffix(failover.modelId),