agentstack-sdk 0.5.1rc3__tar.gz → 0.5.2rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/PKG-INFO +1 -1
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/pyproject.toml +1 -1
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/context.py +26 -10
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/context.py +23 -4
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/store/context_store.py +8 -1
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/store/memory_context_store.py +21 -5
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/store/platform_context_store.py +13 -3
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/utils.py +5 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/README.md +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/oauth/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/oauth/oauth.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/oauth/storage/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/oauth/storage/base.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/oauth/storage/memory.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/secrets/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/auth/secrets/secrets.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/base.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/common/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/common/form.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/exceptions.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/interactions/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/interactions/approval.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/services/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/services/embedding.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/services/form.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/services/llm.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/services/mcp.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/services/platform.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/tools/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/tools/call.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/tools/exceptions.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/agent_detail.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/canvas.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/citation.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/error.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/form_request.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/settings.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/trajectory.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/types.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/client.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/common.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/configuration.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/file.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/model_provider.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/provider.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/provider_build.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/types.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/user.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/user_feedback.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/variables.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/vector_store.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/py.typed +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/agent.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/app.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/constants.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/dependencies.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/exceptions.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/middleware/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/middleware/platform_auth_backend.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/server.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/store/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/telemetry.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/utils.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/types.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/__init__.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/file.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/httpx.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/logging.py +0 -0
- {agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/resource_context.py +0 -0
|
@@ -5,25 +5,29 @@ from __future__ import annotations
|
|
|
5
5
|
|
|
6
6
|
from collections.abc import AsyncIterator
|
|
7
7
|
from typing import Literal
|
|
8
|
-
from uuid import UUID
|
|
8
|
+
from uuid import UUID, uuid4
|
|
9
9
|
|
|
10
10
|
import pydantic
|
|
11
11
|
from a2a.types import Artifact, Message
|
|
12
|
-
from pydantic import AwareDatetime, BaseModel, SerializeAsAny
|
|
12
|
+
from pydantic import AwareDatetime, BaseModel, Field, SerializeAsAny, computed_field
|
|
13
13
|
|
|
14
14
|
from agentstack_sdk.platform.client import PlatformClient, get_platform_client
|
|
15
15
|
from agentstack_sdk.platform.common import PaginatedResult
|
|
16
16
|
from agentstack_sdk.platform.provider import Provider
|
|
17
17
|
from agentstack_sdk.platform.types import Metadata, MetadataPatch
|
|
18
|
-
from agentstack_sdk.util.utils import filter_dict
|
|
18
|
+
from agentstack_sdk.util.utils import filter_dict, utc_now
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class ContextHistoryItem(BaseModel):
|
|
22
|
-
id: UUID
|
|
22
|
+
id: UUID = Field(default_factory=uuid4)
|
|
23
23
|
data: Artifact | Message
|
|
24
|
-
created_at: AwareDatetime
|
|
25
|
-
context_id:
|
|
26
|
-
|
|
24
|
+
created_at: AwareDatetime = Field(default_factory=utc_now)
|
|
25
|
+
context_id: str
|
|
26
|
+
|
|
27
|
+
@computed_field
|
|
28
|
+
@property
|
|
29
|
+
def kind(self) -> Literal["message", "artifact"]:
|
|
30
|
+
return getattr(self.data, "kind", "artifact")
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
class ContextToken(pydantic.BaseModel):
|
|
@@ -49,9 +53,6 @@ class Permissions(ContextPermissions):
|
|
|
49
53
|
provider_variables: set[Literal["read", "write", "*"]] = set()
|
|
50
54
|
|
|
51
55
|
contexts: set[Literal["read", "write", "*"]] = set()
|
|
52
|
-
mcp_providers: set[Literal["read", "write", "*"]] = set()
|
|
53
|
-
mcp_tools: set[Literal["read", "*"]] = set()
|
|
54
|
-
mcp_proxy: set[Literal["*"]] = set()
|
|
55
56
|
|
|
56
57
|
connectors: set[Literal["read", "write", "proxy", "*"]] = set()
|
|
57
58
|
|
|
@@ -238,6 +239,21 @@ class Context(pydantic.BaseModel):
|
|
|
238
239
|
)
|
|
239
240
|
).raise_for_status()
|
|
240
241
|
|
|
242
|
+
async def delete_history_from_id(
|
|
243
|
+
self: Context | str,
|
|
244
|
+
*,
|
|
245
|
+
from_id: UUID | str,
|
|
246
|
+
client: PlatformClient | None = None,
|
|
247
|
+
) -> None:
|
|
248
|
+
"""Delete all history items from a specific item onwards (inclusive)"""
|
|
249
|
+
target_context_id = self if isinstance(self, str) else self.id
|
|
250
|
+
async with client or get_platform_client() as platform_client:
|
|
251
|
+
_ = (
|
|
252
|
+
await platform_client.delete(
|
|
253
|
+
url=f"/api/v1/contexts/{target_context_id}/history", params={"from_id": str(from_id)}
|
|
254
|
+
)
|
|
255
|
+
).raise_for_status()
|
|
256
|
+
|
|
241
257
|
async def list_history(
|
|
242
258
|
self: Context | str,
|
|
243
259
|
*,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from
|
|
4
|
+
from collections.abc import AsyncGenerator
|
|
5
|
+
from typing import Literal, overload
|
|
6
|
+
from uuid import UUID
|
|
6
7
|
|
|
7
8
|
import janus
|
|
8
9
|
from a2a.types import Artifact, Message, MessageSendConfiguration, Task
|
|
9
10
|
from pydantic import BaseModel, PrivateAttr
|
|
10
11
|
|
|
11
12
|
from agentstack_sdk.a2a.types import RunYield, RunYieldResume
|
|
13
|
+
from agentstack_sdk.platform.context import ContextHistoryItem
|
|
12
14
|
from agentstack_sdk.server.store.context_store import ContextStoreInstance
|
|
13
15
|
|
|
14
16
|
|
|
@@ -30,12 +32,29 @@ class RunContext(BaseModel, arbitrary_types_allowed=True):
|
|
|
30
32
|
data = data.model_copy(deep=True, update={"context_id": self.context_id, "task_id": self.task_id})
|
|
31
33
|
await self._store.store(data)
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
@overload
|
|
36
|
+
async def load_history(
|
|
37
|
+
self, load_history_items: Literal[False] = False
|
|
38
|
+
) -> AsyncGenerator[Message | Artifact, None]:
|
|
39
|
+
yield ... # type: ignore
|
|
40
|
+
|
|
41
|
+
@overload
|
|
42
|
+
async def load_history(self, load_history_items: Literal[True]) -> AsyncGenerator[ContextHistoryItem, None]:
|
|
43
|
+
yield ... # type: ignore
|
|
44
|
+
|
|
45
|
+
async def load_history(
|
|
46
|
+
self, load_history_items: bool = False
|
|
47
|
+
) -> AsyncGenerator[ContextHistoryItem | Message | Artifact]:
|
|
34
48
|
if not self._store:
|
|
35
49
|
raise RuntimeError("Context store is not initialized")
|
|
36
|
-
async for item in self._store.load_history():
|
|
50
|
+
async for item in self._store.load_history(load_history_items=load_history_items):
|
|
37
51
|
yield item
|
|
38
52
|
|
|
53
|
+
async def delete_history_from_id(self, from_id: UUID) -> None:
|
|
54
|
+
if not self._store:
|
|
55
|
+
raise RuntimeError("Context store is not initialized")
|
|
56
|
+
await self._store.delete_history_from_id(from_id)
|
|
57
|
+
|
|
39
58
|
def yield_sync(self, value: RunYield) -> RunYieldResume:
|
|
40
59
|
self._yield_queue.sync_q.put(value)
|
|
41
60
|
return self._yield_resume_queue.sync_q.get()
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/store/context_store.py
RENAMED
|
@@ -6,19 +6,26 @@ from __future__ import annotations
|
|
|
6
6
|
import abc
|
|
7
7
|
from collections.abc import AsyncIterator
|
|
8
8
|
from typing import TYPE_CHECKING, Protocol
|
|
9
|
+
from uuid import UUID
|
|
9
10
|
|
|
10
11
|
from a2a.types import Artifact, Message
|
|
11
12
|
|
|
13
|
+
from agentstack_sdk.platform.context import ContextHistoryItem
|
|
14
|
+
|
|
12
15
|
if TYPE_CHECKING:
|
|
13
16
|
from agentstack_sdk.server.dependencies import Dependency, Depends
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
class ContextStoreInstance(Protocol):
|
|
17
|
-
async def load_history(
|
|
20
|
+
async def load_history(
|
|
21
|
+
self, load_history_items: bool = False
|
|
22
|
+
) -> AsyncIterator[ContextHistoryItem | Message | Artifact]:
|
|
18
23
|
yield ... # type: ignore
|
|
19
24
|
|
|
20
25
|
async def store(self, data: Message | Artifact) -> None: ...
|
|
21
26
|
|
|
27
|
+
async def delete_history_from_id(self, from_id: UUID) -> None: ...
|
|
28
|
+
|
|
22
29
|
|
|
23
30
|
class ContextStore(abc.ABC):
|
|
24
31
|
def modify_dependencies(self, dependencies: dict[str, Depends]) -> None:
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
from collections.abc import AsyncIterator
|
|
5
5
|
from datetime import timedelta
|
|
6
|
+
from uuid import UUID
|
|
6
7
|
|
|
7
8
|
from a2a.types import Artifact, Message
|
|
8
9
|
from cachetools import TTLCache
|
|
9
10
|
|
|
11
|
+
from agentstack_sdk.platform.context import ContextHistoryItem
|
|
10
12
|
from agentstack_sdk.server.dependencies import Dependency
|
|
11
13
|
from agentstack_sdk.server.store.context_store import ContextStore, ContextStoreInstance
|
|
12
14
|
|
|
@@ -14,14 +16,28 @@ from agentstack_sdk.server.store.context_store import ContextStore, ContextStore
|
|
|
14
16
|
class MemoryContextStoreInstance(ContextStoreInstance):
|
|
15
17
|
def __init__(self, context_id: str):
|
|
16
18
|
self.context_id = context_id
|
|
17
|
-
self._history: list[
|
|
19
|
+
self._history: list[ContextHistoryItem] = []
|
|
18
20
|
|
|
19
|
-
async def load_history(
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
async def load_history(
|
|
22
|
+
self, load_history_items: bool = False
|
|
23
|
+
) -> AsyncIterator[ContextHistoryItem | Message | Artifact]:
|
|
24
|
+
for item in self._history.copy():
|
|
25
|
+
if load_history_items:
|
|
26
|
+
yield item.model_copy(deep=True)
|
|
27
|
+
else:
|
|
28
|
+
yield item.data.model_copy(deep=True)
|
|
22
29
|
|
|
23
30
|
async def store(self, data: Message | Artifact) -> None:
|
|
24
|
-
self._history.append(data.model_copy(deep=True))
|
|
31
|
+
self._history.append(ContextHistoryItem(data=data.model_copy(deep=True), context_id=self.context_id))
|
|
32
|
+
|
|
33
|
+
async def delete_history_from_id(self, from_id: UUID) -> None:
|
|
34
|
+
# Does not allow to delete from an artifact onwards
|
|
35
|
+
index = next(
|
|
36
|
+
(i for i, item in enumerate(self._history) if item.id == from_id),
|
|
37
|
+
None,
|
|
38
|
+
)
|
|
39
|
+
if index is not None:
|
|
40
|
+
self._history = self._history[:index]
|
|
25
41
|
|
|
26
42
|
|
|
27
43
|
class InMemoryContextStore(ContextStore):
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
from collections.abc import AsyncIterator
|
|
5
|
+
from uuid import UUID
|
|
5
6
|
|
|
6
7
|
from a2a.types import Artifact, Message
|
|
7
8
|
|
|
@@ -9,7 +10,7 @@ from agentstack_sdk.a2a.extensions.services.platform import (
|
|
|
9
10
|
PlatformApiExtensionServer,
|
|
10
11
|
PlatformApiExtensionSpec,
|
|
11
12
|
)
|
|
12
|
-
from agentstack_sdk.platform.context import Context
|
|
13
|
+
from agentstack_sdk.platform.context import Context, ContextHistoryItem
|
|
13
14
|
from agentstack_sdk.server.constants import _IMPLICIT_DEPENDENCY_PREFIX
|
|
14
15
|
from agentstack_sdk.server.dependencies import Dependency, Depends
|
|
15
16
|
from agentstack_sdk.server.store.context_store import ContextStore, ContextStoreInstance
|
|
@@ -38,11 +39,20 @@ class PlatformContextStoreInstance(ContextStoreInstance):
|
|
|
38
39
|
self._context_id = context_id
|
|
39
40
|
self._platform_extension = platform_extension
|
|
40
41
|
|
|
41
|
-
async def load_history(
|
|
42
|
+
async def load_history(
|
|
43
|
+
self, load_history_items: bool = False
|
|
44
|
+
) -> AsyncIterator[ContextHistoryItem | Message | Artifact]:
|
|
42
45
|
async with self._platform_extension.use_client():
|
|
43
46
|
async for history_item in Context.list_all_history(self._context_id):
|
|
44
|
-
|
|
47
|
+
if load_history_items:
|
|
48
|
+
yield history_item
|
|
49
|
+
else:
|
|
50
|
+
yield history_item.data
|
|
45
51
|
|
|
46
52
|
async def store(self, data: Message | Artifact) -> None:
|
|
47
53
|
async with self._platform_extension.use_client():
|
|
48
54
|
await Context.add_history_item(self._context_id, data=data)
|
|
55
|
+
|
|
56
|
+
async def delete_history_from_id(self, from_id: UUID) -> None:
|
|
57
|
+
async with self._platform_extension.use_client():
|
|
58
|
+
await Context.delete_history_from_id(self._context_id, from_id=from_id)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import json
|
|
4
4
|
import re
|
|
5
5
|
from collections.abc import AsyncIterator
|
|
6
|
+
from datetime import UTC, datetime
|
|
6
7
|
from typing import Any, TypeVar, cast
|
|
7
8
|
|
|
8
9
|
import httpx
|
|
@@ -40,3 +41,7 @@ def extract_messages(exc: BaseException) -> list[tuple[str, str]]:
|
|
|
40
41
|
return [(exc_type, msg) for e in exc.exceptions for exc_type, msg in extract_messages(e)]
|
|
41
42
|
else:
|
|
42
43
|
return [(type(exc).__name__, str(exc))]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def utc_now() -> datetime:
|
|
47
|
+
return datetime.now(UTC)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/base.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/common/form.py
RENAMED
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/tools/call.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/canvas.py
RENAMED
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/citation.py
RENAMED
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/error.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/a2a/extensions/ui/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/model_provider.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/provider_build.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/user_feedback.py
RENAMED
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/variables.py
RENAMED
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/platform/vector_store.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/dependencies.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/middleware/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/server/store/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentstack_sdk-0.5.1rc3 → agentstack_sdk-0.5.2rc2}/src/agentstack_sdk/util/resource_context.py
RENAMED
|
File without changes
|