diff --git a/Design.md b/Design.md index f14fc2e..c978e96 100644 --- a/Design.md +++ b/Design.md @@ -50,7 +50,8 @@ Shaped like the AI apps people already know, in LLeMbas's own theme: ## Looking at the screens Every screen is drawn from its state alone (`ChatContent`, `DrawerContent`, `SettingsContent`, -`ScheduledContent`, `ScheduleContent`, `ScheduleEditContent`, and the sheets' contents), with its +`ScheduledContent`, `ScheduleContent`, `ScheduleEditContent`, `RunContent`, +`SchedulingModelsContent`, and the sheets' contents), with its actions behind an interface whose methods do nothing by default. The screenshot tests (`app/src/test/.../shots/`) render each with made-up data (`Fakes.kt`, the server's contract files where they fit) on the JVM -- Robolectric draws, Roborazzi writes the PNG -- in Shire and @@ -64,17 +65,33 @@ as the sheet itself. ## Scheduled -The phone's half of the server's scheduled tasks: the list (rule in words, the last run's -status, the next run, a pause switch), a task's page (Run now, Pause, the next five runs, the -history with each run's model -- and when another model stood in -- and Open for its result), -and create or edit **in words**: the instance reads them and answers with a title, the rule in -words, the instruction and the next five runs, which are shown before anything is saved. +The phone's half of the server's scheduled tasks, on its `/api/v2/schedules` routes +(`api/Schedules.kt` holds the shapes, `ScheduleContractTest` reads every contract file): -A push with `kind` `schedule` or `schedule_failed` goes to the **Scheduled results** or -**Scheduled failures** channel: private on the lock screen, where its public version says only -that a task finished or failed; Open goes to the run's chat (or the task), Pause pauses it from -the notification. A server without the routes answers 404, and the page says scheduling needs a -newer server. +- **The list** (`GET /schedules`): the rule in words (`description`), the last run's status or + Running, the next run, a pause switch (`POST …/pause`, `…/resume`). While it is on screen the + app follows `GET /events`, whose `schedules` frame is the whole list whenever it changes. +- **A task's page**: Run now (`POST …/run`, 202 with the run; the next scheduled run is not + used up), Pause, the next five runs, and the history (`GET …/runs?before=&limit=`): status, + when, the model and the one it stood in for (`model.switched_from`), the first lines of the + result (`preview`, plain text), the error or what it waits for and when it retries. +- **A run** (`GET …/runs/{run}`): its facts and the result in full -- Markdown a model wrote, + through Markwon's untrusted rules -- and Open its chat. +- **Create or edit in words**: `POST /schedules/compile` answers a title, the instruction, the + rule, the rule in words and the next runs (or `ok: false` and a reason); nothing is saved + until Save sends them (`POST /schedules` with the words as `request`, or `PATCH`). An empty + rule cannot be saved. Editing starts from the task's `request`. +- **Models for scheduled tasks** (`GET`/`PUT /schedules/models`): the order they are tried, + which are free, and a tick per model; all ticked is sent as no narrowing, and the last one + cannot be unticked. + +A push with `kind` `schedule` or `schedule_failed` carries ids, the run's status, `visibility` +`private`, `actions` and `ask` -- never the result (server `services/schedule/notify.py`). +`ScheduledNotice` reads it; it goes to the **Scheduled results** or **Scheduled failures** +channel, `VISIBILITY_PRIVATE` with a public version that says only that a task finished or +failed. A tap and Open go to the run (on the instance the push came from); Pause is there when +the payload offers it (a failure; `ask: pause` after three in a row). A server without the +routes answers 404, and the page says scheduling needs a newer server. ## Signing in