Watch: show subagent requests on the parent's card, and settle threads by swipe, Settle all and the thread screen
This commit is contained in:
1 parent
a4754b65b0
commit
cf8995e63f
16 files changed
+347
-31
No files matched your search
@@ -49,6 +49,8 @@ protocol GatewayAPI: Sendable {
|
||||
func sendMessage(hostId: String, threadId: String, text: String) async throws
|
||||
func respond(hostId: String, threadId: String, request: RespondRequest) async throws
|
||||
func stop(hostId: String, threadId: String) async throws
|
||||
/// Settles a thread, as in T3. A settled thread that finished or failed leaves the feed.
|
||||
func settle(hostId: String, threadId: String) async throws
|
||||
func projects() async throws -> ProjectsResponse
|
||||
func newThread(_ request: NewThreadRequest) async throws -> NewThreadResponse
|
||||
func registerPush(_ registration: PushRegistration) async throws
|
||||
@@ -95,6 +97,10 @@ struct GatewayClient: GatewayAPI {
|
||||
try await callIgnoringBody("POST", ["v1", "threads", hostId, threadId, "stop"], body: nil as SendMessageRequest?)
|
||||
}
|
||||
|
||||
func settle(hostId: String, threadId: String) async throws {
|
||||
try await callIgnoringBody("POST", ["v1", "threads", hostId, threadId, "settle"], body: nil as SendMessageRequest?)
|
||||
}
|
||||
|
||||
func projects() async throws -> ProjectsResponse {
|
||||
try await call("GET", ["v1", "projects"])
|
||||
}
|
||||
|
||||
@@ -134,6 +134,13 @@ extension PendingRequest.Question {
|
||||
}
|
||||
|
||||
struct FeedItem: Codable, Hashable, Sendable, Identifiable {
|
||||
/// The subagent a request came from, when a thread delegated work and that work waits on you.
|
||||
struct Via: Codable, Hashable, Sendable {
|
||||
var hostId: String
|
||||
var threadId: String
|
||||
var title: String
|
||||
}
|
||||
|
||||
var hostId: String
|
||||
var hostLabel: String
|
||||
var threadId: String
|
||||
@@ -144,9 +151,17 @@ struct FeedItem: Codable, Hashable, Sendable, Identifiable {
|
||||
var updatedAt: Date
|
||||
var lastMessage: String?
|
||||
var request: PendingRequest?
|
||||
/// Set when `request` and `phase` belong to a subagent rather than this thread. Older gateways
|
||||
/// leave it out, which decodes as nil.
|
||||
var via: Via? = nil
|
||||
|
||||
var id: String { "\(hostId)/\(threadId)" }
|
||||
var route: Route { .thread(hostId: hostId, threadId: threadId) }
|
||||
|
||||
/// The thread that answers `request`: the subagent named in `via`, or this thread.
|
||||
var requestThread: (hostId: String, threadId: String) {
|
||||
via.map { ($0.hostId, $0.threadId) } ?? (hostId, threadId)
|
||||
}
|
||||
}
|
||||
|
||||
struct Feed: Codable, Hashable, Sendable {
|
||||
|
||||
Reference in new issue
Block a user