pi-ate-memory 1.3.1 → 1.3.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/lib/routing-register.ts +1 -0
- package/lib/routing.ts +8 -0
- package/package.json +1 -1
package/lib/routing-register.ts
CHANGED
|
@@ -10,6 +10,7 @@ export function registerRouting(pi: ExtensionAPI): void {
|
|
|
10
10
|
const pendingTools = new Map<string, { toolName: string; args: unknown }>();
|
|
11
11
|
|
|
12
12
|
pi.on("message_end", async (event: unknown, ctx: unknown) => {
|
|
13
|
+
if (ctx) router.setJudgeContext(ctx);
|
|
13
14
|
router.accumulate(event as { message?: { content?: unknown } });
|
|
14
15
|
void router.maybeTrigger(pi);
|
|
15
16
|
});
|
package/lib/routing.ts
CHANGED
|
@@ -64,6 +64,13 @@ export class MemoryRouter {
|
|
|
64
64
|
private charCount = 0;
|
|
65
65
|
private judgedBatches = new Set<string>();
|
|
66
66
|
private judgeInstance: JudgeInstance<string[]> | null = null;
|
|
67
|
+
private pendingCtx: unknown = null;
|
|
68
|
+
|
|
69
|
+
/** message_end 事件的 ExtensionContext —— judge 调 LLM 的必要通道,首个事件到达时注入 */
|
|
70
|
+
setJudgeContext(ctx: unknown): void {
|
|
71
|
+
this.pendingCtx = ctx;
|
|
72
|
+
if (this.judgeInstance) (this.judgeInstance as unknown as { setContext(c: unknown): void }).setContext(ctx);
|
|
73
|
+
}
|
|
67
74
|
readonly readTracker = createReadTracker();
|
|
68
75
|
|
|
69
76
|
constructor(private cwd: string, config: RoutingConfig) {
|
|
@@ -124,6 +131,7 @@ export class MemoryRouter {
|
|
|
124
131
|
judgeLogPath: `${process.env.USERPROFILE ?? process.env.HOME ?? ""}/.pi/agent/logs/memory-routing-llmjudge.log`,
|
|
125
132
|
legacySectionKeys: ["memoryRouting", "shepherd"],
|
|
126
133
|
});
|
|
134
|
+
if (this.pendingCtx != null) (this.judgeInstance as unknown as { setContext(c: unknown): void }).setContext(this.pendingCtx);
|
|
127
135
|
}
|
|
128
136
|
return this.judgeInstance;
|
|
129
137
|
}
|