From e4ebc99416a52585910f5d5a0df86ff5ce9930be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Thu, 19 Nov 2026 07:07:40 +0000 Subject: [PATCH] Generated media, MCP servers, and what bites: bytes by Raw, jobs without a stream, a chat that is not told Co-Authored-By: Claude Fable 5.2 --- Design.md | 47 +++++++++++++++++++++++++++++++++++++++++++++-- Working-notes.md | 21 ++++++++++++++++++++- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/Design.md b/Design.md index 7d30742..54deb51 100644 --- a/Design.md +++ b/Design.md @@ -118,8 +118,12 @@ everything that leaves the instance for the phone. `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. +- **A new file is never written over one**: it is made with `create: true`, and where something + has that name the instance writes nothing and its own sentence is shown (409 `exists`, + `FileExists`). The page checks nothing itself. +- **Which bytes** is one type, `Raw` (`api/Media.kt`): a path, one version of a path, a node id, + or a chat's attachment; `ApiClient.raw` makes the request for any of them, and a download, a + cache copy and the player all take one. A version is saved to the phone that way. - **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 @@ -135,6 +139,45 @@ everything that leaves the instance for the phone. - **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. +## Generated media + +What a model made, in the reply (`ui/chat/MediaCards.kt`, `MediaJobs.kt`; the shapes in +`api/Media.kt`; the server's App-API, *Generated media*). + +- **A tool call's `media` is a card**, always in view like a `show` card: a picture drawn (from + the call's attachment where it has one, as before; else from the file by its node id), a video + or a track as its name with Play, a 3D model or a kind the app does not know as what it is. + Under each, four buttons of 48 dp: Open in Files (the Files page at the file's folder, the + route `files-at/{at}`), Download (the "Save to" page), Share and Open with -- the same ways + out the file manager has, through the chat's own `TransferViewModel`. +- **Play opens the player over the chat** (`PlayerDialog`): the platform's `MediaPlayer` through + `RemoteMedia`, asking `/files/raw?node=` for each piece. The file is asked for its first byte + before the player gets it, so one that is in the trash says so in a sentence. +- **Sound and video the person attached** are played from the message: `/attachments/{id}` + answers a file whole, so the player gets a copy in the private cache, deleted when it closes. +- **A `media_job` is a card** with what is made, its state, the time it has taken (counted on the + phone between two reads) and Cancel (`DELETE /media/jobs/{id}`). There is no stream frame for + a job. `ChatViewModel.watchMedia` runs while the chat's screen is in front + (`repeatOnLifecycle`): the chat's jobs once (`GET /media/jobs?chat_id=`), then the ones under + way every three seconds. A job that is `done` is drawn as its result's card. +- **A finished job wakes the chat** with a reply this app did not start. Nothing else tells an + open chat of such a reply (`/events` carries schedules and reports), so the job says it: when + a read shows `told` that the read before did not, the transcript is read again and the reply + being written there followed (`woke`, `rereadAndFollow`). +- **Only in a chat's own screen.** The cards are drawn where `LocalChatMedia` is provided, which + `ChatContent` does and the assistant's sheet does not: nothing of this is over the lock screen, + and nothing here posts a notification. + +## MCP servers + +Settings › MCP servers (`ui/settings/McpScreen.kt`) lists `GET /mcp`: each server's name, tools +and how it is signed in to. A server in `signed_out` or `needs_signin` with a `signin_url` has a +button that opens that page **in the browser** (a Custom Tab). The sign-in is the instance's own +web flow on its cookie door: a browser that is not signed in to the instance is sent to its +sign-in page first and then on to the server's. The app starts and finishes nothing, and its +token is in no address: `signInAddress` opens only a page of the instance the app is signed in +to. The list is read again when the page comes back to the front. + ## 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** diff --git a/Working-notes.md b/Working-notes.md index 653e3f0..f01f722 100644 --- a/Working-notes.md +++ b/Working-notes.md @@ -32,7 +32,9 @@ Read this before changing anything. Each rule has its reason, because a rule wit 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 + lock screen, and a transfer posts no notification. Generated media's cards and players are + drawn only where a chat's own screen provides `LocalChatMedia`; the assistant's sheet, which + may be over the lock screen, must never provide it. 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. @@ -209,3 +211,20 @@ design change, before a phone. (`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. +- **A file's bytes are named by `Raw`** (a path, a version of it, a node id, an attachment) and + asked for through `ApiClient.raw`. A generated file is asked for by its node id, which outlives + a rename. **An attachment is answered whole** (no `Range`): the player gets a cache copy + (`MediaBody`), never `RemoteMedia`. +- **There is no stream frame for a media job, and an open chat is not told of a reply it did not + start.** `watchMedia` polls while the screen is in front; a job's `told` turning true is what + makes the chat read itself again (`woke`). Anything else that wakes a chat (a subagent that + finished, a schedule) is seen only when the chat is opened again. +- **The model lists are narrowed where they are read** (`ApiClient.modelList`, `agentModelList`: + `capability` `chat` only). A picker fed from anywhere else narrows with `forChat()` itself. +- **`gen-strings.py --check` reads keys as `[a-z_]+`**: a key with a digit (`media_model3d`) is + "used but not in strings.py" under its first letters. No digits in a string's key. +- **Only a page of the instance is opened for a sign-in** (`signInAddress`): the address the + list names is taken as it is on the instance's own origin, and as its path on the instance + otherwise. Nothing with the app's token in it is ever handed to a browser. +- **A new file is made with `create: true`**; the page does not check its listing for the name + (the listing may be old, and the sentence is the instance's).