Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip.
| 11291 | # Experimental: this type is part of an experimental API and may change or be removed. |
| 11292 | @dataclass |
| 11293 | class LogRequest: |
| 11294 | """Message text, optional severity level, persistence flag, optional follow-up URL, and |
| 11295 | optional tip. |
| 11296 | """ |
| 11297 | message: str |
| 11298 | """Human-readable message""" |
| 11299 | |
| 11300 | ephemeral: bool | None = None |
| 11301 | """When true, the message is transient and not persisted to the session event log on disk""" |
| 11302 | |
| 11303 | level: SessionLogLevel | None = None |
| 11304 | """Log severity level. Determines how the message is displayed in the timeline. Defaults to |
| 11305 | "info". |
| 11306 | """ |
| 11307 | tip: str | None = None |
| 11308 | """Optional actionable tip displayed alongside the message. Only honored on `level: "info"`.""" |
| 11309 | |
| 11310 | type: str | None = None |
| 11311 | """Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps |
| 11312 | to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". |
| 11313 | """ |
| 11314 | url: str | None = None |
| 11315 | """Optional URL the user can open in their browser for more details""" |
| 11316 | |
| 11317 | @staticmethod |
| 11318 | def from_dict(obj: Any) -> 'LogRequest': |
| 11319 | assert isinstance(obj, dict) |
| 11320 | message = from_str(obj.get("message")) |
| 11321 | ephemeral = from_union([from_bool, from_none], obj.get("ephemeral")) |
| 11322 | level = from_union([SessionLogLevel, from_none], obj.get("level")) |
| 11323 | tip = from_union([from_str, from_none], obj.get("tip")) |
| 11324 | type = from_union([from_str, from_none], obj.get("type")) |
| 11325 | url = from_union([from_str, from_none], obj.get("url")) |
| 11326 | return LogRequest(message, ephemeral, level, tip, type, url) |
| 11327 | |
| 11328 | def to_dict(self) -> dict: |
| 11329 | result: dict = {} |
| 11330 | result["message"] = from_str(self.message) |
| 11331 | if self.ephemeral is not None: |
| 11332 | result["ephemeral"] = from_union([from_bool, from_none], self.ephemeral) |
| 11333 | if self.level is not None: |
| 11334 | result["level"] = from_union([lambda x: to_enum(SessionLogLevel, x), from_none], self.level) |
| 11335 | if self.tip is not None: |
| 11336 | result["tip"] = from_union([from_str, from_none], self.tip) |
| 11337 | if self.type is not None: |
| 11338 | result["type"] = from_union([from_str, from_none], self.type) |
| 11339 | if self.url is not None: |
| 11340 | result["url"] = from_union([from_str, from_none], self.url) |
| 11341 | return result |
| 11342 | |
| 11343 | # Experimental: this type is part of an experimental API and may change or be removed. |
| 11344 | @dataclass |