Files as a file manager, the viewers by kind, and model_ref

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
HomerandClaude Fable 5.2 committed 2026-11-18 21:25:07 +00:00
1 parent 3119569aad
commit 65bfa5cfbf
2 files changed
+56 -2

No files matched your search

+34 -1
@@ -9,7 +9,7 @@ One module, Kotlin and Jetpack Compose, Material 3 coloured by the server's toke
|---|---|
| `api/` | `Models.kt` (the server's shapes), `ApiClient` (every call, with the token), `StreamClient` (the reply, reconnecting), `LiveReply` (applying frames) |
| `auth/` | `InstanceStore` (instances, the active one, preferences; DataStore) and `TokenCipher` (Keystore) |
| `ui/` | `signin`; `home` (the drawer and its list); `chat` (the chat page, transcript, composer, tune sheet, model picker, cards, activity panel); `scheduled`; `files`; `settings`; `theme`; `Markdown.kt` and `MarkdownSplit.kt` |
| `ui/` | `signin`; `home` (the drawer and its list); `chat` (the chat page, transcript, composer, tune sheet, model picker, cards, activity panel); `scheduled`; `files` (the file manager); `viewer` (a `show` card's file, and a file of the tree by its kind); `settings`; `theme`; `Markdown.kt` and `MarkdownSplit.kt` |
| `push/` | UnifiedPush service, notifications, the approval buttons' receiver |
| `assist/` | the voice-interaction service, its session, the recognition service, `AssistController` and its sheet, the tile, voice in and out |
| `share/` | the share target |
@@ -102,6 +102,39 @@ failed. A tap and Open go to the run (on the instance the push came from); Pause
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.
## Files
The person's tree as a file manager (`ui/files/`), through the server's `/api/v2/files` routes
and nothing else. `FilesScreen.kt` is the page and its `FilesViewModel` (the listing, what is
chosen, one write at a time, uploads); `FileDialogs.kt` the smaller pages (a name, a yes or no,
the folder picker, the trash, a file's versions); `Transfers.kt` and `TransferViewModel.kt`
everything that leaves the instance for the phone.
- **A tap opens, a long press chooses.** While anything is chosen a tap chooses too, the top bar
counts, and the bottom bar acts on all of it through `POST /files/batch` -- which answers path
by path: what it refused is shown in its own sentences (`outcome`), and the directory is read
again either way. Each row's menu has the same actions for that one thing.
- **No path is typed.** Move and copy (and the share sheet's "Save to Files") walk to a folder in
`FolderPicker`; what is being moved is left out of its list.
- **An upload is one request a file**, streamed from its content address (`StreamBody`): a 413
names the file and does not take the others with it.
- **A new file is never written over one**: the route would (`PUT /files/content` with no
`base`), so the page checks the listing it holds first.
- **Leaving the instance.** Download writes into a document the person chose with the system's
"Save to" page (`CreateFile`, the Storage Access Framework); several things, or a folder, are
the server's zip. Open with and Share hand another app a copy in the private cache through the
FileProvider (`cache/shared/`, read-only, per grant). The copies go when the screen is left,
when the app starts and at sign-out (`FileCache`). There is no storage permission.
- **The viewer goes by `file_kind`** (`ui/viewer/TreeViewer.kt`, `FileKinds.viewer`): text kinds
as text and editable (a save says the `sha` it opened; a 409 offers Reload and Save anyway);
a picture decoded with capped edge and pixel count (`sampleFor`); a PDF by the platform's
`PdfRenderer` from a cache copy; sound and video by the platform's `MediaPlayer` through
`RemoteMedia`, a `MediaDataSource` that asks the app's own HTTP client for each piece
(`RangeReader`); a table as a grid of fixed columns; a notebook as its cells' text; the rest
as its details. An SVG and an HTML page are their source.
- **Nothing is announced.** A transfer shows its progress in the app and a short word when it is
done; there is no notification, so nothing names a file on the lock screen.
## Reports and "notify when" (harness spec 3.8.0)
From LLeMbas 2.0.0-beta.12 a schedule's run does not answer into a chat: it files a **report**
+22 -1
@@ -16,7 +16,8 @@ Read this before changing anything. Each rule has its reason, because a rule wit
4. **Model output is untrusted.** Markdown is rendered by Markwon with no image loading and no
HTML plugin, and a link opens outside the app, in the browser, for http, https and mailto only
(`ui/Markdown.kt`). The server's rule, kept on the phone. The file viewer (`ui/viewer/`)
keeps the same rule for a `show` card's file, and **never renders HTML**: there is no WebView
keeps the same rule for a `show` card's file and for a file of the person's tree (which a
model may have written), and **never renders HTML**: there is no WebView
in the app, so a page a model wrote is shown as its source, and "Open in the browser" hands
it to the web UI's sealed frame. A picture the instance generated (`image_generate`'s
`image {id, width, height}`) is drawn by `ui/chat/GeneratedPicture.kt` alone: fetched by
@@ -30,6 +31,9 @@ Read this before changing anything. Each rule has its reason, because a rule wit
sentence (a scheduled task's names nothing of the task; the server's `public` is not used).
An action that acts on the account from a notification (Allow once, Deny, Run again) needs
the phone unlocked.
The file manager and its viewers are pages of the main activity, which never shows over the
lock screen, and a transfer posts no notification. The copies of files the phone holds for
a viewer or another app are in the private cache and are cleared at sign-out.
6. **The token is sealed** with an AES key in the Android Keystore (`auth/Instances.kt`) and the
app's data is excluded from backups: a copy would be ciphertext nobody can open.
7. **No colour outside the theme.** `ui/theme/Tokens.kt` is generated from the server's
@@ -186,5 +190,22 @@ design change, before a phone.
to the server, and a Chat schedule left alone is sent nothing.
- **The composer's `@` reads the word the text ends with** (`ui/chat/Mentions.kt`), not the
cursor: the field is a plain string shared with dictation.
- **A chat's, a reply's and a schedule's model is looked up by `model_ref` where there is one**
(`serving`, `ChatState.modelInfo`, `replyModel`, `saidWithConnection`), and by it alone: a ref
the list does not have is no model, never "the first with that id". Anything new that shows
such a model goes through these, not through `named(id)`.
- **A file's bytes are asked for with the token in the Authorization header, never in an
address.** The platform's player reads through `RemoteMedia` (a `MediaDataSource` over
`ApiClient.rawBytes`); do not hand `MediaPlayer`, an intent or another app a URL of the
instance. Another app gets a copy from the private cache through the FileProvider.
- **Nothing a file holds is rendered or run.** The tree's viewer (`TreeViewer.kt`) draws text,
pixels the app decoded with a size cap, and the platform's own PDF pages. An SVG and an HTML
page are their source; a notebook's HTML and picture outputs are dropped (`parseNotebook`).
- **The text being edited lives in `EditViewModel`**, not in `rememberSaveable`: a megabyte does
not fit what Android saves of a screen, and unsaved words must survive a turn of the phone.
- **Two hosts of one `TransferViewModel` would each open the other app**: the Files page and the
viewer each have their own (`viewModel(key = "viewer-transfers")`).
- **A re-pin's new fixture fields break tests that copy a fixture and change one field**
(`schedule.copy(model = …)` kept the fixture's `model_ref`): change both, or neither.
- **A model's `interactive_only` is parsed and not drawn**: the web's own model pickers do not
mark it either. Schedules take their models from `/schedules/models`, which never lists one.