From 65806028183dd4bfca3b4e84b21425e9f2baa9ba Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Tue, 9 Dec 2025 02:04:22 +0100 Subject: [PATCH] Update lens protos --- owocr/lens_betterproto.py | 1058 +++++++++++++++++++++++++------------ 1 file changed, 727 insertions(+), 331 deletions(-) diff --git a/owocr/lens_betterproto.py b/owocr/lens_betterproto.py index 5419c19..6dfffe6 100644 --- a/owocr/lens_betterproto.py +++ b/owocr/lens_betterproto.py @@ -1,5 +1,5 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! -# sources: lens_overlay_client_context.proto, lens_overlay_client_logs.proto, lens_overlay_client_platform.proto, lens_overlay_cluster_info.proto, lens_overlay_deep_gleam_data.proto, lens_overlay_document.proto, lens_overlay_filters.proto, lens_overlay_geometry.proto, lens_overlay_image_crop.proto, lens_overlay_image_data.proto, lens_overlay_interaction_request_metadata.proto, lens_overlay_knowledge_intent_query.proto, lens_overlay_knowledge_query.proto, lens_overlay_math_solver_query.proto, lens_overlay_message_set.proto, lens_overlay_overlay_object.proto, lens_overlay_payload.proto, lens_overlay_phase_latencies_metadata.proto, lens_overlay_platform.proto, lens_overlay_polygon.proto, lens_overlay_request_id.proto, lens_overlay_routing_info.proto, lens_overlay_selection_type.proto, lens_overlay_server.proto, lens_overlay_service_deps.proto, lens_overlay_stickiness_signals.proto, lens_overlay_surface.proto, lens_overlay_text.proto, lens_overlay_text_query.proto, lens_overlay_translate_stickiness_signals.proto, lens_overlay_video_context_input_params.proto, lens_overlay_video_params.proto, lens_overlay_visual_search_interaction_data.proto, lens_overlay_visual_search_interaction_log_data.proto +# sources: aim_communication.proto, aim_query.proto, lens_overlay_client_context.proto, lens_overlay_client_logs.proto, lens_overlay_client_platform.proto, lens_overlay_cluster_info.proto, lens_overlay_contextual_inputs.proto, lens_overlay_deep_gleam_data.proto, lens_overlay_document.proto, lens_overlay_filters.proto, lens_overlay_geometry.proto, lens_overlay_image_crop.proto, lens_overlay_image_data.proto, lens_overlay_interaction_request_metadata.proto, lens_overlay_knowledge_intent_query.proto, lens_overlay_knowledge_query.proto, lens_overlay_math_solver_query.proto, lens_overlay_message_set.proto, lens_overlay_overlay_object.proto, lens_overlay_payload.proto, lens_overlay_phase_latencies_metadata.proto, lens_overlay_platform.proto, lens_overlay_polygon.proto, lens_overlay_request_id.proto, lens_overlay_request_type.proto, lens_overlay_routing_info.proto, lens_overlay_selection_type.proto, lens_overlay_server.proto, lens_overlay_service_deps.proto, lens_overlay_stickiness_signals.proto, lens_overlay_surface.proto, lens_overlay_text.proto, lens_overlay_text_query.proto, lens_overlay_translate_stickiness_signals.proto, lens_overlay_video_context_input_params.proto, lens_overlay_video_params.proto, lens_overlay_visual_input_type.proto, lens_overlay_visual_search_interaction_data.proto, lens_overlay_visual_search_interaction_log_data.proto # plugin: python-betterproto # This file has been @generated @@ -12,6 +12,75 @@ from typing import ( import betterproto +class LensOverlayRequestIdMediaType(betterproto.Enum): + MEDIA_TYPE_DEFAULT_IMAGE = 0 + MEDIA_TYPE_PDF = 1 + MEDIA_TYPE_WEBPAGE = 2 + MEDIA_TYPE_PDF_AND_IMAGE = 3 + MEDIA_TYPE_WEBPAGE_AND_IMAGE = 4 + + +class LensOverlayVisualInputType(betterproto.Enum): + """Input type for the visual search request.""" + + VISUAL_INPUT_TYPE_UNKNOWN = 0 + VISUAL_INPUT_TYPE_PDF = 4 + VISUAL_INPUT_TYPE_WEBPAGE = 5 + + +class CoordinateType(betterproto.Enum): + """Specifies the coordinate system used for geometry protos.""" + + UNSPECIFIED = 0 + """Unspecified default value, per proto best practice.""" + + NORMALIZED = 1 + """Normalized coordinates.""" + + IMAGE = 2 + """Image pixel coordinates.""" + + +class PolygonVertexOrdering(betterproto.Enum): + """Specifies the vertex ordering.""" + + VERTEX_ORDERING_UNSPECIFIED = 0 + CLOCKWISE = 1 + COUNTER_CLOCKWISE = 2 + + +class LensOverlayInteractionRequestMetadataType(betterproto.Enum): + UNKNOWN = 0 + TAP = 1 + """User's tap on the screen.""" + + REGION = 2 + """User's region selection on the screenshot.""" + + TEXT_SELECTION = 3 + """User's text selection on the screenshot.""" + + REGION_SEARCH = 4 + """User selected a bounding box to region search.""" + + OBJECT_FULFILLMENT = 5 + """Requests selection and fulfillment of a specific object.""" + + CONTEXTUAL_SEARCH_QUERY = 9 + """User sent a query in the contextual search box.""" + + PDF_QUERY = 10 + """User sent a query about a pdf.""" + + WEBPAGE_QUERY = 11 + """User sent a query about a website.""" + + +class ClientPlatform(betterproto.Enum): + UNSPECIFIED = 0 + LENS_OVERLAY = 2 + + class LensOverlayFilterType(betterproto.Enum): """Supported filter types.""" @@ -20,14 +89,57 @@ class LensOverlayFilterType(betterproto.Enum): AUTO_FILTER = 7 +class LensOverlaySelectionType(betterproto.Enum): + """Possible selection types for Lens overlay.""" + + UNKNOWN_SELECTION_TYPE = 0 + TAP_ON_EMPTY = 1 + SELECT_TEXT_HIGHLIGHT = 3 + REGION_SEARCH = 7 + INJECTED_IMAGE = 10 + TAP_ON_REGION_GLEAM = 15 + MULTIMODAL_SEARCH = 18 + SELECT_TRANSLATED_TEXT = 21 + TAP_ON_OBJECT = 22 + MULTIMODAL_SUGGEST_TYPEAHEAD = 25 + MULTIMODAL_SUGGEST_ZERO_PREFIX = 26 + MULTIMODAL_SELECTION_CLEAR = 27 + TRANSLATE_CHIP = 52 + SYMBOLIC_MATH_OBJECT = 53 + + +class QueryPayloadQueryTextSource(betterproto.Enum): + """The input source of the query text.""" + + QUERY_TEXT_SOURCE_UNSPECIFIED = 0 + QUERY_TEXT_SOURCE_KEYBOARD_INPUT = 1 + + +class FeatureCapability(betterproto.Enum): + """ + Feature Capabilities shared between AIM and Client. Both sides need to + support a feature for it to WAI. Sent in the handshake request/response so + both ends of communication are aware of what features to support. + """ + + DEFAULT = 0 + """ + Default value. The only supported feature is sending a query from the + client to AIM. + """ + + class Platform(betterproto.Enum): UNSPECIFIED = 0 WEB = 3 + LENS_OVERLAY = 6 class Surface(betterproto.Enum): UNSPECIFIED = 0 CHROMIUM = 4 + LENS_OVERLAY = 42 + CHROME_NTP = 47 class LensRenderingEnvironment(betterproto.Enum): @@ -52,32 +164,11 @@ class LensOverlayClientLogsLensOverlayEntryPoint(betterproto.Enum): OMNIBOX_BUTTON = 4 TOOLBAR_BUTTON = 5 FIND_IN_PAGE = 6 - - -class ClientPlatform(betterproto.Enum): - UNSPECIFIED = 0 - LENS_OVERLAY = 2 - - -class CoordinateType(betterproto.Enum): - """Specifies the coordinate system used for geometry protos.""" - - UNSPECIFIED = 0 - """Unspecified default value, per proto best practice.""" - - NORMALIZED = 1 - """Normalized coordinates.""" - - IMAGE = 2 - """Image pixel coordinates.""" - - -class PolygonVertexOrdering(betterproto.Enum): - """Specifies the vertex ordering.""" - - VERTEX_ORDERING_UNSPECIFIED = 0 - CLOCKWISE = 1 - COUNTER_CLOCKWISE = 2 + OMNIBOX_PAGE_ACTION = 7 + OMNIBOX_CONTEXTUAL_SUGGESTION = 8 + HOMEWORK_ACTION_CHIP = 9 + TEXT_CONTEXT_MENU = 10 + VIDEO_CONTEXT_MENU = 11 class WritingDirection(betterproto.Enum): @@ -127,73 +218,28 @@ class TranslationDataBackgroundImageDataFileFormat(betterproto.Enum): JPEG_RGB_PNG_MASK = 4 -class LensOverlayInteractionRequestMetadataType(betterproto.Enum): - UNKNOWN = 0 - TAP = 1 - """User's tap on the screen.""" - - REGION = 2 - """User's region selection on the screenshot.""" - - TEXT_SELECTION = 3 - """User's text selection on the screenshot.""" - - REGION_SEARCH = 4 - """User selected a bounding box to region search.""" - - OBJECT_FULFILLMENT = 5 - """Requests selection and fulfillment of a specific object.""" - - CONTEXTUAL_SEARCH_QUERY = 9 - """User sent a query in the contextual search box.""" - - PDF_QUERY = 10 - """User sent a query about a pdf.""" - - WEBPAGE_QUERY = 11 - """User sent a query about a website.""" - - class OverlayObjectRenderingMetadataRenderType(betterproto.Enum): DEFAULT = 0 GLEAM = 1 -class LensOverlaySelectionType(betterproto.Enum): - """Possible selection types for Lens overlay.""" - - UNKNOWN_SELECTION_TYPE = 0 - TAP_ON_EMPTY = 1 - SELECT_TEXT_HIGHLIGHT = 3 - REGION_SEARCH = 7 - INJECTED_IMAGE = 10 - TAP_ON_REGION_GLEAM = 15 - MULTIMODAL_SEARCH = 18 - SELECT_TRANSLATED_TEXT = 21 - TAP_ON_OBJECT = 22 - MULTIMODAL_SUGGEST_TYPEAHEAD = 25 - MULTIMODAL_SUGGEST_ZERO_PREFIX = 26 - TRANSLATE_CHIP = 52 - SYMBOLIC_MATH_OBJECT = 53 - - -class PayloadRequestType(betterproto.Enum): +class RequestType(betterproto.Enum): """The type of the request the payload is sent in.""" - REQUEST_TYPE_DEFAULT = 0 + DEFAULT = 0 """Unset Request type.""" - REQUEST_TYPE_PDF = 1 + PDF = 1 """Request is for PDF.""" - REQUEST_TYPE_EARLY_PARTIAL_PDF = 3 + EARLY_PARTIAL_PDF = 3 """Request is for partial PDF upload.""" - REQUEST_TYPE_WEBPAGE = 2 + WEBPAGE = 2 """Request is for webpage.""" -class PayloadCompressionType(betterproto.Enum): +class CompressionType(betterproto.Enum): """Possible compression types for content_data.""" UNCOMPRESSED = 0 @@ -203,9 +249,36 @@ class PayloadCompressionType(betterproto.Enum): """ZSTD compression.""" +class ContentDataContentType(betterproto.Enum): + """ + Possible types of the content. + Next ID: 6 + """ + + CONTENT_TYPE_UNSPECIFIED = 0 + """Default value.""" + + CONTENT_TYPE_PDF = 1 + """PDF content.""" + + CONTENT_TYPE_INNER_TEXT = 2 + """Inner text content.""" + + CONTENT_TYPE_INNER_HTML = 3 + """Inner HTML content.""" + + CONTENT_TYPE_ANNOTATED_PAGE_CONTENT = 4 + """Annotated page content.""" + + CONTENT_TYPE_EARLY_PARTIAL_PDF = 5 + """Early partial PDF content.""" + + class LensOverlayServerErrorErrorType(betterproto.Enum): UNKNOWN_TYPE = 0 MISSING_REQUEST = 1 + MISSING_CHUNKS = 2 + """Payload chunks are missing from the server cache.""" class StickinessSignalsNamespace(betterproto.Enum): @@ -214,6 +287,211 @@ class StickinessSignalsNamespace(betterproto.Enum): EDUCATION_INPUT = 79 +@dataclass(eq=False, repr=False) +class LensOverlayRoutingInfo(betterproto.Message): + """Information about where to route the request.""" + + server_address: str = betterproto.string_field(1) + """Address to route the request to.""" + + cell_address: str = betterproto.string_field(3) + """Cell to route the request to.""" + + blade_target: str = betterproto.string_field(2) + """Blade target to route the request to.""" + + +@dataclass(eq=False, repr=False) +class LensOverlayRequestId(betterproto.Message): + """ + Request Id definition to support request sequencing and state lookup. + Next Id: 11 + """ + + uuid: int = betterproto.uint64_field(1) + """A unique identifier for a sequence of related Lens requests.""" + + sequence_id: int = betterproto.int32_field(2) + """ + An id to indicate the order of the current request within a sequence of + requests sharing the same uuid. Starts from 1, increments by 1 if there is + a new request with the same uuid. + """ + + image_sequence_id: int = betterproto.int32_field(3) + """ + An id to indicate the order of image payload sent within a sequence of + requests sharing the same uuid. Starts from 1, increments by 1 if there is + a new request with an image payload with the same uuid. + Note, region search request does not increment this id. + """ + + analytics_id: bytes = betterproto.bytes_field(4) + """ + Analytics ID for the Lens request. Will be updated on the initial request + and once per interaction request. + """ + + long_context_id: int = betterproto.int32_field(9) + """ + An id to indicate the order of contextual document payloads sent within a + sequence of requests sharing the same uuid. Starts from 1, increments by 1 + if there is a new request with a contextual payload with the same uuid. + """ + + routing_info: "LensOverlayRoutingInfo" = betterproto.message_field(6) + """Information about where to route the request.""" + + time_usec: int = betterproto.uint64_field(7) + """The Epoch Micro Wall time when the request is built.""" + + media_type: "LensOverlayRequestIdMediaType" = betterproto.enum_field(10) + """The type of media this object represents.""" + + +@dataclass(eq=False, repr=False) +class Polygon(betterproto.Message): + """Information about a polygon.""" + + vertex: List["PolygonVertex"] = betterproto.message_field(1) + vertex_ordering: "PolygonVertexOrdering" = betterproto.enum_field(2) + coordinate_type: "CoordinateType" = betterproto.enum_field(3) + """Specifies the coordinate type of vertices.""" + + +@dataclass(eq=False, repr=False) +class PolygonVertex(betterproto.Message): + """Represents a single vertex in the polygon.""" + + x: float = betterproto.float_field(1) + y: float = betterproto.float_field(2) + + +@dataclass(eq=False, repr=False) +class CenterRotatedBox(betterproto.Message): + """Information about a center bounding box rotated around its center.""" + + center_x: float = betterproto.float_field(1) + center_y: float = betterproto.float_field(2) + width: float = betterproto.float_field(3) + height: float = betterproto.float_field(4) + rotation_z: float = betterproto.float_field(5) + """ + Clockwise rotation around the center in radians. The rotation angle is + computed before normalizing the coordinates. + """ + + coordinate_type: "CoordinateType" = betterproto.enum_field(6) + """ + Specifies the coordinate type of center and size. + @note default is COORDINATE_TYPE_UNSPECIFIED, please initialize this value + to NORMALIZED or IMAGE for Lens detection API usage. + """ + + +@dataclass(eq=False, repr=False) +class Geometry(betterproto.Message): + """Geometric shape(s) used for tracking and detection.""" + + bounding_box: "CenterRotatedBox" = betterproto.message_field(1) + """Specifies the bounding box for this geometry.""" + + segmentation_polygon: List["Polygon"] = betterproto.message_field(5) + """ + Specifies the segmentation polygon. The vertices of the outer-boundaries + are in clockwise, and the ones of inner-boundaries are in counter-clockwise + ordering. + """ + + +@dataclass(eq=False, repr=False) +class ZoomedCrop(betterproto.Message): + """ + A cropped and potentially re-scaled image region, rectangular subregion of a + canonical image. + """ + + crop: "CenterRotatedBox" = betterproto.message_field(1) + """The cropped region of the parent image in parent coordinates.""" + + parent_width: int = betterproto.int32_field(2) + """Width of the parent image.""" + + parent_height: int = betterproto.int32_field(3) + """Height of the parent image.""" + + zoom: float = betterproto.float_field(4) + """ + The ratio of the pixel dimensions of the child image to the pixel + dimensions of the 'crop' in parent coordinates. + """ + + +@dataclass(eq=False, repr=False) +class TextQuery(betterproto.Message): + """Contains an unstructured text query to add to an image query.""" + + query: str = betterproto.string_field(1) + """The unstructured text query, such as "blue" or "blouse".""" + + is_primary: bool = betterproto.bool_field(2) + + +@dataclass(eq=False, repr=False) +class LensOverlayInteractionRequestMetadata(betterproto.Message): + """Metadata associated with an interaction request.""" + + type: "LensOverlayInteractionRequestMetadataType" = betterproto.enum_field(1) + selection_metadata: "LensOverlayInteractionRequestMetadataSelectionMetadata" = ( + betterproto.message_field(2) + ) + query_metadata: "LensOverlayInteractionRequestMetadataQueryMetadata" = ( + betterproto.message_field(4) + ) + + +@dataclass(eq=False, repr=False) +class LensOverlayInteractionRequestMetadataSelectionMetadata(betterproto.Message): + """ + Metadata related to the selection associated with this interaction request. + """ + + point: "LensOverlayInteractionRequestMetadataSelectionMetadataPoint" = ( + betterproto.message_field(1, group="selection") + ) + region: "LensOverlayInteractionRequestMetadataSelectionMetadataRegion" = ( + betterproto.message_field(2, group="selection") + ) + object: "LensOverlayInteractionRequestMetadataSelectionMetadataObject" = ( + betterproto.message_field(3, group="selection") + ) + + +@dataclass(eq=False, repr=False) +class LensOverlayInteractionRequestMetadataSelectionMetadataPoint(betterproto.Message): + x: float = betterproto.float_field(1) + y: float = betterproto.float_field(2) + + +@dataclass(eq=False, repr=False) +class LensOverlayInteractionRequestMetadataSelectionMetadataRegion(betterproto.Message): + region: "CenterRotatedBox" = betterproto.message_field(1) + + +@dataclass(eq=False, repr=False) +class LensOverlayInteractionRequestMetadataSelectionMetadataObject(betterproto.Message): + object_id: str = betterproto.string_field(1) + geometry: "Geometry" = betterproto.message_field(2) + + +@dataclass(eq=False, repr=False) +class LensOverlayInteractionRequestMetadataQueryMetadata(betterproto.Message): + """Metadata related to query.""" + + text_query: "TextQuery" = betterproto.message_field(2) + """The text query information.""" + + @dataclass(eq=False, repr=False) class AppliedFilter(betterproto.Message): """Supported filter types.""" @@ -237,6 +515,174 @@ class AppliedFilters(betterproto.Message): filter: List["AppliedFilter"] = betterproto.message_field(1) +@dataclass(eq=False, repr=False) +class LensOverlayVisualSearchInteractionLogData(betterproto.Message): + """Log data for a Lens Overlay visual search interaction.""" + + filter_data: "FilterData" = betterproto.message_field(1) + """Filter related metadata.""" + + user_selection_data: "UserSelectionData" = betterproto.message_field(2) + """User Selection metadata.""" + + is_parent_query: bool = betterproto.bool_field(3) + """Whether the query is a parent query.""" + + client_platform: "ClientPlatform" = betterproto.enum_field(4) + """The client platform this query was originated from.""" + + +@dataclass(eq=False, repr=False) +class FilterData(betterproto.Message): + """ + Filter data. + Next ID: 2 + """ + + filter_type: "LensOverlayFilterType" = betterproto.enum_field(1) + """ + The filter type associated with this interaction (auto, translate, etc.). + """ + + +@dataclass(eq=False, repr=False) +class UserSelectionData(betterproto.Message): + """ + User selection data. + Next ID: 2 + """ + + selection_type: "LensOverlaySelectionType" = betterproto.enum_field(1) + """ + The selection type associated with this interaction (e.g. region search). + """ + + +@dataclass(eq=False, repr=False) +class LensOverlayVisualSearchInteractionData(betterproto.Message): + """Metadata associated with a Lens Visual Search request.""" + + interaction_type: "LensOverlayInteractionRequestMetadataType" = ( + betterproto.enum_field(1) + ) + """The type of interaction.""" + + zoomed_crop: "ZoomedCrop" = betterproto.message_field(7) + """The selected region for this interaction, instead of the object id.""" + + object_id: str = betterproto.string_field(3) + """ + The selected object id for this interaction, instead of the zoomed crop. + Currently unsupported and should not be populated. + """ + + text_select: "LensOverlayVisualSearchInteractionDataTextSelect" = ( + betterproto.message_field(4) + ) + log_data: "LensOverlayVisualSearchInteractionLogData" = betterproto.message_field(5) + """Logging-specific data.""" + + +@dataclass(eq=False, repr=False) +class LensOverlayVisualSearchInteractionDataTextSelect(betterproto.Message): + """The selected text for this interaction.""" + + selected_texts: str = betterproto.string_field(5) + """ + The selected texts string for a text selection interaction. This is set + when sending a text selection interaction from Lens surfaces. + """ + + +@dataclass(eq=False, repr=False) +class LensImageQueryData(betterproto.Message): + """ + The collection of parameters required to execute a Lens query as part of AI + Mode. + """ + + search_session_id: str = betterproto.string_field(1) + """ID for subsequent search requests.""" + + request_id: "LensOverlayRequestId" = betterproto.message_field(2) + """A preformatted request ID to send for the current Lens query.""" + + visual_input_type: "LensOverlayVisualInputType" = betterproto.enum_field(4) + """The type of visual input provided for the query.""" + + visual_search_interaction_data: "LensOverlayVisualSearchInteractionData" = ( + betterproto.message_field(7) + ) + """The visual input interaction data for the query.""" + + +@dataclass(eq=False, repr=False) +class QueryPayload(betterproto.Message): + """The set of data that's required to generate a response from the LLM.""" + + query_text: str = betterproto.string_field(1) + """The user query.""" + + query_text_source: "QueryPayloadQueryTextSource" = betterproto.enum_field(3) + """The input source of the query text.""" + + lens_image_query_data: List["LensImageQueryData"] = betterproto.message_field(2) + """Query data returned if Lens was invoked.""" + + +@dataclass(eq=False, repr=False) +class HandshakePing(betterproto.Message): + """ + Message clients send to AIM to initiate a handshake. Sent continuously on + page load until AIM acknowledges with a HandshakeResponse. + """ + + capabilities: List["FeatureCapability"] = betterproto.enum_field(1) + """The list of features supports by this client.""" + + +@dataclass(eq=False, repr=False) +class SubmitQuery(betterproto.Message): + """Message from client to AIM to submit a query.""" + + payload: "QueryPayload" = betterproto.message_field(1) + """ + The set of data that's required to generate a response from the LLM. + Queries can be unimodal (text only or image only) or multimodal (e.g. text + + image). + """ + + +@dataclass(eq=False, repr=False) +class HandshakeResponse(betterproto.Message): + """ + Message AIM sends to clients to confirm a handshake, at which point the + client can send messages to AIM knowing they will be delivered. + """ + + capabilities: List["FeatureCapability"] = betterproto.enum_field(1) + """The list of features supported by this AIM instance.""" + + +@dataclass(eq=False, repr=False) +class ClientToAimMessage(betterproto.Message): + """The message for clients to send messages to AIM.""" + + handshake_ping: "HandshakePing" = betterproto.message_field( + 1, group="event_message" + ) + submit_query: "SubmitQuery" = betterproto.message_field(2, group="event_message") + + +@dataclass(eq=False, repr=False) +class AimToClientMessage(betterproto.Message): + """The message for AIM to send messages to native clients.""" + + handshake_response: "HandshakeResponse" = betterproto.message_field( + 1, group="event_message" + ) + + @dataclass(eq=False, repr=False) class LensOverlayClientContext(betterproto.Message): """Context information of the client sending the request.""" @@ -364,20 +810,6 @@ class LensOverlayClientLogs(betterproto.Message): """Whether the user has disabled metrics collection.""" -@dataclass(eq=False, repr=False) -class LensOverlayRoutingInfo(betterproto.Message): - """Information about where to route the request.""" - - server_address: str = betterproto.string_field(1) - """Address to route the request to.""" - - cell_address: str = betterproto.string_field(3) - """Cell to route the request to.""" - - blade_target: str = betterproto.string_field(2) - """Blade target to route the request to.""" - - @dataclass(eq=False, repr=False) class LensOverlayClusterInfo(betterproto.Message): """The cluster info for a Lens Overlay session.""" @@ -393,81 +825,22 @@ class LensOverlayClusterInfo(betterproto.Message): @dataclass(eq=False, repr=False) -class Polygon(betterproto.Message): - """Information about a polygon.""" +class LensOverlayContextualInputs(betterproto.Message): + """ + A container for lens inputs sent into search. Each LensOverlayContextualInput + represents one input file, such as an image or pdf. + """ - vertex: List["PolygonVertex"] = betterproto.message_field(1) - vertex_ordering: "PolygonVertexOrdering" = betterproto.enum_field(2) - coordinate_type: "CoordinateType" = betterproto.enum_field(3) - """Specifies the coordinate type of vertices.""" + inputs: List["LensOverlayContextualInputsLensOverlayContextualInput"] = ( + betterproto.message_field(1) + ) @dataclass(eq=False, repr=False) -class PolygonVertex(betterproto.Message): - """Represents a single vertex in the polygon.""" +class LensOverlayContextualInputsLensOverlayContextualInput(betterproto.Message): + """Next ID: 2""" - x: float = betterproto.float_field(1) - y: float = betterproto.float_field(2) - - -@dataclass(eq=False, repr=False) -class CenterRotatedBox(betterproto.Message): - """Information about a center bounding box rotated around its center.""" - - center_x: float = betterproto.float_field(1) - center_y: float = betterproto.float_field(2) - width: float = betterproto.float_field(3) - height: float = betterproto.float_field(4) - rotation_z: float = betterproto.float_field(5) - """ - Clockwise rotation around the center in radians. The rotation angle is - computed before normalizing the coordinates. - """ - - coordinate_type: "CoordinateType" = betterproto.enum_field(6) - """ - Specifies the coordinate type of center and size. - @note default is COORDINATE_TYPE_UNSPECIFIED, please initialize this value - to NORMALIZED or IMAGE for Lens detection API usage. - """ - - -@dataclass(eq=False, repr=False) -class Geometry(betterproto.Message): - """Geometric shape(s) used for tracking and detection.""" - - bounding_box: "CenterRotatedBox" = betterproto.message_field(1) - """Specifies the bounding box for this geometry.""" - - segmentation_polygon: List["Polygon"] = betterproto.message_field(5) - """ - Specifies the segmentation polygon. The vertices of the outer-boundaries - are in clockwise, and the ones of inner-boundaries are in counter-clockwise - ordering. - """ - - -@dataclass(eq=False, repr=False) -class ZoomedCrop(betterproto.Message): - """ - A cropped and potentially re-scaled image region, rectangular subregion of a - canonical image. - """ - - crop: "CenterRotatedBox" = betterproto.message_field(1) - """The cropped region of the parent image in parent coordinates.""" - - parent_width: int = betterproto.int32_field(2) - """Width of the parent image.""" - - parent_height: int = betterproto.int32_field(3) - """Height of the parent image.""" - - zoom: float = betterproto.float_field(4) - """ - The ratio of the pixel dimensions of the child image to the pixel - dimensions of the 'crop' in parent coordinates. - """ + request_id: "LensOverlayRequestId" = betterproto.message_field(1) @dataclass(eq=False, repr=False) @@ -767,71 +1140,6 @@ class ImageMetadata(betterproto.Message): """ -@dataclass(eq=False, repr=False) -class TextQuery(betterproto.Message): - """Contains an unstructured text query to add to an image query.""" - - query: str = betterproto.string_field(1) - """The unstructured text query, such as "blue" or "blouse".""" - - is_primary: bool = betterproto.bool_field(2) - - -@dataclass(eq=False, repr=False) -class LensOverlayInteractionRequestMetadata(betterproto.Message): - """Metadata associated with an interaction request.""" - - type: "LensOverlayInteractionRequestMetadataType" = betterproto.enum_field(1) - selection_metadata: "LensOverlayInteractionRequestMetadataSelectionMetadata" = ( - betterproto.message_field(2) - ) - query_metadata: "LensOverlayInteractionRequestMetadataQueryMetadata" = ( - betterproto.message_field(4) - ) - - -@dataclass(eq=False, repr=False) -class LensOverlayInteractionRequestMetadataSelectionMetadata(betterproto.Message): - """ - Metadata related to the selection associated with this interaction request. - """ - - point: "LensOverlayInteractionRequestMetadataSelectionMetadataPoint" = ( - betterproto.message_field(1, group="selection") - ) - region: "LensOverlayInteractionRequestMetadataSelectionMetadataRegion" = ( - betterproto.message_field(2, group="selection") - ) - object: "LensOverlayInteractionRequestMetadataSelectionMetadataObject" = ( - betterproto.message_field(3, group="selection") - ) - - -@dataclass(eq=False, repr=False) -class LensOverlayInteractionRequestMetadataSelectionMetadataPoint(betterproto.Message): - x: float = betterproto.float_field(1) - y: float = betterproto.float_field(2) - - -@dataclass(eq=False, repr=False) -class LensOverlayInteractionRequestMetadataSelectionMetadataRegion(betterproto.Message): - region: "CenterRotatedBox" = betterproto.message_field(1) - - -@dataclass(eq=False, repr=False) -class LensOverlayInteractionRequestMetadataSelectionMetadataObject(betterproto.Message): - object_id: str = betterproto.string_field(1) - geometry: "Geometry" = betterproto.message_field(2) - - -@dataclass(eq=False, repr=False) -class LensOverlayInteractionRequestMetadataQueryMetadata(betterproto.Message): - """Metadata related to query.""" - - text_query: "TextQuery" = betterproto.message_field(2) - """The text query information.""" - - @dataclass(eq=False, repr=False) class TranslateStickinessSignals(betterproto.Message): """ @@ -944,40 +1252,6 @@ class OverlayObjectInteractionProperties(betterproto.Message): """Whether an object can be tapped""" -@dataclass(eq=False, repr=False) -class LensOverlayRequestId(betterproto.Message): - """ - Request Id definition to support request sequencing and state lookup. - """ - - uuid: int = betterproto.uint64_field(1) - """A unique identifier for a sequence of related Lens requests.""" - - sequence_id: int = betterproto.int32_field(2) - """ - An id to indicate the order of the current request within a sequence of - requests sharing the same uuid. Starts from 1, increments by 1 if there is - a new request with the same uuid. - """ - - image_sequence_id: int = betterproto.int32_field(3) - """ - An id to indicate the order of image payload sent within a sequence of - requests sharing the same uuid. Starts from 1, increments by 1 if there is - a new request with an image payload with the same uuid. - Note, region search request does not increment this id. - """ - - analytics_id: bytes = betterproto.bytes_field(4) - """ - Analytics ID for the Lens request. Will be updated on the initial request - and once per interaction request. - """ - - routing_info: "LensOverlayRoutingInfo" = betterproto.message_field(6) - """Information about where to route the request.""" - - @dataclass(eq=False, repr=False) class LensOverlayRequestContext(betterproto.Message): """Request context for a Lens Overlay request.""" @@ -989,6 +1263,17 @@ class LensOverlayRequestContext(betterproto.Message): """The client context for the request.""" +@dataclass(eq=False, repr=False) +class ViewportRequestContext(betterproto.Message): + """Context information about the viewport for the request.""" + + pdf_page_number: int = betterproto.int32_field(1) + """ + Optional. Pdf page number the user is viewing for contextual search + requests. Only sent with viewport requests on pdf documents. + """ + + @dataclass(eq=False, repr=False) class LensOverlayObjectsRequest(betterproto.Message): request_context: "LensOverlayRequestContext" = betterproto.message_field(1) @@ -1004,6 +1289,63 @@ class LensOverlayObjectsRequest(betterproto.Message): field. """ + viewport_request_context: "ViewportRequestContext" = betterproto.message_field(5) + """Optional. Viewport context for contextual search viewport requests.""" + + +@dataclass(eq=False, repr=False) +class LensOverlayUploadChunkRequest(betterproto.Message): + request_context: "LensOverlayRequestContext" = betterproto.message_field(1) + """ + Required. Chunks of the same payload should have the same request + context. + """ + + debug_options: "ChunkDebugOptions" = betterproto.message_field(6) + """Optional. Debug options for the request.""" + + chunk_id: int = betterproto.int64_field(3) + """ + Required. The id of the chunk. This should start from 0 for the first + chunk and go up to (total_chunks - 1) in sequential chunk order. + """ + + chunk_bytes: bytes = betterproto.bytes_field(4) + """Required. The bytes of the payload chunk to upload.""" + + +@dataclass(eq=False, repr=False) +class LensOverlayUploadChunkResponse(betterproto.Message): + debug_metadata: "ChunkDebugMetadata" = betterproto.message_field(2) + """Debug metadata from the upload chunk response.""" + + +@dataclass(eq=False, repr=False) +class ChunkDebugOptions(betterproto.Message): + total_chunks: int = betterproto.int64_field(1) + """ + Required in first chunk request of the payload. Optional afterwards. + Total number of chunks that will be uploaded to Lens server for the given + payload. + """ + + query_chunks: bool = betterproto.bool_field(2) + """ + Optional. When true, Lens server will return a repeated list of remaining + chunk ids that it expects to receive to complete the payload. Should only + be used for debugging purposes. + """ + + +@dataclass(eq=False, repr=False) +class ChunkDebugMetadata(betterproto.Message): + remaining_chunks: List[int] = betterproto.int64_field(1) + """ + Only populated if ChunkDebugOptions.query_chunks is true in the + UploadChunk request. List of chunk ids that Lens server is expecting to + complete the payload. Should only be used for debugging purposes. + """ + @dataclass(eq=False, repr=False) class LensOverlayObjectsResponse(betterproto.Message): @@ -1037,13 +1379,14 @@ class LensOverlayInteractionRequest(betterproto.Message): @dataclass(eq=False, repr=False) class LensOverlayInteractionResponse(betterproto.Message): encoded_response: str = betterproto.string_field(3) + text: "Text" = betterproto.message_field(5) @dataclass(eq=False, repr=False) class Payload(betterproto.Message): - """Next ID: 9""" + """Next ID: 11""" - request_type: "PayloadRequestType" = betterproto.enum_field(6) + request_type: "RequestType" = betterproto.enum_field(6) """Optional. The type of the request.""" image_data: "ImageData" = betterproto.message_field(2) @@ -1056,28 +1399,114 @@ class Payload(betterproto.Message): """ Data for non-image payloads. May be sent with or without an image in the image_data field. If content_data is set, content_type must also be set. + TODO(crbug.com/399173540): Deprecate this field in favor of content. """ content_type: str = betterproto.string_field(4) """ The media type/MIME type of the data represented i content_data, e.g. "application/pdf". If content_type is set, content_data should also be set. + TODO(crbug.com/399173540): Deprecate this field in favor of content. """ page_url: str = betterproto.string_field(5) - """The page url this request was made on.""" + """ + The page url this request was made on. + TODO(crbug.com/399173540): Deprecate this field in favor of content. + """ partial_pdf_document: "LensOverlayDocument" = betterproto.message_field(7) """ The partially parsed PDF document. Used to get early suggest signals. This is only set for REQUEST_TYPE_EARLY_PARTIAL_PDF. + TODO(crbug.com/399173540): Deprecate this field in favor of content. """ - compression_type: "PayloadCompressionType" = betterproto.enum_field(8) + compression_type: "CompressionType" = betterproto.enum_field(8) """ Compression format of content_data. Currently only used for PDF data. + TODO(crbug.com/399173540): Deprecate this field in favor of content. """ + stored_chunk_options: "StoredChunkOptions" = betterproto.message_field(9) + """ + Optional. Options for reading stored chunks from state layer. + TODO(crbug.com/399173540): Deprecate this field in favor of content. + """ + + content: "Content" = betterproto.message_field(10) + """Non-image content to be sent to the Lens server.""" + + +@dataclass(eq=False, repr=False) +class StoredChunkOptions(betterproto.Message): + """ + Specifies the options for the server to use when reading stored chunks from + state layer during a streamed request. + Next ID: 4 + """ + + read_stored_chunks: bool = betterproto.bool_field(1) + """ + When set to true, Lens will retrieve payload chunks uploaded to state + layer via the UploadChunk API and use those to construct + content_data. If this is set, then content_type and total_stored_chunks + must also be set. + """ + + total_stored_chunks: int = betterproto.int64_field(2) + """ + The total number of chunks the payload was split into. This is used to + facilitate the reconstruction of content_data. + """ + + is_read_retry: bool = betterproto.bool_field(3) + """ + Indicates that this is a retry for a previously failed attempt to read + payload chunks from the server. + """ + + +@dataclass(eq=False, repr=False) +class Content(betterproto.Message): + """ + Generic content message for all types of content that can be sent to Lens. + Next ID: 5 + """ + + webpage_url: str = betterproto.string_field(1) + """Optional. Page url for the webpage.""" + + webpage_title: str = betterproto.string_field(4) + """Optional. Page title of the webpage.""" + + content_data: List["ContentData"] = betterproto.message_field(2) + """Optional. Content items for the request.""" + + request_type: "RequestType" = betterproto.enum_field(3) + """The type of the request.""" + + +@dataclass(eq=False, repr=False) +class ContentData(betterproto.Message): + """ + Generic content data message for all types of content that can be sent to + Lens. + Next ID: 5 + """ + + content_type: "ContentDataContentType" = betterproto.enum_field(1) + """The type of the content.""" + + data: bytes = betterproto.bytes_field(2) + """The content data.""" + + compression_type: "CompressionType" = betterproto.enum_field(3) + """Optional. Compression format of content_data.""" + + stored_chunk_options: "StoredChunkOptions" = betterproto.message_field(4) + """Optional. Options for reading stored chunks from state layer.""" + @dataclass(eq=False, repr=False) class LensOverlayServerClusterInfoRequest(betterproto.Message): @@ -1088,6 +1517,15 @@ class LensOverlayServerClusterInfoRequest(betterproto.Message): Whether to return a search session id alongside the server session id. """ + surface: "Surface" = betterproto.enum_field(2) + """The client surface.""" + + platform: "Platform" = betterproto.enum_field(3) + """The client platform.""" + + rendering_context: "RenderingContext" = betterproto.message_field(4) + """The rendering context.""" + @dataclass(eq=False, repr=False) class LensOverlayServerClusterInfoResponse(betterproto.Message): @@ -1105,12 +1543,35 @@ class LensOverlayServerClusterInfoResponse(betterproto.Message): class LensOverlayServerError(betterproto.Message): """ An error encountered while handling a request. - Next ID: 2 + Next ID: 4 """ error_type: "LensOverlayServerErrorErrorType" = betterproto.enum_field(1) """The error type.""" + missing_chunks_metadata: "MissingChunksMetadata" = betterproto.message_field(2) + """The metadata for missing chunks.""" + + +@dataclass(eq=False, repr=False) +class MissingChunksMetadata(betterproto.Message): + """ + Metadata for missing chunks. + Next ID: 3 + """ + + has_chunk_metadata: bool = betterproto.bool_field(1) + """ + Whether the chunk metadata is missing. Used to verify if + the ObjectInteractionRequest was routed to the correct task. + If true, the read hit the correct task, and clients should reupload + the missing chunks reported. + If false, the read hit the wrong task, so clients should retry the read. + """ + + missing_chunk_ids: List[int] = betterproto.int64_field(2) + """The ids of the missing chunks.""" + @dataclass(eq=False, repr=False) class LensOverlayServerRequest(betterproto.Message): @@ -1171,68 +1632,3 @@ class LensOverlayVideoParams(betterproto.Message): betterproto.message_field(1) ) """Video context params from input.""" - - -@dataclass(eq=False, repr=False) -class LensOverlayVisualSearchInteractionLogData(betterproto.Message): - """Log data for a Lens Overlay visual search interaction.""" - - filter_data: "FilterData" = betterproto.message_field(1) - """Filter related metadata.""" - - user_selection_data: "UserSelectionData" = betterproto.message_field(2) - """User Selection metadata.""" - - is_parent_query: bool = betterproto.bool_field(3) - """Whether the query is a parent query.""" - - client_platform: "ClientPlatform" = betterproto.enum_field(4) - """The client platform this query was originated from.""" - - -@dataclass(eq=False, repr=False) -class FilterData(betterproto.Message): - """ - Filter data. - Next ID: 2 - """ - - filter_type: "LensOverlayFilterType" = betterproto.enum_field(1) - """ - The filter type associated with this interaction (auto, translate, etc.). - """ - - -@dataclass(eq=False, repr=False) -class UserSelectionData(betterproto.Message): - """ - User selection data. - Next ID: 2 - """ - - selection_type: "LensOverlaySelectionType" = betterproto.enum_field(1) - """ - The selection type associated with this interaction (e.g. region search). - """ - - -@dataclass(eq=False, repr=False) -class LensOverlayVisualSearchInteractionData(betterproto.Message): - """Metadata associated with a Lens Visual Search request.""" - - interaction_type: "LensOverlayInteractionRequestMetadataType" = ( - betterproto.enum_field(1) - ) - """The type of interaction.""" - - zoomed_crop: "ZoomedCrop" = betterproto.message_field(7) - """The selected region for this interaction, instead of the object id.""" - - object_id: str = betterproto.string_field(3) - """ - The selected object id for this interaction, instead of the zoomed crop. - Currently unsupported and should not be populated. - """ - - log_data: "LensOverlayVisualSearchInteractionLogData" = betterproto.message_field(5) - """Logging-specific data."""