glaip-sdk 0.0.3__py3-none-any.whl → 0.0.5__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 (47) hide show
  1. glaip_sdk/__init__.py +5 -5
  2. glaip_sdk/branding.py +146 -0
  3. glaip_sdk/cli/__init__.py +1 -1
  4. glaip_sdk/cli/agent_config.py +82 -0
  5. glaip_sdk/cli/commands/__init__.py +3 -3
  6. glaip_sdk/cli/commands/agents.py +786 -271
  7. glaip_sdk/cli/commands/configure.py +19 -19
  8. glaip_sdk/cli/commands/mcps.py +151 -141
  9. glaip_sdk/cli/commands/models.py +1 -1
  10. glaip_sdk/cli/commands/tools.py +252 -178
  11. glaip_sdk/cli/display.py +244 -0
  12. glaip_sdk/cli/io.py +106 -0
  13. glaip_sdk/cli/main.py +27 -20
  14. glaip_sdk/cli/resolution.py +59 -0
  15. glaip_sdk/cli/utils.py +372 -213
  16. glaip_sdk/cli/validators.py +235 -0
  17. glaip_sdk/client/__init__.py +3 -224
  18. glaip_sdk/client/agents.py +632 -171
  19. glaip_sdk/client/base.py +66 -4
  20. glaip_sdk/client/main.py +226 -0
  21. glaip_sdk/client/mcps.py +143 -18
  22. glaip_sdk/client/tools.py +327 -104
  23. glaip_sdk/config/constants.py +10 -1
  24. glaip_sdk/models.py +43 -3
  25. glaip_sdk/rich_components.py +29 -0
  26. glaip_sdk/utils/__init__.py +18 -171
  27. glaip_sdk/utils/agent_config.py +181 -0
  28. glaip_sdk/utils/client_utils.py +159 -79
  29. glaip_sdk/utils/display.py +100 -0
  30. glaip_sdk/utils/general.py +94 -0
  31. glaip_sdk/utils/import_export.py +140 -0
  32. glaip_sdk/utils/rendering/formatting.py +6 -1
  33. glaip_sdk/utils/rendering/renderer/__init__.py +67 -8
  34. glaip_sdk/utils/rendering/renderer/base.py +340 -247
  35. glaip_sdk/utils/rendering/renderer/debug.py +3 -2
  36. glaip_sdk/utils/rendering/renderer/panels.py +11 -10
  37. glaip_sdk/utils/rendering/steps.py +1 -1
  38. glaip_sdk/utils/resource_refs.py +192 -0
  39. glaip_sdk/utils/rich_utils.py +29 -0
  40. glaip_sdk/utils/serialization.py +285 -0
  41. glaip_sdk/utils/validation.py +273 -0
  42. {glaip_sdk-0.0.3.dist-info → glaip_sdk-0.0.5.dist-info}/METADATA +6 -5
  43. glaip_sdk-0.0.5.dist-info/RECORD +55 -0
  44. glaip_sdk/cli/commands/init.py +0 -177
  45. glaip_sdk-0.0.3.dist-info/RECORD +0 -40
  46. {glaip_sdk-0.0.3.dist-info → glaip_sdk-0.0.5.dist-info}/WHEEL +0 -0
  47. {glaip_sdk-0.0.3.dist-info → glaip_sdk-0.0.5.dist-info}/entry_points.txt +0 -0
glaip_sdk/__init__.py CHANGED
@@ -1,12 +1,12 @@
1
- """AIP SDK - Python SDK for AI Agent Platform.
1
+ """GL AIP SDK - Python SDK for GDP Labs AI Agent Package.
2
2
 
3
3
  Authors:
4
4
  Raymond Christopher (raymond.christopher@gdplabs.id)
5
5
  """
6
6
 
7
- from ._version import __version__
8
- from .client import Client
9
- from .exceptions import AIPError
10
- from .models import MCP, Agent, Tool
7
+ from glaip_sdk._version import __version__
8
+ from glaip_sdk.client import Client
9
+ from glaip_sdk.exceptions import AIPError
10
+ from glaip_sdk.models import MCP, Agent, Tool
11
11
 
12
12
  __all__ = ["Client", "Agent", "Tool", "MCP", "AIPError", "__version__"]
glaip_sdk/branding.py ADDED
@@ -0,0 +1,146 @@
1
+ """AIP SDK Branding and Visual Identity.
2
+
3
+ Simple, friendly CLI branding for the GL AIP (GDP Labs AI Agent Package) SDK.
4
+
5
+ - Package name: GL AIP (GDP Labs AI Agent Package)
6
+ - Version: auto-detected (AIP_VERSION env or importlib.metadata), or passed in
7
+ - Colors: blue / bright_blue, with NO_COLOR/AIP_NO_COLOR fallbacks
8
+
9
+ Author:
10
+ Raymond Christopher (raymond.christopher@gdplabs.id)
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import os
16
+ import platform
17
+ import sys
18
+
19
+ from rich.console import Console
20
+
21
+ from glaip_sdk.rich_components import AIPPanel
22
+
23
+ try:
24
+ # Python 3.8+ standard way to read installed package version
25
+ from importlib.metadata import PackageNotFoundError
26
+ from importlib.metadata import version as pkg_version
27
+ except Exception: # pragma: no cover
28
+ pkg_version = None
29
+ PackageNotFoundError = Exception
30
+
31
+
32
+ # ---- minimal, readable styles (light blue + white theme) -----------------
33
+ PRIMARY = "bright_blue" # Light blue for main elements
34
+ BORDER = "bright_blue" # Light blue borders
35
+ TITLE_STYLE = f"bold {PRIMARY}"
36
+ LABEL = "bold"
37
+
38
+
39
+ class AIPBranding:
40
+ """GL AIP SDK branding utilities with ASCII banner and version display."""
41
+
42
+ # GL AIP ASCII art - Modern block style with enhanced visibility
43
+ AIP_LOGO = r"""
44
+ ██████╗ ██╗ █████╗ ██╗██████╗
45
+ ██╔════╝ ██║ ██╔══██╗██║██╔══██╗
46
+ ██║ ███╗██║ ███████║██║██████╔╝
47
+ ██║ ██║██║ ██╔══██║██║██╔═══╝
48
+ ╚██████╔╝███████╗ ██║ ██║██║██║
49
+ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝╚═╝╚═╝
50
+ GDP Labs AI Agents Package
51
+ """.strip("\n")
52
+
53
+ def __init__(
54
+ self,
55
+ version: str | None = None,
56
+ package_name: str | None = None,
57
+ ):
58
+ """
59
+ Args:
60
+ version: Explicit SDK version (overrides auto-detection).
61
+ package_name: If set, attempt to read version from installed package.
62
+ """
63
+ self.version = version or self._auto_version(package_name)
64
+ self.console = self._make_console()
65
+
66
+ # ---- small helpers --------------------------------------------------------
67
+ @staticmethod
68
+ def _auto_version(package_name: str | None) -> str:
69
+ # Priority: env → package metadata → fallback
70
+ env_version = os.getenv("AIP_VERSION")
71
+ if env_version:
72
+ return env_version
73
+ if package_name and pkg_version:
74
+ try:
75
+ return pkg_version(package_name)
76
+ except PackageNotFoundError:
77
+ pass
78
+ return "0.0.0"
79
+
80
+ @staticmethod
81
+ def _make_console() -> Console:
82
+ # Respect NO_COLOR/AIP_NO_COLOR environment variables
83
+ no_color_env = (
84
+ os.getenv("NO_COLOR") is not None or os.getenv("AIP_NO_COLOR") is not None
85
+ )
86
+ if no_color_env:
87
+ color_system = None
88
+ no_color = True
89
+ else:
90
+ color_system = "auto"
91
+ no_color = False
92
+ return Console(color_system=color_system, no_color=no_color, soft_wrap=True)
93
+
94
+ # ---- public API -----------------------------------------------------------
95
+ def get_welcome_banner(self) -> str:
96
+ """Get AIP banner with version info."""
97
+ banner = self.AIP_LOGO
98
+ line = f"Version: {self.version}"
99
+ banner = f"{banner}\n{line}"
100
+ return banner
101
+
102
+ def get_version_info(self) -> dict:
103
+ return {
104
+ "version": self.version,
105
+ "python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
106
+ "platform": platform.platform(),
107
+ "architecture": platform.architecture()[0],
108
+ }
109
+
110
+ def display_welcome_panel(self, title: str = "Welcome to AIP") -> None:
111
+ banner = self.get_welcome_banner()
112
+ panel = AIPPanel(
113
+ banner,
114
+ title=f"[{TITLE_STYLE}]{title}[/{TITLE_STYLE}]",
115
+ border_style=BORDER,
116
+ padding=(1, 2),
117
+ )
118
+ self.console.print(panel)
119
+
120
+ def display_version_panel(self) -> None:
121
+ v = self.get_version_info()
122
+ version_text = (
123
+ f"[{TITLE_STYLE}]AIP SDK Version Information[/{TITLE_STYLE}]\n\n"
124
+ f"[{LABEL}]Version:[/] {v['version']}\n"
125
+ f"[{LABEL}]Python:[/] {v['python_version']}\n"
126
+ f"[{LABEL}]Platform:[/] {v['platform']}\n"
127
+ f"[{LABEL}]Architecture:[/] {v['architecture']}"
128
+ )
129
+ panel = AIPPanel(
130
+ version_text,
131
+ title=f"[{TITLE_STYLE}]Version Details[/{TITLE_STYLE}]",
132
+ border_style=BORDER,
133
+ padding=(1, 2),
134
+ )
135
+ self.console.print(panel)
136
+
137
+ def display_status_banner(self, status: str = "ready") -> None:
138
+ # Keep it simple (no emoji); easy to parse in logs/CI
139
+ banner = f"[{LABEL}]AIP[/{LABEL}] - {status.title()}"
140
+ self.console.print(banner)
141
+
142
+ @classmethod
143
+ def create_from_sdk(
144
+ cls, sdk_version: str | None = None, package_name: str | None = None
145
+ ) -> AIPBranding:
146
+ return cls(version=sdk_version, package_name=package_name)
glaip_sdk/cli/__init__.py CHANGED
@@ -4,6 +4,6 @@ Authors:
4
4
  Raymond Christopher (raymond.christopher@gdplabs.id)
5
5
  """
6
6
 
7
- from .main import main
7
+ from glaip_sdk.cli.main import main
8
8
 
9
9
  __all__ = ["main"]
@@ -0,0 +1,82 @@
1
+ """CLI-specific agent configuration utilities.
2
+
3
+ This module provides CLI-only affordances for agent configuration,
4
+ such as merging CLI flags over imported data.
5
+
6
+ Authors:
7
+ Raymond Christopher (raymond.christopher@gdplabs.id)
8
+ """
9
+
10
+ from typing import Any
11
+
12
+ from glaip_sdk.utils.agent_config import (
13
+ resolve_language_model_selection,
14
+ sanitize_agent_config,
15
+ )
16
+ from glaip_sdk.utils.import_export import merge_import_with_cli_args
17
+
18
+
19
+ def merge_agent_config_with_cli_args(
20
+ import_data: dict[str, Any], cli_args: dict[str, Any]
21
+ ) -> dict[str, Any]:
22
+ """Merge imported agent data with CLI arguments, preferring CLI args.
23
+
24
+ This is a CLI-specific wrapper that handles agent-specific merging logic.
25
+
26
+ Args:
27
+ import_data: Data loaded from import file
28
+ cli_args: Arguments passed via CLI
29
+
30
+ Returns:
31
+ Merged data dictionary
32
+
33
+ Notes:
34
+ - CLI arguments take precedence over imported data
35
+ - Handles agent-specific fields like tools and agents arrays
36
+ - Preserves agent configuration structure
37
+ """
38
+ return merge_import_with_cli_args(
39
+ import_data, cli_args, array_fields=["tools", "agents"]
40
+ )
41
+
42
+
43
+ def resolve_agent_language_model_selection(
44
+ merged_data: dict[str, Any], cli_model: str | None
45
+ ) -> tuple[dict[str, Any], bool]:
46
+ """Resolve language model selection for agent creation/update.
47
+
48
+ This is a CLI-specific wrapper around the core LM selection logic.
49
+
50
+ Args:
51
+ merged_data: Merged import data and CLI args
52
+ cli_model: Model specified via CLI --model flag
53
+
54
+ Returns:
55
+ Tuple of (lm_selection_dict, should_strip_lm_identity)
56
+ """
57
+ return resolve_language_model_selection(merged_data, cli_model)
58
+
59
+
60
+ def sanitize_agent_config_for_cli(
61
+ agent_config: dict | None,
62
+ *,
63
+ strip_credentials: bool = True,
64
+ strip_lm_identity: bool = False,
65
+ ) -> dict:
66
+ """Sanitize agent_config for CLI operations.
67
+
68
+ This is a CLI-specific wrapper around the core sanitization logic.
69
+
70
+ Args:
71
+ agent_config: The agent configuration to sanitize
72
+ strip_credentials: Always drop lm_credentials (default: True)
73
+ strip_lm_identity: Also drop lm_provider/lm_name/lm_base_url when True
74
+
75
+ Returns:
76
+ Sanitized agent configuration
77
+ """
78
+ return sanitize_agent_config(
79
+ agent_config,
80
+ strip_credentials=strip_credentials,
81
+ strip_lm_identity=strip_lm_identity,
82
+ )
@@ -1,5 +1,5 @@
1
- """CLI commands package."""
1
+ """CLI commands package exports."""
2
2
 
3
- from . import agents, init, mcps, models, tools
3
+ from glaip_sdk.cli.commands import agents, configure, mcps, models, tools
4
4
 
5
- __all__ = ["agents", "tools", "mcps", "models", "init"]
5
+ __all__ = ["agents", "tools", "mcps", "models", "configure"]