Skip to content

Commit dd484ac

Browse files
committed
feat: introduce middleware priority and update default priorities for adapters and logging middleware.
1 parent 84f8412 commit dd484ac

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.13.3] - 2026-03-24
8+
## [0.14.0] - 2026-03-24
99

1010
### Added
1111
- **Middleware priority**`Middleware` base class now accepts `priority: int` (0-1000, default 0). Higher priority executes first; equal priority preserves registration order. `BeforeMiddleware` and `AfterMiddleware` adapters also accept `priority`.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "apcore"
7-
version = "0.13.3"
7+
version = "0.14.0"
88
description = "Schema-driven module standard for AI-perceivable interfaces"
99
readme = "README.md"
1010
requires-python = ">=3.11"

src/apcore/middleware/adapters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class BeforeMiddleware(Middleware):
1313
"""Wraps a before-only callback function as a Middleware instance."""
1414

1515
def __init__(
16-
self, callback: Callable[[str, dict[str, Any], Context], dict[str, Any] | None], *, priority: int = 0
16+
self, callback: Callable[[str, dict[str, Any], Context], dict[str, Any] | None], *, priority: int = 100
1717
) -> None:
1818
"""Store the callback for delegation."""
1919
super().__init__(priority=priority)
@@ -31,7 +31,7 @@ def __init__(
3131
self,
3232
callback: Callable[[str, dict[str, Any], dict[str, Any], Context], dict[str, Any] | None],
3333
*,
34-
priority: int = 0,
34+
priority: int = 100,
3535
) -> None:
3636
"""Store the callback for delegation."""
3737
super().__init__(priority=priority)

src/apcore/middleware/logging.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(
2727
log_outputs: bool = True,
2828
log_errors: bool = True,
2929
) -> None:
30+
super().__init__(priority=700)
3031
self._logger = logger or logging.getLogger("apcore.middleware.logging")
3132
self._log_inputs = log_inputs
3233
self._log_outputs = log_outputs

0 commit comments

Comments
 (0)