@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed `sessionDir` in `settings.json` to expand `~`, so portable session-directory settings no longer require a shell wrapper ([#3514](https://github.com/badlogic/pi-mono/issues/3514))
|
||||||
- Fixed parallel tool-call rows to leave the pending state as soon as each tool is finalized, while still appending persisted tool results in assistant source order ([#3503](https://github.com/badlogic/pi-mono/issues/3503))
|
- Fixed parallel tool-call rows to leave the pending state as soon as each tool is finalized, while still appending persisted tool results in assistant source order ([#3503](https://github.com/badlogic/pi-mono/issues/3503))
|
||||||
- Fixed exported session markdown to render Markdown while showing HTML-like message content such as `<file name="...">...</file>` verbatim, so shared sessions match the TUI instead of letting the browser interpret message text ([#3484](https://github.com/badlogic/pi-mono/issues/3484))
|
- Fixed exported session markdown to render Markdown while showing HTML-like message content such as `<file name="...">...</file>` verbatim, so shared sessions match the TUI instead of letting the browser interpret message text ([#3484](https://github.com/badlogic/pi-mono/issues/3484))
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ When a provider requests a retry delay longer than `maxDelayMs` (e.g., Google's
|
|||||||
|
|
||||||
| Setting | Type | Default | Description |
|
| Setting | Type | Default | Description |
|
||||||
|---------|------|---------|-------------|
|
|---------|------|---------|-------------|
|
||||||
| `sessionDir` | string | - | Directory where session files are stored. Accepts absolute or relative paths. |
|
| `sessionDir` | string | - | Directory where session files are stored. Accepts absolute or relative paths, plus `~`. |
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{ "sessionDir": ".pi/sessions" }
|
{ "sessionDir": ".pi/sessions" }
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { Transport } from "@mariozechner/pi-ai";
|
import type { Transport } from "@mariozechner/pi-ai";
|
||||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||||
|
import { homedir } from "os";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
import lockfile from "proper-lockfile";
|
import lockfile from "proper-lockfile";
|
||||||
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
||||||
@@ -534,7 +535,17 @@ export class SettingsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSessionDir(): string | undefined {
|
getSessionDir(): string | undefined {
|
||||||
return this.settings.sessionDir;
|
const sessionDir = this.settings.sessionDir;
|
||||||
|
if (!sessionDir) {
|
||||||
|
return sessionDir;
|
||||||
|
}
|
||||||
|
if (sessionDir === "~") {
|
||||||
|
return homedir();
|
||||||
|
}
|
||||||
|
if (sessionDir.startsWith("~/")) {
|
||||||
|
return join(homedir(), sessionDir.slice(2));
|
||||||
|
}
|
||||||
|
return sessionDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultProvider(): string | undefined {
|
getDefaultProvider(): string | undefined {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
||||||
|
import { homedir } from "os";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
import { SettingsManager } from "../src/core/settings-manager.js";
|
import { SettingsManager } from "../src/core/settings-manager.js";
|
||||||
@@ -308,5 +309,11 @@ describe("SettingsManager", () => {
|
|||||||
const manager = SettingsManager.create(projectDir, agentDir);
|
const manager = SettingsManager.create(projectDir, agentDir);
|
||||||
expect(manager.getSessionDir()).toBe("./sessions");
|
expect(manager.getSessionDir()).toBe("./sessions");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should expand ~ in sessionDir", () => {
|
||||||
|
writeFileSync(join(agentDir, "settings.json"), JSON.stringify({ sessionDir: "~/sessions" }));
|
||||||
|
const manager = SettingsManager.create(projectDir, agentDir);
|
||||||
|
expect(manager.getSessionDir()).toBe(join(homedir(), "sessions"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user