@vedtechsolutions/engram-mcp 1.0.21 → 1.0.23
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/hook.js +35 -6
- package/package.json +1 -1
package/dist/hook.js
CHANGED
|
@@ -3331,13 +3331,26 @@ function sanitizeCognitiveState(state) {
|
|
|
3331
3331
|
return path.split(/[/\\]/).pop() ?? path;
|
|
3332
3332
|
});
|
|
3333
3333
|
const uniqueFiles = [...new Set(editedFiles)].slice(-5);
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3334
|
+
const taskVerbs = /^(fix|add|create|update|implement|remove|refactor|build|change|move|write|make|set|run|deploy|test|commit|push|install|configure|debug|solve|enable|disable|start|stop|check|verify|analyze|review|audit|optimize|clean|delete|migrate|upgrade|publish|get|do|finish)/i;
|
|
3335
|
+
if (state.recent_prompts && state.recent_prompts.length > 0) {
|
|
3336
|
+
for (let i = state.recent_prompts.length - 1; i >= 0; i--) {
|
|
3337
|
+
const prompt = state.recent_prompts[i];
|
|
3338
|
+
const first = prompt.split(/[.!?\n]/)[0]?.trim();
|
|
3339
|
+
if (first && first.length >= 15 && first.length <= 200 && taskVerbs.test(first)) {
|
|
3340
|
+
state.active_task = first;
|
|
3341
|
+
break;
|
|
3342
|
+
}
|
|
3339
3343
|
}
|
|
3340
3344
|
}
|
|
3345
|
+
if (!state.active_task && cog.current_approach && cog.current_approach.length >= 10) {
|
|
3346
|
+
const firstSentence = cog.current_approach.split(/[.!?\n]/)[0]?.trim();
|
|
3347
|
+
if (firstSentence && firstSentence.length >= 10 && firstSentence.length <= 150) {
|
|
3348
|
+
state.active_task = firstSentence;
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
if (!state.active_task && uniqueFiles.length > 0) {
|
|
3352
|
+
state.active_task = `Working on ${uniqueFiles.join(", ")}`;
|
|
3353
|
+
}
|
|
3341
3354
|
}
|
|
3342
3355
|
if (state.session_files.length > 0) {
|
|
3343
3356
|
state.session_files = state.session_files.filter((f) => {
|
|
@@ -3757,6 +3770,12 @@ Output: ${truncate(toolOutput, 500)}`,
|
|
|
3757
3770
|
if (state.recent_tool_names.length > 10) {
|
|
3758
3771
|
state.recent_tool_names = state.recent_tool_names.slice(-10);
|
|
3759
3772
|
}
|
|
3773
|
+
state.cognitive_state = updateCognitiveState(
|
|
3774
|
+
state.cognitive_state,
|
|
3775
|
+
{ type: "tool_call", toolName: "Bash", inputSummary: truncate(cmd, 100) },
|
|
3776
|
+
state.recent_tool_names,
|
|
3777
|
+
state.recent_errors
|
|
3778
|
+
);
|
|
3760
3779
|
state.recent_actions.push({
|
|
3761
3780
|
tool: "Bash",
|
|
3762
3781
|
target: truncate(cmd, 120),
|
|
@@ -4248,6 +4267,16 @@ function handlePostWrite(toolInput, argFallback) {
|
|
|
4248
4267
|
const filePath = input?.file_path ?? input?.path ?? "";
|
|
4249
4268
|
if (!filePath) return;
|
|
4250
4269
|
const state = loadWatcherState();
|
|
4270
|
+
state.recent_tool_names.push("Edit");
|
|
4271
|
+
if (state.recent_tool_names.length > 10) {
|
|
4272
|
+
state.recent_tool_names = state.recent_tool_names.slice(-10);
|
|
4273
|
+
}
|
|
4274
|
+
state.cognitive_state = updateCognitiveState(
|
|
4275
|
+
state.cognitive_state,
|
|
4276
|
+
{ type: "tool_call", toolName: "Edit", inputSummary: filePath },
|
|
4277
|
+
state.recent_tool_names,
|
|
4278
|
+
state.recent_errors
|
|
4279
|
+
);
|
|
4251
4280
|
{
|
|
4252
4281
|
const newStr = input?.new_string ?? "";
|
|
4253
4282
|
const firstNewLine = newStr.split("\n").find((l) => l.trim().length > 0) ?? "";
|
|
@@ -6394,7 +6423,7 @@ ${distillLines}`
|
|
|
6394
6423
|
}
|
|
6395
6424
|
if (content.length >= 30 && content.length <= 500 && !content.startsWith("<")) {
|
|
6396
6425
|
const firstSentence = content.split(/[.!?\n]/)[0]?.trim();
|
|
6397
|
-
const isTaskLike = firstSentence && /^(fix|add|create|update|implement|remove|refactor|build|change|move|write|make|set|run|deploy|test|commit|push|install|configure|debug|solve|close|merge|release)/i.test(firstSentence);
|
|
6426
|
+
const isTaskLike = firstSentence && /^(fix|add|create|update|implement|remove|refactor|build|change|move|write|make|set|run|deploy|test|commit|push|install|configure|debug|solve|close|merge|release|enable|disable|start|stop|check|verify|analyze|review|audit|optimize|clean|delete|migrate|upgrade|publish|get|do|finish)/i.test(firstSentence);
|
|
6398
6427
|
if (isTaskLike && firstSentence.length >= 15 && firstSentence.length <= 200) {
|
|
6399
6428
|
state.active_task = firstSentence;
|
|
6400
6429
|
}
|