Make memory runtime-native for companion chat

Replace the old project-scoped file memory plumbing with runtime-native conversational memory and remove obsolete pi-memory-md shipping/wiring.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Harivansh Rathi 2026-03-08 15:24:52 -07:00
parent 9765576c0a
commit 5c389efcf9
10 changed files with 1859 additions and 1536 deletions

View file

@ -315,6 +315,7 @@ export async function createAgentSession(
};
const extensionRunnerRef: { current?: ExtensionRunner } = {};
const sessionRef: { current?: AgentSession } = {};
agent = new Agent({
initialState: {
@ -326,9 +327,15 @@ export async function createAgentSession(
convertToLlm: convertToLlmWithBlockImages,
sessionId: sessionManager.getSessionId(),
transformContext: async (messages) => {
const currentSession = sessionRef.current;
let transformedMessages = messages;
if (currentSession) {
transformedMessages =
await currentSession.transformRuntimeContext(transformedMessages);
}
const runner = extensionRunnerRef.current;
if (!runner) return messages;
return runner.emitContext(messages);
if (!runner) return transformedMessages;
return runner.emitContext(transformedMessages);
},
steeringMode: settingsManager.getSteeringMode(),
followUpMode: settingsManager.getFollowUpMode(),
@ -388,6 +395,7 @@ export async function createAgentSession(
initialActiveToolNames,
extensionRunnerRef,
});
sessionRef.current = session;
const extensionsResult = resourceLoader.getExtensions();
return {