chat session context scoping, fix sandboxed pi config mounts, dedupe zai/opencode providers

- Add context/contextId fields to session types, storage, and index
- Filter sessions by context (project, workspace, or default chat)
- Pass context through websocket, REST API, and frontend hooks
- Mount ~/.pi/agent into sandboxed containers for auth + writable sessions
- Remove PI_CODING_AGENT_DIR override so container pi uses ~/.pi/agent
- Deduplicate zai/opencode models (same service, show as opencode)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 22:35:02 +00:00
co-authored by Claude Opus 4.6
parent 1cbf9553ec
commit 13cfeac384
15 changed files with 111 additions and 24 deletions
+2 -1
View File
@@ -51,9 +51,10 @@ piRestRouter.post('/pi/sessions', async (ctx: Context) => {
const body = await ctx.req.json().catch(() => ({}));
const userHome = getHomeDir(user.email);
const filterCwd = body.cwd ? resolveBaseCwd(user.email, body.cwdRoot, body.cwd) : null;
const contextFilter = body.context ? { context: body.context as string, contextId: body.contextId as string | undefined } : undefined;
try {
let sessions = await storage.listUserSessions(userHome);
let sessions = await storage.listUserSessions(userHome, contextFilter);
if (filterCwd) {
sessions = sessions.filter((s) => s.cwd === filterCwd);
}