@jwitmann/vcc-brain-opencode-v2 2.9.0 → 2.9.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
@@ -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.0",
7412
+ version: "2.9.1",
7413
7413
  description: "VCC Brain adapter for OpenCode V2.",
7414
7414
  license: "BSD-3-Clause",
7415
7415
  author: "jwitmann",
@@ -217666,7 +217666,7 @@ Use Helper output as working context. Do not reproduce it wholesale or reimpleme
217666
217666
  }
217667
217667
 
217668
217668
  // ../core/src/context/compaction.ts
217669
- var DEFAULT_RECOVERY_RULE = `Tool input/output omission notices (content IDs) are the only recoverable
217669
+ var DEFAULT_RECOVERY_RULE = `Tool output omission notices (content IDs) are the only recoverable
217670
217670
  ` + ` handles for trimmed content. Keep every omission notice verbatim in the
217671
217671
  ` + ` summary; the agent recovers payloads through the vcc-brain-read_omitted
217672
217672
  ` + " tool.";
@@ -219686,21 +219686,11 @@ Output Length: ${length} characters
219686
219686
  Content ID: ${contentID}
219687
219687
  </tool-output-omission-notice>`;
219688
219688
  }
219689
- function inputOmissionNotice(description, length, contentID) {
219690
- return `<tool-input-omission-notice>
219691
- ${description}
219692
-
219693
- Omitted Length: ${length} characters
219694
- Content ID: ${contentID}
219695
- </tool-input-omission-notice>`;
219696
- }
219697
219689
 
219698
219690
  // ../core/src/context/trim.ts
219699
219691
  var DEFAULT_OUTPUT_DESCRIPTION = "Output omitted due to a compaction operation.";
219700
219692
  var DEFAULT_LIMIT = { words: 128, chars: 1024 };
219701
219693
  var TASK_OUTPUT_LIMIT = { words: 512, chars: 4096 };
219702
- var BASH_COMMAND_CHAR_LIMIT = 1024;
219703
- var BASH_HEAD_CHAR_LIMIT = 512;
219704
219694
  function planTrimBatched(messages, options) {
219705
219695
  const turns = computeTurns(messages);
219706
219696
  removeTrailingAssistantlessTurn(turns);
@@ -219721,22 +219711,14 @@ function planTrimBatched(messages, options) {
219721
219711
  if (call.resultMessageIndex === null || call.resultIsError) {
219722
219712
  continue;
219723
219713
  }
219724
- const input = planInputOmission(call);
219725
219714
  const output = planOutputOmission(call);
219726
- if (input !== null || output !== null) {
219727
- omissions.push({ call, input, output });
219715
+ if (output !== null) {
219716
+ omissions.push({ call, output });
219728
219717
  }
219729
219718
  }
219730
219719
  const requests = [];
219731
219720
  for (const omission of omissions) {
219732
- if (omission.input !== null) {
219733
- requests.push({
219734
- key: omission.input.key,
219735
- content: omission.input.content,
219736
- tokens: omission.input.tokens
219737
- });
219738
- }
219739
- if (omission.output !== null && omission.output.kind === "stored") {
219721
+ if (omission.output.kind === "stored") {
219740
219722
  requests.push({
219741
219723
  key: omission.output.key,
219742
219724
  content: omission.output.content,
@@ -219821,43 +219803,23 @@ function contentAt(messages, location) {
219821
219803
  }
219822
219804
  function buildTrimPlan(messages, omissions, ids) {
219823
219805
  const replacements = [];
219824
- for (const { call, input, output } of omissions) {
219825
- let inputNotice = null;
219826
- if (input !== null) {
219827
- const contentID = ids.get(input.key) ?? null;
219828
- if (contentID !== null) {
219829
- replacements.push({
219830
- messageIndex: call.messageIndex,
219831
- partIndex: call.partIndex,
219832
- part: input.part(contentID)
219833
- });
219834
- inputNotice = input.outputNotice(contentID);
219835
- }
219836
- }
219806
+ for (const { call, output } of omissions) {
219837
219807
  if (call.resultMessageIndex === null || call.resultPartIndex === null) {
219838
219808
  continue;
219839
219809
  }
219840
219810
  const originalOutput = stringifyToolContent(call.resultValue);
219841
219811
  let nextOutput = originalOutput;
219842
219812
  let replaced = false;
219843
- if (output !== null) {
219844
- if (output.kind === "direct") {
219845
- nextOutput = output.text;
219813
+ if (output.kind === "direct") {
219814
+ nextOutput = output.text;
219815
+ replaced = true;
219816
+ } else {
219817
+ const contentID = ids.get(output.key) ?? null;
219818
+ if (contentID !== null) {
219819
+ nextOutput = output.text(contentID);
219846
219820
  replaced = true;
219847
- } else {
219848
- const contentID = ids.get(output.key) ?? null;
219849
- if (contentID !== null) {
219850
- nextOutput = output.text(contentID);
219851
- replaced = true;
219852
- }
219853
219821
  }
219854
219822
  }
219855
- if (inputNotice !== null) {
219856
- nextOutput = `${inputNotice}
219857
-
219858
- ${nextOutput}`;
219859
- replaced = true;
219860
- }
219861
219823
  if (replaced) {
219862
219824
  replacements.push({
219863
219825
  messageIndex: call.resultMessageIndex,
@@ -219874,72 +219836,6 @@ ${nextOutput}`;
219874
219836
  }
219875
219837
  return { replacements };
219876
219838
  }
219877
- function planInputOmission(call) {
219878
- if (!isRecord(call.input)) {
219879
- return null;
219880
- }
219881
- const input = call.input;
219882
- const originalPart = { type: "tool-call", id: call.callID, name: call.toolName, input };
219883
- if (call.toolName === "write") {
219884
- const content = readString(input, "content");
219885
- if (content !== null && exceeds(content, DEFAULT_LIMIT)) {
219886
- return {
219887
- key: `${call.callID}:input`,
219888
- content,
219889
- tokens: countTextTokens(content),
219890
- part: () => ({ ...originalPart, input: { ...input, content: "[Omitted]" } }),
219891
- outputNotice: (contentID) => inputOmissionNotice("File write contents omitted due to a compaction operation. If necessary, reread file to see current contents.", content.length, contentID)
219892
- };
219893
- }
219894
- }
219895
- if (call.toolName === "apply_patch") {
219896
- const content = readString(input, "patchText");
219897
- if (content !== null && exceeds(content, DEFAULT_LIMIT)) {
219898
- return {
219899
- key: `${call.callID}:input`,
219900
- content,
219901
- tokens: countTextTokens(content),
219902
- part: () => ({ ...originalPart, input: { ...input, patchText: "[Omitted]" } }),
219903
- outputNotice: (contentID) => inputOmissionNotice("Patch text omitted due to compaction operation. If necessary, reread files to see current contents.", content.length, contentID)
219904
- };
219905
- }
219906
- }
219907
- if (call.toolName === "bash") {
219908
- const content = readString(input, "command");
219909
- if (content !== null && content.length > BASH_COMMAND_CHAR_LIMIT) {
219910
- const truncated = `${content.slice(0, BASH_HEAD_CHAR_LIMIT)}
219911
- [REST OF COMMAND TRUNCATED]`;
219912
- return {
219913
- key: `${call.callID}:input`,
219914
- content,
219915
- tokens: countTextTokens(content),
219916
- part: () => ({ ...originalPart, input: { ...input, command: truncated } }),
219917
- outputNotice: (contentID) => inputOmissionNotice("Bash command truncated due to compaction operation.", content.length, contentID)
219918
- };
219919
- }
219920
- }
219921
- if (call.toolName === "edit") {
219922
- const oldString = readString(input, "oldString");
219923
- const newString = readString(input, "newString");
219924
- if (oldString !== null && newString !== null) {
219925
- const combined = `${oldString}
219926
- ${newString}`;
219927
- if (exceeds(combined, DEFAULT_LIMIT)) {
219928
- return {
219929
- key: `${call.callID}:input`,
219930
- content: combined,
219931
- tokens: countTextTokens(combined),
219932
- part: () => ({
219933
- ...originalPart,
219934
- input: { ...input, oldString: "[Omitted]", newString: "[Omitted]" }
219935
- }),
219936
- outputNotice: (contentID) => inputOmissionNotice("File edit oldString and newString omitted due to compaction operation. If necessary, reread file to see current contents.", combined.length, contentID)
219937
- };
219938
- }
219939
- }
219940
- }
219941
- return null;
219942
- }
219943
219839
  function planOutputOmission(call) {
219944
219840
  const output = stringifyToolContent(call.resultValue);
219945
219841
  if (call.toolName === "question") {
@@ -220148,9 +220044,6 @@ function registerContextHook(context, deps, runtime) {
220148
220044
  if (!exceedsThresholds(estimateAfterTrim, windowTokens ?? 0, config)) {
220149
220045
  return;
220150
220046
  }
220151
- if (!fullMode) {
220152
- return;
220153
- }
220154
220047
  if (shouldSuppressCompactionRequest(session, estimatedTokens, windowTokens ?? 0, Date.now())) {
220155
220048
  return;
220156
220049
  }
@@ -221397,7 +221290,7 @@ async function registerReadOmittedTool(context, deps) {
221397
221290
  editor.add({
221398
221291
  name: "vcc-brain-read_omitted",
221399
221292
  options: { codemode: false },
221400
- description: "Read original tool input or output content omitted by VCC Brain trimming or compaction. " + "This reads the snapshot of previously executed tool I/O; contents should be expected " + "to be stale. Only use it when stale content is strictly required and similar " + "information cannot be obtained via new tool calls.",
221293
+ description: "Read original tool output content omitted by VCC Brain trimming or compaction. " + "This reads the snapshot of previously executed tool I/O; contents should be expected " + "to be stale. Only use it when stale content is strictly required and similar " + "information cannot be obtained via new tool calls.",
221401
221294
  input: {
221402
221295
  type: "object",
221403
221296
  properties: {
@@ -221435,7 +221328,7 @@ async function registerPruneTool(context, deps) {
221435
221328
  editor.add({
221436
221329
  name: "vcc-brain-prune",
221437
221330
  options: { codemode: false },
221438
- description: "Prune the current session's omitted tool input and output store " + "by age, count, and size. Recover pruned payloads first if they are " + "still needed: pruning deletes the files vcc-brain-read_omitted serves.",
221331
+ description: "Prune the current session's omitted tool output store " + "by age, count, and size. Recover pruned payloads first if they are " + "still needed: pruning deletes the files vcc-brain-read_omitted serves.",
221439
221332
  input: {
221440
221333
  type: "object",
221441
221334
  properties: {
@@ -222086,4 +221979,4 @@ export {
222086
221979
  src_default as default
222087
221980
  };
222088
221981
 
222089
- //# debugId=E7903AA8EC2D379464756E2164756E21
221982
+ //# debugId=C6752D1D4CECD5A764756E2164756E21