ios: bound assistant image sets and keep output tools quiet
This commit is contained in:
@@ -347,6 +347,33 @@ struct AgentTests {
|
||||
#expect(presentation.isTyping(now: now.addingTimeInterval(7.3)))
|
||||
}
|
||||
|
||||
@Test func outputImageActivityKeepsImageReplyTypingSuppressed() throws {
|
||||
var presentation = AgentPresentation(), state = AgentRoomState()
|
||||
let now = Date(timeIntervalSince1970: 100)
|
||||
state.activity.isThinking = true
|
||||
presentation.sent(now: now, activity: state.activity)
|
||||
#expect(presentation.isTyping(now: now.addingTimeInterval(0.3)))
|
||||
let image = AgentAttachment(id: "image", kind: .image, filename: "image.png", mimeType: "image/png", sizeBytes: 12, sha256: String(repeating: "a", count: 64))
|
||||
var reply = agentMessage("image-reply", entry: "1", info: ["status": .string("complete"), "agentAttachments": .array([image.metadataValue])])
|
||||
reply.content = ""
|
||||
let page = agentPage([reply], cursor: "1")
|
||||
var after = state; try after.apply(page)
|
||||
presentation.receive(.messages(page), before: state, after: after, replay: false, now: now.addingTimeInterval(1))
|
||||
state = after
|
||||
#expect(presentation.suppressed)
|
||||
|
||||
after.activity.tools = [.init(id: "output-activity", name: "output_image", status: "initiated")]
|
||||
presentation.receive(.activity("root", after.activity), before: state, after: after, replay: false, now: now.addingTimeInterval(2))
|
||||
state = after
|
||||
#expect(!presentation.isTyping(now: now.addingTimeInterval(3)))
|
||||
|
||||
let tool = agentPage([agentMessage("output-tool", entry: "2", role: .tool, info: ["toolName": .string("output_image"), "status": .string("initiated")])], cursor: "2")
|
||||
try after.apply(tool)
|
||||
presentation.receive(.messages(tool), before: state, after: after, replay: false, now: now.addingTimeInterval(4))
|
||||
#expect(presentation.suppressed)
|
||||
#expect(!presentation.isTyping(now: now.addingTimeInterval(5)))
|
||||
}
|
||||
|
||||
@Test func socketURLAndAuthentication() throws {
|
||||
let config = APIConfiguration(baseURL: URL(string: "https://sybil.bajor.cloud/api/?accidental=query")!, authToken: " token ")
|
||||
#expect(try config.agentWebSocketURL().absoluteString == "wss://sybil.bajor.cloud/api/v1/agent/ws")
|
||||
|
||||
Reference in New Issue
Block a user