Merge lane-app2: keep the lane's reviewed work
This commit is contained in:
@@ -5783,3 +5783,81 @@ Not verified in this pass: the search field, the directory sections and the
|
|||||||
empty state on a device, and the narrow/wide layouts — the brief keeps
|
empty state on a device, and the narrow/wide layouts — the brief keeps
|
||||||
implementation verification to the build and the unit tests, and visual review
|
implementation verification to the build and the unit tests, and visual review
|
||||||
owns the operator's Pixel 9 Pro XL.
|
owns the operator's Pixel 9 Pro XL.
|
||||||
|
|
||||||
|
## The conversation header names the session's model (17 Oct 2026)
|
||||||
|
|
||||||
|
A chat session's model was only visible in the session list row; inside a
|
||||||
|
conversation there was nothing saying what was answering. The conversation header
|
||||||
|
now shows the session's model beside its `Operator` tag and its directory, read
|
||||||
|
from the session the server already reports. `android/` only; no dependency was
|
||||||
|
added beyond the already-declared material-icons-extended, nothing in the
|
||||||
|
Pipelines server, its Go source, the installer or the Docker files was touched,
|
||||||
|
and no run is started from the app.
|
||||||
|
|
||||||
|
- **One derivation, server-reported only.** `ui/chat/ChatFormat.kt` adds
|
||||||
|
`chatHeaderMeta(thread)`: the model id, the session's kind tag (through the
|
||||||
|
shared `sessionTagLabel`, refactored to a tag-value overload so the list row
|
||||||
|
and the header cannot label a tag differently) and the directory, joined with
|
||||||
|
` · `. Every part is a value the server reported; a blank part is omitted, so a
|
||||||
|
session the server reported without a model (or an older server that omits the
|
||||||
|
field) shows no model claim at all — never a guess and never a catalogue.
|
||||||
|
- **The open thread carries what the server reports.** `ChatThread` gains the
|
||||||
|
`tag` field (it already mirrored title/directory/model/agent/busy), and
|
||||||
|
`ChatStore` now folds the server's `model`/`agent`/`tag` into an already-open
|
||||||
|
thread on `sessionsLoaded` (not only on first `open`), and seeds them in the
|
||||||
|
`ensureThread` placeholder. So the header never shows a stale or missing model
|
||||||
|
after a list refresh or for a background chat.
|
||||||
|
- **The header surface.** `ChatScreen.ChatConversationPane`'s top bar title
|
||||||
|
becomes a two-line `Column`: the existing title, then the meta line in the
|
||||||
|
shared `pipelinesText().meta` role with `onSurfaceVariant`, ellipsised — no new
|
||||||
|
geometry literal.
|
||||||
|
|
||||||
|
**No model chooser is shipped, and why.** The brief asks to let the operator
|
||||||
|
choose a session's model and report the exact server change if the server has no
|
||||||
|
request for it. It does not: `ChatPromptRequest` carries `model`/`agent` on the
|
||||||
|
wire (`internal/protocol/chat.go`), but the endpoint drops them —
|
||||||
|
`handleChatPrompt` calls `broker.Prompt(ctx, sessionID, prompt.Text)` and
|
||||||
|
`opencode.Chat.Prompt` posts only `{"text": ...}` — and there is no request that
|
||||||
|
sets a session's model, nor any request that lists the endpoint's models or
|
||||||
|
agents to offer a choice from. Shipping a picker would be a control that does
|
||||||
|
nothing, so the create flow instead says so plainly ("This server has no request
|
||||||
|
for choosing a chat's model, so a new chat uses the server's default.") and the
|
||||||
|
header shows the model the server does report once the session exists.
|
||||||
|
|
||||||
|
The exact server change it would need: (1) forward the chosen model/agent —
|
||||||
|
extend `chatBroker.Prompt` and `opencode.Chat.Prompt` to accept them and include
|
||||||
|
`model`/`agent` in the `POST /api/session/{id}/prompt` body, and pass
|
||||||
|
`prompt.Model`/`prompt.Agent` from `handleChatPrompt`; (2) expose a catalogue
|
||||||
|
request (for example `chat_models`/`chat_agents`, answered from the endpoint's
|
||||||
|
model/agent list) so the client can offer only what the server reports; and
|
||||||
|
(3) optionally accept `model`/`agent` on `chat_create` so a session starts with
|
||||||
|
the operator's chosen default rather than the endpoint's. Until then the app is
|
||||||
|
honest: it shows what the server reports and does not pretend to set it.
|
||||||
|
|
||||||
|
Tests (4 new): in `ChatFormatTest`, that `chatHeaderMeta` shows the reported
|
||||||
|
model, tag and directory, that it never claims a model the server did not report
|
||||||
|
(blank thread → empty, tag only → `Operator`), and that a session tag and a
|
||||||
|
thread tag label the same; in `ChatSessionManagementTest`, that an open
|
||||||
|
conversation carries the model/agent/tag the server reports and that a later list
|
||||||
|
refresh folds the server's new model into the open thread.
|
||||||
|
|
||||||
|
Evidence (this run's implementer pass, macOS, Gradle 8.11.1 at
|
||||||
|
`~/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/bin/gradle`
|
||||||
|
with `JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"`
|
||||||
|
(JDK 17) and `ANDROID_HOME=/Users/alan/Library/Android/sdk`):
|
||||||
|
`gradle --offline --no-daemon :app:testDebugUnitTest` → `BUILD SUCCESSFUL`; the
|
||||||
|
JUnit XMLs total **55 suites / 505 tests / 0 failures / 0 errors / 0 skipped** (4
|
||||||
|
new). `gradle --offline --no-daemon :app:assembleDebug` → `BUILD SUCCESSFUL`; the
|
||||||
|
APK was published to this run's artifacts directory as
|
||||||
|
`pipelines-debug-wip-8e6cb39.apk` (18,706,104 bytes, sha256
|
||||||
|
`b52f2be1fcfce2654b90b9735ce03683fbf91e0a651b2b0ad49e92488d81ad05`; `8e6cb39` is
|
||||||
|
`git rev-parse --short HEAD`, the tree being uncommitted WIP on top of it) and is
|
||||||
|
served at
|
||||||
|
`http://10.0.0.75:8080/artifacts/272/1/pipelines-debug-wip-8e6cb39.apk`
|
||||||
|
(`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
|
||||||
|
`Content-Length: 18706104`).
|
||||||
|
|
||||||
|
Not verified in this pass: the header meta on a device and the create-flow note —
|
||||||
|
the brief keeps implementation verification to the build and the unit tests, and
|
||||||
|
visual review owns the operator's Pixel 9 Pro XL. No packaged skill reference was
|
||||||
|
touched: this is an app-UI change and no reference describes the chat surface.
|
||||||
|
|||||||
@@ -93,12 +93,33 @@ internal fun sessionTitle(session: ChatSession): String =
|
|||||||
* session shows no chip. This only *labels*; the app never filters on the tag,
|
* session shows no chip. This only *labels*; the app never filters on the tag,
|
||||||
* because the server already lists operator sessions only.
|
* because the server already lists operator sessions only.
|
||||||
*/
|
*/
|
||||||
internal fun sessionTagLabel(session: ChatSession): String? = when {
|
internal fun sessionTagLabel(session: ChatSession): String? = sessionTagLabel(session.tag)
|
||||||
session.tag.isBlank() -> null
|
|
||||||
session.tag == ChatProtocol.TAG_OPERATOR -> OPERATOR_TAG_LABEL
|
/**
|
||||||
else -> session.tag
|
* The kind chip label for a session's own tag value (see [sessionTagLabel]).
|
||||||
|
* Kept as the single mapping so a session and the conversation it opens cannot
|
||||||
|
* label the same tag differently.
|
||||||
|
*/
|
||||||
|
internal fun sessionTagLabel(tag: String): String? = when {
|
||||||
|
tag.isBlank() -> null
|
||||||
|
tag == ChatProtocol.TAG_OPERATOR -> OPERATOR_TAG_LABEL
|
||||||
|
else -> tag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The one-line meta under a conversation's own title: the model the server
|
||||||
|
* reports is answering, the session's kind tag and its directory. Every part is
|
||||||
|
* a value the server reported (a model id, the wire tag, the directory), so
|
||||||
|
* nothing is guessed and no catalogue is invented; a blank part is omitted, so a
|
||||||
|
* session the server reported without a model (or an older server that omits the
|
||||||
|
* field) shows no model claim at all.
|
||||||
|
*/
|
||||||
|
internal fun chatHeaderMeta(thread: ChatThread): String = listOfNotNull(
|
||||||
|
thread.model.takeIf { it.isNotBlank() },
|
||||||
|
sessionTagLabel(thread.tag),
|
||||||
|
thread.directory.takeIf { it.isNotBlank() },
|
||||||
|
).joinToString(" · ")
|
||||||
|
|
||||||
private const val OPERATOR_TAG_LABEL = "Operator"
|
private const val OPERATOR_TAG_LABEL = "Operator"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -628,6 +628,19 @@ private fun NewChatPane(
|
|||||||
modifier = Modifier.padding(horizontal = CHAT_GUTTER, vertical = CHAT_ITEM_GAP),
|
modifier = Modifier.padding(horizontal = CHAT_GUTTER, vertical = CHAT_ITEM_GAP),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// The brokered server exposes no request for choosing a
|
||||||
|
// session's model: chat_prompt carries model/agent fields but
|
||||||
|
// the server does not forward them, and there is no catalogue
|
||||||
|
// request to offer a choice from. So the flow says so plainly
|
||||||
|
// rather than shipping a picker that would do nothing. The
|
||||||
|
// conversation header then shows whatever model the server
|
||||||
|
// reports for the created session.
|
||||||
|
Text(
|
||||||
|
text = "This server has no request for choosing a chat's model, so a new chat uses the server's default.",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.padding(horizontal = CHAT_GUTTER, vertical = CHAT_ITEM_GAP),
|
||||||
|
)
|
||||||
NewChatActions(
|
NewChatActions(
|
||||||
directory = selected?.createDirectory ?: create.directory,
|
directory = selected?.createDirectory ?: create.directory,
|
||||||
creating = create.creating,
|
creating = create.creating,
|
||||||
@@ -851,11 +864,28 @@ private fun ChatConversationPane(
|
|||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Column {
|
||||||
text = thread.title.ifBlank { sessionTitle(ChatSession(id = thread.sessionId)) },
|
Text(
|
||||||
maxLines = 1,
|
text = thread.title.ifBlank { sessionTitle(ChatSession(id = thread.sessionId)) },
|
||||||
overflow = TextOverflow.Ellipsis,
|
maxLines = 1,
|
||||||
)
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
// The model the server reports is answering this session,
|
||||||
|
// beside the session's kind tag and its directory, so what
|
||||||
|
// is replying is always visible without leaving the
|
||||||
|
// conversation. Every part is server-reported; a blank one
|
||||||
|
// is simply omitted.
|
||||||
|
val meta = chatHeaderMeta(thread)
|
||||||
|
if (meta.isNotBlank()) {
|
||||||
|
Text(
|
||||||
|
text = meta,
|
||||||
|
style = pipelinesText().meta,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = vm::showChatList) {
|
IconButton(onClick = vm::showChatList) {
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ data class ChatThread(
|
|||||||
val directory: String = "",
|
val directory: String = "",
|
||||||
val model: String = "",
|
val model: String = "",
|
||||||
val agent: String = "",
|
val agent: String = "",
|
||||||
|
/** The session's kind tag the server reported (see [ChatSession.tag]). */
|
||||||
|
val tag: String = "",
|
||||||
val updatedAt: Long = 0,
|
val updatedAt: Long = 0,
|
||||||
/** The server reports another client (or an active run) holds this session. */
|
/** The server reports another client (or an active run) holds this session. */
|
||||||
val busy: Boolean = false,
|
val busy: Boolean = false,
|
||||||
@@ -298,6 +300,9 @@ class ChatStore(
|
|||||||
thread.copy(
|
thread.copy(
|
||||||
title = renamed[thread.sessionId] ?: session.title.ifBlank { thread.title },
|
title = renamed[thread.sessionId] ?: session.title.ifBlank { thread.title },
|
||||||
directory = session.directory.ifBlank { thread.directory },
|
directory = session.directory.ifBlank { thread.directory },
|
||||||
|
model = session.model.ifBlank { thread.model },
|
||||||
|
agent = session.agent.ifBlank { thread.agent },
|
||||||
|
tag = session.tag.ifBlank { thread.tag },
|
||||||
busy = session.busy,
|
busy = session.busy,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -446,6 +451,7 @@ class ChatStore(
|
|||||||
directory = session.directory,
|
directory = session.directory,
|
||||||
model = session.model,
|
model = session.model,
|
||||||
agent = session.agent,
|
agent = session.agent,
|
||||||
|
tag = session.tag,
|
||||||
updatedAt = session.updatedAt,
|
updatedAt = session.updatedAt,
|
||||||
busy = session.busy,
|
busy = session.busy,
|
||||||
)
|
)
|
||||||
@@ -455,6 +461,9 @@ class ChatStore(
|
|||||||
val merged = existing.copy(
|
val merged = existing.copy(
|
||||||
title = title.ifBlank { existing.title },
|
title = title.ifBlank { existing.title },
|
||||||
directory = session.directory.ifBlank { existing.directory },
|
directory = session.directory.ifBlank { existing.directory },
|
||||||
|
model = session.model.ifBlank { existing.model },
|
||||||
|
agent = session.agent.ifBlank { existing.agent },
|
||||||
|
tag = session.tag.ifBlank { existing.tag },
|
||||||
busy = session.busy,
|
busy = session.busy,
|
||||||
)
|
)
|
||||||
_state.value = _state.value.copy(
|
_state.value = _state.value.copy(
|
||||||
@@ -720,6 +729,9 @@ class ChatStore(
|
|||||||
sessionId = sessionId,
|
sessionId = sessionId,
|
||||||
title = _state.value.overrides.titles[sessionId] ?: session?.title ?: "",
|
title = _state.value.overrides.titles[sessionId] ?: session?.title ?: "",
|
||||||
directory = session?.directory ?: "",
|
directory = session?.directory ?: "",
|
||||||
|
model = session?.model ?: "",
|
||||||
|
agent = session?.agent ?: "",
|
||||||
|
tag = session?.tag ?: "",
|
||||||
busy = session?.busy ?: false,
|
busy = session?.busy ?: false,
|
||||||
)
|
)
|
||||||
_state.value = _state.value.copy(open = _state.value.open + placeholder)
|
_state.value = _state.value.copy(open = _state.value.open + placeholder)
|
||||||
|
|||||||
@@ -152,4 +152,32 @@ class ChatFormatTest {
|
|||||||
assertEquals("Named", sessionTitle(ChatSession(id = "ses_1", title = "Named")))
|
assertEquals("Named", sessionTitle(ChatSession(id = "ses_1", title = "Named")))
|
||||||
assertEquals("ses_abcdefghijklmn", sessionTitle(ChatSession(id = "ses_abcdefghijklmnop")))
|
assertEquals("ses_abcdefghijklmn", sessionTitle(ChatSession(id = "ses_abcdefghijklmnop")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun chatHeaderMetaShowsTheReportedModelTagAndDirectory() {
|
||||||
|
// The conversation header names what is answering beside the session's
|
||||||
|
// kind tag and its directory, every part the server's own value.
|
||||||
|
val thread = ChatThread(
|
||||||
|
sessionId = "ses_1",
|
||||||
|
model = "deepseek-v4.1-flash",
|
||||||
|
tag = ChatProtocol.TAG_OPERATOR,
|
||||||
|
directory = "/home/op/work",
|
||||||
|
)
|
||||||
|
assertEquals("deepseek-v4.1-flash · Operator · /home/op/work", chatHeaderMeta(thread))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun chatHeaderMetaNeverClaimsAModelTheServerDidNotReport() {
|
||||||
|
// A session the server reported without a model (or an older server that
|
||||||
|
// omits the field) shows no model claim, never a guess or a catalogue.
|
||||||
|
assertEquals("", chatHeaderMeta(ChatThread(sessionId = "ses_1")))
|
||||||
|
assertEquals("Operator", chatHeaderMeta(ChatThread(sessionId = "ses_1", tag = ChatProtocol.TAG_OPERATOR)))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun aSessionTagAndAThreadTagLabelTheSame() {
|
||||||
|
assertEquals(sessionTagLabel(ChatSession(tag = ChatProtocol.TAG_OPERATOR)), sessionTagLabel(ChatProtocol.TAG_OPERATOR))
|
||||||
|
assertEquals("scratch", sessionTagLabel("scratch"))
|
||||||
|
assertNull(sessionTagLabel(""))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,23 @@ class ChatSessionManagementTest {
|
|||||||
assertTrue(store.value.visibleSessions == listed)
|
assertTrue(store.value.visibleSessions == listed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun anOpenConversationCarriesTheModelAndTagTheServerReports() {
|
||||||
|
val store = ChatStore()
|
||||||
|
store.sessionsLoaded(listOf(session("a").copy(model = "deepseek-v4.1-flash", agent = "build")))
|
||||||
|
store.open(store.value.sessions.single())
|
||||||
|
// The header reads the server's own values, so opening a session shows
|
||||||
|
// what is answering without a second request.
|
||||||
|
assertEquals("deepseek-v4.1-flash", store.value.thread("a")!!.model)
|
||||||
|
assertEquals("build", store.value.thread("a")!!.agent)
|
||||||
|
assertEquals(ChatProtocol.TAG_OPERATOR, store.value.thread("a")!!.tag)
|
||||||
|
|
||||||
|
// A later list refresh folds the server's reported model into the open
|
||||||
|
// conversation too, so the header never shows a stale model id.
|
||||||
|
store.sessionsLoaded(listOf(session("a").copy(model = "gpt-x", agent = "build")))
|
||||||
|
assertEquals("gpt-x", store.value.thread("a")!!.model)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun theCoveredPaneCountMatchesTheVisibleList() {
|
fun theCoveredPaneCountMatchesTheVisibleList() {
|
||||||
val store = ChatStore()
|
val store = ChatStore()
|
||||||
|
|||||||
Reference in New Issue
Block a user