chore(compose): add shared json-file logging config and component labels
Introduce x-logging anchor with json-file driver, size/file caps, and container name tagging so Alloy on puck can reliably tail every service through the Docker socket. Apply to all services and inject MNEMOSYNE_COMPONENT env vars (init/app/mcp/worker) for consistent log attribution both in Loki and via `docker logs`. Also update mnemosyne_integration.md to reflect the shift from per-turn JWTs to long-lived team JWTs for workspace-scoped MCP access.
This commit is contained in:
@@ -32,23 +32,32 @@ from .auth import (
|
||||
)
|
||||
|
||||
|
||||
# ``Context.get_state`` is a synchronous method in FastMCP — it returns the
|
||||
# stored value (``Any``) or ``None`` if the key is absent. Awaiting the
|
||||
# returned value raises ``TypeError: object NoneType can't be used in 'await'
|
||||
# expression`` whenever the value is ``None`` (and is semantically wrong even
|
||||
# when it isn't). These helpers stay ``async def`` so call sites (and their
|
||||
# ``await`` usage) don't have to change, but they call ``get_state``
|
||||
# synchronously.
|
||||
|
||||
|
||||
async def get_mcp_user(ctx: Context | None):
|
||||
if ctx is None:
|
||||
return None
|
||||
return await ctx.get_state(STATE_KEY_USER)
|
||||
return ctx.get_state(STATE_KEY_USER)
|
||||
|
||||
|
||||
async def get_mcp_token(ctx: Context | None):
|
||||
if ctx is None:
|
||||
return None
|
||||
return await ctx.get_state(STATE_KEY_TOKEN)
|
||||
return ctx.get_state(STATE_KEY_TOKEN)
|
||||
|
||||
|
||||
async def get_mcp_claims(ctx: Context | None) -> dict | None:
|
||||
"""Return the JWT claims dict for this request, or None for opaque-token callers."""
|
||||
if ctx is None:
|
||||
return None
|
||||
return await ctx.get_state(STATE_KEY_CLAIMS)
|
||||
return ctx.get_state(STATE_KEY_CLAIMS)
|
||||
|
||||
|
||||
async def get_mcp_resolved_libraries(ctx: Context | None) -> list[str] | None:
|
||||
@@ -68,4 +77,4 @@ async def get_mcp_resolved_libraries(ctx: Context | None) -> list[str] | None:
|
||||
"""
|
||||
if ctx is None:
|
||||
return None
|
||||
return await ctx.get_state(STATE_KEY_RESOLVED_LIBRARIES)
|
||||
return ctx.get_state(STATE_KEY_RESOLVED_LIBRARIES)
|
||||
|
||||
Reference in New Issue
Block a user