@juicesharp/rpiv-advisor 1.5.2 → 1.6.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/advisor.ts +11 -9
- package/package.json +1 -1
package/advisor.ts
CHANGED
|
@@ -22,10 +22,10 @@ import { completeSimple, getSupportedThinkingLevels, type Message, type Thinking
|
|
|
22
22
|
import {
|
|
23
23
|
type AgentToolResult,
|
|
24
24
|
type AgentToolUpdateCallback,
|
|
25
|
+
buildSessionContext,
|
|
25
26
|
convertToLlm,
|
|
26
27
|
type ExtensionAPI,
|
|
27
28
|
type ExtensionContext,
|
|
28
|
-
type SessionEntry,
|
|
29
29
|
type ToolInfo,
|
|
30
30
|
} from "@earendil-works/pi-coding-agent";
|
|
31
31
|
import type { SelectItem } from "@earendil-works/pi-tui";
|
|
@@ -377,14 +377,16 @@ async function executeAdvisor(
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
// Live-read every call — advisor runs mid-turn so any message_end snapshot
|
|
380
|
-
// is always one turn stale.
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
.
|
|
387
|
-
|
|
380
|
+
// is always one turn stale. buildSessionContext() preserves Pi's resolved
|
|
381
|
+
// LLM context, including compaction summaries and branch summaries, instead
|
|
382
|
+
// of replaying raw pre-compaction branch messages. convertToLlm is
|
|
383
|
+
// pass-through for user/assistant/toolResult (messages.js:111-114), so
|
|
384
|
+
// element refs are stable across calls via the session store.
|
|
385
|
+
const { messages: sessionMessages } = buildSessionContext(
|
|
386
|
+
ctx.sessionManager.getEntries(),
|
|
387
|
+
ctx.sessionManager.getLeafId(),
|
|
388
|
+
);
|
|
389
|
+
const branchMessages = ensureUserTailForAdvisor(stripInflightAdvisorCall(convertToLlm(sessionMessages)));
|
|
388
390
|
const inventoryMessage = getInventoryMessage(pi.getAllTools());
|
|
389
391
|
const messages: Message[] = inventoryMessage ? [inventoryMessage, ...branchMessages] : branchMessages;
|
|
390
392
|
|