@yandy0725/pi-memory 1.0.0 → 1.0.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/index.ts +8 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -87,11 +87,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
87
87
|
pi.on("before_agent_start", async (event, ctx) => {
|
|
88
88
|
if (!config?.enabled || !indexSnapshot || !memoryDir) return;
|
|
89
89
|
|
|
90
|
-
// Auto-surfacing: select relevant topic files via LLM side-query and inject as message
|
|
90
|
+
// Auto-surfacing: select relevant topic files via LLM side-query and inject as message.
|
|
91
|
+
// Skip for subagents: pi-subagents strips "subagent" from all children's
|
|
92
|
+
// tool sets, so its absence reliably identifies subagents. Without this guard,
|
|
93
|
+
// runSideQuery's subagent spawn → before_agent_start → re-enter here → OOM.
|
|
94
|
+
const agentTools = event.systemPromptOptions?.selectedTools;
|
|
95
|
+
const isSubagent = agentTools && !agentTools.includes("subagent");
|
|
96
|
+
|
|
91
97
|
const autoSurfacing = config.autoSurfacing;
|
|
92
98
|
// biome-ignore lint/suspicious/noExplicitAny: message injection result
|
|
93
99
|
let injectedMessage: any;
|
|
94
|
-
if (autoSurfacing?.enabled && event.prompt) {
|
|
100
|
+
if (autoSurfacing?.enabled && event.prompt && !isSubagent) {
|
|
95
101
|
try {
|
|
96
102
|
if (ctx.hasUI) ctx.ui.setStatus("surfacing", "Searching relevant memories…");
|
|
97
103
|
const manifest = await scanTopics(memoryDir);
|