Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md

Large diffs are not rendered by default.

38 changes: 34 additions & 4 deletions docs/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,10 @@ is T3 Code's sidebar: one list of every chat, whatever project or folder it is f
chat started three folders down is never out of sight. The rules are pure, in
`web/src/chat/sidebar.ts` (`sidebarLists`, tested in `sidebar.test.ts`). Top to bottom:

- **New chat**, then the **scope button** ("All chats"). It narrows the list to Home or one
- **New chat**, then **Recent / By task**, which orders what is in play (below; kept per
device, `totem.chats.order`, By task unless he picks Recent). A count on By task is how many
tasks in the scope are due today or overdue.
- The **scope button** ("All chats"). It narrows the list to Home or one
project (with its folders) or folder, the way T3's project filter does, and is kept per
device (`totem.chats.scope`). It never moves the page: when scoped to a project, ↗ opens
that project's page and × goes back to every chat. A dot on it means a chat the scope hides
Expand All @@ -1449,6 +1452,22 @@ chat started three folders down is never out of sight. The rules are pure, in
- **Snoozed** and **Settled**, folded, at the bottom: one of each for the whole panel, not one
per project, left out while empty. Settled shows ten, then Show more.

**By task** (`web/src/tasksnav/`, the pure part in `lists.ts`, `playByTask`) keeps that
list but folds Working into it, and gathers the chats in play that work on one open task under
that task's row, the group placed where its latest chat would be. A chat with no task, or
whose task is done, stays a card of its own. Under the chats come the owner's **next tasks**
in the scope (a task's folder stands where a chat's project does), less those already
heading a group: Overdue, Today, Next 7 days, Later and No date, each a folding heading
(Later and No date start folded, kept per device as `totem.nav.folded`), then a folded
Snoozed tasks with Wake now on each. A task's row shows its check (done; for a sheet row, done for
him alone), title, folder and due day, a dot when one of its chats is answering or waiting
on him, and on hover Snooze (Tomorrow, For 3 days, For a week, or a time) and New chat. A
click on the row starts a chat for it in its folder (`tasksnav/pick.ts`): from a new chat's
page the words already typed go with it (`useChatDrafts.startForTask`); from an open chat it
starts a new one and leaves that chat's draft alone. The task picked for the chat being
written is highlighted, and stays in sight in a folded section. The tasks load while the
panel is up (`useWork` polls each minute). Snoozed and Settled stay at the bottom.

Each chat in the list, Pinned and Working is a **card**: its place (project icon and
"Project › Folder", or Home) and on the right what it is doing (Awaiting input, Awaiting
approval, Your turn, Working, Woke, Done for a finished reply he hasn't read, else how long
Expand Down Expand Up @@ -1799,8 +1818,9 @@ timer (`pauseToast`/`resumeToast` in `web/src/toast.ts`).
A chat can name the task it works on, and the chats panel shows it on the chat's card
(The chats panel), the way T3 Code shows a thread's pull request. Action items get worked
on in chats; this is where the two meet (`web/src/work/`). Until 1.1 the panel had a Tasks
face listing every open task with its chats; the Tasks page is now where tasks are listed,
added and sorted.
face listing every open task with its chats; now its By task order gathers chats under their
task and lists the next tasks under them (The chats panel), and the Tasks page is where tasks
are added, edited and sorted.

- **Folders.** A task is filed under a chat project or folder, or nowhere ("Personal"): the
same folders the Tasks page shows (`docs/tasks.md` → Folders). A local task carries its
Expand Down Expand Up @@ -1909,9 +1929,19 @@ project. Working is a section of cards at the end of the list; Snoozed and Settl
buttons (Settled and snoozed, above). Totems is a drawer row of its own under Overview, with a dot
for a report waiting, and the drawer's Tasks face is gone, as on the web. It is built for a thumb:

- **Recent / By task** sits at the top, as on the web (`features/chat/chatsOrder.ts`, the web's
key; By task by default; the rules are `mobile/src/lib/tasksnav/lists.ts`, the web's
`tasksnav/lists.ts` byte for byte, checked by `features/work/shared.test.mjs`). By task folds
Working into the list, puts a task's chats in play under its row as slim rows, and lists the
next tasks below (`features/chat/TaskRows.tsx`), with Later, No date and Snoozed tasks folded.
A task's row: its ring finishes it, a tap starts a new chat for it in its folder
(`newTaskChat`; the words in a new chat's composer are not carried over, as they are on the
web), swiped right it is done, swiped left it shows Snooze (Tomorrow, 3 days, a week) and Open
(its page), and a long-press has all four. Done and Snooze leave the drawer's Undo line.

- **No second list.** The tasks are the app's own task store (`features/todos/store.ts`), so the
Tasks page, a task's page and the drawer never disagree; the drawer reads them each time it
opens, only when a card names a task, never on a timer. Every call that finishes or reopens a
opens, never on a timer. Every call that finishes or reopens a
task (`lib/api.ts`, `toldTasks`) makes the chat store read the list again, so its chats settle
or come back at once.
- **A task opens its page**, the sheet the Tasks page opens (`todo/[id]`, a sheet row's too), in place
Expand Down
4 changes: 2 additions & 2 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ mirrored byte for byte to `mobile/src/lib/todos/`.
- **Select tasks** (the "…" menu) acts on many at once. Done's Undo reopens only the
tasks it finished that did not roll (never one already done before); the toast says how
many repeating tasks rolled to their next date.
- **Snooze** (`s`, or the hover button) offers `snoozeTimes` plus a picked time; Undo
wakes it. **Not doing** and **delete** (Delete/Backspace) offer Undo too.
- **Snooze** (`s`, or the hover button) offers `snoozeTimes` (Tomorrow, For 3 days, For a
week, each to 9:00 local, stepped by calendar day) plus a picked time; Undo wakes it. **Not doing** and **delete** (Delete/Backspace) offer Undo too.
- **The pane** opens the selected row on the right (Enter or a click) and follows the
keyboard cursor. Everything saves as it changes, with no Save button: title (Enter or
leaving the field), description, Due, Priority, Folder (the chats panel's folder picker,
Expand Down
4 changes: 4 additions & 0 deletions mobile/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ Use `npx expo install <pkg>` for dependencies so versions match the SDK.
linked task is done settles once read, as T3 settles a merged PR (`settle.ts` `taskDoneSince`, from the bridge's
`taskDoneAt`); every task status call in `lib/api.ts` goes through `toldTasks`, which makes the chat store read the
list again (`onTaskStatus` in `initChat`), so a new call that finishes or reopens a task goes through it too.
Recent / By task at the top (`features/chat/chatsOrder.ts`, By task by default) is the web's order:
`lib/tasksnav/lists.ts` is the web's `tasksnav/lists.ts` byte for byte (`features/work/shared.test.mjs`), and
`features/chat/TaskRows.tsx` draws a task's group and the next tasks (ring = Done, tap = new chat for it, swipe
right = Done, swipe left = Snooze and Open, long-press = all four; `snoozeTask` in `features/work/state.ts`).
- **Tasks and chats** (`src/features/work/`): the task store the Tasks page uses (`features/work/state.ts` derives the
WorkTasks, it keeps no copy; `lib/work/groups.ts` is the web's `work/groups.ts` byte for byte,
`features/work/shared.test.mjs`). A task opens its page (`todo/[id]`), whose Chats section is the web card's;
Expand Down
35 changes: 28 additions & 7 deletions mobile/src/features/chat/ChatsNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// swiped left it shows Snooze, Settle and "…" (the full menu), and long-press opens
// that menu too. A chat with unsent words wears an amber pencil.
//
// Recent / By task at the very top orders what is in play (chatsOrder.ts, By task
// by default): By task folds Working into the list, gathers chats on one open task
// under its row, and lists the next tasks under the chats (TaskRows.tsx; the rules
// are lib/tasksnav/lists.ts, the web's file byte for byte).
//
// The scope button at the top narrows the list to Home or one project and its folders,
// the way T3's project filter does (chatsScope.ts); ↗ opens that project's page, and a
// dot says when a chat the scope hides is waiting on him. Totems' own chats are not
Expand Down Expand Up @@ -52,6 +57,9 @@ import { drawerPan } from '../../shell/drawerGesture'
import TaskBadge from '../work/TaskBadge'
import { loadBoard, loadSheet } from '../todos/store'
import { setSidebarScope, useSidebarScope } from './chatsScope'
import { setChatsOrder, useChatsOrder } from './chatsOrder'
import { useDrawerTasks, TaskGroupRows, NextTasks, OrderSwitch } from './TaskRows'
import { dueNow, playByTask } from '../../lib/tasksnav/lists'

const muted80 = 'rgba(138, 145, 163, 0.8)'
// The web card's status colours (chat.css .sb-working, .sb-done, .sb-needs).
Expand Down Expand Up @@ -421,14 +429,23 @@ export default function ChatsNav({ onOpenChat, drafts, chatShowing = true }: {
useEffect(() => { setDock({ scope, snoozed: snoozed.length, settled: settled.length, showing: chatShowing }) }, [scope, snoozed.length, settled.length, chatShowing])
useEffect(() => () => setDock(null), [])

// The cards' tasks are read each time the drawer opens: it stays mounted, so a timer here would poll while it is closed.
// The tasks are read each time the drawer opens (By task lists them, and Recent's cards and
// switch name them): it stays mounted, so a timer here would poll while it is closed.
const status = useDrawerStatus()
const namesTask = useMemo(() => [...pinned, ...inbox, ...working].some((t) => !!t.taskId), [pinned, inbox, working])
useEffect(() => {
if (status !== 'open' || !namesTask) return
if (status !== 'open') return
void loadBoard()
void loadSheet()
}, [status, namesTask])
}, [status])

// By task: everything in play (Working too), latest first, gathered under the task each chat works on.
const order = useChatsOrder()
const byTask = order === 'task'
const d = useDrawerTasks(scope, now)
const due = dueNow(d.sections)
const play = useMemo(() => (byTask ? playByTask([...inbox, ...working].sort((a, b) => activeAt(b, now) - activeAt(a, now)), d.tasks) : []), [byTask, inbox, working, now, d.tasks])
const grouped = useMemo(() => new Set(play.flatMap((i) => (i.kind === 'task' ? [i.group.task.ref] : []))), [play])
const slim = (t: ChatThread) => <ThreadItem key={t.id} t={t} now={now} active={t.id === activeId} live={!!runs[t.id]} onOpen={onOpenChat} />

const card = (t: ChatThread) => {
const project = t.projectId ? projects.find((p) => p.id === t.projectId) || null : null
Expand All @@ -441,17 +458,21 @@ export default function ChatsNav({ onOpenChat, drafts, chatShowing = true }: {
const draftsProject = scope !== 'all' && scope !== 'home' ? scope : null
return (
<View style={{ paddingTop: 6 }}>
<OrderSwitch value={order} onChange={setChatsOrder} due={due} />
<ScopeBar value={scope} projects={projects} outside={outside} onOpenPage={() => onOpenChat(null)} />
{drafts?.(draftsProject, scope === 'home')}
{pinned.length ? <View accessibilityLabel="Pinned">{pinned.map(card)}</View> : null}
{pinned.length && inbox.length ? <View style={st.divider} /> : null}
{inbox.map(card)}
{pinned.length && (byTask ? play.length : inbox.length) ? <View style={st.divider} /> : null}
{byTask
? play.map((i) => (i.kind === 'task' ? <TaskGroupRows key={i.group.task.ref} group={i.group} d={d} chat={slim} /> : card(i.chat)))
: inbox.map(card)}
{loaded && nothing ? (
<T size={13.5} color={colors.muted} style={st.emptyNote}>
{snoozed.length || settled.length ? 'All settled. Nothing is waiting on you.' : scope === 'all' ? 'Your chats will show up here.' : 'Chats here will show up in this list.'}
</T>
) : null}
{working.length ? (
{byTask ? <NextTasks d={d} skip={grouped} /> : null}
{working.length && !byTask ? (
<View style={{ marginTop: 10 }}>
<View style={st.shelfHead}>
<Spark size={11} />
Expand Down
Loading
Loading