fix(coding-agent): respect agentDir for sdk session paths closes #2457
This commit is contained in:
@@ -418,9 +418,9 @@ export function buildSessionContext(
|
||||
* Compute the default session directory for a cwd.
|
||||
* Encodes cwd into a safe directory name under ~/.pi/agent/sessions/.
|
||||
*/
|
||||
function getDefaultSessionDir(cwd: string): string {
|
||||
export function getDefaultSessionDir(cwd: string, agentDir: string = getDefaultAgentDir()): string {
|
||||
const safePath = `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
|
||||
const sessionDir = join(getDefaultAgentDir(), "sessions", safePath);
|
||||
const sessionDir = join(agentDir, "sessions", safePath);
|
||||
if (!existsSync(sessionDir)) {
|
||||
mkdirSync(sessionDir, { recursive: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user