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.
- 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.15b3.dist-info}/METADATA +1 -1
- glaip_sdk-0.6.15b3.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.15b3.dist-info}/WHEEL +0 -0
- {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.15b3.dist-info}/entry_points.txt +0 -0
- {glaip_sdk-0.6.15b2.dist-info → glaip_sdk-0.6.15b3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Rendering utilities.
|
|
2
|
+
|
|
3
|
+
Authors:
|
|
4
|
+
Raymond Christopher (raymond.christopher@gdplabs.id)
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from dataclasses import dataclass, field
|
|
10
|
+
from time import monotonic
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(slots=True)
|
|
15
|
+
class Step:
|
|
16
|
+
"""Represents a single execution step in a workflow.
|
|
17
|
+
|
|
18
|
+
A step tracks the execution of tools, delegates, or agents with
|
|
19
|
+
timing information and metadata.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
step_id: str
|
|
23
|
+
kind: str # "tool" | "delegate" | "agent"
|
|
24
|
+
name: str
|
|
25
|
+
status: str = "running"
|
|
26
|
+
args: dict = field(default_factory=dict)
|
|
27
|
+
output: str = ""
|
|
28
|
+
parent_id: str | None = None
|
|
29
|
+
task_id: str | None = None
|
|
30
|
+
context_id: str | None = None
|
|
31
|
+
started_at: float = field(default_factory=monotonic)
|
|
32
|
+
duration_ms: int | None = None
|
|
33
|
+
duration_source: str | None = None
|
|
34
|
+
display_label: str | None = None
|
|
35
|
+
status_icon: str | None = None
|
|
36
|
+
failure_reason: str | None = None
|
|
37
|
+
branch_failed: bool = False
|
|
38
|
+
is_parallel: bool = False
|
|
39
|
+
server_started_at: float | None = None
|
|
40
|
+
server_finished_at: float | None = None
|
|
41
|
+
duration_unknown: bool = False
|
|
42
|
+
metadata: dict[str, Any] = field(default_factory=dict)
|
|
43
|
+
|
|
44
|
+
def finish(self, duration_raw: float | None, *, source: str | None = None) -> None:
|
|
45
|
+
"""Mark the step as finished and calculate duration.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
duration_raw: Raw duration in seconds, or None to calculate from started_at
|
|
49
|
+
source: Optional duration source tag
|
|
50
|
+
"""
|
|
51
|
+
self.duration_unknown = False
|
|
52
|
+
if isinstance(duration_raw, (int, float)) and duration_raw > 0:
|
|
53
|
+
# Use provided duration if it's a positive number (even if very small)
|
|
54
|
+
self.duration_ms = round(float(duration_raw) * 1000)
|
|
55
|
+
self.duration_source = source or self.duration_source or "provided"
|
|
56
|
+
else:
|
|
57
|
+
# Calculate from started_at if duration_raw is None, negative, or zero
|
|
58
|
+
self.duration_ms = int((monotonic() - self.started_at) * 1000)
|
|
59
|
+
self.duration_source = source or self.duration_source or "monotonic"
|
|
60
|
+
self.status = "finished"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@dataclass(slots=True)
|
|
64
|
+
class RunStats:
|
|
65
|
+
"""Statistics for a complete execution run.
|
|
66
|
+
|
|
67
|
+
Tracks timing and resource usage information for workflow executions.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
started_at: float = field(default_factory=monotonic)
|
|
71
|
+
finished_at: float | None = None
|
|
72
|
+
usage: dict[str, Any] = field(default_factory=dict)
|
|
73
|
+
|
|
74
|
+
def stop(self) -> None:
|
|
75
|
+
"""Mark the run as finished and record the end time."""
|
|
76
|
+
self.finished_at = monotonic()
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def duration_s(self) -> float | None:
|
|
80
|
+
"""Get the duration of the run in seconds.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
Duration in seconds if run is finished, None otherwise
|
|
84
|
+
"""
|
|
85
|
+
return None if self.finished_at is None else round(self.finished_at - self.started_at, 2)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Renderer package for modular streaming output.
|
|
2
|
+
|
|
3
|
+
This package provides modular components for rendering agent execution streams,
|
|
4
|
+
with clean separation of concerns between configuration, console handling,
|
|
5
|
+
debug output, panel rendering, progress tracking, and event routing.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
|
|
10
|
+
from glaip_sdk.rich_components import AIPPanel
|
|
11
|
+
from glaip_sdk.utils.rendering.renderer.base import RichStreamRenderer
|
|
12
|
+
from glaip_sdk.utils.rendering.renderer.config import RendererConfig
|
|
13
|
+
from glaip_sdk.utils.rendering.renderer.console import CapturingConsole
|
|
14
|
+
from glaip_sdk.utils.rendering.renderer.factory import (
|
|
15
|
+
RendererFactoryOptions,
|
|
16
|
+
make_default_renderer,
|
|
17
|
+
make_minimal_renderer,
|
|
18
|
+
make_silent_renderer,
|
|
19
|
+
make_verbose_renderer,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def print_panel(
|
|
24
|
+
content: str,
|
|
25
|
+
*,
|
|
26
|
+
title: str | None = None,
|
|
27
|
+
border_style: str = "blue",
|
|
28
|
+
padding: tuple[int, int] = (1, 2),
|
|
29
|
+
console: Console | None = None,
|
|
30
|
+
) -> None:
|
|
31
|
+
"""Print boxed content using Rich without exposing Console/Panel at call site.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
content: The text to display inside the panel.
|
|
35
|
+
title: Optional title for the panel.
|
|
36
|
+
border_style: Rich style string for the border color.
|
|
37
|
+
padding: (vertical, horizontal) padding inside the panel.
|
|
38
|
+
console: Optional Rich Console to print to; created if not provided.
|
|
39
|
+
"""
|
|
40
|
+
c = console or Console()
|
|
41
|
+
c.print(AIPPanel(content, title=title, border_style=border_style, padding=padding))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
# Main classes
|
|
46
|
+
"RichStreamRenderer",
|
|
47
|
+
"RendererConfig",
|
|
48
|
+
"CapturingConsole",
|
|
49
|
+
"RendererFactoryOptions",
|
|
50
|
+
"make_silent_renderer",
|
|
51
|
+
"make_minimal_renderer",
|
|
52
|
+
"make_default_renderer",
|
|
53
|
+
"make_verbose_renderer",
|
|
54
|
+
"print_panel",
|
|
55
|
+
]
|