glaip-sdk 0.6.15b2__py3-none-any.whl → 0.6.16__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.
- glaip_sdk/agents/__init__.py +27 -0
- glaip_sdk/agents/base.py +1196 -0
- glaip_sdk/cli/__init__.py +9 -0
- glaip_sdk/cli/account_store.py +540 -0
- glaip_sdk/cli/agent_config.py +78 -0
- glaip_sdk/cli/auth.py +699 -0
- glaip_sdk/cli/commands/__init__.py +5 -0
- glaip_sdk/cli/commands/accounts.py +746 -0
- glaip_sdk/cli/commands/agents.py +1509 -0
- glaip_sdk/cli/commands/common_config.py +104 -0
- glaip_sdk/cli/commands/configure.py +896 -0
- glaip_sdk/cli/commands/mcps.py +1356 -0
- glaip_sdk/cli/commands/models.py +69 -0
- glaip_sdk/cli/commands/tools.py +576 -0
- glaip_sdk/cli/commands/transcripts.py +755 -0
- glaip_sdk/cli/commands/update.py +61 -0
- glaip_sdk/cli/config.py +95 -0
- glaip_sdk/cli/constants.py +38 -0
- glaip_sdk/cli/context.py +150 -0
- glaip_sdk/cli/core/__init__.py +79 -0
- glaip_sdk/cli/core/context.py +124 -0
- glaip_sdk/cli/core/output.py +851 -0
- glaip_sdk/cli/core/prompting.py +649 -0
- glaip_sdk/cli/core/rendering.py +187 -0
- glaip_sdk/cli/display.py +355 -0
- glaip_sdk/cli/hints.py +57 -0
- glaip_sdk/cli/io.py +112 -0
- glaip_sdk/cli/main.py +615 -0
- glaip_sdk/cli/masking.py +136 -0
- glaip_sdk/cli/mcp_validators.py +287 -0
- glaip_sdk/cli/pager.py +266 -0
- glaip_sdk/cli/parsers/__init__.py +7 -0
- glaip_sdk/cli/parsers/json_input.py +177 -0
- glaip_sdk/cli/resolution.py +67 -0
- glaip_sdk/cli/rich_helpers.py +27 -0
- glaip_sdk/cli/slash/__init__.py +15 -0
- glaip_sdk/cli/slash/accounts_controller.py +578 -0
- glaip_sdk/cli/slash/accounts_shared.py +75 -0
- glaip_sdk/cli/slash/agent_session.py +285 -0
- glaip_sdk/cli/slash/prompt.py +256 -0
- glaip_sdk/cli/slash/remote_runs_controller.py +566 -0
- glaip_sdk/cli/slash/session.py +1708 -0
- glaip_sdk/cli/slash/tui/__init__.py +9 -0
- glaip_sdk/cli/slash/tui/accounts_app.py +876 -0
- glaip_sdk/cli/slash/tui/background_tasks.py +72 -0
- glaip_sdk/cli/slash/tui/loading.py +58 -0
- glaip_sdk/cli/slash/tui/remote_runs_app.py +628 -0
- glaip_sdk/cli/transcript/__init__.py +31 -0
- glaip_sdk/cli/transcript/cache.py +536 -0
- glaip_sdk/cli/transcript/capture.py +329 -0
- glaip_sdk/cli/transcript/export.py +38 -0
- glaip_sdk/cli/transcript/history.py +815 -0
- glaip_sdk/cli/transcript/launcher.py +77 -0
- glaip_sdk/cli/transcript/viewer.py +374 -0
- glaip_sdk/cli/update_notifier.py +290 -0
- glaip_sdk/cli/utils.py +263 -0
- glaip_sdk/cli/validators.py +238 -0
- glaip_sdk/client/__init__.py +11 -0
- glaip_sdk/client/_agent_payloads.py +520 -0
- glaip_sdk/client/agent_runs.py +147 -0
- glaip_sdk/client/agents.py +1335 -0
- glaip_sdk/client/base.py +502 -0
- glaip_sdk/client/main.py +249 -0
- glaip_sdk/client/mcps.py +370 -0
- glaip_sdk/client/run_rendering.py +700 -0
- glaip_sdk/client/shared.py +21 -0
- glaip_sdk/client/tools.py +661 -0
- glaip_sdk/client/validators.py +198 -0
- glaip_sdk/config/constants.py +52 -0
- glaip_sdk/mcps/__init__.py +21 -0
- glaip_sdk/mcps/base.py +345 -0
- glaip_sdk/models/__init__.py +90 -0
- glaip_sdk/models/agent.py +47 -0
- glaip_sdk/models/agent_runs.py +116 -0
- glaip_sdk/models/common.py +42 -0
- glaip_sdk/models/mcp.py +33 -0
- glaip_sdk/models/tool.py +33 -0
- glaip_sdk/payload_schemas/__init__.py +7 -0
- glaip_sdk/payload_schemas/agent.py +85 -0
- glaip_sdk/registry/__init__.py +55 -0
- glaip_sdk/registry/agent.py +164 -0
- glaip_sdk/registry/base.py +139 -0
- glaip_sdk/registry/mcp.py +253 -0
- glaip_sdk/registry/tool.py +232 -0
- glaip_sdk/runner/__init__.py +59 -0
- glaip_sdk/runner/base.py +84 -0
- glaip_sdk/runner/deps.py +112 -0
- glaip_sdk/runner/langgraph.py +782 -0
- glaip_sdk/runner/mcp_adapter/__init__.py +13 -0
- glaip_sdk/runner/mcp_adapter/base_mcp_adapter.py +43 -0
- glaip_sdk/runner/mcp_adapter/langchain_mcp_adapter.py +257 -0
- glaip_sdk/runner/mcp_adapter/mcp_config_builder.py +95 -0
- glaip_sdk/runner/tool_adapter/__init__.py +18 -0
- glaip_sdk/runner/tool_adapter/base_tool_adapter.py +44 -0
- glaip_sdk/runner/tool_adapter/langchain_tool_adapter.py +219 -0
- glaip_sdk/tools/__init__.py +22 -0
- glaip_sdk/tools/base.py +435 -0
- glaip_sdk/utils/__init__.py +86 -0
- glaip_sdk/utils/a2a/__init__.py +34 -0
- glaip_sdk/utils/a2a/event_processor.py +188 -0
- glaip_sdk/utils/agent_config.py +194 -0
- glaip_sdk/utils/bundler.py +267 -0
- glaip_sdk/utils/client.py +111 -0
- glaip_sdk/utils/client_utils.py +486 -0
- glaip_sdk/utils/datetime_helpers.py +58 -0
- glaip_sdk/utils/discovery.py +78 -0
- glaip_sdk/utils/display.py +135 -0
- glaip_sdk/utils/export.py +143 -0
- glaip_sdk/utils/general.py +61 -0
- glaip_sdk/utils/import_export.py +168 -0
- glaip_sdk/utils/import_resolver.py +492 -0
- glaip_sdk/utils/instructions.py +101 -0
- glaip_sdk/utils/rendering/__init__.py +115 -0
- glaip_sdk/utils/rendering/formatting.py +264 -0
- glaip_sdk/utils/rendering/layout/__init__.py +64 -0
- glaip_sdk/utils/rendering/layout/panels.py +156 -0
- glaip_sdk/utils/rendering/layout/progress.py +202 -0
- glaip_sdk/utils/rendering/layout/summary.py +74 -0
- glaip_sdk/utils/rendering/layout/transcript.py +606 -0
- glaip_sdk/utils/rendering/models.py +85 -0
- glaip_sdk/utils/rendering/renderer/__init__.py +55 -0
- glaip_sdk/utils/rendering/renderer/base.py +1024 -0
- glaip_sdk/utils/rendering/renderer/config.py +27 -0
- glaip_sdk/utils/rendering/renderer/console.py +55 -0
- glaip_sdk/utils/rendering/renderer/debug.py +178 -0
- glaip_sdk/utils/rendering/renderer/factory.py +138 -0
- glaip_sdk/utils/rendering/renderer/stream.py +202 -0
- glaip_sdk/utils/rendering/renderer/summary_window.py +79 -0
- glaip_sdk/utils/rendering/renderer/thinking.py +273 -0
- glaip_sdk/utils/rendering/renderer/toggle.py +182 -0
- glaip_sdk/utils/rendering/renderer/tool_panels.py +442 -0
- glaip_sdk/utils/rendering/renderer/transcript_mode.py +162 -0
- glaip_sdk/utils/rendering/state.py +204 -0
- glaip_sdk/utils/rendering/step_tree_state.py +100 -0
- glaip_sdk/utils/rendering/steps/__init__.py +34 -0
- glaip_sdk/utils/rendering/steps/event_processor.py +778 -0
- glaip_sdk/utils/rendering/steps/format.py +176 -0
- glaip_sdk/utils/rendering/steps/manager.py +387 -0
- glaip_sdk/utils/rendering/timing.py +36 -0
- glaip_sdk/utils/rendering/viewer/__init__.py +21 -0
- glaip_sdk/utils/rendering/viewer/presenter.py +184 -0
- glaip_sdk/utils/resource_refs.py +195 -0
- glaip_sdk/utils/run_renderer.py +41 -0
- glaip_sdk/utils/runtime_config.py +425 -0
- glaip_sdk/utils/serialization.py +424 -0
- glaip_sdk/utils/sync.py +142 -0
- glaip_sdk/utils/tool_detection.py +33 -0
- glaip_sdk/utils/validation.py +264 -0
- {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.16.dist-info}/METADATA +4 -5
- glaip_sdk-0.6.16.dist-info/RECORD +160 -0
- glaip_sdk-0.6.15b2.dist-info/RECORD +0 -12
- {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.16.dist-info}/WHEEL +0 -0
- {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.16.dist-info}/entry_points.txt +0 -0
- {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.16.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"""CLI validation utilities that wrap core validation with Click exceptions.
|
|
2
|
+
|
|
3
|
+
This module provides thin wrappers over utils.validation that translate
|
|
4
|
+
ValueError exceptions to click.ClickException for CLI user experience.
|
|
5
|
+
|
|
6
|
+
Authors:
|
|
7
|
+
Raymond Christopher (raymond.christopher@gdplabs.id)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
import click
|
|
15
|
+
|
|
16
|
+
from glaip_sdk.cli.utils import handle_best_effort_check
|
|
17
|
+
from glaip_sdk.utils.validation import (
|
|
18
|
+
coerce_timeout,
|
|
19
|
+
validate_agent_instruction,
|
|
20
|
+
validate_agent_name,
|
|
21
|
+
validate_api_key,
|
|
22
|
+
validate_directory_path,
|
|
23
|
+
validate_file_path,
|
|
24
|
+
validate_mcp_name,
|
|
25
|
+
validate_timeout,
|
|
26
|
+
validate_tool_name,
|
|
27
|
+
validate_url,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def validate_agent_name_cli(name: str) -> str:
|
|
32
|
+
"""Validate agent name and return cleaned version.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
name: Agent name to validate
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
Cleaned agent name
|
|
39
|
+
|
|
40
|
+
Raises:
|
|
41
|
+
click.ClickException: If name is invalid
|
|
42
|
+
"""
|
|
43
|
+
try:
|
|
44
|
+
return validate_agent_name(name)
|
|
45
|
+
except ValueError as e:
|
|
46
|
+
raise click.ClickException(str(e)) from e
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def validate_agent_instruction_cli(instruction: str) -> str:
|
|
50
|
+
"""Validate agent instruction and return cleaned version.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
instruction: Agent instruction to validate
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Cleaned agent instruction
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
click.ClickException: If instruction is invalid
|
|
60
|
+
"""
|
|
61
|
+
try:
|
|
62
|
+
return validate_agent_instruction(instruction)
|
|
63
|
+
except ValueError as e:
|
|
64
|
+
raise click.ClickException(str(e)) from e
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def validate_timeout_cli(timeout: int) -> int:
|
|
68
|
+
"""Validate timeout value.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
timeout: Timeout value in seconds
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Validated timeout value
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
click.ClickException: If timeout is invalid
|
|
78
|
+
"""
|
|
79
|
+
try:
|
|
80
|
+
return validate_timeout(timeout)
|
|
81
|
+
except ValueError as e:
|
|
82
|
+
raise click.ClickException(str(e)) from e
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def validate_tool_name_cli(name: str) -> str:
|
|
86
|
+
"""Validate tool name and return cleaned version.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
name: Tool name to validate
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Cleaned tool name
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
click.ClickException: If name is invalid
|
|
96
|
+
"""
|
|
97
|
+
try:
|
|
98
|
+
return validate_tool_name(name)
|
|
99
|
+
except ValueError as e:
|
|
100
|
+
raise click.ClickException(str(e)) from e
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def validate_mcp_name_cli(name: str) -> str:
|
|
104
|
+
"""Validate MCP name and return cleaned version.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
name: MCP name to validate
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
Cleaned MCP name
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
click.ClickException: If name is invalid
|
|
114
|
+
"""
|
|
115
|
+
try:
|
|
116
|
+
return validate_mcp_name(name)
|
|
117
|
+
except ValueError as e:
|
|
118
|
+
raise click.ClickException(str(e)) from e
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def validate_file_path_cli(file_path: str | Path, must_exist: bool = True) -> Path:
|
|
122
|
+
"""Validate file path.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
file_path: File path to validate
|
|
126
|
+
must_exist: Whether file must exist
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Path object
|
|
130
|
+
|
|
131
|
+
Raises:
|
|
132
|
+
click.ClickException: If file path is invalid
|
|
133
|
+
"""
|
|
134
|
+
try:
|
|
135
|
+
return validate_file_path(file_path, must_exist)
|
|
136
|
+
except ValueError as e:
|
|
137
|
+
raise click.ClickException(str(e)) from e
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def validate_directory_path_cli(dir_path: str | Path, must_exist: bool = True) -> Path:
|
|
141
|
+
"""Validate directory path.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
dir_path: Directory path to validate
|
|
145
|
+
must_exist: Whether directory must exist
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Path object
|
|
149
|
+
|
|
150
|
+
Raises:
|
|
151
|
+
click.ClickException: If directory path is invalid
|
|
152
|
+
"""
|
|
153
|
+
try:
|
|
154
|
+
return validate_directory_path(dir_path, must_exist)
|
|
155
|
+
except ValueError as e:
|
|
156
|
+
raise click.ClickException(str(e)) from e
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def validate_url_cli(url: str) -> str:
|
|
160
|
+
"""Validate URL format.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
url: URL to validate
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
Validated URL
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
click.ClickException: If URL is invalid
|
|
170
|
+
"""
|
|
171
|
+
try:
|
|
172
|
+
return validate_url(url)
|
|
173
|
+
except ValueError as e:
|
|
174
|
+
raise click.ClickException(str(e)) from e
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def validate_api_key_cli(api_key: str) -> str:
|
|
178
|
+
"""Validate API key format.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
api_key: API key to validate
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
Validated API key
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
click.ClickException: If API key is invalid
|
|
188
|
+
"""
|
|
189
|
+
try:
|
|
190
|
+
return validate_api_key(api_key)
|
|
191
|
+
except ValueError as e:
|
|
192
|
+
raise click.ClickException(str(e)) from e
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def coerce_timeout_cli(value: int | float | str) -> int:
|
|
196
|
+
"""Coerce timeout value to integer with CLI-friendly error handling.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
value: The timeout value to coerce (int, float, str, etc.)
|
|
200
|
+
|
|
201
|
+
Returns:
|
|
202
|
+
Integer timeout value
|
|
203
|
+
|
|
204
|
+
Raises:
|
|
205
|
+
click.ClickException: If value cannot be coerced to valid timeout
|
|
206
|
+
"""
|
|
207
|
+
try:
|
|
208
|
+
return coerce_timeout(value)
|
|
209
|
+
except ValueError as e:
|
|
210
|
+
raise click.ClickException(str(e)) from e
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def validate_name_uniqueness_cli(
|
|
214
|
+
_client: Any,
|
|
215
|
+
name: str,
|
|
216
|
+
resource_type: str,
|
|
217
|
+
finder_func: Callable[..., list[Any]],
|
|
218
|
+
) -> None:
|
|
219
|
+
"""Validate that a resource name is unique.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
client: API client
|
|
223
|
+
name: Name to validate
|
|
224
|
+
resource_type: Type of resource (for error messages)
|
|
225
|
+
finder_func: Function to find existing resources by name
|
|
226
|
+
|
|
227
|
+
Raises:
|
|
228
|
+
click.ClickException: If name is not unique
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
def _check_duplicate() -> None:
|
|
232
|
+
existing = finder_func(name=name)
|
|
233
|
+
if existing:
|
|
234
|
+
raise click.ClickException(
|
|
235
|
+
f"A {resource_type.lower()} named '{name}' already exists. Please choose a unique name."
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
handle_best_effort_check(_check_duplicate)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Client module for AIP SDK.
|
|
3
|
+
|
|
4
|
+
Authors:
|
|
5
|
+
Raymond Christopher (raymond.christopher@gdplabs.id)
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from glaip_sdk.client.agent_runs import AgentRunsClient
|
|
9
|
+
from glaip_sdk.client.main import Client
|
|
10
|
+
|
|
11
|
+
__all__ = ["AgentRunsClient", "Client"]
|