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:
1 parent
dc3730eba7
commit
2fb4a8ea79
16 files changed
+884
-26
No files matched your search
+17
-11
@@ -61,6 +61,7 @@ type ModelRef struct {
|
||||
|
||||
// TokenUsage is a session's or message's token counters.
|
||||
type TokenUsage struct {
|
||||
Total int64 `json:"total,omitempty"`
|
||||
Input int64 `json:"input"`
|
||||
Output int64 `json:"output"`
|
||||
Reasoning int64 `json:"reasoning"`
|
||||
@@ -146,12 +147,16 @@ type MessageTime struct {
|
||||
|
||||
// ContentPart is a block of an assistant message.
|
||||
type ContentPart struct {
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
State *ToolState `json:"state,omitempty"`
|
||||
Time *PartTime `json:"time,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
State *ToolState `json:"state,omitempty"`
|
||||
Time *PartTime `json:"time,omitempty"`
|
||||
MIME string `json:"mime,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
URI string `json:"uri,omitempty"`
|
||||
Filename string `json:"filename,omitempty"`
|
||||
}
|
||||
|
||||
// PartTime is when a reasoning/text block was written.
|
||||
@@ -162,11 +167,12 @@ type PartTime struct {
|
||||
|
||||
// ToolState is a tool call's state machine.
|
||||
type ToolState struct {
|
||||
Status string `json:"status"`
|
||||
Input map[string]any `json:"input,omitempty"`
|
||||
Content []ContentPart `json:"content,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Error json.RawMessage `json:"error,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Input map[string]any `json:"input,omitempty"`
|
||||
Content []ContentPart `json:"content,omitempty"`
|
||||
Attachments []ContentPart `json:"attachments,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Error json.RawMessage `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// PromptFile is a file riding with a prompt: a data URL or a URI the
|
||||
|
||||
Reference in new issue
Block a user