Add tasks: the crew's shared to-do list
Bots and workspaces each keep a list of work tracked until it's done, and the bots move it along themselves as they work. - tasks (one collection per bot or per workspace), task_notes (the progress log) and task_media (a deliverable or a reference file, its bytes a private media row served at /media/private/<id>) - statuses todo/doing/blocked/done/cancelled, with blocked_reason while only the user can unblock it - visibility as SQL in src/utils/task-access: a user's own bots and workspaces, a run's own list plus its workspaces, everything for the coordinator; every tool and endpoint resolves through it - list_tasks, create_task and update_task on every run, so a chat reply, a task and a routine all read the list, log progress and file what they produced - TasksNote on every run and TaskReminderNote in chat, so a greeting or a proposed next step brings pending work up in one measured line - tasks group on the workspace dashboard and a tasks modal in the conversation header, sharing one form, row and detail panel - a bot's or workspace's own chat uploads are read before the delete so none are stranded; bot files keep their folder Also corrects the README's RAM guidance and table alignment.
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import Row from "@moduletrace/twui/layout/Row";
|
||||
import Link from "@moduletrace/twui/layout/Link";
|
||||
import { FileText, Image as ImageIcon } from "lucide-react";
|
||||
import Span from "@moduletrace/twui/layout/Span";
|
||||
import type { TaskFile } from "@/src/types";
|
||||
|
||||
type Props = {
|
||||
file: TaskFile;
|
||||
/**
|
||||
* A crew manager can unlink it.
|
||||
*/
|
||||
onDetach?: () => void;
|
||||
busy?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* One file on a task: its name, opening the bytes at
|
||||
* `/media/private/<id>`, and its `[file:ID]` chip when it lives in a bot's
|
||||
* or workspace's folder (so the file's real home is reachable too).
|
||||
*/
|
||||
export default function TaskFileRow({ file, onDetach, busy }: Props) {
|
||||
if (file.missing) {
|
||||
return (
|
||||
<Row className="w-full min-h-10 gap-2! flex-nowrap items-center px-1 py-1">
|
||||
<FileText size={16} className="shrink-0 text-ink-disabled" aria-hidden />
|
||||
<Span className="grow min-w-0 text-[13px] leading-[18px] text-ink-disabled truncate">
|
||||
{file.name || `File ${file.media_id}`} (gone)
|
||||
</Span>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Row className="w-full min-h-10 gap-2! flex-nowrap items-center px-1 py-1">
|
||||
{file.media_type == "image" ? (
|
||||
<ImageIcon size={16} className="shrink-0 text-ink-secondary" aria-hidden />
|
||||
) : (
|
||||
<FileText size={16} className="shrink-0 text-ink-secondary" aria-hidden />
|
||||
)}
|
||||
<Link
|
||||
href={`/media/private/${file.media_id}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
title={file.name || "Open the file"}
|
||||
className="grow min-w-0 text-[13px] leading-[18px] text-ink truncate hover:underline"
|
||||
>
|
||||
{file.name || `File ${file.media_id}`}
|
||||
</Link>
|
||||
{file.kind == "reference" ? (
|
||||
<Span className="shrink-0 text-[11px] leading-4 text-ink-secondary">reference</Span>
|
||||
) : null}
|
||||
{file.bot_file_id ? (
|
||||
<Span className="shrink-0 text-[11px] leading-4 text-ink-secondary">
|
||||
{`[file:${file.bot_file_id}]`}
|
||||
</Span>
|
||||
) : null}
|
||||
{onDetach ? (
|
||||
<Span
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-disabled={busy}
|
||||
title="Unlink this file"
|
||||
onClick={() => (busy ? undefined : onDetach())}
|
||||
onKeyDown={(event) => {
|
||||
if (busy) return;
|
||||
if (event.key == "Enter" || event.key == " ") onDetach();
|
||||
}}
|
||||
className="shrink-0 px-1 text-[11px] leading-4 text-ink-secondary cursor-pointer hover:text-ink"
|
||||
>
|
||||
Unlink
|
||||
</Span>
|
||||
) : null}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user