@jwitmann/vcc-brain-opencode-v2 2.9.0 → 2.9.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 +106 -180
- package/dist/index.js.map +14 -13
- package/dist/server.js +106 -180
- package/dist/server.js.map +14 -13
- package/dist/tui.js +2 -2
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
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.
|
|
7412
|
+
version: "2.9.2",
|
|
7413
7413
|
description: "VCC Brain adapter for OpenCode V2.",
|
|
7414
7414
|
license: "BSD-3-Clause",
|
|
7415
7415
|
author: "jwitmann",
|
|
@@ -216793,6 +216793,14 @@ function evaluateBrainUpdateActivity(state, fingerprint, completedCalls, thresho
|
|
|
216793
216793
|
};
|
|
216794
216794
|
return { state: next, completedSinceBaseline: sinceBaseline, crossed };
|
|
216795
216795
|
}
|
|
216796
|
+
function brainUpdateReminderText(toolCallThreshold) {
|
|
216797
|
+
return `<vcc-brain-brain-update-reminder>
|
|
216798
|
+
You have completed ${toolCallThreshold} tool calls without a Brain change.
|
|
216799
|
+
Before continuing, record any durable decisions, contracts, or lessons in the
|
|
216800
|
+
appropriate Brain partition. Do not write transient task progress or restate
|
|
216801
|
+
implementation. If nothing durable has emerged, make no Brain edits.
|
|
216802
|
+
</vcc-brain-brain-update-reminder>`;
|
|
216803
|
+
}
|
|
216796
216804
|
function isHelperTool(part) {
|
|
216797
216805
|
return part.namespace === "vcc-brain" || part.namespace === "operator";
|
|
216798
216806
|
}
|
|
@@ -217496,15 +217504,7 @@ async function maybeAppendBrainUpdateReminder(deps, runtime, sessionID, messages
|
|
|
217496
217504
|
await appendReceipt(join9(deps.stateDirectory, "context-log"), sessionID, receipt);
|
|
217497
217505
|
return `${content}
|
|
217498
217506
|
|
|
217499
|
-
${
|
|
217500
|
-
}
|
|
217501
|
-
function brainUpdateReminder(toolCallThreshold) {
|
|
217502
|
-
return `<vcc-brain-brain-update-reminder>
|
|
217503
|
-
You have completed ${toolCallThreshold} tool calls without a Brain change.
|
|
217504
|
-
Before continuing, record any durable decisions, contracts, or lessons in the
|
|
217505
|
-
appropriate Brain partition. Do not write transient task progress or restate
|
|
217506
|
-
implementation. If nothing durable has emerged, make no Brain edits.
|
|
217507
|
-
</vcc-brain-brain-update-reminder>`;
|
|
217507
|
+
${brainUpdateReminderText(deps.config.toolCallThreshold)}`;
|
|
217508
217508
|
}
|
|
217509
217509
|
|
|
217510
217510
|
// src/utils.ts
|
|
@@ -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
|
|
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.";
|
|
@@ -219099,6 +219099,23 @@ ${JSON.stringify(event.data ?? null)}`;
|
|
|
219099
219099
|
text
|
|
219100
219100
|
};
|
|
219101
219101
|
}
|
|
219102
|
+
function dropPhantomSeqZeroHits(out) {
|
|
219103
|
+
const hits = out.hits.filter((hit) => hit.seq !== 0);
|
|
219104
|
+
const dropped = out.hits.length - hits.length;
|
|
219105
|
+
const totalMatches = out.totalMatches - dropped;
|
|
219106
|
+
const omitted = Math.max(0, totalMatches - hits.length);
|
|
219107
|
+
const lines = [
|
|
219108
|
+
`[search "${out.pattern}": ${totalMatches} matching event(s)]`,
|
|
219109
|
+
...hits.map((hit) => hit.text),
|
|
219110
|
+
...omitted > 0 ? [`[${omitted} more matching event(s) omitted — narrow the pattern or use recall]`] : [],
|
|
219111
|
+
...out.truncated ? ["[search budget exhausted; some hits were cut]"] : []
|
|
219112
|
+
];
|
|
219113
|
+
if (hits.length > 0)
|
|
219114
|
+
lines.push("[use recall with a (seq N) pointer to restore any hit's full original content]");
|
|
219115
|
+
return { ...out, totalMatches, hits, omitted, text: lines.join(`
|
|
219116
|
+
|
|
219117
|
+
`) };
|
|
219118
|
+
}
|
|
219102
219119
|
|
|
219103
219120
|
// src/compaction-snapshot.ts
|
|
219104
219121
|
var SNAPSHOT_VERSION = 1;
|
|
@@ -219413,27 +219430,7 @@ function searchSnapshot(messages, patternSource, config = {}) {
|
|
|
219413
219430
|
}
|
|
219414
219431
|
};
|
|
219415
219432
|
const out = searchSession(paddedSession, patternSource, { maxSearchHits, maxRecallTokens });
|
|
219416
|
-
|
|
219417
|
-
const dropped = out.hits.length - hits.length;
|
|
219418
|
-
const totalMatches = out.totalMatches - dropped;
|
|
219419
|
-
const omitted = Math.max(0, totalMatches - hits.length);
|
|
219420
|
-
const lines = [
|
|
219421
|
-
`[search "${out.pattern}": ${totalMatches} matching event(s)]`,
|
|
219422
|
-
...hits.map((hit) => hit.text),
|
|
219423
|
-
...omitted > 0 ? [`[${omitted} more matching event(s) omitted — narrow the pattern or use recall]`] : [],
|
|
219424
|
-
...out.truncated ? ["[search budget exhausted; some hits were cut]"] : []
|
|
219425
|
-
];
|
|
219426
|
-
if (hits.length > 0)
|
|
219427
|
-
lines.push("[use recall with a (seq N) pointer to restore any hit's full original content]");
|
|
219428
|
-
return {
|
|
219429
|
-
...out,
|
|
219430
|
-
totalMatches,
|
|
219431
|
-
hits,
|
|
219432
|
-
omitted,
|
|
219433
|
-
text: lines.join(`
|
|
219434
|
-
|
|
219435
|
-
`)
|
|
219436
|
-
};
|
|
219433
|
+
return dropPhantomSeqZeroHits(out);
|
|
219437
219434
|
}
|
|
219438
219435
|
function formatRecallReply(type, id, recalled) {
|
|
219439
219436
|
const label = `**vcc-brain-recall ${type} ${id}** (${recalled.seqs.length} event(s), ${recalled.tokens} tokens` + `${recalled.missing > 0 ? `, ${recalled.missing} missing` : ""}` + `${recalled.truncated ? ", budget-truncated" : ""})`;
|
|
@@ -219686,21 +219683,11 @@ Output Length: ${length} characters
|
|
|
219686
219683
|
Content ID: ${contentID}
|
|
219687
219684
|
</tool-output-omission-notice>`;
|
|
219688
219685
|
}
|
|
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
219686
|
|
|
219698
219687
|
// ../core/src/context/trim.ts
|
|
219699
219688
|
var DEFAULT_OUTPUT_DESCRIPTION = "Output omitted due to a compaction operation.";
|
|
219700
219689
|
var DEFAULT_LIMIT = { words: 128, chars: 1024 };
|
|
219701
219690
|
var TASK_OUTPUT_LIMIT = { words: 512, chars: 4096 };
|
|
219702
|
-
var BASH_COMMAND_CHAR_LIMIT = 1024;
|
|
219703
|
-
var BASH_HEAD_CHAR_LIMIT = 512;
|
|
219704
219691
|
function planTrimBatched(messages, options) {
|
|
219705
219692
|
const turns = computeTurns(messages);
|
|
219706
219693
|
removeTrailingAssistantlessTurn(turns);
|
|
@@ -219721,22 +219708,14 @@ function planTrimBatched(messages, options) {
|
|
|
219721
219708
|
if (call.resultMessageIndex === null || call.resultIsError) {
|
|
219722
219709
|
continue;
|
|
219723
219710
|
}
|
|
219724
|
-
const input = planInputOmission(call);
|
|
219725
219711
|
const output = planOutputOmission(call);
|
|
219726
|
-
if (
|
|
219727
|
-
omissions.push({ call,
|
|
219712
|
+
if (output !== null) {
|
|
219713
|
+
omissions.push({ call, output });
|
|
219728
219714
|
}
|
|
219729
219715
|
}
|
|
219730
219716
|
const requests = [];
|
|
219731
219717
|
for (const omission of omissions) {
|
|
219732
|
-
if (omission.
|
|
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") {
|
|
219718
|
+
if (omission.output.kind === "stored") {
|
|
219740
219719
|
requests.push({
|
|
219741
219720
|
key: omission.output.key,
|
|
219742
219721
|
content: omission.output.content,
|
|
@@ -219821,43 +219800,23 @@ function contentAt(messages, location) {
|
|
|
219821
219800
|
}
|
|
219822
219801
|
function buildTrimPlan(messages, omissions, ids) {
|
|
219823
219802
|
const replacements = [];
|
|
219824
|
-
for (const { call,
|
|
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
|
-
}
|
|
219803
|
+
for (const { call, output } of omissions) {
|
|
219837
219804
|
if (call.resultMessageIndex === null || call.resultPartIndex === null) {
|
|
219838
219805
|
continue;
|
|
219839
219806
|
}
|
|
219840
219807
|
const originalOutput = stringifyToolContent(call.resultValue);
|
|
219841
219808
|
let nextOutput = originalOutput;
|
|
219842
219809
|
let replaced = false;
|
|
219843
|
-
if (output
|
|
219844
|
-
|
|
219845
|
-
|
|
219810
|
+
if (output.kind === "direct") {
|
|
219811
|
+
nextOutput = output.text;
|
|
219812
|
+
replaced = true;
|
|
219813
|
+
} else {
|
|
219814
|
+
const contentID = ids.get(output.key) ?? null;
|
|
219815
|
+
if (contentID !== null) {
|
|
219816
|
+
nextOutput = output.text(contentID);
|
|
219846
219817
|
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
219818
|
}
|
|
219854
219819
|
}
|
|
219855
|
-
if (inputNotice !== null) {
|
|
219856
|
-
nextOutput = `${inputNotice}
|
|
219857
|
-
|
|
219858
|
-
${nextOutput}`;
|
|
219859
|
-
replaced = true;
|
|
219860
|
-
}
|
|
219861
219820
|
if (replaced) {
|
|
219862
219821
|
replacements.push({
|
|
219863
219822
|
messageIndex: call.resultMessageIndex,
|
|
@@ -219874,72 +219833,6 @@ ${nextOutput}`;
|
|
|
219874
219833
|
}
|
|
219875
219834
|
return { replacements };
|
|
219876
219835
|
}
|
|
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
219836
|
function planOutputOmission(call) {
|
|
219944
219837
|
const output = stringifyToolContent(call.resultValue);
|
|
219945
219838
|
if (call.toolName === "question") {
|
|
@@ -220148,9 +220041,6 @@ function registerContextHook(context, deps, runtime) {
|
|
|
220148
220041
|
if (!exceedsThresholds(estimateAfterTrim, windowTokens ?? 0, config)) {
|
|
220149
220042
|
return;
|
|
220150
220043
|
}
|
|
220151
|
-
if (!fullMode) {
|
|
220152
|
-
return;
|
|
220153
|
-
}
|
|
220154
220044
|
if (shouldSuppressCompactionRequest(session, estimatedTokens, windowTokens ?? 0, Date.now())) {
|
|
220155
220045
|
return;
|
|
220156
220046
|
}
|
|
@@ -221379,8 +221269,62 @@ async function refreshPreambleContent(deps, runtime, sessionID, projectDirectory
|
|
|
221379
221269
|
}
|
|
221380
221270
|
|
|
221381
221271
|
// src/tool.ts
|
|
221382
|
-
import { execFile } from "node:child_process";
|
|
221383
221272
|
import { join as join14 } from "node:path";
|
|
221273
|
+
|
|
221274
|
+
// ../core/src/helper-binary.ts
|
|
221275
|
+
import { execFile } from "node:child_process";
|
|
221276
|
+
var HELPER_BIN = "vcc-brain-helper";
|
|
221277
|
+
var HELPER_TIMEOUT_MS = 60000;
|
|
221278
|
+
var HELPER_MAX_BUFFER_BYTES = 4 * 1024 * 1024;
|
|
221279
|
+
function asAbortSignal(value) {
|
|
221280
|
+
if (typeof value !== "object" || value === null) {
|
|
221281
|
+
return;
|
|
221282
|
+
}
|
|
221283
|
+
const candidate = value;
|
|
221284
|
+
return typeof candidate.aborted === "boolean" && typeof candidate.addEventListener === "function" ? value : undefined;
|
|
221285
|
+
}
|
|
221286
|
+
function isBufferOverflow(error) {
|
|
221287
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
221288
|
+
return false;
|
|
221289
|
+
}
|
|
221290
|
+
const code = error.code;
|
|
221291
|
+
return code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" || code === "ENOBUFS";
|
|
221292
|
+
}
|
|
221293
|
+
function runHelperBinary(argument_, options) {
|
|
221294
|
+
const bin = process.env.VCC_BRAIN_HELPER_BIN ?? HELPER_BIN;
|
|
221295
|
+
const signal = asAbortSignal(options?.signal);
|
|
221296
|
+
if (signal?.aborted === true) {
|
|
221297
|
+
return Promise.resolve({ exitCode: -1, output: "Helper call cancelled.", cancelled: true });
|
|
221298
|
+
}
|
|
221299
|
+
return new Promise((resolve) => {
|
|
221300
|
+
execFile(bin, [...argument_], { timeout: HELPER_TIMEOUT_MS, maxBuffer: HELPER_MAX_BUFFER_BYTES, signal }, (error, stdout, stderr) => {
|
|
221301
|
+
if (error !== null && (signal?.aborted === true || error.name === "AbortError")) {
|
|
221302
|
+
resolve({ exitCode: -1, output: "Helper call cancelled.", cancelled: true });
|
|
221303
|
+
return;
|
|
221304
|
+
}
|
|
221305
|
+
if (error === null) {
|
|
221306
|
+
resolve({ exitCode: 0, output: stdout, cancelled: false });
|
|
221307
|
+
return;
|
|
221308
|
+
}
|
|
221309
|
+
if (isBufferOverflow(error)) {
|
|
221310
|
+
resolve({
|
|
221311
|
+
exitCode: typeof error.code === "number" ? error.code : 2,
|
|
221312
|
+
output: `Helper output exceeded ${HELPER_MAX_BUFFER_BYTES} bytes and was discarded. ` + "Narrow the request (query keywords, recall --seq/--from-seq) and retry.",
|
|
221313
|
+
cancelled: false
|
|
221314
|
+
});
|
|
221315
|
+
return;
|
|
221316
|
+
}
|
|
221317
|
+
const exitCode = typeof error.code === "number" ? error.code : 2;
|
|
221318
|
+
if (exitCode !== 0 && stderr !== "") {
|
|
221319
|
+
resolve({ exitCode, output: stderr, cancelled: false });
|
|
221320
|
+
return;
|
|
221321
|
+
}
|
|
221322
|
+
resolve({ exitCode, output: stdout !== "" ? stdout : error.message, cancelled: false });
|
|
221323
|
+
});
|
|
221324
|
+
});
|
|
221325
|
+
}
|
|
221326
|
+
|
|
221327
|
+
// src/tool.ts
|
|
221384
221328
|
var OMISSION_ID_PATTERN = /^omitted-\d+$/;
|
|
221385
221329
|
var CONTEXT_MANAGEMENT_TOOL_NAMES = [
|
|
221386
221330
|
"vcc-brain-read_omitted",
|
|
@@ -221397,7 +221341,7 @@ async function registerReadOmittedTool(context, deps) {
|
|
|
221397
221341
|
editor.add({
|
|
221398
221342
|
name: "vcc-brain-read_omitted",
|
|
221399
221343
|
options: { codemode: false },
|
|
221400
|
-
description: "Read original tool
|
|
221344
|
+
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
221345
|
input: {
|
|
221402
221346
|
type: "object",
|
|
221403
221347
|
properties: {
|
|
@@ -221435,7 +221379,7 @@ async function registerPruneTool(context, deps) {
|
|
|
221435
221379
|
editor.add({
|
|
221436
221380
|
name: "vcc-brain-prune",
|
|
221437
221381
|
options: { codemode: false },
|
|
221438
|
-
description: "Prune the current session's omitted tool
|
|
221382
|
+
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
221383
|
input: {
|
|
221440
221384
|
type: "object",
|
|
221441
221385
|
properties: {
|
|
@@ -221587,30 +221531,12 @@ async function registerSearchTool(context, deps) {
|
|
|
221587
221531
|
});
|
|
221588
221532
|
});
|
|
221589
221533
|
}
|
|
221590
|
-
var HELPER_BIN = "vcc-brain-helper";
|
|
221591
|
-
var HELPER_TIMEOUT_MS = 60000;
|
|
221592
|
-
function runHelperBinary(argument_) {
|
|
221593
|
-
return new Promise((resolve) => {
|
|
221594
|
-
execFile(HELPER_BIN, [...argument_], { timeout: HELPER_TIMEOUT_MS }, (error, stdout, stderr) => {
|
|
221595
|
-
if (error === null) {
|
|
221596
|
-
resolve({ exitCode: 0, output: stdout });
|
|
221597
|
-
return;
|
|
221598
|
-
}
|
|
221599
|
-
const exitCode = typeof error.code === "number" ? error.code : 2;
|
|
221600
|
-
if (exitCode !== 0 && stderr !== "") {
|
|
221601
|
-
resolve({ exitCode, output: stderr });
|
|
221602
|
-
return;
|
|
221603
|
-
}
|
|
221604
|
-
resolve({ exitCode, output: stdout !== "" ? stdout : error.message });
|
|
221605
|
-
});
|
|
221606
|
-
});
|
|
221607
|
-
}
|
|
221608
221534
|
async function registerSearchSessionsTool(context, deps) {
|
|
221609
221535
|
await context.tool.transform((editor) => {
|
|
221610
221536
|
editor.add({
|
|
221611
221537
|
name: "vcc-brain-search-sessions",
|
|
221612
221538
|
options: { codemode: false },
|
|
221613
|
-
description: "Search OTHER sessions (cross-session recall) for keywords, scoped to this project plus mutual peers. " + "Returns matching turns with stored session ids (like opencode:ses_
|
|
221539
|
+
description: "Search OTHER sessions (cross-session recall) for keywords, scoped to this project plus mutual peers. " + "Returns matching turns with stored session ids (like opencode:ses_..., dsh:<uuid>, or pi:<id>); " + "call vcc-brain-recall-session to restore a session's full turns. " + "Use vcc-brain-search (not this tool) for the current conversation. " + "OpenCode results require one `vcc-brain-helper recall-cross index` run on this machine first.",
|
|
221614
221540
|
input: {
|
|
221615
221541
|
type: "object",
|
|
221616
221542
|
properties: {
|
|
@@ -221621,7 +221547,7 @@ async function registerSearchSessionsTool(context, deps) {
|
|
|
221621
221547
|
harness: {
|
|
221622
221548
|
type: "string",
|
|
221623
221549
|
description: "Limit results to one harness.",
|
|
221624
|
-
enum: ["dsh", "opencode", "all"]
|
|
221550
|
+
enum: ["dsh", "opencode", "pi", "all"]
|
|
221625
221551
|
}
|
|
221626
221552
|
},
|
|
221627
221553
|
required: ["keywords"]
|
|
@@ -221643,14 +221569,14 @@ async function registerSearchSessionsTool(context, deps) {
|
|
|
221643
221569
|
deps.projectDirectory
|
|
221644
221570
|
];
|
|
221645
221571
|
if (input.harness !== undefined && input.harness !== "") {
|
|
221646
|
-
if (input.harness !== "dsh" && input.harness !== "opencode" && input.harness !== "all") {
|
|
221647
|
-
return { content: "Invalid input: harness must be one of dsh, opencode, all." };
|
|
221572
|
+
if (input.harness !== "dsh" && input.harness !== "opencode" && input.harness !== "pi" && input.harness !== "all") {
|
|
221573
|
+
return { content: "Invalid input: harness must be one of dsh, opencode, pi, all." };
|
|
221648
221574
|
}
|
|
221649
221575
|
invocation.push("--harness", input.harness);
|
|
221650
221576
|
}
|
|
221651
221577
|
invocation.push(...words);
|
|
221652
221578
|
try {
|
|
221653
|
-
const result = await runHelperBinary(invocation);
|
|
221579
|
+
const result = await runHelperBinary(invocation, null);
|
|
221654
221580
|
return { content: result.output };
|
|
221655
221581
|
} catch {
|
|
221656
221582
|
return { content: "Could not run the recall index. Is vcc-brain-helper installed?" };
|
|
@@ -221664,13 +221590,13 @@ async function registerRecallSessionTool(context) {
|
|
|
221664
221590
|
editor.add({
|
|
221665
221591
|
name: "vcc-brain-recall-session",
|
|
221666
221592
|
options: { codemode: false },
|
|
221667
|
-
description: "Restore the full turns of one indexed past session by its stored session id " + "(like opencode:ses_
|
|
221593
|
+
description: "Restore the full turns of one indexed past session by its stored session id " + "(like opencode:ses_..., dsh:<uuid>, or pi:<id>), optionally a single turn by sequence number. " + "Use vcc-brain-recall (not this tool) for the current conversation.",
|
|
221668
221594
|
input: {
|
|
221669
221595
|
type: "object",
|
|
221670
221596
|
properties: {
|
|
221671
221597
|
sessionId: {
|
|
221672
221598
|
type: "string",
|
|
221673
|
-
description: "Stored session id, like opencode:ses_
|
|
221599
|
+
description: "Stored session id, like opencode:ses_..., dsh:<uuid>, or pi:<id>."
|
|
221674
221600
|
},
|
|
221675
221601
|
seq: {
|
|
221676
221602
|
type: "string",
|
|
@@ -221698,7 +221624,7 @@ async function registerRecallSessionTool(context) {
|
|
|
221698
221624
|
invocation.push("--seq", sequence);
|
|
221699
221625
|
}
|
|
221700
221626
|
try {
|
|
221701
|
-
const result = await runHelperBinary(invocation);
|
|
221627
|
+
const result = await runHelperBinary(invocation, null);
|
|
221702
221628
|
return { content: result.output };
|
|
221703
221629
|
} catch {
|
|
221704
221630
|
return { content: "Could not run the recall index. Is vcc-brain-helper installed?" };
|
|
@@ -222086,4 +222012,4 @@ export {
|
|
|
222086
222012
|
src_default as default
|
|
222087
222013
|
};
|
|
222088
222014
|
|
|
222089
|
-
//# debugId=
|
|
222015
|
+
//# debugId=39C0390913B60D3D64756E2164756E21
|