glaip-sdk 0.1.0__py3-none-any.whl → 0.6.10__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 +5 -2
- glaip_sdk/_version.py +10 -3
- glaip_sdk/agents/__init__.py +27 -0
- glaip_sdk/agents/base.py +1191 -0
- glaip_sdk/branding.py +15 -6
- glaip_sdk/cli/account_store.py +540 -0
- glaip_sdk/cli/agent_config.py +2 -6
- glaip_sdk/cli/auth.py +265 -45
- glaip_sdk/cli/commands/__init__.py +2 -2
- glaip_sdk/cli/commands/accounts.py +746 -0
- glaip_sdk/cli/commands/agents.py +251 -173
- glaip_sdk/cli/commands/common_config.py +101 -0
- glaip_sdk/cli/commands/configure.py +735 -143
- glaip_sdk/cli/commands/mcps.py +266 -134
- glaip_sdk/cli/commands/models.py +13 -9
- glaip_sdk/cli/commands/tools.py +67 -88
- glaip_sdk/cli/commands/transcripts.py +755 -0
- glaip_sdk/cli/commands/update.py +3 -8
- glaip_sdk/cli/config.py +49 -7
- 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 +846 -0
- glaip_sdk/cli/core/prompting.py +649 -0
- glaip_sdk/cli/core/rendering.py +187 -0
- glaip_sdk/cli/display.py +45 -32
- glaip_sdk/cli/hints.py +57 -0
- glaip_sdk/cli/io.py +14 -17
- glaip_sdk/cli/main.py +232 -143
- glaip_sdk/cli/masking.py +21 -33
- glaip_sdk/cli/mcp_validators.py +5 -15
- glaip_sdk/cli/pager.py +12 -19
- glaip_sdk/cli/parsers/__init__.py +1 -3
- glaip_sdk/cli/parsers/json_input.py +11 -22
- glaip_sdk/cli/resolution.py +3 -9
- glaip_sdk/cli/rich_helpers.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 +65 -29
- glaip_sdk/cli/slash/prompt.py +24 -10
- glaip_sdk/cli/slash/remote_runs_controller.py +566 -0
- glaip_sdk/cli/slash/session.py +807 -225
- 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 +258 -60
- glaip_sdk/cli/transcript/capture.py +72 -21
- glaip_sdk/cli/transcript/history.py +815 -0
- glaip_sdk/cli/transcript/launcher.py +1 -3
- glaip_sdk/cli/transcript/viewer.py +79 -499
- glaip_sdk/cli/update_notifier.py +177 -24
- glaip_sdk/cli/utils.py +242 -1308
- glaip_sdk/cli/validators.py +16 -18
- glaip_sdk/client/__init__.py +2 -1
- glaip_sdk/client/_agent_payloads.py +53 -37
- glaip_sdk/client/agent_runs.py +147 -0
- glaip_sdk/client/agents.py +320 -92
- glaip_sdk/client/base.py +78 -35
- glaip_sdk/client/main.py +19 -10
- glaip_sdk/client/mcps.py +123 -15
- glaip_sdk/client/run_rendering.py +136 -101
- glaip_sdk/client/shared.py +21 -0
- glaip_sdk/client/tools.py +163 -34
- glaip_sdk/client/validators.py +20 -48
- glaip_sdk/config/constants.py +11 -0
- glaip_sdk/exceptions.py +1 -3
- 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/payload_schemas/agent.py +1 -3
- 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 +115 -0
- glaip_sdk/runner/langgraph.py +706 -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/agent_config.py +4 -14
- glaip_sdk/utils/bundler.py +267 -0
- glaip_sdk/utils/client.py +111 -0
- glaip_sdk/utils/client_utils.py +46 -28
- glaip_sdk/utils/datetime_helpers.py +58 -0
- glaip_sdk/utils/discovery.py +78 -0
- glaip_sdk/utils/display.py +25 -21
- glaip_sdk/utils/export.py +143 -0
- glaip_sdk/utils/general.py +1 -36
- glaip_sdk/utils/import_export.py +15 -16
- 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 +7 -35
- glaip_sdk/utils/rendering/layout/__init__.py +64 -0
- glaip_sdk/utils/rendering/{renderer → layout}/panels.py +10 -3
- glaip_sdk/utils/rendering/{renderer → layout}/progress.py +73 -12
- glaip_sdk/utils/rendering/layout/summary.py +74 -0
- glaip_sdk/utils/rendering/layout/transcript.py +606 -0
- glaip_sdk/utils/rendering/models.py +3 -6
- glaip_sdk/utils/rendering/renderer/__init__.py +9 -49
- glaip_sdk/utils/rendering/renderer/base.py +258 -1577
- glaip_sdk/utils/rendering/renderer/config.py +1 -5
- glaip_sdk/utils/rendering/renderer/debug.py +30 -34
- glaip_sdk/utils/rendering/renderer/factory.py +138 -0
- glaip_sdk/utils/rendering/renderer/stream.py +10 -51
- 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 +1 -3
- 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 +1 -3
- glaip_sdk/utils/rendering/steps/__init__.py +34 -0
- glaip_sdk/utils/rendering/{steps.py → steps/event_processor.py} +76 -517
- 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 +29 -26
- glaip_sdk/utils/runtime_config.py +425 -0
- glaip_sdk/utils/serialization.py +32 -46
- glaip_sdk/utils/sync.py +142 -0
- glaip_sdk/utils/tool_detection.py +33 -0
- glaip_sdk/utils/validation.py +20 -28
- {glaip_sdk-0.1.0.dist-info → glaip_sdk-0.6.10.dist-info}/METADATA +42 -4
- glaip_sdk-0.6.10.dist-info/RECORD +159 -0
- {glaip_sdk-0.1.0.dist-info → glaip_sdk-0.6.10.dist-info}/WHEEL +1 -1
- glaip_sdk/models.py +0 -259
- glaip_sdk-0.1.0.dist-info/RECORD +0 -82
- {glaip_sdk-0.1.0.dist-info → glaip_sdk-0.6.10.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Shared mixin for tracking background asyncio tasks in Textual apps.
|
|
2
|
+
|
|
3
|
+
Authors:
|
|
4
|
+
Raymond Christopher (raymond.christopher@gdplabs.id)
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import asyncio
|
|
10
|
+
import logging
|
|
11
|
+
from collections.abc import Callable, Coroutine
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BackgroundTaskMixin:
|
|
16
|
+
"""Mixin that tracks background tasks and cleans them up on unmount."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
19
|
+
"""Initialize task tracking set for derived Textual apps."""
|
|
20
|
+
super().__init__(*args, **kwargs)
|
|
21
|
+
self._pending_tasks: set[asyncio.Task[Any]] = set()
|
|
22
|
+
|
|
23
|
+
def track_task(
|
|
24
|
+
self,
|
|
25
|
+
coro: Coroutine[Any, Any, Any],
|
|
26
|
+
*,
|
|
27
|
+
on_error: Callable[[Exception], None] | None = None,
|
|
28
|
+
logger: logging.Logger | None = None,
|
|
29
|
+
) -> asyncio.Task[Any]:
|
|
30
|
+
"""Create and track a background task with optional error handling."""
|
|
31
|
+
task = asyncio.create_task(coro)
|
|
32
|
+
self._pending_tasks.add(task)
|
|
33
|
+
|
|
34
|
+
def _cleanup(finished: asyncio.Task[Any]) -> None:
|
|
35
|
+
self._pending_tasks.discard(finished)
|
|
36
|
+
if finished.cancelled():
|
|
37
|
+
return
|
|
38
|
+
try:
|
|
39
|
+
exc = finished.exception()
|
|
40
|
+
except Exception:
|
|
41
|
+
return
|
|
42
|
+
if exc:
|
|
43
|
+
if on_error:
|
|
44
|
+
on_error(exc)
|
|
45
|
+
elif logger:
|
|
46
|
+
logger.debug("Background task failed", exc_info=exc)
|
|
47
|
+
|
|
48
|
+
task.add_done_callback(_cleanup)
|
|
49
|
+
return task
|
|
50
|
+
|
|
51
|
+
def on_unmount(self) -> None: # pragma: no cover - UI lifecycle hook
|
|
52
|
+
"""Ensure background tasks are cleaned up on exit."""
|
|
53
|
+
pending = [task for task in self._pending_tasks if not task.done()]
|
|
54
|
+
for task in pending:
|
|
55
|
+
try:
|
|
56
|
+
task.cancel()
|
|
57
|
+
except Exception:
|
|
58
|
+
continue
|
|
59
|
+
if pending:
|
|
60
|
+
try:
|
|
61
|
+
loop = asyncio.get_running_loop()
|
|
62
|
+
except RuntimeError:
|
|
63
|
+
loop = None
|
|
64
|
+
if loop and loop.is_running():
|
|
65
|
+
try:
|
|
66
|
+
loop.create_task(asyncio.gather(*pending, return_exceptions=True))
|
|
67
|
+
except Exception:
|
|
68
|
+
pass
|
|
69
|
+
self._pending_tasks.clear()
|
|
70
|
+
parent_on_unmount = getattr(super(), "on_unmount", None)
|
|
71
|
+
if callable(parent_on_unmount):
|
|
72
|
+
parent_on_unmount() # type: ignore[misc]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Shared helpers for toggling Textual loading indicators.
|
|
2
|
+
|
|
3
|
+
Note: uses Textual's built-in LoadingIndicator as the MVP; upgrade to the
|
|
4
|
+
PulseIndicator from cli-textual-animated-indicators.md when shipped.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from collections.abc import Callable
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
try: # pragma: no cover - optional dependency
|
|
13
|
+
from textual.widgets import LoadingIndicator
|
|
14
|
+
except Exception: # pragma: no cover - optional dependency
|
|
15
|
+
LoadingIndicator = None # type: ignore[assignment]
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING: # pragma: no cover - type checking aid
|
|
18
|
+
from textual.widgets import LoadingIndicator as _LoadingIndicatorType
|
|
19
|
+
|
|
20
|
+
LoadingIndicator: type[_LoadingIndicatorType] | None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _set_indicator_display(app: object, selector: str, visible: bool) -> None:
|
|
24
|
+
"""Safely toggle a LoadingIndicator's display property."""
|
|
25
|
+
if LoadingIndicator is None:
|
|
26
|
+
return
|
|
27
|
+
try:
|
|
28
|
+
indicator = app.query_one(selector, LoadingIndicator) # type: ignore[arg-type]
|
|
29
|
+
indicator.display = visible
|
|
30
|
+
except Exception:
|
|
31
|
+
# Ignore lookup/rendering errors to keep UI resilient
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def show_loading_indicator(
|
|
36
|
+
app: object,
|
|
37
|
+
selector: str,
|
|
38
|
+
*,
|
|
39
|
+
message: str | None = None,
|
|
40
|
+
set_status: Callable[..., None] | None = None,
|
|
41
|
+
status_style: str = "cyan",
|
|
42
|
+
) -> None:
|
|
43
|
+
"""Show a loading indicator and optionally set a status message."""
|
|
44
|
+
_set_indicator_display(app, selector, True)
|
|
45
|
+
if message and set_status:
|
|
46
|
+
try:
|
|
47
|
+
set_status(message, status_style)
|
|
48
|
+
except TypeError:
|
|
49
|
+
# Fallback for setters that accept only a single arg or kwargs
|
|
50
|
+
try:
|
|
51
|
+
set_status(message)
|
|
52
|
+
except Exception:
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def hide_loading_indicator(app: object, selector: str) -> None:
|
|
57
|
+
"""Hide a loading indicator."""
|
|
58
|
+
_set_indicator_display(app, selector, False)
|