acontext 0.1.7__tar.gz → 0.1.9__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.
- {acontext-0.1.7 → acontext-0.1.9}/PKG-INFO +1 -1
- {acontext-0.1.7 → acontext-0.1.9}/pyproject.toml +1 -1
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/async_client.py +0 -2
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/client.py +0 -2
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/__init__.py +0 -4
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/async_sandboxes.py +1 -1
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/async_sessions.py +96 -1
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/sandboxes.py +1 -1
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/sessions.py +96 -1
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/__init__.py +4 -11
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/common.py +7 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/session.py +4 -0
- acontext-0.1.7/src/acontext/resources/async_tools.py +0 -34
- acontext-0.1.7/src/acontext/resources/tools.py +0 -34
- acontext-0.1.7/src/acontext/types/tool.py +0 -25
- {acontext-0.1.7 → acontext-0.1.9}/README.md +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/__init__.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/_constants.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/_utils.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/__init__.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/base.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/disk.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/prompts.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/sandbox.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/skill.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/agent/text_editor.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/client_types.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/errors.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/messages.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/py.typed +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/async_disks.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/async_skills.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/async_users.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/disks.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/skills.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/resources/users.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/disk.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/sandbox.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/skill.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/types/user.py +0 -0
- {acontext-0.1.7 → acontext-0.1.9}/src/acontext/uploads.py +0 -0
|
@@ -15,7 +15,6 @@ from .uploads import FileUpload as FileUpload
|
|
|
15
15
|
from .resources.async_disks import AsyncDisksAPI as AsyncDisksAPI
|
|
16
16
|
from .resources.async_sandboxes import AsyncSandboxesAPI as AsyncSandboxesAPI
|
|
17
17
|
from .resources.async_sessions import AsyncSessionsAPI as AsyncSessionsAPI
|
|
18
|
-
from .resources.async_tools import AsyncToolsAPI as AsyncToolsAPI
|
|
19
18
|
from .resources.async_skills import AsyncSkillsAPI as AsyncSkillsAPI
|
|
20
19
|
from .resources.async_users import AsyncUsersAPI as AsyncUsersAPI
|
|
21
20
|
|
|
@@ -107,7 +106,6 @@ class AcontextAsyncClient:
|
|
|
107
106
|
self.sessions = AsyncSessionsAPI(self)
|
|
108
107
|
self.disks = AsyncDisksAPI(self)
|
|
109
108
|
self.artifacts = self.disks.artifacts
|
|
110
|
-
self.tools = AsyncToolsAPI(self)
|
|
111
109
|
self.skills = AsyncSkillsAPI(self)
|
|
112
110
|
self.users = AsyncUsersAPI(self)
|
|
113
111
|
self.sandboxes = AsyncSandboxesAPI(self)
|
|
@@ -15,7 +15,6 @@ from .uploads import FileUpload as FileUpload
|
|
|
15
15
|
from .resources.disks import DisksAPI as DisksAPI
|
|
16
16
|
from .resources.sandboxes import SandboxesAPI as SandboxesAPI
|
|
17
17
|
from .resources.sessions import SessionsAPI as SessionsAPI
|
|
18
|
-
from .resources.tools import ToolsAPI as ToolsAPI
|
|
19
18
|
from .resources.skills import SkillsAPI as SkillsAPI
|
|
20
19
|
from .resources.users import UsersAPI as UsersAPI
|
|
21
20
|
|
|
@@ -107,7 +106,6 @@ class AcontextClient:
|
|
|
107
106
|
self.sessions = SessionsAPI(self)
|
|
108
107
|
self.disks = DisksAPI(self)
|
|
109
108
|
self.artifacts = self.disks.artifacts
|
|
110
|
-
self.tools = ToolsAPI(self)
|
|
111
109
|
self.skills = SkillsAPI(self)
|
|
112
110
|
self.users = UsersAPI(self)
|
|
113
111
|
self.sandboxes = SandboxesAPI(self)
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
from .async_disks import AsyncDisksAPI, AsyncDiskArtifactsAPI
|
|
4
4
|
from .async_sandboxes import AsyncSandboxesAPI
|
|
5
5
|
from .async_sessions import AsyncSessionsAPI
|
|
6
|
-
from .async_tools import AsyncToolsAPI
|
|
7
6
|
from .async_skills import AsyncSkillsAPI
|
|
8
7
|
from .async_users import AsyncUsersAPI
|
|
9
8
|
from .disks import DisksAPI, DiskArtifactsAPI
|
|
10
9
|
from .sandboxes import SandboxesAPI
|
|
11
10
|
from .sessions import SessionsAPI
|
|
12
|
-
from .tools import ToolsAPI
|
|
13
11
|
from .skills import SkillsAPI
|
|
14
12
|
from .users import UsersAPI
|
|
15
13
|
|
|
@@ -18,14 +16,12 @@ __all__ = [
|
|
|
18
16
|
"DiskArtifactsAPI",
|
|
19
17
|
"SandboxesAPI",
|
|
20
18
|
"SessionsAPI",
|
|
21
|
-
"ToolsAPI",
|
|
22
19
|
"SkillsAPI",
|
|
23
20
|
"UsersAPI",
|
|
24
21
|
"AsyncDisksAPI",
|
|
25
22
|
"AsyncDiskArtifactsAPI",
|
|
26
23
|
"AsyncSandboxesAPI",
|
|
27
24
|
"AsyncSessionsAPI",
|
|
28
|
-
"AsyncToolsAPI",
|
|
29
25
|
"AsyncSkillsAPI",
|
|
30
26
|
"AsyncUsersAPI",
|
|
31
27
|
]
|
|
@@ -84,6 +84,7 @@ class AsyncSessionsAPI:
|
|
|
84
84
|
user: str | None = None,
|
|
85
85
|
disable_task_tracking: bool | None = None,
|
|
86
86
|
configs: Mapping[str, Any] | None = None,
|
|
87
|
+
use_uuid: str | None = None,
|
|
87
88
|
) -> Session:
|
|
88
89
|
"""Create a new session.
|
|
89
90
|
|
|
@@ -91,9 +92,14 @@ class AsyncSessionsAPI:
|
|
|
91
92
|
user: Optional user identifier string. Defaults to None.
|
|
92
93
|
disable_task_tracking: Whether to disable task tracking for this session. Defaults to None (server default: False).
|
|
93
94
|
configs: Optional session configuration dictionary. Defaults to None.
|
|
95
|
+
use_uuid: Optional UUID string to use as the session ID. If not provided, a UUID will be auto-generated.
|
|
96
|
+
If a session with this UUID already exists, a 409 Conflict error will be raised.
|
|
94
97
|
|
|
95
98
|
Returns:
|
|
96
99
|
The created Session object.
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
AcontextAPIError: If use_uuid is invalid or a session with this UUID already exists.
|
|
97
103
|
"""
|
|
98
104
|
payload: dict[str, Any] = {}
|
|
99
105
|
if user:
|
|
@@ -102,6 +108,8 @@ class AsyncSessionsAPI:
|
|
|
102
108
|
payload["disable_task_tracking"] = disable_task_tracking
|
|
103
109
|
if configs is not None:
|
|
104
110
|
payload["configs"] = configs
|
|
111
|
+
if use_uuid is not None:
|
|
112
|
+
payload["use_uuid"] = use_uuid
|
|
105
113
|
data = await self._requester.request("POST", "/session", json_data=payload)
|
|
106
114
|
return Session.model_validate(data)
|
|
107
115
|
|
|
@@ -216,6 +224,7 @@ class AsyncSessionsAPI:
|
|
|
216
224
|
*,
|
|
217
225
|
blob: MessageBlob,
|
|
218
226
|
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
227
|
+
meta: dict[str, Any] | None = None,
|
|
219
228
|
file_field: str | None = None,
|
|
220
229
|
file: (
|
|
221
230
|
FileUpload
|
|
@@ -230,12 +239,15 @@ class AsyncSessionsAPI:
|
|
|
230
239
|
session_id: The UUID of the session.
|
|
231
240
|
blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
|
|
232
241
|
format: The format of the message blob. Defaults to "openai".
|
|
242
|
+
meta: Optional user-provided metadata for the message. This metadata is stored
|
|
243
|
+
separately from the message content and can be retrieved via get_messages().metas
|
|
244
|
+
or updated via patch_message_meta(). Works with all formats.
|
|
233
245
|
file_field: The field name for file upload. Only used when format is "acontext".
|
|
234
246
|
Required if file is provided. Defaults to None.
|
|
235
247
|
file: Optional file upload. Only used when format is "acontext". Defaults to None.
|
|
236
248
|
|
|
237
249
|
Returns:
|
|
238
|
-
The created Message object.
|
|
250
|
+
The created Message object. The msg.meta field contains only user-provided metadata.
|
|
239
251
|
|
|
240
252
|
Raises:
|
|
241
253
|
ValueError: If format is invalid, file/file_field provided for non-acontext format,
|
|
@@ -256,6 +268,9 @@ class AsyncSessionsAPI:
|
|
|
256
268
|
payload: dict[str, Any] = {
|
|
257
269
|
"format": format,
|
|
258
270
|
}
|
|
271
|
+
if meta is not None:
|
|
272
|
+
payload["meta"] = meta
|
|
273
|
+
|
|
259
274
|
if format == "acontext":
|
|
260
275
|
if isinstance(blob, Mapping):
|
|
261
276
|
payload["blob"] = blob
|
|
@@ -404,3 +419,83 @@ class AsyncSessionsAPI:
|
|
|
404
419
|
"GET", f"/session/{session_id}/observing_status"
|
|
405
420
|
)
|
|
406
421
|
return MessageObservingStatus.model_validate(data)
|
|
422
|
+
|
|
423
|
+
async def patch_message_meta(
|
|
424
|
+
self,
|
|
425
|
+
session_id: str,
|
|
426
|
+
message_id: str,
|
|
427
|
+
*,
|
|
428
|
+
meta: dict[str, Any],
|
|
429
|
+
) -> dict[str, Any]:
|
|
430
|
+
"""Update message metadata using patch semantics.
|
|
431
|
+
|
|
432
|
+
Only updates keys present in the meta dict. Existing keys not in the request
|
|
433
|
+
are preserved. To delete a key, pass None as its value.
|
|
434
|
+
|
|
435
|
+
Args:
|
|
436
|
+
session_id: The UUID of the session.
|
|
437
|
+
message_id: The UUID of the message.
|
|
438
|
+
meta: Dictionary of metadata keys to add, update, or delete.
|
|
439
|
+
Pass None as a value to delete that key.
|
|
440
|
+
|
|
441
|
+
Returns:
|
|
442
|
+
The complete user metadata after the patch operation.
|
|
443
|
+
|
|
444
|
+
Example:
|
|
445
|
+
>>> # Add/update keys
|
|
446
|
+
>>> updated = await client.sessions.patch_message_meta(
|
|
447
|
+
... session_id, message_id,
|
|
448
|
+
... meta={"status": "processed", "score": 0.95}
|
|
449
|
+
... )
|
|
450
|
+
>>> # Delete a key
|
|
451
|
+
>>> updated = await client.sessions.patch_message_meta(
|
|
452
|
+
... session_id, message_id,
|
|
453
|
+
... meta={"old_key": None} # Deletes "old_key"
|
|
454
|
+
... )
|
|
455
|
+
"""
|
|
456
|
+
payload = {"meta": meta}
|
|
457
|
+
data = await self._requester.request(
|
|
458
|
+
"PATCH",
|
|
459
|
+
f"/session/{session_id}/messages/{message_id}/meta",
|
|
460
|
+
json_data=payload,
|
|
461
|
+
)
|
|
462
|
+
return data.get("meta", {}) # type: ignore
|
|
463
|
+
|
|
464
|
+
async def patch_configs(
|
|
465
|
+
self,
|
|
466
|
+
session_id: str,
|
|
467
|
+
*,
|
|
468
|
+
configs: dict[str, Any],
|
|
469
|
+
) -> dict[str, Any]:
|
|
470
|
+
"""Update session configs using patch semantics.
|
|
471
|
+
|
|
472
|
+
Only updates keys present in the configs dict. Existing keys not in the request
|
|
473
|
+
are preserved. To delete a key, pass None as its value.
|
|
474
|
+
|
|
475
|
+
Args:
|
|
476
|
+
session_id: The UUID of the session.
|
|
477
|
+
configs: Dictionary of config keys to add, update, or delete.
|
|
478
|
+
Pass None as a value to delete that key.
|
|
479
|
+
|
|
480
|
+
Returns:
|
|
481
|
+
The complete configs after the patch operation.
|
|
482
|
+
|
|
483
|
+
Example:
|
|
484
|
+
>>> # Add/update keys
|
|
485
|
+
>>> updated = await client.sessions.patch_configs(
|
|
486
|
+
... session_id,
|
|
487
|
+
... configs={"agent": "bot2", "temperature": 0.8}
|
|
488
|
+
... )
|
|
489
|
+
>>> # Delete a key
|
|
490
|
+
>>> updated = await client.sessions.patch_configs(
|
|
491
|
+
... session_id,
|
|
492
|
+
... configs={"old_key": None} # Deletes "old_key"
|
|
493
|
+
... )
|
|
494
|
+
"""
|
|
495
|
+
payload = {"configs": configs}
|
|
496
|
+
data = await self._requester.request(
|
|
497
|
+
"PATCH",
|
|
498
|
+
f"/session/{session_id}/configs",
|
|
499
|
+
json_data=payload,
|
|
500
|
+
)
|
|
501
|
+
return data.get("configs", {}) # type: ignore
|
|
@@ -84,6 +84,7 @@ class SessionsAPI:
|
|
|
84
84
|
user: str | None = None,
|
|
85
85
|
disable_task_tracking: bool | None = None,
|
|
86
86
|
configs: Mapping[str, Any] | None = None,
|
|
87
|
+
use_uuid: str | None = None,
|
|
87
88
|
) -> Session:
|
|
88
89
|
"""Create a new session.
|
|
89
90
|
|
|
@@ -91,9 +92,14 @@ class SessionsAPI:
|
|
|
91
92
|
user: Optional user identifier string. Defaults to None.
|
|
92
93
|
disable_task_tracking: Whether to disable task tracking for this session. Defaults to None (server default: False).
|
|
93
94
|
configs: Optional session configuration dictionary. Defaults to None.
|
|
95
|
+
use_uuid: Optional UUID string to use as the session ID. If not provided, a UUID will be auto-generated.
|
|
96
|
+
If a session with this UUID already exists, a 409 Conflict error will be raised.
|
|
94
97
|
|
|
95
98
|
Returns:
|
|
96
99
|
The created Session object.
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
AcontextAPIError: If use_uuid is invalid or a session with this UUID already exists.
|
|
97
103
|
"""
|
|
98
104
|
payload: dict[str, Any] = {}
|
|
99
105
|
if user:
|
|
@@ -102,6 +108,8 @@ class SessionsAPI:
|
|
|
102
108
|
payload["disable_task_tracking"] = disable_task_tracking
|
|
103
109
|
if configs is not None:
|
|
104
110
|
payload["configs"] = configs
|
|
111
|
+
if use_uuid is not None:
|
|
112
|
+
payload["use_uuid"] = use_uuid
|
|
105
113
|
data = self._requester.request("POST", "/session", json_data=payload)
|
|
106
114
|
return Session.model_validate(data)
|
|
107
115
|
|
|
@@ -216,6 +224,7 @@ class SessionsAPI:
|
|
|
216
224
|
*,
|
|
217
225
|
blob: MessageBlob,
|
|
218
226
|
format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
|
|
227
|
+
meta: dict[str, Any] | None = None,
|
|
219
228
|
file_field: str | None = None,
|
|
220
229
|
file: (
|
|
221
230
|
FileUpload
|
|
@@ -230,12 +239,15 @@ class SessionsAPI:
|
|
|
230
239
|
session_id: The UUID of the session.
|
|
231
240
|
blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
|
|
232
241
|
format: The format of the message blob. Defaults to "openai".
|
|
242
|
+
meta: Optional user-provided metadata for the message. This metadata is stored
|
|
243
|
+
separately from the message content and can be retrieved via get_messages().metas
|
|
244
|
+
or updated via patch_message_meta(). Works with all formats.
|
|
233
245
|
file_field: The field name for file upload. Only used when format is "acontext".
|
|
234
246
|
Required if file is provided. Defaults to None.
|
|
235
247
|
file: Optional file upload. Only used when format is "acontext". Defaults to None.
|
|
236
248
|
|
|
237
249
|
Returns:
|
|
238
|
-
The created Message object.
|
|
250
|
+
The created Message object. The msg.meta field contains only user-provided metadata.
|
|
239
251
|
|
|
240
252
|
Raises:
|
|
241
253
|
ValueError: If format is invalid, file/file_field provided for non-acontext format,
|
|
@@ -257,6 +269,9 @@ class SessionsAPI:
|
|
|
257
269
|
payload: dict[str, Any] = {
|
|
258
270
|
"format": format,
|
|
259
271
|
}
|
|
272
|
+
if meta is not None:
|
|
273
|
+
payload["meta"] = meta
|
|
274
|
+
|
|
260
275
|
if format == "acontext":
|
|
261
276
|
if isinstance(blob, Mapping):
|
|
262
277
|
payload["blob"] = blob
|
|
@@ -398,3 +413,83 @@ class SessionsAPI:
|
|
|
398
413
|
"""
|
|
399
414
|
data = self._requester.request("GET", f"/session/{session_id}/observing_status")
|
|
400
415
|
return MessageObservingStatus.model_validate(data)
|
|
416
|
+
|
|
417
|
+
def patch_message_meta(
|
|
418
|
+
self,
|
|
419
|
+
session_id: str,
|
|
420
|
+
message_id: str,
|
|
421
|
+
*,
|
|
422
|
+
meta: dict[str, Any],
|
|
423
|
+
) -> dict[str, Any]:
|
|
424
|
+
"""Update message metadata using patch semantics.
|
|
425
|
+
|
|
426
|
+
Only updates keys present in the meta dict. Existing keys not in the request
|
|
427
|
+
are preserved. To delete a key, pass None as its value.
|
|
428
|
+
|
|
429
|
+
Args:
|
|
430
|
+
session_id: The UUID of the session.
|
|
431
|
+
message_id: The UUID of the message.
|
|
432
|
+
meta: Dictionary of metadata keys to add, update, or delete.
|
|
433
|
+
Pass None as a value to delete that key.
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
The complete user metadata after the patch operation.
|
|
437
|
+
|
|
438
|
+
Example:
|
|
439
|
+
>>> # Add/update keys
|
|
440
|
+
>>> updated = client.sessions.patch_message_meta(
|
|
441
|
+
... session_id, message_id,
|
|
442
|
+
... meta={"status": "processed", "score": 0.95}
|
|
443
|
+
... )
|
|
444
|
+
>>> # Delete a key
|
|
445
|
+
>>> updated = client.sessions.patch_message_meta(
|
|
446
|
+
... session_id, message_id,
|
|
447
|
+
... meta={"old_key": None} # Deletes "old_key"
|
|
448
|
+
... )
|
|
449
|
+
"""
|
|
450
|
+
payload = {"meta": meta}
|
|
451
|
+
data = self._requester.request(
|
|
452
|
+
"PATCH",
|
|
453
|
+
f"/session/{session_id}/messages/{message_id}/meta",
|
|
454
|
+
json_data=payload,
|
|
455
|
+
)
|
|
456
|
+
return data.get("meta", {}) # type: ignore
|
|
457
|
+
|
|
458
|
+
def patch_configs(
|
|
459
|
+
self,
|
|
460
|
+
session_id: str,
|
|
461
|
+
*,
|
|
462
|
+
configs: dict[str, Any],
|
|
463
|
+
) -> dict[str, Any]:
|
|
464
|
+
"""Update session configs using patch semantics.
|
|
465
|
+
|
|
466
|
+
Only updates keys present in the configs dict. Existing keys not in the request
|
|
467
|
+
are preserved. To delete a key, pass None as its value.
|
|
468
|
+
|
|
469
|
+
Args:
|
|
470
|
+
session_id: The UUID of the session.
|
|
471
|
+
configs: Dictionary of config keys to add, update, or delete.
|
|
472
|
+
Pass None as a value to delete that key.
|
|
473
|
+
|
|
474
|
+
Returns:
|
|
475
|
+
The complete configs after the patch operation.
|
|
476
|
+
|
|
477
|
+
Example:
|
|
478
|
+
>>> # Add/update keys
|
|
479
|
+
>>> updated = client.sessions.patch_configs(
|
|
480
|
+
... session_id,
|
|
481
|
+
... configs={"agent": "bot2", "temperature": 0.8}
|
|
482
|
+
... )
|
|
483
|
+
>>> # Delete a key
|
|
484
|
+
>>> updated = client.sessions.patch_configs(
|
|
485
|
+
... session_id,
|
|
486
|
+
... configs={"old_key": None} # Deletes "old_key"
|
|
487
|
+
... )
|
|
488
|
+
"""
|
|
489
|
+
payload = {"configs": configs}
|
|
490
|
+
data = self._requester.request(
|
|
491
|
+
"PATCH",
|
|
492
|
+
f"/session/{session_id}/configs",
|
|
493
|
+
json_data=payload,
|
|
494
|
+
)
|
|
495
|
+
return data.get("configs", {}) # type: ignore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Type definitions for API responses."""
|
|
2
2
|
|
|
3
|
-
from .common import FileContent
|
|
3
|
+
from .common import FileContent, FlagResponse
|
|
4
4
|
from .disk import (
|
|
5
5
|
Artifact,
|
|
6
6
|
Disk,
|
|
@@ -22,11 +22,6 @@ from .session import (
|
|
|
22
22
|
TaskData,
|
|
23
23
|
TokenCounts,
|
|
24
24
|
)
|
|
25
|
-
from .tool import (
|
|
26
|
-
FlagResponse,
|
|
27
|
-
ToolReferenceData,
|
|
28
|
-
ToolRenameItem,
|
|
29
|
-
)
|
|
30
25
|
from .skill import (
|
|
31
26
|
FileInfo,
|
|
32
27
|
GetSkillFileResp,
|
|
@@ -50,10 +45,12 @@ from .user import (
|
|
|
50
45
|
)
|
|
51
46
|
|
|
52
47
|
__all__ = [
|
|
48
|
+
# Common types
|
|
49
|
+
"FileContent",
|
|
50
|
+
"FlagResponse",
|
|
53
51
|
# Disk types
|
|
54
52
|
"Artifact",
|
|
55
53
|
"Disk",
|
|
56
|
-
"FileContent",
|
|
57
54
|
"GetArtifactResp",
|
|
58
55
|
"ListArtifactsResp",
|
|
59
56
|
"ListDisksOutput",
|
|
@@ -70,10 +67,6 @@ __all__ = [
|
|
|
70
67
|
"Task",
|
|
71
68
|
"TaskData",
|
|
72
69
|
"TokenCounts",
|
|
73
|
-
# Tool types
|
|
74
|
-
"FlagResponse",
|
|
75
|
-
"ToolReferenceData",
|
|
76
|
-
"ToolRenameItem",
|
|
77
70
|
# Skill types
|
|
78
71
|
"FileInfo",
|
|
79
72
|
"Skill",
|
|
@@ -9,3 +9,10 @@ class FileContent(BaseModel):
|
|
|
9
9
|
type: str = Field(..., description="File content type: 'text', 'json', 'csv', or 'code'")
|
|
10
10
|
raw: str = Field(..., description="Raw text content of the file")
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
class FlagResponse(BaseModel):
|
|
14
|
+
"""Response model for flag operations like kill sandbox."""
|
|
15
|
+
|
|
16
|
+
status: int = Field(..., description="Status code of the operation")
|
|
17
|
+
errmsg: str = Field(..., description="Error message if any")
|
|
18
|
+
|
|
@@ -245,6 +245,10 @@ class GetMessagesOutput(BaseModel):
|
|
|
245
245
|
...,
|
|
246
246
|
description="List of message UUIDs corresponding to each item in the same order",
|
|
247
247
|
)
|
|
248
|
+
metas: list[dict[str, Any]] = Field(
|
|
249
|
+
default_factory=list,
|
|
250
|
+
description="List of user-provided metadata for each message (same order as items/ids)",
|
|
251
|
+
)
|
|
248
252
|
next_cursor: str | None = Field(None, description="Cursor for pagination")
|
|
249
253
|
has_more: bool = Field(..., description="Whether there are more items")
|
|
250
254
|
this_time_tokens: int = Field(
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""Async tool endpoints."""
|
|
2
|
-
|
|
3
|
-
from ..client_types import AsyncRequesterProtocol
|
|
4
|
-
from ..types.tool import FlagResponse, ToolReferenceData
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class AsyncToolsAPI:
|
|
8
|
-
def __init__(self, requester: AsyncRequesterProtocol) -> None:
|
|
9
|
-
self._requester = requester
|
|
10
|
-
|
|
11
|
-
async def rename_tool_name(
|
|
12
|
-
self, *, rename: list[dict[str, str]]
|
|
13
|
-
) -> FlagResponse:
|
|
14
|
-
"""Rename tool names within a project.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
rename: List of dictionaries with old_name and new_name keys.
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
FlagResponse containing status and errmsg fields.
|
|
21
|
-
"""
|
|
22
|
-
payload = {"rename": rename}
|
|
23
|
-
data = await self._requester.request("PUT", "/tool/name", json_data=payload)
|
|
24
|
-
return FlagResponse.model_validate(data)
|
|
25
|
-
|
|
26
|
-
async def get_tool_name(self) -> list[ToolReferenceData]:
|
|
27
|
-
"""Get all tool names within a project.
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
List of ToolReferenceData objects.
|
|
31
|
-
"""
|
|
32
|
-
data = await self._requester.request("GET", "/tool/name")
|
|
33
|
-
return [ToolReferenceData.model_validate(item) for item in data]
|
|
34
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""Tool endpoints."""
|
|
2
|
-
|
|
3
|
-
from ..client_types import RequesterProtocol
|
|
4
|
-
from ..types.tool import FlagResponse, ToolReferenceData
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ToolsAPI:
|
|
8
|
-
def __init__(self, requester: RequesterProtocol) -> None:
|
|
9
|
-
self._requester = requester
|
|
10
|
-
|
|
11
|
-
def rename_tool_name(
|
|
12
|
-
self, *, rename: list[dict[str, str]]
|
|
13
|
-
) -> FlagResponse:
|
|
14
|
-
"""Rename tool names within a project.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
rename: List of dictionaries with old_name and new_name keys.
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
FlagResponse containing status and errmsg fields.
|
|
21
|
-
"""
|
|
22
|
-
payload = {"rename": rename}
|
|
23
|
-
data = self._requester.request("PUT", "/tool/name", json_data=payload)
|
|
24
|
-
return FlagResponse.model_validate(data)
|
|
25
|
-
|
|
26
|
-
def get_tool_name(self) -> list[ToolReferenceData]:
|
|
27
|
-
"""Get all tool names within a project.
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
List of ToolReferenceData objects.
|
|
31
|
-
"""
|
|
32
|
-
data = self._requester.request("GET", "/tool/name")
|
|
33
|
-
return [ToolReferenceData.model_validate(item) for item in data]
|
|
34
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"""Type definitions for tool resources."""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class FlagResponse(BaseModel):
|
|
7
|
-
"""Flag response with status and error message."""
|
|
8
|
-
|
|
9
|
-
status: int = Field(..., description="Status code")
|
|
10
|
-
errmsg: str = Field(..., description="Error message")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ToolReferenceData(BaseModel):
|
|
14
|
-
"""Tool reference data."""
|
|
15
|
-
|
|
16
|
-
name: str = Field(..., description="Tool name")
|
|
17
|
-
sop_count: int = Field(..., description="Number of SOPs using this tool")
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class ToolRenameItem(BaseModel):
|
|
21
|
-
"""Tool rename item."""
|
|
22
|
-
|
|
23
|
-
old_name: str = Field(..., description="Old tool name")
|
|
24
|
-
new_name: str = Field(..., description="New tool name")
|
|
25
|
-
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|