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.
Files changed (146) hide show
  1. glaip_sdk/__init__.py +44 -4
  2. glaip_sdk/_version.py +9 -0
  3. glaip_sdk/agents/__init__.py +27 -0
  4. glaip_sdk/agents/base.py +1196 -0
  5. glaip_sdk/branding.py +13 -0
  6. glaip_sdk/cli/account_store.py +540 -0
  7. glaip_sdk/cli/auth.py +254 -15
  8. glaip_sdk/cli/commands/__init__.py +2 -2
  9. glaip_sdk/cli/commands/accounts.py +746 -0
  10. glaip_sdk/cli/commands/agents.py +213 -73
  11. glaip_sdk/cli/commands/common_config.py +104 -0
  12. glaip_sdk/cli/commands/configure.py +729 -113
  13. glaip_sdk/cli/commands/mcps.py +241 -72
  14. glaip_sdk/cli/commands/models.py +11 -5
  15. glaip_sdk/cli/commands/tools.py +49 -57
  16. glaip_sdk/cli/commands/transcripts.py +755 -0
  17. glaip_sdk/cli/config.py +48 -4
  18. glaip_sdk/cli/constants.py +38 -0
  19. glaip_sdk/cli/context.py +8 -0
  20. glaip_sdk/cli/core/__init__.py +79 -0
  21. glaip_sdk/cli/core/context.py +124 -0
  22. glaip_sdk/cli/core/output.py +851 -0
  23. glaip_sdk/cli/core/prompting.py +649 -0
  24. glaip_sdk/cli/core/rendering.py +187 -0
  25. glaip_sdk/cli/display.py +35 -19
  26. glaip_sdk/cli/hints.py +57 -0
  27. glaip_sdk/cli/io.py +6 -3
  28. glaip_sdk/cli/main.py +241 -121
  29. glaip_sdk/cli/masking.py +21 -33
  30. glaip_sdk/cli/pager.py +9 -10
  31. glaip_sdk/cli/parsers/__init__.py +1 -3
  32. glaip_sdk/cli/slash/__init__.py +0 -9
  33. glaip_sdk/cli/slash/accounts_controller.py +578 -0
  34. glaip_sdk/cli/slash/accounts_shared.py +75 -0
  35. glaip_sdk/cli/slash/agent_session.py +62 -21
  36. glaip_sdk/cli/slash/prompt.py +21 -0
  37. glaip_sdk/cli/slash/remote_runs_controller.py +566 -0
  38. glaip_sdk/cli/slash/session.py +771 -140
  39. glaip_sdk/cli/slash/tui/__init__.py +9 -0
  40. glaip_sdk/cli/slash/tui/accounts.tcss +86 -0
  41. glaip_sdk/cli/slash/tui/accounts_app.py +876 -0
  42. glaip_sdk/cli/slash/tui/background_tasks.py +72 -0
  43. glaip_sdk/cli/slash/tui/loading.py +58 -0
  44. glaip_sdk/cli/slash/tui/remote_runs_app.py +628 -0
  45. glaip_sdk/cli/transcript/__init__.py +12 -52
  46. glaip_sdk/cli/transcript/cache.py +255 -44
  47. glaip_sdk/cli/transcript/capture.py +27 -1
  48. glaip_sdk/cli/transcript/history.py +815 -0
  49. glaip_sdk/cli/transcript/viewer.py +72 -499
  50. glaip_sdk/cli/update_notifier.py +14 -5
  51. glaip_sdk/cli/utils.py +243 -1252
  52. glaip_sdk/cli/validators.py +5 -6
  53. glaip_sdk/client/__init__.py +2 -1
  54. glaip_sdk/client/_agent_payloads.py +45 -9
  55. glaip_sdk/client/agent_runs.py +147 -0
  56. glaip_sdk/client/agents.py +291 -35
  57. glaip_sdk/client/base.py +1 -0
  58. glaip_sdk/client/main.py +19 -10
  59. glaip_sdk/client/mcps.py +122 -12
  60. glaip_sdk/client/run_rendering.py +466 -89
  61. glaip_sdk/client/shared.py +21 -0
  62. glaip_sdk/client/tools.py +155 -10
  63. glaip_sdk/config/constants.py +11 -0
  64. glaip_sdk/hitl/__init__.py +15 -0
  65. glaip_sdk/hitl/local.py +151 -0
  66. glaip_sdk/mcps/__init__.py +21 -0
  67. glaip_sdk/mcps/base.py +345 -0
  68. glaip_sdk/models/__init__.py +90 -0
  69. glaip_sdk/models/agent.py +47 -0
  70. glaip_sdk/models/agent_runs.py +116 -0
  71. glaip_sdk/models/common.py +42 -0
  72. glaip_sdk/models/mcp.py +33 -0
  73. glaip_sdk/models/tool.py +33 -0
  74. glaip_sdk/payload_schemas/__init__.py +1 -13
  75. glaip_sdk/registry/__init__.py +55 -0
  76. glaip_sdk/registry/agent.py +164 -0
  77. glaip_sdk/registry/base.py +139 -0
  78. glaip_sdk/registry/mcp.py +253 -0
  79. glaip_sdk/registry/tool.py +232 -0
  80. glaip_sdk/rich_components.py +58 -2
  81. glaip_sdk/runner/__init__.py +59 -0
  82. glaip_sdk/runner/base.py +84 -0
  83. glaip_sdk/runner/deps.py +112 -0
  84. glaip_sdk/runner/langgraph.py +870 -0
  85. glaip_sdk/runner/mcp_adapter/__init__.py +13 -0
  86. glaip_sdk/runner/mcp_adapter/base_mcp_adapter.py +43 -0
  87. glaip_sdk/runner/mcp_adapter/langchain_mcp_adapter.py +257 -0
  88. glaip_sdk/runner/mcp_adapter/mcp_config_builder.py +95 -0
  89. glaip_sdk/runner/tool_adapter/__init__.py +18 -0
  90. glaip_sdk/runner/tool_adapter/base_tool_adapter.py +44 -0
  91. glaip_sdk/runner/tool_adapter/langchain_tool_adapter.py +219 -0
  92. glaip_sdk/tools/__init__.py +22 -0
  93. glaip_sdk/tools/base.py +435 -0
  94. glaip_sdk/utils/__init__.py +58 -12
  95. glaip_sdk/utils/a2a/__init__.py +34 -0
  96. glaip_sdk/utils/a2a/event_processor.py +188 -0
  97. glaip_sdk/utils/bundler.py +267 -0
  98. glaip_sdk/utils/client.py +111 -0
  99. glaip_sdk/utils/client_utils.py +39 -7
  100. glaip_sdk/utils/datetime_helpers.py +58 -0
  101. glaip_sdk/utils/discovery.py +78 -0
  102. glaip_sdk/utils/display.py +23 -15
  103. glaip_sdk/utils/export.py +143 -0
  104. glaip_sdk/utils/general.py +0 -33
  105. glaip_sdk/utils/import_export.py +12 -7
  106. glaip_sdk/utils/import_resolver.py +492 -0
  107. glaip_sdk/utils/instructions.py +101 -0
  108. glaip_sdk/utils/rendering/__init__.py +115 -1
  109. glaip_sdk/utils/rendering/formatting.py +5 -30
  110. glaip_sdk/utils/rendering/layout/__init__.py +64 -0
  111. glaip_sdk/utils/rendering/{renderer → layout}/panels.py +9 -0
  112. glaip_sdk/utils/rendering/{renderer → layout}/progress.py +70 -1
  113. glaip_sdk/utils/rendering/layout/summary.py +74 -0
  114. glaip_sdk/utils/rendering/layout/transcript.py +606 -0
  115. glaip_sdk/utils/rendering/models.py +1 -0
  116. glaip_sdk/utils/rendering/renderer/__init__.py +9 -47
  117. glaip_sdk/utils/rendering/renderer/base.py +275 -1476
  118. glaip_sdk/utils/rendering/renderer/debug.py +26 -20
  119. glaip_sdk/utils/rendering/renderer/factory.py +138 -0
  120. glaip_sdk/utils/rendering/renderer/stream.py +4 -12
  121. glaip_sdk/utils/rendering/renderer/thinking.py +273 -0
  122. glaip_sdk/utils/rendering/renderer/tool_panels.py +442 -0
  123. glaip_sdk/utils/rendering/renderer/transcript_mode.py +162 -0
  124. glaip_sdk/utils/rendering/state.py +204 -0
  125. glaip_sdk/utils/rendering/steps/__init__.py +34 -0
  126. glaip_sdk/utils/rendering/{steps.py → steps/event_processor.py} +53 -440
  127. glaip_sdk/utils/rendering/steps/format.py +176 -0
  128. glaip_sdk/utils/rendering/steps/manager.py +387 -0
  129. glaip_sdk/utils/rendering/timing.py +36 -0
  130. glaip_sdk/utils/rendering/viewer/__init__.py +21 -0
  131. glaip_sdk/utils/rendering/viewer/presenter.py +184 -0
  132. glaip_sdk/utils/resource_refs.py +25 -13
  133. glaip_sdk/utils/runtime_config.py +425 -0
  134. glaip_sdk/utils/serialization.py +18 -0
  135. glaip_sdk/utils/sync.py +142 -0
  136. glaip_sdk/utils/tool_detection.py +33 -0
  137. glaip_sdk/utils/tool_storage_provider.py +140 -0
  138. glaip_sdk/utils/validation.py +16 -24
  139. {glaip_sdk-0.1.3.dist-info → glaip_sdk-0.6.19.dist-info}/METADATA +56 -21
  140. glaip_sdk-0.6.19.dist-info/RECORD +163 -0
  141. {glaip_sdk-0.1.3.dist-info → glaip_sdk-0.6.19.dist-info}/WHEEL +2 -1
  142. glaip_sdk-0.6.19.dist-info/entry_points.txt +2 -0
  143. glaip_sdk-0.6.19.dist-info/top_level.txt +1 -0
  144. glaip_sdk/models.py +0 -240
  145. glaip_sdk-0.1.3.dist-info/RECORD +0 -83
  146. glaip_sdk-0.1.3.dist-info/entry_points.txt +0 -3
@@ -0,0 +1,187 @@
1
+ """CLI rendering utilities: Rich console helpers, viewer launchers, renderer builders.
2
+
3
+ Authors:
4
+ Raymond Christopher (raymond.christopher@gdplabs.id)
5
+ Putu Ravindra Wiguna (putu.r.wiguna@gdplabs.id)
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import os
11
+ import sys
12
+ from contextlib import AbstractContextManager, contextmanager, nullcontext
13
+ from typing import Any
14
+
15
+ from rich.console import Console
16
+
17
+ from glaip_sdk.branding import ACCENT_STYLE
18
+ from glaip_sdk.cli.context import _get_view, get_ctx_value
19
+ from glaip_sdk.utils.rendering.renderer import (
20
+ CapturingConsole,
21
+ RendererFactoryOptions,
22
+ RichStreamRenderer,
23
+ make_default_renderer,
24
+ make_verbose_renderer,
25
+ )
26
+
27
+ # Export console for backward compatibility
28
+ console = Console()
29
+
30
+
31
+ def _can_use_spinner(ctx: Any | None, active_console: Console) -> bool:
32
+ """Check if spinner output is allowed in the current environment."""
33
+ if ctx is not None:
34
+ tty_enabled = bool(get_ctx_value(ctx, "tty", True))
35
+ view = (_get_view(ctx) or "rich").lower()
36
+ if not tty_enabled or view not in {"", "rich"}:
37
+ return False
38
+
39
+ if not active_console.is_terminal:
40
+ return False
41
+
42
+ return _stream_supports_tty(getattr(active_console, "file", None))
43
+
44
+
45
+ def _stream_supports_tty(stream: Any) -> bool:
46
+ """Return True if the provided stream can safely render a spinner."""
47
+ target = stream if hasattr(stream, "isatty") else sys.stdout
48
+ try:
49
+ return bool(target.isatty())
50
+ except Exception:
51
+ return False
52
+
53
+
54
+ def update_spinner(status_indicator: Any | None, message: str) -> None:
55
+ """Update spinner text when a status indicator is active."""
56
+ if status_indicator is None:
57
+ return
58
+
59
+ try:
60
+ status_indicator.update(message)
61
+ except Exception: # pragma: no cover - defensive update
62
+ pass
63
+
64
+
65
+ def stop_spinner(status_indicator: Any | None) -> None:
66
+ """Stop an active spinner safely."""
67
+ if status_indicator is None:
68
+ return
69
+
70
+ try:
71
+ status_indicator.stop()
72
+ except Exception: # pragma: no cover - defensive stop
73
+ pass
74
+
75
+
76
+ # Backwards compatibility aliases for legacy callers
77
+ _spinner_update = update_spinner
78
+ _spinner_stop = stop_spinner
79
+
80
+
81
+ def spinner_context(
82
+ ctx: Any | None,
83
+ message: str,
84
+ *,
85
+ console_override: Console | None = None,
86
+ spinner: str = "dots",
87
+ spinner_style: str = ACCENT_STYLE,
88
+ ) -> AbstractContextManager[Any]:
89
+ """Return a context manager that renders a spinner when appropriate."""
90
+ active_console = console_override or console
91
+ if not _can_use_spinner(ctx, active_console):
92
+ return nullcontext()
93
+
94
+ status = active_console.status(
95
+ message,
96
+ spinner=spinner,
97
+ spinner_style=spinner_style,
98
+ )
99
+
100
+ if not hasattr(status, "__enter__") or not hasattr(status, "__exit__"):
101
+ return nullcontext()
102
+
103
+ return status
104
+
105
+
106
+ def _register_renderer_with_session(ctx: Any, renderer: RichStreamRenderer) -> None:
107
+ """Attach renderer to an active slash session when present."""
108
+ try:
109
+ ctx_obj = getattr(ctx, "obj", None)
110
+ session = ctx_obj.get("_slash_session") if isinstance(ctx_obj, dict) else None
111
+ if session and hasattr(session, "register_active_renderer"):
112
+ session.register_active_renderer(renderer)
113
+ except Exception:
114
+ # Never let session bookkeeping break renderer creation
115
+ pass
116
+
117
+
118
+ def build_renderer(
119
+ _ctx: Any,
120
+ *,
121
+ save_path: str | os.PathLike[str] | None,
122
+ verbose: bool = False,
123
+ _tty_enabled: bool = True,
124
+ live: bool | None = None,
125
+ snapshots: bool | None = None,
126
+ ) -> tuple[RichStreamRenderer, Console | CapturingConsole]:
127
+ """Build renderer and capturing console for CLI commands.
128
+
129
+ Args:
130
+ _ctx: Click context object for CLI operations.
131
+ save_path: Path to save output to (enables capturing console).
132
+ verbose: Whether to enable verbose mode.
133
+ _tty_enabled: Whether TTY is available for interactive features.
134
+ live: Whether to enable live rendering mode (overrides verbose default).
135
+ snapshots: Whether to capture and store snapshots.
136
+
137
+ Returns:
138
+ Tuple of (renderer, capturing_console) for streaming output.
139
+ """
140
+ # Use capturing console if saving output
141
+ working_console = CapturingConsole(console, capture=True) if save_path else console
142
+
143
+ # Configure renderer based on verbose mode and explicit overrides
144
+ live_enabled = bool(live) if live is not None else not verbose
145
+ cfg_overrides = {
146
+ "live": live_enabled,
147
+ "append_finished_snapshots": bool(snapshots) if snapshots is not None else False,
148
+ }
149
+ renderer_console = (
150
+ working_console.original_console if isinstance(working_console, CapturingConsole) else working_console
151
+ )
152
+ factory = make_verbose_renderer if verbose else make_default_renderer
153
+ factory_options = RendererFactoryOptions(
154
+ console=renderer_console,
155
+ cfg_overrides=cfg_overrides,
156
+ verbose=verbose if factory is make_default_renderer else None,
157
+ )
158
+ renderer = factory_options.build(factory)
159
+
160
+ # Link the renderer back to the slash session when running from the palette.
161
+ _register_renderer_with_session(_ctx, renderer)
162
+
163
+ return renderer, working_console
164
+
165
+
166
+ @contextmanager
167
+ def with_client_and_spinner(
168
+ ctx: Any,
169
+ spinner_message: str,
170
+ *,
171
+ console_override: Console | None = None,
172
+ ) -> Any:
173
+ """Context manager for commands that need client and spinner.
174
+
175
+ Args:
176
+ ctx: Click context.
177
+ spinner_message: Message to display in spinner.
178
+ console_override: Optional console override.
179
+
180
+ Yields:
181
+ Client instance.
182
+ """
183
+ from glaip_sdk.cli.core.context import get_client # noqa: PLC0415
184
+
185
+ client = get_client(ctx)
186
+ with spinner_context(ctx, spinner_message, console_override=console_override):
187
+ yield client
glaip_sdk/cli/display.py CHANGED
@@ -16,8 +16,8 @@ from rich.panel import Panel
16
16
  from rich.text import Text
17
17
 
18
18
  from glaip_sdk.branding import ERROR_STYLE, SUCCESS, SUCCESS_STYLE, WARNING_STYLE
19
+ from glaip_sdk.cli.hints import command_hint, format_command_hint, in_slash_mode
19
20
  from glaip_sdk.cli.rich_helpers import markup_text
20
- from glaip_sdk.cli.utils import command_hint, format_command_hint
21
21
  from glaip_sdk.icons import ICON_AGENT, ICON_TOOL
22
22
  from glaip_sdk.rich_components import AIPPanel
23
23
 
@@ -208,6 +208,7 @@ def build_resource_result_data(resource: Any, fields: list[str]) -> dict[str, An
208
208
 
209
209
 
210
210
  def _normalise_field_value(field: str, value: Any) -> Any:
211
+ """Convert special sentinel values into display-friendly text."""
211
212
  if value is _MISSING:
212
213
  return "N/A"
213
214
  if hasattr(value, "_mock_name"):
@@ -303,6 +304,7 @@ def display_agent_run_suggestions(agent: Any) -> Panel:
303
304
  """Return a panel with post-creation suggestions for an agent."""
304
305
  agent_id = getattr(agent, "id", "")
305
306
  agent_name = getattr(agent, "name", "")
307
+ slash_mode = in_slash_mode()
306
308
  run_hint_id = command_hint(
307
309
  f'agents run {agent_id} "Your message here"',
308
310
  slash_command=None,
@@ -312,27 +314,41 @@ def display_agent_run_suggestions(agent: Any) -> Panel:
312
314
  slash_command=None,
313
315
  )
314
316
 
315
- cli_section = ""
316
- if run_hint_id and run_hint_name:
317
- cli_section = (
318
- "📋 Prefer the CLI instead?\n"
319
- f" {format_command_hint(run_hint_id) or run_hint_id}\n"
320
- f" {format_command_hint(run_hint_name) or run_hint_name}\n\n"
317
+ content_parts: list[str] = ["[bold blue]💡 Next Steps:[/bold blue]\n\n"]
318
+
319
+ if slash_mode:
320
+ slash_shortcuts = "\n".join(
321
+ f" {format_command_hint(command, description) or command}"
322
+ for command, description in (
323
+ ("/details", "Show configuration (toggle preview)"),
324
+ ("/help", "Show command palette menu"),
325
+ ("/exit", "Return to the palette"),
326
+ )
327
+ )
328
+ content_parts.append(
329
+ f"🚀 Start chatting with [bold]{agent_name}[/bold] right here:\n"
330
+ f" Type your message below and press Enter to run it immediately.\n\n"
331
+ f"{ICON_TOOL} Slash shortcuts:\n"
332
+ f"{slash_shortcuts}"
333
+ )
334
+ else:
335
+ cli_hint_lines = [format_command_hint(hint) or hint for hint in (run_hint_id, run_hint_name) if hint]
336
+ if cli_hint_lines:
337
+ joined_hints = "\n".join(f" {hint}" for hint in cli_hint_lines)
338
+ content_parts.append(f"🚀 Run this agent from the CLI:\n{joined_hints}\n\n")
339
+ content_parts.append(
340
+ f"{ICON_TOOL} Available options:\n"
341
+ f" [dim]--chat-history[/dim] Include previous conversation\n"
342
+ f" [dim]--file[/dim] Attach files\n"
343
+ f" [dim]--input[/dim] Alternative input method\n"
344
+ f" [dim]--timeout[/dim] Set execution timeout\n"
345
+ f" [dim]--save[/dim] Save transcript to file\n"
346
+ f" [dim]--verbose[/dim] Show detailed execution\n\n"
347
+ f"💡 [dim]Input text can be positional OR use --input flag (both work!)[/dim]"
321
348
  )
322
349
 
323
350
  return AIPPanel(
324
- f"[bold blue]💡 Next Steps:[/bold blue]\n\n"
325
- f"🚀 Start chatting with [bold]{agent_name}[/bold] right here:\n"
326
- f" Type your message below and press Enter to run it immediately.\n\n"
327
- f"{cli_section}"
328
- f"{ICON_TOOL} Available options:\n"
329
- f" [dim]--chat-history[/dim] Include previous conversation\n"
330
- f" [dim]--file[/dim] Attach files\n"
331
- f" [dim]--input[/dim] Alternative input method\n"
332
- f" [dim]--timeout[/dim] Set execution timeout\n"
333
- f" [dim]--save[/dim] Save transcript to file\n"
334
- f" [dim]--verbose[/dim] Show detailed execution\n\n"
335
- f"💡 [dim]Input text can be positional OR use --input flag (both work!)[/dim]",
351
+ "".join(content_parts),
336
352
  title=f"{ICON_AGENT} Ready to Run Agent",
337
353
  border_style="blue",
338
354
  padding=(0, 1),
glaip_sdk/cli/hints.py ADDED
@@ -0,0 +1,57 @@
1
+ """Helpers for formatting CLI/slash command hints.
2
+
3
+ Authors:
4
+ Raymond Christopher (raymond.christopher@gdplabs.id)
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import click
10
+
11
+ from glaip_sdk.branding import HINT_COMMAND_STYLE, HINT_DESCRIPTION_COLOR
12
+
13
+
14
+ def in_slash_mode(ctx: click.Context | None = None) -> bool:
15
+ """Return True when running inside the slash command palette."""
16
+ if ctx is None:
17
+ try:
18
+ ctx = click.get_current_context(silent=True)
19
+ except RuntimeError:
20
+ ctx = None
21
+
22
+ if ctx is None:
23
+ return False
24
+
25
+ obj = getattr(ctx, "obj", None)
26
+ if isinstance(obj, dict):
27
+ return bool(obj.get("_slash_session"))
28
+
29
+ return bool(getattr(obj, "_slash_session", False))
30
+
31
+
32
+ def command_hint(
33
+ cli_command: str | None,
34
+ slash_command: str | None = None,
35
+ *,
36
+ ctx: click.Context | None = None,
37
+ ) -> str | None:
38
+ """Return the appropriate command string for the current mode."""
39
+ if in_slash_mode(ctx):
40
+ if not slash_command:
41
+ return None
42
+ return slash_command if slash_command.startswith("/") else f"/{slash_command}"
43
+
44
+ if not cli_command:
45
+ return None
46
+ return f"aip {cli_command}"
47
+
48
+
49
+ def format_command_hint(command: str | None, description: str | None = None) -> str | None:
50
+ """Return a Rich markup string that highlights a command hint."""
51
+ if not command:
52
+ return None
53
+
54
+ highlighted = f"[{HINT_COMMAND_STYLE}]{command}[/]"
55
+ if description:
56
+ highlighted += f" [{HINT_DESCRIPTION_COLOR}]{description}[/{HINT_DESCRIPTION_COLOR}]"
57
+ return highlighted
glaip_sdk/cli/io.py CHANGED
@@ -7,6 +7,7 @@ Authors:
7
7
  Raymond Christopher (raymond.christopher@gdplabs.id)
8
8
  """
9
9
 
10
+ from importlib import import_module
10
11
  from pathlib import Path
11
12
  from typing import TYPE_CHECKING, Any
12
13
 
@@ -25,9 +26,11 @@ if TYPE_CHECKING: # pragma: no cover - typing-only imports
25
26
 
26
27
  def _create_console() -> "Console":
27
28
  """Return a Console instance (lazy import for easier testing)."""
28
- from rich.console import Console # Local import for test patching
29
-
30
- return Console()
29
+ try:
30
+ console_module = import_module("rich.console")
31
+ except ImportError as exc: # pragma: no cover - optional dependency missing
32
+ raise RuntimeError("Rich Console is not available") from exc
33
+ return console_module.Console()
31
34
 
32
35
 
33
36
  def load_resource_from_file_with_validation(file_path: Path, resource_type: str) -> dict[str, Any]: