fix(context): compute-host /context and session.context_breakdown carry the per-file manifest; report blocked files

Why: the tui_gateway live formatter (`_format_live_context_output`, used when
the session runs on a compute host) renders its own summary and never got the
"Context files" block, and `session.context_breakdown` had no structured rows,
so Desktop's popover could not show them. The formatter now appends
render_context_file_lines() with the session cwd bound (the RPC thread has no
session context, so the discovery walk would key on the backend's cwd), and
the RPC payload gains a `context_files` list (contract + generated TS/OpenRPC
+ Desktop type). The docs sentence is scoped to the surfaces that render it.

A file whose content _scan_context_content replaces with a BLOCKED marker was
reported "loaded"; the manifest now runs the same scan and reports `blocked`.
The module docstring names the frontmatter-strip / chain-cap approximations
and drops the product-name attribution (credit stays in the PR body).
This commit is contained in:
teknium1
2026-09-14 21:18:33 -07:00
committed by Teknium
parent f271ba09b0
commit e860b8e4e4
9 changed files with 122 additions and 12 deletions
+11 -1
View File
@@ -2798,7 +2798,7 @@ export interface SessionContextBreakdownParams {
session_id: string
profile?: string | null
}
/** ``agent.context_breakdown.compute_session_context_breakdown`` (empty categories before the agent builds). */
/** ``agent.context_breakdown.compute_session_context_breakdown`` (empty categories before the agent builds) plus the per-file context manifest (empty until the agent exists). */
export interface SessionContextBreakdownResult {
categories: ContextCategory[]
context_max: number
@@ -2808,6 +2808,7 @@ export interface SessionContextBreakdownResult {
context_estimated: boolean
context_source: string
model: string
context_files?: ContextFileSource[]
}
export interface ContextCategory {
color: string
@@ -2815,6 +2816,15 @@ export interface ContextCategory {
label: string
tokens: number
}
/** One row of ``agent.context_file_sources.list_context_file_sources``. */
export interface ContextFileSource {
label: string
path: string
chars: number
est_tokens: number
loaded: boolean
status: string
}
export interface SessionCompressParams {
session_id: string
profile?: string | null
+49 -1
View File
@@ -9039,6 +9039,46 @@
"title": "ContextCategory",
"type": "object"
},
"ContextFileSource": {
"additionalProperties": false,
"description": "One row of ``agent.context_file_sources.list_context_file_sources``.",
"properties": {
"label": {
"title": "Label",
"type": "string"
},
"path": {
"title": "Path",
"type": "string"
},
"chars": {
"title": "Chars",
"type": "integer"
},
"est_tokens": {
"title": "Est Tokens",
"type": "integer"
},
"loaded": {
"title": "Loaded",
"type": "boolean"
},
"status": {
"title": "Status",
"type": "string"
}
},
"required": [
"label",
"path",
"chars",
"est_tokens",
"loaded",
"status"
],
"title": "ContextFileSource",
"type": "object"
},
"ControllerScope": {
"additionalProperties": false,
"properties": {
@@ -24445,7 +24485,7 @@
},
"SessionContextBreakdownResult": {
"additionalProperties": false,
"description": "``agent.context_breakdown.compute_session_context_breakdown`` (empty categories before the agent builds).",
"description": "``agent.context_breakdown.compute_session_context_breakdown`` (empty categories before the agent builds)\nplus the per-file context manifest (empty until the agent exists).",
"properties": {
"categories": {
"items": {
@@ -24481,6 +24521,14 @@
"model": {
"title": "Model",
"type": "string"
},
"context_files": {
"default": [],
"items": {
"$ref": "#/components/schemas/ContextFileSource"
},
"title": "Context Files",
"type": "array"
}
},
"required": [