Skip to content

Commit c72f454

Browse files
authored
Dev/0.6.19 (#773)
* Fix TDV document capability inference * Fix OAuth provider endpoint URL handling * update message, oauth improvements CIMD
1 parent 9efd591 commit c72f454

13 files changed

Lines changed: 942 additions & 15 deletions

File tree

src/fast_agent/cli/commands/check_config.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from rich.table import Table
1515

1616
from fast_agent.cli.env_helpers import resolve_environment_dir_option
17+
from fast_agent.cli.update_check import check_for_update_notice, should_run_update_check
1718
from fast_agent.config import resolve_config_search_root
1819
from fast_agent.constants import DEFAULT_ENVIRONMENT_DIR
1920
from fast_agent.core.agent_card_validation import AgentCardScanResult, scan_agent_card_directory
@@ -2147,6 +2148,26 @@ def _context_env_dir(ctx: typer.Context) -> Path | None:
21472148
return None
21482149

21492150

2151+
def _resolve_check_update_notice(
2152+
ctx: typer.Context,
2153+
env_dir: Path | None,
2154+
) -> str | None:
2155+
if ctx.invoked_subcommand is not None:
2156+
return None
2157+
2158+
payload = ctx.obj
2159+
no_update_check = False
2160+
if isinstance(payload, dict):
2161+
raw_no_update_check = payload.get("no_update_check")
2162+
if isinstance(raw_no_update_check, bool):
2163+
no_update_check = raw_no_update_check
2164+
2165+
if not should_run_update_check(disabled=no_update_check):
2166+
return None
2167+
2168+
return check_for_update_notice(environment_dir=env_dir)
2169+
2170+
21502171
@app.command("models")
21512172
def models(
21522173
ctx: typer.Context,
@@ -2223,5 +2244,9 @@ def main(
22232244
else:
22242245
ctx.obj = {"env_dir": env_dir}
22252246

2247+
update_notice = _resolve_check_update_notice(ctx, env_dir)
2248+
if update_notice:
2249+
console.print(update_notice)
2250+
22262251
if ctx.invoked_subcommand is None:
22272252
show_check_summary(env_dir=env_dir)

src/fast_agent/cli/commands/go.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import typer
1111

1212
from fast_agent.cards import service as card_service
13-
from fast_agent.cli.command_support import get_settings_or_exit
13+
from fast_agent.cli.command_support import ensure_context_object, get_settings_or_exit
1414
from fast_agent.cli.env_helpers import resolve_environment_dir_option
1515
from fast_agent.cli.runtime.agent_setup import run_agent_request
1616
from fast_agent.cli.runtime.request_builders import (
@@ -42,6 +42,7 @@
4242
)
4343
from fast_agent.cli.runtime.runner import run_request
4444
from fast_agent.cli.shared_options import CommonAgentOptions
45+
from fast_agent.cli.update_check import check_for_update_notice, should_run_update_check
4546
from fast_agent.constants import FAST_AGENT_SHELL_CHILD_ENV
4647
from fast_agent.paths import resolve_environment_paths
4748

@@ -288,6 +289,29 @@ def _maybe_queue_pack_readme_notice(
288289
)
289290

290291

292+
def _resolve_request_update_notice(
293+
*,
294+
ctx: typer.Context,
295+
request: AgentRunRequest,
296+
environment_dir: Path | None,
297+
) -> str | None:
298+
context_payload = ensure_context_object(ctx)
299+
no_update_check_value = context_payload.get("no_update_check")
300+
no_update_check = no_update_check_value if isinstance(no_update_check_value, bool) else False
301+
302+
if request.noenv:
303+
return None
304+
if not request.is_repl:
305+
return None
306+
if request.quiet:
307+
return None
308+
if not should_run_update_check(
309+
disabled=no_update_check,
310+
):
311+
return None
312+
return check_for_update_notice(environment_dir=environment_dir)
313+
314+
291315
@app.callback(invoke_without_command=True, no_args_is_help=False)
292316
def go(
293317
ctx: typer.Context,
@@ -447,4 +471,15 @@ def go(
447471
watch=watch,
448472
quiet=quiet,
449473
)
474+
475+
update_notice = _resolve_request_update_notice(
476+
ctx=ctx,
477+
request=request,
478+
environment_dir=effective_env_dir,
479+
)
480+
if update_notice and not request.quiet:
481+
from fast_agent.ui.enhanced_prompt import queue_startup_notice
482+
483+
queue_startup_notice(update_notice)
484+
450485
run_request(request)

src/fast_agent/cli/main.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
import typer.main
1010
from typer.core import TyperGroup
1111

12+
from fast_agent.cli.command_support import ensure_context_object
1213
from fast_agent.cli.constants import normalize_resume_flag_args
1314
from fast_agent.cli.display import print_section_header
1415
from fast_agent.cli.env_helpers import resolve_environment_dir_option
1516
from fast_agent.cli.terminal import Application
17+
from fast_agent.cli.update_check import check_for_update_notice, should_run_update_check
1618
from fast_agent.constants import FAST_AGENT_SHELL_CHILD_ENV
1719
from fast_agent.ui.console import console as shared_console
1820

@@ -68,7 +70,7 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> click.Command | None
6870
console = shared_console
6971

7072

71-
def show_welcome() -> None:
73+
def show_welcome(update_notice: str | None = None) -> None:
7274
"""Show a welcome message with available commands, using new styling."""
7375
from importlib.metadata import version
7476

@@ -102,6 +104,10 @@ def show_welcome() -> None:
102104

103105
console.print(table)
104106

107+
if update_notice:
108+
console.print()
109+
console.print(update_notice)
110+
105111
console.print(
106112
"\nVisit [cyan][link=https://fast-agent.ai]fast-agent.ai[/link][/cyan] for more information."
107113
)
@@ -114,6 +120,11 @@ def main(
114120
quiet: bool = typer.Option(False, "--quiet", "-q", help="Disable output"),
115121
color: bool = typer.Option(True, "--color/--no-color", help="Enable/disable color output"),
116122
version: bool = typer.Option(False, "--version", help="Show version and exit"),
123+
no_update_check: bool = typer.Option(
124+
False,
125+
"--no-update-check",
126+
help="Skip checking PyPI for newer fast-agent releases",
127+
),
117128
env: Path | None = typer.Option(
118129
None, "--env", help="Override the base fast-agent environment directory"
119130
),
@@ -130,7 +141,11 @@ def main(
130141
)
131142
raise typer.Exit(1)
132143

133-
resolve_environment_dir_option(ctx, env)
144+
context_payload = ensure_context_object(ctx)
145+
context_payload["no_update_check"] = no_update_check
146+
147+
resolved_env_dir = resolve_environment_dir_option(ctx, env)
148+
context_payload["env_dir"] = resolved_env_dir
134149

135150
application.verbosity = 1 if verbose else 0 if not quiet else -1
136151
if not color:
@@ -141,6 +156,12 @@ def main(
141156
application.console = base_console.__class__(color_system=None)
142157
application.error_console = base_error_console.__class__(color_system=None, stderr=True)
143158

159+
update_notice: str | None = None
160+
if not version and ctx.invoked_subcommand is None and should_run_update_check(
161+
disabled=no_update_check,
162+
):
163+
update_notice = check_for_update_notice(environment_dir=resolved_env_dir)
164+
144165
# Handle version flag
145166
if version:
146167
from importlib.metadata import version as get_version
@@ -154,4 +175,4 @@ def main(
154175

155176
# Show welcome message if no command was invoked
156177
if ctx.invoked_subcommand is None:
157-
show_welcome()
178+
show_welcome(update_notice=update_notice)

0 commit comments

Comments
 (0)