fix(coding-agent): parse quoted import paths and missing files

This commit is contained in:
Armin Ronacher
2026-04-16 23:55:52 +02:00
parent 9078230b1a
commit 165603189b
3 changed files with 194 additions and 9 deletions

View File

@@ -33,6 +33,16 @@ export type CreateAgentSessionRuntimeFactory = (options: {
sessionStartEvent?: SessionStartEvent;
}) => Promise<CreateAgentSessionRuntimeResult>;
export class SessionImportFileNotFoundError extends Error {
readonly filePath: string;
constructor(filePath: string) {
super(`File not found: ${filePath}`);
this.name = "SessionImportFileNotFoundError";
this.filePath = filePath;
}
}
function extractUserMessageText(content: string | Array<{ type: string; text?: string }>): string {
if (typeof content === "string") {
return content;
@@ -251,7 +261,7 @@ export class AgentSessionRuntime {
async importFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }> {
const resolvedPath = resolve(inputPath);
if (!existsSync(resolvedPath)) {
throw new Error(`File not found: ${resolvedPath}`);
throw new SessionImportFileNotFoundError(resolvedPath);
}
const sessionDir = this.session.sessionManager.getSessionDir();