glaip-sdk 0.0.20__py3-none-any.whl → 0.7.7__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 +10 -3
- glaip_sdk/agents/__init__.py +27 -0
- glaip_sdk/agents/base.py +1250 -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 +271 -45
- glaip_sdk/cli/commands/__init__.py +2 -2
- glaip_sdk/cli/commands/accounts.py +746 -0
- glaip_sdk/cli/commands/agents/__init__.py +119 -0
- glaip_sdk/cli/commands/agents/_common.py +561 -0
- glaip_sdk/cli/commands/agents/create.py +151 -0
- glaip_sdk/cli/commands/agents/delete.py +64 -0
- glaip_sdk/cli/commands/agents/get.py +89 -0
- glaip_sdk/cli/commands/agents/list.py +129 -0
- glaip_sdk/cli/commands/agents/run.py +264 -0
- glaip_sdk/cli/commands/agents/sync_langflow.py +72 -0
- glaip_sdk/cli/commands/agents/update.py +112 -0
- glaip_sdk/cli/commands/common_config.py +104 -0
- glaip_sdk/cli/commands/configure.py +734 -143
- glaip_sdk/cli/commands/mcps/__init__.py +94 -0
- glaip_sdk/cli/commands/mcps/_common.py +459 -0
- glaip_sdk/cli/commands/mcps/connect.py +82 -0
- glaip_sdk/cli/commands/mcps/create.py +152 -0
- glaip_sdk/cli/commands/mcps/delete.py +73 -0
- glaip_sdk/cli/commands/mcps/get.py +212 -0
- glaip_sdk/cli/commands/mcps/list.py +69 -0
- glaip_sdk/cli/commands/mcps/tools.py +235 -0
- glaip_sdk/cli/commands/mcps/update.py +190 -0
- glaip_sdk/cli/commands/models.py +14 -12
- glaip_sdk/cli/commands/shared/__init__.py +21 -0
- glaip_sdk/cli/commands/shared/formatters.py +91 -0
- glaip_sdk/cli/commands/tools/__init__.py +69 -0
- glaip_sdk/cli/commands/tools/_common.py +80 -0
- glaip_sdk/cli/commands/tools/create.py +228 -0
- glaip_sdk/cli/commands/tools/delete.py +61 -0
- glaip_sdk/cli/commands/tools/get.py +103 -0
- glaip_sdk/cli/commands/tools/list.py +69 -0
- glaip_sdk/cli/commands/tools/script.py +49 -0
- glaip_sdk/cli/commands/tools/update.py +102 -0
- glaip_sdk/cli/commands/transcripts/__init__.py +90 -0
- glaip_sdk/cli/commands/transcripts/_common.py +9 -0
- glaip_sdk/cli/commands/transcripts/clear.py +5 -0
- glaip_sdk/cli/commands/transcripts/detail.py +5 -0
- glaip_sdk/cli/commands/transcripts_original.py +756 -0
- glaip_sdk/cli/commands/update.py +164 -23
- 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 +851 -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/entrypoint.py +20 -0
- glaip_sdk/cli/hints.py +57 -0
- glaip_sdk/cli/io.py +14 -17
- glaip_sdk/cli/main.py +344 -167
- glaip_sdk/cli/masking.py +21 -33
- glaip_sdk/cli/mcp_validators.py +5 -15
- glaip_sdk/cli/pager.py +15 -22
- glaip_sdk/cli/parsers/__init__.py +1 -3
- glaip_sdk/cli/parsers/json_input.py +11 -22
- glaip_sdk/cli/resolution.py +5 -10
- glaip_sdk/cli/rich_helpers.py +1 -3
- glaip_sdk/cli/slash/__init__.py +0 -9
- glaip_sdk/cli/slash/accounts_controller.py +580 -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 +827 -232
- glaip_sdk/cli/slash/tui/__init__.py +34 -0
- glaip_sdk/cli/slash/tui/accounts.tcss +88 -0
- glaip_sdk/cli/slash/tui/accounts_app.py +933 -0
- glaip_sdk/cli/slash/tui/background_tasks.py +72 -0
- glaip_sdk/cli/slash/tui/clipboard.py +147 -0
- glaip_sdk/cli/slash/tui/context.py +59 -0
- glaip_sdk/cli/slash/tui/keybind_registry.py +235 -0
- glaip_sdk/cli/slash/tui/loading.py +58 -0
- glaip_sdk/cli/slash/tui/remote_runs_app.py +628 -0
- glaip_sdk/cli/slash/tui/terminal.py +402 -0
- glaip_sdk/cli/slash/tui/theme/__init__.py +15 -0
- glaip_sdk/cli/slash/tui/theme/catalog.py +79 -0
- glaip_sdk/cli/slash/tui/theme/manager.py +86 -0
- glaip_sdk/cli/slash/tui/theme/tokens.py +55 -0
- glaip_sdk/cli/slash/tui/toast.py +123 -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 -329
- glaip_sdk/cli/update_notifier.py +385 -24
- glaip_sdk/cli/validators.py +16 -18
- glaip_sdk/client/__init__.py +3 -1
- glaip_sdk/client/_schedule_payloads.py +89 -0
- glaip_sdk/client/agent_runs.py +147 -0
- glaip_sdk/client/agents.py +370 -100
- glaip_sdk/client/base.py +78 -35
- glaip_sdk/client/hitl.py +136 -0
- glaip_sdk/client/main.py +25 -10
- glaip_sdk/client/mcps.py +166 -27
- glaip_sdk/client/payloads/agent/__init__.py +23 -0
- glaip_sdk/client/{_agent_payloads.py → payloads/agent/requests.py} +65 -74
- glaip_sdk/client/payloads/agent/responses.py +43 -0
- glaip_sdk/client/run_rendering.py +583 -79
- glaip_sdk/client/schedules.py +439 -0
- glaip_sdk/client/shared.py +21 -0
- glaip_sdk/client/tools.py +214 -56
- glaip_sdk/client/validators.py +20 -48
- glaip_sdk/config/constants.py +11 -0
- glaip_sdk/exceptions.py +1 -3
- glaip_sdk/hitl/__init__.py +48 -0
- glaip_sdk/hitl/base.py +64 -0
- glaip_sdk/hitl/callback.py +43 -0
- glaip_sdk/hitl/local.py +121 -0
- glaip_sdk/hitl/remote.py +523 -0
- glaip_sdk/icons.py +9 -3
- glaip_sdk/mcps/__init__.py +21 -0
- glaip_sdk/mcps/base.py +345 -0
- glaip_sdk/models/__init__.py +107 -0
- glaip_sdk/models/agent.py +47 -0
- glaip_sdk/models/agent_runs.py +117 -0
- glaip_sdk/models/common.py +42 -0
- glaip_sdk/models/mcp.py +33 -0
- glaip_sdk/models/schedule.py +224 -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 +445 -0
- glaip_sdk/rich_components.py +58 -2
- glaip_sdk/runner/__init__.py +76 -0
- glaip_sdk/runner/base.py +84 -0
- glaip_sdk/runner/deps.py +112 -0
- glaip_sdk/runner/langgraph.py +872 -0
- glaip_sdk/runner/logging_config.py +77 -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 +242 -0
- glaip_sdk/schedules/__init__.py +22 -0
- glaip_sdk/schedules/base.py +291 -0
- glaip_sdk/tools/__init__.py +22 -0
- glaip_sdk/tools/base.py +468 -0
- glaip_sdk/utils/__init__.py +59 -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 +403 -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 +524 -0
- glaip_sdk/utils/instructions.py +101 -0
- glaip_sdk/utils/rendering/__init__.py +115 -1
- glaip_sdk/utils/rendering/formatting.py +38 -23
- 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 +18 -8
- glaip_sdk/utils/rendering/renderer/__init__.py +9 -51
- glaip_sdk/utils/rendering/renderer/base.py +534 -882
- glaip_sdk/utils/rendering/renderer/config.py +4 -10
- 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 +13 -54
- 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.py → steps/manager.py} +122 -26
- 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 +162 -0
- glaip_sdk/utils/tool_detection.py +301 -0
- glaip_sdk/utils/tool_storage_provider.py +140 -0
- glaip_sdk/utils/validation.py +20 -28
- {glaip_sdk-0.0.20.dist-info → glaip_sdk-0.7.7.dist-info}/METADATA +78 -23
- glaip_sdk-0.7.7.dist-info/RECORD +213 -0
- {glaip_sdk-0.0.20.dist-info → glaip_sdk-0.7.7.dist-info}/WHEEL +2 -1
- glaip_sdk-0.7.7.dist-info/entry_points.txt +2 -0
- glaip_sdk-0.7.7.dist-info/top_level.txt +1 -0
- glaip_sdk/cli/commands/agents.py +0 -1412
- glaip_sdk/cli/commands/mcps.py +0 -1225
- glaip_sdk/cli/commands/tools.py +0 -597
- glaip_sdk/cli/utils.py +0 -1330
- glaip_sdk/models.py +0 -259
- glaip_sdk-0.0.20.dist-info/RECORD +0 -80
- glaip_sdk-0.0.20.dist-info/entry_points.txt +0 -3
|
@@ -8,8 +8,13 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
import json
|
|
10
10
|
from dataclasses import dataclass
|
|
11
|
+
from io import StringIO
|
|
11
12
|
from typing import Any
|
|
12
13
|
|
|
14
|
+
from rich.console import Console
|
|
15
|
+
|
|
16
|
+
from glaip_sdk.cli.auth import resolve_api_url_from_context
|
|
17
|
+
from glaip_sdk.cli.context import get_ctx_value
|
|
13
18
|
from glaip_sdk.cli.transcript.cache import (
|
|
14
19
|
TranscriptPayload,
|
|
15
20
|
TranscriptStoreResult,
|
|
@@ -18,7 +23,7 @@ from glaip_sdk.cli.transcript.cache import (
|
|
|
18
23
|
from glaip_sdk.cli.transcript.cache import (
|
|
19
24
|
build_payload as build_transcript_payload,
|
|
20
25
|
)
|
|
21
|
-
from glaip_sdk.utils.rendering.
|
|
26
|
+
from glaip_sdk.utils.rendering.layout.progress import format_tool_title
|
|
22
27
|
|
|
23
28
|
|
|
24
29
|
@dataclass(slots=True)
|
|
@@ -65,11 +70,7 @@ def compute_finished_at(renderer: Any) -> float | None:
|
|
|
65
70
|
|
|
66
71
|
if started_at is None:
|
|
67
72
|
stream_processor = getattr(renderer, "stream_processor", None)
|
|
68
|
-
started_at = (
|
|
69
|
-
getattr(stream_processor, "streaming_started_at", None)
|
|
70
|
-
if stream_processor is not None
|
|
71
|
-
else None
|
|
72
|
-
)
|
|
73
|
+
started_at = getattr(stream_processor, "streaming_started_at", None) if stream_processor is not None else None
|
|
73
74
|
if started_at is None or duration is None:
|
|
74
75
|
return None
|
|
75
76
|
try:
|
|
@@ -78,9 +79,7 @@ def compute_finished_at(renderer: Any) -> float | None:
|
|
|
78
79
|
return None
|
|
79
80
|
|
|
80
81
|
|
|
81
|
-
def extract_server_run_id(
|
|
82
|
-
meta: dict[str, Any], events: list[dict[str, Any]]
|
|
83
|
-
) -> str | None:
|
|
82
|
+
def extract_server_run_id(meta: dict[str, Any], events: list[dict[str, Any]]) -> str | None:
|
|
84
83
|
"""Derive a server-side run identifier from renderer metadata."""
|
|
85
84
|
run_id = meta.get("run_id") or meta.get("id")
|
|
86
85
|
if run_id:
|
|
@@ -107,9 +106,7 @@ def _coerce_meta(meta: Any) -> dict[str, Any]:
|
|
|
107
106
|
return {"value": coerce_result_text(meta)}
|
|
108
107
|
|
|
109
108
|
|
|
110
|
-
def register_last_transcript(
|
|
111
|
-
ctx: Any, payload: TranscriptPayload, store_result: TranscriptStoreResult
|
|
112
|
-
) -> None:
|
|
109
|
+
def register_last_transcript(ctx: Any, payload: TranscriptPayload, store_result: TranscriptStoreResult) -> None:
|
|
113
110
|
"""Persist last-run transcript references onto the Click context."""
|
|
114
111
|
ctx_obj = getattr(ctx, "obj", None)
|
|
115
112
|
if not isinstance(ctx_obj, dict):
|
|
@@ -119,6 +116,15 @@ def register_last_transcript(
|
|
|
119
116
|
ctx_obj["_last_transcript_path"] = str(store_result.path)
|
|
120
117
|
|
|
121
118
|
|
|
119
|
+
def _resolve_api_url(ctx: Any) -> str | None:
|
|
120
|
+
"""Resolve API URL from context or account store (CLI/palette ignores env creds)."""
|
|
121
|
+
return resolve_api_url_from_context(
|
|
122
|
+
ctx,
|
|
123
|
+
get_api_url=lambda c: get_ctx_value(c, "api_url"),
|
|
124
|
+
get_account_name=lambda c: get_ctx_value(c, "account_name"),
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
122
128
|
def _extract_step_summaries(renderer: Any) -> list[dict[str, Any]]:
|
|
123
129
|
"""Return lightweight step summaries for the transcript viewer."""
|
|
124
130
|
steps = getattr(renderer, "steps", None)
|
|
@@ -172,6 +178,38 @@ def _format_step_display_name(name: str) -> str:
|
|
|
172
178
|
return name
|
|
173
179
|
|
|
174
180
|
|
|
181
|
+
def _extract_step_summary_lines(renderer: Any) -> list[str]:
|
|
182
|
+
"""Render the live steps summary to plain text lines."""
|
|
183
|
+
if not hasattr(renderer, "_render_steps_text"):
|
|
184
|
+
return []
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
renderable = renderer._render_steps_text()
|
|
188
|
+
except Exception:
|
|
189
|
+
return []
|
|
190
|
+
|
|
191
|
+
buffer = StringIO()
|
|
192
|
+
console = Console(file=buffer, record=True, force_terminal=False, width=120)
|
|
193
|
+
try:
|
|
194
|
+
console.print(renderable)
|
|
195
|
+
except Exception:
|
|
196
|
+
return []
|
|
197
|
+
|
|
198
|
+
text = console.export_text() or buffer.getvalue()
|
|
199
|
+
lines = [line.rstrip() for line in text.splitlines()]
|
|
200
|
+
half = len(lines) // 2
|
|
201
|
+
if half and lines[:half] == lines[half : half * 2]:
|
|
202
|
+
return lines[:half]
|
|
203
|
+
start = 0
|
|
204
|
+
prefixes = ("🤖", "🔧", "💭", "├", "└", "│", "•")
|
|
205
|
+
for idx, line in enumerate(lines):
|
|
206
|
+
if line.lstrip().startswith(prefixes):
|
|
207
|
+
start = idx
|
|
208
|
+
break
|
|
209
|
+
trimmed = lines[start:]
|
|
210
|
+
return [line for line in trimmed if line]
|
|
211
|
+
|
|
212
|
+
|
|
175
213
|
def _collect_renderer_outputs(
|
|
176
214
|
renderer: Any, final_result: Any
|
|
177
215
|
) -> tuple[
|
|
@@ -211,13 +249,23 @@ def _derive_transcript_meta(
|
|
|
211
249
|
if step_summaries:
|
|
212
250
|
meta["transcript_steps"] = step_summaries
|
|
213
251
|
|
|
252
|
+
step_lines = _extract_step_summary_lines(renderer)
|
|
253
|
+
if step_lines:
|
|
254
|
+
meta["transcript_step_lines"] = step_lines
|
|
255
|
+
|
|
214
256
|
stream_processor = getattr(renderer, "stream_processor", None)
|
|
215
257
|
stream_started_at = (
|
|
216
|
-
getattr(stream_processor, "streaming_started_at", None)
|
|
217
|
-
if stream_processor is not None
|
|
218
|
-
else None
|
|
258
|
+
getattr(stream_processor, "streaming_started_at", None) if stream_processor is not None else None
|
|
219
259
|
)
|
|
220
260
|
finished_at = compute_finished_at(renderer)
|
|
261
|
+
state = getattr(renderer, "state", None)
|
|
262
|
+
if state is not None:
|
|
263
|
+
duration_hint = getattr(state, "final_duration_seconds", None)
|
|
264
|
+
if duration_hint is not None:
|
|
265
|
+
try:
|
|
266
|
+
meta["final_duration_seconds"] = float(duration_hint)
|
|
267
|
+
except Exception:
|
|
268
|
+
pass
|
|
221
269
|
model_name = meta.get("model") or model
|
|
222
270
|
return meta, stream_started_at, finished_at, model_name
|
|
223
271
|
|
|
@@ -236,16 +284,19 @@ def store_transcript_for_session(
|
|
|
236
284
|
if not hasattr(renderer, "get_transcript_events"):
|
|
237
285
|
return None
|
|
238
286
|
|
|
239
|
-
events, aggregated_output, final_output = _collect_renderer_outputs(
|
|
240
|
-
renderer, final_result
|
|
241
|
-
)
|
|
287
|
+
events, aggregated_output, final_output = _collect_renderer_outputs(renderer, final_result)
|
|
242
288
|
|
|
243
289
|
if not (events or aggregated_output or final_output):
|
|
244
290
|
return None
|
|
245
291
|
|
|
246
|
-
meta, stream_started_at, finished_at, model_name = _derive_transcript_meta(
|
|
247
|
-
|
|
248
|
-
|
|
292
|
+
meta, stream_started_at, finished_at, model_name = _derive_transcript_meta(renderer, model)
|
|
293
|
+
|
|
294
|
+
try:
|
|
295
|
+
api_url = _resolve_api_url(ctx)
|
|
296
|
+
except Exception:
|
|
297
|
+
api_url = None
|
|
298
|
+
if api_url:
|
|
299
|
+
meta["api_url"] = api_url
|
|
249
300
|
|
|
250
301
|
payload: TranscriptPayload = build_transcript_payload(
|
|
251
302
|
events=events,
|