Contract at server dev 8dd3201: a subagent's conversation by its id
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
The server's /api/v2 has the tree routes (8dd3201): GET /chats/{c}/tree
{tree, room, live} and GET /chats/{c}/subagents/{id}/transcript {id,
state, turns}. The activity sheet reads the tree when it opens (an older
server's 404 is ignored), so the list is there without a reply streaming;
a subagent's row opens its conversation from the transcript route, by id,
followed every 3 s while it has not ended -- the provisional member-by-name
route is gone. The conversation dialog is one for both kinds now
(ConversationDialog); a 409 (an agent chat's device away) is said in the
server's words. Findings and stopping are not on Android (the reduced
display, subagents.md §12).
ContractTest reads tree.json and subagent_transcript.json.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
12 files changed
+237
-38
No files matched your search
@@ -104,19 +104,4 @@ object ActivityLogic {
|
||||
|
||||
/** A percentage as the server writes it: one decimal, none when it is whole. */
|
||||
fun percent(value: Double): String = trim(String.format(Locale.ROOT, "%.1f", value))
|
||||
|
||||
/**
|
||||
* A tree subagent as the agent route knows it: a team member, by its name (`GET
|
||||
* /chats/{chat}/agents/member/{name}`), which is how the server reads a member's conversation.
|
||||
*/
|
||||
fun ofTreeAgent(agent: TreeAgent): ActivityAgent = ActivityAgent(
|
||||
kind = "member",
|
||||
id = agent.name,
|
||||
name = agent.name,
|
||||
role = agent.position,
|
||||
brief = agent.task,
|
||||
state = agent.state,
|
||||
model = agent.model,
|
||||
transcript = true,
|
||||
)
|
||||
}
|
||||
@@ -247,6 +247,12 @@ class ApiClient(val base: String, private val token: String, val http: OkHttpCli
|
||||
/** One background agent and its whole conversation, read-only. `kind` is `member` or `job`. */
|
||||
suspend fun agent(chatId: String, kind: String, id: String): AgentDetail = get("/chats/$chatId/agents/${segment(kind)}/${segment(id)}")
|
||||
|
||||
/** The chat's subagent tree and room (spec 3.4.0); a 404 from a server without it. */
|
||||
suspend fun tree(chatId: String): TreeView = get("/chats/$chatId/tree")
|
||||
|
||||
/** A subagent's conversation by its id (`s1`), read-only; 409 while an agent chat's device is away. */
|
||||
suspend fun subagentTranscript(chatId: String, id: String): SubagentTranscript = get("/chats/$chatId/subagents/${segment(id)}/transcript")
|
||||
|
||||
/** Stop a background agent (a member leaves the team with those under it). */
|
||||
suspend fun stopAgent(chatId: String, kind: String, id: String): List<String> =
|
||||
send<Stopped>("POST", "/chats/$chatId/agents/${segment(kind)}/${segment(id)}/stop", null).stopped
|
||||
|
||||
@@ -47,6 +47,14 @@ data class TreeAgent(
|
||||
val contextPercent: Int? get() = context?.takeIf { it.window > 0 }?.let { (it.used.toLong() * 100 / it.window).toInt() }
|
||||
}
|
||||
|
||||
/** `GET /chats/{chat}/tree`: the tree (null: none), the room, and whether it is live (false: kept while the device is away). */
|
||||
@Serializable
|
||||
data class TreeView(val tree: SubagentTree? = null, val room: List<RoomMessage> = emptyList(), val live: Boolean = true)
|
||||
|
||||
/** `GET /chats/{chat}/subagents/{id}/transcript`: its conversation, read-only, live or after it ended. */
|
||||
@Serializable
|
||||
data class SubagentTranscript(val id: String = "", val state: String = "", val turns: List<AgentTurn> = emptyList())
|
||||
|
||||
@Serializable
|
||||
data class TreeContext(val used: Int = 0, val window: Int = 0)
|
||||
|
||||
|
||||
Reference in new issue
Block a user