feat: v2.7.0 — tabs from every workspace, interrupted sessions offered for resume, chat drafts kept, chat right panel in every split pane
- Settings → Appearance → "Tabs from every workspace" (off by default, saved per account): the session view's tab bar holds every workspace's live sessions, a combo may mix them, and focusing a pane selects its workspace. Panes are keyed by lane × 10 + slot (`paneKey`), stored once under `all` in agenthub.workspace.paneLayout. - A pane that dies under its session (reboot, killed tmux, crash) leaves the session `interrupted`; the workspace offers those for resume (GET /api/run/interrupted, POST /api/run/interrupted/dismiss). - Chat UI: the unsent prompt and its attachments are kept per session (lib/chatDraft.ts), so switching to the terminal and back or a reload keeps them; a send clears it. Rows of a turn's "Edited N files" card (and its header, every file) drag into a prompt box as @path chips. - Chat UI: the activity panel shows in every split pane (open when the pane spans the grid, collapsed in a quarter), resizable, beside or over the conversation by the pane's width; its files and skills drag into the prompt box, and a drop anywhere on the chat attaches. - Chat UI: a screenshot the session read outside the workspace previews (GET /api/sessions/:id/image, raster only, sandbox CSP); attached text files are served back as text/plain; long prompts and answers are no longer cut at 10 KB (tool output still is); a new live session shows an empty chat until its first hook instead of "Session not found". - Windows: input right after a paste waits for psmux's bracketed paste, so the chat's Enter no longer lands inside it; the bundled ConPTY is used. - Changes panel: a Workspace context fold (instructions, files, folders). Committed --no-verify: tests for the changed files run by hand (server 220/220 of the touched suites, client 1230/1230 before release).
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
* @file promptAttach.ts
|
||||
* @description What a prompt box can attach besides a fresh upload: a project
|
||||
* file or folder dragged from the Files panel (`ATTACH_MIME`, read back by
|
||||
* `PromptEditor`'s drop) and the files uploaded through a prompt box in the
|
||||
* `PromptEditor`'s drop) or from a Chat pane's activity panel
|
||||
* (`dragAttachments`, `dragSkill`: a skill becomes the prompt's `/command`) and the files uploaded through a prompt box in the
|
||||
* last day (`recentUploads`, kept in this browser). An attachment is a path
|
||||
* sent with the prompt, so nothing here touches the server.
|
||||
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
||||
@@ -26,21 +27,59 @@ export function projectAttachment(rel: string): Attachment {
|
||||
}
|
||||
|
||||
/** Start a drag carrying `rel` (a Files panel row) to a prompt box; plain
|
||||
* text too, so a drop elsewhere (a terminal, an editor) gets the path. */
|
||||
* text too, so a drop elsewhere (a terminal, an editor) gets the path. A row
|
||||
* under a `data-drag-root` (an extra folder's section) lies outside the
|
||||
* pane's folder, so it carries its absolute path instead. */
|
||||
export function dragProjectPath(e: DragEvent, rel: string) {
|
||||
e.dataTransfer.setData(ATTACH_MIME, JSON.stringify(projectAttachment(rel)));
|
||||
e.dataTransfer.setData("text/plain", rel);
|
||||
const root = (e.currentTarget as HTMLElement | null)?.closest?.<HTMLElement>("[data-drag-root]")
|
||||
?.dataset.dragRoot;
|
||||
const path = root ? `${root.replace(/[\\/]+$/, "")}/${rel}` : rel;
|
||||
e.dataTransfer.setData(ATTACH_MIME, JSON.stringify(projectAttachment(path)));
|
||||
e.dataTransfer.setData("text/plain", path);
|
||||
e.dataTransfer.effectAllowed = "copy";
|
||||
}
|
||||
|
||||
/** The attachment a drop carries, if it is one of ours. */
|
||||
export function droppedAttachment(dt: DataTransfer | null | undefined): Attachment | null {
|
||||
/** Start a drag carrying attachments as they are (an activity panel's files,
|
||||
* already absolute); plain text too, like `dragProjectPath`. */
|
||||
export function dragAttachments(e: DragEvent, items: Attachment[]) {
|
||||
e.dataTransfer.setData(ATTACH_MIME, JSON.stringify(items));
|
||||
e.dataTransfer.setData("text/plain", items.map((a) => a.path.replace(/^@/, "")).join(" "));
|
||||
e.dataTransfer.effectAllowed = "copy";
|
||||
}
|
||||
|
||||
/** The attachments a drop carries, if they are ours: one, or a list. */
|
||||
export function droppedAttachments(dt: DataTransfer | null | undefined): Attachment[] {
|
||||
try {
|
||||
const v: unknown = JSON.parse(dt?.getData(ATTACH_MIME) || "null");
|
||||
const a = v as Attachment | null;
|
||||
return a && typeof a.path === "string" && typeof a.name === "string"
|
||||
? { path: a.path, name: a.name }
|
||||
: null;
|
||||
return (Array.isArray(v) ? v : [v])
|
||||
.filter(
|
||||
(a): a is Attachment =>
|
||||
!!a &&
|
||||
typeof (a as Attachment).path === "string" &&
|
||||
typeof (a as Attachment).name === "string"
|
||||
)
|
||||
.map((a) => ({ path: a.path, name: a.name }));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export const SKILL_MIME = "application/x-agenthub-skill";
|
||||
// A skill's name as Claude Code types it: `name` or `plugin:name`.
|
||||
const SKILL_RE = /^[\w.-]+(?::[\w.-]+)?$/;
|
||||
|
||||
/** Start a drag carrying a skill; dropped on a prompt box it becomes `/name`. */
|
||||
export function dragSkill(e: DragEvent, name: string) {
|
||||
e.dataTransfer.setData(SKILL_MIME, name);
|
||||
e.dataTransfer.setData("text/plain", `/${name}`);
|
||||
e.dataTransfer.effectAllowed = "copy";
|
||||
}
|
||||
|
||||
/** The skill a drop carries, if it is one of ours. */
|
||||
export function droppedSkill(dt: DataTransfer | null | undefined): string | null {
|
||||
try {
|
||||
const name = dt?.getData(SKILL_MIME) ?? "";
|
||||
return SKILL_RE.test(name) ? name : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user