diff --git a/.design-sync/NOTES.md b/.design-sync/NOTES.md index 263d18af..01ead25f 100644 --- a/.design-sync/NOTES.md +++ b/.design-sync/NOTES.md @@ -50,6 +50,11 @@ Tailwind and TypeScript). Nothing there reimplements a component. provider's `useState` initializer, before the store connects: the fake answers the store's first `browser.list` synchronously, so an answer taken before the browsers opened arrives after their `browser.changed` and wins (the panel then says "Browser closed" over the page). +- Routines: `BotloftProvider` `routines` go into `FakeRoutines` in the initializer too (same + first-answer race as the browsers) and as `routine.changed` after. `pkg/routines.ts` builds + them; with no `nextInMinutes` the next run follows the schedule (local time; cron is not worked + out, an hour from now), so the row's "Next" agrees with its schedule. `pkg/ids.ts` holds the + shared id and time helpers. - Type emission covers the whole package with the repo as root; `.design-sync` is renamed to `ds` in `dist/types/emit` (ts-morph skips dot folders), and `paths` points bare imports at `app/node_modules` (`@types` first, or React resolves to its JS). `vite/client.d.ts` is added @@ -76,7 +81,7 @@ Tailwind and TypeScript). Nothing there reimplements a component. - The icon set follows the app's imports: an icon the app stops using disappears from `icons`. - Bot colors in previews and conventions are sample values, not tokens. - Scope (owner's choices on 2026-10-02): the base pieces, the bot badges, and the app screens the - explainer video needs (sidebar, crew cards, a bot's turn, messages, requests, the live browser). - Not in it yet: the whole crew view, the composer, the screens panel, routines, settings. + explainer video needs (sidebar, crew cards, a bot's turn, messages, requests, the live browser, routines). + Not in it yet: the whole crew view, the composer, the screens panel, settings. - `scene.ts` mirrors protocol shapes and daemon summaries by hand; a protocol change (`protocol.gen.ts`) or a new request kind needs it updated, or the tsc step fails. diff --git a/.design-sync/config.json b/.design-sync/config.json index dc6c9279..94c510f5 100644 --- a/.design-sync/config.json +++ b/.design-sync/config.json @@ -22,13 +22,14 @@ "BotStateBadge": "/** The bot: its state and whether the owner paused it. */ bot: { state: \"offline\" | \"launching\" | \"idle\" | \"busy\" | \"needs_approval\" | \"rate_limited\" | \"auth_error\" | \"backoff\" | \"archived\"; paused: boolean }; /** A paused crew shows its stopped bots as paused. */ crewPaused?: boolean; compact?: boolean;", "ChiefBadge": "/** The crew this bot leads; only its name is read, for the tooltip. */ crew: { name: string }; /** Just the crown, for tight rows. */ compact?: boolean;", "Menu": "/** Accessible name of the button that opens the menu. */ label: string; /** An icon from window.Botloft.icons, e.g. icons.Ellipsis. */ icon: React.ComponentType<{ size?: number; strokeWidth?: number }>; items: { label: string; icon?: React.ComponentType<{ size?: number; strokeWidth?: number }>; danger?: boolean; disabled?: boolean; /** Makes the item one of a set of choices, marked when chosen. */ checked?: boolean; onSelect: () => void }[];", - "ApprovalCard": "/** A request: Botloft.chat.askCommand / askSite / suggestBot / askPlan(...).body. The card follows its toolName (command, website, suggested bot, plan) and its status (pending, allowed, denied, expired). Needs BotloftProvider around it. */ approval: any; /** A bot from Botloft.makeBot(...). */ bot: any;", + "ApprovalCard": "/** A request: Botloft.chat.askCommand / askSite / suggestBot / askPlan / askRoutine(...).body. The card follows its toolName (command, website, suggested bot, plan, routine) and its status (pending, allowed, denied, expired). Needs BotloftProvider around it. */ approval: any; /** A bot from Botloft.makeBot(...). */ bot: any;", "BotRun": "/** One turn of the bot, in order: items from Botloft.chat.reply / tool / askCommand / askSite / suggestBot / askPlan / turn(bot, ...). Needs BotloftProvider around it. */ items: any[]; /** A bot from Botloft.makeBot(...). */ bot: any; /** The turn in progress: the reply being written (draft) or the working dots (working). Only a live run moves the avatar. */ live?: { draft: string; working: boolean };", "InboundRow": "/** A message from Botloft.makeMessage({ from, to, body }). From \"owner\" it is your bubble on the right; from a bot or \"system\" it sits on the left with the sender's avatar. The sender must be among BotloftProvider bots. */ message: any; /** The bot whose chat this is: the message's recipient. */ /** A bot from Botloft.makeBot(...). */ bot: any;", "CrewBots": "/** A crew from Botloft.makeCrew(...). */ crew: any; /** Its bots, from Botloft.makeBot({ crew, ... }); the Chief (chief: true) gets the crown. Pass the same ones to BotloftProvider. */ bots: any[]; onNewBot: () => void;", "Sidebar": "/** No props: it lists the crews and bots given to BotloftProvider, with each bot's state and last activity, and the account at the bottom. Put it as the direct first child of the app window's flex row (fixed height); wrapped in anything else it shrinks to its content. */ className?: never;", - "BotloftProvider": "/** Crews from Botloft.makeCrew(...). */ crews?: any[]; /** Bots from Botloft.makeBot(...). A new array updates them, e.g. to change a state over time. */ bots?: any[]; /** Open browsers for BrowserPanel: [{ bot, url, title, tabs?: [{ url, title }], action?: { kind: \"open\" | \"click\" | \"type\" | \"scroll\" | \"back\", x?, y?, label? } }]. A new action object moves the bot's cursor on the page again. */ browsers?: any[]; /** The bot whose chat is open: highlighted in the sidebar. */ selectedBotId?: string; /** Called when Allow or Deny is clicked on a request card. */ onAnswer?: (answer: { approvalId: string; allow: boolean; note?: string }) => void; children: React.ReactNode;", - "BrowserPanel": "/** The bot whose browser this is; its page comes from BotloftProvider browsers (it shows \"closed\" without one). Place it as the last child of the app window's flex row, right of the chat column: it is a side panel the owner can widen. */ bot: any; /** Counts up each time the owner asks to take the browser into their own hands. */ take?: number; onClose: () => void;" + "BotloftProvider": "/** Crews from Botloft.makeCrew(...). */ crews?: any[]; /** Bots from Botloft.makeBot(...). A new array updates them, e.g. to change a state over time. */ bots?: any[]; /** Open browsers for BrowserPanel: [{ bot, url, title, tabs?: [{ url, title }], action?: { kind: \"open\" | \"click\" | \"type\" | \"scroll\" | \"back\", x?, y?, label? } }]. A new action object moves the bot's cursor on the page again. */ browsers?: any[]; /** Routines from Botloft.makeRoutine(...), for CrewRoutines. A new array updates them, e.g. to show a run starting. */ routines?: any[]; /** The bot whose chat is open: highlighted in the sidebar. */ selectedBotId?: string; /** Called when Allow or Deny is clicked on a request card. */ onAnswer?: (answer: { approvalId: string; allow: boolean; note?: string }) => void; children: React.ReactNode;", + "BrowserPanel": "/** The bot whose browser this is; its page comes from BotloftProvider browsers (it shows \"closed\" without one). Place it as the last child of the app window's flex row, right of the chat column: it is a side panel the owner can widen. */ bot: any; /** Counts up each time the owner asks to take the browser into their own hands. */ take?: number; onClose: () => void;", + "CrewRoutines": "/** A crew from Botloft.makeCrew(...): it lists every routine of the crew's bots that BotloftProvider was given (routines from Botloft.makeRoutine), each with its bot, its schedule in words, when it runs next and how its last run went. */ crew: any;" }, "overrides": { "Dialog": { @@ -72,6 +73,9 @@ "BrowserPanel": { "cardMode": "single", "viewport": "1440x620" + }, + "CrewRoutines": { + "cardMode": "column" } }, "readmeHeader": ".design-sync/conventions.md" diff --git a/.design-sync/conventions.md b/.design-sync/conventions.md index 72e2cf20..2a9c0b65 100644 --- a/.design-sync/conventions.md +++ b/.design-sync/conventions.md @@ -61,6 +61,13 @@ const scout = makeBot({ crew, name: "Scout", state: "busy", role: "Finds sources `chat.askCommand(bot, command, { explanation })`, `chat.suggestBot(chief, { name, role, model, instructions, reason })`, `chat.askPlan(bot, markdown)`, `chat.turn(bot, seconds)`. Each takes `{ status: "allowed" | "denied" }` to show it answered. `ApprovalCard` takes one of them's `.body`. + `chat.askRoutine(bot, { name, prompt, schedule, bot: "writer" })` is a bot asking to set up a + routine (for itself, or for another bot by handle). +- Routines, for `CrewRoutines` (pass them as `BotloftProvider` `routines`): `makeRoutine({ bot, + name, prompt, schedule: schedule.weekly([5], "09:00") | schedule.weekdays("08:30") | + schedule.every(120), lastRun: { status: "done" | "failed" | "queued" | "skipped" } })`. Days are + 1 = Monday ... 7 = Sunday. The next run follows the schedule. `status: "queued"` reads "Running + now": a new `routines` array with it shows a routine starting. - `makeMessage({ from: bot | "owner" | "system", to: bot, body, kind: "note" | "task" })` for `InboundRow`: yours on the right, a bot's or Botloft's on the left. @@ -76,8 +83,10 @@ const scout = makeBot({ crew, name: "Scout", state: "busy", role: "Finds sources `Choices` (2-6 options side by side), `Switch`, `Tabs`, `Menu`, `Details`, `SidePanel`. - App screens: `Sidebar` (crews and bots, 288px wide), `CrewBots` (a crew's bot cards), `BotRun` (one turn of a bot in its chat, inside a `