glaip-sdk 0.1.3__py3-none-any.whl → 0.6.19__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/__init__.py +44 -4
- glaip_sdk/_version.py +9 -0
- glaip_sdk/agents/__init__.py +27 -0
- glaip_sdk/agents/base.py +1196 -0
- glaip_sdk/branding.py +13 -0
- glaip_sdk/cli/account_store.py +540 -0
- glaip_sdk/cli/auth.py +254 -15
- glaip_sdk/cli/commands/__init__.py +2 -2
- glaip_sdk/cli/commands/accounts.py +746 -0
- glaip_sdk/cli/commands/agents.py +213 -73
- glaip_sdk/cli/commands/common_config.py +104 -0
- glaip_sdk/cli/commands/configure.py +729 -113
- glaip_sdk/cli/commands/mcps.py +241 -72
- glaip_sdk/cli/commands/models.py +11 -5
- glaip_sdk/cli/commands/tools.py +49 -57
- glaip_sdk/cli/commands/transcripts.py +755 -0
- glaip_sdk/cli/config.py +48 -4
- glaip_sdk/cli/constants.py +38 -0
- glaip_sdk/cli/context.py +8 -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 +35 -19
- glaip_sdk/cli/hints.py +57 -0
- glaip_sdk/cli/io.py +6 -3
- glaip_sdk/cli/main.py +241 -121
- glaip_sdk/cli/masking.py +21 -33
- glaip_sdk/cli/pager.py +9 -10
- glaip_sdk/cli/parsers/__init__.py +1 -3
- glaip_sdk/cli/slash/__init__.py +0 -9
- 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 +62 -21
- glaip_sdk/cli/slash/prompt.py +21 -0
- glaip_sdk/cli/slash/remote_runs_controller.py +566 -0
- glaip_sdk/cli/slash/session.py +771 -140
- glaip_sdk/cli/slash/tui/__init__.py +9 -0
- glaip_sdk/cli/slash/tui/accounts.tcss +86 -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 +12 -52
- glaip_sdk/cli/transcript/cache.py +255 -44
- glaip_sdk/cli/transcript/capture.py +27 -1
- glaip_sdk/cli/transcript/history.py +815 -0
- glaip_sdk/cli/transcript/viewer.py +72 -499
- glaip_sdk/cli/update_notifier.py +14 -5
- glaip_sdk/cli/utils.py +243 -1252
- glaip_sdk/cli/validators.py +5 -6
- glaip_sdk/client/__init__.py +2 -1
- glaip_sdk/client/_agent_payloads.py +45 -9
- glaip_sdk/client/agent_runs.py +147 -0
- glaip_sdk/client/agents.py +291 -35
- glaip_sdk/client/base.py +1 -0
- glaip_sdk/client/main.py +19 -10
- glaip_sdk/client/mcps.py +122 -12
- glaip_sdk/client/run_rendering.py +466 -89
- glaip_sdk/client/shared.py +21 -0
- glaip_sdk/client/tools.py +155 -10
- glaip_sdk/config/constants.py +11 -0
- glaip_sdk/hitl/__init__.py +15 -0
- glaip_sdk/hitl/local.py +151 -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 +1 -13
- 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/rich_components.py +58 -2
- 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 +870 -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 +58 -12
- glaip_sdk/utils/a2a/__init__.py +34 -0
- glaip_sdk/utils/a2a/event_processor.py +188 -0
- glaip_sdk/utils/bundler.py +267 -0
- glaip_sdk/utils/client.py +111 -0
- glaip_sdk/utils/client_utils.py +39 -7
- glaip_sdk/utils/datetime_helpers.py +58 -0
- glaip_sdk/utils/discovery.py +78 -0
- glaip_sdk/utils/display.py +23 -15
- glaip_sdk/utils/export.py +143 -0
- glaip_sdk/utils/general.py +0 -33
- glaip_sdk/utils/import_export.py +12 -7
- glaip_sdk/utils/import_resolver.py +492 -0
- glaip_sdk/utils/instructions.py +101 -0
- glaip_sdk/utils/rendering/__init__.py +115 -1
- glaip_sdk/utils/rendering/formatting.py +5 -30
- glaip_sdk/utils/rendering/layout/__init__.py +64 -0
- glaip_sdk/utils/rendering/{renderer → layout}/panels.py +9 -0
- glaip_sdk/utils/rendering/{renderer → layout}/progress.py +70 -1
- glaip_sdk/utils/rendering/layout/summary.py +74 -0
- glaip_sdk/utils/rendering/layout/transcript.py +606 -0
- glaip_sdk/utils/rendering/models.py +1 -0
- glaip_sdk/utils/rendering/renderer/__init__.py +9 -47
- glaip_sdk/utils/rendering/renderer/base.py +275 -1476
- glaip_sdk/utils/rendering/renderer/debug.py +26 -20
- glaip_sdk/utils/rendering/renderer/factory.py +138 -0
- glaip_sdk/utils/rendering/renderer/stream.py +4 -12
- glaip_sdk/utils/rendering/renderer/thinking.py +273 -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/steps/__init__.py +34 -0
- glaip_sdk/utils/rendering/{steps.py → steps/event_processor.py} +53 -440
- 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 +25 -13
- glaip_sdk/utils/runtime_config.py +425 -0
- glaip_sdk/utils/serialization.py +18 -0
- glaip_sdk/utils/sync.py +142 -0
- glaip_sdk/utils/tool_detection.py +33 -0
- glaip_sdk/utils/tool_storage_provider.py +140 -0
- glaip_sdk/utils/validation.py +16 -24
- {glaip_sdk-0.1.3.dist-info → glaip_sdk-0.6.19.dist-info}/METADATA +56 -21
- glaip_sdk-0.6.19.dist-info/RECORD +163 -0
- {glaip_sdk-0.1.3.dist-info → glaip_sdk-0.6.19.dist-info}/WHEEL +2 -1
- glaip_sdk-0.6.19.dist-info/entry_points.txt +2 -0
- glaip_sdk-0.6.19.dist-info/top_level.txt +1 -0
- glaip_sdk/models.py +0 -240
- glaip_sdk-0.1.3.dist-info/RECORD +0 -83
- glaip_sdk-0.1.3.dist-info/entry_points.txt +0 -3
glaip_sdk/cli/masking.py
CHANGED
|
@@ -6,9 +6,10 @@ Authors:
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
-
import os
|
|
10
9
|
from typing import Any
|
|
11
10
|
|
|
11
|
+
from glaip_sdk.cli.constants import MASK_SENSITIVE_FIELDS, MASKING_ENABLED
|
|
12
|
+
|
|
12
13
|
__all__ = [
|
|
13
14
|
"mask_payload",
|
|
14
15
|
"mask_rows",
|
|
@@ -16,20 +17,9 @@ __all__ = [
|
|
|
16
17
|
"_mask_any",
|
|
17
18
|
"_maybe_mask_row",
|
|
18
19
|
"_resolve_mask_fields",
|
|
20
|
+
"mask_api_key_display",
|
|
19
21
|
]
|
|
20
22
|
|
|
21
|
-
_DEFAULT_MASK_FIELDS = {
|
|
22
|
-
"api_key",
|
|
23
|
-
"apikey",
|
|
24
|
-
"token",
|
|
25
|
-
"access_token",
|
|
26
|
-
"secret",
|
|
27
|
-
"client_secret",
|
|
28
|
-
"password",
|
|
29
|
-
"private_key",
|
|
30
|
-
"bearer",
|
|
31
|
-
}
|
|
32
|
-
|
|
33
23
|
|
|
34
24
|
def _mask_value(raw: Any) -> str:
|
|
35
25
|
"""Return a masked representation of the provided value.
|
|
@@ -90,22 +80,10 @@ def _maybe_mask_row(row: dict[str, Any], mask_fields: set[str]) -> dict[str, Any
|
|
|
90
80
|
|
|
91
81
|
|
|
92
82
|
def _resolve_mask_fields() -> set[str]:
|
|
93
|
-
"""
|
|
94
|
-
|
|
95
|
-
Returns:
|
|
96
|
-
set[str]: Set of field names to mask. Empty set if masking is disabled
|
|
97
|
-
via AIP_MASK_OFF environment variable, custom fields from
|
|
98
|
-
AIP_MASK_FIELDS, or default fields if neither is set.
|
|
99
|
-
"""
|
|
100
|
-
if os.getenv("AIP_MASK_OFF", "0") in {"1", "true", "on", "yes"}:
|
|
83
|
+
"""Return the configured set of fields that should be masked."""
|
|
84
|
+
if not MASKING_ENABLED:
|
|
101
85
|
return set()
|
|
102
|
-
|
|
103
|
-
env_fields = (os.getenv("AIP_MASK_FIELDS") or "").strip()
|
|
104
|
-
if env_fields:
|
|
105
|
-
parts = [part.strip().lower() for part in env_fields.split(",") if part.strip()]
|
|
106
|
-
return set(parts)
|
|
107
|
-
|
|
108
|
-
return set(_DEFAULT_MASK_FIELDS)
|
|
86
|
+
return set(MASK_SENSITIVE_FIELDS)
|
|
109
87
|
|
|
110
88
|
|
|
111
89
|
def mask_payload(payload: Any) -> Any:
|
|
@@ -115,9 +93,7 @@ def mask_payload(payload: Any) -> Any:
|
|
|
115
93
|
payload: Any data structure (dict, list, or primitive) to mask.
|
|
116
94
|
|
|
117
95
|
Returns:
|
|
118
|
-
Any: The payload with sensitive fields masked based on
|
|
119
|
-
configuration. Returns original payload if masking is disabled
|
|
120
|
-
or if an error occurs during masking.
|
|
96
|
+
Any: The payload with sensitive fields masked based on configuration.
|
|
121
97
|
"""
|
|
122
98
|
mask_fields = _resolve_mask_fields()
|
|
123
99
|
if not mask_fields:
|
|
@@ -136,8 +112,8 @@ def mask_rows(rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
136
112
|
|
|
137
113
|
Returns:
|
|
138
114
|
list[dict[str, Any]]: List of rows with sensitive fields masked based
|
|
139
|
-
on
|
|
140
|
-
|
|
115
|
+
on configuration. Returns original rows if
|
|
116
|
+
masking is disabled or if an error occurs.
|
|
141
117
|
"""
|
|
142
118
|
mask_fields = _resolve_mask_fields()
|
|
143
119
|
if not mask_fields:
|
|
@@ -146,3 +122,15 @@ def mask_rows(rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
146
122
|
return [_maybe_mask_row(row, mask_fields) for row in rows]
|
|
147
123
|
except Exception:
|
|
148
124
|
return rows
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def mask_api_key_display(value: str | None) -> str:
|
|
128
|
+
"""Mask API keys for CLI display while preserving readability for short keys."""
|
|
129
|
+
if not value:
|
|
130
|
+
return ""
|
|
131
|
+
length = len(value)
|
|
132
|
+
if length <= 4:
|
|
133
|
+
return "***"
|
|
134
|
+
if length <= 8:
|
|
135
|
+
return value[:1] + "••••" + value[-1:]
|
|
136
|
+
return value[:4] + "••••" + value[-4:]
|
glaip_sdk/cli/pager.py
CHANGED
|
@@ -19,6 +19,8 @@ from typing import Any
|
|
|
19
19
|
|
|
20
20
|
from rich.console import Console
|
|
21
21
|
|
|
22
|
+
from glaip_sdk.cli.constants import PAGER_HEADER_ENABLED, PAGER_MODE, PAGER_WRAP_LINES
|
|
23
|
+
|
|
22
24
|
__all__ = [
|
|
23
25
|
"console",
|
|
24
26
|
"_prepare_pager_env",
|
|
@@ -64,8 +66,7 @@ def _prepare_pager_env(clear_on_exit: bool = True) -> None:
|
|
|
64
66
|
-R : pass ANSI color escapes
|
|
65
67
|
-S : chop long lines (horizontal scroll with ←/→)
|
|
66
68
|
(No -F, no -X) so we open a full-screen pager and clear on exit.
|
|
67
|
-
Toggle wrapping
|
|
68
|
-
Power users can override via AIP_LESS_FLAGS.
|
|
69
|
+
Toggle wrapping via `PAGER_WRAP_LINES` (True drops -S).
|
|
69
70
|
|
|
70
71
|
Args:
|
|
71
72
|
clear_on_exit: Whether to clear the pager on exit (default: True)
|
|
@@ -75,10 +76,9 @@ def _prepare_pager_env(clear_on_exit: bool = True) -> None:
|
|
|
75
76
|
"""
|
|
76
77
|
os.environ.pop("LESSSECURE", None)
|
|
77
78
|
if os.getenv("LESS") is None:
|
|
78
|
-
|
|
79
|
-
base = "-R" if want_wrap else "-RS"
|
|
79
|
+
base = "-R" if PAGER_WRAP_LINES else "-RS"
|
|
80
80
|
default_flags = base if clear_on_exit else (base + "FX")
|
|
81
|
-
os.environ["LESS"] =
|
|
81
|
+
os.environ["LESS"] = default_flags
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
def _render_ansi(renderable: Any) -> str:
|
|
@@ -111,8 +111,7 @@ def _pager_header() -> str:
|
|
|
111
111
|
Returns:
|
|
112
112
|
str: Header text containing navigation help, or empty string if disabled
|
|
113
113
|
"""
|
|
114
|
-
|
|
115
|
-
if v in {"0", "false", "off"}:
|
|
114
|
+
if not PAGER_HEADER_ENABLED:
|
|
116
115
|
return ""
|
|
117
116
|
return "\n".join(
|
|
118
117
|
[
|
|
@@ -254,10 +253,10 @@ def _should_page_output(row_count: int, is_tty: bool) -> bool:
|
|
|
254
253
|
bool: True if output should be paginated, False otherwise
|
|
255
254
|
"""
|
|
256
255
|
active_console = _get_console()
|
|
257
|
-
|
|
258
|
-
if
|
|
256
|
+
pager_mode = (PAGER_MODE or "auto").lower()
|
|
257
|
+
if pager_mode in ("0", "off", "false"):
|
|
259
258
|
return False
|
|
260
|
-
if
|
|
259
|
+
if pager_mode in ("1", "on", "true"):
|
|
261
260
|
return is_tty
|
|
262
261
|
try:
|
|
263
262
|
term_h = active_console.size.height or 24
|
glaip_sdk/cli/slash/__init__.py
CHANGED
|
@@ -6,19 +6,10 @@ Authors:
|
|
|
6
6
|
|
|
7
7
|
from glaip_sdk.cli.commands.agents import get as agents_get_command
|
|
8
8
|
from glaip_sdk.cli.commands.agents import run as agents_run_command
|
|
9
|
-
from glaip_sdk.cli.commands.configure import configure_command, load_config
|
|
10
|
-
from glaip_sdk.cli.slash.agent_session import AgentRunSession
|
|
11
|
-
from glaip_sdk.cli.slash.prompt import _HAS_PROMPT_TOOLKIT
|
|
12
9
|
from glaip_sdk.cli.slash.session import SlashSession
|
|
13
|
-
from glaip_sdk.cli.utils import get_client
|
|
14
10
|
|
|
15
11
|
__all__ = [
|
|
16
|
-
"AgentRunSession",
|
|
17
12
|
"SlashSession",
|
|
18
|
-
"_HAS_PROMPT_TOOLKIT",
|
|
19
13
|
"agents_get_command",
|
|
20
14
|
"agents_run_command",
|
|
21
|
-
"configure_command",
|
|
22
|
-
"get_client",
|
|
23
|
-
"load_config",
|
|
24
15
|
]
|