Pin the server contract, tokens and strings to server dev a25db24; app API 2
The contract moves from f5b3dbb to the server's dev at a25db24971a0: version.json says
{"app_api": 2}, and the server now writes its own show cards (tool_show.json: one from the tree,
one from a device) and the files routes (files_listing.json, file_content.json,
file_content_withheld.json). Tokens from the same commit change only in the header; the strings
regenerate unchanged.
- APP_API is 2, and it is now the floor as well as the ceiling: a protocol-3 server that still
says app API 1 is a 2.0 build from before the show route and the files, and is refused as too
old, as 1.x is.
- The files routes are modelled (FileEntry, FileListing, FileContent, Withheld) and ApiClient
reads them: files(path), fileContent(path), and webFile(path) for the web UI's /files/view.
- shownText is documented against the server's real route, GET /api/v2/chats/{chat}/show with
?node=&version= or ?shown=, plain text up to 1 MB, 413 / 415 / 404; ClientTest pins the paths.
- The hand-written show cards leave ShowAndServerTest; ContractTest reads the server's.
Nothing in the app reads /api/v2/devices for its own token (devices() has no caller), so apps no
longer being listed there changes nothing here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
15 files changed
+302
-57
No files matched your search
@@ -233,6 +233,50 @@ data class ShowCard(
|
||||
}
|
||||
}
|
||||
|
||||
// --- The person's files (`GET /files`, `GET /files/content`) ----------------------------------
|
||||
|
||||
/** One entry of a directory: `kind` is `file`, `dir` or `mount`. */
|
||||
@Serializable
|
||||
data class FileEntry(
|
||||
val name: String = "",
|
||||
val path: String = "",
|
||||
val kind: String = "file",
|
||||
val size: Long = 0,
|
||||
val mime: String = "",
|
||||
@SerialName("updated_at") val updatedAt: String? = null,
|
||||
) {
|
||||
/** A directory or a mount: something to open as a listing, not in the viewer. */
|
||||
val isFolder: Boolean get() = kind == "dir" || kind == "mount"
|
||||
}
|
||||
|
||||
/** A directory, through the person's own access. `parent` is null at `/`. */
|
||||
@Serializable
|
||||
data class FileListing(val path: String = "/", val parent: String? = null, val entries: List<FileEntry> = emptyList())
|
||||
|
||||
/** Why a file's text did not come: `reason` is `not_text` or `too_large`; `message` says it. */
|
||||
@Serializable
|
||||
data class Withheld(val reason: String = "", val message: String = "")
|
||||
|
||||
/**
|
||||
* A file's text, as the explorer's viewer reads it. An HTML file is its source, never rendered;
|
||||
* a file that is not text or is over 1 MB has an empty [text] and says why in [withheld].
|
||||
*/
|
||||
@Serializable
|
||||
data class FileContent(
|
||||
val path: String = "",
|
||||
val name: String = "",
|
||||
val size: Long = 0,
|
||||
val mime: String = "",
|
||||
val kind: String = "text",
|
||||
val language: String = "",
|
||||
val sha: String = "",
|
||||
val text: String = "",
|
||||
val withheld: Withheld? = null,
|
||||
) {
|
||||
/** The kind the viewer draws, by the `show` card's rule: anything unknown is plain text. */
|
||||
val viewKind: String get() = if (kind in ShowCard.VIEW_KINDS) kind else "text"
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class SteerNote(val id: String = "", val text: String = "")
|
||||
|
||||
|
||||
Reference in new issue
Block a user