@aws/nx-plugin-mcp 1.0.0-rc.78 → 1.0.0-rc.79

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.
@@ -468,6 +468,7 @@ Let's take a look at some of the files in detail:
468
468
  from contextlib import contextmanager
469
469
 
470
470
  from strands import Agent, tool
471
+ from strands.hooks import HookCallback, HookProvider
471
472
  from strands_tools import current_time
472
473
  from dungeon_adventure_agent_connection import log_model_errors, log_tool_errors
473
474
 
@@ -477,6 +478,9 @@ def subtract(a: int, b: int) -> int:
477
478
  return a - b
478
479
 
479
480
 
481
+ AGENT_HOOKS: list[HookProvider | HookCallback] = [log_model_errors, log_tool_errors]
482
+
483
+
480
484
  @contextmanager
481
485
  def get_agent():
482
486
  yield Agent(
@@ -488,7 +492,7 @@ Use your tools for mathematical tasks.
488
492
  Refer to tools as your 'spellbook'.
489
493
  """,
490
494
  tools=[subtract, current_time],
491
- hooks=[log_model_errors, log_tool_errors],
495
+ hooks=AGENT_HOOKS,
492
496
  )
493
497
  ```
494
498
 
@@ -531,7 +535,7 @@ from fastapi import FastAPI, Request
531
535
  from fastapi.middleware.cors import CORSMiddleware
532
536
  from fastapi.responses import StreamingResponse
533
537
 
534
- from .agent import get_agent
538
+ from .agent import AGENT_HOOKS, get_agent
535
539
  from .middleware.session_id_middleware import SESSION_ID_HEADER, SessionIdMiddleware
536
540
  from .session import get_session_manager
537
541
 
@@ -548,6 +552,10 @@ async def lifespan(app: FastAPI):
548
552
  # A per-thread session manager, not the template Agent's own, since
549
553
  # AG-UI caches one Strands agent per thread_id.
550
554
  config=StrandsAgentConfig(session_manager_provider=lambda _input_data: get_session_manager()),
555
+ # Required as well as on the template Agent: AG-UI keeps only the
556
+ # built HookRegistry, so hooks it can't read back are never
557
+ # registered and model/tool failures go unreported.
558
+ hooks=AGENT_HOOKS,
551
559
  )
552
560
  yield
553
561
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin-mcp",
3
- "version": "1.0.0-rc.78",
3
+ "version": "1.0.0-rc.79",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",