glaip-sdk 0.6.15b2__py3-none-any.whl → 0.6.15b3__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.
Files changed (154) hide show
  1. glaip_sdk/agents/__init__.py +27 -0
  2. glaip_sdk/agents/base.py +1196 -0
  3. glaip_sdk/cli/__init__.py +9 -0
  4. glaip_sdk/cli/account_store.py +540 -0
  5. glaip_sdk/cli/agent_config.py +78 -0
  6. glaip_sdk/cli/auth.py +699 -0
  7. glaip_sdk/cli/commands/__init__.py +5 -0
  8. glaip_sdk/cli/commands/accounts.py +746 -0
  9. glaip_sdk/cli/commands/agents.py +1509 -0
  10. glaip_sdk/cli/commands/common_config.py +104 -0
  11. glaip_sdk/cli/commands/configure.py +896 -0
  12. glaip_sdk/cli/commands/mcps.py +1356 -0
  13. glaip_sdk/cli/commands/models.py +69 -0
  14. glaip_sdk/cli/commands/tools.py +576 -0
  15. glaip_sdk/cli/commands/transcripts.py +755 -0
  16. glaip_sdk/cli/commands/update.py +61 -0
  17. glaip_sdk/cli/config.py +95 -0
  18. glaip_sdk/cli/constants.py +38 -0
  19. glaip_sdk/cli/context.py +150 -0
  20. glaip_sdk/cli/core/__init__.py +79 -0
  21. glaip_sdk/cli/core/context.py +124 -0
  22. glaip_sdk/cli/core/output.py +851 -0
  23. glaip_sdk/cli/core/prompting.py +649 -0
  24. glaip_sdk/cli/core/rendering.py +187 -0
  25. glaip_sdk/cli/display.py +355 -0
  26. glaip_sdk/cli/hints.py +57 -0
  27. glaip_sdk/cli/io.py +112 -0
  28. glaip_sdk/cli/main.py +615 -0
  29. glaip_sdk/cli/masking.py +136 -0
  30. glaip_sdk/cli/mcp_validators.py +287 -0
  31. glaip_sdk/cli/pager.py +266 -0
  32. glaip_sdk/cli/parsers/__init__.py +7 -0
  33. glaip_sdk/cli/parsers/json_input.py +177 -0
  34. glaip_sdk/cli/resolution.py +67 -0
  35. glaip_sdk/cli/rich_helpers.py +27 -0
  36. glaip_sdk/cli/slash/__init__.py +15 -0
  37. glaip_sdk/cli/slash/accounts_controller.py +578 -0
  38. glaip_sdk/cli/slash/accounts_shared.py +75 -0
  39. glaip_sdk/cli/slash/agent_session.py +285 -0
  40. glaip_sdk/cli/slash/prompt.py +256 -0
  41. glaip_sdk/cli/slash/remote_runs_controller.py +566 -0
  42. glaip_sdk/cli/slash/session.py +1708 -0
  43. glaip_sdk/cli/slash/tui/__init__.py +9 -0
  44. glaip_sdk/cli/slash/tui/accounts_app.py +876 -0
  45. glaip_sdk/cli/slash/tui/background_tasks.py +72 -0
  46. glaip_sdk/cli/slash/tui/loading.py +58 -0
  47. glaip_sdk/cli/slash/tui/remote_runs_app.py +628 -0
  48. glaip_sdk/cli/transcript/__init__.py +31 -0
  49. glaip_sdk/cli/transcript/cache.py +536 -0
  50. glaip_sdk/cli/transcript/capture.py +329 -0
  51. glaip_sdk/cli/transcript/export.py +38 -0
  52. glaip_sdk/cli/transcript/history.py +815 -0
  53. glaip_sdk/cli/transcript/launcher.py +77 -0
  54. glaip_sdk/cli/transcript/viewer.py +374 -0
  55. glaip_sdk/cli/update_notifier.py +290 -0
  56. glaip_sdk/cli/utils.py +263 -0
  57. glaip_sdk/cli/validators.py +238 -0
  58. glaip_sdk/client/__init__.py +11 -0
  59. glaip_sdk/client/_agent_payloads.py +520 -0
  60. glaip_sdk/client/agent_runs.py +147 -0
  61. glaip_sdk/client/agents.py +1335 -0
  62. glaip_sdk/client/base.py +502 -0
  63. glaip_sdk/client/main.py +249 -0
  64. glaip_sdk/client/mcps.py +370 -0
  65. glaip_sdk/client/run_rendering.py +700 -0
  66. glaip_sdk/client/shared.py +21 -0
  67. glaip_sdk/client/tools.py +661 -0
  68. glaip_sdk/client/validators.py +198 -0
  69. glaip_sdk/config/constants.py +52 -0
  70. glaip_sdk/mcps/__init__.py +21 -0
  71. glaip_sdk/mcps/base.py +345 -0
  72. glaip_sdk/models/__init__.py +90 -0
  73. glaip_sdk/models/agent.py +47 -0
  74. glaip_sdk/models/agent_runs.py +116 -0
  75. glaip_sdk/models/common.py +42 -0
  76. glaip_sdk/models/mcp.py +33 -0
  77. glaip_sdk/models/tool.py +33 -0
  78. glaip_sdk/payload_schemas/__init__.py +7 -0
  79. glaip_sdk/payload_schemas/agent.py +85 -0
  80. glaip_sdk/registry/__init__.py +55 -0
  81. glaip_sdk/registry/agent.py +164 -0
  82. glaip_sdk/registry/base.py +139 -0
  83. glaip_sdk/registry/mcp.py +253 -0
  84. glaip_sdk/registry/tool.py +232 -0
  85. glaip_sdk/runner/__init__.py +59 -0
  86. glaip_sdk/runner/base.py +84 -0
  87. glaip_sdk/runner/deps.py +112 -0
  88. glaip_sdk/runner/langgraph.py +782 -0
  89. glaip_sdk/runner/mcp_adapter/__init__.py +13 -0
  90. glaip_sdk/runner/mcp_adapter/base_mcp_adapter.py +43 -0
  91. glaip_sdk/runner/mcp_adapter/langchain_mcp_adapter.py +257 -0
  92. glaip_sdk/runner/mcp_adapter/mcp_config_builder.py +95 -0
  93. glaip_sdk/runner/tool_adapter/__init__.py +18 -0
  94. glaip_sdk/runner/tool_adapter/base_tool_adapter.py +44 -0
  95. glaip_sdk/runner/tool_adapter/langchain_tool_adapter.py +219 -0
  96. glaip_sdk/tools/__init__.py +22 -0
  97. glaip_sdk/tools/base.py +435 -0
  98. glaip_sdk/utils/__init__.py +86 -0
  99. glaip_sdk/utils/a2a/__init__.py +34 -0
  100. glaip_sdk/utils/a2a/event_processor.py +188 -0
  101. glaip_sdk/utils/agent_config.py +194 -0
  102. glaip_sdk/utils/bundler.py +267 -0
  103. glaip_sdk/utils/client.py +111 -0
  104. glaip_sdk/utils/client_utils.py +486 -0
  105. glaip_sdk/utils/datetime_helpers.py +58 -0
  106. glaip_sdk/utils/discovery.py +78 -0
  107. glaip_sdk/utils/display.py +135 -0
  108. glaip_sdk/utils/export.py +143 -0
  109. glaip_sdk/utils/general.py +61 -0
  110. glaip_sdk/utils/import_export.py +168 -0
  111. glaip_sdk/utils/import_resolver.py +492 -0
  112. glaip_sdk/utils/instructions.py +101 -0
  113. glaip_sdk/utils/rendering/__init__.py +115 -0
  114. glaip_sdk/utils/rendering/formatting.py +264 -0
  115. glaip_sdk/utils/rendering/layout/__init__.py +64 -0
  116. glaip_sdk/utils/rendering/layout/panels.py +156 -0
  117. glaip_sdk/utils/rendering/layout/progress.py +202 -0
  118. glaip_sdk/utils/rendering/layout/summary.py +74 -0
  119. glaip_sdk/utils/rendering/layout/transcript.py +606 -0
  120. glaip_sdk/utils/rendering/models.py +85 -0
  121. glaip_sdk/utils/rendering/renderer/__init__.py +55 -0
  122. glaip_sdk/utils/rendering/renderer/base.py +1024 -0
  123. glaip_sdk/utils/rendering/renderer/config.py +27 -0
  124. glaip_sdk/utils/rendering/renderer/console.py +55 -0
  125. glaip_sdk/utils/rendering/renderer/debug.py +178 -0
  126. glaip_sdk/utils/rendering/renderer/factory.py +138 -0
  127. glaip_sdk/utils/rendering/renderer/stream.py +202 -0
  128. glaip_sdk/utils/rendering/renderer/summary_window.py +79 -0
  129. glaip_sdk/utils/rendering/renderer/thinking.py +273 -0
  130. glaip_sdk/utils/rendering/renderer/toggle.py +182 -0
  131. glaip_sdk/utils/rendering/renderer/tool_panels.py +442 -0
  132. glaip_sdk/utils/rendering/renderer/transcript_mode.py +162 -0
  133. glaip_sdk/utils/rendering/state.py +204 -0
  134. glaip_sdk/utils/rendering/step_tree_state.py +100 -0
  135. glaip_sdk/utils/rendering/steps/__init__.py +34 -0
  136. glaip_sdk/utils/rendering/steps/event_processor.py +778 -0
  137. glaip_sdk/utils/rendering/steps/format.py +176 -0
  138. glaip_sdk/utils/rendering/steps/manager.py +387 -0
  139. glaip_sdk/utils/rendering/timing.py +36 -0
  140. glaip_sdk/utils/rendering/viewer/__init__.py +21 -0
  141. glaip_sdk/utils/rendering/viewer/presenter.py +184 -0
  142. glaip_sdk/utils/resource_refs.py +195 -0
  143. glaip_sdk/utils/run_renderer.py +41 -0
  144. glaip_sdk/utils/runtime_config.py +425 -0
  145. glaip_sdk/utils/serialization.py +424 -0
  146. glaip_sdk/utils/sync.py +142 -0
  147. glaip_sdk/utils/tool_detection.py +33 -0
  148. glaip_sdk/utils/validation.py +264 -0
  149. {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.15b3.dist-info}/METADATA +1 -1
  150. glaip_sdk-0.6.15b3.dist-info/RECORD +160 -0
  151. glaip_sdk-0.6.15b2.dist-info/RECORD +0 -12
  152. {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.15b3.dist-info}/WHEEL +0 -0
  153. {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.15b3.dist-info}/entry_points.txt +0 -0
  154. {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.15b3.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"]