mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
regenerate from cloud 733acc2f6d
This commit is contained in:
@@ -2223,6 +2223,7 @@ pkg/hanzoai/cloud/models/series_point.py
|
||||
pkg/hanzoai/cloud/models/session_detail.py
|
||||
pkg/hanzoai/cloud/models/session_ended.py
|
||||
pkg/hanzoai/cloud/models/session_list.py
|
||||
pkg/hanzoai/cloud/models/session_progress.py
|
||||
pkg/hanzoai/cloud/models/session_user.py
|
||||
pkg/hanzoai/cloud/models/session_view.py
|
||||
pkg/hanzoai/cloud/models/set_env_req.py
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
ref=3f82fe0da0317de62e734b2d9f1741e4f50e12b9
|
||||
sha256=30edce7ee166dae17f685f16e385627c313126ede7e6c0a0b4ebad1c1839a199
|
||||
ref=733acc2f6dc56a2ec0dd6baccc647749215c3181
|
||||
sha256=70d0f975d783aebae756b393e97355cfc39910867519139b3a1bc443644ec560
|
||||
repo=hanzo-inc/cloud
|
||||
path=openapi.yaml
|
||||
|
||||
@@ -2246,6 +2246,7 @@ __all__ = [
|
||||
"SessionDetail",
|
||||
"SessionEnded",
|
||||
"SessionList",
|
||||
"SessionProgress",
|
||||
"SessionUser",
|
||||
"SessionView",
|
||||
"SetEnvReq",
|
||||
@@ -4709,6 +4710,7 @@ from hanzoai.cloud.models.series_point import SeriesPoint as SeriesPoint
|
||||
from hanzoai.cloud.models.session_detail import SessionDetail as SessionDetail
|
||||
from hanzoai.cloud.models.session_ended import SessionEnded as SessionEnded
|
||||
from hanzoai.cloud.models.session_list import SessionList as SessionList
|
||||
from hanzoai.cloud.models.session_progress import SessionProgress as SessionProgress
|
||||
from hanzoai.cloud.models.session_user import SessionUser as SessionUser
|
||||
from hanzoai.cloud.models.session_view import SessionView as SessionView
|
||||
from hanzoai.cloud.models.set_env_req import SetEnvReq as SetEnvReq
|
||||
|
||||
@@ -44,6 +44,7 @@ from hanzoai.cloud.models.routed_run_out import RoutedRunOut
|
||||
from hanzoai.cloud.models.run_list import RunList
|
||||
from hanzoai.cloud.models.session_detail import SessionDetail
|
||||
from hanzoai.cloud.models.session_list import SessionList
|
||||
from hanzoai.cloud.models.session_progress import SessionProgress
|
||||
from hanzoai.cloud.models.session_view import SessionView
|
||||
from hanzoai.cloud.models.target_deleted import TargetDeleted
|
||||
from hanzoai.cloud.models.target_list import TargetList
|
||||
@@ -4308,6 +4309,267 @@ class AgentsApi:
|
||||
|
||||
|
||||
|
||||
@validate_call
|
||||
def get_agents_sessions_by_id_progress(
|
||||
self,
|
||||
id: Annotated[StrictStr, Field(description="ID is the session to act on, from the path.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> SessionProgress:
|
||||
"""Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now.
|
||||
|
||||
Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now. It is a MODEL ESTIMATE read off the run's own transcript, not a measurement — `estimated` says so on every answer, and a run whose progress cannot be told reports phase \"unknown\" with no percentage rather than a zero it does not mean. A session that has already finished answers from its own status instead, and is marked not estimated. The list and detail reads carry the same value; this address is the one that WAITS. Where the stored estimate has gone stale it is remade before answering, so a human deciding whether to step into a run gets a current reading rather than the last poll's — which costs one small completion, charged to the same wallet the session already names, at most once every thirty seconds per run.
|
||||
|
||||
:param id: ID is the session to act on, from the path. (required)
|
||||
:type id: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._get_agents_sessions_by_id_progress_serialize(
|
||||
id=id,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "SessionProgress",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
).data
|
||||
|
||||
|
||||
@validate_call
|
||||
def get_agents_sessions_by_id_progress_with_http_info(
|
||||
self,
|
||||
id: Annotated[StrictStr, Field(description="ID is the session to act on, from the path.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[SessionProgress]:
|
||||
"""Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now.
|
||||
|
||||
Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now. It is a MODEL ESTIMATE read off the run's own transcript, not a measurement — `estimated` says so on every answer, and a run whose progress cannot be told reports phase \"unknown\" with no percentage rather than a zero it does not mean. A session that has already finished answers from its own status instead, and is marked not estimated. The list and detail reads carry the same value; this address is the one that WAITS. Where the stored estimate has gone stale it is remade before answering, so a human deciding whether to step into a run gets a current reading rather than the last poll's — which costs one small completion, charged to the same wallet the session already names, at most once every thirty seconds per run.
|
||||
|
||||
:param id: ID is the session to act on, from the path. (required)
|
||||
:type id: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._get_agents_sessions_by_id_progress_serialize(
|
||||
id=id,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "SessionProgress",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
)
|
||||
|
||||
|
||||
@validate_call
|
||||
def get_agents_sessions_by_id_progress_without_preload_content(
|
||||
self,
|
||||
id: Annotated[StrictStr, Field(description="ID is the session to act on, from the path.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now.
|
||||
|
||||
Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now. It is a MODEL ESTIMATE read off the run's own transcript, not a measurement — `estimated` says so on every answer, and a run whose progress cannot be told reports phase \"unknown\" with no percentage rather than a zero it does not mean. A session that has already finished answers from its own status instead, and is marked not estimated. The list and detail reads carry the same value; this address is the one that WAITS. Where the stored estimate has gone stale it is remade before answering, so a human deciding whether to step into a run gets a current reading rather than the last poll's — which costs one small completion, charged to the same wallet the session already names, at most once every thirty seconds per run.
|
||||
|
||||
:param id: ID is the session to act on, from the path. (required)
|
||||
:type id: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._get_agents_sessions_by_id_progress_serialize(
|
||||
id=id,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "SessionProgress",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _get_agents_sessions_by_id_progress_serialize(
|
||||
self,
|
||||
id,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
_host_index,
|
||||
) -> RequestSerialized:
|
||||
|
||||
_host = None
|
||||
|
||||
_collection_formats: Dict[str, str] = {
|
||||
}
|
||||
|
||||
_path_params: Dict[str, str] = {}
|
||||
_query_params: List[Tuple[str, str]] = []
|
||||
_header_params: Dict[str, Optional[str]] = _headers or {}
|
||||
_form_params: List[Tuple[str, str]] = []
|
||||
_files: Dict[
|
||||
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
||||
] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if id is not None:
|
||||
_path_params['id'] = id
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
if 'Accept' not in _header_params:
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
'bearer'
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/v1/agents/sessions/{id}/progress',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
body=_body_params,
|
||||
post_params=_form_params,
|
||||
files=_files,
|
||||
auth_settings=_auth_settings,
|
||||
collection_formats=_collection_formats,
|
||||
_host=_host,
|
||||
_request_auth=_request_auth
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@validate_call
|
||||
def get_agents_sessions_by_id_tree(
|
||||
self,
|
||||
|
||||
@@ -2115,6 +2115,7 @@ from hanzoai.cloud.models.series_point import SeriesPoint
|
||||
from hanzoai.cloud.models.session_detail import SessionDetail
|
||||
from hanzoai.cloud.models.session_ended import SessionEnded
|
||||
from hanzoai.cloud.models.session_list import SessionList
|
||||
from hanzoai.cloud.models.session_progress import SessionProgress
|
||||
from hanzoai.cloud.models.session_user import SessionUser
|
||||
from hanzoai.cloud.models.session_view import SessionView
|
||||
from hanzoai.cloud.models.set_env_req import SetEnvReq
|
||||
|
||||
@@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, Strict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from hanzoai.cloud.models.event_view import EventView
|
||||
from hanzoai.cloud.models.last_event_view import LastEventView
|
||||
from hanzoai.cloud.models.session_progress import SessionProgress
|
||||
from hanzoai.cloud.models.session_view import SessionView
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
@@ -43,6 +44,7 @@ class SessionDetail(BaseModel):
|
||||
last_event: Optional[LastEventView] = Field(default=None, alias="lastEvent")
|
||||
org: Optional[StrictStr] = None
|
||||
parent_session_id: Optional[StrictStr] = Field(default=None, alias="parentSessionId")
|
||||
progress: Optional[SessionProgress] = None
|
||||
project: Optional[StrictStr] = None
|
||||
provider: Optional[StrictStr] = None
|
||||
published: Optional[StrictBool] = None
|
||||
@@ -58,7 +60,7 @@ class SessionDetail(BaseModel):
|
||||
terminal: Optional[StrictStr] = None
|
||||
title: Optional[StrictStr] = None
|
||||
updated_at: Optional[StrictStr] = Field(default=None, alias="updatedAt")
|
||||
__properties: ClassVar[List[str]] = ["account", "actor", "agent", "childSessions", "children", "createdAt", "cwd", "endedAt", "events", "host", "id", "lastEvent", "org", "parentSessionId", "project", "provider", "published", "recentEvents", "repo", "room", "rootSessionId", "startedAt", "status", "target", "taskRunId", "taskWorkflowId", "terminal", "title", "updatedAt"]
|
||||
__properties: ClassVar[List[str]] = ["account", "actor", "agent", "childSessions", "children", "createdAt", "cwd", "endedAt", "events", "host", "id", "lastEvent", "org", "parentSessionId", "progress", "project", "provider", "published", "recentEvents", "repo", "room", "rootSessionId", "startedAt", "status", "target", "taskRunId", "taskWorkflowId", "terminal", "title", "updatedAt"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@@ -109,6 +111,9 @@ class SessionDetail(BaseModel):
|
||||
# override the default output from pydantic by calling `to_dict()` of last_event
|
||||
if self.last_event:
|
||||
_dict['lastEvent'] = self.last_event.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of progress
|
||||
if self.progress:
|
||||
_dict['progress'] = self.progress.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in recent_events (list)
|
||||
_items = []
|
||||
if self.recent_events:
|
||||
@@ -142,6 +147,7 @@ class SessionDetail(BaseModel):
|
||||
"lastEvent": LastEventView.from_dict(obj["lastEvent"]) if obj.get("lastEvent") is not None else None,
|
||||
"org": obj.get("org"),
|
||||
"parentSessionId": obj.get("parentSessionId"),
|
||||
"progress": SessionProgress.from_dict(obj["progress"]) if obj.get("progress") is not None else None,
|
||||
"project": obj.get("project"),
|
||||
"provider": obj.get("provider"),
|
||||
"published": obj.get("published"),
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Hanzo Cloud API
|
||||
|
||||
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
||||
|
||||
The version of the OpenAPI document: v1
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class SessionProgress(BaseModel):
|
||||
"""
|
||||
SessionProgress
|
||||
""" # noqa: E501
|
||||
activity: Optional[StrictStr] = Field(default=None, description="Activity is the one line saying what the run is doing right now (\"running the reaper's tests\"), up to 120 characters, in the model's words. Empty when nothing has estimated it yet.")
|
||||
at: Optional[StrictStr] = Field(default=None, description="At is when this was determined, RFC 3339 in UTC to the second. Read it as the estimate's AGE: an estimate is not refreshed while nothing has happened, and a stale one beside a run that is still moving is itself worth seeing. Empty when nothing has estimated it yet.")
|
||||
estimated: Optional[StrictBool] = Field(default=None, description="Estimated says a MODEL produced this, from the run's transcript, and it may be wrong. False means the session's own row said it: a finished run is 100% because it finished, not because anything guessed. Never treat a true here as a measurement — it is the reason to look, not the answer.")
|
||||
pct: Optional[StrictInt] = Field(default=None, description="Pct is how much of the run is done, 0 to 100. THE KEY IS ABSENT when progress is indeterminate — a run nobody can estimate is not a run that has done nothing, and rendering the second for the first is the mistake this omission exists to make impossible. Read `phase` before reaching for it.")
|
||||
phase: Optional[StrictStr] = Field(default=None, description="Phase is what shape the run is in: running, blocked, done, error, or unknown when nothing has estimated it yet. blocked means the transcript shows the run waiting on something — an approval, a credential, an answer — which is the one state the running surface cannot report about itself. error only ever comes from the session's own terminal status.")
|
||||
__properties: ClassVar[List[str]] = ["activity", "at", "estimated", "pct", "phase"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SessionProgress from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SessionProgress from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"activity": obj.get("activity"),
|
||||
"at": obj.get("at"),
|
||||
"estimated": obj.get("estimated"),
|
||||
"pct": obj.get("pct"),
|
||||
"phase": obj.get("phase")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import json
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from hanzoai.cloud.models.last_event_view import LastEventView
|
||||
from hanzoai.cloud.models.session_progress import SessionProgress
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@@ -40,6 +41,7 @@ class SessionView(BaseModel):
|
||||
last_event: Optional[LastEventView] = Field(default=None, description="LastEvent is the compact latest-activity line for the list projection (nil in register/patch/tree responses; set by list + detail). It lets a swipe card show a live one-line preview without fetching full detail.", alias="lastEvent")
|
||||
org: Optional[StrictStr] = Field(default=None, description="Org is the caller's OWN tenant, echoed so a client can build the public build URL (/builds/:org/:project) without a second call or a guess. It is never another tenant's — every read is org-scoped before it gets here.")
|
||||
parent_session_id: Optional[StrictStr] = Field(default=None, description="ParentSessionID is the session that spawned this one, making this a subagent of it. Empty means this session is a root — a flow of its own. A parent always belongs to the same org, so a tree never crosses a tenant.", alias="parentSessionId")
|
||||
progress: Optional[SessionProgress] = Field(default=None, description="Progress is how far along this run is — a share of its goal, a phase, and a line saying what it is doing. Always present, so a board never branches on whether it is there; `phase` says \"unknown\" when nothing has estimated it. It is a MODEL ESTIMATE wherever `estimated` is true, and the row's own word where it is false. See progress.go.")
|
||||
project: Optional[StrictStr] = Field(default=None, description="The readable build: the product this session built and whether its story is public (provenance.go).")
|
||||
provider: Optional[StrictStr] = Field(default=None, description="Provider is the linked AI account's provider (claude | codex | hanzo | …) that served this run. Empty when the surface did not say.")
|
||||
published: Optional[StrictBool] = Field(default=None, description="Published is the author's decision to let anyone read this session's story at the public build route. It only ever widens READ access to a session that already exists and grants nothing else; false, an unpublished session is invisible there no matter who asks. It cannot be true without a Project, because that route is keyed on (org, project).")
|
||||
@@ -54,7 +56,7 @@ class SessionView(BaseModel):
|
||||
terminal: Optional[StrictStr] = Field(default=None, description="Terminal is where this session can be WATCHED — the URL the machine published for its live terminal. Omitted when it publishes none.")
|
||||
title: Optional[StrictStr] = Field(default=None, description="Title is the human line a card shows (\"ship the landing page\"), up to 512 characters. Free text, and the one field a surface may rewrite as the work turns out to be something else.")
|
||||
updated_at: Optional[StrictStr] = Field(default=None, description="UpdatedAt is the session's last-activity clock, same format. It moves on a write to the row — a status, a title, a re-dispatch — AND on every appended turn, because the append bumps it in the same transaction. The list is ordered on CreatedAt, so this is the field that says whether a session is still saying anything.", alias="updatedAt")
|
||||
__properties: ClassVar[List[str]] = ["account", "actor", "agent", "children", "createdAt", "cwd", "endedAt", "events", "host", "id", "lastEvent", "org", "parentSessionId", "project", "provider", "published", "repo", "room", "rootSessionId", "startedAt", "status", "target", "taskRunId", "taskWorkflowId", "terminal", "title", "updatedAt"]
|
||||
__properties: ClassVar[List[str]] = ["account", "actor", "agent", "children", "createdAt", "cwd", "endedAt", "events", "host", "id", "lastEvent", "org", "parentSessionId", "progress", "project", "provider", "published", "repo", "room", "rootSessionId", "startedAt", "status", "target", "taskRunId", "taskWorkflowId", "terminal", "title", "updatedAt"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@@ -98,6 +100,9 @@ class SessionView(BaseModel):
|
||||
# override the default output from pydantic by calling `to_dict()` of last_event
|
||||
if self.last_event:
|
||||
_dict['lastEvent'] = self.last_event.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of progress
|
||||
if self.progress:
|
||||
_dict['progress'] = self.progress.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
@@ -123,6 +128,7 @@ class SessionView(BaseModel):
|
||||
"lastEvent": LastEventView.from_dict(obj["lastEvent"]) if obj.get("lastEvent") is not None else None,
|
||||
"org": obj.get("org"),
|
||||
"parentSessionId": obj.get("parentSessionId"),
|
||||
"progress": SessionProgress.from_dict(obj["progress"]) if obj.get("progress") is not None else None,
|
||||
"project": obj.get("project"),
|
||||
"provider": obj.get("provider"),
|
||||
"published": obj.get("published"),
|
||||
|
||||
Reference in New Issue
Block a user