@vedtechsolutions/engram-mcp 1.0.11 → 1.0.12
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 +38 -11
- package/package.json +1 -1
package/dist/hook.js
CHANGED
|
@@ -3141,7 +3141,8 @@ function loadWatcherState() {
|
|
|
3141
3141
|
recent_commands: raw.recent_commands ?? [],
|
|
3142
3142
|
procedural_encoded_count: raw.procedural_encoded_count ?? 0,
|
|
3143
3143
|
recent_actions: raw.recent_actions ?? [],
|
|
3144
|
-
continuation_brief: raw.continuation_brief ?? null
|
|
3144
|
+
continuation_brief: raw.continuation_brief ?? null,
|
|
3145
|
+
recent_prompts: raw.recent_prompts ?? []
|
|
3145
3146
|
};
|
|
3146
3147
|
}
|
|
3147
3148
|
} catch {
|
|
@@ -3207,7 +3208,8 @@ function loadWatcherState() {
|
|
|
3207
3208
|
recent_commands: [],
|
|
3208
3209
|
procedural_encoded_count: 0,
|
|
3209
3210
|
recent_actions: [],
|
|
3210
|
-
continuation_brief: null
|
|
3211
|
+
continuation_brief: null,
|
|
3212
|
+
recent_prompts: []
|
|
3211
3213
|
};
|
|
3212
3214
|
}
|
|
3213
3215
|
function saveWatcherState(state) {
|
|
@@ -4176,13 +4178,18 @@ function handlePostWrite(toolInput, argFallback) {
|
|
|
4176
4178
|
const filePath = input?.file_path ?? input?.path ?? "";
|
|
4177
4179
|
if (!filePath) return;
|
|
4178
4180
|
const state = loadWatcherState();
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4181
|
+
{
|
|
4182
|
+
const newStr = input?.new_string ?? "";
|
|
4183
|
+
const firstNewLine = newStr.split("\n").find((l) => l.trim().length > 0) ?? "";
|
|
4184
|
+
const actionTarget = firstNewLine ? `${filePath} \u2192 ${firstNewLine}`.slice(0, 250) : filePath;
|
|
4185
|
+
state.recent_actions.push({
|
|
4186
|
+
tool: "Edit",
|
|
4187
|
+
target: actionTarget,
|
|
4188
|
+
time: (/* @__PURE__ */ new Date()).toISOString()
|
|
4189
|
+
});
|
|
4190
|
+
if (state.recent_actions.length > 15) {
|
|
4191
|
+
state.recent_actions = state.recent_actions.slice(-15);
|
|
4192
|
+
}
|
|
4186
4193
|
}
|
|
4187
4194
|
if (typeof filePath === "string" && !state.session_files.includes(filePath)) {
|
|
4188
4195
|
state.session_files.push(filePath);
|
|
@@ -4706,6 +4713,14 @@ function summarizeToolInput(tool, input) {
|
|
|
4706
4713
|
`pattern=${input.pattern ?? ""} path=${input.path ?? ""}`,
|
|
4707
4714
|
200
|
|
4708
4715
|
);
|
|
4716
|
+
case "Edit": {
|
|
4717
|
+
const filePath = input.file_path ?? "";
|
|
4718
|
+
const newStr = input.new_string ?? "";
|
|
4719
|
+
const firstNewLine = newStr.split("\n").find((l) => l.trim().length > 0) ?? "";
|
|
4720
|
+
return truncate(`${filePath} \u2192 ${firstNewLine}`, 250);
|
|
4721
|
+
}
|
|
4722
|
+
case "Write":
|
|
4723
|
+
return truncate(input.file_path ?? "", 200);
|
|
4709
4724
|
case "Agent":
|
|
4710
4725
|
return truncate(input.prompt ?? "", 300);
|
|
4711
4726
|
case "WebSearch":
|
|
@@ -5025,7 +5040,8 @@ function handleSessionStart(stdinJson, argFallback) {
|
|
|
5025
5040
|
recent_commands: isPostCompact ? prevState?.recent_commands ?? [] : [],
|
|
5026
5041
|
procedural_encoded_count: isPostCompact ? prevState?.procedural_encoded_count ?? 0 : 0,
|
|
5027
5042
|
recent_actions: isPostCompact ? prevState?.recent_actions ?? [] : [],
|
|
5028
|
-
continuation_brief: isPostCompact ? prevState?.continuation_brief ?? null : null
|
|
5043
|
+
continuation_brief: isPostCompact ? prevState?.continuation_brief ?? null : null,
|
|
5044
|
+
recent_prompts: isPostCompact ? prevState?.recent_prompts ?? [] : []
|
|
5029
5045
|
});
|
|
5030
5046
|
const source = metadata.source;
|
|
5031
5047
|
if (!source || source === "startup") {
|
|
@@ -5690,7 +5706,8 @@ function buildContinuationBrief(state) {
|
|
|
5690
5706
|
decisions,
|
|
5691
5707
|
tried_failed: triedFailed,
|
|
5692
5708
|
key_files: keyFiles.length > 0 ? keyFiles : state.session_files.slice(-10),
|
|
5693
|
-
blockers: state.recent_errors.slice(-3).map((e) => truncate(e, 150))
|
|
5709
|
+
blockers: state.recent_errors.slice(-3).map((e) => truncate(e, 150)),
|
|
5710
|
+
user_requests: state.recent_prompts.slice(-5).map((p) => truncate(p, 200))
|
|
5694
5711
|
};
|
|
5695
5712
|
}
|
|
5696
5713
|
function handlePreCompact() {
|
|
@@ -6280,6 +6297,12 @@ ${distillLines}`
|
|
|
6280
6297
|
}
|
|
6281
6298
|
}
|
|
6282
6299
|
}
|
|
6300
|
+
if (content.length >= 10) {
|
|
6301
|
+
state.recent_prompts.push(truncate(content, 300));
|
|
6302
|
+
if (state.recent_prompts.length > 8) {
|
|
6303
|
+
state.recent_prompts = state.recent_prompts.slice(-8);
|
|
6304
|
+
}
|
|
6305
|
+
}
|
|
6283
6306
|
try {
|
|
6284
6307
|
if (content.length >= 20 && !state.cognitive_state.current_approach) {
|
|
6285
6308
|
const approach = extractApproachFromPrompt(content);
|
|
@@ -7110,6 +7133,10 @@ function handlePostCompact(stdinJson) {
|
|
|
7110
7133
|
const files = brief.key_files.map((f) => f.split(/[/\\]/).pop() ?? f);
|
|
7111
7134
|
mindLines.push(` Files: ${files.join(", ")}`);
|
|
7112
7135
|
}
|
|
7136
|
+
if (brief.user_requests && brief.user_requests.length > 0) {
|
|
7137
|
+
mindLines.push(` User asked:`);
|
|
7138
|
+
for (const req of brief.user_requests.slice(-3)) mindLines.push(` - ${req}`);
|
|
7139
|
+
}
|
|
7113
7140
|
lines.push(mindLines.join("\n"));
|
|
7114
7141
|
} else {
|
|
7115
7142
|
const cog = state.cognitive_state;
|