feat(keyboard): expand contextual skills and managed flows
Add local clipboard intent recommendations, webpage and phone actions, and safer host handoffs. Refine managed gateway, catalog refresh, onboarding, and adaptive polish behavior.
This commit is contained in:
@@ -314,7 +314,9 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
utteranceMode: .aiQuestion,
|
||||
aiConversationID: UUID(),
|
||||
aiQuestionText: "总结这段剪贴板内容",
|
||||
aiTaskKind: .clipboardTransform
|
||||
aiWebPageURL: URL(string: "https://example.com/article"),
|
||||
aiTaskKind: .clipboardTransform,
|
||||
managedRequestSource: .hotword
|
||||
)
|
||||
|
||||
let decoded = try JSONDecoder().decode(
|
||||
@@ -324,7 +326,12 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
|
||||
XCTAssertEqual(decoded, command)
|
||||
XCTAssertEqual(decoded.aiQuestionText, "总结这段剪贴板内容")
|
||||
XCTAssertEqual(
|
||||
decoded.aiWebPageURL,
|
||||
URL(string: "https://example.com/article")
|
||||
)
|
||||
XCTAssertEqual(decoded.aiTaskKind, .clipboardTransform)
|
||||
XCTAssertEqual(decoded.managedRequestSource, .hotword)
|
||||
XCTAssertNil(decoded.aiThinkingEnabled)
|
||||
}
|
||||
|
||||
@@ -376,11 +383,18 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
conversationID: UUID(),
|
||||
prefilledQuestion: "整理剪贴板",
|
||||
taskKind: .customSkill,
|
||||
thinkingEnabled: false
|
||||
requestSource: .hotword,
|
||||
thinkingEnabled: false,
|
||||
webPageURL: URL(string: "https://example.com/article")
|
||||
)
|
||||
|
||||
XCTAssertEqual(request.aiTaskKind, .customSkill)
|
||||
XCTAssertEqual(request.managedRequestSource, .hotword)
|
||||
XCTAssertEqual(request.aiThinkingEnabled, false)
|
||||
XCTAssertEqual(
|
||||
request.aiWebPageURL,
|
||||
URL(string: "https://example.com/article")
|
||||
)
|
||||
}
|
||||
|
||||
func testFlowCommandDecodesLegacyJSONWithoutAIIntentKeys() throws {
|
||||
@@ -1366,7 +1380,7 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
startDeadlineAt: 1_700_000_008.25,
|
||||
processingDeadlineAt: 1_700_000_045.25
|
||||
)
|
||||
let expected = #"{"action":"startRecording","aiConversationID":"33333333-4444-5555-6666-777777777777","commandSeq":42,"createdAt":1700000000.25,"editSourceText":"draft","fieldContext":{"followingText":"after","isContextAvailable":true,"isEmptyField":false,"isSecureEntry":false,"keyboardType":"default","precedingText":"before","returnKeyType":"send"},"localeId":"en-US","processingDeadlineAt":1700000045.25,"protocolVersion":8,"sessionId":"00112233-4455-6677-8899-AABBCCDDEEFF","sourceHistoryEntryID":"22222222-3333-4444-5555-666666666666","sourceHistoryEntryRevision":7,"startDeadlineAt":1700000008.25,"utteranceId":"11111111-2222-3333-4444-555555555555","utteranceMode":"editLastInput"}"#
|
||||
let expected = #"{"action":"startRecording","aiConversationID":"33333333-4444-5555-6666-777777777777","commandSeq":42,"createdAt":1700000000.25,"editSourceText":"draft","fieldContext":{"followingText":"after","isContextAvailable":true,"isEmptyField":false,"isSecureEntry":false,"keyboardType":"default","precedingText":"before","returnKeyType":"send"},"localeId":"en-US","processingDeadlineAt":1700000045.25,"protocolVersion":10,"sessionId":"00112233-4455-6677-8899-AABBCCDDEEFF","sourceHistoryEntryID":"22222222-3333-4444-5555-666666666666","sourceHistoryEntryRevision":7,"startDeadlineAt":1700000008.25,"utteranceId":"11111111-2222-3333-4444-555555555555","utteranceMode":"editLastInput"}"#
|
||||
|
||||
XCTAssertEqual(try sortedJSONString(command), expected)
|
||||
}
|
||||
@@ -1402,7 +1416,7 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
historyEntryRevision: 9,
|
||||
aiConversationID: conversationID
|
||||
)
|
||||
let expected = #"{"aiConversationID":"33333333-4444-5555-6666-777777777777","commandSeq":42,"createdAt":1700000050.5,"errorKind":"asrFailed","fieldFingerprint":"default|send|before|after","historyEntryID":"22222222-3333-4444-5555-666666666666","historyEntryRevision":9,"hostGeneration":"generation-1","protocolVersion":8,"rawText":"raw","revision":8,"sessionId":"00112233-4455-6677-8899-AABBCCDDEEFF","status":"final","text":"polished","utteranceId":"11111111-2222-3333-4444-555555555555","utteranceMode":"aiQuestion","warning":"fallback"}"#
|
||||
let expected = #"{"aiConversationID":"33333333-4444-5555-6666-777777777777","commandSeq":42,"createdAt":1700000050.5,"errorKind":"asrFailed","fieldFingerprint":"default|send|before|after","historyEntryID":"22222222-3333-4444-5555-666666666666","historyEntryRevision":9,"hostGeneration":"generation-1","protocolVersion":10,"rawText":"raw","revision":8,"sessionId":"00112233-4455-6677-8899-AABBCCDDEEFF","status":"final","text":"polished","utteranceId":"11111111-2222-3333-4444-555555555555","utteranceMode":"aiQuestion","warning":"fallback"}"#
|
||||
|
||||
XCTAssertEqual(try sortedJSONString(result), expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user