glaip-sdk 0.6.5b6__py3-none-any.whl → 0.7.12__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 +42 -5
- glaip_sdk/agents/base.py +217 -42
- glaip_sdk/branding.py +113 -2
- glaip_sdk/cli/account_store.py +15 -0
- glaip_sdk/cli/auth.py +14 -8
- glaip_sdk/cli/commands/accounts.py +1 -1
- 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 +15 -12
- glaip_sdk/cli/commands/configure.py +2 -3
- 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 +2 -4
- 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.py → transcripts_original.py} +2 -1
- glaip_sdk/cli/commands/update.py +163 -17
- glaip_sdk/cli/config.py +1 -0
- glaip_sdk/cli/core/output.py +12 -7
- glaip_sdk/cli/entrypoint.py +20 -0
- glaip_sdk/cli/main.py +127 -39
- glaip_sdk/cli/pager.py +3 -3
- glaip_sdk/cli/resolution.py +2 -1
- glaip_sdk/cli/slash/accounts_controller.py +112 -32
- glaip_sdk/cli/slash/agent_session.py +5 -2
- glaip_sdk/cli/slash/prompt.py +11 -0
- glaip_sdk/cli/slash/remote_runs_controller.py +3 -1
- glaip_sdk/cli/slash/session.py +369 -23
- glaip_sdk/cli/slash/tui/__init__.py +26 -1
- glaip_sdk/cli/slash/tui/accounts.tcss +79 -5
- glaip_sdk/cli/slash/tui/accounts_app.py +1027 -88
- glaip_sdk/cli/slash/tui/clipboard.py +195 -0
- glaip_sdk/cli/slash/tui/context.py +87 -0
- glaip_sdk/cli/slash/tui/keybind_registry.py +235 -0
- glaip_sdk/cli/slash/tui/layouts/__init__.py +14 -0
- glaip_sdk/cli/slash/tui/layouts/harlequin.py +160 -0
- glaip_sdk/cli/slash/tui/remote_runs_app.py +119 -12
- glaip_sdk/cli/slash/tui/terminal.py +407 -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 +112 -0
- glaip_sdk/cli/slash/tui/theme/tokens.py +55 -0
- glaip_sdk/cli/slash/tui/toast.py +374 -0
- glaip_sdk/cli/transcript/history.py +1 -1
- glaip_sdk/cli/transcript/viewer.py +5 -3
- glaip_sdk/cli/tui_settings.py +125 -0
- glaip_sdk/cli/update_notifier.py +215 -7
- glaip_sdk/cli/validators.py +1 -1
- glaip_sdk/client/__init__.py +2 -1
- glaip_sdk/client/_schedule_payloads.py +89 -0
- glaip_sdk/client/agents.py +50 -8
- glaip_sdk/client/hitl.py +136 -0
- glaip_sdk/client/main.py +7 -1
- glaip_sdk/client/mcps.py +44 -13
- glaip_sdk/client/payloads/agent/__init__.py +23 -0
- glaip_sdk/client/{_agent_payloads.py → payloads/agent/requests.py} +22 -47
- glaip_sdk/client/payloads/agent/responses.py +43 -0
- glaip_sdk/client/run_rendering.py +414 -3
- glaip_sdk/client/schedules.py +439 -0
- glaip_sdk/client/tools.py +57 -26
- glaip_sdk/guardrails/__init__.py +80 -0
- glaip_sdk/guardrails/serializer.py +89 -0
- 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/models/__init__.py +17 -0
- glaip_sdk/models/agent_runs.py +2 -1
- glaip_sdk/models/schedule.py +224 -0
- glaip_sdk/payload_schemas/agent.py +1 -0
- glaip_sdk/payload_schemas/guardrails.py +34 -0
- glaip_sdk/registry/tool.py +273 -59
- glaip_sdk/runner/__init__.py +20 -3
- glaip_sdk/runner/deps.py +5 -8
- glaip_sdk/runner/langgraph.py +318 -42
- glaip_sdk/runner/logging_config.py +77 -0
- glaip_sdk/runner/mcp_adapter/langchain_mcp_adapter.py +104 -5
- glaip_sdk/runner/tool_adapter/langchain_tool_adapter.py +72 -7
- glaip_sdk/schedules/__init__.py +22 -0
- glaip_sdk/schedules/base.py +291 -0
- glaip_sdk/tools/base.py +67 -14
- glaip_sdk/utils/__init__.py +1 -0
- glaip_sdk/utils/bundler.py +138 -2
- glaip_sdk/utils/import_resolver.py +43 -11
- glaip_sdk/utils/rendering/renderer/base.py +58 -0
- glaip_sdk/utils/runtime_config.py +15 -12
- glaip_sdk/utils/sync.py +31 -11
- glaip_sdk/utils/tool_detection.py +274 -6
- glaip_sdk/utils/tool_storage_provider.py +140 -0
- {glaip_sdk-0.6.5b6.dist-info → glaip_sdk-0.7.12.dist-info}/METADATA +49 -37
- glaip_sdk-0.7.12.dist-info/RECORD +219 -0
- {glaip_sdk-0.6.5b6.dist-info → glaip_sdk-0.7.12.dist-info}/WHEEL +2 -1
- glaip_sdk-0.7.12.dist-info/entry_points.txt +2 -0
- glaip_sdk-0.7.12.dist-info/top_level.txt +1 -0
- glaip_sdk/cli/commands/agents.py +0 -1509
- glaip_sdk/cli/commands/mcps.py +0 -1356
- glaip_sdk/cli/commands/tools.py +0 -576
- glaip_sdk/cli/utils.py +0 -263
- glaip_sdk-0.6.5b6.dist-info/RECORD +0 -159
- glaip_sdk-0.6.5b6.dist-info/entry_points.txt +0 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Update agent command.
|
|
2
|
+
|
|
3
|
+
Authors:
|
|
4
|
+
Raymond Christopher (raymond.christopher@gdplabs.id)
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import click
|
|
12
|
+
|
|
13
|
+
from glaip_sdk.cli.context import output_flags
|
|
14
|
+
from glaip_sdk.cli.display import (
|
|
15
|
+
display_agent_run_suggestions,
|
|
16
|
+
display_update_success,
|
|
17
|
+
handle_json_output,
|
|
18
|
+
handle_rich_output,
|
|
19
|
+
)
|
|
20
|
+
from glaip_sdk.cli.core.context import get_client
|
|
21
|
+
|
|
22
|
+
from ._common import (
|
|
23
|
+
_get_agent_for_update,
|
|
24
|
+
_handle_click_exception_for_json,
|
|
25
|
+
_handle_command_exception,
|
|
26
|
+
_prepare_agent_output,
|
|
27
|
+
_resolve_resources_by_name,
|
|
28
|
+
_split_comma_separated_refs,
|
|
29
|
+
agents_group,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@agents_group.command()
|
|
34
|
+
@click.argument("agent_id")
|
|
35
|
+
@click.option("--name", help="New agent name")
|
|
36
|
+
@click.option("--instruction", help="New instruction")
|
|
37
|
+
@click.option("--tools", multiple=True, help="New tool names or IDs")
|
|
38
|
+
@click.option("--agents", multiple=True, help="New sub-agent names")
|
|
39
|
+
@click.option("--mcps", multiple=True, help="New MCP names or IDs")
|
|
40
|
+
@click.option("--timeout", type=int, help="New timeout value")
|
|
41
|
+
@click.option(
|
|
42
|
+
"--import",
|
|
43
|
+
"import_file",
|
|
44
|
+
type=click.Path(exists=True, dir_okay=False),
|
|
45
|
+
help="Import agent configuration from JSON file",
|
|
46
|
+
)
|
|
47
|
+
@output_flags()
|
|
48
|
+
@click.pass_context
|
|
49
|
+
def update(
|
|
50
|
+
ctx: Any,
|
|
51
|
+
agent_id: str,
|
|
52
|
+
name: str | None,
|
|
53
|
+
instruction: str | None,
|
|
54
|
+
tools: tuple[str, ...] | None,
|
|
55
|
+
agents: tuple[str, ...] | None,
|
|
56
|
+
mcps: tuple[str, ...] | None,
|
|
57
|
+
timeout: float | None,
|
|
58
|
+
import_file: str | None,
|
|
59
|
+
) -> None:
|
|
60
|
+
r"""Update an existing agent.
|
|
61
|
+
|
|
62
|
+
\b
|
|
63
|
+
Examples:
|
|
64
|
+
aip agents update my-agent --instruction "New instruction"
|
|
65
|
+
aip agents update my-agent --import agent.json
|
|
66
|
+
"""
|
|
67
|
+
try:
|
|
68
|
+
client = get_client(ctx)
|
|
69
|
+
tools = _split_comma_separated_refs(tools)
|
|
70
|
+
agents = _split_comma_separated_refs(agents)
|
|
71
|
+
mcps = _split_comma_separated_refs(mcps)
|
|
72
|
+
|
|
73
|
+
has_updates = bool(import_file) or any(
|
|
74
|
+
[
|
|
75
|
+
name is not None,
|
|
76
|
+
instruction is not None,
|
|
77
|
+
bool(tools),
|
|
78
|
+
bool(agents),
|
|
79
|
+
bool(mcps),
|
|
80
|
+
timeout is not None,
|
|
81
|
+
]
|
|
82
|
+
)
|
|
83
|
+
if not has_updates:
|
|
84
|
+
raise click.ClickException("No update fields specified")
|
|
85
|
+
|
|
86
|
+
agent = _get_agent_for_update(client, agent_id)
|
|
87
|
+
|
|
88
|
+
resolved_tools = _resolve_resources_by_name(client, tools, "tool", client.find_tools, "Tool") if tools else None
|
|
89
|
+
resolved_agents = (
|
|
90
|
+
_resolve_resources_by_name(client, agents, "agent", client.find_agents, "Agent") if agents else None
|
|
91
|
+
)
|
|
92
|
+
resolved_mcps = _resolve_resources_by_name(client, mcps, "mcp", client.find_mcps, "MCP") if mcps else None
|
|
93
|
+
|
|
94
|
+
updated_agent = client.agents.update_agent(
|
|
95
|
+
agent.id,
|
|
96
|
+
file=import_file,
|
|
97
|
+
name=name,
|
|
98
|
+
instruction=instruction,
|
|
99
|
+
tools=resolved_tools,
|
|
100
|
+
agents=resolved_agents,
|
|
101
|
+
mcps=resolved_mcps,
|
|
102
|
+
timeout=timeout,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
handle_json_output(ctx, _prepare_agent_output(updated_agent))
|
|
106
|
+
handle_rich_output(ctx, display_update_success("Agent", updated_agent.name))
|
|
107
|
+
handle_rich_output(ctx, display_agent_run_suggestions(updated_agent))
|
|
108
|
+
|
|
109
|
+
except click.ClickException as e:
|
|
110
|
+
_handle_click_exception_for_json(ctx, e)
|
|
111
|
+
except Exception as e:
|
|
112
|
+
_handle_command_exception(ctx, e)
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"""Shared helpers for configuration/account flows."""
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
4
5
|
import logging
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
import click
|
|
5
9
|
from rich.console import Console
|
|
6
10
|
from rich.text import Text
|
|
7
|
-
|
|
8
|
-
from glaip_sdk import Client
|
|
9
11
|
from glaip_sdk.branding import PRIMARY, SUCCESS_STYLE, WARNING_STYLE, AIPBranding
|
|
10
|
-
from glaip_sdk.cli.
|
|
12
|
+
from glaip_sdk.cli.core.output import sdk_version
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING: # pragma: no cover - type checking only
|
|
15
|
+
from glaip_sdk import Client
|
|
11
16
|
|
|
12
17
|
|
|
13
18
|
def render_branding_header(console: Console, rule_text: str) -> None:
|
|
@@ -36,11 +41,10 @@ def check_connection(
|
|
|
36
41
|
console.print("\n🔌 Testing connection...")
|
|
37
42
|
client: Client | None = None
|
|
38
43
|
try:
|
|
39
|
-
# Import lazily
|
|
40
|
-
from
|
|
44
|
+
# Import lazily to avoid pulling in SDK dependencies during CLI startup.
|
|
45
|
+
from glaip_sdk import Client # noqa: PLC0415
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
client = client_module.Client(api_url=api_url, api_key=api_key)
|
|
47
|
+
client = Client(api_url=api_url, api_key=api_key)
|
|
44
48
|
try:
|
|
45
49
|
agents = client.list_agents()
|
|
46
50
|
console.print(Text(f"✅ Connection successful! Found {len(agents)} agents", style=SUCCESS_STYLE))
|
|
@@ -75,11 +79,10 @@ def check_connection_with_reason(
|
|
|
75
79
|
"""Test connectivity and return structured reason."""
|
|
76
80
|
client: Client | None = None
|
|
77
81
|
try:
|
|
78
|
-
# Import lazily
|
|
79
|
-
from
|
|
82
|
+
# Import lazily to avoid pulling in SDK dependencies during CLI startup.
|
|
83
|
+
from glaip_sdk import Client # noqa: PLC0415
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
client = client_module.Client(api_url=api_url, api_key=api_key)
|
|
85
|
+
client = Client(api_url=api_url, api_key=api_key)
|
|
83
86
|
try:
|
|
84
87
|
client.list_agents()
|
|
85
88
|
return True, ""
|
|
@@ -22,15 +22,14 @@ from glaip_sdk.branding import ACCENT_STYLE, ERROR_STYLE, INFO, NEUTRAL, SUCCESS
|
|
|
22
22
|
# Optional import for gitignore support; warn when missing to avoid silent expansion
|
|
23
23
|
try:
|
|
24
24
|
import pathspec # type: ignore[import-untyped] # noqa: PLC0415
|
|
25
|
-
except ImportError:
|
|
25
|
+
except ImportError: # pragma: no cover - optional dependency
|
|
26
26
|
pathspec = None # type: ignore[assignment]
|
|
27
27
|
from glaip_sdk.cli.account_store import get_account_store
|
|
28
28
|
from glaip_sdk.cli.commands.common_config import check_connection, render_branding_header
|
|
29
29
|
from glaip_sdk.cli.config import CONFIG_FILE, load_config, save_config
|
|
30
|
-
from glaip_sdk.cli.hints import format_command_hint
|
|
30
|
+
from glaip_sdk.cli.hints import command_hint, format_command_hint
|
|
31
31
|
from glaip_sdk.cli.masking import mask_api_key_display
|
|
32
32
|
from glaip_sdk.cli.rich_helpers import markup_text
|
|
33
|
-
from glaip_sdk.cli.utils import command_hint
|
|
34
33
|
from glaip_sdk.rich_components import AIPTable
|
|
35
34
|
|
|
36
35
|
console = Console()
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""MCP CLI commands package.
|
|
2
|
+
|
|
3
|
+
This package contains MCP management commands split by operation.
|
|
4
|
+
The package is the canonical import surface.
|
|
5
|
+
|
|
6
|
+
Authors:
|
|
7
|
+
Raymond Christopher (raymond.christopher@gdplabs.id)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# pylint: disable=duplicate-code
|
|
11
|
+
from glaip_sdk.cli.commands.mcps._common import ( # noqa: E402
|
|
12
|
+
mcps_group,
|
|
13
|
+
_resolve_mcp,
|
|
14
|
+
console,
|
|
15
|
+
_load_import_ready_payload,
|
|
16
|
+
_merge_import_payload,
|
|
17
|
+
_strip_server_only_fields,
|
|
18
|
+
_coerce_cli_string,
|
|
19
|
+
_collect_cli_overrides,
|
|
20
|
+
_merge_config_field,
|
|
21
|
+
_merge_auth_field,
|
|
22
|
+
_get_config_transport,
|
|
23
|
+
_generate_update_preview,
|
|
24
|
+
)
|
|
25
|
+
from glaip_sdk.cli.commands.mcps.connect import connect # noqa: E402
|
|
26
|
+
from glaip_sdk.cli.commands.mcps.create import create # noqa: E402
|
|
27
|
+
from glaip_sdk.cli.commands.mcps.delete import delete # noqa: E402
|
|
28
|
+
from glaip_sdk.cli.commands.mcps.get import get # noqa: E402
|
|
29
|
+
from glaip_sdk.cli.commands.mcps.list import list_mcps # noqa: E402
|
|
30
|
+
from glaip_sdk.cli.commands.mcps.tools import list_tools, _get_tools_from_config # noqa: E402
|
|
31
|
+
from glaip_sdk.cli.commands.mcps.update import update # noqa: E402
|
|
32
|
+
|
|
33
|
+
# Import core functions for test compatibility
|
|
34
|
+
from glaip_sdk.cli.core.context import get_client # noqa: E402
|
|
35
|
+
from glaip_sdk.cli.core.output import ( # noqa: E402
|
|
36
|
+
output_list,
|
|
37
|
+
output_result,
|
|
38
|
+
)
|
|
39
|
+
from glaip_sdk.cli.core.rendering import ( # noqa: E402
|
|
40
|
+
spinner_context,
|
|
41
|
+
with_client_and_spinner,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Import validators for test compatibility
|
|
45
|
+
from glaip_sdk.cli.mcp_validators import ( # noqa: E402
|
|
46
|
+
validate_mcp_auth_structure,
|
|
47
|
+
validate_mcp_config_structure,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# Import import/export utilities for test compatibility
|
|
51
|
+
from glaip_sdk.utils.import_export import convert_export_to_import_format # noqa: E402
|
|
52
|
+
from glaip_sdk.cli.io import load_resource_from_file_with_validation # noqa: E402
|
|
53
|
+
|
|
54
|
+
# Import shared formatters for test compatibility
|
|
55
|
+
from glaip_sdk.cli.commands.shared.formatters import ( # noqa: E402
|
|
56
|
+
_format_dict_value,
|
|
57
|
+
_redact_sensitive_dict,
|
|
58
|
+
_is_sensitive_data,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
__all__ = [
|
|
62
|
+
"mcps_group",
|
|
63
|
+
"connect",
|
|
64
|
+
"create",
|
|
65
|
+
"delete",
|
|
66
|
+
"get",
|
|
67
|
+
"list_mcps",
|
|
68
|
+
"list_tools",
|
|
69
|
+
"update",
|
|
70
|
+
"_resolve_mcp",
|
|
71
|
+
"console",
|
|
72
|
+
"_load_import_ready_payload",
|
|
73
|
+
"_merge_import_payload",
|
|
74
|
+
"_strip_server_only_fields",
|
|
75
|
+
"_coerce_cli_string",
|
|
76
|
+
"_collect_cli_overrides",
|
|
77
|
+
"_merge_config_field",
|
|
78
|
+
"_merge_auth_field",
|
|
79
|
+
"_get_config_transport",
|
|
80
|
+
"_generate_update_preview",
|
|
81
|
+
"_get_tools_from_config",
|
|
82
|
+
"_format_dict_value",
|
|
83
|
+
"_redact_sensitive_dict",
|
|
84
|
+
"_is_sensitive_data",
|
|
85
|
+
"get_client",
|
|
86
|
+
"output_list",
|
|
87
|
+
"output_result",
|
|
88
|
+
"spinner_context",
|
|
89
|
+
"with_client_and_spinner",
|
|
90
|
+
"validate_mcp_auth_structure",
|
|
91
|
+
"validate_mcp_config_structure",
|
|
92
|
+
"convert_export_to_import_format",
|
|
93
|
+
"load_resource_from_file_with_validation",
|
|
94
|
+
]
|