@jwitmann/vcc-brain-opencode-v2 2.9.2 → 2.10.0

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/server.js CHANGED
@@ -7409,7 +7409,7 @@ import { Plugin } from "@opencode/plugin";
7409
7409
  // package.json
7410
7410
  var package_default = {
7411
7411
  name: "@jwitmann/vcc-brain-opencode-v2",
7412
- version: "2.9.2",
7412
+ version: "2.10.0",
7413
7413
  description: "VCC Brain adapter for OpenCode V2.",
7414
7414
  license: "BSD-3-Clause",
7415
7415
  author: "jwitmann",
@@ -217550,16 +217550,6 @@ function readOptionNumber(path, block, key, defaultValue) {
217550
217550
  }
217551
217551
  return success2(value);
217552
217552
  }
217553
- function readOptionString(path, block, key, defaultValue) {
217554
- const value = block[key];
217555
- if (value === undefined) {
217556
- return success2(defaultValue);
217557
- }
217558
- if (typeof value !== "string") {
217559
- return failure2({ message: `The "${path}.${key}" option must be a string.` });
217560
- }
217561
- return success2(value);
217562
- }
217563
217553
  function readOptionBoolean(path, block, key, defaultValue) {
217564
217554
  const value = block[key];
217565
217555
  if (value === undefined) {
@@ -219908,12 +219898,8 @@ function countWords(text, maxWords) {
219908
219898
  import { join as join12 } from "node:path";
219909
219899
 
219910
219900
  // src/context-config.ts
219911
- function isFullContextMode(config) {
219912
- return config.mode === "full";
219913
- }
219914
219901
  var DEFAULT_CONTEXT_MANAGEMENT_CONFIG = {
219915
219902
  enabled: false,
219916
- mode: "full",
219917
219903
  ratio: 0.8,
219918
219904
  hardCapTokens: 250000,
219919
219905
  keepRecentTurns: 3,
@@ -219941,7 +219927,6 @@ function parseContextManagementBlock(block, base = DEFAULT_CONTEXT_MANAGEMENT_CO
219941
219927
  }
219942
219928
  const path = "vcc-brain.contextManagement";
219943
219929
  const enabled = readOptionBoolean(path, block, "enabled", base.enabled);
219944
- const mode = readOptionString(path, block, "mode", base.mode);
219945
219930
  const ratio = readOptionNumber(path, block, "ratio", base.ratio);
219946
219931
  const hardCapTokens = readOptionNumber(path, block, "hardCapTokens", base.hardCapTokens);
219947
219932
  const keepRecentTurns = readOptionNumber(path, block, "keepRecentTurns", base.keepRecentTurns);
@@ -219949,13 +219934,6 @@ function parseContextManagementBlock(block, base = DEFAULT_CONTEXT_MANAGEMENT_CO
219949
219934
  const compactFloorTokens = readOptionNumber(path, block, "compactFloorTokens", base.compactFloorTokens);
219950
219935
  if (!enabled.ok)
219951
219936
  return enabled;
219952
- if (!mode.ok)
219953
- return mode;
219954
- if (mode.value !== "full" && mode.value !== "vcc") {
219955
- return failure2({
219956
- message: `The "${path}.mode" option must be "full" or "vcc".`
219957
- });
219958
- }
219959
219937
  if (!ratio.ok)
219960
219938
  return ratio;
219961
219939
  if (!hardCapTokens.ok)
@@ -219968,7 +219946,6 @@ function parseContextManagementBlock(block, base = DEFAULT_CONTEXT_MANAGEMENT_CO
219968
219946
  return compactFloorTokens;
219969
219947
  return success2({
219970
219948
  enabled: enabled.value,
219971
- mode: mode.value,
219972
219949
  ratio: ratio.value,
219973
219950
  hardCapTokens: hardCapTokens.value,
219974
219951
  keepRecentTurns: keepRecentTurns.value,
@@ -219985,23 +219962,20 @@ function registerContextHook(context, deps, runtime) {
219985
219962
  }
219986
219963
  const sessionID = event.sessionID;
219987
219964
  const config = deps.config;
219988
- const fullMode = isFullContextMode(config);
219989
219965
  await ensureSessionHydrated(deps.stateDirectory, runtime, sessionID);
219990
219966
  if (!deps.isBrainAvailable(sessionID)) {
219991
219967
  await ensureRefusalReceipt(deps.stateDirectory, runtime, sessionID, deps);
219992
219968
  return;
219993
219969
  }
219994
219970
  const session = sessionRuntime(runtime, sessionID);
219995
- if (fullMode) {
219996
- if (isContextStale(deps)) {
219997
- return;
219998
- }
219999
- const remembered = await rememberSnapshot(join12(deps.stateDirectory, "context-snapshot"), sessionID, event.messages, new Date().toISOString(), session.snapshotSeen);
220000
- if (isContextStale(deps)) {
220001
- return;
220002
- }
220003
- session.snapshotSeen = remembered.seen;
219971
+ if (isContextStale(deps)) {
219972
+ return;
219973
+ }
219974
+ const remembered = await rememberSnapshot(join12(deps.stateDirectory, "context-snapshot"), sessionID, event.messages, new Date().toISOString(), session.snapshotSeen);
219975
+ if (isContextStale(deps)) {
219976
+ return;
220004
219977
  }
219978
+ session.snapshotSeen = remembered.seen;
220005
219979
  const estimatedTokens = estimateContextTokens(session.estimator, event.messages);
220006
219980
  const windowTokens = await resolveWindowTokens(context, session, event.model);
220007
219981
  session.lastEstimate = estimatedTokens;
@@ -221805,7 +221779,7 @@ var VccBrainPlugin = Plugin.define({
221805
221779
  const effectiveBrainUpdatesConfig = projectOverride.config.brainUpdates;
221806
221780
  const effectiveContextManagement = projectOverride.config.contextManagement;
221807
221781
  let contextManagementEnabled = parsed.ok && effectiveContextManagement.enabled;
221808
- if (contextManagementEnabled && isFullContextMode(effectiveContextManagement)) {
221782
+ if (contextManagementEnabled) {
221809
221783
  const external = await findExternalCompactionProvider(context);
221810
221784
  if (external !== null) {
221811
221785
  contextManagementEnabled = false;
@@ -221822,7 +221796,7 @@ var VccBrainPlugin = Plugin.define({
221822
221796
  const isActive = () => isCurrent() && !standDown.stoodDown;
221823
221797
  let providerRecheckDone = false;
221824
221798
  const maybeStandDownForExternalProvider = async () => {
221825
- if (!contextManagementEnabled || !isFullContextMode(effectiveContextManagement) || providerRecheckDone || !isCurrent()) {
221799
+ if (!contextManagementEnabled || providerRecheckDone || !isCurrent()) {
221826
221800
  return;
221827
221801
  }
221828
221802
  providerRecheckDone = true;
@@ -221933,7 +221907,6 @@ var VccBrainPlugin = Plugin.define({
221933
221907
  };
221934
221908
  const controller = new AbortController;
221935
221909
  if (contextManagementEnabled) {
221936
- const fullMode = isFullContextMode(config);
221937
221910
  const requestCompaction = (sessionID, cause) => {
221938
221911
  if (!isActive()) {
221939
221912
  return;
@@ -221949,28 +221922,24 @@ var VccBrainPlugin = Plugin.define({
221949
221922
  isCurrent: isActive
221950
221923
  };
221951
221924
  registerContextHook(context, deps, runtime);
221952
- if (fullMode) {
221953
- registerCompactionHook(context, {
221954
- config,
221955
- stateDirectory,
221956
- brainPaths: DEFAULT_BRAIN_PATHS,
221957
- isBrainAvailable,
221958
- reportReceiptFailure,
221959
- refreshEnabled: refreshConfig.enabled,
221960
- isCurrent: isActive,
221961
- onAnchorWritten: (sessionID) => {
221962
- cache.delete(sessionID);
221963
- }
221964
- }, runtime);
221965
- }
221925
+ registerCompactionHook(context, {
221926
+ config,
221927
+ stateDirectory,
221928
+ brainPaths: DEFAULT_BRAIN_PATHS,
221929
+ isBrainAvailable,
221930
+ reportReceiptFailure,
221931
+ refreshEnabled: refreshConfig.enabled,
221932
+ isCurrent: isActive,
221933
+ onAnchorWritten: (sessionID) => {
221934
+ cache.delete(sessionID);
221935
+ }
221936
+ }, runtime);
221966
221937
  registerCompletionTrigger(context, deps, runtime, { signal: controller.signal });
221967
221938
  await registerReadOmittedTool(context, { stateDirectory });
221968
221939
  await registerPruneTool(context, { stateDirectory });
221969
- if (fullMode) {
221970
- await registerRecallTool(context, { stateDirectory });
221971
- await registerSearchTool(context, { stateDirectory });
221972
- await registerAnchorTool(context, { stateDirectory, runtime });
221973
- }
221940
+ await registerRecallTool(context, { stateDirectory });
221941
+ await registerSearchTool(context, { stateDirectory });
221942
+ await registerAnchorTool(context, { stateDirectory, runtime });
221974
221943
  await registerSearchSessionsTool(context, {
221975
221944
  projectDirectory: context.location.directory
221976
221945
  });
@@ -222012,4 +221981,4 @@ export {
222012
221981
  src_default as default
222013
221982
  };
222014
221983
 
222015
- //# debugId=5275C9ACEF08608064756E2164756E21
221984
+ //# debugId=991AE20D1ACF66DE64756E2164756E21