feat: context usage ring and tool image previews

- the composer shows a context ring and percentage from the last
  token-bearing assistant message, toned at 75% and 90%; tapping opens a
  sheet with the model, used tokens, limits, output reserve and turn cost
- images a tool call names (read attachments as data URLs, input paths,
  and image paths in output text) get a link under the tool row; tapping
  previews it from the data URL or /api/fs/raw, allowing paths outside
  the workspace
- directory-scoped requests now send x-opencode-directory-encoding: uri,
  which scoped routes such as /api/fs/raw need to decode the header
- ocprobe gains a raw file command for checking previews

Bump version to 0.2.2 (build 16).
This commit is contained in:
blumia committed 2026-11-18 02:15:11 +08:00
1 parent dc3730eba7
commit 2fb4a8ea79
16 files changed
+884 -26

No files matched your search

+15
View File
@@ -94,6 +94,20 @@ func main() {
printJSON(page)
fmt.Fprintf(os.Stderr, "%d messages, next=%q\n", len(page.Data), page.Cursor.Next)
case "raw":
if flag.NArg() < 2 {
fail(fmt.Errorf("raw needs an absolute file path, and optionally a directory"))
}
dir := ""
if flag.NArg() > 2 {
dir = flag.Arg(2)
}
data, mime, err := client.RawFile(ctx, flag.Arg(1), dir)
if err != nil {
fail(err)
}
fmt.Fprintf(os.Stderr, "%d bytes, %s\n", len(data), mime)
case "prompt":
if flag.NArg() < 3 {
fail(fmt.Errorf("prompt needs a session id and text"))
@@ -193,6 +207,7 @@ commands:
status probe /auth/session
sessions list sessions (newest first)
messages <session-id> latest messages of a session
raw <path> [directory] fetch a file the server can read
prompt <session-id> <text> send a message
interrupt <session-id> stop the running turn
events watch the event stream