acontext 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

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.
@@ -1,198 +0,0 @@
1
- """
2
- Spaces endpoints.
3
- """
4
-
5
- from collections.abc import Mapping
6
- from typing import Any
7
-
8
- from .._utils import build_params
9
- from ..client_types import RequesterProtocol
10
- from ..types.space import (
11
- ExperienceConfirmation,
12
- ListExperienceConfirmationsOutput,
13
- ListSpacesOutput,
14
- Space,
15
- SpaceSearchResult,
16
- )
17
-
18
-
19
- class SpacesAPI:
20
- def __init__(self, requester: RequesterProtocol) -> None:
21
- self._requester = requester
22
-
23
- def list(
24
- self,
25
- *,
26
- user: str | None = None,
27
- limit: int | None = None,
28
- cursor: str | None = None,
29
- time_desc: bool | None = None,
30
- ) -> ListSpacesOutput:
31
- """List all spaces in the project.
32
-
33
- Args:
34
- user: Filter by user identifier. Defaults to None.
35
- limit: Maximum number of spaces to return. Defaults to None.
36
- cursor: Cursor for pagination. Defaults to None.
37
- time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
38
-
39
- Returns:
40
- ListSpacesOutput containing the list of spaces and pagination information.
41
- """
42
- params = build_params(user=user, limit=limit, cursor=cursor, time_desc=time_desc)
43
- data = self._requester.request("GET", "/space", params=params or None)
44
- return ListSpacesOutput.model_validate(data)
45
-
46
- def create(
47
- self,
48
- *,
49
- user: str | None = None,
50
- configs: Mapping[str, Any] | None = None,
51
- ) -> Space:
52
- """Create a new space.
53
-
54
- Args:
55
- user: Optional user identifier string. Defaults to None.
56
- configs: Optional space configuration dictionary. Defaults to None.
57
-
58
- Returns:
59
- The created Space object.
60
- """
61
- payload: dict[str, Any] = {}
62
- if user is not None:
63
- payload["user"] = user
64
- if configs is not None:
65
- payload["configs"] = configs
66
- data = self._requester.request("POST", "/space", json_data=payload)
67
- return Space.model_validate(data)
68
-
69
- def delete(self, space_id: str) -> None:
70
- """Delete a space by its ID.
71
-
72
- Args:
73
- space_id: The UUID of the space to delete.
74
- """
75
- self._requester.request("DELETE", f"/space/{space_id}")
76
-
77
- def update_configs(
78
- self,
79
- space_id: str,
80
- *,
81
- configs: Mapping[str, Any],
82
- ) -> None:
83
- """Update space configurations.
84
-
85
- Args:
86
- space_id: The UUID of the space.
87
- configs: Space configuration dictionary.
88
- """
89
- payload = {"configs": configs}
90
- self._requester.request("PUT", f"/space/{space_id}/configs", json_data=payload)
91
-
92
- def get_configs(self, space_id: str) -> Space:
93
- """Get space configurations.
94
-
95
- Args:
96
- space_id: The UUID of the space.
97
-
98
- Returns:
99
- Space object containing the configurations.
100
- """
101
- data = self._requester.request("GET", f"/space/{space_id}/configs")
102
- return Space.model_validate(data)
103
-
104
- def experience_search(
105
- self,
106
- space_id: str,
107
- *,
108
- query: str,
109
- limit: int | None = None,
110
- mode: str | None = None,
111
- semantic_threshold: float | None = None,
112
- max_iterations: int | None = None,
113
- ) -> SpaceSearchResult:
114
- """Perform experience search within a space.
115
-
116
- This is the most advanced search option that can operate in two modes:
117
- - fast: Quick semantic search (default)
118
- - agentic: Iterative search with AI-powered refinement
119
-
120
- Args:
121
- space_id: The UUID of the space.
122
- query: The search query string.
123
- limit: Maximum number of results to return (1-50, default 10).
124
- mode: Search mode, either "fast" or "agentic" (default "fast").
125
- semantic_threshold: Cosine distance threshold (0=identical, 2=opposite).
126
- max_iterations: Maximum iterations for agentic search (1-100, default 16).
127
-
128
- Returns:
129
- SpaceSearchResult containing cited blocks and optional final answer.
130
- """
131
- params = build_params(
132
- query=query,
133
- limit=limit,
134
- mode=mode,
135
- semantic_threshold=semantic_threshold,
136
- max_iterations=max_iterations,
137
- )
138
- data = self._requester.request(
139
- "GET", f"/space/{space_id}/experience_search", params=params or None
140
- )
141
- return SpaceSearchResult.model_validate(data)
142
-
143
- def get_unconfirmed_experiences(
144
- self,
145
- space_id: str,
146
- *,
147
- limit: int | None = None,
148
- cursor: str | None = None,
149
- time_desc: bool | None = None,
150
- ) -> ListExperienceConfirmationsOutput:
151
- """Get all unconfirmed experiences in a space with cursor-based pagination.
152
-
153
- Args:
154
- space_id: The UUID of the space.
155
- limit: Maximum number of confirmations to return (1-200, default 20).
156
- cursor: Cursor for pagination. Use the cursor from the previous response to get the next page.
157
- time_desc: Order by created_at descending if True, ascending if False (default False).
158
-
159
- Returns:
160
- ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information.
161
- """
162
- params = build_params(limit=limit, cursor=cursor, time_desc=time_desc)
163
- data = self._requester.request(
164
- "GET",
165
- f"/space/{space_id}/experience_confirmations",
166
- params=params or None,
167
- )
168
- return ListExperienceConfirmationsOutput.model_validate(data)
169
-
170
- def confirm_experience(
171
- self,
172
- space_id: str,
173
- experience_id: str,
174
- *,
175
- save: bool,
176
- ) -> ExperienceConfirmation | None:
177
- """Confirm an experience confirmation.
178
-
179
- If save is False, delete the row. If save is True, get the data first,
180
- then delete the row.
181
-
182
- Args:
183
- space_id: The UUID of the space.
184
- experience_id: The UUID of the experience confirmation.
185
- save: If True, get data before deleting. If False, just delete.
186
-
187
- Returns:
188
- ExperienceConfirmation object if save is True, None otherwise.
189
- """
190
- payload = {"save": save}
191
- data = self._requester.request(
192
- "PUT",
193
- f"/space/{space_id}/experience_confirmations/{experience_id}",
194
- json_data=payload,
195
- )
196
- if data is None:
197
- return None
198
- return ExperienceConfirmation.model_validate(data)
acontext/types/block.py DELETED
@@ -1,26 +0,0 @@
1
- """Type definitions for block resources."""
2
-
3
- from typing import Any
4
-
5
- from pydantic import BaseModel, Field
6
-
7
-
8
- class Block(BaseModel):
9
- """Block model representing a block in a space."""
10
-
11
- id: str = Field(..., description="Block UUID")
12
- space_id: str = Field(..., description="Space UUID")
13
- type: str = Field(..., description="Block type: 'page', 'folder', 'text', 'sop', etc.")
14
- parent_id: str | None = Field(None, description="Parent block UUID, optional")
15
- title: str = Field(..., description="Block title")
16
- props: dict[str, Any] = Field(..., description="Block properties dictionary")
17
- sort: int = Field(..., description="Sort order")
18
- is_archived: bool = Field(..., description="Whether the block is archived")
19
- created_at: str = Field(..., description="ISO 8601 formatted creation timestamp")
20
- updated_at: str = Field(..., description="ISO 8601 formatted update timestamp")
21
- children: list["Block"] | None = Field(None, description="List of child blocks, optional")
22
-
23
-
24
- # Rebuild model to resolve forward references
25
- Block.model_rebuild()
26
-
acontext/types/space.py DELETED
@@ -1,70 +0,0 @@
1
- """Type definitions for space resources."""
2
-
3
- from typing import Any
4
-
5
- from pydantic import BaseModel, Field
6
-
7
-
8
- class Space(BaseModel):
9
- """Space model representing a space resource."""
10
-
11
- id: str = Field(..., description="Space UUID")
12
- project_id: str = Field(..., description="Project UUID")
13
- user_id: str | None = Field(None, description="User UUID")
14
- configs: dict[str, Any] | None = Field(
15
- None, description="Space configuration dictionary"
16
- )
17
- created_at: str = Field(..., description="ISO 8601 formatted creation timestamp")
18
- updated_at: str = Field(..., description="ISO 8601 formatted update timestamp")
19
-
20
-
21
- class ListSpacesOutput(BaseModel):
22
- """Response model for listing spaces."""
23
-
24
- items: list[Space] = Field(..., description="List of spaces")
25
- next_cursor: str | None = Field(None, description="Cursor for pagination")
26
- has_more: bool = Field(..., description="Whether there are more items")
27
-
28
-
29
- class SearchResultBlockItem(BaseModel):
30
- """Search result block item model."""
31
-
32
- block_id: str = Field(..., description="Block UUID")
33
- title: str = Field(..., description="Block title")
34
- type: str = Field(..., description="Block type")
35
- props: dict[str, Any] = Field(..., description="Block properties")
36
- distance: float | None = Field(
37
- None, description="Cosine distance (0=identical, 2=opposite)"
38
- )
39
-
40
-
41
- class SpaceSearchResult(BaseModel):
42
- """Experience search result model."""
43
-
44
- cited_blocks: list[SearchResultBlockItem] = Field(
45
- ..., description="List of cited blocks"
46
- )
47
- final_answer: str | None = Field(None, description="AI-generated final answer")
48
-
49
-
50
- class ExperienceConfirmation(BaseModel):
51
- """Experience confirmation model."""
52
-
53
- id: str = Field(..., description="Experience confirmation UUID")
54
- space_id: str = Field(..., description="Space UUID")
55
- task_id: str | None = Field(None, description="Task UUID (optional)")
56
- experience_data: dict[str, Any] = Field(
57
- ..., description="Experience data dictionary"
58
- )
59
- created_at: str = Field(..., description="ISO 8601 formatted creation timestamp")
60
- updated_at: str = Field(..., description="ISO 8601 formatted update timestamp")
61
-
62
-
63
- class ListExperienceConfirmationsOutput(BaseModel):
64
- """Response model for listing experience confirmations."""
65
-
66
- items: list[ExperienceConfirmation] = Field(
67
- ..., description="List of experience confirmations"
68
- )
69
- next_cursor: str | None = Field(None, description="Cursor for pagination")
70
- has_more: bool = Field(..., description="Whether there are more items")
@@ -1,44 +0,0 @@
1
- acontext/__init__.py,sha256=jAgRawWIjyMd6g3gq7Xm_3vNB31cPj8rMFPO4LGQKdM,1027
2
- acontext/_constants.py,sha256=Ikuy_Wz3CPmXjKPLXb4Y580-fe54o1hZ2ZB1Bpw3sFE,363
3
- acontext/_utils.py,sha256=GKQH45arKh0sDu64u-5jwrII_ctnU_oChYlgR5lRkfE,1250
4
- acontext/agent/__init__.py,sha256=0lIRRDk-sCtLelpNiWYIEKzKC5a8bWJge2vp9Wqnibk,157
5
- acontext/agent/base.py,sha256=RcHiWVDJwfkPl_3ycEqFxW3S4pXGTwXo3bV6qzXTkBw,3459
6
- acontext/agent/disk.py,sha256=pIz9xFULG3k0KKSvilz6jZskIvp3mGHhkOxQIUQTNZs,22367
7
- acontext/agent/skill.py,sha256=sPKhnTobE9NG88-OeZFyZLT4jahjTXZsuSy2vD4_NlA,13017
8
- acontext/async_client.py,sha256=0hvkRno72IpwGlHdVd6T8fxXkmSrGuDUzgQOuj6M3NY,8499
9
- acontext/client.py,sha256=FKBKCf7o3kBF_khEEKei3wYu3UgsQoSnGuxT8BbrjrE,8203
10
- acontext/client_types.py,sha256=uVBWzLbZyXrqkljG49ojdQL_xX6N3n_HGt4Bs_TEE48,987
11
- acontext/errors.py,sha256=W9i7_t46q9kbci3XAyZiyQhS154d4R9rSon3na-gjgs,1296
12
- acontext/messages.py,sha256=oNRZStfhcPFt6DPOfs_-Q7R1Xui6dOMr3wmpmC8pzvE,2310
13
- acontext/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- acontext/resources/__init__.py,sha256=AFBNrAev_BL4mO8hUPHHejvkrRQ-23g6q7pnuNYtKyA,1063
15
- acontext/resources/async_blocks.py,sha256=e_iJpgcAdwS2tXQ16MMCnySlddp5JV3BadN_EyqZSF4,5555
16
- acontext/resources/async_disks.py,sha256=rc8hSdVsZ1UbrK2kwxmEMZyP0aEMsvjyZ70cYddpiF8,12051
17
- acontext/resources/async_sandboxes.py,sha256=qIJGotEQjBbDIadcgSfmM_w_Gilv-66HAefvf_7GSgc,1670
18
- acontext/resources/async_sessions.py,sha256=0SuNzuLSG4wKyJa_QCIP5pKkvzW6VDe5yHNRDdqoPrw,16317
19
- acontext/resources/async_skills.py,sha256=VoeqO9Z6E7qPCE2tMJaO7coONaCKCoLJRANQ5yWVbiE,4666
20
- acontext/resources/async_spaces.py,sha256=b8DNG2L43B6iSgfmH8M-0cxAp681IjSCjw-4alfjV2A,6712
21
- acontext/resources/async_tools.py,sha256=RbGaF2kX65Mun-q-Fp5H1J8waWTLIdCOfbdY19jpn1o,1091
22
- acontext/resources/async_users.py,sha256=m0nK_Luo6Uuvw2azGx8Wg2cXnipnTnyheolr79fX16Y,2020
23
- acontext/resources/blocks.py,sha256=HJdAy5HdyTcHCYCPmqNdvApYKZ6aWs-ORIi_wQt3TUM,5447
24
- acontext/resources/disks.py,sha256=YyAzm6A00T4A3dI8YTEAOxwm6bnCnp8gWIoZ4lLGN5w,11859
25
- acontext/resources/sandboxes.py,sha256=bUv6tKopgkvWDqfiIrL2GozZ2cClQYvQftPb_5n_XXA,1611
26
- acontext/resources/sessions.py,sha256=xHvT-CQHXhTc6BHHwpW_jyzMkxccSuTIdpLpTjS_NRc,16056
27
- acontext/resources/skills.py,sha256=ZECLUfy4QWHnzk9nnq1VvEeFTx-u7NvEhECfbq5Reiw,4615
28
- acontext/resources/spaces.py,sha256=Ktvkkn3Jj7CZoKMbn6fYuo0zqImoCWj2EnMsnL2q-0A,6571
29
- acontext/resources/tools.py,sha256=II_185B0HYKSP43hizE6C1zs7kjkkPLKihuEG8s-DRY,1046
30
- acontext/resources/users.py,sha256=6xwU7UeMWRIGn6n7LKgsptV9pzYFNWCbJftieptVg6k,1961
31
- acontext/types/__init__.py,sha256=FTijldVjPDL8EYHau0KppcawReQpNIdxzFiebVBlP0E,2058
32
- acontext/types/block.py,sha256=CzKByunk642rWXNNnh8cx67UzKLKDAxODmC_whwjP90,1078
33
- acontext/types/common.py,sha256=5kLwzszlIofz8qZ9-Wj_zcBBiF22mAWgH9uWPkcgWCE,327
34
- acontext/types/disk.py,sha256=jdQqQ8HF3cwl_Y1dh98TOXZKfcdN_gSzaSrCE8PKT-0,2250
35
- acontext/types/sandbox.py,sha256=EkdfsQUHQ3RxhWfHCC12-CHjIPkBD6bWV_7LSRpEWmI,844
36
- acontext/types/session.py,sha256=JeIlnjT6Gs2t4kZu5DKjus9KeCc-Vgjj7RH1x-JqYyY,11597
37
- acontext/types/skill.py,sha256=VlLp5NpsJSpyoQTlTuV6jJ4G6ArHr1SDpcqEmFkHyeY,2364
38
- acontext/types/space.py,sha256=9BkGBYGeQDVwYTmPLoIjMY-IUdQzjrt8I7CXca2_5Vc,2600
39
- acontext/types/tool.py,sha256=-mVn-vgk2SENK0Ubt-ZgWFZxKa-ddABqcAgXQ69YY-E,805
40
- acontext/types/user.py,sha256=JjE0xZDwUAs2BL741U7NINyyPAso64A1YmgMBPqSuvo,1331
41
- acontext/uploads.py,sha256=6twnqQOY_eerNuEjeSKsE_3S0IfJUiczXtAy4aXqDl8,1379
42
- acontext-0.1.3.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
43
- acontext-0.1.3.dist-info/METADATA,sha256=o3SIxLNV7aNdWnoIddBCeI_EBlMjWphNOTXKzJMr4Z4,888
44
- acontext-0.1.3.dist-info/RECORD,,