Pick project and model when creating a task
This commit is contained in:
@@ -4,9 +4,6 @@
|
||||
|
||||
# M2 — Seeing the work
|
||||
|
||||
- Pick project and model when creating a task
|
||||
The switcher's task creation lets a `proj:` prefix narrow to project rows instead of always using the focused or first project, and the "New task in X" row shows the model that will run.
|
||||
|
||||
# M3 — Second vendor and review
|
||||
|
||||
# M4 — Merging and history
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ Messages byre itself sends an agent (actor `byre`: the restart notice, Sync and
|
||||
|
||||
**Drafts.** Unsent composer text (task and lead) and unsent inbox answers (checked choices and Other/Reply text) are kept in memory by `web/src/drafts.ts` and mirrored to the browser's localStorage under `byre.drafts.<login>`, one JSON object with `composer` (keyed by `message:<task id>` or `message:lead`, each `{text, images}`), `checked` and `texts` (both keyed by inbox item id). Writes are debounced and flushed at once when a composer or answer box loses focus, when the transcript view is disposed, and on `pagehide`. A composer draft is cleared only once its send succeeds, and an inbox answer only once its response is accepted; each send in flight is tracked on its own and the stored draft holds the text of every unconfirmed send (oldest first, then the composer's current text, separated by blank lines) and counts its images, so a reload mid-send brings back everything not yet confirmed. A failed send's text goes back into the composer ahead of whatever is there now (text typed since, or earlier failures), separated by a blank line, rather than replacing it. Drafts for tasks that are no longer active and for inbox items no longer open are pruned whenever the task list or inbox reloads. A storage read that throws or holds malformed JSON (or entries of the wrong shape) is ignored, and a write that throws is logged; drafts then live only in memory. Pending images are not stored, only their count: after a reload the composer shows how many need re-attaching, until dismissed or the next successful send.
|
||||
|
||||
The task switcher (⌘K, or the project ▸ task picker centred in the right pane's top row) lists active tasks with their session state and open inbox item count (the Project tab's task list shows the same state), and **merge held** on a task with `merge_queued_at`, live while it is open. Tasks with inbox items come first; within each group, the task least recently visited in this browser comes first (never-visited tasks before all others, ties in the server's order: projects by name, tasks newest first). Visit times are kept in the browser's localStorage under `byre.visits`, stamped when a task is selected and again when it is left. After the tasks come the projects, one row each; picking one points the right pane at the project with no task, on the Project tab. Typing filters both and adds a last row that creates a task with the typed text as its title, in the right pane's project (the first project when there is none); Enter picks the highlighted row. Picking a task points the right pane at it on the Inbox tab when it has open inbox items, otherwise on the Transcript tab (see "Lead agent").
|
||||
The task switcher (⌘K, or the project ▸ task picker centred in the right pane's top row) lists active tasks with their session state and open inbox item count (the Project tab's task list shows the same state), and **merge held** on a task with `merge_queued_at`, live while it is open. Tasks with inbox items come first; within each group, the task least recently visited in this browser comes first (never-visited tasks before all others, ties in the server's order: projects by name, tasks newest first). Visit times are kept in the browser's localStorage under `byre.visits`, stamped when a task is selected and again when it is left. After the tasks come the projects, one row each; picking one points the right pane at the project with no task, on the Project tab. Typing filters both and adds a last row that creates a task with the typed text as its title, in the right pane's project (the first project when there is none); Enter picks the highlighted row. Text before a first colon that starts at least one project's name (ignoring case, no spaces) picks those projects instead: `by: fix` lists only their tasks whose titles contain "fix", their project rows that match, and one row per project creating the task titled "fix" there. When no project name starts with it, the whole text is the title, so "Fix: login" stays as typed. A create row shows `models[0]` from `web/src/task.ts`, the model the composer offers first for the new task's first message; the task itself starts with no session. Picking a task points the right pane at it on the Inbox tab when it has open inbox items, otherwise on the Transcript tab (see "Lead agent").
|
||||
|
||||
**Task colours.** Each task has a colour, `tasks.color` (`color` in the API), an index into the palette of `--task-0` … `--task-N` custom properties at the top of `web/style.css`, one set for light and one for dark, all at least 4.5:1 against the backgrounds so they work as text. `CreateTask` assigns it in the same transaction as the task's row: of the `store.TaskColors` colours, one no active task holds, and among those the one given out longest ago (the lowest `max(rowid)` of tasks with that colour, never-used first), so a new task doesn't take the colour of one just closed. Active tasks have distinct colours until more than `TaskColors` are active at once. `TaskColors` must match the number of palette entries. An element styled with `taskStyle(id)` (`web/src/taskcolor.ts`) sets `--task` for itself and its children from the task's `color`; `--task` defaults to the accent, which is also what a task the page doesn't know gets. The right pane sets it for the selected task, which tints the picker's row, colours the task picker's text, the selected tab's underline, the composer's border and the running border and scanner. Everywhere a task is named it shows in its colour: task titles in the switcher, the Project tab and the Status tab (`.task-name`), and task links (`a.task-link`), including any Markdown link to `#/task/<id>` or `#/task/<id>/<tab>`. The lead's guidance tells it to link every task it names that way, using `#/task/<id>/inbox` when it points the human at the task's inbox, and clicking one points the right pane at the task, selecting the named tab if there is one.
|
||||
|
||||
|
||||
Vendored
+12
-7
@@ -2,7 +2,7 @@ import { post } from "./api.js";
|
||||
import { errorText, h, replace, showAlert } from "./dom.js";
|
||||
import { focusLead } from "./panes.js";
|
||||
import { activeTasks, focusedProject, focusProject, focusTab, focusTask, lastVisits, onEach, state, taskState } from "./state.js";
|
||||
import { confirmMerge } from "./task.js";
|
||||
import { confirmMerge, models } from "./task.js";
|
||||
import { taskStyle } from "./taskcolor.js";
|
||||
export function bindShortcuts() {
|
||||
addEventListener("keydown", (e) => {
|
||||
@@ -50,6 +50,7 @@ const shortcuts = [
|
||||
[
|
||||
["↑ ↓", "Move the highlight"],
|
||||
["Enter", "Pick the highlighted row"],
|
||||
["name: title", "Create the task in the project whose name starts with name"],
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -117,12 +118,16 @@ export function openSwitcher() {
|
||||
}
|
||||
};
|
||||
const render = () => {
|
||||
const title = input.value.trim();
|
||||
const typed = input.value.trim();
|
||||
const prefix = /^([^:\s]+):\s*(.*)$/.exec(typed);
|
||||
const named = prefix ? state.projects.filter((p) => p.name.toLowerCase().startsWith(prefix[1].toLowerCase())) : [];
|
||||
const targets = named.length > 0 ? named : undefined;
|
||||
const title = targets ? prefix[2] : typed;
|
||||
const q = title.toLowerCase();
|
||||
const inbox = (taskId) => state.inbox.filter((item) => item.task_id === taskId).length;
|
||||
const visits = lastVisits();
|
||||
const matches = activeTasks()
|
||||
.filter(({ project, task }) => `${project.name} ${task.title}`.toLowerCase().includes(q))
|
||||
.filter(({ project, task }) => targets ? targets.some((p) => p.id === project.id) && task.title.toLowerCase().includes(q) : `${project.name} ${task.title}`.toLowerCase().includes(q))
|
||||
.map((m) => ({ ...m, count: inbox(m.task.id), visited: visits[m.task.id] ?? 0 }))
|
||||
.sort((a, b) => Number(b.count > 0) - Number(a.count > 0) || a.visited - b.visited);
|
||||
rows = matches.map(({ project, task, count }) => {
|
||||
@@ -130,7 +135,7 @@ export function openSwitcher() {
|
||||
const el = h("li", { style: taskStyle(task.id) }, h("span", { class: `dot ${ts ?? "none"}`, title: ts ?? "no session" }), h("span", { class: "task-title" }, h("span", { class: "project-name" }, project.name), " ", h("span", { class: "task-name" }, task.title)), count > 0 && h("span", { class: "badge", title: "inbox items" }, count), task.merge_queued_at !== undefined && h("span", { class: "task-state warn", title: "Waiting for the merge in progress in this project to finish" }, "merge held"), h("span", { class: "task-state" }, ts ?? "no agent"));
|
||||
return { el, pick: () => go(task.id) };
|
||||
});
|
||||
for (const p of state.projects.filter((p) => `${p.name} project`.toLowerCase().includes(q))) {
|
||||
for (const p of (targets ?? state.projects).filter((p) => `${p.name} project`.toLowerCase().includes(q))) {
|
||||
const el = h("li", {}, h("span", { class: "dot none" }), h("span", { class: "task-title" }, h("span", { class: "project-name" }, p.name)), h("span", { class: "task-state" }, "project"));
|
||||
rows.push({
|
||||
el,
|
||||
@@ -140,9 +145,9 @@ export function openSwitcher() {
|
||||
},
|
||||
});
|
||||
}
|
||||
const project = focusedProject() ?? state.projects[0];
|
||||
if (title && project) {
|
||||
const el = h("li", { class: "new-task" }, h("span", { class: "task-title" }, "New task in ", h("span", { class: "project-name" }, project.name), ": ", title));
|
||||
const fallback = focusedProject() ?? state.projects[0];
|
||||
for (const project of title ? (targets ?? (fallback ? [fallback] : [])) : []) {
|
||||
const el = h("li", { class: "new-task" }, h("span", { class: "task-title" }, "New task in ", h("span", { class: "project-name" }, project.name), ": ", title), h("span", { class: "task-state", title: "Model for the first message" }, models[0]));
|
||||
rows.push({ el, pick: () => void create(project.id, title) });
|
||||
}
|
||||
selected = Math.min(selected, Math.max(rows.length - 1, 0));
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+19
-7
@@ -2,7 +2,7 @@ import { post } from "./api.js";
|
||||
import { errorText, h, replace, showAlert } from "./dom.js";
|
||||
import { focusLead } from "./panes.js";
|
||||
import { activeTasks, focusedProject, focusProject, focusTab, focusTask, lastVisits, onEach, state, taskState } from "./state.js";
|
||||
import { confirmMerge } from "./task.js";
|
||||
import { confirmMerge, models } from "./task.js";
|
||||
import { taskStyle } from "./taskcolor.js";
|
||||
|
||||
export function bindShortcuts(): void {
|
||||
@@ -48,6 +48,7 @@ const shortcuts: [string, [string, string][]][] = [
|
||||
[
|
||||
["↑ ↓", "Move the highlight"],
|
||||
["Enter", "Pick the highlighted row"],
|
||||
["name: title", "Create the task in the project whose name starts with name"],
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -128,12 +129,18 @@ export function openSwitcher(): void {
|
||||
};
|
||||
|
||||
const render = () => {
|
||||
const title = input.value.trim();
|
||||
const typed = input.value.trim();
|
||||
const prefix = /^([^:\s]+):\s*(.*)$/.exec(typed);
|
||||
const named = prefix ? state.projects.filter((p) => p.name.toLowerCase().startsWith(prefix[1]!.toLowerCase())) : [];
|
||||
const targets = named.length > 0 ? named : undefined;
|
||||
const title = targets ? prefix![2]! : typed;
|
||||
const q = title.toLowerCase();
|
||||
const inbox = (taskId: string) => state.inbox.filter((item) => item.task_id === taskId).length;
|
||||
const visits = lastVisits();
|
||||
const matches = activeTasks()
|
||||
.filter(({ project, task }) => `${project.name} ${task.title}`.toLowerCase().includes(q))
|
||||
.filter(({ project, task }) =>
|
||||
targets ? targets.some((p) => p.id === project.id) && task.title.toLowerCase().includes(q) : `${project.name} ${task.title}`.toLowerCase().includes(q),
|
||||
)
|
||||
.map((m) => ({ ...m, count: inbox(m.task.id), visited: visits[m.task.id] ?? 0 }))
|
||||
.sort((a, b) => Number(b.count > 0) - Number(a.count > 0) || a.visited - b.visited);
|
||||
rows = matches.map(({ project, task, count }) => {
|
||||
@@ -149,7 +156,7 @@ export function openSwitcher(): void {
|
||||
);
|
||||
return { el, pick: () => go(task.id) };
|
||||
});
|
||||
for (const p of state.projects.filter((p) => `${p.name} project`.toLowerCase().includes(q))) {
|
||||
for (const p of (targets ?? state.projects).filter((p) => `${p.name} project`.toLowerCase().includes(q))) {
|
||||
const el = h("li", {}, h("span", { class: "dot none" }), h("span", { class: "task-title" }, h("span", { class: "project-name" }, p.name)), h("span", { class: "task-state" }, "project"));
|
||||
rows.push({
|
||||
el,
|
||||
@@ -159,9 +166,14 @@ export function openSwitcher(): void {
|
||||
},
|
||||
});
|
||||
}
|
||||
const project = focusedProject() ?? state.projects[0];
|
||||
if (title && project) {
|
||||
const el = h("li", { class: "new-task" }, h("span", { class: "task-title" }, "New task in ", h("span", { class: "project-name" }, project.name), ": ", title));
|
||||
const fallback = focusedProject() ?? state.projects[0];
|
||||
for (const project of title ? (targets ?? (fallback ? [fallback] : [])) : []) {
|
||||
const el = h(
|
||||
"li",
|
||||
{ class: "new-task" },
|
||||
h("span", { class: "task-title" }, "New task in ", h("span", { class: "project-name" }, project.name), ": ", title),
|
||||
h("span", { class: "task-state", title: "Model for the first message" }, models[0]),
|
||||
);
|
||||
rows.push({ el, pick: () => void create(project.id, title) });
|
||||
}
|
||||
selected = Math.min(selected, Math.max(rows.length - 1, 0));
|
||||
|
||||
Reference in New Issue
Block a user