@@ -4,6 +4,7 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `--no-session --session-id` so ephemeral CLI runs can use deterministic session IDs for provider cache affinity ([#6070](https://github.com/earendil-works/pi/issues/6070)).
|
||||
- Fixed disk BMP image files to be detected, converted to PNG, and attached through `read` and CLI `@file` inputs ([#6047](https://github.com/earendil-works/pi/issues/6047)).
|
||||
- Fixed auto-retry for provider stream errors that explicitly tell callers to retry the request ([#6019](https://github.com/earendil-works/pi/issues/6019)).
|
||||
|
||||
|
||||
@@ -1431,8 +1431,8 @@ export class SessionManager {
|
||||
}
|
||||
|
||||
/** Create an in-memory session (no file persistence) */
|
||||
static inMemory(cwd: string = process.cwd()): SessionManager {
|
||||
return new SessionManager(cwd, "", undefined, false);
|
||||
static inMemory(cwd: string = process.cwd(), options?: NewSessionOptions): SessionManager {
|
||||
return new SessionManager(cwd, "", undefined, false, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -225,7 +225,6 @@ function validateSessionIdFlags(parsed: Args): void {
|
||||
parsed.session ? "--session" : undefined,
|
||||
parsed.continue ? "--continue" : undefined,
|
||||
parsed.resume ? "--resume" : undefined,
|
||||
parsed.noSession ? "--no-session" : undefined,
|
||||
].filter((flag): flag is string => flag !== undefined);
|
||||
|
||||
if (conflictingFlags.length > 0) {
|
||||
@@ -259,7 +258,7 @@ async function createSessionManager(
|
||||
settingsManager: SettingsManager,
|
||||
): Promise<SessionManager> {
|
||||
if (parsed.noSession || parsed.help || parsed.listModels !== undefined) {
|
||||
return SessionManager.inMemory(cwd);
|
||||
return SessionManager.inMemory(cwd, parsed.sessionId !== undefined ? { id: parsed.sessionId } : undefined);
|
||||
}
|
||||
|
||||
if (parsed.fork) {
|
||||
|
||||
@@ -108,6 +108,13 @@ describe("--session-id read-only commands", () => {
|
||||
expect(hasSessionWithId(join(result.agentDir, "sessions"), "read-only-help")).toBe(false);
|
||||
});
|
||||
|
||||
it("allows --no-session with --session-id", async () => {
|
||||
const result = await runCli(["--no-session", "--session-id", "ephemeral-id", "--help"]);
|
||||
|
||||
expect(result.code).toBe(0);
|
||||
expect(hasSessionWithId(join(result.agentDir, "sessions"), "ephemeral-id")).toBe(false);
|
||||
});
|
||||
|
||||
it("does not reserve a session for --list-models", async () => {
|
||||
const result = await runCli(["--session-id", "read-only-models", "--list-models"]);
|
||||
|
||||
|
||||
@@ -13,6 +13,13 @@ describe("SessionManager.newSession with custom id", () => {
|
||||
expect(session.getSessionId()).toBe("my-custom-id");
|
||||
});
|
||||
|
||||
it("uses the provided id when creating an in-memory session", () => {
|
||||
const session = SessionManager.inMemory(process.cwd(), { id: "memory-session-id" });
|
||||
expect(session.getSessionId()).toBe("memory-session-id");
|
||||
expect(session.getHeader()!.id).toBe("memory-session-id");
|
||||
expect(session.getSessionFile()).toBeUndefined();
|
||||
});
|
||||
|
||||
it("allows alphanumeric session ids with interior punctuation", () => {
|
||||
const session = SessionManager.inMemory();
|
||||
session.newSession({ id: "abc-123_def.456" });
|
||||
|
||||
Reference in New Issue
Block a user