* feat(chat): fork assistant turns into new drafts Builds chat-history attachments on the daemon and routes them into draft composers so users can continue an assistant turn in an existing workspace tab or New Workspace. * fix(chat): clean up fork draft handling * fix(chat): address fork draft review feedback * fix(server): build fork context from bounded timeline * fix(app): restore assistant turn footer in streams * fix(app): preserve fork draft setup * fix(app): tighten assistant fork footers * fix(app): lock active fork draft handoff * fix(app): preserve attachment-only draft retries * fix(app): unify composer attachment scopes * fix(app): align chat history attachment labels * fix(app): centralize attachment pill content * fix(app): trim fork context for workspace naming
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { AgentAttachment } from "@getpaseo/protocol/messages";
|
|
import {
|
|
getWorkspaceNamingAttachments,
|
|
remapDraftCwdToWorkspace,
|
|
} from "./new-workspace-fork-context";
|
|
|
|
describe("remapDraftCwdToWorkspace", () => {
|
|
it("preserves a Windows subdirectory when source path casing differs", () => {
|
|
expect(
|
|
remapDraftCwdToWorkspace({
|
|
cwd: "c:\\Repo\\packages\\app",
|
|
sourceDirectory: "C:\\Repo",
|
|
workspaceDirectory: "D:\\Worktrees\\fork",
|
|
}),
|
|
).toBe("D:\\Worktrees\\fork\\packages\\app");
|
|
});
|
|
|
|
it("falls back to the workspace root when the cwd is outside the source directory", () => {
|
|
expect(
|
|
remapDraftCwdToWorkspace({
|
|
cwd: "/other/repo/packages/app",
|
|
sourceDirectory: "/repo",
|
|
workspaceDirectory: "/worktrees/fork",
|
|
}),
|
|
).toBe("/worktrees/fork");
|
|
});
|
|
});
|
|
|
|
describe("getWorkspaceNamingAttachments", () => {
|
|
it("removes full chat history from workspace naming context", () => {
|
|
const chatHistory = {
|
|
type: "text",
|
|
mimeType: "text/plain",
|
|
contextKind: "chat_history",
|
|
title: "Chat history",
|
|
text: "Long prior conversation",
|
|
} satisfies AgentAttachment;
|
|
const prContext = {
|
|
type: "github_pr",
|
|
mimeType: "application/github-pr",
|
|
number: 1788,
|
|
title: "Fork assistant turns into new drafts",
|
|
url: "https://github.com/getpaseo/paseo/pull/1788",
|
|
} satisfies AgentAttachment;
|
|
|
|
expect(getWorkspaceNamingAttachments([chatHistory, prContext])).toEqual([prContext]);
|
|
});
|
|
});
|